X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FPrimitivesAPI%2FPrimitivesAPI_Cylinder.cpp;h=7d342b9141b112709f49a322f15698773a2e7fcf;hb=910ad5cd45b974cea91ce98c4dbf6ad2f74a663e;hp=42c10aed1f8f4ea718893bccf57f4646b2321705;hpb=ccd1d538ff04366093c86220b22b53c4b7370f14;p=modules%2Fshaper.git diff --git a/src/PrimitivesAPI/PrimitivesAPI_Cylinder.cpp b/src/PrimitivesAPI/PrimitivesAPI_Cylinder.cpp index 42c10aed1..7d342b914 100644 --- a/src/PrimitivesAPI/PrimitivesAPI_Cylinder.cpp +++ b/src/PrimitivesAPI/PrimitivesAPI_Cylinder.cpp @@ -1,8 +1,8 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> +// Copyright (C) 2014-201x CEA/DEN, EDF R&D --> -// File: PrimitivesAPI_Cylinder.h +// File: PrimitivesAPI_Cylinder.cpp // Created: 12 Jan 2017 -// Author: Clarisse Genrault (CEA) +// Author: Clarisse Genrault #include "PrimitivesAPI_Cylinder.h" @@ -19,44 +19,42 @@ PrimitivesAPI_Cylinder::PrimitivesAPI_Cylinder(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theBasePoint, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theRadius, - const ModelHighAPI_Double& theHeight) + const ModelHighAPI_Selection& theBasePoint, + const ModelHighAPI_Selection& theAxis, + const ModelHighAPI_Double& theRadius, + const ModelHighAPI_Double& theHeight) : ModelHighAPI_Interface(theFeature) { if (initialize()) { fillAttribute(PrimitivesPlugin_Cylinder::CREATION_METHOD_CYLINDER(), creationMethod()); - setObjects(theBasePoint, theAxis); + fillAttribute(theBasePoint, basePoint()); + fillAttribute(theAxis, axis()); setSizes(theRadius, theHeight); } } //================================================================================================== PrimitivesAPI_Cylinder::PrimitivesAPI_Cylinder(const std::shared_ptr& theFeature, - const ModelHighAPI_Selection& theBasePoint, - const ModelHighAPI_Selection& theAxis, - const ModelHighAPI_Double& theRadius, - const ModelHighAPI_Double& theHeight, - const ModelHighAPI_Double& theAngle) + const ModelHighAPI_Selection& theBasePoint, + const ModelHighAPI_Selection& theAxis, + const ModelHighAPI_Double& theRadius, + const ModelHighAPI_Double& theHeight, + const ModelHighAPI_Double& theAngle) : ModelHighAPI_Interface(theFeature) { if (initialize()) { fillAttribute(PrimitivesPlugin_Cylinder::CREATION_METHOD_CYLINDER_PORTION(), creationMethod()); - setObjects(theBasePoint, theAxis); + fillAttribute(theBasePoint, basePoint()); + fillAttribute(theAxis, axis()); + fillAttribute(theAngle, angle()); setSizes(theRadius, theHeight); - setAngle(theAngle); } } //================================================================================================== -void PrimitivesAPI_Cylinder::setObjects(const ModelHighAPI_Selection& theBasePoint, - const ModelHighAPI_Selection& theAxis) +PrimitivesAPI_Cylinder::~PrimitivesAPI_Cylinder() { - fillAttribute(theBasePoint, basePoint()); - fillAttribute(theAxis, axis()); - execute(); } //================================================================================================== @@ -65,15 +63,6 @@ void PrimitivesAPI_Cylinder::setSizes(const ModelHighAPI_Double& theRadius, { fillAttribute(theRadius, radius()); fillAttribute(theHeight, height()); - - execute(); -} - -//================================================================================================== -void PrimitivesAPI_Cylinder::setAngle(const ModelHighAPI_Double& theAngle) -{ - fillAttribute(theAngle, angle()); - execute(); } @@ -85,17 +74,18 @@ void PrimitivesAPI_Cylinder::dump(ModelHighAPI_Dumper& theDumper) const theDumper << aBase << " = model.addCylinder(" << aDocName; - std::string aCreationMethod = aBase->string(PrimitivesPlugin_Cylinder::CREATION_METHOD())->value(); - AttributeSelectionPtr anAttrBasePoint = aBase->selection(PrimitivesPlugin_Cylinder::BASE_POINT_ID()); AttributeSelectionPtr anAttrAxis = aBase->selection(PrimitivesPlugin_Cylinder::AXIS_ID()); + theDumper << ", " << anAttrBasePoint << ", " << anAttrAxis; + AttributeDoublePtr anAttrRadius = aBase->real(PrimitivesPlugin_Cylinder::RADIUS_ID()); AttributeDoublePtr anAttrHeight = aBase->real(PrimitivesPlugin_Cylinder::HEIGHT_ID()); - - theDumper << ", " << anAttrBasePoint << ", " << anAttrAxis; theDumper << ", " << anAttrRadius << ", " << anAttrHeight; - + + std::string aCreationMethod = + aBase->string(PrimitivesPlugin_Cylinder::CREATION_METHOD())->value(); + if (aCreationMethod == PrimitivesPlugin_Cylinder::CREATION_METHOD_CYLINDER_PORTION()) { AttributeDoublePtr anAttrAngle = aBase->real(PrimitivesPlugin_Cylinder::ANGLE_ID()); theDumper << ", " << anAttrAngle; @@ -109,12 +99,11 @@ CylinderPtr addCylinder(const std::shared_ptr& thePart, const ModelHighAPI_Selection& theBasePoint, const ModelHighAPI_Selection& theAxis, const ModelHighAPI_Double& theRadius, - const ModelHighAPI_Double& theHeight, - const ModelHighAPI_Double& theAngle) + const ModelHighAPI_Double& theHeight) { std::shared_ptr aFeature = thePart->addFeature(PrimitivesAPI_Cylinder::ID()); return CylinderPtr(new PrimitivesAPI_Cylinder(aFeature, theBasePoint, theAxis, - theRadius, theHeight, theAngle)); + theRadius, theHeight)); } //================================================================================================== @@ -122,34 +111,35 @@ CylinderPtr addCylinder(const std::shared_ptr& thePart, const ModelHighAPI_Selection& theBasePoint, const ModelHighAPI_Selection& theAxis, const ModelHighAPI_Double& theRadius, - const ModelHighAPI_Double& theHeight) + const ModelHighAPI_Double& theHeight, + const ModelHighAPI_Double& theAngle) { std::shared_ptr aFeature = thePart->addFeature(PrimitivesAPI_Cylinder::ID()); return CylinderPtr(new PrimitivesAPI_Cylinder(aFeature, theBasePoint, theAxis, - theRadius, theHeight)); + theRadius, theHeight, theAngle)); } //================================================================================================== CylinderPtr addCylinder(const std::shared_ptr& thePart, const ModelHighAPI_Double& theRadius, - const ModelHighAPI_Double& theHeight, - const ModelHighAPI_Double& theAngle) + const ModelHighAPI_Double& theHeight) { - std::shared_ptr aFeature = thePart->addFeature(PrimitivesAPI_Cylinder::ID()); ModelHighAPI_Selection aBasePoint("VERT", "Origin"); ModelHighAPI_Selection anAxis("EDGE", "OZ"); + std::shared_ptr aFeature = thePart->addFeature(PrimitivesAPI_Cylinder::ID()); return CylinderPtr(new PrimitivesAPI_Cylinder(aFeature, aBasePoint, anAxis, - theRadius, theHeight, theAngle)); + theRadius, theHeight)); } //================================================================================================== CylinderPtr addCylinder(const std::shared_ptr& thePart, const ModelHighAPI_Double& theRadius, - const ModelHighAPI_Double& theHeight) + const ModelHighAPI_Double& theHeight, + const ModelHighAPI_Double& theAngle) { - std::shared_ptr aFeature = thePart->addFeature(PrimitivesAPI_Cylinder::ID()); ModelHighAPI_Selection aBasePoint("VERT", "Origin"); ModelHighAPI_Selection anAxis("EDGE", "OZ"); + std::shared_ptr aFeature = thePart->addFeature(PrimitivesAPI_Cylinder::ID()); return CylinderPtr(new PrimitivesAPI_Cylinder(aFeature, aBasePoint, anAxis, theRadius, theHeight)); } \ No newline at end of file