#include "FeaturesAPI_BoundingBox.h"
-#include <FeaturesPlugin_CreateBoundingBox.h>
+#include <FeaturesPlugin_BoundingBox.h>
#include <ModelAPI_AttributeDoubleArray.h>
#include <ModelHighAPI_Services.h>
#include <ModelHighAPI_Tools.h>
const std::string& aDocName = theDumper.name(aBase->document());
AttributeSelectionPtr anAttrObject;
- anAttrObject = aBase->selection(FeaturesPlugin_CreateBoundingBox::OBJECT_ID());
+ anAttrObject = aBase->selection(FeaturesPlugin_BoundingBox::OBJECT_ID());
theDumper << aBase << " = model.getBoundingBox(" << aDocName << ", " << anAttrObject;
{
FeaturePtr aFeature =
- thePart->addFeature(FeaturesPlugin_CreateBoundingBox::ID());
+ thePart->addFeature(FeaturesPlugin_BoundingBox::ID());
BoundingBoxPtr aBoundingBox;
#include "FeaturesAPI.h"
-#include "FeaturesPlugin_CreateBoundingBox.h"
+#include "FeaturesPlugin_BoundingBox.h"
#include <ModelHighAPI_Interface.h>
#include <ModelHighAPI_Macro.h>
FEATURESAPI_EXPORT
virtual ~FeaturesAPI_BoundingBox();
- INTERFACE_1(FeaturesPlugin_CreateBoundingBox::ID(),
- objectSelected, FeaturesPlugin_CreateBoundingBox::OBJECT_ID(),
+ INTERFACE_1(FeaturesPlugin_BoundingBox::ID(),
+ objectSelected, FeaturesPlugin_BoundingBox::OBJECT_ID(),
ModelAPI_AttributeSelection, /** object selected*/)
/// Dump wrapped feature
FeaturesPlugin_PointCoordinates.h
FeaturesPlugin_GeometryCalculation.h
FeaturesPlugin_BoundingBox.h
- FeaturesPlugin_CommonBoundingBox.h
- FeaturesPlugin_CreateBoundingBox.h
+ FeaturesPlugin_BoundingBoxBase.h
+ FeaturesPlugin_InspectBoundingBox.h
)
SET(PROJECT_SOURCES
FeaturesPlugin_PointCoordinates.cpp
FeaturesPlugin_GeometryCalculation.cpp
FeaturesPlugin_BoundingBox.cpp
- FeaturesPlugin_CommonBoundingBox.cpp
- FeaturesPlugin_CreateBoundingBox.cpp
+ FeaturesPlugin_BoundingBoxBase.cpp
+ FeaturesPlugin_InspectBoundingBox.cpp
)
SET(XML_RESOURCES
#include "FeaturesPlugin_BoundingBox.h"
-#include <Config_PropManager.h>
-
-#include <FeaturesPlugin_CreateBoundingBox.h>
-
-#include <GeomAlgoAPI_BoundingBox.h>
-
#include <ModelAPI_AttributeSelection.h>
#include <ModelAPI_AttributeDoubleArray.h>
-#include <ModelAPI_AttributeBoolean.h>
#include <ModelAPI_AttributeString.h>
+#include <ModelAPI_AttributeBoolean.h>
+
#include <ModelAPI_Data.h>
#include <ModelAPI_Session.h>
#include <ModelAPI_Validator.h>
+#include <GeomAlgoAPI_BoundingBox.h>
+
+#include <Config_PropManager.h>
+#include <ModelAPI_ResultBody.h>
+
#include <iomanip>
#include <sstream>
data()->addAttribute(X_MAX_COORD_ID(), ModelAPI_AttributeString::typeId());
data()->addAttribute(Y_MAX_COORD_ID(), ModelAPI_AttributeString::typeId());
data()->addAttribute(Z_MAX_COORD_ID(), ModelAPI_AttributeString::typeId());
- data()->addAttribute(CREATEBOX_ID(), ModelAPI_AttributeBoolean::typeId());
+ data()->addAttribute(COMPUTE_ID(), ModelAPI_AttributeBoolean::typeId());
ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), X_MIN_COORD_ID());
ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), Y_MIN_COORD_ID());
ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), X_MAX_COORD_ID());
ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), Y_MAX_COORD_ID());
ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), Z_MAX_COORD_ID());
- ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), CREATEBOX_ID());
- ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), RESULT_VALUES_ID());
-
+ ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), COMPUTE_ID());
+ ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), OBJECT_ID());
data()->addAttribute(RESULT_VALUES_ID(), ModelAPI_AttributeDoubleArray::typeId());
data()->realArray(RESULT_VALUES_ID())->setSize(6);
-
+ data()->boolean(COMPUTE_ID())->setValue(true);
}
//=================================================================================================
return;
createBoxByTwoPoints();
-
- if (boolean(CREATEBOX_ID())->value()) {
- if (!myCreateFeature.get())
- createBox();
- updateBox();
- } else {
- if (myCreateFeature.get()) {
- myCreateFeature->eraseResults();
- SessionPtr aSession = ModelAPI_Session::get();
- DocumentPtr aDoc = aSession->activeDocument();
- aDoc->removeFeature(myCreateFeature);
- myCreateFeature.reset();
- }
- }
-}
-
-//=================================================================================================
-void FeaturesPlugin_BoundingBox::attributeChanged(const std::string& theID)
-{
- if (theID == OBJECT_ID()) {
- if (myCreateFeature.get())
- updateBox();
- }
}
//=================================================================================================
-AttributePtr FeaturesPlugin_BoundingBox::attributResultValues()
+void FeaturesPlugin_BoundingBox::attributeChanged(const std::string&)
{
- return attribute(RESULT_VALUES_ID());
}
//=================================================================================================
bool FeaturesPlugin_BoundingBox::updateValues()
{
AttributeSelectionPtr aSelection = selection(OBJECT_ID());
- if (aSelection->isInitialized()) {
- AttributeDoubleArrayPtr aValues =
+ AttributeDoubleArrayPtr aValues =
std::dynamic_pointer_cast<ModelAPI_AttributeDoubleArray>(attribute(RESULT_VALUES_ID()));
+
+ if (aSelection->isInitialized()) {
std::stringstream streamxmin;
std::stringstream streamymin;
std::stringstream streamzmin;
aShape = aSelection->context()->shape();
}
+ AttributeBooleanPtr anIsCompute = boolean(COMPUTE_ID());
+ if (!anIsCompute->value()) {
+ myShape = aShape;
+ anIsCompute->setValue(true);
+ }
+
if (aShape && !aShape->isEqual(myShape)) {
double aXmin, aXmax, aYmin, aYmax, aZmin, aZmax;
std::string anError;
setError("Error in bounding box calculation :" + anError);
return false;
}
-
myShape = aShape;
streamxmin << std::setprecision(14) << aXmin;
aValues->setValue(0, aXmin);
aValues->setValue(4, aZmin);
streamzmax << std::setprecision(14) << aZmax;
aValues->setValue(5, aZmax);
- string(X_MIN_COORD_ID() )->setValue( "X = " + streamxmin.str() );
- string(Y_MIN_COORD_ID() )->setValue( "Y = " + streamymin.str() );
- string(Z_MIN_COORD_ID() )->setValue( "Z = " + streamzmin.str() );
- string(X_MAX_COORD_ID() )->setValue( "X = " + streamxmax.str() );
- string(Y_MAX_COORD_ID() )->setValue( "Y = " + streamymax.str() );
- string(Z_MAX_COORD_ID() )->setValue( "Z = " + streamzmax.str() );
+ } else {
+ streamxmin << std::setprecision(14) << aValues->value(0);
+ streamxmax << std::setprecision(14) << aValues->value(1);
+ streamymin << std::setprecision(14) << aValues->value(2);
+ streamymax << std::setprecision(14) << aValues->value(3);
+ streamzmin << std::setprecision(14) << aValues->value(4);
+ streamzmax << std::setprecision(14) << aValues->value(5);
}
- }
- return true;
-}
-
-//=================================================================================================
-void FeaturesPlugin_BoundingBox::createBox()
-{
- SessionPtr aSession = ModelAPI_Session::get();
-
- DocumentPtr aDoc = aSession->activeDocument();
- if (aDoc.get()) {
- myCreateFeature = aDoc->addFeature(FeaturesPlugin_CreateBoundingBox::ID());
+ string(X_MIN_COORD_ID() )->setValue( "X = " + streamxmin.str() );
+ string(Y_MIN_COORD_ID() )->setValue( "Y = " + streamymin.str() );
+ string(Z_MIN_COORD_ID() )->setValue( "Z = " + streamzmin.str() );
+ string(X_MAX_COORD_ID() )->setValue( "X = " + streamxmax.str() );
+ string(Y_MAX_COORD_ID() )->setValue( "Y = " + streamymax.str() );
+ string(Z_MAX_COORD_ID() )->setValue( "Z = " + streamzmax.str() );
}
+ return true;
}
//=================================================================================================
-void FeaturesPlugin_BoundingBox::updateBox()
+AttributePtr FeaturesPlugin_BoundingBox::attributResultValues()
{
- myCreateFeature->boolean(FeaturesPlugin_CreateBoundingBox::COMPUTE_ID())->setValue(false);
- myCreateFeature->selection(FeaturesPlugin_CreateBoundingBox::OBJECT_ID())
- ->setValue(selection(OBJECT_ID())->context(),
- selection(OBJECT_ID())->value());
-
- AttributeDoubleArrayPtr aValuesFeatures =
- std::dynamic_pointer_cast<ModelAPI_AttributeDoubleArray>
- (myCreateFeature->attribute(RESULT_VALUES_ID()));
- AttributeDoubleArrayPtr aValues =
- std::dynamic_pointer_cast<ModelAPI_AttributeDoubleArray>(attribute(RESULT_VALUES_ID()));
- for (int anI=0; anI < 6; anI++)
- aValuesFeatures->setValue(anI,aValues->value(anI));
-
- myCreateFeature->execute();
- myCreateFeature->boolean(FeaturesPlugin_CreateBoundingBox::COMPUTE_ID())->setValue(true);
+ return attribute(RESULT_VALUES_ID());
}
#ifndef FeaturesPlugin_BoundingBox_H_
#define FeaturesPlugin_BoundingBox_H_
-#include <FeaturesPlugin_CommonBoundingBox.h>
+#include <FeaturesPlugin_BoundingBoxBase.h>
/// \class FeaturesPlugin_BoundingBox
/// \ingroup Plugins
-/// \brief Feature to view the Bounding Box.
+/// \brief Persistence feature to create the bounding box.
-class FeaturesPlugin_BoundingBox : public FeaturesPlugin_CommonBoundingBox
+class FeaturesPlugin_BoundingBox : public FeaturesPlugin_BoundingBoxBase
{
public:
- /// Bounding box macro kind.
+ /// Bounding box kind.
inline static const std::string& ID()
{
- static const std::string MY_ID("BoundingBoxMacro");
+ static const std::string MY_ID("BoundingBox");
return MY_ID;
}
return MY_Z_MAX_COORD_ID;
}
- /// Attribute name for checkbox create box.
- inline static const std::string& CREATEBOX_ID()
- {
- static const std::string MY_CREATEBOX_ID("createbox");
- return MY_CREATEBOX_ID;
- }
-
/// Attribute name for values of result.
inline static const std::string& RESULT_VALUES_ID()
{
return MY_RESULT_VALUES_ID;
}
+ /// Attribute name for indicate to compute the bounding box.
+ inline static const std::string& COMPUTE_ID()
+ {
+ static const std::string MY_COMPUTE_ID("compute");
+ return MY_COMPUTE_ID;
+ }
+
/// \return the kind of a feature.
virtual const std::string& getKind()
{
/// \param theID identifier of changed attribute
FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
- /// Reimplemented from ModelAPI_Feature::isMacro(). Returns true.
- FEATURESPLUGIN_EXPORT virtual bool isMacro() const { return true; }
+ /// Return Attribut values of result.
+ FEATURESPLUGIN_EXPORT virtual AttributePtr attributResultValues();
/// Use plugin manager for features creation
FeaturesPlugin_BoundingBox();
private:
- /// Return Attribut values of result.
- virtual AttributePtr attributResultValues();
-
/// Update values displayed.
bool updateValues();
- /// Create Box
- void createBox();
- /// Update Box
- void updateBox();
-
- /// Feature to create box
- FeaturePtr myCreateFeature;
};
--- /dev/null
+// Copyright (C) 2018-2021 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "FeaturesPlugin_BoundingBoxBase.h"
+
+#include <ModelAPI_AttributeDoubleArray.h>
+
+#include <ModelAPI_Data.h>
+#include <ModelAPI_ResultBody.h>
+#include <ModelAPI_Session.h>
+#include <ModelAPI_Validator.h>
+#include <GeomAPI_Vertex.h>
+
+#include <GeomAlgoAPI_BoundingBox.h>
+#include <GeomAlgoAPI_PointBuilder.h>
+#include <GeomAlgoAPI_ShapeTools.h>
+
+#include <Config_PropManager.h>
+
+#include <iomanip>
+#include <sstream>
+
+
+
+//=================================================================================================
+void FeaturesPlugin_BoundingBoxBase::createBoxByTwoPoints()
+{
+ AttributeDoubleArrayPtr aValues =
+ std::dynamic_pointer_cast<ModelAPI_AttributeDoubleArray>(attributResultValues());
+
+ SessionPtr aSession = ModelAPI_Session::get();
+
+ DocumentPtr aDoc = aSession->activeDocument();
+
+ GeomVertexPtr vertexFirst =
+ GeomAlgoAPI_PointBuilder::vertex(aValues->value(0),
+ aValues->value(2),
+ aValues->value(4));
+
+ GeomVertexPtr vertexSecond =
+ GeomAlgoAPI_PointBuilder::vertex(aValues->value(1),
+ aValues->value(3),
+ aValues->value(5));
+
+
+ std::shared_ptr<GeomAlgoAPI_Box> aBoxAlgo;
+
+
+ aBoxAlgo = std::shared_ptr<GeomAlgoAPI_Box>(
+ new GeomAlgoAPI_Box(vertexFirst->point(),vertexSecond->point()));
+
+
+ // These checks should be made to the GUI for the feature but
+ // the corresponding validator does not exist yet.
+ if (!aBoxAlgo->check()) {
+ setError(aBoxAlgo->getError());
+ return;
+ }
+
+ // Build the box
+ aBoxAlgo->build();
+
+ // Check if the creation of the box
+ if (!aBoxAlgo->isDone()) {
+ // The error is not displayed in a popup window. It must be in the message console.
+ setError(aBoxAlgo->getError());
+ return;
+ }
+ if (!aBoxAlgo->checkValid("Box builder with two points")) {
+ // The error is not displayed in a popup window. It must be in the message console.
+ setError(aBoxAlgo->getError());
+ return;
+ }
+
+ int aResultIndex = 0;
+ ResultBodyPtr aResultBox = document()->createBody(data(), aResultIndex);
+ loadNamingDS(aBoxAlgo, aResultBox);
+ setResult(aResultBox, aResultIndex);
+}
+
+//=================================================================================================
+void FeaturesPlugin_BoundingBoxBase::loadNamingDS(std::shared_ptr<GeomAlgoAPI_Box> theBoxAlgo,
+ std::shared_ptr<ModelAPI_ResultBody> theResultBox)
+{
+ // Load the result
+ theResultBox->store(theBoxAlgo->shape());
+
+ // Prepare the naming
+ theBoxAlgo->prepareNamingFaces();
+
+ // Insert to faces
+ std::map< std::string, std::shared_ptr<GeomAPI_Shape> > listOfFaces =
+ theBoxAlgo->getCreatedFaces();
+ for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator it = listOfFaces.begin();
+ it != listOfFaces.end();
+ ++it) {
+ theResultBox->generated((*it).second, (*it).first);
+ }
+}
--- /dev/null
+// Copyright (C) 2018-2021 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef FeaturesPlugin_BoundingBoxBase_H_
+#define FeaturesPlugin_BoundingBoxBase_H_
+
+#include "FeaturesPlugin.h"
+#include <ModelAPI_Feature.h>
+
+#include <GeomAlgoAPI_Box.h>
+
+#include <GeomAPI_IPresentable.h>
+#include <GeomAPI_IScreenParams.h>
+
+#include <ModelAPI_Attribute.h>
+
+/// \class FeaturesPlugin_BoundingBoxBase
+/// \ingroup Plugins
+/// \brief Base feature to inspect properties of bounding box
+/// and create that box for the selected shape.
+class FeaturesPlugin_BoundingBoxBase : public ModelAPI_Feature
+{
+public:
+ /// Performs the algorithm and stores results it in the data structure.
+ FEATURESPLUGIN_EXPORT virtual void execute(){};
+
+ /// Return Attribut values of result.
+ virtual AttributePtr attributResultValues() = 0;
+
+protected:
+ FeaturesPlugin_BoundingBoxBase() {}
+
+ /// Create box with two points
+ void createBoxByTwoPoints();
+
+ /// Create namming
+ void loadNamingDS(std::shared_ptr<GeomAlgoAPI_Box> theBoxAlgo,
+ std::shared_ptr<ModelAPI_ResultBody> theResultBox);
+
+ GeomShapePtr myShape;
+};
+
+#endif
+++ /dev/null
-// Copyright (C) 2018-2021 CEA/DEN, EDF R&D
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-#include "FeaturesPlugin_CommonBoundingBox.h"
-
-#include <ModelAPI_AttributeDoubleArray.h>
-
-#include <ModelAPI_Data.h>
-#include <ModelAPI_ResultBody.h>
-#include <ModelAPI_Session.h>
-#include <ModelAPI_Validator.h>
-#include <GeomAPI_Vertex.h>
-
-#include <GeomAlgoAPI_BoundingBox.h>
-#include <GeomAlgoAPI_PointBuilder.h>
-#include <GeomAlgoAPI_ShapeTools.h>
-
-#include <Config_PropManager.h>
-
-#include <iomanip>
-#include <sstream>
-
-
-
-//=================================================================================================
-void FeaturesPlugin_CommonBoundingBox::createBoxByTwoPoints()
-{
- AttributeDoubleArrayPtr aValues =
- std::dynamic_pointer_cast<ModelAPI_AttributeDoubleArray>(attributResultValues());
-
- SessionPtr aSession = ModelAPI_Session::get();
-
- DocumentPtr aDoc = aSession->activeDocument();
-
- GeomVertexPtr vertexFirst =
- GeomAlgoAPI_PointBuilder::vertex(aValues->value(0),
- aValues->value(2),
- aValues->value(4));
-
- GeomVertexPtr vertexSecond =
- GeomAlgoAPI_PointBuilder::vertex(aValues->value(1),
- aValues->value(3),
- aValues->value(5));
-
-
- std::shared_ptr<GeomAlgoAPI_Box> aBoxAlgo;
-
-
- aBoxAlgo = std::shared_ptr<GeomAlgoAPI_Box>(
- new GeomAlgoAPI_Box(vertexFirst->point(),vertexSecond->point()));
-
-
- // These checks should be made to the GUI for the feature but
- // the corresponding validator does not exist yet.
- if (!aBoxAlgo->check()) {
- setError(aBoxAlgo->getError());
- return;
- }
-
- // Build the box
- aBoxAlgo->build();
-
- // Check if the creation of the box
- if (!aBoxAlgo->isDone()) {
- // The error is not displayed in a popup window. It must be in the message console.
- setError(aBoxAlgo->getError());
- return;
- }
- if (!aBoxAlgo->checkValid("Box builder with two points")) {
- // The error is not displayed in a popup window. It must be in the message console.
- setError(aBoxAlgo->getError());
- return;
- }
-
- int aResultIndex = 0;
- ResultBodyPtr aResultBox = document()->createBody(data(), aResultIndex);
- loadNamingDS(aBoxAlgo, aResultBox);
- setResult(aResultBox, aResultIndex);
-}
-
-//=================================================================================================
-void FeaturesPlugin_CommonBoundingBox::loadNamingDS(std::shared_ptr<GeomAlgoAPI_Box> theBoxAlgo,
- std::shared_ptr<ModelAPI_ResultBody> theResultBox)
-{
- // Load the result
- theResultBox->store(theBoxAlgo->shape());
-
- // Prepare the naming
- theBoxAlgo->prepareNamingFaces();
-
- // Insert to faces
- std::map< std::string, std::shared_ptr<GeomAPI_Shape> > listOfFaces =
- theBoxAlgo->getCreatedFaces();
- for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator it = listOfFaces.begin();
- it != listOfFaces.end();
- ++it) {
- theResultBox->generated((*it).second, (*it).first);
- }
-}
+++ /dev/null
-// Copyright (C) 2018-2021 CEA/DEN, EDF R&D
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-#ifndef FeaturesPlugin_CommonBoundingBox_H_
-#define FeaturesPlugin_CommonBoundingBox_H_
-
-#include "FeaturesPlugin.h"
-#include <ModelAPI_Feature.h>
-
-#include <GeomAlgoAPI_Box.h>
-
-#include <GeomAPI_IPresentable.h>
-#include <GeomAPI_IScreenParams.h>
-
-#include <ModelAPI_Attribute.h>
-
-/// \class FeaturesPlugin_CommonBoundingBox
-/// \ingroup Plugins
-/// \brief Feature to view the Bounding Box.
-
-class FeaturesPlugin_CommonBoundingBox : public ModelAPI_Feature
-{
-public:
- /// Performs the algorithm and stores results it in the data structure.
- FEATURESPLUGIN_EXPORT virtual void execute(){};
-
- /// Return Attribut values of result.
- virtual AttributePtr attributResultValues() = 0;
-
-protected:
- FeaturesPlugin_CommonBoundingBox() {}
-
- /// Create box with two points
- void createBoxByTwoPoints();
-
- /// Create namming
- void loadNamingDS(std::shared_ptr<GeomAlgoAPI_Box> theBoxAlgo,
- std::shared_ptr<ModelAPI_ResultBody> theResultBox);
-
- GeomShapePtr myShape;
-};
-
-#endif
+++ /dev/null
-// Copyright (C) 2018-2021 CEA/DEN, EDF R&D
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-#include "FeaturesPlugin_CreateBoundingBox.h"
-
-#include <ModelAPI_AttributeSelection.h>
-#include <ModelAPI_AttributeDoubleArray.h>
-#include <ModelAPI_AttributeString.h>
-#include <ModelAPI_AttributeBoolean.h>
-
-#include <ModelAPI_Data.h>
-#include <ModelAPI_Session.h>
-#include <ModelAPI_Validator.h>
-
-#include <GeomAlgoAPI_BoundingBox.h>
-
-#include <Config_PropManager.h>
-#include <ModelAPI_ResultBody.h>
-
-#include <iomanip>
-#include <sstream>
-
-//=================================================================================================
-FeaturesPlugin_CreateBoundingBox::FeaturesPlugin_CreateBoundingBox()
-{
-}
-
-//=================================================================================================
-void FeaturesPlugin_CreateBoundingBox::initAttributes()
-{
- // attribute for object selected
- data()->addAttribute(OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
-
- // attributes for result message and values
- data()->addAttribute(X_MIN_COORD_ID(), ModelAPI_AttributeString::typeId());
- data()->addAttribute(Y_MIN_COORD_ID(), ModelAPI_AttributeString::typeId());
- data()->addAttribute(Z_MIN_COORD_ID(), ModelAPI_AttributeString::typeId());
- data()->addAttribute(X_MAX_COORD_ID(), ModelAPI_AttributeString::typeId());
- data()->addAttribute(Y_MAX_COORD_ID(), ModelAPI_AttributeString::typeId());
- data()->addAttribute(Z_MAX_COORD_ID(), ModelAPI_AttributeString::typeId());
- data()->addAttribute(COMPUTE_ID(), ModelAPI_AttributeBoolean::typeId());
-
- ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), X_MIN_COORD_ID());
- ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), Y_MIN_COORD_ID());
- ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), Z_MIN_COORD_ID());
- ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), X_MAX_COORD_ID());
- ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), Y_MAX_COORD_ID());
- ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), Z_MAX_COORD_ID());
- ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), COMPUTE_ID());
- ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), OBJECT_ID());
- data()->addAttribute(RESULT_VALUES_ID(), ModelAPI_AttributeDoubleArray::typeId());
-
- data()->realArray(RESULT_VALUES_ID())->setSize(6);
- data()->boolean(COMPUTE_ID())->setValue(true);
-}
-
-//=================================================================================================
-void FeaturesPlugin_CreateBoundingBox::execute()
-{
- if (!updateValues())
- return;
-
- createBoxByTwoPoints();
-}
-
-//=================================================================================================
-void FeaturesPlugin_CreateBoundingBox::attributeChanged(const std::string& theID)
-{
-}
-
-//=================================================================================================
-bool FeaturesPlugin_CreateBoundingBox::updateValues()
-{
- AttributeSelectionPtr aSelection = selection(OBJECT_ID());
- AttributeDoubleArrayPtr aValues =
- std::dynamic_pointer_cast<ModelAPI_AttributeDoubleArray>(attribute(RESULT_VALUES_ID()));
-
- if (aSelection->isInitialized()) {
- std::stringstream streamxmin;
- std::stringstream streamymin;
- std::stringstream streamzmin;
- std::stringstream streamxmax;
- std::stringstream streamymax;
- std::stringstream streamzmax;
-
- GeomShapePtr aShape;
- if (aSelection && aSelection->isInitialized()) {
- aShape = aSelection->value();
- if (!aShape && aSelection->context())
- aShape = aSelection->context()->shape();
- }
-
- AttributeBooleanPtr anIsCompute = boolean(COMPUTE_ID());
- if (!anIsCompute->value()) {
- myShape = aShape;
- anIsCompute->setValue(true);
- }
-
- if (aShape && !aShape->isEqual(myShape)) {
- double aXmin, aXmax, aYmin, aYmax, aZmin, aZmax;
- std::string anError;
- if (!GetBoundingBox(aShape,
- aXmin, aXmax,
- aYmin, aYmax,
- aZmin, aZmax,
- anError)) {
- setError("Error in bounding box calculation :" + anError);
- return false;
- }
- myShape = aShape;
- streamxmin << std::setprecision(14) << aXmin;
- aValues->setValue(0, aXmin);
- streamxmax << std::setprecision(14) << aXmax;
- aValues->setValue(1, aXmax);
- streamymin << std::setprecision(14) << aYmin;
- aValues->setValue(2, aYmin);
- streamymax << std::setprecision(14) << aYmax;
- aValues->setValue(3, aYmax);
- streamzmin << std::setprecision(14) << aZmin;
- aValues->setValue(4, aZmin);
- streamzmax << std::setprecision(14) << aZmax;
- aValues->setValue(5, aZmax);
- } else {
- streamxmin << std::setprecision(14) << aValues->value(0);
- streamxmax << std::setprecision(14) << aValues->value(1);
- streamymin << std::setprecision(14) << aValues->value(2);
- streamymax << std::setprecision(14) << aValues->value(3);
- streamzmin << std::setprecision(14) << aValues->value(4);
- streamzmax << std::setprecision(14) << aValues->value(5);
- }
-
- string(X_MIN_COORD_ID() )->setValue( "X = " + streamxmin.str() );
- string(Y_MIN_COORD_ID() )->setValue( "Y = " + streamymin.str() );
- string(Z_MIN_COORD_ID() )->setValue( "Z = " + streamzmin.str() );
- string(X_MAX_COORD_ID() )->setValue( "X = " + streamxmax.str() );
- string(Y_MAX_COORD_ID() )->setValue( "Y = " + streamymax.str() );
- string(Z_MAX_COORD_ID() )->setValue( "Z = " + streamzmax.str() );
- }
- return true;
-}
-
-//=================================================================================================
-AttributePtr FeaturesPlugin_CreateBoundingBox::attributResultValues()
-{
- return attribute(RESULT_VALUES_ID());
-}
+++ /dev/null
-// Copyright (C) 2018-2021 CEA/DEN, EDF R&D
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-#ifndef FeaturesPlugin_CreateBoundingBox_H_
-#define FeaturesPlugin_CreateBoundingBox_H_
-
-#include <FeaturesPlugin_CommonBoundingBox.h>
-
-/// \class FeaturesPlugin_BoundingBox
-/// \ingroup Plugins
-/// \brief Feature to view the Bounding Box.
-
-class FeaturesPlugin_CreateBoundingBox : public FeaturesPlugin_CommonBoundingBox
-{
-public:
- /// Bounding box kind.
- inline static const std::string& ID()
- {
- static const std::string MY_ID("BoundingBox");
- return MY_ID;
- }
-
- /// Attribute name for object selected.
- inline static const std::string& OBJECT_ID()
- {
- static const std::string MY_OBJECT_ID("main_object");
- return MY_OBJECT_ID;
- }
-
- /// Attribute name for x coodinate.
- inline static const std::string& X_MIN_COORD_ID()
- {
- static const std::string MY_X_MIN_COORD_ID("xmincoordinate");
- return MY_X_MIN_COORD_ID;
- }
-
- /// Attribute name for y coodinate.
- inline static const std::string& Y_MIN_COORD_ID()
- {
- static const std::string MY_Y_MIN_COORD_ID("ymincoordinate");
- return MY_Y_MIN_COORD_ID;
- }
-
- /// Attribute name for z coodinate.
- inline static const std::string& Z_MIN_COORD_ID()
- {
- static const std::string MY_Z_MIN_COORD_ID("zmincoordinate");
- return MY_Z_MIN_COORD_ID;
- }
-
- /// Attribute name for x max coodinate.
- inline static const std::string& X_MAX_COORD_ID()
- {
- static const std::string MY_X_MAX_COORD_ID("xmaxcoordinate");
- return MY_X_MAX_COORD_ID;
- }
-
- /// Attribute name for y max coodinate.
- inline static const std::string& Y_MAX_COORD_ID()
- {
- static const std::string MY_Y_MAX_COORD_ID("ymaxcoordinate");
- return MY_Y_MAX_COORD_ID;
- }
-
- /// Attribute name for z max coodinate.
- inline static const std::string& Z_MAX_COORD_ID()
- {
- static const std::string MY_Z_MAX_COORD_ID("zmaxcoordinate");
- return MY_Z_MAX_COORD_ID;
- }
-
- /// Attribute name for values of result.
- inline static const std::string& RESULT_VALUES_ID()
- {
- static const std::string MY_RESULT_VALUES_ID("result_values");
- return MY_RESULT_VALUES_ID;
- }
-
- /// Attribute name for indicate to compute the bounding box.
- inline static const std::string& COMPUTE_ID()
- {
- static const std::string MY_COMPUTE_ID("compute");
- return MY_COMPUTE_ID;
- }
-
- /// \return the kind of a feature.
- virtual const std::string& getKind()
- {
- return ID();
- }
-
- /// Performs the algorithm and stores results it in the data structure.
- FEATURESPLUGIN_EXPORT virtual void execute();
-
- /// Request for initialization of data model of the feature: adding all attributes
- FEATURESPLUGIN_EXPORT virtual void initAttributes();
-
- /// Called on change of any argument-attribute of this object
- /// \param theID identifier of changed attribute
- FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
-
- /// Return Attribut values of result.
- FEATURESPLUGIN_EXPORT virtual AttributePtr attributResultValues();
-
- /// Use plugin manager for features creation
- FeaturesPlugin_CreateBoundingBox();
-
-private:
- /// Update values displayed.
- bool updateValues();
-
-};
-
-#endif
--- /dev/null
+// Copyright (C) 2018-2021 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "FeaturesPlugin_InspectBoundingBox.h"
+
+#include <Config_PropManager.h>
+
+#include <FeaturesPlugin_CreateBoundingBox.h>
+
+#include <GeomAlgoAPI_BoundingBox.h>
+
+#include <ModelAPI_AttributeSelection.h>
+#include <ModelAPI_AttributeDoubleArray.h>
+#include <ModelAPI_AttributeBoolean.h>
+#include <ModelAPI_AttributeString.h>
+#include <ModelAPI_Data.h>
+#include <ModelAPI_Session.h>
+#include <ModelAPI_Validator.h>
+
+#include <iomanip>
+#include <sstream>
+
+//=================================================================================================
+FeaturesPlugin_InspectBoundingBox::FeaturesPlugin_InspectBoundingBox()
+{
+}
+
+//=================================================================================================
+void FeaturesPlugin_InspectBoundingBox::initAttributes()
+{
+ // attribute for object selected
+ data()->addAttribute(OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
+
+ // attributes for result message and values
+ data()->addAttribute(X_MIN_COORD_ID(), ModelAPI_AttributeString::typeId());
+ data()->addAttribute(Y_MIN_COORD_ID(), ModelAPI_AttributeString::typeId());
+ data()->addAttribute(Z_MIN_COORD_ID(), ModelAPI_AttributeString::typeId());
+ data()->addAttribute(X_MAX_COORD_ID(), ModelAPI_AttributeString::typeId());
+ data()->addAttribute(Y_MAX_COORD_ID(), ModelAPI_AttributeString::typeId());
+ data()->addAttribute(Z_MAX_COORD_ID(), ModelAPI_AttributeString::typeId());
+ data()->addAttribute(CREATEBOX_ID(), ModelAPI_AttributeBoolean::typeId());
+
+ ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), X_MIN_COORD_ID());
+ ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), Y_MIN_COORD_ID());
+ ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), Z_MIN_COORD_ID());
+ ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), X_MAX_COORD_ID());
+ ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), Y_MAX_COORD_ID());
+ ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), Z_MAX_COORD_ID());
+ ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), CREATEBOX_ID());
+ ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), RESULT_VALUES_ID());
+
+ data()->addAttribute(RESULT_VALUES_ID(), ModelAPI_AttributeDoubleArray::typeId());
+
+ data()->realArray(RESULT_VALUES_ID())->setSize(6);
+
+}
+
+//=================================================================================================
+void FeaturesPlugin_InspectBoundingBox::execute()
+{
+ if (!updateValues())
+ return;
+
+ createBoxByTwoPoints();
+
+ if (boolean(CREATEBOX_ID())->value()) {
+ if (!myCreateFeature.get())
+ createBox();
+ updateBox();
+ } else {
+ if (myCreateFeature.get()) {
+ myCreateFeature->eraseResults();
+ SessionPtr aSession = ModelAPI_Session::get();
+ DocumentPtr aDoc = aSession->activeDocument();
+ aDoc->removeFeature(myCreateFeature);
+ myCreateFeature.reset();
+ }
+ }
+}
+
+//=================================================================================================
+void FeaturesPlugin_InspectBoundingBox::attributeChanged(const std::string& theID)
+{
+ if (theID == OBJECT_ID()) {
+ if (myCreateFeature.get())
+ updateBox();
+ }
+}
+
+//=================================================================================================
+AttributePtr FeaturesPlugin_InspectBoundingBox::attributResultValues()
+{
+ return attribute(RESULT_VALUES_ID());
+}
+
+//=================================================================================================
+bool FeaturesPlugin_InspectBoundingBox::updateValues()
+{
+ AttributeSelectionPtr aSelection = selection(OBJECT_ID());
+ if (aSelection->isInitialized()) {
+ AttributeDoubleArrayPtr aValues =
+ std::dynamic_pointer_cast<ModelAPI_AttributeDoubleArray>(attribute(RESULT_VALUES_ID()));
+ std::stringstream streamxmin;
+ std::stringstream streamymin;
+ std::stringstream streamzmin;
+ std::stringstream streamxmax;
+ std::stringstream streamymax;
+ std::stringstream streamzmax;
+
+ GeomShapePtr aShape;
+ if (aSelection && aSelection->isInitialized()) {
+ aShape = aSelection->value();
+ if (!aShape && aSelection->context())
+ aShape = aSelection->context()->shape();
+ }
+
+ if (aShape && !aShape->isEqual(myShape)) {
+ double aXmin, aXmax, aYmin, aYmax, aZmin, aZmax;
+ std::string anError;
+ if (!GetBoundingBox(aShape,
+ aXmin, aXmax,
+ aYmin, aYmax,
+ aZmin, aZmax,
+ anError)) {
+ setError("Error in bounding box calculation :" + anError);
+ return false;
+ }
+
+ myShape = aShape;
+ streamxmin << std::setprecision(14) << aXmin;
+ aValues->setValue(0, aXmin);
+ streamxmax << std::setprecision(14) << aXmax;
+ aValues->setValue(1, aXmax);
+ streamymin << std::setprecision(14) << aYmin;
+ aValues->setValue(2, aYmin);
+ streamymax << std::setprecision(14) << aYmax;
+ aValues->setValue(3, aYmax);
+ streamzmin << std::setprecision(14) << aZmin;
+ aValues->setValue(4, aZmin);
+ streamzmax << std::setprecision(14) << aZmax;
+ aValues->setValue(5, aZmax);
+ string(X_MIN_COORD_ID() )->setValue( "X = " + streamxmin.str() );
+ string(Y_MIN_COORD_ID() )->setValue( "Y = " + streamymin.str() );
+ string(Z_MIN_COORD_ID() )->setValue( "Z = " + streamzmin.str() );
+ string(X_MAX_COORD_ID() )->setValue( "X = " + streamxmax.str() );
+ string(Y_MAX_COORD_ID() )->setValue( "Y = " + streamymax.str() );
+ string(Z_MAX_COORD_ID() )->setValue( "Z = " + streamzmax.str() );
+ }
+ }
+ return true;
+}
+
+//=================================================================================================
+void FeaturesPlugin_InspectBoundingBox::createBox()
+{
+ SessionPtr aSession = ModelAPI_Session::get();
+
+ DocumentPtr aDoc = aSession->activeDocument();
+
+ if (aDoc.get()) {
+ myCreateFeature = aDoc->addFeature(FeaturesPlugin_CreateBoundingBox::ID());
+ }
+}
+
+//=================================================================================================
+void FeaturesPlugin_InspectBoundingBox::updateBox()
+{
+ myCreateFeature->boolean(FeaturesPlugin_CreateBoundingBox::COMPUTE_ID())->setValue(false);
+ myCreateFeature->selection(FeaturesPlugin_CreateBoundingBox::OBJECT_ID())
+ ->setValue(selection(OBJECT_ID())->context(),
+ selection(OBJECT_ID())->value());
+
+ AttributeDoubleArrayPtr aValuesFeatures =
+ std::dynamic_pointer_cast<ModelAPI_AttributeDoubleArray>
+ (myCreateFeature->attribute(RESULT_VALUES_ID()));
+ AttributeDoubleArrayPtr aValues =
+ std::dynamic_pointer_cast<ModelAPI_AttributeDoubleArray>(attribute(RESULT_VALUES_ID()));
+ for (int anI=0; anI < 6; anI++)
+ aValuesFeatures->setValue(anI,aValues->value(anI));
+
+ myCreateFeature->execute();
+ myCreateFeature->boolean(FeaturesPlugin_CreateBoundingBox::COMPUTE_ID())->setValue(true);
+}
--- /dev/null
+// Copyright (C) 2018-2021 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef FeaturesPlugin_InspectBoundingBox_H_
+#define FeaturesPlugin_InspectBoundingBox_H_
+
+#include <FeaturesPlugin_BoundingBoxBase.h>
+
+/// \class FeaturesPlugin_InspectBoundingBox
+/// \ingroup Plugins
+/// \brief Feature to view the Bounding Box.
+
+class FeaturesPlugin_InspectBoundingBox : public FeaturesPlugin_BoundingBoxBase
+{
+public:
+ /// Bounding box macro kind.
+ inline static const std::string& ID()
+ {
+ static const std::string MY_ID("BoundingBoxMacro");
+ return MY_ID;
+ }
+
+ /// Attribute name for object selected.
+ inline static const std::string& OBJECT_ID()
+ {
+ static const std::string MY_OBJECT_ID("main_object");
+ return MY_OBJECT_ID;
+ }
+
+ /// Attribute name for x coodinate.
+ inline static const std::string& X_MIN_COORD_ID()
+ {
+ static const std::string MY_X_MIN_COORD_ID("xmincoordinate");
+ return MY_X_MIN_COORD_ID;
+ }
+
+ /// Attribute name for y coodinate.
+ inline static const std::string& Y_MIN_COORD_ID()
+ {
+ static const std::string MY_Y_MIN_COORD_ID("ymincoordinate");
+ return MY_Y_MIN_COORD_ID;
+ }
+
+ /// Attribute name for z coodinate.
+ inline static const std::string& Z_MIN_COORD_ID()
+ {
+ static const std::string MY_Z_MIN_COORD_ID("zmincoordinate");
+ return MY_Z_MIN_COORD_ID;
+ }
+
+ /// Attribute name for x max coodinate.
+ inline static const std::string& X_MAX_COORD_ID()
+ {
+ static const std::string MY_X_MAX_COORD_ID("xmaxcoordinate");
+ return MY_X_MAX_COORD_ID;
+ }
+
+ /// Attribute name for y max coodinate.
+ inline static const std::string& Y_MAX_COORD_ID()
+ {
+ static const std::string MY_Y_MAX_COORD_ID("ymaxcoordinate");
+ return MY_Y_MAX_COORD_ID;
+ }
+
+ /// Attribute name for z max coodinate.
+ inline static const std::string& Z_MAX_COORD_ID()
+ {
+ static const std::string MY_Z_MAX_COORD_ID("zmaxcoordinate");
+ return MY_Z_MAX_COORD_ID;
+ }
+
+ /// Attribute name for checkbox create box.
+ inline static const std::string& CREATEBOX_ID()
+ {
+ static const std::string MY_CREATEBOX_ID("createbox");
+ return MY_CREATEBOX_ID;
+ }
+
+ /// Attribute name for values of result.
+ inline static const std::string& RESULT_VALUES_ID()
+ {
+ static const std::string MY_RESULT_VALUES_ID("result_values");
+ return MY_RESULT_VALUES_ID;
+ }
+
+ /// \return the kind of a feature.
+ virtual const std::string& getKind()
+ {
+ return ID();
+ }
+
+ /// Performs the algorithm and stores results it in the data structure.
+ FEATURESPLUGIN_EXPORT virtual void execute();
+
+ /// Request for initialization of data model of the feature: adding all attributes
+ FEATURESPLUGIN_EXPORT virtual void initAttributes();
+
+ /// Called on change of any argument-attribute of this object
+ /// \param theID identifier of changed attribute
+ FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
+
+ /// Reimplemented from ModelAPI_Feature::isMacro(). Returns true.
+ FEATURESPLUGIN_EXPORT virtual bool isMacro() const { return true; }
+
+ /// Use plugin manager for features creation
+ FeaturesPlugin_InspectBoundingBox();
+
+private:
+ /// Return Attribut values of result.
+ virtual AttributePtr attributResultValues();
+
+ /// Update values displayed.
+ bool updateValues();
+ /// Create Box
+ void createBox();
+ /// Update Box
+ void updateBox();
+
+ /// Feature to create box
+ FeaturePtr myCreateFeature;
+
+};
+
+#endif
#include <FeaturesPlugin_BooleanFill.h>
#include <FeaturesPlugin_BoundingBox.h>
#include <FeaturesPlugin_Chamfer.h>
-#include <FeaturesPlugin_CreateBoundingBox.h>
#include <FeaturesPlugin_Defeaturing.h>
#include <FeaturesPlugin_Extrusion.h>
#include <FeaturesPlugin_ExtrusionCut.h>
#include <FeaturesPlugin_Fillet.h>
#include <FeaturesPlugin_Fillet1D.h>
#include <FeaturesPlugin_GeometryCalculation.h>
+#include <FeaturesPlugin_InspectBoundingBox.h>
#include <FeaturesPlugin_Intersection.h>
#include <FeaturesPlugin_Measurement.h>
#include <FeaturesPlugin_PointCoordinates.h>
return FeaturePtr(new FeaturesPlugin_PointCoordinates);
} else if (theFeatureID == FeaturesPlugin_GeometryCalculation::ID()) {
return FeaturePtr(new FeaturesPlugin_GeometryCalculation);
+ } else if (theFeatureID == FeaturesPlugin_InspectBoundingBox::ID()) {
+ return FeaturePtr(new FeaturesPlugin_InspectBoundingBox);
} else if (theFeatureID == FeaturesPlugin_BoundingBox::ID()) {
return FeaturePtr(new FeaturesPlugin_BoundingBox);
- } else if (theFeatureID == FeaturesPlugin_CreateBoundingBox::ID()) {
- return FeaturePtr(new FeaturesPlugin_CreateBoundingBox);
}