From 63f80d9837b4dcb16e9fafc3b07fac36f6f7b00d Mon Sep 17 00:00:00 2001 From: vsv Date: Thu, 3 Nov 2016 12:51:35 +0300 Subject: [PATCH] Issue #1834: Fix length of lines --- src/SketchAPI/SketchAPI_Arc.cpp | 45 ++--- src/SketchAPI/SketchAPI_Arc.h | 30 ++- src/SketchAPI/SketchAPI_Circle.h | 21 +- src/SketchAPI/SketchAPI_Constraint.cpp | 4 +- src/SketchAPI/SketchAPI_Constraint.h | 1 + src/SketchAPI/SketchAPI_IntersectionPoint.cpp | 4 +- src/SketchAPI/SketchAPI_IntersectionPoint.h | 7 +- src/SketchAPI/SketchAPI_Line.cpp | 1 + src/SketchAPI/SketchAPI_Line.h | 10 +- src/SketchAPI/SketchAPI_Mirror.cpp | 1 + src/SketchAPI/SketchAPI_Mirror.h | 13 +- src/SketchAPI/SketchAPI_Point.cpp | 1 + src/SketchAPI/SketchAPI_Point.h | 7 +- src/SketchAPI/SketchAPI_Projection.cpp | 1 + src/SketchAPI/SketchAPI_Projection.h | 10 +- src/SketchAPI/SketchAPI_Rectangle.cpp | 1 + src/SketchAPI/SketchAPI_Rectangle.h | 1 + src/SketchAPI/SketchAPI_Rotation.cpp | 1 + src/SketchAPI/SketchAPI_Rotation.h | 22 ++- src/SketchAPI/SketchAPI_Sketch.cpp | 180 +++++++++++------- src/SketchAPI/SketchAPI_Sketch.h | 28 ++- src/SketchAPI/SketchAPI_SketchEntity.cpp | 4 +- src/SketchAPI/SketchAPI_SketchEntity.h | 1 + src/SketchAPI/SketchAPI_Translation.cpp | 1 + src/SketchAPI/SketchAPI_Translation.h | 22 ++- src/SketcherPrs/SketcherPrs_Angle.cpp | 38 ++-- src/SketcherPrs/SketcherPrs_Angle.h | 6 +- src/SketcherPrs/SketcherPrs_Coincident.cpp | 7 +- src/SketcherPrs/SketcherPrs_Coincident.h | 9 +- src/SketcherPrs/SketcherPrs_Collinear.cpp | 18 +- .../SketcherPrs_DimensionStyleListener.cpp | 9 +- src/SketcherPrs/SketcherPrs_Equal.cpp | 18 +- src/SketcherPrs/SketcherPrs_Factory.cpp | 12 +- src/SketcherPrs/SketcherPrs_HVDirection.cpp | 9 +- .../SketcherPrs_LengthDimension.cpp | 9 +- src/SketcherPrs/SketcherPrs_LengthDimension.h | 15 +- src/SketcherPrs/SketcherPrs_Middle.cpp | 24 ++- src/SketcherPrs/SketcherPrs_Mirror.cpp | 27 ++- src/SketcherPrs/SketcherPrs_Parallel.cpp | 18 +- src/SketcherPrs/SketcherPrs_Perpendicular.cpp | 20 +- src/SketcherPrs/SketcherPrs_PositionMgr.cpp | 6 +- src/SketcherPrs/SketcherPrs_Radius.cpp | 10 +- src/SketcherPrs/SketcherPrs_Radius.h | 6 +- src/SketcherPrs/SketcherPrs_Rigid.cpp | 14 +- .../SketcherPrs_SensitivePoint.cpp | 6 +- src/SketcherPrs/SketcherPrs_SensitivePoint.h | 7 +- src/SketcherPrs/SketcherPrs_SymbolPrs.cpp | 64 ++++--- src/SketcherPrs/SketcherPrs_SymbolPrs.h | 18 +- src/SketcherPrs/SketcherPrs_Tangent.cpp | 18 +- src/SketcherPrs/SketcherPrs_Tools.cpp | 15 +- src/SketcherPrs/SketcherPrs_Tools.h | 7 +- .../SketcherPrs_Transformation.cpp | 24 ++- 52 files changed, 548 insertions(+), 303 deletions(-) diff --git a/src/SketchAPI/SketchAPI_Arc.cpp b/src/SketchAPI/SketchAPI_Arc.cpp index 628e43238..8428bf784 100644 --- a/src/SketchAPI/SketchAPI_Arc.cpp +++ b/src/SketchAPI/SketchAPI_Arc.cpp @@ -13,14 +13,14 @@ #include #include -//================================================================================================== +//================================================================================================ 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, @@ -29,11 +29,12 @@ SketchAPI_Arc::SketchAPI_Arc(const std::shared_ptr& theFeature : SketchAPI_SketchEntity(theFeature) { if(initialize()) { - setByCenterStartEnd(theCenterX, theCenterY, theStartX, theStartY, theEndX, theEndY, theInversed); + 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, @@ -46,7 +47,7 @@ SketchAPI_Arc::SketchAPI_Arc(const std::shared_ptr& theFeature } } -//================================================================================================== +//================================================================================================ SketchAPI_Arc::SketchAPI_Arc(const std::shared_ptr& theFeature, double theStartX, double theStartY, double theEndX, double theEndY, @@ -58,7 +59,7 @@ SketchAPI_Arc::SketchAPI_Arc(const std::shared_ptr& theFeature } } -//================================================================================================== +//=============================================================================================== SketchAPI_Arc::SketchAPI_Arc(const std::shared_ptr& theFeature, const std::shared_ptr& theStart, const std::shared_ptr& theEnd, @@ -70,7 +71,7 @@ SketchAPI_Arc::SketchAPI_Arc(const std::shared_ptr& theFeature } } -//================================================================================================== +//================================================================================================ SketchAPI_Arc::SketchAPI_Arc(const std::shared_ptr& theFeature, const ModelHighAPI_RefAttr& theTangentPoint, double theEndX, double theEndY, @@ -82,7 +83,7 @@ SketchAPI_Arc::SketchAPI_Arc(const std::shared_ptr& theFeature } } -//================================================================================================== +//================================================================================================ SketchAPI_Arc::SketchAPI_Arc(const std::shared_ptr& theFeature, const ModelHighAPI_RefAttr& theTangentPoint, const std::shared_ptr& theEnd, @@ -94,7 +95,7 @@ SketchAPI_Arc::SketchAPI_Arc(const std::shared_ptr& theFeature } } -//================================================================================================== +//================================================================================================ SketchAPI_Arc::SketchAPI_Arc(const std::shared_ptr& theFeature, const ModelHighAPI_Selection& theExternal) : SketchAPI_SketchEntity(theFeature) @@ -104,7 +105,7 @@ SketchAPI_Arc::SketchAPI_Arc(const std::shared_ptr& theFeature } } -//================================================================================================== +//================================================================================================ SketchAPI_Arc::SketchAPI_Arc(const std::shared_ptr& theFeature, const std::string& theExternalName) : SketchAPI_SketchEntity(theFeature) @@ -114,13 +115,13 @@ SketchAPI_Arc::SketchAPI_Arc(const std::shared_ptr& theFeature } } -//================================================================================================== +//================================================================================================ SketchAPI_Arc::~SketchAPI_Arc() { } -//================================================================================================== +//================================================================================================ void SketchAPI_Arc::setByCenterStartEnd(double theCenterX, double theCenterY, double theStartX, double theStartY, double theEndX, double theEndY, @@ -135,7 +136,7 @@ void SketchAPI_Arc::setByCenterStartEnd(double theCenterX, double theCenterY, execute(); } -//================================================================================================== +//================================================================================================ void SketchAPI_Arc::setByCenterStartEnd(const std::shared_ptr& theCenter, const std::shared_ptr& theStart, const std::shared_ptr& theEnd, @@ -150,7 +151,7 @@ void SketchAPI_Arc::setByCenterStartEnd(const std::shared_ptr& th execute(); } -//================================================================================================== +//================================================================================================ void SketchAPI_Arc::setByStartEndPassed(double theStartX, double theStartY, double theEndX, double theEndY, double thePassedX, double thePassedY) @@ -163,7 +164,7 @@ void SketchAPI_Arc::setByStartEndPassed(double theStartX, double theStartY, execute(); } -//================================================================================================== +//================================================================================================ void SketchAPI_Arc::setByStartEndPassed(const std::shared_ptr& theStart, const std::shared_ptr& theEnd, const std::shared_ptr& thePassed) @@ -176,7 +177,7 @@ void SketchAPI_Arc::setByStartEndPassed(const std::shared_ptr& th execute(); } -//================================================================================================== +//================================================================================================ void SketchAPI_Arc::setByTangent(const ModelHighAPI_RefAttr& theTangentPoint, double theEndX, double theEndY, bool theInversed) @@ -189,7 +190,7 @@ void SketchAPI_Arc::setByTangent(const ModelHighAPI_RefAttr& theTangentPoint, execute(); } -//================================================================================================== +//================================================================================================ void SketchAPI_Arc::setByTangent(const ModelHighAPI_RefAttr& theTangentPoint, const std::shared_ptr& theEnd, bool theInversed) @@ -202,7 +203,7 @@ void SketchAPI_Arc::setByTangent(const ModelHighAPI_RefAttr& theTangentPoint, execute(); } -//================================================================================================== +//================================================================================================ void SketchAPI_Arc::setByExternal(const ModelHighAPI_Selection & theExternal) { fillAttribute(theExternal, external()); @@ -210,7 +211,7 @@ void SketchAPI_Arc::setByExternal(const ModelHighAPI_Selection & theExternal) execute(); } -//================================================================================================== +//=============================================================================================== void SketchAPI_Arc::setByExternalName(const std::string & theExternalName) { fillAttribute(ModelHighAPI_Selection("EDGE", theExternalName), external()); @@ -218,7 +219,7 @@ void SketchAPI_Arc::setByExternalName(const std::string & theExternalName) execute(); } -//================================================================================================== +//=============================================================================================== void SketchAPI_Arc::setRadius(double theRadius) { fillAttribute(ModelHighAPI_Double(theRadius), myradius); @@ -226,7 +227,7 @@ void SketchAPI_Arc::setRadius(double theRadius) execute(); } -//================================================================================================== +//================================================================================================ void SketchAPI_Arc::setAngle(double theAngle) { fillAttribute(ModelHighAPI_Double(theAngle), myangle); @@ -234,7 +235,7 @@ void SketchAPI_Arc::setAngle(double theAngle) execute(); } -//================================================================================================== +//================================================================================================ void SketchAPI_Arc::dump(ModelHighAPI_Dumper& theDumper) const { if (isCopy()) diff --git a/src/SketchAPI/SketchAPI_Arc.h b/src/SketchAPI/SketchAPI_Arc.h index 92f24fb3e..c1d302377 100644 --- a/src/SketchAPI/SketchAPI_Arc.h +++ b/src/SketchAPI/SketchAPI_Arc.h @@ -86,16 +86,26 @@ public: virtual ~SketchAPI_Arc(); INTERFACE_10(SketchPlugin_Arc::ID(), - arcType, SketchPlugin_Arc::ARC_TYPE(), ModelAPI_AttributeString, /** Arc type */, - 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 */, - inversed, SketchPlugin_Arc::INVERSED_ID(), ModelAPI_AttributeBoolean, /** Inversed flag */, - passedPoint, SketchPlugin_Arc::PASSED_POINT_ID(), GeomDataAPI_Point2D, /** Passed point */, - tangentPoint, SketchPlugin_Arc::TANGENT_POINT_ID(), ModelAPI_AttributeRefAttr, /** Tangent point */, - radius, SketchPlugin_Arc::RADIUS_ID(), ModelAPI_AttributeDouble, /** Radius */, - angle, SketchPlugin_Arc::ANGLE_ID(), ModelAPI_AttributeDouble, /** Angle */, - external, SketchPlugin_Arc::EXTERNAL_ID(), ModelAPI_AttributeSelection, /** External */) + arcType, SketchPlugin_Arc::ARC_TYPE(), + ModelAPI_AttributeString, /** Arc type */, + 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 */, + inversed, SketchPlugin_Arc::INVERSED_ID(), + ModelAPI_AttributeBoolean, /** Inversed flag */, + passedPoint, SketchPlugin_Arc::PASSED_POINT_ID(), + GeomDataAPI_Point2D, /** Passed point */, + tangentPoint, SketchPlugin_Arc::TANGENT_POINT_ID(), + ModelAPI_AttributeRefAttr, /** Tangent point */, + 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 diff --git a/src/SketchAPI/SketchAPI_Circle.h b/src/SketchAPI/SketchAPI_Circle.h index 3c10b00c1..99e0aefc1 100644 --- a/src/SketchAPI/SketchAPI_Circle.h +++ b/src/SketchAPI/SketchAPI_Circle.h @@ -66,13 +66,20 @@ public: virtual ~SketchAPI_Circle(); INTERFACE_7(SketchPlugin_Circle::ID(), - circleType, SketchPlugin_Circle::CIRCLE_TYPE(), ModelAPI_AttributeString, /** Circle type */, - center, SketchPlugin_Circle::CENTER_ID(), GeomDataAPI_Point2D, /** Center point */, - radius, SketchPlugin_Circle::RADIUS_ID(), ModelAPI_AttributeDouble, /** Radius */, - firstPoint, SketchPlugin_Circle::FIRST_POINT_ID(), GeomDataAPI_Point2D, /** First point */, - secondPoint, SketchPlugin_Circle::SECOND_POINT_ID(), GeomDataAPI_Point2D, /** Second point */, - thirdPoint, SketchPlugin_Circle::THIRD_POINT_ID(), GeomDataAPI_Point2D, /** Third point */, - external, SketchPlugin_Circle::EXTERNAL_ID(), ModelAPI_AttributeSelection, /** External */) + circleType, SketchPlugin_Circle::CIRCLE_TYPE(), + ModelAPI_AttributeString, /** Circle type */, + center, SketchPlugin_Circle::CENTER_ID(), + GeomDataAPI_Point2D, /** Center point */, + radius, SketchPlugin_Circle::RADIUS_ID(), + ModelAPI_AttributeDouble, /** Radius */, + firstPoint, SketchPlugin_Circle::FIRST_POINT_ID(), + GeomDataAPI_Point2D, /** First point */, + secondPoint, SketchPlugin_Circle::SECOND_POINT_ID(), + GeomDataAPI_Point2D, /** Second point */, + thirdPoint, SketchPlugin_Circle::THIRD_POINT_ID(), + GeomDataAPI_Point2D, /** Third point */, + external, SketchPlugin_Circle::EXTERNAL_ID(), + ModelAPI_AttributeSelection, /** External */) /// Set by center and radius. SKETCHAPI_EXPORT diff --git a/src/SketchAPI/SketchAPI_Constraint.cpp b/src/SketchAPI/SketchAPI_Constraint.cpp index 6ed3e193f..d8ca207c4 100644 --- a/src/SketchAPI/SketchAPI_Constraint.cpp +++ b/src/SketchAPI/SketchAPI_Constraint.cpp @@ -1,3 +1,4 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D // Name : SketchAPI_Constraint.cpp // Purpose: // @@ -139,7 +140,8 @@ void SketchAPI_Constraint::dump(ModelHighAPI_Dumper& theDumper) const FeaturePtr aFeature = ModelAPI_Feature::feature(aRefAttr->object()); if (!aFeature) return; - AttributeSelectionPtr aAttr = aFeature->data()->selection(SketchPlugin_SketchEntity::EXTERNAL_ID()); + AttributeSelectionPtr aAttr = + aFeature->data()->selection(SketchPlugin_SketchEntity::EXTERNAL_ID()); if (aAttr && aAttr->context().get() != NULL && !aAttr->isInvalid()) return; } diff --git a/src/SketchAPI/SketchAPI_Constraint.h b/src/SketchAPI/SketchAPI_Constraint.h index 2f8765251..488563116 100644 --- a/src/SketchAPI/SketchAPI_Constraint.h +++ b/src/SketchAPI/SketchAPI_Constraint.h @@ -1,3 +1,4 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D // Name : SketchAPI_Constraint.h // Purpose: // diff --git a/src/SketchAPI/SketchAPI_IntersectionPoint.cpp b/src/SketchAPI/SketchAPI_IntersectionPoint.cpp index ce33717b1..7723dc240 100644 --- a/src/SketchAPI/SketchAPI_IntersectionPoint.cpp +++ b/src/SketchAPI/SketchAPI_IntersectionPoint.cpp @@ -1,3 +1,4 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D // Name : SketchAPI_IntersectionPoint.cpp // Purpose: // @@ -68,7 +69,8 @@ void SketchAPI_IntersectionPoint::dump(ModelHighAPI_Dumper& theDumper) const const std::string& aSketchName = theDumper.parentName(aBase); AttributeSelectionPtr aLine = externalLine(); - theDumper << aBase << " = " << aSketchName << ".addIntersectionPoint(" << aLine << ")" << std::endl; + theDumper << aBase << " = " << + aSketchName << ".addIntersectionPoint(" << aLine << ")" << std::endl; // dump "auxiliary" flag if necessary SketchAPI_SketchEntity::dump(theDumper); } diff --git a/src/SketchAPI/SketchAPI_IntersectionPoint.h b/src/SketchAPI/SketchAPI_IntersectionPoint.h index 4460f3df5..4d0b52c86 100644 --- a/src/SketchAPI/SketchAPI_IntersectionPoint.h +++ b/src/SketchAPI/SketchAPI_IntersectionPoint.h @@ -1,3 +1,4 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D // Name : SketchAPI_IntersectionPoint.h // Purpose: // @@ -39,8 +40,10 @@ public: virtual ~SketchAPI_IntersectionPoint(); INTERFACE_2(SketchPlugin_IntersectionPoint::ID(), - coordinates, SketchPlugin_IntersectionPoint::COORD_ID(), GeomDataAPI_Point2D, /** IntersectionPoint coordinates */, - externalLine, SketchPlugin_IntersectionPoint::EXTERNAL_LINE_ID(), ModelAPI_AttributeSelection, /** External line */ + coordinates, SketchPlugin_IntersectionPoint::COORD_ID(), + GeomDataAPI_Point2D, /** IntersectionPoint coordinates */, + externalLine, SketchPlugin_IntersectionPoint::EXTERNAL_LINE_ID(), + ModelAPI_AttributeSelection, /** External line */ ) /// Set by external diff --git a/src/SketchAPI/SketchAPI_Line.cpp b/src/SketchAPI/SketchAPI_Line.cpp index 1e5a2da04..b1ea975ee 100644 --- a/src/SketchAPI/SketchAPI_Line.cpp +++ b/src/SketchAPI/SketchAPI_Line.cpp @@ -1,3 +1,4 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D // Name : SketchAPI_Line.cpp // Purpose: // diff --git a/src/SketchAPI/SketchAPI_Line.h b/src/SketchAPI/SketchAPI_Line.h index 23f904240..beec3cb87 100644 --- a/src/SketchAPI/SketchAPI_Line.h +++ b/src/SketchAPI/SketchAPI_Line.h @@ -1,3 +1,4 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D // Name : SketchAPI_Line.h // Purpose: // @@ -50,9 +51,12 @@ public: 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(), ModelAPI_AttributeSelection, /** External */ + 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 */ ) /// Set by coordinates diff --git a/src/SketchAPI/SketchAPI_Mirror.cpp b/src/SketchAPI/SketchAPI_Mirror.cpp index 0039dffb8..38c814fd8 100644 --- a/src/SketchAPI/SketchAPI_Mirror.cpp +++ b/src/SketchAPI/SketchAPI_Mirror.cpp @@ -1,3 +1,4 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D // Name : SketchAPI_Mirror.cpp // Purpose: // diff --git a/src/SketchAPI/SketchAPI_Mirror.h b/src/SketchAPI/SketchAPI_Mirror.h index 4de2f172f..4c00c3684 100644 --- a/src/SketchAPI/SketchAPI_Mirror.h +++ b/src/SketchAPI/SketchAPI_Mirror.h @@ -1,3 +1,4 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D // Name : SketchAPI_Mirror.h // Purpose: // @@ -40,10 +41,14 @@ public: 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(), ModelAPI_AttributeRefList, /** Reference objects */, - mirroredObjects, SketchPlugin_ConstraintMirror::ENTITY_C(), ModelAPI_AttributeRefList, /** Mirrored objects */ + 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 */ ) /// List of mirrored objects diff --git a/src/SketchAPI/SketchAPI_Point.cpp b/src/SketchAPI/SketchAPI_Point.cpp index 346ae4442..2c8820a53 100644 --- a/src/SketchAPI/SketchAPI_Point.cpp +++ b/src/SketchAPI/SketchAPI_Point.cpp @@ -1,3 +1,4 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D // Name : SketchAPI_Point.cpp // Purpose: // diff --git a/src/SketchAPI/SketchAPI_Point.h b/src/SketchAPI/SketchAPI_Point.h index a680aacc6..42d9da930 100644 --- a/src/SketchAPI/SketchAPI_Point.h +++ b/src/SketchAPI/SketchAPI_Point.h @@ -1,3 +1,4 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D // Name : SketchAPI_Point.h // Purpose: // @@ -49,8 +50,10 @@ public: virtual ~SketchAPI_Point(); INTERFACE_2(SketchPlugin_Point::ID(), - coordinates, SketchPlugin_Point::COORD_ID(), GeomDataAPI_Point2D, /** Point coordinates */, - external, SketchPlugin_Point::EXTERNAL_ID(), ModelAPI_AttributeSelection, /** External */ + coordinates, SketchPlugin_Point::COORD_ID(), + GeomDataAPI_Point2D, /** Point coordinates */, + external, SketchPlugin_Point::EXTERNAL_ID(), + ModelAPI_AttributeSelection, /** External */ ) /// Set by coordinates diff --git a/src/SketchAPI/SketchAPI_Projection.cpp b/src/SketchAPI/SketchAPI_Projection.cpp index b0bb46b55..0c5c7f0be 100644 --- a/src/SketchAPI/SketchAPI_Projection.cpp +++ b/src/SketchAPI/SketchAPI_Projection.cpp @@ -1,3 +1,4 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D // Name : SketchAPI_Projection.cpp // Purpose: // diff --git a/src/SketchAPI/SketchAPI_Projection.h b/src/SketchAPI/SketchAPI_Projection.h index 4a573843b..3906f60b7 100644 --- a/src/SketchAPI/SketchAPI_Projection.h +++ b/src/SketchAPI/SketchAPI_Projection.h @@ -1,3 +1,4 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D // Name : SketchAPI_Projection.h // Purpose: // @@ -39,9 +40,12 @@ public: virtual ~SketchAPI_Projection(); INTERFACE_3(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 */ + 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 */ ) /// Set external feature diff --git a/src/SketchAPI/SketchAPI_Rectangle.cpp b/src/SketchAPI/SketchAPI_Rectangle.cpp index 3da59f0ff..88e5d5b22 100644 --- a/src/SketchAPI/SketchAPI_Rectangle.cpp +++ b/src/SketchAPI/SketchAPI_Rectangle.cpp @@ -1,3 +1,4 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D // Name : SketchAPI_Rectangle.cpp // Purpose: // diff --git a/src/SketchAPI/SketchAPI_Rectangle.h b/src/SketchAPI/SketchAPI_Rectangle.h index 455d33bdf..8aeda2a98 100644 --- a/src/SketchAPI/SketchAPI_Rectangle.h +++ b/src/SketchAPI/SketchAPI_Rectangle.h @@ -1,3 +1,4 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D // Name : SketchAPI_Rectangle.h // Purpose: // diff --git a/src/SketchAPI/SketchAPI_Rotation.cpp b/src/SketchAPI/SketchAPI_Rotation.cpp index 57fd4bf15..ea2cea1de 100644 --- a/src/SketchAPI/SketchAPI_Rotation.cpp +++ b/src/SketchAPI/SketchAPI_Rotation.cpp @@ -1,3 +1,4 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D // Name : SketchAPI_Rotation.cpp // Purpose: // diff --git a/src/SketchAPI/SketchAPI_Rotation.h b/src/SketchAPI/SketchAPI_Rotation.h index 2f58d7760..2deebb565 100644 --- a/src/SketchAPI/SketchAPI_Rotation.h +++ b/src/SketchAPI/SketchAPI_Rotation.h @@ -1,3 +1,4 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D // Name : SketchAPI_Rotation.h // Purpose: // @@ -45,13 +46,20 @@ public: virtual ~SketchAPI_Rotation(); INTERFACE_7(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 */, - 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 */ + 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 */, + 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 */ ) /// List of rotated objects diff --git a/src/SketchAPI/SketchAPI_Sketch.cpp b/src/SketchAPI/SketchAPI_Sketch.cpp index 6b1731aba..ce765e71b 100644 --- a/src/SketchAPI/SketchAPI_Sketch.cpp +++ b/src/SketchAPI/SketchAPI_Sketch.cpp @@ -1,3 +1,4 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D // Name : SketchAPI_Sketch.cpp // Purpose: // @@ -123,7 +124,8 @@ void SketchAPI_Sketch::setValue( const std::shared_ptr & theConstraint, const ModelHighAPI_Double & theValue) { - // TODO(spo): check somehow that the feature is a constraint or eliminate crash if the feature have no real attribute VALUE + // TODO(spo): check somehow that the feature is a constraint or eliminate + // crash if the feature have no real attribute VALUE fillAttribute(theValue, theConstraint->feature()->real(SketchPlugin_Constraint::VALUE())); // theConstraint->execute(); @@ -172,7 +174,8 @@ SketchPtr addSketch(const std::shared_ptr & thePart, { // TODO(spo): check that thePart is not empty std::shared_ptr aFeature = thePart->addFeature(SketchAPI_Sketch::ID()); - return SketchPtr(new SketchAPI_Sketch(aFeature, ModelHighAPI_Selection("FACE", theExternalName))); + return SketchPtr( + new SketchAPI_Sketch(aFeature, ModelHighAPI_Selection("FACE", theExternalName))); } SketchPtr addSketch(const std::shared_ptr & thePart, @@ -187,23 +190,28 @@ SketchPtr addSketch(const std::shared_ptr & thePart, std::shared_ptr SketchAPI_Sketch::addPoint( double theX, double theY) { - std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_Point::ID()); + std::shared_ptr aFeature = + 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 aFeature = compositeFeature()->addFeature(SketchPlugin_Point::ID()); + std::shared_ptr aFeature = + compositeFeature()->addFeature(SketchPlugin_Point::ID()); return PointPtr(new SketchAPI_Point(aFeature, thePoint)); } -std::shared_ptr SketchAPI_Sketch::addPoint(const ModelHighAPI_Selection & theExternal) +std::shared_ptr + SketchAPI_Sketch::addPoint(const ModelHighAPI_Selection & theExternal) { - std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_Point::ID()); + std::shared_ptr aFeature = + compositeFeature()->addFeature(SketchPlugin_Point::ID()); return PointPtr(new SketchAPI_Point(aFeature, theExternal)); } std::shared_ptr SketchAPI_Sketch::addPoint(const std::string & theExternalName) { - std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_Point::ID()); + std::shared_ptr aFeature = + compositeFeature()->addFeature(SketchPlugin_Point::ID()); return PointPtr(new SketchAPI_Point(aFeature, theExternalName)); } @@ -211,51 +219,62 @@ std::shared_ptr SketchAPI_Sketch::addPoint(const std::string & std::shared_ptr SketchAPI_Sketch::addIntersectionPoint( const ModelHighAPI_Selection & theExternal) { - std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_IntersectionPoint::ID()); + std::shared_ptr aFeature = + compositeFeature()->addFeature(SketchPlugin_IntersectionPoint::ID()); return IntersectionPointPtr(new SketchAPI_IntersectionPoint(aFeature, theExternal)); } std::shared_ptr SketchAPI_Sketch::addIntersectionPoint( const std::string & theExternalName) { - std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_IntersectionPoint::ID()); + std::shared_ptr aFeature = + compositeFeature()->addFeature(SketchPlugin_IntersectionPoint::ID()); return IntersectionPointPtr(new SketchAPI_IntersectionPoint(aFeature, theExternalName)); } //-------------------------------------------------------------------------------------- -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()); + std::shared_ptr aFeature = + 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 aFeature = compositeFeature()->addFeature(SketchPlugin_Line::ID()); + std::shared_ptr aFeature = + compositeFeature()->addFeature(SketchPlugin_Line::ID()); return LinePtr(new SketchAPI_Line(aFeature, theStartPoint, theEndPoint)); } -std::shared_ptr SketchAPI_Sketch::addLine(const ModelHighAPI_Selection & theExternal) +std::shared_ptr + SketchAPI_Sketch::addLine(const ModelHighAPI_Selection & theExternal) { - std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_Line::ID()); + std::shared_ptr aFeature = + compositeFeature()->addFeature(SketchPlugin_Line::ID()); return LinePtr(new SketchAPI_Line(aFeature, theExternal)); } std::shared_ptr SketchAPI_Sketch::addLine(const std::string & theExternalName) { - std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_Line::ID()); + std::shared_ptr aFeature = + 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()); + std::shared_ptr aFeature = + 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) { - std::shared_ptr aFeature = compositeFeature()->addFeature(SketchAPI_Rectangle::ID()); + std::shared_ptr aFeature = + compositeFeature()->addFeature(SketchAPI_Rectangle::ID()); return RectanglePtr(new SketchAPI_Rectangle(aFeature, theStartPoint, theEndPoint)); } @@ -264,14 +283,17 @@ std::shared_ptr SketchAPI_Sketch::addCircle(double theCenterX, double theCenterY, double theRadius) { - std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_Circle::ID()); + std::shared_ptr aFeature = + 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()); + std::shared_ptr aFeature = + compositeFeature()->addFeature(SketchPlugin_Circle::ID()); return CirclePtr(new SketchAPI_Circle(aFeature, theCenter, theRadius)); } @@ -279,28 +301,34 @@ std::shared_ptr SketchAPI_Sketch::addCircle(double theX1, doub double theX2, double theY2, double theX3, double theY3) { - std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_Circle::ID()); + std::shared_ptr aFeature = + compositeFeature()->addFeature(SketchPlugin_Circle::ID()); return CirclePtr(new SketchAPI_Circle(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_Circle::ID()); + std::shared_ptr aFeature = + compositeFeature()->addFeature(SketchPlugin_Circle::ID()); return CirclePtr(new SketchAPI_Circle(aFeature, thePoint1, thePoint2, thePoint3)); } -std::shared_ptr SketchAPI_Sketch::addCircle(const ModelHighAPI_Selection & theExternal) +std::shared_ptr + SketchAPI_Sketch::addCircle(const ModelHighAPI_Selection & theExternal) { - std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_Circle::ID()); + std::shared_ptr aFeature = + compositeFeature()->addFeature(SketchPlugin_Circle::ID()); return CirclePtr(new SketchAPI_Circle(aFeature, theExternal)); } std::shared_ptr SketchAPI_Sketch::addCircle(const std::string & theExternalName) { // TODO(spo): Add constraint SketchConstraintRigid like in PythonAPI. Is it necessary? - std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_Circle::ID()); + std::shared_ptr aFeature = + compositeFeature()->addFeature(SketchPlugin_Circle::ID()); return CirclePtr(new SketchAPI_Circle(aFeature, theExternalName)); } @@ -310,7 +338,8 @@ std::shared_ptr SketchAPI_Sketch::addArc(double theCenterX, doubl double theEndX, double theEndY, bool theInversed) { - std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_Arc::ID()); + std::shared_ptr aFeature = + compositeFeature()->addFeature(SketchPlugin_Arc::ID()); return ArcPtr(new SketchAPI_Arc(aFeature, theCenterX, theCenterY, theStartX, theStartY, @@ -318,12 +347,14 @@ std::shared_ptr SketchAPI_Sketch::addArc(double theCenterX, doubl 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()); + std::shared_ptr aFeature = + compositeFeature()->addFeature(SketchPlugin_Arc::ID()); return ArcPtr(new SketchAPI_Arc(aFeature, theCenter, theStart, theEnd, theInversed)); } @@ -331,47 +362,56 @@ std::shared_ptr SketchAPI_Sketch::addArc(double theStartX, double double theEndX, double theEndY, double thePassedX, double thePassedY) { - std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_Arc::ID()); + std::shared_ptr aFeature = + compositeFeature()->addFeature(SketchPlugin_Arc::ID()); return ArcPtr(new SketchAPI_Arc(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_Arc::ID()); + std::shared_ptr aFeature = + compositeFeature()->addFeature(SketchPlugin_Arc::ID()); return ArcPtr(new SketchAPI_Arc(aFeature, theStart, theEnd, thePassed)); } -std::shared_ptr SketchAPI_Sketch::addArc(const ModelHighAPI_RefAttr& theTangentPoint, - double theEndX, double theEndY, - bool theInversed) +std::shared_ptr SketchAPI_Sketch::addArc( + const ModelHighAPI_RefAttr& theTangentPoint, + double theEndX, double theEndY, + bool theInversed) { - std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_Arc::ID()); + std::shared_ptr aFeature = + compositeFeature()->addFeature(SketchPlugin_Arc::ID()); return ArcPtr(new SketchAPI_Arc(aFeature, theTangentPoint, theEndX, theEndY, theInversed)); } -std::shared_ptr SketchAPI_Sketch::addArc(const ModelHighAPI_RefAttr& theTangentPoint, - const std::shared_ptr& theEnd, - bool theInversed) +std::shared_ptr SketchAPI_Sketch::addArc( + const ModelHighAPI_RefAttr& theTangentPoint, + const std::shared_ptr& theEnd, + bool theInversed) { - std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_Arc::ID()); + std::shared_ptr aFeature = + compositeFeature()->addFeature(SketchPlugin_Arc::ID()); return ArcPtr(new SketchAPI_Arc(aFeature, theTangentPoint, theEnd, theInversed)); } std::shared_ptr SketchAPI_Sketch::addArc(const ModelHighAPI_Selection & theExternal) { - std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_Arc::ID()); + std::shared_ptr aFeature = + compositeFeature()->addFeature(SketchPlugin_Arc::ID()); return ArcPtr(new SketchAPI_Arc(aFeature, theExternal)); } std::shared_ptr SketchAPI_Sketch::addArc(const std::string & theExternalName) { // TODO(spo): Add constraint SketchConstraintRigid like in PythonAPI. Is it necessary? - std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_Arc::ID()); + std::shared_ptr aFeature = + compositeFeature()->addFeature(SketchPlugin_Arc::ID()); return ArcPtr(new SketchAPI_Arc(aFeature, theExternalName)); } @@ -379,14 +419,16 @@ std::shared_ptr SketchAPI_Sketch::addArc(const std::string & theE std::shared_ptr SketchAPI_Sketch::addProjection( const ModelHighAPI_Selection & theExternalFeature) { - std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_Projection::ID()); + std::shared_ptr aFeature = + compositeFeature()->addFeature(SketchPlugin_Projection::ID()); return ProjectionPtr(new SketchAPI_Projection(aFeature, theExternalFeature)); } std::shared_ptr SketchAPI_Sketch::addProjection( const std::string & theExternalName) { - std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_Projection::ID()); + std::shared_ptr aFeature = + compositeFeature()->addFeature(SketchPlugin_Projection::ID()); return ProjectionPtr(new SketchAPI_Projection(aFeature, theExternalName)); } @@ -395,7 +437,8 @@ std::shared_ptr SketchAPI_Sketch::addMirror( const ModelHighAPI_RefAttr & theMirrorLine, const std::list > & theObjects) { - std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_ConstraintMirror::ID()); + std::shared_ptr aFeature = + compositeFeature()->addFeature(SketchPlugin_ConstraintMirror::ID()); return MirrorPtr(new SketchAPI_Mirror(aFeature, theMirrorLine, theObjects)); } @@ -407,8 +450,10 @@ std::shared_ptr SketchAPI_Sketch::addTranslation( 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)); + std::shared_ptr aFeature = + compositeFeature()->addFeature(SketchPlugin_MultiTranslation::ID()); + return TranslationPtr(new SketchAPI_Translation(aFeature, theObjects, thePoint1, + thePoint2, theNumberOfObjects, theFullValue)); } //-------------------------------------------------------------------------------------- @@ -419,16 +464,21 @@ std::shared_ptr SketchAPI_Sketch::addRotation( const ModelHighAPI_Integer & theNumberOfObjects, bool theFullValue) { - std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_MultiRotation::ID()); - return RotationPtr(new SketchAPI_Rotation(aFeature, theObjects, theCenter, theAngle, theNumberOfObjects, theFullValue)); + std::shared_ptr aFeature = + compositeFeature()->addFeature(SketchPlugin_MultiRotation::ID()); + return RotationPtr( + new SketchAPI_Rotation(aFeature, theObjects, theCenter, + theAngle, theNumberOfObjects, theFullValue)); } //-------------------------------------------------------------------------------------- -std::shared_ptr SketchAPI_Sketch::addSplit(const ModelHighAPI_Reference& theFeature, - const ModelHighAPI_RefAttr& thePoint1, - const ModelHighAPI_RefAttr& thePoint2) +std::shared_ptr SketchAPI_Sketch::addSplit( + const ModelHighAPI_Reference& theFeature, + const ModelHighAPI_RefAttr& thePoint1, + const ModelHighAPI_RefAttr& thePoint2) { - std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_ConstraintSplit::ID()); + std::shared_ptr aFeature = + compositeFeature()->addFeature(SketchPlugin_ConstraintSplit::ID()); fillAttribute(theFeature, aFeature->reference(SketchPlugin_Constraint::VALUE())); fillAttribute(thePoint1, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); fillAttribute(thePoint2, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B())); @@ -660,7 +710,8 @@ void SketchAPI_Sketch::dump(ModelHighAPI_Dumper& theDumper) const 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( @@ -678,7 +729,8 @@ void SketchAPI_Sketch::dump(ModelHighAPI_Dumper& theDumper) const theDumper << aBase << " = model.addSketch(" << aDocName << ", 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()) { diff --git a/src/SketchAPI/SketchAPI_Sketch.h b/src/SketchAPI/SketchAPI_Sketch.h index 462f1de1e..60c5e4202 100644 --- a/src/SketchAPI/SketchAPI_Sketch.h +++ b/src/SketchAPI/SketchAPI_Sketch.h @@ -1,3 +1,4 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D // Name : SketchAPI_Sketch.h // Purpose: // @@ -63,13 +64,20 @@ public: 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 */, - 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_AttributeString, /** Solver DOF */ + 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_AttributeString, /** Solver DOF */ ) /// Set plane @@ -101,10 +109,12 @@ public: /// Add intersection point SKETCHAPI_EXPORT - std::shared_ptr addIntersectionPoint(const ModelHighAPI_Selection & theExternal); + std::shared_ptr + addIntersectionPoint(const ModelHighAPI_Selection & theExternal); /// Add point SKETCHAPI_EXPORT - std::shared_ptr addIntersectionPoint(const std::string & theExternalName); + std::shared_ptr + addIntersectionPoint(const std::string & theExternalName); /// Add line SKETCHAPI_EXPORT diff --git a/src/SketchAPI/SketchAPI_SketchEntity.cpp b/src/SketchAPI/SketchAPI_SketchEntity.cpp index 24758c680..b693505d1 100644 --- a/src/SketchAPI/SketchAPI_SketchEntity.cpp +++ b/src/SketchAPI/SketchAPI_SketchEntity.cpp @@ -1,3 +1,4 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D // Name : SketchAPI_SketchEntity.cpp // Purpose: // @@ -87,7 +88,8 @@ SketchAPI_SketchEntity::wrap(const std::list > else if ((*anIt)->getKind() == SketchPlugin_Point::ID()) aResult.push_back(std::shared_ptr(new SketchAPI_Point(*anIt))); else if ((*anIt)->getKind() == SketchPlugin_IntersectionPoint::ID()) - aResult.push_back(std::shared_ptr(new SketchAPI_IntersectionPoint(*anIt))); + aResult.push_back(std::shared_ptr( + new SketchAPI_IntersectionPoint(*anIt))); } return aResult; } diff --git a/src/SketchAPI/SketchAPI_SketchEntity.h b/src/SketchAPI/SketchAPI_SketchEntity.h index 77773910f..fdd3b40a9 100644 --- a/src/SketchAPI/SketchAPI_SketchEntity.h +++ b/src/SketchAPI/SketchAPI_SketchEntity.h @@ -1,3 +1,4 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D // Name : SketchAPI_SketchEntity.h // Purpose: // diff --git a/src/SketchAPI/SketchAPI_Translation.cpp b/src/SketchAPI/SketchAPI_Translation.cpp index 53c18e971..67e8457e9 100644 --- a/src/SketchAPI/SketchAPI_Translation.cpp +++ b/src/SketchAPI/SketchAPI_Translation.cpp @@ -1,3 +1,4 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D // Name : SketchAPI_Translation.cpp // Purpose: // diff --git a/src/SketchAPI/SketchAPI_Translation.h b/src/SketchAPI/SketchAPI_Translation.h index b60938444..aee6e38bf 100644 --- a/src/SketchAPI/SketchAPI_Translation.h +++ b/src/SketchAPI/SketchAPI_Translation.h @@ -1,3 +1,4 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D // Name : SketchAPI_Translation.h // Purpose: // @@ -44,13 +45,20 @@ public: 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(), ModelAPI_AttributeRefList, /** Reference objects */, - translatedObjects, SketchPlugin_MultiTranslation::ENTITY_B(), ModelAPI_AttributeRefList, /** Translationed objects */ + 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 */ ) /// List of translated objects diff --git a/src/SketcherPrs/SketcherPrs_Angle.cpp b/src/SketcherPrs/SketcherPrs_Angle.cpp index 25750ff5d..0427ff1f4 100644 --- a/src/SketcherPrs/SketcherPrs_Angle.cpp +++ b/src/SketcherPrs/SketcherPrs_Angle.cpp @@ -90,8 +90,10 @@ bool SketcherPrs_Angle::readyToDisplay(ModelAPI_Feature* theConstraint, 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; @@ -106,16 +108,22 @@ bool SketcherPrs_Angle::readyToDisplay(ModelAPI_Feature* theConstraint, aLineB->attribute(SketchPlugin_Line::END_ID())); std::shared_ptr anAng; - if (!aData->attribute(SketchPlugin_ConstraintAngle::ANGLE_REVERSED_FIRST_LINE_ID())->isInitialized() || - !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())); - bool isReversed1 = aData->boolean(SketchPlugin_ConstraintAngle::ANGLE_REVERSED_FIRST_LINE_ID())->value(); + bool isReversed1 = + 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(); - anAng = std::shared_ptr(new GeomAPI_Angle2d(aLine1, isReversed1, aLine2, isReversed2)); + bool isReversed2 = + aData->boolean(SketchPlugin_ConstraintAngle::ANGLE_REVERSED_SECOND_LINE_ID())->value(); + anAng = std::shared_ptr( + new GeomAPI_Angle2d(aLine1, isReversed1, aLine2, isReversed2)); } gp_Pnt2d aFirstPoint = anAng->firstPoint()->impl(); @@ -139,20 +147,23 @@ void SketcherPrs_Angle::Compute(const Handle(PrsMgr_PresentationManager3d)& theP const Standard_Integer theMode) { gp_Pnt aFirstPoint, aSecondPoint, aCenterPoint; - bool aReadyToDisplay = readyToDisplay(myConstraint, mySketcherPlane, aFirstPoint, aSecondPoint, aCenterPoint); + bool aReadyToDisplay = readyToDisplay(myConstraint, mySketcherPlane, + aFirstPoint, aSecondPoint, aCenterPoint); if (aReadyToDisplay) { myFirstPoint = aFirstPoint; mySecondPoint = aSecondPoint; myCenterPoint = aCenterPoint; DataPtr aData = myConstraint->data(); - AttributeDoublePtr anAttributeValue = aData->real(SketchPlugin_ConstraintAngle::ANGLE_VALUE_ID()); + AttributeDoublePtr anAttributeValue = + 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::shared_ptr aFlyoutPnt = mySketcherPlane->to3D(aFlyoutAttr->x(), aFlyoutAttr->y()); + std::shared_ptr aFlyoutPnt = + mySketcherPlane->to3D(aFlyoutAttr->x(), aFlyoutAttr->y()); myFlyOutPoint = aFlyoutPnt->impl(); } @@ -258,12 +269,5 @@ bool SketcherPrs_Angle::isAnglePlaneReversedToSketchPlane() double SketcherPrs_Angle::calculateDistanceToFlyoutPoint() { - //gp_Dir aBisector = gp_Dir((myFirstPoint.XYZ() + mySecondPoint.XYZ()) * 0.5 - myCenterPoint.XYZ()); - //gp_XYZ aFlyDir = myFlyOutPoint.XYZ() - myCenterPoint.XYZ(); - - //double aDistance = aFlyDir.Dot(aBisector.XYZ()); - //// make a positive distance in order to AIS angle presentation is not reversed - //aDistance = fabs(aDistance); - //return aDistance; return myFlyOutPoint.Distance(myCenterPoint); } diff --git a/src/SketcherPrs/SketcherPrs_Angle.h b/src/SketcherPrs/SketcherPrs_Angle.h index 7749848e4..de294a98c 100644 --- a/src/SketcherPrs/SketcherPrs_Angle.h +++ b/src/SketcherPrs/SketcherPrs_Angle.h @@ -36,7 +36,8 @@ public: DEFINE_STANDARD_RTTI(SketcherPrs_Angle) - /// Returns true if the constraint feature arguments are correcly filled to build AIS presentation + /// 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 @@ -44,7 +45,8 @@ public: const std::shared_ptr& thePlane); protected: /// Redefinition of virtual function - Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, + Standard_EXPORT virtual void Compute( + const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode = 0); /// Redefinition of virtual function diff --git a/src/SketcherPrs/SketcherPrs_Coincident.cpp b/src/SketcherPrs/SketcherPrs_Coincident.cpp index 26a5e682c..cfb233def 100644 --- a/src/SketcherPrs/SketcherPrs_Coincident.cpp +++ b/src/SketcherPrs/SketcherPrs_Coincident.cpp @@ -66,9 +66,10 @@ bool SketcherPrs_Coincident::readyToDisplay(ModelAPI_Feature* theConstraint, } -void SketcherPrs_Coincident::Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, - const Handle(Prs3d_Presentation)& thePresentation, - const Standard_Integer theMode) +void SketcherPrs_Coincident::Compute( + const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, + const Handle(Prs3d_Presentation)& thePresentation, + const Standard_Integer theMode) { gp_Pnt aPoint; bool aReadyToDisplay = readyToDisplay(myConstraint, mySketcherPlane, aPoint); diff --git a/src/SketcherPrs/SketcherPrs_Coincident.h b/src/SketcherPrs/SketcherPrs_Coincident.h index 9d6d799ad..f6e7d4a36 100644 --- a/src/SketcherPrs/SketcherPrs_Coincident.h +++ b/src/SketcherPrs/SketcherPrs_Coincident.h @@ -39,11 +39,13 @@ public: Standard_EXPORT virtual void SetColor(const Quantity_NameOfColor aColor); /// 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 + /// visualized in error color. + /// The state is stored in an internal field, so should be changed when /// constraint become not conflicting /// \param theConflicting a state /// \param theColor a color for conflicting object - Standard_EXPORT void SetConflictingConstraint(const bool& theConflicting, const std::vector& theColor); + Standard_EXPORT void SetConflictingConstraint(const bool& theConflicting, + const std::vector& theColor); /// Returns true if the constraint feature arguments are correcly filled to build AIS presentation /// \param theConstraint a constraint feature @@ -55,7 +57,8 @@ public: DEFINE_STANDARD_RTTI(SketcherPrs_Coincident) protected: /// Redefinition of virtual function - Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, + Standard_EXPORT virtual void Compute( + const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode = 0); /// Redefinition of virtual function diff --git a/src/SketcherPrs/SketcherPrs_Collinear.cpp b/src/SketcherPrs/SketcherPrs_Collinear.cpp index 8b069825a..bd88e9289 100755 --- a/src/SketcherPrs/SketcherPrs_Collinear.cpp +++ b/src/SketcherPrs/SketcherPrs_Collinear.cpp @@ -33,8 +33,10 @@ bool SketcherPrs_Collinear::IsReadyToDisplay(ModelAPI_Feature* theConstraint, { 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; @@ -47,8 +49,10 @@ bool SketcherPrs_Collinear::updateIfReadyToDisplay(double theStep) const if (!IsReadyToDisplay(myConstraint, myPlane)) 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(); @@ -59,11 +63,13 @@ bool SketcherPrs_Collinear::updateIfReadyToDisplay(double theStep) const 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 = Prs3d_Root::NewGroup(thePrs); - Handle(Graphic3d_AspectLine3d) aLineAspect = new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2); + Handle(Graphic3d_AspectLine3d) aLineAspect = + new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2); aGroup->SetPrimitivesAspect(aLineAspect); // Draw constrained lines diff --git a/src/SketcherPrs/SketcherPrs_DimensionStyleListener.cpp b/src/SketcherPrs/SketcherPrs_DimensionStyleListener.cpp index 5c9e3fbe6..30a193106 100755 --- a/src/SketcherPrs/SketcherPrs_DimensionStyleListener.cpp +++ b/src/SketcherPrs/SketcherPrs_DimensionStyleListener.cpp @@ -51,7 +51,8 @@ SketcherPrs_DimensionStyleListener::~SketcherPrs_DimensionStyleListener() aLoop->removeListener(this); } -void SketcherPrs_DimensionStyleListener::processEvent(const std::shared_ptr& theMessage) +void SketcherPrs_DimensionStyleListener::processEvent( + const std::shared_ptr& theMessage) { const Events_ID kParameterStyleEvent = SketcherPrs_ParameterStyleMessage::eventId(); if (theMessage->eventID() == kParameterStyleEvent) { @@ -90,7 +91,8 @@ void SketcherPrs_DimensionStyleListener::updateDimensions(AIS_Dimension* theDime aCustomValue = theTextValue.c_str(); else { // format value string using "sprintf" - TCollection_AsciiString aFormatStr = theDimension->Attributes()->DimensionAspect()->ValueStringFormat(); + TCollection_AsciiString aFormatStr = + theDimension->Attributes()->DimensionAspect()->ValueStringFormat(); char aFmtBuffer[256]; sprintf (aFmtBuffer, aFormatStr.ToCString(), theDoubleValue); aCustomValue = TCollection_ExtendedString (aFmtBuffer); @@ -100,7 +102,8 @@ void SketcherPrs_DimensionStyleListener::updateDimensions(AIS_Dimension* theDime } else { // format value string using "sprintf" - TCollection_AsciiString aFormatStr = theDimension->Attributes()->DimensionAspect()->ValueStringFormat(); + TCollection_AsciiString aFormatStr = + theDimension->Attributes()->DimensionAspect()->ValueStringFormat(); char aFmtBuffer[256]; sprintf (aFmtBuffer, aFormatStr.ToCString(), theDoubleValue); aCustomValue = TCollection_ExtendedString (aFmtBuffer); diff --git a/src/SketcherPrs/SketcherPrs_Equal.cpp b/src/SketcherPrs/SketcherPrs_Equal.cpp index 74ed7d4db..518774fa3 100644 --- a/src/SketcherPrs/SketcherPrs_Equal.cpp +++ b/src/SketcherPrs/SketcherPrs_Equal.cpp @@ -33,8 +33,10 @@ bool SketcherPrs_Equal::IsReadyToDisplay(ModelAPI_Feature* theConstraint, { 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; @@ -47,8 +49,10 @@ bool SketcherPrs_Equal::updateIfReadyToDisplay(double theStep) const if (!IsReadyToDisplay(myConstraint, myPlane)) 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(); @@ -59,11 +63,13 @@ bool SketcherPrs_Equal::updateIfReadyToDisplay(double theStep) const 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 { Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(thePrs); - Handle(Graphic3d_AspectLine3d) aLineAspect = new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2); + Handle(Graphic3d_AspectLine3d) aLineAspect = + new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2); aGroup->SetPrimitivesAspect(aLineAspect); // Draw first line diff --git a/src/SketcherPrs/SketcherPrs_Factory.cpp b/src/SketcherPrs/SketcherPrs_Factory.cpp index 449c3c24a..8c8af38ab 100644 --- a/src/SketcherPrs/SketcherPrs_Factory.cpp +++ b/src/SketcherPrs/SketcherPrs_Factory.cpp @@ -64,7 +64,8 @@ AISObjectPtr SketcherPrs_Factory::horisontalConstraint(ModelAPI_Feature* theCons anAISObj = thePrevious; else { anAISObj = AISObjectPtr(new GeomAPI_AISObject()); - Handle(SketcherPrs_HVDirection) aPrs = new SketcherPrs_HVDirection(theConstraint, thePlane, true); + Handle(SketcherPrs_HVDirection) aPrs = + new SketcherPrs_HVDirection(theConstraint, thePlane, true); anAISObj->setImpl(new Handle(AIS_InteractiveObject)(aPrs)); } } @@ -81,7 +82,8 @@ AISObjectPtr SketcherPrs_Factory::verticalConstraint(ModelAPI_Feature* theConstr anAISObj = thePrevious; else { anAISObj = AISObjectPtr(new GeomAPI_AISObject()); - Handle(SketcherPrs_HVDirection) aPrs = new SketcherPrs_HVDirection(theConstraint, thePlane, false); + Handle(SketcherPrs_HVDirection) aPrs = + new SketcherPrs_HVDirection(theConstraint, thePlane, false); anAISObj->setImpl(new Handle(AIS_InteractiveObject)(aPrs)); } } @@ -98,7 +100,8 @@ AISObjectPtr SketcherPrs_Factory::translateConstraint(ModelAPI_Feature* theConst anAISObj = thePrevious; else { anAISObj = AISObjectPtr(new GeomAPI_AISObject()); - Handle(SketcherPrs_Transformation) aPrs = new SketcherPrs_Transformation(theConstraint, thePlane, true); + Handle(SketcherPrs_Transformation) aPrs = + new SketcherPrs_Transformation(theConstraint, thePlane, true); anAISObj->setImpl(new Handle(AIS_InteractiveObject)(aPrs)); } } @@ -115,7 +118,8 @@ AISObjectPtr SketcherPrs_Factory::rotateConstraint(ModelAPI_Feature* theConstrai anAISObj = thePrevious; else { anAISObj = AISObjectPtr(new GeomAPI_AISObject()); - Handle(SketcherPrs_Transformation) aPrs = new SketcherPrs_Transformation(theConstraint, thePlane, false); + Handle(SketcherPrs_Transformation) aPrs = + new SketcherPrs_Transformation(theConstraint, thePlane, false); anAISObj->setImpl(new Handle(AIS_InteractiveObject)(aPrs)); } } diff --git a/src/SketcherPrs/SketcherPrs_HVDirection.cpp b/src/SketcherPrs/SketcherPrs_HVDirection.cpp index b0a706618..33500e1c5 100644 --- a/src/SketcherPrs/SketcherPrs_HVDirection.cpp +++ b/src/SketcherPrs/SketcherPrs_HVDirection.cpp @@ -30,7 +30,8 @@ bool SketcherPrs_HVDirection::IsReadyToDisplay(ModelAPI_Feature* theConstraint, const std::shared_ptr&/* thePlane*/) { bool aReadyToDisplay = false; - 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; @@ -49,12 +50,14 @@ bool SketcherPrs_HVDirection::updateIfReadyToDisplay(double theStep) const 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 = Prs3d_Root::NewGroup(thePrs); // Draw constrained object - Handle(Graphic3d_AspectLine3d) aLineAspect = new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2); + Handle(Graphic3d_AspectLine3d) aLineAspect = + new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2); aGroup->SetPrimitivesAspect(aLineAspect); addLine(aGroup, SketchPlugin_Constraint::ENTITY_A()); diff --git a/src/SketcherPrs/SketcherPrs_LengthDimension.cpp b/src/SketcherPrs/SketcherPrs_LengthDimension.cpp index 024d8962d..267cc476e 100644 --- a/src/SketcherPrs/SketcherPrs_LengthDimension.cpp +++ b/src/SketcherPrs/SketcherPrs_LengthDimension.cpp @@ -35,7 +35,7 @@ IMPLEMENT_STANDARD_HANDLE(SketcherPrs_LengthDimension, AIS_LengthDimension); IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_LengthDimension, AIS_LengthDimension); SketcherPrs_LengthDimension::SketcherPrs_LengthDimension(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane) + const std::shared_ptr& thePlane) : AIS_LengthDimension(MyDefStart, MyDefEnd, MyDefPln), myConstraint(theConstraint), mySketcherPlane(thePlane), @@ -61,9 +61,10 @@ bool SketcherPrs_LengthDimension::IsReadyToDisplay(ModelAPI_Feature* theConstrai return readyToDisplay(theConstraint, thePlane, aPnt1, aPnt2); } -void SketcherPrs_LengthDimension::Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, - const Handle(Prs3d_Presentation)& thePresentation, - const Standard_Integer theMode) +void SketcherPrs_LengthDimension::Compute( + const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, + const Handle(Prs3d_Presentation)& thePresentation, + const Standard_Integer theMode) { gp_Pnt aPnt1, aPnt2; bool aReadyToDisplay = readyToDisplay(myConstraint, mySketcherPlane, aPnt1, aPnt2); diff --git a/src/SketcherPrs/SketcherPrs_LengthDimension.h b/src/SketcherPrs/SketcherPrs_LengthDimension.h index f505e7fff..ef3087c76 100644 --- a/src/SketcherPrs/SketcherPrs_LengthDimension.h +++ b/src/SketcherPrs/SketcherPrs_LengthDimension.h @@ -40,7 +40,8 @@ public: DEFINE_STANDARD_RTTI(SketcherPrs_LengthDimension) - /// Returns true if the constraint feature arguments are correcly filled to build AIS presentation + /// 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 @@ -48,8 +49,10 @@ public: const std::shared_ptr& thePlane); 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, @@ -71,13 +74,15 @@ private: /// Listener to update dimension visualization style SketcherPrs_DimensionStyleListener* myStyleListener; - /// container of values obtained from the constraint, which are necessary to fill the presentation + /// 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 first point for measured geometry gp_Pln myPlane; ///< the plane(plane of the sketch) for measured geometry double myDistance; ///< the flyout distance - SketcherPrs_DimensionStyleListener::DimensionValue myValue; /// the structure filled by constraint + /// the structure filled by constraint + SketcherPrs_DimensionStyleListener::DimensionValue myValue; }; #endif \ No newline at end of file diff --git a/src/SketcherPrs/SketcherPrs_Middle.cpp b/src/SketcherPrs/SketcherPrs_Middle.cpp index b3d224994..8e2ed6816 100755 --- a/src/SketcherPrs/SketcherPrs_Middle.cpp +++ b/src/SketcherPrs/SketcherPrs_Middle.cpp @@ -30,8 +30,10 @@ bool SketcherPrs_Middle::IsReadyToDisplay(ModelAPI_Feature* theConstraint, { 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()); // one object is a feature Line, other object is a point result. We check shape of point result aReadyToDisplay = aObj1.get() && aObj2.get() && @@ -48,15 +50,18 @@ bool SketcherPrs_Middle::updateIfReadyToDisplay(double theStep) const ObjectPtr aPointObject; // find a line result to set middle symbol near it - 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; @@ -72,15 +77,18 @@ bool SketcherPrs_Middle::updateIfReadyToDisplay(double theStep) const 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 = Prs3d_Root::NewGroup(thePrs); - Handle(Graphic3d_AspectLine3d) aLineAspect = new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2); + Handle(Graphic3d_AspectLine3d) aLineAspect = + 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()); diff --git a/src/SketcherPrs/SketcherPrs_Mirror.cpp b/src/SketcherPrs/SketcherPrs_Mirror.cpp index 30bbc6ec3..a086d0f7b 100644 --- a/src/SketcherPrs/SketcherPrs_Mirror.cpp +++ b/src/SketcherPrs/SketcherPrs_Mirror.cpp @@ -33,17 +33,20 @@ bool SketcherPrs_Mirror::IsReadyToDisplay(ModelAPI_Feature* theConstraint, bool aReadyToDisplay = false; // 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()); + std::shared_ptr anAttrB = + 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()); + std::shared_ptr anAttrC = + aData->reflist(SketchPlugin_Constraint::ENTITY_C()); if (anAttrC.get() == NULL) return aReadyToDisplay; @@ -63,13 +66,16 @@ bool SketcherPrs_Mirror::updateIfReadyToDisplay(double theStep) const 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()); + std::shared_ptr anAttrB = + aData->reflist(SketchPlugin_Constraint::ENTITY_B()); // Get mirrored objects - std::shared_ptr anAttrC = aData->reflist(SketchPlugin_Constraint::ENTITY_C()); + std::shared_ptr anAttrC = + aData->reflist(SketchPlugin_Constraint::ENTITY_C()); SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get(); int aNb = anAttrB->size(); @@ -98,13 +104,16 @@ bool SketcherPrs_Mirror::updateIfReadyToDisplay(double theStep) const } -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()); + std::shared_ptr anAttrB = + aData->reflist(SketchPlugin_Constraint::ENTITY_B()); if (anAttrB.get() == NULL) return; - std::shared_ptr anAttrC = aData->reflist(SketchPlugin_Constraint::ENTITY_C()); + std::shared_ptr anAttrC = + aData->reflist(SketchPlugin_Constraint::ENTITY_C()); if (anAttrC.get() == NULL) return; diff --git a/src/SketcherPrs/SketcherPrs_Parallel.cpp b/src/SketcherPrs/SketcherPrs_Parallel.cpp index 431c396b0..9b73b3385 100644 --- a/src/SketcherPrs/SketcherPrs_Parallel.cpp +++ b/src/SketcherPrs/SketcherPrs_Parallel.cpp @@ -35,8 +35,10 @@ bool SketcherPrs_Parallel::IsReadyToDisplay(ModelAPI_Feature* theConstraint, { 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; @@ -48,8 +50,10 @@ bool SketcherPrs_Parallel::updateIfReadyToDisplay(double theStep) const if (!IsReadyToDisplay(myConstraint, myPlane)) 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(); @@ -61,11 +65,13 @@ bool SketcherPrs_Parallel::updateIfReadyToDisplay(double theStep) const } -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 = Prs3d_Root::NewGroup(thePrs); - Handle(Graphic3d_AspectLine3d) aLineAspect = new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2); + Handle(Graphic3d_AspectLine3d) aLineAspect = + new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2); aGroup->SetPrimitivesAspect(aLineAspect); // Draw constrained lines diff --git a/src/SketcherPrs/SketcherPrs_Perpendicular.cpp b/src/SketcherPrs/SketcherPrs_Perpendicular.cpp index 58a7cdec8..d9d280f99 100644 --- a/src/SketcherPrs/SketcherPrs_Perpendicular.cpp +++ b/src/SketcherPrs/SketcherPrs_Perpendicular.cpp @@ -21,7 +21,7 @@ IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Perpendicular, SketcherPrs_SymbolPrs); static Handle(Image_AlienPixMap) MyPixMap; SketcherPrs_Perpendicular::SketcherPrs_Perpendicular(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane) + const std::shared_ptr& thePlane) : SketcherPrs_SymbolPrs(theConstraint, thePlane) { // Create default array @@ -35,8 +35,10 @@ bool SketcherPrs_Perpendicular::IsReadyToDisplay(ModelAPI_Feature* theConstraint { 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; @@ -48,8 +50,10 @@ bool SketcherPrs_Perpendicular::updateIfReadyToDisplay(double theStep) const if (!IsReadyToDisplay(myConstraint, myPlane)) 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(); @@ -61,11 +65,13 @@ bool SketcherPrs_Perpendicular::updateIfReadyToDisplay(double theStep) const } -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 { Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(thePrs); - Handle(Graphic3d_AspectLine3d) aLineAspect = new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2); + Handle(Graphic3d_AspectLine3d) aLineAspect = + new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2); aGroup->SetPrimitivesAspect(aLineAspect); // Draw constrained lines diff --git a/src/SketcherPrs/SketcherPrs_PositionMgr.cpp b/src/SketcherPrs/SketcherPrs_PositionMgr.cpp index 22d983712..0261528f5 100644 --- a/src/SketcherPrs/SketcherPrs_PositionMgr.cpp +++ b/src/SketcherPrs/SketcherPrs_PositionMgr.cpp @@ -59,7 +59,8 @@ gp_Pnt SketcherPrs_PositionMgr::getPosition(ObjectPtr theShape, gp_Pnt aP; // Central point gp_Vec aVec1; // main vector if (aShape->isEdge()) { - std::shared_ptr aCurve = std::shared_ptr(new GeomAPI_Curve(aShape)); + std::shared_ptr aCurve = + std::shared_ptr(new GeomAPI_Curve(aShape)); std::shared_ptr aPnt1; // Start point of main vector std::shared_ptr aPnt2; // End point of main vector if (aCurve->isLine()) { @@ -86,7 +87,8 @@ gp_Pnt SketcherPrs_PositionMgr::getPosition(ObjectPtr theShape, aVec1 = gp_Vec(aPnt1->impl(), aPnt2->impl()); } else { // This is a point - std::shared_ptr aVertex = std::shared_ptr(new GeomAPI_Vertex(aShape)); + std::shared_ptr aVertex = + std::shared_ptr(new GeomAPI_Vertex(aShape)); std::shared_ptr aPnt = aVertex->point(); aP = aPnt->impl(); diff --git a/src/SketcherPrs/SketcherPrs_Radius.cpp b/src/SketcherPrs/SketcherPrs_Radius.cpp index 4edb8778b..826ae8379 100644 --- a/src/SketcherPrs/SketcherPrs_Radius.cpp +++ b/src/SketcherPrs/SketcherPrs_Radius.cpp @@ -104,7 +104,8 @@ bool SketcherPrs_Radius::readyToDisplay(ModelAPI_Feature* theConstraint, std::shared_ptr aNormal = thePlane->normal(); GeomAPI_Circ aCircle(aCenter, aNormal, aRadius); - std::shared_ptr anAnchor = SketcherPrs_Tools::getAnchorPoint(theConstraint, thePlane); + std::shared_ptr anAnchor = + SketcherPrs_Tools::getAnchorPoint(theConstraint, thePlane); theCircle = aCircle.impl(); theAnchorPoint = anAnchor->impl(); @@ -114,9 +115,10 @@ 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) { gp_Circ aCircle; gp_Pnt anAnchorPoint; diff --git a/src/SketcherPrs/SketcherPrs_Radius.h b/src/SketcherPrs/SketcherPrs_Radius.h index ee3cbe929..6710652ce 100644 --- a/src/SketcherPrs/SketcherPrs_Radius.h +++ b/src/SketcherPrs/SketcherPrs_Radius.h @@ -36,7 +36,8 @@ public: DEFINE_STANDARD_RTTI(SketcherPrs_Radius) - /// Returns true if the constraint feature arguments are correcly filled to build AIS presentation + /// 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 @@ -54,7 +55,8 @@ private: gp_Circ& theCircle, gp_Pnt& theAnchorPoint); protected: /// Redefinition of virtual function - Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, + Standard_EXPORT virtual void Compute( + const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode = 0); /// Redefinition of virtual function diff --git a/src/SketcherPrs/SketcherPrs_Rigid.cpp b/src/SketcherPrs/SketcherPrs_Rigid.cpp index 082ab5cfc..d2e993331 100644 --- a/src/SketcherPrs/SketcherPrs_Rigid.cpp +++ b/src/SketcherPrs/SketcherPrs_Rigid.cpp @@ -49,7 +49,8 @@ bool SketcherPrs_Rigid::IsReadyToDisplay(ModelAPI_Feature* theConstraint, bool aReadyToDisplay = false; std::shared_ptr aData = theConstraint->data(); - std::shared_ptr anAttr = aData->refattr(SketchPlugin_Constraint::ENTITY_A()); + std::shared_ptr anAttr = + aData->refattr(SketchPlugin_Constraint::ENTITY_A()); AttributePtr aRefAttr = anAttr->attr(); if (anAttr->isObject()) { // The constraint attached to an object @@ -59,7 +60,7 @@ bool SketcherPrs_Rigid::IsReadyToDisplay(ModelAPI_Feature* theConstraint, } else { // The constraint attached to a point std::shared_ptr aPnt = SketcherPrs_Tools::getPoint(theConstraint, - SketchPlugin_Constraint::ENTITY_A()); + SketchPlugin_Constraint::ENTITY_A()); aReadyToDisplay = aPnt.get() != NULL; } return aReadyToDisplay; @@ -71,7 +72,8 @@ bool SketcherPrs_Rigid::updateIfReadyToDisplay(double theStep) const return false; std::shared_ptr aData = myConstraint->data(); - std::shared_ptr anAttr = aData->refattr(SketchPlugin_Constraint::ENTITY_A()); + std::shared_ptr anAttr = + aData->refattr(SketchPlugin_Constraint::ENTITY_A()); AttributePtr aRefAttr = anAttr->attr(); if (anAttr->isObject()) { // The constraint attached to an object @@ -91,7 +93,8 @@ bool SketcherPrs_Rigid::updateIfReadyToDisplay(double theStep) const } -void SketcherPrs_Rigid::drawLines(const Handle(Prs3d_Presentation)& thePrs, Quantity_Color theColor) const +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); @@ -114,7 +117,8 @@ void SketcherPrs_Rigid::drawLines(const Handle(Prs3d_Presentation)& thePrs, Quan return; Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(thePrs); - Handle(Graphic3d_AspectLine3d) aLineAspect = new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2); + Handle(Graphic3d_AspectLine3d) aLineAspect = + new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2); aGroup->SetPrimitivesAspect(aLineAspect); Handle(Prs3d_PointAspect) aPntAspect = new Prs3d_PointAspect(Aspect_TOM_PLUS, theColor, 1); diff --git a/src/SketcherPrs/SketcherPrs_SensitivePoint.cpp b/src/SketcherPrs/SketcherPrs_SensitivePoint.cpp index 417a6a0c8..61c33fab8 100644 --- a/src/SketcherPrs/SketcherPrs_SensitivePoint.cpp +++ b/src/SketcherPrs/SketcherPrs_SensitivePoint.cpp @@ -15,14 +15,14 @@ IMPLEMENT_STANDARD_HANDLE(SketcherPrs_SensitivePoint, Select3D_SensitiveEntity); IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_SensitivePoint, Select3D_SensitiveEntity); -SketcherPrs_SensitivePoint::SketcherPrs_SensitivePoint(const Handle(SelectBasics_EntityOwner)& anOwner, - int theId) +SketcherPrs_SensitivePoint::SketcherPrs_SensitivePoint( + const Handle(SelectBasics_EntityOwner)& anOwner, int theId) :Select3D_SensitiveEntity(anOwner), myId(theId) { SetSensitivityFactor(12); } -Standard_Boolean SketcherPrs_SensitivePoint::Matches (SelectBasics_SelectingVolumeManager& theMgr, +Standard_Boolean SketcherPrs_SensitivePoint::Matches(SelectBasics_SelectingVolumeManager& theMgr, SelectBasics_PickResult& thePickResult) { Standard_Real aDepth = RealLast(); diff --git a/src/SketcherPrs/SketcherPrs_SensitivePoint.h b/src/SketcherPrs/SketcherPrs_SensitivePoint.h index 000df1a4f..ac9c93ba7 100644 --- a/src/SketcherPrs/SketcherPrs_SensitivePoint.h +++ b/src/SketcherPrs/SketcherPrs_SensitivePoint.h @@ -24,7 +24,8 @@ 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 Standard_EXPORT virtual Standard_Integer NbSubElements() Standard_OVERRIDE; @@ -35,8 +36,8 @@ public: //! 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; diff --git a/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp b/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp index 5f5517354..2e2779c7b 100644 --- a/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp +++ b/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp @@ -140,7 +140,8 @@ public: if (aDataType == GL_NONE) { continue; } else if (anAttrib.Id == Graphic3d_TOA_POS) { - OpenGl_VertexBuffer::bindAttribute (theGlCtx, Graphic3d_TOA_POS, aNbComp, aDataType, Stride, anOffset); + OpenGl_VertexBuffer::bindAttribute(theGlCtx, Graphic3d_TOA_POS, aNbComp, + aDataType, Stride, anOffset); break; } @@ -165,7 +166,8 @@ public: if (aDataType == GL_NONE) continue; - OpenGl_VertexBuffer::bindAttribute (theGlCtx, anAttrib.Id, aNbComp, aDataType, Stride, anOffset); + OpenGl_VertexBuffer::bindAttribute(theGlCtx, anAttrib.Id, aNbComp, + aDataType, Stride, anOffset); anOffset += Graphic3d_Attribute::Stride (anAttrib.DataType); } } @@ -233,7 +235,9 @@ OpenGl_Element* SymbolPrsCallBack(const CALL_DEF_USERDRAW * theUserDraw) { Handle(SketcherPrs_SymbolPrs) anIObj = (SketcherPrs_SymbolPrs*)theUserDraw->Data; if (anIObj.IsNull()) { - std::cout << "VUserDrawCallback error: null object passed, the custom scene element will not be rendered" << std::endl; + std::cout << + "VUserDrawCallback error: null object passed, the custom scene element will not be rendered" + << std::endl; } return new SketcherPrs_Element(anIObj); } @@ -311,7 +315,8 @@ void SketcherPrs_SymbolPrs::prepareAspect() } } -void SketcherPrs_SymbolPrs::addLine(const Handle(Graphic3d_Group)& theGroup, std::string theAttrName) const +void SketcherPrs_SymbolPrs::addLine(const Handle(Graphic3d_Group)& theGroup, + std::string theAttrName) const { ObjectPtr aObj = SketcherPrs_Tools::getResult(myConstraint, theAttrName); std::shared_ptr aLine = SketcherPrs_Tools::getShape(aObj); @@ -329,7 +334,7 @@ void SketcherPrs_SymbolPrs::addLine(const Handle(Graphic3d_Group)& theGroup, std theGroup->AddPrimitiveArray(aLines); } -void SketcherPrs_SymbolPrs::HilightSelected(const Handle(PrsMgr_PresentationManager3d)& thePM, +void SketcherPrs_SymbolPrs::HilightSelected(const Handle(PrsMgr_PresentationManager3d)& thePM, const SelectMgr_SequenceOfOwner& theOwners) { @@ -342,9 +347,10 @@ void SketcherPrs_SymbolPrs::HilightSelected(const Handle(PrsMgr_PresentationMana thePM->Highlight(this); } -void SketcherPrs_SymbolPrs::HilightOwnerWithColor(const Handle(PrsMgr_PresentationManager3d)& thePM, - const Quantity_NameOfColor theColor, - const Handle(SelectMgr_EntityOwner)& theOwner) +void SketcherPrs_SymbolPrs::HilightOwnerWithColor( + const Handle(PrsMgr_PresentationManager3d)& thePM, + const Quantity_NameOfColor theColor, + const Handle(SelectMgr_EntityOwner)& theOwner) { thePM->Color(this, theColor); @@ -356,15 +362,17 @@ void SketcherPrs_SymbolPrs::HilightOwnerWithColor(const Handle(PrsMgr_Presentati thePM->AddToImmediateList(aHilightPrs); } -void SketcherPrs_SymbolPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, - const Handle(Prs3d_Presentation)& thePresentation, - const Standard_Integer theMode) +void SketcherPrs_SymbolPrs::Compute( + const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, + const Handle(Prs3d_Presentation)& thePresentation, + const Standard_Integer theMode) { // Create an icon prepareAspect(); Handle(AIS_InteractiveContext) aCtx = GetContext(); - Handle(OpenGl_GraphicDriver) aDriver = Handle(OpenGl_GraphicDriver)::DownCast(aCtx->CurrentViewer()->Driver()); + Handle(OpenGl_GraphicDriver) aDriver = + Handle(OpenGl_GraphicDriver)::DownCast(aCtx->CurrentViewer()->Driver()); if (!aDriver.IsNull()) { // register the custom element factory function aDriver->UserDrawCallback() = SymbolPrsCallBack; @@ -430,8 +438,8 @@ void SketcherPrs_SymbolPrs::SetConflictingConstraint(const bool& theConflicting, if (theConflicting) { if (!myAspect.IsNull()) - myAspect->SetColor (Quantity_Color (theColor[0] / 255., theColor[1] / 255., theColor[2] / 255., - Quantity_TOC_RGB)); + myAspect->SetColor (Quantity_Color (theColor[0] / 255., theColor[1] / 255., + theColor[2] / 255., Quantity_TOC_RGB)); myIsConflicting = true; } else @@ -447,7 +455,8 @@ void SketcherPrs_SymbolPrs::Render(const Handle(OpenGl_Workspace)& theWorkspace) // this method is a combination of OCCT OpenGL functions. The main purpose is to have // equal distance from the source object to symbol indpendently of zoom. // It is base on OCCT 6.9.1 and might need changes when using later OCCT versions. - // The specific SHAPER modifications are marked by ShaperModification:start/end, other is OCCT code + // The specific SHAPER modifications are marked by ShaperModification:start/end, + // other is OCCT code // do not update presentation for invalid or already removed objects: the presentation // should be removed soon @@ -472,7 +481,8 @@ void SketcherPrs_SymbolPrs::Render(const Handle(OpenGl_Workspace)& theWorkspace) } // Update drawing attributes - if (!myVboAttribs->init(aCtx, 0, aAttribs->NbElements, aAttribs->Data(), GL_NONE, aAttribs->Stride)) { + if (!myVboAttribs->init(aCtx, 0, aAttribs->NbElements, + aAttribs->Data(), GL_NONE, aAttribs->Stride)) { myVboAttribs->Release (aCtx.operator->()); myVboAttribs.Nullify(); return; @@ -484,14 +494,17 @@ void SketcherPrs_SymbolPrs::Render(const Handle(OpenGl_Workspace)& theWorkspace) if (!aSpriteNorm.IsNull() && !aSpriteNorm->IsDisplayList()) { // ShaperModification:start : filling the presentation with color if there is a conflict - const bool toHilight = (theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT) != 0 || myIsConflicting; + const bool toHilight = + (theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT) != 0 || myIsConflicting; // ShaperModification:end - const Handle(OpenGl_PointSprite)& aSprite = (toHilight && anAspectMarker->SpriteHighlightRes(aCtx)->IsValid()) - ? anAspectMarker->SpriteHighlightRes(aCtx) + const Handle(OpenGl_PointSprite)& aSprite = + (toHilight && anAspectMarker->SpriteHighlightRes(aCtx)->IsValid())? + anAspectMarker->SpriteHighlightRes(aCtx) : aSpriteNorm; theWorkspace->EnableTexture (aSprite); - aCtx->ShaderManager()->BindProgram(anAspectMarker, aSprite, Standard_False, Standard_False, anAspectMarker->ShaderProgramRes(aCtx)); + aCtx->ShaderManager()->BindProgram(anAspectMarker, aSprite, Standard_False, + Standard_False, anAspectMarker->ShaderProgramRes(aCtx)); const TEL_COLOUR* aLineColor = &anAspectMarker->Color(); if (theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT) aLineColor = theWorkspace->HighlightColor; @@ -553,11 +566,13 @@ void SketcherPrs_SymbolPrs::drawShape(const std::shared_ptr& theS 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()); + GeomAdaptor_Curve + aAdaptor(aCurve->impl(), aCurve->startParam(), aCurve->endParam()); StdPrs_DeflectionCurve::Add(thePrs,aAdaptor,myDrawer); } } else if (theShape->isVertex()) { @@ -570,8 +585,9 @@ void SketcherPrs_SymbolPrs::drawShape(const std::shared_ptr& theS } } -void SketcherPrs_SymbolPrs::drawListOfShapes(const std::shared_ptr& theListAttr, - const Handle(Prs3d_Presentation)& thePrs) const +void SketcherPrs_SymbolPrs::drawListOfShapes( + const std::shared_ptr& theListAttr, + const Handle(Prs3d_Presentation)& thePrs) const { int aNb = theListAttr->size(); if (aNb == 0) diff --git a/src/SketcherPrs/SketcherPrs_SymbolPrs.h b/src/SketcherPrs/SketcherPrs_SymbolPrs.h index 458f860a7..54b2bd290 100644 --- a/src/SketcherPrs/SketcherPrs_SymbolPrs.h +++ b/src/SketcherPrs/SketcherPrs_SymbolPrs.h @@ -45,13 +45,15 @@ public: virtual ~SketcherPrs_SymbolPrs(); //! Method which draws selected owners ( for fast presentation draw ) - Standard_EXPORT virtual void HilightSelected(const Handle(PrsMgr_PresentationManager3d)& thePM, + 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 Quantity_NameOfColor theColor, const Handle(SelectMgr_EntityOwner)& theOwner); + Standard_EXPORT virtual void HilightOwnerWithColor( + const Handle(PrsMgr_PresentationManager3d)& thePM, + const Quantity_NameOfColor theColor, + const Handle(SelectMgr_EntityOwner)& theOwner); /// Returns sketcher plane Standard_EXPORT std::shared_ptr plane() const { return myPlane; } @@ -63,11 +65,12 @@ public: 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 + /// visualized in error color. The state is stored in an internal field, so should be changed + /// when constraint become not conflicting /// \param theConflicting a state /// \param theColor a color for conflicting object - Standard_EXPORT void SetConflictingConstraint(const bool& theConflicting, const std::vector& theColor); + Standard_EXPORT void SetConflictingConstraint(const bool& theConflicting, + const std::vector& theColor); /// Render of the presentation /// \param theWorkspace is OpenGl workspace @@ -85,7 +88,8 @@ public: protected: /// Redefinition of virtual function - Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, + Standard_EXPORT virtual void Compute( + const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode = 0); /// Redefinition of virtual function diff --git a/src/SketcherPrs/SketcherPrs_Tangent.cpp b/src/SketcherPrs/SketcherPrs_Tangent.cpp index 09fa68109..a857c3955 100644 --- a/src/SketcherPrs/SketcherPrs_Tangent.cpp +++ b/src/SketcherPrs/SketcherPrs_Tangent.cpp @@ -38,8 +38,10 @@ bool SketcherPrs_Tangent::IsReadyToDisplay(ModelAPI_Feature* theConstraint, { 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; @@ -52,8 +54,10 @@ bool SketcherPrs_Tangent::updateIfReadyToDisplay(double theStep) const if (!IsReadyToDisplay(myConstraint, myPlane)) 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 points coordinates SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get(); @@ -64,11 +68,13 @@ bool SketcherPrs_Tangent::updateIfReadyToDisplay(double theStep) const return true; } -void SketcherPrs_Tangent::drawLines(const Handle(Prs3d_Presentation)& thePrs, Quantity_Color theColor) const +void SketcherPrs_Tangent::drawLines(const Handle(Prs3d_Presentation)& thePrs, + Quantity_Color theColor) const { Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(thePrs); - Handle(Graphic3d_AspectLine3d) aLineAspect = new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2); + Handle(Graphic3d_AspectLine3d) aLineAspect = + new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2); aGroup->SetPrimitivesAspect(aLineAspect); ObjectPtr aObj1 = SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_A()); diff --git a/src/SketcherPrs/SketcherPrs_Tools.cpp b/src/SketcherPrs/SketcherPrs_Tools.cpp index b8e37cc53..833580701 100644 --- a/src/SketcherPrs/SketcherPrs_Tools.cpp +++ b/src/SketcherPrs/SketcherPrs_Tools.cpp @@ -69,7 +69,8 @@ ObjectPtr getResult(ModelAPI_Feature* theFeature, const std::string& theAttrName std::shared_ptr getShape(ObjectPtr theObject) { ResultConstructionPtr aRes = std::dynamic_pointer_cast(theObject); - if (aRes.get() != NULL && aRes->data()->isValid()) {/// essential check as it is called in openGl thread + if (aRes.get() != NULL && aRes->data()->isValid()) { + /// essential check as it is called in openGl thread return aRes->shape(); } return std::shared_ptr(); @@ -245,7 +246,8 @@ 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; @@ -308,7 +310,8 @@ Handle(Prs3d_DimensionAspect) createDimensionAspect() return anAspect; } -void updateArrows(Handle(Prs3d_DimensionAspect) theDimAspect, double theDimValue, double theTextSize) +void updateArrows(Handle(Prs3d_DimensionAspect) theDimAspect, + double theDimValue, double theTextSize) { double anArrowLength = theDimAspect->ArrowAspect()->Length(); // This is not realy correct way to get viewer scale. @@ -317,7 +320,8 @@ void updateArrows(Handle(Prs3d_DimensionAspect) theDimAspect, double theDimValue 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); + theDimAspect->SetExtensionSize( + (theTextSize / aViewerScale + SketcherPrs_Tools::getArrowSize()) / 2.0); } else { theDimAspect->SetTextHorizontalPosition(Prs3d_DTHP_Center); theDimAspect->SetArrowOrientation(Prs3d_DAO_Internal); @@ -329,7 +333,8 @@ void updateArrows(Handle(Prs3d_DimensionAspect) theDimAspect, double theDimValue void sendEmptyPresentationError(ModelAPI_Feature* theFeature, const std::string theError) { - Events_InfoMessage("SketcherPrs_Tools", "An empty AIS presentation: SketcherPrs_LengthDimension").send(); + Events_InfoMessage("SketcherPrs_Tools", + "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); diff --git a/src/SketcherPrs/SketcherPrs_Tools.h b/src/SketcherPrs/SketcherPrs_Tools.h index 97c196c50..ed6fd0bf0 100644 --- a/src/SketcherPrs/SketcherPrs_Tools.h +++ b/src/SketcherPrs/SketcherPrs_Tools.h @@ -25,7 +25,8 @@ class Handle_Prs3d_DimensionAspect; //#define MyTextHeight 20 -/// Message that style of visualization of parameter is changed. It will be shown as expression or value +/// Message that style of visualization of parameter is changed. +/// It will be shown as expression or value class SketcherPrs_ParameterStyleMessage : public Events_Message { public: @@ -131,8 +132,8 @@ namespace SketcherPrs_Tools { /// \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); + const std::string& theAttribute, + const std::shared_ptr& thePlane); /// Returns value of dimension arrows size SKETCHERPRS_EXPORT double getArrowSize(); diff --git a/src/SketcherPrs/SketcherPrs_Transformation.cpp b/src/SketcherPrs/SketcherPrs_Transformation.cpp index e4a4899ff..1058aeb8f 100644 --- a/src/SketcherPrs/SketcherPrs_Transformation.cpp +++ b/src/SketcherPrs/SketcherPrs_Transformation.cpp @@ -42,7 +42,8 @@ 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()); + std::shared_ptr anAttrB = + aData->reflist(SketchPlugin_Constraint::ENTITY_B()); if (anAttrB.get() == NULL) return aReadyToDisplay; @@ -58,11 +59,13 @@ bool SketcherPrs_Transformation::IsReadyToDisplay(ModelAPI_Feature* theConstrain AttributePoint2DPtr aEnd = GeomDataAPI_Point2D::getPoint2D(aData, SketchPlugin_MultiTranslation::END_POINT_ID()); - aReadyToDisplay = aStart.get() && aEnd.get() && aStart->isInitialized() && aEnd->isInitialized(); + 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 @@ -76,7 +79,8 @@ bool SketcherPrs_Transformation::updateIfReadyToDisplay(double theStep) const std::shared_ptr aData = myConstraint->data(); // Get transformated objects list - std::shared_ptr anAttrB = aData->reflist(SketchPlugin_Constraint::ENTITY_B()); + std::shared_ptr anAttrB = + aData->reflist(SketchPlugin_Constraint::ENTITY_B()); int aNbB = anAttrB->size(); if (aNbB == 0) @@ -105,18 +109,17 @@ bool SketcherPrs_Transformation::updateIfReadyToDisplay(double theStep) const 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()); + std::shared_ptr anAttrB = + aData->reflist(SketchPlugin_Constraint::ENTITY_B()); if (anAttrB.get() == NULL) return; Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(thePrs); - //Handle(Graphic3d_AspectLine3d) aLineAspect = new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2); - //aGroup->SetPrimitivesAspect(aLineAspect); - // drawListOfShapes uses myDrawer for attributes definition Handle(Prs3d_LineAspect) aLnAspect = new Prs3d_LineAspect(theColor, Aspect_TOL_SOLID, 1); myDrawer->SetLineAspect(aLnAspect); @@ -142,7 +145,8 @@ 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 = myPlane->to3D(aCenter->x(), aCenter->y()); -- 2.30.2