X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FFeaturesPlugin%2FFeaturesPlugin_Boolean.cpp;h=3161b31c22e9cd1978659f88834d512b6ce8dc9c;hb=1788d3baf9a25806d24754c9f8e32e52ac32d3d3;hp=220b4144c6e05edfdfe87eb12124309be7ea5e4f;hpb=ba737434252ae41c4bee1b792a0f0bb098ffae87;p=modules%2Fshaper.git diff --git a/src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp b/src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp index 220b4144c..3161b31c2 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -18,7 +19,7 @@ FeaturesPlugin_Boolean::FeaturesPlugin_Boolean() void FeaturesPlugin_Boolean::initAttributes() { - data()->addAttribute(FeaturesPlugin_Boolean::TYPE_ID(), ModelAPI_AttributeReference::type()); + data()->addAttribute(FeaturesPlugin_Boolean::TYPE_ID(), ModelAPI_AttributeInteger::type()); data()->addAttribute(FeaturesPlugin_Boolean::OBJECT_ID(), ModelAPI_AttributeReference::type()); data()->addAttribute(FeaturesPlugin_Boolean::TOOL_ID(), ModelAPI_AttributeReference::type()); } @@ -39,6 +40,12 @@ boost::shared_ptr FeaturesPlugin_Boolean::getShape(const std::str void FeaturesPlugin_Boolean::execute() { + boost::shared_ptr aTypeAttr = boost::dynamic_pointer_cast< + ModelAPI_AttributeInteger>(data()->attribute(FeaturesPlugin_Boolean::TYPE_ID())); + if (!aTypeAttr) + return; + int aType = aTypeAttr->value(); + boost::shared_ptr aObject = this->getShape(FeaturesPlugin_Boolean::OBJECT_ID()); if (!aObject) return; @@ -48,6 +55,16 @@ void FeaturesPlugin_Boolean::execute() return; boost::shared_ptr aResult = document()->createBody(data()); - aResult->store(GeomAlgoAPI_Boolean::makeCut(aObject, aTool)); + switch (aType) { + case BOOL_CUT: + aResult->store(GeomAlgoAPI_Boolean::makeCut(aObject, aTool)); + break; + case BOOL_FUSE: + aResult->store(GeomAlgoAPI_Boolean::makeFuse(aObject, aTool)); + break; + case BOOL_COMMON: + aResult->store(GeomAlgoAPI_Boolean::makeCommon(aObject, aTool)); + break; + } setResult(aResult); } \ No newline at end of file