---
Checks: |
- clang-diagnostic-*,clang-analyzer-*,modernize-use-override,modernize-use-nullptr,modernize-use-using,modernize-use-default-member-init,modernize-loop-convert,modernize-use-auto,modernize-redundant-void-arg,modernize-type-traits,modernize-use-bool-literals,modernize-use-equals-default,modernize-use-equals-delete,misc-include-cleaner,misc-const-correctness,misc-unused-parameters
+ -*,clang-diagnostic-*,clang-analyzer-*,modernize-use-override,modernize-use-nullptr,modernize-use-using,modernize-use-default-member-init,modernize-loop-convert,modernize-use-auto,modernize-redundant-void-arg,modernize-type-traits,modernize-use-bool-literals,modernize-use-equals-default,modernize-use-equals-delete,misc-include-cleaner,misc-const-correctness,misc-unused-parameters
WarningsAsErrors: ''
HeaderFilterRegex: .*SHAPER.*
AnalyzeTemporaryDtors: false
}
//==================================================================================================
-BuildAPI_Compound::~BuildAPI_Compound() {}
+BuildAPI_Compound::~BuildAPI_Compound() = default;
//==================================================================================================
void BuildAPI_Compound::setBase(
/// Destructor.
BUILDAPI_EXPORT
- virtual ~BuildAPI_Compound();
+ ~BuildAPI_Compound() override;
INTERFACE_1(BuildPlugin_Compound::ID(), baseObjects,
BuildPlugin_Compound::BASE_OBJECTS_ID(),
/// Dump wrapped feature
BUILDAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on Compound object.
}
//==================================================================================================
-BuildAPI_Edge::~BuildAPI_Edge() {}
+BuildAPI_Edge::~BuildAPI_Edge() = default;
//==================================================================================================
void BuildAPI_Edge::setBase(
/// Destructor.
BUILDAPI_EXPORT
- virtual ~BuildAPI_Edge();
+ ~BuildAPI_Edge() override;
INTERFACE_5(BuildPlugin_Edge::ID(), baseObjects,
BuildPlugin_Edge::BASE_OBJECTS_ID(),
/// Dump wrapped feature
BUILDAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on Edge object.
}
//==================================================================================================
-BuildAPI_Face::~BuildAPI_Face() {}
+BuildAPI_Face::~BuildAPI_Face() = default;
//==================================================================================================
void BuildAPI_Face::setBase(
/// Destructor.
BUILDAPI_EXPORT
- virtual ~BuildAPI_Face();
+ ~BuildAPI_Face() override;
INTERFACE_1(BuildPlugin_Face::ID(), baseObjects,
BuildPlugin_Face::BASE_OBJECTS_ID(),
/// Dump wrapped feature
BUILDAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on Face object.
}
//==================================================================================================
-BuildAPI_Interpolation::~BuildAPI_Interpolation() {}
+BuildAPI_Interpolation::~BuildAPI_Interpolation() = default;
//==================================================================================================
void BuildAPI_Interpolation::setBase(
/// Destructor.
BUILDAPI_EXPORT
- virtual ~BuildAPI_Interpolation();
+ ~BuildAPI_Interpolation() override;
INTERFACE_13(BuildPlugin_Interpolation::ID(), baseObjects,
BuildPlugin_Interpolation::BASE_OBJECTS_ID(),
/// Dump wrapped feature
BUILDAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
private:
void execIfBaseNotEmpty();
}
//==================================================================================================
-BuildAPI_Polyline::~BuildAPI_Polyline() {}
+BuildAPI_Polyline::~BuildAPI_Polyline() = default;
//==================================================================================================
void BuildAPI_Polyline::setBase(
/// Destructor.
BUILDAPI_EXPORT
- virtual ~BuildAPI_Polyline();
+ ~BuildAPI_Polyline() override;
INTERFACE_2(BuildPlugin_Polyline::ID(), baseObjects,
BuildPlugin_Polyline::BASE_OBJECTS_ID(),
/// Dump wrapped feature
BUILDAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on Polyline object.
}
//==================================================================================================
-BuildAPI_Shell::~BuildAPI_Shell() {}
+BuildAPI_Shell::~BuildAPI_Shell() = default;
//==================================================================================================
void BuildAPI_Shell::setBase(
/// Destructor.
BUILDAPI_EXPORT
- virtual ~BuildAPI_Shell();
+ ~BuildAPI_Shell() override;
INTERFACE_1(BuildPlugin_Shell::ID(), baseObjects,
BuildPlugin_Shell::BASE_OBJECTS_ID(),
/// Dump wrapped feature
BUILDAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on Shell object.
}
//==================================================================================================
-BuildAPI_Solid::~BuildAPI_Solid() {}
+BuildAPI_Solid::~BuildAPI_Solid() = default;
//==================================================================================================
void BuildAPI_Solid::setBase(
/// Destructor.
BUILDAPI_EXPORT
- virtual ~BuildAPI_Solid();
+ ~BuildAPI_Solid() override;
INTERFACE_1(BuildPlugin_Solid::ID(), baseObjects,
BuildPlugin_Solid::BASE_OBJECTS_ID(),
/// Dump wrapped feature
BUILDAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on Solid object.
}
//==================================================================================================
-BuildAPI_SubShapes::~BuildAPI_SubShapes() {}
+BuildAPI_SubShapes::~BuildAPI_SubShapes() = default;
//==================================================================================================
void BuildAPI_SubShapes::setBaseShape(
/// Destructor.
BUILDAPI_EXPORT
- virtual ~BuildAPI_SubShapes();
+ ~BuildAPI_SubShapes() override;
INTERFACE_2(BuildPlugin_SubShapes::ID(), baseShape,
BuildPlugin_SubShapes::BASE_SHAPE_ID(),
/// Dump wrapped feature
BUILDAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on SubShapes object.
}
//==================================================================================================
-BuildAPI_Vertex::~BuildAPI_Vertex() {}
+BuildAPI_Vertex::~BuildAPI_Vertex() = default;
//==================================================================================================
void BuildAPI_Vertex::setBase(
/// Destructor.
BUILDAPI_EXPORT
- virtual ~BuildAPI_Vertex();
+ ~BuildAPI_Vertex() override;
INTERFACE_2(BuildPlugin_Vertex::ID(), baseObjects,
BuildPlugin_Vertex::BASE_OBJECTS_ID(),
/// Dump wrapped feature
BUILDAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on Vertex object.
}
//==================================================================================================
-BuildAPI_Wire::~BuildAPI_Wire() {}
+BuildAPI_Wire::~BuildAPI_Wire() = default;
//==================================================================================================
void BuildAPI_Wire::setBase(
/// Destructor.
BUILDAPI_EXPORT
- virtual ~BuildAPI_Wire();
+ ~BuildAPI_Wire() override;
INTERFACE_2(BuildPlugin_Wire::ID(), baseObjects,
BuildPlugin_Wire::BASE_OBJECTS_ID(),
/// Dump wrapped feature
BUILDAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on Wire object.
#include <ModelAPI_AttributeSelectionList.h>
//=================================================================================================
-BuildPlugin_CompSolid::BuildPlugin_CompSolid() {}
+BuildPlugin_CompSolid::BuildPlugin_CompSolid() = default;
//=================================================================================================
void BuildPlugin_CompSolid::initAttributes() {
#include <GeomAlgoAPI_Copy.h>
//=================================================================================================
-BuildPlugin_Compound::BuildPlugin_Compound() {}
+BuildPlugin_Compound::BuildPlugin_Compound() = default;
//=================================================================================================
void BuildPlugin_Compound::initAttributes() {
}
/// \return the kind of a feature.
- BUILDPLUGIN_EXPORT virtual const std::string &getKind() {
+ BUILDPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = BuildPlugin_Compound::ID();
return MY_KIND;
}
/// Request for initialization of data model of the feature: adding all
/// attributes.
- BUILDPLUGIN_EXPORT virtual void initAttributes();
+ BUILDPLUGIN_EXPORT void initAttributes() override;
/// Creates a new part document if needed.
- BUILDPLUGIN_EXPORT virtual void execute();
+ BUILDPLUGIN_EXPORT void execute() override;
};
#endif
}
//=================================================================================================
-BuildPlugin_Edge::BuildPlugin_Edge() {}
+BuildPlugin_Edge::BuildPlugin_Edge() = default;
//=================================================================================================
void BuildPlugin_Edge::initAttributes() {
}
/// \return the kind of a feature.
- BUILDPLUGIN_EXPORT virtual const std::string &getKind() {
+ BUILDPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = BuildPlugin_Edge::ID();
return MY_KIND;
}
/// Request for initialization of data model of the feature: adding all
/// attributes.
- BUILDPLUGIN_EXPORT virtual void initAttributes();
+ BUILDPLUGIN_EXPORT void initAttributes() override;
/// Creates a new part document if needed.
- BUILDPLUGIN_EXPORT virtual void execute();
+ BUILDPLUGIN_EXPORT void execute() override;
private:
/// Build edges by the set of segments
#include <GeomAlgoAPI_SketchBuilder.h>
//=================================================================================================
-BuildPlugin_Face::BuildPlugin_Face() {}
+BuildPlugin_Face::BuildPlugin_Face() = default;
//=================================================================================================
void BuildPlugin_Face::initAttributes() {
// Store result.
int anIndex = 0;
- for (ListOfShape::const_iterator anIt = aFaces.cbegin();
- anIt != aFaces.cend(); ++anIt) {
+ for (auto aShape : aFaces) {
std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMakeShapeList(
new GeomAlgoAPI_MakeShapeList);
if (anIndex < aNbFacesFromEdges)
else if (anIndex < aNbNonPlanarFaces)
aMakeShapeList->appendAlgo(aNonPlanarFaceBuilder);
- GeomShapePtr aShape = *anIt;
GeomMakeShapePtr aCopy(new GeomAlgoAPI_Copy(aShape));
aMakeShapeList->appendAlgo(aCopy);
GeomAlgoAPI_ShapeTools::findPlane(theEdges);
std::shared_ptr<GeomAPI_Dir> aNormal = aPln->direction();
bool isReverse = !theNormals.empty();
- std::list<std::shared_ptr<GeomAPI_Dir>>::const_iterator aNormIt =
- theNormals.begin();
+ auto aNormIt = theNormals.begin();
for (; aNormIt != theNormals.end() && isReverse; ++aNormIt)
if ((*aNormIt)->dot(aNormal) > 1.e-7)
isReverse = false;
// Get wires from faces.
ListOfShape aWires;
- for (ListOfShape::const_iterator anIt = theFaces.cbegin();
- anIt != theFaces.cend(); ++anIt)
- aWires.push_back(GeomAlgoAPI_ShapeTools::getFaceOuterWire(*anIt));
+ for (const auto &theFace : theFaces)
+ aWires.push_back(GeomAlgoAPI_ShapeTools::getFaceOuterWire(theFace));
// Make faces with holes.
theFaces.clear();
}
/// \return the kind of a feature.
- BUILDPLUGIN_EXPORT virtual const std::string &getKind() {
+ BUILDPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = BuildPlugin_Face::ID();
return MY_KIND;
}
/// Request for initialization of data model of the feature: adding all
/// attributes.
- BUILDPLUGIN_EXPORT virtual void initAttributes();
+ BUILDPLUGIN_EXPORT void initAttributes() override;
/// Creates a new part document if needed.
- BUILDPLUGIN_EXPORT virtual void execute();
+ BUILDPLUGIN_EXPORT void execute() override;
private:
/// Create faces basing on the list of edges
const double theTolerance);
//=================================================================================================
-BuildPlugin_Filling::BuildPlugin_Filling() {}
+BuildPlugin_Filling::BuildPlugin_Filling() = default;
//=================================================================================================
void BuildPlugin_Filling::initAttributes() {
BuildPlugin_Plugin();
/// Creates the feature object of this plugin by the feature string ID
- virtual FeaturePtr createFeature(std::string theFeatureID);
+ FeaturePtr createFeature(std::string theFeatureID) override;
};
#endif
#include <algorithm>
//=================================================================================================
-BuildPlugin_Polyline::BuildPlugin_Polyline() {}
+BuildPlugin_Polyline::BuildPlugin_Polyline() = default;
//=================================================================================================
void BuildPlugin_Polyline::initAttributes() {
// Store result.
ResultBodyPtr aResultBody = document()->createBody(data());
- std::set<GeomShapePtr>::const_iterator aContextIt = aContexts.begin();
+ auto aContextIt = aContexts.begin();
for (; aContextIt != aContexts.end(); aContextIt++) {
aResultBody->storeModified(*aContextIt, aWire,
aContextIt == aContexts.begin());
inline static bool CLOSED_DEFAULT() { return false; }
/// \return the kind of a feature.
- BUILDPLUGIN_EXPORT virtual const std::string &getKind() {
+ BUILDPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = BuildPlugin_Polyline::ID();
return MY_KIND;
}
/// Request for initialization of data model of the feature: adding all
/// attributes.
- BUILDPLUGIN_EXPORT virtual void initAttributes();
+ BUILDPLUGIN_EXPORT void initAttributes() override;
/// Creates a new part document if needed.
- BUILDPLUGIN_EXPORT virtual void execute();
+ BUILDPLUGIN_EXPORT void execute() override;
};
#endif
ResultBodyPtr aResultBody = document()->createBody(data(), theResultIndex);
aResultBody->storeModified(theOriginalSolids, theResultShape, theAlgorithm);
- for (ListOfShape::const_iterator anIt = theOriginalShapes.cbegin();
- anIt != theOriginalShapes.cend(); ++anIt) {
- GeomShapePtr aShape = *anIt;
+ for (auto aShape : theOriginalShapes) {
aResultBody->loadModifiedShapes(theAlgorithm, aShape,
GeomAPI_Shape::VERTEX);
aResultBody->loadModifiedShapes(theAlgorithm, aShape, GeomAPI_Shape::EDGE);
aContexts.insert(aContext);
}
- std::set<GeomShapePtr, GeomAPI_Shape::Comparator>::const_iterator anIt =
- aContexts.begin();
+ auto anIt = aContexts.begin();
for (; anIt != aContexts.end(); ++anIt)
theContexts.push_back(*anIt);
}
#include <GeomAlgoAPI_Tools.h>
//=================================================================================================
-BuildPlugin_Shell::BuildPlugin_Shell() {}
+BuildPlugin_Shell::BuildPlugin_Shell() = default;
//=================================================================================================
void BuildPlugin_Shell::initAttributes() {
}
/// \return the kind of a feature.
- BUILDPLUGIN_EXPORT virtual const std::string &getKind() {
+ BUILDPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = BuildPlugin_Shell::ID();
return MY_KIND;
}
/// Request for initialization of data model of the feature: adding all
/// attributes.
- BUILDPLUGIN_EXPORT virtual void initAttributes();
+ BUILDPLUGIN_EXPORT void initAttributes() override;
/// Creates a new part document if needed.
- BUILDPLUGIN_EXPORT virtual void execute();
+ BUILDPLUGIN_EXPORT void execute() override;
};
#endif
#include <GeomAlgoAPI_MakeVolume.h>
//=================================================================================================
-BuildPlugin_Solid::BuildPlugin_Solid() {}
+BuildPlugin_Solid::BuildPlugin_Solid() = default;
//=================================================================================================
void BuildPlugin_Solid::initAttributes() {
#include <GeomAlgoAPI_ShapeBuilder.h>
//==================================================================================================
-BuildPlugin_SubShapes::BuildPlugin_SubShapes() {}
+BuildPlugin_SubShapes::BuildPlugin_SubShapes() = default;
//==================================================================================================
void BuildPlugin_SubShapes::initAttributes() {
ResultBodyPtr aResultBody = document()->createBody(data());
aResultBody->storeModified(aBaseShape, aResultShape);
aResultBody->loadModifiedShapes(aBuilder, aBaseShape, GeomAPI_Shape::EDGE);
- for (ListOfShape::const_iterator anIt = aShapesToAdd.cbegin();
- anIt != aShapesToAdd.cend(); ++anIt) {
- GeomAPI_Shape::ShapeType aShType = (*anIt)->shapeType();
- aResultBody->loadModifiedShapes(aBuilder, *anIt, aShType);
+ for (const auto &anIt : aShapesToAdd) {
+ GeomAPI_Shape::ShapeType aShType = anIt->shapeType();
+ aResultBody->loadModifiedShapes(aBuilder, anIt, aShType);
}
setResult(aResultBody);
}
}
/// \return the kind of a feature.
- BUILDPLUGIN_EXPORT virtual const std::string &getKind() {
+ BUILDPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = BuildPlugin_SubShapes::ID();
return MY_KIND;
}
/// Request for initialization of data model of the feature: adding all
/// attributes.
- BUILDPLUGIN_EXPORT virtual void initAttributes();
+ BUILDPLUGIN_EXPORT void initAttributes() override;
/// Called on change of any argument-attribute of this object.
/// \param[in] theID identifier of changed attribute.
- BUILDPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID);
+ BUILDPLUGIN_EXPORT void attributeChanged(const std::string &theID) override;
/// Creates a new part document if needed.
- BUILDPLUGIN_EXPORT virtual void execute();
+ BUILDPLUGIN_EXPORT void execute() override;
};
#endif
//! \param[in] theAttribute the checked attribute.
//! \param[in] theArguments arguments of the attribute.
//! \param[out] theError error message.
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/// \class BuildPlugin_ValidatorBaseForWire
//! \param theFeature the checked feature.
//! \param theArguments arguments of the feature.
//! \param theError error message.
- virtual bool isValid(const std::shared_ptr<ModelAPI_Feature> &theFeature,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const std::shared_ptr<ModelAPI_Feature> &theFeature,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/// \class BuildPlugin_ValidatorBaseForFace
//! \param theFeature the checked feature.
//! \param theArguments arguments of the feature.
//! \param theError error message.
- virtual bool isValid(const std::shared_ptr<ModelAPI_Feature> &theFeature,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const std::shared_ptr<ModelAPI_Feature> &theFeature,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/// \class BuildPlugin_ValidatorBaseForSolids
//! \param theFeature the checked feature.
//! \param theArguments arguments of the feature.
//! \param theError error message.
- virtual bool isValid(const std::shared_ptr<ModelAPI_Feature> &theFeature,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const std::shared_ptr<ModelAPI_Feature> &theFeature,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/// \class BuildPlugin_ValidatorSubShapesSelection
//! \param[in] theAttribute the checked attribute.
//! \param[in] theArguments arguments of the attribute.
//! \param[out] theError error message.
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/// \class BuildPlugin_ValidatorFillingSelection
//! \param[in] theAttribute the checked attribute.
//! \param[in] theArguments arguments of the attribute.
//! \param[out] theError error message.
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/// \class BuildPlugin_ValidatorBaseForVertex
//! \param[in] theAttribute the checked attribute.
//! \param[in] theArguments arguments of the attribute.
//! \param[out] theError error message.
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/// \class BuildPlugin_ValidatorExpression
//! \param theAttribute the checked attribute
//! \param theArguments arguments of the attribute
//! \param theError the error string message if validation fails
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
#endif
#include <GeomAPI_ShapeExplorer.h>
//=================================================================================================
-BuildPlugin_Vertex::BuildPlugin_Vertex() {}
+BuildPlugin_Vertex::BuildPlugin_Vertex() = default;
//=================================================================================================
void BuildPlugin_Vertex::initAttributes() {
// process results of the feature
const std::list<ResultPtr> &aResults = aFeature->results();
- std::list<ResultPtr>::const_iterator anIt = aResults.begin();
+ auto anIt = aResults.begin();
for (; anIt != aResults.end(); ++anIt)
thePrimitives.push_back((*anIt)->shape());
}
/// \return the kind of a feature.
- BUILDPLUGIN_EXPORT virtual const std::string &getKind() {
+ BUILDPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = BuildPlugin_Vertex::ID();
return MY_KIND;
}
/// Request for initialization of data model of the feature: adding all
/// attributes.
- BUILDPLUGIN_EXPORT virtual void initAttributes();
+ BUILDPLUGIN_EXPORT void initAttributes() override;
/// Creates a new part document if needed.
- BUILDPLUGIN_EXPORT virtual void execute();
+ BUILDPLUGIN_EXPORT void execute() override;
protected:
void buildVertices(const ListOfShape &theShapes, bool isIntersect);
std::string &theError);
//=================================================================================================
-BuildPlugin_Wire::BuildPlugin_Wire() {}
+BuildPlugin_Wire::BuildPlugin_Wire() = default;
//=================================================================================================
void BuildPlugin_Wire::initAttributes() {
for (GeomAPI_ShapeExplorer anExp(aWire, GeomAPI_Shape::EDGE); anExp.more();
anExp.next()) {
GeomShapePtr anEdgeInResult = anExp.current();
- for (ListOfShape::const_iterator anIt = anEdges.cbegin();
- anIt != anEdges.cend(); ++anIt) {
- std::shared_ptr<GeomAPI_Edge> anEdgeInList(new GeomAPI_Edge(*anIt));
+ for (const auto &anEdge : anEdges) {
+ std::shared_ptr<GeomAPI_Edge> anEdgeInList(new GeomAPI_Edge(anEdge));
if (anEdgeInList->isEqual(anEdgeInResult)) {
if (anEdgeInList->isSame(anEdgeInResult))
aResultBody->generated(anEdgeInResult, "Edge");
}
// create wires from sketches
- for (std::list<std::pair<FeaturePtr, GeomShapePtr>>::iterator anIt =
- aSketches.begin();
- anIt != aSketches.end(); ++anIt) {
+ for (auto &aSketche : aSketches) {
ListOfShape aWires;
GeomMakeShapePtr aMakeShapeList;
- if (!buildSketchWires(anIt->first, anIt->second, isIntersect, aWires,
+ if (!buildSketchWires(aSketche.first, aSketche.second, isIntersect, aWires,
aMakeShapeList, anError)) {
setError(anError);
return;
}
- for (ListOfShape::iterator aWIt = aWires.begin(); aWIt != aWires.end();
- ++aWIt) {
+ for (auto &aWire : aWires) {
ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
ListOfShape aSketch;
- aSketch.push_back(anIt->second);
- aResultBody->storeModified(aSketch, *aWIt, aMakeShapeList);
- aResultBody->loadModifiedShapes(aMakeShapeList, anIt->second,
+ aSketch.push_back(aSketche.second);
+ aResultBody->storeModified(aSketch, aWire, aMakeShapeList);
+ aResultBody->loadModifiedShapes(aMakeShapeList, aSketche.second,
GeomAPI_Shape::EDGE);
setResult(aResultBody, aResultIndex);
++aResultIndex;
// Check if edges have contours.
bool isAnyContourAdded = false;
- for (std::list<AttributeSelectionPtr>::const_iterator aListIt =
- anAttributesToCheck.cbegin();
- aListIt != anAttributesToCheck.cend(); ++aListIt) {
- AttributeSelectionPtr aSelection = *aListIt;
+ for (auto aSelection : anAttributesToCheck) {
std::shared_ptr<GeomAPI_Edge> anEdgeInList(
new GeomAPI_Edge(aSelection->value()));
anExp.more(); anExp.next()) {
std::shared_ptr<GeomAPI_Edge> anEdgeOnFace(
new GeomAPI_Edge(anExp.current()));
- ListOfShape::const_iterator anEdgesIt = anAddedEdges.cbegin();
+ auto anEdgesIt = anAddedEdges.cbegin();
for (; anEdgesIt != anAddedEdges.cend(); ++anEdgesIt) {
if (anEdgeOnFace->isEqual(*anEdgesIt)) {
break;
// collect wires from faces
const ListOfShape &aFaces = aSketchBuilder->faces();
- for (ListOfShape::const_iterator anIt = aFaces.begin();
- anIt != aFaces.end(); ++anIt) {
- for (GeomAPI_ShapeExplorer aWExp(*anIt, GeomAPI_Shape::WIRE);
+ for (const auto &aFace : aFaces) {
+ for (GeomAPI_ShapeExplorer aWExp(aFace, GeomAPI_Shape::WIRE);
aWExp.more(); aWExp.next()) {
// skip the wire if at least one its edge was already processed
GeomAPI_ShapeExplorer aEExp(aWExp.current(), GeomAPI_Shape::EDGE);
// collect unused edges
ListOfShape aCopy;
- for (ListOfShape::iterator anIt = aSketchEdges.begin();
- anIt != aSketchEdges.end(); ++anIt) {
+ for (auto &aSketchEdge : aSketchEdges) {
ListOfShape anImages;
- aSketchBuilder->modified(*anIt, anImages);
- for (ListOfShape::iterator anEdge = anImages.begin();
- anEdge != anImages.end(); ++anEdge)
- if (aProcessedEdges.find(*anEdge) == aProcessedEdges.end())
- aCopy.push_back(*anEdge);
+ aSketchBuilder->modified(aSketchEdge, anImages);
+ for (auto &anImage : anImages)
+ if (aProcessedEdges.find(anImage) == aProcessedEdges.end())
+ aCopy.push_back(anImage);
}
if (aCopy.size() > 1) {
// connect least edges to wires
typedef std::list<ListOfShape> ListOfWires;
ListOfWires aNewWires;
- typedef std::map<GeomVertexPtr, ListOfWires::iterator,
- GeomAPI_Vertex::GeometricComparator>
- MapVertexWire;
+ using MapVertexWire = std::map<GeomVertexPtr, ListOfWires::iterator,
+ GeomAPI_Vertex::GeometricComparator>;
MapVertexWire aMapVW;
- for (ListOfShape::iterator aEIt = aSketchEdges.begin();
- aEIt != aSketchEdges.end(); ++aEIt) {
- GeomEdgePtr anEdge = (*aEIt)->edge();
+ for (auto &aSketchEdge : aSketchEdges) {
+ GeomEdgePtr anEdge = aSketchEdge->edge();
GeomVertexPtr aStartV, aEndV;
anEdge->vertices(aStartV, aEndV);
- MapVertexWire::iterator aFoundStart = aMapVW.find(aStartV);
- MapVertexWire::iterator aFoundEnd = aMapVW.find(aEndV);
+ auto aFoundStart = aMapVW.find(aStartV);
+ auto aFoundEnd = aMapVW.find(aEndV);
if (aFoundStart == aMapVW.end()) {
if (aFoundEnd == aMapVW.end()) {
// new wire
aNewWires.push_back(ListOfShape());
- ListOfWires::iterator aNewW = --aNewWires.end();
+ auto aNewW = --aNewWires.end();
aNewW->push_back(anEdge);
aMapVW[aStartV] = aNewW;
aMapVW[aEndV] = aNewW;
aFoundStart->second->insert(aFoundStart->second->end(),
aFoundEnd->second->begin(),
aFoundEnd->second->end());
- for (MapVertexWire::iterator it = aMapVW.begin(); it != aMapVW.end();
- ++it)
+ for (auto it = aMapVW.begin(); it != aMapVW.end(); ++it)
if (it != aFoundEnd && it->second == aFoundEnd->second) {
// another boundary of the wire, change link to the whole result
it->second = aFoundStart->second;
}
// generate new wires from the sets of edges
- for (ListOfWires::iterator anIt = aNewWires.begin(); anIt != aNewWires.end();
- ++anIt) {
+ for (auto &aNewWire : aNewWires) {
GeomShapePtr aWire;
- if (!buildWire(*anIt, aWire, theError))
+ if (!buildWire(aNewWire, aWire, theError))
return false;
theWires.push_back(aWire);
}
}
/// \return the kind of a feature.
- BUILDPLUGIN_EXPORT virtual const std::string &getKind() {
+ BUILDPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = BuildPlugin_Wire::ID();
return MY_KIND;
}
/// Request for initialization of data model of the feature: adding all
/// attributes.
- BUILDPLUGIN_EXPORT virtual void initAttributes();
+ BUILDPLUGIN_EXPORT void initAttributes() override;
/// Creates a new part document if needed.
- BUILDPLUGIN_EXPORT virtual void execute();
+ BUILDPLUGIN_EXPORT void execute() override;
/// Performs some functionality by action id.
/// \param[in] theAttributeId action key id.
/// \return false in case if action not perfomed.
- BUILDPLUGIN_EXPORT virtual bool customAction(const std::string &theActionId);
+ BUILDPLUGIN_EXPORT bool customAction(const std::string &theActionId) override;
private:
/// Action: Adds to the list of segments other segments of the sketcher
}
//=================================================================================================
-CollectionAPI_Field::~CollectionAPI_Field() {}
+CollectionAPI_Field::~CollectionAPI_Field() = default;
//=================================================================================================
void CollectionAPI_Field::setSelection(
/// Destructor.
COLLECTIONAPI_EXPORT
- virtual ~CollectionAPI_Field();
+ ~CollectionAPI_Field() override;
INTERFACE_4(CollectionPlugin_Field::ID(), selection,
CollectionPlugin_Field::SELECTED_ID(),
/// Dump wrapped feature
COLLECTIONAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
/// Returns the internal values tables
COLLECTIONAPI_EXPORT
}
//==================================================================================================
-CollectionAPI_Group::~CollectionAPI_Group() {}
+CollectionAPI_Group::~CollectionAPI_Group() = default;
//==================================================================================================
void CollectionAPI_Group::setGroupList(
/// Destructor.
COLLECTIONAPI_EXPORT
- virtual ~CollectionAPI_Group();
+ ~CollectionAPI_Group() override;
INTERFACE_1(CollectionPlugin_Group::ID(), groupList,
CollectionPlugin_Group::LIST_ID(),
/// Dump wrapped feature
COLLECTIONAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on Group object.
}
}
-CollectionAPI_GroupAddition::~CollectionAPI_GroupAddition() {}
+CollectionAPI_GroupAddition::~CollectionAPI_GroupAddition() = default;
void CollectionAPI_GroupAddition::setGroupList(
const std::list<ModelHighAPI_Selection> &theGroupList) {
/// Destructor.
COLLECTIONAPI_EXPORT
- virtual ~CollectionAPI_GroupAddition();
+ ~CollectionAPI_GroupAddition() override;
INTERFACE_1(CollectionPlugin_GroupAddition::ID(), groupList,
CollectionPlugin_GroupAddition::LIST_ID(),
/// Dump wrapped feature
COLLECTIONAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on Group Addition object.
}
}
-CollectionAPI_GroupIntersection::~CollectionAPI_GroupIntersection() {}
+CollectionAPI_GroupIntersection::~CollectionAPI_GroupIntersection() = default;
void CollectionAPI_GroupIntersection::setGroupList(
const std::list<ModelHighAPI_Selection> &theGroupList) {
/// Destructor.
COLLECTIONAPI_EXPORT
- virtual ~CollectionAPI_GroupIntersection();
+ ~CollectionAPI_GroupIntersection() override;
INTERFACE_1(CollectionPlugin_GroupIntersection::ID(), groupList,
CollectionPlugin_GroupIntersection::LIST_ID(),
/// Dump wrapped feature
COLLECTIONAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on Group Addition object.
}
}
-CollectionAPI_GroupShape::~CollectionAPI_GroupShape() {}
+CollectionAPI_GroupShape::~CollectionAPI_GroupShape() = default;
void CollectionAPI_GroupShape::setGroupList(
const std::list<ModelHighAPI_Selection> &theGroupList) {
/// Destructor.
COLLECTIONAPI_EXPORT
- virtual ~CollectionAPI_GroupShape();
+ ~CollectionAPI_GroupShape() override;
INTERFACE_1(CollectionPlugin_GroupShape::ID(), groupList,
CollectionPlugin_GroupShape::LIST_ID(),
/// Dump wrapped feature
COLLECTIONAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on Group Shape object.
}
}
-CollectionAPI_GroupSubstraction::~CollectionAPI_GroupSubstraction() {}
+CollectionAPI_GroupSubstraction::~CollectionAPI_GroupSubstraction() = default;
void CollectionAPI_GroupSubstraction::setObjectsList(
const std::list<ModelHighAPI_Selection> &theGroupList) {
/// Destructor.
COLLECTIONAPI_EXPORT
- virtual ~CollectionAPI_GroupSubstraction();
+ ~CollectionAPI_GroupSubstraction() override;
INTERFACE_2(CollectionPlugin_GroupSubstraction::ID(), objectsList,
CollectionPlugin_GroupSubstraction::LIST_ID(),
/// Dump wrapped feature
COLLECTIONAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on Group Addition object.
#include <ModelAPI_Session.h>
#include <ModelAPI_Validator.h>
-CollectionPlugin_Field::CollectionPlugin_Field() {}
+CollectionPlugin_Field::CollectionPlugin_Field() = default;
void CollectionPlugin_Field::initAttributes() {
data()->addAttribute(SELECTED_ID(),
}
/// Returns the kind of a feature
- COLLECTIONPLUGIN_EXPORT virtual const std::string &getKind() {
+ COLLECTIONPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = CollectionPlugin_Field::ID();
return MY_KIND;
}
/// Creates a new field result if needed
- COLLECTIONPLUGIN_EXPORT virtual void execute();
+ COLLECTIONPLUGIN_EXPORT void execute() override;
/// Request for initialization of data model of the feature: adding all
/// attributes
- COLLECTIONPLUGIN_EXPORT virtual void initAttributes();
+ COLLECTIONPLUGIN_EXPORT void initAttributes() override;
/// Result of fields is created on the fly and don't stored to the document
- COLLECTIONPLUGIN_EXPORT virtual bool isPersistentResult() { return false; }
+ COLLECTIONPLUGIN_EXPORT bool isPersistentResult() override { return false; }
/// Use plugin manager for features creation
CollectionPlugin_Field();
#include <ModelAPI_Tools.h>
#include <sstream>
-CollectionPlugin_Group::CollectionPlugin_Group() {}
+CollectionPlugin_Group::CollectionPlugin_Group() = default;
void CollectionPlugin_Group::initAttributes() {
AttributeSelectionListPtr aList =
// collect all existing names of features to give unique names
std::set<std::wstring> aFeatNames, aResNames;
std::list<FeaturePtr> allFeat = aDoc->allFeatures();
- std::list<FeaturePtr>::iterator allFeatIter = allFeat.begin();
+ auto allFeatIter = allFeat.begin();
for (; allFeatIter != allFeat.end(); allFeatIter++) {
FeaturePtr aFeat = *allFeatIter;
if (aFeat->data().get() && aFeat->data()->isValid()) {
aFeatNames.insert(aFeat->name());
if (aFeat->getKind() == ID() && aFeat->data().get() &&
aFeat->data()->isValid()) {
- std::list<ResultPtr>::const_iterator aRess =
- aFeat->results().cbegin();
+ auto aRess = aFeat->results().cbegin();
for (; aRess != aFeat->results().cend(); aRess++) {
ResultPtr aRes = *aRess;
if (aRes->data().get() && aRes->data()->isValid()) {
aNew = aDoc->addFeature(ID(), false);
aResults.push_front(aNew); // to keep the order
} else { // appending in already created new result
- std::list<FeaturePtr>::reverse_iterator aResIter = aResults.rbegin();
+ auto aResIter = aResults.rbegin();
for (; aFGroup > 1; aResIter++)
aFGroup--;
aNew = *aResIter;
aList->remove(aRemoved);
// set names
if (aResults.size() > 1) { // rename if there are new groups appeared only
- std::list<FeaturePtr>::iterator aResIter = aResults.begin();
+ auto aResIter = aResults.begin();
for (int aSuffix = 1; aResIter != aResults.end(); aResIter++) {
FeaturePtr aFeat =
std::dynamic_pointer_cast<ModelAPI_Feature>(*aResIter);
FiltersFeaturePtr aFilters = aList->filters();
if (aFilters.get()) {
std::list<std::string> aFiltersList = aFilters->filters();
- std::list<std::string>::iterator aFilterName = aFiltersList.begin();
+ auto aFilterName = aFiltersList.begin();
for (; aFilterName != aFiltersList.end(); aFilterName++) {
aFilters->removeFilter(*aFilterName);
}
}
/// Returns the kind of a feature
- COLLECTIONPLUGIN_EXPORT virtual const std::string &getKind() {
+ COLLECTIONPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = CollectionPlugin_GroupAddition::ID();
return MY_KIND;
}
/// Creates a new group result if needed
- COLLECTIONPLUGIN_EXPORT void execute();
+ COLLECTIONPLUGIN_EXPORT void execute() override;
/// Use plugin manager for features creation
CollectionPlugin_GroupAddition() = default;
}
static void keepUniqueShapes(ListOfShape &theShapes) {
- ListOfShape::iterator anIt = theShapes.begin();
+ auto anIt = theShapes.begin();
while (anIt != theShapes.end()) {
GeomShapePtr aCurrent = *anIt;
- ListOfShape::iterator anIt2 = theShapes.begin();
+ auto anIt2 = theShapes.begin();
for (; anIt2 != anIt; ++anIt2)
if (aCurrent->isEqual(*anIt2))
break;
if (anIt2 != anIt) {
// the same shape is found
- ListOfShape::iterator aRemoveIt = anIt++;
+ auto aRemoveIt = anIt++;
theShapes.erase(aRemoveIt);
} else
++anIt;
/// Request for initialization of data model of the feature: adding all
/// attributes
- COLLECTIONPLUGIN_EXPORT virtual void initAttributes();
+ COLLECTIONPLUGIN_EXPORT void initAttributes() override;
/// Use plugin manager for features creation
CollectionPlugin_GroupMerge() = default;
CollectionPlugin_GroupMerge::execute(aGroup);
GeomShapePtr aCompound = aGroup->shape();
- const TopoDS_Shape &aShape = aCompound->impl<TopoDS_Shape>();
+ const auto &aShape = aCompound->impl<TopoDS_Shape>();
if (aShape.NbChildren() == 1) {
/// unique shape, remove compound on type
}
/// Returns the kind of a feature
- COLLECTIONPLUGIN_EXPORT virtual const std::string &getKind() {
+ COLLECTIONPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = CollectionPlugin_GroupShape::ID();
return MY_KIND;
}
/// Creates a new group result if needed
- COLLECTIONPLUGIN_EXPORT void execute();
+ COLLECTIONPLUGIN_EXPORT void execute() override;
/// Use plugin manager for features creation
CollectionPlugin_GroupShape() = default;
typedef std::set<GeomShapePtr, GeomAPI_Shape::Comparator> SetOfShape;
-CollectionPlugin_GroupSubstraction::CollectionPlugin_GroupSubstraction() {}
+CollectionPlugin_GroupSubstraction::CollectionPlugin_GroupSubstraction() =
+ default;
void CollectionPlugin_GroupSubstraction::initAttributes() {
data()->addAttribute(CollectionPlugin_GroupSubstraction::LIST_ID(),
if (theExclude.find(aCurrent) != theExclude.end())
continue; // shape has to be excluded
// check the shape is already in the list
- ListOfShape::iterator anIt2 = theResult.begin();
+ auto anIt2 = theResult.begin();
for (; anIt2 != theResult.end(); ++anIt2)
if (aCurrent->isEqual(*anIt2))
break;
}
/// Returns the kind of a feature
- COLLECTIONPLUGIN_EXPORT virtual const std::string &getKind() {
+ COLLECTIONPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = CollectionPlugin_GroupSubstraction::ID();
return MY_KIND;
}
/// Creates a new group result if needed
- COLLECTIONPLUGIN_EXPORT virtual void execute();
+ COLLECTIONPLUGIN_EXPORT void execute() override;
/// Request for initialization of data model of the feature: adding all
/// attributes
- COLLECTIONPLUGIN_EXPORT virtual void initAttributes();
+ COLLECTIONPLUGIN_EXPORT void initAttributes() override;
/// Use plugin manager for features creation
CollectionPlugin_GroupSubstraction();
class COLLECTIONPLUGIN_EXPORT CollectionPlugin_Plugin : public ModelAPI_Plugin {
public:
/// Creates the feature object of this plugin by the feature string ID
- virtual FeaturePtr createFeature(std::string theFeatureID);
+ FeaturePtr createFeature(std::string theFeatureID) override;
public:
/// Default constructor
return false;
}
// check types of all selection lists are the same
- for (std::list<std::string>::const_iterator aParIt = theArguments.begin();
+ for (auto aParIt = theArguments.begin();
aParIt != theArguments.end() && !aType.empty(); ++aParIt) {
AttributeSelectionListPtr aCurList = anOwner->selectionList(*aParIt);
if (aCurList->size() == 0)
//! \param theFeature the checked feature
//! \param theArguments arguments of the feature (not used)
//! \param theError error message
- virtual bool isValid(const FeaturePtr &theFeature,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const FeaturePtr &theFeature,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/**\class CollectionPlugin_GroupOperationAttributeValidator
//! \param[in] theAttribute the checked attribute.
//! \param[in] theArguments arguments of the attribute.
//! \param[out] theError error message.
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/**\class CollectionPlugin_GroupSelectionValidator
//! \param[in] theAttribute the checked attribute.
//! \param[in] theArguments arguments of the attribute (not used).
//! \param[out] theError error message.
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
#endif
ModuleBase_ModelWidget *CollectionPlugin_WidgetCreator::createWidgetByType(
const std::string &theType, QWidget *theParent,
Config_WidgetAPI *theWidgetApi, ModuleBase_IWorkshop *theWorkshop) {
- ModuleBase_ModelWidget *aWidget = 0;
+ ModuleBase_ModelWidget *aWidget = nullptr;
if (myPanelTypes.find(theType) == myPanelTypes.end())
return aWidget;
CollectionPlugin_WidgetCreator();
/// Virtual destructor
- ~CollectionPlugin_WidgetCreator() {}
+ ~CollectionPlugin_WidgetCreator() = default;
/// Returns a container of possible page types, which this creator can process
/// \param theTypes a list of type names
- virtual void widgetTypes(std::set<std::string> &theTypes);
+ void widgetTypes(std::set<std::string> &theTypes) override;
/// Create widget by its type
/// The default implementation is empty
/// \param theData a low-level API for reading xml definitions of widgets
/// \param theWorkshop a current workshop
/// \return a created model widget or null
- virtual ModuleBase_ModelWidget *
+ ModuleBase_ModelWidget *
createWidgetByType(const std::string &theType, QWidget *theParent,
Config_WidgetAPI *theWidgetApi,
- ModuleBase_IWorkshop * /*theWorkshop*/);
+ ModuleBase_IWorkshop * /*theWorkshop*/) override;
private:
std::set<std::string> myPanelTypes; ///< types of panels
DataTableItemDelegate::createEditor(QWidget *theParent,
const QStyleOptionViewItem &theOption,
const QModelIndex &theIndex) const {
- QWidget *aEditor = 0;
+ QWidget *aEditor = nullptr;
if ((theIndex.column() == 0) && (theIndex.row() > 0)) {
QWidget *aWgt =
QStyledItemDelegate::createEditor(theParent, theOption, theIndex);
- QLineEdit *aEdt = static_cast<QLineEdit *>(aWgt);
+ auto *aEdt = static_cast<QLineEdit *>(aWgt);
aEdt->setReadOnly(true);
aEditor = aEdt;
} else {
- QLineEdit *aLineEdt = 0;
+ QLineEdit *aLineEdt = nullptr;
switch (myType) {
case ModelAPI_AttributeTables::DOUBLE:
aLineEdt = dynamic_cast<QLineEdit *>(
}
break;
case ModelAPI_AttributeTables::BOOLEAN: {
- QComboBox *aBox = new QComboBox(theParent);
+ auto *aBox = new QComboBox(theParent);
aBox->addItem(MYFalse);
aBox->addItem(MYTrue);
aEditor = aBox;
return aEditor;
}
-void DataTableItemDelegate::onEditItem(const QString &theText) {
- QWidget *aWgt = dynamic_cast<QWidget *>(sender());
+void DataTableItemDelegate::onEditItem(const QString & /*theText*/) {
+ auto *aWgt = dynamic_cast<QWidget *>(sender());
commitData(aWgt);
}
QWidget *theParent, ModuleBase_IWorkshop *theWorkshop,
const Config_WidgetAPI *theData)
: ModuleBase_WidgetSelector(theParent, theWorkshop, theData),
- myHeaderEditor(0), myIsTabEdit(false), myActivation(false) {
- QVBoxLayout *aMainLayout = new QVBoxLayout(this);
+ myHeaderEditor(nullptr), myIsTabEdit(false), myActivation(false) {
+ auto *aMainLayout = new QVBoxLayout(this);
// Types definition controls
- QWidget *aTypesWgt = new QWidget(this);
- QFormLayout *aTypesLayout = new QFormLayout(aTypesWgt);
+ auto *aTypesWgt = new QWidget(this);
+ auto *aTypesLayout = new QFormLayout(aTypesWgt);
aTypesLayout->setContentsMargins(0, 0, 0, 0);
aMainLayout->addWidget(aTypesWgt);
aTypesLayout->addRow(tr("Nb. of components"), myNbComponentsSpn);
// Steps controls
- QFrame *aStepFrame = new QFrame(this);
+ auto *aStepFrame = new QFrame(this);
aStepFrame->setFrameShape(QFrame::Box);
aStepFrame->setFrameStyle(QFrame::StyledPanel);
- QGridLayout *aStepLayout = new QGridLayout(aStepFrame);
+ auto *aStepLayout = new QGridLayout(aStepFrame);
aMainLayout->addWidget(aStepFrame);
// Current step label
aStepLayout->addWidget(myCurStepLbl, 0, 1);
// Steps slider
- QWidget *aSliderWidget = new QWidget(aStepFrame);
+ auto *aSliderWidget = new QWidget(aStepFrame);
aStepLayout->addWidget(aSliderWidget, 1, 0, 1, 2);
- QHBoxLayout *aSliderLayout = new QHBoxLayout(aSliderWidget);
+ auto *aSliderLayout = new QHBoxLayout(aSliderWidget);
aSliderLayout->setContentsMargins(0, 0, 0, 0);
aSliderLayout->addWidget(new QLabel("1", aSliderWidget));
appendStepControls();
// Buttons below
- QWidget *aBtnWgt = new QWidget(this);
+ auto *aBtnWgt = new QWidget(this);
aMainLayout->addWidget(aBtnWgt);
- QHBoxLayout *aBtnLayout = new QHBoxLayout(aBtnWgt);
+ auto *aBtnLayout = new QHBoxLayout(aBtnWgt);
aBtnLayout->setContentsMargins(0, 0, 0, 0);
- QPushButton *aAddBtn = new QPushButton(tr("Add step"), aBtnWgt);
+ auto *aAddBtn = new QPushButton(tr("Add step"), aBtnWgt);
aBtnLayout->addWidget(aAddBtn);
aBtnLayout->addStretch(1);
//**********************************************************************************
void CollectionPlugin_WidgetField::appendStepControls() {
- QWidget *aWidget = new QWidget(myStepWgt);
- QGridLayout *aStepLayout = new QGridLayout(aWidget);
+ auto *aWidget = new QWidget(myStepWgt);
+ auto *aStepLayout = new QGridLayout(aWidget);
aStepLayout->setContentsMargins(0, 0, 0, 0);
aStepLayout->addWidget(new QLabel(tr("Stamp"), aWidget), 0, 0);
- QSpinBox *aStampSpn = new QSpinBox(aWidget);
+ auto *aStampSpn = new QSpinBox(aWidget);
aStepLayout->addWidget(aStampSpn, 0, 1);
myStampSpnList.append(aStampSpn);
// Data table
- QTableWidget *aDataTbl =
- new QTableWidget(1, myCompNamesList.count() + 1, aWidget);
+ auto *aDataTbl = new QTableWidget(1, myCompNamesList.count() + 1, aWidget);
aDataTbl->installEventFilter(this);
aDataTbl->setItemDelegate(myDelegate);
updateHeaders(aDataTbl);
- QTableWidgetItem *aItem = new QTableWidgetItem("Default value");
+ auto *aItem = new QTableWidgetItem("Default value");
aItem->setBackgroundColor(Qt::lightGray);
aItem->setFlags(Qt::NoItemFlags | Qt::ItemIsEnabled);
aDataTbl->setItem(0, 0, aItem);
//**********************************************************************************
bool CollectionPlugin_WidgetField::eventFilter(QObject *theObject,
QEvent *theEvent) {
- QObject *aObject = 0;
+ QObject *aObject = nullptr;
foreach (QTableWidget *aTable, myDataTblList) {
if (aTable->horizontalHeader()->viewport() == theObject) {
aObject = theObject;
if (theEvent->type() == QEvent::MouseButtonDblClick) {
if (myHeaderEditor) { // delete previous editor
myHeaderEditor->deleteLater();
- myHeaderEditor = 0;
+ myHeaderEditor = nullptr;
}
- QMouseEvent *aMouseEvent = static_cast<QMouseEvent *>(theEvent);
- QHeaderView *aHeader = static_cast<QHeaderView *>(aObject->parent());
- QTableWidget *aTable =
- static_cast<QTableWidget *>(aHeader->parentWidget());
+ auto *aMouseEvent = static_cast<QMouseEvent *>(theEvent);
+ auto *aHeader = static_cast<QHeaderView *>(aObject->parent());
+ auto *aTable = static_cast<QTableWidget *>(aHeader->parentWidget());
int aShift = aTable->horizontalScrollBar()->value();
int aPos = aMouseEvent->x();
// save item text
myCompNamesList.replace(myEditIndex - 1, aNewTitle);
myHeaderEditor->deleteLater(); // safely delete editor
- myHeaderEditor = 0;
+ myHeaderEditor = nullptr;
// Store into data model
AttributeStringArrayPtr aStringsAttr = myFeature->data()->stringArray(
CollectionPlugin_Field::COMPONENTS_NAMES_ID());
updateHeaders(aTable);
}
} else if (theEvent->type() == QEvent::FocusIn) {
- QTableWidget *aTable = dynamic_cast<QTableWidget *>(theObject);
+ auto *aTable = dynamic_cast<QTableWidget *>(theObject);
if (aTable) {
ModuleBase_IPropertyPanel *aPanel = myWorkshop->propertyPanel();
if (aPanel->activeWidget() != this) {
//**********************************************************************************
QTableWidgetItem *CollectionPlugin_WidgetField::createDefaultItem() const {
- QTableWidgetItem *aItem = new QTableWidgetItem();
+ auto *aItem = new QTableWidgetItem();
switch (myFieldTypeCombo->currentIndex()) {
case ModelAPI_AttributeTables::DOUBLE:
case ModelAPI_AttributeTables::INTEGER:
//**********************************************************************************
QTableWidgetItem *CollectionPlugin_WidgetField::createValueItem(
ModelAPI_AttributeTables::Value &theVal) const {
- QTableWidgetItem *aItem = new QTableWidgetItem();
+ auto *aItem = new QTableWidgetItem();
aItem->setText(getValueText(theVal));
return aItem;
}
for (int i = 0; i < aFirstTable->columnCount(); i++)
aColWidth.append(aFirstTable->columnWidth(i));
- QTableWidgetItem *aItem = 0;
+ QTableWidgetItem *aItem = nullptr;
for (int i = 0; i < aNbSteps; i++) {
myStampSpnList.at(i)->setValue(aStampsAttr->value(i));
QTableWidget *aTable = myDataTblList.at(i);
int aOldCol = myCompNamesList.count();
int aNbRows = myDataTblList.first()->rowCount();
int aDif = theVal - aOldCol;
- QTableWidgetItem *aItem = 0;
+ QTableWidgetItem *aItem = nullptr;
while (myCompNamesList.count() != theVal) {
if (aDif > 0)
int aRows = aSelNb + 1;
QTableWidget *aTable = myDataTblList.last();
aTable->setRowCount(aRows);
- QTableWidgetItem *aItem = 0;
+ QTableWidgetItem *aItem = nullptr;
for (int i = 0; i < aColumns; i++) {
if (i == 0) {
for (int j = 1; j < aRows; j++) {
//**********************************************************************************
bool CollectionPlugin_WidgetField::isValidSelectionCustom(
- const std::shared_ptr<ModuleBase_ViewerPrs> &thePrs) {
+ const std::shared_ptr<ModuleBase_ViewerPrs> & /*thePrs*/) {
return (myShapeTypeCombo->currentIndex() == 5) ? false : true;
}
myFeature->data()->tables(CollectionPlugin_Field::VALUES_ID());
aTablesAttr->setSize(aNewRows, aColumns - 1, myDataTblList.size());
- QTableWidgetItem *aItem = 0;
+ QTableWidgetItem *aItem = nullptr;
foreach (QTableWidget *aTable, myDataTblList) {
aTable->setRowCount(aNewRows);
if (aNewRows > aRows) {
return;
if (!myFeature.get())
return;
- QTableWidget *aTable = static_cast<QTableWidget *>(sender());
+ auto *aTable = static_cast<QTableWidget *>(sender());
int aNb = myDataTblList.indexOf(aTable);
if (aNb == -1)
return;
}
//**********************************************************************************
-void CollectionPlugin_WidgetField::onFocusChanged(QWidget *theOld,
+void CollectionPlugin_WidgetField::onFocusChanged(QWidget * /*theOld*/,
QWidget *theNew) {
if (theNew && (!myIsTabEdit))
myIsTabEdit = dynamic_cast<QLineEdit *>(theNew);
}
//**********************************************************************************
-void CollectionPlugin_WidgetField::onRangeChanged(int theMin, int theMax) {
+void CollectionPlugin_WidgetField::onRangeChanged(int /*theMin*/, int theMax) {
myMaxLbl->setText(QString::number(theMax));
myRemoveBtn->setEnabled(theMax > 1);
}
//**********************************************************************************
-void CollectionPlugin_WidgetField::onColumnResize(int theIndex, int theOld,
+void CollectionPlugin_WidgetField::onColumnResize(int theIndex, int /*theOld*/,
int theNew) {
if (myDataTblList.count() < 2)
return;
for (int i = 0; i < aSelList->size(); i++) {
aAttr = aSelList->value(i);
ModuleBase_ViewerPrsPtr aPrs(
- new ModuleBase_ViewerPrs(aAttr->context(), aAttr->value(), NULL));
+ new ModuleBase_ViewerPrs(aAttr->context(), aAttr->value(), nullptr));
aList.append(aPrs);
}
}
public:
DataTableItemDelegate(ModelAPI_AttributeTables::ValueType theType);
- virtual QWidget *createEditor(QWidget *theParent,
- const QStyleOptionViewItem &theOption,
- const QModelIndex &theIndex) const;
+ QWidget *createEditor(QWidget *theParent,
+ const QStyleOptionViewItem &theOption,
+ const QModelIndex &theIndex) const override;
ModelAPI_AttributeTables::ValueType dataType() const { return myType; }
ModuleBase_IWorkshop *theWorkshop,
const Config_WidgetAPI *theData);
- virtual ~CollectionPlugin_WidgetField() {}
+ ~CollectionPlugin_WidgetField() override = default;
/// Returns list of widget controls
/// \return a control list
- virtual QList<QWidget *> getControls() const;
+ QList<QWidget *> getControls() const override;
/// Checks the widget validity. By default, it returns true.
/// \param thePrs a selected presentation in the view
/// \return a boolean value
- virtual bool
- isValidSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs> &theValue);
+ bool isValidSelectionCustom(
+ const std::shared_ptr<ModuleBase_ViewerPrs> &theValue) override;
/// Returns true if the event is processed.
- virtual bool processEnter();
+ bool processEnter() override;
/// The methiod called when widget is deactivated
- virtual void deactivate();
+ void deactivate() override;
/// Set the given wrapped value to the current widget
/// This value should be processed in the widget according to the needs
/// \param theValues the wrapped selection values
/// \param theToValidate a validation of the values flag
- virtual bool
- setSelection(QList<std::shared_ptr<ModuleBase_ViewerPrs>> &theValues,
- const bool theToValidate);
+ bool setSelection(QList<std::shared_ptr<ModuleBase_ViewerPrs>> &theValues,
+ const bool theToValidate) override;
protected:
/// Saves the internal parameters to the given feature
/// \return True in success
- virtual bool storeValueCustom();
+ bool storeValueCustom() override;
/// Restore value from attribute data to the widget's control
- virtual bool restoreValueCustom();
+ bool restoreValueCustom() override;
/// Retunrs a list of possible shape types
/// \return a list of shapes
- virtual QIntList shapeTypes() const;
+ QIntList shapeTypes() const override;
/// Redefinition of virtual function
/// \param theObject an object for the event
/// \param theEvent an event
- virtual bool eventFilter(QObject *theObject, QEvent *theEvent);
+ bool eventFilter(QObject *theObject, QEvent *theEvent) override;
// virtual void showEvent(QShowEvent* theEvent);
/// Return the attribute values wrapped in a list of viewer presentations
/// \return a list of viewer presentations, which contains an attribute result
/// and a shape. If the attribute do not uses the shape, it is empty
- virtual QList<std::shared_ptr<ModuleBase_ViewerPrs>>
- getAttributeSelection() const;
+ QList<std::shared_ptr<ModuleBase_ViewerPrs>>
+ getAttributeSelection() const override;
private slots:
/// Slot called on number of component changed
myIsGeometricalSelection = false;
}
-Config_AttributeMessage::~Config_AttributeMessage() {}
+Config_AttributeMessage::~Config_AttributeMessage() = default;
const std::string &Config_AttributeMessage::featureId() const {
return myFeatureId;
/// Constructor
CONFIG_EXPORT Config_AttributeMessage(const Events_ID theId,
- const void *theParent = 0);
+ const void *theParent = nullptr);
/// Destructor
- CONFIG_EXPORT virtual ~Config_AttributeMessage();
+ CONFIG_EXPORT ~Config_AttributeMessage() override;
// Auto-generated getters/setters
/// Returns attribute's unique id
// used only for GUI xml data reading
// LCOV_EXCL_START
Config_DataModelReader::Config_DataModelReader()
- : Config_XMLReader(DATAMODEL_FILE), isRootReading(true),
- myIsResultLink(false) {}
+ : Config_XMLReader(DATAMODEL_FILE) {}
-Config_DataModelReader::~Config_DataModelReader() {}
+Config_DataModelReader::~Config_DataModelReader() = default;
void Config_DataModelReader::processNode(xmlNodePtr theNode) {
if (isNode(theNode, NODE_FOLDER, NULL)) {
* Constructor
*/
CONFIG_EXPORT Config_DataModelReader();
- CONFIG_EXPORT virtual ~Config_DataModelReader();
+ CONFIG_EXPORT ~Config_DataModelReader() override;
// ROOT folders propertiues *****************
/// Returns name of type of tree items in root
protected:
/// Overloaded method. Defines how to process each node
- virtual void processNode(xmlNodePtr theNode);
+ void processNode(xmlNodePtr theNode) override;
private:
- bool isRootReading;
+ bool isRootReading{true};
/// Root document data
std::vector<std::string> myRootFolderNames;
std::vector<std::string> mySubFeaturesList;
std::vector<bool> mySubFolderShowEmpty;
- bool myIsResultLink;
+ bool myIsResultLink{false};
std::string mySubTypes;
};
myAbortConfirmation = true;
}
-Config_FeatureMessage::~Config_FeatureMessage() {}
+Config_FeatureMessage::~Config_FeatureMessage() = default;
const std::string &Config_FeatureMessage::icon() const { return myIcon; }
myLibraryDocSection(theDocSection),
myEventGenerated(theEventGenerated ? theEventGenerated
: Config_FeatureMessage::GUI_EVENT()),
- myIsProcessWidgets(theEventGenerated != NULL) {}
+ myIsProcessWidgets(theEventGenerated != nullptr) {}
-Config_FeatureReader::~Config_FeatureReader() {}
+Config_FeatureReader::~Config_FeatureReader() = default;
std::list<std::string> Config_FeatureReader::features() const {
return myFeatures;
std::string aCaseNodeID = getProperty(aCaseNode, _ID);
std::string aSwitchNodeID = "";
const xmlChar *aName = aCaseNode->name;
- xmlNodePtr aSwitchNode = 0;
+ xmlNodePtr aSwitchNode = nullptr;
if (!xmlStrcmp(aName, (const xmlChar *)WDG_SWITCH_CASE)) {
aSwitchNode = hasParentRecursive(aCaseNode, WDG_SWITCH, NULL);
} else if (!xmlStrcmp(aName, (const xmlChar *)WDG_TOOLBOX_BOX)) {
Config_FeatureReader(const std::string &theXmlFile,
const std::string &theLibraryName,
const std::string &theDocSection = std::string(),
- const char *theEventGenerated = 0);
- virtual ~Config_FeatureReader();
+ const char *theEventGenerated = nullptr);
+ ~Config_FeatureReader() override;
/// Returns list of all features defined in reader's file
std::list<std::string> features() const;
protected:
/// Overloaded method. Defines how to process each node
- virtual void processNode(xmlNodePtr aNode);
+ void processNode(xmlNodePtr aNode) override;
/// Overloaded method. Clears attribute cache on exit from attribute's node
- virtual void cleanup(xmlNodePtr aNode);
+ void cleanup(xmlNodePtr aNode) override;
/// Overloaded method. Defines if the given node should be parsed recursively
- virtual bool processChildren(xmlNodePtr aNode);
+ bool processChildren(xmlNodePtr aNode) override;
/// Fills feature message
void
Config_ModuleReader::Config_ModuleReader(const char *theEventGenerated)
: Config_XMLReader(PLUGIN_FILE), myEventGenerated(theEventGenerated) {}
-Config_ModuleReader::~Config_ModuleReader() {}
+Config_ModuleReader::~Config_ModuleReader() = default;
const std::map<std::string, std::string> &
Config_ModuleReader::featuresInFiles() const {
std::list<std::string> aFeatures =
importPlugin(aPluginName, aPluginConf, aPluginDocSection);
- std::list<std::string>::iterator it = aFeatures.begin();
+ auto it = aFeatures.begin();
for (; it != aFeatures.end(); it++) {
if (isLicensed)
addFeatureRequireLicense(*it, aPluginConf);
normalize(getProperty(theNode, PLUGIN_DEPENDENCY));
if (aRequiredModule.empty())
return true;
- std::set<std::string>::iterator it = myDependencyModules.begin();
+ auto it = myDependencyModules.begin();
for (; it != myDependencyModules.end(); it++) {
if (*it == aRequiredModule)
return true;
static PyObject *PyStdOut_write(PyStdOut *self, PyObject *args) {
char *c;
if (!PyArg_ParseTuple(args, "s", &c))
- return NULL;
+ return nullptr;
*(self->out) = *(self->out) + c;
static PyMethodDef PyStdOut_methods[] = {
{"write", (PyCFunction)PyStdOut_write, METH_VARARGS,
PyDoc_STR("write(string) -> None")},
- {0, 0, 0, 0} /* sentinel */
+ {nullptr, nullptr, 0, nullptr} /* sentinel */
};
static PyMemberDef PyStdOut_memberlist[] = {
{(char *)"softspace", T_INT, offsetof(PyStdOut, softspace), 0,
(char *)"flag indicating that a space needs to be printed; used by print"},
- {0, 0, 0, 0, 0} /* sentinel */
+ {nullptr, 0, 0, 0, nullptr} /* sentinel */
};
static PyTypeObject PyStdOut_Type = {
/* The ob_type field must be initialized in the module init function
* to be portable to Windows without using C++. */
- PyVarObject_HEAD_INIT(NULL, 0)
+ PyVarObject_HEAD_INIT(nullptr, 0)
/* 0, */ /*ob_size*/
"PyOut", /*tp_name*/
sizeof(PyStdOut), /*tp_basicsize*/
/* methods */
(destructor)PyStdOut_dealloc, /*tp_dealloc*/
0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash*/
- 0, /*tp_call*/
- 0, /*tp_str*/
+ nullptr, /*tp_getattr*/
+ nullptr, /*tp_setattr*/
+ nullptr, /*tp_compare*/
+ nullptr, /*tp_repr*/
+ nullptr, /*tp_as_number*/
+ nullptr, /*tp_as_sequence*/
+ nullptr, /*tp_as_mapping*/
+ nullptr, /*tp_hash*/
+ nullptr, /*tp_call*/
+ nullptr, /*tp_str*/
PyObject_GenericGetAttr, /*tp_getattro*/
/* softspace is writable: we must supply tp_setattro */
PyObject_GenericSetAttr, /* tp_setattro */
- 0, /*tp_as_buffer*/
+ nullptr, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT, /*tp_flags*/
- 0, /*tp_doc*/
- 0, /*tp_traverse*/
- 0, /*tp_clear*/
- 0, /*tp_richcompare*/
+ nullptr, /*tp_doc*/
+ nullptr, /*tp_traverse*/
+ nullptr, /*tp_clear*/
+ nullptr, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
- 0, /*tp_iter*/
- 0, /*tp_iternext*/
+ nullptr, /*tp_iter*/
+ nullptr, /*tp_iternext*/
PyStdOut_methods, /*tp_methods*/
PyStdOut_memberlist, /*tp_members*/
- 0, /*tp_getset*/
- 0, /*tp_base*/
- 0, /*tp_dict*/
- 0, /*tp_descr_get*/
- 0, /*tp_descr_set*/
+ nullptr, /*tp_getset*/
+ nullptr, /*tp_base*/
+ nullptr, /*tp_dict*/
+ nullptr, /*tp_descr_get*/
+ nullptr, /*tp_descr_set*/
0, /*tp_dictoffset*/
- 0, /*tp_init*/
- 0, /*tp_alloc*/
- 0, /*tp_new*/
- 0, /*tp_free*/
- 0, /*tp_is_gc*/
- 0, /*tp_bases*/
- 0, /*tp_mro*/
- 0, /*tp_cache*/
- 0, /*tp_subclasses*/
- 0, /*tp_weaklist*/
- 0, /*tp_del*/
+ nullptr, /*tp_init*/
+ nullptr, /*tp_alloc*/
+ nullptr, /*tp_new*/
+ nullptr, /*tp_free*/
+ nullptr, /*tp_is_gc*/
+ nullptr, /*tp_bases*/
+ nullptr, /*tp_mro*/
+ nullptr, /*tp_cache*/
+ nullptr, /*tp_subclasses*/
+ nullptr, /*tp_weaklist*/
+ nullptr, /*tp_del*/
0, /*tp_version_tag*/
- 0, /*tp_finalize*/
+ nullptr, /*tp_finalize*/
};
PyObject *newPyStdOut(std::string &out) {
myPluginId = thePluginId;
}
-Config_PluginMessage::~Config_PluginMessage() {}
+Config_PluginMessage::~Config_PluginMessage() = default;
const std::string &Config_PluginMessage::pluginId() const { return myPluginId; }
/// Constructs Config_PluginMessage
CONFIG_EXPORT Config_PluginMessage(const Events_ID theId,
const std::string &thePluginId,
- const void *theParent = 0);
+ const void *theParent = nullptr);
/// Deletes Config_PluginMessage
- CONFIG_EXPORT virtual ~Config_PluginMessage();
+ CONFIG_EXPORT ~Config_PluginMessage() override;
/// Plugin Id
CONFIG_EXPORT const std::string &pluginId() const;
// LCOV_EXCL_START
Config_PointerMessage::Config_PointerMessage(const Events_ID theId,
const void *theParent)
- : Events_Message(theId, theParent), myPointer(0) {}
+ : Events_Message(theId, theParent), myPointer(nullptr) {}
-Config_PointerMessage::~Config_PointerMessage() {}
+Config_PointerMessage::~Config_PointerMessage() = default;
void *Config_PointerMessage::pointer() const { return myPointer; }
class CONFIG_EXPORT Config_PointerMessage : public Events_Message {
public:
/// Constructor
- Config_PointerMessage(const Events_ID theId, const void *theParent = 0);
- virtual ~Config_PointerMessage();
+ Config_PointerMessage(const Events_ID theId, const void *theParent = nullptr);
+ ~Config_PointerMessage() override;
/// Returns pointer to an object
void *pointer() const;
bool stringToBoolean(const std::string &theInt);
Config_Properties &Config_PropManager::props() {
- static Config_Properties *confProps = new Config_Properties();
+ static auto *confProps = new Config_Properties();
return *confProps;
}
if ((aProp->section() == theSection) && (aProp->name() == theName))
return aProp;
}
- return NULL;
+ return nullptr;
}
Config_Properties Config_PropManager::getProperties() {
std::string aStr = theDouble;
// change locale and convert "," to "." if exists
- std::string aCurLocale = setlocale(LC_NUMERIC, 0);
+ std::string aCurLocale = setlocale(LC_NUMERIC, nullptr);
setlocale(LC_NUMERIC, "C");
size_t dotpos = aStr.find(',');
if (dotpos != std::string::npos)
protected:
/// Overloaded method. Defines how to process each node
- virtual void processNode(xmlNodePtr theNode);
+ void processNode(xmlNodePtr theNode) override;
private:
Config_Translator::Translator myTranslator;
class Config_Translator {
public:
/// A data type of dictionary <KeyString, ResultString>
- typedef std::map<std::string, std::string> Dictionary;
+ using Dictionary = std::map<std::string, std::string>;
/// A data type of Translator with structure <Context, Dictionary>
- typedef std::map<std::string, Dictionary> Translator;
+ using Translator = std::map<std::string, Dictionary>;
/**
* Load translations from TS file
myAttributeId = "";
}
-Config_ValidatorMessage::~Config_ValidatorMessage() {}
+Config_ValidatorMessage::~Config_ValidatorMessage() = default;
const std::string &Config_ValidatorMessage::validatorId() const {
return myValidatorId;
* \param theParent - pointer to the sender
*/
CONFIG_EXPORT Config_ValidatorMessage(const Events_ID theId,
- const void *theParent = 0);
- CONFIG_EXPORT virtual ~Config_ValidatorMessage();
+ const void *theParent = nullptr);
+ CONFIG_EXPORT ~Config_ValidatorMessage() override;
//! Get id of the filter
CONFIG_EXPORT const std::string &validatorId() const;
const std::string &theXmlFileName, bool isXMLContent)
: Config_XMLReader(theXmlFileName, isXMLContent) {}
-Config_ValidatorReader::~Config_ValidatorReader() {}
+Config_ValidatorReader::~Config_ValidatorReader() = default;
void Config_ValidatorReader::processNode(xmlNodePtr theNode) {
if (isNode(theNode, NODE_VALIDATOR, NULL)) {
*/
CONFIG_EXPORT Config_ValidatorReader(const std::string &theXmlFile,
bool isXMLContent = false);
- CONFIG_EXPORT virtual ~Config_ValidatorReader();
+ CONFIG_EXPORT ~Config_ValidatorReader() override;
/// Set feature ID for cases when XML for validators is parsed from memory
CONFIG_EXPORT void setFeatureId(const std::string &theId) {
* \brief Allows to customize reader's behavior for a node. Virtual.
* The default implementation process "source" and "validator" nodes.
*/
- virtual void processNode(xmlNodePtr aNode);
+ void processNode(xmlNodePtr aNode) override;
/*!
* \brief Defines which nodes should be processed recursively. Virtual.
* The default impl is to read all nodes.
*/
- virtual bool processChildren(xmlNodePtr aNode);
+ bool processChildren(xmlNodePtr aNode) override;
/*!
* Cleans the cached information about parent feature or attribute (widget)
*/
- virtual void cleanup(xmlNodePtr theNode);
+ void cleanup(xmlNodePtr theNode) override;
/*!
* \brief Retrieves all the necessary info from the validator node.
while (aChildNode && !isElementNode(aChildNode)) {
aChildNode = aChildNode->next;
}
- if (aChildNode != NULL) {
+ if (aChildNode != nullptr) {
myCurrentNode = aChildNode;
return true;
}
if (myCurrentNode) {
myCurrentNode = myCurrentNode->parent;
}
- return myCurrentNode != NULL;
+ return myCurrentNode != nullptr;
}
std::string Config_WidgetAPI::widgetType() const {
{}
-Config_WidgetReader::~Config_WidgetReader() {}
+Config_WidgetReader::~Config_WidgetReader() = default;
std::string
Config_WidgetReader::featureWidgetCfg(const std::string &theFeatureName) {
void Config_WidgetReader::resolveSourceNodes(xmlNodePtr theNode) {
xmlNodePtr aNode = xmlFirstElementChild(theNode);
std::list<xmlNodePtr> aSourceNodes;
- while (aNode != NULL) {
+ while (aNode != nullptr) {
if (isNode(aNode, NODE_SOURCE, NULL)) {
Config_XMLReader aSourceReader =
Config_XMLReader(getProperty(aNode, SOURCE_FILE));
if (aSourceRoot) {
xmlNodePtr aSourceNode = xmlFirstElementChild(aSourceRoot);
xmlNodePtr aTargetNode = xmlDocCopyNodeList(aNode->doc, aSourceNode);
- while (aTargetNode != NULL) {
+ while (aTargetNode != nullptr) {
xmlNodePtr aNextNode = xmlNextElementSibling(aTargetNode);
xmlAddPrevSibling(aNode, aTargetNode);
aTargetNode = aNextNode;
aNode = xmlNextElementSibling(aNode);
}
// Remove "SOURCE" node.
- std::list<xmlNodePtr>::iterator it = aSourceNodes.begin();
+ auto it = aSourceNodes.begin();
for (; it != aSourceNodes.end(); it++) {
xmlUnlinkNode(*it);
xmlFreeNode(*it);
* the reader
*/
CONFIG_EXPORT Config_WidgetReader(const std::string &theXmlFile);
- CONFIG_EXPORT virtual ~Config_WidgetReader();
+ CONFIG_EXPORT ~Config_WidgetReader() override;
/// Extract feature's widget configuration from local cache, stored on node
/// processing
protected:
/// Overloaded method. Defines how to process each node
- void processNode(xmlNodePtr theNode);
+ void processNode(xmlNodePtr theNode) override;
/// Overloaded method. Defines if the given node should be parsed recursively
- bool processChildren(xmlNodePtr theNode);
+ bool processChildren(xmlNodePtr theNode) override;
/// Extracts xml definition of the given node and it's children
std::string dumpNode(xmlNodePtr theNode);
/// Replace all "source" nodes with their content (used before dumping nodes)
}
//==================================================================================================
-ConstructionAPI_Axis::~ConstructionAPI_Axis() {}
+ConstructionAPI_Axis::~ConstructionAPI_Axis() = default;
//==================================================================================================
void ConstructionAPI_Axis::setByPoints(
/// Destructor
CONSTRUCTIONAPI_EXPORT
- virtual ~ConstructionAPI_Axis();
+ ~ConstructionAPI_Axis() override;
INTERFACE_21(
ConstructionPlugin_Axis::ID(), creationMethod,
/// Dump wrapped feature
CONSTRUCTIONAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on Axis object
}
//==================================================================================================
-ConstructionAPI_Plane::~ConstructionAPI_Plane() {}
+ConstructionAPI_Plane::~ConstructionAPI_Plane() = default;
//==================================================================================================
void ConstructionAPI_Plane::setByFaceAndDistance(
/// Destructor
CONSTRUCTIONAPI_EXPORT
- virtual ~ConstructionAPI_Plane();
+ ~ConstructionAPI_Plane() override;
INTERFACE_21(
ConstructionPlugin_Plane::ID(), creationMethod,
/// Dump wrapped feature
CONSTRUCTIONAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on Plane object
}
//==================================================================================================
-ConstructionAPI_Point::~ConstructionAPI_Point() {}
+ConstructionAPI_Point::~ConstructionAPI_Point() = default;
//==================================================================================================
void ConstructionAPI_Point::setByXYZ(const ModelHighAPI_Double &theX,
/// Destructor.
CONSTRUCTIONAPI_EXPORT
- virtual ~ConstructionAPI_Point();
+ ~ConstructionAPI_Point() override;
INTERFACE_25(
ConstructionPlugin_Point::ID(), point,
/// Dump wrapped feature
CONSTRUCTIONAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on Point object.
}
/// Returns a minimal length for axis
- inline static const double MINIMAL_LENGTH() { return 1.e-5; }
+ inline static double MINIMAL_LENGTH() { return 1.e-5; }
/// Creates a new part document if needed
CONSTRUCTIONPLUGIN_EXPORT void execute() override;
const std::shared_ptr<GeomAPI_Pln> thePln);
//==================================================================================================
-ConstructionPlugin_Plane::ConstructionPlugin_Plane() {}
+ConstructionPlugin_Plane::ConstructionPlugin_Plane() = default;
//==================================================================================================
void ConstructionPlugin_Plane::initAttributes() {
AISObjectPtr thePrs) {
std::vector<int> aColor;
// get color from the attribute of the result
- if (theResult.get() != NULL &&
- theResult->data()->attribute(ModelAPI_Result::COLOR_ID()).get() != NULL) {
+ if (theResult.get() != nullptr &&
+ theResult->data()->attribute(ModelAPI_Result::COLOR_ID()).get() !=
+ nullptr) {
AttributeIntArrayPtr aColorAttr =
theResult->data()->intArray(ModelAPI_Result::COLOR_ID());
if (aColorAttr.get() && aColorAttr->size()) {
AttributeDoublePtr anAttrC = real(ConstructionPlugin_Plane::C());
AttributeDoublePtr anAttrD = real(ConstructionPlugin_Plane::D());
std::shared_ptr<GeomAPI_Shape> aPlaneFace;
- if ((anAttrA.get() != NULL) && (anAttrB.get() != NULL) &&
- (anAttrC.get() != NULL) && (anAttrD.get() != NULL) &&
+ if ((anAttrA.get() != nullptr) && (anAttrB.get() != nullptr) &&
+ (anAttrC.get() != nullptr) && (anAttrD.get() != nullptr) &&
anAttrA->isInitialized() && anAttrB->isInitialized() &&
anAttrC->isInitialized() && anAttrD->isInitialized()) {
double aA = anAttrA->value(), aB = anAttrB->value(), aC = anAttrC->value(),
data()->real(ConstructionPlugin_Plane::DISTANCE());
AttributeIntegerPtr aNbCopyAttr =
data()->integer(ConstructionPlugin_Plane::NB_COPIES());
- if ((aFaceAttr.get() != NULL) && (aDistAttr.get() != NULL) &&
- (aNbCopyAttr.get() != NULL) && aFaceAttr->isInitialized() &&
+ if ((aFaceAttr.get() != nullptr) && (aDistAttr.get() != nullptr) &&
+ (aNbCopyAttr.get() != nullptr) && aFaceAttr->isInitialized() &&
aDistAttr->isInitialized()) {
double aDist = aDistAttr->value();
public GeomAPI_ICustomPrs {
public:
/// \return the kind of a feature.
- CONSTRUCTIONPLUGIN_EXPORT virtual const std::string &getKind() {
+ CONSTRUCTIONPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = ConstructionPlugin_Plane::ID();
return MY_KIND;
}
}
/// Creates a new part document if needed
- CONSTRUCTIONPLUGIN_EXPORT virtual void execute();
+ CONSTRUCTIONPLUGIN_EXPORT void execute() override;
/// Request for initialization of data model of the feature: adding all
/// attributes
- CONSTRUCTIONPLUGIN_EXPORT virtual void initAttributes();
+ CONSTRUCTIONPLUGIN_EXPORT void initAttributes() override;
/// Use plugin manager for features creation
ConstructionPlugin_Plane();
/// Customize presentation of the feature
- virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs);
+ bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs) override;
protected:
/// Creates a new plane by general equation.
: public ModelAPI_Plugin {
public:
/// Creates the feature object of this plugin by the feature string ID
- virtual FeaturePtr createFeature(std::string theFeatureID);
+ FeaturePtr createFeature(std::string theFeatureID) override;
/// Default constructor
ConstructionPlugin_Plugin();
//! \param[in] theAttribute the checked attribute.
//! \param[in] theArguments arguments of the attribute.
//! \param[out] theError error message.
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/// \class ConstructionPlugin_ValidatorPointEdgeAndPlaneNotParallel
//! \param[in] theAttribute the checked attribute.
//! \param[in] theArguments arguments of the attribute.
//! \param[out] theError error message.
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/// \class ConstructionPlugin_ValidatorPlaneThreePoints
//! \param[in] theAttribute the checked attribute.
//! \param[in] theArguments arguments of the attribute.
//! \param[out] theError error message.
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/// \class ConstructionPlugin_ValidatorPlaneLinePoint
//! \param[in] theAttribute the checked attribute.
//! \param[in] theArguments arguments of the attribute.
//! \param[out] theError error message.
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/// \class ConstructionPlugin_ValidatorPlaneTwoParallelPlanes
//! \param[in] theAttribute the checked attribute.
//! \param[in] theArguments arguments of the attribute.
//! \param[out] theError error message.
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/// \class ConstructionPlugin_ValidatorAxisTwoNotParallelPlanes
//! \param[in] theAttribute the checked attribute.
//! \param[in] theArguments arguments of the attribute.
//! \param[out] theError error message.
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/// \class ConstructionPlugin_ValidatorPointThreeNonParallelPlanes
//! \param[in] theAttribute the checked attribute.
//! \param[in] theArguments arguments of the attribute.
//! \param[out] theError error message.
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/// \class ConstructionPlugin_ValidatorNotFeature
//! \param[in] theAttribute the checked attribute.
//! \param[in] theArguments arguments of the attribute.
//! \param[out] theError error message.
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
#endif
std::shared_ptr<Events_MessageGroup> aGroup =
std::dynamic_pointer_cast<Events_MessageGroup>(theMessage);
if (aGroup) {
- std::map<char *, std::shared_ptr<Events_Message>>::iterator aMyGroup =
- myGroups.find(aGroup->eventID().eventText());
+ auto aMyGroup = myGroups.find(aGroup->eventID().eventText());
if (aMyGroup ==
myGroups.end()) { // create a new group of messages for accumulation
myGroups[aGroup->eventID().eventText()] = aGroup->newEmpty();
}
void Events_Listener::flushGrouped(const Events_ID &theID) {
- std::map<char *, std::shared_ptr<Events_Message>>::iterator aMyGroup =
- myGroups.find(theID.eventText());
+ auto aMyGroup = myGroups.find(theID.eventText());
if (aMyGroup != myGroups.end()) {
std::shared_ptr<Events_Message> aMessage = aMyGroup->second;
myGroups.erase(aMyGroup);
Events_LongOp::Events_LongOp(void *theSender)
: Events_Message(Events_LongOp::eventID(), theSender) {}
-Events_LongOp::~Events_LongOp() {}
+Events_LongOp::~Events_LongOp() = default;
Events_ID Events_LongOp::eventID() {
Events_Loop *aLoop = Events_Loop::loop();
class EVENTS_EXPORT Events_LongOp : public Events_Message {
public:
/// Default destructor
- virtual ~Events_LongOp();
+ ~Events_LongOp() override;
/// Returns the identifier of this event
static Events_ID eventID();
/// Starts the long operation
- static void start(void *theSender = 0);
+ static void start(void *theSender = nullptr);
/// Stops the long operation
- static void end(void *theSender = 0);
+ static void end(void *theSender = nullptr);
/// Returns true if the long operation is performed
static bool isPerformed();
protected:
/// Default constructor. Use "start" and "end" for generation.
- Events_LongOp(void *theSender = 0);
+ Events_LongOp(void *theSender = nullptr);
};
#endif /* EVENTS_ERROR_H_ */
static std::map<std::string, char *> CREATED_EVENTS;
char *aResult;
std::string aName(theName);
- std::map<std::string, char *>::iterator aFound = CREATED_EVENTS.find(aName);
+ auto aFound = CREATED_EVENTS.find(aName);
if (aFound == CREATED_EVENTS.end()) { // not created yet
#ifdef WIN32
aResult = _strdup(theName); // copy to make unique internal pointer
void Events_Loop::sendProcessEvent(
const std::shared_ptr<Events_Message> &theMessage,
std::list<Events_Listener *> &theListeners, const bool theFlushedNow) {
- std::list<Events_Listener *>::iterator aL = theListeners.begin();
+ auto aL = theListeners.begin();
for (; aL != theListeners.end(); aL++) {
if (theFlushedNow && (*aL)->groupMessages()) {
(*aL)->groupWhileFlush(theMessage);
std::shared_ptr<Events_MessageGroup> aGroup =
std::dynamic_pointer_cast<Events_MessageGroup>(theMessage);
if (aGroup) {
- std::map<char *, std::shared_ptr<Events_Message>>::iterator aMyGroup =
- myGroups.find(aGroup->eventID().eventText());
+ auto aMyGroup = myGroups.find(aGroup->eventID().eventText());
if (aMyGroup ==
myGroups.end()) { // create a new group of messages for accumulation
myGroups[aGroup->eventID().eventText()] = aGroup->newEmpty();
}
}
// send
- std::map<char *, std::map<void *, std::list<Events_Listener *>>>::iterator
- aFindID = myListeners.find(theMessage->eventID().eventText());
+ auto aFindID = myListeners.find(theMessage->eventID().eventText());
if (aFindID != myListeners.end()) {
- std::map<void *, std::list<Events_Listener *>>::iterator aFindSender =
- aFindID->second.find(theMessage->sender());
+ auto aFindSender = aFindID->second.find(theMessage->sender());
if (aFindSender != aFindID->second.end()) {
sendProcessEvent(theMessage, aFindSender->second,
isFlushedNow && isGroup);
}
if (theMessage->sender()) { // also call for NULL senders registered
- aFindSender = aFindID->second.find(NULL);
+ aFindSender = aFindID->second.find(nullptr);
if (aFindSender != aFindID->second.end()) {
sendProcessEvent(theMessage, aFindSender->second,
isFlushedNow && isGroup);
myImmediateListeners[theID.eventText()] = theListener;
return;
}
- std::map<char *, std::map<void *, std::list<Events_Listener *>>>::iterator
- aFindID = myListeners.find(theID.eventText());
+ auto aFindID = myListeners.find(theID.eventText());
if (aFindID == myListeners.end()) { // create container associated with ID
myListeners[theID.eventText()] =
std::map<void *, std::list<Events_Listener *>>();
aFindID = myListeners.find(theID.eventText());
}
- std::map<void *, std::list<Events_Listener *>>::iterator aFindSender =
- aFindID->second.find(theSender);
+ auto aFindSender = aFindID->second.find(theSender);
if (aFindSender ==
aFindID->second.end()) { // create container associated with sender
aFindID->second[theSender] = std::list<Events_Listener *>();
}
// check that listener was not registered with such parameters before
std::list<Events_Listener *> &aListeners = aFindSender->second;
- for (std::list<Events_Listener *>::iterator aL = aListeners.begin();
- aL != aListeners.end(); aL++)
- if (*aL == theListener)
+ for (auto &aListener : aListeners)
+ if (aListener == theListener)
return; // avoid duplicates
aListeners.push_back(theListener);
#endif
}
// send accumulated messages to "groupListeners"
- std::map<char *, std::map<void *, std::list<Events_Listener *>>>::iterator
- aFindID = myListeners.find(theID.eventText());
+ auto aFindID = myListeners.find(theID.eventText());
if (aFindID != myListeners.end()) {
- std::map<void *, std::list<Events_Listener *>>::iterator aFindSender =
- aFindID->second.begin();
+ auto aFindSender = aFindID->second.begin();
for (; aFindSender != aFindID->second.end(); aFindSender++) {
- std::list<Events_Listener *>::iterator aListener =
- aFindSender->second.begin();
+ auto aListener = aFindSender->second.begin();
for (; aListener != aFindSender->second.end(); aListener++) {
if ((*aListener)->groupMessages()) {
(*aListener)->flushGrouped(theID);
}
void Events_Loop::eraseMessages(const Events_ID &theID) {
- std::map<char *, std::shared_ptr<Events_Message>>::iterator aMyGroup =
- myGroups.find(theID.eventText());
+ auto aMyGroup = myGroups.find(theID.eventText());
if (aMyGroup != myGroups.end()) {
myGroups.erase(aMyGroup);
}
}
void Events_Loop::clear(const Events_ID &theID) {
- std::map<char *, std::shared_ptr<Events_Message>>::iterator aMyGroup =
- myGroups.find(theID.eventText());
+ auto aMyGroup = myGroups.find(theID.eventText());
if (aMyGroup != myGroups.end()) { // really sends
myGroups.erase(aMyGroup);
}
//! The empty constructor, will be called at startup of the application, only
//! once
- Events_Loop() {}
+ Events_Loop() = default;
public:
///! Returns the main object of the loop, one per application.
/// \param theValue a Boolean value to send
/// \param theSender a pointer on sender object
Events_MessageBool(const Events_ID theEventID, const bool theValue,
- const void *theSender = 0)
+ const void *theSender = nullptr)
: Events_Message(theEventID, theSender), myValue(theValue) {}
/// Default destructor
- virtual ~Events_MessageBool() {}
+ ~Events_MessageBool() override = default;
/// Returns the value stored in this message.
- const bool value() const { return myValue; }
+ bool value() const { return myValue; }
/// Sends the message
EVENTS_EXPORT void send();
const void *theSender)
: Events_Message(theID, theSender) {}
-Events_MessageGroup::~Events_MessageGroup() {}
+Events_MessageGroup::~Events_MessageGroup() = default;
// state of the history
}
-ExchangeAPI_Export::~ExchangeAPI_Export() {}
+ExchangeAPI_Export::~ExchangeAPI_Export() = default;
// this method is needed on Windows because back-slashes in python may cause
// error
/// Destructor.
EXCHANGEAPI_EXPORT
- virtual ~ExchangeAPI_Export();
+ ~ExchangeAPI_Export() override;
INTERFACE_16(
ExchangePlugin_ExportFeature::ID(), exportType,
/// Dump wrapped feature
EXCHANGEAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on Export object
setParameters(theFilePath, theScalInterUnits, theMaterials, theColor);
}
-ExchangeAPI_Import::~ExchangeAPI_Import() {}
+ExchangeAPI_Import::~ExchangeAPI_Import() = default;
//--------------------------------------------------------------------------------------
void ExchangeAPI_Import::setParameters(const std::string &theFilePath,
anImageAttr->texture(aWidth, aHeight, aByteList, aFormat);
// convert image data to QPixmap
- uchar *arr = new uchar[aByteList.size()];
+ auto *arr = new uchar[aByteList.size()];
std::copy(aByteList.begin(), aByteList.end(), arr);
QImage image(arr, aWidth, aHeight, QImage::Format_ARGB32);
QPixmap pixmap = QPixmap::fromImage(image);
const bool theColor);
/// Destructor
EXCHANGEAPI_EXPORT
- virtual ~ExchangeAPI_Import();
+ ~ExchangeAPI_Import() override;
INTERFACE_7(ExchangePlugin_ImportFeature::ID(), filePath,
ExchangePlugin_ImportFeature::FILE_PATH_ID(),
/// Dump wrapped feature
EXCHANGEAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
//! Pointer on Import object
/// Destructor
EXCHANGEAPI_EXPORT
- virtual ~ExchangeAPI_Import_Image() = default;
+ ~ExchangeAPI_Import_Image() override = default;
INTERFACE_1(ExchangePlugin_Import_ImageFeature::ID(), filePath,
ExchangePlugin_Import_ImageFeature::FILE_PATH_ID(),
/// Dump wrapped feature
EXCHANGEAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
//! Pointer on Import object
-typedef std::shared_ptr<ExchangeAPI_Import_Image> ImportImagePtr;
+using ImportImagePtr = std::shared_ptr<ExchangeAPI_Import_Image>;
EXCHANGEAPI_EXPORT
ImportImagePtr addImportImage(const std::shared_ptr<ModelAPI_Document> &thePart,
static const bool THE_DUMP_WEAK = false;
#endif
-ExchangePlugin_Dump::ExchangePlugin_Dump() {}
+ExchangePlugin_Dump::ExchangePlugin_Dump() = default;
-ExchangePlugin_Dump::~ExchangePlugin_Dump() {}
+ExchangePlugin_Dump::~ExchangePlugin_Dump() = default;
void ExchangePlugin_Dump::initAttributes() {
data()->addAttribute(FILE_PATH_ID(), ModelAPI_AttributeString::typeId());
boolean(GEOMETRIC_DUMP_ID())->value(),
boolean(WEAK_NAMING_DUMP_ID())->value()};
int aNbSelectedTypes = 0;
- for (int i = 0; i < THE_TYPES_SIZE; ++i)
- if (aTypes[i])
+ for (bool aType : aTypes)
+ if (aType)
++aNbSelectedTypes;
if (boolean(TOPOLOGICAL_NAMING_DUMP_ID())->value()) {
/// Default constructor
EXCHANGEPLUGIN_EXPORT ExchangePlugin_Dump();
/// Default destructor
- EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_Dump();
+ EXCHANGEPLUGIN_EXPORT ~ExchangePlugin_Dump() override;
/// Returns the unique kind of a feature
- EXCHANGEPLUGIN_EXPORT virtual const std::string &getKind() {
+ EXCHANGEPLUGIN_EXPORT const std::string &getKind() override {
return ExchangePlugin_Dump::ID();
}
/// Request for initialization of data model of the feature: adding all
/// attributes
- EXCHANGEPLUGIN_EXPORT virtual void initAttributes();
+ EXCHANGEPLUGIN_EXPORT void initAttributes() override;
/// Computes or recomputes the results
- EXCHANGEPLUGIN_EXPORT virtual void execute();
+ EXCHANGEPLUGIN_EXPORT void execute() override;
/// Reimplemented from ModelAPI_Feature::isMacro(). Returns true.
- EXCHANGEPLUGIN_EXPORT virtual bool isMacro() const { return true; }
+ EXCHANGEPLUGIN_EXPORT bool isMacro() const override { return true; }
/// Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false.
- EXCHANGEPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; }
+ EXCHANGEPLUGIN_EXPORT bool isPreviewNeeded() const override { return false; }
protected:
/// Performs dump to the file
#include <ExchangePlugin_Tools.h>
-ExchangePlugin_ExportFeature::ExchangePlugin_ExportFeature() {}
+ExchangePlugin_ExportFeature::ExchangePlugin_ExportFeature() = default;
ExchangePlugin_ExportFeature::~ExchangePlugin_ExportFeature() {
// TODO Auto-generated destructor stub
continue;
std::shared_ptr<GeomAPI_Shape> aCurShape = anAttrSelection->value();
- if (aCurShape.get() == NULL)
+ if (aCurShape.get() == nullptr)
aCurShape = anAttrSelection->context()->shape();
- if (aCurShape.get() != NULL) {
+ if (aCurShape.get() != nullptr) {
aShapes.push_back(aCurShape);
aContexts.push_back(anAttrSelection->context());
}
// iterate all documents used
if (aDocuments.empty())
aDocuments.push_back(document());
- std::list<DocumentPtr>::iterator aDoc = aDocuments.begin();
+ auto aDoc = aDocuments.begin();
for (; aDoc != aDocuments.end(); aDoc++) {
// groups
int aGroupCount = (*aDoc)->size(ModelAPI_ResultGroup::group());
}
}
if (!isWholePart) { // fill the rest values by default ones
- XAO::GeometricElementList::iterator allElem =
- aXao.getGeometry()->begin(aFieldDimension);
+ auto allElem = aXao.getGeometry()->begin(aFieldDimension);
for (; allElem != aXao.getGeometry()->end(aFieldDimension);
allElem++) {
if (aFilledIDs.find(allElem->first) != aFilledIDs.end())
/// Default constructor
EXCHANGEPLUGIN_EXPORT ExchangePlugin_ExportFeature();
/// Default destructor
- EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_ExportFeature();
+ EXCHANGEPLUGIN_EXPORT ~ExchangePlugin_ExportFeature() override;
/// Returns the unique kind of a feature
- EXCHANGEPLUGIN_EXPORT virtual const std::string &getKind() {
+ EXCHANGEPLUGIN_EXPORT const std::string &getKind() override {
return ExchangePlugin_ExportFeature::ID();
}
/// Request for initialization of data model of the feature: adding all
/// attributes
- EXCHANGEPLUGIN_EXPORT virtual void initAttributes();
+ EXCHANGEPLUGIN_EXPORT void initAttributes() override;
/// Reimplemented from ModelAPI_Feature::attributeChanged()
- EXCHANGEPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID);
+ EXCHANGEPLUGIN_EXPORT void
+ attributeChanged(const std::string &theID) override;
/// Computes or recomputes the results
- EXCHANGEPLUGIN_EXPORT virtual void execute();
+ EXCHANGEPLUGIN_EXPORT void execute() override;
/// Reimplemented from ModelAPI_Feature::isMacro(). Returns false.
// It is macro for not-XAO export. For XAO the feature is kept invisible in
// the tree for the export to GEOM functionality correct working.
- EXCHANGEPLUGIN_EXPORT virtual bool isMacro() const;
+ EXCHANGEPLUGIN_EXPORT bool isMacro() const override;
/// Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false.
- EXCHANGEPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; }
+ EXCHANGEPLUGIN_EXPORT bool isPreviewNeeded() const override { return false; }
/// Do not put in history.
/// Since it is not a macro, it is not deleted, but we don't want to see it.
- bool isInHistory() { return false; }
+ bool isInHistory() override { return false; }
protected:
/// Performs export of the file
// Collect names of features as a single string
static std::wstring namesOfFeatures(const std::list<FeaturePtr> &theFeatures);
-ExchangePlugin_ExportPart::ExchangePlugin_ExportPart() {}
+ExchangePlugin_ExportPart::ExchangePlugin_ExportPart() = default;
void ExchangePlugin_ExportPart::initAttributes() {
data()->addAttribute(FILE_PATH_ID(), ModelAPI_AttributeString::typeId());
static void allReferencedFeatures(const std::set<FeaturePtr> &theFeatures,
std::set<FeaturePtr> &theReferencedFeatures) {
std::set<FeaturePtr> aReferences;
- for (std::set<FeaturePtr>::const_iterator anIt = theFeatures.begin();
- anIt != theFeatures.end(); ++anIt) {
- theReferencedFeatures.insert(*anIt);
+ for (const auto &theFeature : theFeatures) {
+ theReferencedFeatures.insert(theFeature);
std::list<std::pair<std::string, std::list<ObjectPtr>>> aRefs;
- (*anIt)->data()->referencesToObjects(aRefs);
+ theFeature->data()->referencesToObjects(aRefs);
- for (std::list<std::pair<std::string, std::list<ObjectPtr>>>::iterator
- aRIt = aRefs.begin();
- aRIt != aRefs.end(); ++aRIt) {
- for (std::list<ObjectPtr>::iterator anObjIt = aRIt->second.begin();
- anObjIt != aRIt->second.end(); ++anObjIt) {
+ for (auto &aRef : aRefs) {
+ for (auto anObjIt = aRef.second.begin(); anObjIt != aRef.second.end();
+ ++anObjIt) {
FeaturePtr aFeature = ModelAPI_Feature::feature(*anObjIt);
if (aFeature && !isCoordinate(aFeature) &&
theReferencedFeatures.find(aFeature) == theReferencedFeatures.end())
// remove all features after the current one
FeaturePtr aCurrentFeature = theDocument->currentFeature(false);
- std::list<FeaturePtr>::iterator anIt = theExport.begin();
+ auto anIt = theExport.begin();
for (; anIt != theExport.end(); ++anIt)
if (*anIt == aCurrentFeature) {
theExport.erase(++anIt, theExport.end());
anIt = theExport.begin();
while (anIt != theExport.end()) {
if (aFeaturesToExport.find(*anIt) == aFeaturesToExport.end()) {
- std::list<FeaturePtr>::iterator aRemoveIt = anIt++;
+ auto aRemoveIt = anIt++;
theExport.erase(aRemoveIt);
} else
++anIt;
std::list<FeaturePtr> &theExport) {
theExport = theDocument->allFeatures();
// keep constructions only
- std::list<FeaturePtr>::iterator anIt = theExport.begin();
+ auto anIt = theExport.begin();
while (anIt != theExport.end()) {
FeaturePtr aCurFeature = *anIt;
ResultPtr aCurResult = aCurFeature->lastResult();
if (isApplicable)
++anIt;
else {
- std::list<FeaturePtr>::iterator aRemoveIt = anIt++;
+ auto aRemoveIt = anIt++;
theExport.erase(aRemoveIt);
}
}
std::list<FeaturePtr> &theExternalReferences,
std::list<FeaturePtr> &theExportedParts,
std::list<FeaturePtr> &theReferredParts) {
- for (std::list<FeaturePtr>::const_iterator anIt = theFeatures.begin();
- anIt != theFeatures.end(); ++anIt) {
+ for (const auto &theFeature : theFeatures) {
// full part should not be exported
- if ((*anIt)->getKind() == PartSetPlugin_Part::ID())
- theExportedParts.push_back(*anIt);
+ if (theFeature->getKind() == PartSetPlugin_Part::ID())
+ theExportedParts.push_back(theFeature);
- DocumentPtr aDoc = (*anIt)->document();
+ DocumentPtr aDoc = theFeature->document();
std::list<std::pair<std::string, std::list<ObjectPtr>>> aRefs;
- (*anIt)->data()->referencesToObjects(aRefs);
- std::list<std::pair<std::string, std::list<ObjectPtr>>>::iterator aRIt =
- aRefs.begin();
+ theFeature->data()->referencesToObjects(aRefs);
+ auto aRIt = aRefs.begin();
for (; aRIt != aRefs.end(); ++aRIt) {
- for (std::list<ObjectPtr>::iterator anObjIt = aRIt->second.begin();
- anObjIt != aRIt->second.end(); ++anObjIt) {
- FeaturePtr aFeature = ModelAPI_Feature::feature(*anObjIt);
+ for (auto &anObjIt : aRIt->second) {
+ FeaturePtr aFeature = ModelAPI_Feature::feature(anObjIt);
if (aFeature) {
// feature refers to external entity,
// which is neither the Origin nor coordinate axis or plane
if (aFeature->document() != aDoc && !isCoordinate(aFeature))
- theExternalReferences.push_back(*anIt);
+ theExternalReferences.push_back(theFeature);
// feature refers to result of a part
if (aFeature->getKind() == PartSetPlugin_Part::ID())
- theReferredParts.push_back(*anIt);
+ theReferredParts.push_back(theFeature);
}
}
}
std::wstring namesOfFeatures(const std::list<FeaturePtr> &theFeatures) {
std::wostringstream aListOfFeatures;
- for (std::list<FeaturePtr>::const_iterator anIt = theFeatures.begin();
- anIt != theFeatures.end(); ++anIt) {
+ for (auto anIt = theFeatures.begin(); anIt != theFeatures.end(); ++anIt) {
if (anIt != theFeatures.begin())
aListOfFeatures << ", ";
aListOfFeatures << "'" << (*anIt)->name() << "'";
ExchangePlugin_ExportPart();
/// Returns the unique kind of a feature
- EXCHANGEPLUGIN_EXPORT virtual const std::string &getKind() {
+ EXCHANGEPLUGIN_EXPORT const std::string &getKind() override {
return ExchangePlugin_ExportPart::ID();
}
/// Request for initialization of data model of the feature: adding all
/// attributes
- EXCHANGEPLUGIN_EXPORT virtual void initAttributes();
+ EXCHANGEPLUGIN_EXPORT void initAttributes() override;
/// Computes or recomputes the results
- EXCHANGEPLUGIN_EXPORT virtual void execute();
+ EXCHANGEPLUGIN_EXPORT void execute() override;
/// Returns true if this feature is used as macro: creates other features and
/// then removed.
- EXCHANGEPLUGIN_EXPORT virtual bool isMacro() const { return true; }
+ EXCHANGEPLUGIN_EXPORT bool isMacro() const override { return true; }
/// Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false.
- EXCHANGEPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; }
+ EXCHANGEPLUGIN_EXPORT bool isPreviewNeeded() const override { return false; }
/// Do not put in history.
/// Since it is not a macro, it is not deleted, but we don't want to see it.
- bool isInHistory() { return false; }
+ bool isInHistory() override { return false; }
};
#endif /* EXCHANGEPLUGIN_EXPORTPART_H_ */
} else {
// find existing part by its name
std::list<FeaturePtr> aSubFeatures = thePartSetDoc->allFeatures();
- for (std::list<FeaturePtr>::iterator aFIt = aSubFeatures.begin();
- aFIt != aSubFeatures.end(); ++aFIt) {
- if ((*aFIt)->getKind() == PartSetPlugin_Part::ID() &&
- (*aFIt)->name() == thePartName) {
- aPartFeature = *aFIt;
+ for (auto &aSubFeature : aSubFeatures) {
+ if (aSubFeature->getKind() == PartSetPlugin_Part::ID() &&
+ aSubFeature->name() == thePartName) {
+ aPartFeature = aSubFeature;
break;
}
}
// append names of all parts
std::list<FeaturePtr> aSubFeatures = aDoc->allFeatures();
- for (std::list<FeaturePtr>::iterator aFIt = aSubFeatures.begin();
- aFIt != aSubFeatures.end(); ++aFIt) {
- if ((*aFIt)->getKind() == PartSetPlugin_Part::ID())
- anAcceptedValues.push_back((*aFIt)->name());
+ for (auto &aSubFeature : aSubFeatures) {
+ if (aSubFeature->getKind() == PartSetPlugin_Part::ID())
+ anAcceptedValues.push_back(aSubFeature->name());
}
if ((size_t)aPartsAttr->size() != anAcceptedValues.size())
aTargetAttr->setValue(0);
aPartsAttr->setSize((int)anAcceptedValues.size());
- std::list<std::wstring>::iterator anIt = anAcceptedValues.begin();
+ auto anIt = anAcceptedValues.begin();
for (int anInd = 0; anIt != anAcceptedValues.end(); ++anIt, ++anInd)
aPartsAttr->setValue(anInd, Locale::Convert::toString(*anIt));
} else {
/// Default constructor
EXCHANGEPLUGIN_EXPORT ExchangePlugin_ImportBase() = default;
/// Default destructor
- EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_ImportBase() = default;
+ EXCHANGEPLUGIN_EXPORT ~ExchangePlugin_ImportBase() override = default;
/// Request for initialization of data model of the feature: adding all
/// attributes
- EXCHANGEPLUGIN_EXPORT virtual void initAttributes();
+ EXCHANGEPLUGIN_EXPORT void initAttributes() override;
/// Called on change of any argument-attribute of this object
/// \param theID identifier of changed attribute
- EXCHANGEPLUGIN_EXPORT virtual void
- attributeChanged(const std::string &theID) = 0;
+ EXCHANGEPLUGIN_EXPORT void
+ attributeChanged(const std::string &theID) override = 0;
/// Computes or recomputes the results
- EXCHANGEPLUGIN_EXPORT virtual void execute() = 0;
+ EXCHANGEPLUGIN_EXPORT void execute() override = 0;
/// Returns true if this feature is used as macro: creates other features and
/// then removed.
- EXCHANGEPLUGIN_EXPORT virtual bool isMacro() const { return true; }
+ EXCHANGEPLUGIN_EXPORT bool isMacro() const override { return true; }
/// Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false.
- EXCHANGEPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; }
+ EXCHANGEPLUGIN_EXPORT bool isPreviewNeeded() const override { return false; }
protected:
EXCHANGEPLUGIN_EXPORT void updatePart(AttributeStringArrayPtr &aPartsAttr,
/// Default constructor
EXCHANGEPLUGIN_EXPORT ExchangePlugin_Import() = default;
/// Default destructor
- EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_Import() = default;
+ EXCHANGEPLUGIN_EXPORT ~ExchangePlugin_Import() override = default;
/// Returns the unique kind of a feature
- EXCHANGEPLUGIN_EXPORT virtual const std::string &getKind() override {
+ EXCHANGEPLUGIN_EXPORT const std::string &getKind() override {
return ExchangePlugin_Import::ID();
}
/// Computes or recomputes the results
- EXCHANGEPLUGIN_EXPORT virtual void execute() override;
+ EXCHANGEPLUGIN_EXPORT void execute() override;
/// Request for initialization of data model of the feature: adding all
/// attributes
- EXCHANGEPLUGIN_EXPORT virtual void initAttributes();
+ EXCHANGEPLUGIN_EXPORT void initAttributes() override;
// Called on change of any argument-attribute of this object
/// \param theID identifier of changed attribute
- EXCHANGEPLUGIN_EXPORT virtual void
+ EXCHANGEPLUGIN_EXPORT void
attributeChanged(const std::string &theID) override;
};
/// Default constructor
EXCHANGEPLUGIN_EXPORT ExchangePlugin_Import_Image() = default;
/// Default destructor
- EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_Import_Image() = default;
+ EXCHANGEPLUGIN_EXPORT ~ExchangePlugin_Import_Image() override = default;
/// Returns the unique kind of a feature
- EXCHANGEPLUGIN_EXPORT virtual const std::string &getKind() override {
+ EXCHANGEPLUGIN_EXPORT const std::string &getKind() override {
return ExchangePlugin_Import_Image::ID();
}
/// Computes or recomputes the results
- EXCHANGEPLUGIN_EXPORT virtual void execute() override;
+ EXCHANGEPLUGIN_EXPORT void execute() override;
// Called on change of any argument-attribute of this object
/// \param theID identifier of changed attribute
- EXCHANGEPLUGIN_EXPORT virtual void
+ EXCHANGEPLUGIN_EXPORT void
attributeChanged(const std::string &theID) override;
};
// Remove previous groups/fields stored in RefList
std::list<ObjectPtr> anGroupList = aRefListOfGroups->list();
- std::list<ObjectPtr>::iterator anGroupIt = anGroupList.begin();
+ auto anGroupIt = anGroupList.begin();
for (; anGroupIt != anGroupList.end(); ++anGroupIt) {
std::shared_ptr<ModelAPI_Feature> aFeature =
ModelAPI_Feature::feature(*anGroupIt);
std::list<ResultPtr> allRes;
ModelAPI_Tools::allSubs(theResultBody, allRes);
- for (std::list<ResultPtr>::iterator aRes = allRes.begin();
- aRes != allRes.end(); ++aRes) {
- ModelAPI_Tools::getColor(*aRes, aColor);
+ for (auto &allRe : allRes) {
+ ModelAPI_Tools::getColor(allRe, aColor);
if (!aColor.empty()) {
auto it = std::find(aColorsRead.begin(), aColorsRead.end(), aColor);
if (it == aColorsRead.end()) {
// add element with the same color
std::list<ResultPtr> allRes;
ModelAPI_Tools::allSubs(theResultBody, allRes);
- for (std::list<ResultPtr>::iterator aRes = allRes.begin();
- aRes != allRes.end(); ++aRes) {
- ModelAPI_Tools::getColor(*aRes, aColor);
- GeomShapePtr aShape = (*aRes)->shape();
+ for (auto &allRe : allRes) {
+ ModelAPI_Tools::getColor(allRe, aColor);
+ GeomShapePtr aShape = allRe->shape();
if (!aColor.empty()) {
- if (aRes->get() && aColor == theColor) {
+ if (allRe.get() && aColor == theColor) {
if (aShape->isCompound() || aShape->isCompSolid()) {
GeomAPI_ShapeIterator anIt(aShape);
for (; anIt.more(); anIt.next()) {
std::list<ResultPtr> allRes;
ModelAPI_Tools::allSubs(theResultBody, allRes);
- for (std::list<ResultPtr>::iterator aRes = allRes.begin();
- aRes != allRes.end(); ++aRes) {
+ for (auto &allRe : allRes) {
- GeomShapePtr aShape = (*aRes)->shape();
- for (std::list<std::wstring>::iterator aResMat = anIt->second.begin();
- aResMat != anIt->second.end(); ++aResMat) {
- if (aRes->get() && ((*aRes)->data()->name() == (*aResMat))) {
+ GeomShapePtr aShape = allRe->shape();
+ for (auto &aResMat : anIt->second) {
+ if (allRe.get() && (allRe->data()->name() == aResMat)) {
if (aShape->isCompound() || aShape->isCompSolid()) {
GeomAPI_ShapeIterator aShapeIt(aShape);
for (; aShapeIt.more(); aShapeIt.next()) {
// Remove previous groups/fields stored in RefList
std::list<ObjectPtr> anGroupList = aRefListOfGroups->list();
- std::list<ObjectPtr>::iterator anGroupIt = anGroupList.begin();
+ auto anGroupIt = anGroupList.begin();
for (; anGroupIt != anGroupList.end(); ++anGroupIt) {
std::shared_ptr<ModelAPI_Feature> aFeature =
ModelAPI_Feature::feature(*anGroupIt);
// limitation: now in XAO fields are related to everything, so, iterate
// all sub-shapes to fill
int aCountSelected = aXaoField->countElements();
- std::list<ResultPtr>::const_iterator aResIter = results().begin();
+ auto aResIter = results().begin();
for (; aResIter != results().end() && aCountSelected; aResIter++) {
ResultBodyPtr aBody =
std::dynamic_pointer_cast<ModelAPI_ResultBody>(*aResIter);
aXaoField->countComponents(), aXaoField->countSteps());
aTables->setType(aType);
// iterate steps
- XAO::stepIterator aStepIter = aXaoField->begin();
+ auto aStepIter = aXaoField->begin();
for (int aStepIndex = 0; aStepIter != aXaoField->end();
aStepIter++, aStepIndex++) {
aStamps->setValue(aStepIndex, (*aStepIter)->getStamp());
// Store image in result body attribute
AttributeImagePtr anImageAttr =
resultBody->data()->image(ModelAPI_ResultBody::IMAGE_ID());
- if (anImageAttr.get() != NULL) {
+ if (anImageAttr.get() != nullptr) {
QImage aQImage = px.toImage();
const uchar *aImageBytes = aQImage.bits();
std::list<unsigned char> aByteArray(aImageBytes,
/// Default constructor
EXCHANGEPLUGIN_EXPORT ExchangePlugin_ImportFeatureBase() = default;
/// Default destructor
- EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_ImportFeatureBase() = default;
+ EXCHANGEPLUGIN_EXPORT ~ExchangePlugin_ImportFeatureBase() override = default;
/// Returns the unique kind of a feature
- EXCHANGEPLUGIN_EXPORT virtual const std::string &getKind() = 0;
+ EXCHANGEPLUGIN_EXPORT const std::string &getKind() override = 0;
/// Request for initialization of data model of the feature: adding all
/// attributes
- EXCHANGEPLUGIN_EXPORT virtual void initAttributes();
+ EXCHANGEPLUGIN_EXPORT void initAttributes() override;
/// Computes or recomputes the results
- EXCHANGEPLUGIN_EXPORT virtual void execute() = 0;
+ EXCHANGEPLUGIN_EXPORT void execute() override = 0;
/// Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false.
- EXCHANGEPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; }
+ EXCHANGEPLUGIN_EXPORT bool isPreviewNeeded() const override { return false; }
/// Reimplemented from ModelAPI_CompositeFeature::addFeature()
- virtual std::shared_ptr<ModelAPI_Feature> addFeature(std::string theID);
+ std::shared_ptr<ModelAPI_Feature> addFeature(std::string theID) override;
/// Reimplemented from ModelAPI_CompositeFeature::numberOfSubs()
- virtual int numberOfSubs(bool forTree = false) const;
+ int numberOfSubs(bool forTree = false) const override;
/// Reimplemented from ModelAPI_CompositeFeature::subFeature()
- virtual std::shared_ptr<ModelAPI_Feature> subFeature(const int theIndex,
- bool forTree = false);
+ std::shared_ptr<ModelAPI_Feature> subFeature(const int theIndex,
+ bool forTree = false) override;
/// Reimplemented from ModelAPI_CompositeFeature::subFeatureId()
- virtual int subFeatureId(const int theIndex) const;
+ int subFeatureId(const int theIndex) const override;
/// Reimplemented from ModelAPI_CompositeFeature::isSub()
- virtual bool isSub(ObjectPtr theObject) const;
+ bool isSub(ObjectPtr theObject) const override;
/// Reimplemented from ModelAPI_CompositeFeature::removeFeature()
- virtual void removeFeature(std::shared_ptr<ModelAPI_Feature> theFeature);
+ void removeFeature(std::shared_ptr<ModelAPI_Feature> theFeature) override;
protected:
/// Performs the import of the file
/// Default constructor
EXCHANGEPLUGIN_EXPORT ExchangePlugin_ImportFeature() = default;
/// Default destructor
- EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_ImportFeature() = default;
+ EXCHANGEPLUGIN_EXPORT ~ExchangePlugin_ImportFeature() override = default;
/// attribute name of step Scale to International System Units
inline static const std::string &STEP_SCALE_INTER_UNITS_ID() {
return MY_MEMORY_BUFFER_ID;
}
/// Returns the unique kind of a feature
- EXCHANGEPLUGIN_EXPORT virtual const std::string &getKind() override {
+ EXCHANGEPLUGIN_EXPORT const std::string &getKind() override {
return ExchangePlugin_ImportFeature::ID();
}
/// Computes or recomputes the results
- EXCHANGEPLUGIN_EXPORT virtual void execute() override;
+ EXCHANGEPLUGIN_EXPORT void execute() override;
/// Request for initialization of data model of the feature: adding all
/// attributes
- EXCHANGEPLUGIN_EXPORT virtual void initAttributes();
+ EXCHANGEPLUGIN_EXPORT void initAttributes() override;
/// Return false in case of XAOMem import.
- EXCHANGEPLUGIN_EXPORT virtual bool isEditable();
+ EXCHANGEPLUGIN_EXPORT bool isEditable() override;
protected:
/// Performs the import of the file
/// Default constructor
EXCHANGEPLUGIN_EXPORT ExchangePlugin_Import_ImageFeature() = default;
/// Default destructor
- EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_Import_ImageFeature() = default;
+ EXCHANGEPLUGIN_EXPORT ~ExchangePlugin_Import_ImageFeature() override =
+ default;
/// Returns the unique kind of a feature
- EXCHANGEPLUGIN_EXPORT virtual const std::string &getKind() override {
+ EXCHANGEPLUGIN_EXPORT const std::string &getKind() override {
return ExchangePlugin_Import_ImageFeature::ID();
}
/// Computes or recomputes the results
- EXCHANGEPLUGIN_EXPORT virtual void execute() override;
+ EXCHANGEPLUGIN_EXPORT void execute() override;
protected:
/// Performs the import of the file
static DocumentPtr findDocument(DocumentPtr thePartSetDoc,
const std::string &thePartName);
-ExchangePlugin_ImportPart::ExchangePlugin_ImportPart() {}
+ExchangePlugin_ImportPart::ExchangePlugin_ImportPart() = default;
void ExchangePlugin_ImportPart::initAttributes() {
data()->addAttribute(FILE_PATH_ID(), ModelAPI_AttributeString::typeId());
// append names of all parts
std::list<FeaturePtr> aSubFeatures = aDoc->allFeatures();
- for (std::list<FeaturePtr>::iterator aFIt = aSubFeatures.begin();
- aFIt != aSubFeatures.end(); ++aFIt) {
- if ((*aFIt)->getKind() == PartSetPlugin_Part::ID())
+ for (auto &aSubFeature : aSubFeatures) {
+ if (aSubFeature->getKind() == PartSetPlugin_Part::ID())
anAcceptedValues.push_back(
- Locale::Convert::toString((*aFIt)->name()));
+ Locale::Convert::toString(aSubFeature->name()));
}
if ((size_t)aPartsAttr->size() != anAcceptedValues.size())
aTargetAttr->setValue(0);
aPartsAttr->setSize((int)anAcceptedValues.size());
- std::list<std::string>::iterator anIt = anAcceptedValues.begin();
+ auto anIt = anAcceptedValues.begin();
for (int anInd = 0; anIt != anAcceptedValues.end(); ++anIt, ++anInd)
aPartsAttr->setValue(anInd, *anIt);
} else {
} else {
// find existing part by its name
std::list<FeaturePtr> aSubFeatures = thePartSetDoc->allFeatures();
- for (std::list<FeaturePtr>::iterator aFIt = aSubFeatures.begin();
- aFIt != aSubFeatures.end(); ++aFIt) {
- if ((*aFIt)->getKind() == PartSetPlugin_Part::ID() &&
- Locale::Convert::toString((*aFIt)->name()) == thePartName) {
- aPartFeature = *aFIt;
+ for (auto &aSubFeature : aSubFeatures) {
+ if (aSubFeature->getKind() == PartSetPlugin_Part::ID() &&
+ Locale::Convert::toString(aSubFeature->name()) == thePartName) {
+ aPartFeature = aSubFeature;
break;
}
}
std::list<FeaturePtr> &theAvoided,
ObjectNameMap &theIndexedNames) {
std::list<FeaturePtr> anAllFeatures = theDocument->allFeatures();
- std::list<FeaturePtr>::iterator aFIt = anAllFeatures.begin();
- std::list<FeaturePtr>::iterator anAvoidIt = theAvoided.begin();
+ auto aFIt = anAllFeatures.begin();
+ auto anAvoidIt = theAvoided.begin();
for (; aFIt != anAllFeatures.end(); ++aFIt) {
if (anAvoidIt != theAvoided.end() && *aFIt == *anAvoidIt) {
// skip this feature
addIndexedName(*aFIt, theIndexedNames);
// store names of results
const std::list<ResultPtr> &aResults = (*aFIt)->results();
- for (std::list<ResultPtr>::const_iterator aRIt = aResults.begin();
- aRIt != aResults.end(); ++aRIt)
- addIndexedName(*aRIt, theIndexedNames);
+ for (const auto &aResult : aResults)
+ addIndexedName(aResult, theIndexedNames);
}
}
int anIndex = 1;
splitName(aName, anIndex);
- ObjectNameMap::iterator aFoundGroup = theExistingNames.find(aGroup);
+ auto aFoundGroup = theExistingNames.find(aGroup);
bool isUnique = aFoundGroup == theExistingNames.end();
std::map<std::wstring, std::set<int>>::iterator aFound;
addIndexedName(theObject, theExistingNames);
} else {
// search the appropriate index
- std::set<int>::iterator aFoundIndex = aFound->second.find(anIndex);
+ auto aFoundIndex = aFound->second.find(anIndex);
for (; aFoundIndex != aFound->second.end(); ++aFoundIndex, ++anIndex)
if (anIndex != *aFoundIndex)
break;
ObjectNameMap aNames;
collectOldNames(theDocument, theImported, aNames);
- for (std::list<FeaturePtr>::iterator anIt = theImported.begin();
- anIt != theImported.end(); ++anIt) {
+ for (auto &anIt : theImported) {
// update name of feature
- std::wstring aNewName = uniqueName(*anIt, aNames);
- (*anIt)->data()->setName(aNewName);
+ std::wstring aNewName = uniqueName(anIt, aNames);
+ anIt->data()->setName(aNewName);
// update names of results
- const std::list<ResultPtr> &aResults = (*anIt)->results();
- for (std::list<ResultPtr>::const_iterator aRIt = aResults.begin();
- aRIt != aResults.end(); ++aRIt) {
- aNewName = uniqueName(*aRIt, aNames);
- (*aRIt)->data()->setName(aNewName);
+ const std::list<ResultPtr> &aResults = anIt->results();
+ for (const auto &aResult : aResults) {
+ aNewName = uniqueName(aResult, aNames);
+ aResult->data()->setName(aNewName);
}
}
}
ExchangePlugin_ImportPart();
/// Returns the unique kind of a feature
- EXCHANGEPLUGIN_EXPORT virtual const std::string &getKind() {
+ EXCHANGEPLUGIN_EXPORT const std::string &getKind() override {
return ExchangePlugin_ImportPart::ID();
}
/// Request for initialization of data model of the feature: adding all
/// attributes
- EXCHANGEPLUGIN_EXPORT virtual void initAttributes();
+ EXCHANGEPLUGIN_EXPORT void initAttributes() override;
/// Called on change of any argument-attribute of this object
/// \param theID identifier of changed attribute
- EXCHANGEPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID);
+ EXCHANGEPLUGIN_EXPORT void
+ attributeChanged(const std::string &theID) override;
/// Computes or recomputes the results
- EXCHANGEPLUGIN_EXPORT virtual void execute();
+ EXCHANGEPLUGIN_EXPORT void execute() override;
/// Returns true if this feature is used as macro: creates other features and
/// then removed.
- EXCHANGEPLUGIN_EXPORT virtual bool isMacro() const { return true; }
+ EXCHANGEPLUGIN_EXPORT bool isMacro() const override { return true; }
/// Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false.
- EXCHANGEPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; }
+ EXCHANGEPLUGIN_EXPORT bool isPreviewNeeded() const override { return false; }
};
#endif /* EXCHANGEPLUGIN_IMPORTPART_H_ */
class EXCHANGEPLUGIN_EXPORT ExchangePlugin_Plugin : public ModelAPI_Plugin {
public:
/// Creates the feature object of this plugin by the feature string ID
- virtual FeaturePtr createFeature(std::string theFeatureID);
+ FeaturePtr createFeature(std::string theFeatureID) override;
public:
ExchangePlugin_Plugin();
bool ExchangePlugin_FormatValidator::parseFormats(
const std::list<std::string> &theArguments,
std::list<std::string> &outFormats) {
- std::list<std::string>::const_iterator it = theArguments.begin();
+ auto it = theArguments.begin();
bool result = true;
for (; it != theArguments.end(); ++it) {
std::string anArg = *it;
* Returns true is the file-name attribute correctly corresponds to the set of
* allowed formats.
*/
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/**
/// \param[in] theAttribute an attribute to check
/// \param[in] theArguments a filter parameters
/// \param[out] theError error message.
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
#endif
}
//==================================================================================================
-FeaturesAPI_BooleanCommon::~FeaturesAPI_BooleanCommon() {}
+FeaturesAPI_BooleanCommon::~FeaturesAPI_BooleanCommon() = default;
//==================================================================================================
void FeaturesAPI_BooleanCommon::setMainObjects(
/// Destructor.
FEATURESAPI_EXPORT
- virtual ~FeaturesAPI_BooleanCommon();
+ ~FeaturesAPI_BooleanCommon() override;
INTERFACE_5(FeaturesPlugin_BooleanCommon::ID(), creationMethod,
FeaturesPlugin_BooleanCommon::CREATION_METHOD(),
/// Dump wrapped feature
FEATURESAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on Boolean object.
}
//==================================================================================================
-FeaturesAPI_BooleanCut::~FeaturesAPI_BooleanCut() {}
+FeaturesAPI_BooleanCut::~FeaturesAPI_BooleanCut() = default;
//==================================================================================================
void FeaturesAPI_BooleanCut::setMainObjects(
/// Destructor.
FEATURESAPI_EXPORT
- virtual ~FeaturesAPI_BooleanCut();
+ ~FeaturesAPI_BooleanCut() override;
INTERFACE_4(FeaturesPlugin_BooleanCut::ID(), mainObjects,
FeaturesPlugin_BooleanCut::OBJECT_LIST_ID(),
/// Dump wrapped feature
FEATURESAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on Boolean object.
}
//==================================================================================================
-FeaturesAPI_BooleanFill::~FeaturesAPI_BooleanFill() {}
+FeaturesAPI_BooleanFill::~FeaturesAPI_BooleanFill() = default;
//==================================================================================================
void FeaturesAPI_BooleanFill::setMainObjects(
/// Destructor.
FEATURESAPI_EXPORT
- virtual ~FeaturesAPI_BooleanFill();
+ ~FeaturesAPI_BooleanFill() override;
INTERFACE_4(FeaturesPlugin_BooleanFill::ID(), mainObjects,
FeaturesPlugin_BooleanFill::OBJECT_LIST_ID(),
/// Dump wrapped feature
FEATURESAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on Boolean object.
}
//==================================================================================================
-FeaturesAPI_BooleanFuse::~FeaturesAPI_BooleanFuse() {}
+FeaturesAPI_BooleanFuse::~FeaturesAPI_BooleanFuse() = default;
//==================================================================================================
void FeaturesAPI_BooleanFuse::setMainObjects(
/// Destructor.
FEATURESAPI_EXPORT
- virtual ~FeaturesAPI_BooleanFuse();
+ ~FeaturesAPI_BooleanFuse() override;
INTERFACE_6(FeaturesPlugin_BooleanFuse::ID(), creationMethod,
FeaturesPlugin_BooleanFuse::CREATION_METHOD(),
/// Dump wrapped feature
FEATURESAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on Boolean object.
}
//==================================================================================================
-FeaturesAPI_BooleanSmash::~FeaturesAPI_BooleanSmash() {}
+FeaturesAPI_BooleanSmash::~FeaturesAPI_BooleanSmash() = default;
//==================================================================================================
void FeaturesAPI_BooleanSmash::setMainObjects(
/// Destructor.
FEATURESAPI_EXPORT
- virtual ~FeaturesAPI_BooleanSmash();
+ ~FeaturesAPI_BooleanSmash() override;
INTERFACE_4(FeaturesPlugin_BooleanSmash::ID(), mainObjects,
FeaturesPlugin_BooleanSmash::OBJECT_LIST_ID(),
/// Dump wrapped feature
FEATURESAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on Boolean object.
}
//=================================================================================================
-FeaturesAPI_BoundingBox::~FeaturesAPI_BoundingBox() {}
+FeaturesAPI_BoundingBox::~FeaturesAPI_BoundingBox() = default;
//=================================================================================================
void FeaturesAPI_BoundingBox::dump(ModelHighAPI_Dumper &theDumper) const {
/// Destructor.
FEATURESAPI_EXPORT
- virtual ~FeaturesAPI_BoundingBox();
+ ~FeaturesAPI_BoundingBox() override;
INTERFACE_1(FeaturesPlugin_BoundingBox::ID(), objectSelected,
FeaturesPlugin_BoundingBox::OBJECT_ID(),
/// Dump wrapped feature
FEATURESAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on the NormalToface object.
}
}
-FeaturesAPI_Chamfer::~FeaturesAPI_Chamfer() {}
+FeaturesAPI_Chamfer::~FeaturesAPI_Chamfer() = default;
//==================================================================================================
void FeaturesAPI_Chamfer::setBase(
/// Destructor.
FEATURESAPI_EXPORT
- virtual ~FeaturesAPI_Chamfer();
+ ~FeaturesAPI_Chamfer() override;
INTERFACE_6(FeaturesPlugin_Chamfer::ID(), creationMethod,
FeaturesPlugin_Chamfer::CREATION_METHOD(),
/// Dump wrapped feature
FEATURESAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
private:
void execIfBaseNotEmpty();
}
//================================================================================================
-FeaturesAPI_Copy::~FeaturesAPI_Copy() {}
+FeaturesAPI_Copy::~FeaturesAPI_Copy() = default;
//=================================================================================================
void FeaturesAPI_Copy::setObjects(
const int theNumber);
/// Destructor.
- FEATURESAPI_EXPORT virtual ~FeaturesAPI_Copy();
+ FEATURESAPI_EXPORT ~FeaturesAPI_Copy() override;
INTERFACE_2(FeaturesPlugin_Copy::ID(), objects,
FeaturesPlugin_Copy::OBJECTS(), ModelAPI_AttributeSelectionList,
FEATURESAPI_EXPORT void setNumber(const int theNumber);
/// Dump wrapped feature
- FEATURESAPI_EXPORT virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ FEATURESAPI_EXPORT void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on Copy object.
setFaces(theFacesToRemove);
}
-FeaturesAPI_Defeaturing::~FeaturesAPI_Defeaturing() {}
+FeaturesAPI_Defeaturing::~FeaturesAPI_Defeaturing() = default;
void FeaturesAPI_Defeaturing::setFaces(
const std::list<ModelHighAPI_Selection> &theFacesToRemove) {
/// Destructor.
FEATURESAPI_EXPORT
- virtual ~FeaturesAPI_Defeaturing();
+ ~FeaturesAPI_Defeaturing() override;
INTERFACE_1(FeaturesPlugin_Defeaturing::ID(), baseObjects,
FeaturesPlugin_Defeaturing::OBJECT_LIST_ID(),
/// Dump wrapped feature
FEATURESAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
private:
void execIfBaseNotEmpty();
}
//==================================================================================================
-FeaturesAPI_Extrusion::~FeaturesAPI_Extrusion() {}
+FeaturesAPI_Extrusion::~FeaturesAPI_Extrusion() = default;
//==================================================================================================
void FeaturesAPI_Extrusion::setNestedSketch(
/// Destructor.
FEATURESAPI_EXPORT
- virtual ~FeaturesAPI_Extrusion();
+ ~FeaturesAPI_Extrusion() override;
INTERFACE_10(
FeaturesPlugin_Extrusion::ID(), sketch,
/// Dump wrapped feature
FEATURESAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
private:
void execIfBaseNotEmpty();
: ModelHighAPI_Interface(theFeature) {}
//==================================================================================================
-FeaturesAPI_ExtrusionBoolean::~FeaturesAPI_ExtrusionBoolean() {}
+FeaturesAPI_ExtrusionBoolean::~FeaturesAPI_ExtrusionBoolean() = default;
//==================================================================================================
void FeaturesAPI_ExtrusionBoolean::setNestedSketch(
public:
/// Destructor.
FEATURESAPI_EXPORT
- virtual ~FeaturesAPI_ExtrusionBoolean();
+ ~FeaturesAPI_ExtrusionBoolean() override;
INTERFACE_11("", sketch, FeaturesPlugin_Extrusion::SKETCH_ID(),
ModelAPI_AttributeReference, /** Sketch launcher */, baseObjects,
/// Dump wrapped feature
FEATURESAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
protected:
/// Constructor without values.
class FeaturesAPI_ExtrusionCut : public FeaturesAPI_ExtrusionBoolean {
public:
static std::string ID() { return FeaturesPlugin_ExtrusionCut::ID(); }
- virtual std::string getID() { return ID(); }
+ std::string getID() override { return ID(); }
// FEATURESAPI_EXPORT
// virtual std::string getID() {
class FeaturesAPI_ExtrusionFuse : public FeaturesAPI_ExtrusionBoolean {
public:
static std::string ID() { return FeaturesPlugin_ExtrusionFuse::ID(); }
- virtual std::string getID() { return ID(); }
+ std::string getID() override { return ID(); }
/// Constructor without values.
FEATURESAPI_EXPORT
};
/// Pointer on ExtrusionFuse object.
-typedef std::shared_ptr<FeaturesAPI_ExtrusionFuse> ExtrusionFusePtr;
+using ExtrusionFusePtr = std::shared_ptr<FeaturesAPI_ExtrusionFuse>;
/// \ingroup CPPHighAPI
/// \brief Create ExtrusionFuse feature.
}
}
-FeaturesAPI_Fillet1D::~FeaturesAPI_Fillet1D() {}
+FeaturesAPI_Fillet1D::~FeaturesAPI_Fillet1D() = default;
void FeaturesAPI_Fillet1D::setBase(
const std::list<ModelHighAPI_Selection> &theBaseObjects) {
}
}
-FeaturesAPI_Fillet2D::~FeaturesAPI_Fillet2D() {}
+FeaturesAPI_Fillet2D::~FeaturesAPI_Fillet2D() = default;
void FeaturesAPI_Fillet2D::setBase(
const std::list<ModelHighAPI_Selection> &theBaseObjects) {
class FeaturesAPI_Fillet : public ModelHighAPI_Interface {
public:
/// Destructor.
- virtual ~FeaturesAPI_Fillet() {}
+ ~FeaturesAPI_Fillet() override = default;
virtual std::shared_ptr<ModelAPI_AttributeDouble> radius() const = 0;
/// Destructor.
FEATURESAPI_EXPORT
- virtual ~FeaturesAPI_Fillet1D();
+ ~FeaturesAPI_Fillet1D() override;
INTERFACE_4(FeaturesPlugin_Fillet1D::ID(), creationMethod,
FeaturesPlugin_Fillet1D::CREATION_METHOD(),
/// Modify base objects of the fillet.
FEATURESAPI_EXPORT
- virtual void setBase(const std::list<ModelHighAPI_Selection> &theBaseObjects);
+ void
+ setBase(const std::list<ModelHighAPI_Selection> &theBaseObjects) override;
/// Modify fillet to have fixed radius
FEATURESAPI_EXPORT
- virtual void setRadius(const ModelHighAPI_Double &theRadius);
+ void setRadius(const ModelHighAPI_Double &theRadius) override;
/// Dump wrapped feature
FEATURESAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
private:
void execIfBaseNotEmpty();
/// Destructor.
FEATURESAPI_EXPORT
- virtual ~FeaturesAPI_Fillet2D();
+ ~FeaturesAPI_Fillet2D() override;
INTERFACE_5(FeaturesPlugin_Fillet::ID(), creationMethod,
FeaturesPlugin_Fillet::CREATION_METHOD(),
/// Modify base objects of the fillet.
FEATURESAPI_EXPORT
- virtual void setBase(const std::list<ModelHighAPI_Selection> &theBaseObjects);
+ void
+ setBase(const std::list<ModelHighAPI_Selection> &theBaseObjects) override;
/// Modify fillet to have fixed radius
FEATURESAPI_EXPORT
- virtual void setRadius(const ModelHighAPI_Double &theRadius);
+ void setRadius(const ModelHighAPI_Double &theRadius) override;
/// Modify fillet to have varying radius
FEATURESAPI_EXPORT
/// Dump wrapped feature
FEATURESAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
private:
void execIfBaseNotEmpty();
}
//==================================================================================================
-FeaturesAPI_FusionFaces::~FeaturesAPI_FusionFaces() {}
+FeaturesAPI_FusionFaces::~FeaturesAPI_FusionFaces() = default;
//==================================================================================================
void FeaturesAPI_FusionFaces::setBase(const ModelHighAPI_Selection &theBase) {
/// Destructor.
FEATURESAPI_EXPORT
- virtual ~FeaturesAPI_FusionFaces();
+ ~FeaturesAPI_FusionFaces() override;
INTERFACE_1(FeaturesPlugin_FusionFaces::ID(), base,
FeaturesPlugin_FusionFaces::BASE_SHAPE_ID(),
/// Dump wrapped feature
FEATURESAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on FusionFaces object.
}
//==================================================================================================
-FeaturesAPI_GlueFaces::~FeaturesAPI_GlueFaces() {}
+FeaturesAPI_GlueFaces::~FeaturesAPI_GlueFaces() = default;
//==================================================================================================
void FeaturesAPI_GlueFaces::setMainObjects(
/// Destructor.
FEATURESAPI_EXPORT
- virtual ~FeaturesAPI_GlueFaces();
+ ~FeaturesAPI_GlueFaces() override;
INTERFACE_3(FeaturesPlugin_GlueFaces::ID(), mainObjects,
FeaturesPlugin_GlueFaces::OBJECTS_LIST_ID(),
/// Dump wrapped feature
FEATURESAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on Glue Faces object.
}
//=================================================================================================
-FeaturesAPI_ImportResult::~FeaturesAPI_ImportResult() {}
+FeaturesAPI_ImportResult::~FeaturesAPI_ImportResult() = default;
//=================================================================================================
void FeaturesAPI_ImportResult::setObjects(
const std::list<ModelHighAPI_Selection> &theBaseObjects);
/// Destructor.
- FEATURESAPI_EXPORT virtual ~FeaturesAPI_ImportResult();
+ FEATURESAPI_EXPORT ~FeaturesAPI_ImportResult() override;
INTERFACE_1(FeaturesPlugin_ImportResult::ID(), objects,
FeaturesPlugin_ImportResult::OBJECTS(),
setObjects(const std::list<ModelHighAPI_Selection> &theBaseObjects);
/// Dump wrapped feature
- FEATURESAPI_EXPORT virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ FEATURESAPI_EXPORT void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on ImportResult object.
}
//==================================================================================================
-FeaturesAPI_Intersection::~FeaturesAPI_Intersection() {}
+FeaturesAPI_Intersection::~FeaturesAPI_Intersection() = default;
//==================================================================================================
void FeaturesAPI_Intersection::setObjects(
/// Destructor.
FEATURESAPI_EXPORT
- virtual ~FeaturesAPI_Intersection();
+ ~FeaturesAPI_Intersection() override;
INTERFACE_3(FeaturesPlugin_Intersection::ID(), objects,
FeaturesPlugin_Intersection::OBJECT_LIST_ID(),
/// Dump wrapped feature
FEATURESAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on Intersection object.
}
//==================================================================================================
-FeaturesAPI_LimitTolerance::~FeaturesAPI_LimitTolerance() {}
+FeaturesAPI_LimitTolerance::~FeaturesAPI_LimitTolerance() = default;
//==================================================================================================
void FeaturesAPI_LimitTolerance::setMainObject(
/// Destructor.
FEATURESAPI_EXPORT
- virtual ~FeaturesAPI_LimitTolerance();
+ ~FeaturesAPI_LimitTolerance() override;
INTERFACE_2(FeaturesPlugin_LimitTolerance::ID(), mainObject,
FeaturesPlugin_LimitTolerance::OBJECT_ID(),
/// Dump wrapped feature
FEATURESAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on LimitTolerance object.
}
//==================================================================================================
-FeaturesAPI_Loft::~FeaturesAPI_Loft() {}
+FeaturesAPI_Loft::~FeaturesAPI_Loft() = default;
//==================================================================================================
void FeaturesAPI_Loft::dump(ModelHighAPI_Dumper &theDumper) const {
/// Destructor.
FEATURESAPI_EXPORT
- virtual ~FeaturesAPI_Loft();
+ ~FeaturesAPI_Loft() override;
INTERFACE_2(FeaturesPlugin_Loft::ID(), fisrstObject,
FeaturesPlugin_Loft::FIRST_OBJECT_ID(),
/// Dump wrapped feature
FEATURESAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on Loft object.
}
//==================================================================================================
-FeaturesAPI_MultiRotation::~FeaturesAPI_MultiRotation() {}
+FeaturesAPI_MultiRotation::~FeaturesAPI_MultiRotation() = default;
//==================================================================================================
void FeaturesAPI_MultiRotation::setMainObjects(
/// Destructor.
FEATURESAPI_EXPORT
- virtual ~FeaturesAPI_MultiRotation();
+ ~FeaturesAPI_MultiRotation() override;
INTERFACE_5(FeaturesPlugin_MultiRotation::ID(), mainObjects,
FeaturesPlugin_MultiRotation::OBJECTS_LIST_ID(),
/// Dump wrapped feature
FEATURESAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on Multirotation object.
}
//==================================================================================================
-FeaturesAPI_MultiTranslation::~FeaturesAPI_MultiTranslation() {}
+FeaturesAPI_MultiTranslation::~FeaturesAPI_MultiTranslation() = default;
//==================================================================================================
void FeaturesAPI_MultiTranslation::setMainObjects(
/// Destructor.
FEATURESAPI_EXPORT
- virtual ~FeaturesAPI_MultiTranslation();
+ ~FeaturesAPI_MultiTranslation() override;
INTERFACE_8(FeaturesPlugin_MultiTranslation::ID(), mainObjects,
FeaturesPlugin_MultiTranslation::OBJECTS_LIST_ID(),
/// Dump wrapped feature
FEATURESAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on MultiTranslation object.
}
//=================================================================================================
-FeaturesAPI_NormalToFace::~FeaturesAPI_NormalToFace() {}
+FeaturesAPI_NormalToFace::~FeaturesAPI_NormalToFace() = default;
//=================================================================================================
void FeaturesAPI_NormalToFace::dump(ModelHighAPI_Dumper &theDumper) const {
/// Destructor.
FEATURESAPI_EXPORT
- virtual ~FeaturesAPI_NormalToFace();
+ ~FeaturesAPI_NormalToFace() override;
INTERFACE_3(FeaturesPlugin_NormalToFace::ID(), faceSelected,
FeaturesPlugin_NormalToFace::FACE_SELECTED_ID(),
/// Dump wrapped feature
FEATURESAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on the NormalToface object.
}
//==================================================================================================
-FeaturesAPI_Partition::~FeaturesAPI_Partition() {}
+FeaturesAPI_Partition::~FeaturesAPI_Partition() = default;
//==================================================================================================
void FeaturesAPI_Partition::setBase(
/// Destructor.
FEATURESAPI_EXPORT
- virtual ~FeaturesAPI_Partition();
+ ~FeaturesAPI_Partition() override;
INTERFACE_3(FeaturesPlugin_Partition::ID(), baseObjects,
FeaturesPlugin_Partition::BASE_OBJECTS_ID(),
/// Dump wrapped feature
FEATURESAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on Partition object.
}
//==================================================================================================
-FeaturesAPI_Placement::~FeaturesAPI_Placement() {}
+FeaturesAPI_Placement::~FeaturesAPI_Placement() = default;
//==================================================================================================
void FeaturesAPI_Placement::setObjects(
/// Destructor.
FEATURESAPI_EXPORT
- virtual ~FeaturesAPI_Placement();
+ ~FeaturesAPI_Placement() override;
INTERFACE_5(FeaturesPlugin_Placement::ID(), objects,
FeaturesPlugin_Placement::OBJECTS_LIST_ID(),
/// Dump wrapped feature
FEATURESAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on Placement object.
}
//=================================================================================================
-FeaturesAPI_PointCloudOnFace::~FeaturesAPI_PointCloudOnFace() {}
+FeaturesAPI_PointCloudOnFace::~FeaturesAPI_PointCloudOnFace() = default;
//==================================================================================================
void FeaturesAPI_PointCloudOnFace::setNumberOfPoints(
/// Destructor.
FEATURESAPI_EXPORT
- virtual ~FeaturesAPI_PointCloudOnFace();
+ ~FeaturesAPI_PointCloudOnFace() override;
INTERFACE_2(FeaturesPlugin_PointCloudOnFace::ID(), faceSelected,
FeaturesPlugin_PointCloudOnFace::FACE_SELECTED_ID(),
/// Dump wrapped feature
FEATURESAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on the PointCloudOnFace object.
}
//==================================================================================================
-FeaturesAPI_RemoveResults::~FeaturesAPI_RemoveResults() {}
+FeaturesAPI_RemoveResults::~FeaturesAPI_RemoveResults() = default;
//==================================================================================================
void FeaturesAPI_RemoveResults::setRemoved(
/// Destructor.
FEATURESAPI_EXPORT
- virtual ~FeaturesAPI_RemoveResults();
+ ~FeaturesAPI_RemoveResults() override;
INTERFACE_1(FeaturesPlugin_RemoveResults::ID(), removed,
FeaturesPlugin_RemoveResults::RESULTS_ID(),
/// Dump wrapped feature
FEATURESAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on RemoveResults object.
}
//==================================================================================================
-FeaturesAPI_RemoveSubShapes::~FeaturesAPI_RemoveSubShapes() {}
+FeaturesAPI_RemoveSubShapes::~FeaturesAPI_RemoveSubShapes() = default;
//==================================================================================================
void FeaturesAPI_RemoveSubShapes::setBase(
/// Destructor.
FEATURESAPI_EXPORT
- virtual ~FeaturesAPI_RemoveSubShapes();
+ ~FeaturesAPI_RemoveSubShapes() override;
INTERFACE_4(FeaturesPlugin_RemoveSubShapes::ID(), base,
FeaturesPlugin_RemoveSubShapes::BASE_SHAPE_ID(),
/// Dump wrapped feature
FEATURESAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on RemoveSubShapes object.
: ModelHighAPI_Interface(theFeature) {}
//==================================================================================================
-FeaturesAPI_RevolutionBoolean::~FeaturesAPI_RevolutionBoolean() {}
+FeaturesAPI_RevolutionBoolean::~FeaturesAPI_RevolutionBoolean() = default;
//==================================================================================================
void FeaturesAPI_RevolutionBoolean::setNestedSketch(
public:
/// Destructor.
FEATURESAPI_EXPORT
- virtual ~FeaturesAPI_RevolutionBoolean();
+ ~FeaturesAPI_RevolutionBoolean() override;
INTERFACE_11("", sketch, FeaturesPlugin_Revolution::SKETCH_ID(),
ModelAPI_AttributeReference, /** Sketch launcher */, baseObjects,
/// Dump wrapped feature
FEATURESAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
protected:
/// Constructor without values.
class FeaturesAPI_RevolutionCut : public FeaturesAPI_RevolutionBoolean {
public:
static std::string ID() { return FeaturesPlugin_RevolutionCut::ID(); }
- virtual std::string getID() { return ID(); }
+ std::string getID() override { return ID(); }
/// Constructor without values.
FEATURESAPI_EXPORT
class FeaturesAPI_RevolutionFuse : public FeaturesAPI_RevolutionBoolean {
public:
static std::string ID() { return FeaturesPlugin_RevolutionFuse::ID(); }
- virtual std::string getID() { return ID(); }
+ std::string getID() override { return ID(); }
/// Constructor without values.
FEATURESAPI_EXPORT
};
/// Pointer on RevolutionFuse object.
-typedef std::shared_ptr<FeaturesAPI_RevolutionFuse> RevolutionFusePtr;
+using RevolutionFusePtr = std::shared_ptr<FeaturesAPI_RevolutionFuse>;
/// \ingroup CPPHighAPI
/// \brief Create RevolutionFuse feature.
}
//==================================================================================================
-FeaturesAPI_Rotation::~FeaturesAPI_Rotation() {}
+FeaturesAPI_Rotation::~FeaturesAPI_Rotation() = default;
//==================================================================================================
void FeaturesAPI_Rotation::setMainObjects(
/// Destructor.
FEATURESAPI_EXPORT
- virtual ~FeaturesAPI_Rotation();
+ ~FeaturesAPI_Rotation() override;
INTERFACE_7(FeaturesPlugin_Rotation::ID(), creationMethod,
FeaturesPlugin_Rotation::CREATION_METHOD(),
/// Dump wrapped feature
FEATURESAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on Rotation object.
}
//==================================================================================================
-FeaturesAPI_Scale::~FeaturesAPI_Scale() {}
+FeaturesAPI_Scale::~FeaturesAPI_Scale() = default;
//==================================================================================================
void FeaturesAPI_Scale::setMainObjects(
/// Destructor.
FEATURESAPI_EXPORT
- virtual ~FeaturesAPI_Scale();
+ ~FeaturesAPI_Scale() override;
INTERFACE_7(FeaturesPlugin_Scale::ID(), creationMethod,
FeaturesPlugin_Scale::CREATION_METHOD(), ModelAPI_AttributeString,
/// Dump wrapped feature
FEATURESAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on Scale object.
}
//==================================================================================================
-FeaturesAPI_Sewing::~FeaturesAPI_Sewing() {}
+FeaturesAPI_Sewing::~FeaturesAPI_Sewing() = default;
//==================================================================================================
void FeaturesAPI_Sewing::setMainObjects(
/// Destructor.
FEATURESAPI_EXPORT
- virtual ~FeaturesAPI_Sewing();
+ ~FeaturesAPI_Sewing() override;
INTERFACE_4(FeaturesPlugin_Sewing::ID(), mainObjects,
FeaturesPlugin_Sewing::OBJECTS_LIST_ID(),
/// Dump wrapped feature
FEATURESAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on Sewing object.
}
//=================================================================================================
-FeaturesAPI_SharedFaces::~FeaturesAPI_SharedFaces() {}
+FeaturesAPI_SharedFaces::~FeaturesAPI_SharedFaces() = default;
//=================================================================================================
void FeaturesAPI_SharedFaces::dump(ModelHighAPI_Dumper &theDumper) const {
/// Destructor.
FEATURESAPI_EXPORT
- virtual ~FeaturesAPI_SharedFaces();
+ ~FeaturesAPI_SharedFaces() override;
INTERFACE_2(FeaturesPlugin_GroupSharedFaces::ID(), objectselected,
FeaturesPlugin_GroupSharedFaces::OBJECT_ID(),
/// Dump wrapped feature
FEATURESAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on the SharedFaces object.
}
//==================================================================================================
-FeaturesAPI_Symmetry::~FeaturesAPI_Symmetry() {}
+FeaturesAPI_Symmetry::~FeaturesAPI_Symmetry() = default;
//==================================================================================================
void FeaturesAPI_Symmetry::setMainObjects(
/// Destructor.
FEATURESAPI_EXPORT
- virtual ~FeaturesAPI_Symmetry();
+ ~FeaturesAPI_Symmetry() override;
INTERFACE_6(FeaturesPlugin_Symmetry::ID(), creationMethod,
FeaturesPlugin_Symmetry::CREATION_METHOD(),
/// Dump wrapped feature
FEATURESAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on Symmetry object.
}
//==================================================================================================
-FeaturesAPI_Translation::~FeaturesAPI_Translation() {}
+FeaturesAPI_Translation::~FeaturesAPI_Translation() = default;
//==================================================================================================
void FeaturesAPI_Translation::setMainObjects(
firstSel = axis;
values[0] = distance;
} else if (byVector) {
- std::list<ModelHighAPI_Double>::const_iterator it = vector.begin();
+ auto it = vector.begin();
for (ModelHighAPI_Double *vIt = values; it != vector.end(); ++vIt, ++it)
*vIt = *it;
} else if (byPoints) {
/// Destructor.
FEATURESAPI_EXPORT
- virtual ~FeaturesAPI_Translation();
+ ~FeaturesAPI_Translation() override;
INTERFACE_9(FeaturesPlugin_Translation::ID(), creationMethod,
FeaturesPlugin_Translation::CREATION_METHOD(),
/// Dump wrapped feature
FEATURESAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on Translation object.
}
//================================================================================================
-FeaturesAPI_Union::~FeaturesAPI_Union() {}
+FeaturesAPI_Union::~FeaturesAPI_Union() = default;
//==================================================================================================
void FeaturesAPI_Union::setBase(
/// Destructor.
FEATURESAPI_EXPORT
- virtual ~FeaturesAPI_Union();
+ ~FeaturesAPI_Union() override;
INTERFACE_3(FeaturesPlugin_Union::ID(), baseObjects,
FeaturesPlugin_Union::BASE_OBJECTS_ID(),
/// Dump wrapped feature
FEATURESAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on Union object.
theResultBody->loadDeletedShapes(theMakeShape, theBaseShape,
GeomAPI_Shape::FACE);
- for (ListOfShape::const_iterator anIter = theTools.begin();
- anIter != theTools.end(); ++anIter) {
+ for (const auto &theTool : theTools) {
GeomAPI_Shape::ShapeType aShapeType =
- (*anIter)->shapeType() <= GeomAPI_Shape::FACE ? GeomAPI_Shape::FACE
- : GeomAPI_Shape::EDGE;
- theResultBody->loadModifiedShapes(theMakeShape, *anIter, aShapeType);
+ theTool->shapeType() <= GeomAPI_Shape::FACE ? GeomAPI_Shape::FACE
+ : GeomAPI_Shape::EDGE;
+ theResultBody->loadModifiedShapes(theMakeShape, theTool, aShapeType);
- theResultBody->loadDeletedShapes(theMakeShape, *anIter,
+ theResultBody->loadDeletedShapes(theMakeShape, theTool,
GeomAPI_Shape::FACE);
}
}
ModelAPI_Tools::ResultBaseAlgo aRBA;
aRBA.resultBody = aResultBody;
aRBA.baseShape = theObjects.front();
- for (std::vector<ModelAPI_Tools::ResultBaseAlgo>::iterator aRBAIt =
- theResultBaseAlgoList.begin();
- aRBAIt != theResultBaseAlgoList.end(); ++aRBAIt) {
- theMakeShapeList->appendAlgo(aRBAIt->makeShape);
+ for (auto &aRBAIt : theResultBaseAlgoList) {
+ theMakeShapeList->appendAlgo(aRBAIt.makeShape);
}
aRBA.makeShape = theMakeShapeList;
theResultBaseAlgoList.clear();
/// Request for initialization of data model of the feature: adding all
/// attributes.
- FEATURESPLUGIN_EXPORT virtual void initAttributes();
+ FEATURESPLUGIN_EXPORT void initAttributes() override;
protected:
/// Use plugin manager for features creation.
}
/// \return the kind of a feature.
- FEATURESPLUGIN_EXPORT virtual const std::string &getKind() {
+ FEATURESPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = FeaturesPlugin_BooleanCommon::ID();
return MY_KIND;
}
/// Request for initialization of data model of the feature: adding all
/// attributes.
- FEATURESPLUGIN_EXPORT virtual void initAttributes();
+ FEATURESPLUGIN_EXPORT void initAttributes() override;
/// Performs the algorithm and stores results it in the data structure.
- FEATURESPLUGIN_EXPORT virtual void execute();
+ FEATURESPLUGIN_EXPORT void execute() override;
public:
/// Use plugin manager for features creation.
static const ListOfShape ExplodeCompounds(const ListOfShape &aList) {
ListOfShape subShapes;
- for (auto shp = aList.cbegin(); shp != aList.cend(); ++shp) {
- if ((*shp).get() && (*shp)->isCompound()) {
+ for (const auto &shp : aList) {
+ if (shp.get() && shp->isCompound()) {
// Use all sub shapes of the compound
- for (GeomAPI_ShapeIterator anExp(*shp); anExp.more(); anExp.next()) {
+ for (GeomAPI_ShapeIterator anExp(shp); anExp.more(); anExp.next()) {
GeomShapePtr aCurrent = anExp.current();
subShapes.push_back(aCurrent);
}
} else
- subShapes.push_back(*shp);
+ subShapes.push_back(shp);
}
return subShapes;
}
/// \return the kind of a feature.
- FEATURESPLUGIN_EXPORT virtual const std::string &getKind() {
+ FEATURESPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = FeaturesPlugin_BooleanCut::ID();
return MY_KIND;
}
/// Request for initialization of data model of the feature: adding all
/// attributes.
- FEATURESPLUGIN_EXPORT virtual void initAttributes();
+ FEATURESPLUGIN_EXPORT void initAttributes() override;
/// Performs the algorithm and stores results it in the data structure.
- FEATURESPLUGIN_EXPORT virtual void execute();
+ FEATURESPLUGIN_EXPORT void execute() override;
public:
/// Use plugin manager for features creation.
}
/// \return the kind of a feature.
- FEATURESPLUGIN_EXPORT virtual const std::string &getKind() {
+ FEATURESPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = FeaturesPlugin_BooleanFill::ID();
return MY_KIND;
}
/// Request for initialization of data model of the feature: adding all
/// attributes.
- FEATURESPLUGIN_EXPORT virtual void initAttributes();
+ FEATURESPLUGIN_EXPORT void initAttributes() override;
/// Performs the algorithm and stores results it in the data structure.
- FEATURESPLUGIN_EXPORT virtual void execute();
+ FEATURESPLUGIN_EXPORT void execute() override;
public:
/// Use plugin manager for features creation.
static void collectSolids(const ListOfShape &theShapes,
ListOfShape &theResult) {
- for (ListOfShape::const_iterator it = theShapes.begin();
- it != theShapes.end(); ++it)
- explodeCompound(*it, theResult);
+ for (const auto &theShape : theShapes)
+ explodeCompound(theShape, theResult);
}
//==================================================================================================
// If we have compsolids then cut with not used solids all others.
if (!aShapesToAdd.empty() && !isSingleCompsolid) {
aSolidsToFuse.clear();
- for (ListOfShape::iterator anIt = anOriginalShapes.begin();
- anIt != anOriginalShapes.end(); anIt++) {
+ for (auto &anOriginalShape : anOriginalShapes) {
ListOfShape aOneObjectList;
- aOneObjectList.push_back(*anIt);
+ aOneObjectList.push_back(anOriginalShape);
std::shared_ptr<GeomAlgoAPI_Boolean> aCutAlgo(new GeomAlgoAPI_Boolean(
aOneObjectList, aShapesToAdd, GeomAlgoAPI_Tools::BOOL_CUT, aFuzzy));
}
/// \return the kind of a feature.
- FEATURESPLUGIN_EXPORT virtual const std::string &getKind() {
+ FEATURESPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = FeaturesPlugin_BooleanFuse::ID();
return MY_KIND;
}
/// Request for initialization of data model of the feature: adding all
/// attributes.
- FEATURESPLUGIN_EXPORT virtual void initAttributes();
+ FEATURESPLUGIN_EXPORT void initAttributes() override;
/// Performs the algorithm and stores results it in the data structure.
- FEATURESPLUGIN_EXPORT virtual void execute();
+ FEATURESPLUGIN_EXPORT void execute() override;
public:
/// Use plugin manager for features creation.
// to avoid treating them as unused later when constructing a compound
// containing the result of Smash and all unused sub-shapes of multi-level
// compounds
- for (ListOfShape::iterator aNUIt = aNotUsed.begin();
- aNUIt != aNotUsed.end(); ++aNUIt)
- anObjectsHistory.addObject(*aNUIt);
+ for (auto &aNUIt : aNotUsed)
+ anObjectsHistory.addObject(aNUIt);
}
}
}
/// \return the kind of a feature.
- FEATURESPLUGIN_EXPORT virtual const std::string &getKind() {
+ FEATURESPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = FeaturesPlugin_BooleanSmash::ID();
return MY_KIND;
}
/// Request for initialization of data model of the feature: adding all
/// attributes.
- FEATURESPLUGIN_EXPORT virtual void initAttributes();
+ FEATURESPLUGIN_EXPORT void initAttributes() override;
/// Performs the algorithm and stores results it in the data structure.
- FEATURESPLUGIN_EXPORT virtual void execute();
+ FEATURESPLUGIN_EXPORT void execute() override;
public:
/// Use plugin manager for features creation.
#include <sstream>
//=================================================================================================
-FeaturesPlugin_BoundingBox::FeaturesPlugin_BoundingBox() {}
+FeaturesPlugin_BoundingBox::FeaturesPlugin_BoundingBox() = default;
//=================================================================================================
void FeaturesPlugin_BoundingBox::initAttributes() {
}
/// \return the kind of a feature.
- virtual const std::string &getKind() { return ID(); }
+ const std::string &getKind() override { return ID(); }
/// Performs the algorithm and stores results it in the data structure.
- FEATURESPLUGIN_EXPORT virtual void execute();
+ FEATURESPLUGIN_EXPORT void execute() override;
/// Request for initialization of data model of the feature: adding all
/// attributes
- FEATURESPLUGIN_EXPORT virtual void initAttributes();
+ FEATURESPLUGIN_EXPORT void initAttributes() override;
/// Called on change of any argument-attribute of this object
/// \param theID identifier of changed attribute
- FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID);
+ FEATURESPLUGIN_EXPORT void
+ attributeChanged(const std::string &theID) override;
/// Return Attribut values of result.
- FEATURESPLUGIN_EXPORT virtual AttributePtr attributResultValues();
+ FEATURESPLUGIN_EXPORT AttributePtr attributResultValues() override;
/// Use plugin manager for features creation
FeaturesPlugin_BoundingBox();
// 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);
+ for (auto &listOfFace : listOfFaces) {
+ theResultBox->generated(listOfFace.second, listOfFace.first);
}
}
class FeaturesPlugin_BoundingBoxBase : public ModelAPI_Feature {
public:
/// Performs the algorithm and stores results it in the data structure.
- FEATURESPLUGIN_EXPORT virtual void execute(){};
+ FEATURESPLUGIN_EXPORT void execute() override{};
/// Return Attribut values of result.
virtual AttributePtr attributResultValues() = 0;
protected:
- FeaturesPlugin_BoundingBoxBase() {}
+ FeaturesPlugin_BoundingBoxBase() = default;
/// Create box with two points
void createBoxByTwoPoints();
static void
extractEdgesAndFaces(const ListOfShape &theShapes, ListOfShape &theEdges,
std::map<GeomShapePtr, GeomShapePtr> &theMapEdgeFace) {
- for (ListOfShape::const_iterator anIt = theShapes.begin();
- anIt != theShapes.end(); ++anIt)
- if ((*anIt)->isEdge())
- theEdges.push_back(*anIt);
+ for (const auto &theShape : theShapes)
+ if (theShape->isEdge())
+ theEdges.push_back(theShape);
else {
- for (GeomAPI_ShapeExplorer anExp(*anIt, GeomAPI_Shape::EDGE);
+ for (GeomAPI_ShapeExplorer anExp(theShape, GeomAPI_Shape::EDGE);
anExp.more(); anExp.next()) {
GeomShapePtr aCurrent = anExp.current();
theEdges.push_back(aCurrent);
- theMapEdgeFace[aCurrent] = *anIt;
+ theMapEdgeFace[aCurrent] = theShape;
}
}
}
-FeaturesPlugin_Chamfer::FeaturesPlugin_Chamfer() {}
+FeaturesPlugin_Chamfer::FeaturesPlugin_Chamfer() = default;
void FeaturesPlugin_Chamfer::initAttributes() {
data()->addAttribute(FeaturesPlugin_Chamfer::CREATION_METHOD(),
}
/// \return the kind of a feature.
- FEATURESPLUGIN_EXPORT virtual const std::string &getKind() {
+ FEATURESPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = FeaturesPlugin_Chamfer::ID();
return MY_KIND;
}
/// Request for initialization of data model of the feature: adding all
/// attributes.
- FEATURESPLUGIN_EXPORT virtual void initAttributes();
+ FEATURESPLUGIN_EXPORT void initAttributes() override;
/// Use plugin manager for features creation.
FeaturesPlugin_Chamfer();
private:
/// Return attribute storing the selected objects of the operation.
- virtual std::shared_ptr<ModelAPI_Attribute> objectsAttribute();
+ std::shared_ptr<ModelAPI_Attribute> objectsAttribute() override;
/// Return name of modified shape prefix name
- virtual const std::string &modifiedShapePrefix() const;
+ const std::string &modifiedShapePrefix() const override;
/// Run chamfer/fillet operation and returns the modification algorithm if
/// succeed.
- virtual std::shared_ptr<GeomAlgoAPI_MakeShape>
- performOperation(const GeomShapePtr &theSolid, const ListOfShape &theEdges);
+ std::shared_ptr<GeomAlgoAPI_MakeShape>
+ performOperation(const GeomShapePtr &theSolid,
+ const ListOfShape &theEdges) override;
};
#endif
ListOfShape aFaces = GeomAlgoAPI_ShapeTools::getSharedFaces(aShape);
myShape = aShape;
aFacesListAttr->setSelectionType("face");
- ListOfShape::const_iterator anIt = aFaces.cbegin();
+ auto anIt = aFaces.cbegin();
for (; anIt != aFaces.cend(); ++anIt) {
GeomShapePtr aFacePtr = *anIt;
if (!(aFacesListAttr->isInList(aCompSolidAttr->context(), aFacePtr))) {
// Getting tools.
ListOfShape aTools;
- for (ListOfMakeShape::const_iterator anIt = aGenMakeShapes.cbegin();
- anIt != aGenMakeShapes.cend(); ++anIt) {
- aTools.push_back((*anIt)->shape());
+ for (const auto &aGenMakeShape : aGenMakeShapes) {
+ aTools.push_back(aGenMakeShape->shape());
}
// Make boolean.
int aResultIndex = 0;
std::vector<ResultBaseAlgo> aResultBaseAlgoList;
ListOfShape aResultShapesList;
- ListOfShape::const_iterator aBoolObjIt = aBooleanObjects.cbegin();
- ListOfMakeShape::const_iterator aBoolMSIt = aBooleanMakeShapes.cbegin();
+ auto aBoolObjIt = aBooleanObjects.cbegin();
+ auto aBoolMSIt = aBooleanMakeShapes.cbegin();
for (; aBoolObjIt != aBooleanObjects.cend() &&
aBoolMSIt != aBooleanMakeShapes.cend();
++aBoolObjIt, ++aBoolMSIt) {
aResultBody->storeModified(*aBoolObjIt, (*aBoolMSIt)->shape());
// Store generation history.
- ListOfShape::const_iterator aGenBaseIt = aGenBaseShapes.cbegin();
- ListOfMakeShape::const_iterator aGenMSIt = aGenMakeShapes.cbegin();
+ auto aGenBaseIt = aGenBaseShapes.cbegin();
+ auto aGenMSIt = aGenMakeShapes.cbegin();
for (; aGenBaseIt != aGenBaseShapes.cend() &&
aGenMSIt != aGenMakeShapes.cend();
++aGenBaseIt, ++aGenMSIt) {
for (GeomAPI_ShapeIterator aCompoundIt(theCompound); aCompoundIt.more();
aCompoundIt.next()) {
GeomShapePtr aCompoundSS = aCompoundIt.current();
- ListOfShape::const_iterator aUseIt = theSubShapesToAvoid.cbegin();
+ auto aUseIt = theSubShapesToAvoid.cbegin();
for (; aUseIt != theSubShapesToAvoid.cend(); aUseIt++) {
if (aCompoundSS->isEqual(*aUseIt)) {
break;
if (!aCompoundsMap.isBound(aResRootPtr->shape())) {
// Compsolid or a simple (one-level) compound
GeomShapePtr aContextShape = aResCompSolidPtr->shape();
- std::map<GeomShapePtr, ListOfShape>::iterator anIt =
- aCompSolidsObjects.begin();
+ auto anIt = aCompSolidsObjects.begin();
for (; anIt != aCompSolidsObjects.end(); anIt++) {
if (anIt->first->isEqual(aContextShape)) {
aCompSolidsObjects[anIt->first].push_back(anObject);
}
// For solids cut each object with all tools.
- for (ListOfShape::const_iterator anIt = anObjects.cbegin();
- anIt != anObjects.cend(); ++anIt) {
- GeomShapePtr anObject = *anIt;
+ for (auto anObject : anObjects) {
ListOfShape aListWithObject;
aListWithObject.push_back(anObject);
std::shared_ptr<GeomAlgoAPI_Boolean> aBoolAlgo(new GeomAlgoAPI_Boolean(
}
// Compsolids handling
- for (std::map<GeomShapePtr, ListOfShape>::const_iterator anIt =
- aCompSolidsObjects.cbegin();
- anIt != aCompSolidsObjects.cend(); ++anIt) {
- GeomShapePtr aCompSolid = anIt->first;
- const ListOfShape &aUsedShapes = anIt->second;
+ for (const auto &aCompSolidsObject : aCompSolidsObjects) {
+ GeomShapePtr aCompSolid = aCompSolidsObject.first;
+ const ListOfShape &aUsedShapes = aCompSolidsObject.second;
// Collecting solids from compsolids which will not be modified in boolean
// operation.
for (GeomAPI_ShapeIterator aCompSolidIt(aCompSolid); aCompSolidIt.more();
aCompSolidIt.next()) {
GeomShapePtr aSolidInCompSolid = aCompSolidIt.current();
- ListOfShape::const_iterator aUsedShapesIt = aUsedShapes.cbegin();
+ auto aUsedShapesIt = aUsedShapes.cbegin();
for (; aUsedShapesIt != aUsedShapes.cend(); ++aUsedShapesIt) {
if (aSolidInCompSolid->isEqual(*aUsedShapesIt)) {
break;
std::shared_ptr<GeomAlgoAPI_MakeShapeCustom> aCompMkr(
new GeomAlgoAPI_MakeShapeCustom);
aCompMkr->setResult(aBoolRes);
- for (ListOfShape::iterator aCS = aCompSolids.begin();
- aCS != aCompSolids.end(); aCS++)
- aCompMkr->addModified(*aCS, aBoolRes);
+ for (auto &aCompSolid : aCompSolids)
+ aCompMkr->addModified(aCompSolid, aBoolRes);
aMakeShapeList->appendAlgo(aCompMkr);
} else {
std::shared_ptr<GeomAlgoAPI_PaveFiller> aFillerAlgo(
}
// Complex (recursive) compounds handling
- for (ListOfShape::const_iterator anIt = aCompounds.cbegin();
- anIt != aCompounds.cend(); ++anIt) {
- GeomShapePtr aCompound = (*anIt);
+ for (const auto &anIt : aCompounds) {
+ GeomShapePtr aCompound = anIt;
GeomShapePtr aRes;
std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMakeShapeList(
new GeomAlgoAPI_MakeShapeList());
// Filter edges and faces in tools.
ListOfShape aTools;
- for (ListOfShape::const_iterator anIt = theTools.cbegin();
- anIt != theTools.cend(); ++anIt) {
- if ((*anIt)->shapeType() == GeomAPI_Shape::EDGE ||
- (*anIt)->shapeType() == GeomAPI_Shape::FACE) {
- anEdgesAndFaces.push_back(*anIt);
+ for (const auto &theTool : theTools) {
+ if (theTool->shapeType() == GeomAPI_Shape::EDGE ||
+ theTool->shapeType() == GeomAPI_Shape::FACE) {
+ anEdgesAndFaces.push_back(theTool);
} else {
- aTools.push_back(*anIt);
+ aTools.push_back(theTool);
}
}
// Collecting solids and compsolids from compounds which will not be
// modified in boolean operation and will be added to result.
ListOfShape aShapesToAdd;
- for (ListOfShape::iterator anIt = aCompounds.begin();
- anIt != aCompounds.end(); anIt++) {
- GeomShapePtr aCompound = (*anIt);
+ for (auto &anIt : aCompounds) {
+ GeomShapePtr aCompound = anIt;
addSubShapes(aCompound, anObjects, aShapesToAdd);
}
// Collecting solids from compsolids which will not be
// modified in boolean operation and will be added to result.
- for (std::map<GeomShapePtr, ListOfShape>::iterator anIt =
- aCompSolidsObjects.begin();
- anIt != aCompSolidsObjects.end(); anIt++) {
- GeomShapePtr aCompSolid = anIt->first;
- ListOfShape &aUsedShapes = anIt->second;
+ for (auto &aCompSolidsObject : aCompSolidsObjects) {
+ GeomShapePtr aCompSolid = aCompSolidsObject.first;
+ ListOfShape &aUsedShapes = aCompSolidsObject.second;
aSolidsToFuse.insert(aSolidsToFuse.end(), aUsedShapes.begin(),
aUsedShapes.end()); //???
addSubShapes(aCompSolid, aUsedShapes, aShapesToAdd);
void FeaturesPlugin_CompositeBoolean::storeDeletedShapes(
std::vector<ResultBaseAlgo> &theResultBaseAlgoList,
const ListOfShape &theTools, const GeomShapePtr theResultShapesCompound) {
- for (std::vector<ResultBaseAlgo>::iterator anIt =
- theResultBaseAlgoList.begin();
- anIt != theResultBaseAlgoList.end(); ++anIt) {
- ResultBaseAlgo &aRCA = *anIt;
+ for (auto &aRCA : theResultBaseAlgoList) {
aRCA.resultBody->loadDeletedShapes(aRCA.makeShape, aRCA.baseShape,
GeomAPI_Shape::FACE,
theResultShapesCompound);
- for (ListOfShape::const_iterator anIter = theTools.begin();
- anIter != theTools.end(); anIter++) {
- aRCA.resultBody->loadDeletedShapes(aRCA.makeShape, *anIter,
+ for (const auto &theTool : theTools) {
+ aRCA.resultBody->loadDeletedShapes(aRCA.makeShape, theTool,
GeomAPI_Shape::FACE,
theResultShapesCompound);
}
};
protected:
- FeaturesPlugin_CompositeBoolean(){};
+ FeaturesPlugin_CompositeBoolean() = default;
+ ;
/// Initializes boolean attributes.
void initBooleanAttributes();
//=================================================================================================
void FeaturesPlugin_CompositeSketch::removeFeature(
- std::shared_ptr<ModelAPI_Feature> theFeature) {
+ std::shared_ptr<ModelAPI_Feature> /*theFeature*/) {
AttributeSelectionListPtr aBaseObjectsSelectionList =
selectionList(BASE_OBJECTS_ID());
if (aBaseObjectsSelectionList.get() &&
std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMakeList =
std::dynamic_pointer_cast<GeomAlgoAPI_MakeShapeList>(theMakeShape);
if (aMakeList.get()) {
- ListOfMakeShape::const_iterator anIter = aMakeList->list().cbegin();
+ auto anIter = aMakeList->list().cbegin();
for (; anIter != aMakeList->list().cend(); anIter++) {
std::shared_ptr<GeomAlgoAPI_MakeSweep> aSweep =
std::dynamic_pointer_cast<GeomAlgoAPI_MakeSweep>(*anIter);
}
}
}
- std::list<std::shared_ptr<GeomAlgoAPI_MakeSweep>>::iterator aSweep =
- aSweeps.begin();
+ auto aSweep = aSweeps.begin();
for (; aSweep != aSweeps.end(); aSweep++) {
// Store from shapes.
storeShapes(theMakeShape, theResultBody, aBaseShapeType,
}
// Store shapes.
- for (ListOfShape::const_iterator anIt = theShapes.cbegin();
- anIt != theShapes.cend(); ++anIt) {
- GeomShapePtr aShape = *anIt;
-
+ for (auto aShape : theShapes) {
if (aShapeTypeToExplore == GeomAPI_Shape::COMPOUND) {
std::string aName =
theName +
for (int i = 0; i < aNbSubs; ++i) {
ResultBodyPtr aSubRes = theResultBody->subResult(i);
GeomShapePtr aShape = aSubRes->shape();
- ListOfShape::iterator aNewIt = aNewShapes.begin();
+ auto aNewIt = aNewShapes.begin();
for (; aNewIt != aNewShapes.end(); ++aNewIt)
if (aShape->isSubShape(*aNewIt, false))
break;
GeomShapePtr aGroupValue = theValue.get() ? theValue : aContextRes->shape();
AttributeSelectionListPtr aList = selectionList(OBJECTS());
- std::list<ResultPtr>::const_iterator aResIter = results().cbegin();
+ auto aResIter = results().cbegin();
while (aResIter != results().cend()) { // do as long as many iterations
for (int aSelIndex = 0; aSelIndex < aList->size(); aSelIndex++) {
if (aResIter ==
if (aResBody.get()) {
std::list<ResultPtr> aSubs;
ModelAPI_Tools::allSubs(aResBody, aSubs, true);
- std::list<ResultPtr>::iterator aSubIter = aSubs.begin();
+ auto aSubIter = aSubs.begin();
for (; aSubIter != aSubs.end(); aSubIter++) {
GeomShapePtr aSubShape = (*aSubIter)->shape();
if (aSubShape.get() &&
}
/// \return the kind of a feature.
- FEATURESPLUGIN_EXPORT virtual const std::string &getKind() {
+ FEATURESPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = FeaturesPlugin_Copy::ID();
return MY_KIND;
}
}
/// Performs the algorithm and stores results it in the data structure.
- FEATURESPLUGIN_EXPORT virtual void execute();
+ FEATURESPLUGIN_EXPORT void execute() override;
/// Request for initialization of data model of the feature: adding all
/// attributes.
- FEATURESPLUGIN_EXPORT virtual void initAttributes();
+ FEATURESPLUGIN_EXPORT void initAttributes() override;
/// To update the group feature which is moved over this copy feature (to add
/// copies to selection)
- FEATURESPLUGIN_EXPORT virtual void
+ FEATURESPLUGIN_EXPORT void
getCopies(ObjectPtr theContext, std::shared_ptr<GeomAPI_Shape> theValue,
std::list<ObjectPtr> &theCopyContext,
- std::list<std::shared_ptr<GeomAPI_Shape>> &theCopyVals);
+ std::list<std::shared_ptr<GeomAPI_Shape>> &theCopyVals) override;
/// Use plugin manager for features creation.
- FeaturesPlugin_Copy() {}
+ FeaturesPlugin_Copy() = default;
};
#endif
#include <unordered_map>
-FeaturesPlugin_Defeaturing::FeaturesPlugin_Defeaturing() {}
+FeaturesPlugin_Defeaturing::FeaturesPlugin_Defeaturing() = default;
void FeaturesPlugin_Defeaturing::initAttributes() {
data()->addAttribute(OBJECT_LIST_ID(),
std::vector<ModelAPI_Tools::ResultBaseAlgo> aResultBaseAlgoList;
ListOfShape anOriginalShapesList, aResultShapesList;
- for (SolidFaces::iterator anIt = aBodiesAndFacesToRemove.begin();
- anIt != aBodiesAndFacesToRemove.end(); ++anIt) {
- GeomShapePtr aParent = anIt->first;
- anAlgo.reset(new GeomAlgoAPI_Defeaturing(aParent, anIt->second));
+ for (auto &anIt : aBodiesAndFacesToRemove) {
+ GeomShapePtr aParent = anIt.first;
+ anAlgo.reset(new GeomAlgoAPI_Defeaturing(aParent, anIt.second));
if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(anAlgo, getKind(),
anError)) {
setError(anError);
}
/// \return the kind of a feature.
- FEATURESPLUGIN_EXPORT virtual const std::string &getKind() {
+ FEATURESPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = FeaturesPlugin_Defeaturing::ID();
return MY_KIND;
}
}
/// Performs the defeaturing algorithm and stores it in the data structure.
- FEATURESPLUGIN_EXPORT virtual void execute();
+ FEATURESPLUGIN_EXPORT void execute() override;
/// Request for initialization of data model of the feature: adding all
/// attributes.
- FEATURESPLUGIN_EXPORT virtual void initAttributes();
+ FEATURESPLUGIN_EXPORT void initAttributes() override;
/// Use plugin manager for features creation.
FeaturesPlugin_Defeaturing();
#include <GeomAPI_ShapeIterator.h>
//=================================================================================================
-FeaturesPlugin_Extrusion::FeaturesPlugin_Extrusion() {}
+FeaturesPlugin_Extrusion::FeaturesPlugin_Extrusion() = default;
//=================================================================================================
void FeaturesPlugin_Extrusion::initAttributes() {
// Store results.
int aResultIndex = 0;
- ListOfShape::const_iterator aBaseIt = aBaseShapesList.cbegin();
- ListOfMakeShape::const_iterator anAlgoIt = aMakeShapesList.cbegin();
+ auto aBaseIt = aBaseShapesList.cbegin();
+ auto anAlgoIt = aMakeShapesList.cbegin();
for (;
aBaseIt != aBaseShapesList.cend() && anAlgoIt != aMakeShapesList.cend();
++aBaseIt, ++anAlgoIt) {
// Generating result for each base shape.
std::string anError;
- for (ListOfShape::const_iterator anIter = theBaseShapes.cbegin();
- anIter != theBaseShapes.cend(); anIter++) {
- std::shared_ptr<GeomAPI_Shape> aBaseShape = *anIter;
-
+ for (auto aBaseShape : theBaseShapes) {
std::shared_ptr<GeomAlgoAPI_Prism> aPrismAlgo(new GeomAlgoAPI_Prism(
aBaseShape, aDir, aToShape, aToSize, aFromShape, aFromSize));
if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aPrismAlgo, getKind(),
}
/// \return the kind of a feature.
- FEATURESPLUGIN_EXPORT virtual const std::string &getKind() {
+ FEATURESPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = FeaturesPlugin_Extrusion::ID();
return MY_KIND;
}
/// Request for initialization of data model of the feature: adding all
/// attributes.
- FEATURESPLUGIN_EXPORT virtual void initAttributes();
+ FEATURESPLUGIN_EXPORT void initAttributes() override;
/// Performs the algorithm and stores results it in the data structure.
- FEATURESPLUGIN_EXPORT virtual void execute();
+ FEATURESPLUGIN_EXPORT void execute() override;
protected:
/// Generates extrusions.
public:
/// Request for initialization of data model of the feature: adding all
/// attributes.
- FEATURESPLUGIN_EXPORT virtual void initAttributes();
+ FEATURESPLUGIN_EXPORT void initAttributes() override;
protected:
- FeaturesPlugin_ExtrusionBoolean(){};
+ FeaturesPlugin_ExtrusionBoolean() = default;
+ ;
// Creates extrusions.
bool makeGeneration(ListOfShape &theBaseShapes,
- ListOfMakeShape &theMakeShapes);
+ ListOfMakeShape &theMakeShapes) override;
/// Stores generation history.
void storeGenerationHistory(
ResultBodyPtr theResultBody, const GeomShapePtr theBaseShape,
- const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape);
+ const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape) override;
/// Calculate prism sizes to ensure that it passes through all objects
/// Redefined from FeaturesPlugin_Extrusion
- virtual void getSizes(double &theToSize, double &theFromSize);
+ void getSizes(double &theToSize, double &theFromSize) override;
};
#endif
}
/// \return the kind of a feature
- FEATURESPLUGIN_EXPORT virtual const std::string &getKind() {
+ FEATURESPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = FeaturesPlugin_ExtrusionCut::ID();
return MY_KIND;
}
/// Performs the algorithm and stores results it in the data structure.
- FEATURESPLUGIN_EXPORT virtual void execute();
+ FEATURESPLUGIN_EXPORT void execute() override;
};
#endif
// Getting tools.
ListOfShape aNewTools;
ListOfMakeShape aToolsMakeShapes;
- for (ListOfMakeShape::const_iterator anIt = aGenMakeShapes.cbegin();
- anIt != aGenMakeShapes.cend(); ++anIt) {
- GeomMakeShapePtr anAlgo = (*anIt);
+ for (const auto &aGenMakeShape : aGenMakeShapes) {
+ GeomMakeShapePtr anAlgo = aGenMakeShape;
std::shared_ptr<GeomAlgoAPI_Prism> aPrismAlgo =
std::dynamic_pointer_cast<GeomAlgoAPI_Prism>(anAlgo);
int aResultIndex = 0;
std::vector<ResultBaseAlgo> aResultBaseAlgoList;
ListOfShape aResultShapesList;
- ListOfShape::const_iterator aBoolObjIt = aBooleanObjects.cbegin();
- ListOfMakeShape::const_iterator aBoolMSIt = aBooleanMakeShapes.cbegin();
+ auto aBoolObjIt = aBooleanObjects.cbegin();
+ auto aBoolMSIt = aBooleanMakeShapes.cbegin();
for (; aBoolObjIt != aBooleanObjects.cend() &&
aBoolMSIt != aBooleanMakeShapes.cend();
++aBoolObjIt, ++aBoolMSIt) {
aResultBody->storeModified(*aBoolObjIt, (*aBoolMSIt)->shape());
// Store generation history.
- ListOfShape::const_iterator aGenBaseIt = aGenBaseShapes.cbegin();
- ListOfMakeShape::const_iterator aGenMSIt = aGenMakeShapes.cbegin();
+ auto aGenBaseIt = aGenBaseShapes.cbegin();
+ auto aGenMSIt = aGenMakeShapes.cbegin();
for (; aGenBaseIt != aGenBaseShapes.cend() &&
aGenMSIt != aGenMakeShapes.cend();
++aGenBaseIt, ++aGenMSIt) {
// ???
- ListOfMakeShape::const_iterator aToolsMSIt = aToolsMakeShapes.cbegin();
+ auto aToolsMSIt = aToolsMakeShapes.cbegin();
for (; aToolsMSIt != aToolsMakeShapes.cend(); ++aToolsMSIt) {
std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMSList(
new GeomAlgoAPI_MakeShapeList());
}
/// \return the kind of a feature
- FEATURESPLUGIN_EXPORT virtual const std::string &getKind() {
+ FEATURESPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = FeaturesPlugin_ExtrusionFuse::ID();
return MY_KIND;
}
/// Performs the algorithm and stores results it in the data structure.
- FEATURESPLUGIN_EXPORT virtual void execute();
+ FEATURESPLUGIN_EXPORT void execute() override;
private:
void executeFuseThroughAll();
// Extract edges from the list
static ListOfShape extractEdges(const ListOfShape &theShapes) {
ListOfShape anEdges;
- for (ListOfShape::const_iterator anIt = theShapes.begin();
- anIt != theShapes.end(); ++anIt)
- for (GeomAPI_ShapeExplorer anExp(*anIt, GeomAPI_Shape::EDGE); anExp.more();
- anExp.next())
+ for (const auto &theShape : theShapes)
+ for (GeomAPI_ShapeExplorer anExp(theShape, GeomAPI_Shape::EDGE);
+ anExp.more(); anExp.next())
anEdges.push_back(anExp.current());
return anEdges;
}
-FeaturesPlugin_Fillet::FeaturesPlugin_Fillet() {}
+FeaturesPlugin_Fillet::FeaturesPlugin_Fillet() = default;
void FeaturesPlugin_Fillet::initAttributes() {
data()->addAttribute(CREATION_METHOD(), ModelAPI_AttributeString::typeId());
}
/// \return the kind of a feature.
- FEATURESPLUGIN_EXPORT virtual const std::string &getKind() {
+ FEATURESPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = FeaturesPlugin_Fillet::ID();
return MY_KIND;
}
/// Request for initialization of data model of the feature: adding all
/// attributes.
- FEATURESPLUGIN_EXPORT virtual void initAttributes();
+ FEATURESPLUGIN_EXPORT void initAttributes() override;
/// Use plugin manager for features creation.
FeaturesPlugin_Fillet();
private:
/// Return attribute storing the selected objects of the operation.
- virtual std::shared_ptr<ModelAPI_Attribute> objectsAttribute();
+ std::shared_ptr<ModelAPI_Attribute> objectsAttribute() override;
/// Return name of modified shape prefix name
- virtual const std::string &modifiedShapePrefix() const;
+ const std::string &modifiedShapePrefix() const override;
/// Run chamfer/fillet operation and returns the modification algorithm if
/// succeed.
- virtual std::shared_ptr<GeomAlgoAPI_MakeShape>
- performOperation(const GeomShapePtr &theSolid, const ListOfShape &theEdges);
+ std::shared_ptr<GeomAlgoAPI_MakeShape>
+ performOperation(const GeomShapePtr &theSolid,
+ const ListOfShape &theEdges) override;
};
#endif
Events_Loop::loop()->send(aMessage);
}
-FeaturesPlugin_Fillet1D::FeaturesPlugin_Fillet1D() {}
+FeaturesPlugin_Fillet1D::FeaturesPlugin_Fillet1D() = default;
void FeaturesPlugin_Fillet1D::initAttributes() {
data()->addAttribute(CREATION_METHOD(), ModelAPI_AttributeString::typeId());
return;
int aResultIndex = 0;
- for (ListOfShape::iterator anIt = aWires.begin(); anIt != aWires.end();
- ++anIt)
- if (!performFillet(*anIt, aVertices[*anIt], aResultIndex++))
+ for (auto &aWire : aWires)
+ if (!performFillet(aWire, aVertices[aWire], aResultIndex++))
break;
removeResults(aResultIndex);
}
GeomAPI_Shape::EDGE);
const MapShapeToShapes &aSubshapes = aMapVE.map();
std::set<GeomShapePtr, GeomAPI_Shape::Comparator> aFilletVertices;
- for (MapShapeToShapes::const_iterator anIt = aSubshapes.begin();
- anIt != aSubshapes.end(); ++anIt) {
+ for (const auto &aSubshape : aSubshapes) {
// vertex should have 2 adjacent edges
- if (anIt->second.size() != 2)
+ if (aSubshape.second.size() != 2)
continue;
// skip vertices, which adjacent edges are not on the same plane
ListOfShape anEdges;
- anEdges.insert(anEdges.end(), anIt->second.begin(), anIt->second.end());
+ anEdges.insert(anEdges.end(), aSubshape.second.begin(),
+ aSubshape.second.end());
GeomPlanePtr aPlane = GeomAlgoAPI_ShapeTools::findPlane(anEdges);
if (!aPlane)
continue;
// skip vertices, which smoothly connect adjacent edges
GeomEdgePtr anEdge1(new GeomAPI_Edge(anEdges.front()));
GeomEdgePtr anEdge2(new GeomAPI_Edge(anEdges.back()));
- GeomVertexPtr aSharedVertex(new GeomAPI_Vertex(anIt->first));
+ GeomVertexPtr aSharedVertex(new GeomAPI_Vertex(aSubshape.first));
if (GeomAlgoAPI_ShapeTools::isTangent(anEdge1, anEdge2, aSharedVertex))
continue;
- aFilletVertices.insert(anIt->first);
+ aFilletVertices.insert(aSubshape.first);
}
if (aFilletVertices.empty()) {
THE_PREFIX);
setResult(aResult, theResultIndex);
// store new edges generated from vertices
- for (ListOfShape::const_iterator anIt = theVertices.begin();
- anIt != theVertices.end(); ++anIt)
- aResult->loadGeneratedShapes(aFilletBuilder, *anIt, GeomAPI_Shape::VERTEX,
- THE_PREFIX, true);
+ for (const auto &theVertice : theVertices)
+ aResult->loadGeneratedShapes(aFilletBuilder, theVertice,
+ GeomAPI_Shape::VERTEX, THE_PREFIX, true);
return isOk;
}
/// \ingroup Plugins
/// \brief Feature for appling fillet on vertices of 3D wire.
class FeaturesPlugin_Fillet1D : public ModelAPI_Feature {
- typedef std::map<GeomShapePtr, ListOfShape, GeomAPI_Shape::Comparator>
- MapShapeSubs;
+ using MapShapeSubs =
+ std::map<GeomShapePtr, ListOfShape, GeomAPI_Shape::Comparator>;
public:
/// Feature kind.
}
/// \return the kind of a feature.
- FEATURESPLUGIN_EXPORT virtual const std::string &getKind() {
+ FEATURESPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = FeaturesPlugin_Fillet1D::ID();
return MY_KIND;
}
/// Request for initialization of data model of the feature: adding all
/// attributes.
- FEATURESPLUGIN_EXPORT virtual void initAttributes();
+ FEATURESPLUGIN_EXPORT void initAttributes() override;
/// Called on change of any argument-attribute of this object
/// \param theID identifier of changed attribute
- FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID);
+ FEATURESPLUGIN_EXPORT void
+ attributeChanged(const std::string &theID) override;
/// Performs the fillet algorithm and stores it in the data structure.
- FEATURESPLUGIN_EXPORT virtual void execute();
+ FEATURESPLUGIN_EXPORT void execute() override;
/// Use plugin manager for features creation.
FeaturesPlugin_Fillet1D();
#include <GeomAlgoAPI_UnifySameDomain.h>
//==================================================================================================
-FeaturesPlugin_FusionFaces::FeaturesPlugin_FusionFaces() {}
+FeaturesPlugin_FusionFaces::FeaturesPlugin_FusionFaces() = default;
//==================================================================================================
void FeaturesPlugin_FusionFaces::initAttributes() {
}
/// \return the kind of a feature.
- FEATURESPLUGIN_EXPORT virtual const std::string &getKind() {
+ FEATURESPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = FeaturesPlugin_FusionFaces::ID();
return MY_KIND;
}
/// Request for initialization of data model of the feature: adding all
/// attributes.
- FEATURESPLUGIN_EXPORT virtual void initAttributes();
+ FEATURESPLUGIN_EXPORT void initAttributes() override;
/// Executes the faces fusion and stores the modififed shape.
- FEATURESPLUGIN_EXPORT virtual void execute();
+ FEATURESPLUGIN_EXPORT void execute() override;
};
#endif
#include <sstream>
//=================================================================================================
-FeaturesPlugin_GeometryCalculation::FeaturesPlugin_GeometryCalculation() {}
+FeaturesPlugin_GeometryCalculation::FeaturesPlugin_GeometryCalculation() =
+ default;
//=================================================================================================
void FeaturesPlugin_GeometryCalculation::initAttributes() {
}
/// \return the kind of a feature.
- virtual const std::string &getKind() { return ID(); }
+ const std::string &getKind() override { return ID(); }
/// Attribute name for object selected.
inline static const std::string &OBJECT_SELECTED_ID() {
}
/// Performs the algorithm and stores results it in the data structure.
- FEATURESPLUGIN_EXPORT virtual void execute();
+ FEATURESPLUGIN_EXPORT void execute() override;
/// Request for initialization of data model of the feature: adding all
/// attributes
- FEATURESPLUGIN_EXPORT virtual void initAttributes();
+ FEATURESPLUGIN_EXPORT void initAttributes() override;
/// Called on change of any argument-attribute of this object
/// \param theID identifier of changed attribute
- FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID);
+ FEATURESPLUGIN_EXPORT void
+ attributeChanged(const std::string &theID) override;
/// Reimplemented from ModelAPI_Feature::isMacro(). Returns true.
- FEATURESPLUGIN_EXPORT virtual bool isMacro() const { return true; }
+ FEATURESPLUGIN_EXPORT bool isMacro() const override { return true; }
/// Use plugin manager for features creation
FeaturesPlugin_GeometryCalculation();
#include <sstream>
//==================================================================================================
-FeaturesPlugin_GlueFaces::FeaturesPlugin_GlueFaces() {}
+FeaturesPlugin_GlueFaces::FeaturesPlugin_GlueFaces() = default;
//==================================================================================================
void FeaturesPlugin_GlueFaces::initAttributes() {
// Consider the list of input shapes the same as the result, if
// * the total number of faces did NOT change.
int nbInputFaces = 0, nbInputEdges = 0;
- for (ListOfShape::const_iterator anIt = theInputs.cbegin();
- anIt != theInputs.cend(); ++anIt) {
- GeomShapePtr aShape = *anIt;
+ for (auto aShape : theInputs) {
if (aShape.get()) {
nbInputFaces += aShape->subShapes(GeomAPI_Shape::FACE, true).size();
nbInputEdges += aShape->subShapes(GeomAPI_Shape::EDGE, true).size();
}
/// \return the kind of a feature.
- FEATURESPLUGIN_EXPORT virtual const std::string &getKind() {
+ FEATURESPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = FeaturesPlugin_GlueFaces::ID();
return MY_KIND;
}
/// Request for initialization of data model of the feature: adding all
/// attributes.
- FEATURESPLUGIN_EXPORT virtual void initAttributes();
+ FEATURESPLUGIN_EXPORT void initAttributes() override;
/// Executes the faces fusion and stores the modififed shape.
- FEATURESPLUGIN_EXPORT virtual void execute();
+ FEATURESPLUGIN_EXPORT void execute() override;
private:
/// Retrieve all shapes from the selection list
// std::list<ObjectPtr> anGroupList = aRefListOfGroups->list();
// std::list<ObjectPtr>::iterator anGroupIt = anGroupList.begin();
const std::list<ObjectPtr> &anGroupList = aRefListOfGroups->list();
- std::list<ObjectPtr>::const_iterator anGroupIt = anGroupList.begin();
+ auto anGroupIt = anGroupList.begin();
for (; anGroupIt != anGroupList.end(); ++anGroupIt) {
std::shared_ptr<ModelAPI_Feature> aFeature =
ModelAPI_Feature::feature(*anGroupIt);
}
}
- std::list<ResultPtr>::iterator aResIter = aResults.begin();
+ auto aResIter = aResults.begin();
for (; aResIter != aResults.end(); aResIter++) {
GeomShapePtr aShape = (*aResIter)->shape();
if (!aShape.get() || aShape->isNull())
std::list<DocumentPtr> aDocuments; /// documents of Parts
aDocuments.push_back((*aResIter)->document());
- std::list<DocumentPtr>::iterator aDoc = aDocuments.begin();
+ auto aDoc = aDocuments.begin();
for (; aDoc != aDocuments.end(); aDoc++) {
// groups
int aGroupCount = (*aDoc)->size(ModelAPI_ResultGroup::group());
// Check: may be this group already exists in the list
bool anIsFound = false;
- std::list<ResultGroupPtr>::iterator anIter = aGroups.begin();
+ auto anIter = aGroups.begin();
for (; anIter != aGroups.end(); anIter++) {
if (*anIter == aResultGroup) {
anIsFound = true;
}
}
- std::list<ResultGroupPtr>::iterator anIter = aGroups.begin();
+ auto anIter = aGroups.begin();
for (; anIter != aGroups.end(); anIter++) {
DocumentPtr aDoc = (*anIter)->document();
GeomAPI_ShapeExplorer anExplo(aLocalShape, aTypeOfShape);
for (; anExplo.more(); anExplo.next()) {
GeomShapePtr anExploredShape = anExplo.current();
- std::set<ResultPtr>::iterator aResultIter =
- aGlobalResultsCashed.begin();
+ auto aResultIter = aGlobalResultsCashed.begin();
for (; aResultIter != aGlobalResultsCashed.end(); aResultIter++) {
GeomShapePtr aCashedShape = (*aResultIter)->shape();
if (aCashedShape->isSubShape(anExploredShape))
}
/// \return the kind of a feature.
- FEATURESPLUGIN_EXPORT virtual const std::string &getKind() {
+ FEATURESPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = FeaturesPlugin_ImportResult::ID();
return MY_KIND;
}
}
/// Performs the algorithm and stores results it in the data structure.
- FEATURESPLUGIN_EXPORT virtual void execute();
+ FEATURESPLUGIN_EXPORT void execute() override;
/// Request for initialization of data model of the feature: adding all
/// attributes.
- FEATURESPLUGIN_EXPORT virtual void initAttributes();
+ FEATURESPLUGIN_EXPORT void initAttributes() override;
/// Appends a feature
- FEATURESPLUGIN_EXPORT virtual std::shared_ptr<ModelAPI_Feature>
- addFeature(std::string theID);
+ FEATURESPLUGIN_EXPORT std::shared_ptr<ModelAPI_Feature>
+ addFeature(std::string theID) override;
/// \return the number of sub-elements.
- FEATURESPLUGIN_EXPORT virtual int numberOfSubs(bool forTree = false) const;
+ FEATURESPLUGIN_EXPORT int numberOfSubs(bool forTree = false) const override;
/// \return the sub-feature by zero-base index.
- FEATURESPLUGIN_EXPORT virtual std::shared_ptr<ModelAPI_Feature>
- subFeature(const int theIndex, bool forTree = false);
+ FEATURESPLUGIN_EXPORT std::shared_ptr<ModelAPI_Feature>
+ subFeature(const int theIndex, bool forTree = false) override;
/// \return the sub-feature unique identifier in this composite feature by
/// zero-base index.
- FEATURESPLUGIN_EXPORT virtual int subFeatureId(const int theIndex) const;
+ FEATURESPLUGIN_EXPORT int subFeatureId(const int theIndex) const override;
/// \return true if feature or result belong to this composite feature as
/// subs.
- FEATURESPLUGIN_EXPORT virtual bool isSub(ObjectPtr theObject) const;
+ FEATURESPLUGIN_EXPORT bool isSub(ObjectPtr theObject) const override;
/// This method to inform that sub-feature is removed and must be removed from
/// the internal data structures of the owner (the remove from the document
/// will be done outside just after).
- FEATURESPLUGIN_EXPORT virtual void
- removeFeature(std::shared_ptr<ModelAPI_Feature> theFeature);
+ FEATURESPLUGIN_EXPORT void
+ removeFeature(std::shared_ptr<ModelAPI_Feature> theFeature) override;
/// Use plugin manager for features creation.
- FeaturesPlugin_ImportResult() {}
+ FeaturesPlugin_ImportResult() = default;
};
/// \class FeaturesPlugin_ValidatorImportResults
//! \param[in] theAttribute the checked attribute.
//! \param[in] theArguments arguments of the attribute.
//! \param[out] theError error message.
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
#endif
#include <sstream>
//=================================================================================================
-FeaturesPlugin_InspectBoundingBox::FeaturesPlugin_InspectBoundingBox() {}
+FeaturesPlugin_InspectBoundingBox::FeaturesPlugin_InspectBoundingBox() =
+ default;
//=================================================================================================
void FeaturesPlugin_InspectBoundingBox::initAttributes() {
}
/// \return the kind of a feature.
- virtual const std::string &getKind() { return ID(); }
+ const std::string &getKind() override { return ID(); }
/// Performs the algorithm and stores results it in the data structure.
- FEATURESPLUGIN_EXPORT virtual void execute();
+ FEATURESPLUGIN_EXPORT void execute() override;
/// Request for initialization of data model of the feature: adding all
/// attributes
- FEATURESPLUGIN_EXPORT virtual void initAttributes();
+ FEATURESPLUGIN_EXPORT void initAttributes() override;
/// Called on change of any argument-attribute of this object
/// \param theID identifier of changed attribute
- FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID);
+ FEATURESPLUGIN_EXPORT void
+ attributeChanged(const std::string &theID) override;
/// Reimplemented from ModelAPI_Feature::isMacro(). Returns true.
- FEATURESPLUGIN_EXPORT virtual bool isMacro() const { return true; }
+ FEATURESPLUGIN_EXPORT bool isMacro() const override { return true; }
/// Use plugin manager for features creation
FeaturesPlugin_InspectBoundingBox();
private:
/// Return Attribut values of result.
- virtual AttributePtr attributResultValues();
+ AttributePtr attributResultValues() override;
/// Update values displayed.
bool updateValues();
#include <sstream>
//=================================================================================================
-FeaturesPlugin_InspectNormalToFace::FeaturesPlugin_InspectNormalToFace() {}
+FeaturesPlugin_InspectNormalToFace::FeaturesPlugin_InspectNormalToFace() =
+ default;
//=================================================================================================
void FeaturesPlugin_InspectNormalToFace::initAttributes() {
}
/// \return the kind of a feature.
- virtual const std::string &getKind() { return ID(); }
+ const std::string &getKind() override { return ID(); }
/// Performs the algorithm and stores results it in the data structure.
- FEATURESPLUGIN_EXPORT virtual void execute();
+ FEATURESPLUGIN_EXPORT void execute() override;
/// Request for initialization of data model of the feature: adding all
/// attributes
- FEATURESPLUGIN_EXPORT virtual void initAttributes();
+ FEATURESPLUGIN_EXPORT void initAttributes() override;
/// Called on change of any argument-attribute of this object
/// \param theID identifier of changed attribute
- FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID);
+ FEATURESPLUGIN_EXPORT void
+ attributeChanged(const std::string &theID) override;
/// Reimplemented from ModelAPI_Feature::isMacro(). Returns true.
- FEATURESPLUGIN_EXPORT virtual bool isMacro() const { return true; }
+ FEATURESPLUGIN_EXPORT bool isMacro() const override { return true; }
/// Use plugin manager for features creation
FeaturesPlugin_InspectNormalToFace();
static const double DEFAULT_FUZZY = 1.e-5;
//=================================================================================================
-FeaturesPlugin_Intersection::FeaturesPlugin_Intersection() {}
+FeaturesPlugin_Intersection::FeaturesPlugin_Intersection() = default;
//=================================================================================================
void FeaturesPlugin_Intersection::initAttributes() {
}
/// Returns the kind of a feature.
- FEATURESPLUGIN_EXPORT virtual const std::string &getKind() {
+ FEATURESPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = FeaturesPlugin_Intersection::ID();
return MY_KIND;
}
/// Executes feature.
- FEATURESPLUGIN_EXPORT virtual void execute();
+ FEATURESPLUGIN_EXPORT void execute() override;
/// Request for initialization of data model of the feature: adding all
/// attributes.
- FEATURESPLUGIN_EXPORT virtual void initAttributes();
+ FEATURESPLUGIN_EXPORT void initAttributes() override;
/// Use plugin manager for features creation.
FeaturesPlugin_Intersection();
#include <ModelAPI_ResultBody.h>
//=================================================================================================
-FeaturesPlugin_LimitTolerance::FeaturesPlugin_LimitTolerance() {}
+FeaturesPlugin_LimitTolerance::FeaturesPlugin_LimitTolerance() = default;
//=================================================================================================
void FeaturesPlugin_LimitTolerance::initAttributes() {
}
/// \return the kind of a feature.
- FEATURESPLUGIN_EXPORT virtual const std::string &getKind() {
+ FEATURESPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = FeaturesPlugin_LimitTolerance::ID();
return MY_KIND;
}
/// Request for initialization of data model of the feature: adding all
/// attributes.
- FEATURESPLUGIN_EXPORT virtual void initAttributes();
+ FEATURESPLUGIN_EXPORT void initAttributes() override;
/// Performs the algorithm and stores results in the data structure.
- FEATURESPLUGIN_EXPORT virtual void execute();
+ FEATURESPLUGIN_EXPORT void execute() override;
public:
/// Use plugin manager for features creation.
#include <cmath>
//==================================================================================================
-FeaturesPlugin_Loft::FeaturesPlugin_Loft() {}
+FeaturesPlugin_Loft::FeaturesPlugin_Loft() = default;
//==================================================================================================
void FeaturesPlugin_Loft::initAttributes() {
}
/// \return the kind of a feature.
- FEATURESPLUGIN_EXPORT virtual const std::string &getKind() {
+ FEATURESPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = FeaturesPlugin_Loft::ID();
return MY_KIND;
}
/// Performs the algorithm and stores results it in the data structure.
- FEATURESPLUGIN_EXPORT virtual void execute();
+ FEATURESPLUGIN_EXPORT void execute() override;
/// Request for initialization of data model of the feature: adding all
/// attributes
- FEATURESPLUGIN_EXPORT virtual void initAttributes();
+ FEATURESPLUGIN_EXPORT void initAttributes() override;
/// Use plugin manager for features creation
FeaturesPlugin_Loft();
#include <iomanip>
#include <sstream>
-FeaturesPlugin_Measurement::FeaturesPlugin_Measurement() : mySceenScale(1) {}
+FeaturesPlugin_Measurement::FeaturesPlugin_Measurement() {}
void FeaturesPlugin_Measurement::initAttributes() {
data()->addAttribute(FeaturesPlugin_Measurement::MEASURE_KIND(),
attribute(RESULT_VALUES_ID()));
aValues->setSize((int)aValuesList.size());
int anIndex = 0;
- for (std::list<double>::iterator anIt = aValuesList.begin();
- anIt != aValuesList.end(); ++anIt)
- aValues->setValue(anIndex++, *anIt);
+ for (double &anIt : aValuesList)
+ aValues->setValue(anIndex++, anIt);
}
static GeomVertexPtr
}
if (aShape1 && aShape2) {
- const TopoDS_Shape &aShp1 = aShape1->impl<TopoDS_Shape>();
- const TopoDS_Shape &aShp2 = aShape2->impl<TopoDS_Shape>();
+ const auto &aShp1 = aShape1->impl<TopoDS_Shape>();
+ const auto &aShp2 = aShape2->impl<TopoDS_Shape>();
BRepExtrema_DistShapeShape aDist(aShp1, aShp2);
aDist.Perform();
if (aDist.IsDone()) {
}
/// \return the kind of a feature.
- virtual const std::string &getKind() { return ID(); }
+ const std::string &getKind() override { return ID(); }
/// Attribute name for measurement method.
inline static const std::string &MEASURE_KIND() {
}
/// Performs the algorithm and stores results it in the data structure.
- FEATURESPLUGIN_EXPORT virtual void execute();
+ FEATURESPLUGIN_EXPORT void execute() override;
/// Request for initialization of data model of the feature: adding all
/// attributes
- FEATURESPLUGIN_EXPORT virtual void initAttributes();
+ FEATURESPLUGIN_EXPORT void initAttributes() override;
/// Called on change of any argument-attribute of this object
/// \param theID identifier of changed attribute
- FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID);
+ FEATURESPLUGIN_EXPORT void
+ attributeChanged(const std::string &theID) override;
/// Reimplemented from ModelAPI_Feature::isMacro(). Returns true.
- virtual bool isMacro() const { return true; }
+ bool isMacro() const override { return true; }
/** Returns the AIS preview
* \param thePrevious - defines a presentation if it was created previously
*/
- FEATURESPLUGIN_EXPORT virtual AISObjectPtr
- getAISObject(AISObjectPtr thePrevious);
+ FEATURESPLUGIN_EXPORT AISObjectPtr
+ getAISObject(AISObjectPtr thePrevious) override;
/// Set current screen plane
/// \param theScreenPlane the screen plane
- virtual void setScreenPlane(GeomPlanePtr theScreenPlane) {
+ void setScreenPlane(GeomPlanePtr theScreenPlane) override {
myScreenPlane = theScreenPlane;
}
/// Set current view scale
/// \param theScale the view scale
- virtual void setViewScale(double theScale) { mySceenScale = theScale; }
+ void setViewScale(double theScale) override { mySceenScale = theScale; }
/// Use plugin manager for features creation
FeaturesPlugin_Measurement();
void setupDimension(AISObjectPtr theDim);
GeomPlanePtr myScreenPlane; //< a plane of current screen
- double mySceenScale; //< a scale of current view
+ double mySceenScale{1}; //< a scale of current view
};
#endif
static const std::string MULTIROTATION_VERSION_1("v9.5");
//=================================================================================================
-FeaturesPlugin_MultiRotation::FeaturesPlugin_MultiRotation() {}
+FeaturesPlugin_MultiRotation::FeaturesPlugin_MultiRotation() = default;
//=================================================================================================
void FeaturesPlugin_MultiRotation::initAttributes() {
std::string anError;
int aResultIndex = 0;
// Moving each part.
- for (std::list<ResultPtr>::iterator aPRes = aParts.begin();
- aPRes != aParts.end(); ++aPRes) {
+ for (auto &aPart : aParts) {
ResultPartPtr anOrigin =
- std::dynamic_pointer_cast<ModelAPI_ResultPart>(*aPRes);
+ std::dynamic_pointer_cast<ModelAPI_ResultPart>(aPart);
std::shared_ptr<GeomAPI_Trsf> aTrsf(new GeomAPI_Trsf());
for (int i = 0; i < nbCopies; ++i) {
aTrsf->setRotation(anAxis, i * anAngle);
const ListOfShape &anOriginalShapes = anObjects.objects();
ListOfShape aTopLevel;
anObjects.topLevelObjects(aTopLevel);
- for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end();
- ++anIt) {
+ for (auto &anIt : aTopLevel) {
ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalShapes,
- ListOfShape(), aMakeShapeList, *anIt,
+ ListOfShape(), aMakeShapeList, anIt,
"Rotated");
// Copy image data, if any
ModelAPI_Tools::copyImageAttribute(aTextureSource, aResultBody);
}
/// \return the kind of a feature.
- FEATURESPLUGIN_EXPORT virtual const std::string &getKind() {
+ FEATURESPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = FeaturesPlugin_MultiRotation::ID();
return MY_KIND;
}
/// Performs the algorithm and stores results it in the data structure.
- FEATURESPLUGIN_EXPORT virtual void execute();
+ FEATURESPLUGIN_EXPORT void execute() override;
/// Request for initialization of data model of the feature: adding all
/// attributes.
- FEATURESPLUGIN_EXPORT virtual void initAttributes();
+ FEATURESPLUGIN_EXPORT void initAttributes() override;
/// Use plugin manager for features creation.
FeaturesPlugin_MultiRotation();
static const std::string MULTITRANSLATION_VERSION_1("v9.5");
//=================================================================================================
-FeaturesPlugin_MultiTranslation::FeaturesPlugin_MultiTranslation() {}
+FeaturesPlugin_MultiTranslation::FeaturesPlugin_MultiTranslation() = default;
//=================================================================================================
void FeaturesPlugin_MultiTranslation::initAttributes() {
std::string anError;
int aResultIndex = 0;
// Moving each part.
- for (std::list<ResultPtr>::iterator aPRes = aParts.begin();
- aPRes != aParts.end(); ++aPRes) {
+ for (auto &aPart : aParts) {
ResultPartPtr anOrigin =
- std::dynamic_pointer_cast<ModelAPI_ResultPart>(*aPRes);
+ std::dynamic_pointer_cast<ModelAPI_ResultPart>(aPart);
std::shared_ptr<GeomAPI_Trsf> aTrsf(new GeomAPI_Trsf());
for (int j = 0; j < aSecondNbCopies; j++) {
for (int i = 0; i < aFirstNbCopies; i++) {
const ListOfShape &anOriginalShapes = anObjects.objects();
ListOfShape aTopLevel;
anObjects.topLevelObjects(aTopLevel);
- for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end();
- ++anIt) {
+ for (auto &anIt : aTopLevel) {
ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalShapes,
- ListOfShape(), aMakeShapeList, *anIt,
+ ListOfShape(), aMakeShapeList, anIt,
"Translated");
// Copy image data, if any
ModelAPI_Tools::copyImageAttribute(aTextureSource, aResultBody);
}
/// \return the kind of a feature.
- FEATURESPLUGIN_EXPORT virtual const std::string &getKind() {
+ FEATURESPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = FeaturesPlugin_MultiTranslation::ID();
return MY_KIND;
}
/// Performs the algorithm and stores results it in the data structure.
- FEATURESPLUGIN_EXPORT virtual void execute();
+ FEATURESPLUGIN_EXPORT void execute() override;
/// Request for initialization of data model of the feature: adding all
/// attributes.
- FEATURESPLUGIN_EXPORT virtual void initAttributes();
+ FEATURESPLUGIN_EXPORT void initAttributes() override;
/// Use plugin manager for features creation.
FeaturesPlugin_MultiTranslation();
#include <sstream>
//=================================================================================================
-FeaturesPlugin_NormalToFace::FeaturesPlugin_NormalToFace() {}
+FeaturesPlugin_NormalToFace::FeaturesPlugin_NormalToFace() = default;
//=================================================================================================
void FeaturesPlugin_NormalToFace::initAttributes() {
}
/// \return the kind of a feature.
- virtual const std::string &getKind() { return ID(); }
+ const std::string &getKind() override { return ID(); }
/// Performs the algorithm and stores results it in the data structure.
- FEATURESPLUGIN_EXPORT virtual void execute();
+ FEATURESPLUGIN_EXPORT void execute() override;
/// Request for initialization of data model of the feature: adding all
/// attributes
- FEATURESPLUGIN_EXPORT virtual void initAttributes();
+ FEATURESPLUGIN_EXPORT void initAttributes() override;
/// Called on change of any argument-attribute of this object
/// \param theID identifier of changed attribute
- FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID);
+ FEATURESPLUGIN_EXPORT void
+ attributeChanged(const std::string &theID) override;
/// Use plugin manager for features creation
FeaturesPlugin_NormalToFace();
static const double DEFAULT_FUZZY = 1.e-5;
//=================================================================================================
-FeaturesPlugin_Partition::FeaturesPlugin_Partition() {}
+FeaturesPlugin_Partition::FeaturesPlugin_Partition() = default;
//=================================================================================================
void FeaturesPlugin_Partition::initAttributes() {
ResultBodyPtr aResultBody = document()->createBody(data(), theIndex);
// if result is same as one of the base object, no modification was performed
- for (ListOfShape::const_iterator anObj = theObjects.cbegin();
- anObj != theObjects.cend(); ++anObj) {
- if (anObj->get() && (*anObj)->isSame(theResultShape)) {
+ for (const auto &theObject : theObjects) {
+ if (theObject.get() && theObject->isSame(theResultShape)) {
aResultBody->store(theResultShape, false);
setResult(aResultBody, theIndex);
return;
std::shared_ptr<GeomAPI_DataMapOfShapeShape> aMapOfSubShapes =
theMakeShape->mapOfSubShapes();
theObjects.insert(theObjects.end(), thePlanes.begin(), thePlanes.end());
- for (ListOfShape::const_iterator anIt = theObjects.cbegin();
- anIt != theObjects.cend(); ++anIt) {
- GeomShapePtr aShape = *anIt;
+ for (auto aShape : theObjects) {
aResultBody->loadModifiedShapes(theMakeShape, aShape, GeomAPI_Shape::EDGE);
aResultBody->loadModifiedShapes(theMakeShape, aShape, GeomAPI_Shape::FACE);
aResultBody->loadDeletedShapes(theMakeShape, aShape, GeomAPI_Shape::FACE);
}
/// \return the kind of a feature.
- FEATURESPLUGIN_EXPORT virtual const std::string &getKind() {
+ FEATURESPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = FeaturesPlugin_Partition::ID();
return MY_KIND;
}
/// Performs the algorithm and stores results it in the data structure.
- FEATURESPLUGIN_EXPORT virtual void execute();
+ FEATURESPLUGIN_EXPORT void execute() override;
/// Request for initialization of data model of the feature: adding all
/// attributes
- FEATURESPLUGIN_EXPORT virtual void initAttributes();
+ FEATURESPLUGIN_EXPORT void initAttributes() override;
/// Use plugin manager for features creation
FeaturesPlugin_Partition();
const std::string theName, int &theShapeIndex);
//==================================================================================================
-FeaturesPlugin_Pipe::FeaturesPlugin_Pipe() {}
+FeaturesPlugin_Pipe::FeaturesPlugin_Pipe() = default;
//==================================================================================================
void FeaturesPlugin_Pipe::initAttributes() {
}
// Make faces from sketch wires.
- for (std::map<ResultConstructionPtr, ListOfShape>::const_iterator anIt =
- aSketchWiresMap.cbegin();
- anIt != aSketchWiresMap.cend(); ++anIt) {
+ for (const auto &anIt : aSketchWiresMap) {
const std::shared_ptr<GeomAPI_PlanarEdges> aSketchPlanarEdges =
- std::dynamic_pointer_cast<GeomAPI_PlanarEdges>((*anIt).first->shape());
- const ListOfShape &aWiresList = (*anIt).second;
+ std::dynamic_pointer_cast<GeomAPI_PlanarEdges>(anIt.first->shape());
+ const ListOfShape &aWiresList = anIt.second;
ListOfShape aFaces;
GeomAlgoAPI_ShapeTools::makeFacesWithHoles(aSketchPlanarEdges->origin(),
aSketchPlanarEdges->norm(),
std::string anError;
if (aCreationMethod == CREATION_METHOD_SIMPLE() ||
aCreationMethod == CREATION_METHOD_BINORMAL()) {
- for (ListOfShape::const_iterator anIter = aBaseShapesList.cbegin();
- anIter != aBaseShapesList.cend(); anIter++) {
- std::shared_ptr<GeomAPI_Shape> aBaseShape = *anIter;
-
+ for (auto aBaseShape : aBaseShapesList) {
std::shared_ptr<GeomAlgoAPI_Pipe> aPipeAlgo(
aCreationMethod == CREATION_METHOD_SIMPLE()
? new GeomAlgoAPI_Pipe(aBaseShape, aPathShape)
aResultBody->storeGenerated(theBaseShapes.front(), thePipeAlgo->shape());
// Store generated edges/faces.
- for (ListOfShape::const_iterator anIter = theBaseShapes.cbegin();
- anIter != theBaseShapes.cend(); ++anIter) {
- GeomShapePtr aBaseShape = *anIter;
+ for (auto aBaseShape : theBaseShapes) {
GeomAPI_Shape::ShapeType aBaseShapeType = aBaseShape->shapeType();
GeomAPI_Shape::ShapeType aShapeTypeToExplode = GeomAPI_Shape::SHAPE;
switch (aBaseShapeType) {
// Store shapes.
int aShapeIndex = 1;
int aFaceIndex = 1;
- for (ListOfShape::const_iterator anIt = theShapes.cbegin();
- anIt != theShapes.cend(); ++anIt) {
- GeomShapePtr aShape = *anIt;
-
+ for (auto aShape : theShapes) {
if (aShapeTypeToExplore == GeomAPI_Shape::COMPOUND) {
std::string aName =
theName +
static const std::string PLACEMENT_VERSION_1("v9.5");
-FeaturesPlugin_Placement::FeaturesPlugin_Placement() {}
+FeaturesPlugin_Placement::FeaturesPlugin_Placement() = default;
void FeaturesPlugin_Placement::initAttributes() {
AttributeSelectionListPtr aSelection =
// Verify planarity of faces and linearity of edges
std::shared_ptr<GeomAPI_Shape> aShapes[2] = {aStartShape, anEndShape};
- for (int i = 0; i < 2; i++) {
- if (!isShapeValid(aShapes[i])) {
+ for (auto &aShape : aShapes) {
+ if (!isShapeValid(aShape)) {
return;
}
}
int aResultIndex = 0;
std::string anError;
- for (std::list<ResultPtr>::iterator aPRes = aParts.begin();
- aPRes != aParts.end(); ++aPRes) {
+ for (auto &aPart : aParts) {
// Applying transformation to each part.
ResultPartPtr anOrigin =
- std::dynamic_pointer_cast<ModelAPI_ResultPart>(*aPRes);
+ std::dynamic_pointer_cast<ModelAPI_ResultPart>(aPart);
ResultPartPtr aResultPart =
document()->copyPart(anOrigin, data(), aResultIndex);
aResultPart->setTrsf(aContextRes, aTrsf);
const ListOfShape &anOriginalShapes = anObjects.objects();
ListOfShape aTopLevel;
anObjects.topLevelObjects(aTopLevel);
- for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end();
- ++anIt) {
+ for (auto &anIt : aTopLevel) {
// LoadNamingDS
ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalShapes,
- ListOfShape(), aMakeShapeList, *anIt,
+ ListOfShape(), aMakeShapeList, anIt,
"Placed");
// Copy image data, if any
ModelAPI_Tools::copyImageAttribute(aTextureSource, aResultBody);
}
/// Returns the kind of a feature
- FEATURESPLUGIN_EXPORT virtual const std::string &getKind() {
+ FEATURESPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = FeaturesPlugin_Placement::ID();
return MY_KIND;
}
/// Performs the algorithm and stores results it in the data structure.
- FEATURESPLUGIN_EXPORT virtual void execute();
+ FEATURESPLUGIN_EXPORT void execute() override;
/// Request for initialization of data model of the feature: adding all
/// attributes
- FEATURESPLUGIN_EXPORT virtual void initAttributes();
+ FEATURESPLUGIN_EXPORT void initAttributes() override;
/// Use plugin manager for features creation
FeaturesPlugin_Placement();
class FEATURESPLUGIN_EXPORT FeaturesPlugin_Plugin : public ModelAPI_Plugin {
public:
/// Creates the feature object of this plugin by the feature string ID
- virtual FeaturePtr createFeature(std::string theFeatureID);
+ FeaturePtr createFeature(std::string theFeatureID) override;
public:
/// Default constructor
#include <sstream>
//=================================================================================================
-FeaturesPlugin_PointCloudOnFace::FeaturesPlugin_PointCloudOnFace() {}
+FeaturesPlugin_PointCloudOnFace::FeaturesPlugin_PointCloudOnFace() = default;
//=================================================================================================
void FeaturesPlugin_PointCloudOnFace::initAttributes() {
}
/// \return the kind of a feature.
- virtual const std::string &getKind() { return ID(); }
+ const std::string &getKind() override { return ID(); }
/// Attribute name of number of points in the point cloud.
inline static const std::string &NUMBER_ID() {
}
/// Performs the algorithm and stores results it in the data structure.
- FEATURESPLUGIN_EXPORT virtual void execute();
+ FEATURESPLUGIN_EXPORT void execute() override;
/// Request for initialization of data model of the feature: adding all
/// attributes
- FEATURESPLUGIN_EXPORT virtual void initAttributes();
+ FEATURESPLUGIN_EXPORT void initAttributes() override;
/// Called on change of any argument-attribute of this object
/// \param theID identifier of changed attribute
- FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID);
+ FEATURESPLUGIN_EXPORT void
+ attributeChanged(const std::string &theID) override;
/// Use plugin manager for features creation
FeaturesPlugin_PointCloudOnFace();
#include <iomanip>
#include <sstream>
-FeaturesPlugin_PointCoordinates::FeaturesPlugin_PointCoordinates() {}
+FeaturesPlugin_PointCoordinates::FeaturesPlugin_PointCoordinates() = default;
void FeaturesPlugin_PointCoordinates::initAttributes() {
// attribute for point selected
}
/// \return the kind of a feature.
- virtual const std::string &getKind() { return ID(); }
+ const std::string &getKind() override { return ID(); }
/// Performs the algorithm and stores results it in the data structure.
- FEATURESPLUGIN_EXPORT virtual void execute();
+ FEATURESPLUGIN_EXPORT void execute() override;
/// Request for initialization of data model of the feature: adding all
/// attributes
- FEATURESPLUGIN_EXPORT virtual void initAttributes();
+ FEATURESPLUGIN_EXPORT void initAttributes() override;
/// Called on change of any argument-attribute of this object
/// \param theID identifier of changed attribute
- FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID);
+ FEATURESPLUGIN_EXPORT void
+ attributeChanged(const std::string &theID) override;
/// Reimplemented from ModelAPI_Feature::isMacro(). Returns true.
- FEATURESPLUGIN_EXPORT virtual bool isMacro() const { return true; }
+ FEATURESPLUGIN_EXPORT bool isMacro() const override { return true; }
/// Use plugin manager for features creation
FeaturesPlugin_PointCoordinates();
#include <ModelAPI_Tools.h>
#include <ModelAPI_Validator.h>
-FeaturesPlugin_Recover::FeaturesPlugin_Recover()
- : myClearListOnTypeChange(true) {}
+FeaturesPlugin_Recover::FeaturesPlugin_Recover() {}
void FeaturesPlugin_Recover::initAttributes() {
data()->addAttribute(BASE_FEATURE(), ModelAPI_AttributeReference::typeId());
/// previous state of persistent flag
bool myPersistent;
/// necessity to clean recovered list while changing the type of recover
- bool myClearListOnTypeChange;
+ bool myClearListOnTypeChange{true};
public:
/// Extrusion kind
#include <GeomAlgoAPI_ShapeTools.h>
//==================================================================================================
-FeaturesPlugin_RemoveSubShapes::FeaturesPlugin_RemoveSubShapes() {}
+FeaturesPlugin_RemoveSubShapes::FeaturesPlugin_RemoveSubShapes() = default;
//==================================================================================================
void FeaturesPlugin_RemoveSubShapes::initAttributes() {
#include <GeomAPI_ShapeIterator.h>
//=================================================================================================
-FeaturesPlugin_Revolution::FeaturesPlugin_Revolution() {}
+FeaturesPlugin_Revolution::FeaturesPlugin_Revolution() = default;
//=================================================================================================
void FeaturesPlugin_Revolution::initAttributes() {
// Store results.
int aResultIndex = 0;
- ListOfShape::const_iterator aBaseIt = aBaseShapesList.cbegin();
- ListOfMakeShape::const_iterator anAlgoIt = aMakeShapesList.cbegin();
+ auto aBaseIt = aBaseShapesList.cbegin();
+ auto anAlgoIt = aMakeShapesList.cbegin();
for (;
aBaseIt != aBaseShapesList.cend() && anAlgoIt != aMakeShapesList.cend();
++aBaseIt, ++anAlgoIt) {
// Generating result for each base shape.
std::string anError;
- for (ListOfShape::const_iterator anIter = theBaseShapes.cbegin();
- anIter != theBaseShapes.cend(); anIter++) {
- GeomShapePtr aBaseShape = *anIter;
-
+ for (auto aBaseShape : theBaseShapes) {
std::shared_ptr<GeomAlgoAPI_Revolution> aRevolAlgo(
new GeomAlgoAPI_Revolution(aBaseShape, anAxis, aToShape, aToAngle,
aFromShape, aFromAngle));
public:
/// Request for initialization of data model of the feature: adding all
/// attributes.
- FEATURESPLUGIN_EXPORT virtual void initAttributes();
+ FEATURESPLUGIN_EXPORT void initAttributes() override;
protected:
- FeaturesPlugin_RevolutionBoolean(){};
+ FeaturesPlugin_RevolutionBoolean() = default;
+ ;
// Creates revolutions.
bool makeGeneration(ListOfShape &theBaseShapes,
- ListOfMakeShape &theMakeShapes);
+ ListOfMakeShape &theMakeShapes) override;
/// Stores generation history.
void storeGenerationHistory(
ResultBodyPtr theResultBody, const GeomShapePtr theBaseShape,
- const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape);
+ const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape) override;
};
#endif
}
/// \return the kind of a feature
- FEATURESPLUGIN_EXPORT virtual const std::string &getKind() {
+ FEATURESPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = FeaturesPlugin_RevolutionCut::ID();
return MY_KIND;
}
/// Performs the algorithm and stores results it in the data structure.
- FEATURESPLUGIN_EXPORT virtual void execute();
+ FEATURESPLUGIN_EXPORT void execute() override;
};
#endif
}
/// \return the kind of a feature
- FEATURESPLUGIN_EXPORT virtual const std::string &getKind() {
+ FEATURESPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = FeaturesPlugin_RevolutionFuse::ID();
return MY_KIND;
}
/// Performs the algorithm and stores results it in the data structure.
- FEATURESPLUGIN_EXPORT virtual void execute();
+ FEATURESPLUGIN_EXPORT void execute() override;
};
#endif
static const std::string ROTATION_VERSION_1("v9.5");
//=================================================================================================
-FeaturesPlugin_Rotation::FeaturesPlugin_Rotation() {}
+FeaturesPlugin_Rotation::FeaturesPlugin_Rotation() = default;
//=================================================================================================
void FeaturesPlugin_Rotation::initAttributes() {
selection(FeaturesPlugin_Rotation::START_POINT_ID());
std::shared_ptr<ModelAPI_AttributeSelection> anEndPointRef =
selection(FeaturesPlugin_Rotation::END_POINT_ID());
- if ((aCenterRef.get() != NULL) && (aStartPointRef.get() != NULL) &&
- (anEndPointRef.get() != NULL)) {
+ if ((aCenterRef.get() != nullptr) && (aStartPointRef.get() != nullptr) &&
+ (anEndPointRef.get() != nullptr)) {
GeomShapePtr aCenterShape = aCenterRef->value();
if (!aCenterShape.get() && aCenterRef->context().get())
aCenterShape = aCenterRef->context()->shape();
std::string anError;
int aResultIndex = 0;
// Rotating each part.
- for (std::list<ResultPtr>::iterator aPRes = aParts.begin();
- aPRes != aParts.end(); ++aPRes) {
+ for (auto &aPart : aParts) {
ResultPartPtr anOriginal =
- std::dynamic_pointer_cast<ModelAPI_ResultPart>(*aPRes);
+ std::dynamic_pointer_cast<ModelAPI_ResultPart>(aPart);
ResultPartPtr aResultPart =
document()->copyPart(anOriginal, data(), aResultIndex);
aResultPart->setTrsf(anOriginal, theTrsf);
const ListOfShape &anOriginalShapes = anObjects.objects();
ListOfShape aTopLevel;
anObjects.topLevelObjects(aTopLevel);
- for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end();
- ++anIt) {
+ for (auto &anIt : aTopLevel) {
ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalShapes,
- ListOfShape(), aMakeShapeList, *anIt,
+ ListOfShape(), aMakeShapeList, anIt,
"Rotated");
// Copy image data, if any
ModelAPI_Tools::copyImageAttribute(aTextureSource, aResultBody);
}
/// \return the kind of a feature.
- FEATURESPLUGIN_EXPORT virtual const std::string &getKind() {
+ FEATURESPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = FeaturesPlugin_Rotation::ID();
return MY_KIND;
}
/// Performs the algorithm and stores results it in the data structure.
- FEATURESPLUGIN_EXPORT virtual void execute();
+ FEATURESPLUGIN_EXPORT void execute() override;
/// Request for initialization of data model of the feature: adding all
/// attributes.
- FEATURESPLUGIN_EXPORT virtual void initAttributes();
+ FEATURESPLUGIN_EXPORT void initAttributes() override;
/// Use plugin manager for features creation.
FeaturesPlugin_Rotation();
static const std::string SCALE_VERSION_1("v9.5");
//=================================================================================================
-FeaturesPlugin_Scale::FeaturesPlugin_Scale() {}
+FeaturesPlugin_Scale::FeaturesPlugin_Scale() = default;
//=================================================================================================
void FeaturesPlugin_Scale::initAttributes() {
std::shared_ptr<GeomAPI_Pnt> aCenterPoint;
std::shared_ptr<ModelAPI_AttributeSelection> anObjRef =
selection(FeaturesPlugin_Scale::CENTER_POINT_ID());
- if (anObjRef.get() != NULL) {
+ if (anObjRef.get() != nullptr) {
GeomShapePtr aShape = anObjRef->value();
if (!aShape.get()) {
aShape = anObjRef->context()->shape();
const ListOfShape &anOriginalShapes = anObjects.objects();
ListOfShape aTopLevel;
anObjects.topLevelObjects(aTopLevel);
- for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end();
- ++anIt) {
+ for (auto &anIt : aTopLevel) {
ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalShapes,
- ListOfShape(), aMakeShapeList, *anIt,
+ ListOfShape(), aMakeShapeList, anIt,
"Scaled");
// Copy image data, if any
ModelAPI_Tools::copyImageAttribute(aTextureSource, aResultBody);
std::shared_ptr<GeomAPI_Pnt> aCenterPoint;
std::shared_ptr<ModelAPI_AttributeSelection> anObjRef =
selection(FeaturesPlugin_Scale::CENTER_POINT_ID());
- if (anObjRef.get() != NULL) {
+ if (anObjRef.get() != nullptr) {
GeomShapePtr aShape = anObjRef->value();
if (!aShape.get()) {
aShape = anObjRef->context()->shape();
const ListOfShape &anOriginalShapes = anObjects.objects();
ListOfShape aTopLevel;
anObjects.topLevelObjects(aTopLevel);
- for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end();
- ++anIt) {
+ for (auto &anIt : aTopLevel) {
ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalShapes,
- ListOfShape(), aMakeShapeList, *anIt,
+ ListOfShape(), aMakeShapeList, anIt,
"Scaled");
// Copy image data, if any
ModelAPI_Tools::copyImageAttribute(aTextureSource, aResultBody);
}
/// \return the kind of a feature.
- FEATURESPLUGIN_EXPORT virtual const std::string &getKind() {
+ FEATURESPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = FeaturesPlugin_Scale::ID();
return MY_KIND;
}
/// Performs the algorithm and stores results it in the data structure.
- FEATURESPLUGIN_EXPORT virtual void execute();
+ FEATURESPLUGIN_EXPORT void execute() override;
/// Request for initialization of data model of the feature: adding all
/// attributes.
- FEATURESPLUGIN_EXPORT virtual void initAttributes();
+ FEATURESPLUGIN_EXPORT void initAttributes() override;
/// Use plugin manager for features creation.
FeaturesPlugin_Scale();
#include <ModelAPI_ResultBody.h>
//=================================================================================================
-FeaturesPlugin_Sewing::FeaturesPlugin_Sewing() {}
+FeaturesPlugin_Sewing::FeaturesPlugin_Sewing() = default;
//=================================================================================================
void FeaturesPlugin_Sewing::initAttributes() {
// * both arguments have the same number of shells
// * the total number of faces in these shells did NOT change.
int nbInputShells = 0, nbInputFaces = 0;
- for (ListOfShape::const_iterator anIt = theInputs.cbegin();
- anIt != theInputs.cend(); ++anIt) {
- GeomShapePtr aShape = *anIt;
+ for (auto aShape : theInputs) {
if (aShape.get()) {
if (aShape->isShell())
nbInputShells++;
if (theResult->isCompound()) {
ListOfShape shells = theResult->subShapes(GeomAPI_Shape::SHELL, true);
nbResultShells = shells.size();
- for (ListOfShape::const_iterator anIt = shells.cbegin();
- anIt != shells.cend(); ++anIt) {
- GeomShapePtr aShape = *anIt;
+ for (auto aShape : shells) {
if (aShape.get() && aShape->isShell()) {
nbInputFaces += aShape->subShapes(GeomAPI_Shape::FACE, true).size();
}
}
/// \return the kind of a feature.
- FEATURESPLUGIN_EXPORT virtual const std::string &getKind() {
+ FEATURESPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = FeaturesPlugin_Sewing::ID();
return MY_KIND;
}
/// Request for initialization of data model of the feature: adding all
/// attributes.
- FEATURESPLUGIN_EXPORT virtual void initAttributes();
+ FEATURESPLUGIN_EXPORT void initAttributes() override;
/// Performs the algorithm and stores results in the data structure.
- FEATURESPLUGIN_EXPORT virtual void execute();
+ FEATURESPLUGIN_EXPORT void execute() override;
public:
/// Use plugin manager for features creation.
#include <sstream>
//=================================================================================================
-FeaturesPlugin_SharedFaces::FeaturesPlugin_SharedFaces() {}
+FeaturesPlugin_SharedFaces::FeaturesPlugin_SharedFaces() = default;
//=================================================================================================
void FeaturesPlugin_SharedFaces::initAttributes() {
}
/// \return the kind of a feature.
- virtual const std::string &getKind() { return ID(); }
+ const std::string &getKind() override { return ID(); }
/// Performs the algorithm and stores results it in the data structure.
- FEATURESPLUGIN_EXPORT virtual void execute();
+ FEATURESPLUGIN_EXPORT void execute() override;
/// Request for initialization of data model of the feature: adding all
/// attributes
- FEATURESPLUGIN_EXPORT virtual void initAttributes();
+ FEATURESPLUGIN_EXPORT void initAttributes() override;
/// Called on change of any argument-attribute of this object
/// \param theID identifier of changed attribute
- FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID);
+ FEATURESPLUGIN_EXPORT void
+ attributeChanged(const std::string &theID) override;
/// Reimplemented from ModelAPI_Feature::isMacro(). Returns true.
- FEATURESPLUGIN_EXPORT virtual bool isMacro() const { return true; }
+ FEATURESPLUGIN_EXPORT bool isMacro() const override { return true; }
/// Use plugin manager for features creation
FeaturesPlugin_SharedFaces();
private:
/// Return attribut values of object.
- virtual AttributePtr attributObject();
+ AttributePtr attributObject() override;
/// Return attribut values of list of faces.
- virtual AttributePtr attributListFaces();
+ AttributePtr attributListFaces() override;
/// Return attribut values of number of faces.
- virtual AttributePtr attributNumberFaces();
+ AttributePtr attributNumberFaces() override;
/// Return attribut values of IsCompute.
- virtual AttributePtr attributIsCompute();
+ AttributePtr attributIsCompute() override;
/// Create group
void createGroup();
static const std::string SYMMETRY_VERSION_1("v9.5");
//=================================================================================================
-FeaturesPlugin_Symmetry::FeaturesPlugin_Symmetry() {}
+FeaturesPlugin_Symmetry::FeaturesPlugin_Symmetry() = default;
//=================================================================================================
void FeaturesPlugin_Symmetry::initAttributes() {
std::shared_ptr<GeomAPI_Pnt> aPoint;
AttributeSelectionPtr anObjRef =
selection(FeaturesPlugin_Symmetry::POINT_OBJECT_ID());
- if (anObjRef.get() != NULL) {
+ if (anObjRef.get() != nullptr) {
GeomShapePtr aShape1 = anObjRef->value();
if (!aShape1.get()) {
aShape1 = anObjRef->context()->shape();
std::string anError;
int aResultIndex = 0;
// Symmetrying parts.
- for (std::list<ResultPtr>::iterator aPRes = aParts.begin();
- aPRes != aParts.end(); ++aPRes) {
+ for (auto &aPart : aParts) {
ResultPartPtr anOriginal =
- std::dynamic_pointer_cast<ModelAPI_ResultPart>(*aPRes);
+ std::dynamic_pointer_cast<ModelAPI_ResultPart>(aPart);
buildResult(anOriginal, theTrsf, aResultIndex);
}
const ListOfShape &anOriginalShapes = anObjects.objects();
ListOfShape aTopLevel;
anObjects.topLevelObjects(aTopLevel);
- for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end();
- ++anIt)
- buildResult(aMakeShapeList, anOriginalShapes, *anIt, aResultIndex,
+ for (auto &anIt : aTopLevel)
+ buildResult(aMakeShapeList, anOriginalShapes, anIt, aResultIndex,
aTextureSource);
// Remove the rest results if there were produced in the previous pass.
}
/// \return the kind of a feature.
- FEATURESPLUGIN_EXPORT virtual const std::string &getKind() {
+ FEATURESPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = FeaturesPlugin_Symmetry::ID();
return MY_KIND;
}
/// Performs the algorithm and stores results it in the data structure.
- FEATURESPLUGIN_EXPORT virtual void execute();
+ FEATURESPLUGIN_EXPORT void execute() override;
/// Request for initialization of data model of the feature: adding all
/// attributes.
- FEATURESPLUGIN_EXPORT virtual void initAttributes();
+ FEATURESPLUGIN_EXPORT void initAttributes() override;
/// Use plugin manager for features creation.
FeaturesPlugin_Symmetry();
}
// Make faces from sketch wires.
- for (std::map<ResultConstructionPtr, ListOfShape>::const_iterator anIt =
- aSketchWiresMap.cbegin();
- anIt != aSketchWiresMap.cend(); ++anIt) {
+ for (const auto &anIt : aSketchWiresMap) {
const std::shared_ptr<GeomAPI_PlanarEdges> aSketchPlanarEdges =
- std::dynamic_pointer_cast<GeomAPI_PlanarEdges>((*anIt).first->shape());
- const ListOfShape &aWiresList = (*anIt).second;
+ std::dynamic_pointer_cast<GeomAPI_PlanarEdges>(anIt.first->shape());
+ const ListOfShape &aWiresList = anIt.second;
ListOfShape aFaces;
GeomAlgoAPI_ShapeTools::makeFacesWithHoles(aSketchPlanarEdges->origin(),
aSketchPlanarEdges->norm(),
static const std::string TRANSLATION_VERSION_1("v9.5");
//=================================================================================================
-FeaturesPlugin_Translation::FeaturesPlugin_Translation() {}
+FeaturesPlugin_Translation::FeaturesPlugin_Translation() = default;
//=================================================================================================
void FeaturesPlugin_Translation::initAttributes() {
data()->selection(FeaturesPlugin_Translation::END_POINT_ID());
std::shared_ptr<GeomAPI_Pnt> aFirstPoint;
std::shared_ptr<GeomAPI_Pnt> aSecondPoint;
- if ((aRef1.get() != NULL) && (aRef2.get() != NULL)) {
+ if ((aRef1.get() != nullptr) && (aRef2.get() != nullptr)) {
GeomShapePtr aShape1 = aRef1->value();
if (!aShape1.get()) // If we can't get the points directly, try getting them
// from the context
std::string anError;
int aResultIndex = 0;
// Moving each part.
- for (std::list<ResultPtr>::iterator aPRes = aParts.begin();
- aPRes != aParts.end(); ++aPRes) {
+ for (auto &aPart : aParts) {
ResultPartPtr anOrigin =
- std::dynamic_pointer_cast<ModelAPI_ResultPart>(*aPRes);
+ std::dynamic_pointer_cast<ModelAPI_ResultPart>(aPart);
ResultPartPtr aResultPart =
document()->copyPart(anOrigin, data(), aResultIndex);
aResultPart->setTrsf(anOrigin, theTrsf);
const ListOfShape &anOriginalShapes = anObjects.objects();
ListOfShape aTopLevel;
anObjects.topLevelObjects(aTopLevel);
- for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end();
- ++anIt) {
+ for (auto &anIt : aTopLevel) {
// LoadNamingDS
ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalShapes,
- ListOfShape(), aMakeShapeList, *anIt,
+ ListOfShape(), aMakeShapeList, anIt,
"Translated");
// Copy image data, if any
ModelAPI_Tools::copyImageAttribute(aTextureSource, aResultBody);
}
/// \return the kind of a feature.
- FEATURESPLUGIN_EXPORT virtual const std::string &getKind() {
+ FEATURESPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = FeaturesPlugin_Translation::ID();
return MY_KIND;
}
/// Performs the algorithm and stores results it in the data structure.
- FEATURESPLUGIN_EXPORT virtual void execute();
+ FEATURESPLUGIN_EXPORT void execute() override;
/// Request for initialization of data model of the feature: adding all
/// attributes.
- FEATURESPLUGIN_EXPORT virtual void initAttributes();
+ FEATURESPLUGIN_EXPORT void initAttributes() override;
/// Use plugin manager for features creation.
FeaturesPlugin_Translation();
#include <GeomAPI_ShapeExplorer.h>
#include <GeomAPI_ShapeIterator.h>
-#include <ModelAPI_AttributeBoolean.h>>
+#include <ModelAPI_AttributeBoolean.h> //>
#include <ModelAPI_AttributeDouble.h>
#include <ModelAPI_AttributeSelectionList.h>
#include <ModelAPI_ResultBody.h>
static const double DEFAULT_FUZZY = 1.e-5;
//=================================================================================================
-FeaturesPlugin_Union::FeaturesPlugin_Union() {}
+FeaturesPlugin_Union::FeaturesPlugin_Union() = default;
//=================================================================================================
void FeaturesPlugin_Union::initAttributes() {
std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMakeShapeList(
new GeomAlgoAPI_MakeShapeList());
- for (std::vector<ModelAPI_Tools::ResultBaseAlgo>::iterator aRBAIt =
- aResultBaseAlgoList.begin();
- aRBAIt != aResultBaseAlgoList.end(); ++aRBAIt) {
- aMakeShapeList->appendAlgo(aRBAIt->makeShape);
+ for (auto &aRBAIt : aResultBaseAlgoList) {
+ aMakeShapeList->appendAlgo(aRBAIt.makeShape);
}
GeomShapePtr aShape;
}
/// \return the kind of a feature.
- FEATURESPLUGIN_EXPORT virtual const std::string &getKind() {
+ FEATURESPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = FeaturesPlugin_Union::ID();
return MY_KIND;
}
/// Performs the algorithm and stores results it in the data structure.
- FEATURESPLUGIN_EXPORT virtual void execute();
+ FEATURESPLUGIN_EXPORT void execute() override;
/// Request for initialization of data model of the feature: adding all
/// attributes
- FEATURESPLUGIN_EXPORT virtual void initAttributes();
+ FEATURESPLUGIN_EXPORT void initAttributes() override;
/// Use plugin manager for features creation
FeaturesPlugin_Union();
* \param theArguments arguments of the attribute
* \param theError error message
*/
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
#endif
//==================================================================================================
bool FeaturesPlugin_ValidatorPipePath::isValid(
const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
+ const std::list<std::string> & /*theArguments*/,
Events_InfoMessage &theError) const {
AttributeSelectionPtr aPathAttrSelection =
std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttribute);
//==================================================================================================
bool FeaturesPlugin_ValidatorPipeLocations::isValid(
const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
+ const std::list<std::string> & /*theArguments*/,
Events_InfoMessage &theError) const {
AttributeSelectionListPtr anAttrSelectionList =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
// LCOV_EXCL_START
bool FeaturesPlugin_ValidatorPipeLocationsNumber::isValid(
const std::shared_ptr<ModelAPI_Feature> &theFeature,
- const std::list<std::string> &theArguments,
+ const std::list<std::string> & /*theArguments*/,
Events_InfoMessage &theError) const {
static const std::string aCreationMethodID = "creation_method";
static const std::string aBaseObjectsID = "base_objects";
//==================================================================================================
bool FeaturesPlugin_ValidatorLoftSameTypeShape::isValid(
const std::shared_ptr<ModelAPI_Feature> &theFeature,
- const std::list<std::string> &theArguments,
+ const std::list<std::string> & /*theArguments*/,
Events_InfoMessage &theError) const {
static const std::string aFirstObjetcID = "first_object";
static const std::string aSecondObjetcID = "second_object";
}
}
- for (std::set<ResultConstructionPtr>::const_iterator anIt =
- aSelectedSketches.cbegin();
- anIt != aSelectedSketches.cend(); ++anIt) {
- ResultConstructionPtr aResultConstruction = *anIt;
+ for (auto aResultConstruction : aSelectedSketches) {
if (aSelectedSketchesFromObjects.find(aResultConstruction) !=
aSelectedSketchesFromObjects.cend()) {
theError =
"wires on sketch, whole sketch (if it has at least one face), "
"and whole objects with shape types: %1";
std::string anArgumentString;
- for (auto anIt = theArguments.cbegin(); anIt != theArguments.cend();
- ++anIt) {
+ for (const auto &theArgument : theArguments) {
if (!anArgumentString.empty())
anArgumentString += ", ";
- anArgumentString += *anIt;
+ anArgumentString += theArgument;
}
theError.arg(anArgumentString);
return false;
}
// first argument is for the base attribute, second - for skipping feature
// kind
- std::list<std::string>::const_iterator anIt = theArguments.begin();
+ auto anIt = theArguments.begin();
std::string aBaseAttributeId = *anIt;
FeaturePtr aFeature = ModelAPI_Feature::feature(theAttribute->owner());
AttributePtr aBaseAttribute = aFeature->attribute(aBaseAttributeId);
anIt++;
std::string aFeatureAttributeKind = *anIt;
- GeomValidators_FeatureKind *aValidator = new GeomValidators_FeatureKind();
+ auto *aValidator = new GeomValidators_FeatureKind();
// check whether the selection is on the sketch
std::list<std::string> anArguments;
anArguments.push_back(aFeatureAttributeKind);
bool aFeatureKind = aValidator->isValid(theAttribute, theArguments, theError);
bool aPlanarFace = false;
// check if selection has Face selected
- GeomValidators_ShapeType *aShapeType = new GeomValidators_ShapeType();
+ auto *aShapeType = new GeomValidators_ShapeType();
anArguments.clear();
anArguments.push_back("face");
aPlanarFace = aShapeType->isValid(theAttribute, anArguments, theError);
// LCOV_EXCL_STOP
}
- std::list<std::string>::const_iterator anArgsIt = theArguments.begin();
+ auto anArgsIt = theArguments.begin();
AttributePtr aCheckAttribute = theFeature->attribute(*anArgsIt);
++anArgsIt;
//==================================================================================================
bool FeaturesPlugin_ValidatorExtrusionBoundaryFace::isValid(
const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
+ const std::list<std::string> & /*theArguments*/,
Events_InfoMessage &theError) const {
FeaturePtr aFeature = ModelAPI_Feature::feature(theAttribute->owner());
aFeature->real(FeaturesPlugin_Extrusion::FROM_OFFSET_ID())->value();
// check extrusion
- for (ListOfShape::iterator anIt = aBaseShapeList.begin();
- anIt != aBaseShapeList.end(); anIt++) {
- std::shared_ptr<GeomAPI_Shape> aBaseShape = *anIt;
-
+ for (auto aBaseShape : aBaseShapeList) {
std::shared_ptr<GeomAlgoAPI_Prism> aPrismAlgo(new GeomAlgoAPI_Prism(
aBaseShape, aDir, aToShape, aToSize, aFromShape, aFromSize));
bool isFailed = GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(
//==================================================================================================
bool FeaturesPlugin_ValidatorBooleanSelection::isValid(
const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
+ const std::list<std::string> & /*theArguments*/,
Events_InfoMessage &theError) const {
AttributeSelectionListPtr anAttrSelectionList =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
//==================================================================================================
bool FeaturesPlugin_ValidatorFilletSelection::isValid(
const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
+ const std::list<std::string> & /*theArguments*/,
Events_InfoMessage &theError) const {
AttributeSelectionListPtr anAttrSelectionList =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
GeomShapePtr aVertex = aCurSel->value();
// check wire already processed, if not, store all vertices and edges,
// sharing them
- std::map<GeomShapePtr, MapShapeToShapes>::iterator aProcessed =
- aWireSubshapes.find(aContext);
+ auto aProcessed = aWireSubshapes.find(aContext);
if (aProcessed == aWireSubshapes.end()) {
if (aContext->shapeType() != GeomAPI_Shape::WIRE) {
theError = "Selected vertex is not a wire corner";
}
// check the vertex
- MapShapeToShapes::iterator aFound = aProcessed->second.find(aVertex);
+ auto aFound = aProcessed->second.find(aVertex);
if (aFound == aProcessed->second.end()) {
theError = "Selected vertex does not exist in the wire";
return true;
FeaturePtr aResultFeature = aSelectAttr->contextFeature();
if (aResultFeature.get()) {
bool aOkRes = false;
- std::list<ResultPtr>::const_iterator aFRes =
- aResultFeature->results().cbegin();
+ auto aFRes = aResultFeature->results().cbegin();
for (; aFRes != aResultFeature->results().cend() && !aOkRes; aFRes++) {
ResultBodyPtr aBody =
std::dynamic_pointer_cast<ModelAPI_ResultBody>(*aFRes);
//==================================================================================================
bool FeaturesPlugin_ValidatorRemoveSubShapesSelection::isValid(
const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
+ const std::list<std::string> & /*theArguments*/,
Events_InfoMessage &theError) const {
AttributeSelectionListPtr aSubShapesAttrList =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
AttributeSelectionPtr anAttrSelectionInList =
aSubShapesAttrList->value(anIndex);
GeomShapePtr aShapeToAdd = anAttrSelectionInList->value();
- for (ListOfShape::const_iterator anIt = aSubShapes.cbegin();
- anIt != aSubShapes.cend(); ++anIt) {
- if ((*anIt)->isEqual(aShapeToAdd)) {
+ for (const auto &aSubShape : aSubShapes) {
+ if (aSubShape->isEqual(aShapeToAdd)) {
isSameFound = true;
break;
}
//==================================================================================================
bool FeaturesPlugin_ValidatorRemoveSubShapesResult::isValid(
const std::shared_ptr<ModelAPI_Feature> &theFeature,
- const std::list<std::string> &theArguments,
+ const std::list<std::string> & /*theArguments*/,
Events_InfoMessage &theError) const {
static const std::string aBaseShapeID = "base_shape";
static const std::string aSubShapesID = "subshapes_to_keep";
// LCOV_EXCL_START
bool FeaturesPlugin_ValidatorUnionSelection::isValid(
const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
+ const std::list<std::string> & /*theArguments*/,
Events_InfoMessage &theError) const {
AttributeSelectionListPtr aBaseObjectsAttrList =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
//==================================================================================================
bool FeaturesPlugin_ValidatorUnionArguments::isValid(
const std::shared_ptr<ModelAPI_Feature> &theFeature,
- const std::list<std::string> &theArguments,
+ const std::list<std::string> & /*theArguments*/,
Events_InfoMessage &theError) const {
// LCOV_EXCL_START
// Check feature kind.
size_t aConcealedResults = aResults.size();
if (!aConcealedResults && !theArguments.empty()) {
// find if these results are touched by the feature in another attribute
- std::list<std::string>::const_iterator anIt = theArguments.begin();
+ auto anIt = theArguments.begin();
std::string aRecoveredList = *anIt;
if (!aRecoveredList.empty()) {
std::shared_ptr<ModelAPI_AttributeRefList> aParameterList =
bool FeaturesPlugin_ValidatorCircular::isValid(
const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
+ const std::list<std::string> & /*theArguments*/,
Events_InfoMessage &theError) const {
static std::list<std::string> aEdgeArg(1, "circle");
static std::list<std::string> aFaceArg(1, "cylinder");
int anObjectsToolsNb[2] = {0, 0};
- std::list<std::string>::const_iterator anIt = theArguments.begin(),
- aLast = theArguments.end();
+ auto anIt = theArguments.begin(), aLast = theArguments.end();
bool isAllInSameCompSolid = true;
ResultBodyPtr aCompSolid;
//=================================================================================================
// LCOV_EXCL_START
bool FeaturesPlugin_ValidatorBooleanArguments::isNotObligatory(
- std::string theFeature, std::string theAttribute) {
+ std::string /*theFeature*/, std::string theAttribute) {
if (theAttribute == "main_objects" || theAttribute == "tool_objects") {
return true;
}
//==================================================================================================
bool FeaturesPlugin_ValidatorBooleanSmashSelection::isValid(
const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
+ const std::list<std::string> & /*theArguments*/,
Events_InfoMessage &theError) const {
std::shared_ptr<FeaturesPlugin_BooleanSmash> aFeature =
std::dynamic_pointer_cast<FeaturesPlugin_BooleanSmash>(
// LCOV_EXCL_START
bool FeaturesPlugin_IntersectionSelection::isValid(
const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
+ const std::list<std::string> & /*theArguments*/,
Events_InfoMessage &theError) const {
if (!theAttribute.get()) {
theError = "Error: empty selection.";
// LCOV_EXCL_START
bool FeaturesPlugin_ValidatorBooleanFuseSelection::isValid(
const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
+ const std::list<std::string> & /*theArguments*/,
Events_InfoMessage &theError) const {
AttributeSelectionListPtr anAttrSelectionList =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
int anObjectsNb = 0, aToolsNb = 0;
- std::list<std::string>::const_iterator anIt = theArguments.begin();
+ auto anIt = theArguments.begin();
bool isAllInSameCompSolid = true;
ResultBodyPtr aCompSolid;
//=================================================================================================
// LCOV_EXCL_START
bool FeaturesPlugin_ValidatorBooleanFuseArguments::isNotObligatory(
- std::string theFeature, std::string theAttribute) {
+ std::string /*theFeature*/, std::string theAttribute) {
if (theAttribute == "main_objects" || theAttribute == "tool_objects") {
return true;
}
// LCOV_EXCL_START
bool FeaturesPlugin_ValidatorBooleanCommonSelection::isValid(
const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
+ const std::list<std::string> & /*theArguments*/,
Events_InfoMessage &theError) const {
AttributeSelectionListPtr anAttrSelectionList =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
int anObjectsNb = 0, aToolsNb = 0;
- std::list<std::string>::const_iterator anIt = theArguments.begin();
+ auto anIt = theArguments.begin();
ResultBodyPtr aCompSolid;
//=================================================================================================
// LCOV_EXCL_START
bool FeaturesPlugin_ValidatorBooleanCommonArguments::isNotObligatory(
- std::string theFeature, std::string theAttribute) {
+ std::string /*theFeature*/, std::string /*theAttribute*/) {
return false;
}
// LCOV_EXCL_STOP
//==================================================================================================
bool FeaturesPlugin_ValidatorDefeaturingSelection::isValid(
const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
+ const std::list<std::string> & /*theArguments*/,
Events_InfoMessage &theError) const {
AttributeSelectionListPtr anAttrSelectionList =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
//==================================================================================================
bool FeaturesPlugin_ValidatorSewingSelection::isValid(
const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
+ const std::list<std::string> & /*theArguments*/,
Events_InfoMessage &theError) const {
AttributeSelectionListPtr anAttrSelectionList =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
//==================================================================================================
bool FeaturesPlugin_ValidatorGlueFacesSelection::isValid(
const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
+ const std::list<std::string> & /*theArguments*/,
Events_InfoMessage &theError) const {
AttributeSelectionListPtr anAttrSelectionList =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
//! \param[in] theAttribute the checked attribute.
//! \param[in] theArguments arguments of the attribute.
//! \param[out] theError error message.
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/// \class FeaturesPlugin_ValidatorPipeLocations
//! \param[in] theAttribute the checked attribute.
//! \param[in] theArguments arguments of the attribute.
//! \param[out] theError error message.
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/// \class FeaturesPlugin_ValidatorPipeLocationsNumber
//! selected bases, or empty. \param theFeature the checked feature \param
//! theArguments arguments of the feature (not used) \param theError error
//! message
- virtual bool isValid(const std::shared_ptr<ModelAPI_Feature> &theFeature,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const std::shared_ptr<ModelAPI_Feature> &theFeature,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/// \class FeaturesPlugin_ValidatorLoftSameTypeShape
//! \param theFeature the checked feature
//! \param theArguments arguments of the feature (not used)
//! \param theError error message
- virtual bool isValid(const std::shared_ptr<ModelAPI_Feature> &theFeature,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const std::shared_ptr<ModelAPI_Feature> &theFeature,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/// \class FeaturesPlugin_ValidatorBaseForGeneration
//! arguments. \param[in] theAttribute the checked attribute. \param[in]
//! theArguments arguments of the attribute. \param[out] theError error
//! message.
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
private:
bool isValidAttribute(const AttributePtr &theAttribute,
//! \param theFeature the checked feature
//! \param theArguments arguments of the feature (not used)
//! \param theError error message
- virtual bool isValid(const std::shared_ptr<ModelAPI_Feature> &theFeature,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const std::shared_ptr<ModelAPI_Feature> &theFeature,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/// \class FeaturesPlugin_ValidatorCompositeLauncher
//! arguments. \param[in] theAttribute the checked attribute. \param[in]
//! theArguments arguments of the attribute. \param[out] theError error
//! message.
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/// \class FeaturesPlugin_ValidatorExtrusionDir
//! \param[in] theFeature the checked feature.
//! \param[in] theArguments arguments of the attribute.
//! \param[out] theError error message.
- virtual bool isValid(const std::shared_ptr<ModelAPI_Feature> &theFeature,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const std::shared_ptr<ModelAPI_Feature> &theFeature,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
private:
bool isShapesCanBeEmpty(const AttributePtr &theAttribute,
//! \param[in] theFeature the checked feature.
//! \param[in] theArguments arguments of the attribute.
//! \param[out] theError error message.
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/// \class FeaturesPlugin_ValidatorBooleanSelection
/// \param[in] theAttribute an attribute to check.
/// \param[in] theArguments a filter parameters.
/// \param[out] theError error message.
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/// \class FeaturesPlugin_ValidatorFilletSelection
/// \param[in] theAttribute an attribute to check.
/// \param[in] theArguments a filter parameters.
/// \param[out] theError error message.
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/// \class FeaturesPlugin_ValidatorFillet1DSelection
/// \param[in] theAttribute an attribute to check.
/// \param[in] theArguments a filter parameters.
/// \param[out] theError error message.
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/// \class FeaturesPlugin_ValidatorPartitionSelection
/// \param[in] theAttribute an attribute to check.
/// \param[in] theArguments a filter parameters.
/// \param[out] theError error message.
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/// \class FeaturesPlugin_ValidatorRemoveSubShapesSelection
/// \param[in] theAttribute an attribute to check.
/// \param[in] theArguments a filter parameters.
/// \param[out] theError error message.
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/// \class FeaturesPlugin_ValidatorRemoveSubShapesResult
//! \param theFeature the checked feature
//! \param theArguments arguments of the feature (not used)
//! \param theError error message
- virtual bool isValid(const std::shared_ptr<ModelAPI_Feature> &theFeature,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const std::shared_ptr<ModelAPI_Feature> &theFeature,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/// \class FeaturesPlugin_ValidatorUnionSelection
/// \param[in] theAttribute an attribute to check.
/// \param[in] theArguments a filter parameters.
/// \param[out] theError error message.
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/// \class FeaturesPlugin_ValidatorUnionArguments
//! \param theFeature the checked feature
//! \param theArguments arguments of the feature (not used)
//! \param theError error message
- virtual bool isValid(const std::shared_ptr<ModelAPI_Feature> &theFeature,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const std::shared_ptr<ModelAPI_Feature> &theFeature,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/// \class FeaturesPlugin_ValidatorConcealedResult
//! \param[in] theAttribute the checked attribute.
//! \param[in] theArguments arguments of the attribute.
//! \param[out] theError error message.
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/// \class FeaturesPlugin_ValidatorCircular
//! \param[in] theAttribute the checked attribute.
//! \param[in] theArguments arguments of the attribute.
//! \param[out] theError error message.
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/** \class FeaturesPlugin_ValidatorBooleanArguments
* validator. \param[out] theError error message. \returns true if feature is
* valid.
*/
- virtual bool isValid(const std::shared_ptr<ModelAPI_Feature> &theFeature,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const std::shared_ptr<ModelAPI_Feature> &theFeature,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
/// \return true if the attribute in feature is not obligatory for the feature
/// execution.
- virtual bool isNotObligatory(std::string theFeature,
- std::string theAttribute);
+ bool isNotObligatory(std::string theFeature,
+ std::string theAttribute) override;
};
/// \class FeaturesPlugin_ValidatorBooleanSmashSelection
//! \param[in] theAttribute the checked attribute.
//! \param[in] theArguments arguments of the attribute.
//! \param[out] theError error message.
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/// \class FeaturesPlugin_IntersectionSelection
//! \param[in] theAttribute the checked attribute.
//! \param[in] theArguments arguments of the attribute.
//! \param[out] theError error message.
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/// \class FeaturesPlugin_ValidatorBooleanFuseSelection
//! \param[in] theAttribute the checked attribute.
//! \param[in] theArguments arguments of the attribute.
//! \param[out] theError error message.
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/** \class FeaturesPlugin_ValidatorBooleanFuseArguments
* validator. \param[out] theError error message. \returns true if feature is
* valid.
*/
- virtual bool isValid(const std::shared_ptr<ModelAPI_Feature> &theFeature,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const std::shared_ptr<ModelAPI_Feature> &theFeature,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
/// \return true if the attribute in feature is not obligatory for the feature
/// execution.
- virtual bool isNotObligatory(std::string theFeature,
- std::string theAttribute);
+ bool isNotObligatory(std::string theFeature,
+ std::string theAttribute) override;
};
/// \class FeaturesPlugin_ValidatorBooleanCommonSelection
//! \param[in] theAttribute the checked attribute.
//! \param[in] theArguments arguments of the attribute.
//! \param[out] theError error message.
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/** \class FeaturesPlugin_ValidatorBooleanCommonArguments
* validator. \param[out] theError error message. \returns true if feature is
* valid.
*/
- virtual bool isValid(const std::shared_ptr<ModelAPI_Feature> &theFeature,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const std::shared_ptr<ModelAPI_Feature> &theFeature,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
/// \return true if the attribute in feature is not obligatory for the feature
/// execution.
- virtual bool isNotObligatory(std::string theFeature,
- std::string theAttribute);
+ bool isNotObligatory(std::string theFeature,
+ std::string theAttribute) override;
};
/// \class FeaturesPlugin_ValidatorDefeaturingSelection
/// \param[in] theAttribute an attribute to check.
/// \param[in] theArguments a filter parameters.
/// \param[out] theError error message.
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/// \class FeaturesPlugin_ValidatorSewingSelection
/// \param[in] theAttribute an attribute to check.
/// \param[in] theArguments a filter parameters.
/// \param[out] theError error message.
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/// \class FeaturesPlugin_ValidatorGlueFacesSelection
/// \param[in] theAttribute an attribute to check.
/// \param[in] theArguments a filter parameters.
/// \param[out] theError error message.
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
#endif
GeomAlgoAPI_ShapeTools::getBoundingBox(theObjects, 1.0);
// Resize planes to fit in bounding box
- for (ListOfShape::iterator anIt = thePlanes.begin(); anIt != thePlanes.end();
- ++anIt) {
- GeomShapePtr aPlane = *anIt;
+ for (auto &thePlane : thePlanes) {
+ GeomShapePtr aPlane = thePlane;
GeomShapePtr aTool =
GeomAlgoAPI_ShapeTools::fitPlaneToBox(aPlane, aBoundingPoints);
std::shared_ptr<GeomAlgoAPI_MakeShapeCustom> aMkShCustom(
new GeomAlgoAPI_MakeShapeCustom);
aMkShCustom->addModified(aPlane, aTool);
theMakeShapeList->appendAlgo(aMkShCustom);
- *anIt = aTool;
+ thePlane = aTool;
}
}
}
/// Use plugin manager for features creation.
- FeaturesPlugin_VersionedBoolean() {}
+ FeaturesPlugin_VersionedBoolean() = default;
/// Initialize version field of the Boolean feature.
/// The version is initialized for newly created features,
const std::string &aPrefix = modifiedShapePrefix();
ListOfShape aTopLevel;
anObjectHierarchy.topLevelObjects(aTopLevel);
- for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end();
- ++anIt) {
+ for (auto &anIt : aTopLevel) {
ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
ModelAPI_Tools::loadModifiedShapes(aResultBody, anOriginalSolids,
- ListOfShape(), aMakeShapeList, *anIt,
+ ListOfShape(), aMakeShapeList, anIt,
aPrefix);
setResult(aResultBody, aResultIndex++);
- for (ListOfShape::iterator aEIt = anEdges.begin(); aEIt != anEdges.end();
- ++aEIt) {
- GeomShapePtr aBase = *aEIt;
+ for (auto aBase : anEdges) {
// Store new faces generated from edges and vertices
aResultBody->loadGeneratedShapes(aMakeShapeList, aBase,
GeomAPI_Shape::EDGE, aPrefix, true);
}
ModelAPI_Tools::loadDeletedShapes(aResultBody, GeomShapePtr(),
- anOriginalSolids, aMakeShapeList, *anIt);
+ anOriginalSolids, aMakeShapeList, anIt);
}
removeResults(aResultIndex);
ListOfShape anEdges;
collectSubs(aParent, anEdges, GeomAPI_Shape::EDGE);
- for (ListOfShape::iterator anIt = anEdges.begin();
- anIt != anEdges.end(); ++anIt) {
- theObjects.addObject(*anIt);
- theObjects.addParent(*anIt, aParent);
+ for (auto &anEdge : anEdges) {
+ theObjects.addObject(anEdge);
+ theObjects.addParent(anEdge, aParent);
}
}
}
class FeaturesPlugin_VersionedChFi : public ModelAPI_Feature {
public:
/// Performs the fillet algorithm and stores it in the data structure.
- FEATURESPLUGIN_EXPORT virtual void execute();
+ FEATURESPLUGIN_EXPORT void execute() override;
protected:
- FeaturesPlugin_VersionedChFi() {}
+ FeaturesPlugin_VersionedChFi() = default;
/// Intialize the version for the newly created feature.
void initVersion(const std::shared_ptr<ModelAPI_Attribute> &theObjectsAttr);
#include "FiltersAPI_Argument.h"
-FiltersAPI_Argument::FiltersAPI_Argument() {}
+FiltersAPI_Argument::FiltersAPI_Argument() = default;
FiltersAPI_Argument::FiltersAPI_Argument(const bool theValue)
: myBoolean(theValue) {}
const AttributeSelectionPtr &theSelection)
: mySelectionAttr(theSelection) {}
-FiltersAPI_Argument::~FiltersAPI_Argument() {}
+FiltersAPI_Argument::~FiltersAPI_Argument() = default;
void FiltersAPI_Argument::dump(ModelHighAPI_Dumper &theDumper) const {
if (mySelectionAttr) {
->initAttributes();
}
-FiltersAPI_Feature::~FiltersAPI_Feature() {}
+FiltersAPI_Feature::~FiltersAPI_Feature() = default;
static void
separateArguments(const std::list<FiltersAPI_Argument> &theArguments,
std::list<std::string> &theTextArgs,
std::list<bool> &theBoolArgs,
std::list<ModelHighAPI_Double> &theDoubleArgs) {
- std::list<FiltersAPI_Argument>::const_iterator anIt = theArguments.begin();
+ auto anIt = theArguments.begin();
for (; anIt != theArguments.end(); ++anIt) {
if (anIt->selection().variantType() != ModelHighAPI_Selection::VT_Empty)
theSelections.push_back(anIt->selection());
void FiltersAPI_Feature::setFilters(const std::list<FilterAPIPtr> &theFilters) {
FiltersFeaturePtr aBase =
std::dynamic_pointer_cast<ModelAPI_FiltersFeature>(feature());
- for (std::list<FilterAPIPtr>::const_iterator anIt = theFilters.begin();
- anIt != theFilters.end(); ++anIt) {
- std::string aFilterID = aBase->addFilter((*anIt)->name());
- aBase->setReversed(aFilterID, (*anIt)->isReversed());
+ for (const auto &theFilter : theFilters) {
+ std::string aFilterID = aBase->addFilter(theFilter->name());
+ aBase->setReversed(aFilterID, theFilter->isReversed());
- const std::list<FiltersAPI_Argument> &anArgs = (*anIt)->arguments();
+ const std::list<FiltersAPI_Argument> &anArgs = theFilter->arguments();
if (!anArgs.empty()) {
// separate selection arguments and strings
std::list<ModelHighAPI_Selection> aSelections;
separateArguments(anArgs, aSelections, aTexts, aBools, aDoubles);
std::list<AttributePtr> aFilterArgs = aBase->filterArgs(aFilterID);
- std::list<AttributePtr>::iterator aFIt = aFilterArgs.begin();
+ auto aFIt = aFilterArgs.begin();
// first boolean argument is always "Reversed" flag
AttributeBooleanPtr aReversedFlag =
std::dynamic_pointer_cast<ModelAPI_AttributeBoolean>(*aFIt);
ModelAPI_FiltersFactory *aFFactory = ModelAPI_Session::get()->filters();
std::list<std::string> aFilters = aBase->filters();
- for (std::list<std::string>::iterator aFIt = aFilters.begin();
- aFIt != aFilters.end(); ++aFIt) {
+ for (auto aFIt = aFilters.begin(); aFIt != aFilters.end(); ++aFIt) {
// for multiple filters get original id
std::string aFilterKind = aFFactory->id(aFFactory->filter(*aFIt));
FiltersAPI_Filter aFilter(aFilterKind, aBase->filterArgs(*aFIt));
/// Destructor
FILTERSAPI_EXPORT
- virtual ~FiltersAPI_Feature();
+ ~FiltersAPI_Feature() override;
INTERFACE_0(FiltersPlugin_Selection::ID())
/// Dump wrapped feature
FILTERSAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
typedef std::shared_ptr<FiltersAPI_Feature> FiltersPtr;
FiltersAPI_Filter::FiltersAPI_Filter(
const std::string &theName, const std::list<AttributePtr> &theArguments)
: myName(theName) {
- std::list<AttributePtr>::const_iterator anArgIt = theArguments.begin();
+ auto anArgIt = theArguments.begin();
// first attribute is usually for reversing the filter
AttributeBooleanPtr aBoolAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeBoolean>(*anArgIt);
}
}
-FiltersAPI_Filter::~FiltersAPI_Filter() {}
+FiltersAPI_Filter::~FiltersAPI_Filter() = default;
void FiltersAPI_Filter::dump(ModelHighAPI_Dumper &theDumper) const {
theDumper << "model.addFilter(name = \"" << myName << "\"";
if (!myFilterArguments.empty()) {
theDumper << ", args = [";
bool isFirstArg = true;
- for (std::list<FiltersAPI_Argument>::const_iterator anIt =
- myFilterArguments.begin();
- anIt != myFilterArguments.end(); ++anIt) {
+ for (const auto &myFilterArgument : myFilterArguments) {
if (isFirstArg)
isFirstArg = false;
else
theDumper << ", ";
- anIt->dump(theDumper);
+ myFilterArgument.dump(theDumper);
}
theDumper << "]";
}
std::dynamic_pointer_cast<ModelAPI_FiltersFeature>(theFeature->feature());
}
-FiltersAPI_Selection::~FiltersAPI_Selection() {}
+FiltersAPI_Selection::~FiltersAPI_Selection() = default;
FiltersFeaturePtr FiltersAPI_Selection::feature() const {
return myFilterFeature;
std::list<std::pair<ResultPtr, GeomShapePtr>> aResList =
aSession->filters()->select(myFilterFeature, theShapeType);
- std::list<std::pair<ResultPtr, GeomShapePtr>>::const_iterator itSelected =
- aResList.cbegin();
+ auto itSelected = aResList.cbegin();
for (; itSelected != aResList.cend(); itSelected++) {
ResultPtr aCurRes = (*itSelected).first;
GeomShapePtr aSubShape = (*itSelected).second;
/// Destructor
FILTERSAPI_EXPORT
- virtual ~FiltersAPI_Selection();
+ ~FiltersAPI_Selection() override;
/// Return filters feature
FILTERSAPI_EXPORT
public:
FiltersPlugin_BelongsTo() : ModelAPI_Filter() {}
- virtual const std::string &name() const {
+ const std::string &name() const override {
static const std::string kName("Belongs to");
return kName;
}
/// Returns true for any type because it supports all selection types
- virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override;
+ bool isSupported(GeomAPI_Shape::ShapeType theType) const override;
/// This method should contain the filter logic. It returns true if the given
/// shape is accepted by the filter. \param theShape the given shape \param
/// theArgs arguments of the filter
- virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &,
- const ModelAPI_FiltersArgs &theArgs) const override;
+ bool isOk(const GeomShapePtr &theShape, const ResultPtr &,
+ const ModelAPI_FiltersArgs &theArgs) const override;
/// Returns XML string which represents GUI of the filter
- virtual std::string xmlRepresentation() const override;
+ std::string xmlRepresentation() const override;
/// Initializes arguments of a filter.
- virtual void initAttributes(ModelAPI_FiltersArgs &theArguments) override;
+ void initAttributes(ModelAPI_FiltersArgs &theArguments) override;
};
#endif
GeomEdgePtr anEdge;
anEdge = GeomEdgePtr(new GeomAPI_Edge(aEExp.current()));
- for (SetOfShapes::const_iterator aFIt = aFound->second.begin();
- aFIt != aFound->second.end(); ++aFIt) {
+ for (const auto &aFIt : aFound->second) {
std::string anError = "";
- if (theCache.find(*aFIt) == theCache.end()) {
+ if (theCache.find(aFIt) == theCache.end()) {
GeomPointPtr aPoint = anEdge->middlePoint();
- if (GeomAlgoAPI_ShapeTools::isContinuousFaces(theFace, *aFIt, aPoint,
+ if (GeomAlgoAPI_ShapeTools::isContinuousFaces(theFace, aFIt, aPoint,
theAngle, anError)) {
- theCache.insert(*aFIt);
- cacheContinuousFace(*aFIt, theEdgeToFaces, theCache, theAngle);
+ theCache.insert(aFIt);
+ cacheContinuousFace(aFIt, theEdgeToFaces, theCache, theAngle);
}
}
}
MapShapeAndAncestors anEdgesToFaces;
mapEdgesAndFaces(theTopLevelShape, anEdgesToFaces);
- for (SetOfShapes::const_iterator aFIt = theFaces.begin();
- aFIt != theFaces.end(); ++aFIt) {
+ for (const auto &theFace : theFaces) {
// keep the original face
- theCache.insert(*aFIt);
+ theCache.insert(theFace);
// cache continuous face
- cacheContinuousFace(*aFIt, anEdgesToFaces, theCache, theAngle);
+ cacheContinuousFace(theFace, anEdgesToFaces, theCache, theAngle);
}
}
#include <set>
-typedef std::set<GeomShapePtr, GeomAPI_Shape::Comparator> SetOfShapes;
+using SetOfShapes = std::set<GeomShapePtr, GeomAPI_Shape::Comparator>;
/**\class FiltersPlugin_ContinuousFaces
* \ingroup DataModel
public:
FiltersPlugin_ContinuousFaces() : ModelAPI_Filter() { myAngle = 0.0; }
- virtual const std::string &name() const {
+ const std::string &name() const override {
static const std::string kName("Continuous faces");
return kName;
}
/// Returns true for face type
- virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override;
+ bool isSupported(GeomAPI_Shape::ShapeType theType) const override;
/// This method should contain the filter logic. It returns true if the given
/// shape is accepted by the filter. \param theShape the given shape \param
/// theArgs arguments of the filter
- virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &,
- const ModelAPI_FiltersArgs &theArgs) const override;
+ bool isOk(const GeomShapePtr &theShape, const ResultPtr &,
+ const ModelAPI_FiltersArgs &theArgs) const override;
/// Returns XML string which represents GUI of the filter
- virtual std::string xmlRepresentation() const override;
+ std::string xmlRepresentation() const override;
/// Initializes arguments of a filter.
- virtual void initAttributes(ModelAPI_FiltersArgs &theArguments) override;
+ void initAttributes(ModelAPI_FiltersArgs &theArguments) override;
private:
/// Original faces selected for filtering
public:
FiltersPlugin_EdgeSize() : ModelAPI_Filter() {}
- virtual const std::string &name() const {
+ const std::string &name() const override {
static const std::string kName("Edge size");
return kName;
}
/// Returns true for edge type
- virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override;
+ bool isSupported(GeomAPI_Shape::ShapeType theType) const override;
/// This method should contain the filter logic. It returns true if the given
/// shape is accepted by the filter. \param theShape the given shape \param
/// theArgs arguments of the filter
- virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &,
- const ModelAPI_FiltersArgs &theArgs) const override;
+ bool isOk(const GeomShapePtr &theShape, const ResultPtr &,
+ const ModelAPI_FiltersArgs &theArgs) const override;
/// Returns XML string which represents GUI of the filter
- virtual std::string xmlRepresentation() const override;
+ std::string xmlRepresentation() const override;
/// Initializes arguments of a filter.
- virtual void initAttributes(ModelAPI_FiltersArgs &theArguments) override;
+ void initAttributes(ModelAPI_FiltersArgs &theArguments) override;
};
#endif
public:
FiltersPlugin_ExternalFaces() : ModelAPI_Filter() {}
- virtual const std::string &name() const {
+ const std::string &name() const override {
static const std::string kName("External faces");
return kName;
}
/// Returns true for any type because it supports all selection types
- virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override;
+ bool isSupported(GeomAPI_Shape::ShapeType theType) const override;
/// This method should contain the filter logic. It returns true if the given
/// shape is accepted by the filter. \param theShape the given shape \param
/// theResult parent result of the shape to be checked \param theArgs
/// arguments of the filter
- virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &theResult,
- const ModelAPI_FiltersArgs &theArgs) const override;
+ bool isOk(const GeomShapePtr &theShape, const ResultPtr &theResult,
+ const ModelAPI_FiltersArgs &theArgs) const override;
};
#endif
public:
FiltersPlugin_FaceSize() : ModelAPI_Filter() {}
- virtual const std::string &name() const {
+ const std::string &name() const override {
static const std::string kName("Face size");
return kName;
}
/// Returns true for face type
- virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override;
+ bool isSupported(GeomAPI_Shape::ShapeType theType) const override;
/// This method should contain the filter logic. It returns true if the given
/// shape is accepted by the filter. \param theShape the given shape \param
/// theArgs arguments of the filter
- virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &,
- const ModelAPI_FiltersArgs &theArgs) const override;
+ bool isOk(const GeomShapePtr &theShape, const ResultPtr &,
+ const ModelAPI_FiltersArgs &theArgs) const override;
/// Returns XML string which represents GUI of the filter
- virtual std::string xmlRepresentation() const override;
+ std::string xmlRepresentation() const override;
/// Initializes arguments of a filter.
- virtual void initAttributes(ModelAPI_FiltersArgs &theArguments) override;
+ void initAttributes(ModelAPI_FiltersArgs &theArguments) override;
};
#endif
GeomEdgePtr anEdge;
anEdge = GeomEdgePtr(new GeomAPI_Edge(aIt->first));
- for (SetOfShapes::const_iterator aFIt = aIt->second.begin();
- aFIt != aIt->second.end(); ++aFIt) {
- SetOfShapes::const_iterator aFIt2 = aFIt;
+ for (auto aFIt = aIt->second.begin(); aFIt != aIt->second.end(); ++aFIt) {
+ auto aFIt2 = aFIt;
++aFIt2;
for (; aFIt2 != aIt->second.end(); ++aFIt2) {
std::string anError;
#include <set>
-typedef std::set<GeomShapePtr, GeomAPI_Shape::Comparator> SetOfShapes;
+using SetOfShapes = std::set<GeomShapePtr, GeomAPI_Shape::Comparator>;
/**\class FiltersPlugin_FeatureEdges
* \ingroup DataModel
public:
FiltersPlugin_FeatureEdges() : ModelAPI_Filter() { myAngle = 0.0; }
- virtual const std::string &name() const {
+ const std::string &name() const override {
static const std::string kName("Feature edges");
return kName;
}
/// Returns true for edge type
- virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override;
+ bool isSupported(GeomAPI_Shape::ShapeType theType) const override;
/// This method should contain the filter logic. It returns true if the given
/// shape is accepted by the filter. \param theShape the given shape \param
/// theArgs arguments of the filter
- virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &,
- const ModelAPI_FiltersArgs &theArgs) const override;
+ bool isOk(const GeomShapePtr &theShape, const ResultPtr &,
+ const ModelAPI_FiltersArgs &theArgs) const override;
/// Returns XML string which represents GUI of the filter
- virtual std::string xmlRepresentation() const override;
+ std::string xmlRepresentation() const override;
/// Initializes arguments of a filter.
- virtual void initAttributes(ModelAPI_FiltersArgs &theArguments) override;
+ void initAttributes(ModelAPI_FiltersArgs &theArguments) override;
private:
/// Shapes applicable for the filter
public:
FiltersPlugin_HorizontalFace() : ModelAPI_Filter() {}
- virtual const std::string &name() const {
+ const std::string &name() const override {
static const std::string kName("Horizontal faces");
return kName;
}
/// Returns true if the given shape type is supported
- virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override;
+ bool isSupported(GeomAPI_Shape::ShapeType theType) const override;
/// This method should contain the filter logic. It returns true if the given
/// shape is accepted by the filter. \param theShape the given shape \param
/// theArgs arguments of the filter
- virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &,
- const ModelAPI_FiltersArgs &theArgs) const override;
+ bool isOk(const GeomShapePtr &theShape, const ResultPtr &,
+ const ModelAPI_FiltersArgs &theArgs) const override;
};
#endif
public:
FiltersPlugin_OnGeometry() : ModelAPI_Filter() {}
- virtual const std::string &name() const {
+ const std::string &name() const override {
static const std::string kName("On geometry");
return kName;
}
/// Returns true for any type because it supports all selection types
- virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override;
+ bool isSupported(GeomAPI_Shape::ShapeType theType) const override;
/// This method should contain the filter logic. It returns true if the given
/// shape is accepted by the filter. \param theShape the given shape \param
/// theArgs arguments of the filter
- virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &,
- const ModelAPI_FiltersArgs &theArgs) const override;
+ bool isOk(const GeomShapePtr &theShape, const ResultPtr &,
+ const ModelAPI_FiltersArgs &theArgs) const override;
/// Returns XML string which represents GUI of the filter
- virtual std::string xmlRepresentation() const override;
+ std::string xmlRepresentation() const override;
/// Initializes arguments of a filter.
- virtual void initAttributes(ModelAPI_FiltersArgs &theArguments) override;
+ void initAttributes(ModelAPI_FiltersArgs &theArguments) override;
};
#endif
public:
FiltersPlugin_OnPlane() : ModelAPI_Filter() {}
- virtual const std::string &name() const {
+ const std::string &name() const override {
static const std::string kName("On plane");
return kName;
}
/// Returns true for any type because it supports all selection types
- virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override;
+ bool isSupported(GeomAPI_Shape::ShapeType theType) const override;
/// Returns True if the filter can be used several times within one selection
- virtual bool isMultiple() const { return true; }
+ bool isMultiple() const override { return true; }
/// This method should contain the filter logic. It returns true if the given
/// shape is accepted by the filter. \param theShape the given shape \param
/// theArgs arguments of the filter
- virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &,
- const ModelAPI_FiltersArgs &theArgs) const override;
+ bool isOk(const GeomShapePtr &theShape, const ResultPtr &,
+ const ModelAPI_FiltersArgs &theArgs) const override;
/// Returns XML string which represents GUI of the filter
- virtual std::string xmlRepresentation() const override;
+ std::string xmlRepresentation() const override;
/// Initializes arguments of a filter.
- virtual void initAttributes(ModelAPI_FiltersArgs &theArguments) override;
+ void initAttributes(ModelAPI_FiltersArgs &theArguments) override;
};
#endif
public:
FiltersPlugin_OnPlaneSide() : ModelAPI_Filter() {}
- virtual const std::string &name() const {
+ const std::string &name() const override {
static const std::string kName("On plane side");
return kName;
}
/// Returns true for any type because it supports all selection types
- virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override;
+ bool isSupported(GeomAPI_Shape::ShapeType theType) const override;
/// Returns True if the filter can be used several times within one selection
- virtual bool isMultiple() const { return true; }
+ bool isMultiple() const override { return true; }
/// This method should contain the filter logic. It returns true if the given
/// shape is accepted by the filter. \param theShape the given shape \param
/// theArgs arguments of the filter
- virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &,
- const ModelAPI_FiltersArgs &theArgs) const override;
+ bool isOk(const GeomShapePtr &theShape, const ResultPtr &,
+ const ModelAPI_FiltersArgs &theArgs) const override;
/// Returns XML string which represents GUI of the filter
- virtual std::string xmlRepresentation() const override;
+ std::string xmlRepresentation() const override;
/// Initializes arguments of a filter.
- virtual void initAttributes(ModelAPI_FiltersArgs &theArguments) override;
+ void initAttributes(ModelAPI_FiltersArgs &theArguments) override;
};
#endif
//=======================================================================
bool FiltersPlugin_OnShapeName::isOk(
- const GeomShapePtr &theShape, const ResultPtr &theResult,
+ const GeomShapePtr & /*theShape*/, const ResultPtr &theResult,
const ModelAPI_FiltersArgs &theArgs) const {
if (!theResult)
return false;
public:
FiltersPlugin_OnShapeName() : ModelAPI_Filter() {}
- virtual const std::string &name() const {
+ const std::string &name() const override {
static const std::string kName("On shape name");
return kName;
}
/// Returns true for face type
- virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override;
+ bool isSupported(GeomAPI_Shape::ShapeType theType) const override;
/// This method should contain the filter logic. It returns true if the given
/// shape is accepted by the filter. \param theShape the given shape \param
/// theArgs arguments of the filter
- virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &theResult,
- const ModelAPI_FiltersArgs &theArgs) const override;
+ bool isOk(const GeomShapePtr &theShape, const ResultPtr &theResult,
+ const ModelAPI_FiltersArgs &theArgs) const override;
/// Returns XML string which represents GUI of the filter
- virtual std::string xmlRepresentation() const override;
+ std::string xmlRepresentation() const override;
/// Initializes arguments of a filter.
- virtual void initAttributes(ModelAPI_FiltersArgs &theArguments) override;
+ void initAttributes(ModelAPI_FiltersArgs &theArguments) override;
};
#endif
static void cacheOppositeEdge(const GeomShapePtr theEdge,
const MapShapeAndAncestors &theEdgeToFaces,
SetOfShapes &theCache) {
- MapShapeAndAncestors::const_iterator aFound = theEdgeToFaces.find(theEdge);
+ auto aFound = theEdgeToFaces.find(theEdge);
if (aFound == theEdgeToFaces.end())
return;
- for (SetOfShapes::const_iterator aFIt = aFound->second.begin();
- aFIt != aFound->second.end(); ++aFIt) {
- GeomShapePtr anOpposite = oppositeEdgeInQuadFace(theEdge, *aFIt);
+ for (const auto &aFIt : aFound->second) {
+ GeomShapePtr anOpposite = oppositeEdgeInQuadFace(theEdge, aFIt);
if (anOpposite && theCache.find(anOpposite) == theCache.end()) {
theCache.insert(anOpposite);
cacheOppositeEdge(anOpposite, theEdgeToFaces, theCache);
#include <set>
-typedef std::set<GeomShapePtr, GeomAPI_Shape::Comparator> SetOfShapes;
+using SetOfShapes = std::set<GeomShapePtr, GeomAPI_Shape::Comparator>;
/**\class FiltersPlugin_OppositeToEdge
* \ingroup DataModel
public:
FiltersPlugin_OppositeToEdge() : ModelAPI_Filter() {}
- virtual const std::string &name() const {
+ const std::string &name() const override {
static const std::string kName("Opposite to an edge");
return kName;
}
/// Returns true for any type because it supports all selection types
- virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override;
+ bool isSupported(GeomAPI_Shape::ShapeType theType) const override;
/// This method should contain the filter logic. It returns true if the given
/// shape is accepted by the filter. \param theShape the given shape \param
/// theArgs arguments of the filter
- virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &,
- const ModelAPI_FiltersArgs &theArgs) const override;
+ bool isOk(const GeomShapePtr &theShape, const ResultPtr &,
+ const ModelAPI_FiltersArgs &theArgs) const override;
/// Returns XML string which represents GUI of the filter
- virtual std::string xmlRepresentation() const override;
+ std::string xmlRepresentation() const override;
/// Initializes arguments of a filter.
- virtual void initAttributes(ModelAPI_FiltersArgs &theArguments) override;
+ void initAttributes(ModelAPI_FiltersArgs &theArguments) override;
private:
/// Original edge selected for filtering
class FILTERS_EXPORT FiltersPlugin_Plugin : public ModelAPI_Plugin {
public:
/// Creates the feature object of this plugin by the feature string ID
- virtual FeaturePtr createFeature(std::string theFeatureID);
+ FeaturePtr createFeature(std::string theFeatureID) override;
public:
FiltersPlugin_Plugin();
public:
FiltersPlugin_RelativeToSolid() : ModelAPI_Filter() {}
- virtual const std::string &name() const {
+ const std::string &name() const override {
static const std::string kName("On/In/Out a solid");
return kName;
}
/// Returns true for any type because it supports all selection types
- virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override;
+ bool isSupported(GeomAPI_Shape::ShapeType theType) const override;
/// Returns True if the filter can be used several times within one selection
- virtual bool isMultiple() const { return true; }
+ bool isMultiple() const override { return true; }
/// This method should contain the filter logic. It returns true if the given
/// shape is accepted by the filter. \param theShape the given shape \param
/// theArgs arguments of the filter
- virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &,
- const ModelAPI_FiltersArgs &theArgs) const override;
+ bool isOk(const GeomShapePtr &theShape, const ResultPtr &,
+ const ModelAPI_FiltersArgs &theArgs) const override;
/// Returns XML string which represents GUI of the filter
- virtual std::string xmlRepresentation() const override;
+ std::string xmlRepresentation() const override;
/// Initializes arguments of a filter.
- virtual void initAttributes(ModelAPI_FiltersArgs &theArguments) override;
+ void initAttributes(ModelAPI_FiltersArgs &theArguments) override;
};
#endif
aStream << "_" << anID << "_" << theFilterID;
aFilterID = aStream.str();
}
- std::list<std::string>::iterator aFiltersIDs = aFilters.begin();
+ auto aFiltersIDs = aFilters.begin();
for (; aFiltersIDs != aFilters.end(); aFiltersIDs++) {
if (*aFiltersIDs == aFilterID)
break;
std::list<std::string> aFilters;
data()->allGroups(aFilters);
ModelAPI_FiltersFactory *aFactory = ModelAPI_Session::get()->filters();
- std::list<std::string>::iterator aFIter = aFilters.begin();
+ auto aFIter = aFilters.begin();
for (; aFIter != aFilters.end(); aFIter++) {
FilterPtr aFilter = aFactory->filter(*aFIter);
if (aFilter.get() && !aFilter->isSupported(aType)) {
ModelAPI_FiltersFactory *aFactory = ModelAPI_Session::get()->filters();
std::list<std::string> aFilters;
data()->allGroups(aFilters);
- for (std::list<std::string>::iterator aFIt = aFilters.begin();
- aFIt != aFilters.end(); aFIt++) {
- FilterPtr aFilter = aFactory->filter(*aFIt);
+ for (auto &aFIt : aFilters) {
+ FilterPtr aFilter = aFactory->filter(aFIt);
if (aFilter.get()) {
std::shared_ptr<ModelAPI_AttributeBoolean> aBool =
std::dynamic_pointer_cast<ModelAPI_AttributeBoolean>(
data()->addFloatingAttribute(
- kReverseAttrID, ModelAPI_AttributeBoolean::typeId(), *aFIt));
+ kReverseAttrID, ModelAPI_AttributeBoolean::typeId(), aFIt));
if (!aBool->isInitialized())
aBool->setValue(false); // not reversed by default
ModelAPI_FiltersArgs anArgs;
anArgs.setFeature(
std::dynamic_pointer_cast<ModelAPI_FiltersFeature>(data()->owner()));
- anArgs.setFilter(*aFIt);
+ anArgs.setFilter(aFIt);
aFilter->initAttributes(anArgs);
}
}
}
/// Returns the kind of a feature
- FILTERS_EXPORT virtual const std::string &getKind() { return ID(); }
+ FILTERS_EXPORT const std::string &getKind() override { return ID(); }
/// This feature does not displayed in the data tree
- virtual bool isInHistory() { return false; }
+ bool isInHistory() override { return false; }
/// Computes a selection?
- FILTERS_EXPORT virtual void execute() {}
+ FILTERS_EXPORT void execute() override {}
/// Feature is created in the plugin manager
- FiltersPlugin_Selection() {}
+ FiltersPlugin_Selection() = default;
/// This method initializes all filters on open of document
- FILTERS_EXPORT virtual void initAttributes() override;
+ FILTERS_EXPORT void initAttributes() override;
// methods related to the filters management
/// Adds a filter to the feature. Also initializes arguments of this filter.
/// Returns the real identifier of the filter.
- FILTERS_EXPORT virtual std::string
- addFilter(const std::string theFilterID) override;
+ FILTERS_EXPORT std::string addFilter(const std::string theFilterID) override;
/// Removes an existing filter from the feature.
- FILTERS_EXPORT virtual void
- removeFilter(const std::string theFilterID) override;
+ FILTERS_EXPORT void removeFilter(const std::string theFilterID) override;
/// Returns the list of existing filters in the feature.
- FILTERS_EXPORT virtual std::list<std::string> filters() const override;
+ FILTERS_EXPORT std::list<std::string> filters() const override;
/// Stores the reversed flag for the filter.
- FILTERS_EXPORT virtual void setReversed(const std::string theFilterID,
- const bool theReversed) override;
+ FILTERS_EXPORT void setReversed(const std::string theFilterID,
+ const bool theReversed) override;
/// Returns the reversed flag value for the filter.
- FILTERS_EXPORT virtual bool
- isReversed(const std::string theFilterID) override;
+ FILTERS_EXPORT bool isReversed(const std::string theFilterID) override;
/// Returns the ordered list of attributes related to the filter.
- FILTERS_EXPORT virtual std::list<AttributePtr>
+ FILTERS_EXPORT std::list<AttributePtr>
filterArgs(const std::string theFilterID) const override;
/// Sets the attribute (not-persistent field) that contains this filters
/// feature. The filter feature may make synchronization by this method call.
- FILTERS_EXPORT virtual void
- setAttribute(const AttributePtr &theAttr) override;
+ FILTERS_EXPORT void setAttribute(const AttributePtr &theAttr) override;
/// Returns the attribute (not-persistent field) that contains this filters
/// feature.
- FILTERS_EXPORT virtual const AttributePtr &baseAttribute() const override;
+ FILTERS_EXPORT const AttributePtr &baseAttribute() const override;
protected:
AttributePtr myBase; ///< the attribute related to this filter
// iterate on groups and find the one having the current filters feature
DocumentPtr aCurDoc = ModelAPI_Session::get()->activeDocument();
std::list<FeaturePtr> aFeatList = aCurDoc->allFeatures();
- for (std::list<FeaturePtr>::iterator anIt = aFeatList.begin();
- anIt != aFeatList.end(); ++anIt)
- if ((*anIt)->getKind() == CollectionPlugin_Group::ID()) {
+ for (auto &anIt : aFeatList)
+ if (anIt->getKind() == CollectionPlugin_Group::ID()) {
AttributeSelectionListPtr aSelList =
- (*anIt)->selectionList(CollectionPlugin_Group::LIST_ID());
+ anIt->selectionList(CollectionPlugin_Group::LIST_ID());
if (aSelList->filters() == aFilterFeature) {
TypeOfShape aType = shapeType(aSelList->selectionType());
if (isValidAttribute(theAttribute, aType, theError))
/// \param[in] theAttribute an attribute to check
/// \param[in] theArguments a filter parameters
/// \param[out] theError error message.
- FILTERS_EXPORT virtual bool
- isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ FILTERS_EXPORT bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
#endif
public:
FiltersPlugin_VerticalFace() : ModelAPI_Filter() {}
- virtual const std::string &name() const {
+ const std::string &name() const override {
static const std::string kName("Vertical faces");
return kName;
}
/// Returns true if the given shape type is supported
- virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override;
+ bool isSupported(GeomAPI_Shape::ShapeType theType) const override;
/// This method should contain the filter logic. It returns true if the given
/// shape is accepted by the filter. \param theShape the given shape \param
/// theArgs arguments of the filter
- virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &,
- const ModelAPI_FiltersArgs &theArgs) const override;
+ bool isOk(const GeomShapePtr &theShape, const ResultPtr &,
+ const ModelAPI_FiltersArgs &theArgs) const override;
};
#endif
public:
FiltersPlugin_VolumeSize() : ModelAPI_Filter() {}
- virtual const std::string &name() const {
+ const std::string &name() const override {
static const std::string kName("Volume size");
return kName;
}
/// Returns true for solid type
- virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override;
+ bool isSupported(GeomAPI_Shape::ShapeType theType) const override;
/// This method should contain the filter logic. It returns true if the given
/// shape is accepted by the filter. \param theShape the given shape \param
/// theArgs arguments of the filter
- virtual bool isOk(const GeomShapePtr &theShape, const ResultPtr &,
- const ModelAPI_FiltersArgs &theArgs) const override;
+ bool isOk(const GeomShapePtr &theShape, const ResultPtr &,
+ const ModelAPI_FiltersArgs &theArgs) const override;
/// Returns XML string which represents GUI of the filter
- virtual std::string xmlRepresentation() const override;
+ std::string xmlRepresentation() const override;
/// Initializes arguments of a filter.
- virtual void initAttributes(ModelAPI_FiltersArgs &theArguments) override;
+ void initAttributes(ModelAPI_FiltersArgs &theArguments) override;
};
#endif
}
//==================================================================================================
-GDMLAPI_ConeSegment::~GDMLAPI_ConeSegment() {}
+GDMLAPI_ConeSegment::~GDMLAPI_ConeSegment() = default;
//==================================================================================================
void GDMLAPI_ConeSegment::setAttributes(
/// Destructor.
GDMLAPI_EXPORT
- virtual ~GDMLAPI_ConeSegment();
+ ~GDMLAPI_ConeSegment() override;
INTERFACE_7(GDMLPlugin_ConeSegment::ID(), rmin1,
GDMLPlugin_ConeSegment::RMIN1_ID(), ModelAPI_AttributeDouble,
/// Dump wrapped feature
GDMLAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on primitive ConeSegment object
}
}
-GDMLAPI_Ellipsoid::~GDMLAPI_Ellipsoid() {}
+GDMLAPI_Ellipsoid::~GDMLAPI_Ellipsoid() = default;
void GDMLAPI_Ellipsoid::setSizes(const ModelHighAPI_Double &theAX,
const ModelHighAPI_Double &theBY,
/// Destructor.
GDMLAPI_EXPORT
- virtual ~GDMLAPI_Ellipsoid();
+ ~GDMLAPI_Ellipsoid() override;
INTERFACE_7(GDMLPlugin_Ellipsoid::ID(), ax, GDMLPlugin_Ellipsoid::AX_ID(),
ModelAPI_AttributeDouble,
/// Dump wrapped feature
GDMLAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on primitive Ellipsoid object
//=================================================================================================
GDMLPlugin_ConeSegment::GDMLPlugin_ConeSegment() // Nothing to do during
// instantiation
-{}
+ = default;
//=================================================================================================
void GDMLPlugin_ConeSegment::initAttributes() {
// Insert to faces
std::map<std::string, std::shared_ptr<GeomAPI_Shape>> listOfFaces =
theConeSegmentAlgo->getCreatedFaces();
- for (std::map<std::string, std::shared_ptr<GeomAPI_Shape>>::iterator it =
- listOfFaces.begin();
- it != listOfFaces.end(); ++it) {
- theResultConeSegment->generated((*it).second, (*it).first);
+ for (auto &listOfFace : listOfFaces) {
+ theResultConeSegment->generated(listOfFace.second, listOfFace.first);
}
}
}
/// Returns the kind of a feature
- GDMLPLUGIN_EXPORT virtual const std::string &getKind() {
+ GDMLPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = GDMLPlugin_ConeSegment::ID();
return MY_KIND;
}
/// Creates a new part document if needed
- GDMLPLUGIN_EXPORT virtual void execute();
+ GDMLPLUGIN_EXPORT void execute() override;
/// Request for initialization of data model of the feature: adding all
/// attributes
- GDMLPLUGIN_EXPORT virtual void initAttributes();
+ GDMLPLUGIN_EXPORT void initAttributes() override;
/// Use plugin manager for features creation
GDMLPlugin_ConeSegment();
//=================================================================================================
GDMLPlugin_Ellipsoid::GDMLPlugin_Ellipsoid() // Nothing to do during
// instantiation
-{}
+ = default;
//=================================================================================================
void GDMLPlugin_Ellipsoid::initAttributes() {
// Naming for faces and edges
std::map<std::string, std::shared_ptr<GeomAPI_Shape>> listOfFaces =
theEllipsoidAlgo->getCreatedFaces();
- for (std::map<std::string, std::shared_ptr<GeomAPI_Shape>>::iterator it =
- listOfFaces.begin();
- it != listOfFaces.end(); ++it) {
- theResultEllipsoid->generated((*it).second, (*it).first);
+ for (auto &listOfFace : listOfFaces) {
+ theResultEllipsoid->generated(listOfFace.second, listOfFace.first);
}
// Naming vertices
}
/// Returns the kind of a feature
- GDMLPLUGIN_EXPORT virtual const std::string &getKind() {
+ GDMLPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = GDMLPlugin_Ellipsoid::ID();
return MY_KIND;
}
/// Creates a new part document if needed
- GDMLPLUGIN_EXPORT virtual void execute();
+ GDMLPLUGIN_EXPORT void execute() override;
/// Request for initialization of data model of the feature: adding all
/// attributes
- GDMLPLUGIN_EXPORT virtual void initAttributes();
+ GDMLPLUGIN_EXPORT void initAttributes() override;
/// Use plugin manager for features creation
GDMLPlugin_Ellipsoid();
class GDMLPLUGIN_EXPORT GDMLPlugin_Plugin : public ModelAPI_Plugin {
public:
/// Creates the feature object of this plugin by the feature string ID
- virtual FeaturePtr createFeature(std::string theFeatureID);
+ FeaturePtr createFeature(std::string theFeatureID) override;
public:
/// Default constructor
if (!empty()) {
// This is necessary for correct deletion of Handle entity.
// Without this Handle does not decremented counter to 0
- Handle(AIS_InteractiveObject) *anAIS =
- implPtr<Handle(AIS_InteractiveObject)>();
+ auto *anAIS = implPtr<Handle(AIS_InteractiveObject)>();
anAIS->Nullify();
}
}
Handle(Prs3d_Drawer) aDrawer = anAIS->Attributes();
Handle(Prs3d_LineAspect) aLineAspect;
- Aspect_TypeOfLine aType = (Aspect_TypeOfLine)theStyle;
+ auto aType = (Aspect_TypeOfLine)theStyle;
if (aDrawer->HasOwnLineAspect()) {
aLineAspect = aDrawer->LineAspect();
}
const std::shared_ptr<GeomAPI_Edge> &theEdge2,
const std::shared_ptr<GeomAPI_Pnt> &thePoint) {
gp_Pnt aPoint = thePoint->impl<gp_Pnt>();
- const TopoDS_Edge &anEdge1 = theEdge1->impl<TopoDS_Edge>();
- const TopoDS_Edge &anEdge2 = theEdge2->impl<TopoDS_Edge>();
+ const auto &anEdge1 = theEdge1->impl<TopoDS_Edge>();
+ const auto &anEdge2 = theEdge2->impl<TopoDS_Edge>();
double aF1, aL1;
Handle(Geom_Curve) aCurve1 = BRep_Tool::Curve(anEdge1, aF1, aL1);
double aF2, aL2;
Handle(Geom_Curve) aCurve2 = BRep_Tool::Curve(anEdge2, aF2, aL2);
- AngleDirections *anAngle = new AngleDirections;
+ auto *anAngle = new AngleDirections;
gp_Pnt aP;
GeomAPI_ProjectPointOnCurve aProj1(aPoint, aCurve1);
gp_Pnt aPoint2 = thePoint2->impl<gp_Pnt>();
gp_Pnt aPoint3 = thePoint3->impl<gp_Pnt>();
- AngleDirections *anAngle = new AngleDirections;
+ auto *anAngle = new AngleDirections;
anAngle->myDir1.SetXYZ(aPoint1.XYZ() - aPoint2.XYZ());
anAngle->myDir2.SetXYZ(aPoint3.XYZ() - aPoint2.XYZ());
setImpl(anAngle);
double GeomAPI_Angle::angleDegree() { return angleRadian() * 180.0 / PI; }
double GeomAPI_Angle::angleRadian() {
- AngleDirections *anAngle = MY_ANGLE;
+ auto *anAngle = MY_ANGLE;
if (anAngle->myDir1.SquareMagnitude() < Precision::SquareConfusion() ||
anAngle->myDir2.SquareMagnitude() < Precision::SquareConfusion())
return 0.0;
newAngle(const std::shared_ptr<GeomAPI_Pnt2d> &theCenter,
const std::shared_ptr<GeomAPI_Pnt2d> &theFirst,
const std::shared_ptr<GeomAPI_Pnt2d> &theSecond) {
- ThreePoints2d *aResult = new ThreePoints2d;
+ auto *aResult = new ThreePoints2d;
aResult->myCenter = gp_Pnt2d(theCenter->x(), theCenter->y());
aResult->myFirst = gp_Pnt2d(theFirst->x(), theFirst->y());
aResult->mySecond = gp_Pnt2d(theSecond->x(), theSecond->y());
double GeomAPI_Angle2d::angleDegree() { return angleRadian() * 180.0 / PI; }
double GeomAPI_Angle2d::angleRadian() {
- ThreePoints2d *anAngle = MY_ANGLE;
+ auto *anAngle = MY_ANGLE;
gp_Dir2d aDir1(anAngle->myFirst.XY() - anAngle->myCenter.XY());
gp_Dir2d aDir2(anAngle->mySecond.XY() - anAngle->myCenter.XY());
return aDir1.Angle(aDir2);
};
//! Pointer on the object
-typedef std::shared_ptr<GeomAPI_Ax2> GeomAx2Ptr;
+using GeomAx2Ptr = std::shared_ptr<GeomAPI_Ax2>;
#endif
// additionally check the number of poles is greater than needed for th
// periodic B-spline
int aNbPoles = 0;
- std::list<int>::const_iterator it = theMults.begin();
+ auto it = theMults.begin();
for (++it; it != theMults.end(); ++it)
aNbPoles += *it;
if ((int)thePoles.size() > aNbPoles)
TColStd_Array1OfInteger aMults(1, (int)theMults.size());
int anIndex = 1;
- for (std::list<GeomPnt2dPtr>::const_iterator aPIt = thePoles.begin();
+ for (auto aPIt = thePoles.begin();
aPIt != thePoles.end() && anIndex <= aPoles.Upper(); ++aPIt, ++anIndex)
aPoles.SetValue(anIndex, gp_Pnt2d((*aPIt)->x(), (*aPIt)->y()));
anIndex = 1;
- for (std::list<double>::const_iterator aWIt = theWeights.begin();
+ for (auto aWIt = theWeights.begin();
aWIt != theWeights.end() && anIndex <= aWeights.Upper();
++aWIt, ++anIndex)
aWeights.SetValue(anIndex, *aWIt);
anIndex = 1;
- for (std::list<double>::const_iterator aKIt = theKnots.begin();
- aKIt != theKnots.end(); ++aKIt, ++anIndex)
+ for (auto aKIt = theKnots.begin(); aKIt != theKnots.end(); ++aKIt, ++anIndex)
aKnots.SetValue(anIndex, *aKIt);
anIndex = 1;
- for (std::list<int>::const_iterator aMIt = theMults.begin();
- aMIt != theMults.end(); ++aMIt, ++anIndex)
+ for (auto aMIt = theMults.begin(); aMIt != theMults.end(); ++aMIt, ++anIndex)
aMults.SetValue(anIndex, *aMIt);
Handle(Geom2d_BSplineCurve) aCurve = new Geom2d_BSplineCurve(
return std::list<int>(aBSplMults.begin(), aBSplMults.end());
}
-const bool
-GeomAPI_BSpline2d::parameter(const std::shared_ptr<GeomAPI_Pnt2d> thePoint,
- const double theTolerance,
- double &theParameter) const {
- const gp_Pnt2d &aPoint = thePoint->impl<gp_Pnt2d>();
+bool GeomAPI_BSpline2d::parameter(const std::shared_ptr<GeomAPI_Pnt2d> thePoint,
+ const double theTolerance,
+ double &theParameter) const {
+ const auto &aPoint = thePoint->impl<gp_Pnt2d>();
bool isOk = GeomLib_Tool::Parameter(MY_BSPLINE, aPoint, theTolerance,
theParameter) == Standard_True;
if (!isOk) {
/// \param[in] thePoint point of origin.
/// \param[in] theTolerance tolerance of computation.
/// \param[out] theParameter resulting parameter.
- GEOMAPI_EXPORT const bool
- parameter(const std::shared_ptr<GeomAPI_Pnt2d> thePoint,
- const double theTolerance, double &theParameter) const;
+ GEOMAPI_EXPORT bool parameter(const std::shared_ptr<GeomAPI_Pnt2d> thePoint,
+ const double theTolerance,
+ double &theParameter) const;
/// \brief Calculate point on B-spline curve accrding to the given parameter
GEOMAPI_EXPORT void D0(const double theU,
};
//! Pointer on the object
-typedef std::shared_ptr<GeomAPI_Box> GeomBoxPtr;
+using GeomBoxPtr = std::shared_ptr<GeomAPI_Box>;
#endif
Handle(Geom_Circle) aCircle = new Geom_Circle(*MY_CIRC);
- const gp_Pnt &aPoint = thePoint->impl<gp_Pnt>();
+ const auto &aPoint = thePoint->impl<gp_Pnt>();
GeomAPI_ProjectPointOnCurve aProj(aPoint, aCircle);
Standard_Integer aNbPoint = aProj.NbPoints();
double aRadius = aCenter.Distance(aPoint);
if (aCenter.IsEqual(aPoint, Precision::Confusion()))
- return NULL;
+ return nullptr;
gp_Dir2d aDir(thePointX - theCenterX, thePointY - theCenterY);
return aResult;
const gp_Pnt2d &aCenter = MY_CIRC2D->Location();
- const gp_Pnt2d &aPoint = thePoint->impl<gp_Pnt2d>();
+ const auto &aPoint = thePoint->impl<gp_Pnt2d>();
double aDist = aCenter.Distance(aPoint);
if (aDist < Precision::Confusion())
}
//=================================================================================================
-const bool
-GeomAPI_Circ2d::parameter(const std::shared_ptr<GeomAPI_Pnt2d> thePoint,
- const double theTolerance,
- double &theParameter) const {
+bool GeomAPI_Circ2d::parameter(const std::shared_ptr<GeomAPI_Pnt2d> thePoint,
+ const double theTolerance,
+ double &theParameter) const {
Handle(Geom2d_Circle) aCurve = new Geom2d_Circle(*MY_CIRC2D);
return GeomLib_Tool::Parameter(aCurve, thePoint->impl<gp_Pnt2d>(),
theTolerance, theParameter) == Standard_True;
* theTolerance tolerance of computation. \param[out] theParameter resulting
* parameter.
*/
- GEOMAPI_EXPORT const bool
- parameter(const std::shared_ptr<GeomAPI_Pnt2d> thePoint,
- const double theTolerance, double &theParameter) const;
+ GEOMAPI_EXPORT bool parameter(const std::shared_ptr<GeomAPI_Pnt2d> thePoint,
+ const double theTolerance,
+ double &theParameter) const;
/** \brief Returns in thePoint the point of parameter theU.
* P = C + R * Cos (U) * XDir + R * Sin (U) * YDir where C is the center of
};
//! Pointer on the object
-typedef std::shared_ptr<GeomAPI_Cone> GeomConePtr;
+using GeomConePtr = std::shared_ptr<GeomAPI_Cone>;
#endif
GeomAPI_Curve::GeomAPI_Curve(const std::shared_ptr<GeomAPI_Shape> &theShape)
: GeomAPI_Interface(new Handle_Geom_Curve()) // initially it is null
{
- const TopoDS_Shape &aShape = theShape->impl<TopoDS_Shape>();
+ const auto &aShape = theShape->impl<TopoDS_Shape>();
TopoDS_Edge anEdge = TopoDS::Edge(aShape);
if (!anEdge.IsNull()) {
Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, myStart, myEnd);
if (MY_CURVE.IsNull())
return aResult;
- const gp_Pnt &aPoint = thePoint->impl<gp_Pnt>();
+ const auto &aPoint = thePoint->impl<gp_Pnt>();
GeomAPI_ProjectPointOnCurve aProj(aPoint, MY_CURVE);
Standard_Integer aNbPoint = aProj.NbPoints();
bool GeomAPI_Curve::Comparator::operator()(
const GeomCurvePtr &theCurve1, const GeomCurvePtr &theCurve2) const {
- const Handle(Geom_Curve) &aCurve1 = theCurve1->impl<Handle_Geom_Curve>();
- const Handle(Geom_Curve) &aCurve2 = theCurve2->impl<Handle_Geom_Curve>();
+ const auto &aCurve1 = theCurve1->impl<Handle_Geom_Curve>();
+ const auto &aCurve2 = theCurve2->impl<Handle_Geom_Curve>();
return aCurve1.get() < aCurve2.get();
}
if (!theCylinder)
return false;
- gp_Cylinder *anOther = theCylinder->implPtr<gp_Cylinder>();
+ auto *anOther = theCylinder->implPtr<gp_Cylinder>();
if (fabs(MY_CYL->Radius() - anOther->Radius()) < theTolerance) {
gp_Dir aDir1 = MY_CYL->Position().Direction();
gp_Dir aDir2 = anOther->Position().Direction();
};
//! Pointer on the object
-typedef std::shared_ptr<GeomAPI_Cylinder> GeomCylinderPtr;
+using GeomCylinderPtr = std::shared_ptr<GeomAPI_Cylinder>;
#endif
//=================================================================================================
bool GeomAPI_DataMapOfShapeMapOfShapes::bind(
const std::shared_ptr<GeomAPI_Shape> theKey, const ListOfShape &theItems) {
- const TopoDS_Shape &aKey = theKey->impl<TopoDS_Shape>();
+ const auto &aKey = theKey->impl<TopoDS_Shape>();
if (MY_MAP->IsBound(aKey)) {
MY_MAP->ChangeFind(aKey).Clear();
}
- for (ListOfShape::const_iterator anIt = theItems.cbegin();
- anIt != theItems.cend(); anIt++) {
- const TopoDS_Shape &anItem = (*anIt)->impl<TopoDS_Shape>();
+ for (const auto &theItem : theItems) {
+ const auto &anItem = theItem->impl<TopoDS_Shape>();
if (MY_MAP->IsBound(aKey)) {
MY_MAP->ChangeFind(aKey).Add(anItem);
} else {
bool GeomAPI_DataMapOfShapeMapOfShapes::add(
const std::shared_ptr<GeomAPI_Shape> theKey,
const std::shared_ptr<GeomAPI_Shape> theItem) {
- const TopoDS_Shape &aKey = theKey->impl<TopoDS_Shape>();
- const TopoDS_Shape &anItem = theItem->impl<TopoDS_Shape>();
+ const auto &aKey = theKey->impl<TopoDS_Shape>();
+ const auto &anItem = theItem->impl<TopoDS_Shape>();
if (MY_MAP->IsBound(aKey)) {
return MY_MAP->ChangeFind(aKey).Add(anItem) == Standard_True;
} else {
//=================================================================================================
bool GeomAPI_DataMapOfShapeMapOfShapes::isBound(
const std::shared_ptr<GeomAPI_Shape> theKey) const {
- const TopoDS_Shape &aKey = theKey->impl<TopoDS_Shape>();
+ const auto &aKey = theKey->impl<TopoDS_Shape>();
return MY_MAP->IsBound(aKey) == Standard_True;
}
//=================================================================================================
bool GeomAPI_DataMapOfShapeMapOfShapes::find(
const std::shared_ptr<GeomAPI_Shape> theKey, ListOfShape &theItems) const {
- const TopoDS_Shape &aKey = theKey->impl<TopoDS_Shape>();
+ const auto &aKey = theKey->impl<TopoDS_Shape>();
if (MY_MAP->IsBound(aKey) == Standard_False) {
return false;
//=================================================================================================
bool GeomAPI_DataMapOfShapeMapOfShapes::unBind(
const std::shared_ptr<GeomAPI_Shape> theKey) {
- const TopoDS_Shape &aKey = theKey->impl<TopoDS_Shape>();
+ const auto &aKey = theKey->impl<TopoDS_Shape>();
return MY_MAP->UnBind(aKey) == Standard_True;
}
class IteratorImpl : public GeomAPI_DataMapOfShapeMapOfShapes::iterator {
public:
- IteratorImpl() {}
+ IteratorImpl() = default;
IteratorImpl(const MAP::Iterator &theIterator) : myIterator(theIterator) {}
return !myIterator.More();
}
- virtual iterator &operator++() {
+ iterator &operator++() override {
myIterator.Next();
return *this;
}
- virtual iterator operator++(int) {
+ iterator operator++(int) override {
std::shared_ptr<IteratorImpl> aSelf =
std::dynamic_pointer_cast<IteratorImpl>(mySelf);
std::shared_ptr<IteratorImpl> aCopy(new IteratorImpl(aSelf->myIterator));
return IteratorImpl(aCopy);
}
- virtual key_type first() const {
+ key_type first() const override {
if (mySelf)
return iterator::first();
return aShape;
}
- virtual mapped_type second() const {
+ mapped_type second() const override {
if (mySelf)
return iterator::second();
MAP::Iterator myIterator;
};
-GeomAPI_DataMapOfShapeMapOfShapes::iterator::iterator() {}
+GeomAPI_DataMapOfShapeMapOfShapes::iterator::iterator() = default;
GeomAPI_DataMapOfShapeMapOfShapes::iterator::iterator(
- const GeomAPI_DataMapOfShapeMapOfShapes::iterator &theOther)
- : mySelf(theOther.mySelf) {}
+ const GeomAPI_DataMapOfShapeMapOfShapes::iterator &theOther) = default;
const GeomAPI_DataMapOfShapeMapOfShapes::iterator &
GeomAPI_DataMapOfShapeMapOfShapes::iterator::operator=(
void GeomAPI_DataMapOfShapeShape::merge(
const GeomAPI_DataMapOfShapeShape &theDataMap) {
- const TopTools_DataMapOfShapeShape &aDataMap =
- theDataMap.impl<TopTools_DataMapOfShapeShape>();
- TopTools_DataMapOfShapeShape *myDataMap =
- implPtr<TopTools_DataMapOfShapeShape>();
+ const auto &aDataMap = theDataMap.impl<TopTools_DataMapOfShapeShape>();
+ auto *myDataMap = implPtr<TopTools_DataMapOfShapeShape>();
for (TopTools_DataMapIteratorOfDataMapOfShapeShape anIt(aDataMap);
anIt.More(); anIt.Next()) {
myDataMap->Bind(anIt.Key(), anIt.Value());
};
//! Pointer on the object
-typedef std::shared_ptr<GeomAPI_Dir2d> GeomDir2dPtr;
+using GeomDir2dPtr = std::shared_ptr<GeomAPI_Dir2d>;
#endif
#include <GCPnts_AbscissaPoint.hxx>
GeomAPI_Edge::GeomAPI_Edge() {
- TopoDS_Edge *anEdge = new TopoDS_Edge;
+ auto *anEdge = new TopoDS_Edge;
BRep_Builder aBuilder;
aBuilder.MakeEdge(*anEdge);
void GeomAPI_Edge::vertices(
std::shared_ptr<GeomAPI_Vertex> &theStartVertex,
std::shared_ptr<GeomAPI_Vertex> &theEndVertex) const {
- const TopoDS_Edge &anEdge = impl<TopoDS_Edge>();
+ const auto &anEdge = impl<TopoDS_Edge>();
TopoDS_Vertex aStart, aEnd;
TopExp::Vertices(anEdge, aStart, aEnd);
theStartVertex.reset(new GeomAPI_Vertex);
}
bool GeomAPI_Edge::isLine() const {
- const TopoDS_Shape &aShape =
- const_cast<GeomAPI_Edge *>(this)->impl<TopoDS_Shape>();
+ const auto &aShape = const_cast<GeomAPI_Edge *>(this)->impl<TopoDS_Shape>();
double aFirst, aLast;
Handle(Geom_Curve) aCurve =
BRep_Tool::Curve((const TopoDS_Edge &)aShape, aFirst, aLast);
}
bool GeomAPI_Edge::isCircle() const {
- const TopoDS_Shape &aShape =
- const_cast<GeomAPI_Edge *>(this)->impl<TopoDS_Shape>();
+ const auto &aShape = const_cast<GeomAPI_Edge *>(this)->impl<TopoDS_Shape>();
double aFirst, aLast;
Handle(Geom_Curve) aCurve =
BRep_Tool::Curve((const TopoDS_Edge &)aShape, aFirst, aLast);
}
bool GeomAPI_Edge::isArc() const {
- const TopoDS_Shape &aShape =
- const_cast<GeomAPI_Edge *>(this)->impl<TopoDS_Shape>();
+ const auto &aShape = const_cast<GeomAPI_Edge *>(this)->impl<TopoDS_Shape>();
double aFirst, aLast;
Handle(Geom_Curve) aCurve =
BRep_Tool::Curve((const TopoDS_Edge &)aShape, aFirst, aLast);
}
bool GeomAPI_Edge::isEllipse() const {
- const TopoDS_Shape &aShape =
- const_cast<GeomAPI_Edge *>(this)->impl<TopoDS_Shape>();
+ const auto &aShape = const_cast<GeomAPI_Edge *>(this)->impl<TopoDS_Shape>();
double aFirst, aLast;
Handle(Geom_Curve) aCurve =
BRep_Tool::Curve((const TopoDS_Edge &)aShape, aFirst, aLast);
}
bool GeomAPI_Edge::isBSpline() const {
- const TopoDS_Shape &aShape =
- const_cast<GeomAPI_Edge *>(this)->impl<TopoDS_Shape>();
+ const auto &aShape = const_cast<GeomAPI_Edge *>(this)->impl<TopoDS_Shape>();
double aFirst, aLast;
Handle(Geom_Curve) aCurve =
BRep_Tool::Curve((const TopoDS_Edge &)aShape, aFirst, aLast);
}
std::shared_ptr<GeomAPI_Pnt> GeomAPI_Edge::firstPoint() {
- const TopoDS_Shape &aShape =
- const_cast<GeomAPI_Edge *>(this)->impl<TopoDS_Shape>();
+ const auto &aShape = const_cast<GeomAPI_Edge *>(this)->impl<TopoDS_Shape>();
double aFirst, aLast;
Handle(Geom_Curve) aCurve =
BRep_Tool::Curve((const TopoDS_Edge &)aShape, aFirst, aLast);
}
std::shared_ptr<GeomAPI_Pnt> GeomAPI_Edge::lastPoint() {
- const TopoDS_Shape &aShape =
- const_cast<GeomAPI_Edge *>(this)->impl<TopoDS_Shape>();
+ const auto &aShape = const_cast<GeomAPI_Edge *>(this)->impl<TopoDS_Shape>();
double aFirst, aLast;
Handle(Geom_Curve) aCurve =
BRep_Tool::Curve((const TopoDS_Edge &)aShape, aFirst, aLast);
}
std::shared_ptr<GeomAPI_Circ> GeomAPI_Edge::circle() const {
- const TopoDS_Shape &aShape =
- const_cast<GeomAPI_Edge *>(this)->impl<TopoDS_Shape>();
+ const auto &aShape = const_cast<GeomAPI_Edge *>(this)->impl<TopoDS_Shape>();
double aFirst, aLast;
Handle(Geom_Curve) aCurve =
BRep_Tool::Curve((const TopoDS_Edge &)aShape, aFirst, aLast);
}
std::shared_ptr<GeomAPI_Ellipse> GeomAPI_Edge::ellipse() const {
- const TopoDS_Shape &aShape =
- const_cast<GeomAPI_Edge *>(this)->impl<TopoDS_Shape>();
+ const auto &aShape = const_cast<GeomAPI_Edge *>(this)->impl<TopoDS_Shape>();
double aFirst, aLast;
Handle(Geom_Curve) aCurve =
BRep_Tool::Curve((const TopoDS_Edge &)aShape, aFirst, aLast);
}
std::shared_ptr<GeomAPI_Lin> GeomAPI_Edge::line() const {
- const TopoDS_Shape &aShape =
- const_cast<GeomAPI_Edge *>(this)->impl<TopoDS_Shape>();
+ const auto &aShape = const_cast<GeomAPI_Edge *>(this)->impl<TopoDS_Shape>();
double aFirst, aLast;
Handle(Geom_Curve) aCurve =
BRep_Tool::Curve((const TopoDS_Edge &)aShape, aFirst, aLast);
bool GeomAPI_Edge::isEqual(const std::shared_ptr<GeomAPI_Shape> theEdge) const {
if (!theEdge.get() || !theEdge->isEdge())
return false;
- const TopoDS_Shape &aMyShape =
- const_cast<GeomAPI_Edge *>(this)->impl<TopoDS_Shape>();
- const TopoDS_Shape &aInShape = theEdge->impl<TopoDS_Shape>();
+ const auto &aMyShape = const_cast<GeomAPI_Edge *>(this)->impl<TopoDS_Shape>();
+ const auto &aInShape = theEdge->impl<TopoDS_Shape>();
if (aMyShape.IsNull() || aInShape.IsNull())
return false;
}
void GeomAPI_Edge::getRange(double &theFirst, double &theLast) const {
- const TopoDS_Shape &aShape =
- const_cast<GeomAPI_Edge *>(this)->impl<TopoDS_Shape>();
+ const auto &aShape = const_cast<GeomAPI_Edge *>(this)->impl<TopoDS_Shape>();
Handle(Geom_Curve) aCurve =
BRep_Tool::Curve((const TopoDS_Edge &)aShape, theFirst, theLast);
}
// LCOV_EXCL_START
bool GeomAPI_Edge::isInPlane(std::shared_ptr<GeomAPI_Pln> thePlane) const {
double aFirst, aLast;
- const TopoDS_Shape &aShape =
- const_cast<GeomAPI_Edge *>(this)->impl<TopoDS_Shape>();
+ const auto &aShape = const_cast<GeomAPI_Edge *>(this)->impl<TopoDS_Shape>();
Handle(Geom_Curve) aCurve =
BRep_Tool::Curve((const TopoDS_Edge &)aShape, aFirst, aLast);
if (aCurve.IsNull())
const std::shared_ptr<GeomAPI_Pln> thePlane,
std::list<std::shared_ptr<GeomAPI_Pnt>> &theResult) const {
double aFirst, aLast;
- const TopoDS_Shape &aShape =
- const_cast<GeomAPI_Edge *>(this)->impl<TopoDS_Shape>();
+ const auto &aShape = const_cast<GeomAPI_Edge *>(this)->impl<TopoDS_Shape>();
Handle(Geom_Curve) aCurve =
BRep_Tool::Curve((const TopoDS_Edge &)aShape, aFirst, aLast);
if (!aCurve.IsNull()) {
}
bool GeomAPI_Edge::isClosed() const {
- const TopoDS_Shape &aShape =
- const_cast<GeomAPI_Edge *>(this)->impl<TopoDS_Shape>();
+ const auto &aShape = const_cast<GeomAPI_Edge *>(this)->impl<TopoDS_Shape>();
if (aShape.IsNull())
return false;
double aFirst, aLast;
}
bool GeomAPI_Edge::isDegenerated() const {
- const TopoDS_Shape &aShape =
- const_cast<GeomAPI_Edge *>(this)->impl<TopoDS_Shape>();
+ const auto &aShape = const_cast<GeomAPI_Edge *>(this)->impl<TopoDS_Shape>();
if (aShape.IsNull() || aShape.ShapeType() != TopAbs_EDGE)
return false;
return BRep_Tool::Degenerated(TopoDS::Edge(aShape));
GeomPointPtr GeomAPI_Edge::middlePoint() const {
GeomPointPtr aMiddlePoint;
- const TopoDS_Edge &anEdge = impl<TopoDS_Edge>();
+ const auto &anEdge = impl<TopoDS_Edge>();
if (anEdge.IsNull())
return aMiddlePoint;
double aFirst, aLast;
Handle(Geom_Ellipse) aEllipse = new Geom_Ellipse(*MY_ELIPS);
- const gp_Pnt &aPoint = thePoint->impl<gp_Pnt>();
+ const auto &aPoint = thePoint->impl<gp_Pnt>();
GeomAPI_ProjectPointOnCurve aProj(aPoint, aEllipse);
Standard_Integer aNbPoint = aProj.NbPoints();
return aResult;
}
-const bool
-GeomAPI_Ellipse::parameter(const std::shared_ptr<GeomAPI_Pnt> thePoint,
- const double theTolerance,
- double &theParameter) const {
+bool GeomAPI_Ellipse::parameter(const std::shared_ptr<GeomAPI_Pnt> thePoint,
+ const double theTolerance,
+ double &theParameter) const {
Handle(Geom_Ellipse) aCurve = new Geom_Ellipse(*MY_ELIPS);
return GeomLib_Tool::Parameter(aCurve, thePoint->impl<gp_Pnt>(), theTolerance,
theParameter) == Standard_True;
* theTolerance tolerance of computation. \param[out] theParameter resulting
* parameter.
*/
- GEOMAPI_EXPORT const bool
- parameter(const std::shared_ptr<GeomAPI_Pnt> thePoint,
- const double theTolerance, double &theParameter) const;
+ GEOMAPI_EXPORT bool parameter(const std::shared_ptr<GeomAPI_Pnt> thePoint,
+ const double theTolerance,
+ double &theParameter) const;
};
//! Pointer on the object
newEllipse(const std::shared_ptr<GeomAPI_Pnt2d> &theCenter,
const std::shared_ptr<GeomAPI_Pnt2d> &theAxisPoint,
const std::shared_ptr<GeomAPI_Pnt2d> &thePassingPoint) {
- const gp_Pnt2d &aCenter = theCenter->impl<gp_Pnt2d>();
- const gp_Pnt2d &anAxisPnt = theAxisPoint->impl<gp_Pnt2d>();
- const gp_Pnt2d &aPassedPnt = thePassingPoint->impl<gp_Pnt2d>();
+ const auto &aCenter = theCenter->impl<gp_Pnt2d>();
+ const auto &anAxisPnt = theAxisPoint->impl<gp_Pnt2d>();
+ const auto &aPassedPnt = thePassingPoint->impl<gp_Pnt2d>();
gp_Dir2d aXAxis(anAxisPnt.XY() - aCenter.XY());
double aMajorRadius = anAxisPnt.Distance(aCenter);
double X = aPassedDir.Dot(aXAxis.XY()) / aMajorRadius;
if (Abs(X) > 1.0 - Precision::Confusion())
- return 0; // ellipse cannot be created for such parameters
+ return nullptr; // ellipse cannot be created for such parameters
double Y = aPassedDir.CrossMagnitude(aXAxis.XY());
double aMinorRadius = Y / Sqrt(1. - X * X);
IntAna2d_AnaIntersection anInter(theEllipse->impl<gp_Elips2d>(),
IntAna2d_Conic(*MY_ELLIPSE));
- Extrema_ExtCC2d *anExtema = new Extrema_ExtCC2d(
- Geom2dAdaptor_Curve(anEllipse1), Geom2dAdaptor_Curve(anEllipse2));
+ auto *anExtema = new Extrema_ExtCC2d(Geom2dAdaptor_Curve(anEllipse1),
+ Geom2dAdaptor_Curve(anEllipse2));
double aDistance = extrema(&anInter, anExtema, theEllipse->firstFocus(),
thePointOnEllipse, thePointOnMe);
delete anExtema;
Handle(Geom2d_Ellipse) aEllipse = new Geom2d_Ellipse(*MY_ELLIPSE);
- const gp_Pnt2d &aPoint = thePoint->impl<gp_Pnt2d>();
+ const auto &aPoint = thePoint->impl<gp_Pnt2d>();
Geom2dAPI_ProjectPointOnCurve aProj(aPoint, aEllipse);
Standard_Integer aNbPoint = aProj.NbPoints();
return aResult;
}
-const bool
-GeomAPI_Ellipse2d::parameter(const std::shared_ptr<GeomAPI_Pnt2d> thePoint,
- const double theTolerance,
- double &theParameter) const {
+bool GeomAPI_Ellipse2d::parameter(const std::shared_ptr<GeomAPI_Pnt2d> thePoint,
+ const double theTolerance,
+ double &theParameter) const {
Handle(Geom2d_Ellipse) aCurve = new Geom2d_Ellipse(*MY_ELLIPSE);
return GeomLib_Tool::Parameter(aCurve, thePoint->impl<gp_Pnt2d>(),
theTolerance, theParameter) == Standard_True;
* theTolerance tolerance of computation. \param[out] theParameter resulting
* parameter.
*/
- GEOMAPI_EXPORT const bool
- parameter(const std::shared_ptr<GeomAPI_Pnt2d> thePoint,
- const double theTolerance, double &theParameter) const;
+ GEOMAPI_EXPORT bool parameter(const std::shared_ptr<GeomAPI_Pnt2d> thePoint,
+ const double theTolerance,
+ double &theParameter) const;
/// Calculate minimal distance between the ellipse and a line.
/// Return corresponding points on the ellipse and on the line.
if (!theFace->isFace())
return false;
- const TopoDS_Shape &aMyShape =
- const_cast<GeomAPI_Face *>(this)->impl<TopoDS_Shape>();
- const TopoDS_Shape &aInShape = theFace->impl<TopoDS_Shape>();
+ const auto &aMyShape = const_cast<GeomAPI_Face *>(this)->impl<TopoDS_Shape>();
+ const auto &aInShape = theFace->impl<TopoDS_Shape>();
TopoDS_Face aMyFace = TopoDS::Face(aMyShape);
TopoDS_Face aInFace = TopoDS::Face(aInShape);
}
bool GeomAPI_Face::isCylindrical() const {
- const TopoDS_Shape &aShape =
- const_cast<GeomAPI_Face *>(this)->impl<TopoDS_Shape>();
+ const auto &aShape = const_cast<GeomAPI_Face *>(this)->impl<TopoDS_Shape>();
Handle(Geom_Surface) aSurf = BRep_Tool::Surface(TopoDS::Face(aShape));
Handle(Geom_RectangularTrimmedSurface) aTrimmed =
Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurf);
GeomPointPtr GeomAPI_Face::middlePoint() const {
GeomPointPtr anInnerPoint;
- const TopoDS_Face &aFace = impl<TopoDS_Face>();
+ const auto &aFace = impl<TopoDS_Face>();
if (aFace.IsNull())
return anInnerPoint;
#include <GeomAPI_ICustomPrs.h>
-GeomAPI_ICustomPrs::~GeomAPI_ICustomPrs() {}
+GeomAPI_ICustomPrs::~GeomAPI_ICustomPrs() = default;
#include "GeomAPI_IPresentable.h"
-GeomAPI_IPresentable::~GeomAPI_IPresentable() {}
+GeomAPI_IPresentable::~GeomAPI_IPresentable() = default;
*/
class GeomAPI_IScreenParams {
public:
- virtual ~GeomAPI_IScreenParams() {}
+ virtual ~GeomAPI_IScreenParams() = default;
/**
* Set plane of active view screen
virtual void setViewScale(double theScale) = 0;
};
-typedef std::shared_ptr<GeomAPI_IScreenParams> GeomScreenParamsPtr;
+using GeomScreenParamsPtr = std::shared_ptr<GeomAPI_IScreenParams>;
#endif
#include <GeomAPI_Interface.h>
-GeomAPI_Interface::GeomAPI_Interface() {}
+GeomAPI_Interface::GeomAPI_Interface() = default;
-GeomAPI_Interface::~GeomAPI_Interface() {}
+GeomAPI_Interface::~GeomAPI_Interface() = default;
-bool GeomAPI_Interface::empty() const { return myImpl.get() == 0; }
+bool GeomAPI_Interface::empty() const { return myImpl.get() == nullptr; }
}
void GeomAPI_PlanarEdges::addEdge(std::shared_ptr<GeomAPI_Shape> theEdge) {
- const TopoDS_Edge &anEdge = theEdge->impl<TopoDS_Edge>();
+ const auto &anEdge = theEdge->impl<TopoDS_Edge>();
if (anEdge.ShapeType() != TopAbs_EDGE)
return;
- TopoDS_Shape &aWire = const_cast<TopoDS_Shape &>(impl<TopoDS_Shape>());
+ auto &aWire = const_cast<TopoDS_Shape &>(impl<TopoDS_Shape>());
BRep_Builder aBuilder;
aBuilder.Add(aWire, anEdge);
}
std::list<std::shared_ptr<GeomAPI_Shape>> GeomAPI_PlanarEdges::getEdges() {
- TopoDS_Shape &aShape = const_cast<TopoDS_Shape &>(impl<TopoDS_Shape>());
+ auto &aShape = const_cast<TopoDS_Shape &>(impl<TopoDS_Shape>());
TopExp_Explorer aWireExp(aShape, TopAbs_EDGE);
std::list<std::shared_ptr<GeomAPI_Shape>> aResult;
for (; aWireExp.More(); aWireExp.Next()) {
return aResult;
}
-bool GeomAPI_PlanarEdges::hasPlane() const { return myPlane.get() != NULL; }
+bool GeomAPI_PlanarEdges::hasPlane() const { return myPlane.get() != nullptr; }
bool GeomAPI_PlanarEdges::isVertex() const { return false; }
const std::shared_ptr<GeomAPI_Shape> theShape) const {
if (!theShape.get())
return false;
- TopoDS_Shape &aMyShape = const_cast<TopoDS_Shape &>(impl<TopoDS_Shape>());
+ auto &aMyShape = const_cast<TopoDS_Shape &>(impl<TopoDS_Shape>());
TopoDS_Shape aTheShape = theShape->impl<TopoDS_Shape>();
if (aMyShape.ShapeType() !=
aTheShape.ShapeType()) // to don't confuse by the face of same edges
GEOMAPI_EXPORT GeomAPI_PlanarEdges();
/// Returns whether the shape is alone vertex
- GEOMAPI_EXPORT virtual bool isVertex() const;
+ GEOMAPI_EXPORT bool isVertex() const override;
/// Returns whether the shape is alone edge
- GEOMAPI_EXPORT virtual bool isEdge() const;
+ GEOMAPI_EXPORT bool isEdge() const override;
/// Appends the edge to the set
GEOMAPI_EXPORT void addEdge(std::shared_ptr<GeomAPI_Shape> theEdge);
/// Returns the list of edges in this interface
GEOMAPI_EXPORT std::shared_ptr<GeomAPI_Dir> norm() const;
/// Returns whether the shape is planar
- GEOMAPI_EXPORT virtual bool isPlanar() const;
+ GEOMAPI_EXPORT bool isPlanar() const override;
/// Set working plane
/// \param theOrigin origin of the plane axis
/// Returns whether the shapes are equal
GEOMAPI_EXPORT
- virtual bool isEqual(const std::shared_ptr<GeomAPI_Shape> theShape) const;
+ bool isEqual(const std::shared_ptr<GeomAPI_Shape> theShape) const override;
private:
std::shared_ptr<GeomAPI_Ax3> myPlane;
return false;
}
- const gp_Pln &aMyPln = impl<gp_Pln>();
- const gp_Pln &anOtherPln = thePlane->impl<gp_Pln>();
+ const auto &aMyPln = impl<gp_Pln>();
+ const auto &anOtherPln = thePlane->impl<gp_Pln>();
return (aMyPln.Contains(anOtherPln.Location(), theTolerance) &&
aMyPln.Axis().IsParallel(anOtherPln.Axis(), theTolerance));
}
double
GeomAPI_Pln::distance(const std::shared_ptr<GeomAPI_Pln> thePlane) const {
- const gp_Pln &aMyPln = impl<gp_Pln>();
- const gp_Pln &anOtherPln = thePlane->impl<gp_Pln>();
+ const auto &aMyPln = impl<gp_Pln>();
+ const auto &anOtherPln = thePlane->impl<gp_Pln>();
return aMyPln.Distance(anOtherPln);
}
double
GeomAPI_Pln::distance(const std::shared_ptr<GeomAPI_Pnt> thePoint) const {
- const gp_Pln &aMyPln = impl<gp_Pln>();
- const gp_Pnt &aPnt = thePoint->impl<gp_Pnt>();
+ const auto &aMyPln = impl<gp_Pln>();
+ const auto &aPnt = thePoint->impl<gp_Pnt>();
return aMyPln.Distance(aPnt);
}
return aRes;
}
- const gp_Pln &aMyPln = impl<gp_Pln>();
- const gp_Pln &anOtherPln = thePlane->impl<gp_Pln>();
+ const auto &aMyPln = impl<gp_Pln>();
+ const auto &anOtherPln = thePlane->impl<gp_Pln>();
IntAna_QuadQuadGeo aQuad(aMyPln, anOtherPln, Precision::Confusion(),
Precision::Confusion());
}
bool GeomAPI_Shape::isVertex() const {
- const TopoDS_Shape &aShape =
- const_cast<GeomAPI_Shape *>(this)->impl<TopoDS_Shape>();
+ const auto &aShape = const_cast<GeomAPI_Shape *>(this)->impl<TopoDS_Shape>();
return !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX;
}
bool GeomAPI_Shape::isEdge() const {
- const TopoDS_Shape &aShape =
- const_cast<GeomAPI_Shape *>(this)->impl<TopoDS_Shape>();
+ const auto &aShape = const_cast<GeomAPI_Shape *>(this)->impl<TopoDS_Shape>();
return !aShape.IsNull() && aShape.ShapeType() == TopAbs_EDGE;
}
bool GeomAPI_Shape::isWire() const {
- const TopoDS_Shape &aShape =
- const_cast<GeomAPI_Shape *>(this)->impl<TopoDS_Shape>();
+ const auto &aShape = const_cast<GeomAPI_Shape *>(this)->impl<TopoDS_Shape>();
return !aShape.IsNull() && aShape.ShapeType() == TopAbs_WIRE;
}
bool GeomAPI_Shape::isFace() const {
- const TopoDS_Shape &aShape =
- const_cast<GeomAPI_Shape *>(this)->impl<TopoDS_Shape>();
+ const auto &aShape = const_cast<GeomAPI_Shape *>(this)->impl<TopoDS_Shape>();
return !aShape.IsNull() && aShape.ShapeType() == TopAbs_FACE;
}
bool GeomAPI_Shape::isShell() const {
- const TopoDS_Shape &aShape =
- const_cast<GeomAPI_Shape *>(this)->impl<TopoDS_Shape>();
+ const auto &aShape = const_cast<GeomAPI_Shape *>(this)->impl<TopoDS_Shape>();
return !aShape.IsNull() && aShape.ShapeType() == TopAbs_SHELL;
}
bool GeomAPI_Shape::isCompound() const {
- const TopoDS_Shape &aShape =
- const_cast<GeomAPI_Shape *>(this)->impl<TopoDS_Shape>();
+ const auto &aShape = const_cast<GeomAPI_Shape *>(this)->impl<TopoDS_Shape>();
return !aShape.IsNull() && aShape.ShapeType() == TopAbs_COMPOUND;
}
bool GeomAPI_Shape::isCollectionOfSolids() const {
- const TopoDS_Shape &aShape =
- const_cast<GeomAPI_Shape *>(this)->impl<TopoDS_Shape>();
+ const auto &aShape = const_cast<GeomAPI_Shape *>(this)->impl<TopoDS_Shape>();
if (aShape.IsNull())
return false;
}
bool GeomAPI_Shape::isCompoundOfSolids() const {
- const TopoDS_Shape &aShape =
- const_cast<GeomAPI_Shape *>(this)->impl<TopoDS_Shape>();
+ const auto &aShape = const_cast<GeomAPI_Shape *>(this)->impl<TopoDS_Shape>();
if (aShape.IsNull() || aShape.ShapeType() != TopAbs_COMPOUND)
return false;
bool isAtLeastOne = false;
// LCOV_EXCL_START
GeomAPI_Shape::ShapeType GeomAPI_Shape::typeOfCompoundShapes() const {
- const TopoDS_Shape &aShape =
- const_cast<GeomAPI_Shape *>(this)->impl<TopoDS_Shape>();
+ const auto &aShape = const_cast<GeomAPI_Shape *>(this)->impl<TopoDS_Shape>();
if (aShape.IsNull() || aShape.ShapeType() != TopAbs_COMPOUND)
return SHAPE;
int aType = -1;
}
bool GeomAPI_Shape::isConnectedTopology() const {
- const TopoDS_Shape &aShape =
- const_cast<GeomAPI_Shape *>(this)->impl<TopoDS_Shape>();
+ const auto &aShape = const_cast<GeomAPI_Shape *>(this)->impl<TopoDS_Shape>();
if (aShape.IsNull() || aShape.ShapeType() != TopAbs_COMPOUND)
return false;
// list of simple elements that are not detected in connection to others
}
bool GeomAPI_Shape::isSolid() const {
- const TopoDS_Shape &aShape =
- const_cast<GeomAPI_Shape *>(this)->impl<TopoDS_Shape>();
+ const auto &aShape = const_cast<GeomAPI_Shape *>(this)->impl<TopoDS_Shape>();
return !aShape.IsNull() && aShape.ShapeType() == TopAbs_SOLID;
}
bool GeomAPI_Shape::isCompSolid() const {
- const TopoDS_Shape &aShape =
- const_cast<GeomAPI_Shape *>(this)->impl<TopoDS_Shape>();
+ const auto &aShape = const_cast<GeomAPI_Shape *>(this)->impl<TopoDS_Shape>();
return !aShape.IsNull() && aShape.ShapeType() == TopAbs_COMPSOLID;
}
std::shared_ptr<GeomAPI_Vertex> GeomAPI_Shape::vertex() const {
GeomVertexPtr aVertex;
if (isVertex()) {
- const TopoDS_Shape &aShape =
+ const auto &aShape =
const_cast<GeomAPI_Shape *>(this)->impl<TopoDS_Shape>();
aVertex = GeomVertexPtr(new GeomAPI_Vertex);
aVertex->setImpl(new TopoDS_Shape(aShape));
std::shared_ptr<GeomAPI_Edge> GeomAPI_Shape::edge() const {
GeomEdgePtr anEdge;
if (isEdge()) {
- const TopoDS_Shape &aShape =
+ const auto &aShape =
const_cast<GeomAPI_Shape *>(this)->impl<TopoDS_Shape>();
anEdge = GeomEdgePtr(new GeomAPI_Edge);
anEdge->setImpl(new TopoDS_Shape(aShape));
std::shared_ptr<GeomAPI_Wire> GeomAPI_Shape::wire() const {
GeomWirePtr aWire;
if (isWire()) {
- const TopoDS_Shape &aShape =
+ const auto &aShape =
const_cast<GeomAPI_Shape *>(this)->impl<TopoDS_Shape>();
aWire = GeomWirePtr(new GeomAPI_Wire);
aWire->setImpl(new TopoDS_Shape(aShape));
std::shared_ptr<GeomAPI_Face> GeomAPI_Shape::face() const {
GeomFacePtr aFace;
if (isFace()) {
- const TopoDS_Shape &aShape =
+ const auto &aShape =
const_cast<GeomAPI_Shape *>(this)->impl<TopoDS_Shape>();
aFace = GeomFacePtr(new GeomAPI_Face);
aFace->setImpl(new TopoDS_Shape(aShape));
std::shared_ptr<GeomAPI_Shell> GeomAPI_Shape::shell() const {
GeomShellPtr aShell;
if (isShell()) {
- const TopoDS_Shape &aShape =
+ const auto &aShape =
const_cast<GeomAPI_Shape *>(this)->impl<TopoDS_Shape>();
aShell = GeomShellPtr(new GeomAPI_Shell);
aShell->setImpl(new TopoDS_Shape(aShape));
std::shared_ptr<GeomAPI_Solid> GeomAPI_Shape::solid() const {
GeomSolidPtr aSolid;
if (isSolid()) {
- const TopoDS_Shape &aShape =
+ const auto &aShape =
const_cast<GeomAPI_Shape *>(this)->impl<TopoDS_Shape>();
aSolid = GeomSolidPtr(new GeomAPI_Solid);
aSolid->setImpl(new TopoDS_Shape(aShape));
GeomAPI_Shape::subShapes(const ShapeType theSubShapeType,
const bool theOnlyUnique) const {
ListOfShape aSubs;
- const TopoDS_Shape &aShape = impl<TopoDS_Shape>();
+ const auto &aShape = impl<TopoDS_Shape>();
if (aShape.IsNull())
return aSubs;
}
GeomAPI_Shape::ShapeType GeomAPI_Shape::shapeType() const {
- const TopoDS_Shape &aShape = impl<TopoDS_Shape>();
+ const auto &aShape = impl<TopoDS_Shape>();
if (aShape.IsNull())
return GeomAPI_Shape::SHAPE;
return false;
}
- const TopoDS_Shape &aShapeToSearch = theShape->impl<TopoDS_Shape>();
+ const auto &aShapeToSearch = theShape->impl<TopoDS_Shape>();
if (aShapeToSearch.IsNull()) {
return false;
}
bool GeomAPI_Shape::computeSize(double &theXmin, double &theYmin,
double &theZmin, double &theXmax,
double &theYmax, double &theZmax) const {
- const TopoDS_Shape &aShape =
- const_cast<GeomAPI_Shape *>(this)->impl<TopoDS_Shape>();
+ const auto &aShape = const_cast<GeomAPI_Shape *>(this)->impl<TopoDS_Shape>();
if (aShape.IsNull())
return false;
Bnd_Box aBndBox;
std::string
GeomAPI_Shape::getShapeStream(const bool theWithTriangulation) const {
std::ostringstream aStream;
- const TopoDS_Shape &aShape =
- const_cast<GeomAPI_Shape *>(this)->impl<TopoDS_Shape>();
+ const auto &aShape = const_cast<GeomAPI_Shape *>(this)->impl<TopoDS_Shape>();
if (!theWithTriangulation) { // make a copy of shape without triangulation
BRepBuilderAPI_Copy aCopy(aShape, Standard_False, Standard_False);
const TopoDS_Shape &aCopyShape = aCopy.Shape();
// LCOV_EXCL_STOP
GeomShapePtr GeomAPI_Shape::intersect(const GeomShapePtr theShape) const {
- const TopoDS_Shape &aShape1 =
- const_cast<GeomAPI_Shape *>(this)->impl<TopoDS_Shape>();
- const TopoDS_Shape &aShape2 = theShape->impl<TopoDS_Shape>();
+ const auto &aShape1 = const_cast<GeomAPI_Shape *>(this)->impl<TopoDS_Shape>();
+ const auto &aShape2 = theShape->impl<TopoDS_Shape>();
BRepAlgoAPI_Section aCommon(aShape1, aShape2);
if (!aCommon.IsDone())
return false;
}
- const TopoDS_Shape &aShape1 =
- const_cast<GeomAPI_Shape *>(this)->impl<TopoDS_Shape>();
- const TopoDS_Shape &aShape2 = theShape->impl<TopoDS_Shape>();
+ const auto &aShape1 = const_cast<GeomAPI_Shape *>(this)->impl<TopoDS_Shape>();
+ const auto &aShape2 = theShape->impl<TopoDS_Shape>();
BRepExtrema_DistShapeShape aDist(aShape1, aShape2);
aDist.Perform();
BOPAlgo_CheckerSI aCSI; // checker of self-interferences
aCSI.SetLevelOfCheck(theLevelOfCheck);
TopTools_ListOfShape aList;
- const TopoDS_Shape &aThisShape =
+ const auto &aThisShape =
const_cast<GeomAPI_Shape *>(this)->impl<TopoDS_Shape>();
aList.Append(aThisShape);
aCSI.SetArguments(aList);
bool GeomAPI_Shape::Comparator::operator()(
const std::shared_ptr<GeomAPI_Shape> &theShape1,
const std::shared_ptr<GeomAPI_Shape> &theShape2) const {
- const TopoDS_Shape &aShape1 = theShape1->impl<TopoDS_Shape>();
- const TopoDS_Shape &aShape2 = theShape2->impl<TopoDS_Shape>();
+ const auto &aShape1 = theShape1->impl<TopoDS_Shape>();
+ const auto &aShape2 = theShape2->impl<TopoDS_Shape>();
bool isLess = aShape1.TShape() < aShape2.TShape();
if (aShape1.TShape() == aShape2.TShape()) {
Standard_Integer aHash1 = aShape1.Location().HashCode(IntegerLast());
bool GeomAPI_Shape::ComparatorWithOri::operator()(
const std::shared_ptr<GeomAPI_Shape> &theShape1,
const std::shared_ptr<GeomAPI_Shape> &theShape2) const {
- const TopoDS_Shape &aShape1 = theShape1->impl<TopoDS_Shape>();
- const TopoDS_Shape &aShape2 = theShape2->impl<TopoDS_Shape>();
+ const auto &aShape1 = theShape1->impl<TopoDS_Shape>();
+ const auto &aShape2 = theShape2->impl<TopoDS_Shape>();
bool isLess = aShape1.TShape() < aShape2.TShape();
if (aShape1.TShape() == aShape2.TShape()) {
Standard_Integer aHash1 = aShape1.Location().HashCode(IntegerLast());
int GeomAPI_Shape::Hash::operator()(
const std::shared_ptr<GeomAPI_Shape> &theShape) const {
- const TopoDS_Shape &aShape = theShape->impl<TopoDS_Shape>();
+ const auto &aShape = theShape->impl<TopoDS_Shape>();
return aShape.HashCode(IntegerLast());
}
bool GeomAPI_Shape::Equal::operator()(
const std::shared_ptr<GeomAPI_Shape> &theShape1,
const std::shared_ptr<GeomAPI_Shape> &theShape2) const {
- const TopoDS_Shape &aShape1 = theShape1->impl<TopoDS_Shape>();
- const TopoDS_Shape &aShape2 = theShape2->impl<TopoDS_Shape>();
+ const auto &aShape1 = theShape1->impl<TopoDS_Shape>();
+ const auto &aShape2 = theShape2->impl<TopoDS_Shape>();
Standard_Integer aHash1 = aShape1.Location().HashCode(IntegerLast());
Standard_Integer aHash2 = aShape2.Location().HashCode(IntegerLast());
const GeomShapePtr &theParent) {
myParent[theShape] = theParent;
- MapShapeToIndex::iterator aFound = myParentIndices.find(theParent);
+ auto aFound = myParentIndices.find(theParent);
size_t anIndex = myParentIndices.size();
if (aFound == myParentIndices.end()) {
myParentIndices[theParent] = anIndex;
void GeomAPI_ShapeHierarchy::markProcessed(const GeomShapePtr &theShape) {
myProcessedObjects.insert(theShape);
// mark sub-shapes of the compound as processed too
- MapShapeToIndex::iterator aFoundInd = myParentIndices.find(theShape);
+ auto aFoundInd = myParentIndices.find(theShape);
if (aFoundInd != myParentIndices.end()) {
const ListOfShape &aSubs = mySubshapes[aFoundInd->second].second;
- for (ListOfShape::const_iterator anIt = aSubs.begin(); anIt != aSubs.end();
- ++anIt)
- markProcessed(*anIt);
+ for (const auto &aSub : aSubs)
+ markProcessed(aSub);
}
}
void GeomAPI_ShapeHierarchy::markProcessed(const ListOfShape &theShapes) {
- for (ListOfShape::const_iterator anIt = theShapes.begin();
- anIt != theShapes.end(); ++anIt)
- markProcessed(*anIt);
+ for (const auto &theShape : theShapes)
+ markProcessed(theShape);
}
void GeomAPI_ShapeHierarchy::markModified(const GeomShapePtr &theSource,
const ListOfShape &
GeomAPI_ShapeHierarchy::objects(GeomShapePtr theParent) const {
- MapShapeToIndex::const_iterator aFoundIndex = myParentIndices.find(theParent);
+ auto aFoundIndex = myParentIndices.find(theParent);
if (aFoundIndex == myParentIndices.end()) {
static const ListOfShape THE_DUMMY = ListOfShape();
return THE_DUMMY; // no such shape
return;
}
- for (ListOfShape::const_iterator anIt = myObjects.begin();
- anIt != myObjects.end(); ++anIt) {
- GeomAPI_Shape::ShapeType aType = (*anIt)->shapeType();
+ for (const auto &myObject : myObjects) {
+ GeomAPI_Shape::ShapeType aType = myObject->shapeType();
if (aType >= theMinType && aType <= theMaxType)
- theShapesByType.push_back(*anIt);
+ theShapesByType.push_back(myObject);
else
- theOtherShapes.push_back(*anIt);
+ theOtherShapes.push_back(myObject);
}
}
theUsed.clear();
theNotUsed.clear();
- MapShapeToIndex::const_iterator aFoundIndex =
- myParentIndices.find(theCompShape);
+ auto aFoundIndex = myParentIndices.find(theCompShape);
if (aFoundIndex == myParentIndices.end())
return; // no such shape
void GeomAPI_ShapeHierarchy::topLevelObjects(
ListOfShape &theDestination) const {
- GeomAPI_ShapeHierarchy *aThis = const_cast<GeomAPI_ShapeHierarchy *>(this);
+ auto *aThis = const_cast<GeomAPI_ShapeHierarchy *>(this);
SetOfShape aProcessed = myProcessedObjects;
aThis->myProcessedObjects.clear();
GeomShapePtr aRoot = aThis->root(aShape);
if (aRoot) {
// check the current shape was modified
- MapShapeToShape::const_iterator aFound = myModifiedObjects.find(aRoot);
+ auto aFound = myModifiedObjects.find(aRoot);
if (aFound != myModifiedObjects.end())
aShape = aFound->second;
else {
}
} else {
// check the current shape was modified
- MapShapeToShape::const_iterator aFound = myModifiedObjects.find(aShape);
+ auto aFound = myModifiedObjects.find(aShape);
if (aFound != myModifiedObjects.end())
aShape = aFound->second;
}
SetOfShape aUsedObjects = myProcessedObjects;
aUsedObjects.insert(myObjects.begin(), myObjects.end());
- for (std::vector<ShapeAndSubshapes>::const_iterator anIt =
- mySubshapes.begin();
- anIt != mySubshapes.end(); ++anIt) {
- MapShapeToShape::const_iterator aParent = myParent.find(anIt->first);
+ for (const auto &mySubshape : mySubshapes) {
+ auto aParent = myParent.find(mySubshape.first);
if ((aParent == myParent.end() || !aParent->second) &&
- anIt->first->shapeType() == GeomAPI_Shape::COMPOUND) {
+ mySubshape.first->shapeType() == GeomAPI_Shape::COMPOUND) {
// this is a top-level compound
- GeomShapePtr aCompound = collectSubs(anIt->first, aUsedObjects);
+ GeomShapePtr aCompound = collectSubs(mySubshape.first, aUsedObjects);
// add to destination non-empty compounds only
if (aCompound)
theDestination.push_back(aCompound);
if (!theTarget.get() || !theSub.get())
return;
- TopoDS_Shape *aShape = theTarget->implPtr<TopoDS_Shape>();
+ auto *aShape = theTarget->implPtr<TopoDS_Shape>();
- std::map<GeomShapePtr, GeomShapePtr,
- GeomAPI_Shape::Comparator>::const_iterator aFound =
- theModified.find(theSub);
- const TopoDS_Shape &aShapeToAdd =
+ auto aFound = theModified.find(theSub);
+ const auto &aShapeToAdd =
(aFound == theModified.end() ? theSub : aFound->second)
->impl<TopoDS_Shape>();
if (theExcluded.find(aCurrent) != theExcluded.end())
continue; // already used
- MapShapeToIndex::const_iterator aFoundIndex =
- myParentIndices.find(aCurrent);
+ auto aFoundIndex = myParentIndices.find(aCurrent);
if (aCurrent->shapeType() > GeomAPI_Shape::COMPOUND ||
aFoundIndex == myParentIndices.end()) {
bool isAddShape = true;
/// \brief Storage for the hierarchy of shapes and their parents (compounds or
/// compsolids)
class GeomAPI_ShapeHierarchy {
- typedef std::pair<GeomShapePtr, ListOfShape> ShapeAndSubshapes;
- typedef std::map<GeomShapePtr, GeomShapePtr, GeomAPI_Shape::Comparator>
- MapShapeToShape;
- typedef std::map<GeomShapePtr, size_t, GeomAPI_Shape::Comparator>
- MapShapeToIndex;
- typedef std::set<GeomShapePtr, GeomAPI_Shape::Comparator> SetOfShape;
+ using ShapeAndSubshapes = std::pair<GeomShapePtr, ListOfShape>;
+ using MapShapeToShape =
+ std::map<GeomShapePtr, GeomShapePtr, GeomAPI_Shape::Comparator>;
+ using MapShapeToIndex =
+ std::map<GeomShapePtr, size_t, GeomAPI_Shape::Comparator>;
+ using SetOfShape = std::set<GeomShapePtr, GeomAPI_Shape::Comparator>;
ListOfShape myObjects; ///< list of objects of some operation
MapShapeToShape
class iterator
: public std::iterator<std::forward_iterator_tag, GeomShapePtr> {
public:
- GEOMAPI_EXPORT iterator() {}
+ GEOMAPI_EXPORT iterator() = default;
protected:
iterator(GeomAPI_ShapeHierarchy *theHierarchy, bool isBegin = true);
//=================================================================================================
GeomAPI_Shell::GeomAPI_Shell() {
- TopoDS_Shell *aShell = new TopoDS_Shell();
+ auto *aShell = new TopoDS_Shell();
BRep_Builder aBuilder;
aBuilder.MakeShell(*aShell);
// find corner with the smallest coordinates
std::list<GeomPointPtr>::const_iterator aPrev = --aCorners.end();
- std::list<GeomPointPtr>::const_iterator aCur = aPrev--;
+ auto aCur = aPrev--;
std::list<GeomPointPtr>::const_iterator aNext = aCorners.begin();
GeomPointPtr anOrigin = *aCur;
GeomPointPtr aFront = *aNext;
return GeomBoxPtr();
// calculate heights for planes computed by rectangles
- for (std::map<int, int>::iterator it = aParallelPlanes.begin();
- it != aParallelPlanes.end(); ++it) {
- GeomDirPtr aNormal = aPlanes[it->first].myAxes->normal();
- GeomPointPtr anOrigin = aPlanes[it->first].myAxes->origin();
- GeomPointPtr aNeighbor = aPlanes[it->second].myAxes->origin();
-
- aPlanes[it->first].myHeight = aPlanes[it->second].myHeight =
- aNormal->xyz()->dot(aNeighbor->xyz()->decreased(anOrigin->xyz()));
+ for (auto &aParallelPlane : aParallelPlanes) {
+ GeomDirPtr aNormal = aPlanes[aParallelPlane.first].myAxes->normal();
+ GeomPointPtr anOrigin = aPlanes[aParallelPlane.first].myAxes->origin();
+ GeomPointPtr aNeighbor = aPlanes[aParallelPlane.second].myAxes->origin();
+
+ aPlanes[aParallelPlane.first].myHeight =
+ aPlanes[aParallelPlane.second].myHeight =
+ aNormal->xyz()->dot(aNeighbor->xyz()->decreased(anOrigin->xyz()));
}
// check if the box is oriented in the main axes
GeomPointPtr GeomAPI_Shell::middlePoint() const {
GeomPointPtr anInnerPoint;
- const TopoDS_Shell &aShell = impl<TopoDS_Shell>();
+ const auto &aShell = impl<TopoDS_Shell>();
if (aShell.IsNull())
return anInnerPoint;
GEOMAPI_EXPORT std::shared_ptr<GeomAPI_Box> getParallelepiped() const;
/// Return middle point on the shell
- GEOMAPI_EXPORT virtual std::shared_ptr<GeomAPI_Pnt> middlePoint() const;
+ GEOMAPI_EXPORT std::shared_ptr<GeomAPI_Pnt> middlePoint() const override;
};
-typedef std::shared_ptr<GeomAPI_Shell> GeomShellPtr;
+using GeomShellPtr = std::shared_ptr<GeomAPI_Shell>;
#endif
GeomPointPtr GeomAPI_Solid::middlePoint() const {
GeomPointPtr anInnerPoint;
- const TopoDS_Solid &aSolid = impl<TopoDS_Solid>();
+ const auto &aSolid = impl<TopoDS_Solid>();
if (aSolid.IsNull())
return anInnerPoint;
GEOMAPI_EXPORT std::shared_ptr<GeomAPI_Box> getParallelepiped() const;
/// Return inner point in the solid
- GEOMAPI_EXPORT virtual std::shared_ptr<GeomAPI_Pnt> middlePoint() const;
+ GEOMAPI_EXPORT std::shared_ptr<GeomAPI_Pnt> middlePoint() const override;
};
-typedef std::shared_ptr<GeomAPI_Solid> GeomSolidPtr;
+using GeomSolidPtr = std::shared_ptr<GeomAPI_Solid>;
#endif
};
//! Pointer on the object
-typedef std::shared_ptr<GeomAPI_Sphere> GeomSpherePtr;
+using GeomSpherePtr = std::shared_ptr<GeomAPI_Sphere>;
#endif
};
//! Pointer on the object
-typedef std::shared_ptr<GeomAPI_Torus> GeomTorusPtr;
+using GeomTorusPtr = std::shared_ptr<GeomAPI_Torus>;
#endif
};
//! Pointer on the object
-typedef std::shared_ptr<GeomAPI_Trsf> GeomTrsfPtr;
+using GeomTrsfPtr = std::shared_ptr<GeomAPI_Trsf>;
#endif
}
std::shared_ptr<GeomAPI_Pnt> GeomAPI_Vertex::point() {
- const TopoDS_Shape &aShape =
- const_cast<GeomAPI_Vertex *>(this)->impl<TopoDS_Shape>();
+ const auto &aShape = const_cast<GeomAPI_Vertex *>(this)->impl<TopoDS_Shape>();
TopoDS_Vertex aVertex = TopoDS::Vertex(aShape);
gp_Pnt aPoint = BRep_Tool::Pnt(aVertex);
return std::shared_ptr<GeomAPI_Pnt>(
const std::shared_ptr<GeomAPI_Shape> theVert) const {
if (!theVert.get() || !theVert->isVertex())
return false;
- const TopoDS_Shape &aMyShape =
+ const auto &aMyShape =
const_cast<GeomAPI_Vertex *>(this)->impl<TopoDS_Shape>();
- const TopoDS_Shape &aInShape = theVert->impl<TopoDS_Shape>();
+ const auto &aInShape = theVert->impl<TopoDS_Shape>();
if (aMyShape.ShapeType() != aInShape.ShapeType())
return false;
bool GeomAPI_Vertex::GeometricComparator::operator()(
const GeomVertexPtr &theVertex1, const GeomVertexPtr &theVertex2) const {
- const TopoDS_Vertex &aVertex1 = theVertex1->impl<TopoDS_Vertex>();
- const TopoDS_Vertex &aVertex2 = theVertex2->impl<TopoDS_Vertex>();
+ const auto &aVertex1 = theVertex1->impl<TopoDS_Vertex>();
+ const auto &aVertex2 = theVertex2->impl<TopoDS_Vertex>();
gp_Pnt aPnt1 = BRep_Tool::Pnt(aVertex1);
gp_Pnt aPnt2 = BRep_Tool::Pnt(aVertex2);
//==================================================================================================
GeomAPI_Wire::GeomAPI_Wire() {
- TopoDS_Wire *aWire = new TopoDS_Wire();
+ auto *aWire = new TopoDS_Wire();
BRep_Builder aBuilder;
aBuilder.MakeWire(*aWire);
// Getting objects.
TopTools_ListOfShape anObjects;
- for (ListOfShape::const_iterator anObjectsIt = theObjects.begin();
- anObjectsIt != theObjects.end(); anObjectsIt++) {
- anObjects.Append((*anObjectsIt)->impl<TopoDS_Shape>());
+ for (const auto &theObject : theObjects) {
+ anObjects.Append(theObject->impl<TopoDS_Shape>());
}
// Getting tools.
TopTools_ListOfShape aTools;
- for (ListOfShape::const_iterator aToolsIt = theTools.begin();
- aToolsIt != theTools.end(); aToolsIt++) {
- aTools.Append((*aToolsIt)->impl<TopoDS_Shape>());
+ for (const auto &theTool : theTools) {
+ aTools.Append(theTool->impl<TopoDS_Shape>());
}
// Creating boolean operation.
- BOPAlgo_BOP *aBuilder = new BOPAlgo_BOP();
+ auto *aBuilder = new BOPAlgo_BOP();
switch (theOperationType) {
case GeomAlgoAPI_Tools::BOOL_CUT: {
aBuilder->SetOperation(BOPAlgo_CUT);
return;
}
// searching for new result by sub-shapes of aSubType type
- TopAbs_ShapeEnum aSubType = TopAbs_ShapeEnum(int(theOld.ShapeType()) + 1);
+ auto aSubType = TopAbs_ShapeEnum(int(theOld.ShapeType()) + 1);
while (aSubType < TopAbs_VERTEX && !isHistoryType(aSubType))
aSubType = TopAbs_ShapeEnum(int(aSubType) + 1);
if (aSubType == TopAbs_SHAPE)
/// make arguments of Fuse produce result shapes with "modified" evolution
void GeomAlgoAPI_Boolean::modified(const GeomShapePtr theOldShape,
ListOfShape &theNewShapes) {
- BOPAlgo_BOP *aBuilder = this->implPtr<BOPAlgo_BOP>();
+ auto *aBuilder = this->implPtr<BOPAlgo_BOP>();
if (aBuilder->Operation() ==
BOPAlgo_FUSE) { // only for fuse and when old is and argument
TopoDS_Shape anOld = theOldShape->impl<TopoDS_Shape>();
const double theFuzzy = -1);
/// Redefinition of the generic method for the Fuse problem: OCCT 30481
- GEOMALGOAPI_EXPORT virtual void modified(const GeomShapePtr theOldShape,
- ListOfShape &theNewShapes);
+ GEOMALGOAPI_EXPORT void modified(const GeomShapePtr theOldShape,
+ ListOfShape &theNewShapes) override;
private:
/// Builds resulting shape.
#include <TopoDS_Shape.hxx>
//=================================================================================================
-GeomAlgoAPI_Box::GeomAlgoAPI_Box() {}
+GeomAlgoAPI_Box::GeomAlgoAPI_Box() = default;
//=================================================================================================
GeomAlgoAPI_Box::GeomAlgoAPI_Box(const double theDx, const double theDy,
myCreatedFaces.clear();
// Construct the box
- BRepPrimAPI_MakeBox *aBoxMaker = new BRepPrimAPI_MakeBox(myDx, myDy, myDz);
+ auto *aBoxMaker = new BRepPrimAPI_MakeBox(myDx, myDy, myDz);
aBoxMaker->Build();
// Test the algorithm
void GeomAlgoAPI_Box::buildWithPoints() {
myCreatedFaces.clear();
- const gp_Pnt &aFirstPoint = myFirstPoint->impl<gp_Pnt>();
- const gp_Pnt &aSecondPoint = mySecondPoint->impl<gp_Pnt>();
+ const auto &aFirstPoint = myFirstPoint->impl<gp_Pnt>();
+ const auto &aSecondPoint = mySecondPoint->impl<gp_Pnt>();
// Construct the box
- BRepPrimAPI_MakeBox *aBoxMaker =
- new BRepPrimAPI_MakeBox(aFirstPoint, aSecondPoint);
+ auto *aBoxMaker = new BRepPrimAPI_MakeBox(aFirstPoint, aSecondPoint);
aBoxMaker->Build();
// Test the algorithm
const double theDy, const double theDz);
/// Checks if data for the box construction is OK.
- GEOMALGOAPI_EXPORT bool check();
+ GEOMALGOAPI_EXPORT bool check() override;
/// Builds the box.
- GEOMALGOAPI_EXPORT void build();
+ GEOMALGOAPI_EXPORT void build() override;
/// Prepare the naming (redifined because it is specific for a box).
- GEOMALGOAPI_EXPORT void prepareNamingFaces();
+ GEOMALGOAPI_EXPORT void prepareNamingFaces() override;
private:
/// Builds the box with the dimensions "Dx", "Dy" and "Dz".
if (!theShape.get())
return false;
- const TopoDS_Shape &aShape = theShape->impl<TopoDS_Shape>();
+ const auto &aShape = theShape->impl<TopoDS_Shape>();
if (aShape.IsNull())
return false;
if (!theShape.get())
return false;
- const TopoDS_Shape &aShape = theShape->impl<TopoDS_Shape>();
+ const auto &aShape = theShape->impl<TopoDS_Shape>();
if (aShape.IsNull())
return false;
if (!theShape.get())
return false;
- const TopoDS_Shape &aShape = theShape->impl<TopoDS_Shape>();
+ const auto &aShape = theShape->impl<TopoDS_Shape>();
if (aShape.IsNull())
return false;
if (!theShape.get())
return false;
- const TopoDS_Shape &aShape = theShape->impl<TopoDS_Shape>();
+ const auto &aShape = theShape->impl<TopoDS_Shape>();
if (aShape.IsNull())
return false;
if (!theEdge.get())
return false;
- const TopoDS_Shape &aShape = theEdge->impl<TopoDS_Shape>();
+ const auto &aShape = theEdge->impl<TopoDS_Shape>();
if (aShape.IsNull())
return false;
if (!theEdge.get())
return false;
- const TopoDS_Shape &aShape = theEdge->impl<TopoDS_Shape>();
+ const auto &aShape = theEdge->impl<TopoDS_Shape>();
if (aShape.IsNull())
return false;
if (!theEdge.get())
return false;
- const TopoDS_Shape &aShape = theEdge->impl<TopoDS_Shape>();
+ const auto &aShape = theEdge->impl<TopoDS_Shape>();
if (aShape.IsNull())
return false;
TopExp::MapShapesAndAncestors(aShapeBase, TopAbs_EDGE, TopAbs_FACE, M);
// create chamfer builder
- BRepFilletAPI_MakeChamfer *aChamferBuilder =
- new BRepFilletAPI_MakeChamfer(aShapeBase);
+ auto *aChamferBuilder = new BRepFilletAPI_MakeChamfer(aShapeBase);
setImpl(aChamferBuilder);
setBuilderType(OCCT_BRepBuilderAPI_MakeShape);
- for (ListOfShape::const_iterator anIt = theChamferShapes.begin();
- anIt != theChamferShapes.end(); ++anIt) {
- if ((*anIt)->isEdge()) {
- TopoDS_Edge E = (*anIt)->impl<TopoDS_Edge>();
- if (theMapEdgeFace.find(*anIt) != theMapEdgeFace.end()) {
+ for (const auto &theChamferShape : theChamferShapes) {
+ if (theChamferShape->isEdge()) {
+ TopoDS_Edge E = theChamferShape->impl<TopoDS_Edge>();
+ if (theMapEdgeFace.find(theChamferShape) != theMapEdgeFace.end()) {
// TopoDS_Face F = (theMapEdgeFace[*anIt])->impl<TopoDS_Face>();
- TopoDS_Face F = (theMapEdgeFace.at(*anIt))->impl<TopoDS_Face>();
+ TopoDS_Face F =
+ (theMapEdgeFace.at(theChamferShape))->impl<TopoDS_Face>();
if (!BRepTools::IsReallyClosed(E, F) && !BRep_Tool::Degenerated(E) &&
M.FindFromKey(E).Extent() == 2) {
if (performDistances) {
#include <cmath>
typedef std::shared_ptr<gp_Circ2d> Circ2dPtr;
-typedef std::shared_ptr<Geom2dAdaptor_Curve> CurveAdaptorPtr;
-typedef std::vector<std::shared_ptr<GccEnt_QualifiedCirc>> VectorOfGccCirc;
-typedef std::vector<std::shared_ptr<GccEnt_QualifiedLin>> VectorOfGccLine;
+using CurveAdaptorPtr = std::shared_ptr<Geom2dAdaptor_Curve>;
+using VectorOfGccCirc = std::vector<std::shared_ptr<GccEnt_QualifiedCirc>>;
+using VectorOfGccLine = std::vector<std::shared_ptr<GccEnt_QualifiedLin>>;
// Provide different mechanisms to create circle:
// * by passing points
private:
Circ2dPtr circleByCenterAndRadius() {
- const gp_Pnt2d &aCenter = myCenter->impl<gp_Pnt2d>();
+ const auto &aCenter = myCenter->impl<gp_Pnt2d>();
return Circ2dPtr(new gp_Circ2d(gp_Ax2d(aCenter, gp::DX2d()), myRadius));
}
Circ2dPtr circleByCenterAndPassingPoint() {
- const gp_Pnt2d &aCenter = myCenter->impl<gp_Pnt2d>();
+ const auto &aCenter = myCenter->impl<gp_Pnt2d>();
if (aCenter.SquareDistance(myPassingPoints[0]) >
Precision::SquareConfusion()) {
GccAna_Circ2dTanCen aBuilder(myPassingPoints[0], aCenter);
}
Circ2dPtr circleByCenterAndTangent() {
- const gp_Pnt2d &aCenter = myCenter->impl<gp_Pnt2d>();
+ const auto &aCenter = myCenter->impl<gp_Pnt2d>();
CurveAdaptorPtr aCurve = myTangentShapes[0];
std::shared_ptr<GccAna_Circ2dTanCen> aCircleBuilder;
theTangentCircles.reserve(3);
theTangentLines.reserve(3);
- std::vector<CurveAdaptorPtr>::iterator anIt = myTangentShapes.begin();
+ auto anIt = myTangentShapes.begin();
for (; anIt != myTangentShapes.end(); ++anIt) {
switch ((*anIt)->GetType()) {
case GeomAbs_Line:
std::shared_ptr<GeomAPI_Shape> theSub) {
int anID = 0;
TopoDS_Shape aMainShape = theContext->impl<TopoDS_Shape>();
- const TopoDS_Shape &aSubShape = theSub->impl<TopoDS_Shape>();
+ const auto &aSubShape = theSub->impl<TopoDS_Shape>();
if (!aMainShape.IsNull() && !aSubShape.IsNull()) {
TopTools_IndexedMapOfShape aSubShapesMap;
TopExp::MapShapes(aMainShape, aSubShapesMap);
void GeomAlgoAPI_Cone::build() {
myCreatedFaces.clear();
- const gp_Ax2 &anAxis = myAxis->impl<gp_Ax2>();
+ const auto &anAxis = myAxis->impl<gp_Ax2>();
// Construct the torus
- BRepPrimAPI_MakeCone *aConeMaker =
+ auto *aConeMaker =
new BRepPrimAPI_MakeCone(anAxis, myBaseRadius, myTopRadius, myHeight);
aConeMaker->Build();
const double theHeight);
/// Checks if data for the cone construction is OK.
- GEOMALGOAPI_EXPORT bool check();
+ GEOMALGOAPI_EXPORT bool check() override;
/// Builds the cone.
- GEOMALGOAPI_EXPORT void build();
+ GEOMALGOAPI_EXPORT void build() override;
private:
std::shared_ptr<GeomAPI_Ax2> myAxis; /// Axis of the cone.
gp_Dir aZDir(0., 0., 1.);
gp_Pnt anOrigin(0., 0., 0.);
gp_Ax1 aZAxis(anOrigin, aZDir);
- BRepPrimAPI_MakeRevol *aRevolBuilder = new BRepPrimAPI_MakeRevol(
+ auto *aRevolBuilder = new BRepPrimAPI_MakeRevol(
aFaceBuilder.Face(), aZAxis, myDeltaPhi * M_PI / 180., Standard_True);
if (!aRevolBuilder) {
myError = "Cone Segment builder :: section revolution did not succeed";
const double theDeltaPhi);
/// Checks if the set of parameters used to define the cone segment are OK.
- GEOMALGOAPI_EXPORT bool check();
+ GEOMALGOAPI_EXPORT bool check() override;
/// Builds the cone segment based on the parameters given in the constructor.
- GEOMALGOAPI_EXPORT void build();
+ GEOMALGOAPI_EXPORT void build() override;
private:
double myRMin1; /// Cone base inner radius.
}
// Getting shape.
- const TopoDS_Shape &aBaseShape = theShape->impl<TopoDS_Shape>();
+ const auto &aBaseShape = theShape->impl<TopoDS_Shape>();
// Creating copy.
- BRepBuilderAPI_Copy *aBuilder =
+ auto *aBuilder =
new BRepBuilderAPI_Copy(aBaseShape, theCopyGeom, theCopyMesh);
this->setImpl(aBuilder);
this->setBuilderType(OCCT_BRepBuilderAPI_MakeShape);
gp_Pnt aPlaneBase[3]; // base points to calculate the normal direction
int aNbPlanePoints = 0;
gp_Dir aNormal;
- std::list<GeomPointPtr>::const_iterator anIt = thePoints.begin();
+ auto anIt = thePoints.begin();
for (int i = 1; anIt != thePoints.end(); anIt++, i++) {
- const gp_Pnt &aPoint = (*anIt)->impl<gp_Pnt>();
+ const auto &aPoint = (*anIt)->impl<gp_Pnt>();
aPoints.SetValue(i, 1, aPoint);
aPoints.SetValue(i, 2, aPoint);
if (aNbPlanePoints < 3) {
return;
}
- std::list<GeomPointPtr>::iterator aPIt = thePoints.begin();
+ auto aPIt = thePoints.begin();
GeomPointPtr aPrevPnt = *aPIt;
for (; aPIt != thePoints.end(); ++aPIt) {
GeomPointPtr aPnt = *aPIt;
- std::list<GeomPointPtr>::iterator aNextIt = aPIt;
- std::list<GeomPointPtr>::iterator aNearestIt = ++aNextIt;
+ auto aNextIt = aPIt;
+ auto aNearestIt = ++aNextIt;
double aMinDist = RealLast();
while (aNextIt != thePoints.end()) {
double aDist = aPnt->distance(*aNextIt);
if (aDist < Precision::Confusion()) {
// remove duplicates
- std::list<GeomPointPtr>::iterator aRemoveIt = aNextIt++;
+ auto aRemoveIt = aNextIt++;
thePoints.erase(aRemoveIt);
// update iterator showing the nearest point, because it may become
// invalid
void GeomAlgoAPI_Cylinder::build() {
myCreatedFaces.clear();
- const gp_Ax2 &anAxis = myAxis->impl<gp_Ax2>();
+ const auto &anAxis = myAxis->impl<gp_Ax2>();
// Construct the cylinder
BRepPrimAPI_MakeCylinder *aCylinderMaker;
const double theAngle);
/// Checks if data for the cylinder construction is OK.
- GEOMALGOAPI_EXPORT bool check();
+ GEOMALGOAPI_EXPORT bool check() override;
/// Builds the cylinder.
- GEOMALGOAPI_EXPORT void build();
+ GEOMALGOAPI_EXPORT void build() override;
private:
bool withAngle; /// Boolean indicating if the type of cylinder (full or
std::shared_ptr<GeomAPI_Edge>
GeomAlgoAPI_EdgeBuilder::line(std::shared_ptr<GeomAPI_Pnt> theStart,
std::shared_ptr<GeomAPI_Pnt> theEnd) {
- const gp_Pnt &aStart = theStart->impl<gp_Pnt>();
- const gp_Pnt &anEnd = theEnd->impl<gp_Pnt>();
+ const auto &aStart = theStart->impl<gp_Pnt>();
+ const auto &anEnd = theEnd->impl<gp_Pnt>();
return createLine(aStart, anEnd);
}
std::shared_ptr<GeomAPI_Edge>
GeomAlgoAPI_EdgeBuilder::line(const std::shared_ptr<GeomAPI_Lin> theLin) {
GeomEdgePtr aRes;
if (theLin.get()) {
- const gp_Lin &aLin = theLin->impl<gp_Lin>();
+ const auto &aLin = theLin->impl<gp_Lin>();
BRepBuilderAPI_MakeEdge anEdgeBuilder(aLin);
TopoDS_Edge anEdge = anEdgeBuilder.Edge();
aRes = GeomEdgePtr(new GeomAPI_Edge);
std::shared_ptr<GeomAPI_Edge> GeomAlgoAPI_EdgeBuilder::cylinderAxis(
std::shared_ptr<GeomAPI_Shape> theCylindricalFace) {
std::shared_ptr<GeomAPI_Edge> aResult;
- const TopoDS_Shape &aShape = theCylindricalFace->impl<TopoDS_Shape>();
+ const auto &aShape = theCylindricalFace->impl<TopoDS_Shape>();
if (aShape.IsNull())
return aResult;
TopoDS_Face aFace = TopoDS::Face(aShape);
GeomAlgoAPI_EdgeBuilder::lineCircle(std::shared_ptr<GeomAPI_Pnt> theCenter,
std::shared_ptr<GeomAPI_Dir> theNormal,
double theRadius) {
- const gp_Pnt &aCenter = theCenter->impl<gp_Pnt>();
- const gp_Dir &aDir = theNormal->impl<gp_Dir>();
+ const auto &aCenter = theCenter->impl<gp_Pnt>();
+ const auto &aDir = theNormal->impl<gp_Dir>();
gp_Circ aCircle(gp_Ax2(aCenter, aDir), theRadius);
GeomAlgoAPI_EdgeBuilder::lineCircle(std::shared_ptr<GeomAPI_Circ> theCircle) {
GeomEdgePtr aRes;
if (theCircle.get()) {
- const gp_Circ &aCirc = theCircle->impl<gp_Circ>();
+ const auto &aCirc = theCircle->impl<gp_Circ>();
BRepBuilderAPI_MakeEdge anEdgeBuilder(aCirc);
TopoDS_Edge anEdge = anEdgeBuilder.Edge();
aRes = GeomEdgePtr(new GeomAPI_Edge);
std::shared_ptr<GeomAPI_Dir> theNormal) {
std::shared_ptr<GeomAPI_Edge> aRes;
- const gp_Pnt &aCenter = theCenter->impl<gp_Pnt>();
- const gp_Dir &aDir = theNormal->impl<gp_Dir>();
+ const auto &aCenter = theCenter->impl<gp_Pnt>();
+ const auto &aDir = theNormal->impl<gp_Dir>();
/// OCCT creates an edge on a circle with empty radius, but visualization
/// is not able to process it
double aRadius = theCenter->distance(theStartPoint);
gp_Circ aCircle(gp_Ax2(aCenter, aDir), aRadius);
- const gp_Pnt &aStart = theStartPoint->impl<gp_Pnt>();
- const gp_Pnt &anEndInter = theEndPoint->impl<gp_Pnt>();
+ const auto &aStart = theStartPoint->impl<gp_Pnt>();
+ const auto &anEndInter = theEndPoint->impl<gp_Pnt>();
// project end point to a circle
gp_XYZ aEndDir = anEndInter.XYZ() - aCenter.XYZ();
const std::shared_ptr<GeomAPI_Dir> &theNormal,
const std::shared_ptr<GeomAPI_Dir> &theMajorAxis,
const double theMajorRadius, const double theMinorRadius) {
- const gp_Pnt &aCenter = theCenter->impl<gp_Pnt>();
- const gp_Dir &aNormal = theNormal->impl<gp_Dir>();
- const gp_Dir &aMajorAxis = theMajorAxis->impl<gp_Dir>();
+ const auto &aCenter = theCenter->impl<gp_Pnt>();
+ const auto &aNormal = theNormal->impl<gp_Dir>();
+ const auto &aMajorAxis = theMajorAxis->impl<gp_Dir>();
gp_Elips anEllipse(gp_Ax2(aCenter, aNormal, aMajorAxis), theMajorRadius,
theMinorRadius);
aBuilder.Add(aShell, aSewer.SewedShape());
}
- BRepBuilderAPI_MakeSolid *anEllipsoidMk =
- new BRepBuilderAPI_MakeSolid(aShell);
+ auto *anEllipsoidMk = new BRepBuilderAPI_MakeSolid(aShell);
anEllipsoidMk->Build();
// Store and publish the results
const double theZCut2);
/// Checks if the set of parameters used to define the ellipsoid are OK.
- GEOMALGOAPI_EXPORT bool check();
+ GEOMALGOAPI_EXPORT bool check() override;
/// Builds the ellipsoid based on the parameters given in the constructor.
- GEOMALGOAPI_EXPORT void build();
+ GEOMALGOAPI_EXPORT void build() override;
private:
double myAx; /// X dimension of the ellipsoid.
: myMessageError(theMessageError) {}
//=================================================================================================
-GeomAlgoAPI_Exception::~GeomAlgoAPI_Exception() noexcept {}
+GeomAlgoAPI_Exception::~GeomAlgoAPI_Exception() noexcept = default;
//=================================================================================================
const char *GeomAlgoAPI_Exception::what() const noexcept {
/// \param theMessageError Error message to be displayed
GEOMALGOAPI_EXPORT GeomAlgoAPI_Exception(std::string theMessageError);
/// Destroyer
- GEOMALGOAPI_EXPORT ~GeomAlgoAPI_Exception() noexcept;
+ GEOMALGOAPI_EXPORT ~GeomAlgoAPI_Exception() noexcept override;
/// Allows to collet the error
- GEOMALGOAPI_EXPORT const char *what() const noexcept;
+ GEOMALGOAPI_EXPORT const char *what() const noexcept override;
private:
std::string myMessageError; /// Error message to be displayed.
std::shared_ptr<GeomAPI_Face> GeomAlgoAPI_FaceBuilder::squareFace(
const std::shared_ptr<GeomAPI_Pnt> theCenter,
const std::shared_ptr<GeomAPI_Dir> theNormal, const double theSize) {
- const gp_Pnt &aCenter = theCenter->impl<gp_Pnt>();
- const gp_Dir &aDir = theNormal->impl<gp_Dir>();
+ const auto &aCenter = theCenter->impl<gp_Pnt>();
+ const auto &aDir = theNormal->impl<gp_Dir>();
gp_Pln aPlane(aCenter, aDir);
// half of the size in each direction from the center
BRepBuilderAPI_MakeFace aFaceBuilder(aPlane, -theSize / 2., theSize / 2.,
std::shared_ptr<GeomAPI_Face> GeomAlgoAPI_FaceBuilder::planarFace(
const std::shared_ptr<GeomAPI_Pnt> theCenter,
const std::shared_ptr<GeomAPI_Dir> theNormal) {
- const gp_Pnt &aCenter = theCenter->impl<gp_Pnt>();
- const gp_Dir &aDir = theNormal->impl<gp_Dir>();
+ const auto &aCenter = theCenter->impl<gp_Pnt>();
+ const auto &aDir = theNormal->impl<gp_Dir>();
gp_Pln aPlane(aCenter, aDir);
BRepBuilderAPI_MakeFace aFaceBuilder(aPlane);
std::shared_ptr<GeomAPI_Face> aRes(new GeomAPI_Face());
return;
// create fillet builder
- BRepFilletAPI_MakeFillet *aFilletBuilder =
+ auto *aFilletBuilder =
new BRepFilletAPI_MakeFillet(theBaseSolid->impl<TopoDS_Shape>());
setImpl(aFilletBuilder);
setBuilderType(OCCT_BRepBuilderAPI_MakeShape);
// assign filleting edges
- for (ListOfShape::const_iterator anIt = theFilletEdges.begin();
- anIt != theFilletEdges.end(); ++anIt) {
- if ((*anIt)->isEdge())
- aFilletBuilder->Add((*anIt)->impl<TopoDS_Edge>());
+ for (const auto &theFilletEdge : theFilletEdges) {
+ if (theFilletEdge->isEdge())
+ aFilletBuilder->Add(theFilletEdge->impl<TopoDS_Edge>());
}
// assign fillet radii for each contour of filleting edges
static void substituteNewEdge(
GeomEdgePtr theEdge,
std::map<GeomShapePtr, ListOfShape, GeomAPI_Shape::Comparator> &theMap) {
- std::map<GeomShapePtr, ListOfShape, GeomAPI_Shape::Comparator>::iterator
- anIt = theMap.begin();
+ auto anIt = theMap.begin();
for (; anIt != theMap.end(); ++anIt) {
- for (ListOfShape::iterator aEIt = anIt->second.begin();
- aEIt != anIt->second.end(); ++aEIt)
- if (theEdge->isEqual(*aEIt)) {
+ for (auto &aEIt : anIt->second)
+ if (theEdge->isEqual(aEIt)) {
// substitute edge and stop iteration
- *aEIt = theEdge;
+ aEIt = theEdge;
return;
}
}
GeomShapePtr aShape_i =
buildWire(aSubShape, aFilletVertices, theRadius);
- if (aShape_i.get() != NULL)
+ if (aShape_i.get() != nullptr)
aShapes.push_back(aShape_i);
else
aShapes.push_back(aSubShape);
GeomAlgoAPI_MapShapesAndAncestors aMapVE(theBaseWire, GeomAPI_Shape::VERTEX,
GeomAPI_Shape::EDGE);
- for (ListOfShape::const_iterator aVIt = theFilletVertices.begin();
- aVIt != theFilletVertices.end(); ++aVIt) {
+ for (const auto &theFilletVertice : theFilletVertices) {
// get edges to perform fillet
- MapShapeToShapes::const_iterator aVE = aMapVE.map().find(*aVIt);
+ auto aVE = aMapVE.map().find(theFilletVertice);
if (aVE == aMapVE.map().end())
continue;
ListOfShape anEdges;
- for (SetOfShapes::const_iterator aEIt = aVE->second.begin();
- aEIt != aVE->second.end(); ++aEIt) {
+ for (const auto &aEIt : aVE->second) {
ListOfShape aNewEdges;
- modified(*aEIt, aNewEdges);
+ modified(aEIt, aNewEdges);
if (aNewEdges.empty())
- anEdges.push_back(*aEIt);
+ anEdges.push_back(aEIt);
else
anEdges.insert(anEdges.end(), aNewEdges.begin(), aNewEdges.end());
}
if (!isOk) {
// something gone wrong and the fillet edge is not constructed,
// just store the failed vertex and continue
- myFailedVertices.push_back(*aVIt);
+ myFailedVertices.push_back(theFilletVertice);
continue;
}
// store modified shapes
myGenerated[aVE->first].push_back(convert(aFilletEdge));
- SetOfShapes::const_iterator aEIt = aVE->second.begin();
+ auto aEIt = aVE->second.begin();
myModified[*aEIt].clear();
myModified[*aEIt].push_back(convert(anEdge1));
myModified[*(++aEIt)].clear();
modified(aWExp.current(), aNewEdges);
if (aNewEdges.empty())
aNewEdges.push_back(aWExp.current());
- for (ListOfShape::iterator anIt = aNewEdges.begin();
- anIt != aNewEdges.end(); ++anIt)
- aBuilder.Add(aNewWire, TopoDS::Edge((*anIt)->impl<TopoDS_Shape>()));
+ for (auto &aNewEdge : aNewEdges)
+ aBuilder.Add(aNewWire, TopoDS::Edge(aNewEdge->impl<TopoDS_Shape>()));
ListOfShape aNewEdges1;
generated(aWExp.currentVertex(), aNewEdges1);
- for (ListOfShape::iterator anIt = aNewEdges1.begin();
- anIt != aNewEdges1.end(); ++anIt)
- aBuilder.Add(aNewWire, TopoDS::Edge((*anIt)->impl<TopoDS_Shape>()));
+ for (auto &anIt : aNewEdges1)
+ aBuilder.Add(aNewWire, TopoDS::Edge(anIt->impl<TopoDS_Shape>()));
}
// fix the wire connectivity
ShapeFix_Wire aFixWire;
void GeomAlgoAPI_Fillet1D::generated(const GeomShapePtr theOldShape,
ListOfShape &theNewShapes) {
- MapModified::iterator aFound = myGenerated.find(theOldShape);
+ auto aFound = myGenerated.find(theOldShape);
if (aFound != myGenerated.end())
theNewShapes = aFound->second;
}
void GeomAlgoAPI_Fillet1D::modified(const GeomShapePtr theOldShape,
ListOfShape &theNewShapes) {
- MapModified::iterator aFound = myModified.find(theOldShape);
+ auto aFound = myModified.find(theOldShape);
if (aFound != myModified.end())
theNewShapes = aFound->second;
}
TopoDS_Compound aCompound;
BRep_Builder aBuilder;
aBuilder.MakeCompound(aCompound);
- ListOfShape::const_iterator anIt = theShapes.cbegin();
+ auto anIt = theShapes.cbegin();
for (; anIt != theShapes.cend(); ++anIt) {
- const TopoDS_Shape &aShape = (*anIt)->impl<TopoDS_Shape>();
+ const auto &aShape = (*anIt)->impl<TopoDS_Shape>();
if (aShape.IsNull())
break;
aBuilder.Add(aCompound, aShape);
//==================================================================================================
GeomAlgoAPI_Intersection::GeomAlgoAPI_Intersection(
const ListOfShape &theObjects, const double theFuzzy)
- : myFiller(0) {
+ : myFiller(nullptr) {
build(theObjects, theFuzzy);
}
}
// Creating partition operation.
- BOPAlgo_Section *anOperation = new BOPAlgo_Section;
+ auto *anOperation = new BOPAlgo_Section;
this->setImpl(anOperation);
this->setBuilderType(OCCT_BOPAlgo_Builder);
// Getting objects.
TopTools_ListOfShape anObjects;
- for (ListOfShape::const_iterator anObjectsIt = theObjects.begin();
- anObjectsIt != theObjects.end(); anObjectsIt++) {
- const TopoDS_Shape &aShape = (*anObjectsIt)->impl<TopoDS_Shape>();
+ for (const auto &theObject : theObjects) {
+ const auto &aShape = theObject->impl<TopoDS_Shape>();
if (!aShape.IsNull()) {
anObjects.Append(aShape);
}
}
- BOPAlgo_PaveFiller *aDSFiller = new BOPAlgo_PaveFiller;
+ auto *aDSFiller = new BOPAlgo_PaveFiller;
myFiller = aDSFiller;
aDSFiller->SetArguments(anObjects);
anOperation->PerformWithFiller(
*aDSFiller); // it references a filler fields, so keep the filler
- myFiller = 0;
+ myFiller = nullptr;
if (anOperation->HasErrors()) {
return;
}
const double theFuzzy = 1.e-8);
/// Destructor to erase the filler
- GEOMALGOAPI_EXPORT virtual ~GeomAlgoAPI_Intersection();
+ GEOMALGOAPI_EXPORT ~GeomAlgoAPI_Intersection() override;
private:
/// Builds resulting shape.
return;
}
- const TopoDS_Shape &aOriginalShape = theShape->impl<TopoDS_Shape>();
+ const auto &aOriginalShape = theShape->impl<TopoDS_Shape>();
Standard_Real aTol = theTolerance;
TopAbs_ShapeEnum aType = TopAbs_SHAPE;
}
// Initialize and build
- BRepOffsetAPI_ThruSections *ThruSections =
- new BRepOffsetAPI_ThruSections(anIsSolid);
+ auto *ThruSections = new BRepOffsetAPI_ThruSections(anIsSolid);
ThruSections->AddWire(TopoDS::Wire(aFirstShapeOut));
ThruSections->AddWire(TopoDS::Wire(aSecondShapeOut));
#include <GeomAlgoAPI_MakeShapeCustom.h>
//==================================================================================================
-GeomAlgoAPI_MakeShapeCustom::GeomAlgoAPI_MakeShapeCustom() {}
+GeomAlgoAPI_MakeShapeCustom::GeomAlgoAPI_MakeShapeCustom() = default;
//==================================================================================================
void GeomAlgoAPI_MakeShapeCustom::setResult(const GeomShapePtr theShape) {
myListOfMakeShape = theMakeShapeList;
- for (ListOfMakeShape::const_iterator anIt = theMakeShapeList.cbegin();
- anIt != theMakeShapeList.cend(); ++anIt) {
- myMap->merge((*anIt)->mapOfSubShapes());
+ for (const auto &anIt : theMakeShapeList) {
+ myMap->merge(anIt->mapOfSubShapes());
}
}
//==================================================================================================
bool GeomAlgoAPI_MakeShapeList::isDeleted(const GeomShapePtr theOldShape) {
- for (ListOfMakeShape::iterator aBuilderIt = myListOfMakeShape.begin();
- aBuilderIt != myListOfMakeShape.end(); ++aBuilderIt) {
- GeomMakeShapePtr aMakeShape = *aBuilderIt;
+ for (auto aMakeShape : myListOfMakeShape) {
if (aMakeShape->isDeleted(theOldShape)) {
return true;
}
aResultShapesMap.Add(theOldShape->impl<TopoDS_Shape>());
aResultShapesList.Append(theOldShape->impl<TopoDS_Shape>());
- for (ListOfMakeShape::iterator aBuilderIt = myListOfMakeShape.begin();
- aBuilderIt != myListOfMakeShape.end(); ++aBuilderIt) {
- GeomMakeShapePtr aMakeShape = *aBuilderIt;
+ for (auto aMakeShape : myListOfMakeShape) {
NCollection_Map<TopoDS_Shape> aTempShapes;
for (NCollection_Map<TopoDS_Shape>::Iterator aShapeIt(anAlgoShapes);
aShapeIt.More(); aShapeIt.Next()) {
aShape->setImpl(new TopoDS_Shape(aShapeIt.Value()));
ListOfShape aGeneratedShapes;
aMakeShape->generated(aShape, aGeneratedShapes);
- for (ListOfShape::const_iterator anIt = aGeneratedShapes.cbegin();
- anIt != aGeneratedShapes.cend(); ++anIt) {
- const TopoDS_Shape &anItShape = (*anIt)->impl<TopoDS_Shape>();
+ for (const auto &aGeneratedShape : aGeneratedShapes) {
+ const auto &anItShape = aGeneratedShape->impl<TopoDS_Shape>();
if (anItShape.IsSame(aShapeIt.Value())) {
anArgumentIsInResult = true;
continue;
}
ListOfShape aModifiedShapes;
aMakeShape->modified(aShape, aModifiedShapes);
- for (ListOfShape::const_iterator anIt = aModifiedShapes.cbegin();
- anIt != aModifiedShapes.cend(); ++anIt) {
- const TopoDS_Shape &anItShape = (*anIt)->impl<TopoDS_Shape>();
+ for (const auto &aModifiedShape : aModifiedShapes) {
+ const auto &anItShape = aModifiedShape->impl<TopoDS_Shape>();
if (anItShape.IsSame(aShapeIt.Value())) {
anArgumentIsInResult = true;
continue;
return;
}
- for (ListOfMakeShape::iterator aBuilderIt = myListOfMakeShape.begin();
- aBuilderIt != myListOfMakeShape.end(); ++aBuilderIt) {
- GeomMakeShapePtr aMakeShape = *aBuilderIt;
+ for (auto aMakeShape : myListOfMakeShape) {
aMakeShape->generated(theOldShape, theNewShapes);
}
}
return;
}
- for (ListOfMakeShape::iterator aBuilderIt = myListOfMakeShape.begin();
- aBuilderIt != myListOfMakeShape.end(); ++aBuilderIt) {
- GeomMakeShapePtr aMakeShape = *aBuilderIt;
+ for (auto aMakeShape : myListOfMakeShape) {
ListOfShape aModifiedShapes;
aMakeShape->modified(theOldShape, theNewShapes);
}
GeomAlgoAPI_MakeShapeSet(const ListOfMakeShape &theMakeShapeSet);
/// \return the list of shapes generated from the shape \a theShape
- GEOMALGOAPI_EXPORT virtual void generated(const GeomShapePtr theShape,
- ListOfShape &theHistory);
+ GEOMALGOAPI_EXPORT void generated(const GeomShapePtr theShape,
+ ListOfShape &theHistory) override;
/// \return the list of shapes modified from the shape \a theShape
- GEOMALGOAPI_EXPORT virtual void modified(const GeomShapePtr theShape,
- ListOfShape &theHistory);
+ GEOMALGOAPI_EXPORT void modified(const GeomShapePtr theShape,
+ ListOfShape &theHistory) override;
};
#endif
static void convertToTopoDS(const ListOfShape &theShapes,
TopTools_ListOfShape &theTopoDSShapes) {
- for (ListOfShape::const_iterator anIt = theShapes.begin();
- anIt != theShapes.end(); ++anIt)
- theTopoDSShapes.Append((*anIt)->impl<TopoDS_Shape>());
+ for (const auto &theShape : theShapes)
+ theTopoDSShapes.Append(theShape->impl<TopoDS_Shape>());
}
//=================================================================================================
}
// create make volume opration
- BOPAlgo_MakerVolume *aVolumeMaker = new BOPAlgo_MakerVolume;
+ auto *aVolumeMaker = new BOPAlgo_MakerVolume;
this->setImpl(aVolumeMaker);
this->setBuilderType(OCCT_BOPAlgo_Builder);
/// \param[in] theOldShape base shape.
/// \param[out] theNewShapes shapes modified from \a theShape. Does not
/// cleared!
- GEOMALGOAPI_EXPORT virtual void modified(const GeomShapePtr theOldShape,
- ListOfShape &theNewShapes);
+ GEOMALGOAPI_EXPORT void modified(const GeomShapePtr theOldShape,
+ ListOfShape &theNewShapes) override;
private:
/// Builds resulting shape.
}
int GeomAlgoAPI_NExplode::index(const GeomShapePtr theSubShape) {
- std::vector<GeomShapePtr>::iterator anIter = mySorted.begin();
+ auto anIter = mySorted.begin();
for (int anIndex = 1; anIter != mySorted.end(); anIter++, anIndex++) {
if ((*anIter)->isSame(theSubShape))
return anIndex;
}
GeomShapePtr GeomAlgoAPI_NExplode::shape(const int theIndex) {
- std::vector<GeomShapePtr>::iterator anIter = mySorted.begin();
+ auto anIter = mySorted.begin();
for (int anIndex = 1; anIter != mySorted.end(); anIter++, anIndex++) {
if (anIndex == theIndex)
return *anIter;
TColStd_IndexedDataMapOfTransientTransient aMapTShapes;
TopTools_MapOfShape aMapEdges;
for (auto anEdge : theEdges) {
- const TopoDS_Edge &aTEdge = anEdge->impl<TopoDS_Edge>();
+ const auto &aTEdge = anEdge->impl<TopoDS_Edge>();
if (aMapEdges.Add(aTEdge)) {
BRepBuilderAPI_Copy aCopy(aTEdge, Standard_False, Standard_False);
const TopoDS_Shape &aCopyEdge = aCopy.Shape();
void GeomAlgoAPI_Offset::build(const GeomShapePtr &theShape,
const double theOffsetValue) {
- BRepOffsetAPI_MakeOffsetShape *anOffsetAlgo =
- new BRepOffsetAPI_MakeOffsetShape;
+ auto *anOffsetAlgo = new BRepOffsetAPI_MakeOffsetShape;
anOffsetAlgo->PerformBySimple(theShape->impl<TopoDS_Shape>(), theOffsetValue);
setImpl(anOffsetAlgo);
setBuilderType(OCCT_BRepBuilderAPI_MakeShape);
const TopoDS_Face &aFace = aFaceBuilder.Face();
// 3. Make Offset
- BRepOffsetAPI_MakeOffset *aParal = new BRepOffsetAPI_MakeOffset;
+ auto *aParal = new BRepOffsetAPI_MakeOffset;
setImpl(aParal);
setBuilderType(OCCT_BRepBuilderAPI_MakeShape);
// results
GeomAlgoAPI_SortListOfShapes::sort(aCombiningShapes);
- for (ListOfShape::iterator anIt = aCombiningShapes.begin();
- anIt != aCombiningShapes.end(); ++anIt)
- aBuilder.Add(aResCompound, (*anIt)->impl<TopoDS_Shape>());
+ for (auto &aCombiningShape : aCombiningShapes)
+ aBuilder.Add(aResCompound, aCombiningShape->impl<TopoDS_Shape>());
}
theCompound = aResCompound;
}
// Creating partition operation.
- GEOMAlgo_Splitter *anOperation = new GEOMAlgo_Splitter;
+ auto *anOperation = new GEOMAlgo_Splitter;
this->setImpl(anOperation);
this->setBuilderType(OCCT_BOPAlgo_Builder);
TopTools_MapOfShape ShapesMap;
// Getting objects.
- for (ListOfShape::const_iterator anObjectsIt = theObjects.begin();
- anObjectsIt != theObjects.end(); anObjectsIt++) {
- const TopoDS_Shape &aShape = (*anObjectsIt)->impl<TopoDS_Shape>();
+ for (const auto &theObject : theObjects) {
+ const auto &aShape = theObject->impl<TopoDS_Shape>();
// #2240: decompose compounds to get the valid result
TopTools_ListOfShape aSimpleShapes;
prepareShapes(aShape, aSimpleShapes);
}
// Getting tools.
- for (ListOfShape::const_iterator aToolsIt = theTools.begin();
- aToolsIt != theTools.end(); aToolsIt++) {
- const TopoDS_Shape &aShape = (*aToolsIt)->impl<TopoDS_Shape>();
+ for (const auto &theTool : theTools) {
+ const auto &aShape = theTool->impl<TopoDS_Shape>();
// #2419: decompose compounds to get the valid result
TopTools_ListOfShape aSimpleShapes;
prepareShapes(aShape, aSimpleShapes);
void GeomAlgoAPI_PaveFiller::build(const ListOfShape &theListOfShape,
const bool theIsMakeCompSolids,
const double theFuzzy) {
- BOPAlgo_PaveFiller *aPaveFiller = new BOPAlgo_PaveFiller;
+ auto *aPaveFiller = new BOPAlgo_PaveFiller;
TopTools_ListOfShape aListOfShape;
- for (ListOfShape::const_iterator anIt = theListOfShape.cbegin();
- anIt != theListOfShape.cend(); anIt++) {
- const TopoDS_Shape &aShape = (*anIt)->impl<TopoDS_Shape>();
+ for (const auto &anIt : theListOfShape) {
+ const auto &aShape = anIt->impl<TopoDS_Shape>();
if (aShape.ShapeType() == TopAbs_COMPOUND) {
for (TopoDS_Iterator anIter(aShape); anIter.More(); anIter.Next()) {
aListOfShape.Append(anIter.Value());
if (aPaveFiller->HasErrors())
return;
- BOPAlgo_Builder *aBuilder = new BOPAlgo_Builder();
+ auto *aBuilder = new BOPAlgo_Builder();
this->setImpl(aBuilder);
this->setBuilderType(OCCT_BOPAlgo_Builder);
aBuilder->SetArguments(aListOfShape);
addMovedPath(anOldPath, aNewPath);
// Making pipe.
- BRepOffsetAPI_MakePipe *aPipeBuilder = NULL;
+ BRepOffsetAPI_MakePipe *aPipeBuilder = nullptr;
try {
aPipeBuilder = new BRepOffsetAPI_MakePipe(aPathWire, aBaseShape);
} catch (...) {
gp_Dir aBiNormalDir = aBiNormalLine->Lin().Direction();
// Making pipe.
- BRepOffsetAPI_MakePipeShell *aPipeBuilder =
- new BRepOffsetAPI_MakePipeShell(aPathWire);
+ auto *aPipeBuilder = new BRepOffsetAPI_MakePipeShell(aPathWire);
if (!aPipeBuilder) {
return;
}
// Get locations after moving path shape.
std::list<TopoDS_Vertex> aLocations;
- for (ListOfShape::const_iterator aLocIt = theLocations.cbegin();
- aLocIt != theLocations.cend(); ++aLocIt) {
- GeomShapePtr aLocation = *aLocIt;
+ for (auto aLocation : theLocations) {
if (!aLocation.get() || aLocation->shapeType() != GeomAPI_Shape::VERTEX) {
return;
}
if (!aPipeBuilder) {
return;
}
- ListOfShape::const_iterator aBaseIt = theBaseShapes.cbegin();
- std::list<TopoDS_Vertex>::const_iterator aLocationsIt = aLocations.cbegin();
+ auto aBaseIt = theBaseShapes.cbegin();
+ auto aLocationsIt = aLocations.cbegin();
while (aBaseIt != theBaseShapes.cend()) {
GeomShapePtr aBase = *aBaseIt;
if (!getBase(aBaseShape, aBaseShapeType, aBase)) {
}
// Initial shapes
- const TopoDS_Shape &aSourceShape = theSourceSolid->impl<TopoDS_Shape>();
- const TopoDS_Shape &aDestShape = theDestSolid->impl<TopoDS_Shape>();
+ const auto &aSourceShape = theSourceSolid->impl<TopoDS_Shape>();
+ const auto &aDestShape = theDestSolid->impl<TopoDS_Shape>();
// Check the material of the solids to be on the correct side
BRepClass3d_SolidClassifier aClassifier;
static const double aTransStep = 10. * Precision::Confusion();
true); // it is allways true for simple transformation generation
} else { // internal rebuild of the shape
// Transform the shape with copying it
- BRepBuilderAPI_Transform *aBuilder =
- new BRepBuilderAPI_Transform(aSourceShape, aTrsf, true);
+ auto *aBuilder = new BRepBuilderAPI_Transform(aSourceShape, aTrsf, true);
if (!aBuilder) {
return;
}
//==================================================================================================
std::shared_ptr<GeomAPI_Vertex>
GeomAlgoAPI_PointBuilder::vertex(const std::shared_ptr<GeomAPI_Pnt> thePoint) {
- const gp_Pnt &aPnt = thePoint->impl<gp_Pnt>();
+ const auto &aPnt = thePoint->impl<gp_Pnt>();
BRepBuilderAPI_MakeVertex aMaker(aPnt);
TopoDS_Vertex aVertex = aMaker.Vertex();
std::shared_ptr<GeomAPI_Vertex> aRes(new GeomAPI_Vertex);
GeomAbs_SurfaceType aType = aBAsurf.GetType();
BRep_Builder aBB;
- const Standard_Integer aNbFaces = (Standard_Integer)theFacesAndAreas.size();
+ const auto aNbFaces = (Standard_Integer)theFacesAndAreas.size();
const Standard_Integer aDiff = theNbExtremalFaces - theRemovedFaces.Extent();
}
// Getting base shape.
- const TopoDS_Shape &aBaseShape = theBaseShape->impl<TopoDS_Shape>();
+ const auto &aBaseShape = theBaseShape->impl<TopoDS_Shape>();
GeomAPI_Shape::ShapeType aShapeTypeToExp;
switch (aBaseShape.ShapeType()) {
case TopAbs_VERTEX:
const GeomShapePtr theBaseShape, const GeomDirPtr theDirection,
const double theToSize, const double theFromSize,
const GeomAPI_Shape::ShapeType theTypeToExp) {
- const TopoDS_Shape &aBaseShape = theBaseShape->impl<TopoDS_Shape>();
+ const auto &aBaseShape = theBaseShape->impl<TopoDS_Shape>();
gp_Vec anExtVec = theDirection->impl<gp_Dir>();
// Moving base shape.
gp_Trsf aTrsf;
aTrsf.SetTranslation(anExtVec * -theFromSize);
- BRepBuilderAPI_Transform *aTransformBuilder =
- new BRepBuilderAPI_Transform(aBaseShape, aTrsf);
+ auto *aTransformBuilder = new BRepBuilderAPI_Transform(aBaseShape, aTrsf);
if (!aTransformBuilder || !aTransformBuilder->IsDone()) {
return;
}
TopoDS_Shape aMovedBase = aTransformBuilder->Shape();
// Making prism.
- BRepPrimAPI_MakePrism *aPrismBuilder = new BRepPrimAPI_MakePrism(
+ auto *aPrismBuilder = new BRepPrimAPI_MakePrism(
aMovedBase, anExtVec * (theFromSize + theToSize));
if (!aPrismBuilder || !aPrismBuilder->IsDone()) {
return;
const GeomPlanePtr theToPlane, const double theToSize,
const GeomPlanePtr theFromPlane, const double theFromSize,
const GeomAPI_Shape::ShapeType theTypeToExp) {
- const TopoDS_Shape &aBaseShape = theBaseShape->impl<TopoDS_Shape>();
+ const auto &aBaseShape = theBaseShape->impl<TopoDS_Shape>();
gp_Vec anExtVec = theDirection->impl<gp_Dir>();
// Moving prism bounding faces according to "from" and "to" sizes.
Standard_Real aZArr[2] = {aBndBox.CornerMin().Z(), aBndBox.CornerMax().Z()};
gp_Pnt aPoints[8];
int aNum = 0;
- for (int i = 0; i < 2; i++) {
- for (int j = 0; j < 2; j++) {
- for (int k = 0; k < 2; k++) {
- aPoints[aNum] = gp_Pnt(aXArr[i], aYArr[j], aZArr[k]);
+ for (double i : aXArr) {
+ for (double j : aYArr) {
+ for (double k : aZArr) {
+ aPoints[aNum] = gp_Pnt(i, j, k);
aNum++;
}
}
IntAna_Quadric aBndFromQuadric(
gp_Pln(aFromPnt->impl<gp_Pnt>(), aFromDir->impl<gp_Dir>()));
Standard_Real aMaxToDist = 0, aMaxFromDist = 0;
- for (int i = 0; i < 8; i++) {
- gp_Lin aLine(aPoints[i], anExtVec);
+ for (const auto &aPoint : aPoints) {
+ gp_Lin aLine(aPoint, anExtVec);
IntAna_IntConicQuad aToIntAna(aLine, aBndToQuadric);
IntAna_IntConicQuad aFromIntAna(aLine, aBndFromQuadric);
if (aToIntAna.NbPoints() == 0 || aFromIntAna.NbPoints() == 0) {
}
const gp_Pnt &aPntOnToFace = aToIntAna.Point(1);
const gp_Pnt &aPntOnFromFace = aFromIntAna.Point(1);
- if (aPoints[i].Distance(aPntOnToFace) > aMaxToDist) {
- aMaxToDist = aPoints[i].Distance(aPntOnToFace);
+ if (aPoint.Distance(aPntOnToFace) > aMaxToDist) {
+ aMaxToDist = aPoint.Distance(aPntOnToFace);
}
- if (aPoints[i].Distance(aPntOnFromFace) > aMaxFromDist) {
- aMaxFromDist = aPoints[i].Distance(aPntOnFromFace);
+ if (aPoint.Distance(aPntOnFromFace) > aMaxFromDist) {
+ aMaxFromDist = aPoint.Distance(aPntOnFromFace);
}
}
// Moving base shape.
gp_Trsf aTrsf;
aTrsf.SetTranslation(anExtVec * -aPrismLength);
- BRepBuilderAPI_Transform *aTransformBuilder =
- new BRepBuilderAPI_Transform(aBaseShape, aTrsf);
+ auto *aTransformBuilder = new BRepBuilderAPI_Transform(aBaseShape, aTrsf);
if (!aTransformBuilder || !aTransformBuilder->IsDone()) {
return;
}
TopoDS_Shape aMovedBase = aTransformBuilder->Shape();
// Making prism.
- BRepPrimAPI_MakePrism *aPrismBuilder =
+ auto *aPrismBuilder =
new BRepPrimAPI_MakePrism(aMovedBase, anExtVec * 2 * aPrismLength);
if (!aPrismBuilder || !aPrismBuilder->IsDone()) {
return;
// Orienting bounding planes.
std::shared_ptr<GeomAPI_Pnt> aCentreOfMass =
GeomAlgoAPI_ShapeTools::centreOfMass(theBaseShape);
- const gp_Pnt &aCentrePnt = aCentreOfMass->impl<gp_Pnt>();
+ const auto &aCentrePnt = aCentreOfMass->impl<gp_Pnt>();
gp_Lin aLine(aCentrePnt, anExtVec);
IntAna_IntConicQuad aToIntAna(aLine, aBndToQuadric);
IntAna_IntConicQuad aFromIntAna(aLine, aBndFromQuadric);
aToPnt, aToDir, THE_FACE_SIZE_COEFF * aBndBoxSize);
// bounding planes
- const TopoDS_Shape &aToShape = aBoundingToShape->impl<TopoDS_Shape>();
- const TopoDS_Shape &aFromShape = aBoundingFromShape->impl<TopoDS_Shape>();
+ const auto &aToShape = aBoundingToShape->impl<TopoDS_Shape>();
+ const auto &aFromShape = aBoundingFromShape->impl<TopoDS_Shape>();
TopoDS_Face aToFace = TopoDS::Face(aToShape);
TopoDS_Face aFromFace = TopoDS::Face(aFromShape);
// Solid based on "To" bounding plane
gp_Vec aNormal = aToDir->impl<gp_Dir>();
- BRepPrimAPI_MakePrism *aToPrismBuilder =
+ auto *aToPrismBuilder =
new BRepPrimAPI_MakePrism(aToShape, aNormal * (-2.0 * aBndBoxSize));
if (!aToPrismBuilder || !aToPrismBuilder->IsDone()) {
return;
TopoDS_Shape aToSolid = aToPrismBuilder->Shape();
// Cutting with to plane.
- BRepAlgoAPI_Cut *aToCutBuilder = new BRepAlgoAPI_Cut(aResult, aToSolid);
+ auto *aToCutBuilder = new BRepAlgoAPI_Cut(aResult, aToSolid);
aToCutBuilder->Build();
if (!aToCutBuilder->IsDone()) {
return;
// Solid based on "From" bounding plane
aNormal = aFromDir->impl<gp_Dir>();
- BRepPrimAPI_MakePrism *aFromPrismBuilder =
+ auto *aFromPrismBuilder =
new BRepPrimAPI_MakePrism(aFromShape, aNormal * (-2.0 * aBndBoxSize));
if (!aFromPrismBuilder || !aFromPrismBuilder->IsDone()) {
return;
TopoDS_Shape aFromSolid = aFromPrismBuilder->Shape();
// Cutting with from plane.
- BRepAlgoAPI_Cut *aFromCutBuilder = new BRepAlgoAPI_Cut(aResult, aFromSolid);
+ auto *aFromCutBuilder = new BRepAlgoAPI_Cut(aResult, aFromSolid);
aFromCutBuilder->Build();
if (!aFromCutBuilder->IsDone()) {
return;
const bool theToIsPlanar, const GeomShapePtr theFromShape,
const double theFromSize, const bool theFromIsPlanar,
const GeomAPI_Shape::ShapeType theTypeToExp) {
- const TopoDS_Shape &aBaseShape = theBaseShape->impl<TopoDS_Shape>();
+ const auto &aBaseShape = theBaseShape->impl<TopoDS_Shape>();
gp_Vec anExtVec = theDirection->impl<gp_Dir>();
// Moving prism bounding faces according to "from" and "to" sizes.
// Prism building.
gp_Trsf aTrsf;
aTrsf.SetTranslation(anExtVec * -aPrismLength);
- BRepBuilderAPI_Transform *aTransformBuilder =
- new BRepBuilderAPI_Transform(aBaseShape, aTrsf);
+ auto *aTransformBuilder = new BRepBuilderAPI_Transform(aBaseShape, aTrsf);
if (!aTransformBuilder || !aTransformBuilder->IsDone()) {
return;
}
TopoDS_Shape aMovedBase = aTransformBuilder->Shape();
// Making prism.
- BRepPrimAPI_MakePrism *aPrismBuilder =
+ auto *aPrismBuilder =
new BRepPrimAPI_MakePrism(aMovedBase, anExtVec * 2 * aPrismLength);
if (!aPrismBuilder || !aPrismBuilder->IsDone()) {
return;
if (theFromIsPlanar) {
ListOfShape anImagesFrom;
aPartition->modified(aBoundingFromShape, anImagesFrom);
- for (ListOfShape::iterator anIt = anImagesFrom.begin();
- anIt != anImagesFrom.end(); ++anIt)
- addFromShape(*anIt);
+ for (auto &anIt : anImagesFrom)
+ addFromShape(anIt);
}
if (theToIsPlanar) {
ListOfShape anImagesTo;
aPartition->modified(aBoundingToShape, anImagesTo);
- for (ListOfShape::iterator anIt = anImagesTo.begin();
- anIt != anImagesTo.end(); ++anIt)
- addToShape(*anIt);
+ for (auto &anIt : anImagesTo)
+ addToShape(anIt);
}
// Collect results which have both boundaries, selected for extrusion,
// check all faces are in solid
bool isApplicable = true;
- for (std::list<ListOfShape>::const_iterator it1 = theShapesToExist.begin();
+ for (auto it1 = theShapesToExist.begin();
it1 != theShapesToExist.end() && isApplicable; ++it1) {
- ListOfShape::const_iterator it2 = it1->begin();
+ auto it2 = it1->begin();
for (; it2 != it1->end(); ++it2)
if (aFaces.find(*it2) != aFaces.end())
break;
void collectModified(const GeomMakeShapePtr &theOperation,
const ListOfShape &theShapes,
std::list<ListOfShape> &theModified) {
- for (ListOfShape::const_iterator anIt = theShapes.begin();
- anIt != theShapes.end(); ++anIt) {
+ for (const auto &theShape : theShapes) {
theModified.push_back(ListOfShape());
- theOperation->modified(*anIt, theModified.back());
- theOperation->generated(*anIt, theModified.back());
- theModified.back().push_back(*anIt);
+ theOperation->modified(theShape, theModified.back());
+ theOperation->generated(theShape, theModified.back());
+ theModified.back().push_back(theShape);
}
}
std::list<ListOfShape> aModifiedExclude;
collectModified(theOperation, theShapesToExclude, aModifiedExclude);
SetOfShape aTabooShapes;
- for (std::list<ListOfShape>::iterator anIt = aModifiedExclude.begin();
- anIt != aModifiedExclude.end(); ++anIt)
- aTabooShapes.insert(anIt->begin(), anIt->end());
+ for (auto &anIt : aModifiedExclude)
+ aTabooShapes.insert(anIt.begin(), anIt.end());
// type of sub-shapes to explode
GeomAPI_Shape::ShapeType aSubshapeType;
GeomCurvePtr GeomAlgoAPI_Projection::project(const GeomEdgePtr &theEdge) {
GeomCurvePtr aCurve(new GeomAPI_Curve);
- const TopoDS_Shape &aShape = theEdge->impl<TopoDS_Shape>();
+ const auto &aShape = theEdge->impl<TopoDS_Shape>();
TopoDS_Edge anEdge = TopoDS::Edge(aShape);
if (!anEdge.IsNull()) {
double aStart, aEnd;
}
// Getting base shape.
- const TopoDS_Shape &aBaseShape = theBaseShape->impl<TopoDS_Shape>();
+ const auto &aBaseShape = theBaseShape->impl<TopoDS_Shape>();
TopAbs_ShapeEnum aShapeTypeToExp;
switch (aBaseShape.ShapeType()) {
case TopAbs_VERTEX:
// Rotating base face with the negative value of "from angle".
gp_Trsf aBaseTrsf;
aBaseTrsf.SetRotation(anAxis, -theFromAngle / 180.0 * M_PI);
- BRepBuilderAPI_Transform *aBaseTransform =
+ auto *aBaseTransform =
new BRepBuilderAPI_Transform(aBaseShape, aBaseTrsf, true);
if (!aBaseTransform) {
return;
// Making revolution to the angle equal to the sum of "from angle" and "to
// angle".
- BRepPrimAPI_MakeRevol *aRevolBuilder = new BRepPrimAPI_MakeRevol(
+ auto *aRevolBuilder = new BRepPrimAPI_MakeRevol(
aRotatedBase, anAxis, (theFromAngle + theToAngle) / 180 * M_PI,
Standard_True);
if (!aRevolBuilder) {
} else if (theFromShape &&
theToShape) { // Case 2: When both bounding planes were set.
// Making revolution to the 360 angle.
- BRepPrimAPI_MakeRevol *aRevolBuilder =
+ auto *aRevolBuilder =
new BRepPrimAPI_MakeRevol(aBaseShape, anAxis, 2 * M_PI, Standard_True);
if (!aRevolBuilder) {
return;
aToSolid = aToTransform.Shape();
// Cutting revolution with from plane.
- BRepAlgoAPI_Cut *aFromCutBuilder = new BRepAlgoAPI_Cut(aResult, aFromSolid);
+ auto *aFromCutBuilder = new BRepAlgoAPI_Cut(aResult, aFromSolid);
aFromCutBuilder->Build();
if (!aFromCutBuilder->IsDone()) {
return;
}
// Cutting revolution with to plane.
- BRepAlgoAPI_Cut *aToCutBuilder = new BRepAlgoAPI_Cut(aResult, aToSolid);
+ auto *aToCutBuilder = new BRepAlgoAPI_Cut(aResult, aToSolid);
aToCutBuilder->Build();
if (!aToCutBuilder->IsDone()) {
return;
}
} else { // Case 3: When only one bounding plane was set.
// Making revolution to the 360 angle.
- BRepPrimAPI_MakeRevol *aRevolBuilder =
+ auto *aRevolBuilder =
new BRepPrimAPI_MakeRevol(aBaseShape, anAxis, 2 * M_PI, Standard_True);
if (!aRevolBuilder) {
return;
aBoundingSolid = aBoundingTransform.Shape();
// Cutting revolution with bounding plane.
- BRepAlgoAPI_Cut *aBoundingCutBuilder =
- new BRepAlgoAPI_Cut(aResult, aBoundingSolid);
+ auto *aBoundingCutBuilder = new BRepAlgoAPI_Cut(aResult, aBoundingSolid);
aBoundingCutBuilder->Build();
if (!aBoundingCutBuilder->IsDone()) {
return;
aBaseSolid = aBaseTransform.Shape();
// Cutting revolution with base.
- BRepAlgoAPI_Cut *aBaseCutBuilder = new BRepAlgoAPI_Cut(aResult, aBaseSolid);
+ auto *aBaseCutBuilder = new BRepAlgoAPI_Cut(aResult, aBaseSolid);
aBaseCutBuilder->Build();
if (aBaseCutBuilder->IsDone()) {
TopoDS_Shape aCutResult = aBaseCutBuilder->Shape();
GeomAlgoAPI_STEPAttributes anAttrs(aDoc->Main());
- std::list<std::shared_ptr<GeomAPI_Shape>>::const_iterator aShape =
- theShapes.cbegin();
- std::list<std::shared_ptr<ModelAPI_Result>>::const_iterator aResult =
- theResults.cbegin();
+ auto aShape = theShapes.cbegin();
+ auto aResult = theResults.cbegin();
for (; aShape != theShapes.cend(); aShape++, aResult++) {
TDF_Label aNullLab;
if (aResult->get() &&
//
#ifndef GEOMALGOAPI_STLIMPORT_H_
-#define GEOMALGOAPI_STLPIMPORT_H_
+#define GEOMALGOAPI_STLIMPORT_H_
#include <GeomAPI_Shape.h>
#include <GeomAlgoAPI.h>
return;
}
- const gp_Pnt &aCenterPoint = theCenterPoint->impl<gp_Pnt>();
+ const auto &aCenterPoint = theCenterPoint->impl<gp_Pnt>();
// Perform the rotation matrix
gp_Mat aMatRot(theScaleFactorX, 0., 0., 0., theScaleFactorY, 0., 0., 0.,
aGTrsf = aGTrsf0P.Multiplied(aGTrsf);
aGTrsf = aGTrsf.Multiplied(aGTrsfP0);
- const TopoDS_Shape &aSourceShape = theSourceShape->impl<TopoDS_Shape>();
+ const auto &aSourceShape = theSourceShape->impl<TopoDS_Shape>();
if (aSourceShape.IsNull()) {
myError =
}
// Transform the shape while copying it.
- BRepBuilderAPI_GTransform *aBuilder =
- new BRepBuilderAPI_GTransform(aSourceShape, aGTrsf, true);
+ auto *aBuilder = new BRepBuilderAPI_GTransform(aSourceShape, aGTrsf, true);
if (!aBuilder) {
myError = "Scale builder :: transform initialization failed.";
return;
return;
}
- BRepBuilderAPI_Sewing *aSewingBuilder = new BRepBuilderAPI_Sewing();
+ auto *aSewingBuilder = new BRepBuilderAPI_Sewing();
this->setImpl(aSewingBuilder);
if (!myBuildShell) {
aSewingBuilder->SetNonManifoldMode(theAllowNonManifold);
}
- for (ListOfShape::const_iterator anIt = theShapes.cbegin();
- anIt != theShapes.cend(); ++anIt) {
- const TopoDS_Shape &aShape = (*anIt)->impl<TopoDS_Shape>();
+ for (const auto &theShape : theShapes) {
+ const auto &aShape = theShape->impl<TopoDS_Shape>();
aSewingBuilder->Add(aShape);
}
return;
}
- const TopoDS_Shape &aShape = theShape->impl<TopoDS_Shape>();
- const BRepBuilderAPI_Sewing &aSewingBuilder =
- this->impl<BRepBuilderAPI_Sewing>();
+ const auto &aShape = theShape->impl<TopoDS_Shape>();
+ const auto &aSewingBuilder = this->impl<BRepBuilderAPI_Sewing>();
TopoDS_Shape aModifiedShape = aSewingBuilder.Modified(aShape);
if (aModifiedShape.IsEqual(aShape)) {
/// \return the list of shapes modified from the shape \a theShape.
/// \param[in] theShape base shape.
/// \param[out] theHistory modified shapes.
- GEOMALGOAPI_EXPORT virtual void
+ GEOMALGOAPI_EXPORT void
modified(const std::shared_ptr<GeomAPI_Shape> theShape,
- ListOfShape &theHistory);
+ ListOfShape &theHistory) override;
protected:
bool myBuildShell; // whether algorithm is used by MakeShell or by Sewing
return;
}
- TopoDS_Shape *aShape = theShape->implPtr<TopoDS_Shape>();
- const TopoDS_Shape &aShapeToAdd = theShapeToAdd->impl<TopoDS_Shape>();
+ auto *aShape = theShape->implPtr<TopoDS_Shape>();
+ const auto &aShapeToAdd = theShapeToAdd->impl<TopoDS_Shape>();
BRep_Builder aBuilder;
aBuilder.Add(*aShape, aShapeToAdd);
return;
}
- TopoDS_Shape *aShape = theShape->implPtr<TopoDS_Shape>();
- const TopoDS_Shape &aShapeToRemove = theShapeToRemove->impl<TopoDS_Shape>();
+ auto *aShape = theShape->implPtr<TopoDS_Shape>();
+ const auto &aShapeToRemove = theShapeToRemove->impl<TopoDS_Shape>();
BRep_Builder aBuilder;
aBuilder.Remove(*aShape, aShapeToRemove);
}
//==================================================================================================
-GeomAlgoAPI_ShapeBuilder::GeomAlgoAPI_ShapeBuilder() {}
+GeomAlgoAPI_ShapeBuilder::GeomAlgoAPI_ShapeBuilder() = default;
//==================================================================================================
void GeomAlgoAPI_ShapeBuilder::removeInternal(
}
this->appendAlgo(aMakeShapeCustom);
} else if (aBaseShapeType == GeomAPI_Shape::FACE) {
- const TopoDS_Shape &aBaseShape = theShape->impl<TopoDS_Shape>();
- BRepBuilderAPI_Copy *aCopyBuilder = new BRepBuilderAPI_Copy(aBaseShape);
+ const auto &aBaseShape = theShape->impl<TopoDS_Shape>();
+ auto *aCopyBuilder = new BRepBuilderAPI_Copy(aBaseShape);
this->appendAlgo(std::shared_ptr<GeomAlgoAPI_MakeShape>(
new GeomAlgoAPI_MakeShape(aCopyBuilder)));
if (!aCopyBuilder->IsDone()) {
if (!theShape.get()) {
return;
}
- const TopoDS_Shape &aBaseShape = theShape->impl<TopoDS_Shape>();
+ const auto &aBaseShape = theShape->impl<TopoDS_Shape>();
TopAbs_ShapeEnum aBaseShapeType = aBaseShape.ShapeType();
// Copy base shape.
- BRepBuilderAPI_Copy *aCopyBuilder = new BRepBuilderAPI_Copy(aBaseShape);
+ auto *aCopyBuilder = new BRepBuilderAPI_Copy(aBaseShape);
this->appendAlgo(std::shared_ptr<GeomAlgoAPI_MakeShape>(
new GeomAlgoAPI_MakeShape(aCopyBuilder)));
if (!aCopyBuilder->IsDone()) {
BRep_Builder aBuilder;
std::shared_ptr<GeomAlgoAPI_MakeShapeCustom> aMakeShapeCustom(
new GeomAlgoAPI_MakeShapeCustom());
- for (ListOfShape::const_iterator anIt = theShapesToAdd.cbegin();
- anIt != theShapesToAdd.cend(); ++anIt) {
- TopoDS_Shape aShapeToAdd = (*anIt)->impl<TopoDS_Shape>();
+ for (const auto &anIt : theShapesToAdd) {
+ TopoDS_Shape aShapeToAdd = anIt->impl<TopoDS_Shape>();
TopoDS_Shape aModShapeToAdd = aShapeToAdd;
aModShapeToAdd.Orientation(TopAbs_INTERNAL);
for (TopExp_Explorer aResExp(aResultShape, TopAbs_VERTEX); aResExp.More();
GeomAlgoAPI_ShapeInfo::Values::Values(
const GeomAlgoAPI_ShapeInfo::InfoType theType)
: myType(theType) {
- static GeomAlgoAPI_ShapeInfo::Translator *kDefaultTr =
- new GeomAlgoAPI_ShapeInfo::Translator;
+ static auto *kDefaultTr = new GeomAlgoAPI_ShapeInfo::Translator;
myTr = kDefaultTr;
}
/// Keeps values of different possible types, used in python shapeInfo.
class GeomAlgoAPI_InfoValue {
- int myType; //< type stored in this Value
+ int myType{-1}; //< type stored in this Value
std::string myStr; //< type 0
double myDouble; //< type 1
bool myBool; //< type 2
public:
- GeomAlgoAPI_InfoValue() : myType(-1) {} // invalid case
+ GeomAlgoAPI_InfoValue() {} // invalid case
GeomAlgoAPI_InfoValue(const char *theVal) : myType(0), myStr(theVal) {}
GeomAlgoAPI_InfoValue(const std::string theVal) : myType(0), myStr(theVal) {}
GeomAlgoAPI_InfoValue(const double theVal) : myType(1), myDouble(theVal) {}
/// It is provided by a caller of this class.
class Translator {
public:
- Translator() {}
+ Translator() = default;
GEOMALGOAPI_EXPORT virtual std::string translate(const char *theSource) {
return theSource;
}
if (!theShape.get()) {
return 0.0;
}
- const TopoDS_Shape &aShape = theShape->impl<TopoDS_Shape>();
+ const auto &aShape = theShape->impl<TopoDS_Shape>();
if (aShape.IsNull()) {
return 0.0;
}
if (!theShape.get()) {
return 0.0;
}
- const TopoDS_Shape &aShape = theShape->impl<TopoDS_Shape>();
+ const auto &aShape = theShape->impl<TopoDS_Shape>();
if (aShape.IsNull()) {
return 0.0;
}
if (!theShape.get()) {
return 0.0;
}
- const TopoDS_Shape &aShape = theShape->impl<TopoDS_Shape>();
+ const auto &aShape = theShape->impl<TopoDS_Shape>();
if (aShape.IsNull()) {
return 0.0;
}
theError = "isContinuousFaces : An invalid argument";
return false;
}
- const gp_Pnt &aPoint = thePoint->impl<gp_Pnt>();
+ const auto &aPoint = thePoint->impl<gp_Pnt>();
// Getting base shape.
if (!theFace1.get()) {
if (!theShape) {
return std::shared_ptr<GeomAPI_Pnt>();
}
- const TopoDS_Shape &aShape = theShape->impl<TopoDS_Shape>();
+ const auto &aShape = theShape->impl<TopoDS_Shape>();
if (aShape.IsNull()) {
return std::shared_ptr<GeomAPI_Pnt>();
}
const std::shared_ptr<GeomAPI_Face> &theCylinder) {
double aRadius = -1.0;
if (theCylinder->isCylindrical()) {
- const TopoDS_Shape &aShape = theCylinder->impl<TopoDS_Shape>();
+ const auto &aShape = theCylinder->impl<TopoDS_Shape>();
Handle(Geom_Surface) aSurf = BRep_Tool::Surface(TopoDS::Face(aShape));
Handle(Geom_CylindricalSurface) aCyl =
Handle(Geom_CylindricalSurface)::DownCast(aSurf);
auto getExtemaDistShape =
[](const GeomShapePtr &theShape1,
const GeomShapePtr &theShape2) -> BRepExtrema_DistShapeShape {
- const TopoDS_Shape &aShape1 = theShape1->impl<TopoDS_Shape>();
- const TopoDS_Shape &aShape2 = theShape2->impl<TopoDS_Shape>();
+ const auto &aShape1 = theShape1->impl<TopoDS_Shape>();
+ const auto &aShape2 = theShape2->impl<TopoDS_Shape>();
BRepExtrema_DistShapeShape aDist(aShape1, aShape2);
aDist.Perform();
if (!theShape1.get() || !theShape2.get())
return aResult;
- const TopoDS_Shape &aShape1 = theShape1->impl<TopoDS_Shape>();
- const TopoDS_Shape &aShape2 = theShape2->impl<TopoDS_Shape>();
+ const auto &aShape1 = theShape1->impl<TopoDS_Shape>();
+ const auto &aShape2 = theShape2->impl<TopoDS_Shape>();
TopAbs_ShapeEnum aType1 = aShape1.ShapeType();
TopAbs_ShapeEnum aType2 = aShape2.ShapeType();
// Get free shapes.
int anOrder = 0;
- const TopoDS_Shape &aShapesComp = theCompound->impl<TopoDS_Shape>();
+ const auto &aShapesComp = theCompound->impl<TopoDS_Shape>();
for (TopoDS_Iterator anIter(aShapesComp); anIter.More();
anIter.Next(), anOrder++) {
const TopoDS_Shape &aShape = anIter.Value();
TopoDS_Builder aBuilder;
aBuilder.MakeCompound(aResultComp);
// put to result compound and result list in accordance to the order numbers
- std::map<GeomShapePtr, int>::iterator anInputIter = anInputOrder.begin();
+ auto anInputIter = anInputOrder.begin();
std::map<int, GeomShapePtr> aNums;
for (; anInputIter != anInputOrder.end(); anInputIter++)
aNums[anInputIter->second] = anInputIter->first;
- std::map<int, GeomShapePtr>::iterator aNumsIter = aNums.begin();
+ auto aNumsIter = aNums.begin();
for (; aNumsIter != aNums.end(); aNumsIter++) {
aBuilder.Add(aResultComp, (aNumsIter->second)->impl<TopoDS_Shape>());
theResuts.push_back(aNumsIter->second);
bool GeomAlgoAPI_ShapeTools::hasSharedTopology(
const ListOfShape &theShapes, const GeomAPI_Shape::ShapeType theShapeType) {
TopTools_IndexedMapOfShape aSubs;
- for (ListOfShape::const_iterator anIt = theShapes.begin();
- anIt != theShapes.end(); ++anIt) {
+ for (const auto &theShape : theShapes) {
TopTools_IndexedMapOfShape aCurSubs;
- TopExp::MapShapes((*anIt)->impl<TopoDS_Shape>(),
+ TopExp::MapShapes(theShape->impl<TopoDS_Shape>(),
(TopAbs_ShapeEnum)theShapeType, aCurSubs);
for (TopTools_IndexedMapOfShape::Iterator aSubIt(aCurSubs); aSubIt.More();
aSubIt.Next()) {
Bnd_Box aBndBox;
// Getting box.
- for (ListOfShape::const_iterator anObjectsIt = theShapes.begin();
- anObjectsIt != theShapes.end(); anObjectsIt++) {
- const TopoDS_Shape &aShape = (*anObjectsIt)->impl<TopoDS_Shape>();
+ for (const auto &theShape : theShapes) {
+ const auto &aShape = theShape->impl<TopoDS_Shape>();
BRepBndLib::Add(aShape, aBndBox);
}
Standard_Real aYArr[2] = {aBndBox.CornerMin().Y(), aBndBox.CornerMax().Y()};
Standard_Real aZArr[2] = {aBndBox.CornerMin().Z(), aBndBox.CornerMax().Z()};
std::list<std::shared_ptr<GeomAPI_Pnt>> aResultPoints;
- for (int i = 0; i < 2; i++) {
- for (int j = 0; j < 2; j++) {
- for (int k = 0; k < 2; k++) {
- std::shared_ptr<GeomAPI_Pnt> aPnt(
- new GeomAPI_Pnt(aXArr[i], aYArr[j], aZArr[k]));
+ for (double i : aXArr) {
+ for (double j : aYArr) {
+ for (double k : aZArr) {
+ std::shared_ptr<GeomAPI_Pnt> aPnt(new GeomAPI_Pnt(i, j, k));
aResultPoints.push_back(aPnt);
}
}
return aResultFace;
}
- const TopoDS_Shape &aShape = thePlane->impl<TopoDS_Shape>();
+ const auto &aShape = thePlane->impl<TopoDS_Shape>();
if (aShape.ShapeType() != TopAbs_FACE) {
return aResultFace;
}
IntAna_Quadric aQuadric(aFacePln);
Standard_Real UMin, UMax, VMin, VMax;
UMin = UMax = VMin = VMax = 0;
- for (std::list<std::shared_ptr<GeomAPI_Pnt>>::const_iterator aPointsIt =
- thePoints.begin();
- aPointsIt != thePoints.end(); aPointsIt++) {
- const gp_Pnt &aPnt = (*aPointsIt)->impl<gp_Pnt>();
+ for (const auto &thePoint : thePoints) {
+ const auto &aPnt = thePoint->impl<gp_Pnt>();
gp_Lin aLin(aPnt, aFacePln.Axis().Direction());
IntAna_IntConicQuad anIntAna(aLin, aQuadric);
const gp_Pnt &aPntOnFace = anIntAna.Point(1);
theV2 = aVertex;
if (theShape) {
- const TopoDS_Shape &aShape = theShape->impl<TopoDS_Shape>();
+ const auto &aShape = theShape->impl<TopoDS_Shape>();
TopoDS_Vertex aV1, aV2;
ShapeAnalysis::FindBounds(aShape, aV1, aV2);
BRepAlgo_FaceRestrictor aFRestrictor;
aFRestrictor.Init(aFace, Standard_False, Standard_True);
- for (ListOfShape::const_iterator anIt = theWires.cbegin();
- anIt != theWires.cend(); ++anIt) {
- TopoDS_Wire aWire = TopoDS::Wire((*anIt)->impl<TopoDS_Shape>());
+ for (const auto &theWire : theWires) {
+ TopoDS_Wire aWire = TopoDS::Wire(theWire->impl<TopoDS_Shape>());
aFRestrictor.Add(aWire);
}
BRep_Builder aBuilder;
aBuilder.MakeCompound(aCompound);
- for (ListOfShape::const_iterator anIt = theShapes.cbegin();
- anIt != theShapes.cend(); ++anIt) {
- aBuilder.Add(aCompound, (*anIt)->impl<TopoDS_Shape>());
+ for (const auto &theShape : theShapes) {
+ aBuilder.Add(aCompound, theShape->impl<TopoDS_Shape>());
}
BRepBuilderAPI_FindPlane aFindPlane(aCompound);
return false;
}
- const TopoDS_Shape &aSubShape = theSubShape->impl<TopoDS_Shape>();
- const TopoDS_Shape &aBaseShape = theBaseShape->impl<TopoDS_Shape>();
+ const auto &aSubShape = theSubShape->impl<TopoDS_Shape>();
+ const auto &aBaseShape = theBaseShape->impl<TopoDS_Shape>();
if (aSubShape.ShapeType() == TopAbs_VERTEX) {
// If sub-shape is a vertex check distance to shape. If it is <=
Standard_Real aFirst, aLast;
Handle(Geom_Curve) aCurve = BRep_Tool::Curve(aBaseEdge, aFirst, aLast);
- PointToRefsMap::const_iterator aPIt = thePointsInfo.begin();
+ auto aPIt = thePointsInfo.begin();
std::shared_ptr<GeomAPI_Pnt> aPnt = aPIt->first;
gp_Pnt aPoint(aPnt->x(), aPnt->y(), aPnt->z());
}
aBOP.AddArgument(aBaseEdge);
- PointToRefsMap::const_iterator aPIt = thePointsInfo.begin();
+ auto aPIt = thePointsInfo.begin();
for (; aPIt != thePointsInfo.end(); ++aPIt) {
std::shared_ptr<GeomAPI_Pnt> aPnt = aPIt->first;
TopoDS_Vertex aV =
Standard_Real aFirst, aLast;
Handle(Geom_Curve) aCurve = BRep_Tool::Curve(aBaseEdge, aFirst, aLast);
- std::list<std::shared_ptr<GeomAPI_Pnt>>::const_iterator aPIt =
- thePoints.begin();
+ auto aPIt = thePoints.begin();
gp_Pnt aPoint((*aPIt)->x(), (*aPIt)->y(), (*aPIt)->z());
TopAbs_Orientation anOrientation = aBaseEdge.Orientation();
}
aBOP.AddArgument(aBaseEdge);
- std::list<std::shared_ptr<GeomAPI_Pnt>>::const_iterator aPtIt =
- thePoints.begin();
+ auto aPtIt = thePoints.begin();
for (; aPtIt != thePoints.end(); ++aPtIt) {
std::shared_ptr<GeomAPI_Pnt> aPnt = *aPtIt;
TopoDS_Vertex aV =
std::shared_ptr<GeomAPI_Shape> aResultShape;
if (thePoints.size() == 2) {
- std::list<std::shared_ptr<GeomAPI_Pnt>>::const_iterator aPntIt =
- thePoints.begin();
+ auto aPntIt = thePoints.begin();
std::shared_ptr<GeomAPI_Pnt> aFirstPoint = *aPntIt;
aPntIt++;
std::shared_ptr<GeomAPI_Pnt> aLastPoint = *aPntIt;
- std::set<std::shared_ptr<GeomAPI_Shape>>::const_iterator
- anIt = theShapes.begin(),
- aLast = theShapes.end();
+ auto anIt = theShapes.begin(), aLast = theShapes.end();
for (; anIt != aLast; anIt++) {
GeomShapePtr aShape = *anIt;
std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(aShape));
theMin = RealLast();
theMax = RealFirst();
// Project bounding points on theDir
- for (std::list<std::shared_ptr<GeomAPI_Pnt>>::const_iterator aPointsIt =
- thePoints.begin();
- aPointsIt != thePoints.end(); aPointsIt++) {
- const gp_Pnt &aPnt = (*aPointsIt)->impl<gp_Pnt>();
+ for (const auto &thePoint : thePoints) {
+ const auto &aPnt = thePoint->impl<gp_Pnt>();
gp_Dir aPntDir(aPnt.XYZ());
Standard_Real proj = (theDir * aPntDir) * aPnt.XYZ().Modulus();
if (proj < theMin)
theToSize = 0.0;
theFromSize = 0.0;
- for (ListOfShape::const_iterator anIt = theBaseShapes.begin();
- anIt != theBaseShapes.end(); ++anIt) {
- const GeomShapePtr &aBaseShape_i = (*anIt);
+ for (const auto &aBaseShape_i : theBaseShapes) {
ListOfShape aBaseShapes_i;
aBaseShapes_i.push_back(aBaseShape_i);
// Direction (normal to aBaseShapes_i)
// Code like in GeomAlgoAPI_Prism
gp_Dir aDir;
- const TopoDS_Shape &aBaseShape = aBaseShape_i->impl<TopoDS_Shape>();
+ const auto &aBaseShape = aBaseShape_i->impl<TopoDS_Shape>();
BRepBuilderAPI_FindPlane aFindPlane(aBaseShape);
if (aFindPlane.Found() == Standard_True) {
Handle(Geom_Plane) aPlane;
const std::list<std::shared_ptr<GeomAPI_Shape>> &theInitialShapes) {
// Try to find edge lying on the one of original edges.
// First found edge will be taken as a start edge for the result wire
- std::list<std::shared_ptr<GeomAPI_Shape>>::const_iterator aFeatIt =
- theInitialShapes.begin();
+ auto aFeatIt = theInitialShapes.begin();
for (; aFeatIt != theInitialShapes.end(); aFeatIt++) {
std::shared_ptr<GeomAPI_Shape> aShape(*aFeatIt);
- const TopoDS_Edge &anEdge = aShape->impl<TopoDS_Edge>();
+ const auto &anEdge = aShape->impl<TopoDS_Edge>();
if (anEdge.ShapeType() != TopAbs_EDGE)
continue;
// collect indices of all edges to operate them quickly
NCollection_DataMap<Handle(Geom_Curve), int>
aCurveToIndex; // curve -> index in initial shapes
- std::list<std::shared_ptr<GeomAPI_Shape>>::const_iterator aFeatIt =
- theInitialShapes.begin();
+ auto aFeatIt = theInitialShapes.begin();
for (int anIndex = 0; aFeatIt != theInitialShapes.end(); aFeatIt++) {
std::shared_ptr<GeomAPI_Shape> aShape(*aFeatIt);
- const TopoDS_Edge &anEdge = aShape->impl<TopoDS_Edge>();
+ const auto &anEdge = aShape->impl<TopoDS_Edge>();
if (anEdge.ShapeType() != TopAbs_EDGE)
continue;
// Use General Fuse algorithm to prepare all subfaces, bounded by given list
// of edges
- BOPAlgo_Builder *aBB = new BOPAlgo_Builder;
+ auto *aBB = new BOPAlgo_Builder;
aBB->AddArgument(aPlnFace);
// Set fuzzy value for BOP, because PlaneGCS can solve the set of constraints
// with the precision up to 5.e-5 if the sketch contains arcs.
NCollection_List<TopoDS_Shape> anEdges;
NCollection_List<TopoDS_Shape>::Iterator aShapeIt;
- std::list<std::shared_ptr<GeomAPI_Shape>>::const_iterator aFeatIt =
- theEdges.begin();
+ auto aFeatIt = theEdges.begin();
for (; aFeatIt != theEdges.end(); aFeatIt++) {
std::shared_ptr<GeomAPI_Shape> aShape(*aFeatIt);
- const TopoDS_Edge &anEdge = aShape->impl<TopoDS_Edge>();
+ const auto &anEdge = aShape->impl<TopoDS_Edge>();
if (anEdge.ShapeType() == TopAbs_EDGE)
aBB->AddArgument(anEdge);
}
if (theShape->shapeType() == GeomAPI_Shape::FACE) {
// middle point may be out of face (within a hole),
// in this case, find the nearest point on the face
- const TopoDS_Face &aFace = theShape->impl<TopoDS_Face>();
+ const auto &aFace = theShape->impl<TopoDS_Face>();
BRepClass_FaceClassifier aFaceClassifier(aFace, aPointOnFace, theTolerance);
if (aFaceClassifier.State() == TopAbs_OUT) {
BRepBuilderAPI_MakeVertex aVertex(aPointOnFace);
GeomAlgoAPI_SolidClassifier::State aResult =
GeomAlgoAPI_SolidClassifier::State_UNKNOWN;
- const TopoDS_Shape &aSolid = theSolid->impl<TopoDS_Shape>();
- const TopoDS_Shape &aShape = theShape->impl<TopoDS_Shape>();
+ const auto &aSolid = theSolid->impl<TopoDS_Shape>();
+ const auto &aShape = theShape->impl<TopoDS_Shape>();
for (TopExp_Explorer anExp(aSolid, TopAbs_SHELL); anExp.More();
anExp.Next()) {
// compare distance from the shape to the solid's shells
/// \brief Classify shape according to the given solid.
class GeomAlgoAPI_SolidClassifier {
public:
- typedef int State;
+ using State = int;
static const State State_UNKNOWN = 0x0;
static const State State_IN = 0x1;
}
Bnd_Box boundingBox(const GeomShapePtr &theShape) {
- const TopoDS_Shape &aShape = theShape->impl<TopoDS_Shape>();
+ const auto &aShape = theShape->impl<TopoDS_Shape>();
TopoDS_TShape *aS = aShape.TShape().get();
- std::map<TopoDS_TShape *, Bnd_Box>::iterator aFound = myShapes.find(aS);
+ auto aFound = myShapes.find(aS);
if (aFound == myShapes.end()) {
Bnd_Box aBB;
BRepBndLib::AddOptimal(aShape, aBB, false);
Bnd_Box2d boundingBoxUV(const TopoDS_Face &theFace) {
TopoDS_TShape *aFacePtr = theFace.TShape().get();
- std::map<TopoDS_TShape *, Bnd_Box2d>::iterator aFound =
- myUVBounds.find(aFacePtr);
+ auto aFound = myUVBounds.find(aFacePtr);
if (aFound == myUVBounds.end()) {
Bnd_Box2d aBB;
BRepTools::AddUVBounds(theFace, aBB);
if (isRootGeo) {
buildRootSphere();
} else {
- const gp_Pnt &aCenterPoint = myCenterPoint->impl<gp_Pnt>();
+ const auto &aCenterPoint = myCenterPoint->impl<gp_Pnt>();
// Construct the sphere
- BRepPrimAPI_MakeSphere *aSphereMaker =
- new BRepPrimAPI_MakeSphere(aCenterPoint, myRadius);
+ auto *aSphereMaker = new BRepPrimAPI_MakeSphere(aCenterPoint, myRadius);
aSphereMaker->Build();
// Build the solid using the section face we've created and a revolution
// builder
- BRepPrimAPI_MakeRevol *aRevolBuilder = new BRepPrimAPI_MakeRevol(
+ auto *aRevolBuilder = new BRepPrimAPI_MakeRevol(
aFaceBuilder.Face(), aZAxis, myPhiMax * M_PI / 180., Standard_True);
if (!aRevolBuilder) {
return;
using namespace GeomAlgoAPI_Tools;
Localizer::Localizer() {
- myCurLocale = std::setlocale(LC_NUMERIC, 0);
+ myCurLocale = std::setlocale(LC_NUMERIC, nullptr);
std::setlocale(LC_NUMERIC, "C");
}
void GeomAlgoAPI_Torus::build() {
myCreatedFaces.clear();
- const gp_Ax2 &anAxis = myAxis->impl<gp_Ax2>();
+ const auto &anAxis = myAxis->impl<gp_Ax2>();
// Construct the torus
- BRepPrimAPI_MakeTorus *aTorusMaker =
- new BRepPrimAPI_MakeTorus(anAxis, myRadius, myRingRadius);
+ auto *aTorusMaker = new BRepPrimAPI_MakeTorus(anAxis, myRadius, myRingRadius);
aTorusMaker->Build();
const double theRingRadius);
/// Checks if data for the torus construction is OK.
- GEOMALGOAPI_EXPORT bool check();
+ GEOMALGOAPI_EXPORT bool check() override;
/// Builds the torus.
- GEOMALGOAPI_EXPORT void build();
+ GEOMALGOAPI_EXPORT void build() override;
private:
std::shared_ptr<GeomAPI_Ax2> myAxis; /// Axis of the torus.
return;
}
- const TopoDS_Shape &aSourceShape = theSourceShape->impl<TopoDS_Shape>();
- const gp_Trsf &aTrsf = theTrsf->impl<gp_Trsf>();
+ const auto &aSourceShape = theSourceShape->impl<TopoDS_Shape>();
+ const auto &aTrsf = theTrsf->impl<gp_Trsf>();
if (aSourceShape.IsNull()) {
myError =
return;
}
- BRepBuilderAPI_Transform *aBuilder =
- new BRepBuilderAPI_Transform(aSourceShape, aTrsf, true);
+ auto *aBuilder = new BRepBuilderAPI_Transform(aSourceShape, aTrsf, true);
if (!aBuilder)
return;
protected:
/// \brief Default constructor (to be used in the derived classes)
- GeomAlgoAPI_Transform() {}
+ GeomAlgoAPI_Transform() = default;
/// Builds resulting shape.
void build(std::shared_ptr<GeomAPI_Shape> theSourceShape,
#include <TopoDS_Wire.hxx>
//=================================================================================================
-GeomAlgoAPI_Tube::GeomAlgoAPI_Tube() {}
+GeomAlgoAPI_Tube::GeomAlgoAPI_Tube() = default;
//=================================================================================================
GeomAlgoAPI_Tube::GeomAlgoAPI_Tube(const double theRMin, const double theRMax,
gp_Vec aVec(aNormal);
gp_Trsf aTrsf;
aTrsf.SetTranslation(aVec * -myZ / 2);
- BRepBuilderAPI_Transform *aTranformBuilder =
- new BRepBuilderAPI_Transform(aFace, aTrsf);
+ auto *aTranformBuilder = new BRepBuilderAPI_Transform(aFace, aTrsf);
if (!aTranformBuilder || !aTranformBuilder->IsDone()) {
myError = "Tube builder :: algorithm failed";
return;
}
TopoDS_Shape aMovedBase = aTranformBuilder->Shape();
- BRepPrimAPI_MakePrism *aPrismBuilder =
- new BRepPrimAPI_MakePrism(aMovedBase, aVec * myZ);
+ auto *aPrismBuilder = new BRepPrimAPI_MakePrism(aMovedBase, aVec * myZ);
std::shared_ptr<GeomAPI_Shape> aShape =
std::shared_ptr<GeomAPI_Shape>(new GeomAPI_Shape());
const double theRMax, const double theZ);
/// Checks if data for the torus construction is OK.
- GEOMALGOAPI_EXPORT bool check();
+ GEOMALGOAPI_EXPORT bool check() override;
/// Builds the torus.
- GEOMALGOAPI_EXPORT void build();
+ GEOMALGOAPI_EXPORT void build() override;
private:
/// Builds the the tube with the inside radius, the outside radius and the
return;
}
- const TopoDS_Shape &aShell = aResults.front()->impl<TopoDS_Shape>();
+ const auto &aShell = aResults.front()->impl<TopoDS_Shape>();
std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
aShape->setImpl(new TopoDS_Shape(aShell));
//==================================================================================================
void GeomAlgoAPI_UnifySameDomain::build(const GeomShapePtr &theShape,
const bool theIsToSimplifyShell) {
- ShapeUpgrade_UnifySameDomain *aUnifyAlgo = new ShapeUpgrade_UnifySameDomain();
+ auto *aUnifyAlgo = new ShapeUpgrade_UnifySameDomain();
this->setImpl(aUnifyAlgo);
- const TopoDS_Shape &aShape = theShape->impl<TopoDS_Shape>();
+ const auto &aShape = theShape->impl<TopoDS_Shape>();
aUnifyAlgo->Initialize(aShape, Standard_True, Standard_True, Standard_True);
aUnifyAlgo->SetLinearTolerance(defineLinearTolerance(aShape));
aUnifyAlgo->SetAngularTolerance(1.e-5); // for #32443
return;
}
- const TopoDS_Shape &aShape = theShape->impl<TopoDS_Shape>();
- const ShapeUpgrade_UnifySameDomain &aUnifyAlgo =
- this->impl<ShapeUpgrade_UnifySameDomain>();
+ const auto &aShape = theShape->impl<TopoDS_Shape>();
+ const auto &aUnifyAlgo = this->impl<ShapeUpgrade_UnifySameDomain>();
for (int aIsModified = 0; aIsModified <= 1; aIsModified++) {
if (!aUnifyAlgo.History()->IsSupportedType(
/// \return the list of shapes modified from the shape \a theShape.
/// \param[in] theShape base shape.
/// \param[out] theHistory modified shapes.
- GEOMALGOAPI_EXPORT virtual void
+ GEOMALGOAPI_EXPORT void
modified(const std::shared_ptr<GeomAPI_Shape> theShape,
- ListOfShape &theHistory);
+ ListOfShape &theHistory) override;
private:
/// Builds resulting shape from list of shapes.
Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirst, aLast);
bool isAdded = true;
- std::map<Handle(Geom_Curve), ParamMap>::iterator aFound =
- myShapes.find(aCurve);
+ auto aFound = myShapes.find(aCurve);
if (aFound == myShapes.end())
myShapes[aCurve][aFirst].insert(aLast);
else {
- ParamMap::iterator aFoundPar = aFound->second.find(aFirst);
+ auto aFoundPar = aFound->second.find(aFirst);
if (aFoundPar == aFound->second.end())
aFound->second[aFirst].insert(aLast);
else if (aFoundPar->second.find(aLast) == aFoundPar->second.end())
TopTools_ListOfShape aListOfEdges;
SetOfEdges aProcessedEdges;
- ListOfShape::const_iterator anIt = theShapes.cbegin();
+ auto anIt = theShapes.cbegin();
for (; anIt != theShapes.cend(); ++anIt) {
TopoDS_Shape aShape = (*anIt)->impl<TopoDS_Shape>();
switch (aShape.ShapeType()) {
}
}
- BRepBuilderAPI_MakeWire *aWireBuilder = new BRepBuilderAPI_MakeWire;
+ auto *aWireBuilder = new BRepBuilderAPI_MakeWire;
aWireBuilder->Add(aListOfEdges);
if (aWireBuilder->Error() == BRepBuilderAPI_WireDone) {
setImpl(aWireBuilder);
for (int i = 0; anEdgesIt != anEdges.end(); ++anEdgesIt, i++) {
GeomEdgePtr anEdge1(new GeomAPI_Edge(*anEdgesIt));
- std::list<GeomShapePtr>::const_iterator anOtherEdgesIt =
- std::next(anEdgesIt);
+ auto anOtherEdgesIt = std::next(anEdgesIt);
for (int j = i + 1; anOtherEdgesIt != anEdges.end();
++anOtherEdgesIt, j++) {
GeomEdgePtr anEdge2(new GeomAPI_Edge(*anOtherEdgesIt));
TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
try {
- XAO::BrepGeometry *aGeometry = new XAO::BrepGeometry;
+ auto *aGeometry = new XAO::BrepGeometry;
theXao->setGeometry(aGeometry);
aGeometry->setTopoDS_Shape(aShape);
} catch (XAO::XAO_Exception &e) {
}
try {
- XAO::BrepGeometry *aGeometry =
- dynamic_cast<XAO::BrepGeometry *>(theXao->getGeometry());
+ auto *aGeometry = dynamic_cast<XAO::BrepGeometry *>(theXao->getGeometry());
TopoDS_Shape aShape = aGeometry->getTopoDS_Shape();
bool aWasFree =
aShape.Free(); // make top level topology free, same as imported
}
try {
- XAO::BrepGeometry *aGeometry =
- dynamic_cast<XAO::BrepGeometry *>(theXao->getGeometry());
+ auto *aGeometry = dynamic_cast<XAO::BrepGeometry *>(theXao->getGeometry());
TopoDS_Shape aShape = aGeometry->getTopoDS_Shape();
bool aWasFree =
aShape.Free(); // make top level topology free, same as imported
XAO::Geometry *aGeometry = theXao->getGeometry();
XAO::Format aFormat = aGeometry->getFormat();
if (aFormat == XAO::BREP) {
- if (XAO::BrepGeometry *aBrepGeometry =
- dynamic_cast<XAO::BrepGeometry *>(aGeometry))
+ if (auto *aBrepGeometry = dynamic_cast<XAO::BrepGeometry *>(aGeometry))
aShape = aBrepGeometry->getTopoDS_Shape();
} else {
theError = "Unsupported XAO geometry format:" +
XAO::Geometry *aGeometry = theXao->getGeometry();
XAO::Format aFormat = aGeometry->getFormat();
if (aFormat == XAO::BREP) {
- if (XAO::BrepGeometry *aBrepGeometry =
- dynamic_cast<XAO::BrepGeometry *>(aGeometry))
+ if (auto *aBrepGeometry = dynamic_cast<XAO::BrepGeometry *>(aGeometry))
aShape = aBrepGeometry->getTopoDS_Shape();
} else {
theError = "Unsupported XAO geometry format:" +
// purpose:
//=======================================================================
GEOMAlgo_Algo::GEOMAlgo_Algo()
- : myErrorStatus(1), myWarningStatus(0),
- myComputeInternalShapes(Standard_True) {}
+
+{}
//=======================================================================
// function: ~
// purpose:
//=======================================================================
-GEOMAlgo_Algo::~GEOMAlgo_Algo() {}
+GEOMAlgo_Algo::~GEOMAlgo_Algo() = default;
//=======================================================================
// function: CheckData
GEOMALGOIMPL_EXPORT virtual void CheckResult();
- Standard_Integer myErrorStatus;
- Standard_Integer myWarningStatus;
- Standard_Boolean myComputeInternalShapes;
+ Standard_Integer myErrorStatus{1};
+ Standard_Integer myWarningStatus{0};
+ Standard_Boolean myComputeInternalShapes{Standard_True};
};
#endif
TopoDS_Shape &theRes, TopoDS_Shape &theGlobalRes,
TopTools_MapOfShape &theRemovedFaces) {
BRep_Builder aBB;
- const Standard_Integer aNbFaces = (Standard_Integer)theFacesAndAreas.size();
+ const auto aNbFaces = (Standard_Integer)theFacesAndAreas.size();
const Standard_Integer aDiff = theNbExtremalFaces - theRemovedFaces.Extent();
// function : ~
// purpose :
//=======================================================================
-GEOMAlgo_BndSphere::~GEOMAlgo_BndSphere() {}
+GEOMAlgo_BndSphere::~GEOMAlgo_BndSphere() = default;
//=======================================================================
// function : IsOut
// purpose :
// function : GEOMAlgo_CoupleOfShapes
// purpose :
//=======================================================================
-GEOMAlgo_CoupleOfShapes::GEOMAlgo_CoupleOfShapes() {}
+GEOMAlgo_CoupleOfShapes::GEOMAlgo_CoupleOfShapes() = default;
//=======================================================================
// function : SetShapes
// purpose :
// function : ~
// purpose :
//=======================================================================
-GEOMAlgo_GlueDetector::~GEOMAlgo_GlueDetector() {}
+GEOMAlgo_GlueDetector::~GEOMAlgo_GlueDetector() = default;
//=======================================================================
// function : StickedShapes
public:
GEOMALGOIMPL_EXPORT GEOMAlgo_GlueDetector();
- GEOMALGOIMPL_EXPORT virtual ~GEOMAlgo_GlueDetector();
+ GEOMALGOIMPL_EXPORT ~GEOMAlgo_GlueDetector() override;
- GEOMALGOIMPL_EXPORT virtual void Perform();
+ GEOMALGOIMPL_EXPORT void Perform() override;
GEOMALGOIMPL_EXPORT const TopTools_IndexedDataMapOfShapeListOfShape &
StickedShapes();
// function : ~GEOMAlgo_Gluer2
// purpose :
//=======================================================================
-GEOMAlgo_Gluer2::~GEOMAlgo_Gluer2() {}
+GEOMAlgo_Gluer2::~GEOMAlgo_Gluer2() = default;
//=======================================================================
// function : Clear
public:
GEOMALGOIMPL_EXPORT GEOMAlgo_Gluer2();
- GEOMALGOIMPL_EXPORT virtual ~GEOMAlgo_Gluer2();
+ GEOMALGOIMPL_EXPORT ~GEOMAlgo_Gluer2() override;
GEOMALGOIMPL_EXPORT void
SetShapesToGlue(const TopTools_DataMapOfShapeListOfShape &aM);
GEOMALGOIMPL_EXPORT Standard_Boolean KeepNonSolids() const;
- GEOMALGOIMPL_EXPORT virtual void Clear();
+ GEOMALGOIMPL_EXPORT void Clear() override;
- GEOMALGOIMPL_EXPORT virtual void Perform();
+ GEOMALGOIMPL_EXPORT void Perform() override;
- GEOMALGOIMPL_EXPORT virtual void CheckData();
+ GEOMALGOIMPL_EXPORT void CheckData() override;
GEOMALGOIMPL_EXPORT void Detect();
GEOMALGOIMPL_EXPORT const TopTools_DataMapOfShapeListOfShape &
ImagesToWork() const;
- GEOMALGOIMPL_EXPORT virtual const TopTools_ListOfShape &
- Generated(const TopoDS_Shape &theS);
+ GEOMALGOIMPL_EXPORT const TopTools_ListOfShape &
+ Generated(const TopoDS_Shape &theS) override;
- GEOMALGOIMPL_EXPORT virtual const TopTools_ListOfShape &
- Modified(const TopoDS_Shape &theS);
+ GEOMALGOIMPL_EXPORT const TopTools_ListOfShape &
+ Modified(const TopoDS_Shape &theS) override;
- GEOMALGOIMPL_EXPORT virtual Standard_Boolean
- IsDeleted(const TopoDS_Shape &theS);
+ GEOMALGOIMPL_EXPORT Standard_Boolean
+ IsDeleted(const TopoDS_Shape &theS) override;
GEOMALGOIMPL_EXPORT static void MakeVertex(const TopTools_ListOfShape &theLV,
TopoDS_Vertex &theV);
GEOMALGOIMPL_EXPORT void FillContainers(const TopAbs_ShapeEnum theType);
GEOMALGOIMPL_EXPORT void FillCompound(const TopoDS_Shape &theC);
- GEOMALGOIMPL_EXPORT virtual void PrepareHistory();
+ GEOMALGOIMPL_EXPORT void PrepareHistory() override;
GEOMALGOIMPL_EXPORT Standard_Boolean HasImage(const TopoDS_Shape &theC);
#define _NCollection_MapHasher
#include <NCollection_IndexedDataMap.hxx>
-typedef NCollection_IndexedDataMap<Standard_Integer, TopoDS_Shape,
- TColStd_MapIntegerHasher>
- GEOMAlgo_IndexedDataMapOfIntegerShape;
+using GEOMAlgo_IndexedDataMapOfIntegerShape =
+ NCollection_IndexedDataMap<Standard_Integer, TopoDS_Shape,
+ TColStd_MapIntegerHasher>;
#undef _NCollection_MapHasher
#define _NCollection_MapHasher
#include <NCollection_IndexedDataMap.hxx>
-typedef NCollection_IndexedDataMap<GEOMAlgo_PassKeyShape, TopTools_ListOfShape,
- GEOMAlgo_PassKeyShapeMapHasher>
- GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape;
+using GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape =
+ NCollection_IndexedDataMap<GEOMAlgo_PassKeyShape, TopTools_ListOfShape,
+ GEOMAlgo_PassKeyShapeMapHasher>;
#undef _NCollection_MapHasher
#define _NCollection_MapHasher
#include <NCollection_IndexedDataMap.hxx>
-typedef NCollection_IndexedDataMap<TopoDS_Shape, GEOMAlgo_BndSphere,
- TopTools_ShapeMapHasher>
- GEOMAlgo_IndexedDataMapOfShapeBndSphere;
+using GEOMAlgo_IndexedDataMapOfShapeBndSphere =
+ NCollection_IndexedDataMap<TopoDS_Shape, GEOMAlgo_BndSphere,
+ TopTools_ShapeMapHasher>;
#undef _NCollection_MapHasher
#define _NCollection_MapHasher
#include <NCollection_IndexedDataMap.hxx>
-typedef NCollection_IndexedDataMap<TopoDS_Shape, TopTools_IndexedMapOfShape,
- TopTools_ShapeMapHasher>
- GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape;
+using GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape =
+ NCollection_IndexedDataMap<TopoDS_Shape, TopTools_IndexedMapOfShape,
+ TopTools_ShapeMapHasher>;
#undef _NCollection_MapHasher
#include <GEOMAlgo_CoupleOfShapes.hxx>
#include <NCollection_List.hxx>
-typedef NCollection_List<GEOMAlgo_CoupleOfShapes> GEOMAlgo_ListOfCoupleOfShapes;
-typedef GEOMAlgo_ListOfCoupleOfShapes::Iterator
- GEOMAlgo_ListIteratorOfListOfCoupleOfShapes;
+using GEOMAlgo_ListOfCoupleOfShapes = NCollection_List<GEOMAlgo_CoupleOfShapes>;
+using GEOMAlgo_ListIteratorOfListOfCoupleOfShapes =
+ GEOMAlgo_ListOfCoupleOfShapes::Iterator;
#endif
// function :~
// purpose :
//=======================================================================
-GEOMAlgo_PassKeyShape::~GEOMAlgo_PassKeyShape() {}
+GEOMAlgo_PassKeyShape::~GEOMAlgo_PassKeyShape() = default;
//=======================================================================
// function :Assign
// purpose :
// function : ~
// purpose :
//=======================================================================
-GEOMAlgo_Splitter::~GEOMAlgo_Splitter() {}
+GEOMAlgo_Splitter::~GEOMAlgo_Splitter() = default;
//=======================================================================
// function : AddTool
// purpose :
TopoDS_Iterator aItC;
//
aLC.Append(aC1);
- while (1) {
+ while (true) {
aLC1.Clear();
aIt.Initialize(aLC);
for (; aIt.More(); aIt.Next()) {
GEOMALGOIMPL_EXPORT
GEOMAlgo_Splitter(const Handle(NCollection_BaseAllocator) & theAllocator);
- GEOMALGOIMPL_EXPORT virtual ~GEOMAlgo_Splitter();
+ GEOMALGOIMPL_EXPORT ~GEOMAlgo_Splitter() override;
/// Add a tool shape
/// \param theShape a tool shape
GEOMALGOIMPL_EXPORT Standard_Integer LimitMode() const;
/// Clears all tool shapes
- GEOMALGOIMPL_EXPORT virtual void Clear();
+ GEOMALGOIMPL_EXPORT void Clear() override;
protected:
/// Build result.
/// \param theType a type of limit
- GEOMALGOIMPL_EXPORT virtual void BuildResult(const TopAbs_ShapeEnum theType);
+ GEOMALGOIMPL_EXPORT void BuildResult(const TopAbs_ShapeEnum theType) override;
/// Post processing of the calculation
#if OCC_VERSION_LARGE < 0x07070000
- GEOMALGOIMPL_EXPORT virtual void PostTreat();
+ GEOMALGOIMPL_EXPORT void PostTreat() override;
#else
GEOMALGOIMPL_EXPORT virtual void
PostTreat(const Message_ProgressRange &theRange);
void GEOMImpl_Fillet1d::fillDiff(GEOMImpl_Fillet1dPoint *thePoint,
Standard_Real theDiffStep,
Standard_Boolean theFront) {
- GEOMImpl_Fillet1dPoint *aDiff = new GEOMImpl_Fillet1dPoint(
+ auto *aDiff = new GEOMImpl_Fillet1dPoint(
thePoint->GetParam() + (theFront ? (theDiffStep) : (-theDiffStep)));
fillPoint(aDiff);
if (!thePoint->ComputeDifference(aDiff)) {
Standard_Integer aCycle;
for (aCycle = 2, myStartSide = Standard_False; aCycle;
myStartSide = !myStartSide, aCycle--) {
- GEOMImpl_Fillet1dPoint *aLeft = NULL, *aRight = NULL;
+ GEOMImpl_Fillet1dPoint *aLeft = nullptr, *aRight = nullptr;
for (aParam = theStart + aStep;
aParam < theEnd || fabs(theEnd - aParam) < Precision::Confusion();
}
GEOMImpl_Fillet1dPoint *aPoint1 = theLeft->Copy();
- GEOMImpl_Fillet1dPoint *aPoint2 = new GEOMImpl_Fillet1dPoint(theParameter);
+ auto *aPoint2 = new GEOMImpl_Fillet1dPoint(theParameter);
fillPoint(aPoint2);
fillDiff(aPoint2, diffx, Standard_True);
GEOMImpl_Fillet1dPoint *aNearest;
Standard_Integer a;
TColStd_ListIteratorOfListOfReal anIter(myResultParams);
- for (aNearest = NULL, a = 1; anIter.More(); anIter.Next(), a++) {
+ for (aNearest = nullptr, a = 1; anIter.More(); anIter.Next(), a++) {
myStartSide =
(myResultOrientation.Value(a)) ? Standard_True : Standard_False;
- GEOMImpl_Fillet1dPoint *aPoint = new GEOMImpl_Fillet1dPoint(anIter.Value());
+ auto *aPoint = new GEOMImpl_Fillet1dPoint(anIter.Value());
fillPoint(aPoint);
if (!aPoint->HasSolution(myRadius))
continue;
// purpose :
//=======================================================================
GEOMImpl_Fillet1dPoint *GEOMImpl_Fillet1dPoint::Copy() {
- GEOMImpl_Fillet1dPoint *aCopy = new GEOMImpl_Fillet1dPoint(myParam);
+ auto *aCopy = new GEOMImpl_Fillet1dPoint(myParam);
Standard_Integer a;
for (a = 1; a <= myV.Length(); a++) {
aCopy->myV.Append(myV.Value(a));
myCoords; ///< X, Y and Z doubles as real array attribute [0; 2]
public:
/// Defines the double value
- GEOMDATA_EXPORT virtual void setValue(const double theX, const double theY,
- const double theZ);
+ GEOMDATA_EXPORT void setValue(const double theX, const double theY,
+ const double theZ) override;
/// Defines the direction
- GEOMDATA_EXPORT virtual void
- setValue(const std::shared_ptr<GeomAPI_Dir> &theDir);
+ GEOMDATA_EXPORT void
+ setValue(const std::shared_ptr<GeomAPI_Dir> &theDir) override;
/// Returns the X double value
- GEOMDATA_EXPORT virtual double x() const;
+ GEOMDATA_EXPORT double x() const override;
/// Returns the Y double value
- GEOMDATA_EXPORT virtual double y() const;
+ GEOMDATA_EXPORT double y() const override;
/// Returns the Z double value
- GEOMDATA_EXPORT virtual double z() const;
+ GEOMDATA_EXPORT double z() const override;
/// Returns the direction of this attribute
- GEOMDATA_EXPORT virtual std::shared_ptr<GeomAPI_Dir> dir();
+ GEOMDATA_EXPORT std::shared_ptr<GeomAPI_Dir> dir() override;
/// Returns the coordinates of this attribute
- GEOMDATA_EXPORT virtual std::shared_ptr<GeomAPI_XYZ> xyz();
+ GEOMDATA_EXPORT std::shared_ptr<GeomAPI_XYZ> xyz() override;
/// Returns \c ture if the direction is initialized
- GEOMDATA_EXPORT virtual bool isInitialized();
+ GEOMDATA_EXPORT bool isInitialized() override;
/// Resets attribute to default state.
- GEOMDATA_EXPORT virtual void reset();
+ GEOMDATA_EXPORT void reset() override;
protected:
/// Initializes attributes
GEOMDATA_EXPORT GeomData_Dir(TDF_Label &theLabel);
/// Reinitializes the internal state of the attribute (may be needed on
/// undo/redo, abort, etc)
- virtual void reinit();
+ void reinit() override;
friend class Model_Data;
};
void GeomData_Point::reinit() {
myIsInitialized = true;
- for (int aComponent = 0; aComponent < NUM_COMPONENTS; ++aComponent) {
- myExpression[aComponent]->reinit();
- myIsInitialized =
- myIsInitialized && myExpression[aComponent]->isInitialized();
+ for (auto &aComponent : myExpression) {
+ aComponent->reinit();
+ myIsInitialized = myIsInitialized && aComponent->isInitialized();
}
}
public:
/// Defines the double value
- GEOMDATA_EXPORT virtual void setValue(const double theX, const double theY,
- const double theZ);
+ GEOMDATA_EXPORT void setValue(const double theX, const double theY,
+ const double theZ) override;
/// Defines the point
- GEOMDATA_EXPORT virtual void
- setValue(const std::shared_ptr<GeomAPI_Pnt> &thePoint);
+ GEOMDATA_EXPORT void
+ setValue(const std::shared_ptr<GeomAPI_Pnt> &thePoint) override;
/// Returns the X double value
- GEOMDATA_EXPORT virtual double x() const;
+ GEOMDATA_EXPORT double x() const override;
/// Returns the Y double value
- GEOMDATA_EXPORT virtual double y() const;
+ GEOMDATA_EXPORT double y() const override;
/// Returns the Z double value
- GEOMDATA_EXPORT virtual double z() const;
+ GEOMDATA_EXPORT double z() const override;
/// Defines the X coordinate value
- GEOMDATA_EXPORT void setX(const double theX);
+ GEOMDATA_EXPORT void setX(const double theX) override;
/// Defines the Y coordinate value
- GEOMDATA_EXPORT void setY(const double theY);
+ GEOMDATA_EXPORT void setY(const double theY) override;
/// Defines the Z coordinate value
- GEOMDATA_EXPORT void setZ(const double theZ);
+ GEOMDATA_EXPORT void setZ(const double theZ) override;
/// Returns the 3D point
- GEOMDATA_EXPORT virtual std::shared_ptr<GeomAPI_Pnt> pnt();
+ GEOMDATA_EXPORT std::shared_ptr<GeomAPI_Pnt> pnt() override;
/// Defines the calculated double value
- GEOMDATA_EXPORT virtual void
- setCalculatedValue(const double theX, const double theY, const double theZ);
+ GEOMDATA_EXPORT void setCalculatedValue(const double theX, const double theY,
+ const double theZ) override;
/// Defines the text values
- GEOMDATA_EXPORT virtual void setText(const std::wstring &theX,
- const std::wstring &theY,
- const std::wstring &theZ);
+ GEOMDATA_EXPORT void setText(const std::wstring &theX,
+ const std::wstring &theY,
+ const std::wstring &theZ) override;
/// Defines the X text value
- GEOMDATA_EXPORT virtual void setTextX(const std::wstring &theX);
+ GEOMDATA_EXPORT void setTextX(const std::wstring &theX) override;
/// Defines the Y text value
- GEOMDATA_EXPORT virtual void setTextY(const std::wstring &theY);
+ GEOMDATA_EXPORT void setTextY(const std::wstring &theY) override;
/// Defines the Z text value
- GEOMDATA_EXPORT virtual void setTextZ(const std::wstring &theZ);
+ GEOMDATA_EXPORT void setTextZ(const std::wstring &theZ) override;
/// Returns the X text value
- GEOMDATA_EXPORT virtual std::wstring textX();
+ GEOMDATA_EXPORT std::wstring textX() override;
/// Returns the Y text value
- GEOMDATA_EXPORT virtual std::wstring textY();
+ GEOMDATA_EXPORT std::wstring textY() override;
/// Returns the Z text value
- GEOMDATA_EXPORT virtual std::wstring textZ();
+ GEOMDATA_EXPORT std::wstring textZ() override;
/// Allows to set expression (text) as invalid (by the parameters listener)
- GEOMDATA_EXPORT virtual void setExpressionInvalid(int, const bool theFlag);
+ GEOMDATA_EXPORT void setExpressionInvalid(int, const bool theFlag) override;
/// Returns true if text is invalid
- GEOMDATA_EXPORT virtual bool expressionInvalid(int);
+ GEOMDATA_EXPORT bool expressionInvalid(int) override;
/// Allows to set expression (text) error (by the parameters listener)
- GEOMDATA_EXPORT virtual void setExpressionError(int theComponent,
- const std::string &theError);
+ GEOMDATA_EXPORT void setExpressionError(int theComponent,
+ const std::string &theError) override;
/// Returns an expression error
- GEOMDATA_EXPORT virtual std::string expressionError(int theComponent);
+ GEOMDATA_EXPORT std::string expressionError(int theComponent) override;
/// Defines the used parameters
- GEOMDATA_EXPORT virtual void
+ GEOMDATA_EXPORT void
setUsedParameters(int theComponent,
- const std::set<std::wstring> &theUsedParameters);
+ const std::set<std::wstring> &theUsedParameters) override;
/// Returns the used parameters
- GEOMDATA_EXPORT virtual std::set<std::wstring>
- usedParameters(int theComponent) const;
+ GEOMDATA_EXPORT std::set<std::wstring>
+ usedParameters(int theComponent) const override;
protected:
/// Initializes attributes
GEOMDATA_EXPORT GeomData_Point();
/// Reinitializes the internal state of the attribute (may be needed on
/// undo/redo, abort, etc)
- virtual void reinit();
+ void reinit() override;
friend class Model_Data;
};
void GeomData_Point2D::reinit() {
myIsInitialized = true;
- for (int aComponent = 0; aComponent < NUM_COMPONENTS; ++aComponent) {
- myExpression[aComponent]->reinit();
- myIsInitialized =
- myIsInitialized && myExpression[aComponent]->isInitialized();
+ for (auto &aComponent : myExpression) {
+ aComponent->reinit();
+ myIsInitialized = myIsInitialized && aComponent->isInitialized();
}
}
void GeomData_Point2D::reset() {
myIsInitialized = false;
- for (int aComponent = 0; aComponent < NUM_COMPONENTS; ++aComponent) {
- myExpression[aComponent]->reset();
+ for (auto &aComponent : myExpression) {
+ aComponent->reset();
}
}
myExpression[NUM_COMPONENTS]; ///< Expressions for X, Y
public:
/// Defines the double value
- GEOMDATA_EXPORT virtual void setValue(const double theX, const double theY);
+ GEOMDATA_EXPORT void setValue(const double theX, const double theY) override;
/// Defines the point
- GEOMDATA_EXPORT virtual void
- setValue(const std::shared_ptr<GeomAPI_Pnt2d> &thePoint);
+ GEOMDATA_EXPORT void
+ setValue(const std::shared_ptr<GeomAPI_Pnt2d> &thePoint) override;
/// Returns the X double value
- GEOMDATA_EXPORT virtual double x() const;
+ GEOMDATA_EXPORT double x() const override;
/// Returns the Y double value
- GEOMDATA_EXPORT virtual double y() const;
+ GEOMDATA_EXPORT double y() const override;
/// Returns the 2D point
- GEOMDATA_EXPORT virtual std::shared_ptr<GeomAPI_Pnt2d> pnt();
+ GEOMDATA_EXPORT std::shared_ptr<GeomAPI_Pnt2d> pnt() override;
/// Defines the calculated double value
- GEOMDATA_EXPORT virtual void setCalculatedValue(const double theX,
- const double theY);
+ GEOMDATA_EXPORT void setCalculatedValue(const double theX,
+ const double theY) override;
/// Defines the text values
- GEOMDATA_EXPORT virtual void setText(const std::wstring &theX,
- const std::wstring &theY);
+ GEOMDATA_EXPORT void setText(const std::wstring &theX,
+ const std::wstring &theY) override;
/// Returns the text values
- GEOMDATA_EXPORT virtual std::wstring textX();
- GEOMDATA_EXPORT virtual std::wstring textY();
+ GEOMDATA_EXPORT std::wstring textX() override;
+ GEOMDATA_EXPORT std::wstring textY() override;
/// Allows to set expression (text) as invalid (by the parameters listener)
- GEOMDATA_EXPORT virtual void setExpressionInvalid(int, const bool theFlag);
+ GEOMDATA_EXPORT void setExpressionInvalid(int, const bool theFlag) override;
/// Returns true if text is invalid
- GEOMDATA_EXPORT virtual bool expressionInvalid(int);
+ GEOMDATA_EXPORT bool expressionInvalid(int) override;
/// Allows to set expression (text) error (by the parameters listener)
- GEOMDATA_EXPORT virtual void setExpressionError(int theComponent,
- const std::string &theError);
+ GEOMDATA_EXPORT void setExpressionError(int theComponent,
+ const std::string &theError) override;
/// Returns an expression error
- GEOMDATA_EXPORT virtual std::string expressionError(int theComponent);
+ GEOMDATA_EXPORT std::string expressionError(int theComponent) override;
/// Defines the used parameters
- GEOMDATA_EXPORT virtual void
+ GEOMDATA_EXPORT void
setUsedParameters(int theComponent,
- const std::set<std::wstring> &theUsedParameters);
+ const std::set<std::wstring> &theUsedParameters) override;
/// Returns the used parameters
- GEOMDATA_EXPORT virtual std::set<std::wstring>
- usedParameters(int theComponent) const;
+ GEOMDATA_EXPORT std::set<std::wstring>
+ usedParameters(int theComponent) const override;
protected:
/// Initializes attributes
GEOMDATA_EXPORT GeomData_Point2D();
/// Reinitializes the internal state of the attribute (may be needed on
/// undo/redo, abort, etc)
- virtual void reinit();
+ void reinit() override;
/// Resets attribute to deafult state.
- virtual void reset();
+ void reset() override;
friend class Model_Data;
};
public:
/// Copy values from another array
/// \return \c true if the copy was successful
- GEOMDATA_EXPORT virtual bool
- assign(std::shared_ptr<GeomDataAPI_Point2DArray> theOther);
+ GEOMDATA_EXPORT bool
+ assign(std::shared_ptr<GeomDataAPI_Point2DArray> theOther) override;
/// Returns the size of the array (zero means that it is empty)
- GEOMDATA_EXPORT virtual int size();
+ GEOMDATA_EXPORT int size() override;
/// Sets the new size of the array. The previous data is erased.
- GEOMDATA_EXPORT virtual void setSize(const int theSize);
+ GEOMDATA_EXPORT void setSize(const int theSize) override;
/// Defines the value of the array by index [0; size-1]
- GEOMDATA_EXPORT virtual void setPnt(const int theIndex, const double theX,
- const double theY);
+ GEOMDATA_EXPORT void setPnt(const int theIndex, const double theX,
+ const double theY) override;
/// Defines the value of the array by index [0; size-1]
- GEOMDATA_EXPORT virtual void
- setPnt(const int theIndex, const std::shared_ptr<GeomAPI_Pnt2d> &thePoint);
+ GEOMDATA_EXPORT void
+ setPnt(const int theIndex,
+ const std::shared_ptr<GeomAPI_Pnt2d> &thePoint) override;
/// Returns the value by the index
- GEOMDATA_EXPORT virtual std::shared_ptr<GeomAPI_Pnt2d>
- pnt(const int theIndex);
+ GEOMDATA_EXPORT std::shared_ptr<GeomAPI_Pnt2d>
+ pnt(const int theIndex) override;
protected:
/// Initializes attributes
GEOMDATA_EXPORT GeomData_Point2DArray(TDF_Label &theLabel);
/// Reinitializes the internal state of the attribute (may be needed on
/// undo/redo, abort, etc)
- virtual void reinit();
+ void reinit() override;
friend class Model_Data;
};
std::string GeomDataAPI_Dir::attributeType() { return typeId(); }
-GeomDataAPI_Dir::GeomDataAPI_Dir() {}
+GeomDataAPI_Dir::GeomDataAPI_Dir() = default;
-GeomDataAPI_Dir::~GeomDataAPI_Dir() {}
+GeomDataAPI_Dir::~GeomDataAPI_Dir() = default;
return aPointAttr;
}
-GeomDataAPI_Point2D::GeomDataAPI_Point2D() {}
+GeomDataAPI_Point2D::GeomDataAPI_Point2D() = default;
-GeomDataAPI_Point2D::~GeomDataAPI_Point2D() {}
+GeomDataAPI_Point2D::~GeomDataAPI_Point2D() = default;
std::string GeomDataAPI_Point2DArray::attributeType() { return typeId(); }
-GeomDataAPI_Point2DArray::GeomDataAPI_Point2DArray() {}
+GeomDataAPI_Point2DArray::GeomDataAPI_Point2DArray() = default;
-GeomDataAPI_Point2DArray::~GeomDataAPI_Point2DArray() {}
+GeomDataAPI_Point2DArray::~GeomDataAPI_Point2DArray() = default;
/// \param[in] theAttribute an attribute to check
/// \param[in] theArguments a filter parameters
/// \param[out] theError error message.
- GEOMVALIDATORS_EXPORT virtual bool
+ GEOMVALIDATORS_EXPORT bool
isValid(const AttributePtr &theAttribute,
const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ Events_InfoMessage &theError) const override;
};
#endif
class GeomValidators_ConstructionComposite
: public ModelAPI_AttributeValidator {
public:
- GEOMVALIDATORS_EXPORT GeomValidators_ConstructionComposite() {}
+ GEOMVALIDATORS_EXPORT GeomValidators_ConstructionComposite() = default;
//! returns true if attribute is valid
//! \param[in] theAttribute the checked attribute
//! \param[in] theArguments arguments of the attribute
//! \param[out] theError error message.
- GEOMVALIDATORS_EXPORT virtual bool
+ GEOMVALIDATORS_EXPORT bool
isValid(const AttributePtr &theAttribute,
const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ Events_InfoMessage &theError) const override;
};
#endif
std::map<std::string, std::list<AttributePtr>> anAttributesMap;
// For all attributes referred by theArguments
// sort it using attributeType() and store into anAttributesMap
- std::list<std::string>::const_iterator anArgumentIt = theArguments.begin();
+ auto anArgumentIt = theArguments.begin();
for (; anArgumentIt != theArguments.end(); ++anArgumentIt) {
AttributePtr anAttribute = theFeature->attribute(*anArgumentIt);
anAttributesMap[anAttribute->attributeType()].push_back(anAttribute);
for (; anAttributesMapIt != anAttributesMap.end(); ++anAttributesMapIt) {
const std::list<AttributePtr> &anAttributes = anAttributesMapIt->second;
// for the list of attributes check that all elements are unique
- std::list<AttributePtr>::const_iterator anAttributeIt =
- anAttributes.begin();
+ auto anAttributeIt = anAttributes.begin();
if (anAttributeIt != anAttributes.end()) {
- std::list<AttributePtr>::const_iterator aNextIt = anAttributeIt;
+ auto aNextIt = anAttributeIt;
++aNextIt;
while (aNextIt != anAttributes.end()) {
// if equal attribute is found then all attributes are not different
- std::list<AttributePtr>::const_iterator aFindIt =
+ auto aFindIt =
std::find_if(aNextIt, anAttributes.end(), IsEqual(*anAttributeIt));
if (aFindIt != anAttributes.end()) {
theError = "Attributes " + (*anAttributeIt)->id() + " and " +
}
// LCOV_EXCL_START
-bool GeomValidators_Different::isNotObligatory(std::string theFeature,
- std::string theAttribute) {
+bool GeomValidators_Different::isNotObligatory(std::string /*theFeature*/,
+ std::string /*theAttribute*/) {
return true;
}
// LCOV_EXCL_STOP
* validator. \param[out] theError error message. \returns true if feature is
* valid.
*/
- GEOMVALIDATORS_EXPORT virtual bool
+ GEOMVALIDATORS_EXPORT bool
isValid(const std::shared_ptr<ModelAPI_Feature> &theFeature,
const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ Events_InfoMessage &theError) const override;
- GEOMVALIDATORS_EXPORT virtual bool isNotObligatory(std::string theFeature,
- std::string theAttribute);
+ GEOMVALIDATORS_EXPORT bool isNotObligatory(std::string theFeature,
+ std::string theAttribute) override;
};
#endif
//=================================================================================================
bool GeomValidators_DifferentShapes::checkEquals(
std::list<AttributePtr> &theAttributes) {
- std::list<AttributePtr>::iterator anIt = theAttributes.begin();
+ auto anIt = theAttributes.begin();
for (; anIt != theAttributes.end(); anIt++) {
AttributePtr anAttribute = *anIt;
- std::list<AttributePtr>::iterator anOthersIt = std::next(anIt);
+ auto anOthersIt = std::next(anIt);
for (; anOthersIt != theAttributes.end(); anOthersIt++) {
AttributePtr anOtherAttribute = *anOthersIt;
if (isAttrShapesEqual(anAttribute, anOtherAttribute)) {
FeaturePtr aFeature = aSelectionAttribute->contextFeature();
std::string aCurrentAttributeId = theCurrentAttribute->id();
- if (theAttributes.size() > 0 && aShape.get() != NULL) {
- std::list<AttributePtr>::iterator anAttr = theAttributes.begin();
+ if (theAttributes.size() > 0 && aShape.get() != nullptr) {
+ auto anAttr = theAttributes.begin();
for (; anAttr != theAttributes.end(); anAttr++) {
AttributePtr anAttribute = *anAttr;
// take into concideration only other attributes
- if (anAttribute.get() != NULL &&
+ if (anAttribute.get() != nullptr &&
anAttribute->id() != aCurrentAttributeId) {
aSelectionAttribute =
std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(anAttribute);
// the shape of the attribute should be not the same
- if (aSelectionAttribute.get() != NULL) {
+ if (aSelectionAttribute.get() != nullptr) {
GeomShapePtr anAttrShape = aSelectionAttribute->value();
ResultPtr aResult = aSelectionAttribute->context();
if (!anAttrShape.get()) {
/// the attribute does not contain a selection attribute filled with the same
/// shape \param[in] theAttribute an attribute to check \param[in]
/// theArguments a filter parameters \param[out] theError error message.
- GEOMVALIDATORS_EXPORT virtual bool
+ GEOMVALIDATORS_EXPORT bool
isValid(const AttributePtr &theAttribute,
const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ Events_InfoMessage &theError) const override;
private:
/// Check if the list contains equal shape selection.
*/
class GeomValidators_Face : public ModelAPI_AttributeValidator {
public:
- GEOMVALIDATORS_EXPORT GeomValidators_Face() {}
+ GEOMVALIDATORS_EXPORT GeomValidators_Face() = default;
//! returns true if attribute is valid
//! \param[in] theAttribute the checked attribute
//! \param[in] theArguments arguments of the attribute
//! \param[out] theError error message.
- GEOMVALIDATORS_EXPORT virtual bool
+ GEOMVALIDATORS_EXPORT bool
isValid(const AttributePtr &theAttribute,
const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ Events_InfoMessage &theError) const override;
};
#endif
bool isSketchEntities = true;
std::set<std::string> anEntityKinds;
std::string anEntityKindsStr;
- std::list<std::string>::const_iterator anIt = theArguments.begin(),
- aLast = theArguments.end();
+ auto anIt = theArguments.begin(), aLast = theArguments.end();
for (; anIt != aLast; anIt++) {
anEntityKinds.insert(*anIt);
if (!anEntityKindsStr.empty())
/// \param[in] theAttribute an attribute to check
/// \param[in] theArguments a filter parameters
/// \param[out] theError error message.
- GEOMVALIDATORS_EXPORT virtual bool
+ GEOMVALIDATORS_EXPORT bool
isValid(const AttributePtr &theAttribute,
const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ Events_InfoMessage &theError) const override;
};
#endif
/// \param[in] theAttribute an attribute to check
/// \param[in] theArguments a filter parameters
/// \param[out] theError error message.
- GEOMVALIDATORS_EXPORT virtual bool
+ GEOMVALIDATORS_EXPORT bool
isValid(const AttributePtr &theAttribute,
const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ Events_InfoMessage &theError) const override;
};
#endif
// check intersection with all arguments
bool isOk = true;
- for (std::list<std::string>::const_iterator anIt = theArguments.begin();
- anIt != theArguments.end() && isOk; ++anIt) {
+ for (auto anIt = theArguments.begin(); anIt != theArguments.end() && isOk;
+ ++anIt) {
aSelection = aFeature->selection(*anIt);
// LCOV_EXCL_START
if (!aSelection) {
/// \param[in] theAttribute an attribute to check.
/// \param[in] theArguments a filter parameters.
/// \param[out] theError error message.
- GEOMVALIDATORS_EXPORT virtual bool
+ GEOMVALIDATORS_EXPORT bool
isValid(const AttributePtr &theAttribute,
const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ Events_InfoMessage &theError) const override;
};
#endif
/// \param[in] theArguments the arguments in the configuration file for this
/// validator. \param[out] theError error message. \returns true if feature is
/// valid.
- GEOMVALIDATORS_EXPORT virtual bool
+ GEOMVALIDATORS_EXPORT bool
isValid(const std::shared_ptr<ModelAPI_Feature> &theFeature,
const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ Events_InfoMessage &theError) const override;
};
#endif
}
// LCOV_EXCL_STOP
- for (std::list<std::string>::const_iterator anIt = theArguments.cbegin();
- anIt != theArguments.cend(); ++anIt) {
- std::string anArgument = *anIt;
+ for (auto anArgument : theArguments) {
AttributePtr anAttribute = theFeature->attribute(anArgument);
if (!anAttribute.get()) {
// LCOV_EXCL_START
/// \param[in] theAttribute an attribute to check.
/// \param[in] theArguments a filter parameters.
/// \param[out] theError error message.
- GEOMVALIDATORS_EXPORT virtual bool
+ GEOMVALIDATORS_EXPORT bool
isValid(const std::shared_ptr<ModelAPI_Feature> &theFeature,
const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ Events_InfoMessage &theError) const override;
/// \return true if the attribute in feature is not obligatory for the feature
/// execution.
- GEOMVALIDATORS_EXPORT virtual bool isNotObligatory(std::string theFeature,
- std::string theAttribute);
+ GEOMVALIDATORS_EXPORT bool isNotObligatory(std::string theFeature,
+ std::string theAttribute) override;
};
#endif
// ModelAPI_Session::get()->registerPlugin(this);
}
-FeaturePtr GeomValidators_Plugin::createFeature(std::string theFeatureID) {
+FeaturePtr GeomValidators_Plugin::createFeature(std::string /*theFeatureID*/) {
// feature of such kind is not found
return FeaturePtr();
}
class GEOMVALIDATORS_EXPORT GeomValidators_Plugin : public ModelAPI_Plugin {
public:
/// Creates the feature object of this plugin by the feature string ID
- virtual FeaturePtr createFeature(std::string theFeatureID);
+ FeaturePtr createFeature(std::string theFeatureID) override;
public:
GeomValidators_Plugin();
Events_InfoMessage &theError) const {
double aMinValue = 1.e-12;
if (theArguments.size() == 1) {
- std::list<std::string>::const_iterator anIt = theArguments.begin();
+ auto anIt = theArguments.begin();
double aValue = Config_PropManager::stringToDouble((*anIt).c_str());
if (aValue != 0) {
// very probably ok
//! \param[in] theAttribute the checked attribute
//! \param[in] theArguments arguments of the attribute
//! \param[out] theError error message.
- GEOMVALIDATORS_EXPORT virtual bool
+ GEOMVALIDATORS_EXPORT bool
isValid(const AttributePtr &theAttribute,
const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ Events_InfoMessage &theError) const override;
};
#endif
Events_InfoMessage &theError) const {
bool aValid = false;
- std::list<std::string>::const_iterator anIt = theArguments.begin(),
- aLast = theArguments.end();
+ auto anIt = theArguments.begin(), aLast = theArguments.end();
// returns true if the attribute satisfies at least one of given arguments
for (; anIt != aLast; anIt++) {
TypeOfShape aShapeType = shapeType(*anIt);
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(theObject);
FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
const std::string &aKind = aFeature->getKind();
- return aResult.get() != NULL && aKind == "Plane";
+ return aResult.get() != nullptr && aKind == "Plane";
}
if (!aResult.get()) {
aValid = false;
};
public:
- GEOMVALIDATORS_EXPORT GeomValidators_ShapeType() {}
+ GEOMVALIDATORS_EXPORT GeomValidators_ShapeType() = default;
//! Returns true if attribute has shape type listed in the parameter arguments
//! \param[in] theAttribute the checked attribute
//! \param[in] theArguments arguments of the attribute
//! \param[out] theError error message.
- GEOMVALIDATORS_EXPORT virtual bool
+ GEOMVALIDATORS_EXPORT bool
isValid(const AttributePtr &theAttribute,
const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ Events_InfoMessage &theError) const override;
/// Convert string to TypeOfShape value
/// \param theType a string value
if (anAttrType == ModelAPI_AttributeRefAttr::typeId()) {
AttributeRefAttrPtr anAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
- if (anAttr != NULL && anAttr->isObject())
+ if (anAttr != nullptr && anAttr->isObject())
anObject = anAttr->object();
}
if (anAttrType == ModelAPI_AttributeSelection::typeId()) {
AttributeSelectionPtr anAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttribute);
- if (anAttr != NULL)
+ if (anAttr != nullptr)
anObject = anAttr->context();
}
if (anAttrType == ModelAPI_AttributeReference::typeId()) {
AttributeReferencePtr anAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeReference>(theAttribute);
- if (anAttr.get() != NULL)
+ if (anAttr.get() != nullptr)
anObject = anAttr->value();
}
return anObject;
return false;
}
- for (std::list<std::string>::const_iterator anIt = theArguments.begin();
- anIt != theArguments.end(); ++anIt) {
+ for (const auto &theArgument : theArguments) {
// check the argument links to the attribute of the current feature
- AttributePtr aCurAttr = anOwner->attribute(*anIt);
+ AttributePtr aCurAttr = anOwner->attribute(theArgument);
if (!aCurAttr) {
theError = "Arguments should be names of attributes of current feature";
return false;
//! \param[in] theAttribute the checked attribute
//! \param[in] theArguments arguments of the attribute
//! \param[out] theError error message.
- GEOMVALIDATORS_EXPORT virtual bool
+ GEOMVALIDATORS_EXPORT bool
isValid(const AttributePtr &theAttribute,
const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ Events_InfoMessage &theError) const override;
};
/**
//! \param[in] theAttribute the checked attribute
//! \param[in] theArguments arguments of the attribute
//! \param[out] theError error message.
- GEOMVALIDATORS_EXPORT virtual bool
+ GEOMVALIDATORS_EXPORT bool
isValid(const AttributePtr &theAttribute,
const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ Events_InfoMessage &theError) const override;
};
#endif
}
// LCOV_EXCL_STOP
- std::list<std::string>::const_iterator anIt = theArguments.begin();
+ auto anIt = theArguments.begin();
std::string aSelectedMethod;
if (theFeature->string(*anIt)) {
theFeature->selection(*anIt);
if (anAttrSel && anAttrSel->isInitialized()) {
aToShape = std::dynamic_pointer_cast<GeomAPI_Shape>(anAttrSel->value());
- if (aToShape.get() == NULL && anAttrSel->context().get() != NULL) {
+ if (aToShape.get() == nullptr && anAttrSel->context().get() != nullptr) {
aToShape = anAttrSel->context()->shape();
}
if (aToShape->isCompound()) {
anAttrSel = theFeature->selection(*anIt);
if (anAttrSel && anAttrSel->isInitialized()) {
aFromShape = std::dynamic_pointer_cast<GeomAPI_Shape>(anAttrSel->value());
- if (aFromShape.get() == NULL && anAttrSel->context().get() != NULL) {
+ if (aFromShape.get() == nullptr && anAttrSel->context().get() != nullptr) {
aFromShape = anAttrSel->context()->shape();
}
if (aFromShape->isCompound()) {
}
std::shared_ptr<GeomAPI_Pln> aPln = aFace->getPlane();
if (aPln.get()) {
- for (ListOfShape::const_iterator anIter = aFacesList.cbegin();
- anIter != aFacesList.cend(); anIter++) {
- std::shared_ptr<GeomAPI_Shape> aSketchShape = *anIter;
+ for (auto aSketchShape : aFacesList) {
std::shared_ptr<GeomAPI_Face> aSketchFace(
new GeomAPI_Face(aSketchShape));
std::shared_ptr<GeomAPI_Pln> aSketchPln = aSketchFace->getPlane();
//=================================================================================================
// LCOV_EXCL_START
-bool GeomValidators_ZeroOffset::isNotObligatory(std::string theFeature,
+bool GeomValidators_ZeroOffset::isNotObligatory(std::string /*theFeature*/,
std::string theAttribute) {
if (theAttribute == "from_object" || theAttribute == "to_object") {
return true;
* validator. \param[out] theError error message. \return true if feature is
* valid.
*/
- GEOMVALIDATORS_EXPORT virtual bool
+ GEOMVALIDATORS_EXPORT bool
isValid(const std::shared_ptr<ModelAPI_Feature> &theFeature,
const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ Events_InfoMessage &theError) const override;
/// \return true if the attribute in feature is not obligatory for the feature
/// execution.
- GEOMVALIDATORS_EXPORT virtual bool isNotObligatory(std::string theFeature,
- std::string theAttribute);
+ GEOMVALIDATORS_EXPORT bool isNotObligatory(std::string theFeature,
+ std::string theAttribute) override;
};
#endif
InitializationPlugin_EvalListener::InitializationPlugin_EvalListener() {
Events_Loop *aLoop = Events_Loop::loop();
- aLoop->registerListener(this, ModelAPI_AttributeEvalMessage::eventId(), NULL,
- true);
- aLoop->registerListener(this, ModelAPI_ParameterEvalMessage::eventId(), NULL,
- true);
- aLoop->registerListener(this, ModelAPI_BuildEvalMessage::eventId(), NULL,
+ aLoop->registerListener(this, ModelAPI_AttributeEvalMessage::eventId(),
+ nullptr, true);
+ aLoop->registerListener(this, ModelAPI_ParameterEvalMessage::eventId(),
+ nullptr, true);
+ aLoop->registerListener(this, ModelAPI_BuildEvalMessage::eventId(), nullptr,
true);
aLoop->registerListener(this, ModelAPI_ComputePositionsMessage::eventId(),
- NULL, true);
+ nullptr, true);
aLoop->registerListener(this, ModelAPI_ImportParametersMessage::eventId(),
- NULL, true);
+ nullptr, true);
myInterp = std::shared_ptr<InitializationPlugin_PyInterp>(
new InitializationPlugin_PyInterp());
}
//=================================================================================================
-InitializationPlugin_EvalListener::~InitializationPlugin_EvalListener() {}
+InitializationPlugin_EvalListener::~InitializationPlugin_EvalListener() =
+ default;
//=================================================================================================
void InitializationPlugin_EvalListener::processEvent(
std::list<std::wstring> anExprParams = myInterp->compile(theExpression);
// find expression's params in the model
- std::list<std::wstring>::iterator it = anExprParams.begin();
+ auto it = anExprParams.begin();
for (; it != anExprParams.end(); it++) {
double aValue;
ResultParameterPtr aParamRes;
continue;
if (theIsFirstTime) {
- std::list<ResultParameterPtr>::iterator anIter =
+ auto anIter =
std::find(theParamsList.begin(), theParamsList.end(), aParamRes);
if (anIter == theParamsList.end())
theParamsList.push_back(aParamRes);
std::list<std::wstring> anExprParams = myInterp->compile(theExpression);
// find expression's params in the model
std::list<std::wstring> aContext;
- std::list<std::wstring>::iterator it = anExprParams.begin();
+ auto it = anExprParams.begin();
for (; it != anExprParams.end(); it++) {
double aValue;
ResultParameterPtr aParamRes;
class InitializationPlugin_EvalListener : public Events_Listener {
public:
INITIALIZATIONPLUGIN_EXPORT InitializationPlugin_EvalListener();
- INITIALIZATIONPLUGIN_EXPORT virtual ~InitializationPlugin_EvalListener();
+ INITIALIZATIONPLUGIN_EXPORT ~InitializationPlugin_EvalListener() override;
/// Reimplemented from Events_Listener::processEvent().
INITIALIZATIONPLUGIN_EXPORT
- virtual void processEvent(const std::shared_ptr<Events_Message> &theMessage);
+ void processEvent(const std::shared_ptr<Events_Message> &theMessage) override;
// performs the python call to initialize high level data model on internal
// data model creation
new InitializationPlugin_Plugin();
InitializationPlugin_Plugin::InitializationPlugin_Plugin()
- : myCreatePartOnStart(false) // by default in TUI mode part is not created
- // on start of PartSet
+
{
char *isUnitTest = getenv("SHAPER_UNIT_TEST_IN_PROGRESS");
myInitDataModel = (!isUnitTest || isUnitTest[0] != '1');
Events_Loop *aLoop = Events_Loop::loop();
static const Events_ID kDocCreatedEvent =
ModelAPI_DocumentCreatedMessage::eventId();
- aLoop->registerListener(this, kDocCreatedEvent, NULL, true);
+ aLoop->registerListener(this, kDocCreatedEvent, nullptr, true);
static const Events_ID kCreatePartEvent =
Events_Loop::eventByName(EVENT_CREATE_PART_ON_START);
- aLoop->registerListener(this, kCreatePartEvent, NULL, true);
+ aLoop->registerListener(this, kCreatePartEvent, nullptr, true);
myEvalListener = std::shared_ptr<InitializationPlugin_EvalListener>(
new InitializationPlugin_EvalListener());
FeaturePtr aPlane = *aFIter;
const std::list<std::shared_ptr<ModelAPI_Result>> &aResults =
aPlane->results();
- std::list<ResultPtr>::const_iterator aRIter = aResults.begin();
+ auto aRIter = aResults.begin();
for (; aRIter != aResults.cend(); aRIter++) {
(*aRIter)->setDisplayed(false);
}
/// Creates plug-in and registers it in the Event Loop
INITIALIZATIONPLUGIN_EXPORT InitializationPlugin_Plugin();
/// Destructs the plugin
- INITIALIZATIONPLUGIN_EXPORT virtual ~InitializationPlugin_Plugin() {}
+ INITIALIZATIONPLUGIN_EXPORT ~InitializationPlugin_Plugin() override = default;
/// Process the ModelAPI_DocumentCreatedMessage to fulfill a document
/// from the message with origin and planes
- INITIALIZATIONPLUGIN_EXPORT virtual void
- processEvent(const std::shared_ptr<Events_Message> &theMessage);
+ INITIALIZATIONPLUGIN_EXPORT void
+ processEvent(const std::shared_ptr<Events_Message> &theMessage) override;
protected:
/// Creates a plane by given parameters A, B, C
private:
std::shared_ptr<InitializationPlugin_EvalListener> myEvalListener;
bool myInitDataModel;
- bool myCreatePartOnStart;
+ bool myCreatePartOnStart{false};
};
#endif
InitializationPlugin_PyInterp::InitializationPlugin_PyInterp()
: PyInterp_Interp() {}
-InitializationPlugin_PyInterp::~InitializationPlugin_PyInterp() {}
+InitializationPlugin_PyInterp::~InitializationPlugin_PyInterp() = default;
const char *aSearchCode =
"import ast\n"
return aResult;
}
- PyCodeObject *aCodeObj = (PyCodeObject *)aCodePyObj;
+ auto *aCodeObj = (PyCodeObject *)aCodePyObj;
#if PY_VERSION_HEX >= 0x030B0000
std::string aCodeName(PyBytes_AsString(
PyObject_GetAttrString((PyObject *)(aCodeObj), "co_code")));
PyLockWrapper lck; // Acquire GIL until the end of the method
if (theParameters.empty())
return;
- std::list<std::wstring>::const_iterator it = theParameters.begin();
+ auto it = theParameters.begin();
for (; it != theParameters.cend(); it++) {
std::string aParamValue = Locale::Convert::toString(*it);
simpleRun(aParamValue.c_str(), false);
double result = 0.;
try {
// set locale due to the #2485
- std::string aCurLocale = std::setlocale(LC_NUMERIC, 0);
+ std::string aCurLocale = std::setlocale(LC_NUMERIC, nullptr);
std::setlocale(LC_NUMERIC, "C");
result = std::stod(anEvalStr);
std::setlocale(LC_NUMERIC, aCurLocale.c_str());
: public PyInterp_Interp {
public:
InitializationPlugin_PyInterp();
- virtual ~InitializationPlugin_PyInterp();
+ ~InitializationPlugin_PyInterp() override;
/// Returns a list of positions for theName in theExpression.
std::list<std::pair<int, int>> positions(const std::wstring &theExpression,
/// Returns error message.
std::string errorMessage();
/// Overrides PyInterp_Interp.
- virtual bool initContext();
+ bool initContext() override;
/// Reimplemented from PyInterp_Interp::closeContext().
- virtual void closeContext();
+ void closeContext() override;
};
#endif /* INITIALIZATIONPLUGIN_PYINTERP_H_ */
//=======================================================================
void Model_Application::deleteAllDocuments() {
- std::map<int, std::shared_ptr<Model_Document>>::iterator aDoc =
- myDocs.begin();
+ auto aDoc = myDocs.begin();
for (; aDoc != myDocs.end(); aDoc++) {
if (aDoc->second->isOpened()) // here is main document was closed before
// subs and closed subs
for (aResult = int(myDocs.size()); true; aResult++) {
if (myDocs.find(aResult) == myDocs.end()) {
bool aFound = false;
- std::map<std::wstring, int>::iterator aLBDIter = myLoadedByDemand.begin();
+ auto aLBDIter = myLoadedByDemand.begin();
for (; aLBDIter != myLoadedByDemand.end(); aLBDIter++) {
if (aLBDIter->second == aResult) {
aFound = true;
public:
// Redefined OCAF methods
//! Return name of resource (i.e. "Standard")
- Standard_CString ResourcesName();
+ Standard_CString ResourcesName() override;
//! Return format (i.e "MDTV-Standard")
//! \param theFormats sequence of allowed formats for input/output
virtual void Formats(TColStd_SequenceOfExtendedString &theFormats);
TDF_Label myLab; ///< if attribute is not initialized, store label here
public:
/// Defines the double value
- MODEL_EXPORT virtual void setValue(bool theValue);
+ MODEL_EXPORT void setValue(bool theValue) override;
/// Returns the double value
- MODEL_EXPORT virtual bool value();
+ MODEL_EXPORT bool value() override;
protected:
/// Initializes attibutes
/// Reinitializes the internal state of the attribute (may be needed on
/// undo/redo, abort, etc)
- virtual void reinit();
+ void reinit() override;
friend class Model_Data;
};
public:
/// Defines the document referenced from this attribute
- MODEL_EXPORT virtual void setValue(std::shared_ptr<ModelAPI_Document> theDoc);
+ MODEL_EXPORT void
+ setValue(std::shared_ptr<ModelAPI_Document> theDoc) override;
/// Returns document referenced from this attribute
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Document> value();
+ MODEL_EXPORT std::shared_ptr<ModelAPI_Document> value() override;
/// Returns the persisten ID of the document
- MODEL_EXPORT virtual int docId();
+ MODEL_EXPORT int docId() override;
protected:
/// Initializes attibutes
/// Reinitializes the internal state of the attribute (may be needed on
/// undo/redo, abort, etc)
- virtual void reinit();
+ void reinit() override;
friend class Model_Data;
};
public:
/// Defines the double value
- MODEL_EXPORT virtual void setValue(const double theValue);
+ MODEL_EXPORT void setValue(const double theValue) override;
/// Returns the double value
- MODEL_EXPORT virtual double value();
+ MODEL_EXPORT double value() override;
/// Defines the calculated double value
- MODEL_EXPORT virtual void setCalculatedValue(const double theValue);
+ MODEL_EXPORT void setCalculatedValue(const double theValue) override;
/// Defines the text value
- MODEL_EXPORT virtual void setText(const std::wstring &theText);
+ MODEL_EXPORT void setText(const std::wstring &theText) override;
/// Returns the text value
- MODEL_EXPORT virtual std::wstring text();
+ MODEL_EXPORT std::wstring text() override;
/// Allows to set expression (text) as invalid (by the parameters listener)
- MODEL_EXPORT virtual void setExpressionInvalid(const bool theFlag);
+ MODEL_EXPORT void setExpressionInvalid(const bool theFlag) override;
/// Returns true if text is invalid
- MODEL_EXPORT virtual bool expressionInvalid();
+ MODEL_EXPORT bool expressionInvalid() override;
/// Allows to set expression (text) error (by the parameters listener)
- MODEL_EXPORT virtual void setExpressionError(const std::string &theError);
+ MODEL_EXPORT void setExpressionError(const std::string &theError) override;
/// Returns an expression error
- MODEL_EXPORT virtual std::string expressionError();
+ MODEL_EXPORT std::string expressionError() override;
/// Defines the used parameters
- MODEL_EXPORT virtual void
- setUsedParameters(const std::set<std::wstring> &theUsedParameters);
+ MODEL_EXPORT void
+ setUsedParameters(const std::set<std::wstring> &theUsedParameters) override;
/// Returns the used parameters
- MODEL_EXPORT virtual std::set<std::wstring> usedParameters() const;
+ MODEL_EXPORT std::set<std::wstring> usedParameters() const override;
protected:
/// Initializes attributes
Model_AttributeDouble(TDF_Label &theLabel);
/// Reinitializes the internal state of the attribute (may be needed on
/// undo/redo, abort, etc)
- virtual void reinit();
+ void reinit() override;
/// Resets attribute to deafult state.
- virtual void reset();
+ void reset() override;
friend class Model_Data;
};
class Model_AttributeDoubleArray : public ModelAPI_AttributeDoubleArray {
public:
/// Returns the size of the array (zero means that it is empty)
- MODEL_EXPORT virtual int size();
+ MODEL_EXPORT int size() override;
/// Sets the new size of the array. The previous data is erased.
- MODEL_EXPORT virtual void setSize(const int theSize);
+ MODEL_EXPORT void setSize(const int theSize) override;
/// Defines the value of the array by index [0; size-1]
- MODEL_EXPORT virtual void setValue(const int theIndex, const double theValue);
+ MODEL_EXPORT void setValue(const int theIndex,
+ const double theValue) override;
/// Returns the value by the index
- MODEL_EXPORT virtual double value(const int theIndex);
+ MODEL_EXPORT double value(const int theIndex) override;
protected:
/// Initializes attibutes
Model_AttributeDoubleArray(TDF_Label &theLabel);
/// Reinitializes the internal state of the attribute (may be needed on
/// undo/redo, abort, etc)
- virtual void reinit();
+ void reinit() override;
private:
/// The OCCT array that keeps all values.
// Texture
Handle(TColStd_HArray1OfByte) aNewArray =
new TColStd_HArray1OfByte(0, int(theByteArray.size()) - 1);
- std::list<unsigned char>::const_iterator itBA = theByteArray.begin();
+ auto itBA = theByteArray.begin();
for (int j = 0; itBA != theByteArray.end(); ++itBA, ++j) {
aNewArray->SetValue(j, (Standard_Byte)(*itBA));
}
public:
/// Defines the value of the image attribute
- MODEL_EXPORT virtual void
- setTexture(const int theWidth, const int theHeight,
- const std::list<unsigned char> &theByteArray,
- const std::string &theFormat, const bool sendUpdated = true);
+ MODEL_EXPORT void setTexture(const int theWidth, const int theHeight,
+ const std::list<unsigned char> &theByteArray,
+ const std::string &theFormat,
+ const bool sendUpdated = true) override;
/// Returns true, if texture width and height are non-zero
- MODEL_EXPORT virtual bool hasTexture();
+ MODEL_EXPORT bool hasTexture() override;
/// Returns the value of the image attribute
- MODEL_EXPORT virtual bool texture(int &theWidth, int &theHeight,
- std::list<unsigned char> &theByteArray,
- std::string &theFormat);
+ MODEL_EXPORT bool texture(int &theWidth, int &theHeight,
+ std::list<unsigned char> &theByteArray,
+ std::string &theFormat) override;
/// Copy the image data to the destination attribute
- virtual void copyTo(std::shared_ptr<ModelAPI_AttributeImage> theTarget) const;
+ void
+ copyTo(std::shared_ptr<ModelAPI_AttributeImage> theTarget) const override;
protected:
/// Initializes attibutes
Model_AttributeImage(TDF_Label &theLabel);
/// Reinitializes the internal state of the attribute (may be needed on
/// undo/redo, abort, etc)
- virtual void reinit();
+ void reinit() override;
friend class Model_Data;
};
public:
/// Returns the size of the array (zero means that it is empty)
- MODEL_EXPORT virtual int size();
+ MODEL_EXPORT int size() override;
/// Sets the new size of the array. The previous data is erased.
- MODEL_EXPORT virtual void setSize(const int theSize, bool sendUpdated = true);
+ MODEL_EXPORT void setSize(const int theSize,
+ bool sendUpdated = true) override;
/// Defines the value of the array by index [0; size-1]
- MODEL_EXPORT virtual void setValue(const int theIndex, const int theValue,
- bool sendUpdated = true);
+ MODEL_EXPORT void setValue(const int theIndex, const int theValue,
+ bool sendUpdated = true) override;
/// Returns the value by the index
- MODEL_EXPORT virtual int value(const int theIndex);
+ MODEL_EXPORT int value(const int theIndex) override;
protected:
/// Initializes attibutes
Model_AttributeIntArray(TDF_Label &theLabel);
/// Reinitializes the internal state of the attribute (may be needed on
/// undo/redo, abort, etc)
- virtual void reinit();
+ void reinit() override;
friend class Model_Data;
};
class Model_AttributeInteger : public ModelAPI_AttributeInteger {
public:
/// Defines the integer value
- MODEL_EXPORT virtual void setValue(const int theValue);
+ MODEL_EXPORT void setValue(const int theValue) override;
/// Returns the integer value
- MODEL_EXPORT virtual int value();
+ MODEL_EXPORT int value() override;
/// Defines the calculated value
- MODEL_EXPORT virtual void setCalculatedValue(const int theValue);
+ MODEL_EXPORT void setCalculatedValue(const int theValue) override;
/// Defines the text value
- MODEL_EXPORT virtual void setText(const std::wstring &theText);
+ MODEL_EXPORT void setText(const std::wstring &theText) override;
/// Returns the text value
- MODEL_EXPORT virtual std::wstring text();
+ MODEL_EXPORT std::wstring text() override;
/// Allows to set expression (text) as invalid (by the parameters listener)
- MODEL_EXPORT virtual void setExpressionInvalid(const bool theFlag);
+ MODEL_EXPORT void setExpressionInvalid(const bool theFlag) override;
/// Returns true if text is invalid
- MODEL_EXPORT virtual bool expressionInvalid();
+ MODEL_EXPORT bool expressionInvalid() override;
/// Allows to set expression (text) error (by the parameters listener)
- MODEL_EXPORT virtual void setExpressionError(const std::string &theError);
+ MODEL_EXPORT void setExpressionError(const std::string &theError) override;
/// Returns an expression error
- MODEL_EXPORT virtual std::string expressionError();
+ MODEL_EXPORT std::string expressionError() override;
/// Defines the used parameters
- MODEL_EXPORT virtual void
- setUsedParameters(const std::set<std::wstring> &theUsedParameters);
+ MODEL_EXPORT void
+ setUsedParameters(const std::set<std::wstring> &theUsedParameters) override;
/// Returns the used parameters
- MODEL_EXPORT virtual std::set<std::wstring> usedParameters() const;
+ MODEL_EXPORT std::set<std::wstring> usedParameters() const override;
protected:
/// Initializes attributes
Model_AttributeInteger(TDF_Label &theLabel);
/// Reinitializes the internal state of the attribute (may be needed on
/// undo/redo, abort, etc)
- virtual void reinit();
+ void reinit() override;
friend class Model_Data;
}
ADD_BACK_REF(theObject);
owner()->data()->sendAttributeUpdated(this);
- } else if (theObject.get() == NULL) {
+ } else if (theObject.get() == nullptr) {
REMOVE_BACK_REF(anObject);
myRef->Set(myRef->Label()); // reference to itself means that object is null
myID->Set(""); // feature is identified by the empty ID
public:
/// Returns true if this attribute references to a object (not to the
/// attribute)
- MODEL_EXPORT virtual bool isObject();
+ MODEL_EXPORT bool isObject() override;
/// Defines the reference to the attribute
- MODEL_EXPORT virtual void
- setAttr(std::shared_ptr<ModelAPI_Attribute> theAttr);
+ MODEL_EXPORT void
+ setAttr(std::shared_ptr<ModelAPI_Attribute> theAttr) override;
/// Returns attribute referenced from this attribute
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Attribute> attr();
+ MODEL_EXPORT std::shared_ptr<ModelAPI_Attribute> attr() override;
/// Defines the reference to the object
- MODEL_EXPORT virtual void setObject(ObjectPtr theFeature);
+ MODEL_EXPORT void setObject(ObjectPtr theFeature) override;
/// Returns object referenced from this attribute
- MODEL_EXPORT virtual ObjectPtr object();
+ MODEL_EXPORT ObjectPtr object() override;
/// Returns true if attribute was initialized by some value
- MODEL_EXPORT virtual bool isInitialized();
+ MODEL_EXPORT bool isInitialized() override;
protected:
/// Objects are created for features automatically
MODEL_EXPORT Model_AttributeRefAttr(TDF_Label &theLabel);
/// Reinitializes the internal state of the attribute (may be needed on
/// undo/redo, abort, etc)
- virtual void reinit();
+ void reinit() override;
friend class Model_Data;
};
void Model_AttributeRefAttrList::remove(ObjectPtr theObject) {
TDF_Label aTheObjLab;
- if (theObject.get() != NULL) {
+ if (theObject.get() != nullptr) {
aTheObjLab = std::dynamic_pointer_cast<Model_Data>(theObject->data())
->label()
.Father();
if (aOneisDeleted || aRefIter.Value() != aTheObjLab ||
!anIDIter.Value().IsEmpty() ||
(aTheObjLab.IsNull() &&
- aDoc->objects()->object(aRefIter.Value()) != NULL)) {
+ aDoc->objects()->object(aRefIter.Value()) != nullptr)) {
myRef->Append(aRefIter.Value());
myIDs->Append(anIDIter.Value());
} else if (aTheObjLab.IsNull() &&
- aDoc->objects()->object(aRefIter.Value()) != NULL) {
+ aDoc->objects()->object(aRefIter.Value()) != nullptr) {
aOneisDeleted = true;
}
}
void Model_AttributeRefAttrList::remove(AttributePtr theAttr) {
TDF_Label aTheObjLab;
- if (theAttr->owner().get() != NULL) {
+ if (theAttr->owner().get() != nullptr) {
aTheObjLab = std::dynamic_pointer_cast<Model_Data>(theAttr->owner()->data())
->label()
.Father();
// append now only not removed
aRefIter.Value() != aTheObjLab || // append now only not removed
(aTheObjLab.IsNull() &&
- aDoc->objects()->object(aRefIter.Value()) != NULL)) {
+ aDoc->objects()->object(aRefIter.Value()) != nullptr)) {
myRef->Append(aRefIter.Value());
myIDs->Append(anIDIter.Value());
} else {
std::list<std::pair<ObjectPtr, AttributePtr>> anOldList = list();
myRef->Clear();
myIDs->Clear();
- std::list<std::pair<ObjectPtr, AttributePtr>>::iterator anOldIter =
- anOldList.begin();
+ auto anOldIter = anOldList.begin();
for (; anOldIter != anOldList.end(); anOldIter++) {
REMOVE_BACK_REF((anOldIter->first));
}
myIDs; ///< the referenced attributes IDs (empty for just object)
public:
/// Appends the feature to the end of a list
- MODEL_EXPORT virtual void append(ObjectPtr theObject);
+ MODEL_EXPORT void append(ObjectPtr theObject) override;
/// Appends the attribute to the end of a list
- MODEL_EXPORT virtual void append(AttributePtr theAttr);
+ MODEL_EXPORT void append(AttributePtr theAttr) override;
/// Erases the first meet of the feature in the list
- MODEL_EXPORT virtual void remove(ObjectPtr theObject);
+ MODEL_EXPORT void remove(ObjectPtr theObject) override;
/// Erases the first meet of the attribute in the list
- MODEL_EXPORT virtual void remove(AttributePtr theAttr);
+ MODEL_EXPORT void remove(AttributePtr theAttr) override;
/// Removes all references from the list
- MODEL_EXPORT virtual void clear();
+ MODEL_EXPORT void clear() override;
/// Returns number of features in the list
- MODEL_EXPORT virtual int size() const;
+ MODEL_EXPORT int size() const override;
/// Returns the list of features and attributes (if it is reference to the
/// attribute)
- MODEL_EXPORT virtual std::list<std::pair<ObjectPtr, AttributePtr>> list();
+ MODEL_EXPORT std::list<std::pair<ObjectPtr, AttributePtr>> list() override;
/// Returns true if the object is in list
- MODEL_EXPORT virtual bool isInList(const ObjectPtr &theObj);
+ MODEL_EXPORT bool isInList(const ObjectPtr &theObj) override;
/// Returns true if the attribute is in list
- MODEL_EXPORT virtual bool isInList(const AttributePtr &theObj);
+ MODEL_EXPORT bool isInList(const AttributePtr &theObj) override;
/// Returns true if this is reference to an attribute, not just object
- MODEL_EXPORT virtual bool isAttribute(const int theIndex) const;
+ MODEL_EXPORT bool isAttribute(const int theIndex) const override;
/// Returns the referenced object by the zero-based index
///\param theIndex zero-based index in the list
- MODEL_EXPORT virtual ObjectPtr object(const int theIndex) const;
+ MODEL_EXPORT ObjectPtr object(const int theIndex) const override;
/// Returns the referenced attribute by the zero-based index
///\param theIndex zero-based index in the list
- MODEL_EXPORT virtual AttributePtr attribute(const int theIndex) const;
+ MODEL_EXPORT AttributePtr attribute(const int theIndex) const override;
/// Removes the last element in the list.
- MODEL_EXPORT virtual void removeLast();
+ MODEL_EXPORT void removeLast() override;
/// Removes the elements from the list.
/// \param theIndices a list of indices of elements to be removed
- MODEL_EXPORT virtual void remove(const std::set<int> &theIndices);
+ MODEL_EXPORT void remove(const std::set<int> &theIndices) override;
/// Returns true if attribute was initialized by some value
- MODEL_EXPORT virtual bool isInitialized();
+ MODEL_EXPORT bool isInitialized() override;
protected:
/// Objects are created for features automatically
MODEL_EXPORT Model_AttributeRefAttrList(TDF_Label &theLabel);
/// Reinitializes the internal state of the attribute (may be needed on
/// undo/redo, abort, etc)
- virtual void reinit();
+ void reinit() override;
friend class Model_Data;
};
void Model_AttributeRefList::remove(ObjectPtr theObject) {
eraseHash();
- if (theObject.get() != NULL) {
+ if (theObject.get() != nullptr) {
if (owner()->document() == theObject->document()) {
std::shared_ptr<Model_Data> aData;
aData = std::dynamic_pointer_cast<Model_Data>(theObject->data());
for (TDF_ListIteratorOfLabelList aLIter(aList); aLIter.More();
aLIter.Next()) {
ObjectPtr anObj = aDoc->objects()->object(aLIter.Value());
- if (anObj.get() == NULL) {
+ if (anObj.get() == nullptr) {
myRef->Remove(aLIter.Value());
REMOVE_BACK_REF(theObject);
owner()->data()->sendAttributeUpdated(this);
void Model_AttributeRefList::clear() {
std::list<ObjectPtr> anOldList = list();
myRef->Clear();
- std::list<ObjectPtr>::iterator anOldIter = anOldList.begin();
+ auto anOldIter = anOldList.begin();
for (; anOldIter != anOldList.end(); anOldIter++) {
REMOVE_BACK_REF((*anOldIter));
}
std::list<ObjectPtr> Model_AttributeRefList::list() {
createHash();
std::list<ObjectPtr> aResult;
- std::map<int, ObjectPtr>::iterator aHashIter = myHashIndex.begin();
+ auto aHashIter = myHashIndex.begin();
for (; aHashIter != myHashIndex.end(); aHashIter++) {
aResult.push_back(aHashIter->second);
}
myHashIndexNoEmpty; ///< index to not empty object in the list
public:
/// Appends the feature to the end of a list
- MODEL_EXPORT virtual void append(ObjectPtr theObject);
+ MODEL_EXPORT void append(ObjectPtr theObject) override;
/// Erases the first meet of the feature in the list
- MODEL_EXPORT virtual void remove(ObjectPtr theObject);
+ MODEL_EXPORT void remove(ObjectPtr theObject) override;
/// Returns number of features in the list
///\param theWithEmpty if it is false, returns the number of not-empty
/// referenced objects
- MODEL_EXPORT virtual int size(const bool theWithEmpty = true) const;
+ MODEL_EXPORT int size(const bool theWithEmpty = true) const override;
/// Removes all references from the list
- MODEL_EXPORT virtual void clear();
+ MODEL_EXPORT void clear() override;
/// Returns the list of features
- MODEL_EXPORT virtual std::list<ObjectPtr> list();
+ MODEL_EXPORT std::list<ObjectPtr> list() override;
/// Returns true if the object is in list
- MODEL_EXPORT virtual bool isInList(const ObjectPtr &theObj);
+ MODEL_EXPORT bool isInList(const ObjectPtr &theObj) override;
/// Returns the list of features
///\param theIndex zero-based index in the list
///\param theWithEmpty if it is false, counts the not-empty referenced objects
/// only
- MODEL_EXPORT virtual ObjectPtr object(const int theIndex,
- const bool theWithEmpty = true);
+ MODEL_EXPORT ObjectPtr object(const int theIndex,
+ const bool theWithEmpty = true) override;
/// Substitutes the feature by another one. Does nothing if such object is not
/// found. Does not support the external documents objects yet.
- MODEL_EXPORT virtual void substitute(const ObjectPtr &theCurrent,
- const ObjectPtr &theNew);
+ MODEL_EXPORT void substitute(const ObjectPtr &theCurrent,
+ const ObjectPtr &theNew) override;
/// Removes the last element in the list.
/// Does not support the external documents objects yet.
- MODEL_EXPORT virtual void removeLast();
+ MODEL_EXPORT void removeLast() override;
/// Removes the elements from the list.
/// Does not support the external documents objects yet.
/// \param theIndices a list of indices of elements to be removed
- MODEL_EXPORT virtual void remove(const std::set<int> &theIndices);
+ MODEL_EXPORT void remove(const std::set<int> &theIndices) override;
/// Returns true if attribute was initialized by some value
- MODEL_EXPORT virtual bool isInitialized();
+ MODEL_EXPORT bool isInitialized() override;
/// Erases the hashed objects caused by complicated modifications in the list
void eraseHash();
MODEL_EXPORT Model_AttributeRefList(TDF_Label &theLabel);
/// Reinitializes the internal state of the attribute (may be needed on
/// undo/redo, abort, etc)
- virtual void reinit();
+ void reinit() override;
/// Returns the object by iterators (theExtIter is iterated if necessary)
ObjectPtr
iteratedObject(TDF_ListIteratorOfLabelList &theLIter,
}
}
-Model_AttributeReference::~Model_AttributeReference() {}
+Model_AttributeReference::~Model_AttributeReference() = default;
Handle_TDF_Reference myRef; ///< references to the feature label
public:
/// Defines the object referenced from this attribute
- MODEL_EXPORT virtual void setValue(ObjectPtr theObject);
+ MODEL_EXPORT void setValue(ObjectPtr theObject) override;
/// Returns object referenced from this attribute
- MODEL_EXPORT virtual ObjectPtr value();
+ MODEL_EXPORT ObjectPtr value() override;
- MODEL_EXPORT ~Model_AttributeReference();
+ MODEL_EXPORT ~Model_AttributeReference() override;
- MODEL_EXPORT virtual void
- setObject(const std::shared_ptr<ModelAPI_Object> &theObject);
+ MODEL_EXPORT void
+ setObject(const std::shared_ptr<ModelAPI_Object> &theObject) override;
/// Returns true if attribute was initialized by some value
- MODEL_EXPORT virtual bool isInitialized();
+ MODEL_EXPORT bool isInitialized() override;
protected:
/// Objects are created for features automatically
MODEL_EXPORT Model_AttributeReference(TDF_Label &theLabel);
/// Reinitializes the internal state of the attribute (may be needed on
/// undo/redo, abort, etc)
- virtual void reinit();
+ void reinit() override;
friend class Model_Data;
friend class Model_AttributeSelection;
// do not use the degenerated edge as a shape, a null context and shape is
// used in the case
if (theSubShape.get() && !theSubShape->isNull() && theSubShape->isEdge()) {
- const TopoDS_Shape &aSubShape = theSubShape->impl<TopoDS_Shape>();
+ const auto &aSubShape = theSubShape->impl<TopoDS_Shape>();
if (aSubShape.ShapeType() == TopAbs_EDGE)
isDegeneratedEdge =
BRep_Tool::Degenerated(TopoDS::Edge(aSubShape)) == Standard_True;
GeomShapePtr centerByEdge(GeomShapePtr theEdge,
ModelAPI_AttributeSelection::CenterType theType) {
if (theType != ModelAPI_AttributeSelection::NOT_CENTER &&
- theEdge.get() != NULL) {
+ theEdge.get() != nullptr) {
TopoDS_Shape aShape = theEdge->impl<TopoDS_Shape>();
if (!aShape.IsNull() && aShape.ShapeType() == TopAbs_EDGE) {
TopoDS_Edge anEdge = TopoDS::Edge(aShape);
FeaturePtr aFeature = contextFeature();
if (aFeature.get()) {
std::list<GeomShapePtr> allShapes;
- std::list<ResultPtr>::const_iterator aRes =
- aFeature->results().cbegin();
+ auto aRes = aFeature->results().cbegin();
for (; aRes != aFeature->results().cend(); aRes++) {
if (aRes->get() && !(*aRes)->isDisabled()) {
GeomShapePtr aShape = (*aRes)->shape();
if (aSelLab.IsAttribute(kSIMPLE_REF_ID) ||
aSelLab.IsAttribute(kPART_REF_ID)) {
ResultPtr aContext = context();
- return aContext.get() != NULL;
+ return aContext.get() != nullptr;
}
Handle(TNaming_NamedShape) aSelection;
if (selectionLabel().FindAttribute(TNaming_NamedShape::GetID(),
if (!aMyDoc.get())
return false;
// check at least the feature exists
- return aMyDoc->featureByLab(aRefLab).get() != NULL;
+ return aMyDoc->featureByLab(aRefLab).get() != nullptr;
}
}
return false;
}
Model_AttributeSelection::Model_AttributeSelection(TDF_Label &theLabel)
- : myRef(theLabel), myTmpCenterType(NOT_CENTER), myParent(NULL),
+ : myRef(theLabel), myTmpCenterType(NOT_CENTER), myParent(nullptr),
myIsGeometricalSelection(false) {
myIsInitialized = myRef.isInitialized();
}
// center-name
static ModelAPI_AttributeSelection::CenterType
centerTypeByName(std::wstring &theShapeName) {
- std::map<ModelAPI_AttributeSelection::CenterType, std::wstring>::iterator
- aPrefixIter = centersMap().begin();
+ auto aPrefixIter = centersMap().begin();
for (; aPrefixIter != centersMap().end(); aPrefixIter++) {
std::size_t aFound = theShapeName.find(aPrefixIter->second);
if (aFound != std::wstring::npos &&
// too.
std::list<FeaturePtr> aPartSetFeatures = aFeatures;
aFeatures.clear();
- for (std::list<FeaturePtr>::iterator it = aPartSetFeatures.begin();
- it != aPartSetFeatures.end(); ++it) {
- aFeatures.push_back(*it);
- if ((*it)->firstResult()->groupName() == ModelAPI_ResultPart::group()) {
+ for (auto &aPartSetFeature : aPartSetFeatures) {
+ aFeatures.push_back(aPartSetFeature);
+ if (aPartSetFeature->firstResult()->groupName() ==
+ ModelAPI_ResultPart::group()) {
ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(
- (*it)->firstResult());
+ aPartSetFeature->firstResult());
std::list<FeaturePtr> aPartFeatures = aPart->partDoc()->allFeatures();
aFeatures.insert(aFeatures.end(), aPartFeatures.begin(),
aPartFeatures.end());
// feature
bool isSubOfComposite = false;
const std::set<AttributePtr> &aRefs = (*anIt)->data()->refsToMe();
- for (std::set<AttributePtr>::const_iterator aRefIt = aRefs.begin();
+ for (auto aRefIt = aRefs.begin();
aRefIt != aRefs.end() && !isSubOfComposite; ++aRefIt) {
FeaturePtr aFeature = ModelAPI_Feature::feature((*aRefIt)->owner());
CompositeFeaturePtr aCompFeature =
// process results of the current feature to find appropriate sub-shape
if (ModelGeomAlgo_Shape::findSubshapeByPoint(*anIt, thePoint, aType,
anAppropriate)) {
- std::list<ModelGeomAlgo_Shape::SubshapeOfResult>::iterator anApIt =
- anAppropriate.begin();
+ auto anApIt = anAppropriate.begin();
for (; aSelectionIndex > 0 && anApIt != anAppropriate.end();
--aSelectionIndex)
++anApIt; // skip this shape, because one of the previous is selected
if (aComp.get()) {
std::list<ResultPtr> allNewContextSubs;
ModelAPI_Tools::allSubs(aComp, allNewContextSubs);
- std::list<ResultPtr>::iterator aSub = allNewContextSubs.begin();
+ auto aSub = allNewContextSubs.begin();
for (; aSub != allNewContextSubs.end(); aSub++) {
ResultBodyPtr aBody =
std::dynamic_pointer_cast<ModelAPI_ResultBody>(*aSub);
aNewToOld; // map from new containers to old containers (with val)
TopTools_MapOfShape anOlds; // to know how many olds produced new containers
for (; aToFindPart != 2 && theShapes.IsEmpty(); aToFindPart++) {
- std::list<ResultPtr>::iterator aNewContIter = aNewToIterate.begin();
+ auto aNewContIter = aNewToIterate.begin();
for (; aNewContIter != aNewToIterate.end(); aNewContIter++) {
std::shared_ptr<Model_Data> aNewData =
std::dynamic_pointer_cast<Model_Data>((*aNewContIter)->data());
} else { // all results of a feature
aRootRes = theFeature->results();
}
- std::list<ResultPtr>::const_iterator aRootIter = aRootRes.cbegin();
+ auto aRootIter = aRootRes.cbegin();
for (; aRootIter != aRootRes.cend(); aRootIter++) {
std::list<DataPtr> allRes;
allRes.push_back((*aRootIter)->data());
if (aRootBody.get()) {
std::list<ResultPtr> allSub;
ModelAPI_Tools::allSubs(aRootBody, allSub);
- for (std::list<ResultPtr>::iterator anIt = allSub.begin();
- anIt != allSub.end(); anIt++)
- allRes.push_back((*anIt)->data());
+ for (auto &anIt : allSub)
+ allRes.push_back(anIt->data());
}
if (theCheckWholeFeature)
allRes.push_back(theFeature->data());
- for (std::list<DataPtr>::iterator aRIter = allRes.begin();
- aRIter != allRes.end(); aRIter++) {
- const std::set<AttributePtr> &aRefs = (*aRIter)->refsToMe();
- std::set<AttributePtr>::const_iterator aRef = aRefs.cbegin();
+ for (auto &allRe : allRes) {
+ const std::set<AttributePtr> &aRefs = allRe->refsToMe();
+ auto aRef = aRefs.cbegin();
for (; aRef != aRefs.cend(); aRef++) {
if (!aRef->get() || !(*aRef)->owner().get())
continue;
}
}
// if there exist context composite and sub-result(s), leave only sub(s)
- for (std::list<ResultPtr>::iterator aResIter = aResults.begin();
- aResIter != aResults.end();) {
+ for (auto aResIter = aResults.begin(); aResIter != aResults.end();) {
ResultPtr aParent = ModelAPI_Tools::bodyOwner(*aResIter);
for (; aParent.get(); aParent = ModelAPI_Tools::bodyOwner(aParent))
if (aResultsSet.count(aParent))
break;
if (aParent.get()) {
aResultsSet.erase(aParent);
- for (std::list<ResultPtr>::iterator anIt = aResults.begin();
- anIt != aResults.end(); anIt++) {
+ for (auto anIt = aResults.begin(); anIt != aResults.end(); anIt++) {
if (*anIt == aParent) {
aResults.erase(anIt);
aResIter = aResults.begin(); // erase from set, so, restart iteration
std::list<FeaturePtr> aConcealers;
concealedFeature(aContextOwner, aThisFeature, false, aConcealers,
theContext);
- std::list<FeaturePtr>::iterator aConcealer = aConcealers.begin();
+ auto aConcealer = aConcealers.begin();
for (; aConcealer != aConcealers.end(); aConcealer++) {
std::list<ResultPtr> aRefResults;
ModelAPI_Tools::allResults(*aConcealer, aRefResults);
- std::list<ResultPtr>::iterator aRefIter = aRefResults.begin();
+ auto aRefIter = aRefResults.begin();
for (; aRefIter != aRefResults.end(); aRefIter++) {
ResultBodyPtr aRefBody =
std::dynamic_pointer_cast<ModelAPI_ResultBody>(*aRefIter);
}
}
// check for the further modifications of the copy contexts and values
- std::list<ObjectPtr>::iterator aCopyContIter = aCopyContext.begin();
- std::list<GeomShapePtr>::iterator aCopyValIter = aCopyVals.begin();
+ auto aCopyContIter = aCopyContext.begin();
+ auto aCopyValIter = aCopyVals.begin();
for (; aCopyContIter != aCopyContext.end();
aCopyContIter++, aCopyValIter++) {
ResultPtr aNewCont =
if (searchNewContext(theDoc, aNewContShape, aNewCont, aNewValShape,
theAccessLabel, aNewRes, aNewUpdatedVal)) {
// append new results instead of the current ones
- std::list<ResultPtr>::iterator aNewIter = aNewRes.begin();
+ auto aNewIter = aNewRes.begin();
TopTools_ListIteratorOfListOfShape aNewUpdVal(aNewUpdatedVal);
for (; aNewIter != aNewRes.end(); aNewIter++, aNewUpdVal.Next()) {
theResults.push_back(*aNewIter);
return false;
// iterate all results to find further modifications
- std::list<ResultPtr>::iterator aResIter = aResults.begin();
+ auto aResIter = aResults.begin();
for (aResIter = aResults.begin(); aResIter != aResults.end(); aResIter++) {
- if (aResIter->get() != NULL) {
+ if (aResIter->get() != nullptr) {
ResultPtr aNewResObj = *aResIter;
// compute new values by two contexts: the old and the new
TopTools_ListOfShape aValShapes;
if (searchNewContext(theDoc, aNewContShape, aNewResObj, aNewValSh,
theAccessLabel, aNewRes, aNewUpdatedVal)) {
// append new results instead of the current ones
- std::list<ResultPtr>::iterator aNewIter = aNewRes.begin();
+ auto aNewIter = aNewRes.begin();
TopTools_ListIteratorOfListOfShape aNewUpdVal(aNewUpdatedVal);
for (; aNewIter != aNewRes.end(); aNewIter++, aNewUpdVal.Next()) {
theResults.push_back(*aNewIter);
// if there are copies, but no direct modification, keep the original
bool aKeepOrigin = false;
if (aCopyPossible) {
- std::list<FeaturePtr>::iterator aConcealer = aConcealers.begin();
+ auto aConcealer = aConcealers.begin();
for (aKeepOrigin = true; aConcealer != aConcealers.end();
aConcealer++)
if (!std::dynamic_pointer_cast<ModelAPI_FeatureCopyInterface>(
}
}
bool aChanged = false;
- std::list<FeaturePtr>::iterator aConcealer = aConcealers.begin();
+ auto aConcealer = aConcealers.begin();
for (; aConcealer != aConcealers.end(); aConcealer++)
if (aChanged) {
if (aKeepOrigin || !myParent->isInList(*aConcealer, anEmptyShape))
// the referenced cont
const std::set<AttributePtr> &aRefs =
aPartContext->data()->refsToMe();
- std::set<AttributePtr>::const_iterator aRef = aRefs.begin();
+ auto aRef = aRefs.begin();
for (; aRef != aRefs.end(); aRef++) {
// to avoid detection of part changes by local selection only
AttributeSelectionPtr aSel =
std::set<ResultPtr> aSkippedContext;
// if there exist context composite and sub-result(s), leave only sub(s)
- std::set<ResultPtr>::iterator aResIter = allContexts.begin();
+ auto aResIter = allContexts.begin();
for (; aResIter != allContexts.end(); aResIter++) {
ResultPtr aParent = ModelAPI_Tools::bodyOwner(*aResIter);
for (; aParent.get(); aParent = ModelAPI_Tools::bodyOwner(aParent))
myParent && myParent->isWholeResultAllowed() && !aSubShape.get();
GeomAPI_Shape::ShapeType allowedType = GeomAPI_Shape::SHAPE;
if (isWholeResult) {
- std::list<ResultPtr>::iterator aNewCont = aNewContexts.begin();
+ auto aNewCont = aNewContexts.begin();
TopTools_ListIteratorOfListOfShape aNewValues(aValShapes);
for (; aNewCont != aNewContexts.end(); aNewCont++, aNewValues.Next()) {
if (aNewValues.Value().IsNull()) { // only for the whole context
aShapeType) { // select the best, nearest to the origin
GeomAPI_Shape::ShapeType anOldShapeType =
aContext->shape()->shapeType();
- GeomAPI_Shape::ShapeType aDeltaAllowed =
+ auto aDeltaAllowed =
(GeomAPI_Shape::ShapeType)(anOldShapeType - anAllowed);
if (aDeltaAllowed < 0)
aDeltaAllowed = (GeomAPI_Shape::ShapeType)(-aDeltaAllowed);
- GeomAPI_Shape::ShapeType aDeltaThis =
+ auto aDeltaThis =
(GeomAPI_Shape::ShapeType)(anOldShapeType - aShapeType);
if (aDeltaThis < 0)
aDeltaThis = (GeomAPI_Shape::ShapeType)(-aDeltaThis);
}
}
- std::list<ResultPtr>::iterator aNewCont = aNewContexts.begin();
+ auto aNewCont = aNewContexts.begin();
TopTools_ListIteratorOfListOfShape aNewValues(aValShapes);
bool aFirst = true; // first is set to this, next are appended to parent
for (; aNewCont != aNewContexts.end(); aNewCont++, aNewValues.Next()) {
if (aBodyContext.get() && aBodyContext->numberOfSubs() != 0) {
std::list<ResultPtr> aLower;
ModelAPI_Tools::allSubs(aBodyContext, aLower, true);
- for (std::list<ResultPtr>::iterator aL = aLower.begin();
- aL != aLower.end(); aL++) {
- GeomShapePtr aLShape = (*aL)->shape();
+ for (auto &aL : aLower) {
+ GeomShapePtr aLShape = aL->shape();
if (aLShape.get() && !aLShape->isNull()) {
if (aLShape->isSubShape(aValueShape, false)) {
- aNewContext = *aL;
+ aNewContext = aL;
break;
}
}
FeaturePtr aSub = aComposite->subFeature(a);
const std::list<std::shared_ptr<ModelAPI_Result>> &aResults =
aSub->results();
- std::list<std::shared_ptr<ModelAPI_Result>>::const_iterator aRes =
- aResults.cbegin();
+ auto aRes = aResults.cbegin();
for (; aRes != aResults.cend() && theValue.IsNull(); aRes++) {
if ((*aRes)->data()->name() == aCompName) {
theValue = std::dynamic_pointer_cast<Model_Data>((*aRes)->data())
if (aCompBody.get()) {
std::list<ResultPtr> allSub;
ModelAPI_Tools::allSubs(aCompBody, allSub);
- for (std::list<ResultPtr>::iterator anIt = allSub.begin();
- anIt != allSub.end(); anIt++)
- allRes.push_back((*anIt)->data());
+ for (auto &anIt : allSub)
+ allRes.push_back(anIt->data());
allRes.push_back(aCompBody->data());
aCompContext = aCompBody;
}
allRes.push_back(aResult->document()->feature(aResult)->data());
bool aFoundReferernce = false;
- for (std::list<DataPtr>::iterator aSub = allRes.begin();
- aSub != allRes.end(); aSub++) {
- DataPtr aResCont = *aSub;
+ for (auto aResCont : allRes) {
ResultBodyPtr aResBody =
std::dynamic_pointer_cast<ModelAPI_ResultBody>(aResCont->owner());
if (aResBody.get() && aResBody->numberOfSubs() > 0 &&
aResBody != aCompContext)
continue; // only lower and higher level subs are counted
const std::set<AttributePtr> &aRefs = aResCont->refsToMe();
- std::set<AttributePtr>::const_iterator aRef = aRefs.begin();
+ auto aRef = aRefs.begin();
for (; !aFindNewContext && aRef != aRefs.end(); aRef++) {
if (!aRef->get() || !(*aRef)->owner().get())
continue;
// take all sub-results or one result
std::list<ResultPtr> aRefFeatResults;
ModelAPI_Tools::allResults(aRefFeat, aRefFeatResults);
- std::list<ResultPtr>::iterator aRefResIter = aRefFeatResults.begin();
+ auto aRefResIter = aRefFeatResults.begin();
for (; aRefResIter != aRefFeatResults.end(); aRefResIter++) {
ResultBodyPtr aBody =
std::dynamic_pointer_cast<ModelAPI_ResultBody>(*aRefResIter);
aBody->numberOfSubs() == 0) // add only lower level subs
aResults.push_back(aBody);
}
- std::list<std::shared_ptr<ModelAPI_Result>>::iterator aResIter =
- aResults.begin();
+ auto aResIter = aResults.begin();
// searching by sub-shape
for (; aResIter != aResults.end(); aResIter++) {
if (aComp && aComp->numberOfSubs()) {
std::list<ResultPtr> allSubs;
ModelAPI_Tools::allSubs(aComp, allSubs);
- std::list<ResultPtr>::iterator aS = allSubs.begin();
+ auto aS = allSubs.begin();
for (; aS != allSubs.end(); aS++) {
ResultBodyPtr aSub = std::dynamic_pointer_cast<ModelAPI_ResultBody>(*aS);
if (aSub && aSub->numberOfSubs() == 0 && aSub->shape().get() &&
/// added in the data framework
/// (used to remove immediately, without the following updates)
/// \returns true if attribute was updated
- MODEL_EXPORT virtual bool
- setValue(const ObjectPtr &theContext,
- const std::shared_ptr<GeomAPI_Shape> &theSubShape,
- const bool theTemporarily = false);
+ MODEL_EXPORT bool setValue(const ObjectPtr &theContext,
+ const std::shared_ptr<GeomAPI_Shape> &theSubShape,
+ const bool theTemporarily = false) override;
/// Same as SetValue, but it takes an edge (on circular or elliptic curve)
/// and stores the vertex of the central point (for ellipse the first or the
/// second focus point)
- MODEL_EXPORT virtual void setValueCenter(
- const ObjectPtr &theContext, const std::shared_ptr<GeomAPI_Edge> &theEdge,
- const CenterType theCenterType, const bool theTemporarily = false);
+ MODEL_EXPORT void setValueCenter(const ObjectPtr &theContext,
+ const std::shared_ptr<GeomAPI_Edge> &theEdge,
+ const CenterType theCenterType,
+ const bool theTemporarily = false) override;
/// Makes this selection attribute selects the same as in theSource selection
- MODEL_EXPORT virtual void
- selectValue(const std::shared_ptr<ModelAPI_AttributeSelection> &theSource);
+ MODEL_EXPORT void selectValue(
+ const std::shared_ptr<ModelAPI_AttributeSelection> &theSource) override;
/// Reset temporary stored values
- virtual void removeTemporaryValues();
+ void removeTemporaryValues() override;
/// Returns the selected subshape
- MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Shape> value();
+ MODEL_EXPORT std::shared_ptr<GeomAPI_Shape> value() override;
/// Returns the context of the selection (the whole shape owner)
- MODEL_EXPORT virtual ResultPtr context();
+ MODEL_EXPORT ResultPtr context() override;
/// Returns the context of the selection if the whole feature was selected
- MODEL_EXPORT virtual FeaturePtr contextFeature();
+ MODEL_EXPORT FeaturePtr contextFeature() override;
/// Returns the context of the selection : result or feature
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Object> contextObject();
+ MODEL_EXPORT std::shared_ptr<ModelAPI_Object> contextObject() override;
/// Sets the feature object
- MODEL_EXPORT virtual void
- setObject(const std::shared_ptr<ModelAPI_Object> &theObject);
+ MODEL_EXPORT void
+ setObject(const std::shared_ptr<ModelAPI_Object> &theObject) override;
/// Updates the selection due to the changes in the referenced objects
/// \returns false if update is failed
- MODEL_EXPORT virtual bool update();
+ MODEL_EXPORT bool update() override;
/// Returns a textual string of the selection
/// \param theDefaultValue a name, which is returned if the naming name can
/// not be obtained
- MODEL_EXPORT virtual std::wstring
- namingName(const std::wstring &theDefaultValue = L"");
+ MODEL_EXPORT std::wstring
+ namingName(const std::wstring &theDefaultValue = L"") override;
/// Defines the sub-shape by Id
- MODEL_EXPORT virtual void setId(int theID);
+ MODEL_EXPORT void setId(int theID) override;
/// Selects (i.e. creates Naming data structure) of sub-shape specified by
/// textual name
- MODEL_EXPORT virtual void selectSubShape(const std::string &theType,
- const std::wstring &theSubShapeName);
+ MODEL_EXPORT void
+ selectSubShape(const std::string &theType,
+ const std::wstring &theSubShapeName) override;
/// Selects sub-shape by its inner point
- MODEL_EXPORT virtual void
+ MODEL_EXPORT void
selectSubShape(const std::string &theType,
- const std::shared_ptr<GeomAPI_Pnt> &thePoint);
+ const std::shared_ptr<GeomAPI_Pnt> &thePoint) override;
/// Selects sub-shape by weak naming index
- MODEL_EXPORT virtual void selectSubShape(const std::string &theType,
- const std::wstring &theContextName,
- const int theIndex);
+ MODEL_EXPORT void selectSubShape(const std::string &theType,
+ const std::wstring &theContextName,
+ const int theIndex) override;
/// Returns true if attribute was initialized by some value
- MODEL_EXPORT virtual bool isInitialized();
+ MODEL_EXPORT bool isInitialized() override;
/// Returns true if recompute of selection become impossible
- MODEL_EXPORT virtual bool isInvalid();
+ MODEL_EXPORT bool isInvalid() override;
/// Updates the arguments of selection if something was affected by creation
/// or reorder of features upper in the history line (issue #1757)
/// Returns theRemove true if this attribute must be removed (become deleted)
- MODEL_EXPORT virtual void updateInHistory(bool &theRemove) override;
+ MODEL_EXPORT void updateInHistory(bool &theRemove) override;
// Implementation of the name generator method from the Selector package
// This method returns the context name by the label of the sub-selected shape
- MODEL_EXPORT virtual std::wstring
+ MODEL_EXPORT std::wstring
contextName(const TDF_Label theSelectionLab) override;
/// This method restores by the context and value name the context label and
/// sub-label where the value is. Returns true if it is valid.
- MODEL_EXPORT virtual bool restoreContext(std::wstring theName,
- TDF_Label &theContext,
- TDF_Label &theValue) override;
+ MODEL_EXPORT bool restoreContext(std::wstring theName, TDF_Label &theContext,
+ TDF_Label &theValue) override;
/// Returns true if the first result is newer than the second one in the tree
/// of features
- MODEL_EXPORT virtual bool isLater(const TDF_Label theResult1,
- const TDF_Label theResult2) const override;
+ MODEL_EXPORT bool isLater(const TDF_Label theResult1,
+ const TDF_Label theResult2) const override;
/// Returns the name by context. Adds the part name if the context is located
/// in other document
- MODEL_EXPORT virtual std::wstring
- contextName(const ResultPtr &theContext) const;
+ MODEL_EXPORT std::wstring
+ contextName(const ResultPtr &theContext) const override;
/// Makes the current local selection becomes all sub-shapes with same base
/// geometry.
- MODEL_EXPORT virtual void combineGeometrical();
+ MODEL_EXPORT void combineGeometrical() override;
/// Resets attribute to deafult state
- MODEL_EXPORT virtual void reset();
+ MODEL_EXPORT void reset() override;
protected:
/// Objects are created for features automatically
/// Sets the ID of the attribute in Data (called from Data): here it is used
/// for myRef ID setting
- MODEL_EXPORT virtual void setID(const std::string theID);
+ MODEL_EXPORT void setID(const std::string theID) override;
/// Sets the parent attribute
void setParent(Model_AttributeSelectionList *theParent);
TopoDS_Shape theValShape, TopTools_ListOfShape &theShapes);
/// Returns true if is geometrical selection.
- virtual bool isGeometricalSelection() const {
+ bool isGeometricalSelection() const override {
return myIsGeometricalSelection;
};
// do not use the degenerated edge as a shape, a list is not incremented in
// this case
if (theSubShape.get() && !theSubShape->isNull() && theSubShape->isEdge()) {
- const TopoDS_Shape &aSubShape = theSubShape->impl<TopoDS_Shape>();
+ const auto &aSubShape = theSubShape->impl<TopoDS_Shape>();
if (aSubShape.ShapeType() == TopAbs_EDGE &&
BRep_Tool::Degenerated(TopoDS::Edge(aSubShape))) {
return;
const bool /*theTemporarily*/) {
if (myIsCashed) { // the cashing is active
if (theContext.get()) {
- std::map<ObjectPtr, std::list<std::shared_ptr<GeomAPI_Shape>>>::iterator
- aContext = myCash.find(theContext);
+ auto aContext = myCash.find(theContext);
if (aContext != myCash.end()) {
// iterate shapes because "isSame" method must be called for each shape
- std::list<std::shared_ptr<GeomAPI_Shape>>::iterator aShapes =
- aContext->second.begin();
+ auto aShapes = aContext->second.begin();
for (; aShapes != aContext->second.end(); aShapes++) {
if (!theSubShape.get()) {
if (!aShapes->get())
}
// no-cash method
bool isFeature =
- std::dynamic_pointer_cast<ModelAPI_Feature>(theContext).get() != NULL;
+ std::dynamic_pointer_cast<ModelAPI_Feature>(theContext).get() != nullptr;
ResultPtr aRes;
if (!isFeature)
aRes = std::dynamic_pointer_cast<ModelAPI_Result>(theContext);
anAttr->value()->shapeType() != GeomAPI_Shape::COMPOUND)
continue;
// check it is equal to some other attribute already presented in the list
- std::list<AttributeSelectionPtr>::iterator anAttrIter =
- anAttributes.begin();
+ auto anAttrIter = anAttributes.begin();
for (; anAttrIter != anAttributes.end(); anAttrIter++) {
if (anAttr->context() == (*anAttrIter)->context() &&
anAttr->namingName() == (*anAttrIter)->namingName()) {
/// selected) \param theTemporarily if it is true, do not store and name the
/// added in the data framework
/// (used to remove immediately, without the following updates)
- MODEL_EXPORT virtual void
- append(const ObjectPtr &theContext,
- const std::shared_ptr<GeomAPI_Shape> &theSubShape,
- const bool theTemporarily = false);
+ MODEL_EXPORT void append(const ObjectPtr &theContext,
+ const std::shared_ptr<GeomAPI_Shape> &theSubShape,
+ const bool theTemporarily = false) override;
/// Adds the new reference to the end of the list by the naming name of the
/// selected shape The type of shape is taken from the current selection type
/// if the given is empty
- MODEL_EXPORT virtual void append(const std::wstring &theNamingName,
- const std::string &theType = "");
+ MODEL_EXPORT void append(const std::wstring &theNamingName,
+ const std::string &theType = "") override;
/// Adds the new reference to the end of the list by inner point on the
/// selected shape
- MODEL_EXPORT virtual void append(const std::shared_ptr<GeomAPI_Pnt> &thePoint,
- const std::string &theType);
+ MODEL_EXPORT void append(const std::shared_ptr<GeomAPI_Pnt> &thePoint,
+ const std::string &theType) override;
/// Adds the new reference to the end of the list by weak naming index
- MODEL_EXPORT virtual void append(const std::string &theType,
- const std::wstring &theContextName,
- const int theIndex);
+ MODEL_EXPORT void append(const std::string &theType,
+ const std::wstring &theContextName,
+ const int theIndex) override;
/// Copy the selection list to the destination attribute
- MODEL_EXPORT virtual void copyTo(AttributeSelectionListPtr theTarget) const;
+ MODEL_EXPORT void copyTo(AttributeSelectionListPtr theTarget) const override;
/// Reset temporary stored values
- virtual void removeTemporaryValues();
+ void removeTemporaryValues() override;
/// Removes the last element in the list
- MODEL_EXPORT virtual void removeLast();
+ MODEL_EXPORT void removeLast() override;
/// Removes the elements from the list.
/// \param theIndices a list of indices of elements to be removed
- MODEL_EXPORT virtual void remove(const std::set<int> &theIndices);
+ MODEL_EXPORT void remove(const std::set<int> &theIndices) override;
/// Returns the number of selection attributes in the list
- MODEL_EXPORT virtual int size();
+ MODEL_EXPORT int size() override;
/// Returns true if the object with the shape are in list
/// \param theContext object where the sub-shape was selected
/// \param theSubShape selected sub-shape (if null, the whole context is
/// selected) \param theTemporarily if it is true, it checks also the
/// temporary added item \returns true if the pair is found in the attribute
- MODEL_EXPORT virtual bool
- isInList(const ObjectPtr &theContext,
- const std::shared_ptr<GeomAPI_Shape> &theSubShape,
- const bool theTemporarily = false);
+ MODEL_EXPORT bool isInList(const ObjectPtr &theContext,
+ const std::shared_ptr<GeomAPI_Shape> &theSubShape,
+ const bool theTemporarily = false) override;
/// The type of all elements selection
/// \returns the index of the OCCT enumeration of the type of shape
- MODEL_EXPORT virtual const std::string selectionType() const;
+ MODEL_EXPORT const std::string selectionType() const override;
/// Sets the type of all elements selection
/// \param theType the index of the OCCT enumeration of the type of shape
- MODEL_EXPORT virtual void setSelectionType(const std::string &theType);
+ MODEL_EXPORT void setSelectionType(const std::string &theType) override;
/// Returns the attribute selection by the index (zero based)
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeSelection>
- value(const int theIndex);
+ MODEL_EXPORT std::shared_ptr<ModelAPI_AttributeSelection>
+ value(const int theIndex) override;
/// Returns all attributes
- MODEL_EXPORT virtual void clear();
+ MODEL_EXPORT void clear() override;
/// Returns true if attribute was initialized by some value
- MODEL_EXPORT virtual bool isInitialized();
+ MODEL_EXPORT bool isInitialized() override;
/// Starts or stops cashing of the values in the attribute (the cash may
/// become invalid on modification of the attribute or sub-elements, so the
/// cash must be enabled only during non-modification operations with this
/// attribute)
- MODEL_EXPORT virtual void cashValues(const bool theEnabled);
+ MODEL_EXPORT void cashValues(const bool theEnabled) override;
- MODEL_EXPORT virtual void
+ MODEL_EXPORT void
setGeometricalSelection(const bool theIsGeometricalSelection) override;
/// Returns true if is geometrical selection.
- MODEL_EXPORT virtual bool isGeometricalSelection() const override;
+ MODEL_EXPORT bool isGeometricalSelection() const override;
/// Returns a selection filters feature if it is defined for this selection
/// list
- MODEL_EXPORT virtual FiltersFeaturePtr filters() const;
+ MODEL_EXPORT FiltersFeaturePtr filters() const override;
/// Sets a selection filters feature if it is defined for this selection list
- MODEL_EXPORT virtual void setFilters(FiltersFeaturePtr theFeature);
+ MODEL_EXPORT void setFilters(FiltersFeaturePtr theFeature) override;
protected:
/// Objects are created for features automatically
MODEL_EXPORT Model_AttributeSelectionList(TDF_Label &theLabel);
/// Reinitializes the internal state of the attribute (may be needed on
/// undo/redo, abort, etc)
- virtual void reinit();
+ void reinit() override;
/// Tries to merge attributes in this list with the same result shape. Returns
/// true if theStart matches with some later attribute and theStart is removed
class Model_AttributeStringArray : public ModelAPI_AttributeStringArray {
public:
/// Returns the size of the array (zero means that it is empty)
- MODEL_EXPORT virtual int size();
+ MODEL_EXPORT int size() override;
/// Sets the new size of the array. The previous data is erased.
- MODEL_EXPORT virtual void setSize(const int theSize);
+ MODEL_EXPORT void setSize(const int theSize) override;
/// Defines the value of the array by index [0; size-1]
- MODEL_EXPORT virtual void setValue(const int theIndex,
- const std::string theValue);
+ MODEL_EXPORT void setValue(const int theIndex,
+ const std::string theValue) override;
/// Returns the value by the index
- MODEL_EXPORT virtual std::string value(const int theIndex);
+ MODEL_EXPORT std::string value(const int theIndex) override;
protected:
/// Objects are created for features automatically
aNewDouble = (myType == ModelAPI_AttributeTables::DOUBLE)
? new TColStd_HArray1OfReal(0, aNewSize - 1)
: Handle(TColStd_HArray1OfReal)();
- bool *anOldBool =
- 0; // an not work with internal arrays because of different indexing
+ bool *anOldBool = nullptr; // an not work with internal arrays because of
+ // different indexing
Handle(TDataStd_BooleanArray) aBoolArray; // an existing array
Handle(TColStd_HArray1OfInteger) anOldInt,
aNewInt = (myType == ModelAPI_AttributeTables::INTEGER)
class Model_AttributeTables : public ModelAPI_AttributeTables {
public:
/// Returns the number of rows in the table
- MODEL_EXPORT virtual int rows();
+ MODEL_EXPORT int rows() override;
/// Returns the number of columns in the table
- MODEL_EXPORT virtual int columns();
+ MODEL_EXPORT int columns() override;
/// Returns the number of tables
- MODEL_EXPORT virtual int tables();
+ MODEL_EXPORT int tables() override;
/// Sets the new size of the tables set. This method tries to keep old values
/// if number of rows, columns or tables is increased.
- MODEL_EXPORT virtual void setSize(const int theRows, const int theColumns,
- const int theTables = 1);
+ MODEL_EXPORT void setSize(const int theRows, const int theColumns,
+ const int theTables = 1) override;
/// Defines the tyoe of values in the table. If it differs from the current,
/// erases the content.
- MODEL_EXPORT virtual void setType(ValueType theType);
+ MODEL_EXPORT void setType(ValueType theType) override;
/// Defines the tyoe of values in the table. If it differs from the current,
/// erases the content.
- MODEL_EXPORT virtual const ValueType &type() const;
+ MODEL_EXPORT const ValueType &type() const override;
/// Defines the value by the index in the tables set (indexes are zero-based).
- MODEL_EXPORT virtual void setValue(const Value theValue, const int theRow,
- const int theColumn,
- const int theTable = 0);
+ MODEL_EXPORT void setValue(const Value theValue, const int theRow,
+ const int theColumn,
+ const int theTable = 0) override;
/// Returns the value by the index (indexes are zero-based).
- MODEL_EXPORT virtual Value value(const int theRow, const int theColumn,
- const int theTable = 0);
+ MODEL_EXPORT Value value(const int theRow, const int theColumn,
+ const int theTable = 0) override;
/// Returns the value in the format of string (usefull for the python
/// connection)
- MODEL_EXPORT virtual std::string
- valueStr(const int theRow, const int theColumn, const int theTable = 0);
+ MODEL_EXPORT std::string valueStr(const int theRow, const int theColumn,
+ const int theTable = 0) override;
protected:
/// Objects are created for features automatically
MODEL_EXPORT Model_AttributeTables(TDF_Label &theLabel);
/// Reinitializes the internal state of the attribute (may be needed on
/// undo/redo, abort, etc)
- virtual void reinit();
+ void reinit() override;
private:
/// The OCCT array that keeps all values. Indexes are computed as:
aFeat->getKind(), theAttribute->id())) {
std::list<std::pair<std::string, std::list<ObjectPtr>>> allRefs;
aFeat->data()->referencesToObjects(allRefs);
- std::list<std::pair<std::string, std::list<ObjectPtr>>>::iterator anIter =
- allRefs.begin();
+ auto anIter = allRefs.begin();
for (; anIter != allRefs.end(); anIter++) {
if (anIter->first == theAttribute->id()) {
const std::list<ObjectPtr> &aReferencedList = anIter->second;
- std::list<ObjectPtr>::const_iterator aRefIter =
- aReferencedList.cbegin();
+ auto aRefIter = aReferencedList.cbegin();
for (; aRefIter != aReferencedList.cend(); aRefIter++) {
const ObjectPtr &aReferenced = *aRefIter;
if (!aReferenced.get())
aReferencedResults.push_back(aRefBody);
}
- std::list<ResultPtr>::iterator aRefRes = aReferencedResults.begin();
+ auto aRefRes = aReferencedResults.begin();
bool aCheckFeature =
true; // the last iteration to check the feature
while (aRefRes != aReferencedResults.end() || aCheckFeature) {
continue;
const std::set<AttributePtr> &aRefsToRef =
aRefd->data()->refsToMe();
- std::set<AttributePtr>::const_iterator aRR = aRefsToRef.cbegin();
+ auto aRR = aRefsToRef.cbegin();
for (; aRR != aRefsToRef.cend(); aRR++) {
FeaturePtr aRefFeat =
std::dynamic_pointer_cast<ModelAPI_Feature>(
/// \param theArguments arguments of the attribute
/// \param theError erros message produced by validator to the user if it
/// fails \returns true if attribute is valid
- MODEL_EXPORT virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ MODEL_EXPORT bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
#endif // Model_AttributeValidator_H
const GeomShapePtr &theToShape,
const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape) {
bool aStored = false;
- std::list<GeomShapePtr>::const_iterator anOldIter = theFromShapes.cbegin();
+ auto anOldIter = theFromShapes.cbegin();
for (; anOldIter != theFromShapes.cend(); anOldIter++) {
bool aStore = (*anOldIter)->isCompound() || (*anOldIter)->isShell() ||
(*anOldIter)->isWire();
if (!aStore) {
ListOfShape aNews; // check this old really generates theToShape
theMakeShape->generated(*anOldIter, aNews);
- ListOfShape::iterator aNewIter = aNews.begin();
+ auto aNewIter = aNews.begin();
for (; aNewIter != aNews.end(); aNewIter++) {
if (theToShape->isSame(*aNewIter))
break;
}
TNaming_Builder *Model_BodyBuilder::builder(const int theTag) {
- std::map<int, TNaming_Builder *>::iterator aFind = myBuilders.find(theTag);
+ auto aFind = myBuilders.find(theTag);
if (aFind == myBuilders.end()) {
myBuilders[theTag] = new TNaming_Builder(builderLabel(data(), theTag));
aFind = myBuilders.find(theTag);
const GeomShapePtr &theNewShape,
const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape) {
bool aStored = false;
- std::list<GeomShapePtr>::const_iterator anOldIter = theOldShapes.cbegin();
+ auto anOldIter = theOldShapes.cbegin();
for (; anOldIter != theOldShapes.cend(); anOldIter++) {
// compounds may cause crash if call "modified"
bool aStore = (*anOldIter)->isCompound() || (*anOldIter)->isShell() ||
if (!aStore) {
ListOfShape aNews; // check this old really modifies theNewShape
theMakeShape->modified(*anOldIter, aNews);
- ListOfShape::iterator aNewIter = aNews.begin();
+ auto aNewIter = aNews.begin();
for (; aNewIter != aNews.end(); aNewIter++) {
if (theNewShape->isSame(*aNewIter))
break;
TDF_Label aLab = std::dynamic_pointer_cast<Model_Data>(data())->shapeLab();
if (aLab.IsNull())
return;
- std::map<int, TNaming_Builder *>::iterator aBuilder = myBuilders.begin();
+ auto aBuilder = myBuilders.begin();
for (; aBuilder != myBuilders.end(); aBuilder++) {
Handle(TNaming_NamedShape) aNS = aBuilder->second->NamedShape();
delete aBuilder->second;
for (GeomAPI_ShapeExplorer anExp(theOldShape, theShapeTypeToExplore);
anExp.more(); anExp.next()) {
GeomShapePtr anOldSubShape = anExp.current();
- const TopoDS_Shape &anOldSubShape_ = anOldSubShape->impl<TopoDS_Shape>();
+ const auto &anOldSubShape_ = anOldSubShape->impl<TopoDS_Shape>();
if (!anAlreadyProcessedShapes.Add(anOldSubShape_) ||
!theAlgo->isDeleted(anOldSubShape) ||
aResultShape->isSubShape(anOldSubShape, false) ||
keepTopLevelShapes(ListOfShape &theShapes, const TopoDS_Shape &theRoot,
const GeomShapePtr &theResultShape = GeomShapePtr()) {
GeomAPI_Shape::ShapeType aKeepShapeType = GeomAPI_Shape::SHAPE;
- ListOfShape::iterator anIt = theShapes.begin();
+ auto anIt = theShapes.begin();
while (anIt != theShapes.end()) {
TopoDS_Shape aNewShape = (*anIt)->impl<TopoDS_Shape>();
bool aSkip =
if (aSkip || theRoot.IsSame(aNewShape) ||
(theResultShape && (!theResultShape->isSubShape(*anIt, false) ||
theResultShape->isSame(*anIt)))) {
- ListOfShape::iterator aRemoveIt = anIt++;
+ auto aRemoveIt = anIt++;
theShapes.erase(aRemoveIt);
} else {
GeomAPI_Shape::ShapeType aType = (*anIt)->shapeType();
++anIt;
} else if (aType > aKeepShapeType) {
// shapes with greater shape type should be removed from the list
- ListOfShape::iterator aRemoveIt = anIt++;
+ auto aRemoveIt = anIt++;
theShapes.erase(aRemoveIt);
} else
++anIt;
theShapeTypeToExplore);
anOldShapeExp.more(); anOldShapeExp.next()) {
GeomShapePtr anOldSubShape = anOldShapeExp.current();
- const TopoDS_Shape &anOldSubShape_ = anOldSubShape->impl<TopoDS_Shape>();
+ const auto &anOldSubShape_ = anOldSubShape->impl<TopoDS_Shape>();
// There is no sense to write history if shape already processed
// or old shape does not exist in the document.
ListOfShape aNewShapes;
theAlgo->modified(anOldSubShape, aNewShapes);
- for (ListOfShape::const_iterator aNewShapesIt = aNewShapes.cbegin();
- aNewShapesIt != aNewShapes.cend(); ++aNewShapesIt) {
- GeomShapePtr aNewShape = *aNewShapesIt;
- const TopoDS_Shape &aNewShape_ = aNewShape->impl<TopoDS_Shape>();
+ for (auto aNewShape : aNewShapes) {
+ const auto &aNewShape_ = aNewShape->impl<TopoDS_Shape>();
bool isGenerated = anOldSubShape_.ShapeType() != aNewShape_.ShapeType();
bool aNewShapeIsSameAsOldShape = anOldSubShape->isSame(aNewShape);
for (GeomAPI_ShapeExplorer anOldShapeExp(theOldShape, theShapeTypeToExplore);
anOldShapeExp.more(); anOldShapeExp.next()) {
GeomShapePtr anOldSubShape = anOldShapeExp.current();
- const TopoDS_Shape &anOldSubShape_ = anOldSubShape->impl<TopoDS_Shape>();
+ const auto &anOldSubShape_ = anOldSubShape->impl<TopoDS_Shape>();
// There is no sense to write history if shape already processed
// or old shape does not exist in the document.
keepTopLevelShapes(aNewShapes, anOldSubShape_);
- for (ListOfShape::const_iterator aNewShapesIt = aNewShapes.cbegin();
- aNewShapesIt != aNewShapes.cend(); ++aNewShapesIt) {
- GeomShapePtr aNewShape = *aNewShapesIt;
- const TopoDS_Shape &aNewShape_ = aNewShape->impl<TopoDS_Shape>();
+ for (auto aNewShape : aNewShapes) {
+ const auto &aNewShape_ = aNewShape->impl<TopoDS_Shape>();
bool aNewShapeIsSameAsOldShape = anOldSubShape->isSame(aNewShape);
bool aNewShapeIsNotInResultShape =
public:
/// Stores the shape (called by the execution method).
- MODEL_EXPORT virtual void
- store(const GeomShapePtr &theShape,
- const bool theIsStoreSameShapes = true) override;
+ MODEL_EXPORT void store(const GeomShapePtr &theShape,
+ const bool theIsStoreSameShapes = true) override;
/// Stores the generated shape (called by the execution method).
- MODEL_EXPORT virtual void
- storeGenerated(const GeomShapePtr &theFromShape,
- const GeomShapePtr &theToShape,
- const bool theIsCleanStored = true) override;
+ MODEL_EXPORT void storeGenerated(const GeomShapePtr &theFromShape,
+ const GeomShapePtr &theToShape,
+ const bool theIsCleanStored = true) override;
/// Stores the root generated shapes (called by the execution method).
- MODEL_EXPORT virtual void storeGenerated(
+ MODEL_EXPORT void storeGenerated(
const std::list<GeomShapePtr> &theFromShapes,
const GeomShapePtr &theToShape,
const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape) override;
/// \param theNewShape resulting shape
/// \param theIsCleanStored erases all previous data structure of this body if
/// true
- MODEL_EXPORT virtual void
- storeModified(const GeomShapePtr &theOldShape,
- const GeomShapePtr &theNewShape,
- const bool theIsCleanStored = true) override;
+ MODEL_EXPORT void storeModified(const GeomShapePtr &theOldShape,
+ const GeomShapePtr &theNewShape,
+ const bool theIsCleanStored = true) override;
/// Stores the root modified shape (called by the execution method).
/// \param theOldShapes all shapes that produce result
/// \param theNewShape resulting shape
/// \param theIsCleanStored erases all previous data structure of this body if
/// true
- MODEL_EXPORT virtual void storeModified(
+ MODEL_EXPORT void storeModified(
const std::list<GeomShapePtr> &theOldShapes,
const GeomShapePtr &theNewShape,
const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape) override;
/// Returns the shape-result produced by this feature
- MODEL_EXPORT virtual GeomShapePtr shape();
+ MODEL_EXPORT GeomShapePtr shape() override;
/// Records the subshape newShape which was generated during a topological
/// construction. As an example, consider the case of a face generated in
/// construction of a box. Returns true if it is stored correctly (the final
/// shape contains this new sub-shape)
- MODEL_EXPORT virtual bool
- generated(const GeomShapePtr &theNewShape, const std::string &theName,
- const bool theCheckIsInResult = true) override;
+ MODEL_EXPORT bool generated(const GeomShapePtr &theNewShape,
+ const std::string &theName,
+ const bool theCheckIsInResult = true) override;
/// Records the shape newShape which was generated from the shape oldShape
/// during a topological construction. As an example, consider the case of a
/// face generated from an edge in construction of a prism.
- MODEL_EXPORT virtual void generated(const GeomShapePtr &theOldShape,
- const GeomShapePtr &theNewShape,
- const std::string &theName = "") override;
+ MODEL_EXPORT void generated(const GeomShapePtr &theOldShape,
+ const GeomShapePtr &theNewShape,
+ const std::string &theName = "") override;
/// Records the shape newShape which is a modification of the shape oldShape.
/// As an example, consider the case of a face split or merged in a Boolean
/// operation.
- MODEL_EXPORT virtual void modified(const GeomShapePtr &theOldShape,
- const GeomShapePtr &theNewShape,
- const std::string &theName = "") override;
+ MODEL_EXPORT void modified(const GeomShapePtr &theOldShape,
+ const GeomShapePtr &theNewShape,
+ const std::string &theName = "") override;
/// load deleted shapes
MODEL_EXPORT
- virtual void loadDeletedShapes(
+ void loadDeletedShapes(
const GeomMakeShapePtr &theAlgo, const GeomShapePtr &theOldShape,
const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
const GeomShapePtr &theShapesToExclude = GeomShapePtr()) override;
/// load and orient modified shapes
MODEL_EXPORT
- virtual void
- loadModifiedShapes(const GeomMakeShapePtr &theAlgo,
- const GeomShapePtr &theOldShape,
- const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
- const std::string &theName = "") override;
+ void loadModifiedShapes(const GeomMakeShapePtr &theAlgo,
+ const GeomShapePtr &theOldShape,
+ const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+ const std::string &theName = "") override;
/// load and orient generated shapes
MODEL_EXPORT
- virtual void
- loadGeneratedShapes(const GeomMakeShapePtr &theAlgo,
- const GeomShapePtr &theOldShape,
- const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
- const std::string &theName = "",
- const bool theSaveOldIfNotInTree = false) override;
+ void loadGeneratedShapes(const GeomMakeShapePtr &theAlgo,
+ const GeomShapePtr &theOldShape,
+ const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+ const std::string &theName = "",
+ const bool theSaveOldIfNotInTree = false) override;
/// Loads shapes of the first level (to be used during shape import)
- MODEL_EXPORT virtual void loadFirstLevel(GeomShapePtr theShape,
- const std::string &theName) override;
+ MODEL_EXPORT void loadFirstLevel(GeomShapePtr theShape,
+ const std::string &theName) override;
/// Removes the stored builders
- MODEL_EXPORT virtual ~Model_BodyBuilder();
+ MODEL_EXPORT ~Model_BodyBuilder() override;
/// Cleans cash related to the already stored elements
- MODEL_EXPORT virtual void cleanCash() override;
+ MODEL_EXPORT void cleanCash() override;
protected:
/// Default constructor accessible only by Model_Objects
// id of attribute to store the version of the feature
static const Standard_GUID kVERSION_ID("61cdb78a-1ba7-4942-976f-63bea7f4a2b1");
-Model_Data::Model_Data()
- : mySendAttributeUpdated(true), myWasChangedButBlocked(false) {}
+Model_Data::Model_Data() : myWasChangedButBlocked(false) {}
void Model_Data::setLabel(TDF_Label theLab) {
myLab = theLab;
AttributePtr aResult;
int anAttrIndex = theIndex == -1 ? int(myAttrs.size()) + 1 : theIndex;
TDF_Label anAttrLab = myLab.FindChild(anAttrIndex);
- ModelAPI_Attribute *anAttr = 0;
+ ModelAPI_Attribute *anAttr = nullptr;
if (theAttrType == ModelAPI_AttributeDocRef::typeId()) {
anAttr = new Model_AttributeDocRef(anAttrLab);
} else if (theAttrType == Model_AttributeInteger::typeId()) {
// create also GeomData attributes here because only here the OCAF structure
// is known
else if (theAttrType == GeomData_Point::typeId()) {
- GeomData_Point *anAttribute = new GeomData_Point();
+ auto *anAttribute = new GeomData_Point();
bool anAllInitialized = true;
for (int aComponent = 0; aComponent < GeomData_Point::NUM_COMPONENTS;
++aComponent) {
} else if (theAttrType == GeomData_Dir::typeId()) {
anAttr = new GeomData_Dir(anAttrLab);
} else if (theAttrType == GeomData_Point2D::typeId()) {
- GeomData_Point2D *anAttribute = new GeomData_Point2D();
+ auto *anAttribute = new GeomData_Point2D();
bool anAllInitialized = true;
for (int aComponent = 0; aComponent < GeomData_Point2D::NUM_COMPONENTS;
++aComponent) {
const std::string &
Model_Data::id(const std::shared_ptr<ModelAPI_Attribute> &theAttr) {
- AttributeMap::iterator anAttr = myAttrs.begin();
+ auto anAttr = myAttrs.begin();
for (; anAttr != myAttrs.end(); anAttr++) {
if (anAttr->second.first == theAttr)
return anAttr->first;
std::list<std::shared_ptr<ModelAPI_Attribute>>
Model_Data::attributes(const std::string &theType) {
std::list<std::shared_ptr<ModelAPI_Attribute>> aResult;
- AttributeMap::iterator anAttrsIter = myAttrs.begin();
+ auto anAttrsIter = myAttrs.begin();
for (; anAttrsIter != myAttrs.end(); anAttrsIter++) {
AttributePtr anAttr = anAttrsIter->second.first;
if (theType.empty() || anAttr->attributeType() == theType) {
std::list<std::string> Model_Data::attributesIDs(const std::string &theType) {
std::list<std::string> aResult;
- AttributeMap::iterator anAttrsIter = myAttrs.begin();
+ auto anAttrsIter = myAttrs.begin();
for (; anAttrsIter != myAttrs.end(); anAttrsIter++) {
AttributePtr anAttr = anAttrsIter->second.first;
if (theType.empty() || anAttr->attributeType() == theType) {
std::list<ModelAPI_Attribute *> aWasChangedButBlocked =
myWasChangedButBlocked;
myWasChangedButBlocked.clear();
- std::list<ModelAPI_Attribute *>::iterator aChangedIter =
- aWasChangedButBlocked.begin();
+ auto aChangedIter = aWasChangedButBlocked.begin();
for (; aChangedIter != aWasChangedButBlocked.end(); aChangedIter++) {
try {
myObject->attributeChanged((*aChangedIter)->id());
// remove in order to clear back references in other objects
std::list<std::pair<std::string, std::list<ObjectPtr>>> aRefs;
referencesToObjects(aRefs);
- std::list<std::pair<std::string, std::list<ObjectPtr>>>::iterator
- anAttrIter = aRefs.begin();
+ auto anAttrIter = aRefs.begin();
for (; anAttrIter != aRefs.end(); anAttrIter++) {
- std::list<ObjectPtr>::iterator aReferenced = anAttrIter->second.begin();
+ auto aReferenced = anAttrIter->second.begin();
for (; aReferenced != anAttrIter->second.end(); aReferenced++) {
if (aReferenced->get() && (*aReferenced)->data()->isValid()) {
std::shared_ptr<Model_Data> aData =
}
void Model_Data::updateConcealmentFlag() {
- std::set<AttributePtr>::iterator aRefsIter = myRefsToMe.begin();
+ auto aRefsIter = myRefsToMe.begin();
for (; aRefsIter != myRefsToMe.end(); aRefsIter++) {
if (aRefsIter->get()) {
FeaturePtr aFeature =
findVariables(const std::set<std::wstring> &theParameters,
const DocumentPtr &theDocument) {
std::list<ResultParameterPtr> aResult;
- std::set<std::wstring>::const_iterator aParamIt = theParameters.cbegin();
+ auto aParamIt = theParameters.cbegin();
for (; aParamIt != theParameters.cend(); ++aParamIt) {
const std::wstring &aName = *aParamIt;
double aValue;
ModelAPI_Session::get()->validators());
FeaturePtr aMyFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(myObject);
- AttributeMap::iterator anAttrIt = myAttrs.begin();
+ auto anAttrIt = myAttrs.begin();
std::list<ObjectPtr>
aReferenced; // not inside of cycle to avoid excess memory management
for (; anAttrIt != myAttrs.end(); anAttrIt++) {
if (aRefFeat
.get()) { // reference to all results of the referenced feature
const std::list<ResultPtr> &allRes = aRefFeat->results();
- std::list<ResultPtr>::const_iterator aRefRes = allRes.cbegin();
+ auto aRefRes = allRes.cbegin();
for (; aRefRes != allRes.cend(); aRefRes++) {
aReferenced.push_back(*aRefRes);
}
if (aRefFeat
.get()) { // reference to all results of the referenced feature
const std::list<ResultPtr> &allRes = aRefFeat->results();
- std::list<ResultPtr>::const_iterator aRefRes = allRes.cbegin();
+ auto aRefRes = allRes.cbegin();
for (; aRefRes != allRes.cend(); aRefRes++) {
aReferenced.push_back(*aRefRes);
}
bool Model_Data::isPrecedingAttribute(const std::string &theAttribute1,
const std::string &theAttribute2) const {
- AttributeMap::const_iterator aFound1 = myAttrs.find(theAttribute1);
- AttributeMap::const_iterator aFound2 = myAttrs.find(theAttribute2);
+ auto aFound1 = myAttrs.find(theAttribute1);
+ auto aFound2 = myAttrs.find(theAttribute2);
if (aFound2 == myAttrs.end())
return true;
else if (aFound1 == myAttrs.end())
/// transaction change)
std::set<AttributePtr> myRefsToMe;
/// flag that may block the "attribute updated" sending
- bool mySendAttributeUpdated;
+ bool mySendAttributeUpdated{true};
/// if some attribute was changed, but mySendAttributeUpdated was false, this
/// stores this
std::list<ModelAPI_Attribute *> myWasChangedButBlocked;
/// initialize correctly.
Model_Data();
/// Returns the name of the feature visible by the user in the object browser
- MODEL_EXPORT virtual std::wstring name();
+ MODEL_EXPORT std::wstring name() override;
/// Defines the name of the feature visible by the user in the object browser
- MODEL_EXPORT virtual void setName(const std::wstring &theName);
+ MODEL_EXPORT void setName(const std::wstring &theName) override;
/// Return \c true if the object has been renamed by the user
- MODEL_EXPORT virtual bool hasUserDefinedName() const;
+ MODEL_EXPORT bool hasUserDefinedName() const override;
/// Returns version of the feature (empty string if not applicable)
- MODEL_EXPORT virtual std::string version();
+ MODEL_EXPORT std::string version() override;
/// Initialize the version of the feature
- MODEL_EXPORT virtual void setVersion(const std::string &theVersion);
+ MODEL_EXPORT void setVersion(const std::string &theVersion) override;
/// Returns the attribute that references to another document
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeDocRef>
- document(const std::string &theID);
+ MODEL_EXPORT std::shared_ptr<ModelAPI_AttributeDocRef>
+ document(const std::string &theID) override;
/// Returns the attribute that contains real value with double precision
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeDouble>
- real(const std::string &theID);
+ MODEL_EXPORT std::shared_ptr<ModelAPI_AttributeDouble>
+ real(const std::string &theID) override;
/// Returns the attribute that contains double values array
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeDoubleArray>
- realArray(const std::string &theID);
+ MODEL_EXPORT std::shared_ptr<ModelAPI_AttributeDoubleArray>
+ realArray(const std::string &theID) override;
/// Returns the attribute that contains integer value
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeInteger>
- integer(const std::string &theID);
+ MODEL_EXPORT std::shared_ptr<ModelAPI_AttributeInteger>
+ integer(const std::string &theID) override;
/// Returns the attribute that contains reference to a feature
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeReference>
- reference(const std::string &theID);
+ MODEL_EXPORT std::shared_ptr<ModelAPI_AttributeReference>
+ reference(const std::string &theID) override;
/// Returns the attribute that contains selection to a shape
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeSelection>
- selection(const std::string &theID);
+ MODEL_EXPORT std::shared_ptr<ModelAPI_AttributeSelection>
+ selection(const std::string &theID) override;
/// Returns the attribute that contains selection to a shape
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeSelectionList>
- selectionList(const std::string &theID);
+ MODEL_EXPORT std::shared_ptr<ModelAPI_AttributeSelectionList>
+ selectionList(const std::string &theID) override;
/// Returns the attribute that contains reference to an attribute of a feature
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeRefAttr>
- refattr(const std::string &theID);
+ MODEL_EXPORT std::shared_ptr<ModelAPI_AttributeRefAttr>
+ refattr(const std::string &theID) override;
/// Returns the attribute that contains list of references to features
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeRefList>
- reflist(const std::string &theID);
+ MODEL_EXPORT std::shared_ptr<ModelAPI_AttributeRefList>
+ reflist(const std::string &theID) override;
/// Returns the attribute that contains list of references to features
/// or reference to an attribute of a feature
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeRefAttrList>
- refattrlist(const std::string &theID);
+ MODEL_EXPORT std::shared_ptr<ModelAPI_AttributeRefAttrList>
+ refattrlist(const std::string &theID) override;
/// Returns the attribute that contains boolean value
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeBoolean>
- boolean(const std::string &theID);
+ MODEL_EXPORT std::shared_ptr<ModelAPI_AttributeBoolean>
+ boolean(const std::string &theID) override;
/// Returns the attribute that contains real value with double precision
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeString>
- string(const std::string &theID);
+ MODEL_EXPORT std::shared_ptr<ModelAPI_AttributeString>
+ string(const std::string &theID) override;
/// Returns the attribute that contains integer values array
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeIntArray>
- intArray(const std::string &theID);
+ MODEL_EXPORT std::shared_ptr<ModelAPI_AttributeIntArray>
+ intArray(const std::string &theID) override;
/// Returns the attribute that contains string values array
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeStringArray>
- stringArray(const std::string &theID);
+ MODEL_EXPORT std::shared_ptr<ModelAPI_AttributeStringArray>
+ stringArray(const std::string &theID) override;
/// Returns the attribute that contains string values array
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeTables>
- tables(const std::string &theID);
+ MODEL_EXPORT std::shared_ptr<ModelAPI_AttributeTables>
+ tables(const std::string &theID) override;
/// Returns the attribute that contains image
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeImage>
- image(const std::string &theID);
+ MODEL_EXPORT std::shared_ptr<ModelAPI_AttributeImage>
+ image(const std::string &theID) override;
/// Returns the generic attribute by identifier
/// \param theID identifier of the attribute
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Attribute>
- attribute(const std::string &theID);
+ MODEL_EXPORT std::shared_ptr<ModelAPI_Attribute>
+ attribute(const std::string &theID) override;
/// Returns all attributes of the feature of the given type
/// or all attributes if "theType" is empty
- MODEL_EXPORT virtual std::list<std::shared_ptr<ModelAPI_Attribute>>
- attributes(const std::string &theType);
+ MODEL_EXPORT std::list<std::shared_ptr<ModelAPI_Attribute>>
+ attributes(const std::string &theType) override;
/// Returns all attributes ids of the feature of the given type
/// or all attributes if "theType" is empty
- MODEL_EXPORT virtual std::list<std::string>
- attributesIDs(const std::string &theType);
+ MODEL_EXPORT std::list<std::string>
+ attributesIDs(const std::string &theType) override;
/// Identifier by the id (not fast, iteration by map)
/// \param theAttr attribute already created in this data
- MODEL_EXPORT virtual const std::string &
- id(const std::shared_ptr<ModelAPI_Attribute> &theAttr);
+ MODEL_EXPORT const std::string &
+ id(const std::shared_ptr<ModelAPI_Attribute> &theAttr) override;
/// Returns true if data belongs to same features
- MODEL_EXPORT virtual bool
- isEqual(const std::shared_ptr<ModelAPI_Data> &theData);
+ MODEL_EXPORT bool
+ isEqual(const std::shared_ptr<ModelAPI_Data> &theData) override;
/// Returns true if it is correctly connected to the data model
- MODEL_EXPORT virtual bool isValid();
+ MODEL_EXPORT bool isValid() override;
/// Returns the label where the shape must be stored (used in ResultBody)
TDF_Label shapeLab() const {
/// index of the attribute in the internal data structure, for not-floating
/// attributes it is -1 to let it automatically be added
/// \returns the just created attribute
- MODEL_EXPORT virtual AttributePtr addAttribute(const std::string &theID,
- const std::string theAttrType,
- const int theIndex = -1);
+ MODEL_EXPORT AttributePtr addAttribute(const std::string &theID,
+ const std::string theAttrType,
+ const int theIndex = -1) override;
/// Adds a floating attribute (that may be added/removed during the data life)
/// \param theID identifier of the attribute that can be referenced by this ID
/// later \param theAttrType type of the created attribute (received from the
/// type method) \param theGroup identifier of the group this attribute
/// belongs to, may be an empty string
- MODEL_EXPORT virtual AttributePtr
+ MODEL_EXPORT AttributePtr
addFloatingAttribute(const std::string &theID, const std::string theAttrType,
- const std::string &theGroup);
+ const std::string &theGroup) override;
/// Returns all groups of this data (ordered).
- MODEL_EXPORT virtual void allGroups(std::list<std::string> &theGroups);
+ MODEL_EXPORT void allGroups(std::list<std::string> &theGroups) override;
/// Returns an ordered list of attributes that belong to the given group
- MODEL_EXPORT virtual void
- attributesOfGroup(const std::string &theGroup,
- std::list<std::shared_ptr<ModelAPI_Attribute>> &theAttrs);
+ MODEL_EXPORT void attributesOfGroup(
+ const std::string &theGroup,
+ std::list<std::shared_ptr<ModelAPI_Attribute>> &theAttrs) override;
/// Remove all attributes of the given group
- MODEL_EXPORT virtual void removeAttributes(const std::string &theGroup);
+ MODEL_EXPORT void removeAttributes(const std::string &theGroup) override;
/// Useful method for "set" methods of the attributes: sends an UPDATE event
/// and makes attribute initialized
- MODEL_EXPORT virtual void sendAttributeUpdated(ModelAPI_Attribute *theAttr);
+ MODEL_EXPORT void sendAttributeUpdated(ModelAPI_Attribute *theAttr) override;
/// Blocks sending "attribute updated" if theBlock is true
/// \param theBlock allows switching on/off the blocking state
/// \param theSendMessage if false, it does not send the update message
/// (normally is it used in attributeChanged because this message
/// will be sent anyway)
/// \returns the previous state of block
- MODEL_EXPORT virtual bool
+ MODEL_EXPORT bool
blockSendAttributeUpdated(const bool theBlock,
- const bool theSendMessage = true);
+ const bool theSendMessage = true) override;
/// Puts feature to the document data sub-structure
MODEL_EXPORT void setLabel(TDF_Label theLab);
}
/// Erases all the data from the data model
- MODEL_EXPORT virtual void erase();
+ MODEL_EXPORT void erase() override;
/// Stores the state of the object to execute it later accordingly
- MODEL_EXPORT virtual void execState(const ModelAPI_ExecState theState);
+ MODEL_EXPORT void execState(const ModelAPI_ExecState theState) override;
/// Returns the state of the latest execution of the feature
- MODEL_EXPORT virtual ModelAPI_ExecState execState();
+ MODEL_EXPORT ModelAPI_ExecState execState() override;
/// Registers error during the execution, causes the ExecutionFailed state
- MODEL_EXPORT virtual void setError(const std::string &theError,
- bool theSend = true);
+ MODEL_EXPORT void setError(const std::string &theError,
+ bool theSend = true) override;
/// Erases the error string if it is not empty
void eraseErrorString();
/// Registers error during the execution, causes the ExecutionFailed state
- MODEL_EXPORT virtual std::string error() const;
+ MODEL_EXPORT std::string error() const override;
/// Returns the identifier of feature-owner, unique in this document
- MODEL_EXPORT virtual int featureId() const;
+ MODEL_EXPORT int featureId() const override;
/// returns all objects referenced to this
- MODEL_EXPORT virtual const std::set<AttributePtr> &refsToMe() {
+ MODEL_EXPORT const std::set<AttributePtr> &refsToMe() override {
return myRefsToMe;
}
/// returns all references by attributes of this data
/// \param theRefs returned list of pairs:
/// id of referenced attribute and list of referenced objects
- MODEL_EXPORT virtual void referencesToObjects(
- std::list<std::pair<std::string, std::list<ObjectPtr>>> &theRefs);
+ MODEL_EXPORT void referencesToObjects(
+ std::list<std::pair<std::string, std::list<ObjectPtr>>> &theRefs)
+ override;
/// Copies all attributes content into theTarget data
- MODEL_EXPORT virtual void copyTo(std::shared_ptr<ModelAPI_Data> theTarget);
+ MODEL_EXPORT void copyTo(std::shared_ptr<ModelAPI_Data> theTarget) override;
/// Returns the invalid data pointer (to avoid working with NULL shared
/// pointers in swig)
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Data> invalidPtr();
+ MODEL_EXPORT std::shared_ptr<ModelAPI_Data> invalidPtr() override;
/// Returns the invalid data pointer: static method
static std::shared_ptr<ModelAPI_Data> invalidData();
/// Identifier of the transaction when object (feature or result) was updated
/// last time.
- MODEL_EXPORT virtual int updateID();
+ MODEL_EXPORT int updateID() override;
/// Identifier of the transaction when object (feature or result) was updated
/// last time. This method is called by the updater.
- MODEL_EXPORT virtual void setUpdateID(const int theID);
+ MODEL_EXPORT void setUpdateID(const int theID) override;
/// Returns true if the given object is owner of this data (needed for correct
/// erase of object with duplicated data)
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Object> owner();
+ MODEL_EXPORT std::shared_ptr<ModelAPI_Object> owner() override;
protected:
/// Returns true if "is in history" custom behaviors is defined for the
/// feature
- MODEL_EXPORT virtual bool isInHistory();
+ MODEL_EXPORT bool isInHistory() override;
/// Defines the custom "is in history" behavior
- MODEL_EXPORT virtual void setIsInHistory(const bool theFlag);
+ MODEL_EXPORT void setIsInHistory(const bool theFlag) override;
/// Returns true if the object is deleted, but some data is still kept in
/// memory
- MODEL_EXPORT virtual bool isDeleted();
+ MODEL_EXPORT bool isDeleted() override;
/// Sets true if the object is deleted, but some data is still kept in memory
- MODEL_EXPORT virtual void setIsDeleted(const bool theFlag);
+ MODEL_EXPORT void setIsDeleted(const bool theFlag) override;
/// Erases all attributes from myAttrs, but keeping them in the data structure
void clearAttributes();
/// Returns true if object must be displayed in the viewer: flag is stored in
/// the data model, so on undo/redo, open/save or recreation of object by
/// history-playing it keeps the original state in the current transaction.
- MODEL_EXPORT virtual bool isDisplayed();
+ MODEL_EXPORT bool isDisplayed() override;
/// Sets the displayed/hidden state of the object. If it is changed, sends the
/// "redisplay" signal.
- MODEL_EXPORT virtual void setDisplayed(const bool theDisplay);
+ MODEL_EXPORT void setDisplayed(const bool theDisplay) override;
/// Returns \c true if theAttribute1 is going earlier than theAttribute2 in
/// the data
- MODEL_EXPORT virtual bool
+ MODEL_EXPORT bool
isPrecedingAttribute(const std::string &theAttribute1,
- const std::string &theAttribute2) const;
+ const std::string &theAttribute2) const override;
};
/// Generic method to register back reference, used in referencing attributes.
static bool loadDocument(Handle(Model_Application) theApp,
Handle(TDocStd_Document) & theDoc,
const TCollection_ExtendedString &theFilename) {
- PCDM_ReaderStatus aStatus = (PCDM_ReaderStatus)-1;
+ auto aStatus = (PCDM_ReaderStatus)-1;
try {
aStatus = theApp->Open(theFilename, theDoc);
} catch (Standard_Failure const &anException) {
// make sub-parts as loaded by demand
std::list<ResultPtr> aPartResults;
myObjs->allResults(ModelAPI_ResultPart::group(), aPartResults);
- std::list<ResultPtr>::iterator aPartRes = aPartResults.begin();
+ auto aPartRes = aPartResults.begin();
for (; aPartRes != aPartResults.end(); aPartRes++) {
ResultPartPtr aPart =
std::dynamic_pointer_cast<ModelAPI_ResultPart>(*aPartRes);
// iterate all result parts to find all loaded or not yet loaded documents
std::list<ResultPtr> aPartResults;
myObjs->allResults(ModelAPI_ResultPart::group(), aPartResults);
- std::list<ResultPtr>::iterator aPartRes = aPartResults.begin();
+ auto aPartRes = aPartResults.begin();
for (; aPartRes != aPartResults.end(); aPartRes++) {
ResultPartPtr aPart =
std::dynamic_pointer_cast<ModelAPI_ResultPart>(*aPartRes);
TDF_Label aMain = aTempDoc->Main();
Handle(TDF_RelocationTable) aRelocTable = new TDF_RelocationTable();
- std::list<FeaturePtr>::const_iterator anIt = theExportFeatures.begin();
+ auto anIt = theExportFeatures.begin();
// Perform the copying twice for correct references:
// 1. copy labels hierarchy and fill the relocation table
for (; anIt != theExportFeatures.end(); ++anIt) {
}
// close all subs
const std::set<int> aSubs = subDocuments();
- std::set<int>::iterator aSubIter = aSubs.begin();
+ auto aSubIter = aSubs.begin();
for (; aSubIter != aSubs.end(); aSubIter++) {
std::shared_ptr<Model_Document> aSub = subDoc(*aSubIter);
if (aSub->myObjs) // if it was not closed before
if (theForever) {
// flush everything to avoid messages with bad objects
delete myObjs;
- myObjs = 0;
+ myObjs = nullptr;
if (myDoc->CanClose() == CDM_CCS_OK)
myDoc->Close();
mySelectionFeature.reset();
myRedos.clear();
// new command for all subs
const std::set<int> aSubs = subDocuments();
- std::set<int>::iterator aSubIter = aSubs.begin();
+ auto aSubIter = aSubs.begin();
for (; aSubIter != aSubs.end(); aSubIter++)
subDoc(*aSubIter)->startOperation();
}
// calls problems inside
bool aResult = false;
const std::set<int> aSubs = subDocuments();
- std::set<int>::iterator aSubIter = aSubs.begin();
+ auto aSubIter = aSubs.begin();
for (; aSubIter != aSubs.end(); aSubIter++)
if (subDoc(*aSubIter)->finishOperation())
aResult = true;
}
// abort for all subs, flushes will be later, in the end of root abort
const std::set<int> aSubs = subDocuments();
- std::set<int>::iterator aSubIter = aSubs.begin();
+ auto aSubIter = aSubs.begin();
for (; aSubIter != aSubs.end(); aSubIter++)
subDoc(*aSubIter)->abortOperation();
// references may be changed because they are set in attributes on the fly
return true;
// check other subs contains operation that can be undone
const std::set<int> aSubs = subDocuments();
- std::set<int>::iterator aSubIter = aSubs.begin();
+ auto aSubIter = aSubs.begin();
for (; aSubIter != aSubs.end(); aSubIter++) {
std::shared_ptr<Model_Document> aSub = subDoc(*aSubIter);
if (aSub->myObjs) { // if it was not closed before
if (theWithSubs) {
// undo for all subs
aSubs = subDocuments();
- std::set<int>::iterator aSubIter = aSubs.begin();
+ auto aSubIter = aSubs.begin();
for (; aSubIter != aSubs.end(); aSubIter++) {
if (!subDoc(*aSubIter)->myObjs)
continue;
if (theWithSubs) {
// undo for all subs
const std::set<int> aNewSubs = subDocuments();
- std::set<int>::iterator aNewSubIter = aNewSubs.begin();
+ auto aNewSubIter = aNewSubs.begin();
for (; aNewSubIter != aNewSubs.end(); aNewSubIter++) {
// synchronize only newly appeared documents
if (!subDoc(*aNewSubIter)->myObjs ||
return true;
// check other subs contains operation that can be redone
const std::set<int> aSubs = subDocuments();
- std::set<int>::iterator aSubIter = aSubs.begin();
+ auto aSubIter = aSubs.begin();
for (; aSubIter != aSubs.end(); aSubIter++) {
if (!subDoc(*aSubIter)->myObjs)
continue;
// redo for all subs
const std::set<int> aSubs = subDocuments();
- std::set<int>::iterator aSubIter = aSubs.begin();
+ auto aSubIter = aSubs.begin();
for (; aSubIter != aSubs.end(); aSubIter++)
subDoc(*aSubIter)->redo();
myDoc->ClearRedos();
// clear for all subs
const std::set<int> aSubs = subDocuments();
- for (std::set<int>::iterator aSubIter = aSubs.begin();
- aSubIter != aSubs.end(); aSubIter++)
- subDoc(*aSubIter)->clearUndoRedo();
+ for (int aSub : aSubs)
+ subDoc(aSub)->clearUndoRedo();
}
// this is used for creation of undo/redo1-list by GUI
std::list<std::string> aResult;
// the number of skipped current operations (on undo they will be aborted)
int aSkipCurrent = isOperation() ? 1 : 0;
- std::list<Transaction>::const_reverse_iterator aTrIter =
- myTransactions.crbegin();
+ auto aTrIter = myTransactions.crbegin();
int aNumUndo = int(myTransactions.size());
if (!myNestedNum.empty())
aNumUndo = *myNestedNum.rbegin();
std::list<std::string> Model_Document::redoList() const {
std::list<std::string> aResult;
- std::list<Transaction>::const_reverse_iterator aTrIter = myRedos.crbegin();
+ auto aTrIter = myRedos.crbegin();
for (; aTrIter != myRedos.crend(); aTrIter++) {
aResult.push_back(aTrIter->myId);
}
ModelAPI_Session::get()->moduleDocument());
std::list<ResultPtr> allParts;
aRoot->objects()->allResults(ModelAPI_ResultPart::group(), allParts);
- std::list<ResultPtr>::iterator aParts = allParts.begin();
+ auto aParts = allParts.begin();
for (; aParts != allParts.end(); aParts++) {
ResultPartPtr aPart =
std::dynamic_pointer_cast<ModelAPI_ResultPart>(*aParts);
std::set<int> aResult;
std::list<ResultPtr> aPartResults;
myObjs->allResults(ModelAPI_ResultPart::group(), aPartResults);
- std::list<ResultPtr>::iterator aPartRes = aPartResults.begin();
+ auto aPartRes = aPartResults.begin();
for (; aPartRes != aPartResults.end(); aPartRes++) {
ResultPartPtr aPart =
std::dynamic_pointer_cast<ModelAPI_ResultPart>(*aPartRes);
int Model_Document::size(const std::string &theGroupID,
const bool theAllowFolder) {
- if (myObjs == 0) // may be on close
+ if (myObjs == nullptr) // may be on close
return 0;
return myObjs->size(theGroupID, theAllowFolder);
}
std::shared_ptr<ModelAPI_Object>
Model_Document::parent(const std::shared_ptr<ModelAPI_Object> theChild) {
- if (myObjs == 0) // may be on close
+ if (myObjs == nullptr) // may be on close
return ObjectPtr();
return myObjs->parent(theChild);
}
std::shared_ptr<ModelAPI_Feature>
Model_Document::feature(const std::shared_ptr<ModelAPI_Result> &theResult) {
- if (myObjs == 0) // may be on close
+ if (myObjs == nullptr) // may be on close
return std::shared_ptr<ModelAPI_Feature>();
return myObjs->feature(theResult);
}
void Model_Document::addNamingName(const TDF_Label theLabel,
std::wstring theName) {
- std::map<std::wstring, std::list<TDF_Label>>::iterator aFind =
- myNamingNames.find(theName);
+ auto aFind = myNamingNames.find(theName);
if (aFind != myNamingNames.end()) { // to avoid duplicate-labels
// to keep correct order in spite of history line management
- std::list<TDF_Label>::iterator anAddAfterThis = aFind->second.end();
+ auto anAddAfterThis = aFind->second.end();
FeaturePtr anAddedFeature = featureByLab(theLabel);
- std::list<TDF_Label>::iterator aLabIter = aFind->second.begin();
+ auto aLabIter = aFind->second.begin();
while (aLabIter != aFind->second.end()) {
if (theLabel.IsEqual(*aLabIter)) {
- std::list<TDF_Label>::iterator aTmpIter = aLabIter;
+ auto aTmpIter = aLabIter;
aLabIter++;
aFind->second.erase(aTmpIter);
} else {
void Model_Document::changeNamingName(const std::wstring theOldName,
const std::wstring theNewName,
const TDF_Label &theLabel) {
- std::map<std::wstring, std::list<TDF_Label>>::iterator aFind =
- myNamingNames.find(theOldName);
+ auto aFind = myNamingNames.find(theOldName);
if (aFind != myNamingNames.end()) {
- std::list<TDF_Label>::iterator aLabIter = aFind->second.begin();
+ auto aLabIter = aFind->second.begin();
for (; aLabIter != aFind->second.end(); aLabIter++) {
if (theLabel.IsEqual(*aLabIter)) { // found the label
myNamingNames[theNewName].push_back(theLabel);
TDF_Label Model_Document::findNamingName(std::wstring theName,
ResultPtr theContext) {
- std::map<std::wstring, std::list<TDF_Label>>::iterator aFind =
- myNamingNames.find(theName);
+ auto aFind = myNamingNames.find(theName);
if (aFind != myNamingNames.end()) {
- std::list<TDF_Label>::reverse_iterator aLabIter = aFind->second.rbegin();
+ auto aLabIter = aFind->second.rbegin();
for (; aLabIter != aFind->second.rend(); aLabIter++) {
if (theContext.get()) {
// context is defined and not like this, so, skip
TCollection_ExtendedString aSubName(theName.substr(aSlash + 1).c_str());
// iterate all possible same-named labels starting from the last one (the
// recent)
- std::list<TDF_Label>::reverse_iterator aLabIter = aFind->second.rbegin();
+ auto aLabIter = aFind->second.rbegin();
for (; aLabIter != aFind->second.rend(); aLabIter++) {
if (theContext.get()) {
// context is defined and not like this, so, skip
std::list<std::pair<std::string, std::list<std::shared_ptr<ModelAPI_Object>>>>
aRefs;
theOther->data()->referencesToObjects(aRefs);
- std::list<std::pair<std::string,
- std::list<std::shared_ptr<ModelAPI_Object>>>>::iterator
- aRefIt = aRefs.begin();
+ auto aRefIt = aRefs.begin();
for (; aRefIt != aRefs.end(); aRefIt++) {
- std::list<ObjectPtr>::iterator aRefObjIt = aRefIt->second.begin();
+ auto aRefObjIt = aRefIt->second.begin();
for (; aRefObjIt != aRefIt->second.end(); aRefObjIt++) {
ObjectPtr aRefObj = *aRefObjIt;
if (aRefObj.get()) {
int Model_Document::numberOfNameInHistory(const ObjectPtr &theNameObject,
const TDF_Label &theStartFrom) {
- std::map<std::wstring, std::list<TDF_Label>>::iterator aFind =
- myNamingNames.find(theNameObject->data()->name());
+ auto aFind = myNamingNames.find(theNameObject->data()->name());
if (aFind == myNamingNames.end() || aFind->second.size() < 2) {
return 1; // no need to specify the name by additional identifiers
}
aNameFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theNameObject);
// iterate all labels with this name to find the nearest just before or equal
// relative
- std::list<TDF_Label>::reverse_iterator aLabIter = aFind->second.rbegin();
+ auto aLabIter = aFind->second.rbegin();
for (; aLabIter != aFind->second.rend(); aLabIter++) {
FeaturePtr aLabFeat = featureByLab(*aLabIter);
if (!aLabFeat.get())
aRes = myObjs->findByName(aName);
}
if (aNumInHistory) {
- std::map<std::wstring, std::list<TDF_Label>>::iterator aFind =
- myNamingNames.find(aName);
+ auto aFind = myNamingNames.find(aName);
if (aFind != myNamingNames.end() &&
(int)aFind->second.size() > aNumInHistory) {
- std::list<TDF_Label>::reverse_iterator aLibIt = aFind->second.rbegin();
+ auto aLibIt = aFind->second.rbegin();
for (; aNumInHistory != 0; aNumInHistory--)
aLibIt++;
const TDF_Label &aResultLab = *aLibIt;
if (aFeature.get() && aFeature->data()->isValid()) {
std::list<ResultPtr> aResults;
ModelAPI_Tools::allResults(aFeature, aResults);
- for (std::list<ResultPtr>::iterator aRes = aResults.begin();
- aRes != aResults.end(); aRes++) {
- ModelAPI_EventCreator::get()->sendUpdated(*aRes, aRedispEvent);
+ for (auto &aResult : aResults) {
+ ModelAPI_EventCreator::get()->sendUpdated(aResult, aRedispEvent);
}
}
}
Model_SelectionInPartFeature() : ModelAPI_Feature() {}
/// Returns the unique kind of a feature
- virtual const std::string &getKind() {
+ const std::string &getKind() override {
static std::string MY_KIND("InternalSelectionInPartFeature");
return MY_KIND;
}
/// Request for initialization of data model of the object: adding all
/// attributes
- virtual void initAttributes() {
+ void initAttributes() override {
data()->addAttribute("selection",
ModelAPI_AttributeSelectionList::typeId());
}
/// Nothing to do in the execution function
- virtual void execute() {}
+ void execute() override {}
};
//! Returns the feature that is used for calculation of selection externally
if (!theStates.empty()) {
Handle(TDataStd_BooleanArray) anArray =
TDataStd_BooleanArray::Set(aLab, 0, int(theStates.size()) - 1);
- std::list<bool>::const_iterator aState = theStates.begin();
+ auto aState = theStates.begin();
for (int anIndex = 0; aState != theStates.end(); aState++, anIndex++) {
anArray->SetValue(anIndex, *aState);
}
void Model_Document::setExecuteFeatures(const bool theFlag) {
myExecuteFeatures = theFlag;
const std::set<int> aSubs = subDocuments();
- std::set<int>::iterator aSubIter = aSubs.begin();
+ auto aSubIter = aSubs.begin();
for (; aSubIter != aSubs.end(); aSubIter++) {
if (!subDoc(*aSubIter)->myObjs)
continue;
}
// propagate the same action to sub-documents
const std::set<int> aSubs = subDocuments();
- for (std::set<int>::iterator aSubIter = aSubs.begin();
- aSubIter != aSubs.end(); aSubIter++) {
- subDoc(*aSubIter)->appendTransactionToPrevious();
+ for (int aSub : aSubs) {
+ subDoc(aSub)->appendTransactionToPrevious();
}
}
const bool isGroupped) const {
if (theObjects.empty())
return;
- std::list<ObjectPtr>::const_iterator anObj = theObjects.cbegin();
+ auto anObj = theObjects.cbegin();
std::shared_ptr<Model_ObjectUpdatedMessage> aMsg(
new Model_ObjectUpdatedMessage(*anObj, theEvent));
for (anObj++; anObj != theObjects.cend(); anObj++) {
/////////////////////// UPDATED MESSAGE /////////////////////////////
Model_ObjectUpdatedMessage::Model_ObjectUpdatedMessage(
const ObjectPtr &theObject, const Events_ID &theEvent)
- : ModelAPI_ObjectUpdatedMessage(theEvent, 0) {
+ : ModelAPI_ObjectUpdatedMessage(theEvent, nullptr) {
if (theObject) {
myObjects.insert(theObject);
}
const std::shared_ptr<Events_MessageGroup> &theJoined) {
std::shared_ptr<Model_ObjectUpdatedMessage> aJoined =
std::dynamic_pointer_cast<Model_ObjectUpdatedMessage>(theJoined);
- std::set<ObjectPtr>::iterator aFIter = aJoined->myObjects.begin();
+ auto aFIter = aJoined->myObjects.begin();
for (; aFIter != aJoined->myObjects.end(); aFIter++) {
myObjects.insert(*aFIter);
}
Model_ObjectDeletedMessage::Model_ObjectDeletedMessage(
const std::shared_ptr<ModelAPI_Document> &theDoc,
const std::string &theGroup)
- : ModelAPI_ObjectDeletedMessage(messageId(), 0) {
+ : ModelAPI_ObjectDeletedMessage(messageId(), nullptr) {
if (!theGroup.empty()) {
myGroups.push_back(
std::pair<std::shared_ptr<ModelAPI_Document>, std::string>(theDoc,
class Model_EventCreator : public ModelAPI_EventCreator {
public:
/// creates created, updated or moved messages and sends to the loop
- virtual void sendUpdated(const ObjectPtr &theObject,
- const Events_ID &theEvent,
- const bool isGroupped = true) const;
+ void sendUpdated(const ObjectPtr &theObject, const Events_ID &theEvent,
+ const bool isGroupped = true) const override;
/// creates created, updated or moved messages with the objects collection and
/// sends to the loop
- virtual void sendUpdated(const std::list<ObjectPtr> &theObjects,
- const Events_ID &theEvent,
- const bool isGroupped = true) const;
+ void sendUpdated(const std::list<ObjectPtr> &theObjects,
+ const Events_ID &theEvent,
+ const bool isGroupped = true) const override;
/// creates deleted message and sends to the loop
- virtual void sendDeleted(const std::shared_ptr<ModelAPI_Document> &theDoc,
- const std::string &theGroup) const;
+ void sendDeleted(const std::shared_ptr<ModelAPI_Document> &theDoc,
+ const std::string &theGroup) const override;
/// creates reordered message and sends to the loop
- virtual void
- sendReordered(const std::shared_ptr<ModelAPI_Feature> &theReordered) const;
+ void sendReordered(
+ const std::shared_ptr<ModelAPI_Feature> &theReordered) const override;
/// must be one per application, the constructor for internal usage only
Model_EventCreator();
public:
/// Returns the feature that has been updated
- virtual const std::set<ObjectPtr> &objects() const;
+ const std::set<ObjectPtr> &objects() const override;
//! Creates a new empty group (to store it in the loop before flush)
- virtual std::shared_ptr<Events_MessageGroup> newEmpty();
+ std::shared_ptr<Events_MessageGroup> newEmpty() override;
//! Allows to join the given message with the current one
- virtual void Join(const std::shared_ptr<Events_MessageGroup> &theJoined);
+ void Join(const std::shared_ptr<Events_MessageGroup> &theJoined) override;
};
/// Message that feature was deleted (used for Object Browser update)
public:
/// Returns the group where the objects were deleted
- virtual const std::list<
- std::pair<std::shared_ptr<ModelAPI_Document>, std::string>> &
- groups() const {
+ const std::list<std::pair<std::shared_ptr<ModelAPI_Document>, std::string>> &
+ groups() const override {
return myGroups;
}
/// Returns the new empty message of this type
- virtual std::shared_ptr<Events_MessageGroup> newEmpty();
+ std::shared_ptr<Events_MessageGroup> newEmpty() override;
/// Returns the identifier of this message
- virtual const Events_ID messageId();
+ const Events_ID messageId() override;
/// Appends to this message the given one
- virtual void Join(const std::shared_ptr<Events_MessageGroup> &theJoined);
+ void Join(const std::shared_ptr<Events_MessageGroup> &theJoined) override;
};
/// Message that feature was deleted (used for Object Browser update)
std::shared_ptr<ModelAPI_Feature> myReordered; ///< the feature that was moved
/// Use ModelAPI for creation of this event.
- Model_OrderUpdatedMessage(FeaturePtr theReordered, const void *theSender = 0);
+ Model_OrderUpdatedMessage(FeaturePtr theReordered,
+ const void *theSender = nullptr);
friend class Model_EventCreator;
public:
/// Returns the document that has been updated
- virtual std::shared_ptr<ModelAPI_Feature> reordered() { return myReordered; }
+ std::shared_ptr<ModelAPI_Feature> reordered() override { return myReordered; }
/// Returns the identifier of this message
- virtual const Events_ID messageId();
+ const Events_ID messageId() override;
};
#endif
void Model_Expression::setUsedParameters(
const std::set<std::wstring> &theUsedParameters) {
myUsedParameters->Clear();
- std::set<std::wstring>::const_iterator anIt = theUsedParameters.begin();
+ auto anIt = theUsedParameters.begin();
for (; anIt != theUsedParameters.end(); ++anIt)
myUsedParameters->Append(TCollection_ExtendedString(anIt->c_str()));
}
class Model_Expression : public virtual ModelAPI_Expression {
public:
/// Sets the text of this Expression
- MODEL_EXPORT virtual void setText(const std::wstring &theText);
+ MODEL_EXPORT void setText(const std::wstring &theText) override;
/// Returns the text of this Expression
- MODEL_EXPORT virtual std::wstring text() const;
+ MODEL_EXPORT std::wstring text() const override;
/// Allows to set expression (text) error (by the parameters listener)
- MODEL_EXPORT virtual void setError(const std::string &theError);
+ MODEL_EXPORT void setError(const std::string &theError) override;
/// Returns an expression error
- MODEL_EXPORT virtual std::string error();
+ MODEL_EXPORT std::string error() override;
/// Defines the used parameters (by the parameters listener)
- MODEL_EXPORT virtual void
- setUsedParameters(const std::set<std::wstring> &theUsedParameters);
+ MODEL_EXPORT void
+ setUsedParameters(const std::set<std::wstring> &theUsedParameters) override;
/// Returns the used parameters
- MODEL_EXPORT virtual std::set<std::wstring> usedParameters() const;
+ MODEL_EXPORT std::set<std::wstring> usedParameters() const override;
protected:
/// Initializes attributes
public ModelAPI_ExpressionDouble {
public:
/// Sets the text of this Expression
- MODEL_EXPORT virtual void setText(const std::wstring &theText) {
+ MODEL_EXPORT void setText(const std::wstring &theText) override {
Model_Expression::setText(theText);
};
/// Returns the text of this Expression
- MODEL_EXPORT virtual std::wstring text() const {
+ MODEL_EXPORT std::wstring text() const override {
return Model_Expression::text();
};
/// Allows to set expression (text) error (by the parameters listener)
- MODEL_EXPORT virtual void setError(const std::string &theError) {
+ MODEL_EXPORT void setError(const std::string &theError) override {
Model_Expression::setError(theError);
};
/// Returns an expression error
- MODEL_EXPORT virtual std::string error() {
+ MODEL_EXPORT std::string error() override {
return Model_Expression::error();
};
/// Defines the used parameters (by the parameters listener)
- MODEL_EXPORT virtual void
- setUsedParameters(const std::set<std::wstring> &theUsedParameters) {
+ MODEL_EXPORT void
+ setUsedParameters(const std::set<std::wstring> &theUsedParameters) override {
Model_Expression::setUsedParameters(theUsedParameters);
};
/// Returns the used parameters
- MODEL_EXPORT virtual std::set<std::wstring> usedParameters() const {
+ MODEL_EXPORT std::set<std::wstring> usedParameters() const override {
return Model_Expression::usedParameters();
};
/// Defines the double value
- MODEL_EXPORT virtual void setValue(const double theValue);
+ MODEL_EXPORT void setValue(const double theValue) override;
/// Returns the double value
- MODEL_EXPORT virtual double value();
+ MODEL_EXPORT double value() override;
/// Allows to set expression (text) as invalid (by the parameters listener)
- MODEL_EXPORT virtual void setInvalid(const bool theFlag);
+ MODEL_EXPORT void setInvalid(const bool theFlag) override;
/// Returns true if text is invalid
- MODEL_EXPORT virtual bool isInvalid();
+ MODEL_EXPORT bool isInvalid() override;
protected:
/// Initializes attributes
Model_ExpressionDouble(TDF_Label &theLabel);
/// Reinitializes the internal state of the attribute (may be needed on
/// undo/redo, abort, etc)
- virtual void reinit();
+ void reinit() override;
friend class Model_AttributeDouble;
friend class Model_Data;
public ModelAPI_ExpressionInteger {
public:
/// Sets the text of this Expression
- MODEL_EXPORT virtual void setText(const std::wstring &theText) {
+ MODEL_EXPORT void setText(const std::wstring &theText) override {
Model_Expression::setText(theText);
};
/// Returns the text of this Expression
- MODEL_EXPORT virtual std::wstring text() const {
+ MODEL_EXPORT std::wstring text() const override {
return Model_Expression::text();
};
/// Allows to set expression (text) error (by the parameters listener)
- MODEL_EXPORT virtual void setError(const std::string &theError) {
+ MODEL_EXPORT void setError(const std::string &theError) override {
Model_Expression::setError(theError);
};
/// Returns an expression error
- MODEL_EXPORT virtual std::string error() {
+ MODEL_EXPORT std::string error() override {
return Model_Expression::error();
};
/// Defines the used parameters (by the parameters listener)
- MODEL_EXPORT virtual void
- setUsedParameters(const std::set<std::wstring> &theUsedParameters) {
+ MODEL_EXPORT void
+ setUsedParameters(const std::set<std::wstring> &theUsedParameters) override {
Model_Expression::setUsedParameters(theUsedParameters);
};
/// Returns the used parameters
- MODEL_EXPORT virtual std::set<std::wstring> usedParameters() const {
+ MODEL_EXPORT std::set<std::wstring> usedParameters() const override {
return Model_Expression::usedParameters();
};
/// Defines the integer value
- MODEL_EXPORT virtual void setValue(const int theValue);
+ MODEL_EXPORT void setValue(const int theValue) override;
/// Returns the integer value
- MODEL_EXPORT virtual int value();
+ MODEL_EXPORT int value() override;
/// Allows to set expression (text) as invalid (by the parameters listener)
- MODEL_EXPORT virtual void setInvalid(const bool theFlag);
+ MODEL_EXPORT void setInvalid(const bool theFlag) override;
/// Returns true if text is invalid
- MODEL_EXPORT virtual bool isInvalid();
+ MODEL_EXPORT bool isInvalid() override;
protected:
/// Initializes attributes
Model_ExpressionInteger(TDF_Label &theLabel);
/// Reinitializes the internal state of the attribute (may be needed on
/// undo/redo, abort, etc)
- virtual void reinit();
+ void reinit() override;
friend class Model_AttributeInteger;
}
const std::string kAllTypes = "";
std::list<std::string> aLtAttributes = aData->attributesIDs(kAllTypes);
- std::list<std::string>::iterator it = aLtAttributes.begin();
+ auto it = aLtAttributes.begin();
for (; it != aLtAttributes.end(); it++) {
AttributePtr anAttr = aData->attribute(*it);
if (!aValidators->isCase(theFeature, anAttr->id()))
continue; // this attribute is not participated in the current case
if (!anAttr->isInitialized()) { // attribute is not initialized
- std::map<std::string, std::set<std::string>>::const_iterator
- aFeatureFind = myNotObligatory.find(theFeature->getKind());
+ auto aFeatureFind = myNotObligatory.find(theFeature->getKind());
if (aFeatureFind ==
myNotObligatory.end() || // and it is obligatory for filling
aFeatureFind->second.find(*it) == aFeatureFind->second.end()) {
/// \param theArguments the arguments in the configuration file for this
/// validator \param theError erros message produced by validator to the user
/// if it fails \returns true if feature is valid
- MODEL_EXPORT virtual bool
- isValid(const std::shared_ptr<ModelAPI_Feature> &theFeature,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ MODEL_EXPORT bool isValid(const std::shared_ptr<ModelAPI_Feature> &theFeature,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
/// sets not obligatory attributes, not checked for initialization
virtual void registerNotObligatory(std::string theFeature,
/// Returns true if the attribute in feature is not obligatory for the feature
/// execution
- virtual bool isNotObligatory(std::string theFeature,
- std::string theAttribute);
+ bool isNotObligatory(std::string theFeature,
+ std::string theAttribute) override;
};
#endif
std::list<std::string> aGroups;
theFiltersFeature->data()->allGroups(aGroups);
- for (std::list<std::string>::iterator aGIter = aGroups.begin();
- aGIter != aGroups.end(); aGIter++) {
- std::string aPureID = pureFilterID(*aGIter);
+ for (auto &aGroup : aGroups) {
+ std::string aPureID = pureFilterID(aGroup);
if (myFilters.find(aPureID) == myFilters.end())
continue;
std::list<std::shared_ptr<ModelAPI_Attribute>> anAttrs;
- theFiltersFeature->data()->attributesOfGroup(*aGIter, anAttrs);
- std::list<std::shared_ptr<ModelAPI_Attribute>>::iterator anAttrIter =
- anAttrs.begin();
+ theFiltersFeature->data()->attributesOfGroup(aGroup, anAttrs);
+ auto anAttrIter = anAttrs.begin();
for (; anAttrIter != anAttrs.end(); anAttrIter++) {
- std::string anArgID = (*anAttrIter)->id().substr((*aGIter).length() + 2);
+ std::string anArgID = (*anAttrIter)->id().substr(aGroup.length() + 2);
if (anArgID.empty()) { // reverse flag
std::shared_ptr<ModelAPI_AttributeBoolean> aReverse =
std::dynamic_pointer_cast<ModelAPI_AttributeBoolean>(*anAttrIter);
- FilterArgs aFArgs = {myFilters[aPureID], aReverse->value(), *aGIter};
+ FilterArgs aFArgs = {myFilters[aPureID], aReverse->value(), aGroup};
aFilters.push_back(aFArgs);
} else {
}
// iterate filters and check shape for validity for all of them
- std::list<FilterArgs>::iterator aFilter = aFilters.begin();
+ auto aFilter = aFilters.begin();
for (; aFilter != aFilters.end(); aFilter++) {
anArgs.setFilter(aFilter->myFilterID);
bool aResult = aFilter->myFilter->isOk(theShape, theResult, anArgs);
FilterPtr Model_FiltersFactory::filter(std::string theID) {
std::string aPureID = pureFilterID(theID);
- std::map<std::string, FilterPtr>::iterator aFound = myFilters.find(aPureID);
+ auto aFound = myFilters.find(aPureID);
return aFound == myFilters.end() ? FilterPtr() : aFound->second;
}
std::string Model_FiltersFactory::id(FilterPtr theFilter) {
- std::map<std::string, FilterPtr>::iterator anIter = myFilters.begin();
+ auto anIter = myFilters.begin();
for (; anIter != myFilters.end(); anIter++) {
if (anIter->second == theFilter)
return anIter->first;
/// Register an instance of a filter
/// \param theID unique identifier of the filter, not necessary equal to the
/// name of filter \param theFilter the filter's instance
- virtual void registerFilter(const std::string &theID,
- ModelAPI_Filter *theFilter);
+ void registerFilter(const std::string &theID,
+ ModelAPI_Filter *theFilter) override;
/// Returns true if all filters of the Filters feature are ok for the Shape
/// (taking into account the Reversed states). \param theResult parent result
/// of the shape to check \param theShape the checked shape
- virtual bool isValid(FeaturePtr theFiltersFeature, ResultPtr theResult,
- GeomShapePtr theShape);
+ bool isValid(FeaturePtr theFiltersFeature, ResultPtr theResult,
+ GeomShapePtr theShape) override;
/// Returns list of all shapes and subshapes in the study, satisfying
/// criteria of all filters of \a theFilterFeature.
/// \param theFiltersFeature feature that contains all information about the
/// filters \param theShapeType the type of sub-shapes to find
- virtual std::list<std::pair<ResultPtr, GeomShapePtr>>
+ std::list<std::pair<ResultPtr, GeomShapePtr>>
select(const FiltersFeaturePtr &theFilterFeature,
- const GeomAPI_Shape::ShapeType theShapeType);
+ const GeomAPI_Shape::ShapeType theShapeType) override;
/// Returns the filters that support the given shape type
- virtual std::list<FilterPtr> filters(GeomAPI_Shape::ShapeType theType);
+ std::list<FilterPtr> filters(GeomAPI_Shape::ShapeType theType) override;
/// Returns a filter by ID
- virtual FilterPtr filter(std::string theID);
+ FilterPtr filter(std::string theID) override;
/// Returns a filter ID by the filter pointer
- virtual std::string id(FilterPtr theFilter);
+ std::string id(FilterPtr theFilter) override;
protected:
/// Get instance from Session
- Model_FiltersFactory() {}
+ Model_FiltersFactory() = default;
private:
std::map<std::string, FilterPtr>
static FolderPtr inFolder(const FeaturePtr &theFeature,
const std::string &theFolderAttr) {
const std::set<AttributePtr> &aRefs = theFeature->data()->refsToMe();
- for (std::set<AttributePtr>::iterator anIt = aRefs.begin();
- anIt != aRefs.end(); ++anIt) {
- if ((*anIt)->id() != theFolderAttr)
+ for (const auto &aRef : aRefs) {
+ if (aRef->id() != theFolderAttr)
continue;
- ObjectPtr anOwner = (*anIt)->owner();
+ ObjectPtr anOwner = aRef->owner();
FolderPtr aFolder = std::dynamic_pointer_cast<ModelAPI_Folder>(anOwner);
if (aFolder.get())
return aFolder;
// the dependencies can be in the feature results
std::list<ResultPtr> aResults;
ModelAPI_Tools::allResults(theFeature, aResults);
- std::list<ResultPtr>::const_iterator aResIter = aResults.cbegin();
+ auto aResIter = aResults.cbegin();
for (; aResIter != aResults.cend(); aResIter++) {
ResultPtr aResult = (*aResIter);
std::shared_ptr<Model_Data> aData =
std::dynamic_pointer_cast<Model_Data>(aResult->data());
- if (aData.get() != NULL) {
+ if (aData.get() != nullptr) {
const std::set<AttributePtr> &aRefs = aData->refsToMe();
- std::set<AttributePtr>::const_iterator aRefIt = aRefs.begin(),
- aRefLast = aRefs.end();
+ auto aRefIt = aRefs.begin(), aRefLast = aRefs.end();
for (; aRefIt != aRefLast; aRefIt++) {
FeaturePtr aFeature =
std::dynamic_pointer_cast<ModelAPI_Feature>((*aRefIt)->owner());
- if (aFeature.get() != NULL)
+ if (aFeature.get() != nullptr)
theRefs.insert(aFeature);
}
}
std::dynamic_pointer_cast<Model_Data>(theFeature->data());
if (aData.get() && !aData->refsToMe().empty()) {
const std::set<AttributePtr> &aRefs = aData->refsToMe();
- std::set<AttributePtr>::const_iterator aRefIt = aRefs.begin(),
- aRefLast = aRefs.end();
+ auto aRefIt = aRefs.begin(), aRefLast = aRefs.end();
for (; aRefIt != aRefLast; aRefIt++) {
FeaturePtr aFeature =
std::dynamic_pointer_cast<ModelAPI_Feature>((*aRefIt)->owner());
- if (aFeature.get() != NULL)
+ if (aFeature.get() != nullptr)
theRefs.insert(aFeature);
}
}
// inform the owner
std::set<std::shared_ptr<ModelAPI_Feature>> aRefs;
refsToFeature(theFeature, aRefs, false);
- std::set<std::shared_ptr<ModelAPI_Feature>>::iterator aRefIter =
- aRefs.begin();
+ auto aRefIter = aRefs.begin();
for (; aRefIter != aRefs.end(); aRefIter++) {
std::shared_ptr<ModelAPI_CompositeFeature> aComposite =
std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(*aRefIter);
FeaturePtr aFeature = aFIter.Value();
std::list<ResultPtr> aResList;
ModelAPI_Tools::allResults(aFeature, aResList);
- std::list<ResultPtr>::iterator aRIter = aResList.begin();
+ auto aRIter = aResList.begin();
for (; aRIter != aResList.end(); aRIter++) {
ResultPtr aRes = *aRIter;
if (aRes && aRes->data()->isValid()) {
FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theObj);
std::string aResultGroup = featureResultGroup(aFeature);
if (!aResultGroup.empty()) {
- std::map<std::string, std::vector<ObjectPtr>>::iterator aHIter =
- myHistory.find(aResultGroup);
+ auto aHIter = myHistory.find(aResultGroup);
if (aHIter != myHistory.end())
myHistory.erase(aHIter); // erase from map => this means that it is
// not synchronized
}
void Model_Objects::createHistory(const std::string &theGroupID) {
- std::map<std::string, std::vector<ObjectPtr>>::iterator aHIter =
- myHistory.find(theGroupID);
+ auto aHIter = myHistory.find(theGroupID);
if (aHIter == myHistory.end()) {
std::vector<ObjectPtr> aResult;
std::vector<ObjectPtr> aResultOutOfFolder;
if (aFeature.get()) {
// if feature is in sub-component, remove it from history:
// it is in sub-tree of sub-component
- bool isSub = ModelAPI_Tools::compositeOwner(aFeature).get() != NULL;
+ bool isSub =
+ ModelAPI_Tools::compositeOwner(aFeature).get() != nullptr;
if (isFeature) { // here may be also disabled features
if (!isSub && aFeature->isInHistory()) {
aResult.push_back(aFeature);
// the feature is out of the folders
- if (aLastFeatureInFolder.get() == NULL)
+ if (aLastFeatureInFolder.get() == nullptr)
aResultOutOfFolder.push_back(aFeature);
}
} else if (!aFeature->isDisabled()) { // iterate all results of
// changed by "isConcealed"
const std::list<std::shared_ptr<ModelAPI_Result>> aResults =
aFeature->results();
- std::list<std::shared_ptr<ModelAPI_Result>>::const_iterator
- aRIter = aResults.begin();
+ auto aRIter = aResults.begin();
for (; aRIter != aResults.cend(); aRIter++) {
ResultPtr aRes = *aRIter;
if (aRes->groupName() != theGroupID)
}
void Model_Objects::updateHistory(const std::string theGroup) {
- std::map<std::string, std::vector<ObjectPtr>>::iterator aHIter =
- myHistory.find(theGroup);
+ auto aHIter = myHistory.find(theGroup);
if (aHIter != myHistory.end()) {
myHistory.erase(
aHIter); // erase from map => this means that it is not synchronized
return ObjectPtr();
} else { // iterate results of feature
const std::list<ResultPtr> &aResults = aFeature->results();
- std::list<std::shared_ptr<ModelAPI_Result>>::const_iterator aRIter =
- aResults.cbegin();
+ auto aRIter = aResults.cbegin();
for (; aRIter != aResults.cend(); aRIter++) {
std::shared_ptr<Model_Data> aResData =
std::dynamic_pointer_cast<Model_Data>((*aRIter)->data());
// history or not)
std::list<std::shared_ptr<ModelAPI_Feature>> allObjs = allFeatures();
// from the end to find the latest result with such name
- std::list<std::shared_ptr<ModelAPI_Feature>>::reverse_iterator anObjIter =
- allObjs.rbegin();
+ auto anObjIter = allObjs.rbegin();
for (; anObjIter != allObjs.rend(); anObjIter++) {
if ((*anObjIter)->data()->name() == theName)
return *anObjIter;
} else { // searching among results (concealed or not)
std::list<std::shared_ptr<ModelAPI_Feature>> allObjs = allFeatures();
// from the end to find the latest result with such name
- std::list<std::shared_ptr<ModelAPI_Feature>>::reverse_iterator anObjIter =
- allObjs.rbegin();
+ auto anObjIter = allObjs.rbegin();
for (; anObjIter != allObjs.rend(); anObjIter++) {
std::list<ResultPtr> allRes;
ModelAPI_Tools::allResults(*anObjIter, allRes);
- for (std::list<ResultPtr>::iterator aRes = allRes.begin();
- aRes != allRes.end(); aRes++) {
- if (aRes->get() && (*aRes)->groupName() == theGroupID) {
- if ((*aRes)->data()->name() == theName)
- return *aRes;
+ for (auto &allRe : allRes) {
+ if (allRe.get() && allRe->groupName() == theGroupID) {
+ if (allRe->data()->name() == theName)
+ return allRe;
}
}
}
return ObjectPtr();
}
-const int Model_Objects::index(std::shared_ptr<ModelAPI_Object> theObject,
- const bool theAllowFolder) {
+int Model_Objects::index(std::shared_ptr<ModelAPI_Object> theObject,
+ const bool theAllowFolder) {
std::string aGroup = theObject->groupName();
// treat folder as feature
if (aGroup == ModelAPI_Folder::group())
aGroup = groupNameFoldering(aGroup, theAllowFolder);
std::vector<ObjectPtr> &allObjs = myHistory[aGroup];
- std::vector<ObjectPtr>::iterator anObjIter =
- allObjs.begin(); // iterate to search object
+ auto anObjIter = allObjs.begin(); // iterate to search object
for (int anIndex = 0; anObjIter != allObjs.end(); anObjIter++, anIndex++) {
if ((*anObjIter) == theObject)
return anIndex;
if (aFeature.get()) {
const std::list<std::shared_ptr<ModelAPI_Result>> &aResults =
aFeature->results();
- std::list<std::shared_ptr<ModelAPI_Result>>::const_iterator aRIter =
- aResults.begin();
+ auto aRIter = aResults.begin();
for (; aRIter != aResults.cend(); aRIter++) {
ResultPtr aRes = *aRIter;
if (aRes->groupName() != theGroupID)
} else {
std::list<std::shared_ptr<ModelAPI_Attribute>> anAttrs =
anObject->data()->attributes("");
- std::list<std::shared_ptr<ModelAPI_Attribute>>::iterator anAttr =
- anAttrs.begin();
+ auto anAttr = anAttrs.begin();
for (; anAttr != anAttrs.end(); anAttr++)
(*anAttr)->reinit();
// if feature contains results, re-init them too
if (aFeature.get()) {
std::list<ResultPtr> aResults;
ModelAPI_Tools::allResults(aFeature, aResults);
- std::list<ResultPtr>::iterator aResIter = aResults.begin();
+ auto aResIter = aResults.begin();
for (; aResIter != aResults.end(); aResIter++) {
anAttrs = (*aResIter)->data()->attributes("");
for (anAttr = anAttrs.begin(); anAttr != anAttrs.end();
// if parameters are changed, update the results (issue 937)
const std::list<std::shared_ptr<ModelAPI_Result>> &aResults =
aFeature->results();
- std::list<std::shared_ptr<ModelAPI_Result>>::const_iterator aRIter =
- aResults.begin();
+ auto aRIter = aResults.begin();
for (; aRIter != aResults.cend(); aRIter++) {
std::shared_ptr<ModelAPI_Result> aRes = *aRIter;
if (aRes->data()->isValid() && !aRes->isDisabled()) {
std::shared_ptr<Model_Data> aData =
std::dynamic_pointer_cast<Model_Data>(theObject->data());
// iterate new list to compare with current
- std::set<AttributePtr>::iterator aNewIter = theNewRefs.begin();
+ auto aNewIter = theNewRefs.begin();
for (; aNewIter != theNewRefs.end(); aNewIter++) {
// for the Model_AttributeRefList erase cash (issue #2819)
std::shared_ptr<Model_AttributeRefList> aRefList =
}
if (theNewRefs.size() !=
aData->refsToMe().size()) { // some back ref must be removed
- std::set<AttributePtr>::iterator aCurrentIter = aData->refsToMe().begin();
+ auto aCurrentIter = aData->refsToMe().begin();
while (aCurrentIter != aData->refsToMe().end()) {
if (theNewRefs.find(*aCurrentIter) == theNewRefs.end()) {
// for external references from other documents this system
std::list<std::shared_ptr<ModelAPI_Object>>>>
aRefs;
(*aCurrentIter)->owner()->data()->referencesToObjects(aRefs);
- std::list<std::pair<std::string,
- std::list<std::shared_ptr<ModelAPI_Object>>>>::
- iterator aRefIter = aRefs.begin();
+ auto aRefIter = aRefs.begin();
for (; aRefIter != aRefs.end(); aRefIter++) {
if ((*aCurrentIter)->id() == aRefIter->first) {
std::list<std::shared_ptr<ModelAPI_Object>>::iterator anOIt;
// for the last feature in the folder, check if it is a sub-feature,
// then refer the folder to a top-level parent composite feature
const std::set<AttributePtr> &aRefs = aData->refsToMe();
- std::set<AttributePtr>::iterator anIt = aRefs.begin();
+ auto anIt = aRefs.begin();
for (; anIt != aRefs.end(); ++anIt)
if ((*anIt)->id() == ModelAPI_Folder::LAST_FEATURE_ID())
break;
if (theData.get()) {
std::list<std::pair<std::string, std::list<ObjectPtr>>> aRefs;
theData->referencesToObjects(aRefs);
- std::list<std::pair<std::string, std::list<ObjectPtr>>>::iterator aRefsIt =
- aRefs.begin();
+ auto aRefsIt = aRefs.begin();
for (; aRefsIt != aRefs.end(); aRefsIt++) {
- std::list<ObjectPtr>::iterator aRefTo = aRefsIt->second.begin();
+ auto aRefTo = aRefsIt->second.begin();
for (; aRefTo != aRefsIt->second.end(); aRefTo++) {
if (*aRefTo) {
- std::map<ObjectPtr, std::set<AttributePtr>>::iterator aFound =
- theRefs.find(*aRefTo);
+ auto aFound = theRefs.find(*aRefTo);
if (aFound == theRefs.end()) {
theRefs[*aRefTo] = std::set<AttributePtr>();
aFound = theRefs.find(*aRefTo);
for (aFeatures.Initialize(myFeatures); aFeatures.More(); aFeatures.Next()) {
FeaturePtr aFeature = aFeatures.Value();
static std::set<AttributePtr> anEmpty;
- std::map<ObjectPtr, std::set<AttributePtr>>::iterator aFound =
- allRefs.find(aFeature);
+ auto aFound = allRefs.find(aFeature);
if (aFound == allRefs.end()) { // not found => erase all back references
synchronizeBackRefsForObject(anEmpty, aFeature);
} else {
// also for results
std::list<ResultPtr> aResults;
ModelAPI_Tools::allResults(aFeature, aResults);
- std::list<ResultPtr>::iterator aRIter = aResults.begin();
+ auto aRIter = aResults.begin();
for (; aRIter != aResults.cend(); aRIter++) {
aFound = allRefs.find(*aRIter);
if (aFound == allRefs.end()) { // not found => erase all back references
std::list<ResultPtr> aResults;
ModelAPI_Tools::allResults(aFeature, aResults);
// update the concealment status for display in isConcealed of ResultBody
- std::list<ResultPtr>::iterator aRIter = aResults.begin();
+ auto aRIter = aResults.begin();
for (; aRIter != aResults.cend(); aRIter++) {
(*aRIter)->isConcealed();
}
}
// the rest all refs means that feature references to the external document
// feature: process also them
- std::map<ObjectPtr, std::set<AttributePtr>>::iterator anExtIter =
- allRefs.begin();
+ auto anExtIter = allRefs.begin();
for (; anExtIter != allRefs.end(); anExtIter++) {
synchronizeBackRefsForObject(anExtIter->second, anExtIter->first);
}
// CompSolid's result)
int aBodyResultIndex = 0;
const std::list<ResultPtr> &aResults = anOwner->results();
- std::list<ResultPtr>::const_iterator anIt = aResults.begin();
+ auto anIt = aResults.begin();
for (; anIt != aResults.end(); ++anIt, ++aBodyResultIndex)
if (aBodyRes == *anIt)
break;
// Verify the feature is sub-element in composite feature or it is not used in
// the history
static bool isSkippedFeature(FeaturePtr theFeature) {
- bool isSub = ModelAPI_Tools::compositeOwner(theFeature).get() != NULL;
+ bool isSub = ModelAPI_Tools::compositeOwner(theFeature).get() != nullptr;
return isSub || (theFeature && !theFeature->isInHistory());
}
return;
// check the existing results and remove them if there is nothing on the label
- std::list<ResultPtr>::const_iterator aResIter =
- theFeature->results().cbegin();
+ auto aResIter = theFeature->results().cbegin();
while (aResIter != theFeature->results().cend()) {
ResultPtr aBody = std::dynamic_pointer_cast<ModelAPI_Result>(*aResIter);
if (aBody.get()) {
}
}
if (aResSize > 0) { // check there exist a body that must be updated
- std::list<ResultPtr>::const_iterator aRes = theFeature->results().cbegin();
+ auto aRes = theFeature->results().cbegin();
for (; aResSize && aRes != theFeature->results().cend();
aRes++, aResSize++) {
if ((*aRes)->data()->isValid()) {
continue;
std::list<ResultPtr> allResults;
ModelAPI_Tools::allResults(aFeature, allResults);
- std::list<ResultPtr>::iterator aRIter = allResults.begin();
+ auto aRIter = allResults.begin();
for (; aRIter != allResults.cend(); aRIter++) {
ResultPtr aRes = *aRIter;
if (aRes.get() && aRes->data() && aRes->data()->isValid() &&
//! returns -1. \param theObject object of this document \param theAllowFolder
//! take into account grouping feature by folders \returns index started from
//! zero, or -1 if object is invisible or belongs to another document
- const int index(std::shared_ptr<ModelAPI_Object> theObject,
- const bool theAllowFolder = false);
+ int index(std::shared_ptr<ModelAPI_Object> theObject,
+ const bool theAllowFolder = false);
//! Returns the feature in the group by the index (started from zero)
//! \param theGroupID group that contains a feature
const bool theCheckIsInResult) {
bool aResult = false;
if (mySubs.size()) { // consists of subs
- for (std::vector<ResultBodyPtr>::const_iterator aSubIter = mySubs.cbegin();
- aSubIter != mySubs.cend(); ++aSubIter) {
- const ResultBodyPtr &aSub = *aSubIter;
+ for (const auto &aSub : mySubs) {
if (aSub->generated(theNewShape, theName, theCheckIsInResult))
aResult = true;
}
const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
const std::string &theName, const bool theSaveOldIfNotInTree) {
if (mySubs.size()) { // consists of subs
- for (std::vector<ResultBodyPtr>::const_iterator aSubIter = mySubs.cbegin();
- aSubIter != mySubs.cend(); ++aSubIter) {
- const ResultBodyPtr &aSub = *aSubIter;
+ for (const auto &aSub : mySubs) {
aSub->loadGeneratedShapes(theAlgo, theOldShape, theShapeTypeToExplore,
theName, theSaveOldIfNotInTree);
}
// optimization of getting of new shapes for specific sub-result
if (!theAlgo->isNewShapesCollected(theOldShape, theShapeTypeToExplore))
theAlgo->collectNewShapes(theOldShape, theShapeTypeToExplore);
- std::vector<ResultBodyPtr>::const_iterator aSubIter = mySubs.cbegin();
+ auto aSubIter = mySubs.cbegin();
for (; aSubIter != mySubs.cend(); aSubIter++) {
(*aSubIter)->loadModifiedShapes(theAlgo, theOldShape,
theShapeTypeToExplore, theName);
void Model_ResultBody::loadFirstLevel(GeomShapePtr theShape,
const std::string &theName) {
if (mySubs.size()) { // consists of subs
- for (std::vector<ResultBodyPtr>::const_iterator aSubIter = mySubs.cbegin();
- aSubIter != mySubs.cend(); ++aSubIter) {
- const ResultBodyPtr &aSub = *aSubIter;
+ for (const auto &aSub : mySubs) {
aSub->loadFirstLevel(theShape, theName);
}
} else { // do for this directly
}
bool Model_ResultBody::isSub(ObjectPtr theResult, int &theIndex) const {
- std::map<ObjectPtr, int>::const_iterator aFound = mySubsMap.find(theResult);
+ auto aFound = mySubsMap.find(theResult);
if (aFound != mySubsMap.end()) {
theIndex = aFound->second;
return true;
bool aNewFlag = !myLastConcealed;
if (checkAllSubs(anOwner, aNewFlag,
anUpdated)) { // state of everyone must be updated
- std::list<ResultBodyPtr>::iterator aRes = anUpdated.begin();
+ auto aRes = anUpdated.begin();
for (; aRes != anUpdated.end(); aRes++) {
bool aLastConcealed = (*aRes)->isConcealed();
if (aNewFlag != aLastConcealed) {
Model_ResultBody::findShapeName(std::shared_ptr<GeomAPI_Shape> theShape) {
TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
- for (std::map<std::wstring, std::shared_ptr<GeomAPI_Shape>>::iterator it =
- myNamesShape.begin();
- it != myNamesShape.end(); ++it) {
- TopoDS_Shape curSelectedShape = (*it).second->impl<TopoDS_Shape>();
+ for (auto &it : myNamesShape) {
+ TopoDS_Shape curSelectedShape = it.second->impl<TopoDS_Shape>();
if ((aShape.IsSame(curSelectedShape))) {
- return (*it).first;
+ return it.first;
}
}
return L"material not found";
const std::vector<int> &
Model_ResultBody::findShapeColor(const std::wstring &theShapeName) {
- std::map<std::wstring, std::vector<int>>::iterator aColor =
- myColorsShape.find(theShapeName);
+ auto aColor = myColorsShape.find(theShapeName);
if (aColor != myColorsShape.end())
return aColor->second;
static std::vector<int> anEmptyVector;
aSubIndex) { // it is needed to create a new sub-result
std::wstring thenameshape = L"";
// find shape name read
- for (std::map<std::wstring, std::shared_ptr<GeomAPI_Shape>>::iterator
- it = myNamesShape.begin();
- it != myNamesShape.end(); ++it) {
- TopoDS_Shape curSelectedShape = (*it).second->impl<TopoDS_Shape>();
+ for (auto &it : myNamesShape) {
+ TopoDS_Shape curSelectedShape = it.second->impl<TopoDS_Shape>();
if (!(aShapesIter.Value().IsSame(curSelectedShape)))
continue;
- thenameshape = (*it).first;
+ thenameshape = it.first;
break;
}
aSub = anObjects->createBody(this->data(), aSubIndex, thenameshape);
// finf color read
- std::map<std::wstring, std::vector<int>>::iterator itColor =
- myColorsShape.find(thenameshape);
+ auto itColor = myColorsShape.find(thenameshape);
if (itColor != myColorsShape.end()) {
ModelAPI_Tools::setColor(aSub, (*itColor).second);
}
void Model_ResultBody::cleanCash() {
myBuilder->cleanCash();
- for (std::vector<ResultBodyPtr>::const_iterator aSubIter = mySubs.cbegin();
- aSubIter != mySubs.cend(); ++aSubIter) {
- const ResultBodyPtr &aSub = *aSubIter;
+ for (const auto &aSub : mySubs) {
aSub->cleanCash();
}
}
for (GeomAPI_ShapeIterator anIter(theSub); anIter.more(); anIter.next())
collectSubs(anIter.current(), theSubSubs, theOneLevelMore);
} else if (theOneLevelMore) {
- GeomAPI_Shape::ShapeType aSubType =
- GeomAPI_Shape::ShapeType(int(theSub->shapeType()) + 1);
+ auto aSubType = GeomAPI_Shape::ShapeType(int(theSub->shapeType()) + 1);
if (aSubType == GeomAPI_Shape::SHAPE)
return;
if (aSubType == GeomAPI_Shape::SHELL)
TopTools_MapOfShape aSubSubs;
collectSubs(theSub, aSubSubs, false);
- std::list<GeomShapePtr>::const_iterator aRootOlds = theAllOlds.cbegin();
+ auto aRootOlds = theAllOlds.cbegin();
for (; aRootOlds != theAllOlds.cend(); aRootOlds++) {
// use sub-shapes of olds too if they are compounds or compsolids
TopTools_MapOfShape anOldSubs;
aNews.clear();
// store result in the history
TopTools_ListOfShape aList;
- for (ListOfShape::iterator aNewIter = aNews.begin();
- aNewIter != aNews.end(); aNewIter++) {
- aList.Append((*aNewIter)->impl<TopoDS_Shape>());
+ for (auto &aNew : aNews) {
+ aList.Append(aNew->impl<TopoDS_Shape>());
}
myHistoryCash.Bind(anOldShape, aList);
}
- for (ListOfShape::iterator aNewIter = aNews.begin();
- aNewIter != aNews.end(); aNewIter++) {
- if (aSubSubs.Contains((*aNewIter)->impl<TopoDS_Shape>())) {
+ for (auto &aNew : aNews) {
+ if (aSubSubs.Contains(aNew->impl<TopoDS_Shape>())) {
// check list already contains this sub
- std::list<GeomShapePtr>::iterator aResIter = theOldForSub.begin();
+ auto aResIter = theOldForSub.begin();
for (; aResIter != theOldForSub.end(); aResIter++)
if ((*aResIter)->isSame(anOldSub))
break;
public:
/// Removes the stored builders
- MODEL_EXPORT virtual ~Model_ResultBody();
+ MODEL_EXPORT ~Model_ResultBody() override;
/// Request for initialization of data model of the result body: adding all
/// attributes
- virtual void initAttributes();
+ void initAttributes() override;
/// Records the subshape newShape which was generated during a topological
/// construction. As an example, consider the case of a face generated in
/// construction of a box.
- MODEL_EXPORT virtual bool
- generated(const GeomShapePtr &theNewShape, const std::string &theName,
- const bool theCheckIsInResult = true) override;
+ MODEL_EXPORT bool generated(const GeomShapePtr &theNewShape,
+ const std::string &theName,
+ const bool theCheckIsInResult = true) override;
/// load generated shapes
MODEL_EXPORT
- virtual void
+ void
loadGeneratedShapes(const std::shared_ptr<GeomAlgoAPI_MakeShape> &theAlgo,
const GeomShapePtr &theOldShape,
const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
/// load modified shapes for sub-objects
MODEL_EXPORT
- virtual void
- loadModifiedShapes(const std::shared_ptr<GeomAlgoAPI_MakeShape> &theAlgo,
- const GeomShapePtr &theOldShape,
- const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
- const std::string &theName = "") override;
+ void loadModifiedShapes(const std::shared_ptr<GeomAlgoAPI_MakeShape> &theAlgo,
+ const GeomShapePtr &theOldShape,
+ const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+ const std::string &theName = "") override;
/// load shapes of the first level (to be used during shape import)
- MODEL_EXPORT virtual void loadFirstLevel(GeomShapePtr theShape,
- const std::string &theName);
+ MODEL_EXPORT void loadFirstLevel(GeomShapePtr theShape,
+ const std::string &theName) override;
/// Returns the number of sub-elements
- MODEL_EXPORT virtual int numberOfSubs(bool forTree = false) const;
+ MODEL_EXPORT int numberOfSubs(bool forTree = false) const override;
/// Returns the sub-result by zero-base index
- MODEL_EXPORT virtual ResultBodyPtr subResult(const int theIndex,
- bool forTree = false) const;
+ MODEL_EXPORT ResultBodyPtr subResult(const int theIndex,
+ bool forTree = false) const override;
/// Returns true if feature or result belong to this composite feature as subs
/// Returns theIndex - zero based index of sub if found
- MODEL_EXPORT virtual bool isSub(ObjectPtr theObject, int &theIndex) const;
+ MODEL_EXPORT bool isSub(ObjectPtr theObject, int &theIndex) const override;
/// Returns the parameters of color definition in the resources configuration
/// manager
- MODEL_EXPORT virtual void colorConfigInfo(std::string &theSection,
- std::string &theName,
- std::string &theDefault);
+ MODEL_EXPORT void colorConfigInfo(std::string &theSection,
+ std::string &theName,
+ std::string &theDefault) override;
/// Disables the result body: keeps the resulting shape as selection, but
/// erases the underlaying naming data structure if theFlag if false. Or
/// restores every thing on theFlag is true.
- MODEL_EXPORT virtual bool
- setDisabled(std::shared_ptr<ModelAPI_Result> theThis, const bool theFlag);
+ MODEL_EXPORT bool setDisabled(std::shared_ptr<ModelAPI_Result> theThis,
+ const bool theFlag) override;
/// The compsolid is concealed if at least one of the sub is concealed
- MODEL_EXPORT virtual bool isConcealed();
+ MODEL_EXPORT bool isConcealed() override;
/// Sets all subs as concealed in the data tree (referenced by other objects)
- MODEL_EXPORT virtual void setIsConcealed(const bool theValue,
- const bool theForced = false);
+ MODEL_EXPORT void setIsConcealed(const bool theValue,
+ const bool theForced = false) override;
/// Returns true is the topology is connected.
- MODEL_EXPORT virtual bool isConnectedTopology();
+ MODEL_EXPORT bool isConnectedTopology() override;
/// Cleans cash related to the already stored elements
- MODEL_EXPORT virtual void cleanCash() override;
+ MODEL_EXPORT void cleanCash() override;
/// sets the texture file
- MODEL_EXPORT virtual bool hasTexture() override;
+ MODEL_EXPORT bool hasTexture() override;
/// Find the imported color by the construction name of a shape.
/// Returns empty vector if not found.
- MODEL_EXPORT virtual const std::vector<int> &
- findShapeColor(const std::wstring &theShapeName);
+ MODEL_EXPORT const std::vector<int> &
+ findShapeColor(const std::wstring &theShapeName) override;
protected:
/// Makes a body on the given feature
/// Updates the sub-bodies if shape of this object is composite-solid
void updateSubs(const std::shared_ptr<GeomAPI_Shape> &theThisShape,
- const bool theShapeChanged = true);
+ const bool theShapeChanged = true) override;
/// Updates the sub-bodies in accordance to the algorithm history information
void updateSubs(const GeomShapePtr &theThisShape,
const std::list<GeomShapePtr> &theOlds,
const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
- const bool isGenerated);
+ const bool isGenerated) override;
/// Checks the state of children and parents to send events of creation/erase
/// when needed
return false;
}
-Model_ResultConstruction::Model_ResultConstruction() {}
+Model_ResultConstruction::Model_ResultConstruction() = default;
bool Model_ResultConstruction::isInHistory() {
std::shared_ptr<Model_Data> aData =
}
std::shared_ptr<Model_Document> aMyDoc =
std::dynamic_pointer_cast<Model_Document>(document());
- const TopoDS_Shape &aShape = theShape->impl<TopoDS_Shape>();
+ const auto &aShape = theShape->impl<TopoDS_Shape>();
if (isInfinite() || aShape.ShapeType() == TopAbs_VERTEX) {
aShapeLab.ForgetAllAttributes(); // clear all previously stored
TNaming_Builder aBuilder(aShapeLab);
}
std::shared_ptr<Model_Document> aMyDoc =
std::dynamic_pointer_cast<Model_Document>(document());
- const TopoDS_Shape &aShape = aResShape->impl<TopoDS_Shape>();
+ const auto &aShape = aResShape->impl<TopoDS_Shape>();
if (aShape.ShapeType() != TopAbs_VERTEX &&
aShape.ShapeType() != TopAbs_EDGE) {
ResultPtr aThisPtr =
NCollection_List<TopoDS_Face>
anUnorderedFaces; // unordered faces are empty in this case
int aTagId = 0;
- for (std::list<GeomFacePtr>::const_iterator aFIt = theFaces.begin();
- aFIt != theFaces.end(); ++aFIt) {
- aFaces.push_back(*aFIt);
- aFacesOrder.Bind(++aTagId, (*aFIt)->impl<TopoDS_Face>());
+ for (const auto &theFace : theFaces) {
+ aFaces.push_back(theFace);
+ aFacesOrder.Bind(++aTagId, theFace->impl<TopoDS_Face>());
}
MapFaceToEdgeIndices aNewIndices; // edges indices
std::wstringstream aName;
aName << "Face";
TopExp_Explorer aPutEdges(aFaceToPut, TopAbs_EDGE);
- TNaming_Builder *anEdgesBuilder = 0, *aVerticesBuilder = 0;
+ TNaming_Builder *anEdgesBuilder = nullptr, *aVerticesBuilder = nullptr;
for (TColStd_ListOfInteger::Iterator anIter(aNewInd); anIter.More();
anIter.Next()) {
int anIndex = anIter.Value();
FeaturePtr aSub = theComposite->subFeature(a);
const std::list<std::shared_ptr<ModelAPI_Result>> &aResults =
aSub->results();
- std::list<std::shared_ptr<ModelAPI_Result>>::const_iterator aRes =
- aResults.cbegin();
+ auto aRes = aResults.cbegin();
for (; aRes != aResults.cend(); aRes++) {
ResultConstructionPtr aConstr =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aRes);
const ListOfShape &theFaces,
const NCollection_DataMap<Handle(Geom_Curve), int> &theCurvesIndices,
MapFaceToEdgeIndices &theFaceEdges) {
- std::list<std::shared_ptr<GeomAPI_Shape>>::const_iterator aFIter =
- theFaces.begin();
+ auto aFIter = theFaces.begin();
for (; aFIter != theFaces.end(); aFIter++) {
std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(*aFIter));
// put them to a label, trying to keep the same faces on the same labels
myShape; ///< shape of this result created "on the fly"
public:
/// Retuns the parameters of color definition in the resources config manager
- MODEL_EXPORT virtual void colorConfigInfo(std::string &theSection,
- std::string &theName,
- std::string &theDefault);
+ MODEL_EXPORT void colorConfigInfo(std::string &theSection,
+ std::string &theName,
+ std::string &theDefault) override;
/// By default object is displayed in the object browser.
- MODEL_EXPORT virtual bool isInHistory();
+ MODEL_EXPORT bool isInHistory() override;
/// Sets the result
- MODEL_EXPORT virtual void setShape(std::shared_ptr<GeomAPI_Shape> theShape);
+ MODEL_EXPORT void setShape(std::shared_ptr<GeomAPI_Shape> theShape) override;
/// Returns the shape-result produced by this feature
- MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Shape> shape();
+ MODEL_EXPORT std::shared_ptr<GeomAPI_Shape> shape() override;
/// Sets the flag that it must be displayed in history (default is true)
- MODEL_EXPORT virtual void setIsInHistory(const bool myIsInHistory);
+ MODEL_EXPORT void setIsInHistory(const bool myIsInHistory) override;
/// if the construction result may be used as faces, this method returns not
/// zero number of faces \param theUpdateNaming is false of keeping the naming
/// structure untouched (on load)
- MODEL_EXPORT virtual int facesNum(const bool theUpdateNaming = true);
+ MODEL_EXPORT int facesNum(const bool theUpdateNaming = true) override;
/// if the construction result may be used as faces, this method returns face
/// by zero based index
- MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Face> face(const int theIndex);
+ MODEL_EXPORT std::shared_ptr<GeomAPI_Face> face(const int theIndex) override;
/// Change the order of faces
MODEL_EXPORT
- virtual void
- setFacesOrder(const std::list<std::shared_ptr<GeomAPI_Face>> &theFaces);
+ void setFacesOrder(
+ const std::list<std::shared_ptr<GeomAPI_Face>> &theFaces) override;
/// By default object is not infinite.
- MODEL_EXPORT virtual bool isInfinite();
+ MODEL_EXPORT bool isInfinite() override;
/// Sets the flag that it is infinite
- MODEL_EXPORT virtual void setInfinite(const bool theInfinite);
+ MODEL_EXPORT void setInfinite(const bool theInfinite) override;
/// The construction element may be concealed only by "delete" feature
- MODEL_EXPORT virtual void setIsConcealed(const bool theValue,
- const bool theForced = false);
+ MODEL_EXPORT void setIsConcealed(const bool theValue,
+ const bool theForced = false) override;
/// Updates the shape taking the current value from the data structure,
/// returns true if update has been correctly done
- MODEL_EXPORT virtual bool updateShape();
+ MODEL_EXPORT bool updateShape() override;
protected:
/// Makes a body on the given feature
if (theId < (int)mySteps.size()) {
return mySteps[theId];
}
- return NULL;
+ return nullptr;
}
std::wstring Model_ResultField::Model_FieldStep::name() {
// "valid" for GUI checks
};
- virtual ModelAPI_ResultField *field() const { return myParent; }
+ ModelAPI_ResultField *field() const override { return myParent; }
- virtual int id() const { return myId; }
+ int id() const override { return myId; }
- virtual std::shared_ptr<ModelAPI_Document> document() const {
+ std::shared_ptr<ModelAPI_Document> document() const override {
return myParent->document();
}
/// Returns a GUI name of this step
- virtual std::wstring name();
+ std::wstring name() override;
private:
ModelAPI_ResultField *myParent;
/// Returns the parameters of color definition in the resources configuration
/// manager
- MODEL_EXPORT virtual void colorConfigInfo(std::string &theSection,
- std::string &theName,
- std::string &theDefault);
+ MODEL_EXPORT void colorConfigInfo(std::string &theSection,
+ std::string &theName,
+ std::string &theDefault) override;
/// Returns the compound of selected entities
- MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Shape> shape();
+ MODEL_EXPORT std::shared_ptr<GeomAPI_Shape> shape() override;
/// Returns number of steps
- MODEL_EXPORT virtual int stepsSize() const;
+ MODEL_EXPORT int stepsSize() const override;
/// Returns a text line by its number
/// \param theLine a number of line
- MODEL_EXPORT virtual std::string textLine(int theLine) const;
+ MODEL_EXPORT std::string textLine(int theLine) const override;
/// Returns step object
/// \param theId an id of the object
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_ResultField::ModelAPI_FieldStep>
- step(int theId) const;
+ MODEL_EXPORT std::shared_ptr<ModelAPI_ResultField::ModelAPI_FieldStep>
+ step(int theId) const override;
/// Removes the stored builders
- MODEL_EXPORT virtual ~Model_ResultField();
+ MODEL_EXPORT ~Model_ResultField() override;
/// To refresh the steps of a field
- MODEL_EXPORT virtual void updateSteps();
+ MODEL_EXPORT void updateSteps() override;
protected:
/// Makes a body on the given feature data
std::shared_ptr<ModelAPI_Data> myOwnerData; ///< data of owner of this result
public:
/// Retuns the parameters of color definition in the resources config manager
- MODEL_EXPORT virtual void colorConfigInfo(std::string &theSection,
- std::string &theName,
- std::string &theDefault);
+ MODEL_EXPORT void colorConfigInfo(std::string &theSection,
+ std::string &theName,
+ std::string &theDefault) override;
/// Returns the compound of selected entities
- MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Shape> shape();
+ MODEL_EXPORT std::shared_ptr<GeomAPI_Shape> shape() override;
/// \brief Stores the result of operation made on groups.
/// Cleans the storage if empty shape is given.
/// param[in] theShape shape to store.
- MODEL_EXPORT virtual void store(const GeomShapePtr &theShape);
+ MODEL_EXPORT void store(const GeomShapePtr &theShape) override;
/// Removes the stored builders
- MODEL_EXPORT virtual ~Model_ResultGroup() {}
+ MODEL_EXPORT ~Model_ResultGroup() override = default;
protected:
/// Makes a body on the given feature data
return aRes;
}
-Model_ResultPart::Model_ResultPart() {}
+Model_ResultPart::Model_ResultPart() = default;
void Model_ResultPart::activate() {
if (myTrsf.get()) {
std::shared_ptr<ModelAPI_AttributeDocRef> aDocRef =
data()->document(DOC_REF());
- return aDocRef->value().get() != NULL;
+ return aDocRef->value().get() != nullptr;
}
bool Model_ResultPart::setDisabled(std::shared_ptr<ModelAPI_Result> theThis,
}
/// Request for initialization of data model of the result: adding all
/// attributes
- virtual void initAttributes();
+ void initAttributes() override;
/// Returns the part-document of this result
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Document> partDoc();
+ MODEL_EXPORT std::shared_ptr<ModelAPI_Document> partDoc() override;
/// Returns the original part result: for transformation features results this
/// is the original Part feature result
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_ResultPart> original();
+ MODEL_EXPORT std::shared_ptr<ModelAPI_ResultPart> original() override;
/// Sets this document as current and if it is not loaded yet, loads it
- MODEL_EXPORT virtual void activate();
+ MODEL_EXPORT void activate() override;
/// disable all feature of the part on disable of the part result
- MODEL_EXPORT virtual bool
- setDisabled(std::shared_ptr<ModelAPI_Result> theThis, const bool theFlag);
+ MODEL_EXPORT bool setDisabled(std::shared_ptr<ModelAPI_Result> theThis,
+ const bool theFlag) override;
/// Result shape of part document is compound of bodies inside of this part
- MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Shape> shape();
+ MODEL_EXPORT std::shared_ptr<GeomAPI_Shape> shape() override;
/// Returns the name of the shape inside of the part
/// \param theShape selected shape in this document
/// \param theIndex is returned as one-based index if selection was required,
/// "0" otherwise \returns empty name is selection is not correct
- MODEL_EXPORT virtual std::wstring
- nameInPart(const std::shared_ptr<GeomAPI_Shape> &theShape, int &theIndex);
+ MODEL_EXPORT std::wstring
+ nameInPart(const std::shared_ptr<GeomAPI_Shape> &theShape,
+ int &theIndex) override;
/// Updates the selection inside of the part by the selection index
- MODEL_EXPORT virtual bool updateInPart(const int theIndex);
+ MODEL_EXPORT bool updateInPart(const int theIndex) override;
/// Returns the shape by the name in the part
- MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Shape>
+ MODEL_EXPORT std::shared_ptr<GeomAPI_Shape>
shapeInPart(const std::wstring &theName, const std::string &theType,
- int &theIndex);
+ int &theIndex) override;
/// Updates the selection inside of the part as a geometrical selection
- MODEL_EXPORT virtual bool combineGeometrical(const int theIndex,
- std::wstring &theNewName);
+ MODEL_EXPORT bool combineGeometrical(const int theIndex,
+ std::wstring &theNewName) override;
/// Updates the shape-result of the part (called on Part feature execution)
- MODEL_EXPORT virtual void updateShape();
+ MODEL_EXPORT void updateShape() override;
/// Applies the additional transformation of the part
- MODEL_EXPORT virtual void
+ MODEL_EXPORT void
setTrsf(std::shared_ptr<ModelAPI_Result> theThis,
- const std::shared_ptr<GeomAPI_Trsf> &theTransformation);
+ const std::shared_ptr<GeomAPI_Trsf> &theTransformation) override;
/// Returns the summary transformations of all references to the origin
- MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Trsf> summaryTrsf();
+ MODEL_EXPORT std::shared_ptr<GeomAPI_Trsf> summaryTrsf() override;
/// Returns the parameters of color definition in the resources config manager
- MODEL_EXPORT virtual void colorConfigInfo(std::string &theSection,
- std::string &theName,
- std::string &theDefault);
+ MODEL_EXPORT void colorConfigInfo(std::string &theSection,
+ std::string &theName,
+ std::string &theDefault) override;
/// Returns the shape selected in the selection index
- MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Shape>
- selectionValue(const int theIndex);
+ MODEL_EXPORT std::shared_ptr<GeomAPI_Shape>
+ selectionValue(const int theIndex) override;
/// Loading the part from file
- MODEL_EXPORT virtual void loadPart();
+ MODEL_EXPORT void loadPart() override;
protected:
/// makes a result on a temporary feature (an action)
gp_Trsf sumTrsf();
/// Returns true if document is activated (loaded into the memory)
- virtual bool isActivated();
+ bool isActivated() override;
friend class Model_Objects;
};
Model_Application::getApplication()->deleteAllDocuments();
static const Events_ID aDocsCloseEvent =
Events_Loop::eventByName(EVENT_DOCUMENTS_CLOSED);
- myCurrentDoc = NULL;
+ myCurrentDoc = nullptr;
static std::shared_ptr<Events_Message> aMsg(
new Events_Message(aDocsCloseEvent));
Events_Loop::loop()->send(aMsg);
Events_InfoMessage("Model_Session", "Can not load plugin '%1'")
.arg(thePluginName)
.send();
- return NULL;
+ return nullptr;
}
return myPluginObjs[thePluginName];
}
std::list<std::shared_ptr<ModelAPI_Document>> aResult;
aResult.push_back(moduleDocument());
// add subs recursively
- std::list<std::shared_ptr<ModelAPI_Document>>::iterator aDocIt =
- aResult.begin();
+ auto aDocIt = aResult.begin();
for (; aDocIt != aResult.end(); aDocIt++) {
DocumentPtr anAPIDoc = *aDocIt;
std::shared_ptr<Model_Document> aDoc =
std::dynamic_pointer_cast<Model_Document>(anAPIDoc);
if (aDoc) {
const std::set<int> aSubs = aDoc->subDocuments();
- std::set<int>::const_iterator aSubIter = aSubs.cbegin();
+ auto aSubIter = aSubs.cbegin();
for (; aSubIter != aSubs.cend(); aSubIter++) {
aResult.push_back(
Model_Application::getApplication()->document(*aSubIter));
// Add in reverse order.
TDF_Label aLabel = aNamedShape->Label();
TNaming_Builder aBuilder(aLabel);
- for (std::list<std::pair<TopoDS_Shape, TopoDS_Shape>>::iterator aPairsIter =
- aShapePairs.begin();
- aPairsIter != aShapePairs.end(); aPairsIter++) {
+ for (auto &aShapePair : aShapePairs) {
if (anEvol == TNaming_GENERATED) {
- aBuilder.Generated(aPairsIter->first, aPairsIter->second);
+ aBuilder.Generated(aShapePair.first, aShapePair.second);
} else if (anEvol == TNaming_MODIFY) {
- aBuilder.Modify(aPairsIter->first, aPairsIter->second);
+ aBuilder.Modify(aShapePair.first, aShapePair.second);
} else if (anEvol == TNaming_DELETE) {
- aBuilder.Delete(aPairsIter->first);
+ aBuilder.Delete(aShapePair.first);
} else if (anEvol == TNaming_PRIMITIVE) {
- aBuilder.Generated(aPairsIter->second);
+ aBuilder.Generated(aShapePair.second);
} else if (anEvol == TNaming_SELECTED) {
- aBuilder.Select(aPairsIter->second, aPairsIter->first);
+ aBuilder.Select(aShapePair.second, aShapePair.first);
}
}
}
Events_Loop::eventByName(Config_FeatureMessage::MODEL_EVENT());
aLoop->registerListener(this, kFeatureEvent);
aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_CREATED),
- 0, true);
+ nullptr, true);
aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_UPDATED),
- 0, true);
+ nullptr, true);
aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_DELETED),
- 0, true);
+ nullptr, true);
aLoop->registerListener(this,
Events_Loop::eventByName(EVENT_VALIDATOR_LOADED));
aLoop->registerListener(
theMessage);
std::list<std::shared_ptr<ModelAPI_Document>> allOpened =
Model_Session::allOpenedDocuments();
- std::list<std::pair<std::shared_ptr<ModelAPI_Document>, std::string>>::
- const_iterator aGIter = aDeleted->groups().cbegin();
+ auto aGIter = aDeleted->groups().cbegin();
for (; !aIsActual && aGIter != aDeleted->groups().cend(); aGIter++) {
- std::list<std::shared_ptr<ModelAPI_Document>>::iterator anOpened =
- allOpened.begin();
+ auto anOpened = allOpened.begin();
for (; anOpened != allOpened.end(); anOpened++) {
if (aGIter->first == *anOpened) {
aIsActual = true;
std::shared_ptr<ModelAPI_ObjectDeletedMessage> aDeleted =
std::dynamic_pointer_cast<ModelAPI_ObjectDeletedMessage>(theMessage);
- std::list<std::pair<std::shared_ptr<ModelAPI_Document>, std::string>>::
- const_iterator aGIter = aDeleted->groups().cbegin();
+ auto aGIter = aDeleted->groups().cbegin();
for (; aGIter != aDeleted->groups().cend(); aGIter++) {
if (aGIter->second == ModelAPI_ResultPart::group())
break;
if (aCurrentPart.get()) {
const std::list<std::shared_ptr<ModelAPI_Result>> &aResList =
aCurrentPart->results();
- std::list<std::shared_ptr<ModelAPI_Result>>::const_iterator aRes =
- aResList.begin();
+ auto aRes = aResList.begin();
for (; !aFound && aRes != aResList.end(); aRes++) {
ResultPartPtr aPRes =
std::dynamic_pointer_cast<ModelAPI_ResultPart>(*aRes);
Config_ModuleReader aModuleReader(Config_FeatureMessage::MODEL_EVENT());
aModuleReader.readAll();
std::set<std::string> aFiles = aModuleReader.modulePluginFiles();
- std::set<std::string>::iterator it = aFiles.begin();
+ auto it = aFiles.begin();
for (; it != aFiles.end(); it++) {
Config_ValidatorReader aValidatorReader(*it);
aValidatorReader.readAll();
Events_Loop::loop()->eventByName(EVENT_PLUGIN_LOADED);
ModelAPI_EventCreator::get()->sendUpdated(ObjectPtr(), EVENT_LOAD, false);
// If the plugin has an ability to process GUI events, register it
- Events_Listener *aListener = dynamic_cast<Events_Listener *>(thePlugin);
+ auto *aListener = dynamic_cast<Events_Listener *>(thePlugin);
if (aListener) {
Events_Loop *aLoop = Events_Loop::loop();
static Events_ID aStateRequestEventId =
}
ModelAPI_ValidatorsFactory *Model_Session::validators() {
- static Model_ValidatorsFactory *aFactory = new Model_ValidatorsFactory;
+ static auto *aFactory = new Model_ValidatorsFactory;
return aFactory;
}
ModelAPI_FiltersFactory *Model_Session::filters() {
- static Model_FiltersFactory *aFactory = new Model_FiltersFactory;
+ static auto *aFactory = new Model_FiltersFactory;
return aFactory;
}
//! Loads the OCAF document from the file.
//! \param theFileName full name of the file to load
//! \returns true if file was loaded successfully
- MODEL_EXPORT virtual bool load(const char *theFileName);
+ MODEL_EXPORT bool load(const char *theFileName) override;
//! Saves the OCAF document to the file.
//! \param theFileName full name of the file to store
//! \param theResults the result full file names that were stored by "save"
//! \returns true if file was stored successfully
- MODEL_EXPORT virtual bool save(const char *theFileName,
- std::list<std::string> &theResults);
+ MODEL_EXPORT bool save(const char *theFileName,
+ std::list<std::string> &theResults) override;
//! Closes all documents
- MODEL_EXPORT virtual void closeAll();
+ MODEL_EXPORT void closeAll() override;
//! Starts a new operation (opens a transaction)
//! \param theId string-identifier of the started transaction
//! the nested
//! where it is located and will be committed on the next commit with
//! the nested
- MODEL_EXPORT virtual void
+ MODEL_EXPORT void
startOperation(const std::string &theId = "",
- const bool theAttachedToNested = false);
+ const bool theAttachedToNested = false) override;
//! Finishes the previously started operation (closes the transaction)
- MODEL_EXPORT virtual void finishOperation();
+ MODEL_EXPORT void finishOperation() override;
//! Aborts the operation
- MODEL_EXPORT virtual void abortOperation();
+ MODEL_EXPORT void abortOperation() override;
//! Returns true if operation has been started, but not yet finished or
//! aborted
- MODEL_EXPORT virtual bool isOperation();
+ MODEL_EXPORT bool isOperation() override;
//! Returns true if document was modified (since creation/opening)
- MODEL_EXPORT virtual bool isModified();
+ MODEL_EXPORT bool isModified() override;
//! Returns True if there are available Undos
- MODEL_EXPORT virtual bool canUndo();
+ MODEL_EXPORT bool canUndo() override;
//! Undoes last operation
- MODEL_EXPORT virtual void undo();
+ MODEL_EXPORT void undo() override;
//! Returns True if there are available Redos
- MODEL_EXPORT virtual bool canRedo();
+ MODEL_EXPORT bool canRedo() override;
//! Redoes last operation
- MODEL_EXPORT virtual void redo();
+ MODEL_EXPORT void redo() override;
//! Returns stack of performed operations
- MODEL_EXPORT virtual std::list<std::string> undoList();
+ MODEL_EXPORT std::list<std::string> undoList() override;
//! Returns stack of rolled back operations
- MODEL_EXPORT virtual std::list<std::string> redoList();
+ MODEL_EXPORT std::list<std::string> redoList() override;
//! Clears undo and redo lists of all documents in the session
- MODEL_EXPORT virtual void clearUndoRedo();
+ MODEL_EXPORT void clearUndoRedo() override;
/// Returns the root document of the application (that may contains
/// sub-documents)
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Document> moduleDocument();
+ MODEL_EXPORT std::shared_ptr<ModelAPI_Document> moduleDocument() override;
/// Returns the document by ID, loads if not loaded yet. Returns null if no
/// such document.
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Document>
- document(int theDocID);
+ MODEL_EXPORT std::shared_ptr<ModelAPI_Document>
+ document(int theDocID) override;
/// Return true if root document has been already created
- MODEL_EXPORT virtual bool hasModuleDocument();
+ MODEL_EXPORT bool hasModuleDocument() override;
/// Returns the current document that used for current work in the application
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Document> activeDocument();
+ MODEL_EXPORT std::shared_ptr<ModelAPI_Document> activeDocument() override;
/// Defines the current document that used for current work in the application
- MODEL_EXPORT virtual void
- setActiveDocument(std::shared_ptr<ModelAPI_Document> theDoc,
- bool theSendSignal = true);
+ MODEL_EXPORT void setActiveDocument(std::shared_ptr<ModelAPI_Document> theDoc,
+ bool theSendSignal = true) override;
/// Returns all the opened documents of the session (without postponed)
- MODEL_EXPORT virtual std::list<std::shared_ptr<ModelAPI_Document>>
- allOpenedDocuments();
+ MODEL_EXPORT std::list<std::shared_ptr<ModelAPI_Document>>
+ allOpenedDocuments() override;
/// Returns true if document is not loaded yet
- MODEL_EXPORT virtual bool isLoadByDemand(const std::wstring theDocID,
- const int theDocIndex);
+ MODEL_EXPORT bool isLoadByDemand(const std::wstring theDocID,
+ const int theDocIndex) override;
/// Registers the plugin that creates features.
/// It is obligatory for each plugin to call this function on loading to be
/// found by the plugin manager on call of the feature)
- MODEL_EXPORT virtual void registerPlugin(ModelAPI_Plugin *thePlugin);
+ MODEL_EXPORT void registerPlugin(ModelAPI_Plugin *thePlugin) override;
/// Verifies the license for the plugin is valid
- MODEL_EXPORT virtual bool checkLicense(const std::string &thePluginName);
+ MODEL_EXPORT bool checkLicense(const std::string &thePluginName) override;
/// Processes the configuration file reading
- MODEL_EXPORT virtual void
- processEvent(const std::shared_ptr<Events_Message> &theMessage);
+ MODEL_EXPORT void
+ processEvent(const std::shared_ptr<Events_Message> &theMessage) override;
/// Copies the document to the new one
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Document>
- copy(std::shared_ptr<ModelAPI_Document> theSource, const int theDestID);
+ MODEL_EXPORT std::shared_ptr<ModelAPI_Document>
+ copy(std::shared_ptr<ModelAPI_Document> theSource,
+ const int theDestID) override;
/// Returns the validators factory: the only one instance per application
- MODEL_EXPORT virtual ModelAPI_ValidatorsFactory *validators();
+ MODEL_EXPORT ModelAPI_ValidatorsFactory *validators() override;
/// Returns the filters factory: the only one instance per application
- MODEL_EXPORT virtual ModelAPI_FiltersFactory *filters();
+ MODEL_EXPORT ModelAPI_FiltersFactory *filters() override;
/// Sets the flag to check modifications outside the transaction or not
void setCheckTransactions(const bool theCheck) {
/// Returns the global identifier of the current transaction (needed for the
/// update algo)
- MODEL_EXPORT virtual int transactionID();
+ MODEL_EXPORT int transactionID() override;
/// Returns true if auto-update in the application is blocked
- MODEL_EXPORT virtual bool isAutoUpdateBlocked();
+ MODEL_EXPORT bool isAutoUpdateBlocked() override;
/// Set state of the auto-update of features result in the application
- MODEL_EXPORT virtual void blockAutoUpdate(const bool theBlock);
+ MODEL_EXPORT void blockAutoUpdate(const bool theBlock) override;
#ifdef TINSPECTOR
MODEL_EXPORT virtual Handle(TDocStd_Application) application();
Handle(TDF_Reference) aSourceRef =
Handle(TDF_Reference)::DownCast(anAttrIter.Value());
if (!aSourceRef.IsNull() && !aSourceRef->Get().IsNull()) {
- std::set<TCollection_AsciiString>::const_iterator aFound =
+ auto aFound =
theCoordinateLabels.find(labelToString(aSourceRef->Get()));
if (aFound != theCoordinateLabels.end())
makeExternalReference(theDestination, aSourceRef->Get());
Handle(TDF_RelocationTable) theRelocTable) {
DocumentPtr aPartSet = ModelAPI_Session::get()->moduleDocument();
std::list<FeaturePtr> aFeatures = aPartSet->allFeatures();
- for (std::list<FeaturePtr>::iterator aFIt = aFeatures.begin();
- aFIt != aFeatures.end(); ++aFIt) {
- FeaturePtr aCurFeat = *aFIt;
+ for (auto aCurFeat : aFeatures) {
if (!aCurFeat->isInHistory() &&
(aCurFeat->getKind() == ConstructionPlugin_Point::ID() ||
aCurFeat->getKind() == ConstructionPlugin_Axis::ID() ||
std::set<FeaturePtr> aRefSet;
const std::set<std::shared_ptr<ModelAPI_Attribute>> &aRefs =
theFeature->data()->refsToMe();
- std::set<std::shared_ptr<ModelAPI_Attribute>>::const_iterator aRefIter =
- aRefs.cbegin();
+ auto aRefIter = aRefs.cbegin();
for (; aRefIter != aRefs.cend(); aRefIter++) {
if ((*aRefIter)->isArgument()) {
FeaturePtr aReferenced =
// process also results
std::list<ResultPtr> allResults; // list of this feature and results
ModelAPI_Tools::allResults(theFeature, allResults);
- std::list<ResultPtr>::iterator aRes = allResults.begin();
+ auto aRes = allResults.begin();
for (; aRes != allResults.end(); aRes++) {
const std::set<std::shared_ptr<ModelAPI_Attribute>> &aResRefs =
(*aRes)->data()->refsToMe();
- std::set<std::shared_ptr<ModelAPI_Attribute>>::const_iterator aRIter =
- aResRefs.cbegin();
+ auto aRIter = aResRefs.cbegin();
for (; aRIter != aResRefs.cend(); aRIter++) {
if ((*aRIter)->isArgument()) {
FeaturePtr aReferenced =
if (aPart.get())
aRefSet.insert(aPart);
}
- for (std::set<FeaturePtr>::iterator aRef = aRefSet.begin();
- aRef != aRefSet.end(); aRef++)
- addModified(*aRef, theFeature);
+ for (const auto &aRef : aRefSet)
+ addModified(aRef, theFeature);
return true;
}
// modified
std::list<std::shared_ptr<ModelAPI_Document>> allDocs =
ModelAPI_Session::get()->allOpenedDocuments();
- std::list<std::shared_ptr<ModelAPI_Document>>::iterator aDoc =
- allDocs.begin();
+ auto aDoc = allDocs.begin();
for (; aDoc != allDocs.end(); aDoc++) {
std::list<std::shared_ptr<ModelAPI_Feature>> allFeats =
(*aDoc)->allFeatures();
- std::list<std::shared_ptr<ModelAPI_Feature>>::iterator aFeat =
- allFeats.begin();
+ auto aFeat = allFeats.begin();
for (; aFeat != allFeats.end(); aFeat++) {
if ((*aFeat)->data()->isValid() &&
(*aFeat)->data()->execState() == ModelAPI_StateMustBeUpdated) {
std::shared_ptr<ModelAPI_ObjectUpdatedMessage> aMsg =
std::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
const std::set<ObjectPtr> &anObjs = aMsg->objects();
- std::set<ObjectPtr>::const_iterator anObjIter = anObjs.cbegin();
+ auto anObjIter = anObjs.cbegin();
std::list<ObjectPtr> aFeatures, aResults;
for (; anObjIter != anObjs.cend(); anObjIter++) {
if (std::dynamic_pointer_cast<Model_Document>((*anObjIter)->document())
std::shared_ptr<ModelAPI_ObjectUpdatedMessage> aMsg =
std::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
const std::set<ObjectPtr> &anObjs = aMsg->objects();
- std::set<ObjectPtr>::const_iterator anObjIter = anObjs.cbegin();
+ auto anObjIter = anObjs.cbegin();
bool aSomeModified =
false; // check that features not changed: only redisplay is needed
for (; anObjIter != anObjs.cend(); anObjIter++) {
// result
const std::set<std::shared_ptr<ModelAPI_Attribute>> &aRefs =
(*anObjIter)->data()->refsToMe();
- std::set<std::shared_ptr<ModelAPI_Attribute>>::const_iterator aRefIter =
- aRefs.cbegin();
+ auto aRefIter = aRefs.cbegin();
FeaturePtr aReason;
ResultPtr aReasonResult =
std::dynamic_pointer_cast<ModelAPI_Result>(*anObjIter);
if (theMessage->eventID() == kOpFinishEvent) { // if update is blocked, skip
myIsFinish = true;
// add features that wait for finish as modified
- std::map<std::shared_ptr<ModelAPI_Feature>,
- std::set<std::shared_ptr<ModelAPI_Feature>>>::iterator aFeature =
- myProcessOnFinish.begin();
+ auto aFeature = myProcessOnFinish.begin();
for (; aFeature != myProcessOnFinish.end(); aFeature++) {
if (aFeature->first->data()
->isValid()) { // there may be already removed while wait
}
// remove all macros before clearing all created
- std::set<FeaturePtr>::iterator anUpdatedIter = myWaitForFinish.begin();
+ auto anUpdatedIter = myWaitForFinish.begin();
while (anUpdatedIter != myWaitForFinish.end()) {
FeaturePtr aFeature =
std::dynamic_pointer_cast<ModelAPI_Feature>(*anUpdatedIter);
std::list<std::pair<std::string, std::list<std::shared_ptr<ModelAPI_Object>>>>
aDeps;
theFeature->data()->referencesToObjects(aDeps);
- std::list<std::pair<std::string,
- std::list<std::shared_ptr<ModelAPI_Object>>>>::iterator
- anAttrsIter = aDeps.begin();
+ auto anAttrsIter = aDeps.begin();
for (; anAttrsIter != aDeps.end(); anAttrsIter++) {
if (theFeature->attribute(anAttrsIter->first)->isArgument()) {
- std::list<std::shared_ptr<ModelAPI_Object>>::iterator aDepIter =
- anAttrsIter->second.begin();
+ auto aDepIter = anAttrsIter->second.begin();
for (; aDepIter != anAttrsIter->second.end(); aDepIter++) {
FeaturePtr aDepFeat =
std::dynamic_pointer_cast<ModelAPI_Feature>(*aDepIter);
aNorm->z() != aNZ) {
std::set<FeaturePtr> aWholeR;
allReasons(theFeature, aWholeR);
- std::set<FeaturePtr>::iterator aRIter = aWholeR.begin();
+ auto aRIter = aWholeR.begin();
for (; aRIter != aWholeR.end(); aRIter++) {
if ((*aRIter)->data()->selection("External").get())
(*aRIter)->attributeChanged("External");
// re-processed
std::set<FeaturePtr> aWholeR;
allReasons(theFeature, aWholeR);
- std::set<FeaturePtr>::iterator aRIter = aWholeR.begin();
+ auto aRIter = aWholeR.begin();
for (; aRIter != aWholeR.end(); aRIter++) {
if (myModified.find(*aRIter) != myModified.end()) {
processFeature(theFeature);
std::list<ResultPtr> allResults;
ModelAPI_Tools::allResults(theFeature, allResults);
- std::list<ResultPtr>::iterator aRIter = allResults.begin();
+ auto aRIter = allResults.begin();
for (; aRIter != allResults.cend(); aRIter++) {
std::shared_ptr<ModelAPI_Result> aRes = *aRIter;
if (!aRes->isDisabled()) {
{
std::list<AttributePtr> anAttrinbutes =
theFeature->data()->attributes(ModelAPI_AttributeInteger::typeId());
- std::list<AttributePtr>::iterator anIter = anAttrinbutes.begin();
+ auto anIter = anAttrinbutes.begin();
for (; anIter != anAttrinbutes.end(); anIter++) {
AttributeIntegerPtr anAttribute =
std::dynamic_pointer_cast<ModelAPI_AttributeInteger>(*anIter);
{
std::list<AttributePtr> aDoubles =
theFeature->data()->attributes(ModelAPI_AttributeDouble::typeId());
- std::list<AttributePtr>::iterator aDoubleIter = aDoubles.begin();
+ auto aDoubleIter = aDoubles.begin();
for (; aDoubleIter != aDoubles.end(); aDoubleIter++) {
AttributeDoublePtr aDouble =
std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(*aDoubleIter);
{
std::list<AttributePtr> anAttributes =
theFeature->data()->attributes(GeomDataAPI_Point::typeId());
- std::list<AttributePtr>::iterator anIter = anAttributes.begin();
+ auto anIter = anAttributes.begin();
for (; anIter != anAttributes.end(); anIter++) {
AttributePointPtr aPointAttribute =
std::dynamic_pointer_cast<GeomDataAPI_Point>(*anIter);
{
std::list<AttributePtr> anAttributes =
theFeature->data()->attributes(GeomDataAPI_Point2D::typeId());
- std::list<AttributePtr>::iterator anIter = anAttributes.begin();
+ auto anIter = anAttributes.begin();
for (; anIter != anAttributes.end(); anIter++) {
AttributePoint2DPtr aPoint2DAttribute =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(*anIter);
// update the selection attributes if any
std::list<AttributePtr> aRefs =
theFeature->data()->attributes(ModelAPI_AttributeSelection::typeId());
- std::list<AttributePtr>::iterator aRefsIter = aRefs.begin();
+ auto aRefsIter = aRefs.begin();
for (; aRefsIter != aRefs.end(); aRefsIter++) {
std::shared_ptr<ModelAPI_AttributeSelection> aSel =
std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(*aRefsIter);
bool Model_Update::isReason(std::shared_ptr<ModelAPI_Feature> &theFeature,
std::shared_ptr<ModelAPI_Object> theReason) {
- std::map<std::shared_ptr<ModelAPI_Feature>,
- std::set<std::shared_ptr<ModelAPI_Feature>>>::iterator aReasonsIt =
- myModified.find(theFeature);
+ auto aReasonsIt = myModified.find(theFeature);
if (aReasonsIt != myModified.end()) {
if (aReasonsIt->second.find(theFeature) != aReasonsIt->second.end())
return true; // any is reason if it contains itself
return true;
}
// another try: postponed modification by not-persistences
- std::map<std::shared_ptr<ModelAPI_Feature>,
- std::set<std::shared_ptr<ModelAPI_Feature>>>::iterator aNotPersist =
- myNotPersistentRefs.find(theFeature);
+ auto aNotPersist = myNotPersistentRefs.find(theFeature);
if (aNotPersist != myNotPersistentRefs.end()) {
FeaturePtr aReasFeat =
std::dynamic_pointer_cast<ModelAPI_Feature>(theReason);
ModelAPI_Session::get()->validators();
if (theSender) {
bool added = false; // object may be was crated
- ModelAPI_Object *aSender = static_cast<ModelAPI_Object *>(theSender);
+ auto *aSender = static_cast<ModelAPI_Object *>(theSender);
if (aSender && aSender->document()) {
FeaturePtr aFeatureSender =
std::dynamic_pointer_cast<ModelAPI_Feature>(aSender->data()->owner());
// remove or add all concealment refs from this feature
std::list<std::pair<std::string, std::list<ObjectPtr>>> aRefs;
aSender->data()->referencesToObjects(aRefs);
- std::list<std::pair<std::string, std::list<ObjectPtr>>>::iterator
- aRefIt = aRefs.begin();
+ auto aRefIt = aRefs.begin();
for (; aRefIt != aRefs.end(); aRefIt++) {
if (!aFactory->isConcealed(aFeatureSender->getKind(),
aRefIt->first))
// edit)
continue;
std::list<ObjectPtr> &aRefFeaturesList = aRefIt->second;
- std::list<ObjectPtr>::iterator aReferenced =
- aRefFeaturesList.begin();
+ auto aReferenced = aRefFeaturesList.begin();
for (; aReferenced != aRefFeaturesList.end(); aReferenced++) {
// stability is only on results: feature to feature reference mean
// nested
void Model_Update::updateSelection(
const std::set<std::shared_ptr<ModelAPI_Object>> &theObjects) {
- std::set<std::shared_ptr<ModelAPI_Object>>::iterator anObj =
- theObjects.begin();
+ auto anObj = theObjects.begin();
for (; anObj != theObjects.end(); anObj++) {
std::list<AttributePtr> aRefs =
(*anObj)->data()->attributes(ModelAPI_AttributeSelection::typeId());
- std::list<AttributePtr>::iterator aRefsIter = aRefs.begin();
+ auto aRefsIter = aRefs.begin();
for (; aRefsIter != aRefs.end(); aRefsIter++) {
AttributeSelectionPtr aSel =
std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(*aRefsIter);
Model_Update();
/// Processes the feature argument update: executes the results
- MODEL_EXPORT virtual void
- processEvent(const std::shared_ptr<Events_Message> &theMessage);
+ MODEL_EXPORT void
+ processEvent(const std::shared_ptr<Events_Message> &theMessage) override;
protected:
/// Appends the new modified feature to the myModified, clears myProcessed if
const std::string &theID, const std::string &theFeatureID,
const std::string &theAttrID, const std::list<std::string> &theArguments) {
// create feature-structures if not exist
- std::map<std::string, std::map<std::string, AttrValidators>>::iterator
- aFeature = myAttrs.find(theFeatureID);
+ auto aFeature = myAttrs.find(theFeatureID);
if (aFeature == myAttrs.end()) {
myAttrs[theFeatureID] = std::map<std::string, AttrValidators>();
aFeature = myAttrs.find(theFeatureID);
}
// add attr-structure if not exist, or generate error if already exist
- std::map<std::string, AttrValidators>::iterator anAttr =
- aFeature->second.find(theAttrID);
+ auto anAttr = aFeature->second.find(theAttrID);
if (anAttr == aFeature->second.end()) {
aFeature->second[theAttrID] = AttrValidators();
}
void Model_ValidatorsFactory::validators(const std::string &theFeatureID,
Validators &theValidators) const {
- std::map<std::string, AttrValidators>::const_iterator aFeatureIt =
- myFeatures.find(theFeatureID);
+ auto aFeatureIt = myFeatures.find(theFeatureID);
if (aFeatureIt != myFeatures.cend()) {
- AttrValidators::const_iterator aValidatorsIt = aFeatureIt->second.cbegin();
+ auto aValidatorsIt = aFeatureIt->second.cbegin();
for (; aValidatorsIt != aFeatureIt->second.cend(); aValidatorsIt++) {
if (!validator(aValidatorsIt->first)) {
Events_InfoMessage("Model_Validator", "Validator %1 was not registered")
void Model_ValidatorsFactory::validators(const std::string &theFeatureID,
const std::string &theAttrID,
Validators &theValidators) const {
- std::map<std::string, std::map<std::string, AttrValidators>>::const_iterator
- aFeatureIt = myAttrs.find(theFeatureID);
+ auto aFeatureIt = myAttrs.find(theFeatureID);
if (aFeatureIt != myAttrs.cend()) {
- std::map<std::string, AttrValidators>::const_iterator anAttrIt =
- aFeatureIt->second.find(theAttrID);
+ auto anAttrIt = aFeatureIt->second.find(theAttrID);
if (anAttrIt != aFeatureIt->second.end()) {
- AttrValidators::const_iterator aValidatorsIt = anAttrIt->second.cbegin();
+ auto aValidatorsIt = anAttrIt->second.cbegin();
for (; aValidatorsIt != anAttrIt->second.cend(); aValidatorsIt++) {
if (!validator(aValidatorsIt->first)) {
Events_InfoMessage("Model_Validator",
const ModelAPI_Validator *
Model_ValidatorsFactory::validator(const std::string &theID) const {
- std::map<std::string, ModelAPI_Validator *>::const_iterator aIt =
- myIDs.find(theID);
+ auto aIt = myIDs.find(theID);
if (aIt != myIDs.end()) {
return aIt->second;
}
- return NULL;
+ return nullptr;
}
void Model_ValidatorsFactory::addDefaultValidators(
validators(theFeature->getKind(), aValidators);
if (!aValidators.empty()) {
- Validators::const_iterator aValidatorIt = aValidators.cbegin();
+ auto aValidatorIt = aValidators.cbegin();
for (; aValidatorIt != aValidators.cend(); aValidatorIt++) {
const std::string &aValidatorID = aValidatorIt->first;
const std::list<std::string> &anArguments = aValidatorIt->second;
- const ModelAPI_FeatureValidator *aFValidator =
- dynamic_cast<const ModelAPI_FeatureValidator *>(
- validator(aValidatorID));
+ const auto *aFValidator = dynamic_cast<const ModelAPI_FeatureValidator *>(
+ validator(aValidatorID));
if (aFValidator) {
Events_InfoMessage anError;
if (!aFValidator->isValid(theFeature, anArguments, anError)) {
// check all attributes for validity
static const std::string kAllTypes = "";
std::list<std::string> aLtAttributes = aData->attributesIDs(kAllTypes);
- std::list<std::string>::const_iterator anAttrIt = aLtAttributes.cbegin();
+ auto anAttrIt = aLtAttributes.cbegin();
for (; anAttrIt != aLtAttributes.cend(); anAttrIt++) {
const std::string &anAttributeID = *anAttrIt;
AttributePtr anAttribute = theFeature->data()->attribute(anAttributeID);
Validators aValidators;
validators(aFeature->getKind(), theAttribute->id(), aValidators);
- Validators::iterator aValidatorIt = aValidators.begin();
+ auto aValidatorIt = aValidators.begin();
for (; aValidatorIt != aValidators.end(); ++aValidatorIt) {
const std::string &aValidatorID = aValidatorIt->first;
const std::list<std::string> &anArguments = aValidatorIt->second;
- const ModelAPI_AttributeValidator *anAttrValidator =
+ const auto *anAttrValidator =
dynamic_cast<const ModelAPI_AttributeValidator *>(
validator(aValidatorID));
if (!anAttrValidator)
std::map<std::string, ModelAPI_Validator *>::const_iterator it =
myIDs.find(kDefaultId);
if (it != myIDs.end()) {
- Model_FeatureValidator *aValidator =
- dynamic_cast<Model_FeatureValidator *>(it->second);
+ auto *aValidator = dynamic_cast<Model_FeatureValidator *>(it->second);
if (aValidator) {
aValidator->registerNotObligatory(theFeature, theAttribute);
}
std::map<std::string, ModelAPI_Validator *>::const_iterator it =
myIDs.find(kDefaultId);
if (it != myIDs.end()) {
- Model_FeatureValidator *aValidator =
- dynamic_cast<Model_FeatureValidator *>(it->second);
+ auto *aValidator = dynamic_cast<Model_FeatureValidator *>(it->second);
if (aValidator) {
return aValidator->isNotObligatory(theFeature, theAttribute);
}
void Model_ValidatorsFactory::registerConcealment(std::string theFeature,
std::string theAttribute) {
- std::map<std::string, std::set<std::string>>::iterator aFind =
- myConcealed.find(theFeature);
+ auto aFind = myConcealed.find(theFeature);
if (aFind == myConcealed.end()) {
std::set<std::string> aNewSet;
aNewSet.insert(theAttribute);
bool Model_ValidatorsFactory::isConcealed(std::string theFeature,
std::string theAttribute) {
- std::map<std::string, std::set<std::string>>::iterator aFind =
- myConcealed.find(theFeature);
+ auto aFind = myConcealed.find(theFeature);
return aFind != myConcealed.end() &&
aFind->second.find(theAttribute) != aFind->second.end();
}
void Model_ValidatorsFactory::registerCase(
std::string theFeature, std::string theAttribute,
const std::list<std::pair<std::string, std::string>> &theCases) {
- std::map<std::string,
- std::map<std::string,
- std::map<std::string, std::set<std::string>>>>::iterator
- aFindFeature = myCases.find(theFeature);
+ auto aFindFeature = myCases.find(theFeature);
if (aFindFeature == myCases.end()) {
myCases[theFeature] =
std::map<std::string, std::map<std::string, std::set<std::string>>>();
aFindFeature = myCases.find(theFeature);
}
- std::map<std::string, std::map<std::string, std::set<std::string>>>::iterator
- aFindAttrID = aFindFeature->second.find(theAttribute);
+ auto aFindAttrID = aFindFeature->second.find(theAttribute);
if (aFindAttrID == aFindFeature->second.end()) {
aFindFeature->second[theAttribute] =
std::map<std::string, std::set<std::string>>();
aFindAttrID = aFindFeature->second.find(theAttribute);
}
- std::list<std::pair<std::string, std::string>>::const_iterator
- aCasesIt = theCases.begin(),
- aCasesLast = theCases.end();
+ auto aCasesIt = theCases.begin(), aCasesLast = theCases.end();
std::map<std::string, std::set<std::string>> aFindCases = aFindAttrID->second;
for (; aCasesIt != aCasesLast; aCasesIt++) {
std::pair<std::string, std::string> aCasePair = *aCasesIt;
bool Model_ValidatorsFactory::isCase(FeaturePtr theFeature,
std::string theAttribute) {
bool anInCase = true;
- std::map<std::string,
- std::map<std::string,
- std::map<std::string, std::set<std::string>>>>::iterator
- aFindFeature = myCases.find(theFeature->getKind());
+ auto aFindFeature = myCases.find(theFeature->getKind());
if (aFindFeature != myCases.end()) {
- std::map<std::string,
- std::map<std::string, std::set<std::string>>>::iterator
- aFindAttrID = aFindFeature->second.find(theAttribute);
+ auto aFindAttrID = aFindFeature->second.find(theAttribute);
if (aFindAttrID != aFindFeature->second.end()) {
- std::map<std::string, std::set<std::string>>::iterator
- aCasesIt = aFindAttrID->second.begin(),
- aCasesLast = aFindAttrID->second.end();
+ auto aCasesIt = aFindAttrID->second.begin(),
+ aCasesLast = aFindAttrID->second.end();
for (; aCasesIt != aCasesLast && anInCase; aCasesIt++) {
// the the switch-attribute that contains the case value
AttributeStringPtr aSwitch = theFeature->string(aCasesIt->first);
void Model_ValidatorsFactory::registerMainArgument(std::string theFeature,
std::string theAttribute) {
- std::map<std::string, std::string>::iterator aFound =
- myMainArgument.find(theFeature);
+ auto aFound = myMainArgument.find(theFeature);
if (aFound == myMainArgument.end())
myMainArgument[theFeature] = theAttribute;
}
bool Model_ValidatorsFactory::isMainArgument(std::string theFeature,
std::string theAttribute) {
- std::map<std::string, std::string>::iterator aFound =
- myMainArgument.find(theFeature);
+ auto aFound = myMainArgument.find(theFeature);
return aFound != myMainArgument.end() && aFound->second == theAttribute;
}
void Model_ValidatorsFactory::registerGeometricalSelection(
std::string theFeature, std::string theAttribute) {
- std::map<std::string, std::set<std::string>>::iterator aFind =
- myGeometricalSelection.find(theFeature);
+ auto aFind = myGeometricalSelection.find(theFeature);
if (aFind == myGeometricalSelection.end()) {
std::set<std::string> aNewSet;
aNewSet.insert(theAttribute);
bool Model_ValidatorsFactory::isGeometricalSelection(std::string theFeature,
std::string theAttribute) {
- std::map<std::string, std::set<std::string>>::iterator aFind =
- myGeometricalSelection.find(theFeature);
+ auto aFind = myGeometricalSelection.find(theFeature);
return aFind != myGeometricalSelection.end() &&
aFind->second.find(theAttribute) != aFind->second.end();
}
std::map<std::string, ModelAPI_Validator *>
myIDs; ///< map from ID to registered validator
/// validators IDs to list of arguments
- typedef std::map<std::string, std::list<std::string>> AttrValidators;
+ using AttrValidators = std::map<std::string, std::list<std::string>>;
/// validators IDs by feature ID
std::map<std::string, AttrValidators> myFeatures;
/// validators IDs and arguments by feature and attribute IDs
public:
/// Registers the instance of the validator by the ID
- MODEL_EXPORT virtual void registerValidator(const std::string &theID,
- ModelAPI_Validator *theValidator);
+ MODEL_EXPORT void
+ registerValidator(const std::string &theID,
+ ModelAPI_Validator *theValidator) override;
/// Assigns validator to the feature
- MODEL_EXPORT virtual void assignValidator(const std::string &theID,
- const std::string &theFeatureID);
+ MODEL_EXPORT void assignValidator(const std::string &theID,
+ const std::string &theFeatureID) override;
/// Assigns validator to the feature with arguments of the validator
- MODEL_EXPORT virtual void
+ MODEL_EXPORT void
assignValidator(const std::string &theID, const std::string &theFeatureID,
- const std::list<std::string> &theArguments);
+ const std::list<std::string> &theArguments) override;
/// Assigns validator to the attribute of the feature
- MODEL_EXPORT virtual void
+ MODEL_EXPORT void
assignValidator(const std::string &theID, const std::string &theFeatureID,
const std::string &theAttrID,
- const std::list<std::string> &theArguments);
+ const std::list<std::string> &theArguments) override;
/// Provides a validator for the feature, returns NULL if no validator
- MODEL_EXPORT virtual void validators(const std::string &theFeatureID,
- Validators &theResult) const;
+ MODEL_EXPORT void validators(const std::string &theFeatureID,
+ Validators &theResult) const override;
/// Provides a validator for the attribute, returns NULL if no validator
- MODEL_EXPORT virtual void validators(const std::string &theFeatureID,
- const std::string &theAttrID,
- Validators &theResult) const;
+ MODEL_EXPORT void validators(const std::string &theFeatureID,
+ const std::string &theAttrID,
+ Validators &theResult) const override;
/// Returns registered validator by its Id
- MODEL_EXPORT virtual const ModelAPI_Validator *
- validator(const std::string &theID) const;
+ MODEL_EXPORT const ModelAPI_Validator *
+ validator(const std::string &theID) const override;
/// Returns true if feature and all its attributes are valid.
- MODEL_EXPORT virtual bool
- validate(const std::shared_ptr<ModelAPI_Feature> &theFeature) const;
+ MODEL_EXPORT bool
+ validate(const std::shared_ptr<ModelAPI_Feature> &theFeature) const override;
/// Returns true if the attribute is valid.
- MODEL_EXPORT virtual bool
+ MODEL_EXPORT bool
validate(const std::shared_ptr<ModelAPI_Attribute> &theAttribute,
- std::string &theValidator, Events_InfoMessage &theError) const;
+ std::string &theValidator,
+ Events_InfoMessage &theError) const override;
/// register that this attribute in feature is not obligatory for the feature
/// execution so, it is not needed for the standard validation mechanism
- virtual void registerNotObligatory(std::string theFeature,
- std::string theAttribute);
+ void registerNotObligatory(std::string theFeature,
+ std::string theAttribute) override;
/// Returns true if the attribute in feature is not obligatory for the feature
/// execution
- virtual bool isNotObligatory(std::string theFeature,
- std::string theAttribute);
+ bool isNotObligatory(std::string theFeature,
+ std::string theAttribute) override;
/// register that this attribute conceals in the object browser
/// all referenced features after execution
- virtual void registerConcealment(std::string theFeature,
- std::string theAttribute);
+ void registerConcealment(std::string theFeature,
+ std::string theAttribute) override;
/// Returns true that it was registered that attribute conceals the referenced
/// result
- virtual bool isConcealed(std::string theFeature, std::string theAttribute);
+ bool isConcealed(std::string theFeature, std::string theAttribute) override;
/// register the case-attribute (\a myCases set definition)
- virtual void
- registerCase(std::string theFeature, std::string theAttribute,
- const std::list<std::pair<std::string, std::string>> &theCases);
+ void registerCase(
+ std::string theFeature, std::string theAttribute,
+ const std::list<std::pair<std::string, std::string>> &theCases) override;
/// Returns true if the attribute must be checked (the case is selected)
- virtual bool isCase(FeaturePtr theFeature, std::string theAttribute);
+ bool isCase(FeaturePtr theFeature, std::string theAttribute) override;
/// Register the attribute as a main argument of the feature
- virtual void registerMainArgument(std::string theFeature,
- std::string theAttribute);
+ void registerMainArgument(std::string theFeature,
+ std::string theAttribute) override;
/// Returns true is the attribute is a main argument of the feature
- virtual bool isMainArgument(std::string theFeature, std::string theAttribute);
+ bool isMainArgument(std::string theFeature,
+ std::string theAttribute) override;
/// Register the selection attribute as geometrical selection
- virtual void registerGeometricalSelection(std::string theFeature,
- std::string theAttribute);
+ void registerGeometricalSelection(std::string theFeature,
+ std::string theAttribute) override;
/// Returns true if the attribute is a geometrical selection
- virtual bool isGeometricalSelection(std::string theFeature,
- std::string theAttribute);
+ bool isGeometricalSelection(std::string theFeature,
+ std::string theAttribute) override;
protected:
/// Adds the defualt validators that are usefull for all features.
#include <ModelAPI_Attribute.h>
-ModelAPI_Attribute::~ModelAPI_Attribute() {}
+ModelAPI_Attribute::~ModelAPI_Attribute() = default;
/// Sets the owner of this attribute
void ModelAPI_Attribute::setObject(
std::string ModelAPI_AttributeBoolean::attributeType() { return typeId(); }
/// To virtually destroy the fields of successors
-ModelAPI_AttributeBoolean::~ModelAPI_AttributeBoolean() {}
+ModelAPI_AttributeBoolean::~ModelAPI_AttributeBoolean() = default;
-ModelAPI_AttributeBoolean::ModelAPI_AttributeBoolean() {}
+ModelAPI_AttributeBoolean::ModelAPI_AttributeBoolean() = default;
std::string ModelAPI_AttributeDocRef::attributeType() { return typeId(); }
-ModelAPI_AttributeDocRef::~ModelAPI_AttributeDocRef() {}
+ModelAPI_AttributeDocRef::~ModelAPI_AttributeDocRef() = default;
-ModelAPI_AttributeDocRef::ModelAPI_AttributeDocRef() {}
+ModelAPI_AttributeDocRef::ModelAPI_AttributeDocRef() = default;
std::string ModelAPI_AttributeDouble::attributeType() { return typeId(); }
-ModelAPI_AttributeDouble::~ModelAPI_AttributeDouble() {}
+ModelAPI_AttributeDouble::~ModelAPI_AttributeDouble() = default;
-ModelAPI_AttributeDouble::ModelAPI_AttributeDouble() {}
+ModelAPI_AttributeDouble::ModelAPI_AttributeDouble() = default;
std::string ModelAPI_AttributeDoubleArray::attributeType() { return typeId(); }
//==================================================================================================
-ModelAPI_AttributeDoubleArray::~ModelAPI_AttributeDoubleArray() {}
+ModelAPI_AttributeDoubleArray::~ModelAPI_AttributeDoubleArray() = default;
//==================================================================================================
-ModelAPI_AttributeDoubleArray::ModelAPI_AttributeDoubleArray() {}
+ModelAPI_AttributeDoubleArray::ModelAPI_AttributeDoubleArray() = default;
std::string ModelAPI_AttributeIntArray::attributeType() { return typeId(); }
/// To virtually destroy the fields of successors
-ModelAPI_AttributeIntArray::~ModelAPI_AttributeIntArray() {}
+ModelAPI_AttributeIntArray::~ModelAPI_AttributeIntArray() = default;
-ModelAPI_AttributeIntArray::ModelAPI_AttributeIntArray() {}
+ModelAPI_AttributeIntArray::ModelAPI_AttributeIntArray() = default;
std::string ModelAPI_AttributeInteger::attributeType() { return typeId(); }
/// To virtually destroy the fields of successors
-ModelAPI_AttributeInteger::~ModelAPI_AttributeInteger() {}
+ModelAPI_AttributeInteger::~ModelAPI_AttributeInteger() = default;
-ModelAPI_AttributeInteger::ModelAPI_AttributeInteger() {}
+ModelAPI_AttributeInteger::ModelAPI_AttributeInteger() = default;
std::string ModelAPI_AttributeRefAttr::attributeType() { return typeId(); }
-ModelAPI_AttributeRefAttr::~ModelAPI_AttributeRefAttr() {}
+ModelAPI_AttributeRefAttr::~ModelAPI_AttributeRefAttr() = default;
-ModelAPI_AttributeRefAttr::ModelAPI_AttributeRefAttr() {}
+ModelAPI_AttributeRefAttr::ModelAPI_AttributeRefAttr() = default;
std::string ModelAPI_AttributeRefList::attributeType() { return typeId(); }
-ModelAPI_AttributeRefList::~ModelAPI_AttributeRefList() {}
+ModelAPI_AttributeRefList::~ModelAPI_AttributeRefList() = default;
-ModelAPI_AttributeRefList::ModelAPI_AttributeRefList() {}
+ModelAPI_AttributeRefList::ModelAPI_AttributeRefList() = default;
std::string ModelAPI_AttributeReference::attributeType() { return typeId(); }
-ModelAPI_AttributeReference::~ModelAPI_AttributeReference() {}
+ModelAPI_AttributeReference::~ModelAPI_AttributeReference() = default;
-ModelAPI_AttributeReference::ModelAPI_AttributeReference() {}
+ModelAPI_AttributeReference::ModelAPI_AttributeReference() = default;
std::string ModelAPI_AttributeSelection::attributeType() { return typeId(); }
-ModelAPI_AttributeSelection::~ModelAPI_AttributeSelection() {}
+ModelAPI_AttributeSelection::~ModelAPI_AttributeSelection() = default;
-ModelAPI_AttributeSelection::ModelAPI_AttributeSelection() {}
+ModelAPI_AttributeSelection::ModelAPI_AttributeSelection() = default;
return typeId();
}
-ModelAPI_AttributeSelectionList::~ModelAPI_AttributeSelectionList() {}
+ModelAPI_AttributeSelectionList::~ModelAPI_AttributeSelectionList() = default;
std::string ModelAPI_AttributeString::attributeType() { return typeId(); }
-ModelAPI_AttributeString::~ModelAPI_AttributeString() {}
+ModelAPI_AttributeString::~ModelAPI_AttributeString() = default;
-ModelAPI_AttributeString::ModelAPI_AttributeString() {}
+ModelAPI_AttributeString::ModelAPI_AttributeString() = default;
std::string ModelAPI_AttributeStringArray::attributeType() { return typeId(); }
//==================================================================================================
-ModelAPI_AttributeStringArray::~ModelAPI_AttributeStringArray() {}
+ModelAPI_AttributeStringArray::~ModelAPI_AttributeStringArray() = default;
//==================================================================================================
-ModelAPI_AttributeStringArray::ModelAPI_AttributeStringArray() {}
+ModelAPI_AttributeStringArray::ModelAPI_AttributeStringArray() = default;
MODELAPI_EXPORT static std::string typeId() { return "StringArray"; }
/// Returns the type of this class of attributes, not static method
- MODELAPI_EXPORT virtual std::string attributeType();
+ MODELAPI_EXPORT std::string attributeType() override;
/// To virtually destroy the fields of successors
- MODELAPI_EXPORT virtual ~ModelAPI_AttributeStringArray();
+ MODELAPI_EXPORT ~ModelAPI_AttributeStringArray() override;
protected:
/// Objects are created for features automatically
};
/// Pointer on string attribute
-typedef std::shared_ptr<ModelAPI_AttributeStringArray> AttributeStringArrayPtr;
+using AttributeStringArrayPtr = std::shared_ptr<ModelAPI_AttributeStringArray>;
#endif
std::string ModelAPI_AttributeTables::attributeType() { return typeId(); }
//==================================================================================================
-ModelAPI_AttributeTables::~ModelAPI_AttributeTables() {}
+ModelAPI_AttributeTables::~ModelAPI_AttributeTables() = default;
//==================================================================================================
-ModelAPI_AttributeTables::ModelAPI_AttributeTables() {}
+ModelAPI_AttributeTables::ModelAPI_AttributeTables() = default;
#include <ModelAPI_AttributeValidator.h>
-ModelAPI_AttributeValidator::~ModelAPI_AttributeValidator() {}
+ModelAPI_AttributeValidator::~ModelAPI_AttributeValidator() = default;
*/
class ModelAPI_BodyBuilder {
public:
- MODELAPI_EXPORT virtual ~ModelAPI_BodyBuilder(){};
+ MODELAPI_EXPORT virtual ~ModelAPI_BodyBuilder() = default;
+ ;
/// Stores the shape (called by the execution method).
virtual void store(const GeomShapePtr &theShape,
};
//! Pointer on feature object
-typedef std::shared_ptr<ModelAPI_BodyBuilder> BodyBuilderPtr;
+using BodyBuilderPtr = std::shared_ptr<ModelAPI_BodyBuilder>;
#endif
#include <ModelAPI_CompositeFeature.h>
-ModelAPI_CompositeFeature::~ModelAPI_CompositeFeature() {}
+ModelAPI_CompositeFeature::~ModelAPI_CompositeFeature() = default;
void ModelAPI_CompositeFeature::erase() {
// erase all sub-features
#include <ModelAPI_Data.h>
-ModelAPI_Data::~ModelAPI_Data() {}
+ModelAPI_Data::~ModelAPI_Data() = default;
-ModelAPI_Data::ModelAPI_Data() {}
+ModelAPI_Data::ModelAPI_Data() = default;
const Events_ID theID, const void *theSender)
: Events_MessageGroup(theID, theSender) {}
-ModelAPI_ObjectUpdatedMessage::~ModelAPI_ObjectUpdatedMessage() {}
+ModelAPI_ObjectUpdatedMessage::~ModelAPI_ObjectUpdatedMessage() = default;
ModelAPI_ObjectDeletedMessage::ModelAPI_ObjectDeletedMessage(
const Events_ID theID, const void *theSender)
: Events_MessageGroup(theID, theSender) {}
-ModelAPI_ObjectDeletedMessage::~ModelAPI_ObjectDeletedMessage() {}
+ModelAPI_ObjectDeletedMessage::~ModelAPI_ObjectDeletedMessage() = default;
ModelAPI_OrderUpdatedMessage::ModelAPI_OrderUpdatedMessage(
const Events_ID theID, const void *theSender)
: Events_Message(theID, theSender) {}
-ModelAPI_OrderUpdatedMessage::~ModelAPI_OrderUpdatedMessage() {}
+ModelAPI_OrderUpdatedMessage::~ModelAPI_OrderUpdatedMessage() = default;
// used by GUI only
// LCOV_EXCL_START
myCurrentFeature = std::shared_ptr<ModelAPI_Feature>();
}
-ModelAPI_FeatureStateMessage::~ModelAPI_FeatureStateMessage() {}
+ModelAPI_FeatureStateMessage::~ModelAPI_FeatureStateMessage() = default;
std::shared_ptr<ModelAPI_Feature>
ModelAPI_FeatureStateMessage::feature() const {
std::list<std::string> ModelAPI_FeatureStateMessage::features() const {
std::list<std::string> result;
- std::map<std::string, bool>::const_iterator it = myFeatureState.begin();
+ auto it = myFeatureState.begin();
for (; it != myFeatureState.end(); ++it) {
result.push_back(it->first);
}
const Events_ID theID, const void *theSender)
: Events_Message(theID, theSender) {}
-ModelAPI_DocumentCreatedMessage::~ModelAPI_DocumentCreatedMessage() {}
+ModelAPI_DocumentCreatedMessage::~ModelAPI_DocumentCreatedMessage() = default;
DocumentPtr ModelAPI_DocumentCreatedMessage::document() const {
return myDocument;
const Events_ID theID, const void *theSender)
: Events_Message(theID, theSender) {}
-ModelAPI_AttributeEvalMessage::~ModelAPI_AttributeEvalMessage() {}
+ModelAPI_AttributeEvalMessage::~ModelAPI_AttributeEvalMessage() = default;
AttributePtr ModelAPI_AttributeEvalMessage::attribute() const {
return myAttribute;
const Events_ID theID, const void *theSender)
: Events_Message(theID, theSender), myIsProcessed(false) {}
-ModelAPI_ParameterEvalMessage::~ModelAPI_ParameterEvalMessage() {}
+ModelAPI_ParameterEvalMessage::~ModelAPI_ParameterEvalMessage() = default;
FeaturePtr ModelAPI_ParameterEvalMessage::parameter() const { return myParam; }
const Events_ID theID, const void *theSender)
: Events_Message(theID, theSender) {}
-ModelAPI_ImportParametersMessage::~ModelAPI_ImportParametersMessage() {}
+ModelAPI_ImportParametersMessage::~ModelAPI_ImportParametersMessage() = default;
std::string ModelAPI_ImportParametersMessage::filename() const {
return myFilename;
const void *theSender)
: Events_Message(theID, theSender), myIsProcessed(false) {}
-ModelAPI_BuildEvalMessage::~ModelAPI_BuildEvalMessage() {}
+ModelAPI_BuildEvalMessage::~ModelAPI_BuildEvalMessage() = default;
FeaturePtr ModelAPI_BuildEvalMessage::parameter() const { return myParam; }
const Events_ID theID, const void *theSender)
: Events_Message(theID, theSender) {}
-ModelAPI_ComputePositionsMessage::~ModelAPI_ComputePositionsMessage() {}
+ModelAPI_ComputePositionsMessage::~ModelAPI_ComputePositionsMessage() = default;
const std::wstring &ModelAPI_ComputePositionsMessage::expression() const {
return myExpression;
const Events_ID theID, const void *theSender)
: Events_Message(theID, theSender) {}
-ModelAPI_ObjectRenamedMessage::~ModelAPI_ObjectRenamedMessage() {}
+ModelAPI_ObjectRenamedMessage::~ModelAPI_ObjectRenamedMessage() = default;
void ModelAPI_ObjectRenamedMessage::send(ObjectPtr theObject,
const std::wstring &theOldName,
const Events_ID theID, const void *theSender)
: Events_Message(theID, theSender) {}
-ModelAPI_ReplaceParameterMessage::~ModelAPI_ReplaceParameterMessage() {}
+ModelAPI_ReplaceParameterMessage::~ModelAPI_ReplaceParameterMessage() = default;
void ModelAPI_ReplaceParameterMessage::send(ObjectPtr theObject,
const void *theSender) {
const Events_ID theID, const void *theSender)
: Events_Message(theID, theSender), myDOF(-1) {}
-ModelAPI_SolverFailedMessage::~ModelAPI_SolverFailedMessage() {}
+ModelAPI_SolverFailedMessage::~ModelAPI_SolverFailedMessage() = default;
void ModelAPI_SolverFailedMessage::setObjects(
const std::set<ObjectPtr> &theObjects) {
const Events_ID theID, const void *theSender)
: Events_Message(theID, theSender) {}
-ModelAPI_ShapesFailedMessage::~ModelAPI_ShapesFailedMessage() {}
+ModelAPI_ShapesFailedMessage::~ModelAPI_ShapesFailedMessage() = default;
void ModelAPI_ShapesFailedMessage::setShapes(const ListOfShape &theShapes) {
myShapes = theShapes;
const Events_ID theID, const void *theSender)
: Events_Message(theID, theSender) {}
-ModelAPI_CheckConstraintsMessage::~ModelAPI_CheckConstraintsMessage() {}
+ModelAPI_CheckConstraintsMessage::~ModelAPI_CheckConstraintsMessage() = default;
const std::set<ObjectPtr> &
ModelAPI_CheckConstraintsMessage::constraints() const {
const Events_ID theID, const void *theSender)
: Events_Message(theID, theSender) {}
-ModelAPI_FeaturesLicenseValidMessage::~ModelAPI_FeaturesLicenseValidMessage() {}
+ModelAPI_FeaturesLicenseValidMessage::~ModelAPI_FeaturesLicenseValidMessage() =
+ default;
void ModelAPI_FeaturesLicenseValidMessage::setFeatures(
const std::set<std::string> &theFeatures) {
#include <cwctype>
-ModelAPI_Expression::ModelAPI_Expression() {}
+ModelAPI_Expression::ModelAPI_Expression() = default;
-ModelAPI_Expression::~ModelAPI_Expression() {}
+ModelAPI_Expression::~ModelAPI_Expression() = default;
bool ModelAPI_Expression::isInitialized() { return myIsInitialized; }
void ModelAPI_Expression::setInitialized() { myIsInitialized = true; }
-ModelAPI_ExpressionDouble::ModelAPI_ExpressionDouble() {}
+ModelAPI_ExpressionDouble::ModelAPI_ExpressionDouble() = default;
-ModelAPI_ExpressionInteger::ModelAPI_ExpressionInteger() {}
+ModelAPI_ExpressionInteger::ModelAPI_ExpressionInteger() = default;
bool ModelAPI_Expression::isVariable(const std::string &theString) {
return isVariable(Locale::Convert::toWString(theString));
};
//! Smart pointers for objects
-typedef std::shared_ptr<ModelAPI_Expression> ExpressionPtr;
-typedef std::shared_ptr<ModelAPI_ExpressionDouble> ExpressionDoublePtr;
-typedef std::shared_ptr<ModelAPI_ExpressionInteger> ExpressionIntegerPtr;
+using ExpressionPtr = std::shared_ptr<ModelAPI_Expression>;
+using ExpressionDoublePtr = std::shared_ptr<ModelAPI_ExpressionDouble>;
+using ExpressionIntegerPtr = std::shared_ptr<ModelAPI_ExpressionInteger>;
#endif
if (firstResult() == theResult) {
// nothing to change
} else if (!myResults.empty()) { // all except first become disabled
- std::list<std::shared_ptr<ModelAPI_Result>>::iterator aResIter =
- myResults.begin();
+ auto aResIter = myResults.begin();
*aResIter = theResult;
aECreator->sendUpdated(theResult, EVENT_UPD);
for (aResIter++; aResIter != myResults.end(); aResIter++) {
void ModelAPI_Feature::setResult(
const std::shared_ptr<ModelAPI_Result> &theResult, const int theIndex) {
- std::list<std::shared_ptr<ModelAPI_Result>>::iterator aResIter =
- myResults.begin();
+ auto aResIter = myResults.begin();
for (int anIndex = 0; anIndex < theIndex; anIndex++) {
aResIter++;
}
void ModelAPI_Feature::eraseResultFromList(
const std::shared_ptr<ModelAPI_Result> &theResult) {
- std::list<std::shared_ptr<ModelAPI_Result>>::iterator aResIter =
- myResults.begin();
+ auto aResIter = myResults.begin();
for (; aResIter != myResults.end(); aResIter++) {
ResultPtr aRes = *aResIter;
if (aRes == theResult) {
void ModelAPI_Feature::removeResults(const int theSinceIndex,
const bool theForever,
const bool theFlush) {
- std::list<std::shared_ptr<ModelAPI_Result>>::iterator aResIter =
- myResults.begin();
+ auto aResIter = myResults.begin();
for (int anIndex = 0; anIndex < theSinceIndex && aResIter != myResults.end();
anIndex++)
aResIter++;
std::string aGroup;
- std::list<std::shared_ptr<ModelAPI_Result>>::iterator aNextIter = aResIter;
+ auto aNextIter = aResIter;
while (aNextIter != myResults.end()) {
aGroup = (*aNextIter)->groupName();
// remove previously erased results: to enable later if needed only actual
removeResults(0, false, false); // flush will be in setCurrentFeature
} else {
// enable all disabled previously results
- std::list<std::shared_ptr<ModelAPI_Result>>::iterator aResIter =
- myResults.begin();
+ auto aResIter = myResults.begin();
for (; aResIter != myResults.end(); aResIter++) {
(*aResIter)->setDisabled(*aResIter, false);
}
#include "ModelAPI_FeatureValidator.h"
-ModelAPI_FeatureValidator::ModelAPI_FeatureValidator() {}
+ModelAPI_FeatureValidator::ModelAPI_FeatureValidator() = default;
-ModelAPI_FeatureValidator::~ModelAPI_FeatureValidator() {}
+ModelAPI_FeatureValidator::~ModelAPI_FeatureValidator() = default;
-bool ModelAPI_FeatureValidator::isNotObligatory(std::string theFeature,
- std::string theAttribute) {
+bool ModelAPI_FeatureValidator::isNotObligatory(std::string /*theFeature*/,
+ std::string /*theAttribute*/) {
return false;
}
/// Default constructor
ModelAPI_FeatureValidator();
/// Virtual destructor
- virtual ~ModelAPI_FeatureValidator();
+ ~ModelAPI_FeatureValidator() override;
/// Returns true if feature and/or attributes are valid
/// \param theFeature the validated feature
*/
class ModelAPI_FiltersFactory {
public:
- virtual ~ModelAPI_FiltersFactory() {}
+ virtual ~ModelAPI_FiltersFactory() = default;
/// Register an instance of a filter
/// \param theID unique identifier of the filter, not necessary equal to the
protected:
/// Get instance from Session
- ModelAPI_FiltersFactory() {}
+ ModelAPI_FiltersFactory() = default;
};
#endif
#include <ModelAPI_AttributeReference.h>
-ModelAPI_Folder::ModelAPI_Folder() {}
+ModelAPI_Folder::ModelAPI_Folder() = default;
-ModelAPI_Folder::~ModelAPI_Folder() {}
+ModelAPI_Folder::~ModelAPI_Folder() = default;
void ModelAPI_Folder::init() {}
#include <ModelAPI_IReentrant.h>
-ModelAPI_IReentrant::~ModelAPI_IReentrant() {}
+ModelAPI_IReentrant::~ModelAPI_IReentrant() = default;
void ModelAPI_Object::attributeChanged(const std::string & /*theID*/) {}
-ModelAPI_Object::ModelAPI_Object() {}
+ModelAPI_Object::ModelAPI_Object() = default;
-ModelAPI_Object::~ModelAPI_Object() {}
+ModelAPI_Object::~ModelAPI_Object() = default;
void ModelAPI_Object::setData(std::shared_ptr<ModelAPI_Data> theData) {
myData = theData;
#include "ModelAPI_Plugin.h"
-ModelAPI_Plugin::~ModelAPI_Plugin() {}
+ModelAPI_Plugin::~ModelAPI_Plugin() = default;
#include <Events_Loop.h>
-ModelAPI_Result::~ModelAPI_Result() {}
+ModelAPI_Result::~ModelAPI_Result() = default;
void ModelAPI_Result::initAttributes() {
// append the color attribute. It is empty, the attribute will be filled by a
#include <ModelAPI_BodyBuilder.h>
#include <ModelAPI_Events.h>
-ModelAPI_ResultBody::ModelAPI_ResultBody() : myBuilder(0) {
+ModelAPI_ResultBody::ModelAPI_ResultBody() {
myConnect = ConnectionNotComputed;
}
-ModelAPI_ResultBody::~ModelAPI_ResultBody() {}
+ModelAPI_ResultBody::~ModelAPI_ResultBody() = default;
std::string ModelAPI_ResultBody::groupName() { return group(); }
/// Keeps (not persistently) the connected topology flag
ConnectedTopologyFlag myConnect;
- ModelAPI_BodyBuilder
- *myBuilder; ///< provides the body processing in naming shape
+ ModelAPI_BodyBuilder *myBuilder{
+ 0}; ///< provides the body processing in naming shape
public:
MODELAPI_EXPORT ~ModelAPI_ResultBody() override;
#include "ModelAPI_Events.h"
#include <Events_Loop.h>
-ModelAPI_ResultField::~ModelAPI_ResultField() {}
+ModelAPI_ResultField::~ModelAPI_ResultField() = default;
std::string ModelAPI_ResultField::groupName() { return group(); }
#include "ModelAPI_ResultGroup.h"
-ModelAPI_ResultGroup::~ModelAPI_ResultGroup() {}
+ModelAPI_ResultGroup::~ModelAPI_ResultGroup() = default;
std::string ModelAPI_ResultGroup::groupName() { return group(); }
#include "ModelAPI_ResultParameter.h"
-ModelAPI_ResultParameter::~ModelAPI_ResultParameter() {}
+ModelAPI_ResultParameter::~ModelAPI_ResultParameter() = default;
}
/// instance of the events creator, one pre application
-const ModelAPI_EventCreator *MY_API_CREATOR = 0;
+const ModelAPI_EventCreator *MY_API_CREATOR = nullptr;
const ModelAPI_EventCreator *ModelAPI_EventCreator::get() {
if (!MY_API_CREATOR) { // import Model library that implements this interface
theResultBody->storeModified(theBaseShapes, theResultShape, theMakeShape);
ListOfShape aShapes = theBaseShapes;
- ListOfShape::const_iterator aToolIter = theTools.cbegin();
+ auto aToolIter = theTools.cbegin();
for (; aToolIter != theTools.cend(); aToolIter++)
aShapes.push_back(*aToolIter);
void loadDeletedShapes(std::vector<ResultBaseAlgo> &theResultBaseAlgoList,
const ListOfShape &theTools,
const GeomShapePtr theResultShapesCompound) {
- for (std::vector<ResultBaseAlgo>::iterator anIt =
- theResultBaseAlgoList.begin();
- anIt != theResultBaseAlgoList.end(); ++anIt) {
- ResultBaseAlgo &aRCA = *anIt;
+ for (auto &aRCA : theResultBaseAlgoList) {
loadDeletedShapes(aRCA.resultBody, aRCA.baseShape, theTools, aRCA.makeShape,
theResultShapesCompound);
}
std::set<ResultPtr> &theCashedResults) {
std::list<ResultPtr> aResults;
ModelAPI_Tools::allSubs(theTopLevelResult, aResults, false);
- for (std::list<ResultPtr>::iterator aR = aResults.begin();
- aR != aResults.end(); ++aR) {
- theCashedResults.insert(*aR);
+ for (auto &aResult : aResults) {
+ theCashedResults.insert(aResult);
}
}
std::set<ResultPtr> &theCashedResults) {
// collect all results into a cashed set
if (theCashedResults.empty()) {
- std::list<ResultPtr>::const_iterator aRes = theResults.cbegin();
+ auto aRes = theResults.cbegin();
for (; aRes != theResults.cend(); aRes++) {
if (theCashedResults.count(*aRes))
continue;
continue;
GeomShapePtr aGroupResShape = aSelFeature->firstResult()->shape();
- std::set<ResultPtr>::iterator allResultsIter = theCashedResults.begin();
+ auto allResultsIter = theCashedResults.begin();
for (; allResultsIter != theCashedResults.end(); allResultsIter++) {
GeomShapePtr aResultShape = (*allResultsIter)->shape();
FeaturePtr aContextFeature = anAttr->contextFeature();
if (aContextFeature.get() && !aContextFeature->results().empty()) {
const std::list<ResultPtr> &allResluts = aContextFeature->results();
- std::list<ResultPtr>::const_iterator aResIter = allResluts.cbegin();
+ auto aResIter = allResluts.cbegin();
for (; aResIter != allResluts.cend(); aResIter++) {
if (aResIter->get() && theCashedResults.count(*aResIter))
return true;
if (aPartFeat.get()) {
const std::list<std::shared_ptr<ModelAPI_Result>> &aResList =
aPartFeat->results();
- std::list<std::shared_ptr<ModelAPI_Result>>::const_iterator aRes =
- aResList.begin();
+ auto aRes = aResList.begin();
for (; aRes != aResList.end(); aRes++) {
ResultPartPtr aPart =
std::dynamic_pointer_cast<ModelAPI_ResultPart>(*aRes);
if (theFeature.get() && theFeature->data() && theFeature->data()->isValid()) {
const std::set<std::shared_ptr<ModelAPI_Attribute>> &aRefs =
theFeature->data()->refsToMe();
- std::set<std::shared_ptr<ModelAPI_Attribute>>::const_iterator aRefIter =
- aRefs.begin();
+ auto aRefIter = aRefs.begin();
for (; aRefIter != aRefs.end(); aRefIter++) {
CompositeFeaturePtr aComp =
std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(
return;
const std::list<std::shared_ptr<ModelAPI_Result>> &aResults =
theFeature->results();
- std::list<ResultPtr>::const_iterator aRIter = aResults.begin();
+ auto aRIter = aResults.begin();
for (; aRIter != aResults.cend(); aRIter++) {
theResults.push_back(*aRIter);
ResultBodyPtr aResult =
bool removeFeatures(const std::set<FeaturePtr> &theFeatures,
const bool theFlushRedisplay) {
bool isDone = false;
- std::set<FeaturePtr>::const_iterator anIt = theFeatures.begin(),
- aLast = theFeatures.end();
+ auto anIt = theFeatures.begin(), aLast = theFeatures.end();
for (; anIt != aLast; anIt++) {
FeaturePtr aFeature = *anIt;
if (aFeature.get()) {
// references to it
std::set<FeaturePtr> aMainReferences = theReferencesMap.at(theFeature);
- std::set<FeaturePtr>::const_iterator anIt = aMainReferences.begin(),
- aLast = aMainReferences.end();
+ auto anIt = aMainReferences.begin(), aLast = aMainReferences.end();
for (; anIt != aLast; anIt++) {
FeaturePtr aRefFeature = *anIt;
if (theReferences.find(aRefFeature) == theReferences.end()) {
if (theRecLevel > RECURSE_TOP_LEVEL)
return;
theRecLevel++;
- std::set<FeaturePtr>::const_iterator anIt = theFeatures.begin(),
- aLast = theFeatures.end();
+ auto anIt = theFeatures.begin(), aLast = theFeatures.end();
for (; anIt != aLast; anIt++) {
FeaturePtr aFeature = *anIt;
if (aFeature.get() && theReferences.find(aFeature) == theReferences.end()) {
} else { // filter references to skip composition features of the current
// feature
std::set<FeaturePtr> aFilteredFeatures;
- std::set<FeaturePtr>::const_iterator aRefIt = aSelRefFeatures.begin(),
- aRefLast = aSelRefFeatures.end();
+ auto aRefIt = aSelRefFeatures.begin(), aRefLast = aSelRefFeatures.end();
for (; aRefIt != aRefLast; aRefIt++) {
FeaturePtr aCFeature = *aRefIt;
CompositeFeaturePtr aComposite =
<< getFeatureInfo(aMainListFeature)
<< ", references size = " << aSize << std::endl;
#endif
- std::set<FeaturePtr>::const_iterator anIt = aMainRefList.begin(),
- aLast = aMainRefList.end();
+ auto anIt = aMainRefList.begin(), aLast = aMainRefList.end();
std::set<FeaturePtr> aResultRefList;
aResultRefList.insert(aMainRefList.begin(), aMainRefList.end());
for (; anIt != aLast; anIt++) {
const std::set<FeaturePtr> &theFeatures,
const std::map<FeaturePtr, std::set<FeaturePtr>> &theReferences,
std::set<FeaturePtr> &theFeaturesRefsTo) {
- std::set<FeaturePtr>::const_iterator anIt = theFeatures.begin(),
- aLast = theFeatures.end();
+ auto anIt = theFeatures.begin(), aLast = theFeatures.end();
for (; anIt != aLast; anIt++) {
FeaturePtr aFeature = *anIt;
if (theReferences.find(aFeature) == theReferences.end())
continue;
std::set<FeaturePtr> aRefList = theReferences.at(aFeature);
- std::set<FeaturePtr>::const_iterator aRefIt = aRefList.begin(),
- aRefLast = aRefList.end();
+ auto aRefIt = aRefList.begin(), aRefLast = aRefList.end();
for (; aRefIt != aRefLast; aRefIt++) {
FeaturePtr aRefFeature = *aRefIt;
CompositeFeaturePtr aComposite =
// get the result number in the feature
int anIndexInOwner = 0;
const std::list<ResultPtr> &anOwnerResults = anOwner->results();
- std::list<ResultPtr>::const_iterator aResIt = anOwnerResults.cbegin();
+ auto aResIt = anOwnerResults.cbegin();
for (; aResIt != anOwnerResults.cend(); aResIt++) {
if (*aResIt == theResult)
break;
// store number of references for each object
std::map<ResultPtr, int> aNbRefToObject;
// search the object by result index
- std::list<ObjectPtr>::const_iterator anObjIt = aFoundRef->second.begin();
+ auto anObjIt = aFoundRef->second.begin();
int aResultIndex = anIndexInOwner;
while (--aResultIndex >= 0) {
ResultPtr aCurRes = std::dynamic_pointer_cast<ModelAPI_Result>(*anObjIt);
anObjRes->data()->name() != getDefaultName(anObjRes).first)) {
std::wstringstream aName;
aName << anObjRes->data()->name();
- std::map<ResultPtr, int>::iterator aFound =
- aNbRefToObject.find(anObjRes);
+ auto aFound = aNbRefToObject.find(anObjRes);
if (aFound != aNbRefToObject.end()) {
// to generate unique name, add suffix if there are several results
// referring to the same shape
for (FeaturePtr aCurFeat = theFeature; aCurFeat;) {
CompositeFeaturePtr aFoundComposite;
const std::set<AttributePtr> &aRefs = aCurFeat->data()->refsToMe();
- for (std::set<AttributePtr>::const_iterator anIt = aRefs.begin();
- anIt != aRefs.end(); ++anIt) {
- FeaturePtr aF = ModelAPI_Feature::feature((*anIt)->owner());
+ for (const auto &aRef : aRefs) {
+ FeaturePtr aF = ModelAPI_Feature::feature(aRef->owner());
aFoundComposite =
std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aF);
if (aFoundComposite && aFoundComposite->isSub(aCurFeat))
// collect all documents where the results must be removed
std::map<DocumentPtr, std::list<ResultPtr>> aDocs;
- std::list<ResultPtr>::const_iterator aResIter = theResults.cbegin();
+ auto aResIter = theResults.cbegin();
for (; aResIter != theResults.cend(); aResIter++) {
DocumentPtr aDoc = (*aResIter)->document();
if (!aDocs.count(aDoc))
aDocs[aDoc].push_back(*aResIter);
}
// create a "remove" feature in each doc
- std::map<DocumentPtr, std::list<ResultPtr>>::iterator aDoc = aDocs.begin();
+ auto aDoc = aDocs.begin();
for (; aDoc != aDocs.end(); aDoc++) {
FeaturePtr aRemove = aDoc->first->addFeature("RemoveResults");
if (aRemove) {
AttributeDoublePtr aDeflectionAttr =
theResult->data()->real(ModelAPI_Result::DEFLECTION_ID());
- if (aDeflectionAttr.get() != NULL) {
+ if (aDeflectionAttr.get() != nullptr) {
aDeflectionAttr->setValue(theDeflection);
}
}
double getDeflection(const std::shared_ptr<ModelAPI_Result> &theResult) {
double aDeflection = -1;
// get deflection from the attribute of the result
- if (theResult.get() != NULL &&
+ if (theResult.get() != nullptr &&
theResult->data()->attribute(ModelAPI_Result::DEFLECTION_ID()).get() !=
- NULL) {
+ nullptr) {
AttributeDoublePtr aDoubleAttr =
theResult->data()->real(ModelAPI_Result::DEFLECTION_ID());
if (aDoubleAttr.get() && aDoubleAttr->isInitialized()) {
AttributeIntArrayPtr aColorAttr =
theResult->data()->intArray(ModelAPI_Result::COLOR_ID());
- if (aColorAttr.get() != NULL) {
+ if (aColorAttr.get() != nullptr) {
if (!aColorAttr->size()) {
aColorAttr->setSize(3);
}
std::vector<int> &theColor) {
theColor.clear();
// get color from the attribute of the result
- if (theResult.get() != NULL &&
- theResult->data()->attribute(ModelAPI_Result::COLOR_ID()).get() != NULL) {
+ if (theResult.get() != nullptr &&
+ theResult->data()->attribute(ModelAPI_Result::COLOR_ID()).get() !=
+ nullptr) {
AttributeIntArrayPtr aColorAttr =
theResult->data()->intArray(ModelAPI_Result::COLOR_ID());
if (aColorAttr.get() && aColorAttr->size()) {
AttributeIntArrayPtr aAttr =
theResult->data()->intArray(ModelAPI_Result::ISO_LINES_ID());
- if (aAttr.get() != NULL) {
+ if (aAttr.get() != nullptr) {
if (!aAttr->size()) {
aAttr->setSize(2);
}
AttributeBooleanPtr aAttr =
theResult->data()->boolean(ModelAPI_Result::SHOW_ISO_LINES_ID());
- if (aAttr.get() != NULL) {
+ if (aAttr.get() != nullptr) {
aAttr->setValue(theShow);
}
}
AttributeBooleanPtr aAttr =
theResult->data()->boolean(ModelAPI_Result::SHOW_ISO_LINES_ID());
- if (aAttr.get() != NULL) {
+ if (aAttr.get() != nullptr) {
return aAttr->value();
}
return false;
AttributeBooleanPtr aAttr =
theResult->data()->boolean(ModelAPI_Result::SHOW_EDGES_DIRECTION_ID());
- if (aAttr.get() != NULL) {
+ if (aAttr.get() != nullptr) {
aAttr->setValue(theShow);
}
}
AttributeBooleanPtr aAttr =
theResult->data()->boolean(ModelAPI_Result::SHOW_EDGES_DIRECTION_ID());
- if (aAttr.get() != NULL) {
+ if (aAttr.get() != nullptr) {
return aAttr->value();
}
return false;
AttributeBooleanPtr aAttr =
theResult->data()->boolean(ModelAPI_Result::BRING_TO_FRONT_ID());
- if (aAttr.get() != NULL) {
+ if (aAttr.get() != nullptr) {
aAttr->setValue(theFlag);
}
}
AttributeBooleanPtr aAttr =
theResult->data()->boolean(ModelAPI_Result::BRING_TO_FRONT_ID());
- if (aAttr.get() != NULL) {
+ if (aAttr.get() != nullptr) {
return aAttr->value();
}
return false;
AttributeDoublePtr anAttribute =
theResult->data()->real(ModelAPI_Result::TRANSPARENCY_ID());
- if (anAttribute.get() != NULL) {
+ if (anAttribute.get() != nullptr) {
anAttribute->setValue(theTransparency);
}
}
double getTransparency(const std::shared_ptr<ModelAPI_Result> &theResult) {
double aTransparency = -1;
// get transparency from the attribute of the result
- if (theResult.get() != NULL &&
+ if (theResult.get() != nullptr &&
theResult->data()->attribute(ModelAPI_Result::TRANSPARENCY_ID()).get() !=
- NULL) {
+ nullptr) {
AttributeDoublePtr aDoubleAttr =
theResult->data()->real(ModelAPI_Result::TRANSPARENCY_ID());
if (aDoubleAttr.get() && aDoubleAttr->isInitialized()) {
std::dynamic_pointer_cast<ModelAPI_ResultBody>(theTarget);
if (aBody.get())
allSubs(aBody, allSubRes);
- std::list<ResultPtr>::iterator aSub = allSubRes.begin();
+ auto aSub = allSubRes.begin();
for (; aSub != allSubRes.end(); aSub++) {
const std::set<AttributePtr> &aRefs = (*aSub)->data()->refsToMe();
- std::set<AttributePtr>::const_iterator aRef = aRefs.cbegin();
+ auto aRef = aRefs.cbegin();
for (; aRef != aRefs.cend(); aRef++) {
FeaturePtr aFeat =
std::dynamic_pointer_cast<ModelAPI_Feature>((*aRef)->owner());
// add also feature of the target that may be referenced as a whole
FeaturePtr aTargetFeature = theTarget->document()->feature(theTarget);
const std::set<AttributePtr> &aRefs = aTargetFeature->data()->refsToMe();
- std::set<AttributePtr>::const_iterator aRef = aRefs.cbegin();
+ auto aRef = aRefs.cbegin();
for (; aRef != aRefs.cend(); aRef++) {
FeaturePtr aFeat =
std::dynamic_pointer_cast<ModelAPI_Feature>((*aRef)->owner());
if (theFeatureKind == "Group") {
std::set<FeaturePtr> aGroupOperations;
for (bool aNeedIterate = true; aNeedIterate;) {
- std::set<FeaturePtr>::iterator aResIter = aResSet.begin();
+ auto aResIter = aResSet.begin();
for (; aResIter != aResSet.end(); aResIter++) {
- std::list<ResultPtr>::const_iterator aGroupRes =
- (*aResIter)->results().cbegin();
+ auto aGroupRes = (*aResIter)->results().cbegin();
for (; aGroupRes != (*aResIter)->results().cend(); aGroupRes++) {
const std::set<AttributePtr> &aGroupRefs =
(*aGroupRes)->data()->refsToMe();
- std::set<AttributePtr>::const_iterator aRefIt = aGroupRefs.cbegin();
+ auto aRefIt = aGroupRefs.cbegin();
for (; aRefIt != aGroupRefs.cend(); aRefIt++) {
FeaturePtr aFeat =
std::dynamic_pointer_cast<ModelAPI_Feature>((*aRefIt)->owner());
// without theTarget shape
GeomShapePtr aTargetShape = theTarget->shape();
bool anIsIn = false;
- std::list<ResultPtr>::const_iterator anOpRes =
- aFeat->results().cbegin();
+ auto anOpRes = aFeat->results().cbegin();
for (; anOpRes != aFeat->results().cend() && !anIsIn; anOpRes++) {
GeomShapePtr anOpShape = (*anOpRes)->shape();
if (!anOpShape.get() || anOpShape->isNull())
// insert all new group operations into result and if they are, check for
// next dependencies
aNeedIterate = false;
- std::set<FeaturePtr>::iterator aGroupOpIter = aGroupOperations.begin();
+ auto aGroupOpIter = aGroupOperations.begin();
for (; aGroupOpIter != aGroupOperations.end(); aGroupOpIter++) {
if (aResSet.find(*aGroupOpIter) == aResSet.end()) {
aResSet.insert(*aGroupOpIter);
}
std::list<FeaturePtr> aResList;
- std::set<FeaturePtr>::iterator aResIter = aResSet.begin();
+ auto aResIter = aResSet.begin();
for (; aResIter != aResSet.end(); aResIter++) {
if (theSortResults) { // sort results by creation-order
- std::list<FeaturePtr>::iterator aListIter = aResList.begin();
+ auto aListIter = aResList.begin();
for (; aListIter != aResList.end(); aListIter++) {
if ((*aResIter)->document()->isLater(*aListIter, *aResIter))
break;
aPassedMoved; // all features and all moved before the current one
std::set<FeaturePtr> aPassedAfter; // all passed features after theAfter
bool anAfterIsPassed =
- theAfter.get() == 0; // flag that iterator already passed theAfter
+ theAfter.get() == nullptr; // flag that iterator already passed theAfter
std::list<FeaturePtr> allFeat = aDoc->allFeatures();
- for (std::list<FeaturePtr>::iterator aFeat = allFeat.begin();
- aFeat != allFeat.end(); aFeat++) {
+ for (auto &aFeat : allFeat) {
if (!anAfterIsPassed) {
- if (aMoved.count(*aFeat))
- aPassedMoved.insert(*aFeat);
+ if (aMoved.count(aFeat))
+ aPassedMoved.insert(aFeat);
else // check aPassedMoved are not referenced by the current feature
- aPassed.insert(*aFeat);
+ aPassed.insert(aFeat);
- anAfterIsPassed = *aFeat == theAfter;
+ anAfterIsPassed = aFeat == theAfter;
if (anAfterIsPassed &&
!aPassedMoved.empty()) { // check dependencies of moved relatively to
// the passed
std::map<FeaturePtr, std::set<FeaturePtr>> aReferences;
findAllReferences(aPassedMoved, aReferences);
- std::map<FeaturePtr, std::set<FeaturePtr>>::iterator aRefIter =
- aReferences.begin();
+ auto aRefIter = aReferences.begin();
for (; aRefIter != aReferences.end(); aRefIter++) {
if (aPassed.count(aRefIter->first)) {
aResult += topOwner(aRefIter->first)->name() + L" -> ";
// iterate all passed moved to check is it referenced by described
// feature or not
- std::set<FeaturePtr>::iterator aMovedIter = aPassedMoved.begin();
+ auto aMovedIter = aPassedMoved.begin();
for (; aMovedIter != aPassedMoved.end(); aMovedIter++) {
std::map<FeaturePtr, std::set<FeaturePtr>> aPassedRefs;
std::set<FeaturePtr> aMovedOne;
}
} else // iteration after theAfter
{
- if (aMoved.count(*aFeat)) { // check dependencies of moved relatively to
- // ones after theAfter
+ if (aMoved.count(aFeat)) { // check dependencies of moved relatively to
+ // ones after theAfter
std::map<FeaturePtr, std::set<FeaturePtr>> aReferences;
findAllReferences(aPassedAfter, aReferences);
- bool aFoundRef = aReferences.find(*aFeat) != aReferences.end();
- if (!aFoundRef && !(*aFeat)->results().empty()) // reference may be a
- // feature in moved part
+ bool aFoundRef = aReferences.find(aFeat) != aReferences.end();
+ if (!aFoundRef && !aFeat->results().empty()) // reference may be a
+ // feature in moved part
{
ResultPartPtr aFeatPart =
std::dynamic_pointer_cast<ModelAPI_ResultPart>(
- (*aFeat)->firstResult());
+ aFeat->firstResult());
if (aFeatPart.get() && aFeatPart->partDoc().get()) {
- std::map<FeaturePtr, std::set<FeaturePtr>>::iterator aRef =
- aReferences.begin();
+ auto aRef = aReferences.begin();
for (; aRef != aReferences.end() && !aFoundRef; aRef++)
aFoundRef = aRef->first->document() == aFeatPart->partDoc();
}
}
if (aFoundRef) {
- aResult += topOwner(*aFeat)->name() + L" -> ";
+ aResult += topOwner(aFeat)->name() + L" -> ";
std::set<FeaturePtr> aReferencedCount; // to avoid duplicates in the
// displayed references
// iterate all passed after theAfter to check refers it described
// feature or not
- FeaturePtr aFeatTop = topOwner(*aFeat);
- std::set<FeaturePtr>::iterator aPassedIter = aPassedAfter.begin();
+ FeaturePtr aFeatTop = topOwner(aFeat);
+ auto aPassedIter = aPassedAfter.begin();
for (; aPassedIter != aPassedAfter.end(); aPassedIter++) {
FeaturePtr aPassedTop = topOwner(*aPassedIter);
if (aReferencedCount.count(aPassedTop))
std::set<FeaturePtr> aPassedOne;
aPassedOne.insert(*aPassedIter);
findAllReferences(aPassedOne, aPassedRefs);
- std::map<FeaturePtr, std::set<FeaturePtr>>::iterator aPRIter =
- aPassedRefs.begin();
+ auto aPRIter = aPassedRefs.begin();
for (; aPRIter != aPassedRefs.end(); aPRIter++) {
FeaturePtr aPRTop = topOwner(aPRIter->first);
- if (aPRIter->first == *aFeat || aPRIter->first == aFeatTop ||
- aPRTop == *aFeat || aPRTop == aFeatTop) {
+ if (aPRIter->first == aFeat || aPRIter->first == aFeatTop ||
+ aPRTop == aFeat || aPRTop == aFeatTop) {
aResult += aPassedTop->name() + L" ";
aReferencedCount.insert(aPassedTop);
break;
aResult += L"\n";
}
} else {
- aPassedAfter.insert(*aFeat);
+ aPassedAfter.insert(aFeat);
}
}
}
if (aRefFeature->getKind() == theReferenceFeatureKind) {
std::list<AttributePtr> anAttributes =
aRefFeature->data()->attributes(ModelAPI_AttributeRefAttr::typeId());
- std::list<AttributePtr>::iterator anIter = anAttributes.begin(),
- aLast = anAttributes.end();
+ auto anIter = anAttributes.begin(), aLast = anAttributes.end();
bool isSkippedAttribute = false;
if (isSkipFeatureAttributes) {
for (anIter = anAttributes.begin();
if (aFeature.get()) {
const std::list<std::shared_ptr<ModelAPI_Result>> aResults =
aFeature->results();
- std::list<std::shared_ptr<ModelAPI_Result>>::const_iterator aRIter =
- aResults.begin();
+ auto aRIter = aResults.begin();
for (; aRIter != aResults.cend(); aRIter++) {
ResultPtr aResult = *aRIter;
getPointsOfReference(aResult, theReferenceFeatureKind, theAttributes,
aFeatureShape = (*anEdgeShapes.begin())->shape();
}
- std::list<std::shared_ptr<ModelAPI_Feature>>::const_iterator
- anIt = theFeatures.begin(),
- aLast = theFeatures.end();
+ auto anIt = theFeatures.begin(), aLast = theFeatures.end();
for (; anIt != aLast; anIt++) {
FeaturePtr aFeature = *anIt;
if (aFeature.get() == theBaseFeature.get())
#ifdef DEBUG_POINT_INSIDE_SHAPE
std::cout << "ModelGeomAlgo_Point2D::getPointsInsideShape:" << std::endl;
#endif
- std::set<std::shared_ptr<GeomDataAPI_Point2D>>::const_iterator
- anIt = theAttributes.begin(),
- aLast = theAttributes.end();
+ auto anIt = theAttributes.begin(), aLast = theAttributes.end();
for (; anIt != aLast; anIt++) {
std::shared_ptr<GeomDataAPI_Point2D> anAttribute = *anIt;
std::shared_ptr<GeomAPI_Pnt2d> aPnt2d = anAttribute->pnt();
std::list<std::shared_ptr<GeomAPI_Pnt>> &thePoints,
std::map<std::shared_ptr<GeomDataAPI_Point2D>, std::shared_ptr<GeomAPI_Pnt>>
&theAttributeToPoint) {
- std::set<std::shared_ptr<GeomDataAPI_Point2D>>::const_iterator
- anIt = theAttributes.begin(),
- aLast = theAttributes.end();
+ auto anIt = theAttributes.begin(), aLast = theAttributes.end();
for (; anIt != aLast; anIt++) {
std::shared_ptr<GeomDataAPI_Point2D> anAttribute = *anIt;
std::shared_ptr<GeomAPI_Pnt2d> aPnt2d = anAttribute->pnt();
/// to intersect with the base feature \param thePoints a container of 3D
/// points belong to the shape \param theObjectToPoint a container of object
/// to point
- typedef std::map<std::shared_ptr<GeomAPI_Pnt>,
- std::pair<std::list<std::shared_ptr<GeomDataAPI_Point2D>>,
- std::list<std::shared_ptr<ModelAPI_Object>>>>
- PointToRefsMap;
+ using PointToRefsMap =
+ std::map<std::shared_ptr<GeomAPI_Pnt>,
+ std::pair<std::list<std::shared_ptr<GeomDataAPI_Point2D>>,
+ std::list<std::shared_ptr<ModelAPI_Object>>>>;
static MODELGEOMALGO_EXPORT void getPointsIntersectedShape(
const std::shared_ptr<ModelAPI_Feature> &theBaseFeature,
std::set<ResultPtr> &theShapeResults) {
theShapeResults.clear();
std::list<ResultPtr> aResults = theFeature->results();
- std::list<ResultPtr>::const_iterator aRIter = aResults.cbegin();
+ auto aRIter = aResults.cbegin();
for (; aRIter != aResults.cend(); aRIter++) {
ResultPtr aResult = *aRIter;
GeomShapePtr aShape = aResult->shape();
static void appendSubshapeOfResult(std::list<SubshapeOfResult> &theList,
const ResultPtr &theResult,
const std::list<GeomShapePtr> &theSubshape) {
- for (std::list<GeomShapePtr>::const_iterator anIt = theSubshape.begin();
- anIt != theSubshape.end(); ++anIt)
- appendSubshapeOfResult(theList, theResult, *anIt);
+ for (const auto &anIt : theSubshape)
+ appendSubshapeOfResult(theList, theResult, anIt);
}
static bool
theSelected.clear();
const std::list<ResultPtr> &aResults = theFeature->results();
- for (std::list<ResultPtr>::const_iterator aResIt = aResults.begin();
- aResIt != aResults.end(); ++aResIt) {
+ for (const auto &aResult : aResults) {
bool isSubshapeFound = false;
- GeomShapePtr aCurShape = (*aResIt)->shape();
+ GeomShapePtr aCurShape = aResult->shape();
// first of all, check the point is within bounding box of the result
if (!aCurShape || !isPointWithinBB(thePoint, aCurShape, TOLERANCE))
continue;
std::dynamic_pointer_cast<GeomAPI_PlanarEdges>(aCurShape);
if (theShapeType != GeomAPI_Shape::COMPOUND || !aSketchEdges) {
ResultBodyPtr aCompSolid =
- std::dynamic_pointer_cast<ModelAPI_ResultBody>(*aResIt);
+ std::dynamic_pointer_cast<ModelAPI_ResultBody>(aResult);
if (aCompSolid) {
isSubshapeFound = findSubshapeInCompsolid(
aCompSolid, thePoint, theShapeType, TOLERANCE, theSelected);
std::list<GeomShapePtr> aSubshapes =
findSubShape(aCurShape, theShapeType, thePoint, TOLERANCE);
if (!aSubshapes.empty()) {
- appendSubshapeOfResult(theSelected, *aResIt, aSubshapes);
+ appendSubshapeOfResult(theSelected, aResult, aSubshapes);
isSubshapeFound = true;
}
}
// special case for ResultConstruction if the FACE is selected
ResultConstructionPtr aResConstr =
- std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aResIt);
+ std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aResult);
if (aResConstr && theShapeType >= GeomAPI_Shape::FACE) {
int aNbFaces = aResConstr->facesNum();
for (int aFaceInd = 0; aFaceInd < aNbFaces; ++aFaceInd) {
std::list<GeomShapePtr> aSubshapes =
findSubShape(aCurFace, theShapeType, thePoint, TOLERANCE);
if (!aSubshapes.empty()) {
- appendSubshapeOfResult(theSelected, *aResIt, aSubshapes);
+ appendSubshapeOfResult(theSelected, aResult, aSubshapes);
isSubshapeFound = true;
}
}
if (aSketchEdges && theShapeType == GeomAPI_Shape::COMPOUND &&
aSketchEdges->middlePoint()->distance(thePoint) < TOLERANCE) {
// select whole result
- appendSubshapeOfResult(theSelected, *aResIt, GeomShapePtr());
+ appendSubshapeOfResult(theSelected, aResult, GeomShapePtr());
continue;
}
GeomShapePtr aSubshape =
findEdgeByCenter(aCurShape, thePoint, TOLERANCE, aCenterType);
if (aSubshape) {
- appendSubshapeOfResult(theSelected, *aResIt, aSubshape, aCenterType);
+ appendSubshapeOfResult(theSelected, aResult, aSubshape, aCenterType);
continue;
}
}
for (int aSubInd = 0; aSubInd < aNbSubs; ++aSubInd) {
FeaturePtr aSub = aCF->subFeature(aSubInd);
const std::list<ResultPtr> &aSubResults = aSub->results();
- for (std::list<ResultPtr>::const_iterator aSRIt = aSubResults.begin();
- aSRIt != aSubResults.end(); ++aSRIt) {
- GeomShapePtr aCurShape = (*aSRIt)->shape();
+ for (const auto &aSubResult : aSubResults) {
+ GeomShapePtr aCurShape = aSubResult->shape();
std::list<GeomShapePtr> aSubshapes =
findSubShape(aCurShape, theShapeType, thePoint, TOLERANCE);
if (!aSubshapes.empty()) {
//--------------------------------------------------------------------------------------
ModelHighAPI_Double::ModelHighAPI_Double(double theValue)
- : myVariantType(VT_DOUBLE), myDouble(theValue) {}
+ : myDouble(theValue) {}
ModelHighAPI_Double::ModelHighAPI_Double(const std::wstring &theValue)
: myVariantType(VT_STRING), myString(theValue) {}
ModelHighAPI_Double::ModelHighAPI_Double(const wchar_t *theValue)
: myVariantType(VT_STRING), myString(theValue) {}
-ModelHighAPI_Double::~ModelHighAPI_Double() {}
+ModelHighAPI_Double::~ModelHighAPI_Double() = default;
double ModelHighAPI_Double::value() const {
// needed for array of double, which supports no text
MODELHIGHAPI_EXPORT virtual std::wstring string() const;
private:
- enum VariantType { VT_DOUBLE, VT_STRING } myVariantType;
+ enum VariantType { VT_DOUBLE, VT_STRING } myVariantType{VT_DOUBLE};
double myDouble;
std::wstring myString;
};
}
void mergeBuffer() {
- std::list<ModelHighAPI_Dumper::DumpStoragePtr>::iterator anIt =
- myStorageArray.begin();
+ auto anIt = myStorageArray.begin();
for (; anIt != myStorageArray.end(); ++anIt) {
// avoid multiple empty lines
std::string aBuf = (*anIt)->buffer().str();
if (myStorageArray.empty())
addStorage(DumpStoragePtr(new DumpStorage));
- std::list<ModelHighAPI_Dumper::DumpStoragePtr>::iterator anIt =
- myStorageArray.begin();
+ auto anIt = myStorageArray.begin();
for (; anIt != myStorageArray.end(); ++anIt)
(*anIt)->buffer() << theValue;
}
write(anOutput.str());
}
- virtual void
- write(const std::shared_ptr<ModelAPI_AttributeSelection> &theAttrSelect) {
+ void write(const std::shared_ptr<ModelAPI_AttributeSelection> &theAttrSelect)
+ override {
if (myStorageArray.empty())
addStorage(DumpStoragePtr(new DumpStorage));
- std::list<ModelHighAPI_Dumper::DumpStoragePtr>::iterator anIt =
- myStorageArray.begin();
+ auto anIt = myStorageArray.begin();
for (; anIt != myStorageArray.end(); ++anIt)
(*anIt)->write(theAttrSelect);
}
- virtual void reserveBuffer() {
- std::list<ModelHighAPI_Dumper::DumpStoragePtr>::iterator anIt =
- myStorageArray.begin();
+ void reserveBuffer() override {
+ auto anIt = myStorageArray.begin();
for (; anIt != myStorageArray.end(); ++anIt)
(*anIt)->reserveBuffer();
}
- virtual void restoreReservedBuffer() {
- std::list<ModelHighAPI_Dumper::DumpStoragePtr>::iterator anIt =
- myStorageArray.begin();
+ void restoreReservedBuffer() override {
+ auto anIt = myStorageArray.begin();
for (; anIt != myStorageArray.end(); ++anIt)
(*anIt)->restoreReservedBuffer();
}
- virtual bool exportTo(const std::string &theFilename,
- const ModulesSet &theUsedModules) {
+ bool exportTo(const std::string &theFilename,
+ const ModulesSet &theUsedModules) override {
static const std::string THE_EXT = ".py";
std::string aFilenameBase = theFilename;
if (aFilenameBase.rfind(THE_EXT) == aFilenameBase.size() - THE_EXT.size())
aFilenameBase.substr(0, aFilenameBase.size() - THE_EXT.size());
bool isOk = true;
- std::list<ModelHighAPI_Dumper::DumpStoragePtr>::iterator anIt =
- myStorageArray.begin();
+ auto anIt = myStorageArray.begin();
for (; anIt != myStorageArray.end(); ++anIt) {
std::string aFilename =
aFilenameBase + (*anIt)->myFilenameSuffix + THE_EXT;
return false;
// standard header imported modules
- for (ModulesSet::const_iterator aModIt = theUsedModules.begin();
- aModIt != theUsedModules.end(); ++aModIt) {
- aFile << "from " << *aModIt << " import *" << std::endl;
+ for (const auto &theUsedModule : theUsedModules) {
+ aFile << "from " << theUsedModule << " import *" << std::endl;
}
if (!theUsedModules.empty())
aFile << std::endl;
// Find the position of the part, where its features should be inserted.
// It will avoid checking of appropriate elements in partSet after the
// current part.
- std::list<FeaturePtr>::iterator aFIt = aFeatures.begin();
+ auto aFIt = aFeatures.begin();
for (; aFIt != aFeatures.end(); ++aFIt) {
ResultPartPtr aPartRes =
std::dynamic_pointer_cast<ModelAPI_ResultPart>((*aFIt)->lastResult());
*aFIt, thePoint, theShape->shapeType(), anApproproate)) {
bool isContinue = true;
std::list<std::pair<GeomShapePtr, int>> aCenters;
- std::list<ModelGeomAlgo_Shape::SubshapeOfResult>::iterator anApIt =
- anApproproate.begin();
+ auto anApIt = anApproproate.begin();
for (; anApIt != anApproproate.end() && isContinue; ++anApIt) {
++aNbPossibleSelections;
static int gCompositeStackDepth = 0;
-ModelHighAPI_Dumper *ModelHighAPI_Dumper::mySelf = 0;
+ModelHighAPI_Dumper *ModelHighAPI_Dumper::mySelf = nullptr;
ModelHighAPI_Dumper::ModelHighAPI_Dumper()
- : myDumpStorage(new DumpStorageBuffer), myDumpPostponedInProgress(false) {}
+ : myDumpStorage(new DumpStorageBuffer) {}
ModelHighAPI_Dumper::~ModelHighAPI_Dumper() { delete myDumpStorage; }
void ModelHighAPI_Dumper::setInstance(ModelHighAPI_Dumper *theDumper) {
- if (mySelf == 0)
+ if (mySelf == nullptr)
mySelf = theDumper;
}
bool theSaveNotDumped,
bool theUseEntityName,
bool theSetIsDumped) {
- EntityNameMap::iterator aFound = myNames.find(theEntity);
+ auto aFound = myNames.find(theEntity);
if (aFound != myNames.end()) {
// Set dumped flag for postponed constraints which are without names
if (!aFound->second.myIsDumped)
int aFullIndex = 0;
NbFeaturesMap::const_iterator aFIt = myFeatureCount.begin();
for (; aFIt != myFeatureCount.end(); ++aFIt) {
- std::map<std::string, std::pair<int, int>>::const_iterator aFoundKind =
- aFIt->second.find(aKind);
+ auto aFoundKind = aFIt->second.find(aKind);
if (aFoundKind != aFIt->second.end())
aFullIndex += aFoundKind->second.first;
}
const std::string &
ModelHighAPI_Dumper::parentName(const FeaturePtr &theEntity) {
const std::set<AttributePtr> &aRefs = theEntity->data()->refsToMe();
- std::set<AttributePtr>::const_iterator aRefIt = aRefs.begin();
+ auto aRefIt = aRefs.begin();
for (; aRefIt != aRefs.end(); ++aRefIt) {
CompositeFeaturePtr anOwner =
std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(
// Save only names of results which is not correspond to default feature name
std::list<ResultPtr> allRes;
ModelAPI_Tools::allResults(theFeature, allRes);
- for (std::list<ResultPtr>::iterator aRes = allRes.begin();
- aRes != allRes.end(); aRes++) {
+ for (auto &allRe : allRes) {
std::pair<std::wstring, bool> aName =
- ModelAPI_Tools::getDefaultName(*aRes, true, true);
+ ModelAPI_Tools::getDefaultName(allRe, true, true);
std::string aDefaultName = Locale::Convert::toString(aName.first);
- std::string aResName = Locale::Convert::toString((*aRes)->data()->name());
+ std::string aResName = Locale::Convert::toString(allRe->data()->name());
bool isUserDefined = !(isFeatureDefaultName && aDefaultName == aResName);
- myNames[*aRes] = EntityName(
+ myNames[allRe] = EntityName(
aResName, (isUserDefined ? aResName : std::string()), !isUserDefined);
}
}
// iteratively process composite features,
// if the composite feature is the last in the document, no need to dump
// "model.do()" action
- std::list<ObjectPtr>::const_iterator aNext = anObjIt;
+ auto aNext = anObjIt;
isOk = process(aCompFeat, false, ++aNext != anObjects.end()) && isOk;
} else if (!isDumped(EntityPtr(*anObjIt))) {
// dump folder
// store results if they have user-defined names or colors
std::list<ResultPtr> aResultsWithNameOrColor;
const std::list<ResultPtr> &aResults = theSubFeature->results();
- std::list<ResultPtr>::const_iterator aResIt = aResults.begin();
+ auto aResIt = aResults.begin();
for (; aResIt != aResults.end(); ++aResIt) {
std::string aResName = Locale::Convert::toString((*aResIt)->data()->name());
myNames[*aResIt] = EntityName(aResName, aResName, false);
anEntityNames.myIsDefault = true;
}
// dump "setName" for results
- std::list<ResultPtr>::const_iterator aResIt = aLastDumped.myResults.begin();
- std::list<ResultPtr>::const_iterator aResEnd = aLastDumped.myResults.end();
+ auto aResIt = aLastDumped.myResults.begin();
+ auto aResEnd = aLastDumped.myResults.end();
for (; aResIt != aResEnd; ++aResIt) {
// set result name
EntityName &anEntityNames = myNames[*aResIt];
}
bool ModelHighAPI_Dumper::isDumped(const EntityPtr &theEntity) const {
- EntityNameMap::const_iterator aFound = myNames.find(theEntity);
+ auto aFound = myNames.find(theEntity);
FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theEntity);
return (aFound != myNames.end() && aFound->second.myIsDumped) ||
myFeaturesToSkip.find(aFeature) != myFeaturesToSkip.end();
bool ModelHighAPI_Dumper::isDumped(
const AttributeRefListPtr &theRefList) const {
std::list<ObjectPtr> aRefs = theRefList->list();
- std::list<ObjectPtr>::iterator anIt = aRefs.begin();
+ auto anIt = aRefs.begin();
for (; anIt != aRefs.end(); ++anIt) {
FeaturePtr aFeature = ModelAPI_Feature::feature(*anIt);
if (aFeature && !isDumped(EntityPtr(aFeature)))
std::list<ResultPtr> aResultsWithNameOrColor;
std::list<ResultPtr> allRes;
ModelAPI_Tools::allResults(theEntity, allRes);
- for (std::list<ResultPtr>::iterator aRes = allRes.begin();
- aRes != allRes.end(); aRes++) {
- if (!myNames[*aRes].myIsDefault || !isDefaultColor(*aRes) ||
- !isDefaultDeflection(*aRes) || !isDefaultTransparency(*aRes))
- aResultsWithNameOrColor.push_back(*aRes);
+ for (auto &allRe : allRes) {
+ if (!myNames[allRe].myIsDefault || !isDefaultColor(allRe) ||
+ !isDefaultDeflection(allRe) || !isDefaultTransparency(allRe))
+ aResultsWithNameOrColor.push_back(allRe);
}
// store just dumped entity to stack
if (myEntitiesStack.empty() || myEntitiesStack.top().myEntity != theEntity)
if (aParent) {
anIndices.push_front(ModelAPI_Tools::bodyIndex(aCurRes));
} else { // index of the result in the feature
- std::list<ResultPtr>::const_iterator aRes = aFeature->results().cbegin();
+ auto aRes = aFeature->results().cbegin();
for (int anIndex = 0; aRes != aFeature->results().cend();
aRes++, anIndex++) {
if (*aRes == aCurRes) {
}
*myDumpStorage << name(aFeature);
- for (std::list<int>::iterator anI = anIndices.begin(); anI != anIndices.end();
- anI++) {
+ for (auto anI = anIndices.begin(); anI != anIndices.end(); anI++) {
if (anI == anIndices.begin()) {
if (*anI == 0) {
*myDumpStorage << ".result()";
ModelHighAPI_Dumper &
ModelHighAPI_Dumper::operator<<(const std::list<ResultPtr> &theResults) {
*this << "[";
- for (std::list<ResultPtr>::const_iterator anIt = theResults.begin();
- anIt != theResults.end(); ++anIt) {
+ for (auto anIt = theResults.begin(); anIt != theResults.end(); ++anIt) {
if (anIt != theResults.begin())
*this << ", ";
*this << *anIt;
anOwner->data()->attributes(ModelAPI_AttributeSelectionList::typeId());
if (aSelLists.size() > 1) {
int anIndex = 1;
- for (std::list<AttributePtr>::iterator aSIt = aSelLists.begin();
- aSIt != aSelLists.end(); ++aSIt, ++anIndex)
+ for (auto aSIt = aSelLists.begin(); aSIt != aSelLists.end();
+ ++aSIt, ++anIndex)
if ((*aSIt).get() == theAttrSelList.get())
break;
std::ostringstream aSStream;
std::set<EntityPtr> aNotDumped = theDumper.myNotDumpedEntities;
theDumper.clearNotDumped();
theDumper.myDumpStorage->reserveBuffer();
- std::set<EntityPtr>::const_iterator anIt = aNotDumped.begin();
+ auto anIt = aNotDumped.begin();
for (; anIt != aNotDumped.end(); ++anIt) {
// if the feature is composite, dump it with all subs
CompositeFeaturePtr aCompFeat =
AttributeBooleanPtr aCopyAttr = aFeature->boolean("Copy");
if (aCopyAttr.get() && aCopyAttr->value()) {
const std::set<AttributePtr> &aRefs = aFeature->data()->refsToMe();
- std::set<AttributePtr>::iterator aRefIt = aRefs.begin();
+ auto aRefIt = aRefs.begin();
for (; aRefIt != aRefs.end(); ++aRefIt)
if ((*aRefIt)->id() ==
"ProjectedFeature") { // process projection only
void ModelHighAPI_Dumper::exportVariables() const {
DocumentPtr aRoot = ModelAPI_Session::get()->moduleDocument();
- EntityNameMap::const_iterator aNameIter = myNames.cbegin();
+ auto aNameIter = myNames.cbegin();
for (; aNameIter != myNames.end(); aNameIter++) {
FeaturePtr aFeature =
std::dynamic_pointer_cast<ModelAPI_Feature>(aNameIter->first);
MODELHIGHAPI_EXPORT void dumpEntitySetName();
private:
- ModelHighAPI_Dumper(const ModelHighAPI_Dumper &);
- const ModelHighAPI_Dumper &operator=(const ModelHighAPI_Dumper &);
+ ModelHighAPI_Dumper(const ModelHighAPI_Dumper &) = delete;
+ const ModelHighAPI_Dumper &operator=(const ModelHighAPI_Dumper &) = delete;
/// Iterate all features in document and dump them into intermediate buffer
bool process(const std::shared_ptr<ModelAPI_Document> &theDoc);
std::list<EntityPtr> myPostponed; ///< list of postponed entities (sketch
///< constraints or folders)
- bool myDumpPostponedInProgress; ///< processing postponed is in progress
+ bool myDumpPostponedInProgress{
+ false}; ///< processing postponed is in progress
std::string myDumpDir;
// iterate results to store
std::list<ResultPtr> allResults;
ModelAPI_Tools::allResults(aFeature, allResults);
- std::list<ResultPtr>::iterator aRes = allResults.begin();
+ auto aRes = allResults.begin();
for (; aRes != allResults.end(); aRes++) {
std::map<std::string, std::string> aResDump;
storeData((*aRes)->data(), aResDump);
if (aFeature) {
std::list<ResultPtr> allResults;
ModelAPI_Tools::allResults(aFeature, allResults);
- std::list<ResultPtr>::iterator aRes = allResults.begin();
- std::list<std::map<std::string, std::string>>::iterator aResIter =
- myRes.begin();
+ auto aRes = allResults.begin();
+ auto aResIter = myRes.begin();
for (; aRes != allResults.end() && aResIter != myRes.end();
aRes++, aResIter++) {
anError = compareData((*aRes)->data(), *aResIter);
theAttrs["__name__"] = Locale::Convert::toString(theData->name());
std::list<std::shared_ptr<ModelAPI_Attribute>> allAttrs =
theData->attributes("");
- std::list<std::shared_ptr<ModelAPI_Attribute>>::iterator anAttr =
- allAttrs.begin();
+ auto anAttr = allAttrs.begin();
for (; anAttr != allAttrs.end(); anAttr++) {
theAttrs[(*anAttr)->id()] = dumpAttr(*anAttr);
}
std::map<std::string, std::string> &theAttrs) {
std::map<std::string, std::string> aThis;
storeData(theData, aThis);
- std::map<std::string, std::string>::iterator aThisIter = aThis.begin();
+ auto aThisIter = aThis.begin();
for (; aThisIter != aThis.end(); aThisIter++) {
if (theAttrs.find(aThisIter->first) == theAttrs.end()) {
return "original model had no attribute '" + aThisIter->first + "'";
}
}
// iterate back to find lack attribute in the current model
- std::map<std::string, std::string>::iterator anOrigIter = theAttrs.begin();
+ auto anOrigIter = theAttrs.begin();
for (; anOrigIter != theAttrs.end(); anOrigIter++) {
if (aThis.find(anOrigIter->first) == aThis.end()) {
return "current model had no attribute '" + anOrigIter->first + "'";
->getKind() == "Sketch";
std::list<ObjectPtr> aList = anAttr->list();
std::list<std::string> aResList; // list of resulting strings
- for (std::list<ObjectPtr>::iterator aL = aList.begin(); aL != aList.end();
- aL++) {
- if (aL->get()) {
+ for (auto &aL : aList) {
+ if (aL.get()) {
if (isSketchFeatures) {
// do not control construction features of an ellipse and other
- FeaturePtr aFeature = ModelAPI_Feature::feature(*aL);
+ FeaturePtr aFeature = ModelAPI_Feature::feature(aL);
// if (aFeature->getKind() == "SketchConstraintCoincidenceInternal")
// continue; // skip internal constraints
std::string aStr = aFeature->getKind().substr(0, 16);
if (aStr == "SketchConstraint")
continue; // no need to dump and check constraints
}
- aResList.push_back(Locale::Convert::toString((*aL)->data()->name()));
+ aResList.push_back(Locale::Convert::toString(aL->data()->name()));
} else if (!isSketchFeatures) {
aResList.push_back("__empty__");
}
}
if (isSketchFeatures)
aResList.sort();
- for (std::list<std::string>::iterator aR = aResList.begin();
- aR != aResList.end(); aR++) {
- aResult << *aR << " ";
+ for (auto &aR : aResList) {
+ aResult << aR << " ";
}
} else if (aType == ModelAPI_AttributeRefAttrList::typeId()) {
AttributeRefAttrListPtr anAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeRefAttrList>(theAttr);
std::list<std::pair<ObjectPtr, AttributePtr>> aList = anAttr->list();
- std::list<std::pair<ObjectPtr, AttributePtr>>::iterator aL = aList.begin();
+ auto aL = aList.begin();
for (; aL != aList.end(); aL++) {
if (aL != aList.begin())
aResult << " ";
class ModelAPI_Attribute;
typedef std::shared_ptr<ModelAPI_Object> ObjectPtr;
-typedef std::shared_ptr<ModelAPI_Attribute> AttributePtr;
+using AttributePtr = std::shared_ptr<ModelAPI_Attribute>;
/**\class ModelHighAPI_FeatureStore
* \ingroup CPPHighAPI
public:
// unused constructor for the map container needs
- ModelHighAPI_FeatureStore() {}
+ ModelHighAPI_FeatureStore() = default;
// constructor that initializes this object by feature to store
ModelHighAPI_FeatureStore(ObjectPtr theObject);
// compares the stored feature information with the given feature
initialize();
}
-ModelHighAPI_Folder::~ModelHighAPI_Folder() {}
+ModelHighAPI_Folder::~ModelHighAPI_Folder() = default;
bool ModelHighAPI_Folder::initialize() {
if (!myFolder) {
explicit ModelHighAPI_Folder(
const std::shared_ptr<ModelAPI_Folder> &theFolder);
/// Destructor
- MODELHIGHAPI_EXPORT virtual ~ModelHighAPI_Folder();
+ MODELHIGHAPI_EXPORT ~ModelHighAPI_Folder() override;
static std::string ID() { return ModelAPI_Folder::ID(); }
virtual std::string getID() { return ID(); }
// MODELHIGHAPI_EXPORT void execute();
/// Dump wrapped feature
- MODELHIGHAPI_EXPORT virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ MODELHIGHAPI_EXPORT void dump(ModelHighAPI_Dumper &theDumper) const override;
protected:
bool initialize();
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
-ModelHighAPI_Integer::ModelHighAPI_Integer(int theValue)
- : myVariantType(VT_INT), myInt(theValue) {}
+ModelHighAPI_Integer::ModelHighAPI_Integer(int theValue) : myInt(theValue) {}
ModelHighAPI_Integer::ModelHighAPI_Integer(const std::wstring &theValue)
: myVariantType(VT_STRING), myString(theValue) {}
ModelHighAPI_Integer::ModelHighAPI_Integer(const wchar_t *theValue)
: myVariantType(VT_STRING), myString(theValue) {}
-ModelHighAPI_Integer::~ModelHighAPI_Integer() {}
+ModelHighAPI_Integer::~ModelHighAPI_Integer() = default;
//--------------------------------------------------------------------------------------
void ModelHighAPI_Integer::fillAttribute(
MODELHIGHAPI_EXPORT virtual std::wstring string() const;
private:
- enum VariantType { VT_INT, VT_STRING } myVariantType;
+ enum VariantType { VT_INT, VT_STRING } myVariantType{VT_INT};
int myInt;
std::wstring myString;
};
#include <ModelAPI_Feature.h>
#include <ModelAPI_Result.h>
//--------------------------------------------------------------------------------------
-ModelHighAPI_RefAttr::ModelHighAPI_RefAttr() : myVariantType(VT_OBJECT) {}
+ModelHighAPI_RefAttr::ModelHighAPI_RefAttr() {}
ModelHighAPI_RefAttr::ModelHighAPI_RefAttr(
const std::shared_ptr<ModelAPI_Attribute> &theValue)
: myVariantType(VT_OBJECT),
myObject(std::shared_ptr<ModelAPI_Object>(theValue->defaultResult())) {}
-ModelHighAPI_RefAttr::~ModelHighAPI_RefAttr() {}
+ModelHighAPI_RefAttr::~ModelHighAPI_RefAttr() = default;
//--------------------------------------------------------------------------------------
void ModelHighAPI_RefAttr::fillAttribute(
std::shared_ptr<ModelAPI_Object> object() const { return myObject; }
private:
- enum VariantType { VT_ATTRIBUTE, VT_OBJECT } myVariantType;
+ enum VariantType { VT_ATTRIBUTE, VT_OBJECT } myVariantType{VT_OBJECT};
std::shared_ptr<ModelAPI_Attribute> myAttribute;
std::shared_ptr<ModelAPI_Object> myObject;
};
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
-ModelHighAPI_Selection::ModelHighAPI_Selection() : myVariantType(VT_Empty) {}
+ModelHighAPI_Selection::ModelHighAPI_Selection() {}
ModelHighAPI_Selection::ModelHighAPI_Selection(
const std::shared_ptr<ModelAPI_Result> &theContext,
: myVariantType(VT_TypeInnerPointPair) {
double aCoordinates[3] = {0.0, 0.0, 0.0};
double *aCIt = aCoordinates;
- std::list<double>::const_iterator aPIt = theSubShapeInnerPoint.begin();
+ auto aPIt = theSubShapeInnerPoint.begin();
for (; aPIt != theSubShapeInnerPoint.end(); ++aPIt, ++aCIt)
*aCIt = *aPIt;
std::pair<std::wstring, int>(theContextName, theIndex)) {
}
-ModelHighAPI_Selection::~ModelHighAPI_Selection() {}
+ModelHighAPI_Selection::~ModelHighAPI_Selection() = default;
//--------------------------------------------------------------------------------------
void ModelHighAPI_Selection::fillAttribute(
ModelHighAPI_Selection subResult(int theIndex) const;
protected:
- VariantType myVariantType;
+ VariantType myVariantType{VT_Empty};
ResultSubShapePair myResultSubShapePair;
TypeSubShapeNamePair myTypeSubShapeNamePair;
TypeInnerPointPair myTypeInnerPointPair;
const std::list<ModelHighAPI_RefAttr> &theValue,
const std::shared_ptr<ModelAPI_AttributeRefAttrList> &theAttribute) {
theAttribute->clear();
- for (auto it = theValue.begin(); it != theValue.end(); ++it)
- it->appendToList(theAttribute);
+ for (const auto &it : theValue)
+ it.appendToList(theAttribute);
}
//--------------------------------------------------------------------------------------
const std::list<ModelHighAPI_Reference> &theValue,
const std::shared_ptr<ModelAPI_AttributeRefList> &theAttribute) {
theAttribute->clear();
- for (auto it = theValue.begin(); it != theValue.end(); ++it)
- it->appendToList(theAttribute);
+ for (const auto &it : theValue)
+ it.appendToList(theAttribute);
}
//--------------------------------------------------------------------------------------
const std::list<ModelHighAPI_Selection> &theValue,
const std::shared_ptr<ModelAPI_AttributeRefList> &theAttribute) {
theAttribute->clear();
- for (auto it = theValue.begin(); it != theValue.end(); ++it) {
- if (it->resultSubShapePair().first)
- theAttribute->append(it->resultSubShapePair().first); // use only context
+ for (const auto &it : theValue) {
+ if (it.resultSubShapePair().first)
+ theAttribute->append(it.resultSubShapePair().first); // use only context
}
}
theAttribute->setSelectionType(strByShapeType(aSelectionType));
}
- for (auto it = theValue.begin(); it != theValue.end(); ++it)
- it->appendToList(theAttribute);
+ for (const auto &it : theValue)
+ it.appendToList(theAttribute);
}
//--------------------------------------------------------------------------------------
// process all objects (features and folders)
std::list<ObjectPtr> allObjects = theDoc->allObjects();
- std::list<ObjectPtr>::iterator allIter = allObjects.begin();
+ auto allIter = allObjects.begin();
for (; allIter != allObjects.end(); allIter++) {
ObjectPtr anObject = *allIter;
FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(anObject);
continue; // no need to dump and check constraints
}
if (theCompare) {
- std::map<std::wstring, ModelHighAPI_FeatureStore>::iterator anObjFind =
- aDocFind->second.find(anObject->data()->name());
+ auto anObjFind = aDocFind->second.find(anObject->data()->name());
if (anObjFind == aDocFind->second.end()) {
return "Document '" + Locale::Convert::toString(theDocName) +
"' feature '" +
// iterate all results of this feature
std::list<ResultPtr> allResults;
ModelAPI_Tools::allResults(aFeature, allResults);
- std::list<ResultPtr>::iterator aRes = allResults.begin();
+ auto aRes = allResults.begin();
for (; aRes != allResults.end(); aRes++) {
// recursively store features of sub-documents
if ((*aRes)->groupName() == ModelAPI_ResultPart::group()) {
text = theText;
}
-ModuleBase_ActionInfo::~ModuleBase_ActionInfo() {}
+ModuleBase_ActionInfo::~ModuleBase_ActionInfo() = default;
void ModuleBase_ActionInfo::initFrom(QAction *theAction) {
// By convenience, QAction for a feature keeps feature's id as data
int myVal;
};
-typedef std::shared_ptr<ModuleBase_ActionIntParameter> ActionIntParamPtr;
+using ActionIntParamPtr = std::shared_ptr<ModuleBase_ActionIntParameter>;
#endif
/// \param aPM a presentations manager
/// \param theStyle a style of presentation
/// \param theMode a drawing mode
- virtual void HilightWithColor(const Handle(PrsMgr_PresentationManager3d) &
- aPM,
- const Handle(Prs3d_Drawer) & theStyle,
- const Standard_Integer /*theMode*/ = 0) {
+ void HilightWithColor(const Handle(PrsMgr_PresentationManager3d) & aPM,
+ const Handle(Prs3d_Drawer) & theStyle,
+ const Standard_Integer /*theMode*/ = 0) override {
Selectable()->HilightOwnerWithColor(aPM, theStyle, this);
}
ControlType theType,
Qt::Orientation theButtonsDir)
: QWidget(theParent), myType(theType) {
- QHBoxLayout *aLayout = new QHBoxLayout(this);
+ auto *aLayout = new QHBoxLayout(this);
aLayout->setContentsMargins(0, 0, 0, 0);
switch (myType) {
myGroupBox = new QGroupBox("", this);
aLayout->addWidget(myGroupBox);
- QLayout *aBtnLayout = 0;
+ QLayout *aBtnLayout = nullptr;
switch (theButtonsDir) {
case Qt::Horizontal:
aBtnLayout = new QHBoxLayout(myGroupBox);
if (theIconsList.length() == theChoiceList.length()) {
int aId = 0;
foreach (QString aBtnTxt, theChoiceList) {
- QToolButton *aBtn = new QToolButton(myGroupBox);
+ auto *aBtn = new QToolButton(myGroupBox);
aBtn->setFocusPolicy(Qt::StrongFocus);
aBtn->setCheckable(true);
aBtn->setToolTip(aBtnTxt);
} else {
int aId = 0;
foreach (QString aBtnTxt, theChoiceList) {
- QRadioButton *aBtn = new QRadioButton(aBtnTxt, myGroupBox);
+ auto *aBtn = new QRadioButton(aBtnTxt, myGroupBox);
aBtnLayout->addWidget(aBtn);
myButtons->addButton(aBtn, aId++);
}
: QDialog(theParent->desktop(), Qt::Dialog | Qt::CustomizeWindowHint |
Qt::WindowTitleHint |
Qt::WindowCloseButtonHint),
- myDescription(theDescription), myWorkshop(theParent), myActiveWidget(0) {
+ myDescription(theDescription), myWorkshop(theParent),
+ myActiveWidget(nullptr) {
Config_WidgetAPI aApi(myDescription, "");
myId = aApi.getProperty("id");
Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_CREATED));
Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
- QVBoxLayout *aLayout = new QVBoxLayout(this);
+ auto *aLayout = new QVBoxLayout(this);
aLayout->setContentsMargins(0, 0, 0, 0);
aLayout->setSpacing(1);
- ModuleBase_PageWidget *aPage = new ModuleBase_PageWidget(this);
+ auto *aPage = new ModuleBase_PageWidget(this);
aLayout->addWidget(aPage);
aFactory.createWidget(aPage, false);
myWidgets = aFactory.getModelWidgets();
- QFrame *aFrame = new QFrame(this);
+ auto *aFrame = new QFrame(this);
aFrame->setFrameStyle(QFrame::WinPanel | QFrame::Raised);
aLayout->addWidget(aFrame);
- QHBoxLayout *aBtnLayout = new QHBoxLayout(aFrame);
+ auto *aBtnLayout = new QHBoxLayout(aFrame);
ModuleBase_Tools::adjustMargins(aBtnLayout);
myButtonsBox = new QDialogButtonBox(
}
void ModuleBase_Dialog::initializeWidget(ModuleBase_ModelWidget *theWidget) {
- ModuleBase_ModelDialogWidget *aDlgWgt =
- dynamic_cast<ModuleBase_ModelDialogWidget *>(theWidget);
+ auto *aDlgWgt = dynamic_cast<ModuleBase_ModelDialogWidget *>(theWidget);
if (aDlgWgt)
aDlgWgt->setDialogButtons(myButtonsBox);
const std::string &theDescription);
/// Redefinition of virtual method
- virtual void accept();
+ void accept() override;
protected:
/// Redefinition of virtual method
- virtual void showEvent(QShowEvent *theEvent);
+ void showEvent(QShowEvent *theEvent) override;
private slots:
void onHelpRequest();
*/
ModuleBase_DoubleSpinBox::ModuleBase_DoubleSpinBox(QWidget *theParent,
int thePrecision)
- : QDoubleSpinBox(theParent), myCleared(false) {
+ : QDoubleSpinBox(theParent) {
setLocale(ModuleBase_Tools::doubleLocale());
// MPV 15/09/2014: this must be set before setDecimals;
/*!
\brief Destructor.
*/
-ModuleBase_DoubleSpinBox::~ModuleBase_DoubleSpinBox() {}
+ModuleBase_DoubleSpinBox::~ModuleBase_DoubleSpinBox() = default;
/*!
\brief Check if spin box is in the "cleared" state.
uint overhead = pref.length() + suff.length();
QValidator::State state = QValidator::Invalid;
- QDoubleValidator v(NULL);
+ QDoubleValidator v(nullptr);
// If 'g' format is used (myPrecision < 0), then
// myPrecision - 1 digits are allowed after the decimal point.
bool myIsEmitKeyPressEvent;
/// Is clear flag
- bool myCleared;
+ bool myCleared{false};
/// Precision value
int myPrecision;
myWorkshop->selection()->fillPresentation(aPrs, theOwner);
if (aPrs->isEmpty())
return false;
- ModuleBase_WidgetValidated *aWidgetValidated =
+ auto *aWidgetValidated =
dynamic_cast<ModuleBase_WidgetValidated *>(aCurrentWidget);
if (aWidgetValidated)
aValid =
#include "ModuleBase_ModelWidget.h"
ModuleBase_IErrorMgr::ModuleBase_IErrorMgr(QObject *theParent /*= 0*/)
- : QObject(theParent), myPropertyPanel(NULL) {}
+ : QObject(theParent), myPropertyPanel(nullptr) {}
-ModuleBase_IErrorMgr::~ModuleBase_IErrorMgr() {}
+ModuleBase_IErrorMgr::~ModuleBase_IErrorMgr() = default;
void ModuleBase_IErrorMgr::setPropertyPanel(
ModuleBase_IPropertyPanel *theProp) {
public:
/// Default constructor
/// \param theParent a parent object
- ModuleBase_IErrorMgr(QObject *theParent = 0);
+ ModuleBase_IErrorMgr(QObject *theParent = nullptr);
/// Virtual destructor
- virtual ~ModuleBase_IErrorMgr();
+ ~ModuleBase_IErrorMgr() override;
/// \brief Set property pane to the operation
/// \param theProp a property panel instance
QList<ModuleBase_ViewerPrsPtr> aPreSelected =
aSelection->getSelected(ModuleBase_ISelection::AllControls);
- ModuleBase_OperationFeature *aCurOperation =
- dynamic_cast<ModuleBase_OperationFeature *>(
- myWorkshop->currentOperation());
+ auto *aCurOperation = dynamic_cast<ModuleBase_OperationFeature *>(
+ myWorkshop->currentOperation());
QString aCurOperationKind =
aCurOperation ? aCurOperation->getDescription()->operationId() : "";
}
AISObjectPtr
-ModuleBase_IModule::createPresentation(const ObjectPtr &theResult) {
+ModuleBase_IModule::createPresentation(const ObjectPtr & /*theResult*/) {
return AISObjectPtr();
}
bool ModuleBase_IModule::canBeShaded(Handle(AIS_InteractiveObject)
- theAIS) const {
+ /*theAIS*/) const {
return true;
}
ModuleBase_Operation *
ModuleBase_IModule::createOperation(const std::string &theFeatureId) {
- ModuleBase_OperationFeature *aFOperation =
- dynamic_cast<ModuleBase_OperationFeature *>(
- getNewOperation(theFeatureId));
+ auto *aFOperation = dynamic_cast<ModuleBase_OperationFeature *>(
+ getNewOperation(theFeatureId));
// If the operation is launched as sub-operation of another then we have to
// initialize parent feature
- ModuleBase_OperationFeature *aCurOperation =
- dynamic_cast<ModuleBase_OperationFeature *>(
- myWorkshop->currentOperation());
+ auto *aCurOperation = dynamic_cast<ModuleBase_OperationFeature *>(
+ myWorkshop->currentOperation());
if (aCurOperation) {
FeaturePtr aFeature = aCurOperation->feature();
CompositeFeaturePtr aCompFeature =
}
void ModuleBase_IModule::processProprietaryFeatures() {
- std::set<std::string>::iterator it = myFeaturesValidLicense.begin();
+ auto it = myFeaturesValidLicense.begin();
while (it != myFeaturesValidLicense.end()) {
- std::map<std::string, std::string>::iterator aFound =
- myProprietaryFeatures.find(*it);
+ auto aFound = myProprietaryFeatures.find(*it);
if (aFound == myProprietaryFeatures.end())
++it;
else {
myFeaturesInFiles[aFound->first] = aFound->second;
myProprietaryFeatures.erase(aFound);
- std::set<std::string>::iterator aRemoveIt = it++;
+ auto aRemoveIt = it++;
myFeaturesValidLicense.erase(aRemoveIt);
}
}
}
void ModuleBase_IModule::loadProprietaryPlugins() {
- for (std::set<std::string>::const_iterator itP = myProprietaryPlugins.begin();
- itP != myProprietaryPlugins.end(); ++itP) {
- if (!ModelAPI_Session::get()->checkLicense(*itP))
- Events_InfoMessage(*itP,
+ for (const auto &myProprietaryPlugin : myProprietaryPlugins) {
+ if (!ModelAPI_Session::get()->checkLicense(myProprietaryPlugin))
+ Events_InfoMessage(myProprietaryPlugin,
"License of %1 plugin is not valid or not exist!")
- .arg(*itP)
+ .arg(myProprietaryPlugin)
.send();
}
}
SLOT(onFeatureTriggered()));
}
-bool ModuleBase_IModule::canEraseObject(const ObjectPtr &theObject) const {
+bool ModuleBase_IModule::canEraseObject(const ObjectPtr & /*theObject*/) const {
return true;
}
-bool ModuleBase_IModule::canDisplayObject(const ObjectPtr &theObject) const {
+bool ModuleBase_IModule::canDisplayObject(
+ const ObjectPtr & /*theObject*/) const {
return true;
}
}
void ModuleBase_IModule::onFeatureTriggered() {
- QAction *aCmd = dynamic_cast<QAction *>(sender());
+ auto *aCmd = dynamic_cast<QAction *>(sender());
// Do nothing on uncheck
if (aCmd->isCheckable() && !aCmd->isChecked()) {
ModuleBase_Operation *anOperation =
if (!myWorkshop->canStartOperation(aFeatureId.c_str(), isCommitted))
return;
- ModuleBase_OperationFeature *aFOperation =
+ auto *aFOperation =
dynamic_cast<ModuleBase_OperationFeature *>(createOperation(aFeatureId));
if (aFOperation) {
aFOperation->setFeature(theFeature);
bool ModuleBase_IModule::canActivateSelection(
const ObjectPtr &theObject) const {
- ModuleBase_OperationFeature *aFOperation =
- dynamic_cast<ModuleBase_OperationFeature *>(
- myWorkshop->currentOperation());
+ auto *aFOperation = dynamic_cast<ModuleBase_OperationFeature *>(
+ myWorkshop->currentOperation());
return !aFOperation || !aFOperation->hasObject(theObject);
}
//******************************************************
Handle(SelectMgr_Filter)
ModuleBase_IModule::selectionFilter(const int theType) {
- ModuleBase_SelectionFilterType aType =
- (ModuleBase_SelectionFilterType)theType;
+ auto aType = (ModuleBase_SelectionFilterType)theType;
if (mySelectionFilters.find(aType) != mySelectionFilters.end())
return mySelectionFilters[aType];
#include "ModuleBase_IPrefMgr.h"
-ModuleBase_IPrefMgr::ModuleBase_IPrefMgr() {}
+ModuleBase_IPrefMgr::ModuleBase_IPrefMgr() = default;
-ModuleBase_IPrefMgr::~ModuleBase_IPrefMgr() {}
+ModuleBase_IPrefMgr::~ModuleBase_IPrefMgr() = default;
ModuleBase_ModelWidget *ModuleBase_IPropertyPanel::modelWidget(
const std::string &theAttributeId) const {
- ModuleBase_ModelWidget *aWidget = 0;
+ ModuleBase_ModelWidget *aWidget = nullptr;
QList<ModuleBase_ModelWidget *> aWidgets = modelWidgets();
ModelAPI_ValidatorsFactory *aValidators =
ModelAPI_Session::get()->validators();
ModuleBase_ModelWidget *
ModuleBase_IPropertyPanel::findFirstAcceptingValueWidget(
const QList<ModuleBase_ModelWidget *> &theWidgets) {
- ModuleBase_ModelWidget *aFirstWidget = 0;
+ ModuleBase_ModelWidget *aFirstWidget = nullptr;
ModelAPI_ValidatorsFactory *aValidators =
ModelAPI_Session::get()->validators();
ObjectPtr anObject;
foreach (ModuleBase_ViewerPrsPtr aPrs, theValues) {
anObject = aPrs->object();
- if (anObject.get() != NULL && !anExistedObjects.contains(anObject)) {
+ if (anObject.get() != nullptr && !anExistedObjects.contains(anObject)) {
theValuesTo.append(std::shared_ptr<ModuleBase_ViewerPrs>(
- new ModuleBase_ViewerPrs(anObject, GeomShapePtr(), NULL)));
+ new ModuleBase_ViewerPrs(anObject, GeomShapePtr(), nullptr)));
}
}
}
aLast = theObjects.end();
for (; anIt != aLast; anIt++) {
ObjectPtr anObject = *anIt;
- if (anObject.get() != NULL) {
+ if (anObject.get() != nullptr) {
aSelectedPrs.append(std::shared_ptr<ModuleBase_ViewerPrs>(
- new ModuleBase_ViewerPrs(anObject, GeomShapePtr(), NULL)));
+ new ModuleBase_ViewerPrs(anObject, GeomShapePtr(), nullptr)));
}
}
return aSelectedPrs;
std::shared_ptr<GeomAPI_Vertex> aGeomPrsVertex =
getPresentationVertex(aPrs);
if (aGeomPrsVertex.get()) {
- const TopoDS_Vertex &aPrsVertex = aGeomPrsVertex->impl<TopoDS_Vertex>();
- std::set<std::shared_ptr<GeomAPI_Vertex>>::const_iterator
- aVIt = aVerticesMap.begin(),
- aVLast = aVerticesMap.end();
+ const auto &aPrsVertex = aGeomPrsVertex->impl<TopoDS_Vertex>();
+ auto aVIt = aVerticesMap.begin(), aVLast = aVerticesMap.end();
bool aFound = false;
for (; aVIt != aVLast && !aFound; aVIt++) {
std::shared_ptr<GeomAPI_Vertex> aGeomVertex = *aVIt;
- const TopoDS_Vertex &aVertex = aGeomVertex->impl<TopoDS_Vertex>();
+ const auto &aVertex = aGeomVertex->impl<TopoDS_Vertex>();
gp_Pnt aPoint1 = BRep_Tool::Pnt(aVertex);
gp_Pnt aPoint2 = BRep_Tool::Pnt(aPrsVertex);
#include "ModuleBase_IStepPrs.h"
-ModuleBase_IStepPrs::ModuleBase_IStepPrs() {}
+ModuleBase_IStepPrs::ModuleBase_IStepPrs() = default;
class ModuleBase_ITreeNode;
class ModuleBase_IWorkshop;
-typedef QList<ModuleBase_ITreeNode *> QTreeNodesList;
+using QTreeNodesList = QList<ModuleBase_ITreeNode *>;
class ModuleBase_ITreeNode {
public:
enum VisibilityState { NoneState, Visible, SemiVisible, Hidden };
/// Default constructor
- ModuleBase_ITreeNode(ModuleBase_ITreeNode *theParent = 0)
+ ModuleBase_ITreeNode(ModuleBase_ITreeNode *theParent = nullptr)
: myParent(theParent) {}
virtual ~ModuleBase_ITreeNode() { deleteChildren(); }
virtual std::string type() const = 0;
/// Returns the node representation according to theRole.
- virtual QVariant data(int theColumn, int theRole) const { return QVariant(); }
+ virtual QVariant data(int /*theColumn*/, int /*theRole*/) const {
+ return QVariant();
+ }
/// Returns properties flag of the item
- virtual Qt::ItemFlags flags(int theColumn) const {
+ virtual Qt::ItemFlags flags(int /*theColumn*/) const {
return Qt::ItemIsSelectable | Qt::ItemIsEnabled;
}
ModuleBase_ITreeNode *subNode(int theRow) const {
if ((theRow > -1) && (theRow < myChildren.length()))
return myChildren.at(theRow);
- return 0;
+ return nullptr;
}
/// Finds a node which contains the referenced object
return aSubNode;
}
}
- return 0;
+ return nullptr;
}
/// Returns true if the given node is found within children
/// Process creation of objects.
/// \param theObjects a list of created objects
/// \return a list of nodes which corresponds to the created objects
- virtual QTreeNodesList objectCreated(const QObjectPtrList &theObjects) {
+ virtual QTreeNodesList objectCreated(const QObjectPtrList & /*theObjects*/) {
return QTreeNodesList();
}
/// \param theDoc a document where objects were deleted
/// \param theGroup a name of group where objects were deleted
/// \return a list of parents where nodes were deleted
- virtual QTreeNodesList objectsDeleted(const DocumentPtr &theDoc,
- const QString &theGroup) {
+ virtual QTreeNodesList objectsDeleted(const DocumentPtr & /*theDoc*/,
+ const QString & /*theGroup*/) {
return QTreeNodesList();
}
/// Returns a node which belongs to the given document and contains objects of
/// the given group \param theDoc a document \param theGroup a name of objects
/// group \return a parent node if it is found
- virtual ModuleBase_ITreeNode *findParent(const DocumentPtr &theDoc,
- QString theGroup) {
- return 0;
+ virtual ModuleBase_ITreeNode *findParent(const DocumentPtr & /*theDoc*/,
+ QString /*theGroup*/) {
+ return nullptr;
}
/// Returns root node of a data tree of the given document
if (aRoot)
return aRoot;
}
- return 0;
+ return nullptr;
}
/// Returns visibilitystate of the node in viewer 3d
void sortChildren() {
if (myChildren.size() > 1) {
int i = 0;
- ModuleBase_ITreeNode *aNode = 0;
+ ModuleBase_ITreeNode *aNode = nullptr;
ObjectPtr aObject;
int aIdx;
int aCount = 0;
#include "ModuleBase_IWidgetCreator.h"
-ModuleBase_IWidgetCreator::ModuleBase_IWidgetCreator() {}
+ModuleBase_IWidgetCreator::ModuleBase_IWidgetCreator() = default;
-ModuleBase_IWidgetCreator::~ModuleBase_IWidgetCreator() {}
+ModuleBase_IWidgetCreator::~ModuleBase_IWidgetCreator() = default;
QWidget *ModuleBase_IWidgetCreator::createPanelByType(
- const std::string &theType, QWidget *theParent,
- const FeaturePtr &theFeature, Config_WidgetAPI *theWidgetApi) {
- return 0;
+ const std::string & /*theType*/, QWidget * /*theParent*/,
+ const FeaturePtr & /*theFeature*/, Config_WidgetAPI * /*theWidgetApi*/) {
+ return nullptr;
}
-ModuleBase_PageBase *
-ModuleBase_IWidgetCreator::createPageByType(const std::string &theType,
- QWidget *theParent,
- Config_WidgetAPI *theWidgetApi) {
- return 0;
+ModuleBase_PageBase *ModuleBase_IWidgetCreator::createPageByType(
+ const std::string & /*theType*/, QWidget * /*theParent*/,
+ Config_WidgetAPI * /*theWidgetApi*/) {
+ return nullptr;
}
ModuleBase_ModelWidget *ModuleBase_IWidgetCreator::createWidgetByType(
- const std::string &theType, QWidget *theParent,
- Config_WidgetAPI *theWidgetApi, ModuleBase_IWorkshop *theWorkshop) {
- return 0;
+ const std::string & /*theType*/, QWidget * /*theParent*/,
+ Config_WidgetAPI * /*theWidgetApi*/,
+ ModuleBase_IWorkshop * /*theWorkshop*/) {
+ return nullptr;
}
virtual QWidget *createPanelByType(const std::string &theType,
QWidget *theParent,
const FeaturePtr &theFeature,
- Config_WidgetAPI *theWidgetApi = 0);
+ Config_WidgetAPI *theWidgetApi = nullptr);
/// Create page by its type
/// The default implementation is empty
ModuleBase_IWorkshop *theWorkshop);
};
-typedef std::shared_ptr<ModuleBase_IWidgetCreator> WidgetCreatorPtr;
+using WidgetCreatorPtr = std::shared_ptr<ModuleBase_IWidgetCreator>;
#endif
#include <QDir>
-ModuleBase_IconFactory *MYIconFactory = 0;
+ModuleBase_IconFactory *MYIconFactory = nullptr;
ModuleBase_IconFactory::ModuleBase_IconFactory() { setFactory(this); }
return MYIconFactory;
}
-QIcon ModuleBase_IconFactory::getIcon(ObjectPtr theIcon) { return QIcon(); }
+QIcon ModuleBase_IconFactory::getIcon(ObjectPtr /*theIcon*/) { return QIcon(); }
QIcon ModuleBase_IconFactory::loadIcon(const QString &theValue) {
return QIcon(loadPixmap(theValue));
const QString &theIcon,
int thePrecision)
: QWidget(theParent), myValue(0), myPrecision(thePrecision) {
- QHBoxLayout *aLayout = new QHBoxLayout(this);
+ auto *aLayout = new QHBoxLayout(this);
aLayout->setContentsMargins(2, 0, 0, 0);
aLayout->setSpacing(0);
aLayout->addStretch(1);
}
-ModuleBase_LabelValue::~ModuleBase_LabelValue() {}
+ModuleBase_LabelValue::~ModuleBase_LabelValue() = default;
void ModuleBase_LabelValue::setValue(const double theValue) {
myValue = theValue;
//********************************************************************
void ModuleBase_ListView::addItem(const QString &theTextValue,
const int theIndex) {
- QListWidgetItem *anItem = new QListWidgetItem(theTextValue, myListControl);
+ auto *anItem = new QListWidgetItem(theTextValue, myListControl);
anItem->setData(ATTRIBUTE_SELECTION_INDEX_ROLE, theIndex);
myListControl->addItem(anItem);
}
CustomListWidget(QWidget *theParent) : QListWidget(theParent) {}
/// Redefinition of virtual method
- virtual QSize sizeHint() const {
+ QSize sizeHint() const override {
int aHeight = 2 * QFontMetrics(font()).height();
QSize aSize = QListWidget::sizeHint();
return QSize(aSize.width(), aHeight);
}
/// Redefinition of virtual method
- virtual QSize minimumSizeHint() const {
+ QSize minimumSizeHint() const override {
int aHeight = 4 /*2*/ * QFontMetrics(font()).height();
QSize aSize = QListWidget::minimumSizeHint();
return QSize(aSize.width(), aHeight);
void activated();
protected:
- virtual void mouseReleaseEvent(QMouseEvent *e) {
+ void mouseReleaseEvent(QMouseEvent *e) override {
QListWidget::mouseReleaseEvent(e);
emit activated();
}
// The code is necessary only for Linux because
// it can not update viewport on widget resize
protected:
- void resizeEvent(QResizeEvent *theEvent) {
+ void resizeEvent(QResizeEvent *theEvent) override {
QListWidget::resizeEvent(theEvent);
QTimer::singleShot(5, viewport(), SLOT(repaint()));
}
public:
/// Constructor
- ModuleBase_ListView(QWidget *theParent = 0,
+ ModuleBase_ListView(QWidget *theParent = nullptr,
const QString &theObjectName = QString(),
const QString &theToolTip = QString());
/// Destructor
- virtual ~ModuleBase_ListView() {}
+ ~ModuleBase_ListView() override = default;
/// Returns current control
/// \return list view instance
//**************************************************************
ModuleBase_ModelWidget::ModuleBase_ModelWidget(QWidget *theParent,
const Config_WidgetAPI *theData)
- : QWidget(theParent), myWidgetValidator(0), myState(Stored),
+ : QWidget(theParent), myWidgetValidator(nullptr), myState(Stored),
myIsEditing(false), myIsValueStateBlocked(false),
myFlushUpdateBlocked(false) {
#ifdef DEBUG_WIDGET_INSTANCE
void ModuleBase_ModelWidget::setHighlighted(bool isHighlighted) {
QList<QWidget *> aWidgetList = getControls();
foreach (QWidget *aWidget, aWidgetList) {
- QLabel *aLabel = qobject_cast<QLabel *>(aWidget);
+ auto *aLabel = qobject_cast<QLabel *>(aWidget);
// We won't set the effect to QLabels - it looks ugly
if (aLabel)
continue;
// fields are filled in the edition mode
if (!isEditingMode()) {
AttributePtr anAttribute = myFeature->data()->attribute(myAttributeID);
- if (anAttribute.get() != NULL && !anAttribute->isInitialized())
+ if (anAttribute.get() != nullptr && !anAttribute->isInitialized())
initializeValueByActivate();
}
activateCustom();
//**************************************************************
QWidget *ModuleBase_ModelWidget::getControlAcceptingFocus(const bool isFirst) {
- QWidget *aControl = 0;
+ QWidget *aControl = nullptr;
QList<QWidget *> aControls = getControls();
int aSize = aControls.size();
}
//**************************************************************
-bool ModuleBase_ModelWidget::processAction(ModuleBase_ActionType theActionType,
- const ActionParamPtr &theParam) {
+bool ModuleBase_ModelWidget::processAction(
+ ModuleBase_ActionType theActionType, const ActionParamPtr & /*theParam*/) {
switch (theActionType) {
case ActionEnter:
return processEnter();
bool ModuleBase_ModelWidget::eventFilter(QObject *theObject, QEvent *theEvent) {
QWidget *aWidget = qobject_cast<QWidget *>(theObject);
if (theEvent->type() == QEvent::FocusIn) {
- QFocusEvent *aFocusEvent = dynamic_cast<QFocusEvent *>(theEvent);
+ auto *aFocusEvent = dynamic_cast<QFocusEvent *>(theEvent);
Qt::FocusReason aReason = aFocusEvent->reason();
bool aMouseOrKey =
aReason == Qt::MouseFocusReason ||
emitFocusInWidget();
}
} else if (theEvent->type() == QEvent::FocusOut) {
- QFocusEvent *aFocusEvent = dynamic_cast<QFocusEvent *>(theEvent);
+ auto *aFocusEvent = dynamic_cast<QFocusEvent *>(theEvent);
Qt::FocusReason aReason = aFocusEvent->reason();
bool aMouseOrKey =
//**************************************************************
ModuleBase_ModelWidget *
-ModuleBase_ModelWidget::findModelWidget(ModuleBase_IPropertyPanel *theProp,
+ModuleBase_ModelWidget::findModelWidget(ModuleBase_IPropertyPanel * /*theProp*/,
QWidget *theWidget) {
- ModuleBase_ModelWidget *aModelWidget = 0;
+ ModuleBase_ModelWidget *aModelWidget = nullptr;
if (!theWidget)
return aModelWidget;
ModuleBase_Operation::ModuleBase_Operation(const QString &theId,
QObject *theParent)
- : QObject(theParent), myIsModified(false), myPropertyPanel(NULL),
- myHideFacesVisibilityState(false) {
+ : QObject(theParent), myPropertyPanel(nullptr) {
myDescription = new ModuleBase_OperationDescription(theId);
}
ModuleBase_OperationDescription *myDescription;
/// Modified feature flag
- bool myIsModified;
+ bool myIsModified{false};
/// List of operations IDs which are granted of the current operation
QStringList myGrantedIds;
QString myHelpFileName;
/// Visibility state of HideFaces panel before the operation launch
- bool myHideFacesVisibilityState;
+ bool myHideFacesVisibilityState{false};
};
#endif
const QString &theId)
: myOperationId(theId) {}
-ModuleBase_OperationDescription::~ModuleBase_OperationDescription() {}
+ModuleBase_OperationDescription::~ModuleBase_OperationDescription() = default;
const QString &ModuleBase_OperationDescription::operationId() const {
return myOperationId;
ModuleBase_OperationFeature::ModuleBase_OperationFeature(const QString &theId,
QObject *theParent)
- : ModuleBase_Operation(theId, theParent), myIsEditing(false),
- myNeedToBeAborted(false), myRestartTransactionOnResume(false) {}
+ : ModuleBase_Operation(theId, theParent) {}
ModuleBase_OperationFeature::~ModuleBase_OperationFeature() {
clearPreselection();
}
FeaturePtr
-ModuleBase_OperationFeature::createFeature(const bool theFlushMessage) {
+ModuleBase_OperationFeature::createFeature(const bool /*theFlushMessage*/) {
if (myParentFeature.get()) {
myFeature = myParentFeature->addFeature(
getDescription()->operationId().toStdString());
if (!myIsEditing) {
FeaturePtr aFeature = createFeature();
// if the feature is not created, there is no sense to start the operation
- if (aFeature.get() == NULL) {
+ if (aFeature.get() == nullptr) {
// it is necessary to abor the operation in the session and emit the
// aborted signal in order to update commands status in the workshop, to
// be exact the feature action to be unchecked
ModuleBase_ModelWidget *ModuleBase_OperationFeature::activateByPreselection(
const std::string &theGreedAttributeId) {
- ModuleBase_ModelWidget *aWidget = 0;
+ ModuleBase_ModelWidget *aWidget = nullptr;
if (myPreSelection.empty())
return aWidget;
ModuleBase_IPropertyPanel *aPropertyPanel = propertyPanel();
- ModuleBase_ModelWidget *aFilledWgt = 0;
+ ModuleBase_ModelWidget *aFilledWgt = nullptr;
if (aPropertyPanel) {
const QList<ModuleBase_ModelWidget *> &aWidgets =
aPropertyPanel->modelWidgets();
QList<ModuleBase_ModelWidget *>::const_iterator aWIt;
- ModuleBase_ModelWidget *aWgt = 0;
+ ModuleBase_ModelWidget *aWgt = nullptr;
if (!aWidgets.empty()) {
// equal vertices should not be used here
ModuleBase_ISelection::filterSelectionOnEqualPoints(myPreSelection);
if (aWgt->attributeID() == theGreedAttributeId) {
aPropertyPanel->setPreselectionWidget(aWgt);
if (aWgt->setSelection(myPreSelection, true)) {
- aPropertyPanel->setPreselectionWidget(NULL);
+ aPropertyPanel->setPreselectionWidget(nullptr);
aFilledWgt = aWgt;
break;
} else { // do not process invalid for greed widget selection
aFilledWgt = aWgt;
}
}
- aPropertyPanel->setPreselectionWidget(NULL);
+ aPropertyPanel->setPreselectionWidget(nullptr);
// in order to redisplay object in the viewer, the update/redisplay
// signals should be flushed it is better to perform it not in
// setSelection of each widget, but do it here, after the preselection is
// operation Because we don't know which widget is going to be edited.
if (!isEditOperation()) {
// 4. activate the first obligatory widget
- theProp->activateNextWidget(NULL);
+ theProp->activateNextWidget(nullptr);
} else {
// set focus on Ok button in order to operation manager could process Enter
// press
std::set<ObjectPtr> myVisualizedObjects;
/// Editing feature flag
- bool myIsEditing;
+ bool myIsEditing{false};
/// State used only if the operation should not be commited
- bool myNeedToBeAborted;
+ bool myNeedToBeAborted{false};
/// List of pre-selected object
QList<std::shared_ptr<ModuleBase_ViewerPrs>> myPreSelection;
/// commit/abort this operation.
FeaturePtr myPreviousCurrentFeature;
- bool myRestartTransactionOnResume;
+ bool myRestartTransactionOnResume{false};
};
#endif
class QWidget;
-ModuleBase_PageBase::ModuleBase_PageBase() {}
+ModuleBase_PageBase::ModuleBase_PageBase() = default;
-ModuleBase_PageBase::~ModuleBase_PageBase() {}
+ModuleBase_PageBase::~ModuleBase_PageBase() = default;
QWidget *ModuleBase_PageBase::pageWidget() {
return dynamic_cast<QWidget *>(this);
myWidgetList.clear();
QLayoutItem *aChild;
- while ((aChild = pageLayout()->takeAt(0)) != 0) {
+ while ((aChild = pageLayout()->takeAt(0)) != nullptr) {
if (aChild->widget()) {
delete aChild->widget();
} else {
// without necessity.
// In this patch we clear the stretch information specifying the default
// value: 0.
- QGridLayout *aLayout = dynamic_cast<QGridLayout *>(pageLayout());
+ auto *aLayout = dynamic_cast<QGridLayout *>(pageLayout());
if (aLayout) {
int r = aLayout->rowCount();
for (int i = 0; i < r; i++)
}
void ModuleBase_PageBase::placePageWidget(ModuleBase_PageBase *theWidget) {
- QWidget *aWidget = dynamic_cast<QWidget *>(theWidget);
+ auto *aWidget = dynamic_cast<QWidget *>(theWidget);
placeWidget(aWidget);
}
setLayout(myMainLayout);
}
-ModuleBase_PageGroupBox::~ModuleBase_PageGroupBox() {}
+ModuleBase_PageGroupBox::~ModuleBase_PageGroupBox() = default;
void ModuleBase_PageGroupBox::addPageStretch() {}
Q_OBJECT
public:
/// Constructs a page that looks like a QGroupBox
- explicit ModuleBase_PageGroupBox(QWidget *theParent = 0);
+ explicit ModuleBase_PageGroupBox(QWidget *theParent = nullptr);
/// Destructs the page
- virtual ~ModuleBase_PageGroupBox();
+ ~ModuleBase_PageGroupBox() override;
protected:
/// Adds the given widget to page's layout
- virtual void placeModelWidget(ModuleBase_ModelWidget *theWidget);
+ void placeModelWidget(ModuleBase_ModelWidget *theWidget) override;
/// Adds the given page to page's layout
- virtual void placeWidget(QWidget *theWidget);
+ void placeWidget(QWidget *theWidget) override;
/// Returns page's layout (QGridLayout)
- virtual QLayout *pageLayout();
+ QLayout *pageLayout() override;
/// Adds a stretch to page's layout
- virtual void addPageStretch();
+ void addPageStretch() override;
private:
QGridLayout *myMainLayout; ///< page's layout
setLayout(myMainLayout);
}
-ModuleBase_PageWidget::~ModuleBase_PageWidget() {}
+ModuleBase_PageWidget::~ModuleBase_PageWidget() = default;
void ModuleBase_PageWidget::addPageStretch() { myMainLayout->addStretch(1); }
Q_OBJECT
public:
/// Constructs a page that looks like a QFrame
- explicit ModuleBase_PageWidget(QWidget *theParent = 0);
+ explicit ModuleBase_PageWidget(QWidget *theParent = nullptr);
/// Destructs the page
- virtual ~ModuleBase_PageWidget();
+ ~ModuleBase_PageWidget() override;
protected:
/// Adds the given widget to page's layout
- virtual void placeModelWidget(ModuleBase_ModelWidget *theWidget);
+ void placeModelWidget(ModuleBase_ModelWidget *theWidget) override;
/// Adds the given page to page's layout
- virtual void placeWidget(QWidget *theWidget);
+ void placeWidget(QWidget *theWidget) override;
/// Returns page's layout (QGridLayout)
- virtual QLayout *pageLayout();
+ QLayout *pageLayout() override;
/// Adds a stretch to page's layout
- virtual void addPageStretch();
+ void addPageStretch() override;
private:
QVBoxLayout *myMainLayout; ///< page's layout
myDefValue = defaultValues[myFeatureId + attributeID()];
}
-ModuleBase_PagedContainer::~ModuleBase_PagedContainer() {}
+ModuleBase_PagedContainer::~ModuleBase_PagedContainer() = default;
int ModuleBase_PagedContainer::addPage(ModuleBase_PageBase *thePage,
const QString & /*theName*/,
/// \param theData a data of the widget
ModuleBase_PagedContainer(QWidget *theParent,
const Config_WidgetAPI *theData);
- virtual ~ModuleBase_PagedContainer();
+ ~ModuleBase_PagedContainer() override;
/// Add a new page
/// \param theWidget a page object
const QString &theTooltip);
/// Redefinition of virtual function
- virtual QList<QWidget *> getControls() const;
+ QList<QWidget *> getControls() const override;
/// Redefinition of virtual function
- virtual bool focusTo();
+ bool focusTo() override;
/// Redefinition of virtual function
- virtual void setHighlighted(bool isHighlighted);
+ void setHighlighted(bool isHighlighted) override;
/// Redefinition of virtual function
- virtual void enableFocusProcessing();
+ void enableFocusProcessing() override;
/// The slot is called when user press Ok or OkPlus buttons in the parent
/// property panel
- virtual void onFeatureAccepted();
+ void onFeatureAccepted() override;
protected:
/// Returns index of current page
virtual void setCurrentPageIndex(int) = 0;
/// Redefinition of virtual function
- virtual void activateCustom();
+ void activateCustom() override;
/// Redefinition of virtual function
- virtual bool storeValueCustom();
+ bool storeValueCustom() override;
/// Redefinition of virtual function
- virtual bool restoreValueCustom();
+ bool restoreValueCustom() override;
// A flag which let to remeber last user choice and restore it on next launch
bool myRemeberChoice;
ModuleBase_ParamSpinBox::ModuleBase_ParamSpinBox(QWidget *theParent,
int thePrecision)
- : QAbstractSpinBox(theParent), myIsEquation(false), myAcceptVariables(true),
- myMinimum(-DBL_MAX), myMaximum(DBL_MAX), mySingleStep(1) {
+ : QAbstractSpinBox(theParent) {
myCompleter = new QCompleter(this);
myCompleter->setWidget(lineEdit());
myCompleter->setCompletionMode(QCompleter::PopupCompletion);
/*!
\brief Destructor.
*/
-ModuleBase_ParamSpinBox::~ModuleBase_ParamSpinBox() {}
+ModuleBase_ParamSpinBox::~ModuleBase_ParamSpinBox() = default;
/*!
\brief Perform \a steps increment/decrement steps.
#include <QAbstractSpinBox>
#include <QLineEdit>
#include <QValidator>
+#include <cfloat>
class QStringListModel;
class QCompleter;
QString getPrefix(int &theStart, int &theEnd) const;
void showCompletion(bool checkPrefix);
- bool myIsEquation;
- bool myAcceptVariables;
+ bool myIsEquation{false};
+ bool myAcceptVariables{true};
QStringListModel *myCompleterModel;
QCompleter *myCompleter;
- double myMinimum;
- double myMaximum;
+ double myMinimum{-DBL_MAX};
+ double myMaximum{DBL_MAX};
int myCompletePos;
- double mySingleStep;
+ double mySingleStep{1};
/// Cashed color of active base palette
QColor myEnabledBaseColor;
const QString ModuleBase_Preferences::MENU_SECTION = "Menu";
const QString ModuleBase_Preferences::GENERAL_SECTION = "General";
-SUIT_ResourceMgr *ModuleBase_Preferences::myResourceMgr = 0;
+SUIT_ResourceMgr *ModuleBase_Preferences::myResourceMgr = nullptr;
SUIT_ResourceMgr *ModuleBase_Preferences::resourceMgr() {
if (!myResourceMgr) {
/// \param theMgr a preferences manager
ModuleBase_PrefMgr(ModuleBase_PreferencesMgr *theMgr) : myMgr(theMgr) {}
- virtual int addPreference(const QString &theLbl, int pId,
- SUIT_PreferenceMgr::PrefItemType theType,
- const QString &theSection, const QString &theName) {
+ int addPreference(const QString &theLbl, int pId,
+ SUIT_PreferenceMgr::PrefItemType theType,
+ const QString &theSection,
+ const QString &theName) override {
return myMgr->addItem(theLbl, pId, theType, theSection, theName);
}
- virtual void setItemProperty(const QString &thePropName,
- const QVariant &theValue, const int theId = -1) {
+ void setItemProperty(const QString &thePropName, const QVariant &theValue,
+ const int theId = -1) override {
myMgr->setItemProperty(thePropName, theValue, theId);
}
- virtual SUIT_PreferenceMgr *prefMgr() const { return myMgr; }
+ SUIT_PreferenceMgr *prefMgr() const override { return myMgr; }
private:
ModuleBase_PreferencesMgr *myMgr;
myIsChanged(false) {
setWindowTitle(tr("Edit preferences"));
- QVBoxLayout *main = new QVBoxLayout(this);
+ auto *main = new QVBoxLayout(this);
main->setMargin(5);
main->setSpacing(5);
setFocusProxy(myPreferences);
myPreferences->setFrameStyle(QFrame::Box | QFrame::Sunken);
- QDialogButtonBox *aBtnBox = new QDialogButtonBox(
+ auto *aBtnBox = new QDialogButtonBox(
QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Reset,
Qt::Horizontal, this);
QPushButton *aDefaultButton = aBtnBox->button(QDialogButtonBox::Reset);
myPreferences->retrieve();
}
-ModuleBase_PreferencesDlg::~ModuleBase_PreferencesDlg() {}
+ModuleBase_PreferencesDlg::~ModuleBase_PreferencesDlg() = default;
void ModuleBase_PreferencesDlg::createEditors() {
int aPage = myPreferences->addItem(tr("Desktop"));
class QWidget;
/// Pair of values: section name, value name
-typedef QPair<QString, QString> ModuleBase_Pref;
+using ModuleBase_Pref = QPair<QString, QString>;
/// List of preferences
-typedef QList<ModuleBase_Pref> ModuleBase_Prefs;
+using ModuleBase_Prefs = QList<ModuleBase_Pref>;
//***********************************************************************
/// \ingroup GUI
ModuleBase_PreferencesMgr(QtxResourceMgr *theResource, QWidget *theParent)
: SUIT_PreferenceMgr(theResource, theParent) {}
- virtual ~ModuleBase_PreferencesMgr() {}
+ ~ModuleBase_PreferencesMgr() override = default;
/// Returns True if preferences were modified
ModuleBase_Prefs modified() const { return myModified; }
protected:
/// Store changed resource
- virtual void changedResources(const ResourceMap &theMap);
+ void changedResources(const ResourceMap &theMap) override;
private:
ModuleBase_Prefs myModified;
/// \param theResurces resources manager
/// \param theParent a parent widget
ModuleBase_PreferencesDlg(SUIT_ResourceMgr *theResurces,
- QWidget *theParent = 0);
- virtual ~ModuleBase_PreferencesDlg();
+ QWidget *theParent = nullptr);
+ ~ModuleBase_PreferencesDlg() override;
/// Returns True if preferences were changed
bool isChanged() const { return myIsChanged; }
public slots:
/// A slot called on Ok button press
- virtual void accept();
+ void accept() override;
protected:
- virtual void showEvent(QShowEvent *theEvent);
+ void showEvent(QShowEvent *theEvent) override;
protected slots:
/// A slot called on Default button press
ModuleBase_ToolBox::ModuleBase_ToolBox(QWidget *theParent,
const bool theUseFrameStyleBox)
: QFrame(theParent) {
- QVBoxLayout *aMainLayout = new QVBoxLayout(this);
+ auto *aMainLayout = new QVBoxLayout(this);
aMainLayout->setMargin(0);
aMainLayout->setSpacing(2);
SLOT(onButton(int)));
}
-ModuleBase_ToolBox::~ModuleBase_ToolBox() {}
+ModuleBase_ToolBox::~ModuleBase_ToolBox() = default;
void ModuleBase_ToolBox::addItem(QWidget *thePage, const QString &theName,
const QPixmap &theIcon) {
myStack->addWidget(thePage);
- QToolButton *aButton = new QToolButton(myButtonsFrame);
+ auto *aButton = new QToolButton(myButtonsFrame);
aButton->setFocusPolicy(Qt::StrongFocus);
aButton->setCheckable(true);
aButton->setStyleSheet(AStyle);
QWidget *aFirstControl = aControls.first();
QWidget *aWidget = aFirstControl;
- QWidget *aParent = (QWidget *)aFirstControl->parent();
+ auto *aParent = (QWidget *)aFirstControl->parent();
while (aParent) {
- QStackedWidget *aStackedWidget = dynamic_cast<QStackedWidget *>(aParent);
+ auto *aStackedWidget = dynamic_cast<QStackedWidget *>(aParent);
if (aStackedWidget) {
isOffToolBox = aStackedWidget->currentWidget() != aWidget;
break;
/// buttons and current page
ModuleBase_ToolBox(QWidget *theParent,
const bool theUseFrameStyleBox = false);
- virtual ~ModuleBase_ToolBox();
+ ~ModuleBase_ToolBox() override;
/// Add a new item to the tool box
/// \param thePage a widget of the new item
return anInstance;
}
- void processEvent(const std::shared_ptr<Events_Message> &theMessage) {
+ void
+ processEvent(const std::shared_ptr<Events_Message> &theMessage) override {
if (theMessage->eventID() ==
Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)) {
#if HAVE_SALOME
theLayout->setSpacing(5);
}
-void activateWindow(QWidget *theWidget, const QString &theInfo) {
+void activateWindow(QWidget *theWidget, const QString & /*theInfo*/) {
if (theWidget) {
theWidget->activateWindow();
theWidget->raise();
#endif
}
-void setFocus(QWidget *theWidget, const QString &theInfo) {
+void setFocus(QWidget *theWidget, const QString & /*theInfo*/) {
activateWindow(theWidget);
theWidget->setFocus();
// rectangle of focus is not visible on tool button widgets
void setShadowEffect(QWidget *theWidget, const bool isSetEffect) {
if (isSetEffect) {
- QGraphicsDropShadowEffect *aGlowEffect = new QGraphicsDropShadowEffect();
+ auto *aGlowEffect = new QGraphicsDropShadowEffect();
aGlowEffect->setOffset(.0);
aGlowEffect->setBlurRadius(10.0);
aGlowEffect->setColor(QColor(0, 170, 255)); // Light-blue color, #00AAFF
QGraphicsEffect *anEffect = theWidget->graphicsEffect();
if (anEffect)
anEffect->deleteLater();
- theWidget->setGraphicsEffect(NULL);
+ theWidget->setGraphicsEffect(nullptr);
}
}
QObject *theParent, const QObject *theReceiver,
const char *theMember, const QString &theToolTip,
const QString &theStatusTip) {
- QAction *anAction = new QAction(theIcon, theText, theParent);
+ auto *anAction = new QAction(theIcon, theText, theParent);
anAction->setToolTip(theToolTip.isEmpty() ? theText : theToolTip);
anAction->setStatusTip(!theStatusTip.isEmpty()
? theStatusTip
std::dynamic_pointer_cast<ModelAPI_ResultField::ModelAPI_FieldStep>(
aObj);
- hasResult |= ((aResult.get() != NULL) || (aStep.get() != NULL));
- hasFeature |= (aFeature.get() != NULL);
- hasFolder |= (aFolder.get() != NULL);
- hasParameter |= (aConstruction.get() != NULL);
- hasNonGroup |= (aGroup.get() == NULL);
+ hasResult |= ((aResult.get() != nullptr) || (aStep.get() != nullptr));
+ hasFeature |= (aFeature.get() != nullptr);
+ hasFolder |= (aFolder.get() != nullptr);
+ hasParameter |= (aConstruction.get() != nullptr);
+ hasNonGroup |= (aGroup.get() == nullptr);
if (hasFeature)
- hasCompositeOwner |= (ModelAPI_Tools::compositeOwner(aFeature) != NULL);
+ hasCompositeOwner |=
+ (ModelAPI_Tools::compositeOwner(aFeature) != nullptr);
else if (aResult.get())
- hasCompositeOwner |= (ModelAPI_Tools::bodyOwner(aResult) != NULL);
+ hasCompositeOwner |= (ModelAPI_Tools::bodyOwner(aResult) != nullptr);
if (!hasResultInHistory && aResult.get()) {
aFeature = ModelAPI_Feature::feature(aResult);
if (anAttrType == ModelAPI_AttributeRefAttr::typeId()) {
AttributeRefAttrPtr anAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
- if (anAttr != NULL && anAttr->isObject())
+ if (anAttr != nullptr && anAttr->isObject())
anObject = anAttr->object();
}
if (anAttrType == ModelAPI_AttributeSelection::typeId()) {
AttributeSelectionPtr anAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttribute);
- if (anAttr != NULL)
+ if (anAttr != nullptr)
anObject = anAttr->context();
}
if (anAttrType == ModelAPI_AttributeReference::typeId()) {
AttributeReferencePtr anAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeReference>(theAttribute);
- if (anAttr.get() != NULL)
+ if (anAttr.get() != nullptr)
anObject = anAttr->value();
}
return anObject;
} else if (aType == ModelAPI_AttributeSelection::typeId()) {
AttributeSelectionPtr aSelectAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttribute);
- if (aSelectAttr.get() != NULL) {
+ if (aSelectAttr.get() != nullptr) {
aSelectAttr->setValue(theObject, theShape, theTemporarily);
}
}
return aShape;
}
-void flushUpdated(ObjectPtr theObject) {
+void flushUpdated(ObjectPtr /*theObject*/) {
blockUpdateViewer(true);
// Fix the problem of not previewed results of constraints applied. Flush
bool aFoundModuleDocumentObject = false;
DocumentPtr aModuleDoc = ModelAPI_Session::get()->moduleDocument();
- std::set<FeaturePtr>::const_iterator anIt = theFeatures.begin(),
- aLast = theFeatures.end();
+ auto anIt = theFeatures.begin(), aLast = theFeatures.end();
for (; anIt != aLast && !aFoundModuleDocumentObject; anIt++) {
FeaturePtr aFeature = *anIt;
ResultPtr aResult = ModuleBase_Tools::firstResult(aFeature);
std::set<FeaturePtr> aFeaturesRefsToParameter;
std::set<FeaturePtr> aParameterFeatures;
QStringList aPartFeatureNames;
- std::set<FeaturePtr>::const_iterator anIt = theFeatures.begin(),
- aLast = theFeatures.end();
+ auto anIt = theFeatures.begin(), aLast = theFeatures.end();
// separate features to references to parameter features and references to
// others
for (; anIt != aLast; anIt++) {
std::set<FeaturePtr> aRefFeatures;
std::set<FeaturePtr> aRefList = theReferences.at(aFeature);
- std::set<FeaturePtr>::const_iterator aRefIt = aRefList.begin(),
- aRefLast = aRefList.end();
+ auto aRefIt = aRefList.begin(), aRefLast = aRefList.end();
for (; aRefIt != aRefLast; aRefIt++) {
FeaturePtr aRefFeature = *aRefIt;
if (theFeatures.find(aRefFeature) ==
if (aButtonRole == QMessageBox::ActionRole) {
foreach (FeaturePtr aObj, aParameterFeatures)
- ModelAPI_ReplaceParameterMessage::send(aObj, 0);
+ ModelAPI_ReplaceParameterMessage::send(aObj, nullptr);
} else
theReferencesToDelete.insert(aFeaturesRefsToParameterOnly.begin(),
aFeaturesRefsToParameterOnly.end());
(theWarningText + "\nConstraints will be removed or substituted")
.c_str());
- QCheckBox *aCheckBox = new QCheckBox;
+ auto *aCheckBox = new QCheckBox;
aCheckBox->setTristate(false);
aCheckBox->setText("switch off the notifications.");
std::wstring generateName(const AttributePtr &theAttribute,
ModuleBase_IWorkshop *theWorkshop) {
std::wstring aName;
- if (theAttribute.get() != NULL) {
+ if (theAttribute.get() != nullptr) {
FeaturePtr aFeature = ModelAPI_Feature::feature(theAttribute->owner());
if (aFeature.get()) {
std::string aXmlCfg, aDescription;
// Set displaying status to every element on group
static void setDisplayingByLoop(DocumentPtr theDoc, int theSize,
- std::string theGroup, bool theDisplayFromScript,
- int theDisplayingId) {
+ std::string theGroup, int theDisplayingId) {
for (int anIndex = theSize - 1; anIndex >= 0; --anIndex) {
ObjectPtr anObject = theDoc->object(theGroup, anIndex);
anObject->setDisplayed((theDisplayingId == 1 && anIndex == theSize - 1) ||
}
setDisplayingByLoop(aDoc, aConstructionSize,
- ModelAPI_ResultConstruction::group(),
- theDisplayFromScript, aDisplayingId);
+ ModelAPI_ResultConstruction::group(), aDisplayingId);
setDisplayingByLoop(aDoc, aGroupSize, ModelAPI_ResultGroup::group(),
- theDisplayFromScript, aDisplayingId);
+ aDisplayingId);
setDisplayingByLoop(aDoc, aFieldSize, ModelAPI_ResultField::group(),
- theDisplayFromScript, aDisplayingId);
+ aDisplayingId);
setDisplayingByLoop(aDoc, aResultSize, ModelAPI_ResultBody::group(),
- theDisplayFromScript, aDisplayingId);
+ aDisplayingId);
isDoingDisplay = false;
}
/// Returns True if the given owner is acceptable for selection
/// \param theOwner the selected owner
- Standard_EXPORT virtual Standard_Boolean
- IsOk(const Handle(SelectMgr_EntityOwner) & theOwner) const;
+ Standard_EXPORT Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner) &
+ theOwner) const override;
/// Add an object type name to list of non selectable objects
/// \param theType - a name of an object type
/// Returns True if the given owner is acceptable for selection
/// \param theOwner the selected owner
- Standard_EXPORT virtual Standard_Boolean
- IsOk(const Handle(SelectMgr_EntityOwner) & theOwner) const;
+ Standard_EXPORT Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner) &
+ theOwner) const override;
DEFINE_STANDARD_RTTIEXT(ModuleBase_ShapeInPlaneFilter, SelectMgr_Filter)
private:
theOwner)
: myResult(theResult), myOwner(theOwner), myShape(theShape) {}
-ModuleBase_ViewerPrs::~ModuleBase_ViewerPrs() {}
+ModuleBase_ViewerPrs::~ModuleBase_ViewerPrs() = default;
bool ModuleBase_ViewerPrs::isEqual(ModuleBase_ViewerPrs *thePrs) const {
if (!thePrs || thePrs->isEmpty())
: ModuleBase_ModelWidget(theParent, theData), myActionID(attributeID()) {
setAttributeID(
""); // To prevent errors. Action not stored as attribtue in feature.
- QHBoxLayout *aControlLay = new QHBoxLayout(this);
+ auto *aControlLay = new QHBoxLayout(this);
ModuleBase_Tools::adjustMargins(aControlLay);
myButton = new QToolButton(this);
connect(myButton, SIGNAL(clicked(bool)), this, SLOT(onActionClicked()));
}
-ModuleBase_WidgetAction::~ModuleBase_WidgetAction() {}
+ModuleBase_WidgetAction::~ModuleBase_WidgetAction() = default;
bool ModuleBase_WidgetAction::focusTo() { return false; }
/// is obtained from
ModuleBase_WidgetAction(QWidget *theParent, const Config_WidgetAPI *theData);
- virtual ~ModuleBase_WidgetAction();
+ ~ModuleBase_WidgetAction() override;
/// Do not accept focus, returns false
- virtual bool focusTo();
+ bool focusTo() override;
/// Returns list of widget controls
/// \return a control list
- virtual QList<QWidget *> getControls() const;
+ QList<QWidget *> getControls() const override;
/// \return Context for translation
- virtual std::string context() const {
+ std::string context() const override {
std::string aContext = myFeatureId;
if (!aContext.empty() && !myActionID.empty()) {
aContext += ":";
protected:
/// Do nothing
/// \return True in success
- virtual bool storeValueCustom();
+ bool storeValueCustom() override;
/// Do nothing
- virtual bool restoreValueCustom();
+ bool restoreValueCustom() override;
protected slots:
/// Listens the button click and call the customAction function of the current
myCheckBox->setToolTip(aToolTip);
myCheckBox->setChecked(myDefVal);
- QVBoxLayout *aMainLayout = new QVBoxLayout(this);
+ auto *aMainLayout = new QVBoxLayout(this);
ModuleBase_Tools::adjustMargins(aMainLayout);
aMainLayout->addWidget(myCheckBox);
setLayout(aMainLayout);
connect(myCheckBox, SIGNAL(toggled(bool)), this, SIGNAL(valuesChanged()));
}
-ModuleBase_WidgetBoolValue::~ModuleBase_WidgetBoolValue() {}
+ModuleBase_WidgetBoolValue::~ModuleBase_WidgetBoolValue() = default;
bool ModuleBase_WidgetBoolValue::storeValueCustom() {
DataPtr aData = myFeature->data();
ModuleBase_WidgetBoolValue(QWidget *theParent,
const Config_WidgetAPI *theData);
- virtual ~ModuleBase_WidgetBoolValue();
+ ~ModuleBase_WidgetBoolValue() override;
- virtual bool canAcceptFocus() const { return false; };
+ bool canAcceptFocus() const override { return false; };
- virtual QList<QWidget *> getControls() const;
+ QList<QWidget *> getControls() const override;
- virtual void setHighlighted(bool isHighlighted);
+ void setHighlighted(bool isHighlighted) override;
protected:
/// Saves the internal parameters to the given feature
/// \return True in success
- virtual bool storeValueCustom();
+ bool storeValueCustom() override;
- virtual bool restoreValueCustom();
+ bool restoreValueCustom() override;
private:
/// The check box
std::string aWgtDir = theData->getProperty("buttons_dir");
- QHBoxLayout *aLayout = new QHBoxLayout(this);
+ auto *aLayout = new QHBoxLayout(this);
myChoiceCtrl = new ModuleBase_ChoiceCtrl(
this, aList, aIconList,
(aWgtType == "radiobuttons") ? ModuleBase_ChoiceCtrl::RadioButtons
aLayout->addWidget(myChoiceCtrl);
}
-ModuleBase_WidgetChoice::~ModuleBase_WidgetChoice() {}
+ModuleBase_WidgetChoice::~ModuleBase_WidgetChoice() = default;
bool ModuleBase_WidgetChoice::storeValueCustom() {
DataPtr aData = myFeature->data();
/// is obtained from
ModuleBase_WidgetChoice(QWidget *theParent, const Config_WidgetAPI *theData);
- virtual ~ModuleBase_WidgetChoice();
+ ~ModuleBase_WidgetChoice() override;
/// Defines if it is supported to set the value in this widget
/// It returns false because this is an info widget
- virtual bool canAcceptFocus() const { return false; };
+ bool canAcceptFocus() const override { return false; };
- virtual bool focusTo();
+ bool focusTo() override;
/// Returns list of widget controls
/// \return a controls list
- virtual QList<QWidget *> getControls() const;
+ QList<QWidget *> getControls() const override;
/// Returns text value for the property panel title
/// \param theIndex a button index
/// The slot is called when user press Ok or OkPlus buttons in the parent
/// property panel
- virtual void onFeatureAccepted();
+ void onFeatureAccepted() override;
signals:
/// Segnal about selected item
protected:
/// Saves the internal parameters to the given feature
/// \return True in success
- virtual bool storeValueCustom();
+ bool storeValueCustom() override;
- virtual bool restoreValueCustom();
+ bool restoreValueCustom() override;
private slots:
/// Slot called on combo box index change
return MY_WIDGET_CREATOR_FACTORY;
}
-ModuleBase_WidgetCreatorFactory::ModuleBase_WidgetCreatorFactory() {}
+ModuleBase_WidgetCreatorFactory::ModuleBase_WidgetCreatorFactory() = default;
-ModuleBase_WidgetCreatorFactory::~ModuleBase_WidgetCreatorFactory() {}
+ModuleBase_WidgetCreatorFactory::~ModuleBase_WidgetCreatorFactory() = default;
void ModuleBase_WidgetCreatorFactory::registerCreator(
const WidgetCreatorPtr &theCreator) {
QWidget *ModuleBase_WidgetCreatorFactory::createPanelByType(
const std::string &theType, QWidget *theParent,
const FeaturePtr &theFeature, Config_WidgetAPI *myWidgetApi) {
- QWidget *aPanel = 0;
+ QWidget *aPanel = nullptr;
if (myPanelToCreator.contains(theType)) {
WidgetCreatorPtr aCreator = myPanelToCreator[theType];
aPanel = aCreator->createPanelByType(theType, theParent, theFeature,
ModuleBase_PageBase *ModuleBase_WidgetCreatorFactory::createPageByType(
const std::string &theType, QWidget *theParent,
Config_WidgetAPI *theWidgetApi) {
- ModuleBase_PageBase *aPage = 0;
+ ModuleBase_PageBase *aPage = nullptr;
if (myPageToCreator.contains(theType)) {
WidgetCreatorPtr aCreator = myPageToCreator[theType];
ModuleBase_ModelWidget *ModuleBase_WidgetCreatorFactory::createWidgetByType(
const std::string &theType, QWidget *theParent,
Config_WidgetAPI *theWidgetApi, ModuleBase_IWorkshop *theWorkshop) {
- ModuleBase_ModelWidget *aWidget = 0;
+ ModuleBase_ModelWidget *aWidget = nullptr;
if (myCreators.contains(theType)) {
WidgetCreatorPtr aCreator = myCreators[theType];
/// \return a created panel or null
QWidget *createPanelByType(const std::string &theType, QWidget *theParent,
const FeaturePtr &theFeature,
- Config_WidgetAPI *theWidgetApi = 0);
+ Config_WidgetAPI *theWidgetApi = nullptr);
/// Returns true if there is a creator, which can make a page by the type
/// \param theType a type
ModuleBase_WidgetDoubleValue::ModuleBase_WidgetDoubleValue(
QWidget *theParent, const Config_WidgetAPI *theData)
: ModuleBase_ModelWidget(theParent, theData), myHasDefault(false) {
- QFormLayout *aControlLay = new QFormLayout(this);
+ auto *aControlLay = new QFormLayout(this);
ModuleBase_Tools::adjustMargins(aControlLay);
QString aLabelText = translate(theData->widgetLabel());
mySpinBox->setValueEnabled(isValueEnabled());
}
-ModuleBase_WidgetDoubleValue::~ModuleBase_WidgetDoubleValue() {}
+ModuleBase_WidgetDoubleValue::~ModuleBase_WidgetDoubleValue() = default;
void ModuleBase_WidgetDoubleValue::activateCustom() {
ModuleBase_ModelWidget::activateCustom();
ModuleBase_WidgetDoubleValue(QWidget *theParent,
const Config_WidgetAPI *theData);
- virtual ~ModuleBase_WidgetDoubleValue();
+ ~ModuleBase_WidgetDoubleValue() override;
/// The methiod called when widget is activated
- virtual void activateCustom();
+ void activateCustom() override;
/// Select the internal content if it can be selected. It is empty in the
/// default realization
- virtual void selectContent();
+ void selectContent() override;
/// Returns list of widget controls
/// \return a control list
- virtual QList<QWidget *> getControls() const;
+ QList<QWidget *> getControls() const override;
/// Returns True if data of its feature was modified during operation
- virtual bool isModified() const;
+ bool isModified() const override;
public slots:
// Delayed value chnged: when user starts typing something,
protected:
/// Returns true if the event is processed.
- virtual bool processEnter();
+ bool processEnter() override;
/// Saves the internal parameters to the given feature
/// \return True in success
- virtual bool storeValueCustom();
+ bool storeValueCustom() override;
//! Read value of corresponded attribute from data model to the input control
// \return True in success
- virtual bool restoreValueCustom();
+ bool restoreValueCustom() override;
/// Fills the widget with default values
/// \return true if the widget current value is reset
- virtual bool resetCustom();
+ bool resetCustom() override;
protected:
/// Label of the widget
setObjectName("ModuleBase_EditorDialog");
setMinimumWidth(100);
}
- ~ModuleBase_EditorDialog() {}
+ ~ModuleBase_EditorDialog() override = default;
protected:
// Do nothing if key pressed because it is processing on operation manager
// level
- virtual void keyPressEvent(QKeyEvent *theEvent) {
+ void keyPressEvent(QKeyEvent *theEvent) override {
if (theEvent->key() == Qt::Key_Escape)
return;
QDialog::keyPressEvent(theEvent);
ModuleBase_WidgetEditor::ModuleBase_WidgetEditor(
QWidget *theParent, const Config_WidgetAPI *theData)
: ModuleBase_WidgetDoubleValue(theParent, theData), myXPosition(-1),
- myYPosition(-1), myEditorDialog(0) {}
+ myYPosition(-1), myEditorDialog(nullptr) {}
-ModuleBase_WidgetEditor::~ModuleBase_WidgetEditor() {}
+ModuleBase_WidgetEditor::~ModuleBase_WidgetEditor() = default;
bool ModuleBase_WidgetEditor::editedValue(double theSpinMinValue,
double theSpinMaxValue,
myEditorDialog = new ModuleBase_EditorDialog(QApplication::desktop(),
Qt::FramelessWindowHint);
- QHBoxLayout *aLay = new QHBoxLayout(myEditorDialog);
+ auto *aLay = new QHBoxLayout(myEditorDialog);
aLay->setContentsMargins(2, 2, 2, 2);
- ModuleBase_ParamSpinBox *anEditor =
- new ModuleBase_ParamSpinBox(myEditorDialog);
+ auto *anEditor = new ModuleBase_ParamSpinBox(myEditorDialog);
anEditor->setMinimum(theSpinMinValue);
anEditor->setMaximum(theSpinMaxValue);
}
}
delete myEditorDialog;
- myEditorDialog = 0;
+ myEditorDialog = nullptr;
return isValueAccepted;
}
ModuleBase_WidgetEditor(QWidget *theParent, const std::string &theAttribute);
/// Destructor
- virtual ~ModuleBase_WidgetEditor();
+ ~ModuleBase_WidgetEditor() override;
/// Set focus to the first control of the current widget.
/// The focus policy of the control is checked.
/// If the widget has the NonFocus focus policy, it is skipped.
/// \return the state whether the widget can accept the focus
- virtual bool focusTo();
+ bool focusTo() override;
/// Shous popup window under cursor for data editing
/// \param theSendSignals a flag whether the signals should be sent or the
protected:
/// Returns true if the event is processed.
- virtual bool processEnter();
+ bool processEnter() override;
/// Reject the current editor dialog if it is shown and returns true.
- virtual bool processEscape();
+ bool processEscape() override;
private:
/// Show editor
#include <string>
ExpressionEditor::ExpressionEditor(QWidget *theParent)
- : QPlainTextEdit(theParent), myCompletedAndSelected(false) {
+ : QPlainTextEdit(theParent) {
myCompleter = new QCompleter(this);
myCompleter->setWidget(this);
myCompleter->setCompletionMode(QCompleter::PopupCompletion);
setTabChangesFocus(true);
}
-ExpressionEditor::~ExpressionEditor() {}
+ExpressionEditor::~ExpressionEditor() = default;
void ExpressionEditor::setCompletionList(QStringList &theList) {
theList.sort();
QWidget *theParent, const Config_WidgetAPI *theData,
const std::string &thePlaceHolder)
: ModuleBase_ModelWidget(theParent, theData) {
- QVBoxLayout *aMainLay = new QVBoxLayout(this);
+ auto *aMainLay = new QVBoxLayout(this);
ModuleBase_Tools::adjustMargins(aMainLay);
myResultLabel = new QLabel(this);
SIGNAL(keyReleased(QObject *, QKeyEvent *)));
}
-ModuleBase_WidgetExprEditor::~ModuleBase_WidgetExprEditor() {}
+ModuleBase_WidgetExprEditor::~ModuleBase_WidgetExprEditor() = default;
void ModuleBase_WidgetExprEditor::activateCustom() {
ModuleBase_ModelWidget::activateCustom();
public:
/// Constructor
/// \param theParent a parent widget
- explicit ExpressionEditor(QWidget *theParent = 0);
- virtual ~ExpressionEditor();
+ explicit ExpressionEditor(QWidget *theParent = nullptr);
+ ~ExpressionEditor() override;
/// Set list of completion strings
void setCompletionList(QStringList &);
/// Redefinition of virtual method
/// \param theEvent a key press event
- virtual void keyPressEvent(QKeyEvent *theEvent);
+ void keyPressEvent(QKeyEvent *theEvent) override;
/// Key events processing
/// theEvent a key event
bool handledCompletedAndSelected(QKeyEvent *theEvent);
/// Redefinition of virtual method
- virtual void paintEvent(QPaintEvent *);
+ void paintEvent(QPaintEvent *) override;
private:
QStringListModel *myCompleterModel;
QCompleter *myCompleter;
- bool myCompletedAndSelected;
+ bool myCompletedAndSelected{false};
QString myPlaceHolderText;
};
ModuleBase_WidgetExprEditor(QWidget *theParent,
const Config_WidgetAPI *theData,
const std::string &thePlaceHolder);
- virtual ~ModuleBase_WidgetExprEditor();
+ ~ModuleBase_WidgetExprEditor() override;
/// The methiod called when widget is activated
- virtual void activateCustom();
+ void activateCustom() override;
/// Redefinition of virtual method
- virtual QList<QWidget *> getControls() const;
+ QList<QWidget *> getControls() const override;
protected slots:
/// A slot for processing text changed event
protected:
/// Returns true if the event is processed.
- virtual bool processEnter();
+ bool processEnter() override;
/// Do not initialize value on the widget activation
- virtual void initializeValueByActivate();
+ void initializeValueByActivate() override;
/// Saves the internal parameters to the given feature
/// \return True in success
- virtual bool storeValueCustom();
+ bool storeValueCustom() override;
/// Redefinition of virtual method
- virtual bool restoreValueCustom();
+ bool restoreValueCustom() override;
private:
/// A line edit control
createWidget(aPage);
if (aWdgType == WDG_SWITCH || aWdgType == WDG_TOOLBOX ||
aWdgType == WDG_RADIOBOX) {
- ModuleBase_PagedContainer *aContainer =
+ auto *aContainer =
qobject_cast<ModuleBase_PagedContainer *>(aWidget);
QString anIconPath =
ModuleBase_WidgetCreatorFactory::get()->hasPanelWidget(aPanelName)) {
QWidget *aPanel = ModuleBase_WidgetCreatorFactory::get()->createPanelByType(
aPanelName, thePage->pageWidget(), theFeature, myWidgetApi);
- ModuleBase_ModelWidget *aModelWdg =
- dynamic_cast<ModuleBase_ModelWidget *>(aPanel);
+ auto *aModelWdg = dynamic_cast<ModuleBase_ModelWidget *>(aPanel);
if (aModelWdg)
thePage->addModelWidget(aModelWdg);
else
ModuleBase_PageBase *
ModuleBase_WidgetFactory::createPageByType(const std::string &theType,
QWidget *theParent) {
- ModuleBase_PageBase *aResult = NULL;
+ ModuleBase_PageBase *aResult = nullptr;
if (theType == WDG_GROUP) {
QString aGroupName = qs(myWidgetApi->getProperty(CONTAINER_PAGE_NAME));
- ModuleBase_PageGroupBox *aPage = new ModuleBase_PageGroupBox(theParent);
+ auto *aPage = new ModuleBase_PageGroupBox(theParent);
aPage->setTitle(ModuleBase_Tools::translate(myWidgetApi->myFeatureId,
aGroupName.toStdString()));
aResult = aPage;
} else if (theType == WDG_OPTIONALBOX) {
- ModuleBase_WidgetOptionalBox *aPage =
- new ModuleBase_WidgetOptionalBox(theParent, myWidgetApi);
+ auto *aPage = new ModuleBase_WidgetOptionalBox(theParent, myWidgetApi);
aResult = aPage;
}
if (!aResult)
aResult = ModuleBase_WidgetCreatorFactory::get()->createPageByType(
theType, theParent, myWidgetApi);
- ModuleBase_ModelWidget *aWidget =
- dynamic_cast<ModuleBase_ModelWidget *>(aResult);
+ auto *aWidget = dynamic_cast<ModuleBase_ModelWidget *>(aResult);
if (aWidget)
myModelWidgets.append(aWidget);
ModuleBase_ModelWidget *
ModuleBase_WidgetFactory::createWidgetByType(const std::string &theType,
QWidget *theParent) {
- ModuleBase_ModelWidget *result = NULL;
+ ModuleBase_ModelWidget *result = nullptr;
if (theType == WDG_INFO) {
result = new ModuleBase_WidgetLabel(theParent, myWidgetApi);
} else if (theType == WDG_TOOLBOX_BOX || theType == WDG_SWITCH_CASE ||
theType == NODE_VALIDATOR) {
// Do nothing for "box" and "case"
- result = NULL;
+ result = nullptr;
} else if (theType == WDG_ACTION) {
result = new ModuleBase_WidgetAction(theParent, myWidgetApi);
} else if (theType == WDG_POINT_INPUT) {
/// \param theType a type
/// \param theParent a parent widget
ModuleBase_ModelWidget *createWidgetByType(const std::string &theType,
- QWidget *theParent = NULL);
+ QWidget *theParent = nullptr);
/// Convert STD string to QT string
/// \param theStdString is STD string
ModuleBase_WidgetFileSelector::ModuleBase_WidgetFileSelector(
QWidget *theParent, const Config_WidgetAPI *theData)
- : ModuleBase_ModelWidget(theParent, theData), myFileDialog(0) {
+ : ModuleBase_ModelWidget(theParent, theData), myFileDialog(nullptr) {
myTitle = translate(theData->getProperty("title"));
myType = (theData->getProperty("type") == "save") ? WFS_SAVE : WFS_OPEN;
if (myDefaultPath.isNull() || myDefaultPath.isEmpty())
myDefaultPath =
Config_PropManager::string("Plugins", "import_initial_path").c_str();
- QGridLayout *aMainLay = new QGridLayout(this);
+ auto *aMainLay = new QGridLayout(this);
ModuleBase_Tools::adjustMargins(aMainLay);
- QLabel *aTitleLabel = new QLabel(myTitle, this);
+ auto *aTitleLabel = new QLabel(myTitle, this);
aTitleLabel->setIndent(1);
aMainLay->addWidget(aTitleLabel, 0, 0);
myPathField = new QLineEdit(this);
aMainLay->addWidget(myPathField, 1, 0);
- QPushButton *aSelectPathBtn = new QPushButton("...", this);
+ auto *aSelectPathBtn = new QPushButton("...", this);
aSelectPathBtn->setToolTip(tr("Select file..."));
aSelectPathBtn->setMaximumWidth(20);
aSelectPathBtn->setMaximumHeight(20);
connect(aSelectPathBtn, SIGNAL(clicked()), this, SLOT(onPathSelectionBtn()));
}
-ModuleBase_WidgetFileSelector::~ModuleBase_WidgetFileSelector() {}
+ModuleBase_WidgetFileSelector::~ModuleBase_WidgetFileSelector() = default;
bool ModuleBase_WidgetFileSelector::storeValueCustom() {
// A rare case when plugin was not loaded.
}
}
}
- myFileDialog = 0;
+ myFileDialog = nullptr;
}
void ModuleBase_WidgetFileSelector::onPathChanged() {
/// is obtained from
ModuleBase_WidgetFileSelector(QWidget *theParent,
const Config_WidgetAPI *theData);
- virtual ~ModuleBase_WidgetFileSelector();
+ ~ModuleBase_WidgetFileSelector() override;
- virtual QList<QWidget *> getControls() const;
+ QList<QWidget *> getControls() const override;
/// Returns true if a file on the current path in the line edit
/// exists and has supported format
protected:
/// Reject the current editor dialog if it is shown and returns true.
- virtual bool processEscape();
+ bool processEscape() override;
/// Saves the internal parameters to the given feature
/// \return True in success
- virtual bool storeValueCustom();
+ bool storeValueCustom() override;
- virtual bool restoreValueCustom();
+ bool restoreValueCustom() override;
protected:
/// Converts format to filter string
ModuleBase_WidgetIntValue::ModuleBase_WidgetIntValue(
QWidget *theParent, const Config_WidgetAPI *theData)
: ModuleBase_ModelWidget(theParent, theData), myHasDefault(false) {
- QFormLayout *aControlLay = new QFormLayout(this);
+ auto *aControlLay = new QFormLayout(this);
ModuleBase_Tools::adjustMargins(aControlLay);
QString aLabelText = translate(theData->widgetLabel());
SIGNAL(valuesModified()));
}
-ModuleBase_WidgetIntValue::~ModuleBase_WidgetIntValue() {}
+ModuleBase_WidgetIntValue::~ModuleBase_WidgetIntValue() = default;
void ModuleBase_WidgetIntValue::activateCustom() {
ModuleBase_ModelWidget::activateCustom();
ModuleBase_WidgetIntValue(QWidget *theParent,
const Config_WidgetAPI *theData);
- virtual ~ModuleBase_WidgetIntValue();
+ ~ModuleBase_WidgetIntValue() override;
/// The methiod called when widget is activated
- virtual void activateCustom();
+ void activateCustom() override;
/// Select the internal content if it can be selected. It is empty in the
/// default realization
- virtual void selectContent();
+ void selectContent() override;
/// Returns list of widget controls
/// \return a control list
- virtual QList<QWidget *> getControls() const;
+ QList<QWidget *> getControls() const override;
/// Returns True if data of its feature was modified during operation
- virtual bool isModified() const;
+ bool isModified() const override;
protected:
/// Returns true if the event is processed.
- virtual bool processEnter();
+ bool processEnter() override;
/// Saves the internal parameters to the given feature
/// \return True in success
- virtual bool storeValueCustom();
+ bool storeValueCustom() override;
//! Read value of corresponded attribute from data model to the input control
// \return True in success
- virtual bool restoreValueCustom();
+ bool restoreValueCustom() override;
/// Fills the widget with default values
/// \return true if the widget current value is reset
- virtual bool resetCustom();
+ bool resetCustom() override;
protected:
/// Label of the widget
if (aIsHtml)
myLabel->setTextFormat(Qt::RichText);
- QVBoxLayout *aLayout = new QVBoxLayout(this);
+ auto *aLayout = new QVBoxLayout(this);
ModuleBase_Tools::zeroMargins(aLayout);
aLayout->addWidget(myLabel);
setLayout(aLayout);
myLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
}
-ModuleBase_WidgetLabel::~ModuleBase_WidgetLabel() {}
+ModuleBase_WidgetLabel::~ModuleBase_WidgetLabel() = default;
QList<QWidget *> ModuleBase_WidgetLabel::getControls() const {
return QList<QWidget *>();
/// is obtained from
ModuleBase_WidgetLabel(QWidget *theParent, const Config_WidgetAPI *theData);
- virtual ~ModuleBase_WidgetLabel();
+ ~ModuleBase_WidgetLabel() override;
/// Defines if it is supported to set the value in this widget
/// It returns false because this is an info widget
- virtual bool canAcceptFocus() const { return false; };
+ bool canAcceptFocus() const override { return false; };
- virtual bool restoreValueCustom();
+ bool restoreValueCustom() override;
- virtual QList<QWidget *> getControls() const;
+ QList<QWidget *> getControls() const override;
/// This control doesn't accept focus
- virtual bool focusTo();
+ bool focusTo() override;
protected:
/// Saves the internal parameters to the given feature
/// \return True in success
- virtual bool storeValueCustom() { return true; }
+ bool storeValueCustom() override { return true; }
/// A label control
QLabel *myLabel;
ModuleBase_WidgetLabelValue::ModuleBase_WidgetLabelValue(
QWidget *theParent, const Config_WidgetAPI *theData)
: ModuleBase_ModelWidget(theParent, theData) {
- QVBoxLayout *aLayout = new QVBoxLayout(this);
+ auto *aLayout = new QVBoxLayout(this);
aLayout->setContentsMargins(0, 0, 0, 0);
aLayout->setSpacing(0);
aLayout->addWidget(myLabel);
}
-ModuleBase_WidgetLabelValue::~ModuleBase_WidgetLabelValue() {}
+ModuleBase_WidgetLabelValue::~ModuleBase_WidgetLabelValue() = default;
QList<QWidget *> ModuleBase_WidgetLabelValue::getControls() const {
QList<QWidget *> aControls;
ModuleBase_WidgetLabelValue(QWidget *theParent,
const Config_WidgetAPI *theData);
- virtual ~ModuleBase_WidgetLabelValue();
+ ~ModuleBase_WidgetLabelValue() override;
- virtual bool restoreValueCustom();
+ bool restoreValueCustom() override;
- virtual QList<QWidget *> getControls() const;
+ QList<QWidget *> getControls() const override;
protected:
/// Saves the internal parameters to the given feature
/// \return True in success
- virtual bool storeValueCustom();
+ bool storeValueCustom() override;
//! Switch On/Off highlighting of the widget
- virtual void setHighlighted(bool isHighlighted) {}
+ void setHighlighted(bool isHighlighted) override {}
protected:
ModuleBase_LabelValue *myLabel; ///< A label control
CustomLineEdit(QWidget *theParent, const QString &thePlaceHolder)
: QLineEdit(theParent), myPlaceHolder(thePlaceHolder) {}
- virtual ~CustomLineEdit() {}
+ ~CustomLineEdit() override = default;
/// Redefiniotion of virtual method
/// \param theEvent a paint event
- virtual void paintEvent(QPaintEvent *theEvent) {
+ void paintEvent(QPaintEvent *theEvent) override {
QLineEdit::paintEvent(theEvent);
if (text().isEmpty() && !myPlaceHolder.isEmpty()) {
QPainter aPainter(this);
QWidget *theParent, const Config_WidgetAPI *theData,
const std::string &thePlaceHolder)
: ModuleBase_ModelWidget(theParent, theData) {
- QFormLayout *aMainLay = new QFormLayout(this);
+ auto *aMainLay = new QFormLayout(this);
ModuleBase_Tools::adjustMargins(aMainLay);
QString aLabelText = translate(theData->widgetLabel());
QString aLabelIcon = QString::fromStdString(theData->widgetIcon());
- QLabel *aLabel = new QLabel(aLabelText, this);
+ auto *aLabel = new QLabel(aLabelText, this);
if (!aLabelIcon.isEmpty())
aLabel->setPixmap(ModuleBase_IconFactory::loadPixmap(aLabelIcon));
SIGNAL(valuesModified()));
}
-ModuleBase_WidgetLineEdit::~ModuleBase_WidgetLineEdit() {}
+ModuleBase_WidgetLineEdit::~ModuleBase_WidgetLineEdit() = default;
bool ModuleBase_WidgetLineEdit::storeValueCustom() {
// A rare case when plugin was not loaded.
/// \param thePlaceHolder a string of placeholder
ModuleBase_WidgetLineEdit(QWidget *theParent, const Config_WidgetAPI *theData,
const std::string &thePlaceHolder);
- virtual ~ModuleBase_WidgetLineEdit();
+ ~ModuleBase_WidgetLineEdit() override;
/// Redefinition of virtual method
- virtual QList<QWidget *> getControls() const;
+ QList<QWidget *> getControls() const override;
/// Returns True if data of its feature was modified during operation
- virtual bool isModified() const;
+ bool isModified() const override;
protected:
/// Returns true if the event is processed.
- virtual bool processEnter();
+ bool processEnter() override;
/// Saves the internal parameters to the given feature
/// \return True in success
- virtual bool storeValueCustom();
+ bool storeValueCustom() override;
/// Redefinition of virtual method
- virtual bool restoreValueCustom();
+ bool restoreValueCustom() override;
/// A line edit control
QLineEdit *myLineEdit;
const Config_WidgetAPI *theData)
: ModuleBase_WidgetSelector(theParent, theWorkshop, theData),
myIsSetSelectionBlocked(false), myCurrentHistoryIndex(-1),
- myIsFirst(true), myFiltersWgt(0), myShowOnlyBtn(0) {
+ myIsFirst(true), myFiltersWgt(nullptr), myShowOnlyBtn(nullptr) {
std::string aPropertyTypes = theData->getProperty("shape_types");
QString aTypesStr = aPropertyTypes.c_str();
myShapeTypes = aTypesStr.split(' ', QString::SkipEmptyParts);
QString aLabelText = translate(theData->getProperty("label"));
if (aLabelText.size() > 0) {
- QWidget *aLabelWgt = new QWidget(this);
- QHBoxLayout *aLabelLayout = new QHBoxLayout(aLabelWgt);
+ auto *aLabelWgt = new QWidget(this);
+ auto *aLabelLayout = new QHBoxLayout(aLabelWgt);
aLabelLayout->setContentsMargins(0, 0, 0, 0);
myMainLayout->addWidget(aLabelWgt);
- QLabel *aListLabel = new QLabel(aLabelText, this);
+ auto *aListLabel = new QLabel(aLabelText, this);
aLabelLayout->addWidget(aListLabel);
// if the xml definition contains one type, an information label
// should be shown near to the latest
if (myShapeTypes.size() <= 1) {
QString aLabelIcon = QString::fromStdString(theData->widgetIcon());
if (!aLabelIcon.isEmpty()) {
- QLabel *aSelectedLabel = new QLabel("", this);
+ auto *aSelectedLabel = new QLabel("", this);
aSelectedLabel->setPixmap(
ModuleBase_IconFactory::loadPixmap(aLabelIcon));
aLabelLayout->addWidget(aSelectedLabel);
myUseFilters = theData->getProperty("use_filters");
if (myUseFilters.length() > 0) {
- QWidget *aFltrWgt = new QWidget(this);
- QHBoxLayout *aFltrLayout = new QHBoxLayout(aFltrWgt);
+ auto *aFltrWgt = new QWidget(this);
+ auto *aFltrLayout = new QHBoxLayout(aFltrWgt);
myFiltersWgt =
new ModuleBase_FilterStarter(myUseFilters, aFltrWgt, theWorkshop);
myMainLayout->addWidget(myGeomCheck);
connect(myGeomCheck, SIGNAL(toggled(bool)), SLOT(onSameTopology(bool)));
} else
- myGeomCheck = 0;
+ myGeomCheck = nullptr;
myIsNeutralPointClear =
theData->getBooleanAttribute("clear_in_neutral_point", true);
}
}
-ModuleBase_WidgetMultiSelector::~ModuleBase_WidgetMultiSelector() {}
+ModuleBase_WidgetMultiSelector::~ModuleBase_WidgetMultiSelector() = default;
//********************************************************************
void ModuleBase_WidgetMultiSelector::activateCustom() {
if (aFeature.get())
aResult = aFeature->firstResult();
}
- aValid = aResult.get() != NULL;
+ aValid = aResult.get() != nullptr;
if (aValid) {
if (myFeature) {
// We can not select a result of our feature
void ModuleBase_WidgetMultiSelector::convertIndicesToViewerSelection(
std::set<int> theAttributeIds,
QList<ModuleBase_ViewerPrsPtr> &theValues) const {
- if (myFeature.get() == NULL)
+ if (myFeature.get() == nullptr)
return;
DataPtr aData = myFeature->data();
ObjectPtr anObject = anAttr->contextObject();
if (anObject.get())
theValues.append(std::shared_ptr<ModuleBase_ViewerPrs>(
- new ModuleBase_ViewerPrs(anObject, anAttr->value(), NULL)));
+ new ModuleBase_ViewerPrs(anObject, anAttr->value(), nullptr)));
}
} else if (aType == ModelAPI_AttributeRefList::typeId()) {
AttributeRefListPtr aRefListAttr = aData->reflist(attributeID());
ObjectPtr anObject = aRefListAttr->object(i);
if (anObject.get()) {
theValues.append(std::shared_ptr<ModuleBase_ViewerPrs>(
- new ModuleBase_ViewerPrs(anObject, GeomShapePtr(), NULL)));
+ new ModuleBase_ViewerPrs(anObject, GeomShapePtr(), nullptr)));
}
}
} else if (aType == ModelAPI_AttributeRefAttrList::typeId()) {
GeomShapePtr aGeomShape =
ModuleBase_Tools::getShape(anAttr, myWorkshop);
theValues.append(std::shared_ptr<ModuleBase_ViewerPrs>(
- new ModuleBase_ViewerPrs(anObject, aGeomShape, NULL)));
+ new ModuleBase_ViewerPrs(anObject, aGeomShape, nullptr)));
}
}
}
}
if (theGeomSelection.find(theObject) != theGeomSelection.end()) { // found
const std::set<GeomShapePtr> &aShapes = theGeomSelection.at(theObject);
- std::set<GeomShapePtr>::const_iterator anIt = aShapes.begin(),
- aLast = aShapes.end();
+ auto anIt = aShapes.begin(), aLast = aShapes.end();
for (; anIt != aLast && !aFound; anIt++) {
GeomShapePtr aCShape = *anIt;
if (aCShape.get()) {
if (!aFound && theShape.get() && theWorkshop->hasSHIFTPressed() &&
theObject->isDisplayed()) {
AISObjectPtr anAIS = theWorkshop->findPresentation(theObject);
- if (anAIS.get() != NULL) {
+ if (anAIS.get() != nullptr) {
Handle(AIS_InteractiveObject) anAISIO =
anAIS->impl<Handle(AIS_InteractiveObject)>();
myWorkshop->module()->getXMLRepresentation(myUseFilters, aXmlCfg,
aDescription);
- ModuleBase_WidgetSelectionFilter *aWgt =
- new ModuleBase_WidgetSelectionFilter(
- this, myWorkshop, new Config_WidgetAPI(aDescription), true);
+ auto *aWgt = new ModuleBase_WidgetSelectionFilter(
+ this, myWorkshop, new Config_WidgetAPI(aDescription), true);
aWgt->setFeature(aFilters);
aWgt->restoreValue();
myMainLayout->addWidget(aWgt);
ModuleBase_WidgetMultiSelector(QWidget *theParent,
ModuleBase_IWorkshop *theWorkshop,
const Config_WidgetAPI *theData);
- virtual ~ModuleBase_WidgetMultiSelector();
+ ~ModuleBase_WidgetMultiSelector() override;
/// Returns list of widget controls
/// \return a control list
- virtual QList<QWidget *> getControls() const;
+ QList<QWidget *> getControls() const override;
/// The methiod called when widget is deactivated
- virtual void deactivate();
+ void deactivate() override;
/// Update Undo/Redo actions state
- virtual void updateAfterDeactivation();
+ void updateAfterDeactivation() override;
/// Update Undo/Redo actions state
- virtual void updateAfterActivation();
+ void updateAfterActivation() override;
/// Set the given wrapped value to the current widget
/// This value should be processed in the widget according to the needs
/// \param theValues the wrapped selection values
/// \param theToValidate a validation of the values flag
- virtual bool
- setSelection(QList<std::shared_ptr<ModuleBase_ViewerPrs>> &theValues,
- const bool theToValidate);
+ bool setSelection(QList<std::shared_ptr<ModuleBase_ViewerPrs>> &theValues,
+ const bool theToValidate) override;
/// Returns values which should be highlighted when the whidget is active
/// \param theValues a list of presentations
- virtual void
- getHighlighted(QList<std::shared_ptr<ModuleBase_ViewerPrs>> &theValues);
+ void getHighlighted(
+ QList<std::shared_ptr<ModuleBase_ViewerPrs>> &theValues) override;
/// Returns true if the action can be processed. By default it is empty and
/// returns false. \param theActionType an action type \param isActionEnabled
/// if true, the enable state of the action
- virtual bool canProcessAction(ModuleBase_ActionType theActionType,
- bool &isActionEnabled);
+ bool canProcessAction(ModuleBase_ActionType theActionType,
+ bool &isActionEnabled) override;
/// Returns true if the event is processed. The default implementation is
/// empty, returns false.
- virtual bool processAction(ModuleBase_ActionType theActionType,
- const ActionParamPtr &theParam = ActionParamPtr());
+ bool
+ processAction(ModuleBase_ActionType theActionType,
+ const ActionParamPtr &theParam = ActionParamPtr()) override;
/// Checks the widget validity. By default, it returns true.
/// \param thePrs a selected presentation in the view
/// \return a boolean value
- virtual bool
- isValidSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs> &thePrs);
+ bool isValidSelectionCustom(
+ const std::shared_ptr<ModuleBase_ViewerPrs> &thePrs) override;
/// Returns list of accessible actions for Undo/Redo commands. By default it
/// returns empty list. \param theActionType type of action. It can be
/// ActionUndo or ActionRedo.
- virtual QList<ActionInfo>
- actionsList(ModuleBase_ActionType theActionType) const;
+ QList<ActionInfo>
+ actionsList(ModuleBase_ActionType theActionType) const override;
/// The slot is called when user press Ok or OkPlus buttons in the parent
/// property panel
- virtual void onFeatureAccepted();
+ void onFeatureAccepted() override;
/// Returns True if data of its feature was modified during operation
- virtual bool isModified() const;
+ bool isModified() const override;
- virtual void setReadOnly(bool isReadOnly);
+ void setReadOnly(bool isReadOnly) override;
public slots:
/// Slot is called on selection type changed
protected:
/// Returns true if envent is processed.
/// Redefined to process XML state about clear selection in neutral point
- virtual bool processSelection();
+ bool processSelection() override;
protected slots:
/// Slot for delete command in a list pop-up menu
protected:
/// Returns true if the event is processed. The default implementation is
/// empty, returns false.
- virtual bool processDelete();
+ bool processDelete() override;
/// The methiod called when widget is activated
- virtual void activateCustom();
+ void activateCustom() override;
/// Saves the internal parameters to the given feature
/// \return True in success
- virtual bool storeValueCustom();
+ bool storeValueCustom() override;
/// restire type of selection by feature attribute
- virtual bool restoreValueCustom();
+ bool restoreValueCustom() override;
/// Creates an element of the attribute current selection if history is empty
virtual void appendFirstSelectionInHistory();
void clearSelectedHistory();
/// Set the focus on the last item in the list
- virtual void updateFocus();
+ void updateFocus() override;
/// Computes and updates name of selected object in the widget
- virtual void updateSelectionName();
+ void updateSelectionName() override;
/// Emits model changed info, updates the current control by selection change
/// \param theDone a state whether the selection is set
- virtual void updateOnSelectionChanged(const bool theDone);
+ void updateOnSelectionChanged(const bool theDone) override;
/// Retunrs a list of possible shape types
/// \return a list of shapes
- virtual QIntList shapeTypes() const;
+ QIntList shapeTypes() const override;
/// Set current shape type for selection
void setCurrentShapeType(const QString &theShapeType);
/// Return the attribute values wrapped in a list of viewer presentations
/// \return a list of viewer presentations, which contains an attribute result
/// and a shape. If the attribute do not uses the shape, it is empty
- virtual QList<std::shared_ptr<ModuleBase_ViewerPrs>>
- getAttributeSelection() const;
+ QList<std::shared_ptr<ModuleBase_ViewerPrs>>
+ getAttributeSelection() const override;
/// Fills the list control by the attribute values
void updateSelectionList();
/// Returns True if the widget uses feature attribute.
/// If not then it means that the widget do not need attribute at all.
- virtual bool usesAttribute() const { return false; }
+ bool usesAttribute() const override { return false; }
- virtual bool focusTo() { return false; }
+ bool focusTo() override { return false; }
protected:
/// Saves the internal parameters to the given feature
/// \return True in success
- virtual bool storeValueCustom();
+ bool storeValueCustom() override;
/// Redefinition of virtual method
- virtual bool restoreValueCustom();
+ bool restoreValueCustom() override;
};
#endif
ModuleBase_WidgetOptionalBox::ModuleBase_WidgetOptionalBox(
QWidget *theParent, const Config_WidgetAPI *theData)
: ModuleBase_ModelWidget(theParent, theData), ModuleBase_PageBase(),
- myOptionType(CheckBox), myCheckBoxFrame(0), myCheckBox(0),
- myCheckBoxLayout(0), myCheckBoxWidget(0), myGroupBox(0),
- myGroupBoxLayout(0), myCheckGroup(0), myCheckGroupBtn(0),
- myCheckContent(0), myCheckGroupLayout(0), myEnableOnCheck(true) {
+ myOptionType(CheckBox), myCheckBoxFrame(nullptr), myCheckBox(nullptr),
+ myCheckBoxLayout(nullptr), myCheckBoxWidget(nullptr), myGroupBox(nullptr),
+ myGroupBoxLayout(nullptr), myCheckGroup(nullptr),
+ myCheckGroupBtn(nullptr), myCheckContent(nullptr),
+ myCheckGroupLayout(nullptr), myEnableOnCheck(true) {
myToolTip = theData->widgetTooltip();
myGroupTitle = theData->getProperty(CONTAINER_PAGE_NAME);
ModuleBase_Tools::adjustMargins(myMainLayout);
}
-ModuleBase_WidgetOptionalBox::~ModuleBase_WidgetOptionalBox() {}
+ModuleBase_WidgetOptionalBox::~ModuleBase_WidgetOptionalBox() = default;
QWidget *ModuleBase_WidgetOptionalBox::pageWidget() {
return myOptionType == GroupBox ? (myGroupBox ? myGroupBox : myCheckGroup)
setOptionType(GroupBox);
ModuleBase_ModelWidget *aCheckBoxWidget = myCheckBoxWidget;
- myCheckBoxWidget = 0;
+ myCheckBoxWidget = nullptr;
if (aCheckBoxWidget) // move the model widget from check box frame to group
// box frame
placeModelWidget(aCheckBoxWidget);
connect(myGroupBox, SIGNAL(clicked(bool)), this, SLOT(onPageClicked()));
} else {
myCheckGroup = new QWidget(this);
- QVBoxLayout *aLayout = new QVBoxLayout(myCheckGroup);
+ auto *aLayout = new QVBoxLayout(myCheckGroup);
ModuleBase_Tools::zeroMargins(aLayout);
myCheckGroupBtn = new QCheckBox(translate(myGroupTitle), myCheckGroup);
}
bool ModuleBase_WidgetOptionalBox::isCheckBoxFilled() const {
- return myCheckBoxWidget != 0;
+ return myCheckBoxWidget != nullptr;
}
bool ModuleBase_WidgetOptionalBox::getCurrentValue() const {
/// is obtained from
ModuleBase_WidgetOptionalBox(QWidget *theParent,
const Config_WidgetAPI *theData);
- virtual ~ModuleBase_WidgetOptionalBox();
+ ~ModuleBase_WidgetOptionalBox() override;
/// Defines if it is supported to set the value in this widget
/// \return false because this is an info widget
- virtual bool canAcceptFocus() const { return false; };
+ bool canAcceptFocus() const override { return false; };
/// Methods to be redefined from ModuleBase_PageBase: start
/// Cast the page to regular QWidget
/// Methods to be redefined from ModuleBase_ModelWidget: start
/// Returns list of widget controls
/// \return a control list
- virtual QList<QWidget *> getControls() const;
+ QList<QWidget *> getControls() const override;
/// Methods to be redefined from ModuleBase_ModelWidget: end
protected slots:
protected:
/// Methods to be redefined from ModuleBase_PageBase: start
/// Adds the given widget to page's layout
- virtual void placeModelWidget(ModuleBase_ModelWidget *theWidget);
+ void placeModelWidget(ModuleBase_ModelWidget *theWidget) override;
/// Adds the given page to page's layout
- virtual void placeWidget(QWidget *theWidget);
+ void placeWidget(QWidget *theWidget) override;
/// Returns page's layout (QGridLayout)
- virtual QLayout *pageLayout();
+ QLayout *pageLayout() override;
/// Adds a stretch to page's layout
- virtual void addPageStretch();
+ void addPageStretch() override;
/// Methods to be redefined from ModuleBase_PageBase: end
/// Methods to be redefined from ModuleBase_ModelWidget: start
/// Saves the internal parameters to the given feature
/// \return True in success
- virtual bool storeValueCustom();
+ bool storeValueCustom() override;
/// Restore value from attribute data to the widget's control
- virtual bool restoreValueCustom();
+ bool restoreValueCustom() override;
/// Methods to be redefined from ModuleBase_ModelWidget: end
private:
myDefaultValue[i] = aStrArray.at(i).toDouble();
}
}
- QFormLayout *aMainlayout = new QFormLayout(this);
+ auto *aMainlayout = new QFormLayout(this);
ModuleBase_Tools::adjustMargins(aMainlayout);
myXSpin = new ModuleBase_ParamSpinBox(this);
myXSpin->setAcceptVariables(aAcceptVariables);
myXSpin->setToolTip(tr("X coordinate"));
myXSpin->setValue(myDefaultValue[0]);
- QLabel *aXLbl = new QLabel(this);
+ auto *aXLbl = new QLabel(this);
aXLbl->setPixmap(QPixmap(":pictures/x_size.png"));
aMainlayout->addRow(aXLbl, myXSpin);
myYSpin->setAcceptVariables(aAcceptVariables);
myYSpin->setToolTip(tr("Y coordinate"));
myYSpin->setValue(myDefaultValue[1]);
- QLabel *aYLbl = new QLabel(this);
+ auto *aYLbl = new QLabel(this);
aYLbl->setPixmap(QPixmap(":pictures/y_size.png"));
aMainlayout->addRow(aYLbl, myYSpin);
myZSpin->setAcceptVariables(aAcceptVariables);
myZSpin->setToolTip(tr("Z coordinate"));
myZSpin->setValue(myDefaultValue[2]);
- QLabel *aZLbl = new QLabel(this);
+ auto *aZLbl = new QLabel(this);
aZLbl->setPixmap(QPixmap(":pictures/z_size.png"));
aMainlayout->addRow(aZLbl, myZSpin);
SIGNAL(valuesModified()));
}
-ModuleBase_WidgetPointInput::~ModuleBase_WidgetPointInput() {}
+ModuleBase_WidgetPointInput::~ModuleBase_WidgetPointInput() = default;
//********************************************************************
QList<QWidget *> ModuleBase_WidgetPointInput::getControls() const {
//********************************************************************
bool ModuleBase_WidgetPointInput ::setSelection(
QList<std::shared_ptr<ModuleBase_ViewerPrs>> &theValues,
- const bool theToValidate) {
+ const bool /*theToValidate*/) {
if (theValues.size() == 1) {
GeomShapePtr aShape = theValues.first()->shape();
if (aShape.get() && aShape->isVertex()) {
const Config_WidgetAPI *theData);
/// Destructor
- virtual ~ModuleBase_WidgetPointInput();
+ ~ModuleBase_WidgetPointInput() override;
/// Returns list of widget controls
/// \return a control list
- virtual QList<QWidget *> getControls() const;
+ QList<QWidget *> getControls() const override;
/// Saves the internal parameters to the given feature
/// \return True in success
- virtual bool storeValueCustom();
+ bool storeValueCustom() override;
/// Restore value from attribute data to the widget's control
- virtual bool restoreValueCustom();
+ bool restoreValueCustom() override;
/// Defines if it is supposed that the widget should interact with the viewer.
- virtual bool isViewerSelector() { return true; }
+ bool isViewerSelector() override { return true; }
/// Fills given container with selection modes if the widget has it
/// \param [out] theModuleSelectionModes module additional modes, -1 means all
/// default modes \param [out] theModes a container of modes
- virtual void selectionModes(int &theModuleSelectionModes, QIntList &theModes);
+ void selectionModes(int &theModuleSelectionModes,
+ QIntList &theModes) override;
/// Fills the attribute with the value of the selected owner
/// \param thePrs a selected owner
- virtual bool
- setSelection(QList<std::shared_ptr<ModuleBase_ViewerPrs>> &theValues,
- const bool theToValidate);
+ bool setSelection(QList<std::shared_ptr<ModuleBase_ViewerPrs>> &theValues,
+ const bool theToValidate) override;
protected:
/// Retunrs a list of possible shape types
/// \return a list of shapes
- virtual QIntList shapeTypes() const;
+ QIntList shapeTypes() const override;
/// Returns true if the event is processed.
- virtual bool processEnter();
+ bool processEnter() override;
protected:
ModuleBase_ParamSpinBox *myXSpin;
connect(myGroup, SIGNAL(buttonToggled(int, bool)), SLOT(onPageChanged()));
}
-ModuleBase_WidgetRadiobox::~ModuleBase_WidgetRadiobox() {}
+ModuleBase_WidgetRadiobox::~ModuleBase_WidgetRadiobox() = default;
int ModuleBase_WidgetRadiobox::addPage(ModuleBase_PageBase *thePage,
const QString &theName,
const QString &theTooltip) {
ModuleBase_PagedContainer::addPage(thePage, theName, theCaseId, theIcon,
theTooltip);
- QWidget *aWgt = new QWidget(this);
- QVBoxLayout *aLay = new QVBoxLayout(aWgt);
+ auto *aWgt = new QWidget(this);
+ auto *aLay = new QVBoxLayout(aWgt);
aLay->setContentsMargins(0, 0, 0, 0);
QRadioButton *aButton;
/// is obtained from
ModuleBase_WidgetRadiobox(QWidget *theParent,
const Config_WidgetAPI *theData);
- virtual ~ModuleBase_WidgetRadiobox();
+ ~ModuleBase_WidgetRadiobox() override;
/// Add a page to the widget
/// \param theWidget a page widget
/// \param theName a name of page
/// \param theCaseId an Id of the page
/// \param theIcon an icon of the page
- virtual int addPage(ModuleBase_PageBase *theWidget, const QString &theName,
- const QString &theCaseId, const QPixmap &theIcon,
- const QString &theTooltip);
+ int addPage(ModuleBase_PageBase *theWidget, const QString &theName,
+ const QString &theCaseId, const QPixmap &theIcon,
+ const QString &theTooltip) override;
protected:
/// Implements ModuleBase_PagedContainer
- virtual int currentPageIndex() const;
+ int currentPageIndex() const override;
/// Implements ModuleBase_PagedContainer
- virtual void setCurrentPageIndex(int);
+ void setCurrentPageIndex(int) override;
private:
QFormLayout *myLayout;
const std::string &theFeature, QWidget *theParent,
ModuleBase_IWorkshop *theWorkshop)
: QWidget(theParent), myFeatureName(theFeature), myWorkshop(theWorkshop) {
- QHBoxLayout *aMainLayout = new QHBoxLayout(this);
+ auto *aMainLayout = new QHBoxLayout(this);
ModuleBase_Tools::adjustMargins(aMainLayout);
aMainLayout->addStretch(1);
- QPushButton *aLaunchBtn = new QPushButton(
+ auto *aLaunchBtn = new QPushButton(
ModuleBase_Tools::translate("FiltersSelection", "Selection by filters"),
this);
connect(aLaunchBtn, SIGNAL(clicked()), SLOT(onFiltersLaunch()));
QString("FiltersPlugin.html");
ModuleBase_Operation *aParentOp = myWorkshop->currentOperation();
- ModuleBase_OperationFeature *aFeatureOp =
- dynamic_cast<ModuleBase_OperationFeature *>(aParentOp);
+ auto *aFeatureOp = dynamic_cast<ModuleBase_OperationFeature *>(aParentOp);
if (aFeatureOp)
// Open transaction on filters operation finish
aFeatureOp->openTransactionOnResume();
QWidget *aParent = parentWidget();
- ModuleBase_WidgetMultiSelector *aSelector =
- dynamic_cast<ModuleBase_WidgetMultiSelector *>(aParent);
+ auto *aSelector = dynamic_cast<ModuleBase_WidgetMultiSelector *>(aParent);
while (!aSelector) {
aParent = aParent->parentWidget();
aSelector = dynamic_cast<ModuleBase_WidgetMultiSelector *>(aParent);
ModuleBase_WidgetSelectionFilter::AttributeId = aSelector->attributeID();
// Launch Filters operation
- ModuleBase_OperationFeature *aFOperation =
- dynamic_cast<ModuleBase_OperationFeature *>(
- myWorkshop->module()->createOperation(myFeatureName));
+ auto *aFOperation = dynamic_cast<ModuleBase_OperationFeature *>(
+ myWorkshop->module()->createOperation(myFeatureName));
AttributeSelectionListPtr aAttrList =
ModuleBase_WidgetSelectionFilter::SelectorFeature->selectionList(
aValidatorReader.setFeatureId(mySelection->getKind());
aValidatorReader.readAll();
- QVBoxLayout *aLayout = new QVBoxLayout(this);
+ auto *aLayout = new QVBoxLayout(this);
ModuleBase_Tools::zeroMargins(aLayout);
- QWidget *aItemRow = new QWidget(this);
+ auto *aItemRow = new QWidget(this);
addItemRow(aItemRow);
aLayout->addWidget(aItemRow);
- ModuleBase_PageWidget *aParamsWgt = new ModuleBase_PageWidget(this);
+ auto *aParamsWgt = new ModuleBase_PageWidget(this);
aParamsWgt->setFrameStyle(QFrame::Box | QFrame::Raised);
aFactory.createWidget(aParamsWgt);
ModuleBase_Tools::zeroMargins(aParamsWgt->layout());
void ModuleBase_FilterItem::addItemRow(QWidget *theParent) {
std::string aContext = mySelection->getKind();
- QHBoxLayout *aLayout = new QHBoxLayout(theParent);
+ auto *aLayout = new QHBoxLayout(theParent);
ModuleBase_Tools::zeroMargins(aLayout);
// Reverse filter button
new QLabel(ModuleBase_Tools::translate(aContext, aFilterName), theParent),
1);
- QToolButton *aDelBtn = new QToolButton(theParent);
+ auto *aDelBtn = new QToolButton(theParent);
aDelBtn->setIcon(QIcon(":pictures/delete.png"));
aDelBtn->setAutoRaise(true);
aDelBtn->setToolTip(
}
// Define widgets
- QVBoxLayout *aMainLayout = new QVBoxLayout(this);
+ auto *aMainLayout = new QVBoxLayout(this);
ModuleBase_Tools::adjustMargins(aMainLayout);
- QGroupBox *aFiltersGroup = new QGroupBox(translate("Filters"), this);
- QVBoxLayout *aGroupLayout = new QVBoxLayout(aFiltersGroup);
+ auto *aFiltersGroup = new QGroupBox(translate("Filters"), this);
+ auto *aGroupLayout = new QVBoxLayout(aFiltersGroup);
aGroupLayout->setContentsMargins(0, 0, 0, 0);
aGroupLayout->setSpacing(0);
aMainLayout->addWidget(aFiltersGroup);
// Select Button
- QWidget *aBtnWgt = new QWidget(this);
- QHBoxLayout *aBtnLayout = new QHBoxLayout(aBtnWgt);
+ auto *aBtnWgt = new QWidget(this);
+ auto *aBtnLayout = new QHBoxLayout(aBtnWgt);
ModuleBase_Tools::adjustMargins(aBtnLayout);
aBtnLayout->addStretch(1);
aMainLayout->addWidget(aBtnWgt);
// Label widgets
- QWidget *aLblWgt = new QWidget(this);
- QHBoxLayout *aLblLayout = new QHBoxLayout(aLblWgt);
+ auto *aLblWgt = new QWidget(this);
+ auto *aLblLayout = new QHBoxLayout(aLblWgt);
ModuleBase_Tools::zeroMargins(aLblLayout);
aLblLayout->addWidget(
ModuleBase_FilterItem *
ModuleBase_WidgetSelectionFilter::onAddFilter(const std::string &theFilter) {
if (theFilter.length() == 0)
- return 0;
- ModuleBase_FilterItem *aItem = new ModuleBase_FilterItem(theFilter, this);
+ return nullptr;
+ auto *aItem = new ModuleBase_FilterItem(theFilter, this);
connect(aItem, SIGNAL(deleteItem(ModuleBase_FilterItem *)),
SLOT(onDeleteItem(ModuleBase_FilterItem *)));
connect(aItem, SIGNAL(reversedItem(ModuleBase_FilterItem *)),
}
void ModuleBase_WidgetSelectionFilter::onReverseItem(
- ModuleBase_FilterItem *theItem) {
+ ModuleBase_FilterItem * /*theItem*/) {
updateSelectBtn();
clearCurrentSelection(true);
updateNumberSelected();
TopoDS_Compound aComp;
aBuilder.MakeCompound(aComp);
- std::list<std::pair<ResultPtr, GeomShapePtr>>::const_iterator itSelected =
- aResList.cbegin();
+ auto itSelected = aResList.cbegin();
for (; itSelected != aResList.cend(); itSelected++) {
ResultPtr aCurRes = (*itSelected).first;
GeomShapePtr aSubShape = (*itSelected).second;
TopTools_MapOfShape aShapesMap;
if (aRes.get()) {
GeomShapePtr aSubShape = aRes->shape();
- const TopoDS_Shape &aShape = aSubShape->impl<TopoDS_Shape>();
+ const auto &aShape = aSubShape->impl<TopoDS_Shape>();
for (TopExp_Explorer anExp(aShape, (TopAbs_ShapeEnum)theShapeType);
anExp.More(); anExp.Next()) {
aShapesMap.Add(anExp.Current());
std::list<std::string>::const_iterator aIt;
int i = 0;
int aNbItems = aItemsList.size();
- ModuleBase_FilterItem *aItem = 0;
+ ModuleBase_FilterItem *aItem = nullptr;
bool isBlocked = myFiltersCombo->blockSignals(true);
for (aIt = aFilters.cbegin(); aIt != aFilters.cend(); aIt++, i++) {
std::string aStr = (*aIt);
- aItem = 0;
+ aItem = nullptr;
if (i >= aNbItems) {
aItem = onAddFilter(aStr);
FilterPtr aFilterObj = aFactory->filter(aStr);
void ModuleBase_WidgetSelectionFilter::storeFilters(
const std::list<FilterPtr> &theFilters) {
- for (std::list<FilterPtr>::const_iterator anIt = theFilters.begin();
- anIt != theFilters.end(); ++anIt) {
- std::string aName = translate((*anIt)->name()).toStdString();
- myFilters[aName] = *anIt;
+ for (const auto &theFilter : theFilters) {
+ std::string aName = translate(theFilter->name()).toStdString();
+ myFilters[aName] = theFilter;
}
}
ModuleBase_IWorkshop *theWorkshop);
/// Destructor
- ~ModuleBase_FilterStarter() {}
+ ~ModuleBase_FilterStarter() override = default;
private slots:
/// A slot to launch filtering operation
bool theReadOnly = false);
/// Destructor
- ~ModuleBase_WidgetSelectionFilter();
+ ~ModuleBase_WidgetSelectionFilter() override;
/// Returns list of widget controls
/// \return a control list
- virtual QList<QWidget *> getControls() const;
+ QList<QWidget *> getControls() const override;
/// It is called when user press Ok or OkPlus buttons in the parent property
/// panel By default this slot does nothing
- virtual void onFeatureAccepted();
+ void onFeatureAccepted() override;
/// Returns current workshop
ModuleBase_IWorkshop *workshop() const { return myWorkshop; }
QWidget *filtersWidget() const { return myFiltersWgt; }
/// Returns error string
- virtual QString getError(const bool theValueStateChecked = true) const;
+ QString getError(const bool theValueStateChecked = true) const override;
protected:
/// Saves the internal parameters to the given feature (not ussed for this
/// widget) \return True in success
- virtual bool storeValueCustom();
+ bool storeValueCustom() override;
/// Restore value from attribute data to the widget's control (not ussed for
/// this widget)
- virtual bool restoreValueCustom();
+ bool restoreValueCustom() override;
private slots:
/// Add a filter by Id in combo box
QList<ModuleBase_FilterItem *> itemsList() const;
/// Translate a string
- QString translate(const std::string &theString) const;
+ QString translate(const std::string &theString) const override;
/// Store translated names of filters and their instances
void
}
//********************************************************************
-ModuleBase_WidgetSelector::~ModuleBase_WidgetSelector() {}
+ModuleBase_WidgetSelector::~ModuleBase_WidgetSelector() = default;
//********************************************************************
void ModuleBase_WidgetSelector::getGeomSelection(
QIntList::const_iterator anIt = aShapeTypes.begin(),
aLast = aShapeTypes.end();
for (; anIt != aLast && !aValid; anIt++) {
- TopAbs_ShapeEnum aCurrentShapeType = (TopAbs_ShapeEnum)*anIt;
+ auto aCurrentShapeType = (TopAbs_ShapeEnum)*anIt;
if (aShapeType == aCurrentShapeType)
aValid = true;
else if (aCurrentShapeType == TopAbs_FACE) {
#include <ModelAPI_AttributeSelectionList.h>
ModuleBase_WidgetSelectorStore::ModuleBase_WidgetSelectorStore()
- : myIsObject(false), mySelectionType(""), mySelectionCount(0) {}
+ : mySelectionType("") {}
void ModuleBase_WidgetSelectorStore::storeAttributeValue(
const AttributePtr &theAttribute, ModuleBase_IWorkshop *theWorkshop) {
/// Constructor
MODULEBASE_EXPORT ModuleBase_WidgetSelectorStore();
/// Destructor
- MODULEBASE_EXPORT virtual ~ModuleBase_WidgetSelectorStore() {}
+ MODULEBASE_EXPORT virtual ~ModuleBase_WidgetSelectorStore() = default;
/// Creates a backup of the current values of the attribute
/// \param theAttribute a model attribute which parameters are to be stored
/// A reference of the attribute
AttributePtr myRefAttribute;
/// A boolean value whether refAttr uses reference of object
- bool myIsObject;
+ bool myIsObject{false};
/// Variable of selection type
std::string mySelectionType;
/// Variable of GeomSelection
- int mySelectionCount; // number of elements in the attribute selection list
- // when store
+ int mySelectionCount{0}; // number of elements in the attribute selection list
+ // when store
};
#endif
QWidget *theParent, ModuleBase_IWorkshop *theWorkshop,
const Config_WidgetAPI *theData)
: ModuleBase_WidgetSelector(theParent, theWorkshop, theData) {
- QFormLayout *aLayout = new QFormLayout(this);
+ auto *aLayout = new QFormLayout(this);
ModuleBase_Tools::adjustMargins(aLayout);
QString aLabelText = translate(theData->widgetLabel());
}
//********************************************************************
-ModuleBase_WidgetShapeSelector::~ModuleBase_WidgetShapeSelector() {}
+ModuleBase_WidgetShapeSelector::~ModuleBase_WidgetShapeSelector() = default;
//********************************************************************
bool ModuleBase_WidgetShapeSelector::storeValueCustom() {
// In order to make reselection possible, set empty object and shape should
// be done
setSelectionCustom(std::shared_ptr<ModuleBase_ViewerPrs>(
- new ModuleBase_ViewerPrs(ObjectPtr(), GeomShapePtr(), NULL)));
+ new ModuleBase_ViewerPrs(ObjectPtr(), GeomShapePtr(), nullptr)));
return false;
}
// it removes the processed value from the parameters list
ObjectPtr anObject = ModuleBase_Tools::getObject(anAttribute);
std::shared_ptr<GeomAPI_Shape> aShapePtr = getShape();
ModuleBase_ViewerPrsPtr aPrs(
- new ModuleBase_ViewerPrs(anObject, aShapePtr, NULL));
+ new ModuleBase_ViewerPrs(anObject, aShapePtr, nullptr));
aSelected.append(aPrs);
}
return aSelected;
if (!isNameUpdated) {
ObjectPtr anObject =
ModuleBase_Tools::getObject(myFeature->attribute(attributeID()));
- if (anObject.get() != NULL) {
+ if (anObject.get() != nullptr) {
std::wstring aName = anObject->data()->name();
myTextLine->setText(QString::fromStdWString(aName));
} else {
AttributeRefAttrPtr aRefAttr = aData->refattr(attributeID());
- if (aRefAttr && aRefAttr->attr().get() != NULL) {
+ if (aRefAttr && aRefAttr->attr().get() != nullptr) {
// myIsObject = aRefAttr->isObject();
std::wstring anAttrName =
ModuleBase_Tools::generateName(aRefAttr->attr(), myWorkshop);
ModuleBase_IWorkshop *theWorkshop,
const Config_WidgetAPI *theData);
- virtual ~ModuleBase_WidgetShapeSelector();
+ ~ModuleBase_WidgetShapeSelector() override;
/// Set the given wrapped value to the current widget
/// This value should be processed in the widget according to the needs
/// preselection. It is redefined to check the value validity and if it is,
/// fill the attribute with by value \param theValues the wrapped selection
/// values \param theToValidate a flag on validation of the values
- virtual bool
- setSelection(QList<std::shared_ptr<ModuleBase_ViewerPrs>> &theValues,
- const bool theToValidate);
+ bool setSelection(QList<std::shared_ptr<ModuleBase_ViewerPrs>> &theValues,
+ const bool theToValidate) override;
/// Returns list of widget controls
/// \return a control list
- virtual QList<QWidget *> getControls() const;
+ QList<QWidget *> getControls() const override;
/// Returns True if data of its feature was modified during operation
- virtual bool isModified() const;
+ bool isModified() const override;
protected:
/// Saves the internal parameters to the given feature
/// \return True in success
- virtual bool storeValueCustom();
+ bool storeValueCustom() override;
- virtual bool restoreValueCustom();
+ bool restoreValueCustom() override;
/// Computes and updates name of selected object in the widget
- virtual void updateSelectionName();
+ void updateSelectionName() override;
// Update focus after the attribute value change
- virtual void updateFocus();
+ void updateFocus() override;
/// Retunrs a list of possible shape types
/// \return a list of shapes
- virtual QIntList shapeTypes() const;
+ QIntList shapeTypes() const override;
/// Get the shape from the attribute if the attribute contains a shape, e.g.
/// selection attribute \return a shape
/// Return the attribute values wrapped in a list of viewer presentations
/// \return a list of viewer presentations, which contains an attribute result
/// and a shape. If the attribute do not uses the shape, it is empty
- virtual QList<std::shared_ptr<ModuleBase_ViewerPrs>>
- getAttributeSelection() const;
+ QList<std::shared_ptr<ModuleBase_ViewerPrs>>
+ getAttributeSelection() const override;
//----------- Class members -------------
protected:
QWidget *theParent, const Config_WidgetAPI *theData)
: ModuleBase_PagedContainer(theParent, theData) {
myRemeberChoice = false;
- QVBoxLayout *aMainLay = new QVBoxLayout(this);
+ auto *aMainLay = new QVBoxLayout(this);
// aMainLay->setContentsMargins(2, 4, 2, 2);
ModuleBase_Tools::adjustMargins(aMainLay);
myCombo = new QComboBox(this);
SLOT(setCurrentIndex(int)));
}
-ModuleBase_WidgetSwitch::~ModuleBase_WidgetSwitch() {}
+ModuleBase_WidgetSwitch::~ModuleBase_WidgetSwitch() = default;
int ModuleBase_WidgetSwitch::addPage(ModuleBase_PageBase *thePage,
const QString &theName,
int aResultCount = myCombo->count();
if (aResultCount == 2)
myCombo->show();
- QFrame *aFrame = dynamic_cast<QFrame *>(thePage);
+ auto *aFrame = dynamic_cast<QFrame *>(thePage);
aFrame->setFrameShape(QFrame::Box);
aFrame->setFrameStyle(QFrame::Sunken);
myPagesLayout->addWidget(aFrame);
/// \param theData the widget configuration. The attribute of the model widget
/// is obtained from
ModuleBase_WidgetSwitch(QWidget *theParent, const Config_WidgetAPI *theData);
- virtual ~ModuleBase_WidgetSwitch();
+ ~ModuleBase_WidgetSwitch() override;
/// Defines if it is supported to set the value in this widget
/// It returns false because this is an info widget
- virtual bool canAcceptFocus() const { return false; };
+ bool canAcceptFocus() const override { return false; };
/// Add a page to the widget
/// \param theWidget a page widget
/// \param theName a name of page
/// \param theCaseId an Id of the page
/// \param theIcon an icon of the page
- virtual int addPage(ModuleBase_PageBase *theWidget, const QString &theName,
- const QString &theCaseId, const QPixmap &theIcon,
- const QString &theTooltip);
+ int addPage(ModuleBase_PageBase *theWidget, const QString &theName,
+ const QString &theCaseId, const QPixmap &theIcon,
+ const QString &theTooltip) override;
protected:
/// Returns index of the current page
- virtual int currentPageIndex() const;
+ int currentPageIndex() const override;
/// Set current page by index
/// \param index index of the page
- virtual void setCurrentPageIndex(int index);
+ void setCurrentPageIndex(int index) override;
private:
/// Combo box
ModuleBase_WidgetToolbox::ModuleBase_WidgetToolbox(
QWidget *theParent, const Config_WidgetAPI *theData)
: ModuleBase_PagedContainer(theParent, theData) {
- QVBoxLayout *aMainLayout = new QVBoxLayout(this);
+ auto *aMainLayout = new QVBoxLayout(this);
ModuleBase_Tools::zeroMargins(aMainLayout);
bool aHasContainerParent = false;
- QWidget *aParent = dynamic_cast<QWidget *>(parent());
+ auto *aParent = dynamic_cast<QWidget *>(parent());
while (aParent && !aHasContainerParent) {
- ModuleBase_PagedContainer *aPagedContainer =
- dynamic_cast<ModuleBase_PagedContainer *>(aParent);
+ auto *aPagedContainer = dynamic_cast<ModuleBase_PagedContainer *>(aParent);
aHasContainerParent = aPagedContainer;
aParent = dynamic_cast<QWidget *>(aParent->parent());
}
connect(myToolBox, SIGNAL(currentChanged(int)), this, SLOT(onPageChanged()));
}
-ModuleBase_WidgetToolbox::~ModuleBase_WidgetToolbox() {}
+ModuleBase_WidgetToolbox::~ModuleBase_WidgetToolbox() = default;
int ModuleBase_WidgetToolbox::addPage(ModuleBase_PageBase *thePage,
const QString &theName,
const QString &theTooltip) {
ModuleBase_PagedContainer::addPage(thePage, theName, theCaseId, theIcon,
theTooltip);
- QFrame *aFrame = dynamic_cast<QFrame *>(thePage);
+ auto *aFrame = dynamic_cast<QFrame *>(thePage);
myToolBox->addItem(aFrame, translate(theName.toStdString()), theIcon);
return myToolBox->count();
}
/// \param theData the widget configuration. The attribute of the model widget
/// is obtained from
ModuleBase_WidgetToolbox(QWidget *theParent, const Config_WidgetAPI *theData);
- virtual ~ModuleBase_WidgetToolbox();
+ ~ModuleBase_WidgetToolbox() override;
/// Defines if it is supported to set the value in this widget
/// \return false because this is an info widget
- virtual bool canAcceptFocus() const { return false; };
+ bool canAcceptFocus() const override { return false; };
/// Add a page to the widget
/// \param theWidget a page widget
/// \param theName a name of page
/// \param theCaseId an Id of the page
/// \param theIcon an icon of the page
- virtual int addPage(ModuleBase_PageBase *theWidget, const QString &theName,
- const QString &theCaseId, const QPixmap &theIcon,
- const QString &theTooltip);
+ int addPage(ModuleBase_PageBase *theWidget, const QString &theName,
+ const QString &theCaseId, const QPixmap &theIcon,
+ const QString &theTooltip) override;
protected:
/// Implements ModuleBase_PagedContainer
- virtual int currentPageIndex() const;
+ int currentPageIndex() const override;
/// Implements ModuleBase_PagedContainer
- virtual void setCurrentPageIndex(int);
+ void setCurrentPageIndex(int) override;
private:
ModuleBase_ToolBox *myToolBox;
ModuleBase_IWorkshop *theWorkshop,
const Config_WidgetAPI *theData);
- virtual ~ModuleBase_WidgetUndoLabel() {}
+ ~ModuleBase_WidgetUndoLabel() override = default;
- virtual bool restoreValueCustom();
+ bool restoreValueCustom() override;
private slots:
void onUndo();
//********************************************************************
ObjectPtr ModuleBase_WidgetValidated::findPresentedObject(
- const AISObjectPtr &theAIS) const {
+ const AISObjectPtr & /*theAIS*/) const {
return myPresentedObject;
}
//********************************************************************
void ModuleBase_WidgetValidated::restoreAttributeValue(
- const AttributePtr &theAttribute, const bool theValid) {
+ const AttributePtr &theAttribute, const bool /*theValid*/) {
myIsInValidate = false;
myAttributeStore->restoreAttributeValue(theAttribute, myWorkshop);
}
//********************************************************************
bool ModuleBase_WidgetValidated::isValidSelectionCustom(
- const ModuleBase_ViewerPrsPtr &thePrs) {
+ const ModuleBase_ViewerPrsPtr & /*thePrs*/) {
return true;
}
//********************************************************************
void ModuleBase_WidgetValidated::selectionFilters(
- QIntList &theModuleSelectionFilters,
+ QIntList & /*theModuleSelectionFilters*/,
SelectMgr_ListOfFilter &theSelectionFilters) {
theSelectionFilters.Append(myWorkshop->validatorFilter());
}
GeomShapePtr aShape = theValue.get() ? theValue->shape() : GeomShapePtr();
if (aShape.get()) {
if (theValid) {
- const TopoDS_Shape &aTDShape = aShape->impl<TopoDS_Shape>();
+ const auto &aTDShape = aShape->impl<TopoDS_Shape>();
bool aValidPrsContains =
myValidPrs.IsBound(aTDShape) &&
theValue.get()->isEqual(myValidPrs.Find(aTDShape).get());
}
} else { // !theValid
if (aShape.get()) {
- const TopoDS_Shape &aTDShape = aShape->impl<TopoDS_Shape>();
+ const auto &aTDShape = aShape->impl<TopoDS_Shape>();
bool anIValidPrsContains =
myInvalidPrs.IsBound(aTDShape) &&
theValue.get()->isEqual(myInvalidPrs.Find(aTDShape).get());
if (!aShape.get())
return false;
- const TopoDS_Shape &aTDShape = aShape->impl<TopoDS_Shape>();
+ const auto &aTDShape = aShape->impl<TopoDS_Shape>();
bool aValidPrsContains =
myValidPrs.IsBound(aTDShape) &&
theValue.get()->isEqual(myValidPrs.Find(aTDShape).get());
FeaturePtr aFeature =
std::dynamic_pointer_cast<ModelAPI_Feature>(anObject);
if (aFeature.get()) {
- std::list<ResultPtr>::const_iterator aRes =
- aFeature->results().cbegin();
+ auto aRes = aFeature->results().cbegin();
for (; aRes != aFeature->results().cend(); aRes++)
aFilterOut.insert(*aRes);
}
//********************************************************************
void ModuleBase_WidgetValidator::selectionFilters(
- QIntList &theModuleSelectionFilters,
+ QIntList & /*theModuleSelectionFilters*/,
SelectMgr_ListOfFilter &theSelectionFilters) {
theSelectionFilters.Append(myWorkshop->validatorFilter());
}
}
void ModuleBase_WidgetValidator::restoreAttributeValue(
- const AttributePtr &theAttribute, const bool theValid) {
+ const AttributePtr &theAttribute, const bool /*theValid*/) {
myIsInValidate = false;
myAttributeStore->restoreAttributeValue(theAttribute, myWorkshop);
}
return aRes->data()->real(ModelAPI_ResultParameter::VALUE())->value();
}
-ParametersAPI_Parameter::~ParametersAPI_Parameter() {}
+ParametersAPI_Parameter::~ParametersAPI_Parameter() = default;
void ParametersAPI_Parameter::dump(ModelHighAPI_Dumper &theDumper) const {
FeaturePtr aBase = feature();
const ParameterPtr &theParameter) {
FeaturePtr aParam = theParameter->feature();
if (aParam) {
- ModelAPI_ReplaceParameterMessage::send(aParam, 0);
+ ModelAPI_ReplaceParameterMessage::send(aParam, nullptr);
thePart->removeFeature(aParam);
}
}
const std::wstring &theComment = std::wstring());
/// Destructor
PARAMETERSAPI_EXPORT
- virtual ~ParametersAPI_Parameter();
+ ~ParametersAPI_Parameter() override;
INTERFACE_3(ParametersPlugin_Parameter::ID(), name,
ParametersPlugin_Parameter::VARIABLE_ID(),
/// Dump wrapped feature
PARAMETERSAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
//! Pointer on Parameter object
Events_ID anEvents_IDs[] = {ModelAPI_ObjectRenamedMessage::eventId(),
ModelAPI_ReplaceParameterMessage::eventId()};
- for (unsigned long long i = 0;
- i < sizeof(anEvents_IDs) / sizeof(anEvents_IDs[0]); ++i)
- aLoop->registerListener(this, anEvents_IDs[i], NULL, true);
+ for (auto anEvents_ID : anEvents_IDs)
+ aLoop->registerListener(this, anEvents_ID, nullptr, true);
}
-ParametersPlugin_EvalListener::~ParametersPlugin_EvalListener() {}
+ParametersPlugin_EvalListener::~ParametersPlugin_EvalListener() = default;
void ParametersPlugin_EvalListener::processEvent(
const std::shared_ptr<Events_Message> &theMessage) {
return anExpressionString;
std::map<int, std::list<int>> aLines;
- std::list<std::pair<int, int>>::const_iterator it = aPositions.begin();
+ auto it = aPositions.begin();
for (; it != aPositions.end(); ++it)
aLines[it->first].push_back(it->second);
aLineStart = anExpressionString.find(L"\n", aLineStart) + 1;
const std::list<int> &aColOffsets = ritLine->second;
- std::list<int>::const_reverse_iterator ritOffset = aColOffsets.rbegin();
+ auto ritOffset = aColOffsets.rbegin();
for (; ritOffset != aColOffsets.rend(); ++ritOffset) {
int anOffset = *ritOffset;
anExpressionString.replace(aLineStart + anOffset, theOldName.size(),
std::dynamic_pointer_cast<GeomDataAPI_Point>(theAttribute);
std::wstring anExpressionString[3] = {
anAttribute->textX(), anAttribute->textY(), anAttribute->textZ()};
- for (int i = 0; i < 3; ++i)
- anExpressionString[i] = renameInPythonExpression(anExpressionString[i],
- theOldName, theNewName);
+ for (auto &i : anExpressionString)
+ i = renameInPythonExpression(i, theOldName, theNewName);
anAttribute->setText(anExpressionString[0], anExpressionString[1],
anExpressionString[2]);
} else if (theAttribute->attributeType() == GeomDataAPI_Point2D::typeId()) {
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(theAttribute);
std::wstring anExpressionString[2] = {anAttribute->textX(),
anAttribute->textY()};
- for (int i = 0; i < 2; ++i)
- anExpressionString[i] = renameInPythonExpression(anExpressionString[i],
- theOldName, theNewName);
+ for (auto &i : anExpressionString)
+ i = renameInPythonExpression(i, theOldName, theNewName);
anAttribute->setText(anExpressionString[0], anExpressionString[1]);
}
}
const std::wstring &theOldName, const std::wstring &theNewName) {
std::set<std::shared_ptr<ModelAPI_Attribute>> anAttributes =
theResultParameter->data()->refsToMe();
- std::set<std::shared_ptr<ModelAPI_Attribute>>::const_iterator anAttributeIt =
- anAttributes.cbegin();
+ auto anAttributeIt = anAttributes.cbegin();
for (; anAttributeIt != anAttributes.cend(); ++anAttributeIt) {
const AttributePtr &anAttribute = *anAttributeIt;
if (anAttribute->attributeType() == ModelAPI_AttributeRefList::typeId()) {
Events_InfoMessage aMsg(aMsgContext, aMsgText);
aMsg.arg(aNotActivatedNames.c_str());
QMessageBox::StandardButton aRes = QMessageBox::warning(
- 0, ModuleBase_Tools::translate(aMsgContext, "Warning"),
+ nullptr, ModuleBase_Tools::translate(aMsgContext, "Warning"),
ModuleBase_Tools::translate(aMsg), QMessageBox::No | QMessageBox::Yes,
QMessageBox::No);
if (aRes != QMessageBox::Yes) {
public:
PARAMETERSPLUGIN_EXPORT ParametersPlugin_EvalListener();
- PARAMETERSPLUGIN_EXPORT virtual ~ParametersPlugin_EvalListener();
+ PARAMETERSPLUGIN_EXPORT ~ParametersPlugin_EvalListener() override;
/// Reimplemented from Events_Listener::processEvent().
PARAMETERSPLUGIN_EXPORT
- virtual void processEvent(const std::shared_ptr<Events_Message> &theMessage);
+ void processEvent(const std::shared_ptr<Events_Message> &theMessage) override;
protected:
/// Processes ObjectRenamed event.
#include <sstream>
#include <string>
-ParametersPlugin_Parameter::ParametersPlugin_Parameter() {}
+ParametersPlugin_Parameter::ParametersPlugin_Parameter() = default;
-ParametersPlugin_Parameter::~ParametersPlugin_Parameter() {}
+ParametersPlugin_Parameter::~ParametersPlugin_Parameter() = default;
void ParametersPlugin_Parameter::initAttributes() {
data()->addAttribute(VARIABLE_ID(), ModelAPI_AttributeString::typeId());
if (anOldName != aName) {
aNames.push_back(anOldName);
}
- std::list<std::wstring>::iterator aNIter = aNames.begin();
+ auto aNIter = aNames.begin();
for (; aNIter != aNames.end(); aNIter++) {
double aValue;
ResultParameterPtr aRootParam;
aRootDoc)) {
std::set<std::shared_ptr<ModelAPI_Attribute>> anAttributes =
aRootParam->data()->refsToMe();
- std::set<std::shared_ptr<ModelAPI_Attribute>>::const_iterator
- anAttributeIt = anAttributes.cbegin();
+ auto anAttributeIt = anAttributes.cbegin();
for (; anAttributeIt != anAttributes.cend(); ++anAttributeIt) {
const AttributePtr &anAttribute = *anAttributeIt;
- ModelAPI_AttributeEvalMessage::send(anAttribute, NULL);
+ ModelAPI_AttributeEvalMessage::send(anAttribute, nullptr);
}
}
}
AttributeRefListPtr aParams = reflist(ARGUMENTS_ID());
bool aDifferent = aParams->size() != (int)aParamsList.size();
if (!aDifferent) {
- std::list<ResultParameterPtr>::const_iterator aNewIter =
- aParamsList.begin();
+ auto aNewIter = aParamsList.begin();
std::list<ObjectPtr> anOldList = aParams->list();
std::list<ObjectPtr>::const_iterator anOldIter = anOldList.begin();
for (; !aDifferent && aNewIter != aParamsList.end();
}
if (aDifferent) {
aParams->clear();
- std::list<ResultParameterPtr>::const_iterator aNewIter =
- aParamsList.begin();
+ auto aNewIter = aParamsList.begin();
for (; aNewIter != aParamsList.end(); aNewIter++) {
aParams->append(*aNewIter);
}
*/
class ParametersPlugin_Parameter : public ModelAPI_Feature {
public:
- virtual ~ParametersPlugin_Parameter();
+ ~ParametersPlugin_Parameter() override;
/// Feature kind
inline static const std::string &ID() {
}
/// Returns the kind of a feature
- PARAMETERSPLUGIN_EXPORT virtual const std::string &getKind() {
+ PARAMETERSPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = ParametersPlugin_Parameter::ID();
return MY_KIND;
}
/// Pre-execution is not needed for parameter
- PARAMETERSPLUGIN_EXPORT virtual bool isPreviewNeeded() const;
+ PARAMETERSPLUGIN_EXPORT bool isPreviewNeeded() const override;
/// Creates a parameter in document
- PARAMETERSPLUGIN_EXPORT virtual void execute();
+ PARAMETERSPLUGIN_EXPORT void execute() override;
/// Request for initialization of data model of the feature: adding all
/// attributes
- PARAMETERSPLUGIN_EXPORT virtual void initAttributes();
+ PARAMETERSPLUGIN_EXPORT void initAttributes() override;
/// Reimplemented from ModelAPI_Feature::isInHistory(). Returns false.
- PARAMETERSPLUGIN_EXPORT virtual bool isInHistory();
+ PARAMETERSPLUGIN_EXPORT bool isInHistory() override;
/// Reimplemented from ModelAPI_Feature::isInHistory().
- PARAMETERSPLUGIN_EXPORT virtual void
- attributeChanged(const std::string &theID);
+ PARAMETERSPLUGIN_EXPORT void
+ attributeChanged(const std::string &theID) override;
/// Use plugin manager for features creation
ParametersPlugin_Parameter();
ParametersPlugin_ParametersMgr::ParametersPlugin_ParametersMgr()
: ModelAPI_Feature() {}
-ParametersPlugin_ParametersMgr::~ParametersPlugin_ParametersMgr() {}
+ParametersPlugin_ParametersMgr::~ParametersPlugin_ParametersMgr() = default;
void ParametersPlugin_ParametersMgr::initAttributes() {}
ParametersPlugin_ParametersMgr();
/// Destructor
- virtual ~ParametersPlugin_ParametersMgr();
+ ~ParametersPlugin_ParametersMgr() override;
/// Request for initialization of data model of the feature: adding all
/// attributes
- PARAMETERSPLUGIN_EXPORT virtual void initAttributes();
+ PARAMETERSPLUGIN_EXPORT void initAttributes() override;
/// Returns the unique kind of a feature
- PARAMETERSPLUGIN_EXPORT virtual const std::string &getKind() {
+ PARAMETERSPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = ParametersPlugin_ParametersMgr::ID();
return MY_KIND;
};
/// Computes or recomputes the results
- PARAMETERSPLUGIN_EXPORT virtual void execute();
+ PARAMETERSPLUGIN_EXPORT void execute() override;
/// Reimplemented from ModelAPI_Feature::isMacro(). Returns true.
- PARAMETERSPLUGIN_EXPORT virtual bool isMacro() const { return true; }
+ PARAMETERSPLUGIN_EXPORT bool isMacro() const override { return true; }
/// Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false.
- PARAMETERSPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; }
+ PARAMETERSPLUGIN_EXPORT bool isPreviewNeeded() const override {
+ return false;
+ }
/// Returns true if result is persistent (stored in document) and on
/// undo-redo, save-open it is not needed to recompute it.
- PARAMETERSPLUGIN_EXPORT virtual bool isPersistentResult() { return false; }
+ PARAMETERSPLUGIN_EXPORT bool isPersistentResult() override { return false; }
/// Returns true if this feature must not be created: this is just an action
/// that is not stored in the features history and data model (like "delete
/// part").
- virtual bool isInHistory() { return false; }
+ bool isInHistory() override { return false; }
};
#endif
class ParametersPlugin_Plugin : public ModelAPI_Plugin {
public:
/// Creates the feature object of this plugin by the feature string ID
- PARAMETERSPLUGIN_EXPORT virtual FeaturePtr
- createFeature(std::string theFeatureID);
+ PARAMETERSPLUGIN_EXPORT FeaturePtr
+ createFeature(std::string theFeatureID) override;
public:
ParametersPlugin_Plugin();
#include <ModelAPI_ResultParameter.h>
#include <ModelAPI_Tools.h>
-ParametersPlugin_VariableValidator::ParametersPlugin_VariableValidator() {}
+ParametersPlugin_VariableValidator::ParametersPlugin_VariableValidator() =
+ default;
-ParametersPlugin_VariableValidator::~ParametersPlugin_VariableValidator() {}
+ParametersPlugin_VariableValidator::~ParametersPlugin_VariableValidator() =
+ default;
bool ParametersPlugin_VariableValidator::isValid(
const AttributePtr &theAttribute,
return true;
}
-ParametersPlugin_ExpressionValidator::ParametersPlugin_ExpressionValidator() {}
+ParametersPlugin_ExpressionValidator::ParametersPlugin_ExpressionValidator() =
+ default;
-ParametersPlugin_ExpressionValidator::~ParametersPlugin_ExpressionValidator() {}
+ParametersPlugin_ExpressionValidator::~ParametersPlugin_ExpressionValidator() =
+ default;
bool ParametersPlugin_ExpressionValidator::isValid(
const AttributePtr &theAttribute,
class ParametersPlugin_VariableValidator : public ModelAPI_AttributeValidator {
public:
PARAMETERSPLUGIN_EXPORT ParametersPlugin_VariableValidator();
- PARAMETERSPLUGIN_EXPORT virtual ~ParametersPlugin_VariableValidator();
+ PARAMETERSPLUGIN_EXPORT ~ParametersPlugin_VariableValidator() override;
/**
* \brief Returns true if attribute has a valid parameter name.
* \param theArguments arguments of the attribute
* \param theError the error string message if validation fails
*/
- PARAMETERSPLUGIN_EXPORT virtual bool
+ PARAMETERSPLUGIN_EXPORT bool
isValid(const AttributePtr &theAttribute,
const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ Events_InfoMessage &theError) const override;
protected:
/// Returns true if theString is unique parameter name in the document of
: public ModelAPI_AttributeValidator {
public:
PARAMETERSPLUGIN_EXPORT ParametersPlugin_ExpressionValidator();
- PARAMETERSPLUGIN_EXPORT virtual ~ParametersPlugin_ExpressionValidator();
+ PARAMETERSPLUGIN_EXPORT ~ParametersPlugin_ExpressionValidator() override;
/**
* \brief Returns true if attribute has a valid parameter expression.
* \param theArguments arguments of the attribute
* \param theError the error string message if validation fails
*/
- PARAMETERSPLUGIN_EXPORT virtual bool
+ PARAMETERSPLUGIN_EXPORT bool
isValid(const AttributePtr &theAttribute,
const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ Events_InfoMessage &theError) const override;
};
#endif /* PARAMETERSPLUGIN_VARIABLEVALIDATOR_H_ */
ModuleBase_ModelWidget *ParametersPlugin_WidgetCreator::createWidgetByType(
const std::string &theType, QWidget *theParent,
Config_WidgetAPI *theWidgetApi, ModuleBase_IWorkshop *theWorkshop) {
- ModuleBase_ModelWidget *aModelWidget = 0;
+ ModuleBase_ModelWidget *aModelWidget = nullptr;
if (theType == "parameters-manager") {
aModelWidget = new ParametersPlugin_WidgetParamsMgr(theParent, theWidgetApi,
theWorkshop);
/// Returns a container of possible widget types, which this creator can
/// process \param theTypes a list of type names
- virtual void widgetTypes(std::set<std::string> &theTypes);
+ void widgetTypes(std::set<std::string> &theTypes) override;
/// Create widget by its type
/// The default implementation is empty
/// \param theWidgetApi a low-level API for reading xml definitions of widgets
/// \param theWorkshop a current workshop
/// \return a created model widget or null
- virtual ModuleBase_ModelWidget *
+ ModuleBase_ModelWidget *
createWidgetByType(const std::string &theType, QWidget *theParent,
Config_WidgetAPI *theWidgetApi,
- ModuleBase_IWorkshop *theWorkshop);
+ ModuleBase_IWorkshop *theWorkshop) override;
};
#endif
/// \param painter a painter object
/// \param option the item options
/// \param index the current index
- virtual void paint(QPainter *painter, const QStyleOptionViewItem &option,
- const QModelIndex &index) const;
+ void paint(QPainter *painter, const QStyleOptionViewItem &option,
+ const QModelIndex &index) const override;
/// Redefinition of virtual method
/// \param parent a parent widget
/// \param option the item options
/// \param index the current index
- virtual QWidget *createEditor(QWidget *parent,
- const QStyleOptionViewItem &option,
- const QModelIndex &index) const;
+ QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
+ const QModelIndex &index) const override;
/// Returns True if the given index is editable item
/// \param theIndex an item index
ModuleBase_IWorkshop *theWorkshop)
: ModuleBase_ModelDialogWidget(theParent, theData), myWorkshop(theWorkshop),
isUpplyBlocked(false) {
- QVBoxLayout *aLayout = new QVBoxLayout(this);
+ auto *aLayout = new QVBoxLayout(this);
myTable = new ParametersPlugin_TreeWidget(this);
myTable->setColumnCount(4);
myFeatures->setFlags(Qt::ItemIsEnabled);
myTable->addTopLevelItem(myFeatures);
- QHBoxLayout *aBtnLayout = new QHBoxLayout(this);
+ auto *aBtnLayout = new QHBoxLayout(this);
myUpBtn = new QToolButton(this);
myUpBtn->setArrowType(Qt::UpArrow);
if (aAddStr.isEmpty())
aAddStr = "Ctrl+A";
- QShortcut *aAddShc = new QShortcut(QKeySequence(aAddStr), myAddBtn);
+ auto *aAddShc = new QShortcut(QKeySequence(aAddStr), myAddBtn);
connect(aAddShc, SIGNAL(activated()), SLOT(onAdd()));
myInsertBtn = new QPushButton(translate("Insert"), this);
ModuleBase_ModelDialogWidget::setDialogButtons(theButtons);
QWidget *aBtnParentWgt = myOkCancelBtn->parentWidget();
- QHBoxLayout *aBtnParentLayout =
- dynamic_cast<QHBoxLayout *>(aBtnParentWgt->layout());
+ auto *aBtnParentLayout = dynamic_cast<QHBoxLayout *>(aBtnParentWgt->layout());
- QPushButton *aPreviewBtn =
- new QPushButton(translate("See preview"), aBtnParentWgt);
+ auto *aPreviewBtn = new QPushButton(translate("See preview"), aBtnParentWgt);
aBtnParentLayout->insertWidget(0, aPreviewBtn);
aBtnParentLayout->insertStretch(1, 1);
connect(aPreviewBtn, SIGNAL(clicked(bool)), SLOT(onShowPreview()));
}
void ParametersPlugin_WidgetParamsMgr::onCloseEditor(
- QWidget *theEditor, QAbstractItemDelegate::EndEditHint theHint) {
+ QWidget * /*theEditor*/, QAbstractItemDelegate::EndEditHint /*theHint*/) {
FeaturePtr aFeature = myParametersList.at(myDelegate->editIndex().row());
QTreeWidgetItem *aItem = myParameters->child(myDelegate->editIndex().row());
int aColumn = myDelegate->editIndex().column();
aValues << translate(NoName);
aValues << translate(NoValue);
- QTreeWidgetItem *aItem = new QTreeWidgetItem(aValues);
+ auto *aItem = new QTreeWidgetItem(aValues);
if (theParent == myParameters) {
aItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable |
Qt::ItemIsEnabled);
QTreeWidgetItem *ParametersPlugin_WidgetParamsMgr::selectedItem() const {
QList<QTreeWidgetItem *> aItemsList = myTable->selectedItems();
if (aItemsList.count() == 0)
- return 0;
+ return nullptr;
QTreeWidgetItem *aCurrentItem = aItemsList.first();
if (aCurrentItem->parent() != myParameters)
- return 0;
+ return nullptr;
return aCurrentItem;
}
public:
/// Constructor
/// \param theParent a parent widget
- ParametersPlugin_TreeWidget(QWidget *theParent = 0)
+ ParametersPlugin_TreeWidget(QWidget *theParent = nullptr)
: QTreeWidget(theParent) {}
protected slots:
/// Redefinition of virtual method
/// \param theEditor a editor widget
/// \param theHint end of editing hint
- virtual void closeEditor(QWidget *theEditor,
- QAbstractItemDelegate::EndEditHint theHint);
+ void closeEditor(QWidget *theEditor,
+ QAbstractItemDelegate::EndEditHint theHint) override;
};
/*!
ModuleBase_IWorkshop *theWorkshop);
/// Destructs the model widget
- virtual ~ParametersPlugin_WidgetParamsMgr() {}
+ ~ParametersPlugin_WidgetParamsMgr() override = default;
/// Returns list of widget controls
/// \return a control list
- virtual QList<QWidget *> getControls() const;
+ QList<QWidget *> getControls() const override;
/// Set general buttons from dialog
/// \param theButtons the dialog buttons
- virtual void setDialogButtons(QDialogButtonBox *theButtons);
+ void setDialogButtons(QDialogButtonBox *theButtons) override;
protected:
/// Saves the internal parameters to the given feature
/// \return True in success
- virtual bool storeValueCustom();
+ bool storeValueCustom() override;
/// Restore value from attribute data to the widget's control
- virtual bool restoreValueCustom();
+ bool restoreValueCustom() override;
/// The method called when widget is activated
- virtual void activateCustom();
+ void activateCustom() override;
- virtual void showEvent(QShowEvent *theEvent);
+ void showEvent(QShowEvent *theEvent) override;
- virtual void hideEvent(QHideEvent *theEvent);
+ void hideEvent(QHideEvent *theEvent) override;
private slots:
/// Slot for reaction on double click in the table (start editing)
return myCenterType;
}
- virtual void HilightSelected(const Handle(PrsMgr_PresentationManager3d) & PM,
- const SelectMgr_SequenceOfOwner &Seq);
- virtual void
- HilightOwnerWithColor(const Handle(PrsMgr_PresentationManager3d) &,
- const Handle(Prs3d_Drawer) &,
- const Handle(SelectMgr_EntityOwner) &);
+ void HilightSelected(const Handle(PrsMgr_PresentationManager3d) & PM,
+ const SelectMgr_SequenceOfOwner &Seq) override;
+ void HilightOwnerWithColor(const Handle(PrsMgr_PresentationManager3d) &,
+ const Handle(Prs3d_Drawer) &,
+ const Handle(SelectMgr_EntityOwner) &) override;
DEFINE_STANDARD_RTTIEXT(PartSet_CenterPrs, AIS_Point)
std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
// Do check that we can use external feature
- if (aSPFeature.get() != NULL && aSPFeature->isExternal() && !useExternal()) {
+ if (aSPFeature.get() != nullptr && aSPFeature->isExternal() &&
+ !useExternal()) {
aValid = false;
}
// there is no a sketch feature is selected, but the shape exists,
// try to create an exernal object
// TODO: unite with the same functionality in PartSet_WidgetShapeSelector
- if (aSPFeature.get() == NULL) {
+ if (aSPFeature.get() == nullptr) {
ObjectPtr anExternalObject = ObjectPtr();
GeomShapePtr anExternalShape = GeomShapePtr();
if (useExternal()) {
if (aResult.get())
aShape = aResult->shape();
}
- if (aShape.get() != NULL && !aShape->isNull())
+ if (aShape.get() != nullptr && !aShape->isNull())
anExternalObject =
externalObject(theObject, aShape, theSketch, isInValidate);
if (!anExternalObject.get()) {
if (theObject.get()) {
DocumentPtr aDoc = theObject->document();
FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
- if (aFeature.get() != NULL) {
+ if (aFeature.get() != nullptr) {
QObjectPtrList anObjects;
anObjects.append(aFeature);
// the external feature should be removed with all references,
XGUI_Workshop *
PartSet_ExternalObjectsMgr::workshop(ModuleBase_IWorkshop *theWorkshop) {
- XGUI_ModuleConnector *aConnector =
- dynamic_cast<XGUI_ModuleConnector *>(theWorkshop);
+ auto *aConnector = dynamic_cast<XGUI_ModuleConnector *>(theWorkshop);
return aConnector->workshop();
}
const std::string &theCanCreateExternal,
const bool theDefaultValue);
- virtual ~PartSet_ExternalObjectsMgr() {}
+ virtual ~PartSet_ExternalObjectsMgr() = default;
/// Returns the state whether the external object is used
bool useExternal() const { return myUseExternal; }
return PartSet_Tools::sketchPlane(mySketch);
}
-void PartSet_ExternalPointsMgr::onDisplayObject(ObjectPtr theObj,
- AISObjectPtr theAIS) {
+void PartSet_ExternalPointsMgr::onDisplayObject(ObjectPtr /*theObj*/,
+ AISObjectPtr /*theAIS*/) {
updateCenterPresentations();
}
void PartSet_ExternalPointsMgr::onEraseObject(ObjectPtr theObj,
- AISObjectPtr theAIS) {
+ AISObjectPtr /*theAIS*/) {
if (myPresentations.contains(theObj)) {
XGUI_Workshop *aWorkshop = XGUI_Tools::workshop(myWorkshop);
XGUI_Displayer *aDisplayer = aWorkshop->displayer();
PartSet_ExternalPointsMgr(ModuleBase_IWorkshop *theWorkshop,
const CompositeFeaturePtr &theSketch);
- virtual ~PartSet_ExternalPointsMgr();
+ ~PartSet_ExternalPointsMgr() override;
public slots:
/**
CompositeFeaturePtr mySketch;
/// Type for list of created AIS objects
- typedef QList<AISObjectPtr> ListOfAIS;
+ using ListOfAIS = QList<AISObjectPtr>;
/// Map of created AIS objects
QMap<ObjectPtr, ListOfAIS> myPresentations;
/// \param theResult a result object
Standard_EXPORT PartSet_FieldStepPrs(FieldStepPtr theStep);
- ModelAPI_AttributeTables::ValueType dataType() const;
+ ModelAPI_AttributeTables::ValueType dataType() const override;
- bool dataRange(double &theMin, double &theMax) const;
+ bool dataRange(double &theMin, double &theMax) const override;
DEFINE_STANDARD_RTTIEXT(PartSet_FieldStepPrs, ViewerData_AISShape)
protected:
//! Compute presentation considering sub-shape color map.
- virtual void Compute(const Handle(PrsMgr_PresentationManager3d) & thePrsMgr,
- const Handle(Prs3d_Presentation) & thePrs,
- const Standard_Integer theMode);
+ void Compute(const Handle(PrsMgr_PresentationManager3d) & thePrsMgr,
+ const Handle(Prs3d_Presentation) & thePrs,
+ const Standard_Integer theMode) override;
private:
QList<double> range(double &theMin, double &theMax) const;
/// Returns True if selected presentation can be selected
/// \param theOwner an owner of the persentation
- Standard_EXPORT virtual Standard_Boolean
- IsOk(const Handle(SelectMgr_EntityOwner) & theOwner) const;
+ Standard_EXPORT Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner) &
+ theOwner) const override;
DEFINE_STANDARD_RTTIEXT(PartSet_FilterInfinite, SelectMgr_Filter)
/// Returns True if selected presentation can be selected
/// \param theOwner an owner of the persentation
- Standard_EXPORT virtual Standard_Boolean
- IsOk(const Handle(SelectMgr_EntityOwner) & theOwner) const;
+ Standard_EXPORT Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner) &
+ theOwner) const override;
DEFINE_STANDARD_RTTIEXT(PartSet_GlobalFilter, ModuleBase_ShapeDocumentFilter)
};
/// Returns True if selected presentation can be selected
/// \param theOwner an owner of the persentation
- Standard_EXPORT virtual Standard_Boolean
- IsOk(const Handle(SelectMgr_EntityOwner) & theOwner) const;
+ Standard_EXPORT Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner) &
+ theOwner) const override;
DEFINE_STANDARD_RTTIEXT(PartSet_ResultGroupNameFilter, SelectMgr_Filter)
/// Returns True if the given owner is acceptable for selection
/// \param theOwner the selected owner
- Standard_EXPORT virtual Standard_Boolean
- IsOk(const Handle(SelectMgr_EntityOwner) & theOwner) const;
+ Standard_EXPORT Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner) &
+ theOwner) const override;
DEFINE_STANDARD_RTTIEXT(PartSet_CirclePointFilter, SelectMgr_Filter)
/// Returns Icon for the given object
/// \param theObj an object
- virtual QIcon getIcon(ObjectPtr theObj);
+ QIcon getIcon(ObjectPtr theObj) override;
/// Event Listener method
/// \param theMessage an event message
- virtual void processEvent(const std::shared_ptr<Events_Message> &theMessage);
+ void processEvent(const std::shared_ptr<Events_Message> &theMessage) override;
private:
static QMap<QString, QString> myIcons;
//******************************************************
PartSet_Module::PartSet_Module(ModuleBase_IWorkshop *theWshop)
: ModuleBase_IModule(theWshop), myIsOperationIsLaunched(false),
- myVisualLayerId(0), myRoot(0) {
+ myVisualLayerId(0), myRoot(nullptr) {
new PartSet_IconFactory(this);
mySketchMgr = new PartSet_SketcherMgr(this);
//******************************************************
void PartSet_Module::operationStarted(ModuleBase_Operation *theOperation) {
- ModuleBase_OperationFeature *aFOperation =
- dynamic_cast<ModuleBase_OperationFeature *>(theOperation);
+ auto *aFOperation = dynamic_cast<ModuleBase_OperationFeature *>(theOperation);
if (aFOperation) {
XGUI_Workshop *aWorkshop = XGUI_Tools::workshop(workshop());
XGUI_PropertyPanel *aPropertyPanel = aWorkshop->propertyPanel();
- ModuleBase_ModelWidget *aFilledWidget = 0;
+ ModuleBase_ModelWidget *aFilledWidget = nullptr;
bool aPostonedWidgetActivation = false;
FeaturePtr aFeature = aFOperation->feature();
//******************************************************
void PartSet_Module::updatePresentationsOnStart(
ModuleBase_Operation *theOperation) {
- ModuleBase_OperationFeature *aFOperation =
- dynamic_cast<ModuleBase_OperationFeature *>(theOperation);
+ auto *aFOperation = dynamic_cast<ModuleBase_OperationFeature *>(theOperation);
if (aFOperation) {
myCustomPrs->activate(aFOperation->feature(),
ModuleBase_IModule::CustomizeArguments, false);
void PartSet_Module::operationResumed(ModuleBase_Operation *theOperation) {
ModuleBase_IModule::operationResumed(theOperation);
- ModuleBase_OperationFeature *aFOperation =
- dynamic_cast<ModuleBase_OperationFeature *>(theOperation);
+ auto *aFOperation = dynamic_cast<ModuleBase_OperationFeature *>(theOperation);
if (aFOperation) {
myCustomPrs->activate(aFOperation->feature(),
ModuleBase_IModule::CustomizeArguments, false);
// VSV: Viewer is updated on feature update and redisplay
if (isModified) {
- XGUI_ModuleConnector *aConnector =
- dynamic_cast<XGUI_ModuleConnector *>(myWorkshop);
+ auto *aConnector = dynamic_cast<XGUI_ModuleConnector *>(myWorkshop);
XGUI_Displayer *aDisplayer = aConnector->workshop()->displayer();
aDisplayer->updateViewer();
}
//******************************************************
ModuleBase_Operation *PartSet_Module::currentOperation() const {
- XGUI_ModuleConnector *aConnector =
- dynamic_cast<XGUI_ModuleConnector *>(workshop());
+ auto *aConnector = dynamic_cast<XGUI_ModuleConnector *>(workshop());
XGUI_OperationMgr *anOpMgr = aConnector->workshop()->operationMgr();
return anOpMgr->currentOperation();
}
// in active sketch operation it is possible to activate operation object in
// selection in the edit operation, e.g. points of the line can be moved
// when the line is edited
- ModuleBase_OperationFeature *aFOperation =
+ auto *aFOperation =
dynamic_cast<ModuleBase_OperationFeature *>(anOperation);
aCanActivate =
aCanActivate || (aFOperation && aFOperation->isEditOperation());
}
//******************************************************
-void PartSet_Module::moduleSelectionModes(int theModesType,
+void PartSet_Module::moduleSelectionModes(int /*theModesType*/,
QIntList &theModes) {
customSubShapesSelectionModes(theModes);
// theModes.append(XGUI_Tools::workshop(myWorkshop)->viewerSelectionModes());
//******************************************************
void PartSet_Module::propertyPanelDefined(ModuleBase_Operation *theOperation) {
- ModuleBase_OperationFeature *aFOperation =
- dynamic_cast<ModuleBase_OperationFeature *>(theOperation);
+ auto *aFOperation = dynamic_cast<ModuleBase_OperationFeature *>(theOperation);
if (!aFOperation)
return;
if (aResult.get() && aResult->shape()->isEqual(aShape))
return aProcessed;
}
- const TopoDS_Shape &aTDShape = aShape->impl<TopoDS_Shape>();
+ const auto &aTDShape = aShape->impl<TopoDS_Shape>();
std::pair<AttributePtr, int> anAttribute =
PartSet_Tools::findAttributeBy2dPoint(anObject, aTDShape,
mySketchMgr->activeSketch());
//******************************************************
void PartSet_Module::onKeyRelease(ModuleBase_IViewWindow *theWnd,
QKeyEvent *theEvent) {
- XGUI_ModuleConnector *aConnector =
- dynamic_cast<XGUI_ModuleConnector *>(workshop());
+ auto *aConnector = dynamic_cast<XGUI_ModuleConnector *>(workshop());
XGUI_OperationMgr *anOpMgr = aConnector->workshop()->operationMgr();
anOpMgr->onKeyReleased(theWnd->viewPort(), theEvent);
}
QWidget *theParent,
Config_WidgetAPI *theWidgetApi) {
ModuleBase_IWorkshop *aWorkshop = workshop();
- ModuleBase_ModelWidget *aWgt = NULL;
+ ModuleBase_ModelWidget *aWgt = nullptr;
if (theType == "sketch-start-label") {
- PartSet_WidgetSketchLabel *aLabelWgt = new PartSet_WidgetSketchLabel(
+ auto *aLabelWgt = new PartSet_WidgetSketchLabel(
theParent, aWorkshop, theWidgetApi, myHasConstraintShown);
connect(aLabelWgt,
SIGNAL(planeSelected(const std::shared_ptr<GeomAPI_Pln> &)),
aLabelWgt->setShowPointsState(mySketchMgr->isShowFreePointsShown());
aWgt = aLabelWgt;
} else if (theType == "sketch-2dpoint_selector") {
- PartSet_WidgetPoint2D *aPointWgt =
+ auto *aPointWgt =
new PartSet_WidgetPoint2D(theParent, aWorkshop, theWidgetApi);
aPointWgt->setSketch(mySketchMgr->activeSketch());
connect(aPointWgt, SIGNAL(vertexSelected()), sketchReentranceMgr(),
SLOT(onVertexSelected()));
aWgt = aPointWgt;
} else if (theType == "sketch-2dpoint_flyout_selector") {
- PartSet_WidgetPoint2DFlyout *aPointWgt =
+ auto *aPointWgt =
new PartSet_WidgetPoint2DFlyout(theParent, aWorkshop, theWidgetApi);
aPointWgt->setSketch(mySketchMgr->activeSketch());
connect(aPointWgt, SIGNAL(vertexSelected()), sketchReentranceMgr(),
SLOT(onVertexSelected()));
aWgt = aPointWgt;
} else if (theType == "sketch_shape_selector") {
- PartSet_WidgetShapeSelector *aShapeSelectorWgt =
+ auto *aShapeSelectorWgt =
new PartSet_WidgetShapeSelector(theParent, aWorkshop, theWidgetApi);
aShapeSelectorWgt->setSketcher(mySketchMgr->activeSketch());
aWgt = aShapeSelectorWgt;
} else if (theType == "sketch_multi_selector") {
- PartSet_WidgetMultiSelector *aShapeSelectorWgt =
+ auto *aShapeSelectorWgt =
new PartSet_WidgetMultiSelector(theParent, aWorkshop, theWidgetApi);
aShapeSelectorWgt->setSketcher(mySketchMgr->activeSketch());
aWgt = aShapeSelectorWgt;
} else if (theType == "sketch_feature_point_selector") {
- PartSet_WidgetFeaturePointSelector *aPointSelectorWgt =
- new PartSet_WidgetFeaturePointSelector(theParent, aWorkshop,
- theWidgetApi);
+ auto *aPointSelectorWgt = new PartSet_WidgetFeaturePointSelector(
+ theParent, aWorkshop, theWidgetApi);
aPointSelectorWgt->setSketcher(mySketchMgr->activeSketch());
aWgt = aPointSelectorWgt;
} else if (theType == "sketch-bspline_selector") {
- PartSet_WidgetBSplinePoints *aBSplineWgt =
+ auto *aBSplineWgt =
new PartSet_WidgetBSplinePoints(theParent, aWorkshop, theWidgetApi);
aBSplineWgt->setSketch(mySketchMgr->activeSketch());
aWgt = aBSplineWgt;
connect(aWgt, SIGNAL(itemSelected(ModuleBase_ModelWidget *, int)), this,
SLOT(onChoiceChanged(ModuleBase_ModelWidget *, int)));
} else if (theType == "bspline-panel") {
- PartSet_BSplineWidget *aPanel =
- new PartSet_BSplineWidget(theParent, theWidgetApi);
+ auto *aPanel = new PartSet_BSplineWidget(theParent, theWidgetApi);
// aPanel->setFeature(theFeature);
aWgt = aPanel;
}
//******************************************************
ModuleBase_ModelWidget *PartSet_Module::activeWidget() const {
- ModuleBase_ModelWidget *anActiveWidget = 0;
+ ModuleBase_ModelWidget *anActiveWidget = nullptr;
ModuleBase_Operation *aOperation = myWorkshop->currentOperation();
if (!aOperation)
// 3. start operation
QString aDescription =
aWorkshop->contextMenuMgr()->action("DELETE_CMD")->text();
- ModuleBase_Operation *anOpAction =
- new ModuleBase_Operation(aDescription, this);
+ auto *anOpAction = new ModuleBase_Operation(aDescription, this);
// the active nested sketch operation should be aborted unconditionally
// the Delete action should be additionally granted for the Sketch operation
}
//******************************************************
-void PartSet_Module::storeConstraintsState(const std::string &theFeatureKind) {
+void PartSet_Module::storeConstraintsState(
+ const std::string & /*theFeatureKind*/) {
if (myWorkshop->currentOperation() &&
myWorkshop->currentOperation()->id().toStdString() ==
SketchPlugin_Sketch::ID()) {
//******************************************************
void PartSet_Module::customizeObjectBrowser(QWidget *theObjectBrowser) {
- XGUI_ObjectsBrowser *aOB =
- dynamic_cast<XGUI_ObjectsBrowser *>(theObjectBrowser);
+ auto *aOB = dynamic_cast<XGUI_ObjectsBrowser *>(theObjectBrowser);
if (aOB) {
QLabel *aLabel = aOB->activeDocLabel();
aLabel->installEventFilter(myMenuMgr);
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
if (aResult.get()) {
std::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(aResult);
- if (aShapePtr.get() != NULL)
+ if (aShapePtr.get() != nullptr)
anAISPrs = new ModuleBase_ResultPrs(aResult);
} else {
FieldStepPtr aStep =
#else
aPixmap->InitTrash(Image_Format_BGRA, aWidth, aHeight);
#endif
- std::list<unsigned char>::iterator aByteIter = aByteList.begin();
+ auto aByteIter = aByteList.begin();
for (int aLine = 0; aLine < aHeight; ++aLine) {
// convert pixels from ARGB to renderer-compatible RGBA
for (int aByte = 0; aByte < aWidth; ++aByte) {
- Image_ColorBGRA &aPixmapBytes =
+ auto &aPixmapBytes =
aPixmap->ChangeValue<Image_ColorBGRA>(aLine, aByte);
aPixmapBytes.b() = (Standard_Byte)*aByteIter++;
if (!anActiveWidget)
anActiveWidget = aPanel->preselectionWidget();
- ModuleBase_WidgetValidated *aWidgetValidated =
+ auto *aWidgetValidated =
dynamic_cast<ModuleBase_WidgetValidated *>(anActiveWidget);
if (aWidgetValidated)
anObject = aWidgetValidated->findPresentedObject(theAIS);
}
} else {
if (hasFeature) {
- myMenuMgr->action("EDIT_CMD")->setEnabled(aCurrentOp == 0);
+ myMenuMgr->action("EDIT_CMD")->setEnabled(aCurrentOp == nullptr);
theMenu->addAction(myMenuMgr->action("EDIT_CMD"));
theMenu->addSeparator();
}
}
- bool aNotDeactivate = (aCurrentOp == 0);
+ bool aNotDeactivate = (aCurrentOp == nullptr);
if (!aNotDeactivate) {
aActivatePartAction->setEnabled(false);
}
return;
XGUI_Workshop *aWorkshop = getWorkshop();
bool needUpdate = false;
- XGUI_DataTree *aTreeView = 0;
+ XGUI_DataTree *aTreeView = nullptr;
if (aWorkshop->objectBrowser()) {
aTreeView = aWorkshop->objectBrowser()->treeView();
QLabel *aLabel = aWorkshop->objectBrowser()->activeDocLabel();
//******************************************************
void PartSet_Module::onChoiceChanged(ModuleBase_ModelWidget *theWidget,
int theIndex) {
- ModuleBase_WidgetChoice *aChoiceWidget =
- dynamic_cast<ModuleBase_WidgetChoice *>(theWidget);
+ auto *aChoiceWidget = dynamic_cast<ModuleBase_WidgetChoice *>(theWidget);
if (!aChoiceWidget)
return;
//******************************************************
XGUI_Workshop *PartSet_Module::getWorkshop() const {
- XGUI_ModuleConnector *aConnector =
- dynamic_cast<XGUI_ModuleConnector *>(workshop());
+ auto *aConnector = dynamic_cast<XGUI_ModuleConnector *>(workshop());
return aConnector->workshop();
}
aText += aName + "\n";
}
- XGUI_ModuleConnector *aConnector =
- dynamic_cast<XGUI_ModuleConnector *>(myWorkshop);
+ auto *aConnector = dynamic_cast<XGUI_ModuleConnector *>(myWorkshop);
ModuleBase_Tools::warningAboutConflict(aConnector->desktop(), aText);
}
QString aDescription =
aWorkshop->contextMenuMgr()->action("DELETE_CMD")->text();
- ModuleBase_Operation *anOpAction = new ModuleBase_Operation(aDescription);
+ auto *anOpAction = new ModuleBase_Operation(aDescription);
anOpMgr->startOperation(anOpAction);
aWorkshop->deleteFeatures(anObjectsList);
gp_Pnt aPnt(0.0, 0.0, 0.0);
BRepBuilderAPI_MakeVertex aMaker(aPnt);
TopoDS_Vertex aVertex = aMaker.Vertex();
- myShapeToPrsMap.Bind(aVertex, NULL);
+ myShapeToPrsMap.Bind(aVertex, nullptr);
Handle(Prs3d_Drawer) aDrawer = Attributes();
Handle(Prs3d_IsoAspect) aUIsoAspect =
void PartSet_OperationPrs::useAISWidth() { myUseAISWidth = true; }
void PartSet_OperationPrs::Compute(const Handle(PrsMgr_PresentationManager3d) &
- thePresentationManager,
+ /*thePresentationManager*/,
const Handle(Prs3d_Presentation) &
thePresentation,
- const Standard_Integer theMode) {
+ const Standard_Integer /*theMode*/) {
#ifdef DEBUG_OPERATION_PRS
qDebug("PartSet_OperationPrs::Compute -- begin");
#endif
}
void PartSet_OperationPrs::appendShapeIfVisible(
- ModuleBase_IWorkshop *theWorkshop, const ObjectPtr &theObject,
+ ModuleBase_IWorkshop * /*theWorkshop*/, const ObjectPtr &theObject,
GeomShapePtr theGeomShape,
QMap<ObjectPtr, QList<GeomShapePtr>> &theObjectShapes) {
if (theGeomShape.get()) {
if (aPrevFullyConstrained != myIsFullyConstrained) {
std::set<ObjectPtr> aModifiedObjects;
- PartSet_Module *aModule =
- dynamic_cast<PartSet_Module *>(myWorkshop->module());
+ auto *aModule = dynamic_cast<PartSet_Module *>(myWorkshop->module());
CompositeFeaturePtr aSketch = aModule->sketchMgr()->activeSketch();
// check the sketch in the message and the active sketch are the same
ModuleBase_Operation *anOperation =
XGUI_Tools::workshop(myWorkshop)->operationMgr()->currentOperation();
if (anOperation) {
- ModuleBase_OperationFeature *aFOperation =
+ auto *aFOperation =
dynamic_cast<ModuleBase_OperationFeature *>(anOperation);
if (aFOperation) {
FeaturePtr aFeature = aFOperation->feature();
}
}
if (theMessage->sender()) {
- ModelAPI_Object *aSender =
- static_cast<ModelAPI_Object *>(theMessage->sender());
+ auto *aSender = static_cast<ModelAPI_Object *>(theMessage->sender());
if (aSender) {
FeaturePtr aFeatureSender = std::dynamic_pointer_cast<ModelAPI_Feature>(
aSender->data()->owner());
if (aFeatureSender.get() &&
aFeatureSender->data()->name() == aCurrentFeatureName) {
- PartSet_Module *aModule =
- dynamic_cast<PartSet_Module *>(myWorkshop->module());
+ auto *aModule = dynamic_cast<PartSet_Module *>(myWorkshop->module());
PartSet_SketcherReentrantMgr *aReentrantMgr =
aModule->sketchReentranceMgr();
aReentrantMgr->setReentrantMessage(theMessage);
if (aConstraintsMsg.get()) {
myObjectsToRemove = aConstraintsMsg->constraints();
- std::set<ObjectPtr>::const_iterator anIt = myObjectsToRemove.begin();
+ auto anIt = myObjectsToRemove.begin();
- PartSet_Module *aModule =
- dynamic_cast<PartSet_Module *>(myWorkshop->module());
+ auto *aModule = dynamic_cast<PartSet_Module *>(myWorkshop->module());
for (; anIt != myObjectsToRemove.end();) {
ObjectPtr anObject = *anIt;
// set error state for new objects and append them in the internal map of
// objects
- std::set<ObjectPtr>::const_iterator anIt = theConflictingObjects.begin(),
- aLast = theConflictingObjects.end();
+ auto anIt = theConflictingObjects.begin(),
+ aLast = theConflictingObjects.end();
int aCountOfSimilarConstraints = 0;
for (; anIt != aLast; anIt++) {
static Events_ID EVENT_REDISP = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
static const ModelAPI_EventCreator *aECreator = ModelAPI_EventCreator::get();
- std::set<ObjectPtr>::const_iterator anIt = theObjects.begin(),
- aLast = theObjects.end();
+ auto anIt = theObjects.begin(), aLast = theObjects.end();
for (; anIt != aLast; anIt++) {
ObjectPtr aObj = *anIt;
aECreator->sendUpdated(aObj, EVENT_DISP);
#include <SketchPlugin_Sketch.h>
-PartSet_PreviewPlanes::PartSet_PreviewPlanes() : myPreviewDisplayed(false) {}
+PartSet_PreviewPlanes::PartSet_PreviewPlanes() {}
bool PartSet_PreviewPlanes::hasVisualizedBodies(
ModuleBase_IWorkshop *theWorkshop) {
foreach (ObjectPtr anObj, aDisplayed) {
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObj);
// result constructions should not be taken as a body
- if (aResult.get() != NULL &&
+ if (aResult.get() != nullptr &&
((aResult->groupName() == ModelAPI_ResultBody::group()) ||
((aResult->groupName() == ModelAPI_ResultPart::group())))) {
GeomShapePtr aShape = aResult->shape();
QObjectPtrList aDisplayed = aDisp->displayedObjects();
foreach (ObjectPtr anObj, aDisplayed) {
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObj);
- if (aResult.get() != NULL) {
+ if (aResult.get() != nullptr) {
FeaturePtr aFeature = ModelAPI_Feature::feature(aResult);
if (aFeature.get() && aFeature->getKind() == SketchPlugin_Sketch::ID()) {
ResultConstructionPtr aCResult =
/// Constructor
PartSet_PreviewPlanes();
- ~PartSet_PreviewPlanes(){};
+ ~PartSet_PreviewPlanes() = default;
+ ;
/// Returns true if there is body visualized in the viewer
/// \param theWorkshop the application workshop
const int theRGB[3]);
private:
- bool myPreviewDisplayed;
+ bool myPreviewDisplayed{false};
AISObjectPtr myYZPlane;
AISObjectPtr myXZPlane;
#include <BRepBndLib.hxx>
-PartSet_PreviewSketchPlane::PartSet_PreviewSketchPlane()
- : myPreviewIsDisplayed(false), mySizeOfView(0), myIsUseSizeOfView(false) {}
+PartSet_PreviewSketchPlane::PartSet_PreviewSketchPlane() {}
void PartSet_PreviewSketchPlane::eraseSketchPlane(
ModuleBase_IWorkshop *theWorkshop, const bool isClearPlane) {
}
}
if (aBox.IsVoid())
- return 0;
+ return false;
double aXmin, aXmax, anYmin, anYmax, aZmin, aZmax;
aBox.Get(aXmin, anYmin, aZmin, aXmax, anYmax, aZmax);
std::shared_ptr<GeomAPI_AISObject> createPreviewPlane();
private:
- bool myPreviewIsDisplayed;
+ bool myPreviewIsDisplayed{false};
std::shared_ptr<GeomAPI_AISObject> myPlane; //! visualized presentation
std::shared_ptr<GeomAPI_Shape> myShape; //! current shape to be displayed
std::shared_ptr<GeomAPI_Pnt>
myViewCentralPoint; //! central point of the default view
- double mySizeOfView; //! size that should be used by creating a default face
- bool myIsUseSizeOfView; //! state if the size is custom or from preferences
+ double mySizeOfView{
+ 0}; //! size that should be used by creating a default face
+ bool myIsUseSizeOfView{
+ false}; //! state if the size is custom or from preferences
std::shared_ptr<GeomAPI_Pnt>
myViewOrigin; //! origin point of sketch if default view is used
};
// Activate individual repaintng if this is a part of compsolid
ResultBodyPtr anOwner = ModelAPI_Tools::bodyOwner(myResult);
- SetAutoHilight(anOwner.get() == NULL);
+ SetAutoHilight(anOwner.get() == nullptr);
ModuleBase_Tools::setPointBallHighlighting(this);
// set line style
Handle(Prs3d_LineAspect) aLineAspect;
- Aspect_TypeOfLine aType = (Aspect_TypeOfLine)aLineStyle;
+ auto aType = (Aspect_TypeOfLine)aLineStyle;
if (aDrawer->HasOwnLineAspect()) {
aLineAspect = aDrawer->LineAspect();
}
// result.
const std::list<std::shared_ptr<ModelAPI_Result>> &aRes =
aFeature->results();
- std::list<std::shared_ptr<ModelAPI_Result>>::const_iterator aResIter =
- aRes.cbegin();
+ auto aResIter = aRes.cbegin();
for (; aResIter != aRes.cend(); aResIter++) {
std::shared_ptr<ModelAPI_ResultConstruction> aConstr =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aResIter);
if (aConstr) {
std::shared_ptr<GeomAPI_Shape> aGeomShape = aConstr->shape();
if (aGeomShape.get()) {
- const TopoDS_Shape &aShape = aGeomShape->impl<TopoDS_Shape>();
+ const auto &aShape = aGeomShape->impl<TopoDS_Shape>();
if (aShape.ShapeType() != TopAbs_EDGE)
anAuxiliaryResults.push_back(aConstr);
}
if (aResult.get()) {
GeomShapePtr aGeomShape = aResult->shape();
if (aGeomShape.get()) {
- const TopoDS_Shape &aShape = aGeomShape->impl<TopoDS_Shape>();
+ const auto &aShape = aGeomShape->impl<TopoDS_Shape>();
if (!aShape.IsNull())
aBuilder.Add(theAuxiliaryCompound, aShape);
}
DEFINE_STANDARD_RTTIEXT(PartSet_ResultSketchPrs, ViewerData_AISShape)
protected:
/// Redefinition of virtual function
- Standard_EXPORT virtual void
+ Standard_EXPORT void
Compute(const Handle(PrsMgr_PresentationManager3d) & thePresentationManager,
const Handle(Prs3d_Presentation) & thePresentation,
- const Standard_Integer theMode = 0);
+ const Standard_Integer theMode = 0) override;
/// Redefinition of virtual function
- Standard_EXPORT virtual void
+ Standard_EXPORT void
ComputeSelection(const Handle(SelectMgr_Selection) & aSelection,
- const Standard_Integer theMode);
+ const Standard_Integer theMode) override;
private:
/// Appens sensitive and owners for wires of the given shape into selection
if (aShapeType == TopAbs_VERTEX) {
std::pair<AttributePtr, int> aPntAttrIndex =
PartSet_Tools::findAttributeBy2dPoint(theFeature, aShape, theSketch);
- if (aPntAttrIndex.first.get() != NULL)
+ if (aPntAttrIndex.first.get() != nullptr)
theSelectedAttributes[aPntAttrIndex.first] = aPntAttrIndex.second;
} else if (aShapeType == TopAbs_EDGE &&
theSelectedResults.find(theResult) == theSelectedResults.end()) {
: QObject(theModule), myModule(theModule), myIsEditLaunching(false),
myIsDragging(false), myDragDone(false), myIsMouseOverWindow(false),
myIsMouseOverViewProcessed(true), myIsPopupMenuActive(false),
- myPreviousUpdateViewerEnabled(true), myExternalPointsMgr(0),
+ myPreviousUpdateViewerEnabled(true), myExternalPointsMgr(nullptr),
myNoDragMoving(false) {
ModuleBase_IWorkshop *anIWorkshop = myModule->workshop();
ModuleBase_IViewer *aViewer = anIWorkshop->viewer();
this,
SLOT(onMouseDoubleClick(ModuleBase_IViewWindow *, QMouseEvent *)));
- XGUI_ModuleConnector *aConnector =
- dynamic_cast<XGUI_ModuleConnector *>(anIWorkshop);
+ auto *aConnector = dynamic_cast<XGUI_ModuleConnector *>(anIWorkshop);
XGUI_Workshop *aWorkshop = aConnector->workshop();
connect(aWorkshop, SIGNAL(applicationStarted()), this,
SLOT(onApplicationStarted()));
// flag is true, the presentable feature is displayed as soon as the
// presentation becomes valid and redisplay happens
// ModuleBase_Operation* aOperation = getCurrentOperation();
- ModuleBase_OperationFeature *aFOperation =
+ auto *aFOperation =
dynamic_cast<ModuleBase_OperationFeature *>(getCurrentOperation());
if (aFOperation) {
FeaturePtr aFeature = aFOperation->feature();
// 2. if the mouse IS NOT over window, reset the active widget value and hide
// the presentation
ModuleBase_IWorkshop *aWorkshop = myModule->workshop();
- XGUI_ModuleConnector *aConnector =
- dynamic_cast<XGUI_ModuleConnector *>(aWorkshop);
+ auto *aConnector = dynamic_cast<XGUI_ModuleConnector *>(aWorkshop);
XGUI_Displayer *aDisplayer = aConnector->workshop()->displayer();
// disable the viewer update in order to avoid visualization of redisplayed
// feature in viewer obtained after reset value
// the feature is to be erased here, but it is correct to call
// canDisplayObject because there can be additional check (e.g. editor widget
// in distance constraint)
- ModuleBase_OperationFeature *aFOperation =
+ auto *aFOperation =
dynamic_cast<ModuleBase_OperationFeature *>(getCurrentOperation());
if (aFOperation) {
FeaturePtr aFeature = aFOperation->feature();
// if (!aViewer->canDragByMouse())
// return;
- ModuleBase_OperationFeature *aFOperation =
+ auto *aFOperation =
dynamic_cast<ModuleBase_OperationFeature *>(getCurrentOperation());
if (!aFOperation)
return;
if ((!isSketcher) && (!isEditing)) {
if (MyModeByDrag) {
ModuleBase_ModelWidget *anActiveWidget = getActiveWidget();
- PartSet_MouseProcessor *aProcessor =
+ auto *aProcessor =
dynamic_cast<PartSet_MouseProcessor *>(anActiveWidget);
if (aProcessor) {
MyMultiselectionState = aViewer->isMultiSelectionEnabled();
aFOperation->propertyPanel()->cleanContent();
}
myIsEditLaunching = aPrevLaunchingState;
- if (aFeature.get() != NULL) {
+ if (aFeature.get() != nullptr) {
std::shared_ptr<SketchPlugin_Feature> aSketchFeature =
std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
if (aSketchFeature.get() &&
return;
}
- ModuleBase_OperationFeature *aOp =
+ auto *aOp =
dynamic_cast<ModuleBase_OperationFeature *>(getCurrentOperation());
bool isEditing = false;
if (aOp) {
}
ModuleBase_ModelWidget *anActiveWidget = getActiveWidget();
- PartSet_MouseProcessor *aProcessor =
- dynamic_cast<PartSet_MouseProcessor *>(anActiveWidget);
+ auto *aProcessor = dynamic_cast<PartSet_MouseProcessor *>(anActiveWidget);
if (aProcessor) {
ModuleBase_ISelection *aSelection = aWorkshop->selection();
QList<ModuleBase_ViewerPrsPtr> aPreSelected = aSelection->getHighlighted();
return;
ModuleBase_IWorkshop *aWorkshop = myModule->workshop();
- XGUI_ModuleConnector *aConnector =
- dynamic_cast<XGUI_ModuleConnector *>(aWorkshop);
+ auto *aConnector = dynamic_cast<XGUI_ModuleConnector *>(aWorkshop);
XGUI_Displayer *aDisplayer = aConnector->workshop()->displayer();
if (isNestedCreateOperation(getCurrentOperation(), activeSketch())) {
// in order to visualize correct presentation. These widgets correct the
// feature attribute according to the mouse position
ModuleBase_ModelWidget *anActiveWidget = myModule->activeWidget();
- PartSet_MouseProcessor *aProcessor =
- dynamic_cast<PartSet_MouseProcessor *>(anActiveWidget);
+ auto *aProcessor = dynamic_cast<PartSet_MouseProcessor *>(anActiveWidget);
if (aProcessor)
aProcessor->mouseMoved(theWnd, theEvent);
if (!myIsMouseOverViewProcessed) {
// the feature is to be erased here, but it is correct to call
// canDisplayObject because there can be additional check (e.g. editor
// widget in distance constraint)
- ModuleBase_OperationFeature *aFOperation =
+ auto *aFOperation =
dynamic_cast<ModuleBase_OperationFeature *>(getCurrentOperation());
if (aFOperation) {
FeaturePtr aFeature = aFOperation->feature();
anAttributes.end();
for (; anAttIt != anAttLast; anAttIt++) {
AttributePtr anAttr = anAttIt->first;
- if (anAttr.get() == NULL)
+ if (anAttr.get() == nullptr)
continue;
std::string aAttrId = anAttr->id();
DataPtr aData = aFeature->data();
}
}
-void PartSet_SketcherMgr::onMouseDoubleClick(ModuleBase_IViewWindow *theWnd,
- QMouseEvent *theEvent) {
- ModuleBase_OperationFeature *aFOperation =
+void PartSet_SketcherMgr::onMouseDoubleClick(
+ ModuleBase_IViewWindow * /*theWnd*/, QMouseEvent * /*theEvent*/) {
+ auto *aFOperation =
dynamic_cast<ModuleBase_OperationFeature *>(getCurrentOperation());
if (aFOperation && aFOperation->isEditOperation()) {
std::string aId = aFOperation->id().toStdString();
anId == SketchPlugin_ConstraintAngle::ANGLE_VALUE_ID() ||
anId ==
SketchPlugin_ConstraintDistanceAlongDir::DISTANCE_VALUE_ID()) {
- PartSet_WidgetEditor *anEditor =
- dynamic_cast<PartSet_WidgetEditor *>(aWgt);
+ auto *anEditor = dynamic_cast<PartSet_WidgetEditor *>(aWgt);
if (anEditor)
anEditor->showPopupEditor();
return;
void PartSet_SketcherMgr::onApplicationStarted() {
ModuleBase_IWorkshop *anIWorkshop = myModule->workshop();
- XGUI_ModuleConnector *aConnector =
- dynamic_cast<XGUI_ModuleConnector *>(anIWorkshop);
+ auto *aConnector = dynamic_cast<XGUI_ModuleConnector *>(anIWorkshop);
XGUI_Workshop *aWorkshop = aConnector->workshop();
PartSet_SketcherReentrantMgr *aReentranceMgr =
myModule->sketchReentranceMgr();
if (anActiveSketch.get() && theOperation) {
ModuleBase_Operation *aSketchOperation =
operationMgr()->findOperation(anActiveSketch->getKind().c_str());
- ModuleBase_OperationFeature *aFOperation =
+ auto *aFOperation =
dynamic_cast<ModuleBase_OperationFeature *>(theOperation);
if (aSketchOperation && aFOperation) {
FeaturePtr aFeature = aFOperation->feature();
bool PartSet_SketcherMgr::isNestedCreateOperation(
ModuleBase_Operation *theOperation,
- const CompositeFeaturePtr &theSketch) const {
- ModuleBase_OperationFeature *aFOperation =
- dynamic_cast<ModuleBase_OperationFeature *>(theOperation);
+ const CompositeFeaturePtr & /*theSketch*/) const {
+ auto *aFOperation = dynamic_cast<ModuleBase_OperationFeature *>(theOperation);
return aFOperation && !aFOperation->isEditOperation() &&
isNestedSketchOperation(aFOperation);
}
bool PartSet_SketcherMgr::isNestedEditOperation(
ModuleBase_Operation *theOperation,
- const CompositeFeaturePtr &theSketch) const {
- ModuleBase_OperationFeature *aFOperation =
- dynamic_cast<ModuleBase_OperationFeature *>(theOperation);
+ const CompositeFeaturePtr & /*theSketch*/) const {
+ auto *aFOperation = dynamic_cast<ModuleBase_OperationFeature *>(theOperation);
return aFOperation && aFOperation->isEditOperation() &&
isNestedSketchOperation(aFOperation);
}
(theKind == SketchPlugin_ConstraintDistanceAlongDir::ID());
}
-void PartSet_SketcherMgr::startSketch(ModuleBase_Operation *theOperation) {
+void PartSet_SketcherMgr::startSketch(ModuleBase_Operation * /*theOperation*/) {
static Events_ID EVENT_ATTR =
Events_Loop::loop()->eventByName(EVENT_VISUAL_ATTRIBUTES);
static Events_ID EVENT_DISP =
Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
- ModuleBase_OperationFeature *aFOperation =
+ auto *aFOperation =
dynamic_cast<ModuleBase_OperationFeature *>(getCurrentOperation());
if (!aFOperation)
return;
}
mySketchPlane->createSketchPlane(myCurrentSketch, myModule->workshop());
- XGUI_ModuleConnector *aConnector =
- dynamic_cast<XGUI_ModuleConnector *>(myModule->workshop());
+ auto *aConnector = dynamic_cast<XGUI_ModuleConnector *>(myModule->workshop());
// Hide sketcher result
std::list<ResultPtr> aResults = myCurrentSketch->results();
std::map<FeaturePtr, std::set<FeaturePtr>> aReferences;
ModelAPI_Tools::findAllReferences(anInvalidFeatures, aReferences, false);
- std::set<FeaturePtr>::const_iterator anIt = anInvalidFeatures.begin(),
- aLast = anInvalidFeatures.end();
+ auto anIt = anInvalidFeatures.begin(), aLast = anInvalidFeatures.end();
// separate features to references to parameter features and references to
// others
QStringList anInvalidFeatureNames;
workshop()->viewer()->set2dMode(true);
- PartSet_Fitter *aFitter = new PartSet_Fitter(this);
+ auto *aFitter = new PartSet_Fitter(this);
myModule->workshop()->viewer()->setFitter(aFitter);
}
void PartSet_SketcherMgr::stopSketch(ModuleBase_Operation *theOperation) {
- XGUI_ModuleConnector *aConnector =
- dynamic_cast<XGUI_ModuleConnector *>(myModule->workshop());
- PartSet_Fitter *aFitter =
- (PartSet_Fitter *)myModule->workshop()->viewer()->fitter();
- myModule->workshop()->viewer()->setFitter(0);
+ auto *aConnector = dynamic_cast<XGUI_ModuleConnector *>(myModule->workshop());
+ auto *aFitter = (PartSet_Fitter *)myModule->workshop()->viewer()->fitter();
+ myModule->workshop()->viewer()->setFitter(nullptr);
delete aFitter;
myIsMouseOverWindow = false;
if (myExternalPointsMgr) {
delete myExternalPointsMgr;
- myExternalPointsMgr = 0;
+ myExternalPointsMgr = nullptr;
}
onShowPoints(false);
Events_Loop *aLoop = Events_Loop::loop();
static Events_ID aDispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
- ModuleBase_OperationFeature *aFOperation =
+ auto *aFOperation =
dynamic_cast<ModuleBase_OperationFeature *>(theOperation);
for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) {
if (!aFOperation->isDisplayedOnStart(*aIt)) {
// returning to the neutral point of the Sketcher
bool isClearSelectionPossible = true;
if (myIsEditLaunching) {
- ModuleBase_OperationFeature *aFOperation =
+ auto *aFOperation =
dynamic_cast<ModuleBase_OperationFeature *>(theOperation);
if (aFOperation) {
FeaturePtr aFeature = aFOperation->feature();
void PartSet_SketcherMgr::commitNestedSketch(
ModuleBase_Operation *theOperation) {
if (isNestedCreateOperation(theOperation, activeSketch())) {
- ModuleBase_OperationFeature *aFOperation =
+ auto *aFOperation =
dynamic_cast<ModuleBase_OperationFeature *>(theOperation);
if (aFOperation) {
FeaturePtr aFeature = aFOperation->feature();
/// value after entering the value, the operation should be
/// committed/aborted(by Esc key)
bool aCanCommitOperation = true;
- ModuleBase_OperationFeature *aFOperation =
+ auto *aFOperation =
dynamic_cast<ModuleBase_OperationFeature *>(anOperation);
if (aFOperation && PartSet_SketcherMgr::isDistanceOperation(aFOperation)) {
bool aValueAccepted = setDistanceValueByPreselection(
bool PartSet_SketcherMgr::canDisplayObject(const ObjectPtr &theObject) const {
bool aCanDisplay = true;
- bool aHasActiveSketch = activeSketch().get() != NULL;
+ bool aHasActiveSketch = activeSketch().get() != nullptr;
if (aHasActiveSketch) {
// 1. the sketch feature should not be displayed during the sketch active
// operation it is hidden by a sketch operation start and shown by a sketch
// stop, just the sketch nested features can be visualized
FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
- if (aFeature.get() != NULL && aFeature == activeSketch()) {
+ if (aFeature.get() != nullptr && aFeature == activeSketch()) {
aCanDisplay = false;
}
std::shared_ptr<SketchPlugin_Feature> aSketchFeature =
// 2. sketch sub-features should not be visualized if the sketch operation
// is not active
FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
- if (aFeature.get() != NULL) {
+ if (aFeature.get() != nullptr) {
std::shared_ptr<SketchPlugin_Feature> aSketchFeature =
std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
if (aSketchFeature.get()) {
// feature or this feature result
if (aCanDisplay) {
bool isObjectFound = false;
- ModuleBase_OperationFeature *aFOperation =
+ auto *aFOperation =
dynamic_cast<ModuleBase_OperationFeature *>(getCurrentOperation());
if (aFOperation) {
FeaturePtr aFeature = aFOperation->feature();
ModuleBase_WidgetEditor *anEditorWdg =
anActiveWidget
? dynamic_cast<ModuleBase_WidgetEditor *>(anActiveWidget)
- : 0;
+ : nullptr;
// the active widget editor should not influence here. The presentation
// should be visible always when this widget is active.
if (!anEditorWdg && !myIsPopupMenuActive) {
bool isValueAccepted = false;
theCanCommitOperation = false;
- ModuleBase_OperationFeature *aFOperation =
- dynamic_cast<ModuleBase_OperationFeature *>(theOperation);
+ auto *aFOperation = dynamic_cast<ModuleBase_OperationFeature *>(theOperation);
FeaturePtr aFeature = aFOperation->feature();
// editor is shown only if all attribute references are filled by preseletion
bool anAllRefAttrInitialized = true;
Events_Loop::loop()->flush(
Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
- PartSet_WidgetEditor *anEditor =
- dynamic_cast<PartSet_WidgetEditor *>(aWgt);
+ auto *anEditor = dynamic_cast<PartSet_WidgetEditor *>(aWgt);
if (anEditor) {
int aX = 0, anY = 0;
XGUI_Displayer *aDisplayer = aWorkshop->displayer();
AISObjectPtr anAIS = aDisplayer->getAISObject(aFeature);
Handle(AIS_InteractiveObject) anAISIO;
- if (anAIS.get() != NULL) {
+ if (anAIS.get() != nullptr) {
anAISIO = anAIS->impl<Handle(AIS_InteractiveObject)>();
}
- if (anAIS.get() != NULL) {
+ if (anAIS.get() != nullptr) {
anAISIO = anAIS->impl<Handle(AIS_InteractiveObject)>();
if (!anAISIO.IsNull()) {
ModuleBase_IWorkshop *theWorkshop,
const FeatureToSelectionMap &theSelection,
SelectMgr_IndexedMapOfOwner &theOwnersToSelect) {
- if (theFeature.get() == NULL)
+ if (theFeature.get() == nullptr)
return;
FeatureToSelectionMap::const_iterator anIt = theSelection.find(theFeature);
std::map<AttributePtr, int> aSelectedAttributes = anInfo.myAttributes;
std::set<ResultPtr> aSelectedResults = anInfo.myResults;
- XGUI_ModuleConnector *aConnector =
- dynamic_cast<XGUI_ModuleConnector *>(theWorkshop);
+ auto *aConnector = dynamic_cast<XGUI_ModuleConnector *>(theWorkshop);
XGUI_Displayer *aDisplayer = aConnector->workshop()->displayer();
// 1. found the feature's owners. Check the AIS objects of the constructions
AISObjectPtr aAISObj = aDisplayer->getAISObject(theFeature);
- if (aAISObj.get() != NULL && aSelectedAttributes.empty() &&
+ if (aAISObj.get() != nullptr && aSelectedAttributes.empty() &&
aSelectedResults.empty()) {
Handle(AIS_InteractiveObject) anAISIO =
aAISObj->impl<Handle(AIS_InteractiveObject)>();
for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) {
ResultPtr aResult = *aIt;
AISObjectPtr aResAISObj = aDisplayer->getAISObject(aResult);
- if (aResAISObj.get() == NULL)
+ if (aResAISObj.get() == nullptr)
continue;
Handle(AIS_InteractiveObject) anAISIO =
aResAISObj->impl<Handle(AIS_InteractiveObject)>();
std::pair<AttributePtr, int> aPntAttrIndex =
PartSet_Tools::findAttributeBy2dPoint(theFeature, aShape,
theSketch);
- if (aPntAttrIndex.first.get() != NULL &&
+ if (aPntAttrIndex.first.get() != nullptr &&
aSelectedAttributes.find(aPntAttrIndex.first) !=
aSelectedAttributes.end())
theOwnersToSelect.Add(anOwner);
}
void PartSet_SketcherMgr::widgetStateChanged(int thePreviousState) {
- ModuleBase_OperationFeature *aFOperation =
+ auto *aFOperation =
dynamic_cast<ModuleBase_OperationFeature *>(getCurrentOperation());
if (aFOperation) {
if ((PartSet_SketcherMgr::isSketchOperation(aFOperation) ||
//**************************************************************
ModuleBase_ModelWidget *PartSet_SketcherMgr::getActiveWidget() const {
- ModuleBase_ModelWidget *aWidget = 0;
+ ModuleBase_ModelWidget *aWidget = nullptr;
ModuleBase_Operation *anOperation = getCurrentOperation();
if (anOperation) {
ModuleBase_IPropertyPanel *aPanel = anOperation->propertyPanel();
// qDebug(QString("restoreSelection:
// %1").arg(theCurrentSelection.size()).toStdString().c_str());
ModuleBase_IWorkshop *aWorkshop = myModule->workshop();
- XGUI_ModuleConnector *aConnector =
- dynamic_cast<XGUI_ModuleConnector *>(aWorkshop);
+ auto *aConnector = dynamic_cast<XGUI_ModuleConnector *>(aWorkshop);
FeatureToSelectionMap::const_iterator aSIt = theCurrentSelection.begin(),
aSLast = theCurrentSelection.end();
SelectMgr_IndexedMapOfOwner anOwnersToSelect;
}
void PartSet_SketcherMgr::onShowConstraintsToggle(int theType, bool theState) {
- PartSet_Tools::ConstraintVisibleState aType =
- (PartSet_Tools::ConstraintVisibleState)theType;
+ auto aType = (PartSet_Tools::ConstraintVisibleState)theType;
updateBySketchParameters(aType, theState);
myModule->workshop()->viewer()->update();
void PartSet_SketcherMgr::updateBySketchParameters(
const PartSet_Tools::ConstraintVisibleState &theType, bool theState) {
- if (myCurrentSketch.get() == NULL)
+ if (myCurrentSketch.get() == nullptr)
return;
bool aPrevState = myIsConstraintsShown[theType];
AISObjectPtr anAIS = workshop()->displayer()->getAISObject(theObject);
Handle(AIS_InteractiveObject) anAISIO;
- if (anAIS.get() != NULL) {
+ if (anAIS.get() != nullptr) {
anAISIO = anAIS->impl<Handle(AIS_InteractiveObject)>();
}
// current feature
std::shared_ptr<SketchPlugin_Feature> aSPFeature =
std::dynamic_pointer_cast<SketchPlugin_Feature>(theFeature);
- if (aSPFeature.get() != NULL) {
+ if (aSPFeature.get() != nullptr) {
// 1. Vertices
// 2. Simple segments
// 3. External objects (violet color)
XGUI_Workshop *PartSet_SketcherMgr::workshop() const {
ModuleBase_IWorkshop *anIWorkshop = myModule->workshop();
- XGUI_ModuleConnector *aConnector =
- dynamic_cast<XGUI_ModuleConnector *>(anIWorkshop);
+ auto *aConnector = dynamic_cast<XGUI_ModuleConnector *>(anIWorkshop);
return aConnector->workshop();
}
AttributeSelectionPtr aAttr =
theObject->data()->selection(SketchPlugin_SketchEntity::EXTERNAL_ID());
if (aAttr)
- return aAttr->context().get() != NULL && !aAttr->isInvalid();
+ return aAttr->context().get() != nullptr && !aAttr->isInvalid();
return false;
}
std::shared_ptr<ModelAPI_AttributeBoolean> anAuxiliaryAttr =
aFeature->data()->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID());
bool isConstruction =
- anAuxiliaryAttr.get() != NULL && anAuxiliaryAttr->value();
+ anAuxiliaryAttr.get() != nullptr && anAuxiliaryAttr->value();
std::vector<int> aColor = colorOfObject(theObject, aFeature, isConstruction);
if (!aColor.empty()) {
CompositeFeaturePtr aSketch = mySketchMgr->activeSketch();
ModuleBase_IWorkshop *aWorkshop = mySketchMgr->module()->workshop();
- XGUI_ModuleConnector *aConnector =
- dynamic_cast<XGUI_ModuleConnector *>(aWorkshop);
+ auto *aConnector = dynamic_cast<XGUI_ModuleConnector *>(aWorkshop);
XGUI_Displayer *aDisplayer = aConnector->workshop()->displayer();
Bnd_Box aBndBox;
: QObject(theWorkshop), myWorkshop(theWorkshop), myRestartingMode(RM_None),
myIsFlagsBlocked(false), myIsInternalEditOperation(false),
myNoMoreWidgetsAttribute(""), myIsAutoConstraints(true),
- myLastAutoConstraint(0) {}
+ myLastAutoConstraint(nullptr) {}
-PartSet_SketcherReentrantMgr::~PartSet_SketcherReentrantMgr() {}
+PartSet_SketcherReentrantMgr::~PartSet_SketcherReentrantMgr() = default;
bool PartSet_SketcherReentrantMgr::isInternalEditActive() const {
return myIsInternalEditOperation;
void PartSet_SketcherReentrantMgr::updateInternalEditActiveState() {
if (myIsInternalEditOperation) {
- ModuleBase_OperationFeature *aFOperation =
- dynamic_cast<ModuleBase_OperationFeature *>(
- myWorkshop->currentOperation());
+ auto *aFOperation = dynamic_cast<ModuleBase_OperationFeature *>(
+ myWorkshop->currentOperation());
if (aFOperation) {
FeaturePtr aFeature = aFOperation->feature();
QString anError = myWorkshop->module()->getFeatureError(aFeature);
}
bool PartSet_SketcherReentrantMgr::operationCommitted(
- ModuleBase_Operation *theOperation) {
+ ModuleBase_Operation * /*theOperation*/) {
bool aProcessed = false;
if (!isActiveMgr())
return aProcessed;
}
void PartSet_SketcherReentrantMgr::operationStarted(
- ModuleBase_Operation *theOperation) {
+ ModuleBase_Operation * /*theOperation*/) {
if (!isActiveMgr())
return;
}
void PartSet_SketcherReentrantMgr::operationAborted(
- ModuleBase_Operation *theOperation) {
+ ModuleBase_Operation * /*theOperation*/) {
if (!isActiveMgr())
return;
return aProcessed;
if (myIsInternalEditOperation) {
- ModuleBase_OperationFeature *aFOperation =
- dynamic_cast<ModuleBase_OperationFeature *>(
- myWorkshop->currentOperation());
+ auto *aFOperation = dynamic_cast<ModuleBase_OperationFeature *>(
+ myWorkshop->currentOperation());
FeaturePtr aLastFeature = myRestartingMode == RM_LastFeatureUsed
? aFOperation->feature()
: FeaturePtr();
} else {
// processing mouse move in active widget of restarted operation
ModuleBase_ModelWidget *anActiveWdg = module()->activeWidget();
- PartSet_MouseProcessor *aProcessor =
- dynamic_cast<PartSet_MouseProcessor *>(anActiveWdg);
+ auto *aProcessor = dynamic_cast<PartSet_MouseProcessor *>(anActiveWdg);
if (aProcessor)
aProcessor->mouseMoved(theWnd, theEvent);
}
// position
ModuleBase_Tools::blockUpdateViewer(true);
- ModuleBase_OperationFeature *aFOperation =
- dynamic_cast<ModuleBase_OperationFeature *>(
- myWorkshop->currentOperation());
+ auto *aFOperation = dynamic_cast<ModuleBase_OperationFeature *>(
+ myWorkshop->currentOperation());
myPreviousFeature = aFOperation->feature();
/// selection should be obtained from workshop before ask if the operation
module()->getGeomSelection(aValue, mySelectedObject,
mySelectedAttribute);
- PartSet_WidgetPoint2D *aPointWidget =
+ auto *aPointWidget =
dynamic_cast<PartSet_WidgetPoint2D *>(anActiveWidget);
if (aPointWidget) {
GeomShapePtr aShape;
// fill the first widget by the mouse event point
// if the active widget is not the first, it means that the restarted
// operation is filled by the current preselection.
- PartSet_MouseProcessor *aMouseProcessor =
+ auto *aMouseProcessor =
dynamic_cast<PartSet_MouseProcessor *>(module()->activeWidget());
// PartSet_WidgetPoint2D* aPoint2DWdg =
// dynamic_cast<PartSet_WidgetPoint2D*>(module()->activeWidget());
- PartSet_MouseProcessor *aFirstWidget =
- dynamic_cast<PartSet_MouseProcessor *>(
- aPanel->findFirstAcceptingValueWidget());
+ auto *aFirstWidget = dynamic_cast<PartSet_MouseProcessor *>(
+ aPanel->findFirstAcceptingValueWidget());
// if (aPoint2DWdg && aPoint2DWdg == aFirstWidget) {
if (aMouseProcessor && aMouseProcessor == aFirstWidget) {
std::shared_ptr<ModuleBase_ViewerPrs> aSelectedPrs;
return;
}
- ModuleBase_OperationFeature *aFOperation =
- dynamic_cast<ModuleBase_OperationFeature *>(
- myWorkshop->currentOperation());
+ auto *aFOperation = dynamic_cast<ModuleBase_OperationFeature *>(
+ myWorkshop->currentOperation());
if (module()->sketchMgr()->isDragModeCreation()) {
if (aFOperation && myIsAutoConstraints)
addConstraints(aFOperation->feature());
if (thePreviousAttributeID.empty())
return isDone;
- ModuleBase_OperationFeature *aFOperation =
- dynamic_cast<ModuleBase_OperationFeature *>(
- myWorkshop->currentOperation());
+ auto *aFOperation = dynamic_cast<ModuleBase_OperationFeature *>(
+ myWorkshop->currentOperation());
if (!myWorkshop->module()->getFeatureError(aFOperation->feature()).isEmpty())
return isDone;
void PartSet_SketcherReentrantMgr::onAfterValuesChangedInPropertyPanel() {
if (isInternalEditActive()) {
- ModuleBase_ModelWidget *aWidget = (ModuleBase_ModelWidget *)sender();
+ auto *aWidget = (ModuleBase_ModelWidget *)sender();
if (!aWidget->isModifiedInEdit().empty())
restartOperation();
}
module()->sketchMgr()->isNestedSketchOperation(aCurrentOperation);
if (anActive) { // the manager is not active when the current operation is a
// usual Edit
- ModuleBase_OperationFeature *aFOperation =
- dynamic_cast<ModuleBase_OperationFeature *>(
- myWorkshop->currentOperation());
+ auto *aFOperation = dynamic_cast<ModuleBase_OperationFeature *>(
+ myWorkshop->currentOperation());
if (aFOperation->isEditOperation())
anActive = myIsInternalEditOperation;
}
if (myIsInternalEditOperation)
return true;
- ModuleBase_OperationFeature *aFOperation =
- dynamic_cast<ModuleBase_OperationFeature *>(
- myWorkshop->currentOperation());
+ auto *aFOperation = dynamic_cast<ModuleBase_OperationFeature *>(
+ myWorkshop->currentOperation());
if (aFOperation &&
module()->sketchMgr()->isNestedSketchOperation(aFOperation)) {
ModuleBase_Operation *anEditOperation = module()->currentOperation();
if (anEditOperation) {
ModuleBase_IPropertyPanel *aPanel = aFOperation->propertyPanel();
- ModuleBase_ModelWidget *aPreviousAttributeWidget = 0;
+ ModuleBase_ModelWidget *aPreviousAttributeWidget = nullptr;
QList<ModuleBase_ModelWidget *> aWidgets = aPanel->modelWidgets();
for (int i = 0, aNb = aWidgets.size();
i < aNb && !aPreviousAttributeWidget; i++) {
// is moved to Apply button and there should not be active control
// visualized in property panel
if (aPreviousAttributeWidget == aPanel->activeWidget()) {
- aPanel->activateWidget(NULL, false);
+ aPanel->activateWidget(nullptr, false);
}
// if there is no the next widget to be automatically activated,
// the Ok button in property
}
void PartSet_SketcherReentrantMgr::beforeStopInternalEdit() {
- ModuleBase_OperationFeature *aFOperation =
- dynamic_cast<ModuleBase_OperationFeature *>(
- myWorkshop->currentOperation());
+ auto *aFOperation = dynamic_cast<ModuleBase_OperationFeature *>(
+ myWorkshop->currentOperation());
if (aFOperation) {
disconnect(aFOperation, SIGNAL(beforeCommitted()), this,
SLOT(onBeforeStopped()));
#endif
if (myIsInternalEditOperation) {
- ModuleBase_OperationFeature *aFOperation =
- dynamic_cast<ModuleBase_OperationFeature *>(
- myWorkshop->currentOperation());
+ auto *aFOperation = dynamic_cast<ModuleBase_OperationFeature *>(
+ myWorkshop->currentOperation());
if (aFOperation) {
ModuleBase_ISelection *aSelection = myWorkshop->selection();
QList<ModuleBase_ViewerPrsPtr> aPreSelected =
}
void PartSet_SketcherReentrantMgr::createInternalFeature() {
- ModuleBase_OperationFeature *aFOperation =
- dynamic_cast<ModuleBase_OperationFeature *>(
- myWorkshop->currentOperation());
+ auto *aFOperation = dynamic_cast<ModuleBase_OperationFeature *>(
+ myWorkshop->currentOperation());
if (aFOperation &&
module()->sketchMgr()->isNestedSketchOperation(aFOperation)) {
bool isFeatureChanged = copyReetntrantAttributes(
anOperationFeature, myInternalFeature, aSketch, false);
- XGUI_PropertyPanel *aPropertyPanel =
+ auto *aPropertyPanel =
dynamic_cast<XGUI_PropertyPanel *>(aFOperation->propertyPanel());
myInternalWidget =
new QWidget(aPropertyPanel->contentWidget()->pageWidget());
myInternalWidget->setVisible(false);
- ModuleBase_PageWidget *anInternalPage =
- new ModuleBase_PageWidget(myInternalWidget);
+ auto *anInternalPage = new ModuleBase_PageWidget(myInternalWidget);
QString aXmlRepr = aFOperation->getDescription()->xmlRepresentation();
ModuleBase_WidgetFactory aFactory(aXmlRepr.toStdString(), myWorkshop);
std::cout << "PartSet_SketcherReentrantMgr::deleteInternalFeature: "
<< myInternalFeature->data()->name() << std::endl;
#endif
- setInternalActiveWidget(0);
+ setInternalActiveWidget(nullptr);
delete myInternalWidget;
- myInternalWidget = 0;
+ myInternalWidget = nullptr;
QObjectPtrList anObjects;
anObjects.append(myInternalFeature);
bool PartSet_SketcherReentrantMgr::copyReetntrantAttributes(
const FeaturePtr &theSourceFeature, const FeaturePtr &theNewFeature,
- const CompositeFeaturePtr &theSketch, const bool /*isTemporary*/) {
+ const CompositeFeaturePtr & /*theSketch*/, const bool /*isTemporary*/) {
bool aChanged = false;
if (!theSourceFeature.get() || !theSourceFeature->data().get() ||
!theSourceFeature->data()->isValid())
ModuleBase_Operation *theOperation,
const CompositeFeaturePtr & /*theSketch*/) const {
bool aTangentArc = false;
- ModuleBase_OperationFeature *aFOperation =
- dynamic_cast<ModuleBase_OperationFeature *>(theOperation);
+ auto *aFOperation = dynamic_cast<ModuleBase_OperationFeature *>(theOperation);
if (aFOperation &&
module()->sketchMgr()->isNestedSketchOperation(aFOperation)) {
FeaturePtr aFeature = aFOperation->feature();
}
XGUI_Workshop *PartSet_SketcherReentrantMgr::workshop() const {
- XGUI_ModuleConnector *aConnector =
- dynamic_cast<XGUI_ModuleConnector *>(myWorkshop);
+ auto *aConnector = dynamic_cast<XGUI_ModuleConnector *>(myWorkshop);
return aConnector->workshop();
}
void PartSet_SketcherReentrantMgr::setInternalActiveWidget(
ModuleBase_ModelWidget *theWidget) {
- ModuleBase_OperationFeature *aFOperation =
- dynamic_cast<ModuleBase_OperationFeature *>(
- myWorkshop->currentOperation());
+ auto *aFOperation = dynamic_cast<ModuleBase_OperationFeature *>(
+ myWorkshop->currentOperation());
if (aFOperation) {
- XGUI_PropertyPanel *aPropertyPanel =
+ auto *aPropertyPanel =
dynamic_cast<XGUI_PropertyPanel *>(aFOperation->propertyPanel());
if (aPropertyPanel)
aPropertyPanel->setInternalActiveWidget(theWidget);
/// Constructor
/// \param theWorkshop a workshop instance
PartSet_SketcherReentrantMgr(ModuleBase_IWorkshop *theWorkshop);
- virtual ~PartSet_SketcherReentrantMgr();
+ ~PartSet_SketcherReentrantMgr() override;
public:
/// Return true if the current edit operation is an internal
}
ResultPtr
-PartSet_Tools::findFixedObjectByExternal(const TopoDS_Shape &theShape,
+PartSet_Tools::findFixedObjectByExternal(const TopoDS_Shape & /*theShape*/,
const ObjectPtr &theObject,
CompositeFeaturePtr theSketch) {
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
ResultPtr PartSet_Tools::createFixedObjectByExternal(
const std::shared_ptr<GeomAPI_Shape> &theShape, const ObjectPtr &theObject,
- CompositeFeaturePtr theSketch, const bool theTemporary,
+ CompositeFeaturePtr theSketch, const bool /*theTemporary*/,
FeaturePtr &theCreatedFeature) {
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
if (!aResult.get())
PartSet_Tools::findShapeBy2DPoint(const AttributePtr &theAttribute,
ModuleBase_IWorkshop *theWorkshop) {
GeomShapePtr aShape;
- XGUI_ModuleConnector *aConnector =
- dynamic_cast<XGUI_ModuleConnector *>(theWorkshop);
+ auto *aConnector = dynamic_cast<XGUI_ModuleConnector *>(theWorkshop);
XGUI_Displayer *aDisplayer = aConnector->workshop()->displayer();
// 2. find visualized vertices of the attribute and if the attribute of the
ModelAPI_Feature::feature(theAttribute->owner());
// 2.1 get visualized results of the feature
const std::list<ResultPtr> &aResList = anAttributeFeature->results();
- std::list<ResultPtr>::const_iterator anIt = aResList.begin(),
- aLast = aResList.end();
+ auto anIt = aResList.begin(), aLast = aResList.end();
for (; anIt != aLast; anIt++) {
AISObjectPtr aAISObj = aDisplayer->getAISObject(*anIt);
- if (aAISObj.get() != NULL) {
+ if (aAISObj.get() != nullptr) {
Handle(AIS_InteractiveObject) anAISIO =
aAISObj->impl<Handle(AIS_InteractiveObject)>();
// 2.2 find selected owners of a visualizedd object
if (aBRepShape.ShapeType() == TopAbs_VERTEX) {
// 2.3 if the owner is vertex and an attribute of the vertex is
// equal to the initial attribute, returns the shape
- PartSet_Module *aModule =
+ auto *aModule =
dynamic_cast<PartSet_Module *>(theWorkshop->module());
PartSet_SketcherMgr *aSketchMgr = aModule->sketchMgr();
std::pair<AttributePtr, int> aPntAttrIndex =
PartSet_Tools::findAttributeBy2dPoint(
anAttributeFeature, aBRepShape,
aSketchMgr->activeSketch());
- if (aPntAttrIndex.first.get() != NULL &&
+ if (aPntAttrIndex.first.get() != nullptr &&
aPntAttrIndex.first == theAttribute) {
aShape = std::shared_ptr<GeomAPI_Shape>(new GeomAPI_Shape);
aShape->setImpl(new TopoDS_Shape(aBRepShape));
ModelGeomAlgo_Point2D::getPointOfRefAttr(theFeature.get(), theAttribute,
SketchPlugin_Point::ID(),
SketchPlugin_Point::COORD_ID());
- if (aPointAttr.get() != NULL)
+ if (aPointAttr.get() != nullptr)
return aPointAttr->pnt();
return std::shared_ptr<GeomAPI_Pnt2d>();
}
PartSet_Tools::findFirstCoincidence(const FeaturePtr &theFeature,
std::shared_ptr<GeomAPI_Pnt2d> thePoint) {
FeaturePtr aCoincident;
- if (theFeature.get() == NULL)
+ if (theFeature.get() == nullptr)
return aCoincident;
const std::set<AttributePtr> &aRefsList = theFeature->data()->refsToMe();
std::string theAttr,
QList<bool> &theIsAttributes) {
std::shared_ptr<GeomAPI_Pnt2d> aOrig = getCoincedencePoint(theStartCoin);
- if (aOrig.get() == NULL)
+ if (aOrig.get() == nullptr)
return;
AttributeRefAttrPtr aPnt = theStartCoin->refattr(theAttr);
PartSet_Tools::getCoincedencePoint(FeaturePtr theStartCoin) {
std::shared_ptr<GeomAPI_Pnt2d> aPnt = SketcherPrs_Tools::getPoint(
theStartCoin.get(), SketchPlugin_Constraint::ENTITY_A());
- if (aPnt.get() == NULL)
+ if (aPnt.get() == nullptr)
aPnt = SketcherPrs_Tools::getPoint(theStartCoin.get(),
SketchPlugin_Constraint::ENTITY_B());
return aPnt;
// go through the references to the feature to check
// if it was created by Projection or Intersection
const std::set<AttributePtr> &aRefs = theObject->data()->refsToMe();
- for (std::set<AttributePtr>::const_iterator aRefIt = aRefs.begin();
- aRefIt != aRefs.end(); ++aRefIt) {
- AttributePtr anAttr = *aRefIt;
+ for (auto anAttr : aRefs) {
std::string anIncludeToResultAttrName;
if (anAttr->id() == SketchPlugin_Projection::PROJECTED_FEATURE_ID())
anIncludeToResultAttrName =
FieldStepPtr aStep = aFieldRes->step(i);
if (aStep.get()) {
if (i < myChildren.size()) {
- PartSet_StepNode *aStepNode =
- static_cast<PartSet_StepNode *>(myChildren.at(i));
+ auto *aStepNode = static_cast<PartSet_StepNode *>(myChildren.at(i));
if (aStepNode->object() != aStep) {
aStepNode->setObject(aStep);
}
FieldStepPtr aStep = aFieldRes->step(i);
if (aStep.get()) {
if (i < myChildren.size()) {
- PartSet_StepNode *aStepNode =
- static_cast<PartSet_StepNode *>(myChildren.at(i));
+ auto *aStepNode = static_cast<PartSet_StepNode *>(myChildren.at(i));
if (aStepNode->object() != aStep) {
aStepNode->setObject(aStep);
}
FeaturePtr aFeature = document()->currentFeature(true);
if (!aFeature.get()) { // There is no current feature
- ModuleBase_ITreeNode *aLastFolder = 0;
+ ModuleBase_ITreeNode *aLastFolder = nullptr;
foreach (ModuleBase_ITreeNode *aNode, parent()->children()) {
if (aNode->type() == PartSet_FolderNode::typeId())
aLastFolder = aNode;
ModuleBase_ITreeNode *
PartSet_FeatureFolderNode::findParent(const DocumentPtr &theDoc,
QString theGroup) {
- ModuleBase_ITreeNode *aResult = 0;
+ ModuleBase_ITreeNode *aResult = nullptr;
foreach (ModuleBase_ITreeNode *aNode, myChildren) {
aResult = aNode->findParent(theDoc, theGroup);
if (aResult) {
(theGroup.toStdString() == ModelAPI_Folder::group()));
if ((theDoc == document()) && isGroup)
return this;
- return 0;
+ return nullptr;
}
//////////////////////////////////////////////////////////////////////////////////
-PartSet_RootNode::PartSet_RootNode()
- : PartSet_FeatureFolderNode(0), myWorkshop(0) {
+PartSet_RootNode::PartSet_RootNode() : PartSet_FeatureFolderNode(nullptr) {
SessionPtr aSession = ModelAPI_Session::get();
DocumentPtr aDoc = aSession->moduleDocument();
if (aFeature->getKind() == PartSetPlugin_Part::ID())
return new PartSet_PartRootNode(theObj, this);
- PartSet_ObjectNode *aNode = new PartSet_ObjectNode(theObj, this);
+ auto *aNode = new PartSet_ObjectNode(theObj, this);
aNode->update();
return aNode;
}
case Qt::DisplayRole: {
ResultPartPtr aPartRes = getPartResult(myObject);
if (aPartRes.get()) {
- if (aPartRes->partDoc().get() == NULL)
+ if (aPartRes->partDoc().get() == nullptr)
return QString::fromStdWString(myObject->data()->name()) +
" (Not loaded)";
}
PartSet_PartRootNode::createNode(const ObjectPtr &theObj) {
if (theObj->groupName() == ModelAPI_Folder::group())
return new PartSet_ObjectFolderNode(theObj, this);
- PartSet_ObjectNode *aNode = new PartSet_ObjectNode(theObj, this);
+ auto *aNode = new PartSet_ObjectNode(theObj, this);
aNode->update();
return aNode;
}
*/
class PartSet_TreeNode : public ModuleBase_ITreeNode {
public:
- PartSet_TreeNode(ModuleBase_ITreeNode *theParent = 0)
+ PartSet_TreeNode(ModuleBase_ITreeNode *theParent = nullptr)
: ModuleBase_ITreeNode(theParent) {}
/// Returns the node representation according to theRole.
- virtual QVariant data(int theColumn, int theRole) const;
+ QVariant data(int theColumn, int theRole) const override;
// Returns color of the Item when it is active
virtual QColor activeItemColor() const;
class PartSet_ObjectNode : public PartSet_TreeNode {
public:
PartSet_ObjectNode(const ObjectPtr &theObj,
- ModuleBase_ITreeNode *theParent = 0)
+ ModuleBase_ITreeNode *theParent = nullptr)
: PartSet_TreeNode(theParent), myObject(theObj) {}
static std::string typeId() {
return myType;
}
- virtual std::string type() const { return typeId(); }
+ std::string type() const override { return typeId(); }
/// Returns the node representation according to theRole.
- virtual QVariant data(int theColumn, int theRole) const;
+ QVariant data(int theColumn, int theRole) const override;
/// Returns properties flag of the item
- virtual Qt::ItemFlags flags(int theColumn) const;
+ Qt::ItemFlags flags(int theColumn) const override;
/// Returns object referenced by the node (can be null)
- virtual ObjectPtr object() const { return myObject; }
+ ObjectPtr object() const override { return myObject; }
/// Sets an object to the node
/// theObj a new object
void setObject(ObjectPtr theObj) { myObject = theObj; }
- virtual VisibilityState visibilityState() const;
+ VisibilityState visibilityState() const override;
/// Updates sub-nodes of the node
- virtual void update();
+ void update() override;
/// Process creation of objects.
/// \param theObjects a list of created objects
/// \return a list of nodes which corresponds to the created objects
- virtual QTreeNodesList objectCreated(const QObjectPtrList &theObjects);
+ QTreeNodesList objectCreated(const QObjectPtrList &theObjects) override;
/// Process deletion of objects.
/// \param theDoc a document where objects were deleted
/// \param theGroup a name of group where objects were deleted
- virtual QTreeNodesList objectsDeleted(const DocumentPtr &theDoc,
- const QString &theGroup);
+ QTreeNodesList objectsDeleted(const DocumentPtr &theDoc,
+ const QString &theGroup) override;
/// Returns number of sub-objects of the current object
virtual int numberOfSubs() const;
virtual ObjectPtr subObject(int theId) const;
// Returns color of the Item when it is active
- virtual QColor activeItemColor() const;
+ QColor activeItemColor() const override;
protected:
ObjectPtr myObject;
return myType;
}
- virtual std::string type() const { return typeId(); }
+ std::string type() const override { return typeId(); }
/// Returns the node representation according to theRole.
- virtual QVariant data(int theColumn, int theRole) const;
+ QVariant data(int theColumn, int theRole) const override;
/// Returns properties flag of the item
- virtual Qt::ItemFlags flags(int theColumn) const;
+ Qt::ItemFlags flags(int theColumn) const override;
/// Updates sub-nodes of the node
- virtual void update();
+ void update() override;
/// Process creation of objects.
/// \param theObjects a list of created objects
/// \return a list of nodes which corresponds to the created objects
- virtual QTreeNodesList objectCreated(const QObjectPtrList &theObjects);
+ QTreeNodesList objectCreated(const QObjectPtrList &theObjects) override;
/// Process deletion of objects.
/// \param theDoc a document where objects were deleted
/// \param theGroup a name of group where objects were deleted
- virtual QTreeNodesList objectsDeleted(const DocumentPtr &theDoc,
- const QString &theGroup);
+ QTreeNodesList objectsDeleted(const DocumentPtr &theDoc,
+ const QString &theGroup) override;
QString name() const;
/// Returns a node which belongs to the given document and contains objects of
/// the given group \param theDoc a document \param theGroup a name of objects
/// group \return a parent node if it is found
- virtual ModuleBase_ITreeNode *findParent(const DocumentPtr &theDoc,
- QString theGroup) {
+ ModuleBase_ITreeNode *findParent(const DocumentPtr &theDoc,
+ QString theGroup) override {
if ((theDoc == document()) && (theGroup.toStdString() == groupName()))
return this;
- return 0;
+ return nullptr;
}
private:
*/
class PartSet_FeatureFolderNode : public PartSet_TreeNode {
public:
- PartSet_FeatureFolderNode(ModuleBase_ITreeNode *theParent = 0)
+ PartSet_FeatureFolderNode(ModuleBase_ITreeNode *theParent = nullptr)
: PartSet_TreeNode(theParent) {}
/// Process creation of objects.
/// \param theObjects a list of created objects
/// \return a list of nodes which corresponds to the created objects
- virtual QTreeNodesList objectCreated(const QObjectPtrList &theObjects);
+ QTreeNodesList objectCreated(const QObjectPtrList &theObjects) override;
/// Process deletion of objects.
/// \param theDoc a document where objects were deleted
/// \param theGroup a name of group where objects were deleted
- virtual QTreeNodesList objectsDeleted(const DocumentPtr &theDoc,
- const QString &theGroup);
+ QTreeNodesList objectsDeleted(const DocumentPtr &theDoc,
+ const QString &theGroup) override;
/// Returns a node which belongs to the given document and contains objects of
/// the given group \param theDoc a document \param theGroup a name of objects
/// group \return a parent node if it is found
- virtual ModuleBase_ITreeNode *findParent(const DocumentPtr &theDoc,
- QString theGroup);
+ ModuleBase_ITreeNode *findParent(const DocumentPtr &theDoc,
+ QString theGroup) override;
protected:
virtual ModuleBase_ITreeNode *createNode(const ObjectPtr &theObj) = 0;
return myType;
}
- virtual std::string type() const { return typeId(); }
+ std::string type() const override { return typeId(); }
/// Updates sub-nodes of the node
- virtual void update();
+ void update() override;
- virtual ModuleBase_IWorkshop *workshop() const { return myWorkshop; }
+ ModuleBase_IWorkshop *workshop() const override { return myWorkshop; }
/// Returns document object of the sub-tree.
- virtual DocumentPtr document() const;
+ DocumentPtr document() const override;
void setWorkshop(ModuleBase_IWorkshop *theWork) { myWorkshop = theWork; }
protected:
- virtual ModuleBase_ITreeNode *createNode(const ObjectPtr &theObj);
+ ModuleBase_ITreeNode *createNode(const ObjectPtr &theObj) override;
- virtual int numberOfFolders() const { return 3; }
+ int numberOfFolders() const override { return 3; }
private:
PartSet_FolderNode *myParamsFolder;
PartSet_FolderNode *myConstrFolder;
PartSet_FolderNode *myPartsFolder;
- ModuleBase_IWorkshop *myWorkshop;
+ ModuleBase_IWorkshop *myWorkshop{0};
};
/////////////////////////////////////////////////////////////////////
return myType;
}
- virtual std::string type() const { return typeId(); }
+ std::string type() const override { return typeId(); }
/// Returns object referenced by the node (can be null)
- virtual ObjectPtr object() const { return myObject; }
+ ObjectPtr object() const override { return myObject; }
/// Returns document object of the sub-tree.
- virtual DocumentPtr document() const;
+ DocumentPtr document() const override;
/// Updates sub-nodes of the node
- virtual void update();
+ void update() override;
/// Returns the node representation according to theRole.
- virtual QVariant data(int theColumn, int theRole) const;
+ QVariant data(int theColumn, int theRole) const override;
/// Returns properties flag of the item
- virtual Qt::ItemFlags flags(int theColumn) const;
+ Qt::ItemFlags flags(int theColumn) const override;
/// Process creation of objects.
/// \param theObjects a list of created objects
/// \return a list of nodes which corresponds to the created objects
- virtual QTreeNodesList objectCreated(const QObjectPtrList &theObjects);
+ QTreeNodesList objectCreated(const QObjectPtrList &theObjects) override;
/// Process deletion of objects.
/// \param theDoc a document where objects were deleted
/// \param theGroup a name of group where objects were deleted
- virtual QTreeNodesList objectsDeleted(const DocumentPtr &theDoc,
- const QString &theGroup);
+ QTreeNodesList objectsDeleted(const DocumentPtr &theDoc,
+ const QString &theGroup) override;
protected:
- virtual ModuleBase_ITreeNode *createNode(const ObjectPtr &theObj);
+ ModuleBase_ITreeNode *createNode(const ObjectPtr &theObj) override;
- virtual int numberOfFolders() const;
+ int numberOfFolders() const override;
- virtual void deleteChildren();
+ void deleteChildren() override;
private:
PartSet_FolderNode *myParamsFolder;
return myType;
}
- virtual std::string type() const { return typeId(); }
+ std::string type() const override { return typeId(); }
/// Updates sub-nodes of the node
- virtual void update();
+ void update() override;
/// Process creation of objects.
/// \param theObjects a list of created objects
/// \return a list of nodes which corresponds to the created objects
- virtual QTreeNodesList objectCreated(const QObjectPtrList &theObjects);
+ QTreeNodesList objectCreated(const QObjectPtrList &theObjects) override;
/// Process deletion of objects.
/// \param theDoc a document where objects were deleted
/// \param theGroup a name of group where objects were deleted
- virtual QTreeNodesList objectsDeleted(const DocumentPtr &theDoc,
- const QString &theGroup);
+ QTreeNodesList objectsDeleted(const DocumentPtr &theDoc,
+ const QString &theGroup) override;
/// Returns the node representation according to theRole.
- virtual QVariant data(int theColumn, int theRole) const;
+ QVariant data(int theColumn, int theRole) const override;
};
/////////////////////////////////////////////////////////////////////
return myType;
}
- virtual std::string type() const { return typeId(); }
+ std::string type() const override { return typeId(); }
/// Returns the node representation according to theRole.
- virtual QVariant data(int theColumn, int theRole) const;
+ QVariant data(int theColumn, int theRole) const override;
- virtual VisibilityState visibilityState() const;
+ VisibilityState visibilityState() const override;
};
#endif
const GeomShapePtr &aShape = aPrs->shape();
if (aShape.get() && !aShape->isNull()) {
if (aShape->shapeType() == GeomAPI_Shape::EDGE) {
- const TopoDS_Shape &aTDShape = aShape->impl<TopoDS_Shape>();
+ const auto &aTDShape = aShape->impl<TopoDS_Shape>();
TopoDS_Edge aEdge = TopoDS::Edge(aTDShape);
Standard_Real aStart, aEnd;
Handle(Geom_Curve) aCurve = BRep_Tool::Curve(aEdge, aStart, aEnd);
std::shared_ptr<GeomAPI_Pln> sketcherPlane(ModuleBase_Operation *theOperation) {
std::shared_ptr<GeomAPI_Pln> aEmptyPln;
if (theOperation) {
- ModuleBase_OperationFeature *aFeatureOp =
+ auto *aFeatureOp =
dynamic_cast<ModuleBase_OperationFeature *>(theOperation);
if (aFeatureOp) {
CompositeFeaturePtr aFeature =
}
bool isEmptySelectionValid(ModuleBase_Operation *theOperation) {
- ModuleBase_OperationFeature *aFeatureOp =
- dynamic_cast<ModuleBase_OperationFeature *>(theOperation);
+ auto *aFeatureOp = dynamic_cast<ModuleBase_OperationFeature *>(theOperation);
// during the create operation empty selection is always valid
if (!aFeatureOp->isEditOperation()) {
return true;
bool PartSet_DifferentObjectsValidator::isValid(
const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
+ const std::list<std::string> & /*theArguments*/,
Events_InfoMessage &theError) const {
FeaturePtr aFeature =
std::dynamic_pointer_cast<ModelAPI_Feature>(theAttribute->owner());
anAttrs = aFeature->data()->attributes(ModelAPI_AttributeRefAttr::typeId());
if (anAttrs.size() > 0) {
- std::list<std::shared_ptr<ModelAPI_Attribute>>::iterator anAttrIter =
- anAttrs.begin();
+ auto anAttrIter = anAttrs.begin();
for (; anAttrIter != anAttrs.end(); anAttrIter++) {
if ((*anAttrIter).get() && (*anAttrIter)->id() != theAttribute->id()) {
std::shared_ptr<ModelAPI_AttributeRefAttr> aRef =
anAttrs =
aFeature->data()->attributes(ModelAPI_AttributeSelection::typeId());
if (anAttrs.size() > 0) {
- std::list<std::shared_ptr<ModelAPI_Attribute>>::iterator anAttr =
- anAttrs.begin();
+ auto anAttr = anAttrs.begin();
for (; anAttr != anAttrs.end(); anAttr++) {
if ((*anAttr).get() && (*anAttr)->id() != theAttribute->id()) {
std::shared_ptr<ModelAPI_AttributeSelection> aRef =
std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(*anAttr);
// check the object is already presented
if (aRef->context() == aContext) {
- bool aHasShape = aShape.get() != NULL;
+ bool aHasShape = aShape.get() != nullptr;
if (!aHasShape || aRef->value()->isEqual(aShape)) {
theError =
errorMessage(EqualShapes, "", theAttribute->id(), aRef->id());
anAttrs =
aFeature->data()->attributes(ModelAPI_AttributeReference::typeId());
if (anAttrs.size() > 0) {
- std::list<std::shared_ptr<ModelAPI_Attribute>>::iterator anAttr =
- anAttrs.begin();
+ auto anAttr = anAttrs.begin();
for (; anAttr != anAttrs.end(); anAttr++) {
if ((*anAttr).get() && (*anAttr)->id() != theAttribute->id()) {
std::shared_ptr<ModelAPI_AttributeReference> aRef =
anAttrs =
aFeature->data()->attributes(ModelAPI_AttributeSelectionList::typeId());
if (anAttrs.size() > 0) {
- std::list<std::shared_ptr<ModelAPI_Attribute>>::iterator anAttrItr =
- anAttrs.begin();
+ auto anAttrItr = anAttrs.begin();
for (; anAttrItr != anAttrs.end(); anAttrItr++) {
if ((*anAttrItr).get() && (*anAttrItr)->id() != theAttribute->id()) {
std::shared_ptr<ModelAPI_AttributeSelectionList> aRefSelList =
return false;
}
if (aCurSelContext == aRefSelContext) {
- if (aCurSel->value().get() == NULL ||
- aRefSel->value().get() == NULL) {
+ if (aCurSel->value().get() == nullptr ||
+ aRefSel->value().get() == nullptr) {
theError = errorMessage(EmptyShapes, "", theAttribute->id(),
aRefSel->id());
return false;
std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(theAttribute);
anAttrs = aFeature->data()->attributes(ModelAPI_AttributeRefList::typeId());
if (anAttrs.size() > 0) {
- std::list<std::shared_ptr<ModelAPI_Attribute>>::iterator anAttrItr =
- anAttrs.begin();
+ auto anAttrItr = anAttrs.begin();
for (; anAttrItr != anAttrs.end(); anAttrItr++) {
if ((*anAttrItr).get() && (*anAttrItr)->id() != theAttribute->id()) {
std::shared_ptr<ModelAPI_AttributeRefList> aRefSelList =
bool PartSet_DifferentPointsValidator::isValid(
const AttributePtr &theAttribute,
const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const {
+ Events_InfoMessage & /*theError*/) const {
FeaturePtr aFeature =
std::dynamic_pointer_cast<ModelAPI_Feature>(theAttribute->owner());
//! A class to validate a selection for Distance constraint operation
class PartSet_DistanceSelection : public ModuleBase_SelectionValidator {
public:
- PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection,
- ModuleBase_Operation *theOperation) const;
+ PARTSET_EXPORT bool
+ isValid(const ModuleBase_ISelection *theSelection,
+ ModuleBase_Operation *theOperation) const override;
};
//! \ingroup Validators
//! A class to validate a selection for Length constraint operation
class PartSet_LengthSelection : public ModuleBase_SelectionValidator {
public:
- PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection,
- ModuleBase_Operation *theOperation) const;
+ PARTSET_EXPORT bool
+ isValid(const ModuleBase_ISelection *theSelection,
+ ModuleBase_Operation *theOperation) const override;
};
//! \ingroup Validators
//! A class to validate a selection for Perpendicular constraint operation
class PartSet_PerpendicularSelection : public ModuleBase_SelectionValidator {
public:
- PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection,
- ModuleBase_Operation *theOperation) const;
+ PARTSET_EXPORT bool
+ isValid(const ModuleBase_ISelection *theSelection,
+ ModuleBase_Operation *theOperation) const override;
};
//! \ingroup Validators
//! A class to validate a selection for Parallel constraint operation
class PartSet_ParallelSelection : public ModuleBase_SelectionValidator {
public:
- PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection,
- ModuleBase_Operation *theOperation) const;
+ PARTSET_EXPORT bool
+ isValid(const ModuleBase_ISelection *theSelection,
+ ModuleBase_Operation *theOperation) const override;
};
//! \ingroup Validators
//! A class to validate a selection for Radius constraint operation
class PartSet_RadiusSelection : public ModuleBase_SelectionValidator {
public:
- PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection,
- ModuleBase_Operation *theOperation) const;
+ PARTSET_EXPORT bool
+ isValid(const ModuleBase_ISelection *theSelection,
+ ModuleBase_Operation *theOperation) const override;
};
//! \ingroup Validators
//! A class to validate a selection for Rigid constraint operation
class PartSet_RigidSelection : public ModuleBase_SelectionValidator {
public:
- PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection,
- ModuleBase_Operation *theOperation) const;
+ PARTSET_EXPORT bool
+ isValid(const ModuleBase_ISelection *theSelection,
+ ModuleBase_Operation *theOperation) const override;
};
//! \ingroup Validators
//! A class to validate a selection for coincedence constraint operation
class PartSet_CoincidentSelection : public ModuleBase_SelectionValidator {
public:
- PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection,
- ModuleBase_Operation *theOperation) const;
+ PARTSET_EXPORT bool
+ isValid(const ModuleBase_ISelection *theSelection,
+ ModuleBase_Operation *theOperation) const override;
};
//! \ingroup Validators
//! operation
class PartSet_HVDirSelection : public ModuleBase_SelectionValidator {
public:
- PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection,
- ModuleBase_Operation *theOperation) const;
+ PARTSET_EXPORT bool
+ isValid(const ModuleBase_ISelection *theSelection,
+ ModuleBase_Operation *theOperation) const override;
};
//! \ingroup Validators
//! A class to validate a selection for Tangential constraints operation
class PartSet_TangentSelection : public ModuleBase_SelectionValidator {
public:
- PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection,
- ModuleBase_Operation *theOperation) const;
+ PARTSET_EXPORT bool
+ isValid(const ModuleBase_ISelection *theSelection,
+ ModuleBase_Operation *theOperation) const override;
};
//! \ingroup Validators
//! A class to validate a selection for Fillet constraints operation
class PartSet_FilletSelection : public ModuleBase_SelectionValidator {
public:
- PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection,
- ModuleBase_Operation *theOperation) const;
+ PARTSET_EXPORT bool
+ isValid(const ModuleBase_ISelection *theSelection,
+ ModuleBase_Operation *theOperation) const override;
};
//! \ingroup Validators
//! A class to validate a selection for Angle constraints operation
class PartSet_AngleSelection : public ModuleBase_SelectionValidator {
public:
- PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection,
- ModuleBase_Operation *theOperation) const;
+ PARTSET_EXPORT bool
+ isValid(const ModuleBase_ISelection *theSelection,
+ ModuleBase_Operation *theOperation) const override;
};
//! \ingroup Validators
//! A class to validate a selection for Equal constraints operation
class PartSet_EqualSelection : public ModuleBase_SelectionValidator {
public:
- PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection,
- ModuleBase_Operation *theOperation) const;
+ PARTSET_EXPORT bool
+ isValid(const ModuleBase_ISelection *theSelection,
+ ModuleBase_Operation *theOperation) const override;
};
//! \ingroup Validators
//! A class to validate a selection for Collinear constraints operation
class PartSet_CollinearSelection : public ModuleBase_SelectionValidator {
public:
- PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection,
- ModuleBase_Operation *theOperation) const;
+ PARTSET_EXPORT bool
+ isValid(const ModuleBase_ISelection *theSelection,
+ ModuleBase_Operation *theOperation) const override;
};
//! \ingroup Validators
//! A class to validate a selection for Middle point constraints operation
class PartSet_MiddlePointSelection : public ModuleBase_SelectionValidator {
public:
- PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection,
- ModuleBase_Operation *theOperation) const;
+ PARTSET_EXPORT bool
+ isValid(const ModuleBase_ISelection *theSelection,
+ ModuleBase_Operation *theOperation) const override;
};
//! \ingroup Validators
//! A class to validate a selection for Middle point constraints operation
class PartSet_MultyTranslationSelection : public ModuleBase_SelectionValidator {
public:
- PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection,
- ModuleBase_Operation *theOperation) const;
+ PARTSET_EXPORT bool
+ isValid(const ModuleBase_ISelection *theSelection,
+ ModuleBase_Operation *theOperation) const override;
};
//! \ingroup Validators
//! A class to validate a selection for Middle point constraints operation
class PartSet_SplitSelection : public ModuleBase_SelectionValidator {
public:
- PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection,
- ModuleBase_Operation *theOperation) const;
+ PARTSET_EXPORT bool
+ isValid(const ModuleBase_ISelection *theSelection,
+ ModuleBase_Operation *theOperation) const override;
};
//! \ingroup Validators
//! A class to validate a selection for Middle point constraints operation
class PartSet_ProjectionSelection : public ModuleBase_SelectionValidator {
public:
- PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection,
- ModuleBase_Operation *theOperation) const;
+ PARTSET_EXPORT bool
+ isValid(const ModuleBase_ISelection *theSelection,
+ ModuleBase_Operation *theOperation) const override;
};
//! \ingroup Validators
//! A class to validate a selection for intersection operation
class PartSet_IntersectionSelection : public ModuleBase_SelectionValidator {
public:
- PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection *theSelection,
- ModuleBase_Operation *theOperation) const;
+ PARTSET_EXPORT bool
+ isValid(const ModuleBase_ISelection *theSelection,
+ ModuleBase_Operation *theOperation) const override;
};
////////////// Attribute validators ////////////////
//! \param theAttribute an attribute
//! \param theArguments a list of arguments (names of attributes to check)
//! \param theError an output error string
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
private:
//! Returns error message for the error type
//! \param theAttribute an attribute
//! \param theArguments a list of arguments (names of attributes to check)
//! \param theError an output error string
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
private:
//! Finds Point2D attribute by reference attribute. It might be:
//! \param theAttribute the checked attribute
//! \param theArguments arguments of the attribute
//! \param theError an output error string
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
#endif
myValueIsCashed(false), myIsFeatureVisibleInCash(true), myXValueInCash(0),
myYValueInCash(0), myPointIndex(0), myFinished(false) {
myRefAttribute = theData->getProperty("reference_attribute");
- QVBoxLayout *aMainLayout = new QVBoxLayout(this);
+ auto *aMainLayout = new QVBoxLayout(this);
ModuleBase_Tools::zeroMargins(aMainLayout);
// the control should accept the focus, so the boolean flag is corrected to be
// B-spline weights attribute
myWeightsAttr = theData->getProperty("weights");
- QVBoxLayout *aLayout = new QVBoxLayout(myBox);
+ auto *aLayout = new QVBoxLayout(myBox);
ModuleBase_Tools::adjustMargins(aLayout);
myScrollArea = new QScrollArea(myBox);
myScrollArea->setFrameStyle(QFrame::NoFrame);
aLayout->addWidget(myScrollArea);
- QWidget *aContainer = new QWidget(myScrollArea);
- QVBoxLayout *aBoxLay = new QVBoxLayout(aContainer);
+ auto *aContainer = new QWidget(myScrollArea);
+ auto *aBoxLay = new QVBoxLayout(aContainer);
aBoxLay->setContentsMargins(0, 0, 0, 0);
myGroupBox = new QWidget(aContainer);
- QGridLayout *aGroupLay = new QGridLayout(myGroupBox);
+ auto *aGroupLay = new QGridLayout(myGroupBox);
ModuleBase_Tools::adjustMargins(aGroupLay);
aGroupLay->setSpacing(4);
aGroupLay->setColumnStretch(1, 1);
void PartSet_WidgetBSplinePoints::createNextPoint() {
storeCurentValue();
- QGridLayout *aGroupLay = dynamic_cast<QGridLayout *>(myGroupBox->layout());
+ auto *aGroupLay = dynamic_cast<QGridLayout *>(myGroupBox->layout());
int row = (int)myXSpin.size();
QString aPoleStr = translate("Pole %1");
aPoleStr = aPoleStr.arg(myXSpin.size() + 1);
- QGroupBox *aPoleGroupBox = new QGroupBox(aPoleStr, myGroupBox);
- QGridLayout *aPoleLay = new QGridLayout(aPoleGroupBox);
+ auto *aPoleGroupBox = new QGroupBox(aPoleStr, myGroupBox);
+ auto *aPoleLay = new QGridLayout(aPoleGroupBox);
ModuleBase_Tools::adjustMargins(aPoleLay);
aPoleLay->setSpacing(2);
aPoleLay->setColumnStretch(1, 1);
}
void PartSet_WidgetBSplinePoints::removeLastPoint() {
- QGridLayout *aGroupLay = dynamic_cast<QGridLayout *>(myGroupBox->layout());
+ auto *aGroupLay = dynamic_cast<QGridLayout *>(myGroupBox->layout());
QWidget *aXSpin = myXSpin.back();
QWidget *aYSpin = myYSpin.back();
QWidget *aBox = myXSpin.back()->parentWidget();
bool PartSet_WidgetBSplinePoints::isValidSelectionCustom(
const ModuleBase_ViewerPrsPtr &theValue) {
- PartSet_Module *aModule =
- dynamic_cast<PartSet_Module *>(myWorkshop->module());
+ auto *aModule = dynamic_cast<PartSet_Module *>(myWorkshop->module());
if (aModule->sketchReentranceMgr()->isInternalEditActive())
return true; // when internal edit is started a new feature is created. I
// has not results, AIS
GeomShapePtr aShape = theValue->shape();
if (aShape.get() && !aShape->isNull()) {
Handle(V3d_View) aView = myWorkshop->viewer()->activeView();
- const TopoDS_Shape &aTDShape = aShape->impl<TopoDS_Shape>();
+ const auto &aTDShape = aShape->impl<TopoDS_Shape>();
GeomPnt2dPtr aPnt = PartSet_Tools::getPnt2d(aView, aTDShape, mySketch);
if (aPnt) {
fillRefAttribute(aPnt, theValue);
static void fillLabels(std::vector<ModuleBase_LabelValue *> &theLabels,
const double theValue) {
- for (std::vector<ModuleBase_LabelValue *>::iterator anIt = theLabels.begin();
- anIt != theLabels.end(); ++anIt)
- (*anIt)->setValue(theValue);
+ for (auto &theLabel : theLabels)
+ theLabel->setValue(theValue);
}
bool PartSet_WidgetBSplinePoints::resetCustom() {
aPointArray->setSize(aSize);
aWeightsArray->setSize(aSize);
- std::vector<ModuleBase_LabelValue *>::const_iterator aXIt = myXSpin.begin();
- std::vector<ModuleBase_LabelValue *>::const_iterator aYIt = myYSpin.begin();
+ auto aXIt = myXSpin.begin();
+ auto aYIt = myYSpin.begin();
for (int anIndex = 0; aXIt != myXSpin.end() && aYIt != myYSpin.end();
++anIndex, ++aXIt, ++aYIt)
aPointArray->setPnt(anIndex, (*aXIt)->value(), (*aYIt)->value());
aData->attribute(attributeID()));
AttributeDoubleArrayPtr aWeightsArray = aData->realArray(myWeightsAttr);
- PartSet_WidgetBSplinePoints *that = (PartSet_WidgetBSplinePoints *)this;
+ auto *that = (PartSet_WidgetBSplinePoints *)this;
bool isBlocked = that->blockSignals(true);
bool isImmutable = aPointArray->setImmutable(true);
while ((int)myXSpin.size() < aPointArray->size())
createNextPoint();
- std::vector<ModuleBase_LabelValue *>::iterator aXIt = myXSpin.begin();
- std::vector<ModuleBase_LabelValue *>::iterator aYIt = myYSpin.begin();
+ auto aXIt = myXSpin.begin();
+ auto aYIt = myYSpin.begin();
for (int anIndex = 0; aXIt != myXSpin.end() && aYIt != myYSpin.end();
++anIndex, ++aXIt, ++aYIt) {
GeomPnt2dPtr aPoint = aPointArray->pnt(anIndex);
std::vector<double> &theValues) {
theValues.clear();
theValues.reserve(theLabels.size());
- for (std::vector<ModuleBase_LabelValue *>::const_iterator anIt =
- theLabels.begin();
- anIt != theLabels.end(); ++anIt)
- theValues.push_back((*anIt)->value());
+ for (auto theLabel : theLabels)
+ theValues.push_back(theLabel->value());
}
void PartSet_WidgetBSplinePoints::storeCurentValue() {
static void restoreArray(std::vector<double> &theCacheValues,
std::vector<ModuleBase_LabelValue *> &theLabels) {
- std::vector<double>::iterator aCIt = theCacheValues.begin();
- std::vector<ModuleBase_LabelValue *>::iterator anIt = theLabels.begin();
+ auto aCIt = theCacheValues.begin();
+ auto anIt = theLabels.begin();
for (; anIt != theLabels.end(); ++anIt) {
if (aCIt != theCacheValues.end())
(*anIt)->setValue(*aCIt++);
void PartSet_WidgetBSplinePoints::mouseMoved(ModuleBase_IViewWindow *theWindow,
QMouseEvent *theEvent) {
- PartSet_Module *aModule =
- dynamic_cast<PartSet_Module *>(myWorkshop->module());
+ auto *aModule = dynamic_cast<PartSet_Module *>(myWorkshop->module());
if (myFinished || isEditingMode() ||
aModule->sketchReentranceMgr()->isInternalEditActive())
ModuleBase_IWorkshop *theWorkshop,
const Config_WidgetAPI *theData);
/// Destructor
- virtual ~PartSet_WidgetBSplinePoints();
+ ~PartSet_WidgetBSplinePoints() override;
/// Fills given container with selection modes if the widget has it
/// \param [out] theModuleSelectionModes module additional modes, -1 means all
/// default modes \param theModes [out] a container of modes
- virtual void selectionModes(int &theModuleSelectionModes, QIntList &theModes);
+ void selectionModes(int &theModuleSelectionModes,
+ QIntList &theModes) override;
/// Checks if the selection presentation is valid in widget
/// \param theValue a selected presentation in the view
/// \return a boolean value
- virtual bool
- isValidSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs> &theValue);
+ bool isValidSelectionCustom(
+ const std::shared_ptr<ModuleBase_ViewerPrs> &theValue) override;
/// Checks all attribute validators returns valid. It tries on the given
/// selection to current attribute by setting the value inside and calling
/// Returns list of widget controls
/// \return a control list
- virtual QList<QWidget *> getControls() const;
+ QList<QWidget *> getControls() const override;
/// The methiod called when widget is deactivated
- virtual void deactivate();
+ void deactivate() override;
/// \returns the sketch instance
std::shared_ptr<ModelAPI_CompositeFeature> sketch() const { return mySketch; }
bool setPoint(double theX, double theY);
/// Returns true if the event is processed.
- virtual bool processEscape();
+ bool processEscape() override;
/// Returns true if the attribute can be changed using the selected shapes in
/// the viewer and creating a coincidence constraint to them. This control use
/// Processing the mouse move event in the viewer
/// \param theWindow a view window
/// \param theEvent a mouse event
- virtual void mouseMoved(ModuleBase_IViewWindow *theWindow,
- QMouseEvent *theEvent);
+ void mouseMoved(ModuleBase_IViewWindow *theWindow,
+ QMouseEvent *theEvent) override;
/// Processing the mouse release event in the viewer
/// \param theWindow a view window
/// \param theEvent a mouse event
- virtual void mouseReleased(ModuleBase_IViewWindow *theWindow,
- QMouseEvent *theEvent);
+ void mouseReleased(ModuleBase_IViewWindow *theWindow,
+ QMouseEvent *theEvent) override;
protected:
/// Saves the internal parameters to the given feature
/// \return True in success
- virtual bool storeValueCustom();
+ bool storeValueCustom() override;
/// Restore value from attribute data to the widget's control
- virtual bool restoreValueCustom();
+ bool restoreValueCustom() override;
/// Store current value in cashed value
void storeCurentValue();
/// Fills the widget with default values
/// \return true if the widget current value is reset
- virtual bool resetCustom();
+ bool resetCustom() override;
private:
/// Create labels for the next B-spline point
: ModuleBase_WidgetEditor(theParent, theData), myWorkshop(theWorkshop) {}
bool PartSet_WidgetEditor::focusTo() {
- PartSet_Module *aModule =
- dynamic_cast<PartSet_Module *>(myWorkshop->module());
+ auto *aModule = dynamic_cast<PartSet_Module *>(myWorkshop->module());
if (aModule->isMouseOverWindow() && !isEditingMode())
return ModuleBase_WidgetEditor::focusTo();
else {
PartSet_WidgetEditor(QWidget *theParent, ModuleBase_IWorkshop *theWorkshop,
const Config_WidgetAPI *theData);
- virtual ~PartSet_WidgetEditor() {}
+ ~PartSet_WidgetEditor() override = default;
/// Activates the editor control only in case if the mouse over the OCC
/// window, otherwise set focus to the usual double value control \return the
/// state whether the widget can accept the focus
- virtual bool focusTo();
+ bool focusTo() override;
private:
ModuleBase_IWorkshop *myWorkshop; // the current workshop
ModuleBase_IWorkshop *theWorkshop,
const Config_WidgetAPI *theData);
- virtual ~PartSet_WidgetFeaturePointSelector();
+ ~PartSet_WidgetFeaturePointSelector() override;
/// Checks all widget validator if the owner is valid. Firstly it checks
/// custom widget validating, next, the attribute's validating. It trying on
/// calling validators. After this, the previous attribute value is
/// restored.The valid/invalid value is cashed. \param theValue a selected
/// presentation in the view \return a boolean value
- virtual bool
- isValidSelection(const std::shared_ptr<ModuleBase_ViewerPrs> &theValue);
+ bool isValidSelection(
+ const std::shared_ptr<ModuleBase_ViewerPrs> &theValue) override;
/// Set sketcher
/// \param theSketch a sketcher object
CompositeFeaturePtr sketch() const { return mySketch; }
/// The methiod called when widget is deactivated
- virtual void deactivate();
+ void deactivate() override;
/// Processing the mouse move event in the viewer
/// \param theWindow a view window
/// \param theEvent a mouse event
- virtual void mouseMoved(ModuleBase_IViewWindow *theWindow,
- QMouseEvent *theEvent);
+ void mouseMoved(ModuleBase_IViewWindow *theWindow,
+ QMouseEvent *theEvent) override;
/// Processing the mouse release event in the viewer
/// \param theWindow a view window
/// \param theEvent a mouse event
- virtual void mouseReleased(ModuleBase_IViewWindow *theWindow,
- QMouseEvent *theEvent);
+ void mouseReleased(ModuleBase_IViewWindow *theWindow,
+ QMouseEvent *theEvent) override;
/// Fills the attribute with the value of the selected owner
/// \param thePrs a selected owner
- virtual bool setSelectionCustom(const ModuleBase_ViewerPrsPtr &thePrs);
+ bool setSelectionCustom(const ModuleBase_ViewerPrsPtr &thePrs) override;
/// Fill preselection used in mouseReleased
- virtual void setPreSelection(const ModuleBase_ViewerPrsPtr &thePreSelected,
- ModuleBase_IViewWindow *theWnd,
- QMouseEvent *theEvent);
+ void setPreSelection(const ModuleBase_ViewerPrsPtr &thePreSelected,
+ ModuleBase_IViewWindow *theWnd,
+ QMouseEvent *theEvent) override;
protected:
/// Return the attribute values wrapped in a list of viewer presentations
/// \return a list of viewer presentations, which contains an attribute result
/// and a shape. If the attribute do not uses the shape, it is empty
- virtual QList<std::shared_ptr<ModuleBase_ViewerPrs>>
- getAttributeSelection() const;
+ QList<std::shared_ptr<ModuleBase_ViewerPrs>>
+ getAttributeSelection() const override;
/// The methiod called when widget is activated
- virtual void activateCustom();
+ void activateCustom() override;
/// Return an object and geom shape by the viewer presentation
/// \param thePrs a selection
/// \param theObject an output object
/// \param theShape a shape of the selection
- virtual void
- getGeomSelection(const std::shared_ptr<ModuleBase_ViewerPrs> &thePrs,
- ObjectPtr &theObject, GeomShapePtr &theShape);
+ void getGeomSelection(const std::shared_ptr<ModuleBase_ViewerPrs> &thePrs,
+ ObjectPtr &theObject, GeomShapePtr &theShape) override;
/// Creates a backup of the current values of the attribute
/// It should be realized in the specific widget because of different
/// \param theAttribute an attribute
/// \param theValid a boolean flag, if restore happens for valid parameters
void restoreAttributeValue(const AttributePtr &theAttribute,
- const bool theValid);
+ const bool theValid) override;
protected:
bool fillFeature();
ModuleBase_IWorkshop *theWorkshop,
const Config_WidgetAPI *theData);
- virtual ~PartSet_WidgetFileSelector() {}
+ ~PartSet_WidgetFileSelector() override = default;
protected:
/// Reimplemented from ModuleBase_WidgetFileSelector::storeValueCustom()
- virtual bool storeValueCustom();
+ bool storeValueCustom() override;
/// Reimplemented from ModuleBase_WidgetFileSelector::restoreValue()
- virtual bool restoreValueCustom();
+ bool restoreValueCustom() override;
/// Returns a full format string for the short format
QString shortFormatToFullFormat(const QString &theShortFormat) const;
// there is no a sketch feature is selected, but the shape exists, try to
// create an exernal object
// TODO: unite with the same functionality in PartSet_WidgetShapeSelector
- if (aSPFeature.get() == NULL) {
+ if (aSPFeature.get() == nullptr) {
ObjectPtr anExternalObject = ObjectPtr();
GeomShapePtr anExternalShape = GeomShapePtr();
if (myExternalObjectMgr->useExternal()) {
if (aResult.get())
aShape = aResult->shape();
}
- if (aShape.get() != NULL && !aShape->isNull())
+ if (aShape.get() != nullptr && !aShape->isNull())
anExternalObject = myExternalObjectMgr->externalObject(
theObject, aShape, sketch(), myIsInValidate);
} else {
ModuleBase_IWorkshop *theWorkshop,
const Config_WidgetAPI *theData);
- virtual ~PartSet_WidgetMultiSelector();
+ ~PartSet_WidgetMultiSelector() override;
/// Defines if it is supposed that the widget should interact with the viewer.
- virtual bool isViewerSelector() { return true; }
+ bool isViewerSelector() override { return true; }
/// Set sketcher
/// \param theSketch a sketcher object
/// Checks the widget validity. By default, it returns true.
/// \param thePrs a selected presentation in the view
/// \return a boolean value
- virtual bool
- isValidSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs> &thePrs);
+ bool isValidSelectionCustom(
+ const std::shared_ptr<ModuleBase_ViewerPrs> &thePrs) override;
/// Creates a backup of the current values of the attribute
/// It should be realized in the specific widget because of different
/// parameters of the current attribute
/// \param theAttribute an attribute
/// \param theValid a boolean flag, if restore happens for valid parameters
- virtual void restoreAttributeValue(const AttributePtr &theAttribute,
- const bool theValid);
+ void restoreAttributeValue(const AttributePtr &theAttribute,
+ const bool theValid) override;
/// Return an object and geom shape by the viewer presentation
/// \param thePrs a selection
/// \param theObject an output object
/// \param theShape a shape of the selection
- virtual void
- getGeomSelection(const std::shared_ptr<ModuleBase_ViewerPrs> &thePrs,
- ObjectPtr &theObject, GeomShapePtr &theShape);
+ void getGeomSelection(const std::shared_ptr<ModuleBase_ViewerPrs> &thePrs,
+ ObjectPtr &theObject, GeomShapePtr &theShape) override;
protected:
/// Manager of external objects
}
bool PartSet_WidgetPoint2DFlyout::isValidSelectionCustom(
- const std::shared_ptr<ModuleBase_ViewerPrs> &theValue) {
+ const std::shared_ptr<ModuleBase_ViewerPrs> & /*theValue*/) {
return false;
}
}
XGUI_Workshop *PartSet_WidgetPoint2DFlyout::workshop() const {
- XGUI_ModuleConnector *aConnector =
- dynamic_cast<XGUI_ModuleConnector *>(myWorkshop);
+ auto *aConnector = dynamic_cast<XGUI_ModuleConnector *>(myWorkshop);
return aConnector->workshop();
}
ModuleBase_IWorkshop *theWorkshop,
const Config_WidgetAPI *theData);
/// Destructor
- virtual ~PartSet_WidgetPoint2DFlyout(){};
+ ~PartSet_WidgetPoint2DFlyout() override = default;
+ ;
/// Set the given wrapped value to the current widget
/// This value should be processed in the widget according to the needs
/// \param theValues the wrapped widget values
/// \param theToValidate a validation flag
- virtual bool
- setSelection(QList<std::shared_ptr<ModuleBase_ViewerPrs>> &theValues,
- const bool theToValidate);
+ bool setSelection(QList<std::shared_ptr<ModuleBase_ViewerPrs>> &theValues,
+ const bool theToValidate) override;
/// Checks if the selection presentation is valid in widget
/// \param theValue a selected presentation in the view
/// \return a boolean value
- virtual bool
- isValidSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs> &theValue);
+ bool isValidSelectionCustom(
+ const std::shared_ptr<ModuleBase_ViewerPrs> &theValue) override;
/// Activates the editor control only in case if the mouse over the OCC
/// window, otherwise set focus to the usual double value control \return the
/// state whether the widget can accept the focus
- virtual bool focusTo();
+ bool focusTo() override;
/// Returns true if the attribute can be changed using the selected shapes in
/// the viewer and creating a coincidence constraint to them. This control
/// does not use them.
- virtual bool useSelectedShapes() const;
+ bool useSelectedShapes() const override;
private:
//! Returns workshop
#endif
theData->getBooleanAttribute(DOUBLE_WDG_ACCEPT_EXPRESSIONS, true);
- QGridLayout *aGroupLay = new QGridLayout(myGroupBox);
+ auto *aGroupLay = new QGridLayout(myGroupBox);
ModuleBase_Tools::adjustMargins(aGroupLay);
aGroupLay->setSpacing(2);
aGroupLay->setColumnStretch(1, 1);
myYSpin = new ModuleBase_LabelValue(myGroupBox, tr("Y"));
aGroupLay->addWidget(myYSpin, 1, 1);
- QVBoxLayout *aLayout = new QVBoxLayout(this);
+ auto *aLayout = new QVBoxLayout(this);
ModuleBase_Tools::zeroMargins(aLayout);
aLayout->addWidget(myGroupBox);
setLayout(aLayout);
bool PartSet_WidgetPoint2D::isValidSelectionCustom(
const ModuleBase_ViewerPrsPtr &theValue) {
- PartSet_Module *aModule =
- dynamic_cast<PartSet_Module *>(myWorkshop->module());
+ auto *aModule = dynamic_cast<PartSet_Module *>(myWorkshop->module());
if (aModule->sketchReentranceMgr()->isInternalEditActive())
return true; /// when internal edit is started a new feature is created. I
/// has not results, AIS
aFoundPoint = shapeExploreHasVertex(anAISShape, aPoint, mySketch);
/// analysis of results
- std::list<std::shared_ptr<ModelAPI_Result>>::const_iterator aRIter =
- aResults.cbegin();
+ auto aRIter = aResults.cbegin();
for (; aRIter != aResults.cend() && !aFoundPoint; aRIter++) {
ResultPtr aResult = *aRIter;
if (aResult.get() && aResult->shape().get()) {
GeomShapePtr aShape = theValue->shape();
if (aShape.get() && !aShape->isNull()) {
Handle(V3d_View) aView = myWorkshop->viewer()->activeView();
- const TopoDS_Shape &aTDShape = aShape->impl<TopoDS_Shape>();
+ const auto &aTDShape = aShape->impl<TopoDS_Shape>();
GeomPnt2dPtr aPnt = PartSet_Tools::getPnt2d(aView, aTDShape, mySketch);
if (aPnt) {
fillRefAttribute(aPnt->x(), aPnt->y(), theValue);
GeomShapePtr aShape = aValue->shape();
if (aShape.get() && !aShape->isNull()) {
Handle(V3d_View) aView = myWorkshop->viewer()->activeView();
- const TopoDS_Shape &aTDShape = aShape->impl<TopoDS_Shape>();
+ const auto &aTDShape = aShape->impl<TopoDS_Shape>();
GeomPnt2dPtr aPnt = PartSet_Tools::getPnt2d(aView, aTDShape, mySketch);
if (aPnt) {
AttributePoint2DPtr aPoint = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aData->attribute(attributeID()));
- PartSet_WidgetPoint2D *that = (PartSet_WidgetPoint2D *)this;
+ auto *that = (PartSet_WidgetPoint2D *)this;
bool isBlocked = that->blockSignals(true);
bool isImmutable = aPoint->setImmutable(true);
if (aFirstValue.get()) {
GeomShapePtr aShape = aFirstValue->shape();
if (aShape.get() && aShape->shapeType() == GeomAPI_Shape::VERTEX) {
- const TopoDS_Shape &aTDShape = aShape->impl<TopoDS_Shape>();
+ const auto &aTDShape = aShape->impl<TopoDS_Shape>();
GeomPnt2dPtr aPnt = PartSet_Tools::getPnt2d(aView, aTDShape, mySketch);
aX = aPnt->x();
aY = aPnt->y();
FeaturePtr aSelectedFeature = ModelAPI_Feature::feature(aObject);
bool anExternal = false;
std::shared_ptr<SketchPlugin_Feature> aSPFeature;
- if (aSelectedFeature.get() != NULL)
+ if (aSelectedFeature.get() != nullptr)
aSPFeature =
std::dynamic_pointer_cast<SketchPlugin_Feature>(aSelectedFeature);
void PartSet_WidgetPoint2D::mouseMoved(ModuleBase_IViewWindow *theWindow,
QMouseEvent *theEvent) {
- PartSet_Module *aModule =
- dynamic_cast<PartSet_Module *>(myWorkshop->module());
+ auto *aModule = dynamic_cast<PartSet_Module *>(myWorkshop->module());
if (isEditingMode() || aModule->sketchReentranceMgr()->isInternalEditActive())
return;
double PartSet_WidgetPoint2D::y() const { return myYSpin->value(); }
-bool PartSet_WidgetPoint2D::isFeatureContainsPoint(const FeaturePtr &theFeature,
- double theX, double theY) {
+bool PartSet_WidgetPoint2D::isFeatureContainsPoint(
+ const FeaturePtr & /*theFeature*/, double theX, double theY) {
bool aPointIsFound = false;
if (feature()->getKind() != SketchPlugin_Line::ID())
std::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(theX, theY));
std::list<AttributePtr> anAttributes =
myFeature->data()->attributes(GeomDataAPI_Point2D::typeId());
- std::list<AttributePtr>::iterator anIter = anAttributes.begin();
+ auto anIter = anAttributes.begin();
for (; anIter != anAttributes.end() && !aPointIsFound; anIter++) {
AttributePoint2DPtr aPoint2DAttribute =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(*anIter);
bool PartSet_WidgetPoint2D::useSelectedShapes() const { return true; }
-bool PartSet_WidgetPoint2D::isOrphanPoint(const FeaturePtr &theFeature,
- const CompositeFeaturePtr &theSketch,
- double theX, double theY) {
+bool PartSet_WidgetPoint2D::isOrphanPoint(
+ const FeaturePtr &theFeature, const CompositeFeaturePtr & /*theSketch*/,
+ double theX, double theY) {
bool anOrphanPoint = false;
if (theFeature.get()) {
AttributePoint2DPtr aPointAttr;
PartSet_WidgetPoint2D(QWidget *theParent, ModuleBase_IWorkshop *theWorkshop,
const Config_WidgetAPI *theData);
/// Destructor
- virtual ~PartSet_WidgetPoint2D();
+ ~PartSet_WidgetPoint2D() override;
/// Fills given container with selection modes if the widget has it
/// \param [out] theModuleSelectionModes module additional modes, -1 means all
/// default modes \param theModes [out] a container of modes
- virtual void selectionModes(int &theModuleSelectionModes, QIntList &theModes);
+ void selectionModes(int &theModuleSelectionModes,
+ QIntList &theModes) override;
/// Checks if the selection presentation is valid in widget
/// \param theValue a selected presentation in the view
/// \return a boolean value
- virtual bool
- isValidSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs> &theValue);
+ bool isValidSelectionCustom(
+ const std::shared_ptr<ModuleBase_ViewerPrs> &theValue) override;
/// Checks all attribute validators returns valid. It tries on the given
/// selection to current attribute by setting the value inside and calling
/// This value should be processed in the widget according to the needs
/// \param theValues the wrapped widget values
/// \param theToValidate a validation flag
- virtual bool
- setSelection(QList<std::shared_ptr<ModuleBase_ViewerPrs>> &theValues,
- const bool theToValidate);
+ bool setSelection(QList<std::shared_ptr<ModuleBase_ViewerPrs>> &theValues,
+ const bool theToValidate) override;
/// Select the internal content if it can be selected. It is empty in the
/// default realization
/// Returns list of widget controls
/// \return a control list
- virtual QList<QWidget *> getControls() const;
+ QList<QWidget *> getControls() const override;
// bool initFromPrevious(ObjectPtr theObject);
/// The methiod called when widget is deactivated
- virtual void deactivate();
+ void deactivate() override;
/// \returns the sketch instance
CompositeFeaturePtr sketch() const { return mySketch; }
double y() const;
/// Returns true if the event is processed.
- virtual bool processEnter();
+ bool processEnter() override;
/// Returns true if the attribute can be changed using the selected shapes in
/// the viewer and creating a coincidence constraint to them. This control use
/// Processing the mouse move event in the viewer
/// \param theWindow a view window
/// \param theEvent a mouse event
- virtual void mouseMoved(ModuleBase_IViewWindow *theWindow,
- QMouseEvent *theEvent);
+ void mouseMoved(ModuleBase_IViewWindow *theWindow,
+ QMouseEvent *theEvent) override;
/// Processing the mouse release event in the viewer
/// \param theWindow a view window
/// \param theEvent a mouse event
- virtual void mouseReleased(ModuleBase_IViewWindow *theWindow,
- QMouseEvent *theEvent);
+ void mouseReleased(ModuleBase_IViewWindow *theWindow,
+ QMouseEvent *theEvent) override;
/// Fill preselection used in mouseReleased
// virtual void setPreSelection(const std::shared_ptr<ModuleBase_ViewerPrs>&
// thePreSelected);
- virtual void
+ void
setPreSelection(const std::shared_ptr<ModuleBase_ViewerPrs> &thePreSelected,
- ModuleBase_IViewWindow *theWnd, QMouseEvent *theEvent);
+ ModuleBase_IViewWindow *theWnd,
+ QMouseEvent *theEvent) override;
/// Return an object and geom shape by the viewer presentation
/// \param thePrs a selection
protected:
/// Saves the internal parameters to the given feature
/// \return True in success
- virtual bool storeValueCustom();
+ bool storeValueCustom() override;
/// Restore value from attribute data to the widget's control
- virtual bool restoreValueCustom();
+ bool restoreValueCustom() override;
/// Store current value in cashed value
void storeCurentValue();
/// Fills the widget with default values
/// \return true if the widget current value is reset
- virtual bool resetCustom();
+ bool resetCustom() override;
/// The methiod called when widget is activated
- virtual void activateCustom();
+ void activateCustom() override;
//! Switch On/Off highlighting of the widget
- virtual void setHighlighted(bool isHighlighted);
+ void setHighlighted(bool isHighlighted) override;
/// Returns true if the feature contains Point2D attribute with the same
/// coordinates The attribute of the widget is not processed. \param
/// incorrect visualization in Sketch. E.g. by a line creation, the line
/// should not be visualized immediatelly when the end point widget is
/// activated.
- virtual void initializeValueByActivate();
+ void initializeValueByActivate() override;
private:
/// Creates constrains of the clicked point
ModuleBase_IWorkshop *theWorkshop,
const Config_WidgetAPI *theData);
- virtual ~PartSet_WidgetShapeSelector();
+ ~PartSet_WidgetShapeSelector() override;
/// Set sketcher
/// \param theSketch a sketcher object
/// Appends into container of workshop selection filters
/// \param [out] theModuleSelectionFilters module additional modes, -1 means
/// all default modes \param [out] theSelectionFilters selection filters
- virtual void selectionFilters(QIntList &theModuleSelectionFilters,
- SelectMgr_ListOfFilter &theSelectionFilters);
+ void selectionFilters(QIntList &theModuleSelectionFilters,
+ SelectMgr_ListOfFilter &theSelectionFilters) override;
protected:
/// Checks the widget validity. By default, it returns true.
/// \param thePrs a selected presentation in the view
/// \return a boolean value
- virtual bool
- isValidSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs> &thePrs);
+ bool isValidSelectionCustom(
+ const std::shared_ptr<ModuleBase_ViewerPrs> &thePrs) override;
/// Return an object and geom shape by the viewer presentation
/// \param thePrs a selection
/// \param theObject an output object
/// \param theShape a shape of the selection
- virtual void
- getGeomSelection(const std::shared_ptr<ModuleBase_ViewerPrs> &thePrs,
- ObjectPtr &theObject, GeomShapePtr &theShape);
+ void getGeomSelection(const std::shared_ptr<ModuleBase_ViewerPrs> &thePrs,
+ ObjectPtr &theObject, GeomShapePtr &theShape) override;
/// Creates a backup of the current values of the attribute
/// It should be realized in the specific widget because of different
/// \param theAttribute an attribute
/// \param theValid a boolean flag, if restore happens for valid parameters
void restoreAttributeValue(const AttributePtr &theAttribute,
- const bool theValid);
+ const bool theValid) override;
protected:
/// A reference to external objects manager
myAttributeListID = theData->getProperty("attribute_list_id");
// QFormLayout* aLayout = new QFormLayout(this);
- QVBoxLayout *aLayout = new QVBoxLayout(this);
+ auto *aLayout = new QVBoxLayout(this);
ModuleBase_Tools::zeroMargins(aLayout);
ModuleBase_Tools::adjustMargins(aLayout);
// Size of the View control
mySizeOfViewWidget = new QWidget(this);
- QHBoxLayout *aSizeLayout = new QHBoxLayout(mySizeOfViewWidget);
+ auto *aSizeLayout = new QHBoxLayout(mySizeOfViewWidget);
aSizeLayout->addWidget(
new QLabel(tr("Size of the view"), mySizeOfViewWidget));
mySizeOfView = new QLineEdit(mySizeOfViewWidget);
- QDoubleValidator *aValidator =
- new QDoubleValidator(0, DBL_MAX, 12, mySizeOfView);
+ auto *aValidator = new QDoubleValidator(0, DBL_MAX, 12, mySizeOfView);
aValidator->setLocale(ModuleBase_Tools::doubleLocale());
aValidator->setNotation(QDoubleValidator::StandardNotation);
mySizeOfView->setValidator(aValidator);
if (isEditing) {
setVisibleSelectionControl(false);
- ModuleBase_ModelWidget *anAttributeListWidget = 0;
+ ModuleBase_ModelWidget *anAttributeListWidget = nullptr;
XGUI_Workshop *aWorkshop = XGUI_Tools::workshop(myModule->workshop());
XGUI_PropertyPanel *aPanel = aWorkshop->propertyPanel();
const QList<ModuleBase_ModelWidget *> &aWidgets = aPanel->modelWidgets();
XGUI_Tools::workshop(myWorkshop)->viewer()->update();
}
-void PartSet_WidgetSketchCreator::onResumed(ModuleBase_Operation *theOp) {
+void PartSet_WidgetSketchCreator::onResumed(ModuleBase_Operation * /*theOp*/) {
SessionPtr aMgr = ModelAPI_Session::get();
bool aIsOp = aMgr->isOperation();
if (aIsOp) {
XGUI_PropertyPanel *aPropertyPanel = aWorkshop->propertyPanel();
const QList<ModuleBase_ModelWidget *> &aWidgets =
aPropertyPanel->modelWidgets();
- ModuleBase_ModelWidget *aListWidget = 0;
+ ModuleBase_ModelWidget *aListWidget = nullptr;
foreach (ModuleBase_ModelWidget *aWidget, aWidgets) {
if (aWidget->attributeID() == myAttributeListID) {
aListWidget = aWidget;
PartSet_WidgetSketchCreator(QWidget *theParent, PartSet_Module *theModule,
const Config_WidgetAPI *theData);
- virtual ~PartSet_WidgetSketchCreator();
+ ~PartSet_WidgetSketchCreator() override;
/// Returns list of widget controls
/// \return a control list
- virtual QList<QWidget *> getControls() const;
+ QList<QWidget *> getControls() const override;
/// Set focus to the first control of the current widget.
/// The focus policy of the control is checked.
/// If the widget has the NonFocus focus policy, it is skipped.
/// \return the state whether the widget can accept the focus
- virtual bool focusTo();
+ bool focusTo() override;
/// The methiod called when widget is deactivated
- virtual void deactivate();
+ void deactivate() override;
/// Set the given wrapped value to the current widget
/// This value should be processed in the widget according to the needs
/// \param theValues the wrapped selection values
/// \param theToValidate a validation of the values flag
- virtual bool
- setSelection(QList<std::shared_ptr<ModuleBase_ViewerPrs>> &theValues,
- const bool theToValidate);
+ bool setSelection(QList<std::shared_ptr<ModuleBase_ViewerPrs>> &theValues,
+ const bool theToValidate) override;
/// Editing mode depends on mode of current operation. This value is defined
/// by it.
- virtual void setEditingMode(bool isEditing);
+ void setEditingMode(bool isEditing) override;
/// Checks all widget validator if the owner is valid. Firstly it checks
/// custom widget validating, next, the attribute's validating. It trying on
/// restored.The valid/invalid value is cashed.
/// \param theValue a selected presentation in the view
/// \return a boolean value
- virtual bool
- isValidSelection(const std::shared_ptr<ModuleBase_ViewerPrs> &theValue);
+ bool isValidSelection(
+ const std::shared_ptr<ModuleBase_ViewerPrs> &theValue) override;
/// Returns True in case if the widget contains useful information for
/// inspection tool
- virtual bool isInformative() const { return false; }
+ bool isInformative() const override { return false; }
protected:
/// If there is no operation in current session, start operation for modify
/// Checks whether the selection presentation contains preview planes
/// \param theValue a selection information
/// \return a boolean value
- virtual bool
- isValidSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs> &theValue);
+ bool isValidSelectionCustom(
+ const std::shared_ptr<ModuleBase_ViewerPrs> &theValue) override;
/// Saves the internal parameters to the given feature
/// \return True in success
- virtual bool storeValueCustom();
+ bool storeValueCustom() override;
- virtual bool restoreValueCustom();
+ bool restoreValueCustom() override;
/// Retunrs attribute, which should be validated. In default implementation,
/// this is an attribute of ID
/// \return an attribute
- virtual AttributePtr attribute() const;
+ AttributePtr attribute() const override;
/// Sets the selection control visible and set the current widget as active in
/// property panel It leads to connect to onSelectionChanged slot
/// Retunrs a list of possible shape types
/// \return a list of shapes
- virtual QIntList shapeTypes() const;
+ QIntList shapeTypes() const override;
/// Emits model changed info, updates the current control by selection change
/// \param theDone a state whether the selection is set
- void updateOnSelectionChanged(const bool theDone);
+ void updateOnSelectionChanged(const bool theDone) override;
protected:
/// Returns true if envent is processed.
- virtual bool processSelection();
+ bool processSelection() override;
private:
/// Returns true if the selection mode is active. This is when composition
const QMap<PartSet_Tools::ConstraintVisibleState, bool> &toShowConstraints)
: ModuleBase_WidgetValidated(theParent, theWorkshop, theData),
myOpenTransaction(false), myIsSelection(false) {
- QVBoxLayout *aLayout = new QVBoxLayout(this);
+ auto *aLayout = new QVBoxLayout(this);
ModuleBase_Tools::zeroMargins(aLayout);
myStackWidget = new QStackedWidget(this);
aLayout->addWidget(myStackWidget);
// Define label for plane selection
- QWidget *aFirstWgt = new QWidget(this);
+ auto *aFirstWgt = new QWidget(this);
// Size of the View control
mySizeOfViewWidget = new QWidget(aFirstWgt);
- QHBoxLayout *aSizeLayout = new QHBoxLayout(mySizeOfViewWidget);
+ auto *aSizeLayout = new QHBoxLayout(mySizeOfViewWidget);
aSizeLayout->addWidget(
new QLabel(tr("Size of the view"), mySizeOfViewWidget));
mySizeOfView = new QLineEdit(mySizeOfViewWidget);
- QDoubleValidator *aValidator =
- new QDoubleValidator(0, DBL_MAX, 12, mySizeOfView);
+ auto *aValidator = new QDoubleValidator(0, DBL_MAX, 12, mySizeOfView);
aValidator->setLocale(ModuleBase_Tools::doubleLocale());
aValidator->setNotation(QDoubleValidator::StandardNotation);
mySizeOfView->setValidator(aValidator);
myPartSetMessage = new QDialog(this, Qt::ToolTip);
myPartSetMessage->setModal(false);
myPartSetMessage->setStyleSheet("background-color:lightyellow;");
- QVBoxLayout *aMsgLay = new QVBoxLayout(myPartSetMessage);
+ auto *aMsgLay = new QVBoxLayout(myPartSetMessage);
QString aMsg = tr("The Sketch is created in PartSet.\n"
"It will be necessary to create a Part in order to use "
"this sketch for body creation");
mySizeMessage->hide();
QString aText = translate(theData->getProperty("title"));
- QLabel *aLabel = new QLabel(aText, aFirstWgt);
+ auto *aLabel = new QLabel(aText, aFirstWgt);
aLabel->setWordWrap(true);
QString aTooltip = translate(theData->getProperty("tooltip"));
aLabel->setToolTip(aTooltip);
myStackWidget->addWidget(aFirstWgt);
// Define widget for sketch manmagement
- QWidget *aSecondWgt = new QWidget(this);
+ auto *aSecondWgt = new QWidget(this);
aLayout = new QVBoxLayout(aSecondWgt);
ModuleBase_Tools::zeroMargins(aLayout);
- QGroupBox *aViewBox = new QGroupBox(tr("Sketcher plane"), this);
- QGridLayout *aViewLayout = new QGridLayout(aViewBox);
+ auto *aViewBox = new QGroupBox(tr("Sketcher plane"), this);
+ auto *aViewLayout = new QGridLayout(aViewBox);
myViewInverted = new QCheckBox(tr("Reversed"), aViewBox);
aViewLayout->addWidget(myViewInverted, 0, 0);
// Sketch plane visibility
myViewVisible = new QCheckBox(tr("Visible"), aViewBox);
- PartSet_Module *aModule =
- dynamic_cast<PartSet_Module *>(myWorkshop->module());
+ auto *aModule = dynamic_cast<PartSet_Module *>(myWorkshop->module());
PartSet_PreviewSketchPlane *aPreviewPlane =
aModule->sketchMgr()->previewSketchPlane();
if (aPreviewPlane->isPlaneCreated())
connect(myViewVisible, SIGNAL(toggled(bool)), this,
SLOT(onShowViewPlane(bool)));
- QPushButton *aSetViewBtn = new QPushButton(QIcon(":icons/plane_view.png"),
- tr("Set plane view"), aViewBox);
+ auto *aSetViewBtn = new QPushButton(QIcon(":icons/plane_view.png"),
+ tr("Set plane view"), aViewBox);
connect(aSetViewBtn, SIGNAL(clicked(bool)), this, SLOT(onSetPlaneView()));
aViewLayout->addWidget(aSetViewBtn, 1, 0, 1, 2);
anIt = aStates.begin(),
aLast = aStates.end();
for (; anIt != aLast; anIt++) {
- QCheckBox *aShowConstraints = new QCheckBox(anIt.value(), this);
+ auto *aShowConstraints = new QCheckBox(anIt.value(), this);
connect(aShowConstraints, SIGNAL(toggled(bool)), this,
SLOT(onShowConstraint(bool)));
aLayout->addWidget(aShowConstraints);
SIGNAL(autoConstraints(bool)));
aLayout->addWidget(myAutoConstraints);
- QPushButton *aPlaneBtn =
- new QPushButton(tr("Change sketch plane"), aSecondWgt);
+ auto *aPlaneBtn = new QPushButton(tr("Change sketch plane"), aSecondWgt);
connect(aPlaneBtn, SIGNAL(clicked(bool)), SLOT(onChangePlane()));
aLayout->addWidget(aPlaneBtn);
myPreviewPlanes = new PartSet_PreviewPlanes();
}
-PartSet_WidgetSketchLabel::~PartSet_WidgetSketchLabel() {}
+PartSet_WidgetSketchLabel::~PartSet_WidgetSketchLabel() = default;
bool PartSet_WidgetSketchLabel::setSelection(
QList<ModuleBase_ViewerPrsPtr> &theValues, const bool theToValidate) {
}
void PartSet_WidgetSketchLabel::onShowConstraint(bool theOn) {
- QCheckBox *aSenderCheckBox = qobject_cast<QCheckBox *>(sender());
+ auto *aSenderCheckBox = qobject_cast<QCheckBox *>(sender());
QMap<PartSet_Tools::ConstraintVisibleState, QCheckBox *>::const_iterator
anIt = myShowConstraints.begin(),
// In order to make reselection possible, set empty object and shape should
// be done
setSelectionCustom(ModuleBase_ViewerPrsPtr(
- new ModuleBase_ViewerPrs(ObjectPtr(), GeomShapePtr(), NULL)));
+ new ModuleBase_ViewerPrs(ObjectPtr(), GeomShapePtr(), nullptr)));
aDone = false;
} else {
// it removes the processed value from the parameters list
}
void PartSet_WidgetSketchLabel::updateByPlaneSelected(
- const ModuleBase_ViewerPrsPtr &thePrs) {
+ const ModuleBase_ViewerPrsPtr & /*thePrs*/) {
// Nullify a temporary remembered plane
if (myTmpPlane.get())
myTmpPlane.reset();
isSetSizeOfView = false;
}
}
- PartSet_Module *aModule =
- dynamic_cast<PartSet_Module *>(myWorkshop->module());
+ auto *aModule = dynamic_cast<PartSet_Module *>(myWorkshop->module());
if (aModule) {
CompositeFeaturePtr aSketch =
std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(myFeature);
std::shared_ptr<GeomAPI_Dir> aDir;
if (aShape.get() && !aShape->isNull()) {
- const TopoDS_Shape &aTDShape = aShape->impl<TopoDS_Shape>();
+ const auto &aTDShape = aShape->impl<TopoDS_Shape>();
aDir = setSketchPlane(aTDShape);
isOwnerSet = aDir.get();
}
aShapePtr = aShape;
}
if (aShapePtr.get() && aShapePtr->isFace()) {
- const TopoDS_Shape &aTDShape = aShapePtr->impl<TopoDS_Shape>();
+ const auto &aTDShape = aShapePtr->impl<TopoDS_Shape>();
setSketchPlane(aTDShape);
aSelAttr->setValue(aRes, aShapePtr);
isOwnerSet = true;
aSelShape = aSelAttr->contextFeature()->firstResult()->shape();
}
if (aSelShape.get() && aSelShape->isPlanar()) {
- const TopoDS_Shape &aTDShape = aSelShape->impl<TopoDS_Shape>();
+ const auto &aTDShape = aSelShape->impl<TopoDS_Shape>();
setSketchPlane(aTDShape);
isOwnerSet = true;
}
if (aTopWidget)
aTopWidget->installEventFilter(this);
- PartSet_Module *aModule =
- dynamic_cast<PartSet_Module *>(myWorkshop->module());
+ auto *aModule = dynamic_cast<PartSet_Module *>(myWorkshop->module());
if (aModule) {
bool isBlocked = myAutoConstraints->blockSignals(true);
myAutoConstraints->setChecked(
if (myViewInverted->isChecked())
aDir.Reverse();
myWorkshop->viewer()->setViewProjection(aDir.X(), aDir.Y(), aDir.Z(), 0.);
- PartSet_Module *aModule =
- dynamic_cast<PartSet_Module *>(myWorkshop->module());
+ auto *aModule = dynamic_cast<PartSet_Module *>(myWorkshop->module());
if (aModule)
aModule->onViewTransformed();
}
//******************************************************
void PartSet_WidgetSketchLabel::onChangePlane() {
- PartSet_Module *aModule =
- dynamic_cast<PartSet_Module *>(myWorkshop->module());
+ auto *aModule = dynamic_cast<PartSet_Module *>(myWorkshop->module());
if (aModule) {
mySizeOfViewWidget->setVisible(false);
myRemoveExternal->setVisible(true);
}
void PartSet_WidgetSketchLabel::onShowViewPlane(bool toShow) {
- PartSet_Module *aModule =
- dynamic_cast<PartSet_Module *>(myWorkshop->module());
+ auto *aModule = dynamic_cast<PartSet_Module *>(myWorkshop->module());
PartSet_PreviewSketchPlane *aPreviewPlane =
aModule->sketchMgr()->previewSketchPlane();
if (toShow) {
const QMap<PartSet_Tools::ConstraintVisibleState,
bool> &toShowConstraints);
- virtual ~PartSet_WidgetSketchLabel();
+ ~PartSet_WidgetSketchLabel() override;
/// Set the given wrapped value to the current widget
/// This value should be processed in the widget according to the needs
/// preselection. It is redefined to do nothing if the plane of the sketch has
/// been already set. \param theValues the wrapped selection values \param
/// theToValidate a validation flag
- virtual bool
- setSelection(QList<std::shared_ptr<ModuleBase_ViewerPrs>> &theValues,
- const bool theToValidate);
+ bool setSelection(QList<std::shared_ptr<ModuleBase_ViewerPrs>> &theValues,
+ const bool theToValidate) override;
/// Fills given container with selection modes if the widget has it
/// \param [out] theModuleSelectionModes module additional modes, -1 means all
/// default modes \param theModes [out] a container of modes
- virtual void selectionModes(int &theModuleSelectionModes, QIntList &theModes);
+ void selectionModes(int &theModuleSelectionModes,
+ QIntList &theModes) override;
/// Using widget selection filter only if plane is not defined.
/// \param [out] theModuleSelectionFilters module additional modes, -1 means
/// all default modes \param [out] selection filters
- virtual void selectionFilters(QIntList &theModuleSelectionFilters,
- SelectMgr_ListOfFilter &theSelectionFilters);
+ void selectionFilters(QIntList &theModuleSelectionFilters,
+ SelectMgr_ListOfFilter &theSelectionFilters) override;
/// Returns list of widget controls
/// \return a control list
- virtual QList<QWidget *> getControls() const;
+ QList<QWidget *> getControls() const override;
/// The methiod called when widget is deactivated
- virtual void deactivate();
+ void deactivate() override;
/// The method called if widget should be activated always
- virtual bool needToBeActivated() { return true; }
+ bool needToBeActivated() override { return true; }
/// Returns sketcher plane
std::shared_ptr<GeomAPI_Pln> plane() const;
/// This control accepts focus
- virtual bool focusTo();
- virtual void setHighlighted(bool){/*do nothing*/};
- virtual void enableFocusProcessing();
+ bool focusTo() override;
+ void setHighlighted(bool) override{/*do nothing*/};
+ void enableFocusProcessing() override;
/// Set current state of show free points
/// \param theState a state of the corresponded check box
/// If widgets has several panels then this method has to show a page which
/// contains information for current feature. By default does nothing
- virtual void showInformativePage() {
+ void showInformativePage() override {
if (myStackWidget)
myStackWidget->setCurrentIndex(1);
}
/// It should be realized in the specific widget because of different
/// parameters of the current attribute
/// \param theAttribute an attribute to be stored
- virtual void storeAttributeValue(const AttributePtr &theAttribute);
+ void storeAttributeValue(const AttributePtr &theAttribute) override;
/// Creates a backup of the current values of the attribute
/// It should be realized in the specific widget because of different
/// parameters of the current attribute
/// \param theAttribute an attribute to be restored
/// \param theValid a boolean flag, if restore happens for valid parameters
- virtual void restoreAttributeValue(const AttributePtr &theAttribute,
- const bool theValid);
+ void restoreAttributeValue(const AttributePtr &theAttribute,
+ const bool theValid) override;
/// Fills the attribute with the value of the selected owner
/// \param thePrs a selected owner
- virtual bool setSelectionCustom(const ModuleBase_ViewerPrsPtr &thePrs);
+ bool setSelectionCustom(const ModuleBase_ViewerPrsPtr &thePrs) override;
/// Saves the internal parameters to the given feature
/// \return True in success
- virtual bool storeValueCustom() { return true; }
+ bool storeValueCustom() override { return true; }
- virtual bool restoreValueCustom();
+ bool restoreValueCustom() override;
/// The methiod called when widget is activated
- virtual void activateCustom();
+ void activateCustom() override;
/// Block the model flush of update and intialization of attribute
/// In additional to curstom realization it blocks initialization for all
/// isAttributeSetInitializedBlocked out value if model is blocked in value if
/// model is unblocked to be used to restore previous state when unblocked
/// \param isAttributeSendUpdatedBlocked out value if model signal is blocked
- virtual void blockAttribute(const AttributePtr &theAttribute,
- const bool &theToBlock, bool &isFlushesActived,
- bool &isAttributeSetInitializedBlocked,
- bool &isAttributeSendUpdatedBlocked);
+ void blockAttribute(const AttributePtr &theAttribute, const bool &theToBlock,
+ bool &isFlushesActived,
+ bool &isAttributeSetInitializedBlocked,
+ bool &isAttributeSendUpdatedBlocked) override;
/// Returns true if envent is processed.
- virtual bool processSelection();
+ bool processSelection() override;
/// Set the given wrapped value to the current widget
/// This value should be processed in the widget according to the needs
bool fillSketchPlaneBySelection(const ModuleBase_ViewerPrsPtr &thePrs);
/// Redefinition of a virtual function
- virtual void showEvent(QShowEvent *theEvent);
+ void showEvent(QShowEvent *theEvent) override;
/// Redefinition of a virtual function
- virtual void hideEvent(QHideEvent *theEvent);
+ void hideEvent(QHideEvent *theEvent) override;
/// Redefinition of a virtual function
- virtual bool eventFilter(QObject *theObj, QEvent *theEvent);
+ bool eventFilter(QObject *theObj, QEvent *theEvent) override;
private slots:
/// A slot called on set sketch plane view
initialize();
}
-PartSetAPI_Part::~PartSetAPI_Part() {}
+PartSetAPI_Part::~PartSetAPI_Part() = default;
//--------------------------------------------------------------------------------------
std::shared_ptr<ModelAPI_Document> PartSetAPI_Part::document() const {
explicit PartSetAPI_Part(const std::shared_ptr<ModelAPI_Feature> &theFeature);
/// Destructor
PARTSETAPI_EXPORT
- virtual ~PartSetAPI_Part();
+ ~PartSetAPI_Part() override;
INTERFACE_0(PartSetPlugin_Part::ID())
/// Dump wrapped feature
PARTSETAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
//! Pointer on Part object
}
// LCOV_EXCL_START
/// Returns the kind of a feature
- PARTSETPLUGIN_EXPORT virtual const std::string &getKind() {
+ PARTSETPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = PartSetPlugin_Duplicate::ID();
return MY_KIND;
}
/// Request for initialization of data model of the feature: adding all
/// attributes
- PARTSETPLUGIN_EXPORT virtual void initAttributes() {}
+ PARTSETPLUGIN_EXPORT void initAttributes() override {}
/// Not normal feature that stored in the tree
- PARTSETPLUGIN_EXPORT virtual bool isAction() { return true; }
+ PARTSETPLUGIN_EXPORT bool isAction() override { return true; }
/// Performs the "duplicate"
- PARTSETPLUGIN_EXPORT virtual void execute();
+ PARTSETPLUGIN_EXPORT void execute() override;
/// Use plugin manager for features creation
- PartSetPlugin_Duplicate() {}
+ PartSetPlugin_Duplicate() = default;
};
#endif
#include <ModelAPI_Events.h>
#include <ModelAPI_ResultPart.h>
-PartSetPlugin_Part::PartSetPlugin_Part() {}
+PartSetPlugin_Part::PartSetPlugin_Part() = default;
void PartSetPlugin_Part::initAttributes() { // all is in part result
}
class PartSetPlugin_Plugin : public ModelAPI_Plugin, public Events_Listener {
public:
/// Creates the feature object of this plugin by the feature string ID
- PARTSETPLUGIN_EXPORT virtual FeaturePtr
- createFeature(std::string theFeatureID);
+ PARTSETPLUGIN_EXPORT FeaturePtr
+ createFeature(std::string theFeatureID) override;
/// Is needed for python wrapping by swig
PARTSETPLUGIN_EXPORT PartSetPlugin_Plugin();
//! Redefinition of Events_Listener method
- PARTSETPLUGIN_EXPORT virtual void
- processEvent(const std::shared_ptr<Events_Message> &theMessage);
+ PARTSETPLUGIN_EXPORT void
+ processEvent(const std::shared_ptr<Events_Message> &theMessage) override;
//! Performs the chenges of enabled/disabled state in the toolbar
//! due to the current state of the application.
PARTSETPLUGIN_EXPORT std::shared_ptr<ModelAPI_FeatureStateMessage>
}
// LCOV_EXCL_START
/// Returns the kind of a feature
- PARTSETPLUGIN_EXPORT virtual const std::string &getKind() {
+ PARTSETPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = PartSetPlugin_Remove::ID();
return MY_KIND;
}
/// Request for initialization of data model of the feature: adding all
/// attributes
- PARTSETPLUGIN_EXPORT virtual void initAttributes() {}
+ PARTSETPLUGIN_EXPORT void initAttributes() override {}
// LCOV_EXCL_STOP
/// Not normal feature that stored in the tree
- PARTSETPLUGIN_EXPORT virtual bool isAction() { return true; }
+ PARTSETPLUGIN_EXPORT bool isAction() override { return true; }
/// Performs the "remove"
- PARTSETPLUGIN_EXPORT virtual void execute();
+ PARTSETPLUGIN_EXPORT void execute() override;
/// Use plugin manager for features creation
- PartSetPlugin_Remove() {}
+ PartSetPlugin_Remove() = default;
};
#endif
}
//==================================================================================================
-PrimitivesAPI_Box::~PrimitivesAPI_Box() {}
+PrimitivesAPI_Box::~PrimitivesAPI_Box() = default;
//==================================================================================================
void PrimitivesAPI_Box::setDimensions(const ModelHighAPI_Double &theDx,
/// Destructor.
PRIMITIVESAPI_EXPORT
- virtual ~PrimitivesAPI_Box();
+ ~PrimitivesAPI_Box() override;
INTERFACE_12(PrimitivesPlugin_Box::ID(), creationMethod,
PrimitivesPlugin_Box::CREATION_METHOD(),
/// Dump wrapped feature
PRIMITIVESAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on primitive Box object
}
//==================================================================================================
-PrimitivesAPI_Cone::~PrimitivesAPI_Cone() {}
+PrimitivesAPI_Cone::~PrimitivesAPI_Cone() = default;
//==================================================================================================
void PrimitivesAPI_Cone::setRadius(const ModelHighAPI_Double &theBaseRadius,
/// Destructor.
PRIMITIVESAPI_EXPORT
- virtual ~PrimitivesAPI_Cone();
+ ~PrimitivesAPI_Cone() override;
INTERFACE_5(PrimitivesPlugin_Cone::ID(), basePoint,
PrimitivesPlugin_Cone::BASE_POINT_ID(),
/// Dump wrapped feature
PRIMITIVESAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on primitive Cone object
}
//==================================================================================================
-PrimitivesAPI_Cylinder::~PrimitivesAPI_Cylinder() {}
+PrimitivesAPI_Cylinder::~PrimitivesAPI_Cylinder() = default;
//==================================================================================================
void PrimitivesAPI_Cylinder::setSizes(const ModelHighAPI_Double &theRadius,
/// Destructor.
PRIMITIVESAPI_EXPORT
- virtual ~PrimitivesAPI_Cylinder();
+ ~PrimitivesAPI_Cylinder() override;
INTERFACE_6(PrimitivesPlugin_Cylinder::ID(), creationMethod,
PrimitivesPlugin_Cylinder::CREATION_METHOD(),
/// Dump wrapped feature
PRIMITIVESAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on primitive Cylinder object
}
//==================================================================================================
-PrimitivesAPI_Sphere::~PrimitivesAPI_Sphere() {}
+PrimitivesAPI_Sphere::~PrimitivesAPI_Sphere() = default;
//==================================================================================================
void PrimitivesAPI_Sphere::setCenterPoint(
/// Destructor.
PRIMITIVESAPI_EXPORT
- virtual ~PrimitivesAPI_Sphere();
+ ~PrimitivesAPI_Sphere() override;
INTERFACE_9(PrimitivesPlugin_Sphere::ID(), creationMethod,
PrimitivesPlugin_Sphere::CREATION_METHOD(),
/// Dump wrapped feature
PRIMITIVESAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on primitive Sphere object
}
//==================================================================================================
-PrimitivesAPI_Torus::~PrimitivesAPI_Torus() {}
+PrimitivesAPI_Torus::~PrimitivesAPI_Torus() = default;
//==================================================================================================
void PrimitivesAPI_Torus::setRadius(const ModelHighAPI_Double &theRadius,
/// Destructor.
PRIMITIVESAPI_EXPORT
- virtual ~PrimitivesAPI_Torus();
+ ~PrimitivesAPI_Torus() override;
INTERFACE_4(PrimitivesPlugin_Torus::ID(), basePoint,
PrimitivesPlugin_Torus::BASE_POINT_ID(),
/// Dump wrapped feature
PRIMITIVESAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on primitive Torus object
}
//==================================================================================================
-PrimitivesAPI_Tube::~PrimitivesAPI_Tube() {}
+PrimitivesAPI_Tube::~PrimitivesAPI_Tube() = default;
//==================================================================================================
void PrimitivesAPI_Tube::setRadius(const ModelHighAPI_Double &theRMin,
/// Destructor.
PRIMITIVESAPI_EXPORT
- virtual ~PrimitivesAPI_Tube();
+ ~PrimitivesAPI_Tube() override;
INTERFACE_3(PrimitivesPlugin_Tube::ID(), rmin,
PrimitivesPlugin_Tube::RMIN_ID(), ModelAPI_AttributeDouble,
/// Dump wrapped feature
PRIMITIVESAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on primitive Tube object
//=================================================================================================
PrimitivesPlugin_Box::PrimitivesPlugin_Box() // Nothing to do during
// instantiation
-{}
+ = default;
//=================================================================================================
void PrimitivesPlugin_Box::initAttributes() {
std::shared_ptr<GeomAlgoAPI_Box> aBoxAlgo;
- if ((aRef1.get() != NULL) && (aRef2.get() != NULL)) {
+ if ((aRef1.get() != nullptr) && (aRef2.get() != nullptr)) {
GeomShapePtr aShape1 = aRef1->value();
if (!aShape1.get()) // If we can't get the points directly, try getting them
// from the context
// 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);
+ for (auto &listOfFace : listOfFaces) {
+ theResultBox->generated(listOfFace.second, listOfFace.first);
}
}
}
/// Returns the kind of a feature
- PRIMITIVESPLUGIN_EXPORT virtual const std::string &getKind() {
+ PRIMITIVESPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = PrimitivesPlugin_Box::ID();
return MY_KIND;
}
/// Creates a new part document if needed
- PRIMITIVESPLUGIN_EXPORT virtual void execute();
+ PRIMITIVESPLUGIN_EXPORT void execute() override;
/// Request for initialization of data model of the feature: adding all
/// attributes
- PRIMITIVESPLUGIN_EXPORT virtual void initAttributes();
+ PRIMITIVESPLUGIN_EXPORT void initAttributes() override;
/// Use plugin manager for features creation
PrimitivesPlugin_Box();
#include <sstream>
//=================================================================================================
-PrimitivesPlugin_Cone::PrimitivesPlugin_Cone() {}
+PrimitivesPlugin_Cone::PrimitivesPlugin_Cone() = default;
//=================================================================================================
void PrimitivesPlugin_Cone::initAttributes() {
std::shared_ptr<GeomAPI_Pnt> aBasePoint;
std::shared_ptr<ModelAPI_AttributeSelection> aPointRef =
selection(PrimitivesPlugin_Cone::BASE_POINT_ID());
- if (aPointRef.get() != NULL) {
+ if (aPointRef.get() != nullptr) {
GeomShapePtr aShape1 = aPointRef->value();
if (!aShape1.get()) {
aShape1 = aPointRef->context()->shape();
std::map<std::string, std::shared_ptr<GeomAPI_Shape>> listOfFaces =
theConeAlgo->getCreatedFaces();
int nbFaces = 0;
- for (std::map<std::string, std::shared_ptr<GeomAPI_Shape>>::iterator it =
- listOfFaces.begin();
- it != listOfFaces.end(); ++it) {
- theResultCone->generated((*it).second, (*it).first);
+ for (auto &listOfFace : listOfFaces) {
+ theResultCone->generated(listOfFace.second, listOfFace.first);
nbFaces++;
}
}
/// Returns the kind of a feature
- PRIMITIVESPLUGIN_EXPORT virtual const std::string &getKind() {
+ PRIMITIVESPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = PrimitivesPlugin_Cone::ID();
return MY_KIND;
}
/// Creates a new part document if needed
- PRIMITIVESPLUGIN_EXPORT virtual void execute();
+ PRIMITIVESPLUGIN_EXPORT void execute() override;
/// Request for initialization of data model of the feature: adding all
/// attributes
- PRIMITIVESPLUGIN_EXPORT virtual void initAttributes();
+ PRIMITIVESPLUGIN_EXPORT void initAttributes() override;
/// Use plugin manager for features creation
PrimitivesPlugin_Cone();
#include <ModelAPI_Session.h>
//=================================================================================================
-PrimitivesPlugin_Cylinder::PrimitivesPlugin_Cylinder() {}
+PrimitivesPlugin_Cylinder::PrimitivesPlugin_Cylinder() = default;
//=================================================================================================
void PrimitivesPlugin_Cylinder::initAttributes() {
std::shared_ptr<GeomAPI_Pnt> aBasePoint;
std::shared_ptr<ModelAPI_AttributeSelection> aPointRef =
selection(PrimitivesPlugin_Cylinder::BASE_POINT_ID());
- if (aPointRef.get() != NULL) {
+ if (aPointRef.get() != nullptr) {
GeomShapePtr aShape1 = aPointRef->value();
if (!aShape1.get()) {
aShape1 = aPointRef->context()->shape();
// Insert to faces
std::map<std::string, std::shared_ptr<GeomAPI_Shape>> listOfFaces =
theCylinderAlgo->getCreatedFaces();
- for (std::map<std::string, std::shared_ptr<GeomAPI_Shape>>::iterator it =
- listOfFaces.begin();
- it != listOfFaces.end(); ++it) {
- theResultCylinder->generated((*it).second, (*it).first);
+ for (auto &listOfFace : listOfFaces) {
+ theResultCylinder->generated(listOfFace.second, listOfFace.first);
}
}
}
/// Returns the kind of a feature
- PRIMITIVESPLUGIN_EXPORT virtual const std::string &getKind() {
+ PRIMITIVESPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = PrimitivesPlugin_Cylinder::ID();
return MY_KIND;
}
/// Creates a new part document if needed
- PRIMITIVESPLUGIN_EXPORT virtual void execute();
+ PRIMITIVESPLUGIN_EXPORT void execute() override;
/// Request for initialization of data model of the feature: adding all
/// attributes
- PRIMITIVESPLUGIN_EXPORT virtual void initAttributes();
+ PRIMITIVESPLUGIN_EXPORT void initAttributes() override;
/// Use plugin manager for features creation
PrimitivesPlugin_Cylinder();
class PRIMITIVESPLUGIN_EXPORT PrimitivesPlugin_Plugin : public ModelAPI_Plugin {
public:
/// Creates the feature object of this plugin by the feature string ID
- virtual FeaturePtr createFeature(std::string theFeatureID);
+ FeaturePtr createFeature(std::string theFeatureID) override;
public:
/// Default constructor
#include <sstream>
//=================================================================================================
-PrimitivesPlugin_Torus::PrimitivesPlugin_Torus() {}
+PrimitivesPlugin_Torus::PrimitivesPlugin_Torus() = default;
//=================================================================================================
void PrimitivesPlugin_Torus::initAttributes() {
std::shared_ptr<GeomAPI_Pnt> aBasePoint;
std::shared_ptr<ModelAPI_AttributeSelection> aPointRef =
selection(PrimitivesPlugin_Torus::BASE_POINT_ID());
- if (aPointRef.get() != NULL) {
+ if (aPointRef.get() != nullptr) {
GeomShapePtr aShape1 = aPointRef->value();
if (!aShape1.get()) {
aShape1 = aPointRef->context()->shape();
// Naming for faces
std::map<std::string, std::shared_ptr<GeomAPI_Shape>> listOfFaces =
theTorusAlgo->getCreatedFaces();
- for (std::map<std::string, std::shared_ptr<GeomAPI_Shape>>::iterator it =
- listOfFaces.begin();
- it != listOfFaces.end(); ++it) {
- theResultTorus->generated((*it).second, (*it).first);
+ for (auto &listOfFace : listOfFaces) {
+ theResultTorus->generated(listOfFace.second, listOfFace.first);
}
// Naming of edges
}
/// Returns the kind of a feature
- PRIMITIVESPLUGIN_EXPORT virtual const std::string &getKind() {
+ PRIMITIVESPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = PrimitivesPlugin_Torus::ID();
return MY_KIND;
}
/// Creates a new part document if needed
- PRIMITIVESPLUGIN_EXPORT virtual void execute();
+ PRIMITIVESPLUGIN_EXPORT void execute() override;
/// Request for initialization of data model of the feature: adding all
/// attributes
- PRIMITIVESPLUGIN_EXPORT virtual void initAttributes();
+ PRIMITIVESPLUGIN_EXPORT void initAttributes() override;
/// Use plugin manager for features creation
PrimitivesPlugin_Torus();
//=================================================================================================
PrimitivesPlugin_Tube::PrimitivesPlugin_Tube() // Nothing to do during
// instantiation
-{}
+ = default;
//=================================================================================================
void PrimitivesPlugin_Tube::initAttributes() {
// Insert to faces
std::map<std::string, std::shared_ptr<GeomAPI_Shape>> listOfFaces =
theTubeAlgo->getCreatedFaces();
- for (std::map<std::string, std::shared_ptr<GeomAPI_Shape>>::iterator it =
- listOfFaces.begin();
- it != listOfFaces.end(); ++it) {
- theResultTube->generated((*it).second, (*it).first);
+ for (auto &listOfFace : listOfFaces) {
+ theResultTube->generated(listOfFace.second, listOfFace.first);
}
}
}
/// Returns the kind of a feature
- PRIMITIVESPLUGIN_EXPORT virtual const std::string &getKind() {
+ PRIMITIVESPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = PrimitivesPlugin_Tube::ID();
return MY_KIND;
}
/// Performs the algorithm and stores results it in the data structure
- PRIMITIVESPLUGIN_EXPORT virtual void execute();
+ PRIMITIVESPLUGIN_EXPORT void execute() override;
/// Request for initialization of data model of the feature: adding all
/// attributes
- PRIMITIVESPLUGIN_EXPORT virtual void initAttributes();
+ PRIMITIVESPLUGIN_EXPORT void initAttributes() override;
/// Use plugin manager for features creation.
PrimitivesPlugin_Tube();
SHAPERGUI_PrefMgr(LightApp_Preferences *theMgr, const QString &theModName)
: myMgr(theMgr), myModName(theModName) {}
- virtual int addPreference(const QString &theLbl, int pId,
- SUIT_PreferenceMgr::PrefItemType theType,
- const QString &theSection, const QString &theName) {
+ int addPreference(const QString &theLbl, int pId,
+ SUIT_PreferenceMgr::PrefItemType theType,
+ const QString &theSection,
+ const QString &theName) override {
return myMgr->addPreference(myModName, theLbl, pId, theType, theSection,
theName);
}
- virtual void setItemProperty(const QString &thePropName,
- const QVariant &theValue, const int theId = -1) {
+ void setItemProperty(const QString &thePropName, const QVariant &theValue,
+ const int theId = -1) override {
myMgr->setItemProperty(thePropName, theValue, theId);
}
- virtual SUIT_PreferenceMgr *prefMgr() const { return myMgr; }
+ SUIT_PreferenceMgr *prefMgr() const override { return myMgr; }
private:
LightApp_Preferences *myMgr;
};
//******************************************************
-SHAPERGUI::SHAPERGUI()
- : LightApp_Module("SHAPER"), mySelector(0), myIsOpened(0), myPopupMgr(0),
- myIsInspectionVisible(false), myInspectionPanel(0),
- myIsFacesPanelVisible(false), myIsToolbarsModified(false),
- myAxisArrowRate(-1) {
+SHAPERGUI::SHAPERGUI() : LightApp_Module("SHAPER") {
myWorkshop = new XGUI_Workshop(this);
connect(myWorkshop, SIGNAL(commandStatusUpdated()), this,
SLOT(onUpdateCommandStatus()));
LightApp_Module::initialize(theApp);
myWorkshop->startApplication();
- LightApp_Application *anApp = dynamic_cast<LightApp_Application *>(theApp);
+ auto *anApp = dynamic_cast<LightApp_Application *>(theApp);
if (anApp) {
connect(anApp, SIGNAL(preferenceResetToDefaults()), this,
SLOT(onDefaultPreferences()));
SUIT_ViewManager *aMgr = aOCCViewManagers.first();
SUIT_ViewWindow *aWnd = aMgr->getActiveView();
if (aWnd) {
- OCCViewer_ViewWindow *aOccWnd = static_cast<OCCViewer_ViewWindow *>(aWnd);
+ auto *aOccWnd = static_cast<OCCViewer_ViewWindow *>(aWnd);
OCCViewer_ViewPort3d *aViewPort = aOccWnd->getViewPort();
if (aViewPort) {
XGUI_ViewerProxy *aViewer = myWorkshop->viewer();
}
}
}
- SHAPERGUI_DataModel *aDataModel =
- dynamic_cast<SHAPERGUI_DataModel *>(dataModel());
+ auto *aDataModel = dynamic_cast<SHAPERGUI_DataModel *>(dataModel());
aDataModel->initRootObject();
}
// this must be done in the initialization and in activation (on the second
// activation initialization in not called, so SComponent must be added anyway
- SHAPERGUI_DataModel *aDataModel =
- dynamic_cast<SHAPERGUI_DataModel *>(dataModel());
+ auto *aDataModel = dynamic_cast<SHAPERGUI_DataModel *>(dataModel());
aDataModel->initRootObject();
bool isDone = LightApp_Module::activateModule(theStudy);
setToolShown(true);
QObject *aObj = myWorkshop->objectBrowser()->parent();
- QDockWidget *aObjDoc = dynamic_cast<QDockWidget *>(aObj);
+ auto *aObjDoc = dynamic_cast<QDockWidget *>(aObj);
if (aObjDoc) {
myWorkshop->objectBrowser()->setVisible(true);
aObjDoc->setVisible(true);
setToolShown(false);
QObject *aObj = myWorkshop->objectBrowser()->parent();
- QDockWidget *aObjDoc = dynamic_cast<QDockWidget *>(aObj);
+ auto *aObjDoc = dynamic_cast<QDockWidget *>(aObj);
if (aObjDoc) {
aObjDoc->setVisible(false);
myWorkshop->objectBrowser()->setVisible(false);
aContext->Redisplay(aTrihedron, false);
}
myWorkshop->displayer()->setSelectionColor(myOldSelectionColor);
- myProxyViewer->setSelector(0);
+ myProxyViewer->setSelector(nullptr);
LightApp_SelectionMgr *aMgr = getApp()->selectionMgr();
QList<SUIT_Selector *> aList;
}
delete mySelector;
- mySelector = 0;
+ mySelector = nullptr;
}
// myWorkshop->contextMenuMgr()->disconnectViewer();
//******************************************************
void SHAPERGUI::logShaperGUIEvent() {
- QAction *anAction = static_cast<QAction *>(sender());
+ auto *anAction = static_cast<QAction *>(sender());
if (!anAction)
return;
const QString anId = anAction->data().toString();
if (theMgr->getType() == OCCViewer_Viewer::Type()) {
// Set the auto rotate flag in the new viewer based on the current
// preference
- OCCViewer_ViewManager *aVM = (OCCViewer_ViewManager *)theMgr;
+ auto *aVM = (OCCViewer_ViewManager *)theMgr;
bool aAutoRotation =
Config_PropManager::boolean("Visualization", "use_auto_rotation");
aVM->setAutoRotation(aAutoRotation);
void SHAPERGUI::onViewManagerRemoved(SUIT_ViewManager *theMgr) {
if (mySelector) {
if (theMgr->getType() == OCCViewer_Viewer::Type()) {
- OCCViewer_Viewer *aViewer =
- static_cast<OCCViewer_Viewer *>(theMgr->getViewModel());
+ auto *aViewer = static_cast<OCCViewer_Viewer *>(theMgr->getViewModel());
if (mySelector->viewer() == aViewer) {
XGUI_Displayer *aDisp = myWorkshop->displayer();
QObjectPtrList aObjects = aDisp->displayedObjects();
aObj->setDisplayed(false);
aRes = std::dynamic_pointer_cast<ModelAPI_Result>(aObj);
if (aRes.get()) {
- while (aRes = ModelAPI_Tools::bodyOwner(aRes)) {
+ while ((aRes = ModelAPI_Tools::bodyOwner(aRes))) {
aRes->setDisplayed(false);
}
}
}
Events_Loop::loop()->flush(
Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
- myProxyViewer->setSelector(0);
+ myProxyViewer->setSelector(nullptr);
delete mySelector;
- mySelector = 0;
+ mySelector = nullptr;
myWorkshop->module()->clearViewer();
}
//******************************************************
QtxPopupMgr *SHAPERGUI::popupMgr() {
if (!myPopupMgr)
- myPopupMgr = new QtxPopupMgr(0, this);
+ myPopupMgr = new QtxPopupMgr(nullptr, this);
return myPopupMgr;
}
void SHAPERGUI::onUpdateCommandStatus() {
getApp()->updateActions();
- LightApp_Application *aApp =
- dynamic_cast<LightApp_Application *>(application());
+ auto *aApp = dynamic_cast<LightApp_Application *>(application());
QtxInfoPanel *aInfoPanel = aApp->infoPanel();
if (aInfoPanel->isVisible())
updateInfoPanel();
//******************************************************
SHAPERGUI_OCCSelector *SHAPERGUI::createSelector(SUIT_ViewManager *theMgr) {
if (theMgr->getType() == OCCViewer_Viewer::Type()) {
- OCCViewer_Viewer *aViewer =
- static_cast<OCCViewer_Viewer *>(theMgr->getViewModel());
+ auto *aViewer = static_cast<OCCViewer_Viewer *>(theMgr->getViewModel());
// Remember current length of arrow of axis
Handle(AIS_Trihedron) aTrihedron = aViewer->getTrihedron();
myAxisArrowRate =
aDatumAspect->Attribute(Prs3d_DP_ShadingConeLengthPercent);
- SHAPERGUI_OCCSelector *aSelector =
+ auto *aSelector =
new SHAPERGUI_OCCSelector(aViewer, getApp()->selectionMgr());
#ifdef SALOME_PATCH_FOR_CTRL_WHEEL
aViewer->setUseLocalSelection(true);
return aSelector;
}
- return 0;
+ return nullptr;
}
//******************************************************
const ActionInfo &theInfo,
const QList<QAction *> &theNestedActions) {
SUIT_Desktop *aDesk = application()->desktop();
- SHAPERGUI_NestedButton *anAction =
- new SHAPERGUI_NestedButton(aDesk, theNestedActions);
+ auto *anAction = new SHAPERGUI_NestedButton(aDesk, theNestedActions);
anAction->setData(theInfo.id);
anAction->setCheckable(theInfo.checkable);
anAction->setChecked(theInfo.checked);
// Update the auto rotation flag in all OCC 3D view windows
ViewManagerList lst;
getApp()->viewManagers(OCCViewer_Viewer::Type(), lst);
- for (auto it = lst.begin(); it != lst.end(); ++it) {
- OCCViewer_ViewManager *aVMgr =
- dynamic_cast<OCCViewer_ViewManager *>(*it);
+ for (auto &it : lst) {
+ auto *aVMgr = dynamic_cast<OCCViewer_ViewManager *>(it);
if (aVMgr) {
aVMgr->setAutoRotation(aAutoRotation);
}
}
void SHAPERGUI::updateInfoPanel() {
- LightApp_Application *aApp =
- dynamic_cast<LightApp_Application *>(application());
+ auto *aApp = dynamic_cast<LightApp_Application *>(application());
QtxInfoPanel *aInfoPanel = aApp->infoPanel();
aInfoPanel->clear();
aInfoPanel->setTitle(tr("Welcome to SHAPER"));
Q_OBJECT
public:
SHAPERGUI();
- virtual ~SHAPERGUI();
+ ~SHAPERGUI() override;
//----- LightAPP_Module interface ---------------
/// \brief Initializing of the module
/// \param theApp application instance
- virtual void initialize(CAM_Application *theApp);
+ void initialize(CAM_Application *theApp) override;
/// \brief Definition of module standard windows
- virtual void windows(QMap<int, int> &theWndMap) const;
+ void windows(QMap<int, int> &theWndMap) const override;
/// \brief Definition of module viewer
- virtual void viewManagers(QStringList &theList) const;
+ void viewManagers(QStringList &theList) const override;
/// \brief The method is called on selection changed event
- virtual void selectionChanged();
+ void selectionChanged() override;
//--- XGUI connector interface -----
- virtual QAction *addFeature(const QString &theWBName,
- const QString &theTBName, const QString &theId,
- const QString &theTitle, const QString &theTip,
- const QIcon &theIcon,
- const QKeySequence &theKeys /* = QKeySequence()*/,
- bool isCheckable /*= false*/,
- const bool isAddSeparator /* = false*/,
- const QString &theStatusTip);
+ QAction *addFeature(const QString &theWBName, const QString &theTBName,
+ const QString &theId, const QString &theTitle,
+ const QString &theTip, const QIcon &theIcon,
+ const QKeySequence &theKeys /* = QKeySequence()*/,
+ bool isCheckable /*= false*/,
+ const bool isAddSeparator /* = false*/,
+ const QString &theStatusTip) override;
//! Add feature (QAction) in the \a theWBName toolbar with given \a theInfo
//! about action
- virtual QAction *addFeature(const QString &theWBName,
- const ActionInfo &theInfo,
- const bool isAddSeparator);
+ QAction *addFeature(const QString &theWBName, const ActionInfo &theInfo,
+ const bool isAddSeparator) override;
/// Add a nested feature
/// \param theWBName a workbench name
/// \param theInfo the action parameters
/// \param theNestedActions a list of nested actions
- virtual QAction *addFeatureOfNested(const QString &theWBName,
- const ActionInfo &theInfo,
- const QList<QAction *> &theNestedActions);
+ QAction *
+ addFeatureOfNested(const QString &theWBName, const ActionInfo &theInfo,
+ const QList<QAction *> &theNestedActions) override;
//! Returns true if the feature action is a nested action, in other words,
//! it is created by addNestedFeature().
//! \param theAction - an action of a feature
//! returns boolean result
- virtual bool isFeatureOfNested(const QAction *theAction);
+ bool isFeatureOfNested(const QAction *theAction) override;
- virtual QAction *addDesktopCommand(
+ QAction *addDesktopCommand(
const QString &theId, const QString &theTitle, const QString &theTip,
const QIcon &theIcon, const QKeySequence &theKeys, bool isCheckable,
const char *theMenuSourceText, const QString &theSubMenu = QString(),
const int theMenuPosition = 10,
const int theSuibMenuPosition = -1) Standard_OVERRIDE;
- virtual void addDesktopMenuSeparator(const char *theMenuSourceText,
- const int theMenuPosition = 10);
+ void addDesktopMenuSeparator(const char *theMenuSourceText,
+ const int theMenuPosition = 10) override;
/// Add an action to a tool bar
/// \param theAction an ation to add
/// \param theToolBarTitle a name of tool bar
- virtual bool addActionInToolbar(QAction *theAction,
- const QString &theToolBarTitle);
+ bool addActionInToolbar(QAction *theAction,
+ const QString &theToolBarTitle) override;
/// Creates menu/tool bar actions for loaded features stored in the menu
/// manager
- virtual void createFeatureActions();
+ void createFeatureActions() override;
- virtual QMainWindow *desktop() const;
+ QMainWindow *desktop() const override;
//! Stores XML information for the feature kind
//! \param theFeatureId a feature kind
//! \param theMessage a container of the feature XML properties
- virtual void
- setFeatureInfo(const QString &theFeatureId,
- const std::shared_ptr<Config_FeatureMessage> &theMessage);
+ void setFeatureInfo(
+ const QString &theFeatureId,
+ const std::shared_ptr<Config_FeatureMessage> &theMessage) override;
//! Returns XML information for the feature kind
//! \param theFeatureId a feature kind
//! \return theMessage a container of the feature XML properties
- virtual std::shared_ptr<Config_FeatureMessage>
- featureInfo(const QString &theFeatureId);
+ std::shared_ptr<Config_FeatureMessage>
+ featureInfo(const QString &theFeatureId) override;
//! Returns interface to Salome viewer
- virtual ModuleBase_IViewer *viewer() const { return myProxyViewer; }
+ ModuleBase_IViewer *viewer() const override { return myProxyViewer; }
//! Returns list of defined actions (just by SHAPER module)
- virtual QList<QAction *> commandList() const;
+ QList<QAction *> commandList() const override;
/// Redefinition of virtual function.
/// \param theClient name of pop-up client
/// \param theMenu popup menu instance
/// \param theTitle menu title.
- virtual void contextMenuPopup(const QString &theClient, QMenu *theMenu,
- QString &theTitle);
+ void contextMenuPopup(const QString &theClient, QMenu *theMenu,
+ QString &theTitle) override;
/// Redefinition of virtual function for preferences creation.
- virtual void createPreferences();
+ void createPreferences() override;
/// Redefinition of virtual function for preferences changed event.
- virtual void preferencesChanged(const QString &theSection,
- const QString &theParam);
+ void preferencesChanged(const QString &theSection,
+ const QString &theParam) override;
//! Shows the given text in status bar as a permanent text
//! \theInfo a string value
//! \theMsecs interval of msec milliseconds when the message will be hidden,
//! if -1, it stays.
// If 0, default value is used, it is 3000
- virtual void putInfo(const QString &theInfo, const int theMSecs = 0);
+ void putInfo(const QString &theInfo, const int theMSecs = 0) override;
/// \return Workshop class instance
XGUI_Workshop *workshop() const { return myWorkshop; }
/// \brief Set flag about opened document state
void setIsOpened(bool theOpened) { myIsOpened = theOpened; }
- virtual void updateModuleVisibilityState();
+ void updateModuleVisibilityState() override;
/// Returns list of the module commands
QIntList shaperActions() const { return myActionsList; }
void publishToStudy();
- virtual void updateInfoPanel();
+ void updateInfoPanel() override;
public slots:
/// \brief The method is redefined to connect to the study viewer before the
/// \brief The method is called on the module activation
/// \param theStudy current study
- virtual bool activateModule(SUIT_Study *theStudy);
+ bool activateModule(SUIT_Study *theStudy) override;
/// \brief The method is called on the module activation
/// \param theStudy current study
- virtual bool deactivateModule(SUIT_Study *theStudy);
+ bool deactivateModule(SUIT_Study *theStudy) override;
protected slots:
/// Redefinition of virtual function
/// \param theMgr view manager
- virtual void onViewManagerAdded(SUIT_ViewManager *theMgr);
+ void onViewManagerAdded(SUIT_ViewManager *theMgr) override;
/// Redefinition of virtual function
/// \param theMgr view manager
- virtual void onViewManagerRemoved(SUIT_ViewManager *theMgr);
+ void onViewManagerRemoved(SUIT_ViewManager *theMgr) override;
/// Set preferences to default
void onDefaultPreferences();
protected:
/// Create data model
- CAM_DataModel *createDataModel();
+ CAM_DataModel *createDataModel() override;
/// Create popup menu manager
- virtual QtxPopupMgr *popupMgr();
+ QtxPopupMgr *popupMgr() override;
/// Abort all operations
- virtual bool abortAllOperations();
+ bool abortAllOperations() override;
private slots:
void onWhatIs(bool isToggled);
XGUI_Workshop *myWorkshop;
/// OCC viewer selector instance
- SHAPERGUI_OCCSelector *mySelector;
+ SHAPERGUI_OCCSelector *mySelector{0};
/// Proxy viewer for connection to OCC Viewer in SALOME
SHAPERGUI_SalomeViewer *myProxyViewer;
QMap<QString, std::shared_ptr<Config_FeatureMessage>> myFeaturesInfo;
/// Flag of opened document state
- bool myIsOpened;
+ bool myIsOpened{0};
// the next parameter should be restored after this module deactivation
/// The application value
bool myIsEditEnabled;
/// Popup manager
- QtxPopupMgr *myPopupMgr;
+ QtxPopupMgr *myPopupMgr{0};
QAction *myWhatIsAction;
- bool myIsInspectionVisible;
- QDockWidget *myInspectionPanel;
- bool myIsFacesPanelVisible;
+ bool myIsInspectionVisible{false};
+ QDockWidget *myInspectionPanel{0};
+ bool myIsFacesPanelVisible{false};
/// List of registered actions
QIntList myActionsList;
QMap<QString, QIntList> myToolbars;
QMap<QString, QIntList> myDefaultToolbars;
- bool myIsToolbarsModified;
+ bool myIsToolbarsModified{false};
std::vector<int> myOldSelectionColor;
Handle(Graphic3d_AspectMarker3d) myHighlightPointAspect;
- double myAxisArrowRate;
+ double myAxisArrowRate{-1};
};
#endif
SHAPERGUI_DataModel::SHAPERGUI_DataModel(SHAPERGUI *theModule)
: LightApp_DataModel(theModule), myStudyPath(""), myModule(theModule) {}
-SHAPERGUI_DataModel::~SHAPERGUI_DataModel() {}
+SHAPERGUI_DataModel::~SHAPERGUI_DataModel() = default;
bool SHAPERGUI_DataModel::open(const QString &thePath, CAM_Study *theStudy,
QStringList theFiles) {
// creates a new tmp directory with a copy of files.
QString aTmpDir = theFiles.first();
- LightApp_Study *aStudy =
+ auto *aStudy =
dynamic_cast<LightApp_Study *>(myModule->application()->activeStudy());
QString aNewTmpDir = aStudy->GetTmpDir("", false).c_str();
std::list<std::string> aFileNames;
CAM_Application *anApp = myModule->application();
- LightApp_Study *aStudy = dynamic_cast<LightApp_Study *>(anApp->activeStudy());
+ auto *aStudy = dynamic_cast<LightApp_Study *>(anApp->activeStudy());
SUIT_ResourceMgr *aResMgr = anApp->resourceMgr();
// it is important to check whether the file is saved in the multi-files mode
return true;
}
-bool SHAPERGUI_DataModel::saveAs(const QString &thePath, CAM_Study *theStudy,
+bool SHAPERGUI_DataModel::saveAs(const QString &thePath,
+ CAM_Study * /*theStudy*/,
QStringList &theFiles) {
myStudyPath = thePath;
return save(theFiles);
return LightApp_DataModel::close();
}
-bool SHAPERGUI_DataModel::create(CAM_Study *theStudy) { return true; }
+bool SHAPERGUI_DataModel::create(CAM_Study * /*theStudy*/) { return true; }
bool SHAPERGUI_DataModel::isModified() const {
SessionPtr aMgr = ModelAPI_Session::get();
bool SHAPERGUI_DataModel::isSaved() const { return !isModified(); }
-void SHAPERGUI_DataModel::update(LightApp_DataObject *theObj,
- LightApp_Study *theStudy) {
+void SHAPERGUI_DataModel::update(LightApp_DataObject * /*theObj*/,
+ LightApp_Study * /*theStudy*/) {
// Nothing to do here: we always keep the data tree in the up-to-date state
// The only goal of this method is to hide default behavior from
// LightApp_DataModel
}
void SHAPERGUI_DataModel::initRootObject() {
- LightApp_Study *study =
+ auto *study =
dynamic_cast<LightApp_Study *>(module()->application()->activeStudy());
- CAM_ModuleObject *aModelRoot = dynamic_cast<CAM_ModuleObject *>(root());
- if (study && aModelRoot == NULL) {
+ auto *aModelRoot = dynamic_cast<CAM_ModuleObject *>(root());
+ if (study && aModelRoot == nullptr) {
aModelRoot = createModuleObject(study->root());
aModelRoot->setDataModel(this);
setRoot(aModelRoot);
bool SHAPERGUI_DataModel::dumpPython(const QString &thePath,
CAM_Study *theStudy, bool isMultiFile,
QStringList &theListOfFiles) {
- LightApp_Study *aStudy = dynamic_cast<LightApp_Study *>(theStudy);
+ auto *aStudy = dynamic_cast<LightApp_Study *>(theStudy);
if (!aStudy)
return false;
/// Constructor
/// \param theModule a module instance
SHAPERGUI_DataModel(SHAPERGUI *theModule);
- virtual ~SHAPERGUI_DataModel();
+ ~SHAPERGUI_DataModel() override;
/// Open a data file
/// \param thePath a path to the directory
/// \param theStudy a current study
/// \param theFiles a list of files to open
- virtual bool open(const QString &thePath, CAM_Study *theStudy,
- QStringList theFiles);
+ bool open(const QString &thePath, CAM_Study *theStudy,
+ QStringList theFiles) override;
/// Save module data to file
/// \param theFiles list of created files
- virtual bool save(QStringList &theFiles);
+ bool save(QStringList &theFiles) override;
/// Save module data to a file
/// \param thePath a path to the directory
/// \param theStudy a current study
/// \param theFiles a list of files to open
- virtual bool saveAs(const QString &thePath, CAM_Study *theStudy,
- QStringList &theFiles);
+ bool saveAs(const QString &thePath, CAM_Study *theStudy,
+ QStringList &theFiles) override;
/// Close data structure
- virtual bool close();
+ bool close() override;
/// Create data structure
/// \param theStudy a current study
- virtual bool create(CAM_Study *theStudy);
+ bool create(CAM_Study *theStudy) override;
/// Returns True if the data structure has been modified
- virtual bool isModified() const;
+ bool isModified() const override;
/// Returns True if the data structure is already saved
- virtual bool isSaved() const;
+ bool isSaved() const override;
/// Creates a module root object if it has not been created yet
/// and append it to the active study. It is necessary for correct persistent
/// of the model.
- virtual void initRootObject() override;
+ void initRootObject() override;
/// Update data object
/// \param theObj an data object
/// \param theStudy a current study
- virtual void update(LightApp_DataObject *theObj = 0,
- LightApp_Study *theStudy = 0);
+ void update(LightApp_DataObject *theObj = nullptr,
+ LightApp_Study *theStudy = nullptr) override;
/// Redefinition of virtual method: include the module dump in the common
/// SALOME dump
- virtual bool dumpPython(const QString &, CAM_Study *, bool, QStringList &);
+ bool dumpPython(const QString &, CAM_Study *, bool, QStringList &) override;
protected:
/**
bool event(QEvent *theEvent) override;
private:
- QList<QAction *> myNestedActions; ///< list of nested actions
- QWidget *myAdditionalButtonsWidget{0}; ///< widget to precess additional
- ///< buttons visibility
- QFrame *myButtonFrame{0}; ///< frame arround button representation
- QToolButton *myThisButton{0}; ///< main button
+ QList<QAction *> myNestedActions; ///< list of nested actions
+ QWidget *myAdditionalButtonsWidget{nullptr}; ///< widget to precess additional
+ ///< buttons visibility
+ QFrame *myButtonFrame{nullptr}; ///< frame arround button representation
+ QToolButton *myThisButton{nullptr}; ///< main button
};
#endif /* SRC_SHAPERGUI_NESTEDBUTTON_H_ */
SUIT_SelectionMgr *theMgr)
: LightApp_OCCSelector(theViewer, theMgr) {}
-SHAPERGUI_OCCSelector::~SHAPERGUI_OCCSelector() {}
+SHAPERGUI_OCCSelector::~SHAPERGUI_OCCSelector() = default;
void SHAPERGUI_OCCSelector::getSelection(
- SUIT_DataOwnerPtrList &thePtrList) const {
+ SUIT_DataOwnerPtrList & /*thePtrList*/) const {
OCCViewer_Viewer *vw = viewer();
if (!vw)
return;
}
void SHAPERGUI_OCCSelector::setSelection(
- const SUIT_DataOwnerPtrList &thePtrList) {
+ const SUIT_DataOwnerPtrList & /*thePtrList*/) {
OCCViewer_Viewer *vw = viewer();
if (!vw)
return;
/// \param theViewer a viewer
/// \param theMgr a selection manager
SHAPERGUI_OCCSelector(OCCViewer_Viewer *theViewer, SUIT_SelectionMgr *theMgr);
- virtual ~SHAPERGUI_OCCSelector();
+ ~SHAPERGUI_OCCSelector() override;
protected:
/// Redifinition of virtual function
- virtual void getSelection(SUIT_DataOwnerPtrList &theList) const;
+ void getSelection(SUIT_DataOwnerPtrList &theList) const override;
/// Redifinition of virtual function
- virtual void setSelection(const SUIT_DataOwnerPtrList &theList);
+ void setSelection(const SUIT_DataOwnerPtrList &theList) override;
};
#endif
#endif
SHAPERGUI_SalomeView::SHAPERGUI_SalomeView(OCCViewer_Viewer *theViewer)
- : ModuleBase_IViewWindow(), myCurrentView(0) {
+ : ModuleBase_IViewWindow(), myCurrentView(nullptr) {
myViewer = theViewer;
}
Handle(V3d_View) SHAPERGUI_SalomeView::v3dView() const {
Handle(V3d_View) aView;
if (myCurrentView) {
- OCCViewer_ViewWindow *aWnd =
- static_cast<OCCViewer_ViewWindow *>(myCurrentView);
+ auto *aWnd = static_cast<OCCViewer_ViewWindow *>(myCurrentView);
aView = aWnd->getViewPort()->getView();
}
return aView;
}
QWidget *SHAPERGUI_SalomeView::viewPort() const {
- QWidget *aViewPort = 0;
+ QWidget *aViewPort = nullptr;
if (myCurrentView) {
- OCCViewer_ViewWindow *aWnd =
- static_cast<OCCViewer_ViewWindow *>(myCurrentView);
+ auto *aWnd = static_cast<OCCViewer_ViewWindow *>(myCurrentView);
aViewPort = aWnd->getViewPort();
}
return aViewPort;
//**********************************************
SHAPERGUI_SalomeViewer::SHAPERGUI_SalomeViewer(QObject *theParent)
- : ModuleBase_IViewer(theParent), mySelector(0), myView(0),
+ : ModuleBase_IViewer(theParent), mySelector(nullptr), myView(nullptr),
myIsSelectionChanged(false) {}
SHAPERGUI_SalomeViewer::~SHAPERGUI_SalomeViewer() {
if (mySelector) {
OCCViewer_Viewer *aViewer = mySelector->viewer();
SUIT_ViewManager *aMgr = aViewer->getViewManager();
- OCCViewer_ViewWindow *aWnd =
- static_cast<OCCViewer_ViewWindow *>(aMgr->getActiveView());
+ auto *aWnd = static_cast<OCCViewer_ViewWindow *>(aMgr->getActiveView());
return aWnd->getViewPort()->getView();
}
return Handle(V3d_View)();
//**********************************************
QWidget *SHAPERGUI_SalomeViewer::activeViewPort() const {
- QWidget *aViewPort = 0;
+ QWidget *aViewPort = nullptr;
if (mySelector) {
OCCViewer_Viewer *aViewer = mySelector->viewer();
SUIT_ViewManager *aMgr = aViewer->getViewManager();
- OCCViewer_ViewWindow *aWnd =
- static_cast<OCCViewer_ViewWindow *>(aMgr->getActiveView());
+ auto *aWnd = static_cast<OCCViewer_ViewWindow *>(aMgr->getActiveView());
aViewPort = aWnd->getViewPort();
}
return aViewPort;
bool SHAPERGUI_SalomeViewer::canDragByMouse() const {
OCCViewer_Viewer *aViewer = mySelector->viewer();
SUIT_ViewWindow *aWnd = aViewer->getViewManager()->getActiveView();
- OCCViewer_ViewWindow *aViewWnd = dynamic_cast<OCCViewer_ViewWindow *>(aWnd);
+ auto *aViewWnd = dynamic_cast<OCCViewer_ViewWindow *>(aWnd);
if (aViewWnd) {
return (aViewWnd->interactionStyle() == 0);
}
void SHAPERGUI_SalomeViewer::onViewCreated(SUIT_ViewWindow *theView) {
myView->setCurrentView(theView);
- OCCViewer_ViewFrame *aView = dynamic_cast<OCCViewer_ViewFrame *>(theView);
+ auto *aView = dynamic_cast<OCCViewer_ViewFrame *>(theView);
OCCViewer_ViewWindow *aWnd = aView->getView(OCCViewer_ViewFrame::MAIN_VIEW);
if (aWnd) {
connect(aViewPort, SIGNAL(vpMapped(OCCViewer_ViewPort3d *)), this,
SLOT(onViewPortMapped()));
- OCCViewer_ViewManager *aMgr =
- dynamic_cast<OCCViewer_ViewManager *>(aWnd->getViewManager());
+ auto *aMgr = dynamic_cast<OCCViewer_ViewManager *>(aWnd->getViewManager());
if (aMgr)
aWnd->enableAutoRotation(aMgr->isAutoRotation());
}
//**********************************************
void SHAPERGUI_SalomeViewer::reconnectActions(SUIT_ViewWindow *theWindow,
const bool theUseSHAPERSlot) {
- OCCViewer_ViewWindow *aWindow =
- dynamic_cast<OCCViewer_ViewWindow *>(theWindow);
+ auto *aWindow = dynamic_cast<OCCViewer_ViewWindow *>(theWindow);
if (!aWindow)
return;
void SHAPERGUI_SalomeViewer::fitAll() {
if (mySelector) {
SUIT_ViewManager *aMgr = mySelector->viewer()->getViewManager();
- OCCViewer_ViewFrame *aVFrame =
- dynamic_cast<OCCViewer_ViewFrame *>(aMgr->getActiveView());
+ auto *aVFrame = dynamic_cast<OCCViewer_ViewFrame *>(aMgr->getActiveView());
if (aVFrame) {
aVFrame->onFitAll();
}
return;
SUIT_ViewManager *aMgr = mySelector->viewer()->getViewManager();
- OCCViewer_ViewFrame *aVFrame =
- dynamic_cast<OCCViewer_ViewFrame *>(aMgr->getActiveView());
+ auto *aVFrame = dynamic_cast<OCCViewer_ViewFrame *>(aMgr->getActiveView());
if (aVFrame) {
Handle(V3d_View) aView3d = aVFrame->getViewPort()->getView();
if (!aView3d.IsNull()) {
QVector<SUIT_ViewWindow *> aViews = aMgr->getViews();
if (toActivate) {
foreach (SUIT_ViewWindow *aView, aViews) {
- OCCViewer_ViewFrame *aOCCView =
- dynamic_cast<OCCViewer_ViewFrame *>(aView);
+ auto *aOCCView = dynamic_cast<OCCViewer_ViewFrame *>(aView);
OCCViewer_ViewWindow *aWnd =
aOCCView->getView(OCCViewer_ViewFrame::MAIN_VIEW);
connect(
SIGNAL(vpTransformationFinished(OCCViewer_ViewWindow::OperationType)),
this, SLOT(onViewTransformed(OCCViewer_ViewWindow::OperationType)));
reconnectActions(aWnd, true);
- OCCViewer_ViewManager *aOCCMgr =
- dynamic_cast<OCCViewer_ViewManager *>(aMgr);
+ auto *aOCCMgr = dynamic_cast<OCCViewer_ViewManager *>(aMgr);
if (aOCCMgr)
aWnd->enableAutoRotation(aOCCMgr->isAutoRotation());
}
} else {
foreach (SUIT_ViewWindow *aView, aViews) {
- OCCViewer_ViewFrame *aOCCView =
- dynamic_cast<OCCViewer_ViewFrame *>(aView);
+ auto *aOCCView = dynamic_cast<OCCViewer_ViewFrame *>(aView);
OCCViewer_ViewWindow *aWnd =
aOCCView->getView(OCCViewer_ViewFrame::MAIN_VIEW);
disconnect(
double anOffset =
-theSize - 1; // initial offset from the toolbar of the viewer
- ModuleBase_IViewer::TextColor::const_iterator aLine = theText.cbegin();
+ auto aLine = theText.cbegin();
for (; aLine != theText.cend(); aLine++) {
Quantity_Color aColor(aLine->second.at(0) / 255.,
aLine->second.at(1) / 255.,
OCCViewer_Fitter *SHAPERGUI_SalomeViewer::fitter() const {
if (mySelector)
return mySelector->viewer()->fitter();
- return 0;
+ return nullptr;
}
/// \param theViewer a reference to a viewer
SHAPERGUI_SalomeView(OCCViewer_Viewer *theViewer);
- virtual Handle(V3d_View) v3dView() const;
+ Handle(V3d_View) v3dView() const override;
/// Returns the view window view port
- virtual QWidget *viewPort() const;
+ QWidget *viewPort() const override;
/// Set the current viewer
/// \param theViewer a viewer instance
/// \param theParent a parent object
SHAPERGUI_SalomeViewer(QObject *theParent);
- ~SHAPERGUI_SalomeViewer();
+ ~SHAPERGUI_SalomeViewer() override;
//! Returns AIS_InteractiveContext from current OCCViewer
- virtual Handle(AIS_InteractiveContext) AISContext() const;
+ Handle(AIS_InteractiveContext) AISContext() const override;
//! Retrurns V3d_Vioewer from current viewer
- virtual Handle(V3d_Viewer) v3dViewer() const;
+ Handle(V3d_Viewer) v3dViewer() const override;
//! Trihedron 3d object shown in the viewer
- virtual Handle(AIS_Trihedron) trihedron() const;
+ Handle(AIS_Trihedron) trihedron() const override;
//! Returns Vsd_View object from currently active view window
- virtual Handle(V3d_View) activeView() const;
+ Handle(V3d_View) activeView() const override;
//! Returns viewer view port
- virtual QWidget *activeViewPort() const;
+ QWidget *activeViewPort() const override;
//! Enable or disable selection in the viewer
- virtual void enableSelection(bool isEnabled);
+ void enableSelection(bool isEnabled) override;
//! Returns true if selection is enabled
- virtual bool isSelectionEnabled() const;
+ bool isSelectionEnabled() const override;
//! Enable or disable multiselection in the viewer
- virtual void enableMultiselection(bool isEnable);
+ void enableMultiselection(bool isEnable) override;
//! Returns true if multiselection is enabled
- virtual bool isMultiSelectionEnabled() const;
+ bool isMultiSelectionEnabled() const override;
//! Enable or disable draw mode in the viewer
- virtual bool enableDrawMode(bool isEnabled);
+ bool enableDrawMode(bool isEnabled) override;
//! For some signals it disconnects the window from usual signal and connect
//! it to the module ones
const bool theUseSHAPERSlot);
//! Perfroms the fit all for the active view
- virtual void fitAll();
+ void fitAll() override;
//! Erases all presentations from the viewer
- virtual void eraseAll();
+ void eraseAll() override;
//! Sets the view projection
/// \param theX the X projection value
/// \param theY the Y projection value
/// \param theZ the Z projection value
/// \param theTwist the twist angle in radians
- virtual void setViewProjection(double theX, double theY, double theZ,
- double theTwist);
+ void setViewProjection(double theX, double theY, double theZ,
+ double theTwist) override;
/// Set selector
/// \param theSel a selector instance
void setSelector(SHAPERGUI_OCCSelector *theSel);
/// Add selection filter to the viewer
- virtual void addSelectionFilter(const Handle(SelectMgr_Filter) & theFilter);
+ void addSelectionFilter(const Handle(SelectMgr_Filter) & theFilter) override;
/// Remove selection filter from the viewer
- virtual void removeSelectionFilter(const Handle(SelectMgr_Filter) &
- theFilter);
+ void removeSelectionFilter(const Handle(SelectMgr_Filter) &
+ theFilter) override;
/// Returns true if the selection filter is set to the viewer
/// \param theFilter a selection filter
- virtual bool hasSelectionFilter(const Handle(SelectMgr_Filter) & theFilter);
+ bool hasSelectionFilter(const Handle(SelectMgr_Filter) & theFilter) override;
/// Remove all selection filters from the viewer
virtual void clearSelectionFilters();
SHAPERGUI_OCCSelector *selector() const { return mySelector; }
/// Update current viewer
- virtual void update();
+ void update() override;
/// Method returns True if the viewer can process editing objects
/// by mouse drugging. If this is impossible thet it has to return False.
- virtual bool canDragByMouse() const;
+ bool canDragByMouse() const override;
/// Activate or deactivate viewer
/// \param toActivate - activation flag
// Methods for color scale management
//! Returns True if ColorScale is visible
- virtual bool isColorScaleVisible() const;
+ bool isColorScaleVisible() const override;
//! Show/Hide ColorScale object
- virtual void setColorScaleShown(bool on);
+ void setColorScaleShown(bool on) override;
//! Set position of color scale
// \param theX is X position relative to current view width
// \param theY is Y position relative to current view heigth
- virtual void setColorScalePosition(double theX, double theY);
+ void setColorScalePosition(double theX, double theY) override;
//! Set size of color scale
// \param theW is width relative to current view width
// \param theh is height relative to current view heigth
- virtual void setColorScaleSize(double theW, double theH);
+ void setColorScaleSize(double theW, double theH) override;
//! Set range of color scale
// \param theMin is a minimal value
// \param theMax is a maximal value
- virtual void setColorScaleRange(double theMin, double theMax);
+ void setColorScaleRange(double theMin, double theMax) override;
//! Set number of intervals of color scale
// \param theNb is number of intervals
- virtual void setColorScaleIntervals(int theNb);
+ void setColorScaleIntervals(int theNb) override;
//! Set text heigth of color scale
// \param theH is number of intervals
- virtual void setColorScaleTextHeigth(int theH);
+ void setColorScaleTextHeigth(int theH) override;
//! Set color of text of color scale
// \param theH is number of intervals
- virtual void setColorScaleTextColor(const QColor &theColor);
+ void setColorScaleTextColor(const QColor &theColor) override;
//! Set title of color scale
// \param theText is a title
- virtual void setColorScaleTitle(const QString &theText);
+ void setColorScaleTitle(const QString &theText) override;
//! Sets the text displayed in right-top corner of the 3D view
//! \param theText the text to display, or empty string to erase presentation;
//! the first item is the font name and text color
//! \param theSize size of the text font
- virtual void setText(const ModuleBase_IViewer::TextColor &theText,
- const int theSize);
+ void setText(const ModuleBase_IViewer::TextColor &theText,
+ const int theSize) override;
- virtual void setFitter(OCCViewer_Fitter *theFitter);
- virtual OCCViewer_Fitter *fitter() const;
+ void setFitter(OCCViewer_Fitter *theFitter) override;
+ OCCViewer_Fitter *fitter() const override;
private slots:
void onMousePress(SUIT_ViewWindow *, QMouseEvent *);
SHAPERGUI *theModule)
: QListWidgetItem(theParent), myModule(theModule), myId(theId) {}
- virtual QVariant data(int theRole) const {
- QAction *aAction = 0;
+ QVariant data(int theRole) const override {
+ QAction *aAction = nullptr;
if (myId != -1)
aAction = myModule->action(myId);
myFreeCommands = theModule->getFreeCommands();
setWindowTitle(tr("Toolbars"));
- QVBoxLayout *aMailLayout = new QVBoxLayout(this);
+ auto *aMailLayout = new QVBoxLayout(this);
// Controls part of the dialog
- QWidget *aControlsWgt = new QWidget(this);
- QHBoxLayout *aContolsLay = new QHBoxLayout(aControlsWgt);
+ auto *aControlsWgt = new QWidget(this);
+ auto *aContolsLay = new QHBoxLayout(aControlsWgt);
aContolsLay->setContentsMargins(0, 0, 0, 0);
aMailLayout->addWidget(aControlsWgt);
// Right controls
- QWidget *aListWgt = new QWidget(aControlsWgt);
- QVBoxLayout *aListLayout = new QVBoxLayout(aListWgt);
+ auto *aListWgt = new QWidget(aControlsWgt);
+ auto *aListLayout = new QVBoxLayout(aListWgt);
aListLayout->setContentsMargins(0, 0, 0, 0);
aContolsLay->addWidget(aListWgt);
SLOT(onDoubleClick(const QModelIndex &)));
aListLayout->addWidget(myToolbarsList);
- QWidget *aFreeItemsWgt = new QWidget(aListWgt);
- QHBoxLayout *aFreeLayout = new QHBoxLayout(aFreeItemsWgt);
+ auto *aFreeItemsWgt = new QWidget(aListWgt);
+ auto *aFreeLayout = new QHBoxLayout(aFreeItemsWgt);
aFreeLayout->setContentsMargins(0, 0, 0, 0);
aListLayout->addWidget(aFreeItemsWgt);
aFreeLayout->addWidget(myFreeNbLbl);
// Left controls
- QWidget *aButtonsWgt = new QWidget(aControlsWgt);
- QVBoxLayout *aBtnLayout = new QVBoxLayout(aButtonsWgt);
+ auto *aButtonsWgt = new QWidget(aControlsWgt);
+ auto *aBtnLayout = new QVBoxLayout(aButtonsWgt);
aBtnLayout->setContentsMargins(0, 0, 0, 0);
aContolsLay->addWidget(aButtonsWgt);
- QPushButton *aAddBtn = new QPushButton(tr("Add..."), aButtonsWgt);
+ auto *aAddBtn = new QPushButton(tr("Add..."), aButtonsWgt);
aAddBtn->setToolTip(tr("Add a new empty toolbar to the toolbars list"));
connect(aAddBtn, SIGNAL(clicked(bool)), SLOT(onAdd()));
aBtnLayout->addWidget(aAddBtn);
- QPushButton *aEditBtn = new QPushButton(tr("Edit..."), aButtonsWgt);
+ auto *aEditBtn = new QPushButton(tr("Edit..."), aButtonsWgt);
aEditBtn->setToolTip(tr("Edit currently selected toolbar"));
connect(aEditBtn, SIGNAL(clicked(bool)), SLOT(onEdit()));
aBtnLayout->addWidget(aEditBtn);
- QPushButton *aDeleteBtn = new QPushButton(tr("Delete"), aButtonsWgt);
+ auto *aDeleteBtn = new QPushButton(tr("Delete"), aButtonsWgt);
aDeleteBtn->setToolTip(tr("Delete currently selected toolbar"));
connect(aDeleteBtn, SIGNAL(clicked(bool)), SLOT(onDelete()));
aBtnLayout->addWidget(aDeleteBtn);
aBtnLayout->addStretch(1);
- QPushButton *aResetBtn = new QPushButton(tr("Reset"), aButtonsWgt);
+ auto *aResetBtn = new QPushButton(tr("Reset"), aButtonsWgt);
aResetBtn->setToolTip(tr("Restore default toolbars structure"));
connect(aResetBtn, SIGNAL(clicked(bool)), SLOT(onReset()));
aBtnLayout->addWidget(aResetBtn);
aBtnLayout->addSpacing(19);
// Buttons part of the dialog
- QDialogButtonBox *aButtons = new QDialogButtonBox(
+ auto *aButtons = new QDialogButtonBox(
QDialogButtonBox::Help | QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
Qt::Horizontal, this);
aMailLayout->addWidget(aButtons);
: QDialog(theParent), myModule(theModule) {
setWindowTitle(tr("Edit toolbar"));
- QVBoxLayout *aMailLayout = new QVBoxLayout(this);
+ auto *aMailLayout = new QVBoxLayout(this);
// Name of toolbar
- QWidget *aNameWgt = new QWidget(this);
- QHBoxLayout *aNameLay = new QHBoxLayout(aNameWgt);
+ auto *aNameWgt = new QWidget(this);
+ auto *aNameLay = new QHBoxLayout(aNameWgt);
aNameLay->setContentsMargins(0, 0, 0, 0);
aMailLayout->addWidget(aNameWgt);
aNameLay->addWidget(new QLabel(tr("Toolbar name:"), aNameWgt));
- QLabel *aNameLbl = new QLabel(theToolbar, aNameWgt);
+ auto *aNameLbl = new QLabel(theToolbar, aNameWgt);
QFont aFont = aNameLbl->font();
aFont.setBold(true);
aNameLbl->setFont(aFont);
aNameLay->addStretch(1);
// Lists widget
- QWidget *aControlsWgt = new QWidget(this);
- QHBoxLayout *aCtrlLayout = new QHBoxLayout(aControlsWgt);
+ auto *aControlsWgt = new QWidget(this);
+ auto *aCtrlLayout = new QHBoxLayout(aControlsWgt);
aCtrlLayout->setContentsMargins(0, 0, 0, 0);
aMailLayout->addWidget(aControlsWgt);
// Left list
- QWidget *aCommandsWgt = new QWidget(aControlsWgt);
- QVBoxLayout *aCommandsLay = new QVBoxLayout(aCommandsWgt);
+ auto *aCommandsWgt = new QWidget(aControlsWgt);
+ auto *aCommandsLay = new QVBoxLayout(aCommandsWgt);
aCommandsLay->setContentsMargins(0, 0, 0, 0);
aCtrlLayout->addWidget(aCommandsWgt);
aCommandsLay->addWidget(myCommandsList);
// Middle buttons
- QWidget *aButtonsWgt = new QWidget(aControlsWgt);
- QVBoxLayout *aBtnLayout = new QVBoxLayout(aButtonsWgt);
+ auto *aButtonsWgt = new QWidget(aControlsWgt);
+ auto *aBtnLayout = new QVBoxLayout(aButtonsWgt);
aBtnLayout->setContentsMargins(0, 0, 0, 0);
aCtrlLayout->addWidget(aButtonsWgt);
aBtnLayout->addStretch(1);
- QPushButton *aAddButton =
+ auto *aAddButton =
new QPushButton(QIcon(":pictures/arrow-right.png"), "", aButtonsWgt);
connect(aAddButton, SIGNAL(clicked(bool)), SLOT(onAddItem()));
aBtnLayout->addWidget(aAddButton);
aBtnLayout->addSpacing(20);
- QPushButton *aDelButton =
+ auto *aDelButton =
new QPushButton(QIcon(":pictures/arrow-left.png"), "", aButtonsWgt);
connect(aDelButton, SIGNAL(clicked(bool)), SLOT(onDelItem()));
aBtnLayout->addWidget(aDelButton);
aBtnLayout->addStretch(1);
// Right list
- QWidget *aItemsWgt = new QWidget(aControlsWgt);
- QVBoxLayout *aItemsLay = new QVBoxLayout(aItemsWgt);
+ auto *aItemsWgt = new QWidget(aControlsWgt);
+ auto *aItemsLay = new QVBoxLayout(aItemsWgt);
aItemsLay->setContentsMargins(0, 0, 0, 0);
aCtrlLayout->addWidget(aItemsWgt);
aItemsLay->addWidget(myItemsList);
// Buttons of right list
- QWidget *aBtnWgt = new QWidget(aControlsWgt);
- QVBoxLayout *aBtnLay = new QVBoxLayout(aBtnWgt);
+ auto *aBtnWgt = new QWidget(aControlsWgt);
+ auto *aBtnLay = new QVBoxLayout(aBtnWgt);
aBtnLay->setContentsMargins(0, 0, 0, 0);
aCtrlLayout->addWidget(aBtnWgt);
aBtnLay->addStretch(1);
- QPushButton *aUpButton =
+ auto *aUpButton =
new QPushButton(QIcon(":pictures/arrow-up.png"), "", aBtnWgt);
connect(aUpButton, SIGNAL(clicked(bool)), SLOT(onUp()));
aBtnLay->addWidget(aUpButton);
aBtnLay->addSpacing(20);
- QPushButton *aDownButton =
+ auto *aDownButton =
new QPushButton(QIcon(":pictures/arrow-down.png"), "", aBtnWgt);
connect(aDownButton, SIGNAL(clicked(bool)), SLOT(onDown()));
aBtnLay->addWidget(aDownButton);
aBtnLay->addStretch(1);
// Buttons part of the dialog
- QDialogButtonBox *aButtons = new QDialogButtonBox(
+ auto *aButtons = new QDialogButtonBox(
QDialogButtonBox::Help | QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
Qt::Horizontal, this);
aMailLayout->addWidget(aButtons);
void SHAPERGUI_ToolbarItemsDlg::onAddItem() {
QList<QListWidgetItem *> aCurrentList = myCommandsList->selectedItems();
if (aCurrentList.size() > 0) {
- SHAPERGUI_CommandIdItem *aItem =
- dynamic_cast<SHAPERGUI_CommandIdItem *>(aCurrentList.first());
+ auto *aItem = dynamic_cast<SHAPERGUI_CommandIdItem *>(aCurrentList.first());
int aId = aItem->id();
if (aId != -1) {
myCommandsList->removeItemWidget(aItem);
delete aItem;
}
QModelIndex aIdx = myItemsList->currentIndex();
- aItem = new SHAPERGUI_CommandIdItem(0, aId, myModule);
+ aItem = new SHAPERGUI_CommandIdItem(nullptr, aId, myModule);
if (aIdx.isValid()) {
int aRow = aIdx.row();
myItemsList->insertItem(aRow, aItem);
void SHAPERGUI_ToolbarItemsDlg::onDelItem() {
QList<QListWidgetItem *> aCurrentList = myItemsList->selectedItems();
if (aCurrentList.size() > 0) {
- SHAPERGUI_CommandIdItem *aItem =
- dynamic_cast<SHAPERGUI_CommandIdItem *>(aCurrentList.first());
+ auto *aItem = dynamic_cast<SHAPERGUI_CommandIdItem *>(aCurrentList.first());
int aId = aItem->id();
myItemsList->removeItemWidget(aItem);
delete aItem;
bool SHAPERGUI_ToolbarItemsDlg::eventFilter(QObject *theObj, QEvent *theEvent) {
if (theEvent->type() == QEvent::MouseButtonRelease) {
- QMouseEvent *aMouseEvent = (QMouseEvent *)theEvent;
+ auto *aMouseEvent = (QMouseEvent *)theEvent;
QModelIndex aIdx = myItemsList->indexAt(aMouseEvent->pos());
if (!aIdx.isValid() || aMouseEvent->button() == Qt::RightButton) {
myItemsList->setCurrentIndex(QModelIndex());
QIntList SHAPERGUI_ToolbarItemsDlg::getItems(QListWidget *theWidget,
int theStart) const {
QIntList aList;
- SHAPERGUI_CommandIdItem *aItem = 0;
+ SHAPERGUI_CommandIdItem *aItem = nullptr;
int aNb = theWidget->count();
for (int i = theStart; i < aNb; i++) {
aItem = (SHAPERGUI_CommandIdItem *)theWidget->item(i);
/// An redifinition of a virtual function
/// \param theObj an object
/// \param theEvent an event
- virtual bool eventFilter(QObject *theObj, QEvent *theEvent);
+ bool eventFilter(QObject *theObj, QEvent *theEvent) override;
private slots:
/// A slot for button to add an item to toolbar commands
#include <iostream>
-int main(int argc, char *argv[]) {
+int main(int /*argc*/, char * /*argv*/[]) {
constexpr char GUI_ROOT_DIR[] = "GUI_ROOT_DIR";
constexpr char SHAPER_ROOT_DIR[] = "SHAPER_ROOT_DIR";
constexpr char LIGHTAPPCONFIG[] = "LightAppConfig";
/// Request for initialization of data model of the object: adding all
/// attributes
- virtual void initAttributes();
+ void initAttributes() override;
/// Returns the unique kind of a feature
- virtual const std::string &getKind() {
+ const std::string &getKind() override {
static std::string MY_KIND = SamplePanelPlugin_Feature::ID();
return MY_KIND;
};
/// Computes or recomputes the results
- virtual void execute() {}
+ void execute() override {}
/// Use plugin manager for features creation
SamplePanelPlugin_Feature();
};
-typedef std::shared_ptr<SamplePanelPlugin_Feature> SamplePanelFeaturePtr;
+using SamplePanelFeaturePtr = std::shared_ptr<SamplePanelPlugin_Feature>;
#endif
SamplePanelPlugin_ModelWidget::SamplePanelPlugin_ModelWidget(
QWidget *theParent, const Config_WidgetAPI *theData)
: ModuleBase_ModelWidget(theParent, theData), myDefaultValue(0) {
- QVBoxLayout *aLay = new QVBoxLayout(this);
+ auto *aLay = new QVBoxLayout(this);
aLay->setContentsMargins(0, 0, 0, 0);
myMainWidget = new QWidget(this);
aLay->addWidget(myMainWidget);
- QGridLayout *aLayout = new QGridLayout(myMainWidget);
+ auto *aLayout = new QGridLayout(myMainWidget);
aLayout->addWidget(new QLabel(tr("Values:")), 0, 0);
myComboBox = new QComboBox(myMainWidget);
SamplePanelPlugin_ModelWidget(QWidget *theParent,
const Config_WidgetAPI *theData);
/// Destructs the model widget
- virtual ~SamplePanelPlugin_ModelWidget() {}
+ ~SamplePanelPlugin_ModelWidget() override = default;
/// Returns list of widget controls
/// \return a control list
- virtual QList<QWidget *> getControls() const;
+ QList<QWidget *> getControls() const override;
protected:
/// Saves the internal parameters to the given feature
/// \return True in success
- virtual bool storeValueCustom();
+ bool storeValueCustom() override;
/// Restore value from attribute data to the widget's control
- virtual bool restoreValueCustom();
+ bool restoreValueCustom() override;
private:
QWidget *myMainWidget; // parent control for all widget controls
SamplePanelPlugin_ModelWidgetCreator::createWidgetByType(
const std::string &theType, QWidget *theParent,
Config_WidgetAPI *theWidgetApi, ModuleBase_IWorkshop * /*theWorkshop*/) {
- ModuleBase_ModelWidget *aModelWidget = 0;
+ ModuleBase_ModelWidget *aModelWidget = nullptr;
if (myModelWidgetTypes.find(theType) == myModelWidgetTypes.end())
return aModelWidget;
SamplePanelPlugin_ModelWidgetCreator();
/// Virtual destructor
- ~SamplePanelPlugin_ModelWidgetCreator() {}
+ ~SamplePanelPlugin_ModelWidgetCreator() = default;
/// Returns a container of possible widget types, which this creator can
/// process \param a list of type names
- virtual void widgetTypes(std::set<std::string> &theTypes);
+ void widgetTypes(std::set<std::string> &theTypes) override;
/// Create widget by its type
/// The default implementation is empty
/// \param theData a low-level API for reading xml definitions of widgets
/// \param theWorkshop a current workshop
/// \return a created model widget or null
- virtual ModuleBase_ModelWidget *
+ ModuleBase_ModelWidget *
createWidgetByType(const std::string &theType, QWidget *theParent,
Config_WidgetAPI *theWidgetApi,
- ModuleBase_IWorkshop * /*theWorkshop*/);
+ ModuleBase_IWorkshop * /*theWorkshop*/) override;
private:
std::set<std::string> myModelWidgetTypes; /// types of widgets
SamplePanelPlugin_Panel::SamplePanelPlugin_Panel(QWidget *theParent)
: QWidget(theParent), myDefaultValue(0) {
- QGridLayout *aLayout = new QGridLayout(this);
+ auto *aLayout = new QGridLayout(this);
aLayout->addWidget(new QLabel(tr("Values:")), 0, 0);
myComboBox = new QComboBox(this);
/// Constructs a panel page
SamplePanelPlugin_Panel(QWidget *theParent);
/// Destructs the page
- virtual ~SamplePanelPlugin_Panel() {}
+ ~SamplePanelPlugin_Panel() override = default;
/// Fill the panel by the feature
/// \param theFeature a feature to fill the panel controls
class SamplePanelPlugin_Plugin : public ModelAPI_Plugin {
public:
/// Creates the feature object of this plugin by the feature string ID
- virtual FeaturePtr createFeature(std::string theFeatureID);
+ FeaturePtr createFeature(std::string theFeatureID) override;
public:
SamplePanelPlugin_Plugin();
QWidget *SamplePanelPlugin_WidgetCreator::createPanelByType(
const std::string &theType, QWidget *theParent,
const FeaturePtr &theFeature) {
- QWidget *aWidget = 0;
+ QWidget *aWidget = nullptr;
if (myPanelTypes.find(theType) == myPanelTypes.end())
return aWidget;
if (theType == "QtPanel") {
- SamplePanelPlugin_Panel *aPanel = new SamplePanelPlugin_Panel(theParent);
+ auto *aPanel = new SamplePanelPlugin_Panel(theParent);
aPanel->setFeature(theFeature);
aWidget = aPanel;
}
SamplePanelPlugin_WidgetCreator();
/// Virtual destructor
- ~SamplePanelPlugin_WidgetCreator() {}
+ ~SamplePanelPlugin_WidgetCreator() = default;
/// Returns a container of possible page types, which this creator can process
/// \param theTypes a list of type names
- virtual void panelTypes(std::set<std::string> &theTypes);
+ void panelTypes(std::set<std::string> &theTypes) override;
/// Create panel control by its type.
/// \param theType a panel type
const TDF_Label theAccess, const TDF_Label theBaseDocument,
const bool theGeometricalNaming, const bool theUseNeighbors,
const bool theUseIntersections, const bool theAlwaysGeometricalNaming) {
- Selector_Algo *aResult = NULL;
+ Selector_Algo *aResult = nullptr;
if (theValue.IsNull() || theContext.IsNull())
return aResult;
if (aSelectionType == TopAbs_COMPOUND ||
aSelectionType == TopAbs_COMPSOLID || aSelectionType == TopAbs_SHELL ||
aSelectionType == TopAbs_WIRE) {
- Selector_Container *aContainer = new Selector_Container;
+ auto *aContainer = new Selector_Container;
SET_ALGO_FLAGS(aContainer);
if (aContainer->select(theContext, theValue))
return aContainer;
delete aContainer;
- return NULL;
+ return nullptr;
}
- Selector_Intersect *anIntersect = new Selector_Intersect;
+ auto *anIntersect = new Selector_Intersect;
SET_ALGO_FLAGS(anIntersect);
bool aGoodIntersector = anIntersect->select(theContext, theValue);
// weak intersector is bad for not use neighbors and has lower priority than
}
if (!theUseNeighbors) {
delete anIntersect;
- return NULL;
+ return nullptr;
}
// searching by neighbors
- Selector_FilterByNeighbors *aNBs = new Selector_FilterByNeighbors;
+ auto *aNBs = new Selector_FilterByNeighbors;
SET_ALGO_FLAGS(aNBs);
// searching a context lab to store in NB algorithm
TDF_Label aContextLab = findGoodLabelWithShape(theAccess, theContext);
// pure weak naming: there is no sense to use pure weak naming for neighbors
// selection
if (theUseNeighbors) {
- Selector_WeakName *aWeak = new Selector_WeakName;
+ auto *aWeak = new Selector_WeakName;
SET_ALGO_FLAGS(aWeak);
if (aWeak->select(theContext, theValue)) {
return aWeak;
}
delete aWeak;
}
- return NULL; // not found value in the tree, not found context shape in the
- // tree also
+ return nullptr; // not found value in the tree, not found context shape in
+ // the tree also
}
// getting label of this operation to avoid usage of ready shapes of this
TDF_Label aMyOpLab = theAccess;
}
if (!aPrimitiveNS.IsNull()) {
- Selector_Primitive *aPrimitive = new Selector_Primitive;
+ auto *aPrimitive = new Selector_Primitive;
SET_ALGO_FLAGS(aPrimitive);
aPrimitive->select(aPrimitiveNS->Label());
return aPrimitive;
} else {
- Selector_Modify *aModify = new Selector_Modify;
+ auto *aModify = new Selector_Modify;
SET_ALGO_FLAGS(aModify);
bool aGoodModify = aModify->select(aModifList, theContext, theValue);
// weak intersector is bad for not use neighbors and has lower priority than
}
if (!theUseNeighbors) {
delete aModify;
- return NULL;
+ return nullptr;
}
// searching by neighbors
- Selector_FilterByNeighbors *aNBs = new Selector_FilterByNeighbors;
+ auto *aNBs = new Selector_FilterByNeighbors;
SET_ALGO_FLAGS(aNBs);
// searching a context lab to store in NB algorithm
TDF_Label aContextLab = findGoodLabelWithShape(theAccess, theContext);
delete aModify;
}
- return NULL; // invalid case
+ return nullptr; // invalid case
}
Selector_Algo *
TDF_Label theBaseDocLab) {
Handle(TDataStd_Integer) aTypeAttr;
if (!theLab.FindAttribute(kSEL_TYPE, aTypeAttr))
- return NULL;
- Selector_Type aType = Selector_Type(aTypeAttr->Get());
- Selector_Algo *aResult = NULL;
+ return nullptr;
+ auto aType = Selector_Type(aTypeAttr->Get());
+ Selector_Algo *aResult = nullptr;
switch (aType) {
case SELTYPE_CONTAINER: {
aResult = new Selector_Container;
aResult->myGeometricalNaming = theLab.IsAttribute(kGEOMETRICAL_NAMING);
if (!aResult->restore()) {
delete aResult;
- aResult = NULL;
+ aResult = nullptr;
}
}
return aResult;
TDF_Label theLab, TDF_Label theBaseDocLab, std::wstring theName,
const TopAbs_ShapeEnum theShapeType, const bool theGeomNaming,
Selector_NameGenerator *theNameGenerator, TDF_Label &theContextLab) {
- Selector_Algo *aResult = NULL;
+ Selector_Algo *aResult = nullptr;
if (theName[0] == L'[') { // intersection or container
switch (theShapeType) {
case TopAbs_COMPOUND:
aResult->restoreByName(theName, theShapeType, theNameGenerator);
if (theContextLab.IsNull()) {
delete aResult;
- aResult = NULL;
+ aResult = nullptr;
}
}
return aResult;
Selector_AlgoWithSubs::Selector_AlgoWithSubs() : Selector_Algo() {}
void Selector_AlgoWithSubs::clearSubAlgos() {
- std::list<Selector_Algo *>::iterator anAlgo = mySubSelList.begin();
+ auto anAlgo = mySubSelList.begin();
for (; anAlgo != mySubSelList.end(); anAlgo++) {
delete *anAlgo;
}
/// Initializes selector
Selector_AlgoWithSubs();
/// Destructor
- virtual ~Selector_AlgoWithSubs();
+ ~Selector_AlgoWithSubs() override;
/// Erases the sub-algorithms stored
void clearSubAlgos();
/// Returns the next label for a new sub-selector created
storeType(Selector_Algo::SELTYPE_CONTAINER);
// store all sub-selectors
TDataStd_Integer::Set(label(), shapeTypeID(), (int)myShapeType);
- std::list<Selector_Algo *>::const_iterator aSubSel = list().cbegin();
+ auto aSubSel = list().cbegin();
for (; aSubSel != list().cend(); aSubSel++) {
(*aSubSel)->store();
}
break;
}
TopoDS_ListOfShape aSubSelectorShapes;
- std::list<Selector_Algo *>::const_iterator aSubSel = list().cbegin();
+ auto aSubSel = list().cbegin();
for (; aSubSel != list().cend(); aSubSel++) {
if (!(*aSubSel)->solve(theContext)) {
return false;
Selector_Container::name(Selector_NameGenerator *theNameGenerator) {
std::wstring aResult;
// add names of sub-components one by one in "[]"
- std::list<Selector_Algo *>::const_iterator aSubSel = list().cbegin();
+ auto aSubSel = list().cbegin();
for (; aSubSel != list().cend(); aSubSel++) {
aResult += '[';
aResult += (*aSubSel)->name(theNameGenerator);
const TopoDS_Shape theValue);
/// Stores the name to the label and sub-labels tree
- SELECTOR_EXPORT virtual void store() override;
+ SELECTOR_EXPORT void store() override;
/// Restores the selected shape by the topological naming kept in the data
/// structure Returns true if it can restore structure correctly
- SELECTOR_EXPORT virtual bool restore() override;
+ SELECTOR_EXPORT bool restore() override;
/// Restores the selected shape by the topological name string.
/// Returns not empty label of the context.
- SELECTOR_EXPORT virtual TDF_Label
+ SELECTOR_EXPORT TDF_Label
restoreByName(std::wstring theName, const TopAbs_ShapeEnum theShapeType,
Selector_NameGenerator *theNameGenerator) override;
/// Updates the current shape by the stored topological name
- SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape &theContext) override;
+ SELECTOR_EXPORT bool solve(const TopoDS_Shape &theContext) override;
/// Returns the naming name of the selection
- SELECTOR_EXPORT virtual std::wstring
+ SELECTOR_EXPORT std::wstring
name(Selector_NameGenerator *theNameGenerator) override;
private:
const bool theGeometrical) {
// searching for neighbors with minimum level
int aMinLevel = 0;
- std::list<std::pair<TopoDS_Shape, int>>::const_iterator aNBIter =
- theNB.cbegin();
+ auto aNBIter = theNB.cbegin();
for (; aNBIter != theNB.cend(); aNBIter++) {
if (aMinLevel == 0 || aNBIter->second < aMinLevel) {
aMinLevel = aNBIter->second;
}
TopoDS_Shape aResult = findNeighbor(theContext, aNBs, geometricalNaming());
if (!aResult.IsNull() && aResult.IsSame(theValue)) {
- std::list<std::pair<TopoDS_Shape, int>>::iterator aNBIter = aNBs.begin();
+ auto aNBIter = aNBs.begin();
for (; aNBIter != aNBs.end(); aNBIter++) {
Selector_Algo *aSubAlgo = Selector_Algo::select(
theContext, aNBIter->first, newSubLabel(), baseDocument(),
// store numbers of levels corresponded to the neighbors in sub-selectors
Handle(TDataStd_IntegerArray) anArray = TDataStd_IntegerArray::Set(
label(), kLEVELS_ARRAY, 0, int(myNBLevel.size()) - 1);
- std::list<int>::iterator aLevel = myNBLevel.begin();
+ auto aLevel = myNBLevel.begin();
for (int anIndex = 0; aLevel != myNBLevel.end(); aLevel++, anIndex++) {
anArray->SetValue(anIndex, Abs(*aLevel));
}
// store all sub-selectors
- std::list<Selector_Algo *>::const_iterator aSubSel = list().cbegin();
+ auto aSubSel = list().cbegin();
for (; aSubSel != list().cend(); aSubSel++) {
(*aSubSel)->store();
}
// some selector fails, try to use rest selectors, myNBLevel becomes
// negative: unused
if (myNBLevel.size() > list().size()) {
- std::list<int>::iterator aListIter = myNBLevel.begin();
+ auto aListIter = myNBLevel.begin();
for (size_t a = 0; a < list().size(); a++)
aListIter++;
*aListIter = -*aListIter;
- list().push_back(NULL);
+ list().push_back(nullptr);
}
}
}
std::list<std::pair<TopoDS_Shape, int>>
aNBs; /// neighbor sub-shape -> level of neighborhood
- std::list<int>::iterator aLevel = myNBLevel.begin();
- std::list<Selector_Algo *>::const_iterator aSubSel = list().cbegin();
+ auto aLevel = myNBLevel.begin();
+ auto aSubSel = list().cbegin();
for (; aSubSel != list().cend(); aSubSel++, aLevel++) {
if (*aLevel < 0)
continue; // skip because sub-selector is not good
if (aThisContextNameNeeded)
aContextName = theNameGenerator->contextName(myContext);
std::wstring aResult;
- std::list<int>::iterator aLevel = myNBLevel.begin();
- std::list<Selector_Algo *>::const_iterator aSubSel = list().cbegin();
+ auto aLevel = myNBLevel.begin();
+ auto aSubSel = list().cbegin();
for (; aSubSel != list().cend(); aSubSel++, aLevel++) {
if (!*aSubSel)
continue;
const TopoDS_Shape theValue);
/// Stores the name to the label and sub-labels tree
- SELECTOR_EXPORT virtual void store() override;
+ SELECTOR_EXPORT void store() override;
/// Restores the selected shape by the topological naming kept in the data
/// structure Returns true if it can restore structure correctly
- SELECTOR_EXPORT virtual bool restore() override;
+ SELECTOR_EXPORT bool restore() override;
/// Restores the selected shape by the topological name string.
/// Returns not empty label of the context.
- SELECTOR_EXPORT virtual TDF_Label
+ SELECTOR_EXPORT TDF_Label
restoreByName(std::wstring theName, const TopAbs_ShapeEnum theShapeType,
Selector_NameGenerator *theNameGenerator) override;
/// Updates the current shape by the stored topological name
- SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape &theContext) override;
+ SELECTOR_EXPORT bool solve(const TopoDS_Shape &theContext) override;
/// Returns the naming name of the selection
- SELECTOR_EXPORT virtual std::wstring
+ SELECTOR_EXPORT std::wstring
name(Selector_NameGenerator *theNameGenerator) override;
private:
storeType(Selector_Algo::SELTYPE_INTERSECT);
// store all sub-selectors
TDataStd_Integer::Set(label(), shapeTypeID(), (int)myShapeType);
- std::list<Selector_Algo *>::const_iterator aSubSel = list().cbegin();
+ auto aSubSel = list().cbegin();
for (; aSubSel != list().cend(); aSubSel++) {
(*aSubSel)->store();
}
bool Selector_Intersect::solve(const TopoDS_Shape &theContext) {
TopoDS_Shape aResult;
TopoDS_ListOfShape aSubSelectorShapes;
- std::list<Selector_Algo *>::const_iterator aSubSel = list().cbegin();
+ auto aSubSel = list().cbegin();
for (; aSubSel != list().cend(); aSubSel++) {
if (!(*aSubSel)->solve(theContext)) {
return false;
Selector_Intersect::name(Selector_NameGenerator *theNameGenerator) {
std::wstring aResult;
// add names of sub-components one by one in "[]" +optionally [weak_name_1]
- std::list<Selector_Algo *>::const_iterator aSubSel = list().cbegin();
+ auto aSubSel = list().cbegin();
for (; aSubSel != list().cend(); aSubSel++) {
aResult += '[';
aResult += (*aSubSel)->name(theNameGenerator);
const TopoDS_Shape theValue);
/// Stores the name to the label and sub-labels tree
- SELECTOR_EXPORT virtual void store() override;
+ SELECTOR_EXPORT void store() override;
/// Restores the selected shape by the topological naming kept in the data
/// structure Returns true if it can restore structure correctly
- SELECTOR_EXPORT virtual bool restore() override;
+ SELECTOR_EXPORT bool restore() override;
/// Restores the selected shape by the topological name string.
/// Returns not empty label of the context.
- SELECTOR_EXPORT virtual TDF_Label
+ SELECTOR_EXPORT TDF_Label
restoreByName(std::wstring theName, const TopAbs_ShapeEnum theShapeType,
Selector_NameGenerator *theNameGenerator) override;
/// Updates the current shape by the stored topological name
- SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape &theContext) override;
+ SELECTOR_EXPORT bool solve(const TopoDS_Shape &theContext) override;
/// Returns the naming name of the selection
- SELECTOR_EXPORT virtual std::wstring
+ SELECTOR_EXPORT std::wstring
name(Selector_NameGenerator *theNameGenerator) override;
private:
return L"";
aResult += theNameGenerator->contextName(myFinal) + L"/";
aResult += Locale::Convert::toWString(aName->Get().ToExtString());
- for (TDF_LabelList::iterator aBase = myBases.begin(); aBase != myBases.end();
- aBase++) {
- if (!aBase->FindAttribute(TDataStd_Name::GetID(), aName))
+ for (auto &myBase : myBases) {
+ if (!myBase.FindAttribute(TDataStd_Name::GetID(), aName))
return L"";
aResult += L"&";
- aResult += theNameGenerator->contextName(*aBase) + L"/";
+ aResult += theNameGenerator->contextName(myBase) + L"/";
aResult += Locale::Convert::toWString(aName->Get().ToExtString());
}
if (myWeakIndex != -1) {
const TopoDS_Shape theContext, const TopoDS_Shape theValue);
/// Stores the name to the label and sub-labels tree
- SELECTOR_EXPORT virtual void store() override;
+ SELECTOR_EXPORT void store() override;
/// Restores the selected shape by the topological naming kept in the data
/// structure Returns true if it can restore structure correctly
- SELECTOR_EXPORT virtual bool restore() override;
+ SELECTOR_EXPORT bool restore() override;
/// Restores the selected shape by the topological name string.
/// Returns not empty label of the context.
- SELECTOR_EXPORT virtual TDF_Label
+ SELECTOR_EXPORT TDF_Label
restoreByName(std::wstring theName, const TopAbs_ShapeEnum theShapeType,
Selector_NameGenerator *theNameGenerator) override;
/// Updates the current shape by the stored topological name
- SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape &theContext) override;
+ SELECTOR_EXPORT bool solve(const TopoDS_Shape &theContext) override;
/// Returns the naming name of the selection
- SELECTOR_EXPORT virtual std::wstring
+ SELECTOR_EXPORT std::wstring
name(Selector_NameGenerator *theNameGenerator) override;
private:
const bool theOldOrder)
: myToBeReordered(theOldOrder) {
GeomShapePtr aShape = convertShape(theShape);
- GeomAPI_Shape::ShapeType aType = (GeomAPI_Shape::ShapeType)theType;
+ auto aType = (GeomAPI_Shape::ShapeType)theType;
mySorted = std::make_shared<GeomAlgoAPI_NExplode>(aShape, aType,
getOrder(theOldOrder));
}
#include <TopoDS_Compound.hxx>
Selector_Selector::Selector_Selector(TDF_Label theLab, TDF_Label theBaseDocLab)
- : myLab(theLab), myBaseDocumentLab(theBaseDocLab), myAlgo(NULL) {}
+ : myLab(theLab), myBaseDocumentLab(theBaseDocLab), myAlgo(nullptr) {}
Selector_Selector::~Selector_Selector() {
if (myAlgo)
myAlgo = Selector_Algo::select(theContext, theValue, myLab, myBaseDocumentLab,
theGeometricalNaming, true, true);
- return myAlgo != NULL;
+ return myAlgo != nullptr;
}
bool Selector_Selector::store(const TopoDS_Shape theContext) {
#include <TNaming_SameShapeIterator.hxx>
#include <TNaming_Tool.hxx>
-Selector_WeakName::Selector_WeakName()
- : Selector_Algo(), myRecomputeWeakIndex(false) {}
+Selector_WeakName::Selector_WeakName() : Selector_Algo() {}
bool Selector_WeakName::select(const TopoDS_Shape theContext,
const TopoDS_Shape theValue) {
class Selector_WeakName : public Selector_Algo {
TopAbs_ShapeEnum myShapeType; ///< type of this shape
int myWeakIndex; ///< weak index in case modification produces several shapes
- bool myRecomputeWeakIndex; ///< if the index is stored with old (unstable)
- ///< order, recompute it
- TDF_Label myContext; ///< context shape label
+ bool myRecomputeWeakIndex{false}; ///< if the index is stored with old
+ ///< (unstable) order, recompute it
+ TDF_Label myContext; ///< context shape label
public:
/// Initializes the selection of this kind
SELECTOR_EXPORT bool select(const TopoDS_Shape theContext,
const TopoDS_Shape theValue);
/// Stores the name to the label and sub-labels tree
- SELECTOR_EXPORT virtual void store() override;
+ SELECTOR_EXPORT void store() override;
/// Restores the selected shape by the topological naming kept in the data
/// structure Returns true if it can restore structure correctly
- SELECTOR_EXPORT virtual bool restore() override;
+ SELECTOR_EXPORT bool restore() override;
/// Restores the selected shape by the topological name string.
/// Returns not empty label of the context.
- SELECTOR_EXPORT virtual TDF_Label
+ SELECTOR_EXPORT TDF_Label
restoreByName(std::wstring theName, const TopAbs_ShapeEnum theShapeType,
Selector_NameGenerator *theNameGenerator) override;
/// Updates the current shape by the stored topological name
- SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape &theContext) override;
+ SELECTOR_EXPORT bool solve(const TopoDS_Shape &theContext) override;
/// Returns the naming name of the selection
- SELECTOR_EXPORT virtual std::wstring
+ SELECTOR_EXPORT std::wstring
name(Selector_NameGenerator *theNameGenerator) override;
private:
}
//================================================================================================
-SketchAPI_Arc::~SketchAPI_Arc() {}
+SketchAPI_Arc::~SketchAPI_Arc() = default;
//================================================================================================
void SketchAPI_Arc::setByCenterStartEnd(double theCenterX, double theCenterY,
/// Destructor.
SKETCHAPI_EXPORT
- virtual ~SketchAPI_Arc();
+ ~SketchAPI_Arc() override;
INTERFACE_7(SketchPlugin_Arc::ID(), center, SketchPlugin_Arc::CENTER_ID(),
GeomDataAPI_Point2D, /** Center point */, startPoint,
/// Dump wrapped feature
SKETCHAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on Arc object.
-typedef std::shared_ptr<SketchAPI_Arc> ArcPtr;
+using ArcPtr = std::shared_ptr<SketchAPI_Arc>;
#endif // SketchAPI_Arc_H_
initialize();
}
-SketchAPI_BSpline::~SketchAPI_BSpline() {}
+SketchAPI_BSpline::~SketchAPI_BSpline() = default;
void SketchAPI_BSpline::setByDegreePolesAndWeights(
const ModelHighAPI_Integer &theDegree,
static CompositeFeaturePtr sketchForFeature(FeaturePtr theFeature) {
const std::set<AttributePtr> &aRefs = theFeature->data()->refsToMe();
- for (std::set<AttributePtr>::const_iterator anIt = aRefs.begin();
- anIt != aRefs.end(); ++anIt)
- if ((*anIt)->id() == SketchPlugin_Sketch::FEATURES_ID())
+ for (const auto &aRef : aRefs)
+ if (aRef->id() == SketchPlugin_Sketch::FEATURES_ID())
return std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(
- (*anIt)->owner());
+ aRef->owner());
return CompositeFeaturePtr();
}
static void toMapOfAuxIndices(const std::list<int> &theRegular,
const std::list<int> &theAuxiliary,
std::map<int, bool> &theIndices) {
- for (auto it = theRegular.begin(); it != theRegular.end(); ++it)
- theIndices[*it] = false;
- for (auto it = theAuxiliary.begin(); it != theAuxiliary.end(); ++it)
- theIndices[*it] = true;
+ for (int it : theRegular)
+ theIndices[it] = false;
+ for (int it : theAuxiliary)
+ theIndices[it] = true;
}
std::list<std::shared_ptr<SketchAPI_SketchEntity>>
CompositeFeaturePtr aSketch = sketchForFeature(aBSpline);
AttributePoint2DArrayPtr aPoles = poles();
- for (auto it = anAux.begin(); it != anAux.end(); ++it)
- createPole(aSketch, aBSpline, aPoles, it->first, it->second, anEntities);
+ for (auto &it : anAux)
+ createPole(aSketch, aBSpline, aPoles, it.first, it.second, anEntities);
return SketchAPI_SketchEntity::wrap(anEntities);
}
CompositeFeaturePtr aSketch = sketchForFeature(aBSpline);
AttributePoint2DArrayPtr aPoles = poles();
- for (auto it = anAux.begin(); it != anAux.end(); ++it)
- createSegment(aSketch, aBSpline, aPoles, it->first, it->second, anEntities);
+ for (auto &it : anAux)
+ createSegment(aSketch, aBSpline, aPoles, it.first, it.second, anEntities);
return SketchAPI_SketchEntity::wrap(anEntities);
}
std::shared_ptr<GeomAPI_BSpline2d> aBSplineCurve;
try {
std::list<double> aWeights;
- for (std::list<ModelHighAPI_Double>::const_iterator it = theWeights.begin();
- it != theWeights.end(); ++it)
- aWeights.push_back(it->value());
+ for (const auto &theWeight : theWeights)
+ aWeights.push_back(theWeight.value());
bool isPeriodic =
feature()->getKind() == SketchPlugin_BSplinePeriodic::ID();
isDefaultKnotsMults = aKnotsAttr->size() == (int)aKnots.size() &&
aMultsAttr->size() == (int)aMults.size();
if (isDefaultKnotsMults) {
- std::list<ModelHighAPI_Double>::iterator anIt = aKnots.begin();
+ auto anIt = aKnots.begin();
for (int anIndex = 0; isDefaultKnotsMults && anIt != aKnots.end();
++anIt, ++anIndex)
isDefaultKnotsMults =
fabs(anIt->value() - aKnotsAttr->value(anIndex)) < TOLERANCE;
}
if (isDefaultKnotsMults) {
- std::list<ModelHighAPI_Integer>::iterator anIt = aMults.begin();
+ auto anIt = aMults.begin();
for (int anIndex = 0; isDefaultKnotsMults && anIt != aMults.end();
++anIt, ++anIndex)
isDefaultKnotsMults = anIt->intValue() == aMultsAttr->value(anIndex);
std::map<int, FeaturePtr> &thePoints,
std::map<int, FeaturePtr> &theSegments) {
const std::set<AttributePtr> &aRefs = theBSpline->data()->refsToMe();
- for (std::set<AttributePtr>::const_iterator aRefIt = aRefs.begin();
- aRefIt != aRefs.end(); ++aRefIt) {
- FeaturePtr anOwner = ModelAPI_Feature::feature((*aRefIt)->owner());
+ for (const auto &aRef : aRefs) {
+ FeaturePtr anOwner = ModelAPI_Feature::feature(aRef->owner());
if (anOwner->getKind() ==
SketchPlugin_ConstraintCoincidenceInternal::ID()) {
// process internal constraints only
const std::string &theAttrName,
const std::set<int> &theIndices) {
theDumper << theAttrName << " = [";
- std::set<int>::const_iterator it = theIndices.begin();
+ auto it = theIndices.begin();
theDumper << *it;
for (++it; it != theIndices.end(); ++it)
theDumper << ", " << *it;
bool isFirst = true;
// dump features and split them to auxiliary and regular
std::set<int> aRegular, anAuxiliary;
- for (std::map<int, FeaturePtr>::const_iterator it = theAuxFeatures.begin();
- it != theAuxFeatures.end(); ++it) {
+ for (const auto &theAuxFeature : theAuxFeatures) {
if (!isFirst)
theDumper << ", ";
- theDumper << theDumper.name(it->second, false);
- theDumper.doNotDumpFeature(it->second);
+ theDumper << theDumper.name(theAuxFeature.second, false);
+ theDumper.doNotDumpFeature(theAuxFeature.second);
isFirst = false;
- if (it->second->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->value())
- anAuxiliary.insert(it->first);
+ if (theAuxFeature.second->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())
+ ->value())
+ anAuxiliary.insert(theAuxFeature.first);
else
- aRegular.insert(it->first);
+ aRegular.insert(theAuxFeature.first);
}
theDumper << "] = " << theDumper.name(theBSpline) << "." << theMethod << "(";
if (!aRegular.empty()) {
// update coordinates of points of control polygon
std::map<int, FeaturePtr> aPoints, aLines;
collectAuxiliaryFeatures(feature(), aPoints, aLines);
- std::map<int, FeaturePtr>::iterator aFound = aPoints.find(anIndex);
+ auto aFound = aPoints.find(anIndex);
if (aFound != aPoints.end())
setCoordinates(aFound->second, SketchPlugin_Point::COORD_ID(),
theCoordinates);
/// Destructor.
SKETCHAPI_EXPORT
- virtual ~SketchAPI_BSpline();
+ ~SketchAPI_BSpline() override;
INTERFACE_8(
SketchPlugin_BSpline::ID(), poles, SketchPlugin_BSplineBase::POLES_ID(),
/// Dump wrapped feature
SKETCHAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
protected:
SketchAPI_BSpline(const std::shared_ptr<ModelAPI_Feature> &theFeature,
};
/// Pointer on B-spline object.
-typedef std::shared_ptr<SketchAPI_BSpline> BSplinePtr;
+using BSplinePtr = std::shared_ptr<SketchAPI_BSpline>;
/// \class SketchAPI_BSplinePeriodic
/// \ingroup CPPHighAPI
/// Destructor.
SKETCHAPI_EXPORT
- virtual ~SketchAPI_BSplinePeriodic() {}
+ ~SketchAPI_BSplinePeriodic() override = default;
static std::string ID() { return SketchPlugin_BSplinePeriodic::ID(); }
- virtual std::string getID() { return SketchPlugin_BSplinePeriodic::ID(); }
+ std::string getID() override { return SketchPlugin_BSplinePeriodic::ID(); }
};
#endif // SketchAPI_BSpline_H_
}
//==================================================================================================
-SketchAPI_Circle::~SketchAPI_Circle() {}
+SketchAPI_Circle::~SketchAPI_Circle() = default;
//==================================================================================================
void SketchAPI_Circle::setByCenterAndRadius(double theCenterX,
/// Destructor.
SKETCHAPI_EXPORT
- virtual ~SketchAPI_Circle();
+ ~SketchAPI_Circle() override;
INTERFACE_3(SketchPlugin_Circle::ID(), center,
SketchPlugin_Circle::CENTER_ID(), GeomDataAPI_Point2D,
/// Dump wrapped feature
SKETCHAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on Circle object.
-typedef std::shared_ptr<SketchAPI_Circle> CirclePtr;
+using CirclePtr = std::shared_ptr<SketchAPI_Circle>;
#endif // SketchAPI_Circle_H_
initialize();
}
-SketchAPI_Constraint::~SketchAPI_Constraint() {}
+SketchAPI_Constraint::~SketchAPI_Constraint() = default;
bool SketchAPI_Constraint::initialize() {
if (!feature()) {
return;
AttributeSelectionPtr aAttr =
aFeature->data()->selection(SketchPlugin_SketchEntity::EXTERNAL_ID());
- if (aAttr && aAttr->context().get() != NULL && !aAttr->isInvalid())
+ if (aAttr && aAttr->context().get() != nullptr && !aAttr->isInvalid())
return;
}
/// Destructor
SKETCHAPI_EXPORT
- virtual ~SketchAPI_Constraint();
+ ~SketchAPI_Constraint() override;
static std::string ID() {
static const std::string MY_SKETCH_CONSTRAINT_ID = "SketchConstraint";
/// Dump wrapped feature
SKETCHAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
protected:
// Check all attributes of constraint are already dumped.
static const std::string MY_SKETCH_CONSTRAINT_ID = "SketchConstraintAngle";
return MY_SKETCH_CONSTRAINT_ID;
}
- virtual std::string getID() { return ID(); }
+ std::string getID() override { return ID(); }
/// Dump wrapped feature
SKETCHAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
#endif
}
}
-SketchAPI_Ellipse::~SketchAPI_Ellipse() {}
+SketchAPI_Ellipse::~SketchAPI_Ellipse() = default;
void SketchAPI_Ellipse::setByCenterFocusAndRadius(double theCenterX,
double theCenterY,
static CompositeFeaturePtr sketchForFeature(FeaturePtr theFeature) {
const std::set<AttributePtr> &aRefs = theFeature->data()->refsToMe();
- for (std::set<AttributePtr>::const_iterator anIt = aRefs.begin();
- anIt != aRefs.end(); ++anIt)
- if ((*anIt)->id() == SketchPlugin_Sketch::FEATURES_ID())
+ for (const auto &aRef : aRefs)
+ if (aRef->id() == SketchPlugin_Sketch::FEATURES_ID())
return std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(
- (*anIt)->owner());
+ aRef->owner());
return CompositeFeaturePtr();
}
CompositeFeaturePtr aSketch = sketchForFeature(theEllipse);
std::list<FeaturePtr> anEntities;
- std::list<PairOfStrings>::const_iterator anAttrIt = theAttributes.begin();
+ auto anAttrIt = theAttributes.begin();
createPoint(aSketch, theEllipse, (anAttrIt++)->first, theCenter, anEntities);
createPoint(aSketch, theEllipse, (anAttrIt++)->first, theFirstFocus,
anEntities);
const std::pair<std::string, std::string> &theMinorAxis,
std::map<std::string, FeaturePtr> &theAttrToFeature) {
const std::set<AttributePtr> &aRefs = theEllipse->data()->refsToMe();
- for (std::set<AttributePtr>::const_iterator aRefIt = aRefs.begin();
- aRefIt != aRefs.end(); ++aRefIt) {
- FeaturePtr anOwner = ModelAPI_Feature::feature((*aRefIt)->owner());
+ for (const auto &aRef : aRefs) {
+ FeaturePtr anOwner = ModelAPI_Feature::feature(aRef->owner());
if (anOwner->getKind() ==
SketchPlugin_ConstraintCoincidenceInternal::ID()) {
// process internal constraints only
theDumper << "[";
bool isFirst = true;
- for (std::list<PairOfStrings>::iterator anIt = anAttributes.begin();
- anIt != anAttributes.end(); ++anIt) {
- std::map<std::string, FeaturePtr>::const_iterator aFound =
- theAuxFeatures.find(anIt->first);
+ for (auto &anAttribute : anAttributes) {
+ auto aFound = theAuxFeatures.find(anAttribute.first);
if (aFound == theAuxFeatures.end())
continue;
if (!isFirst)
}
theDumper << "] = " << theDumper.name(theEllipse) << ".construction(";
isFirst = true;
- for (std::list<PairOfStrings>::iterator anIt = anAttributes.begin();
- anIt != anAttributes.end(); ++anIt) {
- std::map<std::string, FeaturePtr>::const_iterator aFound =
- theAuxFeatures.find(anIt->first);
+ for (auto &anAttribute : anAttributes) {
+ auto aFound = theAuxFeatures.find(anAttribute.first);
if (aFound == theAuxFeatures.end())
continue;
if (!isFirst)
theDumper << ", ";
isFirst = false;
- theDumper << anIt->second << " = \"";
+ theDumper << anAttribute.second << " = \"";
if (aFound->second->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())
->value())
theDumper << AUXILIARY_VALUE;
class ModelHighAPI_Selection;
-typedef std::pair<std::string, std::string> PairOfStrings;
+using PairOfStrings = std::pair<std::string, std::string>;
/// \class SketchAPI_Ellipse
/// \ingroup CPPHighAPI
/// Destructor.
SKETCHAPI_EXPORT
- virtual ~SketchAPI_Ellipse();
+ ~SketchAPI_Ellipse() override;
INTERFACE_10(SketchPlugin_Ellipse::ID(), center,
SketchPlugin_Ellipse::CENTER_ID(), GeomDataAPI_Point2D,
/// Dump wrapped feature
SKETCHAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
private:
/// Find all features connected with theEllipse by the internal coincidence.
};
/// Pointer on Ellipse object.
-typedef std::shared_ptr<SketchAPI_Ellipse> EllipsePtr;
+using EllipsePtr = std::shared_ptr<SketchAPI_Ellipse>;
#endif // SketchPlugin_Ellipse_H_
}
}
-SketchAPI_EllipticArc::~SketchAPI_EllipticArc() {}
+SketchAPI_EllipticArc::~SketchAPI_EllipticArc() = default;
void SketchAPI_EllipticArc::setByCenterFocusAndPoints(
double theCenterX, double theCenterY, double theFocusX, double theFocusY,
/// Destructor.
SKETCHAPI_EXPORT
- virtual ~SketchAPI_EllipticArc();
+ ~SketchAPI_EllipticArc() override;
INTERFACE_13(SketchPlugin_EllipticArc::ID(), center,
SketchPlugin_EllipticArc::CENTER_ID(), GeomDataAPI_Point2D,
/// Dump wrapped feature
SKETCHAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
/// Pointer on Ellipse object.
-typedef std::shared_ptr<SketchAPI_EllipticArc> EllipticArcPtr;
+using EllipticArcPtr = std::shared_ptr<SketchAPI_EllipticArc>;
#endif // SketchAPI_EllipticArc_H_
}
}
-SketchAPI_IntersectionPoint::~SketchAPI_IntersectionPoint() {}
+SketchAPI_IntersectionPoint::~SketchAPI_IntersectionPoint() = default;
//--------------------------------------------------------------------------------------
void SketchAPI_IntersectionPoint::setByExternalEdge(
feature()
->reflist(SketchPlugin_IntersectionPoint::INTERSECTION_POINTS_ID())
->list();
- for (std::list<ObjectPtr>::iterator anIt = anIntersections.begin();
- anIt != anIntersections.end(); ++anIt) {
- FeaturePtr aFeature = ModelAPI_Feature::feature(*anIt);
+ for (auto &anIntersection : anIntersections) {
+ FeaturePtr aFeature = ModelAPI_Feature::feature(anIntersection);
if (aFeature && aFeature->getKind() == SketchPlugin_Point::ID()) {
std::shared_ptr<SketchAPI_SketchEntity> anEnt(
new SketchAPI_Point(aFeature));
const std::wstring &theExternalName);
/// Destructor
SKETCHAPI_EXPORT
- virtual ~SketchAPI_IntersectionPoint();
+ ~SketchAPI_IntersectionPoint() override;
INTERFACE_3(SketchPlugin_IntersectionPoint::ID(), externalFeature,
SketchPlugin_IntersectionPoint::EXTERNAL_FEATURE_ID(),
/// Dump wrapped feature
SKETCHAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
//! Pointer on IntersectionPoint object
-typedef std::shared_ptr<SketchAPI_IntersectionPoint> IntersectionPointPtr;
+using IntersectionPointPtr = std::shared_ptr<SketchAPI_IntersectionPoint>;
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
}
}
-SketchAPI_Line::~SketchAPI_Line() {}
+SketchAPI_Line::~SketchAPI_Line() = default;
//--------------------------------------------------------------------------------------
void SketchAPI_Line::setByCoordinates(double theX1, double theY1, double theX2,
const std::wstring &theExternalName);
/// Destructor
SKETCHAPI_EXPORT
- virtual ~SketchAPI_Line();
+ ~SketchAPI_Line() override;
INTERFACE_3(SketchPlugin_Line::ID(), startPoint,
SketchPlugin_Line::START_ID(), GeomDataAPI_Point2D,
/// Dump wrapped feature
SKETCHAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
//! Pointer on Line object
-typedef std::shared_ptr<SketchAPI_Line> LinePtr;
+using LinePtr = std::shared_ptr<SketchAPI_Line>;
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
}
//==================================================================================================
-SketchAPI_MacroCircle::~SketchAPI_MacroCircle() {}
+SketchAPI_MacroCircle::~SketchAPI_MacroCircle() = default;
//==================================================================================================
void SketchAPI_MacroCircle::setByCenterAndPassedPoints(double theCenterX,
/// Destructor.
SKETCHAPI_EXPORT
- virtual ~SketchAPI_MacroCircle();
+ ~SketchAPI_MacroCircle() override;
INTERFACE_6(SketchPlugin_MacroCircle::ID(), circleType,
SketchPlugin_MacroCircle::CIRCLE_TYPE(), ModelAPI_AttributeString,
};
/// Pointer on Circle object.
-typedef std::shared_ptr<SketchAPI_MacroCircle> MacroCirclePtr;
+using MacroCirclePtr = std::shared_ptr<SketchAPI_MacroCircle>;
#endif // SketchAPI_MacroCircle_H_
}
}
-SketchAPI_MacroEllipse::~SketchAPI_MacroEllipse() {}
+SketchAPI_MacroEllipse::~SketchAPI_MacroEllipse() = default;
static void fillAttribute(const std::shared_ptr<GeomAPI_Pnt2d> &thePoint,
const ModelHighAPI_RefAttr &thePointRef,
void SketchAPI_MacroEllipse::storeSketch(const FeaturePtr &theFeature) {
const std::set<AttributePtr> &aRefs = theFeature->data()->refsToMe();
- for (std::set<AttributePtr>::const_iterator anIt = aRefs.begin();
- anIt != aRefs.end(); ++anIt)
- if ((*anIt)->id() == SketchPlugin_Sketch::FEATURES_ID()) {
- mySketch = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(
- (*anIt)->owner());
+ for (const auto &aRef : aRefs)
+ if (aRef->id() == SketchPlugin_Sketch::FEATURES_ID()) {
+ mySketch =
+ std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aRef->owner());
break;
}
}
/// Destructor.
SKETCHAPI_EXPORT
- virtual ~SketchAPI_MacroEllipse();
+ ~SketchAPI_MacroEllipse() override;
INTERFACE_1(SketchPlugin_MacroEllipse::ID(), ellipseType,
SketchPlugin_MacroEllipse::ELLIPSE_TYPE(),
};
/// Pointer on Circle object.
-typedef std::shared_ptr<SketchAPI_MacroEllipse> MacroEllipsePtr;
+using MacroEllipsePtr = std::shared_ptr<SketchAPI_MacroEllipse>;
#endif // SketchAPI_MacroEllipse_H_
}
}
-SketchAPI_MacroEllipticArc::~SketchAPI_MacroEllipticArc() {}
+SketchAPI_MacroEllipticArc::~SketchAPI_MacroEllipticArc() = default;
/// Destructor.
SKETCHAPI_EXPORT
- virtual ~SketchAPI_MacroEllipticArc();
+ ~SketchAPI_MacroEllipticArc() override;
INTERFACE_3(SketchPlugin_MacroEllipticArc::ID(), startPoint,
SketchPlugin_MacroEllipticArc::START_POINT_ID(),
};
/// Pointer on Elliptic Arc object.
-typedef std::shared_ptr<SketchAPI_MacroEllipticArc> MacroEllipticArcPtr;
+using MacroEllipticArcPtr = std::shared_ptr<SketchAPI_MacroEllipticArc>;
#endif // SketchAPI_MacroEllipticArc_H_
}
}
-SketchAPI_Mirror::~SketchAPI_Mirror() {}
+SketchAPI_Mirror::~SketchAPI_Mirror() = default;
void SketchAPI_Mirror::setMirrorList(
const std::list<std::shared_ptr<ModelAPI_Object>> &theObjects) {
// the number of dumped aMirrorObjects is not changed, no need to dump
// anything
static std::map<FeaturePtr, size_t> aNbDumpedArguments;
- std::map<FeaturePtr, size_t>::iterator aFound =
- aNbDumpedArguments.find(aBase);
+ auto aFound = aNbDumpedArguments.find(aBase);
if (aFound != aNbDumpedArguments.end() && aFound->second == aFirstNotDumped) {
theDumper.postpone(aBase);
return;
const std::list<std::shared_ptr<ModelAPI_Object>> &theObjects);
/// Destructor
SKETCHAPI_EXPORT
- virtual ~SketchAPI_Mirror();
+ ~SketchAPI_Mirror() override;
INTERFACE_4(SketchPlugin_ConstraintMirror::ID(), mirrorLine,
SketchPlugin_ConstraintMirror::ENTITY_A(),
std::list<std::shared_ptr<SketchAPI_SketchEntity>> mirrored() const;
/// Dump wrapped feature
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
//! Pointer on Mirror object
-typedef std::shared_ptr<SketchAPI_Mirror> MirrorPtr;
+using MirrorPtr = std::shared_ptr<SketchAPI_Mirror>;
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
}
}
-SketchAPI_Offset::~SketchAPI_Offset() {}
+SketchAPI_Offset::~SketchAPI_Offset() = default;
std::list<std::shared_ptr<SketchAPI_SketchEntity>>
SketchAPI_Offset::offset() const {
const bool theIsApprox = false);
/// Destructor
SKETCHAPI_EXPORT
- virtual ~SketchAPI_Offset();
+ ~SketchAPI_Offset() override;
INTERFACE_5(SketchPlugin_Offset::ID(),
std::list<std::shared_ptr<SketchAPI_SketchEntity>> offset() const;
/// Dump wrapped feature
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
//! Pointer on Offset object
-typedef std::shared_ptr<SketchAPI_Offset> OffsetPtr;
+using OffsetPtr = std::shared_ptr<SketchAPI_Offset>;
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
}
}
-SketchAPI_Point::~SketchAPI_Point() {}
+SketchAPI_Point::~SketchAPI_Point() = default;
//--------------------------------------------------------------------------------------
void SketchAPI_Point::setCoordinates(double theX, double theY) {
}
}
-SketchAPI_Projection::~SketchAPI_Projection() {}
+SketchAPI_Projection::~SketchAPI_Projection() = default;
//--------------------------------------------------------------------------------------
void SketchAPI_Projection::setExternalFeature(
const ModelHighAPI_Selection &theExternalFeature);
/// Destructor
SKETCHAPI_EXPORT
- virtual ~SketchAPI_Projection();
+ ~SketchAPI_Projection() override;
INTERFACE_4(SketchPlugin_Projection::ID(), externalFeature,
SketchPlugin_Projection::EXTERNAL_FEATURE_ID(),
/// Dump wrapped feature
SKETCHAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
//! Pointer on Projection object
-typedef std::shared_ptr<SketchAPI_Projection> ProjectionPtr;
+using ProjectionPtr = std::shared_ptr<SketchAPI_Projection>;
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
}
}
-SketchAPI_Rectangle::~SketchAPI_Rectangle() {}
+SketchAPI_Rectangle::~SketchAPI_Rectangle() = default;
//--------------------------------------------------------------------------------------
void SketchAPI_Rectangle::setByCoordinates(double theX1, double theY1,
const std::shared_ptr<GeomAPI_Pnt2d> &theEndPoint);
/// Destructor
SKETCHAPI_EXPORT
- virtual ~SketchAPI_Rectangle();
+ ~SketchAPI_Rectangle() override;
INTERFACE_7("SketchRectangle", type, "RectangleType",
ModelAPI_AttributeString,
};
//! Pointer on Rectangle object
-typedef std::shared_ptr<SketchAPI_Rectangle> RectanglePtr;
+using RectanglePtr = std::shared_ptr<SketchAPI_Rectangle>;
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
}
}
-SketchAPI_Rotation::~SketchAPI_Rotation() {}
+SketchAPI_Rotation::~SketchAPI_Rotation() = default;
void SketchAPI_Rotation::setRotationList(
const std::list<std::shared_ptr<ModelAPI_Object>> &theObjects) {
// the number of dumped aRotObjects is not changed, no need to dump anything
static std::map<FeaturePtr, size_t> aNbDumpedArguments;
- std::map<FeaturePtr, size_t>::iterator aFound =
- aNbDumpedArguments.find(aBase);
+ auto aFound = aNbDumpedArguments.find(aBase);
if (aFound != aNbDumpedArguments.end() && aFound->second == aFirstNotDumped) {
theDumper.postpone(aBase);
return;
bool theReversed = false);
/// Destructor
SKETCHAPI_EXPORT
- virtual ~SketchAPI_Rotation();
+ ~SketchAPI_Rotation() override;
INTERFACE_8(SketchPlugin_MultiRotation::ID(), rotationList,
SketchPlugin_MultiRotation::ROTATION_LIST_ID(),
std::list<std::shared_ptr<SketchAPI_SketchEntity>> rotatedList() const;
/// Dump wrapped feature
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
//! Pointer on Rotation object
-typedef std::shared_ptr<SketchAPI_Rotation> RotationPtr;
+using RotationPtr = std::shared_ptr<SketchAPI_Rotation>;
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
}
}
-SketchAPI_Sketch::~SketchAPI_Sketch() {}
+SketchAPI_Sketch::~SketchAPI_Sketch() = default;
//--------------------------------------------------------------------------------------
std::shared_ptr<ModelAPI_CompositeFeature>
ResultConstructionPtr aResultConstruction =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(
feature()->firstResult());
- if (aResultConstruction.get() == NULL)
+ if (aResultConstruction.get() == nullptr)
return aSelectionList;
for (int anIndex = 0; anIndex < aResultConstruction->facesNum(); ++anIndex) {
std::list<std::shared_ptr<SketchAPI_Point>> aFreePoints;
std::list<ResultPtr> aPoints =
SketcherPrs_Tools::getFreePoints(compositeFeature());
- for (std::list<ResultPtr>::iterator anIt = aPoints.begin();
- anIt != aPoints.end(); ++anIt) {
- FeaturePtr aFeature = ModelAPI_Feature::feature(*anIt);
+ for (auto &anIt : aPoints) {
+ FeaturePtr aFeature = ModelAPI_Feature::feature(anIt);
PointPtr aPoint(new SketchAPI_Point(aFeature));
aFreePoints.push_back(aPoint);
}
aFaces.push_back(aSketchResult->face(i));
// find new faces order according to the given lists of edges
std::list<GeomFacePtr> aNewFacesOrder;
- std::list<std::list<ModelHighAPI_Selection>>::const_iterator anIt =
- theFaces.begin();
+ auto anIt = theFaces.begin();
for (; anIt != theFaces.end(); ++anIt) {
// find the appropriate face
- std::list<GeomFacePtr>::iterator aFIt = aFaces.begin();
+ auto aFIt = aFaces.begin();
for (; aFIt != aFaces.end(); ++aFIt) {
- std::list<ModelHighAPI_Selection>::const_iterator aEdgeIt = anIt->begin();
+ auto aEdgeIt = anIt->begin();
GeomAPI_ShapeExplorer aFExp(*aFIt, GeomAPI_Shape::EDGE);
for (; aEdgeIt != anIt->end() && aFExp.more(); ++aEdgeIt, aFExp.next()) {
ResultPtr aCurRes = aEdgeIt->resultSubShapePair().first;
bool hasReference = false;
std::list<GeomPnt2dPtr> aPoints;
std::list<ModelHighAPI_RefAttr> aReferences;
- for (std::list<PointOrReference>::const_iterator it = poles.begin();
- it != poles.end(); ++it) {
- aPoints.push_back(it->first);
- aReferences.push_back(it->second);
- if (!it->second.isEmpty())
+ for (const auto &pole : poles) {
+ aPoints.push_back(pole.first);
+ aReferences.push_back(pole.second);
+ if (!pole.second.isEmpty())
hasReference = true;
}
anExp.next()) {
GeomShapePtr aCurrent = anExp.current();
bool isFound = false;
- std::list<GeomShapePtr>::iterator anIt1 = anEdges1.begin();
+ auto anIt1 = anEdges1.begin();
for (; anIt1 != anEdges1.end(); ++anIt1)
if (aCurrent->isSameGeometry(*anIt1)) {
isFound = true;
// compare faces stored in sketch with faces generated by SketchBuilder
int aNbSketchFaces = aSketchResult->facesNum();
int aFaceIndex = 0;
- for (ListOfShape::const_iterator aFIt = aFaces.begin();
+ for (auto aFIt = aFaces.begin();
aFIt != aFaces.end() && aFaceIndex < aNbSketchFaces;
++aFIt, ++aFaceIndex) {
GeomFacePtr aSketchFace = aSketchResult->face(aFaceIndex);
for (int a = 0; a < aSubNum; ++a) {
FeaturePtr aSub = theSketch->subFeature(a);
const std::list<ResultPtr> &aResults = aSub->results();
- std::list<ResultPtr>::const_iterator aRes = aResults.cbegin();
+ auto aRes = aResults.cbegin();
for (; aRes != aResults.cend(); aRes++) {
GeomShapePtr aCurShape = (*aRes)->shape();
if (aCurShape && aCurShape->isEdge())
std::string aSpaceShift(aSketchName.size() + aMethodName.size(), ' ');
theDumper << aSketchName << aMethodName << "([";
- for (std::list<std::list<ResultPtr>>::iterator aFIt = aFaces.begin();
- aFIt != aFaces.end(); ++aFIt) {
+ for (auto aFIt = aFaces.begin(); aFIt != aFaces.end(); ++aFIt) {
if (aFIt != aFaces.begin())
theDumper << ",\n" << aSpaceShift << " ";
theDumper << *aFIt;
std::shared_ptr<ModelAPI_Object> thePlaneObject);
/// Destructor
SKETCHAPI_EXPORT
- virtual ~SketchAPI_Sketch();
+ ~SketchAPI_Sketch() override;
INTERFACE_7(SketchPlugin_Sketch::ID(), origin,
SketchPlugin_Sketch::ORIGIN_ID(), GeomDataAPI_Point,
/// Dump wrapped feature
SKETCHAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
protected:
std::shared_ptr<ModelAPI_CompositeFeature> compositeFeature() const;
};
//! Pointer on Sketch object
-typedef std::shared_ptr<SketchAPI_Sketch> SketchPtr;
+using SketchPtr = std::shared_ptr<SketchAPI_Sketch>;
//--------------------------------------------------------------------------------------
initialize();
}
-SketchAPI_SketchEntity::~SketchAPI_SketchEntity() {}
+SketchAPI_SketchEntity::~SketchAPI_SketchEntity() = default;
//--------------------------------------------------------------------------------------
bool SketchAPI_SketchEntity::initialize() {
std::list<std::shared_ptr<SketchAPI_SketchEntity>> SketchAPI_SketchEntity::wrap(
const std::list<std::shared_ptr<ModelAPI_Feature>> &theFeatures) {
std::list<std::shared_ptr<SketchAPI_SketchEntity>> aResult;
- std::list<std::shared_ptr<ModelAPI_Feature>>::const_iterator anIt =
- theFeatures.begin();
+ auto anIt = theFeatures.begin();
for (; anIt != theFeatures.end(); ++anIt) {
if ((*anIt)->getKind() == SketchPlugin_Line::ID())
aResult.push_back(
}
}
-SketchAPI_Translation::~SketchAPI_Translation() {}
+SketchAPI_Translation::~SketchAPI_Translation() = default;
void SketchAPI_Translation::setTranslationList(
const std::list<std::shared_ptr<ModelAPI_Object>> &theObjects) {
// the number of dumped aTransObjects is not changed, no need to dump anything
static std::map<FeaturePtr, size_t> aNbDumpedArguments;
- std::map<FeaturePtr, size_t>::iterator aFound =
- aNbDumpedArguments.find(aBase);
+ auto aFound = aNbDumpedArguments.find(aBase);
if (aFound != aNbDumpedArguments.end() && aFound->second == aFirstNotDumped) {
theDumper.postpone(aBase);
return;
bool theFullValue = false);
/// Destructor
SKETCHAPI_EXPORT
- virtual ~SketchAPI_Translation();
+ ~SketchAPI_Translation() override;
INTERFACE_7(SketchPlugin_MultiTranslation::ID(), translationList,
SketchPlugin_MultiTranslation::TRANSLATION_LIST_ID(),
std::list<std::shared_ptr<SketchAPI_SketchEntity>> translatedList() const;
/// Dump wrapped feature
- virtual void dump(ModelHighAPI_Dumper &theDumper) const;
+ void dump(ModelHighAPI_Dumper &theDumper) const override;
};
//! Pointer on Translation object
-typedef std::shared_ptr<SketchAPI_Translation> TranslationPtr;
+using TranslationPtr = std::shared_ptr<SketchAPI_Translation>;
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
}
bool SketchPlugin_Arc::isFixed() {
- return data()->selection(EXTERNAL_ID())->context().get() != NULL;
+ return data()->selection(EXTERNAL_ID())->context().get() != nullptr;
}
void SketchPlugin_Arc::attributeChanged(const std::string &theID) {
}
bool SketchPlugin_BSplineBase::isFixed() {
- return data()->selection(EXTERNAL_ID())->context().get() != NULL;
+ return data()->selection(EXTERNAL_ID())->context().get() != nullptr;
}
void SketchPlugin_BSplineBase::attributeChanged(const std::string & /*theID*/) {
std::map<int, FeaturePtr> aControlPoles, aControlSegments;
bool hasAuxSegment = false;
const std::set<AttributePtr> &aRefs = data()->refsToMe();
- for (std::set<AttributePtr>::iterator anIt = aRefs.begin();
- anIt != aRefs.end(); ++anIt) {
- FeaturePtr aFeature = ModelAPI_Feature::feature((*anIt)->owner());
+ for (const auto &aRef : aRefs) {
+ FeaturePtr aFeature = ModelAPI_Feature::feature(aRef->owner());
if (aFeature->getKind() ==
SketchPlugin_ConstraintCoincidenceInternal::ID()) {
AttributeIntegerPtr anIndex;
AttributeRefAttrPtr aNonSplinePoint;
- if ((*anIt)->id() ==
+ if (aRef->id() ==
SketchPlugin_ConstraintCoincidenceInternal::ENTITY_A()) {
anIndex = aFeature->integer(
SketchPlugin_ConstraintCoincidenceInternal::INDEX_ENTITY_A());
aNonSplinePoint =
aFeature->refattr(SketchPlugin_Constraint::ENTITY_B());
- } else if ((*anIt)->id() ==
+ } else if (aRef->id() ==
SketchPlugin_ConstraintCoincidenceInternal::ENTITY_B()) {
anIndex = aFeature->integer(
SketchPlugin_ConstraintCoincidenceInternal::INDEX_ENTITY_B());
aWeights.push_back(1.0); // default weight
}
aWeightsArray->setSize(aWeightsArray->size() + 1);
- std::list<double>::iterator aWIt = aWeights.begin();
+ auto aWIt = aWeights.begin();
for (int i = 0; i < aWeightsArray->size(); ++i, ++aWIt)
aWeightsArray->setValue(i, *aWIt);
std::list<double> aKnots = aBSplineCurve->knots();
int aSize = (int)aKnots.size();
aKnotsAttr->setSize(aSize);
- std::list<double>::iterator aKIt = aKnots.begin();
+ auto aKIt = aKnots.begin();
for (int index = 0; index < aSize; ++index, ++aKIt)
aKnotsAttr->setValue(index, *aKIt);
std::list<int> aMults = aBSplineCurve->mults();
aSize = (int)aMults.size();
aMultsAttr->setSize(aSize);
- std::list<int>::iterator aMIt = aMults.begin();
+ auto aMIt = aMults.begin();
for (int index = 0; index < aSize; ++index, ++aMIt)
aMultsAttr->setValue(index, *aMIt);
data()->blockSendAttributeUpdated(aWasBlocked, true);
// update indices of internal coincidences
- for (std::list<AttributeIntegerPtr>::iterator aCIt =
- aCoincidentPoleIndex.begin();
- aCIt != aCoincidentPoleIndex.end(); ++aCIt)
- (*aCIt)->setValue((*aCIt)->value() + 1);
+ for (auto &aCIt : aCoincidentPoleIndex)
+ aCIt->setValue(aCIt->value() + 1);
// create auxiliary segment and pole updating the control polygon
SketchPlugin_MacroBSpline::createAuxiliaryPole(aPolesArray, anAfter + 1);
anAfter + 1);
// update names of features representing control polygon
- for (std::map<int, FeaturePtr>::iterator anIt = aControlPoles.begin();
- anIt != aControlPoles.end(); ++anIt) {
+ for (auto &aControlPole : aControlPoles) {
SketchPlugin_MacroBSpline::assignDefaultNameForAux(
- anIt->second, aPolesArray, anIt->first + 1);
+ aControlPole.second, aPolesArray, aControlPole.first + 1);
}
- for (std::map<int, FeaturePtr>::iterator anIt = aControlSegments.begin();
- anIt != aControlSegments.end(); ++anIt) {
+ for (auto &aControlSegment : aControlSegments) {
SketchPlugin_MacroBSpline::assignDefaultNameForAux(
- anIt->second, aPolesArray, anIt->first + 1,
- (anIt->first + 2) % aPolesArray->size());
+ aControlSegment.second, aPolesArray, aControlSegment.first + 1,
+ (aControlSegment.first + 2) % aPolesArray->size());
}
return true;
}
bool SketchPlugin_Circle::isFixed() {
- return data()->selection(EXTERNAL_ID())->context().get() != NULL;
+ return data()->selection(EXTERNAL_ID())->context().get() != nullptr;
}
void SketchPlugin_Circle::attributeChanged(const std::string &theID) {
#include "SketchPlugin_Constraint.h"
-SketchPlugin_Constraint::SketchPlugin_Constraint() {}
+SketchPlugin_Constraint::SketchPlugin_Constraint() = default;
FeaturePtr aLineA = SketcherPrs_Tools::getFeatureLine(aData, ENTITY_A());
FeaturePtr aLineB = SketcherPrs_Tools::getFeatureLine(aData, ENTITY_B());
- if ((aLineA.get() == NULL) || (aLineB.get() == NULL))
+ if ((aLineA.get() == nullptr) || (aLineB.get() == nullptr))
return false;
// Intersection of lines
return MY_CONSTRAINT_ANGLE_ID;
}
/// \brief Returns the kind of a feature
- SKETCHPLUGIN_EXPORT virtual const std::string &getKind() {
+ SKETCHPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = SketchPlugin_ConstraintAngle::ID();
return MY_KIND;
}
public:
/// \brief Creates a new part document if needed
- SKETCHPLUGIN_EXPORT virtual void execute();
+ SKETCHPLUGIN_EXPORT void execute() override;
/// Computes the attribute value on the base of other attributes if the value
/// can be computed \param theAttributeId an attribute index to be computed
/// \return a boolean value about it is computed
- SKETCHPLUGIN_EXPORT virtual bool compute(const std::string &theAttributeId);
+ SKETCHPLUGIN_EXPORT bool compute(const std::string &theAttributeId) override;
/// \brief Request for initialization of data model of the feature: adding all
/// attributes
- SKETCHPLUGIN_EXPORT virtual void initAttributes();
+ SKETCHPLUGIN_EXPORT void initAttributes() override;
/// Retuns the parameters of color definition in the resources config manager
- SKETCHPLUGIN_EXPORT virtual void colorConfigInfo(std::string &theSection,
- std::string &theName,
- std::string &theDefault);
+ SKETCHPLUGIN_EXPORT void colorConfigInfo(std::string &theSection,
+ std::string &theName,
+ std::string &theDefault) override;
/// Called on change of any argument-attribute of this object
/// \param theID identifier of changed attribute
- SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID);
+ SKETCHPLUGIN_EXPORT void attributeChanged(const std::string &theID) override;
/// Returns the AIS preview
- SKETCHPLUGIN_EXPORT virtual AISObjectPtr
- getAISObject(AISObjectPtr thePrevious);
+ SKETCHPLUGIN_EXPORT AISObjectPtr
+ getAISObject(AISObjectPtr thePrevious) override;
/// Apply information of the message to current object.
/// It fills selected point and the first object.
- virtual std::string
- processEvent(const std::shared_ptr<Events_Message> &theMessage);
+ std::string
+ processEvent(const std::shared_ptr<Events_Message> &theMessage) override;
/// \brief Use plugin manager for features creation
SketchPlugin_ConstraintAngle();
#include <Events_Loop.h>
-SketchPlugin_ConstraintCoincidence::SketchPlugin_ConstraintCoincidence() {}
+SketchPlugin_ConstraintCoincidence::SketchPlugin_ConstraintCoincidence() =
+ default;
void SketchPlugin_ConstraintCoincidence::initAttributes() {
data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(),
#include <ModelAPI_Validator.h>
SketchPlugin_ConstraintCoincidenceInternal::
- SketchPlugin_ConstraintCoincidenceInternal() {}
+ SketchPlugin_ConstraintCoincidenceInternal() = default;
void SketchPlugin_ConstraintCoincidenceInternal::initAttributes() {
SketchPlugin_ConstraintCoincidence::initAttributes();
void SketchPlugin_ConstraintCoincidenceInternal::execute() {}
AISObjectPtr SketchPlugin_ConstraintCoincidenceInternal::getAISObject(
- AISObjectPtr thePrevious) {
+ AISObjectPtr /*thePrevious*/) {
return AISObjectPtr();
}
return MY_CONSTRAINT_COINCIDENCE_ID;
}
/// \brief Returns the kind of a feature
- SKETCHPLUGIN_EXPORT virtual const std::string &getKind() {
+ SKETCHPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND =
SketchPlugin_ConstraintCoincidenceInternal::ID();
return MY_KIND;
}
/// \brief Returns the AIS preview
- SKETCHPLUGIN_EXPORT virtual AISObjectPtr
- getAISObject(AISObjectPtr thePrevious);
+ SKETCHPLUGIN_EXPORT AISObjectPtr
+ getAISObject(AISObjectPtr thePrevious) override;
/// \brief Creates a new part document if needed
- SKETCHPLUGIN_EXPORT virtual void execute();
+ SKETCHPLUGIN_EXPORT void execute() override;
/// \brief Request for initialization of data model of the feature: adding all
/// attributes
- SKETCHPLUGIN_EXPORT virtual void initAttributes();
+ SKETCHPLUGIN_EXPORT void initAttributes() override;
/// \brief Use plugin manager for features creation
SketchPlugin_ConstraintCoincidenceInternal();
#include "SketcherPrs_Factory.h"
-SketchPlugin_ConstraintCollinear::SketchPlugin_ConstraintCollinear() {}
+SketchPlugin_ConstraintCollinear::SketchPlugin_ConstraintCollinear() = default;
void SketchPlugin_ConstraintCollinear::initAttributes() {
data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(),
return MY_CONSTRAINT_COLLINEAR_ID;
}
/// \brief Returns the kind of a feature
- SKETCHPLUGIN_EXPORT virtual const std::string &getKind() {
+ SKETCHPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = SketchPlugin_ConstraintCollinear::ID();
return MY_KIND;
}
/// \brief Creates a new part document if needed
- SKETCHPLUGIN_EXPORT virtual void execute();
+ SKETCHPLUGIN_EXPORT void execute() override;
/// \brief Request for initialization of data model of the feature: adding all
/// attributes
- SKETCHPLUGIN_EXPORT virtual void initAttributes();
+ SKETCHPLUGIN_EXPORT void initAttributes() override;
/// Returns the AIS preview
- SKETCHPLUGIN_EXPORT virtual AISObjectPtr
- getAISObject(AISObjectPtr thePrevious);
+ SKETCHPLUGIN_EXPORT AISObjectPtr
+ getAISObject(AISObjectPtr thePrevious) override;
/// \brief Use plugin manager for features creation
SketchPlugin_ConstraintCollinear();
}
/// \brief Returns the kind of a feature
- SKETCHPLUGIN_EXPORT virtual const std::string &getKind() {
+ SKETCHPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = SketchPlugin_ConstraintDistance::ID();
return MY_KIND;
}
}
/// \brief Creates a new part document if needed
- SKETCHPLUGIN_EXPORT virtual void execute();
+ SKETCHPLUGIN_EXPORT void execute() override;
/// \brief Request for initialization of data model of the feature: adding all
/// attributes
- SKETCHPLUGIN_EXPORT virtual void initAttributes();
+ SKETCHPLUGIN_EXPORT void initAttributes() override;
/// Retuns the parameters of color definition in the resources config manager
- SKETCHPLUGIN_EXPORT virtual void colorConfigInfo(std::string &theSection,
- std::string &theName,
- std::string &theDefault);
+ SKETCHPLUGIN_EXPORT void colorConfigInfo(std::string &theSection,
+ std::string &theName,
+ std::string &theDefault) override;
/// Returns the AIS preview
- SKETCHPLUGIN_EXPORT virtual AISObjectPtr
- getAISObject(AISObjectPtr thePrevious);
+ SKETCHPLUGIN_EXPORT AISObjectPtr
+ getAISObject(AISObjectPtr thePrevious) override;
/// Called on change of any argument-attribute of this object
/// \param theID identifier of changed attribute
- SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID);
+ SKETCHPLUGIN_EXPORT void attributeChanged(const std::string &theID) override;
/// \brief Use plugin manager for features creation
SketchPlugin_ConstraintDistance();
SketchPlugin_ConstraintDistanceAlongDir::
SketchPlugin_ConstraintDistanceAlongDir()
- : SketchPlugin_ConstraintDistance(), myValue(-1.e100),
- myValueUpdate(false) {}
+ : SketchPlugin_ConstraintDistance() {}
//*************************************************************************************
void SketchPlugin_ConstraintDistanceAlongDir::initAttributes() {
}
/// \brief Creates a new part document if needed
- SKETCHPLUGIN_EXPORT virtual void execute();
+ SKETCHPLUGIN_EXPORT void execute() override;
/// \brief Request for initialization of data model of the feature: adding all
/// attributes
- SKETCHPLUGIN_EXPORT virtual void initAttributes();
+ SKETCHPLUGIN_EXPORT void initAttributes() override;
/// Returns the AIS preview
- SKETCHPLUGIN_EXPORT virtual AISObjectPtr
- getAISObject(AISObjectPtr thePrevious);
+ SKETCHPLUGIN_EXPORT AISObjectPtr
+ getAISObject(AISObjectPtr thePrevious) override;
/// Called on change of any argument-attribute of this object
/// \param theID identifier of changed attribute
- SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID);
+ SKETCHPLUGIN_EXPORT void attributeChanged(const std::string &theID) override;
/// \brief Use plugin manager for features creation
SketchPlugin_ConstraintDistanceAlongDir();
protected:
/// Returns the current distance between the feature attributes
- virtual double calculateCurrentDistance() = 0;
+ double calculateCurrentDistance() override = 0;
/// Update flyout point
virtual void updateFlyoutPoint() = 0;
protected:
- double myValue;
- bool myValueUpdate;
+ double myValue{-1.e100};
+ bool myValueUpdate{false};
};
#endif
}
/// \brief Returns the kind of a feature
- SKETCHPLUGIN_EXPORT virtual const std::string &getKind() {
+ SKETCHPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND =
SketchPlugin_ConstraintDistanceHorizontal::ID();
return MY_KIND;
protected:
/// Returns the current distance between the feature attributes
- virtual double calculateCurrentDistance();
+ double calculateCurrentDistance() override;
/// Update flyout point
- virtual void updateFlyoutPoint();
+ void updateFlyoutPoint() override;
};
#endif
}
/// \brief Returns the kind of a feature
- SKETCHPLUGIN_EXPORT virtual const std::string &getKind() {
+ SKETCHPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = SketchPlugin_ConstraintDistanceVertical::ID();
return MY_KIND;
}
protected:
/// Returns the current distance between the feature attributes
- virtual double calculateCurrentDistance();
+ double calculateCurrentDistance() override;
/// Update flyout point
- virtual void updateFlyoutPoint();
+ void updateFlyoutPoint() override;
};
#endif
#include <Config_PropManager.h>
-SketchPlugin_ConstraintHorizontal::SketchPlugin_ConstraintHorizontal() {}
+SketchPlugin_ConstraintHorizontal::SketchPlugin_ConstraintHorizontal() =
+ default;
void SketchPlugin_ConstraintHorizontal::initAttributes() {
data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(),
return MY_CONSTRAINT_HORIZONTAL_ID;
}
/// \brief Returns the kind of a feature
- SKETCHPLUGIN_EXPORT virtual const std::string &getKind() {
+ SKETCHPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = SketchPlugin_ConstraintHorizontal::ID();
return MY_KIND;
}
/// \brief Creates a new part document if needed
- SKETCHPLUGIN_EXPORT virtual void execute();
+ SKETCHPLUGIN_EXPORT void execute() override;
/// \brief Request for initialization of data model of the feature: adding all
/// attributes
- SKETCHPLUGIN_EXPORT virtual void initAttributes();
+ SKETCHPLUGIN_EXPORT void initAttributes() override;
/// Returns the AIS preview
- SKETCHPLUGIN_EXPORT virtual AISObjectPtr
- getAISObject(AISObjectPtr thePrevious);
+ SKETCHPLUGIN_EXPORT AISObjectPtr
+ getAISObject(AISObjectPtr thePrevious) override;
/// \brief Use plugin manager for features creation
SketchPlugin_ConstraintHorizontal();
}
/// \brief Returns the kind of a feature
- SKETCHPLUGIN_EXPORT virtual const std::string &getKind() {
+ SKETCHPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = SketchPlugin_ConstraintLength::ID();
return MY_KIND;
}
}
/// \brief Creates a new part document if needed
- SKETCHPLUGIN_EXPORT virtual void execute();
+ SKETCHPLUGIN_EXPORT void execute() override;
/// Computes the attribute value on the base of other attributes if the value
/// can be computed \param theAttributeId an attribute index to be computed
/// \return a boolean value about it is computed
- SKETCHPLUGIN_EXPORT virtual bool compute(const std::string &theAttributeId);
+ SKETCHPLUGIN_EXPORT bool compute(const std::string &theAttributeId) override;
/// \brief Request for initialization of data model of the feature: adding all
/// attributes
- SKETCHPLUGIN_EXPORT virtual void initAttributes();
+ SKETCHPLUGIN_EXPORT void initAttributes() override;
/// Retuns the parameters of color definition in the resources config manager
- SKETCHPLUGIN_EXPORT virtual void colorConfigInfo(std::string &theSection,
- std::string &theName,
- std::string &theDefault);
+ SKETCHPLUGIN_EXPORT void colorConfigInfo(std::string &theSection,
+ std::string &theName,
+ std::string &theDefault) override;
/// Returns the AIS preview
- SKETCHPLUGIN_EXPORT virtual AISObjectPtr
- getAISObject(AISObjectPtr thePrevious);
+ SKETCHPLUGIN_EXPORT AISObjectPtr
+ getAISObject(AISObjectPtr thePrevious) override;
/// Called on change of any argument-attribute of this object
/// \param theID identifier of changed attribute
- SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID);
+ SKETCHPLUGIN_EXPORT void attributeChanged(const std::string &theID) override;
/// \brief Use plugin manager for features creation
SketchPlugin_ConstraintLength();
#include <Config_PropManager.h>
-SketchPlugin_ConstraintMirror::SketchPlugin_ConstraintMirror() {}
+SketchPlugin_ConstraintMirror::SketchPlugin_ConstraintMirror() = default;
void SketchPlugin_ConstraintMirror::initAttributes() {
data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(),
for (int anInd = 0; anInd < aMirrorObjectRefs->size(); anInd++) {
ObjectPtr anObject = aMirrorObjectRefs->object(anInd);
std::list<ObjectPtr>::const_iterator anIt = anInitialList.begin();
- std::vector<bool>::iterator aUsedIt = isUsed.begin();
+ auto aUsedIt = isUsed.begin();
for (; anIt != anInitialList.end(); anIt++, aUsedIt++)
if (*anIt == anObject) {
*aUsedIt = true;
aRefListOfShapes->append(anObject);
}
// remove unused items
- std::list<ObjectPtr>::iterator anInitIter = anInitialList.begin();
- std::list<ObjectPtr>::iterator aMirrorIter = aMirroredList.begin();
- std::vector<bool>::iterator aUsedIter = isUsed.begin();
+ auto anInitIter = anInitialList.begin();
+ auto aMirrorIter = aMirroredList.begin();
+ auto aUsedIter = isUsed.begin();
std::set<FeaturePtr> aFeaturesToBeRemoved;
for (; aUsedIter != isUsed.end(); aUsedIter++) {
if (!(*aUsedIter)) {
std::shared_ptr<GeomAPI_Shape> aShapeIn = aRCIn->shape();
const std::list<ResultPtr> &aResults = aNewFeature->results();
- std::list<ResultPtr>::const_iterator anIt = aResults.begin();
+ auto anIt = aResults.begin();
for (; anIt != aResults.end(); anIt++) {
ResultConstructionPtr aRC =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*anIt);
aMirrorIter++;
}
// Remove from the list objects already deleted before
- std::set<int>::reverse_iterator anIt = anInvalidInd.rbegin();
+ auto anIt = anInvalidInd.rbegin();
for (; anIt != anInvalidInd.rend(); anIt++) {
if (*anIt < indFirstWrong)
indFirstWrong--;
aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
std::list<ObjectPtr> aTargetList = aRefListOfMirrored->list();
- for (std::list<ObjectPtr>::const_iterator aTargetIt = aTargetList.cbegin();
- aTargetIt != aTargetList.cend(); aTargetIt++) {
- if ((*aTargetIt).get()) {
- ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(*aTargetIt);
+ for (const auto &aTargetIt : aTargetList) {
+ if (aTargetIt.get()) {
+ ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(aTargetIt);
if (aRes.get()) {
FeaturePtr aFeature = aRes->document()->feature(aRes);
if (aFeature.get()) {
std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(
data()->attribute(SketchPlugin_Constraint::ENTITY_C()));
std::list<ObjectPtr> aTargetList = aRefListOfMirrored->list();
- std::list<ObjectPtr>::iterator aTargetIter = aTargetList.begin();
+ auto aTargetIter = aTargetList.begin();
for (; aTargetIter != aTargetList.end(); aTargetIter++) {
FeaturePtr aFeature = ModelAPI_Feature::feature(*aTargetIter);
if (aFeature)
return MY_CONSTRAINT_MIRROR_ID;
}
/// \brief Returns the kind of a feature
- SKETCHPLUGIN_EXPORT virtual const std::string &getKind() {
+ SKETCHPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = SketchPlugin_ConstraintMirror::ID();
return MY_KIND;
}
}
/// \brief Creates a new part document if needed
- SKETCHPLUGIN_EXPORT virtual void execute();
+ SKETCHPLUGIN_EXPORT void execute() override;
/// \brief Request for initialization of data model of the feature: adding all
/// attributes
- SKETCHPLUGIN_EXPORT virtual void initAttributes();
+ SKETCHPLUGIN_EXPORT void initAttributes() override;
/// Called on change of any argument-attribute of this object
/// \param theID identifier of changed attribute
- SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID);
+ SKETCHPLUGIN_EXPORT void attributeChanged(const std::string &theID) override;
/// Returns the AIS preview
- SKETCHPLUGIN_EXPORT virtual AISObjectPtr
- getAISObject(AISObjectPtr thePrevious);
+ SKETCHPLUGIN_EXPORT AISObjectPtr
+ getAISObject(AISObjectPtr thePrevious) override;
/// removes all fields from this feature: results, data, etc
- SKETCHPLUGIN_EXPORT virtual void erase();
+ SKETCHPLUGIN_EXPORT void erase() override;
/// \brief Use plugin manager for features creation
SketchPlugin_ConstraintMirror();
#include <Config_PropManager.h>
-SketchPlugin_ConstraintParallel::SketchPlugin_ConstraintParallel() {}
+SketchPlugin_ConstraintParallel::SketchPlugin_ConstraintParallel() = default;
void SketchPlugin_ConstraintParallel::initAttributes() {
data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(),
return MY_CONSTRAINT_PARALLEL_ID;
}
/// \brief Returns the kind of a feature
- SKETCHPLUGIN_EXPORT virtual const std::string &getKind() {
+ SKETCHPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = SketchPlugin_ConstraintParallel::ID();
return MY_KIND;
}
/// \brief Creates a new part document if needed
- SKETCHPLUGIN_EXPORT virtual void execute();
+ SKETCHPLUGIN_EXPORT void execute() override;
/// \brief Request for initialization of data model of the feature: adding all
/// attributes
- SKETCHPLUGIN_EXPORT virtual void initAttributes();
+ SKETCHPLUGIN_EXPORT void initAttributes() override;
/// Returns the AIS preview
- SKETCHPLUGIN_EXPORT virtual AISObjectPtr
- getAISObject(AISObjectPtr thePrevious);
+ SKETCHPLUGIN_EXPORT AISObjectPtr
+ getAISObject(AISObjectPtr thePrevious) override;
/// \brief Use plugin manager for features creation
SketchPlugin_ConstraintParallel();
#include <Config_PropManager.h>
-SketchPlugin_ConstraintPerpendicular::SketchPlugin_ConstraintPerpendicular() {}
+SketchPlugin_ConstraintPerpendicular::SketchPlugin_ConstraintPerpendicular() =
+ default;
void SketchPlugin_ConstraintPerpendicular::initAttributes() {
data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(),
return MY_CONSTRAINT_PERPENDICULAR_ID;
}
/// \brief Returns the kind of a feature
- SKETCHPLUGIN_EXPORT virtual const std::string &getKind() {
+ SKETCHPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = SketchPlugin_ConstraintPerpendicular::ID();
return MY_KIND;
}
/// \brief Creates a new part document if needed
- SKETCHPLUGIN_EXPORT virtual void execute();
+ SKETCHPLUGIN_EXPORT void execute() override;
/// \brief Request for initialization of data model of the feature: adding all
/// attributes
- SKETCHPLUGIN_EXPORT virtual void initAttributes();
+ SKETCHPLUGIN_EXPORT void initAttributes() override;
/// Returns the AIS preview
- SKETCHPLUGIN_EXPORT virtual AISObjectPtr
- getAISObject(AISObjectPtr thePrevious);
+ SKETCHPLUGIN_EXPORT AISObjectPtr
+ getAISObject(AISObjectPtr thePrevious) override;
/// \brief Use plugin manager for features creation
SketchPlugin_ConstraintPerpendicular();
#include <GeomAlgoAPI_PointBuilder.h>
#include <GeomDataAPI_Point2D.h>
-SketchPlugin_ConstraintRigid::SketchPlugin_ConstraintRigid() {}
+SketchPlugin_ConstraintRigid::SketchPlugin_ConstraintRigid() = default;
void SketchPlugin_ConstraintRigid::initAttributes() {
data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(),
#include <Config_PropManager.h>
-SketchPlugin_ConstraintTangent::SketchPlugin_ConstraintTangent() {}
+SketchPlugin_ConstraintTangent::SketchPlugin_ConstraintTangent() = default;
void SketchPlugin_ConstraintTangent::initAttributes() {
data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(),
#include <Config_PropManager.h>
-SketchPlugin_ConstraintVertical::SketchPlugin_ConstraintVertical() {}
+SketchPlugin_ConstraintVertical::SketchPlugin_ConstraintVertical() = default;
void SketchPlugin_ConstraintVertical::initAttributes() {
data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(),
return MY_CONSTRAINT_VERTICAL_ID;
}
/// \brief Returns the kind of a feature
- SKETCHPLUGIN_EXPORT virtual const std::string &getKind() {
+ SKETCHPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = SketchPlugin_ConstraintVertical::ID();
return MY_KIND;
}
/// \brief Creates a new part document if needed
- SKETCHPLUGIN_EXPORT virtual void execute();
+ SKETCHPLUGIN_EXPORT void execute() override;
/// \brief Request for initialization of data model of the feature: adding all
/// attributes
- SKETCHPLUGIN_EXPORT virtual void initAttributes();
+ SKETCHPLUGIN_EXPORT void initAttributes() override;
/// Returns the AIS preview
- SKETCHPLUGIN_EXPORT virtual AISObjectPtr
- getAISObject(AISObjectPtr thePrevious);
+ SKETCHPLUGIN_EXPORT AISObjectPtr
+ getAISObject(AISObjectPtr thePrevious) override;
/// \brief Use plugin manager for features creation
SketchPlugin_ConstraintVertical();
AttributeRefAttrListPtr aPointsAttr = refattrlist(POINTS_ID());
std::list<std::pair<ObjectPtr, AttributePtr>> aPointsList =
aPointsAttr->list();
- std::list<std::pair<ObjectPtr, AttributePtr>>::iterator aLastIt =
- --aPointsList.end();
+ auto aLastIt = --aPointsList.end();
for (auto it = aPointsList.begin(); it != aPointsList.end(); ++it) {
AttributePtr anAttr = it->second;
if (!anAttr) {
std::list<std::pair<ObjectPtr, AttributePtr>> aPointsList =
aPointsAttr->list();
- std::list<GeomPointPtr>::iterator aCoordIt = aCoordinates.begin();
- std::list<std::pair<ObjectPtr, AttributePtr>>::iterator anAttrIt =
- aPointsList.begin();
+ auto aCoordIt = aCoordinates.begin();
+ auto anAttrIt = aPointsList.begin();
for (; aCoordIt != aCoordinates.end() && anAttrIt != aPointsList.end();
++aCoordIt, ++anAttrIt)
aMap[*aCoordIt] = *anAttrIt;
std::list<GeomPointPtr> &thePoints) {
std::list<std::pair<ObjectPtr, AttributePtr>> aPointsList =
theAttribute->list();
- for (auto it = aPointsList.begin(); it != aPointsList.end(); ++it) {
- AttributePtr anAttr = it->second;
+ for (auto &it : aPointsList) {
+ AttributePtr anAttr = it.second;
if (!anAttr) {
// maybe the SketchPoint is selected
- FeaturePtr aFeature = ModelAPI_Feature::feature(it->first);
+ FeaturePtr aFeature = ModelAPI_Feature::feature(it.first);
if (aFeature && aFeature->getKind() == SketchPlugin_Point::ID())
anAttr = aFeature->attribute(SketchPlugin_Point::COORD_ID());
else {
}
/// Returns the kind of a feature
- SKETCHPLUGIN_EXPORT virtual const std::string &getKind() {
+ SKETCHPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = SketchPlugin_CurveFitting::ID();
return MY_KIND;
}
/// Returns the AIS preview
- virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious);
+ AISObjectPtr getAISObject(AISObjectPtr thePrevious) override;
/// Creates a new part document if needed
- SKETCHPLUGIN_EXPORT virtual void execute();
+ SKETCHPLUGIN_EXPORT void execute() override;
/// Reimplemented from ModelAPI_Feature::isMacro().
/// \returns true
- SKETCHPLUGIN_EXPORT virtual bool isMacro() const { return true; };
+ SKETCHPLUGIN_EXPORT bool isMacro() const override { return true; };
- SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; };
+ SKETCHPLUGIN_EXPORT bool isPreviewNeeded() const override { return false; };
/// Performs some functionality by action id.
/// \param[in] theAttributeId action key id.
/// \return false in case if action not performed.
- SKETCHPLUGIN_EXPORT virtual bool customAction(const std::string &theActionId);
+ SKETCHPLUGIN_EXPORT bool
+ customAction(const std::string &theActionId) override;
/// Use plugin manager for features creation
SketchPlugin_CurveFitting();
protected:
/// \brief Initializes attributes of derived class.
- virtual void initDerivedClassAttributes();
+ void initDerivedClassAttributes() override;
private:
/// \brief Create a feature, which passes through the selected points
}
bool SketchPlugin_Ellipse::isFixed() {
- return data()->selection(EXTERNAL_ID())->context().get() != NULL;
+ return data()->selection(EXTERNAL_ID())->context().get() != nullptr;
}
void SketchPlugin_Ellipse::attributeChanged(const std::string &theID) {
static const double PI = 3.141592653589793238463;
SketchPlugin_EllipticArc::SketchPlugin_EllipticArc()
- : SketchPlugin_SketchEntity(), myParamDelta(0.0) {}
+ : SketchPlugin_SketchEntity() {}
void SketchPlugin_EllipticArc::initDerivedClassAttributes() {
data()->addAttribute(CENTER_ID(), GeomDataAPI_Point2D::typeId());
}
bool SketchPlugin_EllipticArc::isFixed() {
- return data()->selection(EXTERNAL_ID())->context().get() != NULL;
+ return data()->selection(EXTERNAL_ID())->context().get() != nullptr;
}
void SketchPlugin_EllipticArc::attributeChanged(const std::string &theID) {
void createEllipticArc(SketchPlugin_Sketch *theSketch);
private:
- double myParamDelta;
+ double myParamDelta{0.0};
};
#endif
AttributeRefAttrPtr anAttribute =
std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
- if (anAttribute.get() != NULL) {
+ if (anAttribute.get() != nullptr) {
FeaturePtr anArgumentFeature =
ModelAPI_Feature::feature(anAttribute->object());
- if (anArgumentFeature.get() != NULL) {
+ if (anArgumentFeature.get() != nullptr) {
std::shared_ptr<SketchPlugin_Feature> aSketchFeature =
std::dynamic_pointer_cast<SketchPlugin_Feature>(anArgumentFeature);
- if (aSketchFeature.get() != NULL) {
+ if (aSketchFeature.get() != nullptr) {
isExternal = aSketchFeature->isExternal();
}
}
/// \param theAttribute an attribute to check
/// \param theArguments a filter parameters
/// \param theError error message
- SKETCHPLUGIN_EXPORT virtual bool
- isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ SKETCHPLUGIN_EXPORT bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
protected:
/// returns true if the feature of the attribute is external
/// can be used in outside libraries through casting without a link to the
/// current library.
-SketchPlugin_Feature::SketchPlugin_Feature() { mySketch = 0; }
+SketchPlugin_Feature::SketchPlugin_Feature() { mySketch = nullptr; }
SketchPlugin_Sketch *SketchPlugin_Feature::sketch() {
if (!mySketch) {
// find sketch that references to this feature
const std::set<AttributePtr> &aBackRefs = data()->refsToMe();
- std::set<AttributePtr>::const_iterator aBackRef = aBackRefs.begin();
+ auto aBackRef = aBackRefs.begin();
for (; aBackRef != aBackRefs.end(); aBackRef++) {
std::shared_ptr<SketchPlugin_Sketch> aSketch =
std::dynamic_pointer_cast<SketchPlugin_Sketch>((*aBackRef)->owner());
findFeaturesToRemove(const FeaturePtr theFeature,
const AttributePtr theAttribute);
-SketchPlugin_Fillet::SketchPlugin_Fillet()
- : myIsReversed(false), myFilletCreated(false) {
+SketchPlugin_Fillet::SketchPlugin_Fillet() {
myIsNotInversed[0] = myIsNotInversed[1] = true;
}
ModelAPI_EventCreator::get()->sendUpdated(aConstraint, anUpdateEvent);
// Create tangent features.
- for (int i = 0; i < 2; i++) {
+ for (auto &myBaseFeature : myBaseFeatures) {
aConstraint = SketchPlugin_Tools::createConstraintObjectObject(
sketch(), SketchPlugin_ConstraintTangent::ID(),
- aFilletArc->lastResult(), myBaseFeatures[i]->lastResult());
+ aFilletArc->lastResult(), myBaseFeature->lastResult());
aConstraint->execute();
ModelAPI_EventCreator::get()->sendUpdated(aConstraint, anUpdateEvent);
}
static Events_ID anUpdateEvent =
Events_Loop::eventByName(EVENT_OBJECT_UPDATED);
FeaturePtr aConstraint;
- for (int i = 0; i < 2; i++) {
+ for (auto &myBaseFeature : myBaseFeatures) {
aConstraint = SketchPlugin_Tools::createConstraintAttrObject(
sketch(), SketchPlugin_ConstraintCoincidence::ID(), aCoord,
- myBaseFeatures[i]->lastResult());
+ myBaseFeature->lastResult());
aConstraint->execute();
ModelAPI_EventCreator::get()->sendUpdated(aConstraint, anUpdateEvent);
}
FeaturePtr aFilletApex;
std::list<Length> aLengthToDistance;
- std::set<FeaturePtr>::iterator aFeat = theFeaturesToRemove.begin();
+ auto aFeat = theFeaturesToRemove.begin();
while (aFeat != theFeaturesToRemove.end()) {
std::shared_ptr<SketchPlugin_ConstraintDistance> aDistance =
std::dynamic_pointer_cast<SketchPlugin_ConstraintDistance>(*aFeat);
}
}
// avoid distance from removing if it is updated
- std::set<FeaturePtr>::iterator aKeepIt = aFeat++;
+ auto aKeepIt = aFeat++;
if (isUpdated)
theFeaturesToRemove.erase(aKeepIt);
// restore Length constraints as point-point distances
FeaturePtr aConstraint;
- std::list<Length>::iterator anIt = aLengthToDistance.begin();
+ auto anIt = aLengthToDistance.begin();
for (; anIt != aLengthToDistance.end(); ++anIt) {
aConstraint = SketchPlugin_Tools::createConstraintAttrAttr(
sketch(), SketchPlugin_ConstraintDistance::ID(), anIt->myPoints[0],
std::set<FeaturePtr> aFeaturesToBeRemoved;
std::set<AttributePtr> aRefs = theFeature->data()->refsToMe();
std::list<ResultPtr> aResults = theFeature->results();
- for (std::list<ResultPtr>::const_iterator aResultsIt = aResults.cbegin();
- aResultsIt != aResults.cend(); ++aResultsIt) {
- ResultPtr aResult = *aResultsIt;
+ for (auto aResult : aResults) {
std::set<AttributePtr> aResultRefs = aResult->data()->refsToMe();
aRefs.insert(aResultRefs.begin(), aResultRefs.end());
}
- for (std::set<AttributePtr>::const_iterator anIt = aRefs.cbegin();
- anIt != aRefs.cend(); ++anIt) {
- std::shared_ptr<ModelAPI_Attribute> anAttr = (*anIt);
+ for (const auto &aRef : aRefs) {
+ std::shared_ptr<ModelAPI_Attribute> anAttr = aRef;
FeaturePtr aFeature =
std::dynamic_pointer_cast<ModelAPI_Feature>(anAttr->owner());
if (aFeature->getKind() == SketchPlugin_Fillet::ID()) {
} else {
std::list<AttributePtr> anAttrs =
aFeature->data()->attributes(ModelAPI_AttributeRefAttr::typeId());
- for (std::list<AttributePtr>::const_iterator aRefAttrsIt =
- anAttrs.cbegin();
- aRefAttrsIt != anAttrs.cend(); ++aRefAttrsIt) {
+ for (const auto &anAttr : anAttrs) {
AttributeRefAttrPtr anAttrRefAttr =
- std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(*aRefAttrsIt);
+ std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(anAttr);
if (anAttrRefAttr.get() && anAttrRefAttr->attr() == theAttribute) {
aFeaturesToBeRemoved.insert(aFeature);
}
}
/// \return the kind of a feature.
- SKETCHPLUGIN_EXPORT virtual const std::string &getKind() {
+ SKETCHPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = SketchPlugin_Fillet::ID();
return MY_KIND;
}
/// \brief Creates a new part document if needed.
- SKETCHPLUGIN_EXPORT virtual void execute();
+ SKETCHPLUGIN_EXPORT void execute() override;
/// \brief Request for initialization of data model of the feature: adding all
/// attributes.
- SKETCHPLUGIN_EXPORT virtual void initAttributes();
+ SKETCHPLUGIN_EXPORT void initAttributes() override;
/// Returns the AIS preview
- SKETCHPLUGIN_EXPORT virtual AISObjectPtr
- getAISObject(AISObjectPtr thePrevious);
+ SKETCHPLUGIN_EXPORT AISObjectPtr
+ getAISObject(AISObjectPtr thePrevious) override;
/// Reimplemented from ModelAPI_Feature::isMacro().
/// \returns true
- SKETCHPLUGIN_EXPORT virtual bool isMacro() const { return true; }
+ SKETCHPLUGIN_EXPORT bool isMacro() const override { return true; }
- SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; }
+ SKETCHPLUGIN_EXPORT bool isPreviewNeeded() const override { return false; }
/// Reimplemented from SketchPlugin_Feature::move().
/// Do nothing.
private:
FeaturePtr myBaseFeatures[2];
std::string myFeatAttributes[4]; // attributes of features
- bool myIsReversed;
+ bool myIsReversed{false};
bool myIsNotInversed[2]; // indicates which point the features share
- bool myFilletCreated;
+ bool myFilletCreated{false};
std::shared_ptr<GeomAPI_XY> myCenterXY;
std::shared_ptr<GeomAPI_XY> myTangentXY1;
std::shared_ptr<GeomAPI_XY> myTangentXY2;
#include <GeomDataAPI_Point2D.h>
SketchPlugin_IntersectionPoint::SketchPlugin_IntersectionPoint()
- : SketchPlugin_SketchEntity(), myIsComputing(false) {}
+ : SketchPlugin_SketchEntity() {}
void SketchPlugin_IntersectionPoint::initDerivedClassAttributes() {
data()->addAttribute(EXTERNAL_FEATURE_ID(),
anExistentIntersections.begin();
const std::list<ResultPtr> &aResults = results();
- std::list<ResultPtr>::const_iterator aResIt = aResults.begin();
+ auto aResIt = aResults.begin();
int aResultIndex = 0;
- for (std::list<GeomPointPtr>::iterator aPntIt =
- anIntersectionsPoints.begin();
+ for (auto aPntIt = anIntersectionsPoints.begin();
aPntIt != anIntersectionsPoints.end(); ++aPntIt, ++aResultIndex) {
std::shared_ptr<SketchPlugin_Point> aCurSketchPoint;
if (aExistInterIt == anExistentIntersections.end()) {
return MY_POINT_ID;
}
/// Returns the kind of a feature
- virtual const std::string &getKind() {
+ const std::string &getKind() override {
static std::string MY_KIND = SketchPlugin_IntersectionPoint::ID();
return MY_KIND;
}
}
/// Returns true because intersection point is always external
- virtual bool isFixed() { return true; }
+ bool isFixed() override { return true; }
/// Returns true if the feature and the feature results can be displayed.
/// \return false
- virtual bool canBeDisplayed() const { return false; }
+ bool canBeDisplayed() const override { return false; }
/// Creates a new part document if needed
- SKETCHPLUGIN_EXPORT virtual void execute();
+ SKETCHPLUGIN_EXPORT void execute() override;
/// Called on change of any argument-attribute of this object: for external
/// point
- SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID);
+ SKETCHPLUGIN_EXPORT void attributeChanged(const std::string &theID) override;
/// Use plugin manager for features creation
SketchPlugin_IntersectionPoint();
protected:
/// \brief Initializes attributes of derived class.
- virtual void initDerivedClassAttributes();
+ void initDerivedClassAttributes() override;
private:
/// \brief Find intersection between a line and a sketch plane
void computePoint(const std::string &theID);
- bool myIsComputing;
+ bool myIsComputing{false};
};
#endif
}
}
-SketchPlugin_MacroArc::SketchPlugin_MacroArc()
- : SketchPlugin_SketchEntity(), myParamBefore(0.0) {}
+SketchPlugin_MacroArc::SketchPlugin_MacroArc() : SketchPlugin_SketchEntity() {}
void SketchPlugin_MacroArc::initAttributes() {
data()->addAttribute(ARC_TYPE(), ModelAPI_AttributeString::typeId());
std::shared_ptr<GeomAPI_Pnt2d> myEnd;
/// To define in which direction draw arc.
- double myParamBefore;
+ double myParamBefore{0.0};
};
#endif
const void *theSender)
: ModelAPI_EventReentrantMessage(theID, theSender) {}
/// The virtual destructor
- SKETCHPLUGIN_EXPORT virtual ~SketchPlugin_MacroArcReentrantMessage() {}
+ SKETCHPLUGIN_EXPORT ~SketchPlugin_MacroArcReentrantMessage() override =
+ default;
/// Static. Returns EventID of the message.
inline static Events_ID eventId() {
const int thePoleIndex);
SketchPlugin_MacroBSpline::SketchPlugin_MacroBSpline()
- : SketchPlugin_SketchEntity(), myDegree(3), myIsPeriodic(false) {}
+ : SketchPlugin_SketchEntity() {}
SketchPlugin_MacroBSpline::SketchPlugin_MacroBSpline(bool isPeriodic)
: SketchPlugin_SketchEntity(), myDegree(3), myIsPeriodic(isPeriodic) {}
aBSpline->data()->realArray(SketchPlugin_BSplineBase::KNOTS_ID());
aSize = (int)myKnots.size();
aKnots->setSize(aSize);
- std::list<double>::iterator aKIt = myKnots.begin();
+ auto aKIt = myKnots.begin();
for (int index = 0; index < aSize; ++index, ++aKIt)
aKnots->setValue(index, *aKIt);
aBSpline->data()->intArray(SketchPlugin_BSplineBase::MULTS_ID());
aSize = (int)myMultiplicities.size();
aMults->setSize(aSize);
- std::list<int>::iterator aMIt = myMultiplicities.begin();
+ auto aMIt = myMultiplicities.begin();
for (int index = 0; index < aSize; ++index, ++aMIt)
aMults->setValue(index, *aMIt);
SketchPlugin_Sketch *aSketch = sketch();
- std::list<std::pair<ObjectPtr, AttributePtr>>::iterator aLIt = aList.begin();
- std::list<FeaturePtr>::const_iterator aPIt = thePoles.begin();
+ auto aLIt = aList.begin();
+ auto aPIt = thePoles.begin();
for (; aLIt != aList.end() && aPIt != thePoles.end(); ++aPIt, ++aLIt) {
// firstly, check the attribute (in this case the object will be not empty
// too)
}
/// Returns the kind of a feature
- SKETCHPLUGIN_EXPORT virtual const std::string &getKind() {
+ SKETCHPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = SketchPlugin_MacroBSpline::ID();
return MY_KIND;
}
/// \brief Request for initialization of data model of the feature: adding all
/// attributes.
- SKETCHPLUGIN_EXPORT virtual void initAttributes();
+ SKETCHPLUGIN_EXPORT void initAttributes() override;
/// Returns the AIS preview
- virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious);
+ AISObjectPtr getAISObject(AISObjectPtr thePrevious) override;
/// Creates a new part document if needed
- SKETCHPLUGIN_EXPORT virtual void execute();
+ SKETCHPLUGIN_EXPORT void execute() override;
/// Reimplemented from ModelAPI_Feature::isMacro().
/// \returns true
- SKETCHPLUGIN_EXPORT virtual bool isMacro() const { return true; };
+ SKETCHPLUGIN_EXPORT bool isMacro() const override { return true; };
- SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; };
+ SKETCHPLUGIN_EXPORT bool isPreviewNeeded() const override { return false; };
/// Use plugin manager for features creation
SketchPlugin_MacroBSpline();
private:
std::list<double> myKnots;
std::list<int> myMultiplicities;
- int myDegree;
- bool myIsPeriodic;
+ int myDegree{3};
+ bool myIsPeriodic{false};
};
/**\class SketchPlugin_MacroBSplinePeriodic
}
/// Returns the kind of a feature
- SKETCHPLUGIN_EXPORT virtual const std::string &getKind() {
+ SKETCHPLUGIN_EXPORT const std::string &getKind() override {
return SketchPlugin_MacroBSplinePeriodic::ID();
}
} // namespace
SketchPlugin_MacroCircle::SketchPlugin_MacroCircle()
- : SketchPlugin_SketchEntity(), myRadius(0.0) {}
+ : SketchPlugin_SketchEntity() {}
void SketchPlugin_MacroCircle::initAttributes() {
data()->addAttribute(CIRCLE_TYPE(), ModelAPI_AttributeString::typeId());
// Create constraints.
ResultPtr aCircleResult = theCircleFeature->lastResult();
- for (int i = 0; i < 3; ++i) {
- SketchPlugin_Tools::createCoincidenceOrTangency(
- this, aPointRef[i], AttributePtr(), aCircleResult, true);
+ for (const auto &i : aPointRef) {
+ SketchPlugin_Tools::createCoincidenceOrTangency(this, i, AttributePtr(),
+ aCircleResult, true);
}
}
}
/// Returns the kind of a feature
- SKETCHPLUGIN_EXPORT virtual const std::string &getKind() {
+ SKETCHPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = SketchPlugin_MacroCircle::ID();
return MY_KIND;
}
/// \brief Request for initialization of data model of the feature: adding all
/// attributes.
- SKETCHPLUGIN_EXPORT virtual void initAttributes();
+ SKETCHPLUGIN_EXPORT void initAttributes() override;
/// Called on change of any argument-attribute of this object
- SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID);
+ SKETCHPLUGIN_EXPORT void attributeChanged(const std::string &theID) override;
/// Returns the AIS preview
- virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious);
+ AISObjectPtr getAISObject(AISObjectPtr thePrevious) override;
/// Creates a new part document if needed
- SKETCHPLUGIN_EXPORT virtual void execute();
+ SKETCHPLUGIN_EXPORT void execute() override;
/// Reimplemented from ModelAPI_Feature::isMacro().
/// \returns true
- SKETCHPLUGIN_EXPORT virtual bool isMacro() const { return true; };
+ SKETCHPLUGIN_EXPORT bool isMacro() const override { return true; };
- SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; };
+ SKETCHPLUGIN_EXPORT bool isPreviewNeeded() const override { return false; };
/// Apply information of the message to current object. It fills reference
/// object, tangent type and tangent point refence in case of tangent arc
- virtual std::string
- processEvent(const std::shared_ptr<Events_Message> &theMessage);
+ std::string
+ processEvent(const std::shared_ptr<Events_Message> &theMessage) override;
/// Use plugin manager for features creation
SketchPlugin_MacroCircle();
private:
std::shared_ptr<GeomAPI_Pnt2d> myCenter;
- double myRadius;
+ double myRadius{0.0};
};
#endif
static const double TOLERANCE = 1.e-7;
SketchPlugin_MacroEllipse::SketchPlugin_MacroEllipse()
- : SketchPlugin_SketchEntity(), myMajorRadius(0.0), myMinorRadius(0.0) {}
+ : SketchPlugin_SketchEntity() {}
void SketchPlugin_MacroEllipse::initAttributes() {
data()->addAttribute(ELLIPSE_TYPE(), ModelAPI_AttributeString::typeId());
anEllipsePoints[0], anEllipsePoints[1], anEllipsePoints[2]));
}
- if (!anEllipse || anEllipse->implPtr<void>() == 0)
+ if (!anEllipse || anEllipse->implPtr<void>() == nullptr)
return;
myCenter = anEllipse->center();
}
/// Returns the kind of a feature
- SKETCHPLUGIN_EXPORT virtual const std::string &getKind() {
+ SKETCHPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = SketchPlugin_MacroEllipse::ID();
return MY_KIND;
}
/// \brief Request for initialization of data model of the feature: adding all
/// attributes.
- SKETCHPLUGIN_EXPORT virtual void initAttributes();
+ SKETCHPLUGIN_EXPORT void initAttributes() override;
/// Called on change of any argument-attribute of this object
- SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID);
+ SKETCHPLUGIN_EXPORT void attributeChanged(const std::string &theID) override;
/// Returns the AIS preview
- virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious);
+ AISObjectPtr getAISObject(AISObjectPtr thePrevious) override;
/// Creates a new part document if needed
- SKETCHPLUGIN_EXPORT virtual void execute();
+ SKETCHPLUGIN_EXPORT void execute() override;
/// Reimplemented from ModelAPI_Feature::isMacro().
/// \returns true
- SKETCHPLUGIN_EXPORT virtual bool isMacro() const { return true; }
+ SKETCHPLUGIN_EXPORT bool isMacro() const override { return true; }
- SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; }
+ SKETCHPLUGIN_EXPORT bool isPreviewNeeded() const override { return false; }
/// Apply information of the message to current object. It fills reference
/// object, tangent type and tangent point refence in case of tangent arc
- virtual std::string
- processEvent(const std::shared_ptr<Events_Message> &theMessage);
+ std::string
+ processEvent(const std::shared_ptr<Events_Message> &theMessage) override;
/// Use plugin manager for features creation
SketchPlugin_MacroEllipse();
private:
std::shared_ptr<GeomAPI_Pnt2d> myCenter;
std::shared_ptr<GeomAPI_Pnt2d> myFocus;
- double myMajorRadius;
- double myMinorRadius;
+ double myMajorRadius{0.0};
+ double myMinorRadius{0.0};
};
#endif
const double PI = 3.141592653589793238463;
SketchPlugin_MacroEllipticArc::SketchPlugin_MacroEllipticArc()
- : SketchPlugin_SketchEntity(), myMajorRadius(0.0), myMinorRadius(0.0),
- myParamDelta(0.0) {}
+ : SketchPlugin_SketchEntity() {}
void SketchPlugin_MacroEllipticArc::initAttributes() {
data()->addAttribute(CENTER_ID(), GeomDataAPI_Point2D::typeId());
anEllipsePoints[0], anEllipsePoints[1], anEllipsePoints[2]));
}
- if (!anEllipse || anEllipse->implPtr<void>() == 0)
+ if (!anEllipse || anEllipse->implPtr<void>() == nullptr)
return;
myMajorRadius = anEllipse->majorRadius();
}
/// Returns the kind of a feature
- SKETCHPLUGIN_EXPORT virtual const std::string &getKind() {
+ SKETCHPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = SketchPlugin_MacroEllipticArc::ID();
return MY_KIND;
}
/// \brief Request for initialization of data model of the feature: adding all
/// attributes.
- SKETCHPLUGIN_EXPORT virtual void initAttributes();
+ SKETCHPLUGIN_EXPORT void initAttributes() override;
/// Called on change of any argument-attribute of this object
- SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID);
+ SKETCHPLUGIN_EXPORT void attributeChanged(const std::string &theID) override;
/// Returns the AIS preview
- virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious);
+ AISObjectPtr getAISObject(AISObjectPtr thePrevious) override;
/// Creates a new part document if needed
- SKETCHPLUGIN_EXPORT virtual void execute();
+ SKETCHPLUGIN_EXPORT void execute() override;
/// Reimplemented from ModelAPI_Feature::isMacro().
/// \returns true
- SKETCHPLUGIN_EXPORT virtual bool isMacro() const { return true; }
+ SKETCHPLUGIN_EXPORT bool isMacro() const override { return true; }
- SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; }
+ SKETCHPLUGIN_EXPORT bool isPreviewNeeded() const override { return false; }
/// Apply information of the message to current object. It fills reference
/// object, tangent type and tangent point refence in case of tangent arc
- virtual std::string
- processEvent(const std::shared_ptr<Events_Message> &theMessage);
+ std::string
+ processEvent(const std::shared_ptr<Events_Message> &theMessage) override;
/// Use plugin manager for features creation
SketchPlugin_MacroEllipticArc();
std::shared_ptr<GeomAPI_Pnt2d> myMajorAxis;
std::shared_ptr<GeomAPI_Pnt2d> myStartPnt;
std::shared_ptr<GeomAPI_Pnt2d> myEndPnt;
- double myMajorRadius;
- double myMinorRadius;
- double myParamDelta;
+ double myMajorRadius{0.0};
+ double myMinorRadius{0.0};
+ double myParamDelta{0.0};
};
#endif
static const double PERIOD = 360.0;
static const double ANGLETOL = 1.e-7;
-SketchPlugin_MultiRotation::SketchPlugin_MultiRotation()
- : isUpdatingAngle(false) {}
+SketchPlugin_MultiRotation::SketchPlugin_MultiRotation() {}
void SketchPlugin_MultiRotation::initAttributes() {
data()->addAttribute(CENTER_ID(), ModelAPI_AttributeRefAttr::typeId());
for (int anInd = 0; anInd < aRotationObjectRefs->size(); anInd++) {
ObjectPtr anObject = aRotationObjectRefs->object(anInd);
std::list<ObjectPtr>::const_iterator anIt = anInitialList.begin();
- std::vector<bool>::iterator aUsedIt = isUsed.begin();
+ auto aUsedIt = isUsed.begin();
for (; anIt != anInitialList.end(); anIt++, aUsedIt++)
if (*anIt == anObject) {
*aUsedIt = true;
anAddition.push_back(anObject);
}
// remove unused items
- std::list<ObjectPtr>::iterator anInitIter = anInitialList.begin();
- std::list<ObjectPtr>::iterator aTargetIter = aTargetList.begin();
- std::vector<bool>::iterator aUsedIter = isUsed.begin();
+ auto anInitIter = anInitialList.begin();
+ auto aTargetIter = aTargetList.begin();
+ auto aUsedIter = isUsed.begin();
std::set<FeaturePtr> aFeaturesToBeRemoved;
for (; aUsedIter != isUsed.end(); aUsedIter++) {
if (!(*aUsedIter)) {
aTargetList.insert(aTargetIter, anObject);
} else {
// remove object
- std::list<ObjectPtr>::iterator aRemoveIt = aTargetIter++;
+ auto aRemoveIt = aTargetIter++;
ObjectPtr anObject = *aRemoveIt;
aTargetList.erase(aRemoveIt);
aRefListOfRotated->remove(anObject);
aRefListOfRotated->append(*aTargetIter);
}
// add new items
- std::list<ObjectPtr>::iterator anAddIter = anAddition.begin();
+ auto anAddIter = anAddition.begin();
for (; anAddIter != anAddition.end(); anAddIter++) {
aRefListOfShapes->append(*anAddIter);
aRefListOfRotated->append(*anAddIter);
std::shared_ptr<GeomAPI_Shape> aShapeIn = aResult->shape();
const std::list<ResultPtr> &aResults = aNewFeature->results();
- std::list<ResultPtr>::const_iterator anIt = aResults.begin();
+ auto anIt = aResults.begin();
for (; anIt != aResults.end(); anIt++) {
ResultConstructionPtr aRC =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*anIt);
AttributeRefListPtr aRefListOfRotated =
reflist(SketchPlugin_Constraint::ENTITY_B());
std::list<ObjectPtr> aTargetList = aRefListOfRotated->list();
- std::list<ObjectPtr>::iterator aTargetIter = aTargetList.begin();
+ auto aTargetIter = aTargetList.begin();
std::set<FeaturePtr> aFeaturesToBeRemoved;
while (aTargetIter != aTargetList.end()) {
aTargetIter++;
return MY_CONSTRAINT_ROTATION_ID;
}
/// \brief Returns the kind of a feature
- SKETCHPLUGIN_EXPORT virtual const std::string &getKind() {
+ SKETCHPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = SketchPlugin_MultiRotation::ID();
return MY_KIND;
}
}
/// \brief Creates a new part document if needed
- SKETCHPLUGIN_EXPORT virtual void execute();
+ SKETCHPLUGIN_EXPORT void execute() override;
/// \brief Request for initialization of data model of the feature: adding all
/// attributes
- SKETCHPLUGIN_EXPORT virtual void initAttributes();
+ SKETCHPLUGIN_EXPORT void initAttributes() override;
/// Called on change of any argument-attribute of this object
/// \param theID identifier of changed attribute
- SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID);
+ SKETCHPLUGIN_EXPORT void attributeChanged(const std::string &theID) override;
/// Returns the AIS preview
- SKETCHPLUGIN_EXPORT virtual AISObjectPtr
- getAISObject(AISObjectPtr thePrevious);
+ SKETCHPLUGIN_EXPORT AISObjectPtr
+ getAISObject(AISObjectPtr thePrevious) override;
/// removes all fields from this feature: results, data, etc
- SKETCHPLUGIN_EXPORT virtual void erase();
+ SKETCHPLUGIN_EXPORT void erase() override;
/// \brief Use plugin manager for features creation
SketchPlugin_MultiRotation();
bool updateFullAngleValue();
- bool isUpdatingAngle;
+ bool isUpdatingAngle{false};
};
#endif
#include <SketchPlugin_SketchEntity.h>
#include <SketcherPrs_Factory.h>
-SketchPlugin_MultiTranslation::SketchPlugin_MultiTranslation() {}
+SketchPlugin_MultiTranslation::SketchPlugin_MultiTranslation() = default;
void SketchPlugin_MultiTranslation::initAttributes() {
data()->addAttribute(VALUE_TYPE(), ModelAPI_AttributeString::typeId());
// aTranslationObjectRefs->value(anInd);
ObjectPtr anObject = aTranslationObjectRefs->object(anInd);
std::list<ObjectPtr>::const_iterator anIt = anInitialList.begin();
- std::vector<bool>::iterator aUsedIt = isUsed.begin();
+ auto aUsedIt = isUsed.begin();
for (; anIt != anInitialList.end(); anIt++, aUsedIt++)
if (*anIt == anObject) {
*aUsedIt = true;
anAddition.push_back(anObject);
}
// remove unused items
- std::list<ObjectPtr>::iterator anInitIter = anInitialList.begin();
- std::list<ObjectPtr>::iterator aTargetIter = aTargetList.begin();
- std::vector<bool>::iterator aUsedIter = isUsed.begin();
+ auto anInitIter = anInitialList.begin();
+ auto aTargetIter = aTargetList.begin();
+ auto aUsedIter = isUsed.begin();
std::set<FeaturePtr> aFeaturesToBeRemoved;
for (; aUsedIter != isUsed.end(); aUsedIter++) {
if (!(*aUsedIter)) {
aTargetList.insert(aTargetIter, anObject);
} else {
// remove object
- std::list<ObjectPtr>::iterator aRemoveIt = aTargetIter++;
+ auto aRemoveIt = aTargetIter++;
ObjectPtr anObject = *aRemoveIt;
aTargetList.erase(aRemoveIt);
aRefListOfTranslated->remove(anObject);
aRefListOfTranslated->append(*aTargetIter);
}
// add new items
- std::list<ObjectPtr>::iterator anAddIter = anAddition.begin();
+ auto anAddIter = anAddition.begin();
for (; anAddIter != anAddition.end(); anAddIter++) {
aRefListOfShapes->append(*anAddIter);
aRefListOfTranslated->append(*anAddIter);
std::shared_ptr<GeomAPI_Shape> aShapeIn = aResult->shape();
const std::list<ResultPtr> &aResults = aNewFeature->results();
- std::list<ResultPtr>::const_iterator anIt = aResults.begin();
+ auto anIt = aResults.begin();
for (; anIt != aResults.end(); anIt++) {
ResultConstructionPtr aRC =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*anIt);
AttributeRefListPtr aRefListOfTranslated =
reflist(SketchPlugin_Constraint::ENTITY_B());
std::list<ObjectPtr> aTargetList = aRefListOfTranslated->list();
- std::list<ObjectPtr>::iterator aTargetIter = aTargetList.begin();
+ auto aTargetIter = aTargetList.begin();
while (aTargetIter != aTargetList.end()) {
aTargetIter++;
for (int i = 0; i < aNbCopies && aTargetIter != aTargetList.end();
return MY_CONSTRAINT_TRANSLATION_ID;
}
/// \brief Returns the kind of a feature
- SKETCHPLUGIN_EXPORT virtual const std::string &getKind() {
+ SKETCHPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = SketchPlugin_MultiTranslation::ID();
return MY_KIND;
}
}
/// \brief Creates a new part document if needed
- SKETCHPLUGIN_EXPORT virtual void execute();
+ SKETCHPLUGIN_EXPORT void execute() override;
/// \brief Request for initialization of data model of the feature: adding all
/// attributes
- SKETCHPLUGIN_EXPORT virtual void initAttributes();
+ SKETCHPLUGIN_EXPORT void initAttributes() override;
/// Called on change of any argument-attribute of this object
/// \param theID identifier of changed attribute
- SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string &theID);
+ SKETCHPLUGIN_EXPORT void attributeChanged(const std::string &theID) override;
/// Returns the AIS preview
- SKETCHPLUGIN_EXPORT virtual AISObjectPtr
- getAISObject(AISObjectPtr thePrevious);
+ SKETCHPLUGIN_EXPORT AISObjectPtr
+ getAISObject(AISObjectPtr thePrevious) override;
/// removes all fields from this feature: results, data, etc
- SKETCHPLUGIN_EXPORT virtual void erase();
+ SKETCHPLUGIN_EXPORT void erase() override;
/// \brief Use plugin manager for features creation
SketchPlugin_MultiTranslation();
}
bool SketchPlugin_OverConstraintsResolver::checkHorizontalOrVerticalConflict() {
- std::set<ObjectPtr>::const_iterator anIt = myConstraints.begin(),
- aLast = myConstraints.end();
+ auto anIt = myConstraints.begin(), aLast = myConstraints.end();
bool isHVConstraint = false;
FeaturePtr aFeature;
for (; anIt != aLast; anIt++) {
bool SketchPlugin_OverConstraintsResolver::checkArcsAboutTangentialConflict() {
bool isConflictsFound = false;
- std::set<ObjectPtr>::const_iterator anIt = myConstraints.begin(),
- aLast = myConstraints.end();
+ auto anIt = myConstraints.begin(), aLast = myConstraints.end();
for (; anIt != aLast; anIt++) {
ObjectPtr anObject = *anIt;
ConstraintPtr aConstain =
SketchPlugin_OverConstraintsResolver();
/// Redefinition of Events_Listener method
- void processEvent(const std::shared_ptr<Events_Message> &theMessage);
+ void processEvent(const std::shared_ptr<Events_Message> &theMessage) override;
- virtual bool groupMessages() { return true; }
+ bool groupMessages() override { return true; }
protected:
/// Perform algorithm
class SketchPlugin_Plugin : public ModelAPI_Plugin, public Events_Listener {
public:
/// Creates the feature object of this plugin by the feature string ID
- SKETCHPLUGIN_EXPORT virtual FeaturePtr
- createFeature(std::string theFeatureID);
+ SKETCHPLUGIN_EXPORT FeaturePtr
+ createFeature(std::string theFeatureID) override;
/// Constructor that registers features and other plugin elements.
SKETCHPLUGIN_EXPORT SketchPlugin_Plugin();
//! Redefinition of Events_Listener method
- SKETCHPLUGIN_EXPORT virtual void
- processEvent(const std::shared_ptr<Events_Message> &theMessage);
+ SKETCHPLUGIN_EXPORT void
+ processEvent(const std::shared_ptr<Events_Message> &theMessage) override;
protected:
//! Returns the state of the feature in the WorkBench: enabled or disabled for
}
bool SketchPlugin_Point::isFixed() {
- return data()->selection(EXTERNAL_ID())->context().get() != NULL;
+ return data()->selection(EXTERNAL_ID())->context().get() != nullptr;
}
void SketchPlugin_Point::attributeChanged(const std::string &theID) {
#include <math.h>
#include <vector>
-SketchPlugin_Sketch::SketchPlugin_Sketch() {}
+SketchPlugin_Sketch::SketchPlugin_Sketch() = default;
void SketchPlugin_Sketch::initAttributes() {
data()->addAttribute(SketchPlugin_Sketch::ORIGIN_ID(),
const std::list<std::shared_ptr<ModelAPI_Result>> &aRes =
aFeature->results();
- std::list<std::shared_ptr<ModelAPI_Result>>::const_iterator aResIter =
- aRes.cbegin();
+ auto aResIter = aRes.cbegin();
for (; aResIter != aRes.cend(); aResIter++) {
std::shared_ptr<ModelAPI_ResultConstruction> aConstr =
std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aResIter);
Events_Loop::eventByName(EVENT_OBJECT_UPDATED);
std::list<ObjectPtr> aSubs =
data()->reflist(SketchPlugin_Sketch::FEATURES_ID())->list();
- std::list<ObjectPtr>::iterator aSub = aSubs.begin();
+ auto aSub = aSubs.begin();
for (; aSub != aSubs.end(); aSub++) {
if (aSub->get()) {
if (areCoordPlanes)
bool SketchPlugin_Sketch::removeLinksToExternal() {
std::list<FeaturePtr> aRemove;
std::list<ObjectPtr> aSubs = reflist(FEATURES_ID())->list();
- for (std::list<ObjectPtr>::iterator anIt = aSubs.begin(); anIt != aSubs.end();
- ++anIt) {
- FeaturePtr aFeature = ModelAPI_Feature::feature(*anIt);
+ for (auto &aSub : aSubs) {
+ FeaturePtr aFeature = ModelAPI_Feature::feature(aSub);
if (!aFeature)
continue;
if (isExternalBased(aFeature)) {
}
}
}
- for (std::list<FeaturePtr>::iterator anIt = aRemove.begin();
- anIt != aRemove.end(); ++anIt)
- document()->removeFeature(*anIt);
+ for (auto &anIt : aRemove)
+ document()->removeFeature(anIt);
return true;
}
ObjectPtr theOY, ObjectPtr theOZ) {
if (theAxisToCompare) {
ObjectPtr anAxes[] = {theOX, theOY, theOZ};
- for (int i = 0; i < 3; ++i) {
- ResultPtr anAx = std::dynamic_pointer_cast<ModelAPI_Result>(anAxes[i]);
+ for (auto &anAxe : anAxes) {
+ ResultPtr anAx = std::dynamic_pointer_cast<ModelAPI_Result>(anAxe);
if (anAx && theAxisToCompare->isEqual(anAx->shape()))
- return anAxes[i];
+ return anAxe;
}
}
return ObjectPtr();
std::list<ResultPtr> anOldResults = theOld->results();
std::list<ResultPtr> aNewResults = theNew->results();
- for (std::list<ResultPtr>::iterator it1 = anOldResults.begin(),
- it2 = aNewResults.begin();
+ for (auto it1 = anOldResults.begin(), it2 = aNewResults.begin();
it1 != anOldResults.end() && it2 != aNewResults.end(); ++it1, ++it2) {
myObjects[*it1] = *it2;
checkPostponed(*it1);
auto aFound = myPostponed.find(theOld);
if (aFound == myPostponed.end())
return;
- for (auto it = aFound->second.begin(); it != aFound->second.end(); ++it)
- copyAttribute(it->first, it->second, *this);
+ for (auto &it : aFound->second)
+ copyAttribute(it.first, it.second, *this);
myPostponed.erase(aFound);
}
MapEntities &theMapOldNew) {
// copy only if all referred objects/attribute are already transfered
std::list<std::pair<ObjectPtr, AttributePtr>> aRefs = theOld->list();
- for (std::list<std::pair<ObjectPtr, AttributePtr>>::iterator anIt =
- aRefs.begin();
- anIt != aRefs.end(); ++anIt) {
+ for (auto &aRef : aRefs) {
ObjectPtr aNewObj =
- anIt->first ? theMapOldNew.find(anIt->first) : ObjectPtr();
+ aRef.first ? theMapOldNew.find(aRef.first) : ObjectPtr();
AttributePtr aNewAttr =
- anIt->second ? theMapOldNew.find(anIt->second) : AttributePtr();
+ aRef.second ? theMapOldNew.find(aRef.second) : AttributePtr();
if (aNewObj || aNewAttr)
- *anIt = std::pair<ObjectPtr, AttributePtr>(aNewObj, aNewAttr);
+ aRef = std::pair<ObjectPtr, AttributePtr>(aNewObj, aNewAttr);
else {
- if (anIt->first)
- theMapOldNew.postpone(anIt->first, theOld, theNew);
+ if (aRef.first)
+ theMapOldNew.postpone(aRef.first, theOld, theNew);
else
- theMapOldNew.postpone(anIt->second->owner(), theOld, theNew);
+ theMapOldNew.postpone(aRef.second->owner(), theOld, theNew);
return;
}
}
// update the RefAttrList
theNew->clear();
- for (std::list<std::pair<ObjectPtr, AttributePtr>>::iterator anIt =
- aRefs.begin();
- anIt != aRefs.end(); ++anIt) {
- if (anIt->first)
- theNew->append(anIt->first);
+ for (auto &aRef : aRefs) {
+ if (aRef.first)
+ theNew->append(aRef.first);
else
- theNew->append(anIt->second);
+ theNew->append(aRef.second);
}
}
MapEntities &theMapOldNew) {
// copy only if all referred objects are already transfered
std::list<ObjectPtr> aRefs = theOld->list();
- for (std::list<ObjectPtr>::iterator anIt = aRefs.begin(); anIt != aRefs.end();
- ++anIt) {
- ObjectPtr aNew = theMapOldNew.find(*anIt);
+ for (auto &aRef : aRefs) {
+ ObjectPtr aNew = theMapOldNew.find(aRef);
if (aNew)
- *anIt = aNew;
+ aRef = aNew;
else {
- theMapOldNew.postpone(*anIt, theOld, theNew);
+ theMapOldNew.postpone(aRef, theOld, theNew);
return;
}
}
// update theRefList
theNew->clear();
- for (std::list<ObjectPtr>::iterator anIt = aRefs.begin(); anIt != aRefs.end();
- ++anIt)
- theNew->append(*anIt);
+ for (auto &aRef : aRefs)
+ theNew->append(aRef);
}
static void copySelection(AttributeSelectionPtr theOld,
const std::list<ResultPtr> &anOldResults = theOld->results();
const std::list<ResultPtr> &aNewResults = theNew->results();
- for (std::list<ResultPtr>::const_iterator it0 = anOldResults.begin(),
- it1 = aNewResults.begin();
+ for (auto it0 = anOldResults.begin(), it1 = aNewResults.begin();
it0 != anOldResults.end() && it1 != aNewResults.end(); ++it0, ++it1) {
(*it1)->data()->setName((*it0)->data()->name());
SketchPlugin_Tools::replaceInName(*it1, anOldName, aNewName);
FeaturePtr aNewFeature = theSketch->addFeature(theFeature->getKind());
theFeature->data()->copyTo(aNewFeature->data());
int aResultIndex = 0;
- for (std::list<ResultPtr>::const_iterator aRIt =
- theFeature->results().begin();
+ for (auto aRIt = theFeature->results().begin();
aRIt != theFeature->results().end(); ++aRIt) {
ResultConstructionPtr aResult = theSketch->document()->createConstruction(
aNewFeature->data(), aResultIndex);
aNewFeature->data()->blockSendAttributeUpdated(true, false);
std::list<AttributePtr> anAttrs =
aNewFeature->data()->attributes(std::string());
- for (std::list<AttributePtr>::iterator anIt = anAttrs.begin();
- anIt != anAttrs.end(); ++anIt) {
- AttributePtr anOldAttr = theFeature->attribute((*anIt)->id());
- copyAttribute(anOldAttr, *anIt, theMapOldNew);
+ for (auto &anAttr : anAttrs) {
+ AttributePtr anOldAttr = theFeature->attribute(anAttr->id());
+ copyAttribute(anOldAttr, anAttr, theMapOldNew);
}
aNewFeature->data()->blockSendAttributeUpdated(aWasBlocked, false);
std::wstring aSketchName = aBaseSketch->name() + SKETCH_NAME_SUFFIX;
int aNewSketchIndex = 0;
std::list<FeaturePtr> aFeatures = document()->allFeatures();
- for (std::list<FeaturePtr>::iterator aFIt = aFeatures.begin();
- aFIt != aFeatures.end(); ++aFIt) {
- if ((*aFIt)->getKind() != SketchPlugin_Sketch::ID())
+ for (auto &aFeature : aFeatures) {
+ if (aFeature->getKind() != SketchPlugin_Sketch::ID())
continue;
- int anIndex = index((*aFIt)->name(), aSketchName);
+ int anIndex = index(aFeature->name(), aSketchName);
if (anIndex >= aNewSketchIndex)
aNewSketchIndex = anIndex + 1;
- anIndex = index((*aFIt)->lastResult()->data()->name(), aSketchName);
+ anIndex = index(aFeature->lastResult()->data()->name(), aSketchName);
if (anIndex >= aNewSketchIndex)
aNewSketchIndex = anIndex + 1;
}
}
/// \return the kind of a feature.
- SKETCHPLUGIN_EXPORT virtual const std::string &getKind() {
+ SKETCHPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = SketchPlugin_SketchCopy::ID();
return MY_KIND;
}
/// Creates a new sketch.
- SKETCHPLUGIN_EXPORT virtual void execute();
+ SKETCHPLUGIN_EXPORT void execute() override;
/// Request for initialization of data model of the feature: adding all
/// attributes.
- SKETCHPLUGIN_EXPORT virtual void initAttributes();
+ SKETCHPLUGIN_EXPORT void initAttributes() override;
/// Means that feature is removed on apply.
- SKETCHPLUGIN_EXPORT virtual bool isMacro() const { return true; }
+ SKETCHPLUGIN_EXPORT bool isMacro() const override { return true; }
/// No preview is generated until it is applied.
- SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; }
+ SKETCHPLUGIN_EXPORT bool isPreviewNeeded() const override { return false; }
};
#endif
// and arcs
}
// check some resulting points are coincident to existing
- std::list<std::pair<GeomPnt2dPtr, std::string>>::iterator aPIter =
- aPoints.begin();
+ auto aPIter = aPoints.begin();
for (; aPIter != aPoints.end(); aPIter++) {
AttributePoint2DPtr aPointAttr =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
anItem->attribute(aPIter->second));
- std::list<AttributePoint2DPtr>::iterator aCoincIter =
- aCreatedPoints.begin();
+ auto aCoincIter = aCreatedPoints.begin();
for (; aCoincIter != aCreatedPoints.end(); aCoincIter++) {
double aDX = (*aCoincIter)->x() - aPIter->first->x();
if (fabs(aDX) >= kTOL)
}
/// \return the kind of a feature.
- SKETCHPLUGIN_EXPORT virtual const std::string &getKind() {
+ SKETCHPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = SketchPlugin_SketchDrawer::ID();
return MY_KIND;
}
/// Creates a new sketch.
- SKETCHPLUGIN_EXPORT virtual void execute();
+ SKETCHPLUGIN_EXPORT void execute() override;
/// Request for initialization of data model of the feature: adding all
/// attributes.
- SKETCHPLUGIN_EXPORT virtual void initAttributes();
+ SKETCHPLUGIN_EXPORT void initAttributes() override;
/// Reimplemented from ModelAPI_Feature::isMacro(). Means that feature is
/// removed on apply. \returns true
- SKETCHPLUGIN_EXPORT virtual bool isMacro() const { return true; }
+ SKETCHPLUGIN_EXPORT bool isMacro() const override { return true; }
/// No preview is generated until it is applied.
- SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; }
+ SKETCHPLUGIN_EXPORT bool isPreviewNeeded() const override { return false; }
};
#endif
static const double PI = 3.141592653589793238463;
-SketchPlugin_Split::SketchPlugin_Split() {}
+SketchPlugin_Split::SketchPlugin_Split() = default;
void SketchPlugin_Split::initAttributes() {
data()->addAttribute(SELECTED_OBJECT(),
theFurtherCoincidences.end())
aNewCoincidencesToSplitFeature.insert(anEndPointAttr);
- std::map<FeaturePtr, IdToPointPair>::const_iterator
- aCIt = theCoincidenceToFeature.begin(),
- aCLast = theCoincidenceToFeature.end();
+ auto aCIt = theCoincidenceToFeature.begin(),
+ aCLast = theCoincidenceToFeature.end();
#ifdef DEBUG_SPLIT
std::cout << std::endl;
std::cout << "Coincidences to feature(modified):" << std::endl;
: SketchPlugin_Constraint::ENTITY_A();
AttributePoint2DPtr aCoincPoint = aCIt->second.second;
- std::set<AttributePoint2DPtr>::const_iterator
- aFCIt = theFurtherCoincidences.begin(),
- aFCLast = theFurtherCoincidences.end();
+ auto aFCIt = theFurtherCoincidences.begin(),
+ aFCLast = theFurtherCoincidences.end();
std::shared_ptr<GeomAPI_Pnt2d> aCoincPnt = aCoincPoint->pnt();
AttributePoint2DPtr aFeaturePointAttribute;
for (; aFCIt != aFCLast && !aFeaturePointAttribute.get(); aFCIt++) {
aCoincFeature->refattr(aSecondAttribute)->attr());
theFeaturesToDelete.insert(aCIt->first);
// create new coincidences to split feature points
- std::set<AttributePoint2DPtr>::const_iterator
- aSFIt = aNewCoincidencesToSplitFeature.begin(),
- aSFLast = aNewCoincidencesToSplitFeature.end();
+ auto aSFIt = aNewCoincidencesToSplitFeature.begin(),
+ aSFLast = aNewCoincidencesToSplitFeature.end();
for (; aSFIt != aSFLast; aSFIt++) {
AttributePoint2DPtr aSFAttribute = *aSFIt;
if (aCoincPnt->isEqual(aSFAttribute->pnt())) {
void SketchPlugin_Split::updateRefFeatureConstraints(
const ResultPtr &theFeatureBaseResult,
const std::list<AttributePtr> &theRefsToFeature) {
- std::list<AttributePtr>::const_iterator anIt = theRefsToFeature.begin(),
- aLast = theRefsToFeature.end();
+ auto anIt = theRefsToFeature.begin(), aLast = theRefsToFeature.end();
for (; anIt != aLast; anIt++) {
AttributeRefAttrPtr aRefAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(*anIt);
// ellipse
const std::set<AttributePtr> &aRefs = aBaseFeature->data()->refsToMe();
std::list<AttributePtr> aRefsToParent;
- for (std::set<AttributePtr>::const_iterator aRef = aRefs.begin();
- aRef != aRefs.end(); ++aRef) {
- if ((*aRef)->id() == SketchPlugin_SketchEntity::PARENT_ID())
- aRefsToParent.push_back(*aRef);
+ for (const auto &aRef : aRefs) {
+ if (aRef->id() == SketchPlugin_SketchEntity::PARENT_ID())
+ aRefsToParent.push_back(aRef);
}
- for (std::list<AttributePtr>::iterator aRef = aRefsToParent.begin();
- aRef != aRefsToParent.end(); ++aRef) {
- std::dynamic_pointer_cast<ModelAPI_AttributeReference>(*aRef)->setValue(
+ for (auto &aRef : aRefsToParent) {
+ std::dynamic_pointer_cast<ModelAPI_AttributeReference>(aRef)->setValue(
theBaseFeatureModified);
- FeaturePtr anOwner = ModelAPI_Feature::feature((*aRef)->owner());
+ FeaturePtr anOwner = ModelAPI_Feature::feature(aRef->owner());
SketchPlugin_Tools::replaceInName(anOwner, aBaseFeature->name(),
theBaseFeatureModified->name());
SketchPlugin_Tools::replaceInName(anOwner->lastResult(),
// find the points in coincident features
const GeomAlgoAPI_ShapeTools::PointToRefsMap &aRefAttributes =
myCashedReferences.at(aBaseObject);
- GeomAlgoAPI_ShapeTools::PointToRefsMap::const_iterator
- aRIt = aRefAttributes.begin(),
- aRLast = aRefAttributes.end();
+ auto aRIt = aRefAttributes.begin(), aRLast = aRefAttributes.end();
for (; aRIt != aRLast; aRIt++) {
const std::list<AttributePoint2DPtr> &anAttributes = aRIt->second.first;
GeomPointPtr aPoint = aRIt->first;
class ModelAPI_Feature;
class ModelAPI_Result;
-typedef std::pair<std::string, std::shared_ptr<GeomDataAPI_Point2D>>
- IdToPointPair;
+using IdToPointPair =
+ std::pair<std::string, std::shared_ptr<GeomDataAPI_Point2D>>;
/** \class SketchPlugin_Split
* \ingroup Plugins
return MY_SPLIT_ID;
}
/// \brief Returns the kind of a feature
- SKETCHPLUGIN_EXPORT virtual const std::string &getKind() {
+ SKETCHPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = SketchPlugin_Split::ID();
return MY_KIND;
}
}
/// \brief Creates a new part document if needed
- SKETCHPLUGIN_EXPORT virtual void execute();
+ SKETCHPLUGIN_EXPORT void execute() override;
/// \brief Request for initialization of data model of the feature: adding all
/// attributes
- SKETCHPLUGIN_EXPORT virtual void initAttributes();
+ SKETCHPLUGIN_EXPORT void initAttributes() override;
/// Reimplemented from ModelAPI_Feature::isMacro().
/// \returns true
- SKETCHPLUGIN_EXPORT virtual bool isMacro() const { return true; }
+ SKETCHPLUGIN_EXPORT bool isMacro() const override { return true; }
/// Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false.
/// This is necessary to perform execute only by apply the feature
- SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; }
+ SKETCHPLUGIN_EXPORT bool isPreviewNeeded() const override { return false; }
/// \brief Use plugin manager for features creation
SketchPlugin_Split();
/// Returns the AIS preview
- SKETCHPLUGIN_EXPORT virtual AISObjectPtr
- getAISObject(AISObjectPtr thePrevious);
+ SKETCHPLUGIN_EXPORT AISObjectPtr
+ getAISObject(AISObjectPtr thePrevious) override;
/// Apply information of the message to current object. It fills selected
/// point and object
- virtual std::string
- processEvent(const std::shared_ptr<Events_Message> &theMessage);
+ std::string
+ processEvent(const std::shared_ptr<Events_Message> &theMessage) override;
private:
/// Obtains those constraints of the feature that should be modified. output
std::list<AttributePtr> anAttributes =
theFeature->data()->attributes(std::string());
- std::list<AttributePtr>::iterator anAttributeIt = anAttributes.begin();
+ auto anAttributeIt = anAttributes.begin();
for (; anAttributeIt != anAttributes.end(); ++anAttributeIt) {
clearExpressions(*anAttributeIt);
}
getCoincidencePoint(const FeaturePtr theStartCoin) {
std::shared_ptr<GeomAPI_Pnt2d> aPnt = SketcherPrs_Tools::getPoint(
theStartCoin.get(), SketchPlugin_Constraint::ENTITY_A());
- if (aPnt.get() == NULL)
+ if (aPnt.get() == nullptr)
aPnt = SketcherPrs_Tools::getPoint(theStartCoin.get(),
SketchPlugin_Constraint::ENTITY_B());
return aPnt;
FeaturePtr aObj = ModelAPI_Feature::feature(aPnt->object());
if (theList.find(aObj) == theList.end()) {
std::shared_ptr<GeomAPI_Pnt2d> aOrig = getCoincidencePoint(theStartCoin);
- if (aOrig.get() == NULL) {
+ if (aOrig.get() == nullptr) {
return;
}
if (!theIsAttrOnly || !aPnt->isObject()) {
theList.insert(aObj);
}
std::set<FeaturePtr> aCoincidences = findCoincidentConstraints(aObj);
- std::set<FeaturePtr>::const_iterator aCIt = aCoincidences.begin();
+ auto aCIt = aCoincidences.begin();
for (; aCIt != aCoincidences.end(); ++aCIt) {
FeaturePtr aConstrFeature = *aCIt;
std::shared_ptr<GeomAPI_Pnt2d> aPnt2d =
aCoincidentFeatures.insert(anOwner);
std::set<FeaturePtr> aCoincidences = findCoincidentConstraints(anOwner);
- std::set<FeaturePtr>::const_iterator aCIt = aCoincidences.begin();
+ auto aCIt = aCoincidences.begin();
for (; aCIt != aCoincidences.end(); ++aCIt) {
bool isPointUsedInCoincidence = false;
AttributeRefAttrPtr anOtherCoincidentAttr;
if (thePoint2)
(*aFound1)[thePoint2].insert(theIndex2);
} else {
- for (auto it = aFound2->begin(); it != aFound2->end(); ++it)
- (*aFound1)[it->first].insert(it->second.begin(), it->second.end());
+ for (auto &it : *aFound2)
+ (*aFound1)[it.first].insert(it.second.begin(), it.second.end());
myCoincidentPoints.erase(aFound2);
}
}
std::set<AttributePoint2DPtr> aCoincPoints;
auto aFound = find(thePoint, THE_DEFAULT_INDEX);
if (aFound != myCoincidentPoints.end()) {
- for (auto it = aFound->begin(); it != aFound->end(); ++it) {
+ for (auto &it : *aFound) {
AttributePoint2DPtr aPoint =
- std::dynamic_pointer_cast<GeomDataAPI_Point2D>(it->first);
+ std::dynamic_pointer_cast<GeomDataAPI_Point2D>(it.first);
if (aPoint)
aCoincPoints.insert(aPoint);
else {
AttributePoint2DArrayPtr aPointArray =
- std::dynamic_pointer_cast<GeomDataAPI_Point2DArray>(it->first);
+ std::dynamic_pointer_cast<GeomDataAPI_Point2DArray>(it.first);
if (aPointArray) {
// this is a B-spline feature, the connection is possible
// to the first or the last point
FeaturePtr anOwner =
ModelAPI_Feature::feature(aPointArray->owner());
- if (it->second.find(0) != it->second.end()) {
+ if (it.second.find(0) != it.second.end()) {
AttributePoint2DPtr aFirstPoint =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
anOwner->attribute(SketchPlugin_BSpline::START_ID()));
aCoincPoints.insert(aFirstPoint);
}
- if (it->second.find(aPointArray->size() - 1) != it->second.end()) {
+ if (it.second.find(aPointArray->size() - 1) != it.second.end()) {
AttributePoint2DPtr aFirstPoint =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
anOwner->attribute(SketchPlugin_BSpline::END_ID()));
theFeature->lastResult());
aCoincidences.insert(aCoincToRes.begin(), aCoincToRes.end());
}
- std::set<FeaturePtr>::const_iterator aCIt = aCoincidences.begin();
+ auto aCIt = aCoincidences.begin();
for (; aCIt != aCoincidences.end(); ++aCIt) {
if (theCoincidences.find(*aCIt) != theCoincidences.end())
continue; // already processed
std::set<FeaturePtr> aCoincidences;
coincidences(anOwner, aCoincidences);
- std::set<FeaturePtr>::const_iterator aCIt = aCoincidences.begin();
+ auto aCIt = aCoincidences.begin();
for (; aCIt != aCoincidences.end(); ++aCIt) {
aPoints[0] = aPoints[1] = AttributePtr();
anIndicesInArray[0] = anIndicesInArray[1] = THE_DEFAULT_INDEX;
std::shared_ptr<GeomAPI_Pnt> aStartPoint;
std::shared_ptr<GeomAPI_Pnt> aSecondPoint;
const std::set<GeomShapePtr> &aShapes = theCashedShapes[aBaseObject];
- std::set<GeomShapePtr>::const_iterator anIt = aShapes.begin(),
- aLast = aShapes.end();
+ auto anIt = aShapes.begin(), aLast = aShapes.end();
for (; anIt != aLast; anIt++) {
GeomShapePtr aCurrentShape = *anIt;
std::shared_ptr<GeomAPI_Pnt> aProjectedPoint;
std::cout << "updateRefAttConstraints" << std::endl;
#endif
- std::set<std::pair<AttributePtr, AttributePtr>>::const_iterator
- anIt = theModifiedAttributes.begin(),
- aLast = theModifiedAttributes.end();
+ auto anIt = theModifiedAttributes.begin(),
+ aLast = theModifiedAttributes.end();
for (; anIt != aLast; anIt++) {
AttributePtr anAttribute = anIt->first;
AttributePtr aNewAttribute = anIt->second;
void SketchPlugin_SegmentationTools::updateFeaturesAfterOperation(
const std::set<FeaturePtr> &theFeaturesToUpdate) {
- std::set<FeaturePtr>::const_iterator anIt = theFeaturesToUpdate.begin(),
- aLast = theFeaturesToUpdate.end();
+ auto anIt = theFeaturesToUpdate.begin(), aLast = theFeaturesToUpdate.end();
for (; anIt != aLast; anIt++) {
FeaturePtr aRefFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(*anIt);
std::string aRefFeatureKind = aRefFeature->getKind();
std::string myEnd;
std::string myReversed;
- ArcAttributes() {}
+ ArcAttributes() = default;
ArcAttributes(const std::string &theKind) : myKind(theKind) {
if (myKind == SketchPlugin_Arc::ID()) {
static const double PI = 3.141592653589793238463;
-SketchPlugin_Trim::SketchPlugin_Trim() {}
+SketchPlugin_Trim::SketchPlugin_Trim() = default;
void SketchPlugin_Trim::initAttributes() {
data()->addAttribute(SELECTED_OBJECT(),
const std::set<GeomShapePtr> &aShapes = myCashedShapes[aBaseObject];
if (!aShapes.empty()) {
- std::set<GeomShapePtr>::const_iterator anIt = aShapes.begin(),
- aLast = aShapes.end();
+ auto anIt = aShapes.begin(), aLast = aShapes.end();
for (; anIt != aLast; anIt++) {
GeomShapePtr aBaseShape = *anIt;
std::shared_ptr<GeomAPI_Pnt> aProjectedPoint;
bool aFound = false;
const GeomAlgoAPI_ShapeTools::PointToRefsMap &aRefsMap =
myObjectToPoints.at(aBaseObject);
- for (GeomAlgoAPI_ShapeTools::PointToRefsMap::const_iterator aPointIt =
- aRefsMap.begin();
- aPointIt != aRefsMap.end() && !aFound; aPointIt++) {
+ for (auto aPointIt = aRefsMap.begin(); aPointIt != aRefsMap.end() && !aFound;
+ aPointIt++) {
if (aPointIt->first->isEqual(thePoint)) {
const std::pair<std::list<AttributePoint2DPtr>, std::list<ObjectPtr>>
&anInfo = aPointIt->second;
// create coincidence to objects, intersected the base object
const GeomAlgoAPI_ShapeTools::PointToRefsMap &aRefsMap =
myObjectToPoints.at(aBaseObject);
- for (std::set<AttributePoint2DPtr>::const_iterator
- anIt = aFurtherCoincidences.begin(),
- aLast = aFurtherCoincidences.end();
- anIt != aLast; anIt++) {
- AttributePoint2DPtr aPointAttribute = (*anIt);
+ for (const auto &aFurtherCoincidence : aFurtherCoincidences) {
+ AttributePoint2DPtr aPointAttribute = aFurtherCoincidence;
std::shared_ptr<GeomAPI_Pnt2d> aPoint2d = aPointAttribute->pnt();
#ifdef DEBUG_TRIM
continue;
std::pair<std::list<AttributePoint2DPtr>, std::list<ObjectPtr>> anInfo;
- for (GeomAlgoAPI_ShapeTools::PointToRefsMap::const_iterator aRefIt =
- aRefsMap.begin();
- aRefIt != aRefsMap.end(); aRefIt++) {
- if (aRefIt->first->isEqual(aExtrPoint)) {
- anInfo = aRefIt->second;
+ for (const auto &aRefIt : aRefsMap) {
+ if (aRefIt.first->isEqual(aExtrPoint)) {
+ anInfo = aRefIt.second;
// prefer a segment instead of a point, because further coincidence with
// a segment decreases only 1 DoF (instead of 2 for point) and prevents
// an overconstraint situation.
}
}
const std::list<ObjectPtr> &anObjects = anInfo.second;
- for (std::list<ObjectPtr>::const_iterator anObjectIt = anObjects.begin();
- anObjectIt != anObjects.end(); anObjectIt++) {
+ for (const auto &anObject : anObjects) {
SketchPlugin_Tools::createConstraintAttrObject(
sketch(), SketchPlugin_ConstraintCoincidence::ID(), aPointAttribute,
- *anObjectIt);
+ anObject);
}
}
aReplacingFeature->execute(); // need it to obtain result
aReplacingResult = aReplacingFeature->lastResult();
}
- for (std::list<AttributePtr>::const_iterator anIt = aRefsToFeature.begin(),
- aLast = aRefsToFeature.end();
- anIt != aLast; anIt++) {
- AttributePtr anAttribute = *anIt;
-
+ for (auto anAttribute : aRefsToFeature) {
if (setCoincidenceToAttribute(anAttribute, aFurtherCoincidences,
aFeaturesToDelete))
continue;
return false;
std::shared_ptr<GeomAPI_Pnt2d> aRefPnt2d = aRefPointAttr->pnt();
- std::set<AttributePoint2DPtr>::const_iterator
- anIt = theFurtherCoincidences.begin(),
- aLast = theFurtherCoincidences.end();
+ auto anIt = theFurtherCoincidences.begin(),
+ aLast = theFurtherCoincidences.end();
bool aFoundPoint = false;
for (; anIt != aLast && !aFoundPoint; anIt++) {
AttributePoint2DPtr aPointAttribute = (*anIt);
// ellipse
const std::set<AttributePtr> &aRefs = aBaseFeature->data()->refsToMe();
std::list<AttributePtr> aRefsToParent;
- for (std::set<AttributePtr>::const_iterator aRef = aRefs.begin();
- aRef != aRefs.end(); ++aRef) {
- if ((*aRef)->id() == SketchPlugin_SketchEntity::PARENT_ID())
- aRefsToParent.push_back(*aRef);
+ for (const auto &aRef : aRefs) {
+ if (aRef->id() == SketchPlugin_SketchEntity::PARENT_ID())
+ aRefsToParent.push_back(aRef);
}
- for (std::list<AttributePtr>::iterator aRef = aRefsToParent.begin();
- aRef != aRefsToParent.end(); ++aRef) {
- std::dynamic_pointer_cast<ModelAPI_AttributeReference>(*aRef)->setValue(
+ for (auto &aRef : aRefsToParent) {
+ std::dynamic_pointer_cast<ModelAPI_AttributeReference>(aRef)->setValue(
anNewFeature);
- FeaturePtr anOwner = ModelAPI_Feature::feature((*aRef)->owner());
+ FeaturePtr anOwner = ModelAPI_Feature::feature(aRef->owner());
SketchPlugin_Tools::replaceInName(anOwner, aBaseFeature->name(),
anNewFeature->name());
SketchPlugin_Tools::replaceInName(
class ModelAPI_Result;
class ModelAPI_Object;
-typedef std::pair<std::string, std::shared_ptr<GeomDataAPI_Point2D>>
- IdToPointPair;
+using IdToPointPair =
+ std::pair<std::string, std::shared_ptr<GeomDataAPI_Point2D>>;
/** \class SketchPlugin_Trim
* \ingroup Plugins
return MY_TRIM_ID;
}
/// \brief Returns the kind of a feature
- SKETCHPLUGIN_EXPORT virtual const std::string &getKind() {
+ SKETCHPLUGIN_EXPORT const std::string &getKind() override {
static std::string MY_KIND = SketchPlugin_Trim::ID();
return MY_KIND;
}
}
/// \brief Creates a new part document if needed
- SKETCHPLUGIN_EXPORT virtual void execute();
+ SKETCHPLUGIN_EXPORT void execute() override;
/// \brief Request for initialization of data model of the feature: adding all
/// attributes
- SKETCHPLUGIN_EXPORT virtual void initAttributes();
+ SKETCHPLUGIN_EXPORT void initAttributes() override;
/// Reimplemented from ModelAPI_Feature::isMacro()
/// \returns true
- SKETCHPLUGIN_EXPORT virtual bool isMacro() const { return true; }
+ SKETCHPLUGIN_EXPORT bool isMacro() const override { return true; }
/// Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false.
/// This is necessary to perform execute only by apply the feature
- SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; }
+ SKETCHPLUGIN_EXPORT bool isPreviewNeeded() const override { return false; }
/// \brief Use plugin manager for features creation
SketchPlugin_Trim();
/// Returns the AIS preview
- SKETCHPLUGIN_EXPORT virtual AISObjectPtr
- getAISObject(AISObjectPtr thePrevious);
+ SKETCHPLUGIN_EXPORT AISObjectPtr
+ getAISObject(AISObjectPtr thePrevious) override;
/// Apply information of the message to current object. It fills selected
/// point and object
- virtual std::string
- processEvent(const std::shared_ptr<Events_Message> &theMessage);
+ std::string
+ processEvent(const std::shared_ptr<Events_Message> &theMessage) override;
private:
bool setCoincidenceToAttribute(
// boundary point
std::set<FeaturePtr> aCoincidences =
SketchPlugin_Tools::findCoincidentConstraints(aRefFea);
- for (std::set<FeaturePtr>::iterator anIt = aCoincidences.begin();
+ for (auto anIt = aCoincidences.begin();
anIt != aCoincidences.end() && !isValid; ++anIt) {
std::set<FeaturePtr> aCoinc;
if (isApplicableCoincidence(*anIt, SketchPlugin_Constraint::ENTITY_A()))
SketchPlugin_Tools::findCoincidences(
*anIt, SketchPlugin_Constraint::ENTITY_A(), aCoinc, true);
- std::set<FeaturePtr>::iterator aFoundCoinc = aCoinc.find(aOtherFea);
+ auto aFoundCoinc = aCoinc.find(aOtherFea);
if (aFoundCoinc != aCoinc.end()) {
// do not take into account internal constraints
AttributeReferencePtr aParent =
bool SketchPlugin_NotFixedValidator::isValid(
const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
+ const std::list<std::string> & /*theArguments*/,
Events_InfoMessage &theError) const {
if (theAttribute->attributeType() != ModelAPI_AttributeRefAttr::typeId()) {
theError = "The attribute with the %1 type is not processed";
bool SketchPlugin_MirrorAttrValidator::isValid(
const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
+ const std::list<std::string> & /*theArguments*/,
Events_InfoMessage &theError) const {
if (theAttribute->attributeType() != ModelAPI_AttributeRefList::typeId()) {
theError = "The attribute with the %1 type is not processed";
}
std::wstring aName = aSelObject.get() ? aSelObject->data()->name() : L"";
- std::list<ObjectPtr>::iterator aMirIter = aMirroredObjects.begin();
+ auto aMirIter = aMirroredObjects.begin();
for (; aMirIter != aMirroredObjects.end(); aMirIter++)
if (aSelObject == *aMirIter) {
theError = "The object %1 is a result of mirror";
bool SketchPlugin_CopyValidator::isValid(
const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
+ const std::list<std::string> & /*theArguments*/,
Events_InfoMessage &theError) const {
if (theAttribute->attributeType() != ModelAPI_AttributeRefList::typeId()) {
theError = "The attribute with the %1 type is not processed";
std::dynamic_pointer_cast<ModelAPI_Feature>(*anObjIter);
if (aCurFeature) {
const std::list<ResultPtr> &aResults = aCurFeature->results();
- for (std::list<ResultPtr>::const_iterator aResIt = aResults.begin();
+ for (auto aResIt = aResults.begin();
aResIt != aResults.end() && !isFound; ++aResIt) {
isFound = aSelObject == *aResIt;
}
bool SketchPlugin_SolverErrorValidator::isValid(
const std::shared_ptr<ModelAPI_Feature> &theFeature,
- const std::list<std::string> &theArguments,
+ const std::list<std::string> & /*theArguments*/,
Events_InfoMessage &theError) const {
AttributeStringPtr aAttributeString =
theFeature->string(SketchPlugin_Sketch::SOLVER_ERROR());
}
bool SketchPlugin_SolverErrorValidator::isNotObligatory(
- std::string theFeature, std::string theAttribute) {
+ std::string /*theFeature*/, std::string /*theAttribute*/) {
return true;
}
static bool hasSameTangentFeature(const std::set<AttributePtr> &theRefsList,
const FeaturePtr theFeature) {
- for (std::set<AttributePtr>::const_iterator anIt = theRefsList.cbegin();
- anIt != theRefsList.cend(); ++anIt) {
- std::shared_ptr<ModelAPI_Attribute> aAttr = (*anIt);
+ for (const auto &anIt : theRefsList) {
+ std::shared_ptr<ModelAPI_Attribute> aAttr = anIt;
FeaturePtr aFeature =
std::dynamic_pointer_cast<ModelAPI_Feature>(aAttr->owner());
if (!aFeature)
arePoints =
aFeature.get() && aFeature->getKind() == SketchPlugin_Point::ID();
} else
- arePoints = aRefAttr[i]->attr().get() != NULL;
+ arePoints = aRefAttr[i]->attr().get() != nullptr;
}
return arePoints;
}
bool SketchPlugin_FilletVertexValidator::isValid(
const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
+ const std::list<std::string> & /*theArguments*/,
Events_InfoMessage &theError) const {
FeaturePtr anEdge1, anEdge2;
return isValidVertex(theAttribute, theError, anEdge1, anEdge2);
const std::set<AttributePtr> &aRefsList =
aPointAttribute->owner()->data()->refsToMe();
FeaturePtr aConstraintCoincidence;
- for (std::set<AttributePtr>::const_iterator anIt = aRefsList.cbegin();
- anIt != aRefsList.cend(); ++anIt) {
- std::shared_ptr<ModelAPI_Attribute> aAttr = (*anIt);
+ for (const auto &anIt : aRefsList) {
+ std::shared_ptr<ModelAPI_Attribute> aAttr = anIt;
FeaturePtr aConstrFeature =
std::dynamic_pointer_cast<ModelAPI_Feature>(aAttr->owner());
if (aConstrFeature->getKind() == SketchPlugin_ConstraintCoincidence::ID()) {
// Remove points and external lines from set of coincides.
std::set<FeaturePtr> aNewSetOfCoincides;
- for (std::set<FeaturePtr>::iterator anIt = aCoinsides.begin();
- anIt != aCoinsides.end(); ++anIt) {
+ for (const auto &aCoinside : aCoinsides) {
std::shared_ptr<SketchPlugin_SketchEntity> aSketchEntity =
- std::dynamic_pointer_cast<SketchPlugin_SketchEntity>(*anIt);
+ std::dynamic_pointer_cast<SketchPlugin_SketchEntity>(aCoinside);
if (aSketchEntity.get() &&
(aSketchEntity->isCopy() || aSketchEntity->isExternal())) {
continue;
}
- if ((*anIt)->getKind() != SketchPlugin_Line::ID() &&
- (*anIt)->getKind() != SketchPlugin_Arc::ID()) {
+ if (aCoinside->getKind() != SketchPlugin_Line::ID() &&
+ aCoinside->getKind() != SketchPlugin_Arc::ID()) {
continue;
}
- if ((*anIt)->getKind() == SketchPlugin_Arc::ID()) {
+ if (aCoinside->getKind() == SketchPlugin_Arc::ID()) {
AttributePtr anArcCenter =
- (*anIt)->attribute(SketchPlugin_Arc::CENTER_ID());
+ aCoinside->attribute(SketchPlugin_Arc::CENTER_ID());
std::shared_ptr<GeomAPI_Pnt2d> anArcCenterPnt =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(anArcCenter)->pnt();
double aDistSelectedArcCenter = aSelectedPnt->distance(anArcCenterPnt);
continue;
}
}
- aNewSetOfCoincides.insert(*anIt);
+ aNewSetOfCoincides.insert(aCoinside);
}
aCoinsides = aNewSetOfCoincides;
// of coincides.
if (aCoinsides.size() > 2) {
aNewSetOfCoincides.clear();
- for (std::set<FeaturePtr>::iterator anIt = aCoinsides.begin();
- anIt != aCoinsides.end(); ++anIt) {
- if (!(*anIt)
- ->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())
+ for (const auto &aCoinside : aCoinsides) {
+ if (!aCoinside->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())
->value()) {
- aNewSetOfCoincides.insert(*anIt);
+ aNewSetOfCoincides.insert(aCoinside);
}
}
aCoinsides = aNewSetOfCoincides;
}
// output edges
- std::set<FeaturePtr>::iterator aFIt = aCoinsides.begin();
+ auto aFIt = aCoinsides.begin();
theEdge1 = *aFIt;
theEdge2 = *(++aFIt);
// Check that selected edges don't have tangent constraint.
- std::set<FeaturePtr>::iterator anIt = aCoinsides.begin();
+ auto anIt = aCoinsides.begin();
FeaturePtr aFirstFeature = *anIt++;
FeaturePtr aSecondFeature = *anIt;
const std::set<AttributePtr> &aFirstFeatureRefsList =
}
std::list<ResultPtr> aFirstResults = aFirstFeature->results();
- for (std::list<ResultPtr>::iterator aResIt = aFirstResults.begin();
- aResIt != aFirstResults.end(); ++aResIt) {
- ResultPtr aRes = *aResIt;
+ for (auto aRes : aFirstResults) {
const std::set<AttributePtr> &aResRefsList = aRes->data()->refsToMe();
if (hasSameTangentFeature(aResRefsList, aSecondFeature)) {
theError = "Error: Edges in selected point has tangent constraint.";
AttributeRefAttrPtr aRefAttrs[2] = {aRefAttr, anOtherAttr};
int aNbPoints = 0;
int aNbLines = 0;
- for (int i = 0; i < 2; ++i) {
- if (!aRefAttrs[i]->isObject())
+ for (auto &aRefAttr : aRefAttrs) {
+ if (!aRefAttr->isObject())
++aNbPoints;
else {
- FeaturePtr aFeature = ModelAPI_Feature::feature(aRefAttrs[i]->object());
+ FeaturePtr aFeature = ModelAPI_Feature::feature(aRefAttr->object());
if (!aFeature) {
if (aNbPoints + aNbLines != 0)
return true;
bool SketchPlugin_IntersectionValidator::isValid(
const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
+ const std::list<std::string> & /*theArguments*/,
Events_InfoMessage &theError) const {
if (theAttribute->attributeType() != ModelAPI_AttributeSelection::typeId()) {
theError = "The attribute with the %1 type is not processed";
// find a sketch
std::shared_ptr<SketchPlugin_Sketch> aSketch;
std::set<AttributePtr> aRefs = anExternalAttr->owner()->data()->refsToMe();
- std::set<AttributePtr>::const_iterator anIt = aRefs.begin();
+ auto anIt = aRefs.begin();
for (; anIt != aRefs.end(); ++anIt) {
CompositeFeaturePtr aComp =
std::dynamic_pointer_cast<ModelAPI_CompositeFeature>((*anIt)->owner());
bool SketchPlugin_SplitValidator::isValid(
const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
+ const std::list<std::string> & /*theArguments*/,
Events_InfoMessage &theError) const {
bool aValid = false;
bool SketchPlugin_TrimValidator::isValid(
const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
+ const std::list<std::string> & /*theArguments*/,
Events_InfoMessage &theError) const {
bool aValid = false;
bool SketchPlugin_ProjectionValidator::isValid(
const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
+ const std::list<std::string> & /*theArguments*/,
Events_InfoMessage &theError) const {
if (theAttribute->attributeType() != ModelAPI_AttributeSelection::typeId()) {
theError = "The attribute with the %1 type is not processed";
// find a sketch
std::shared_ptr<SketchPlugin_Sketch> aSketch;
std::set<AttributePtr> aRefs = theAttribute->owner()->data()->refsToMe();
- std::set<AttributePtr>::const_iterator anIt = aRefs.begin();
+ auto anIt = aRefs.begin();
for (; anIt != aRefs.end(); ++anIt) {
CompositeFeaturePtr aComp =
std::dynamic_pointer_cast<ModelAPI_CompositeFeature>((*anIt)->owner());
// B-spline's plane is orthogonal to the sketch plane,
// thus, need to check whether B-spline is planar.
std::list<GeomPointPtr> aPoles = aBSpline->poles();
- for (std::list<GeomPointPtr>::iterator it = aPoles.begin();
- it != aPoles.end() && !aValid; ++it) {
+ for (auto it = aPoles.begin(); it != aPoles.end() && !aValid; ++it) {
if (aBSplinePlane->distance(*it) > tolerance)
aValid = true; // non-planar B-spline curve
}
if (theSet1.empty() || theSet2.empty())
return aCommon;
- std::set<FeaturePtr>::const_iterator anIt2 = theSet2.begin();
+ auto anIt2 = theSet2.begin();
for (; anIt2 != theSet2.end(); ++anIt2)
if (theSet1.find(*anIt2) != theSet1.end())
aCommon.insert(*anIt2);
std::set<FeaturePtr> aCommonReferredFeatures;
// find all features referred by attributes listed in theArguments
- std::list<std::string>::const_iterator anArgIt = theArguments.begin();
+ auto anArgIt = theArguments.begin();
for (; anArgIt != theArguments.end(); ++anArgIt) {
AttributeRefAttrPtr aRefAttr = anOwner->refattr(*anArgIt);
if (!aRefAttr)
// find all points referred by attributes listed in theArguments
bool hasRefsToPoints = false;
- std::list<std::string>::const_iterator anArgIt = theArguments.begin();
+ auto anArgIt = theArguments.begin();
for (; anArgIt != theArguments.end(); ++anArgIt) {
AttributeRefAttrPtr aRefAttr = anOwner->refattr(*anArgIt);
if (!aRefAttr)
std::set<FeaturePtr> aCoincidentFeatures =
SketchPlugin_Tools::findFeaturesCoincidentToPoint(aCenterPoint);
// check one of coincident features is a feature referred by passed point
- std::set<FeaturePtr>::const_iterator anIt = aCoincidentFeatures.begin();
+ auto anIt = aCoincidentFeatures.begin();
for (; anIt != aCoincidentFeatures.end(); ++anIt)
if (*anIt == aPassedFeature) {
theError = aErrorMessage;
bool SketchPlugin_ArcEndPointValidator::isValid(
const AttributePtr &theAttribute,
const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const {
+ Events_InfoMessage & /*theError*/) const {
FeaturePtr aFeature = ModelAPI_Feature::feature(theAttribute->owner());
AttributeRefAttrPtr anEndPointRef = aFeature->refattr(theArguments.front());
bool SketchPlugin_ArcEndPointIntersectionValidator::isValid(
const AttributePtr &theAttribute,
const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const {
+ Events_InfoMessage & /*theError*/) const {
std::shared_ptr<SketchPlugin_MacroArc> anArcFeature =
std::dynamic_pointer_cast<SketchPlugin_MacroArc>(theAttribute->owner());
AttributeRefAttrPtr anEndPointRef =
FeaturePtr aSelectedFeature = ModelAPI_Feature::feature(anObject);
if (aSelectedFeature.get()) {
std::list<ResultPtr> aResults = aSelectedFeature->results();
- for (std::list<ResultPtr>::const_iterator anIt = aResults.cbegin();
- anIt != aResults.cend(); ++anIt) {
- GeomShapePtr aShape = (*anIt)->shape();
+ for (const auto &aResult : aResults) {
+ GeomShapePtr aShape = aResult->shape();
if (!aShape->isEdge())
return true;
aShape = toInfiniteEdge(aShape);
const std::list<std::string> &theArguments,
Events_InfoMessage &theError) const {
std::set<std::string> aFeatureKinds;
- for (std::list<std::string>::const_iterator anArgIt = theArguments.begin();
- anArgIt != theArguments.end(); anArgIt++) {
- aFeatureKinds.insert(*anArgIt);
+ for (const auto &theArgument : theArguments) {
+ aFeatureKinds.insert(theArgument);
}
if (theAttribute->attributeType() != ModelAPI_AttributeRefAttr::typeId()) {
FeaturePtr aCurrentFeature = ModelAPI_Feature::feature(aRefAttr->owner());
std::set<AttributePtr> aRefsList = anObject->data()->refsToMe();
- std::set<AttributePtr>::const_iterator anIt = aRefsList.begin();
+ auto anIt = aRefsList.begin();
for (; anIt != aRefsList.end(); anIt++) {
FeaturePtr aRefFeature = ModelAPI_Feature::feature((*anIt)->owner());
if (aRefFeature.get() && aCurrentFeature != aRefFeature &&
bool SketchPlugin_SketchFeatureValidator::isValid(
const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
+ const std::list<std::string> & /*theArguments*/,
Events_InfoMessage &theError) const {
if (theAttribute->attributeType() != ModelAPI_AttributeRefAttr::typeId() &&
theAttribute->attributeType() != ModelAPI_AttributeReference::typeId()) {
isSketchFeature = aRefAttr->isObject();
if (isSketchFeature) {
FeaturePtr aFeature = ModelAPI_Feature::feature(aRefAttr->object());
- isSketchFeature = aFeature.get() != NULL;
+ isSketchFeature = aFeature.get() != nullptr;
if (isSketchFeature) {
std::shared_ptr<SketchPlugin_Feature> aSketchFeature =
std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
- isSketchFeature = aSketchFeature.get() != NULL;
+ isSketchFeature = aSketchFeature.get() != nullptr;
}
}
} else {
bool SketchPlugin_MultiRotationAngleValidator::isValid(
const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
+ const std::list<std::string> & /*theArguments*/,
Events_InfoMessage &theError) const {
if (theAttribute->attributeType() != ModelAPI_AttributeDouble::typeId()) {
theError = "The attribute with the %1 type is not processed";
bool SketchPlugin_BSplineValidator::isValid(
const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
+ const std::list<std::string> & /*theArguments*/,
Events_InfoMessage &theError) const {
AttributePoint2DArrayPtr aPolesArray =
std::dynamic_pointer_cast<GeomDataAPI_Point2DArray>(theAttribute);
}
bool SketchPlugin_CurveFittingValidator::isValid(
- const FeaturePtr &theFeature, const std::list<std::string> &theArguments,
+ const FeaturePtr &theFeature,
+ const std::list<std::string> & /*theArguments*/,
Events_InfoMessage &theError) const {
AttributeRefAttrListPtr aRefAttrList =
theFeature->refattrlist(SketchPlugin_CurveFitting::POINTS_ID());
//! \param theAttribute the checked attribute
//! \param theArguments arguments of the attribute
//! \param theError error message
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/**\class SketchPlugin_TangentAttrValidator
//! \param theAttribute the checked attribute
//! \param theArguments arguments of the attribute
//! \param theError error message
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/**\class SketchPlugin_PerpendicularAttrValidator
//! \param theAttribute the checked attribute
//! \param theArguments arguments of the attribute
//! \param theError error message
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/**\class SketchPlugin_NotFixedValidator
//! \param theAttribute the checked attribute
//! \param theArguments arguments of the attribute
//! \param theError error message
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/**\class SketchPlugin_EqualAttrValidator
//! \param theAttribute the checked attribute
//! \param theArguments arguments of the attribute
//! \param theError error message
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/**\class SketchPlugin_MirrorAttrValidator
//! \param theAttribute the checked attribute
//! \param theArguments arguments of the attribute (not used)
//! \param theError error message
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/**\class SketchPlugin_CoincidenceAttrValidator
//! \param theAttribute the checked attribute
//! \param theArguments arguments of the attribute (not used)
//! \param theError error message
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/**\class SketchPlugin_CopyValidator
//! \param theAttribute the checked attribute
//! \param theArguments arguments of the attribute (not used)
//! \param theError error message
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/**\class SketchPlugin_SolverErrorValidator
//! \param theFeature the checked feature
//! \param theArguments arguments of the feature (not used)
//! \param theError error message
- virtual bool isValid(const std::shared_ptr<ModelAPI_Feature> &theFeature,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const std::shared_ptr<ModelAPI_Feature> &theFeature,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
/// Returns true if the attribute in feature is not obligatory for the feature
/// execution
- virtual bool isNotObligatory(std::string theFeature,
- std::string theAttribute);
+ bool isNotObligatory(std::string theFeature,
+ std::string theAttribute) override;
};
/**\class SketchPlugin_FilletVertexValidator
//! \param theAttribute the checked attribute
//! \param theArguments arguments of the attribute (not used)
//! \param theError error message
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
//! returns true if attribute is a good point for fillet
//! \param theAttribute the checked point attribute
//! \param theAttribute the checked attribute
//! \param theArguments arguments of the attribute (not used)
//! \param theError error message
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/**\class SketchPlugin_ArcTangentPointValidator
//! \param theAttribute the checked attribute
//! \param theArguments arguments of the attribute
//! \param theError error message
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/**\class SketchPlugin_ArcTransversalPointValidator
//! \param theAttribute the checked attribute
//! \param theArguments arguments of the attribute
//! \param theError error message
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/**\class SketchPlugin_SplitValidator
//! \param theAttribute the checked attribute
//! \param theArguments arguments of the attribute
//! \param theError error message
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/**\class SketchPlugin_TrimValidator
//! \param theAttribute the checked attribute
//! \param theArguments arguments of the attribute
//! \param theError error message
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/**\class SketchPlugin_IntersectionValidator
//! \param theAttribute the checked attribute
//! \param theArguments arguments of the attribute
//! \param theError error message
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/**\class SketchPlugin_ProjectionValidator
//! \param theAttribute the checked attribute
//! \param theArguments arguments of the attribute
//! \param theError error message
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/**\class SketchPlugin_DifferentReferenceValidator
//! \param theAttribute the checked attribute
//! \param theArguments arguments of the attribute
//! \param theError error message
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/**\class SketchPlugin_DifferentPointReferenceValidator
//! \param theAttribute the checked attribute
//! \param theArguments arguments of the attribute
//! \param theError error message
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/**\class SketchPlugin_CirclePassedPointValidator
//! \param theAttribute the checked attribute
//! \param theArguments arguments of the attribute
//! \param theError error message
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute, const std::list<std::string> &,
+ Events_InfoMessage &theError) const override;
};
/**\class SketchPlugin_ThirdPointValidator
//! \param theAttribute the checked attribute
//! \param theArguments arguments of the attribute
//! \param theError error message
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
private:
//! returns true if three points have not been placed on the same line
//! \param theAttribute the checked attribute
//! \param theArguments arguments of the attribute
//! \param theError error message
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/**\class SketchPlugin_ArcEndPointIntersectionValidator
//! \param theAttribute the checked attribute
//! \param theArguments arguments of the attribute
//! \param theError error message
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/**\class SketchPlugin_HasNoConstraint
//! \param theAttribute the checked attribute
//! \param theArguments arguments of the attribute
//! \param theError error message
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/**\class SketchPlugin_ReplicationReferenceValidator
//! \param theAttribute the checked attribute
//! \param theArguments arguments of the attribute
//! \param theError error message
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/**\class SketchPlugin_SketchFeatureValidator
//! \param theAttribute the checked attribute
//! \param theArguments arguments of the attribute
//! \param theError error message
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/**\class SketchPlugin_MultiRotationAngleValidator
//! \param theAttribute the checked attribute
//! \param theArguments arguments of the attribute
//! \param theError error message
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/**\class SketchPlugin_BSplineValidator
//! \param theAttribute the checked attribute
//! \param theArguments arguments of the attribute
//! \param theError error message
- virtual bool isValid(const AttributePtr &theAttribute,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const AttributePtr &theAttribute,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
/**\class SketchPlugin_CurveFittingValidator
//! returns true if number of selected points is greater than the minimal
//! value \param theAttribute the checked attribute \param theArguments
//! arguments of the attribute \param theError error message
- virtual bool isValid(const std::shared_ptr<ModelAPI_Feature> &theFeature,
- const std::list<std::string> &theArguments,
- Events_InfoMessage &theError) const;
+ bool isValid(const std::shared_ptr<ModelAPI_Feature> &theFeature,
+ const std::list<std::string> &theArguments,
+ Events_InfoMessage &theError) const override;
};
#endif
class PlaneGCSSolver_AngleWrapper : public PlaneGCSSolver_ScalarWrapper {
public:
PlaneGCSSolver_AngleWrapper(double *const theParam);
- ~PlaneGCSSolver_AngleWrapper() {}
+ ~PlaneGCSSolver_AngleWrapper() override = default;
/// \brief Change value of parameter
- virtual void setValue(double theValue);
+ void setValue(double theValue) override;
/// \brief Return value of parameter
- virtual double value() const;
+ double value() const override;
};
#endif
if (nonSolverAttribute<SketchPlugin_BSpline>(anOwner, theAttribute->id()) ||
nonSolverAttribute<SketchPlugin_BSplinePeriodic>(anOwner,
theAttribute->id()))
- aStorage = 0;
+ aStorage = nullptr;
int aSize = anArray.size();
GCS::VEC_pD aParameters;
std::dynamic_pointer_cast<GeomDataAPI_Point2DArray>(theAttribute);
std::vector<PointWrapperPtr> aPointsArray = aWrapper->array();
- std::vector<PointWrapperPtr>::iterator aPos = aPointsArray.begin();
+ auto aPos = aPointsArray.begin();
if (aWrapper->size() != anAttribute->size()) {
while (anAttribute->size() > (int)aPointsArray.size()) {
// add points to the middle of array
while (anAttribute->size() < (int)aPointsArray.size()) {
// remove middle points
- std::vector<PointWrapperPtr>::iterator anIt = --aPointsArray.end();
+ auto anIt = --aPointsArray.end();
GCS::SET_pD aParams = PlaneGCSSolver_Tools::parameters(*anIt);
aParamsToRemove.insert(aParams.begin(), aParams.end());
aPointsArray.erase(anIt);
*/
class PlaneGCSSolver_AttributeBuilder : public PlaneGCSSolver_EntityBuilder {
public:
- PlaneGCSSolver_AttributeBuilder(PlaneGCSSolver_Storage *theStorage = 0);
+ PlaneGCSSolver_AttributeBuilder(PlaneGCSSolver_Storage *theStorage = nullptr);
PlaneGCSSolver_AttributeBuilder(const StoragePtr &theStorage);
/// \brief Converts an attribute to the solver's entity.
/// Double attributes and 2D points are supported only.
/// \param theAttribute [in] attribute to create
/// \return Created wrapper of the attribute applicable for specific solver
- virtual EntityWrapperPtr createAttribute(AttributePtr theAttribute);
+ EntityWrapperPtr createAttribute(AttributePtr theAttribute) override;
/// \brief Update entity by the attribute values.
/// \return \c true if any value is updated.
EntityWrapperPtr theEntity);
/// \brief Blank. To be defined in derived class.
- virtual EntityWrapperPtr createFeature(FeaturePtr) {
+ EntityWrapperPtr createFeature(FeaturePtr) override {
return EntityWrapperPtr();
}
};
bool value() const { return myValue; }
/// \brief Return type of current entity
- virtual SketchSolver_EntityType type() const { return ENTITY_BOOLEAN; }
+ SketchSolver_EntityType type() const override { return ENTITY_BOOLEAN; }
protected:
/// \brief Update entity by the values of theAttribute
/// \return \c true if any value of attribute is not equal to the stored in
/// the entity
- virtual bool update(std::shared_ptr<ModelAPI_Attribute> theAttribute);
+ bool update(std::shared_ptr<ModelAPI_Attribute> theAttribute) override;
protected:
bool myValue;
};
-typedef std::shared_ptr<PlaneGCSSolver_BooleanWrapper> BooleanWrapperPtr;
+using BooleanWrapperPtr = std::shared_ptr<PlaneGCSSolver_BooleanWrapper>;
#endif
std::list<GCSConstraintPtr> myGCSConstraints;
};
-typedef std::shared_ptr<PlaneGCSSolver_ConstraintWrapper> ConstraintWrapperPtr;
+using ConstraintWrapperPtr = std::shared_ptr<PlaneGCSSolver_ConstraintWrapper>;
#endif
#include <memory>
typedef std::shared_ptr<GCS::Point> GCSPointPtr;
-typedef std::shared_ptr<GCS::Curve> GCSCurvePtr;
-typedef std::shared_ptr<GCS::Constraint> GCSConstraintPtr;
+using GCSCurvePtr = std::shared_ptr<GCS::Curve>;
+using GCSConstraintPtr = std::shared_ptr<GCS::Constraint>;
// Tolerance for value of parameters
const double tolerance = 1.e-10;
#define PI 3.1415926535897932
// Types for data entities enumeration
-typedef int ConstraintID;
+using ConstraintID = int;
// Predefined values for identifiers
const ConstraintID CID_UNKNOWN = 0;
GCSCurvePtr &changeEntity() { return myEntity; }
/// \brief Return type of current entity
- virtual SketchSolver_EntityType type() const { return myType; }
+ SketchSolver_EntityType type() const override { return myType; }
bool isDegenerated() const;
BooleanWrapperPtr myReversed; // preferably used to control arc orientation
};
-typedef std::shared_ptr<PlaneGCSSolver_EdgeWrapper> EdgeWrapperPtr;
+using EdgeWrapperPtr = std::shared_ptr<PlaneGCSSolver_EdgeWrapper>;
#endif
/// \brief Create entity in the given storage.
/// If the storage is empty, the entity should not be changed
/// while constraint solving. So, it is created out of the storage.
- PlaneGCSSolver_EntityBuilder(PlaneGCSSolver_Storage *theStorage = 0)
+ PlaneGCSSolver_EntityBuilder(PlaneGCSSolver_Storage *theStorage = nullptr)
: myStorage(theStorage) {}
- virtual ~PlaneGCSSolver_EntityBuilder() {}
+ virtual ~PlaneGCSSolver_EntityBuilder() = default;
/// \brief Converts an attribute to the solver's entity.
/// Double attributes and 2D points are supported only.
*/
class PlaneGCSSolver_EntityDestroyer {
public:
- PlaneGCSSolver_EntityDestroyer() {}
+ PlaneGCSSolver_EntityDestroyer() = default;
/// \brief Add entity to remove. Its parameters are stored for further remove
/// from the storage.
class ModelAPI_Attribute;
class PlaneGCSSolver_EntityWrapper;
-typedef std::shared_ptr<PlaneGCSSolver_EntityWrapper> EntityWrapperPtr;
+using EntityWrapperPtr = std::shared_ptr<PlaneGCSSolver_EntityWrapper>;
/**
* Wrapper providing operations with entities regardless the solver.
*/
class PlaneGCSSolver_EntityWrapper {
public:
- PlaneGCSSolver_EntityWrapper() : myExternal(false) {}
- virtual ~PlaneGCSSolver_EntityWrapper() {}
+ PlaneGCSSolver_EntityWrapper() {}
+ virtual ~PlaneGCSSolver_EntityWrapper() = default;
/// \brief Return type of current entity
virtual SketchSolver_EntityType type() const = 0;
/// \brief Update entity by the values of theAttribute
/// \return \c true if any value of attribute is not equal to the stored in
/// the entity
- virtual bool update(std::shared_ptr<ModelAPI_Attribute> theAttribute) {
+ virtual bool update(std::shared_ptr<ModelAPI_Attribute> /*theAttribute*/) {
return false;
}
friend class PlaneGCSSolver_AttributeBuilder;
private:
- bool myExternal;
+ bool myExternal{false};
std::map<std::string, EntityWrapperPtr> myAdditionalAttributes;
};
EntityWrapperPtr createLine(const AttributeEntityMap &theAttributes) {
std::shared_ptr<GCS::Line> aNewLine(new GCS::Line);
- AttributeEntityMap::const_iterator anIt = theAttributes.begin();
+ auto anIt = theAttributes.begin();
for (; anIt != theAttributes.end(); ++anIt) {
std::shared_ptr<PlaneGCSSolver_PointWrapper> aPoint =
std::dynamic_pointer_cast<PlaneGCSSolver_PointWrapper>(anIt->second);
EntityWrapperPtr createCircle(const AttributeEntityMap &theAttributes) {
std::shared_ptr<GCS::Circle> aNewCircle(new GCS::Circle);
- AttributeEntityMap::const_iterator anIt = theAttributes.begin();
+ auto anIt = theAttributes.begin();
for (; anIt != theAttributes.end(); ++anIt) {
if (anIt->first->id() == SketchPlugin_Circle::CENTER_ID()) {
std::shared_ptr<PlaneGCSSolver_PointWrapper> aPoint =
BooleanWrapperPtr isReversed;
// Base attributes of arc (center, start and end points)
- AttributeEntityMap::const_iterator anIt = theAttributes.begin();
+ auto anIt = theAttributes.begin();
for (; anIt != theAttributes.end(); ++anIt) {
std::shared_ptr<PlaneGCSSolver_PointWrapper> aPoint =
std::dynamic_pointer_cast<PlaneGCSSolver_PointWrapper>(anIt->second);
std::map<std::string, EntityWrapperPtr> anAdditionalAttributes;
- AttributeEntityMap::const_iterator anIt = theAttributes.begin();
+ auto anIt = theAttributes.begin();
for (; anIt != theAttributes.end(); ++anIt) {
std::shared_ptr<PlaneGCSSolver_PointWrapper> aPoint =
std::dynamic_pointer_cast<PlaneGCSSolver_PointWrapper>(anIt->second);
BooleanWrapperPtr isReversed;
std::map<std::string, EntityWrapperPtr> anAdditionalAttributes;
- AttributeEntityMap::const_iterator anIt = theAttributes.begin();
+ auto anIt = theAttributes.begin();
for (; anIt != theAttributes.end(); ++anIt) {
std::shared_ptr<PlaneGCSSolver_PointWrapper> aPoint =
std::dynamic_pointer_cast<PlaneGCSSolver_PointWrapper>(anIt->second);
std::map<std::string, EntityWrapperPtr> anAdditionalAttributes;
- AttributeEntityMap::const_iterator anIt = theAttributes.begin();
+ auto anIt = theAttributes.begin();
for (; anIt != theAttributes.end(); ++anIt) {
const std::string &anAttrID = anIt->first->id();
if (anAttrID == TYPE::POLES_ID()) {
else if (anAttrID == TYPE::MULTS_ID()) {
const GCS::VEC_pD &aValues = anArray->array();
aNewSpline->mult.reserve(aValues.size());
- for (GCS::VEC_pD::const_iterator anIt = aValues.begin();
- anIt != aValues.end(); ++anIt)
- aNewSpline->mult.push_back((int)(**anIt));
+ for (auto aValue : aValues)
+ aNewSpline->mult.push_back((int)(*aValue));
}
}
}
#include <PlaneGCSSolver_AttributeBuilder.h>
-typedef std::map<AttributePtr, EntityWrapperPtr> AttributeEntityMap;
+using AttributeEntityMap = std::map<AttributePtr, EntityWrapperPtr>;
/** \class PlaneGCSSolver_FeatureBuilder
* \ingroup Plugins
*/
class PlaneGCSSolver_FeatureBuilder : public PlaneGCSSolver_AttributeBuilder {
public:
- PlaneGCSSolver_FeatureBuilder(PlaneGCSSolver_Storage *theStorage = 0);
+ PlaneGCSSolver_FeatureBuilder(PlaneGCSSolver_Storage *theStorage = nullptr);
PlaneGCSSolver_FeatureBuilder(const StoragePtr &theStorage);
/// \brief Converts an attribute to the solver's entity and stores it for
/// Double attributes and 2D points are supported only.
/// \param theAttribute [in] attribute to create
/// \return Created wrapper of the attribute applicable for specific solver
- virtual EntityWrapperPtr createAttribute(AttributePtr theAttribute);
+ EntityWrapperPtr createAttribute(AttributePtr theAttribute) override;
/// \brief Converts SketchPlugin's feature to the solver's entity.
/// Result if based on the list of already converted attributes.
/// \param theFeature [in] feature to create
- virtual EntityWrapperPtr createFeature(FeaturePtr theFeature);
+ EntityWrapperPtr createFeature(FeaturePtr theFeature) override;
private:
/// list of converted attributes (will be cleared when the feature is created)
std::list<double> aKnots;
std::list<int> aMults;
- for (GCS::VEC_P::const_iterator anIt = poles.begin(); anIt != poles.end();
- ++anIt)
- aPoles.push_back(GeomPnt2dPtr(new GeomAPI_Pnt2d(*anIt->x, *anIt->y)));
- for (GCS::VEC_pD::const_iterator anIt = weights.begin();
- anIt != weights.end(); ++anIt)
- aWeights.push_back(**anIt);
- for (GCS::VEC_pD::const_iterator anIt = knots.begin(); anIt != knots.end();
- ++anIt)
- aKnots.push_back(**anIt);
+ for (const auto &pole : poles)
+ aPoles.push_back(GeomPnt2dPtr(new GeomAPI_Pnt2d(*pole.x, *pole.y)));
+ for (auto weight : weights)
+ aWeights.push_back(*weight);
+ for (auto knot : knots)
+ aKnots.push_back(*knot);
aMults.assign(mult.begin(), mult.end());
std::shared_ptr<GeomAPI_BSpline2d> aCurve(new GeomAPI_BSpline2d(
/// \brife SHAPER's implementation of B-spline curves in PlaneGCS solver
class BSplineImpl : public BSpline {
public:
- virtual DeriVector2 Value(double u, double du, double *derivparam = 0);
- virtual DeriVector2 CalculateNormal(Point &p, double *derivparam = 0);
+ DeriVector2 Value(double u, double du, double *derivparam = nullptr) override;
+ DeriVector2 CalculateNormal(Point &p, double *derivparam = nullptr) override;
- virtual BSplineImpl *Copy();
+ BSplineImpl *Copy() override;
private:
/// Return the index of start knot for the given parameter.
std::shared_ptr<GeomDataAPI_Point2DArray> aPointArray =
std::dynamic_pointer_cast<GeomDataAPI_Point2DArray>(theAttribute);
if (aPointArray && aPointArray->size() == (int)myPoints.size()) {
- std::vector<PointWrapperPtr>::iterator aPIt = myPoints.begin();
+ auto aPIt = myPoints.begin();
for (int anIndex = 0; aPIt != myPoints.end(); ++aPIt, ++anIndex) {
GeomPnt2dPtr aPnt = aPointArray->pnt(anIndex);
}
/// \brief Return type of current entity
- virtual SketchSolver_EntityType type() const { return ENTITY_POINT_ARRAY; }
+ SketchSolver_EntityType type() const override { return ENTITY_POINT_ARRAY; }
protected:
/// \brief Update entity by the values of theAttribute
/// \return \c true if any value of attribute is not equal to the stored in
/// the entity
- virtual bool update(std::shared_ptr<ModelAPI_Attribute> theAttribute);
+ bool update(std::shared_ptr<ModelAPI_Attribute> theAttribute) override;
private:
std::vector<PointWrapperPtr> myPoints;
GCSPointPtr &changeEntity() { return myPoint; }
/// \brief Return type of current entity
- virtual SketchSolver_EntityType type() const { return ENTITY_POINT; }
+ SketchSolver_EntityType type() const override { return ENTITY_POINT; }
protected:
/// \brief Update entity by the values of theAttribute
/// \return \c true if any value of attribute is not equal to the stored in
/// the entity
- virtual bool update(std::shared_ptr<ModelAPI_Attribute> theAttribute);
+ bool update(std::shared_ptr<ModelAPI_Attribute> theAttribute) override;
private:
GCSPointPtr myPoint;
};
-typedef std::shared_ptr<PlaneGCSSolver_PointWrapper> PointWrapperPtr;
+using PointWrapperPtr = std::shared_ptr<PlaneGCSSolver_PointWrapper>;
#endif
void setArray(const GCS::VEC_pD &theParams) { myValue = theParams; }
/// \brief Return type of current entity
- virtual SketchSolver_EntityType type() const { return ENTITY_SCALAR_ARRAY; }
+ SketchSolver_EntityType type() const override { return ENTITY_SCALAR_ARRAY; }
protected:
/// \brief Update entity by the values of theAttribute
/// \return \c true if any value of attribute is not equal to the stored in
/// the entity
- virtual bool update(std::shared_ptr<ModelAPI_Attribute> theAttribute);
+ bool update(std::shared_ptr<ModelAPI_Attribute> theAttribute) override;
protected:
GCS::VEC_pD myValue; ///< list of pointers to values provided by the storage
};
-typedef std::shared_ptr<PlaneGCSSolver_ScalarArrayWrapper>
- ScalarArrayWrapperPtr;
+using ScalarArrayWrapperPtr =
+ std::shared_ptr<PlaneGCSSolver_ScalarArrayWrapper>;
#endif
virtual double value() const;
/// \brief Return type of current entity
- virtual SketchSolver_EntityType type() const { return ENTITY_SCALAR; }
+ SketchSolver_EntityType type() const override { return ENTITY_SCALAR; }
protected:
/// \brief Update entity by the values of theAttribute
/// \return \c true if any value of attribute is not equal to the stored in
/// the entity
- virtual bool update(std::shared_ptr<ModelAPI_Attribute> theAttribute);
+ bool update(std::shared_ptr<ModelAPI_Attribute> theAttribute) override;
protected:
double *myValue; ///< pointer to value provided by the storage
};
-typedef std::shared_ptr<PlaneGCSSolver_ScalarWrapper> ScalarWrapperPtr;
+using ScalarWrapperPtr = std::shared_ptr<PlaneGCSSolver_ScalarWrapper>;
#endif
static const int THE_CONSTRAINT_MULT = 100;
PlaneGCSSolver_Solver::PlaneGCSSolver_Solver()
- : myEquationSystem(new GCS::System), myDiagnoseBeforeSolve(false),
- myInitilized(false), myConfCollected(false), myDOF(0),
- myFictiveConstraint(0) {}
+ : myEquationSystem(new GCS::System) {}
PlaneGCSSolver_Solver::~PlaneGCSSolver_Solver() { clear(); }
? theMultiConstraintID * THE_CONSTRAINT_MULT
: theMultiConstraintID;
- for (std::list<GCSConstraintPtr>::const_iterator anIt =
- theConstraints.begin();
- anIt != theConstraints.end(); ++anIt) {
- GCSConstraintPtr aConstraint = *anIt;
+ for (auto aConstraint : theConstraints) {
aConstraint->setTag(anID);
myEquationSystem->addConstraint(aConstraint.get());
}
void PlaneGCSSolver_Solver::removeConstraint(const ConstraintID &theID) {
- ConstraintMap::iterator aFound = myConstraints.find(theID);
+ auto aFound = myConstraints.find(theID);
if (aFound != myConstraints.end()) {
- for (std::list<GCSConstraintPtr>::iterator anIt = aFound->second.begin();
- anIt != aFound->second.end(); ++anIt)
- myEquationSystem->clearByTag((*anIt)->getTag());
+ for (auto &anIt : aFound->second)
+ myEquationSystem->clearByTag(anIt->getTag());
myConstraints.erase(aFound);
}
}
double *PlaneGCSSolver_Solver::createParameter() {
- double *aResult = new double(0);
+ auto *aResult = new double(0);
myParameters.push_back(aResult);
if (myConstraints.empty() && myDOF >= 0)
++myDOF; // calculate DoF by hand if and only if there is no constraints yet
void PlaneGCSSolver_Solver::addParameters(const GCS::SET_pD &theParams) {
GCS::SET_pD aParams(theParams);
// leave new parameters only
- GCS::VEC_pD::iterator anIt = myParameters.begin();
+ auto anIt = myParameters.begin();
for (; anIt != myParameters.end(); ++anIt)
if (aParams.find(*anIt) != aParams.end())
aParams.erase(*anIt);
GCS::VEC_I aConflict;
myEquationSystem->getConflicting(aConflict);
// convert PlaneGCS constraint IDs to SketchPlugin's ID
- for (GCS::VEC_I::const_iterator anIt = aConflict.begin();
- anIt != aConflict.end(); ++anIt)
- myConflictingIDs.insert((*anIt) / THE_CONSTRAINT_MULT);
+ for (int anIt : aConflict)
+ myConflictingIDs.insert(anIt / THE_CONSTRAINT_MULT);
if (withRedundant) {
myEquationSystem->getRedundant(aConflict);
// convert PlaneGCS constraint IDs to SketchPlugin's ID
- for (GCS::VEC_I::const_iterator anIt = aConflict.begin();
- anIt != aConflict.end(); ++anIt)
- myConflictingIDs.insert((*anIt) / THE_CONSTRAINT_MULT);
+ for (int anIt : aConflict)
+ myConflictingIDs.insert(anIt / THE_CONSTRAINT_MULT);
}
myConfCollected = true;
clear();
// reset constraints
myParameters = aParametersCopy;
- for (ConstraintMap::iterator anIt = aConstraintCopy.begin();
- anIt != aConstraintCopy.end(); ++anIt)
- addConstraint(anIt->first, anIt->second);
+ for (auto &anIt : aConstraintCopy)
+ addConstraint(anIt.first, anIt.second);
// parameters detection works for Dense QR only
GCS::QRAlgorithm aQRAlgo = myEquationSystem->qrAlgorithm;
MapParamGroup myGroups;
void add(double *theParam1, double *theParam2) {
- MapParamGroup::iterator aFound1 = myGroups.find(theParam1);
- MapParamGroup::iterator aFound2 = myGroups.find(theParam2);
+ auto aFound1 = myGroups.find(theParam1);
+ auto aFound2 = myGroups.find(theParam2);
if (aFound1 == myGroups.end()) {
if (aFound2 == myGroups.end()) {
// create new group
myEqualParams.push_back(GCS::SET_pD());
- std::list<GCS::SET_pD>::iterator aGroup = --myEqualParams.end();
+ auto aGroup = --myEqualParams.end();
aGroup->insert(theParam1);
aGroup->insert(theParam2);
myGroups[theParam1] = aGroup;
// merge two groups
GCS::SET_pD aCopy = *(aFound2->second);
myEqualParams.erase(aFound2->second);
- for (GCS::SET_pD::iterator anIt = aCopy.begin(); anIt != aCopy.end();
- ++anIt)
- myGroups[*anIt] = aFound1->second;
+ for (auto anIt : aCopy)
+ myGroups[anIt] = aFound1->second;
aFound1->second->insert(aCopy.begin(), aCopy.end());
}
}
}
} anEqualParams;
- for (ConstraintMap::iterator anIt = myConstraints.begin();
- anIt != myConstraints.end(); ++anIt)
- for (std::list<GCSConstraintPtr>::iterator aCIt = anIt->second.begin();
- aCIt != anIt->second.end(); ++aCIt) {
+ for (auto &myConstraint : myConstraints)
+ for (auto aCIt = myConstraint.second.begin();
+ aCIt != myConstraint.second.end(); ++aCIt) {
if ((*aCIt)->getTypeId() == GCS::Equal)
anEqualParams.add((*aCIt)->params()[0], (*aCIt)->params()[1]);
}
GCS::SET_pD aFreeParamsCopy = theFreeParams;
- for (GCS::SET_pD::iterator anIt = aFreeParamsCopy.begin();
- anIt != aFreeParamsCopy.end(); ++anIt) {
- EqualParameters::MapParamGroup::iterator aFound =
- anEqualParams.myGroups.find(*anIt);
+ for (auto anIt : aFreeParamsCopy) {
+ auto aFound = anEqualParams.myGroups.find(anIt);
if (aFound != anEqualParams.myGroups.end())
theFreeParams.insert(aFound->second->begin(), aFound->second->end());
}
void PlaneGCSSolver_Solver::addFictiveConstraintIfNecessary() {
bool hasOnlyMovement = true;
- for (ConstraintMap::iterator anIt = myConstraints.begin();
+ for (auto anIt = myConstraints.begin();
anIt != myConstraints.end() && hasOnlyMovement; ++anIt)
hasOnlyMovement = anIt->first == CID_MOVEMENT;
if (!hasOnlyMovement)
int aDOF = myDOF;
double *aParam = createParameter();
- double *aFictiveParameter = new double(0.0);
+ auto *aFictiveParameter = new double(0.0);
myFictiveConstraint = new GCS::ConstraintEqual(aFictiveParameter, aParam);
myFictiveConstraint->setTag(CID_FICTIVE);
myParameters.pop_back();
GCS::VEC_pD aParams = myFictiveConstraint->params();
- for (GCS::VEC_pD::iterator anIt = aParams.begin(); anIt != aParams.end();
- ++anIt) {
- double *aPar = *anIt;
+ for (auto aPar : aParams) {
delete aPar;
}
delete myFictiveConstraint;
- myFictiveConstraint = 0;
+ myFictiveConstraint = nullptr;
}
}
void removeFictiveConstraint();
private:
- typedef std::map<ConstraintID, std::list<GCSConstraintPtr>> ConstraintMap;
+ using ConstraintMap = std::map<ConstraintID, std::list<GCSConstraintPtr>>;
GCS::VEC_pD myParameters; ///< list of unknowns
ConstraintMap myConstraints; ///< list of constraints
std::shared_ptr<GCS::System>
- myEquationSystem; ///< set of equations for solving in FreeGCS
- bool myDiagnoseBeforeSolve; ///< is the diagnostic necessary
- bool myInitilized; ///< is the system already initialized
+ myEquationSystem; ///< set of equations for solving in FreeGCS
+ bool myDiagnoseBeforeSolve{false}; ///< is the diagnostic necessary
+ bool myInitilized{false}; ///< is the system already initialized
GCS::SET_I myConflictingIDs; ///< list of IDs of conflicting constraints
/// specifies the conflicting constraints are already collected
- bool myConfCollected;
+ bool myConfCollected{false};
- int myDOF; ///< degrees of freedom
+ int myDOF{0}; ///< degrees of freedom
- GCS::Constraint *myFictiveConstraint;
+ GCS::Constraint *myFictiveConstraint{0};
};
-typedef std::shared_ptr<PlaneGCSSolver_Solver> SolverPtr;
+using SolverPtr = std::shared_ptr<PlaneGCSSolver_Solver>;
#endif
static bool hasReference(std::shared_ptr<SketchPlugin_Feature> theFeature,
const std::string &theFeatureKind) {
const std::set<AttributePtr> &aRefs = theFeature->data()->refsToMe();
- for (std::set<AttributePtr>::const_iterator aRefIt = aRefs.begin();
- aRefIt != aRefs.end(); ++aRefIt) {
- FeaturePtr anOwner = ModelAPI_Feature::feature((*aRefIt)->owner());
+ for (const auto &aRef : aRefs) {
+ FeaturePtr anOwner = ModelAPI_Feature::feature(aRef->owner());
if (anOwner && !anOwner->isMacro() && anOwner->getKind() == theFeatureKind)
return true;
}
bool isExternal = (aSketchFeature && (aSketchFeature->isExternal() ||
isCopy || isProjReferred));
- PlaneGCSSolver_FeatureBuilder aBuilder(isExternal ? 0 : this);
+ PlaneGCSSolver_FeatureBuilder aBuilder(isExternal ? nullptr : this);
// Reserve the feature in the map of features
// (do not want to add several copies of it while adding attributes)
std::list<AttributePtr> anAttributes =
theFeature->data()->attributes(std::string());
- std::list<AttributePtr>::iterator anAttrIt = anAttributes.begin();
+ auto anAttrIt = anAttributes.begin();
for (; anAttrIt != anAttributes.end(); ++anAttrIt)
if (PlaneGCSSolver_Tools::isAttributeApplicable((*anAttrIt)->id(),
theFeature->getKind()))
return update(
aFeature,
theForce); // theAttribute has been processed while adding feature
- return aRelated.get() != 0;
+ return aRelated.get() != nullptr;
}
- PlaneGCSSolver_AttributeBuilder aBuilder(aRelated->isExternal() ? 0 : this);
+ PlaneGCSSolver_AttributeBuilder aBuilder(aRelated->isExternal() ? nullptr
+ : this);
bool isUpdated = aBuilder.updateAttribute(anAttribute, aRelated);
if (isUpdated) {
setNeedToResolve(true);
const std::map<std::string, EntityWrapperPtr> &anAttributes =
theEllipse->additionalAttributes();
- for (std::map<std::string, EntityWrapperPtr>::const_iterator anIt =
- anAttributes.begin();
- anIt != anAttributes.end(); ++anIt) {
+ for (const auto &anAttribute : anAttributes) {
std::shared_ptr<PlaneGCSSolver_PointWrapper> aPoint =
- std::dynamic_pointer_cast<PlaneGCSSolver_PointWrapper>(anIt->second);
+ std::dynamic_pointer_cast<PlaneGCSSolver_PointWrapper>(
+ anAttribute.second);
if (!aPoint)
continue;
GCS::InternalAlignmentType anAlignmentX, anAlignmentY;
- if (anIt->first == SketchPlugin_Ellipse::SECOND_FOCUS_ID())
+ if (anAttribute.first == SketchPlugin_Ellipse::SECOND_FOCUS_ID())
anAlignmentX = GCS::EllipseFocus2X;
- else if (anIt->first == SketchPlugin_Ellipse::MAJOR_AXIS_START_ID())
+ else if (anAttribute.first == SketchPlugin_Ellipse::MAJOR_AXIS_START_ID())
anAlignmentX = GCS::EllipseNegativeMajorX;
- else if (anIt->first == SketchPlugin_Ellipse::MAJOR_AXIS_END_ID())
+ else if (anAttribute.first == SketchPlugin_Ellipse::MAJOR_AXIS_END_ID())
anAlignmentX = GCS::EllipsePositiveMajorX;
- else if (anIt->first == SketchPlugin_Ellipse::MINOR_AXIS_START_ID())
+ else if (anAttribute.first == SketchPlugin_Ellipse::MINOR_AXIS_START_ID())
anAlignmentX = GCS::EllipseNegativeMinorX;
- else if (anIt->first == SketchPlugin_Ellipse::MINOR_AXIS_END_ID())
+ else if (anAttribute.first == SketchPlugin_Ellipse::MINOR_AXIS_END_ID())
anAlignmentX = GCS::EllipsePositiveMinorX;
anEllipseConstraints.push_back(
void PlaneGCSSolver_Storage::removeAuxiliaryConstraints(
const EntityWrapperPtr &theEntity) {
- std::map<EntityWrapperPtr, ConstraintWrapperPtr>::iterator aFound =
- myAuxConstraintMap.find(theEntity);
+ auto aFound = myAuxConstraintMap.find(theEntity);
if (aFound != myAuxConstraintMap.end()) {
mySketchSolver->removeConstraint(aFound->second->id());
myAuxConstraintMap.erase(aFound);
}
void PlaneGCSSolver_Storage::adjustParametrizationOfArcs() {
- std::map<EntityWrapperPtr, ConstraintWrapperPtr>::iterator anIt =
- myAuxConstraintMap.begin();
+ auto anIt = myAuxConstraintMap.begin();
for (; anIt != myAuxConstraintMap.end(); ++anIt) {
EdgeWrapperPtr anEdge =
std::dynamic_pointer_cast<PlaneGCSSolver_EdgeWrapper>(anIt->first);
}
// update parameters of Middle point constraint for point on arc
- std::map<ConstraintPtr, ConstraintWrapperPtr>::iterator aCIt =
- myConstraintMap.begin();
+ auto aCIt = myConstraintMap.begin();
for (; aCIt != myConstraintMap.end(); ++aCIt)
if (aCIt->second->type() == CONSTRAINT_MIDDLE_POINT) {
notify(aCIt->first);
}
bool PlaneGCSSolver_Storage::removeConstraint(ConstraintPtr theConstraint) {
- std::map<ConstraintPtr, ConstraintWrapperPtr>::iterator aFound =
- myConstraintMap.find(theConstraint);
+ auto aFound = myConstraintMap.find(theConstraint);
if (aFound != myConstraintMap.end()) {
ConstraintWrapperPtr aCW = aFound->second;
ConstraintID anID = aCW->id();
std::set<FeaturePtr> anUpdatedFeatures;
- std::map<AttributePtr, EntityWrapperPtr>::const_iterator anIt =
- myAttributeMap.begin();
+ auto anIt = myAttributeMap.begin();
for (; anIt != myAttributeMap.end(); ++anIt) {
if (!anIt->first->isInitialized())
continue;
}
// notify listeners about features update
- std::set<FeaturePtr>::const_iterator aFIt = anUpdatedFeatures.begin();
+ auto aFIt = anUpdatedFeatures.begin();
for (; aFIt != anUpdatedFeatures.end(); ++aFIt)
notify(*aFIt);
}
PlaneGCSSolver_Solver::SolveStatus
PlaneGCSSolver_Storage::checkDegeneratedGeometry() const {
- std::map<FeaturePtr, EntityWrapperPtr>::const_iterator aFIt =
- myFeatureMap.begin();
+ auto aFIt = myFeatureMap.begin();
for (; aFIt != myFeatureMap.end(); ++aFIt) {
EdgeWrapperPtr anEdge =
std::dynamic_pointer_cast<PlaneGCSSolver_EdgeWrapper>(aFIt->second);
if (aFreeParams.empty())
return;
- for (std::map<FeaturePtr, EntityWrapperPtr>::const_iterator aFIt =
- myFeatureMap.begin();
- aFIt != myFeatureMap.end(); ++aFIt) {
- if (!aFIt->second)
+ for (const auto &aFIt : myFeatureMap) {
+ if (!aFIt.second)
continue;
- GCS::SET_pD aParams = PlaneGCSSolver_Tools::parameters(aFIt->second);
- for (GCS::SET_pD::iterator aPIt = aParams.begin(); aPIt != aParams.end();
- ++aPIt)
- if (aFreeParams.find(*aPIt) != aFreeParams.end()) {
- theFeatures.insert(aFIt->first);
+ GCS::SET_pD aParams = PlaneGCSSolver_Tools::parameters(aFIt.second);
+ for (auto aParam : aParams)
+ if (aFreeParams.find(aParam) != aFreeParams.end()) {
+ theFeatures.insert(aFIt.first);
break;
}
}
/// a constraint applicable for corresponding solver.
/// \param theConstraint [in] original SketchPlugin constraint
/// \param theSolverConstraint [in] solver's constraint
- virtual void addConstraint(ConstraintPtr theConstraint,
- ConstraintWrapperPtr theSolverConstraint);
+ void addConstraint(ConstraintPtr theConstraint,
+ ConstraintWrapperPtr theSolverConstraint) override;
/// \brief Add a movement constraint which will be destroyed
/// after the next solving of the set of constraints.
/// \param theSolverConstraint [in] solver's constraint
- virtual void
- addMovementConstraint(const ConstraintWrapperPtr &theSolverConstraint);
+ void addMovementConstraint(
+ const ConstraintWrapperPtr &theSolverConstraint) override;
/// \brief Convert feature to the form applicable for specific solver and map
/// it \param theFeature [in] feature to convert \param theForce [in]
/// forced feature creation \return \c true if the feature has been created or
/// updated
- virtual bool update(FeaturePtr theFeature, bool theForce = false);
+ bool update(FeaturePtr theFeature, bool theForce = false) override;
/// \brief Convert attribute to the form applicable for specific solver and
/// map it \param theAttribute [in] attribute to convert \param theForce [in]
/// forced feature creation \return \c true if the attribute has been created
/// or updated
- virtual bool update(AttributePtr theAttribute, bool theForce = false);
+ bool update(AttributePtr theAttribute, bool theForce = false) override;
/// \brief Make entity external
- virtual void makeExternal(const EntityWrapperPtr &theEntity);
+ void makeExternal(const EntityWrapperPtr &theEntity) override;
/// \brief Make entity non-external
- virtual void makeNonExternal(const EntityWrapperPtr &theEntity);
+ void makeNonExternal(const EntityWrapperPtr &theEntity) override;
/// \brief Removes constraint from the storage
/// \return \c true if the constraint and all its parameters are removed
/// successfully
- virtual bool removeConstraint(ConstraintPtr theConstraint);
+ bool removeConstraint(ConstraintPtr theConstraint) override;
/// \brief Verify, the sketch contains degenerated geometry
/// after resolving the set of constraints
/// \return STATUS_OK if the geometry is valid, STATUS_DEGENERATED otherwise.
- virtual PlaneGCSSolver_Solver::SolveStatus checkDegeneratedGeometry() const;
+ PlaneGCSSolver_Solver::SolveStatus checkDegeneratedGeometry() const override;
/// \brief Update SketchPlugin features after resolving constraints
- virtual void refresh() const;
+ void refresh() const override;
/// \brief Initialize memory for new solver's parameter
double *createParameter();
void removeParameters(const GCS::SET_pD &theParams);
/// \brief Remove all features became invalid
- virtual void removeInvalidEntities();
+ void removeInvalidEntities() override;
/// \brief Check the storage has constraints
- virtual bool isEmpty() const {
+ bool isEmpty() const override {
return SketchSolver_Storage::isEmpty() && myAuxConstraintMap.empty();
}
/// Forward arcs should have the last parameter greater than the first
/// parameter. Reversed arcs should have the last parameter lesser than
/// the first parameter.
- virtual void adjustParametrizationOfArcs();
+ void adjustParametrizationOfArcs() override;
/// \brief Return list of features which are not fully constrained
- virtual void
- getUnderconstrainedGeometry(std::set<ObjectPtr> &theFeatures) const;
+ void
+ getUnderconstrainedGeometry(std::set<ObjectPtr> &theFeatures) const override;
private:
/// \brief Convert feature using specified builder.
createConstraintRadius(std::shared_ptr<PlaneGCSSolver_ScalarWrapper> theValue,
std::shared_ptr<PlaneGCSSolver_EdgeWrapper> theEntity);
static ConstraintWrapperPtr
-createConstraintAngle(ConstraintPtr theConstraint,
- std::shared_ptr<PlaneGCSSolver_ScalarWrapper> theValue,
+createConstraintAngle(std::shared_ptr<PlaneGCSSolver_ScalarWrapper> theValue,
std::shared_ptr<PlaneGCSSolver_EdgeWrapper> theEntity1,
std::shared_ptr<PlaneGCSSolver_EdgeWrapper> theEntity2);
static ConstraintWrapperPtr createConstraintHorizVert(
aResult = createConstraintRadius(GCS_SCALAR_WRAPPER(theValue), anEntity1);
break;
case CONSTRAINT_ANGLE:
- aResult = createConstraintAngle(theConstraint, GCS_SCALAR_WRAPPER(theValue),
- anEntity1, GCS_EDGE_WRAPPER(theEntity2));
+ aResult = createConstraintAngle(GCS_SCALAR_WRAPPER(theValue), anEntity1,
+ GCS_EDGE_WRAPPER(theEntity2));
break;
case CONSTRAINT_FIXED:
break;
std::dynamic_pointer_cast<GCS::BSpline>(anEntity->entity());
std::list<GeomPnt2dPtr> aPoles;
- for (GCS::VEC_P::iterator anIt = aSpline->poles.begin();
- anIt != aSpline->poles.end(); ++anIt)
- aPoles.push_back(GeomPnt2dPtr(new GeomAPI_Pnt2d(*anIt->x, *anIt->y)));
+ for (auto &pole : aSpline->poles)
+ aPoles.push_back(GeomPnt2dPtr(new GeomAPI_Pnt2d(*pole.x, *pole.y)));
std::list<double> aWeights;
- for (GCS::VEC_pD::iterator anIt = aSpline->weights.begin();
- anIt != aSpline->weights.end(); ++anIt)
- aWeights.push_back(**anIt);
+ for (auto &weight : aSpline->weights)
+ aWeights.push_back(*weight);
std::list<double> aKnots;
- for (GCS::VEC_pD::iterator anIt = aSpline->knots.begin();
- anIt != aSpline->knots.end(); ++anIt)
- aKnots.push_back(**anIt);
+ for (auto &knot : aSpline->knots)
+ aKnots.push_back(*knot);
std::list<int> aMultiplicities;
aMultiplicities.assign(aSpline->mult.begin(), aSpline->mult.end());
}
ConstraintWrapperPtr
-createConstraintAngle(ConstraintPtr theConstraint,
- std::shared_ptr<PlaneGCSSolver_ScalarWrapper> theValue,
+createConstraintAngle(std::shared_ptr<PlaneGCSSolver_ScalarWrapper> theValue,
std::shared_ptr<PlaneGCSSolver_EdgeWrapper> theEntity1,
std::shared_ptr<PlaneGCSSolver_EdgeWrapper> theEntity2) {
std::shared_ptr<GCS::Line> aLine1 =
GCS::SET_pD aParams;
PointArrayWrapperPtr aPoints =
std::dynamic_pointer_cast<PlaneGCSSolver_PointArrayWrapper>(theArray);
- for (std::vector<PointWrapperPtr>::const_iterator anIt =
- aPoints->array().begin();
- anIt != aPoints->array().end(); ++anIt) {
- GCS::SET_pD aPointParams = PlaneGCSSolver_Tools::parameters(*anIt);
+ for (const auto &anIt : aPoints->array()) {
+ GCS::SET_pD aPointParams = PlaneGCSSolver_Tools::parameters(anIt);
aParams.insert(aPointParams.begin(), aPointParams.end());
}
return aParams;
std::shared_ptr<GCS::BSpline> aBSpline =
std::dynamic_pointer_cast<GCS::BSpline>(theEdge->entity());
- for (GCS::VEC_P::iterator it = aBSpline->poles.begin();
- it != aBSpline->poles.end(); ++it) {
- aParams.insert(it->x);
- aParams.insert(it->y);
+ for (auto &pole : aBSpline->poles) {
+ aParams.insert(pole.x);
+ aParams.insert(pole.y);
}
- for (GCS::VEC_pD::iterator it = aBSpline->weights.begin();
- it != aBSpline->weights.end(); ++it)
- aParams.insert(*it);
+ for (auto &weight : aBSpline->weights)
+ aParams.insert(weight);
return aParams;
}
class SketchSolver_Constraint;
class PlaneGCSSolver_Update;
-typedef std::shared_ptr<PlaneGCSSolver_Update> UpdaterPtr;
+using UpdaterPtr = std::shared_ptr<PlaneGCSSolver_Update>;
/** \class PlaneGCSSolver_Update
* \ingroup Plugins
public:
PlaneGCSSolver_Update(UpdaterPtr theNext = UpdaterPtr()) : myNext(theNext) {}
- virtual ~PlaneGCSSolver_Update() {}
+ virtual ~PlaneGCSSolver_Update() = default;
/// \brief Attach listener
/// \param theObserver [in] object which want to receive notifications
/// \brief Detach listener
void detach(SketchSolver_Constraint *theObserver) {
- std::list<SketchSolver_Constraint *>::iterator anIt = myObservers.begin();
+ auto anIt = myObservers.begin();
for (; anIt != myObservers.end(); ++anIt)
if (*anIt == theObserver) {
myObservers.erase(anIt);
void PlaneGCSSolver_UpdateCoincidence::attach(
SketchSolver_Constraint *theObserver, const std::string &theType) {
if (theType == GROUP()) {
- std::list<SketchSolver_Constraint *>::iterator aPlaceToAdd =
- myObservers.end();
+ auto aPlaceToAdd = myObservers.end();
// point-point coincidence is placed first,
// other constraints are sorted by their type
for (aPlaceToAdd = myObservers.begin(); aPlaceToAdd != myObservers.end();
theFeature->getKind() == SketchPlugin_ConstraintCollinear::ID()) {
myCoincident.clear();
// notify listeners and stop procesing
- std::list<SketchSolver_Constraint *>::iterator anIt = myObservers.begin();
+ auto anIt = myObservers.begin();
for (; anIt != myObservers.end(); ++anIt)
(*anIt)->notify(theFeature, this);
} else
static bool
hasAnotherExternalPoint(const std::set<EntityWrapperPtr> &theCoincidences,
const EntityWrapperPtr &thePoint) {
- std::set<EntityWrapperPtr>::const_iterator anIt = theCoincidences.begin();
+ auto anIt = theCoincidences.begin();
for (; anIt != theCoincidences.end(); ++anIt)
if ((*anIt)->type() == ENTITY_POINT && (*anIt)->isExternal() &&
*anIt != thePoint)
bool PlaneGCSSolver_UpdateCoincidence::isPointOnEntity(
const EntityWrapperPtr &thePoint, const EntityWrapperPtr &theEntity) {
- std::list<CoincidentEntities>::iterator anIt =
- findGroupOfCoincidence(thePoint);
+ auto anIt = findGroupOfCoincidence(thePoint);
if (anIt == myCoincident.end())
return false;
if (theEntity->type() != ENTITY_POINT)
return myCoincident.end();
- std::list<CoincidentEntities>::iterator aFound = myCoincident.begin();
+ auto aFound = myCoincident.begin();
for (; aFound != myCoincident.end(); ++aFound)
if (aFound->isExist(theEntity))
break;
static bool hasSamePoint(const std::set<EntityWrapperPtr> &theList,
const GCS::Point &thePoint) {
- std::set<EntityWrapperPtr>::const_iterator anIt = theList.begin();
+ auto anIt = theList.begin();
for (; anIt != theList.end(); ++anIt)
if (squareDistance(thePoint, toPoint(*anIt)) < 1.e-14)
return true;
PlaneGCSSolver_UpdateCoincidence(UpdaterPtr theNext = UpdaterPtr())
: PlaneGCSSolver_Update(theNext) {}
- virtual ~PlaneGCSSolver_UpdateCoincidence() {}
+ ~PlaneGCSSolver_UpdateCoincidence() override = default;
/// \brief Group of entities, processed by this kind of updater
static const std::string &GROUP() {
/// \param theObserver [in] object which want to receive notifications
/// \param theType [in] receive notifications about changing objects
/// of theType and their derivatives
- virtual void attach(SketchSolver_Constraint *theObserver,
- const std::string &theType);
+ void attach(SketchSolver_Constraint *theObserver,
+ const std::string &theType) override;
/// \brief Send notification about update of the feature to all interested
- virtual void update(const FeaturePtr &theFeature);
+ void update(const FeaturePtr &theFeature) override;
/// \brief Set coincidence between two given entities
/// \return \c true if the entities does not coincident yet
}
void PlaneGCSSolver_UpdateFeature::update(const FeaturePtr &theFeature) {
- std::list<SketchSolver_Constraint *>::iterator anIt = myObservers.begin();
+ auto anIt = myObservers.begin();
for (; anIt != myObservers.end(); ++anIt)
(*anIt)->notify(theFeature, this);
}
/// \param theObserver [in] object which want to receive notifications
/// \param theType [in] receive notifications about changing objects
/// of theType and their derivatives
- virtual void attach(SketchSolver_Constraint *theObserver,
- const std::string &theType);
+ void attach(SketchSolver_Constraint *theObserver,
+ const std::string &theType) override;
/// \brief Send notification about update of the feature to all interested
- virtual void update(const FeaturePtr &theFeature);
+ void update(const FeaturePtr &theFeature) override;
};
#endif
int aEntInd = 2; // index of first entity in the list of attributes
std::list<AttributePtr> aConstrAttrs =
aData->attributes(ModelAPI_AttributeRefAttr::typeId());
- std::list<AttributePtr>::iterator anIter = aConstrAttrs.begin();
+ auto anIter = aConstrAttrs.begin();
for (; anIter != aConstrAttrs.end(); anIter++) {
AttributeRefAttrPtr aRefAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(*anIter);
class SketchSolver_Constraint {
protected:
/// Default constructor
- SketchSolver_Constraint() : myType(CONSTRAINT_UNKNOWN) {}
+ SketchSolver_Constraint() {}
public:
/// Constructor based on SketchPlugin constraint
SketchSolver_Constraint(ConstraintPtr theConstraint);
- virtual ~SketchSolver_Constraint() {}
+ virtual ~SketchSolver_Constraint() = default;
/// \brief Initializes parameters and start constraint creation
/// \param theStorage [in] storage where to place new constraint
/// storage, which contains all information about entities and constraints
StoragePtr myStorage;
- SketchSolver_ConstraintType myType; ///< type of constraint
+ SketchSolver_ConstraintType myType{
+ CONSTRAINT_UNKNOWN}; ///< type of constraint
std::list<EntityWrapperPtr> myAttributes; ///< attributes of constraint
std::string myErrorMsg; ///< error message
};
-typedef std::shared_ptr<SketchSolver_Constraint> SolverConstraintPtr;
+using SolverConstraintPtr = std::shared_ptr<SketchSolver_Constraint>;
#endif
/// \brief This method is used in derived objects to check consistence of
/// constraint.
- virtual void adjustConstraint();
+ void adjustConstraint() override;
protected:
/// \brief Generate list of attributes of constraint in order useful for
/// constraints \param[out] theValue numerical characteristic of
/// constraint (e.g. distance) \param[out] theAttributes list of attributes to
/// be filled
- virtual void getAttributes(EntityWrapperPtr &theValue,
- std::vector<EntityWrapperPtr> &theAttributes);
+ void getAttributes(EntityWrapperPtr &theValue,
+ std::vector<EntityWrapperPtr> &theAttributes) override;
private:
int myType;
AttributePtr &theEnd) {
AttributePtr anEllipseAttr;
const std::set<AttributePtr> &aRefs = theConstruction->data()->refsToMe();
- for (std::set<AttributePtr>::const_iterator aRefIt = aRefs.begin();
- aRefIt != aRefs.end(); ++aRefIt) {
- FeaturePtr anOwner = ModelAPI_Feature::feature((*aRefIt)->owner());
+ for (const auto &aRef : aRefs) {
+ FeaturePtr anOwner = ModelAPI_Feature::feature(aRef->owner());
if (anOwner && anOwner->getKind() ==
SketchPlugin_ConstraintCoincidenceInternal::ID()) {
AttributeRefAttrPtr aRefAttr;
- if ((*aRefIt)->id() == SketchPlugin_Constraint::ENTITY_A())
+ if (aRef->id() == SketchPlugin_Constraint::ENTITY_A())
aRefAttr = anOwner->refattr(SketchPlugin_Constraint::ENTITY_B());
else
aRefAttr = anOwner->refattr(SketchPlugin_Constraint::ENTITY_A());
}
void SketchSolver_ConstraintCoincidence::notify(
- const FeaturePtr &theFeature, PlaneGCSSolver_Update *theUpdater) {
- PlaneGCSSolver_UpdateCoincidence *anUpdater =
- static_cast<PlaneGCSSolver_UpdateCoincidence *>(theUpdater);
+ const FeaturePtr & /*theFeature*/, PlaneGCSSolver_Update *theUpdater) {
+ auto *anUpdater = static_cast<PlaneGCSSolver_UpdateCoincidence *>(theUpdater);
bool isAccepted =
anUpdater->addCoincidence(myAttributes.front(), myAttributes.back());
// additionally process internal coincidence, set point coincident with
? myAttributes.front()
: myAttributes.back();
- for (int i = 0; i < 2; ++i)
+ for (const auto &myFeatureExtremitie : myFeatureExtremities)
isAccepted = isAccepted &&
- !anUpdater->isPointOnEntity(aPoint, myFeatureExtremities[i]);
+ !anUpdater->isPointOnEntity(aPoint, myFeatureExtremitie);
}
if (isAccepted) {
: SketchSolver_Constraint(theConstraint), myInSolver(false) {}
/// \brief Notify this object about the feature is changed somewhere
- virtual void notify(const FeaturePtr &theFeature,
- PlaneGCSSolver_Update *theUpdater);
+ void notify(const FeaturePtr &theFeature,
+ PlaneGCSSolver_Update *theUpdater) override;
/// \brief Remove constraint
- virtual bool remove();
+ bool remove() override;
protected:
/// \brief Converts SketchPlugin constraint to a list of solver constraints
- virtual void process();
+ void process() override;
/// \brief Generate list of attributes of constraint in order useful for
/// constraints \param[out] theValue numerical characteristic of
/// constraint (e.g. distance) \param[out] theAttributes list of attributes to
/// be filled
- virtual void getAttributes(EntityWrapperPtr &theValue,
- std::vector<EntityWrapperPtr> &theAttributes);
+ void getAttributes(EntityWrapperPtr &theValue,
+ std::vector<EntityWrapperPtr> &theAttributes) override;
/// \brief This method is used in derived objects to check consistency of
/// constraint.
/// E.g. the distance between line and point may be signed.
- virtual void adjustConstraint();
+ void adjustConstraint() override;
protected:
bool myInSolver; ///< shows the constraint is added to the solver
if (theFeature == myBaseConstraint && myInSolver)
return; // the constraint is already being updated
- PlaneGCSSolver_UpdateCoincidence *anUpdater =
- static_cast<PlaneGCSSolver_UpdateCoincidence *>(theUpdater);
+ auto *anUpdater = static_cast<PlaneGCSSolver_UpdateCoincidence *>(theUpdater);
bool isPointOnOppositeLine[4];
- std::list<EntityWrapperPtr>::reverse_iterator anIt = myAttributes.rbegin();
+ auto anIt = myAttributes.rbegin();
for (int i = 0; i < 2; ++i, ++anIt) {
isPointOnOppositeLine[2 * i] =
anUpdater->isPointOnEntity(myPoints[2 * i], *anIt);
/// Constructor based on SketchPlugin constraint
SketchSolver_ConstraintCollinear(ConstraintPtr theConstraint)
: SketchSolver_Constraint(theConstraint), myInSolver(false) {
- for (int i = 0; i < 4; ++i)
- myIsConstraintApplied[i] = false;
+ for (bool &i : myIsConstraintApplied)
+ i = false;
}
/// \brief Notify this object about the feature is changed somewhere
- virtual void notify(const FeaturePtr &theFeature,
- PlaneGCSSolver_Update *theUpdater);
+ void notify(const FeaturePtr &theFeature,
+ PlaneGCSSolver_Update *theUpdater) override;
protected:
/// \brief Converts SketchPlugin constraint to a list of solver constraints
- virtual void process();
+ void process() override;
private:
EntityWrapperPtr myPoints[4]; ///< extremities on collinear lines
mySignValue(0.0) {}
/// \brief Update constraint
- virtual void update();
+ void update() override;
/// \brief Remove constraint
- virtual bool remove();
+ bool remove() override;
/// \brief Notify this object about the feature is changed somewhere
- virtual void notify(const FeaturePtr &theFeature, PlaneGCSSolver_Update *);
+ void notify(const FeaturePtr &theFeature, PlaneGCSSolver_Update *) override;
protected:
/// \brief Generate list of attributes of constraint in order useful for
/// constraints \param[out] theValue numerical characteristic of
/// constraint (e.g. distance) \param[out] theAttributes list of attributes to
/// be filled
- virtual void getAttributes(EntityWrapperPtr &theValue,
- std::vector<EntityWrapperPtr> &theAttributes);
+ void getAttributes(EntityWrapperPtr &theValue,
+ std::vector<EntityWrapperPtr> &theAttributes) override;
/// \brief This method is used in derived objects to check consistence of
/// constraint.
/// E.g. the distance between line and point may be signed.
- virtual void adjustConstraint();
+ void adjustConstraint() override;
private:
void addConstraintsToKeepSign();
int aNbCircs = 0;
int aNbEllipses = 0;
bool isArcFirst = false; // in line-arc equivalence, the line should be first
- std::vector<EntityWrapperPtr>::iterator anAttrIt = theAttributes.begin() + 2;
+ auto anAttrIt = theAttributes.begin() + 2;
for (; anAttrIt != theAttributes.end(); ++anAttrIt) {
SketchSolver_EntityType aType = (*anAttrIt)->type();
if (aType == ENTITY_LINE)
/// \brief Tries to remove constraint
/// \return \c false, if current constraint contains another SketchPlugin
/// constraints (like for multiple coincidence)
- virtual bool remove();
+ bool remove() override;
protected:
/// \brief Generate list of attributes of constraint in order useful for
/// constraints \param[out] theValue numerical characteristic of
/// constraint (e.g. distance) \param[out] theAttributes list of attributes to
/// be filled
- virtual void getAttributes(EntityWrapperPtr &theValue,
- std::vector<EntityWrapperPtr> &theAttributes);
+ void getAttributes(EntityWrapperPtr &theValue,
+ std::vector<EntityWrapperPtr> &theAttributes) override;
private:
ScalarWrapperPtr
case ENTITY_BSPLINE: {
std::shared_ptr<GCS::BSpline> aBSpline =
std::dynamic_pointer_cast<GCS::BSpline>(anEntity->entity());
- for (GCS::VEC_P::iterator anIt = aBSpline->poles.begin();
- anIt != aBSpline->poles.end(); ++anIt) {
- aParameters.push_back(anIt->x);
- aParameters.push_back(anIt->y);
+ for (auto &pole : aBSpline->poles) {
+ aParameters.push_back(pole.x);
+ aParameters.push_back(pole.y);
}
break;
}
SketchSolver_ConstraintFixed(ConstraintPtr theConstraint);
/// \brief Block or unblock events from this constraint
- virtual void blockEvents(bool isBlocked);
+ void blockEvents(bool isBlocked) override;
protected:
/// \brief Converts SketchPlugin constraint to a list of SolveSpace
/// constraints
- virtual void process();
+ void process() override;
/// \brief Generate list of attributes of constraint in order useful for
/// constraints \param[out] theValue numerical characteristic of
/// constraint (e.g. distance) \param[out] theAttributes list of attributes to
/// be filled
- virtual void getAttributes(EntityWrapperPtr &,
- std::vector<EntityWrapperPtr> &) {}
+ void getAttributes(EntityWrapperPtr &,
+ std::vector<EntityWrapperPtr> &) override {}
/// \brief Obtain entity to be fixed
EntityWrapperPtr entityToFix();
/// constraints \param[out] theValue numerical characteristic of
/// constraint (e.g. distance) \param[out] theAttributes list of attributes to
/// be filled
- virtual void getAttributes(EntityWrapperPtr &theValue,
- std::vector<EntityWrapperPtr> &theAttributes);
+ void getAttributes(EntityWrapperPtr &theValue,
+ std::vector<EntityWrapperPtr> &theAttributes) override;
};
#endif
return;
}
- PlaneGCSSolver_UpdateCoincidence *anUpdater =
- static_cast<PlaneGCSSolver_UpdateCoincidence *>(theUpdater);
+ auto *anUpdater = static_cast<PlaneGCSSolver_UpdateCoincidence *>(theUpdater);
bool isAccepted =
anUpdater->addCoincidence(myAttributes.front(), myAttributes.back());
if (isAccepted) {
: SketchSolver_ConstraintCoincidence(theConstraint) {}
/// \brief Notify this object about the feature is changed somewhere
- virtual void notify(const FeaturePtr &theFeature,
- PlaneGCSSolver_Update *theUpdater);
+ void notify(const FeaturePtr &theFeature,
+ PlaneGCSSolver_Update *theUpdater) override;
/// \brief Remove constraint
- virtual bool remove();
+ bool remove() override;
protected:
/// \brief Generate list of attributes of constraint in order useful for
/// constraints \param[out] theValue numerical characteristic of
/// constraint (e.g. distance) \param[out] theAttributes list of attributes to
/// be filled
- virtual void getAttributes(EntityWrapperPtr &theValue,
- std::vector<EntityWrapperPtr> &theAttributes);
+ void getAttributes(EntityWrapperPtr &theValue,
+ std::vector<EntityWrapperPtr> &theAttributes) override;
private:
ConstraintWrapperPtr myMiddle;
// store only original entities because mirrored ones
// will be updated separately in adjustConstraint
std::list<ObjectPtr> aList = aBaseRefList->list();
- std::list<ObjectPtr>::iterator anIt = aList.begin();
+ auto anIt = aList.begin();
for (; anIt != aList.end(); ++anIt) {
FeaturePtr aFeature = ModelAPI_Feature::feature(*anIt);
if (aFeature) {
}
void SketchSolver_ConstraintMirror::blockEvents(bool isBlocked) {
- std::set<FeaturePtr>::iterator anIt = myFeatures.begin();
+ auto anIt = myFeatures.begin();
for (; anIt != myFeatures.end(); ++anIt)
(*anIt)->data()->blockSendAttributeUpdated(isBlocked);
: SketchSolver_Constraint(theConstraint), myNumberOfObjects(0) {}
/// \brief Update constraint
- virtual void update();
+ void update() override;
/// \brief Notify this object about the feature is changed somewhere
- virtual void notify(const FeaturePtr &theFeature, PlaneGCSSolver_Update *);
+ void notify(const FeaturePtr &theFeature, PlaneGCSSolver_Update *) override;
/// \brief Block or unblock events from this constraint
- virtual void blockEvents(bool isBlocked);
+ void blockEvents(bool isBlocked) override;
protected:
/// \brief Converts SketchPlugin constraint to a list of SolveSpace
/// constraints
- virtual void process();
+ void process() override;
/// \brief Generate list of entities of mirror constraint
- virtual void getAttributes(EntityWrapperPtr &,
- std::vector<EntityWrapperPtr> &);
+ void getAttributes(EntityWrapperPtr &,
+ std::vector<EntityWrapperPtr> &) override;
/// \brief This method is used in derived objects to check consistence of
/// constraint.
/// E.g. the distance between line and point may be signed.
- virtual void adjustConstraint();
+ void adjustConstraint() override;
private:
size_t myNumberOfObjects; ///< number of previously mirrored objects
#ifdef CHANGE_RADIUS_WHILE_MOVE
if (theMovedFeature->getKind() == SketchPlugin_Circle::ID() ||
theMovedFeature->getKind() == SketchPlugin_Ellipse::ID())
- isSimple = (theDraggedPoint.get() != 0);
+ isSimple = (theDraggedPoint.get() != nullptr);
else if (theMovedFeature->getKind() == SketchPlugin_Arc::ID() ||
theMovedFeature->getKind() == SketchPlugin_EllipticArc::ID()) {
isSimple =
- (theDraggedPoint.get() != 0 &&
+ (theDraggedPoint.get() != nullptr &&
(theDraggedPoint->id() == SketchPlugin_Arc::CENTER_ID() ||
theDraggedPoint->id() == SketchPlugin_EllipticArc::CENTER_ID()));
}
PointWrapperPtr aPoint =
std::dynamic_pointer_cast<PlaneGCSSolver_PointWrapper>(theArcExtremity);
- double *aParams[nbParams] = {aPoint->point()->x, aPoint->point()->y, 0, 0};
+ double *aParams[nbParams] = {aPoint->point()->x, aPoint->point()->y, nullptr,
+ nullptr};
if (anArc) {
aParams[2] = anArc->center.x;
aParams[3] = anArc->center.y;
void moveTo(const std::shared_ptr<GeomAPI_Pnt2d> &theDestinationPoint);
/// \brief Block or unblock events from this constraint
- virtual void blockEvents(bool isBlocked);
+ void blockEvents(bool isBlocked) override;
/// \brief Returns moved feature
FeaturePtr movedFeature() const { return myMovedFeature; }
protected:
/// \brief Converts SketchPlugin constraint to a list of SolveSpace
/// constraints
- virtual void process();
+ void process() override;
/// \brief Create Fixed constraint for the feature basing on its type and
/// moved point \return Fixed constraint
FeaturePtr aFeature;
std::list<ObjectPtr> anObjectList = aRefList->list();
- std::list<ObjectPtr>::iterator anObjIt = anObjectList.begin();
+ auto anObjIt = anObjectList.begin();
// execute for the feature is not called yet
if ((myNumberOfCopies + 1) * myNumberOfObjects != aRefList->size())
myNumberOfCopies = aRefList->size() / myNumberOfObjects - 1;
// "Multi" constraint has been removed, thus all copy features become
// non-copied, add them once again to be a common feature
- std::set<FeaturePtr>::iterator anIt = myCopiedFeatures.begin();
+ auto anIt = myCopiedFeatures.begin();
for (; anIt != myCopiedFeatures.end(); ++anIt) {
EntityWrapperPtr anEntity = myStorage->entity(*anIt);
if (anEntity) {
if (aRefList && aRefList->size() != 0) {
FeaturePtr aFeature;
std::list<ObjectPtr> anObjectList = aRefList->list();
- std::list<ObjectPtr>::iterator anObjIt = anObjectList.begin();
+ auto anObjIt = anObjectList.begin();
for (; anObjIt != anObjectList.end(); ++anObjIt) {
aFeature = ModelAPI_Feature::feature(*anObjIt);
if (aFeature &&
std::list<double>::iterator aXIt, aYIt;
std::list<ObjectPtr> anObjectList = aRefList->list();
- std::list<ObjectPtr>::iterator anObjIt = anObjectList.begin();
+ auto anObjIt = anObjectList.begin();
while (anObjIt != anObjectList.end()) {
anOriginal = ModelAPI_Feature::feature(*anObjIt++);
if (!anOriginal)
double aXCoord, aYCoord;
std::list<AttributePtr> aPoints =
anOriginal->data()->attributes(GeomDataAPI_Point2D::typeId());
- std::list<AttributePtr>::iterator aPtIt = aPoints.begin();
+ auto aPtIt = aPoints.begin();
for (; aPtIt != aPoints.end(); ++aPtIt) {
AttributePoint2DPtr aPoint2D =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(*aPtIt);
void SketchSolver_ConstraintMulti::blockEvents(bool isBlocked) {
myIsEventsBlocked = isBlocked;
- std::set<FeaturePtr>::iterator anIt = myOriginalFeatures.begin();
+ auto anIt = myOriginalFeatures.begin();
for (; anIt != myOriginalFeatures.end(); ++anIt)
(*anIt)->data()->blockSendAttributeUpdated(isBlocked);
for (anIt = myCopiedFeatures.begin(); anIt != myCopiedFeatures.end(); ++anIt)
myIsEventsBlocked(false), myIsProcessingNotify(false) {}
/// \brief Update constraint
- virtual void update();
+ void update() override;
/// \brief Notify this object about the feature is changed somewhere
- virtual void notify(const FeaturePtr &theFeature, PlaneGCSSolver_Update *);
+ void notify(const FeaturePtr &theFeature, PlaneGCSSolver_Update *) override;
/// \brief Tries to remove constraint
/// \return \c false, if current constraint contains another SketchPlugin
/// constraints (like for multiple coincidence)
- virtual bool remove();
+ bool remove() override;
/// \brief Block or unblock events from this constraint
- virtual void blockEvents(bool isBlocked);
+ void blockEvents(bool isBlocked) override;
protected:
/// \brief Converts SketchPlugin constraint to a list of SolveSpace
/// constraints
- virtual void process() { /* do nothing here */
+ void process() override { /* do nothing here */
}
/// \brief Collect entities which are translated or rotated (not their copies)
/// \brief Generate list of attributes of constraint in order useful for
/// SolveSpace constraints
- virtual void
- getAttributes(EntityWrapperPtr &,
- std::vector<EntityWrapperPtr> &) { /* do nothing here */
+ void getAttributes(EntityWrapperPtr &, std::vector<EntityWrapperPtr> &)
+ override { /* do nothing here */
}
/// \brief This method is used in derived objects to check consistence of
/// constraint.
- virtual void adjustConstraint();
+ void adjustConstraint() override;
/// \brief Update parameters of derived classes
virtual void updateLocal() = 0;
protected:
/// \brief Converts SketchPlugin constraint to a list of SolveSpace
/// constraints
- virtual void process();
+ void process() override;
/// \brief Generate list of rotated entities
/// \param[out] theCenter central point of rotation
/// \brief This method is used in derived objects to check consistence of
/// constraint.
- virtual void adjustConstraint();
+ void adjustConstraint() override;
/// \brief Update parameters (called from base class)
- virtual void updateLocal();
+ void updateLocal() override;
private:
/// \brief Convert absolute coordinates to relative coordinates
- virtual void getRelative(double theAbsX, double theAbsY, double &theRelX,
- double &theRelY);
+ void getRelative(double theAbsX, double theAbsY, double &theRelX,
+ double &theRelY) override;
/// \brief Convert relative coordinates to absolute coordinates
- virtual void getAbsolute(double theRelX, double theRelY, double &theAbsX,
- double &theAbsY);
+ void getAbsolute(double theRelX, double theRelY, double &theAbsX,
+ double &theAbsY) override;
/// \brief Apply transformation for relative coordinates
- virtual void transformRelative(double &theX, double &theY);
+ void transformRelative(double &theX, double &theY) override;
/// \brief Returns name of NUMBER_OF_COPIES parameter for corresponding
/// feature
- virtual const std::string &nameNbObjects();
+ const std::string &nameNbObjects() override;
private:
AttributePoint2DPtr myCenterPointAttribute; ///< a center of rotation
protected:
/// \brief Converts SketchPlugin constraint to a list of SolveSpace
/// constraints
- virtual void process();
+ void process() override;
/// \brief Generate list of translated entities
/// \param[out] theStartPoint start point of translation
/// \brief This method is used in derived objects to check consistence of
/// constraint.
- virtual void adjustConstraint();
+ void adjustConstraint() override;
/// \brief Update parameters (called from base class)
- virtual void updateLocal();
+ void updateLocal() override;
private:
/// \brief Convert absolute coordinates to relative coordinates
- virtual void getRelative(double theAbsX, double theAbsY, double &theRelX,
- double &theRelY);
+ void getRelative(double theAbsX, double theAbsY, double &theRelX,
+ double &theRelY) override;
/// \brief Convert relative coordinates to absolute coordinates
- virtual void getAbsolute(double theRelX, double theRelY, double &theAbsX,
- double &theAbsY);
+ void getAbsolute(double theRelX, double theRelY, double &theAbsX,
+ double &theAbsY) override;
/// \brief Apply transformation for relative coordinates
- virtual void transformRelative(double &theX, double &theY);
+ void transformRelative(double &theX, double &theY) override;
/// \brief Returns name of NUMBER_OF_COPIES parameter for corresponding
/// feature
- virtual const std::string &nameNbObjects();
+ const std::string &nameNbObjects() override;
private:
AttributePoint2DPtr myStartPointAttribute;
: SketchSolver_Constraint(theConstraint) {}
/// \brief Update constraint
- virtual void update();
+ void update() override;
protected:
/// \brief Converts SketchPlugin constraint to a list of SolveSpace
/// constraints
- virtual void process();
+ void process() override;
/// \brief Generate list of entities of mirror constraint
- virtual void getAttributes(EntityWrapperPtr &,
- std::vector<EntityWrapperPtr> &);
+ void getAttributes(EntityWrapperPtr &,
+ std::vector<EntityWrapperPtr> &) override;
};
#endif
int aNbLines = 0;
int aNbCircles = 0;
int aNbOther = 0;
- std::list<EntityWrapperPtr>::iterator anEntIt = myAttributes.begin();
+ auto anEntIt = myAttributes.begin();
for (; anEntIt != myAttributes.end(); ++anEntIt) {
if (!(*anEntIt).get())
continue;
}
void SketchSolver_ConstraintPerpendicular::notify(
- const FeaturePtr &theFeature, PlaneGCSSolver_Update *theUpdater) {
+ const FeaturePtr &theFeature, PlaneGCSSolver_Update * /*theUpdater*/) {
if (theFeature->getKind() != SketchPlugin_ConstraintCoincidence::ID())
return;
std::set<AttributePtr> aCoincidentPoints =
coincidentBoundaryPoints(aTgFeat1, aTgFeat2);
isRebuild = true;
- std::set<AttributePtr>::iterator anIt = aCoincidentPoints.begin();
+ auto anIt = aCoincidentPoints.begin();
for (; anIt != aCoincidentPoints.end() && isRebuild; ++anIt)
if (*anIt == mySharedPoint)
isRebuild =
collectCoincidences(theFeature1, theFeature2);
// collect points only
std::set<AttributePtr> aCoincidentPoints;
- std::set<FeaturePtr>::const_iterator aCIt = aCoincidences.begin();
+ auto aCIt = aCoincidences.begin();
for (; aCIt != aCoincidences.end(); ++aCIt) {
AttributeRefAttrPtr aRefAttrA =
(*aCIt)->refattr(SketchPlugin_Constraint::ENTITY_A());
static std::set<AttributePtr> refsToFeatureAndResults(FeaturePtr theFeature) {
std::set<AttributePtr> aRefs = theFeature->data()->refsToMe();
const std::list<ResultPtr> &aResults = theFeature->results();
- for (std::list<ResultPtr>::const_iterator anIt = aResults.begin();
- anIt != aResults.end(); ++anIt) {
- const std::set<AttributePtr> &aResRefs = (*anIt)->data()->refsToMe();
+ for (const auto &aResult : aResults) {
+ const std::set<AttributePtr> &aResRefs = aResult->data()->refsToMe();
aRefs.insert(aResRefs.begin(), aResRefs.end());
}
return aRefs;
std::set<AttributePtr> aPoints;
std::set<AttributePtr> aRefs = refsToFeatureAndResults(theFeature);
- for (std::set<AttributePtr>::const_iterator anIt = aRefs.begin();
- anIt != aRefs.end(); ++anIt) {
- FeaturePtr aRef = ModelAPI_Feature::feature((*anIt)->owner());
+ for (const auto &anIt : aRefs) {
+ FeaturePtr aRef = ModelAPI_Feature::feature(anIt->owner());
if (aRef && (aRef->getKind() == SketchPlugin_ConstraintCoincidence::ID() ||
aRef->getKind() == SketchPlugin_ConstraintMiddle::ID())) {
for (int i = 0; i < CONSTRAINT_ATTR_SIZE; ++i) {
std::set<AttributePtr> aPointsOnF2 = pointsOnFeature(theFeature2);
std::set<AttributePtr> aCommonPoints;
- for (std::set<AttributePtr>::iterator anIt = aPointsOnF1.begin();
- anIt != aPointsOnF1.end(); ++anIt)
- if (aPointsOnF2.find(*anIt) != aPointsOnF2.end())
- aCommonPoints.insert(*anIt);
+ for (const auto &anIt : aPointsOnF1)
+ if (aPointsOnF2.find(anIt) != aPointsOnF2.end())
+ aCommonPoints.insert(anIt);
return aCommonPoints;
}
: SketchSolver_Constraint(theConstraint), myCurveCurveAngle(0.0) {}
/// \brief Notify this object about the feature is changed somewhere
- virtual void notify(const FeaturePtr &theFeature,
- PlaneGCSSolver_Update *theUpdater);
+ void notify(const FeaturePtr &theFeature,
+ PlaneGCSSolver_Update *theUpdater) override;
protected:
/// \brief Converts SketchPlugin constraint to a list of solver constraints
- virtual void process();
+ void process() override;
/// \brief Remove current constraint from the storage and build is again
void rebuild();
static ConstraintWrapperPtr
createArcLineTangency(EntityWrapperPtr theEntity1, EntityWrapperPtr theEntity2,
EntityWrapperPtr theShapedPoint = EntityWrapperPtr(),
- double *theAngle = 0);
+ double *theAngle = nullptr);
static ConstraintWrapperPtr
createCurveCurveTangency(EntityWrapperPtr theEntity1,
EntityWrapperPtr theEntity2, bool theInternalTangency,
EntityWrapperPtr theSharedPoint = EntityWrapperPtr(),
- double *theAngle = 0);
+ double *theAngle = nullptr);
static void calculateTangencyPoint(EntityWrapperPtr theCurve1,
EntityWrapperPtr theCurve2,
int aNbCircles = 0;
int aNbEllipses = 0;
int aNbSplines = 0;
- std::list<EntityWrapperPtr>::iterator anEntIt = myAttributes.begin();
+ auto anEntIt = myAttributes.begin();
for (; anEntIt != myAttributes.end(); ++anEntIt) {
if (!(*anEntIt).get())
continue;
// which boundary is coincident?
GCS::Point aPoint1, aPoint2;
- for (std::set<AttributePtr>::iterator aPIt = aCoincidentPoints.begin();
- aPIt != aCoincidentPoints.end(); ++aPIt) {
- if ((*aPIt)->owner() == aFeatures[i]) {
- if ((*aPIt)->id() == SketchPlugin_BSpline::START_ID()) {
+ for (const auto &aCoincidentPoint : aCoincidentPoints) {
+ if (aCoincidentPoint->owner() == aFeatures[i]) {
+ if (aCoincidentPoint->id() == SketchPlugin_BSpline::START_ID()) {
aPoint1 = aBSpline->poles[0];
aPoint2 = aBSpline->poles[1];
- } else if ((*aPIt)->id() == SketchPlugin_BSpline::END_ID()) {
+ } else if (aCoincidentPoint->id() ==
+ SketchPlugin_BSpline::END_ID()) {
aPoint1 = aBSpline->poles[aBSpline->poles.size() - 2];
aPoint2 = aBSpline->poles[aBSpline->poles.size() - 1];
}
}
}
-void SketchSolver_ConstraintTangent::notify(const FeaturePtr &theFeature,
- PlaneGCSSolver_Update *theUpdater) {
+void SketchSolver_ConstraintTangent::notify(
+ const FeaturePtr &theFeature, PlaneGCSSolver_Update * /*theUpdater*/) {
if (theFeature->getKind() != SketchPlugin_ConstraintCoincidence::ID())
return;
std::set<AttributePtr> aCoincidentPoints =
coincidentBoundaryPoints(aTgFeat1, aTgFeat2);
isRebuild = true;
- std::set<AttributePtr>::iterator anIt = aCoincidentPoints.begin();
+ auto anIt = aCoincidentPoints.begin();
for (; anIt != aCoincidentPoints.end() && isRebuild; ++anIt)
if (*anIt == mySharedPoint)
isRebuild =
AttributeRefAttrPtr aRefAttr =
aRef->refattr(SketchPlugin_Constraint::ATTRIBUTE(i));
if (aRefAttr && !aRefAttr->isObject()) {
- std::map<AttributePtr, FeaturePtr>::iterator aFound =
- aCoincidentPoints.find(aRefAttr->attr());
+ auto aFound = aCoincidentPoints.find(aRefAttr->attr());
if (aFound != aCoincidentPoints.end()) {
aCoincidencesBetweenFeatures.insert(aRef);
aCoincidencesBetweenFeatures.insert(aFound->second);
collectCoincidences(theFeature1, theFeature2);
// collect points only
std::map<FeaturePtr, std::set<AttributePtr>> aCoincidentPoints;
- std::set<FeaturePtr>::const_iterator aCIt = aCoincidences.begin();
+ auto aCIt = aCoincidences.begin();
for (; aCIt != aCoincidences.end(); ++aCIt) {
for (int i = 0; i < CONSTRAINT_ATTR_SIZE; ++i) {
AttributeRefAttrPtr aRefAttr =
std::set<AttributePtr> aBoundaryPoints;
if (aCoincidentPoints.size() == 2) {
- for (std::map<FeaturePtr, std::set<AttributePtr>>::iterator anIt =
- aCoincidentPoints.begin();
- anIt != aCoincidentPoints.end(); ++anIt)
- aBoundaryPoints.insert(anIt->second.begin(), anIt->second.end());
+ for (auto &aCoincidentPoint : aCoincidentPoints)
+ aBoundaryPoints.insert(aCoincidentPoint.second.begin(),
+ aCoincidentPoint.second.end());
}
return aBoundaryPoints;
}
static std::set<AttributePtr> refsToFeatureAndResults(FeaturePtr theFeature) {
std::set<AttributePtr> aRefs = theFeature->data()->refsToMe();
const std::list<ResultPtr> &aResults = theFeature->results();
- for (std::list<ResultPtr>::const_iterator anIt = aResults.begin();
- anIt != aResults.end(); ++anIt) {
- const std::set<AttributePtr> &aResRefs = (*anIt)->data()->refsToMe();
+ for (const auto &aResult : aResults) {
+ const std::set<AttributePtr> &aResRefs = aResult->data()->refsToMe();
aRefs.insert(aResRefs.begin(), aResRefs.end());
}
return aRefs;
std::set<AttributePtr> aPoints;
std::set<AttributePtr> aRefs = refsToFeatureAndResults(theFeature);
- for (std::set<AttributePtr>::const_iterator anIt = aRefs.begin();
- anIt != aRefs.end(); ++anIt) {
- FeaturePtr aRef = ModelAPI_Feature::feature((*anIt)->owner());
+ for (const auto &anIt : aRefs) {
+ FeaturePtr aRef = ModelAPI_Feature::feature(anIt->owner());
if (aRef &&
(aRef->getKind() == SketchPlugin_ConstraintCoincidence::ID() ||
aRef->getKind() == SketchPlugin_ConstraintCoincidenceInternal::ID() ||
std::set<AttributePtr> aPointsOnF2 = pointsOnFeature(theFeature2);
std::set<AttributePtr> aCommonPoints;
- for (std::set<AttributePtr>::iterator anIt = aPointsOnF1.begin();
- anIt != aPointsOnF1.end(); ++anIt)
- if (aPointsOnF2.find(*anIt) != aPointsOnF2.end())
- aCommonPoints.insert(*anIt);
+ for (const auto &anIt : aPointsOnF1)
+ if (aPointsOnF2.find(anIt) != aPointsOnF2.end())
+ aCommonPoints.insert(anIt);
return aCommonPoints;
}
myCurveCurveAngle(0.0) {}
/// \brief Notify this object about the feature is changed somewhere
- virtual void notify(const FeaturePtr &theFeature,
- PlaneGCSSolver_Update *theUpdater);
+ void notify(const FeaturePtr &theFeature,
+ PlaneGCSSolver_Update *theUpdater) override;
/// \brief Tries to remove constraint
/// \return \c false, if current constraint contains another SketchPlugin
/// constraints (like for multiple coincidence)
- virtual bool remove();
+ bool remove() override;
protected:
/// \brief Converts SketchPlugin constraint to a list of solver constraints
- virtual void process();
+ void process() override;
/// \brief Remove current constraint from the storage and build is again
void rebuild();
/// \brief This method is used in derived objects to check consistency of
/// constraint.
/// E.g. the distance between line and point may be signed.
- virtual void adjustConstraint();
+ void adjustConstraint() override;
private:
bool isArcArcInternal;
const EntityWrapperPtr &theSolverEntity,
const std::shared_ptr<GeomAPI_Pnt2d> &theFrom,
const std::shared_ptr<GeomAPI_Pnt2d> &theTo) {
- bool isEntityExists = (theSolverEntity.get() != 0);
+ bool isEntityExists = (theSolverEntity.get() != nullptr);
if (theSketchDOF == 0 && isEntityExists) {
// avoid moving elements of fully constrained sketch
theStorage->refresh();
myStorage->getConflictingConstraints(mySketchSolver);
if (!myConflictingConstraints.empty()) {
- std::set<ObjectPtr>::iterator anIt = aConflicting.begin();
+ auto anIt = aConflicting.begin();
for (; anIt != aConflicting.end(); ++anIt)
myConflictingConstraints.erase(*anIt);
if (!myConflictingConstraints.empty()) {
if (!areConstraintsValid() || !myStorage->areFeaturesValid()) {
// remove invalid constraints
std::set<ConstraintPtr> anInvalidConstraints;
- ConstraintConstraintMap::iterator aCIter = myConstraints.begin();
+ auto aCIter = myConstraints.begin();
for (; aCIter != myConstraints.end(); ++aCIter) {
if (!aCIter->first->data() || !aCIter->first->data()->isValid())
anInvalidConstraints.insert(aCIter->first);
}
- std::set<ConstraintPtr>::const_iterator aRemoveIt =
- anInvalidConstraints.begin();
+ auto aRemoveIt = anInvalidConstraints.begin();
for (; aRemoveIt != anInvalidConstraints.end(); ++aRemoveIt)
removeConstraint(*aRemoveIt);
if (!myTempConstraints.empty()) {
mySketchSolver->removeConstraint(CID_MOVEMENT);
- std::set<SolverConstraintPtr>::iterator aTmpIt = myTempConstraints.begin();
+ auto aTmpIt = myTempConstraints.begin();
for (; aTmpIt != myTempConstraints.end(); ++aTmpIt)
(*aTmpIt)->remove();
// Purpose: remove constraint and all unused entities
// ============================================================================
void SketchSolver_Group::removeConstraint(ConstraintPtr theConstraint) {
- ConstraintConstraintMap::iterator aCIter = myConstraints.begin();
+ auto aCIter = myConstraints.begin();
for (; aCIter != myConstraints.end(); aCIter++)
if (aCIter->first == theConstraint) {
aCIter->second->remove(); // the constraint is not fully removed
myStorage->blockEvents(isBlocked);
// block/unblock events from constraints
- ConstraintConstraintMap::iterator aCIt = myConstraints.begin();
+ auto aCIt = myConstraints.begin();
for (; aCIt != myConstraints.end(); ++aCIt)
aCIt->second->blockEvents(isBlocked);
bool SketchSolver_Group::areConstraintsValid() const {
// Check the constraints are valid
- ConstraintConstraintMap::const_iterator aCIter = myConstraints.begin();
+ auto aCIter = myConstraints.begin();
for (; aCIter != myConstraints.end(); ++aCIter)
if (!aCIter->first->data() || !aCIter->first->data()->isValid())
return false;
class GeomAPI_Pnt;
class GeomAPI_Pnt2d;
-typedef std::map<ConstraintPtr, SolverConstraintPtr> ConstraintConstraintMap;
+using ConstraintConstraintMap = std::map<ConstraintPtr, SolverConstraintPtr>;
/** \class SketchSolver_Group
* \ingroup Plugins
///< constraints
};
-typedef std::shared_ptr<SketchSolver_Group> SketchGroupPtr;
+using SketchGroupPtr = std::shared_ptr<SketchSolver_Group>;
#endif
static void
featuresOrderedByCreation(const std::set<ObjectPtr> &theOriginalFeatures,
IndexedFeatureMap &theOrderedFeatures) {
- std::set<ObjectPtr>::iterator aFeatIter = theOriginalFeatures.begin();
+ auto aFeatIter = theOriginalFeatures.begin();
for (; aFeatIter != theOriginalFeatures.end(); aFeatIter++) {
std::shared_ptr<SketchPlugin_Feature> aFeature =
std::dynamic_pointer_cast<SketchPlugin_Feature>(*aFeatIter);
int aFeatureIndex = 0;
int aConstraintIndex = (int)theOriginalFeatures.size();
- std::set<ObjectPtr>::iterator aFeatIter = theOriginalFeatures.begin();
+ auto aFeatIter = theOriginalFeatures.begin();
for (; aFeatIter != theOriginalFeatures.end(); aFeatIter++) {
std::shared_ptr<SketchPlugin_Feature> aFeature =
std::dynamic_pointer_cast<SketchPlugin_Feature>(*aFeatIter);
// ========================================================
SketchSolver_Manager *SketchSolver_Manager::instance() {
static SketchSolver_Manager *mySelf =
- 0; // Self pointer to implement singleton functionality
+ nullptr; // Self pointer to implement singleton functionality
if (!mySelf)
mySelf = new SketchSolver_Manager();
return mySelf;
break;
if (aFGrIter != aFeatureGroups.end()) {
- std::list<SketchGroupPtr>::iterator aGroupIter = myGroups.begin();
+ auto aGroupIter = myGroups.begin();
while (aGroupIter != myGroups.end()) {
if (!(*aGroupIter)->isWorkplaneValid()) { // the group should be removed
- std::list<SketchGroupPtr>::iterator aRemoveIt = aGroupIter++;
+ auto aRemoveIt = aGroupIter++;
myGroups.erase(aRemoveIt);
continue;
}
// Obtain sketch, containing the feature
CompositeFeaturePtr aSketch;
const std::set<AttributePtr> &aRefsList = theFeature->data()->refsToMe();
- std::set<AttributePtr>::const_iterator aRefIt = aRefsList.begin();
+ auto aRefIt = aRefsList.begin();
for (; aRefIt != aRefsList.end(); ++aRefIt) {
FeaturePtr anOwner = ModelAPI_Feature::feature((*aRefIt)->owner());
if (anOwner && anOwner->getKind() == SketchPlugin_Sketch::ID()) {
}
void SketchSolver_Manager::releaseFeaturesIfEventsBlocked() const {
- std::list<SketchGroupPtr>::const_iterator aGroupIter = myGroups.begin();
+ auto aGroupIter = myGroups.begin();
for (; aGroupIter != myGroups.end(); ++aGroupIter)
(*aGroupIter)->blockEvents(false);
}
/** \brief Implementation of Event Listener method
* \param[in] theMessage the data of the event
*/
- virtual void processEvent(const std::shared_ptr<Events_Message> &theMessage);
+ void processEvent(const std::shared_ptr<Events_Message> &theMessage) override;
/**
* The solver needs all the updated objects are transfered in one group, not
* one by one. This iscreases performance and avoids problems in resolve of
* only part of the made updates.
*/
- virtual bool groupMessages();
+ bool groupMessages() override;
protected:
SketchSolver_Manager();
- ~SketchSolver_Manager();
+ ~SketchSolver_Manager() override;
/** \brief Adds or updates a constraint or an entity in the suitable group
* \param[in] theFeature sketch feature to be changed
SketchSolver_Storage::constraint(const ConstraintPtr &theConstraint) const {
static ConstraintWrapperPtr aDummy;
- std::map<ConstraintPtr, ConstraintWrapperPtr>::const_iterator aFound =
- myConstraintMap.find(theConstraint);
+ auto aFound = myConstraintMap.find(theConstraint);
if (aFound != myConstraintMap.end())
return aFound->second;
return aDummy;
const EntityWrapperPtr &
SketchSolver_Storage::entity(const FeaturePtr &theFeature) const {
- std::map<FeaturePtr, EntityWrapperPtr>::const_iterator aFound =
- myFeatureMap.find(theFeature);
+ auto aFound = myFeatureMap.find(theFeature);
if (aFound != myFeatureMap.end())
return aFound->second;
const EntityWrapperPtr &
SketchSolver_Storage::entity(const AttributePtr &theAttribute) const {
- std::map<AttributePtr, EntityWrapperPtr>::const_iterator aFound =
- myAttributeMap.find(theAttribute);
+ auto aFound = myAttributeMap.find(theAttribute);
if (aFound != myAttributeMap.end())
return aFound->second;
bool SketchSolver_Storage::areFeaturesValid() const {
// Check the features are valid
- std::map<FeaturePtr, EntityWrapperPtr>::const_iterator aFIter =
- myFeatureMap.begin();
+ auto aFIter = myFeatureMap.begin();
for (; aFIter != myFeatureMap.end(); aFIter++)
if (!aFIter->first->data() || !aFIter->first->data()->isValid())
return false;
std::set<ObjectPtr>
SketchSolver_Storage::getConflictingConstraints(SolverPtr theSolver) const {
std::set<ObjectPtr> aConflicting;
- std::map<ConstraintPtr, ConstraintWrapperPtr>::const_iterator aConstrIt =
- myConstraintMap.begin();
+ auto aConstrIt = myConstraintMap.begin();
for (; aConstrIt != myConstraintMap.end(); ++aConstrIt) {
if (theSolver->isConflicting(aConstrIt->second->id()))
aConflicting.insert(aConstrIt->first);
*/
class SketchSolver_Storage {
private:
- SketchSolver_Storage(const SketchSolver_Storage &);
- SketchSolver_Storage &operator=(const SketchSolver_Storage &);
+ SketchSolver_Storage(const SketchSolver_Storage &) = delete;
+ SketchSolver_Storage &operator=(const SketchSolver_Storage &) = delete;
public:
SketchSolver_Storage(SolverPtr theSolver);
UpdaterPtr myUpdaters;
};
-typedef std::shared_ptr<SketchSolver_Storage> StoragePtr;
+using StoragePtr = std::shared_ptr<SketchSolver_Storage>;
#endif
SketchPlugin_Sketch *theSketcher);
/// Destructor
- Standard_EXPORT ~SketcherPrs_Angle();
+ Standard_EXPORT ~SketcherPrs_Angle() override;
DEFINE_STANDARD_RTTIEXT(SketcherPrs_Angle, PrsDim_AngleDimension)
protected:
/// Redefinition of virtual function
- Standard_EXPORT virtual void
+ Standard_EXPORT void
Compute(const Handle(PrsMgr_PresentationManager3d) & thePresentationManager,
const Handle(Prs3d_Presentation) & thePresentation,
- const Standard_Integer theMode = 0);
+ const Standard_Integer theMode = 0) override;
/// Redefinition of virtual function
- Standard_EXPORT virtual void
- ComputeSelection(const Handle(SelectMgr_Selection) & aSelection,
- const Standard_Integer aMode);
+ Standard_EXPORT void ComputeSelection(const Handle(SelectMgr_Selection) &
+ aSelection,
+ const Standard_Integer aMode) override;
/// Checks is the angle plane has inverted direction of normal to the plane of
/// current sketcher Returns true if crossed product is negative. \return
getCoincidencePoint(ModelAPI_Feature *theConstraint) {
std::shared_ptr<GeomAPI_Pnt2d> aPnt = SketcherPrs_Tools::getPoint(
theConstraint, SketchPlugin_Constraint::ENTITY_A());
- if (aPnt.get() == NULL)
+ if (aPnt.get() == nullptr)
aPnt = SketcherPrs_Tools::getPoint(theConstraint,
SketchPlugin_Constraint::ENTITY_B());
bool aReadyToDisplay = false;
// Get point of the presentation
std::shared_ptr<GeomAPI_Pnt2d> aPnt = getCoincidencePoint(theConstraint);
- aReadyToDisplay = aPnt.get() != NULL;
+ aReadyToDisplay = aPnt.get() != nullptr;
if (aReadyToDisplay) {
std::shared_ptr<GeomAPI_Pnt> aPoint = thePlane->to3D(aPnt->x(), aPnt->y());
thePoint = aPoint->impl<gp_Pnt>();
DEFINE_STANDARD_RTTIEXT(SketcherPrs_Coincident, AIS_InteractiveObject)
protected:
/// Redefinition of virtual function
- Standard_EXPORT virtual void
+ Standard_EXPORT void
Compute(const Handle(PrsMgr_PresentationManager3d) & thePresentationManager,
const Handle(Prs3d_Presentation) & thePresentation,
- const Standard_Integer theMode = 0);
+ const Standard_Integer theMode = 0) override;
/// Redefinition of virtual function
- Standard_EXPORT virtual void
- ComputeSelection(const Handle(SelectMgr_Selection) & aSelection,
- const Standard_Integer aMode);
+ Standard_EXPORT void ComputeSelection(const Handle(SelectMgr_Selection) &
+ aSelection,
+ const Standard_Integer aMode) override;
private:
static bool readyToDisplay(ModelAPI_Feature *theConstraint,
ObjectPtr aObj2 = SketcherPrs_Tools::getResult(
theConstraint, SketchPlugin_Constraint::ENTITY_B());
- aReadyToDisplay = SketcherPrs_Tools::getShape(aObj1).get() != NULL &&
- SketcherPrs_Tools::getShape(aObj2).get() != NULL;
+ aReadyToDisplay = SketcherPrs_Tools::getShape(aObj1).get() != nullptr &&
+ SketcherPrs_Tools::getShape(aObj2).get() != nullptr;
}
return aReadyToDisplay;
}
const std::shared_ptr<GeomAPI_Ax3> &thePlane);
protected:
- virtual const char *iconName() const { return "collinear.png"; }
+ const char *iconName() const override { return "collinear.png"; }
- virtual void drawLines(const Handle(Prs3d_Presentation) & thePrs,
- Quantity_Color theColor) const;
+ void drawLines(const Handle(Prs3d_Presentation) & thePrs,
+ Quantity_Color theColor) const override;
/// Update myPntArray according to presentation positions
/// \return true in case of success
- virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const;
+ bool updateIfReadyToDisplay(double theStep, bool withColor) const override;
};
#endif
myTextValue = Locale::Convert::toString(theAttributeValue->text());
}
-SketcherPrs_DimensionStyle::SketcherPrs_DimensionStyle() {}
+SketcherPrs_DimensionStyle::SketcherPrs_DimensionStyle() = default;
-SketcherPrs_DimensionStyle::~SketcherPrs_DimensionStyle() {}
+SketcherPrs_DimensionStyle::~SketcherPrs_DimensionStyle() = default;
void SketcherPrs_DimensionStyle::updateDimensions(
PrsDim_Dimension *theDimension,
ObjectPtr aObj2 = SketcherPrs_Tools::getResult(
theConstraint, SketchPlugin_Constraint::ENTITY_B());
- aReadyToDisplay = SketcherPrs_Tools::getShape(aObj1).get() != NULL &&
- SketcherPrs_Tools::getShape(aObj2).get() != NULL;
+ aReadyToDisplay = SketcherPrs_Tools::getShape(aObj1).get() != nullptr &&
+ SketcherPrs_Tools::getShape(aObj2).get() != nullptr;
return aReadyToDisplay;
}
ObjectPtr aObj = SketcherPrs_Tools::getResult(
myConstraint, SketchPlugin_Constraint::ENTITY_A());
std::shared_ptr<GeomAPI_Shape> aLine = SketcherPrs_Tools::getShape(aObj);
- if (aLine.get() == NULL)
+ if (aLine.get() == nullptr)
return;
drawShape(aLine, thePrs, theColor);
aObj = SketcherPrs_Tools::getResult(myConstraint,
SketchPlugin_Constraint::ENTITY_B());
aLine = SketcherPrs_Tools::getShape(aObj);
- if (aLine.get() == NULL)
+ if (aLine.get() == nullptr)
return;
drawShape(aLine, thePrs, theColor);
}
const std::shared_ptr<GeomAPI_Ax3> &thePlane);
protected:
- virtual const char *iconName() const { return "equal.png"; }
+ const char *iconName() const override { return "equal.png"; }
- virtual void drawLines(const Handle(Prs3d_Presentation) & thePrs,
- Quantity_Color theColor) const;
+ void drawLines(const Handle(Prs3d_Presentation) & thePrs,
+ Quantity_Color theColor) const override;
/// Update myPntArray according to presentation positions
/// \return true in case of success
- virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const;
+ bool updateIfReadyToDisplay(double theStep, bool withColor) const override;
};
#endif
if (thePlane.get()) {
ObjectPtr aObj = SketcherPrs_Tools::getResult(
theConstraint, SketchPlugin_Constraint::ENTITY_A());
- aReadyToDisplay = SketcherPrs_Tools::getShape(aObj).get() != NULL;
+ aReadyToDisplay = SketcherPrs_Tools::getShape(aObj).get() != nullptr;
}
return aReadyToDisplay;
}
const std::shared_ptr<GeomAPI_Ax3> &thePlane);
protected:
- virtual const char *iconName() const {
+ const char *iconName() const override {
return myIsHorisontal ? "horisontal.png" : "vertical.png";
}
/// Redefine this function in order to add additiona lines of constraint base
/// \param thePrs a presentation
/// \param theColor a color of additiona lines
- virtual void drawLines(const Handle(Prs3d_Presentation) & thePrs,
- Quantity_Color theColor) const;
+ void drawLines(const Handle(Prs3d_Presentation) & thePrs,
+ Quantity_Color theColor) const override;
/// Update myPntArray according to presentation positions
/// \return true in case of success
- virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const;
+ bool updateIfReadyToDisplay(double theStep, bool withColor) const override;
private:
bool myIsHorisontal;
SketchPlugin_Sketch *theSketcher);
/// Destructor
- Standard_EXPORT ~SketcherPrs_LengthDimension();
+ Standard_EXPORT ~SketcherPrs_LengthDimension() override;
DEFINE_STANDARD_RTTIEXT(SketcherPrs_LengthDimension, PrsDim_LengthDimension)
protected:
/// Redefinition of virtual function
- Standard_EXPORT virtual void
+ Standard_EXPORT void
Compute(const Handle(PrsMgr_PresentationManager3d) & thePresentationManager,
const Handle(Prs3d_Presentation) & thePresentation,
- const Standard_Integer theMode = 0);
+ const Standard_Integer theMode = 0) override;
/// Redefinition of virtual function
- Standard_EXPORT virtual void
- ComputeSelection(const Handle(SelectMgr_Selection) & aSelection,
- const Standard_Integer aMode);
+ Standard_EXPORT void ComputeSelection(const Handle(SelectMgr_Selection) &
+ aSelection,
+ const Standard_Integer aMode) override;
private:
static bool readyToDisplay(ModelAPI_Feature *theConstraint,
// one object is a feature Line, other object is a point result. We check
// shape of point result
aReadyToDisplay = aObj1.get() && aObj2.get() &&
- (SketcherPrs_Tools::getShape(aObj1).get() != NULL ||
- SketcherPrs_Tools::getShape(aObj2).get() != NULL);
+ (SketcherPrs_Tools::getShape(aObj1).get() != nullptr ||
+ SketcherPrs_Tools::getShape(aObj2).get() != nullptr);
}
return aReadyToDisplay;
}
ResultPtr aResult = aResults.front();
std::shared_ptr<GeomAPI_Shape> aLine =
SketcherPrs_Tools::getShape(aResult);
- if (aLine.get() != NULL)
+ if (aLine.get() != nullptr)
drawShape(aLine, thePrs, theColor);
}
} else {
std::shared_ptr<GeomAPI_Shape> aLine =
SketcherPrs_Tools::getShape(theObject);
- if (aLine.get() != NULL)
+ if (aLine.get() != nullptr)
drawShape(aLine, thePrs, theColor);
}
}
const std::shared_ptr<GeomAPI_Ax3> &thePlane);
protected:
- virtual const char *iconName() const { return "middlepoint.png"; }
+ const char *iconName() const override { return "middlepoint.png"; }
- virtual void drawLines(const Handle(Prs3d_Presentation) & thePrs,
- Quantity_Color theColor) const;
+ void drawLines(const Handle(Prs3d_Presentation) & thePrs,
+ Quantity_Color theColor) const override;
/// Update myPntArray according to presentation positions
/// \return true in case of success
- virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const;
+ bool updateIfReadyToDisplay(double theStep, bool withColor) const override;
/// Draw shape of the object. Find shape result if the object is feature
void drawLine(const Handle(Prs3d_Presentation) & thePrs,
// Get axis of mirror
ObjectPtr aAxisObj = SketcherPrs_Tools::getResult(
theConstraint, SketchPlugin_Constraint::ENTITY_A());
- if (SketcherPrs_Tools::getShape(aAxisObj).get() == NULL)
+ if (SketcherPrs_Tools::getShape(aAxisObj).get() == nullptr)
return aReadyToDisplay;
std::shared_ptr<ModelAPI_Data> aData = theConstraint->data();
// Get source objects
std::shared_ptr<ModelAPI_AttributeRefList> anAttrB =
aData->reflist(SketchPlugin_Constraint::ENTITY_B());
- if (anAttrB.get() == NULL)
+ if (anAttrB.get() == nullptr)
return aReadyToDisplay;
// Get mirrored objects
std::shared_ptr<ModelAPI_AttributeRefList> anAttrC =
aData->reflist(SketchPlugin_Constraint::ENTITY_C());
- if (anAttrC.get() == NULL)
+ if (anAttrC.get() == nullptr)
return aReadyToDisplay;
int aNb = anAttrB->size();
// get position for each source object
for (i = 0; i < aNb; i++) {
aObj = anAttrB->object(i);
- if (SketcherPrs_Tools::getShape(aObj).get() == NULL)
+ if (SketcherPrs_Tools::getShape(aObj).get() == nullptr)
continue;
aP1 = aMgr->getPosition(aObj, this, theStep);
myPntArray->SetVertice(i + 1, aP1);
// Get position of each mirrored object
for (i = 0; i < aNb; i++) {
aObj = anAttrC->object(i);
- if (SketcherPrs_Tools::getShape(aObj).get() == NULL)
+ if (SketcherPrs_Tools::getShape(aObj).get() == nullptr)
continue;
aP1 = aMgr->getPosition(aObj, this, theStep);
myPntArray->SetVertice(aNb + i + 1, aP1);
std::shared_ptr<ModelAPI_Data> aData = myConstraint->data();
std::shared_ptr<ModelAPI_AttributeRefList> anAttrB =
aData->reflist(SketchPlugin_Constraint::ENTITY_B());
- if (anAttrB.get() == NULL)
+ if (anAttrB.get() == nullptr)
return;
std::shared_ptr<ModelAPI_AttributeRefList> anAttrC =
aData->reflist(SketchPlugin_Constraint::ENTITY_C());
- if (anAttrC.get() == NULL)
+ if (anAttrC.get() == nullptr)
return;
int aNb = anAttrB->size();
const std::shared_ptr<GeomAPI_Ax3> &thePlane);
protected:
- virtual const char *iconName() const { return "mirror.png"; }
+ const char *iconName() const override { return "mirror.png"; }
- virtual void drawLines(const Handle(Prs3d_Presentation) & thePrs,
- Quantity_Color theColor) const;
+ void drawLines(const Handle(Prs3d_Presentation) & thePrs,
+ Quantity_Color theColor) const override;
/// Update myPntArray according to presentation positions
/// \return true in case of success
- virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const;
+ bool updateIfReadyToDisplay(double theStep, bool withColor) const override;
};
#endif
// get position for each source object
for (i = 0; i < aNb; i++) {
aObj = aSelectedEdges->object(i);
- if (SketcherPrs_Tools::getShape(aObj).get() == NULL)
+ if (SketcherPrs_Tools::getShape(aObj).get() == nullptr)
continue;
aP1 = aMgr->getPosition(aObj, this, theStep);
myPntArray->SetVertice(i + 1, aP1);
}
for (i = aNb; i < aNb + aOffNb; i++) {
aObj = aOffcetEdges->object(i - aNb);
- if (SketcherPrs_Tools::getShape(aObj).get() == NULL)
+ if (SketcherPrs_Tools::getShape(aObj).get() == nullptr)
continue;
aP1 = aMgr->getPosition(aObj, this, theStep);
myPntArray->SetVertice(i + 1, aP1);
Quantity_Color theColor) const {
AttributeRefListPtr aSelectedEdges =
myConstraint->reflist(SketchPlugin_Offset::ENTITY_A());
- if (aSelectedEdges.get() == NULL)
+ if (aSelectedEdges.get() == nullptr)
return;
AttributeRefListPtr aOffcetEdges =
myConstraint->reflist(SketchPlugin_Offset::ENTITY_B());
- if (aOffcetEdges.get() == NULL)
+ if (aOffcetEdges.get() == nullptr)
return;
if (aSelectedEdges->size() == 0)
const std::shared_ptr<GeomAPI_Ax3> &thePlane);
protected:
- virtual const char *iconName() const { return "offset.png"; }
+ const char *iconName() const override { return "offset.png"; }
- virtual void drawLines(const Handle(Prs3d_Presentation) & thePrs,
- Quantity_Color theColor) const;
+ void drawLines(const Handle(Prs3d_Presentation) & thePrs,
+ Quantity_Color theColor) const override;
/// Update myPntArray according to presentation positions
/// \return true in case of success
- virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const;
+ bool updateIfReadyToDisplay(double theStep, bool withColor) const override;
};
#endif
ObjectPtr aObj2 = SketcherPrs_Tools::getResult(
theConstraint, SketchPlugin_Constraint::ENTITY_B());
- aReadyToDisplay = SketcherPrs_Tools::getShape(aObj1).get() != NULL &&
- SketcherPrs_Tools::getShape(aObj2).get() != NULL;
+ aReadyToDisplay = SketcherPrs_Tools::getShape(aObj1).get() != nullptr &&
+ SketcherPrs_Tools::getShape(aObj2).get() != nullptr;
}
return aReadyToDisplay;
}
const std::shared_ptr<GeomAPI_Ax3> &thePlane);
protected:
- virtual const char *iconName() const { return "parallel.png"; }
+ const char *iconName() const override { return "parallel.png"; }
- virtual void drawLines(const Handle(Prs3d_Presentation) & thePrs,
- Quantity_Color theColor) const;
+ void drawLines(const Handle(Prs3d_Presentation) & thePrs,
+ Quantity_Color theColor) const override;
/// Update myPntArray according to presentation positions
/// \return true in case of success
- virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const;
+ bool updateIfReadyToDisplay(double theStep, bool withColor) const override;
};
#endif
ObjectPtr aObj2 = SketcherPrs_Tools::getResult(
theConstraint, SketchPlugin_Constraint::ENTITY_B());
- aReadyToDisplay = SketcherPrs_Tools::getShape(aObj1).get() != NULL &&
- SketcherPrs_Tools::getShape(aObj2).get() != NULL;
+ aReadyToDisplay = SketcherPrs_Tools::getShape(aObj1).get() != nullptr &&
+ SketcherPrs_Tools::getShape(aObj2).get() != nullptr;
}
return aReadyToDisplay;
}
const std::shared_ptr<GeomAPI_Ax3> &thePlane);
protected:
- virtual const char *iconName() const { return "perpendicular.png"; }
+ const char *iconName() const override { return "perpendicular.png"; }
/// Redefine this function in order to add additiona lines of constraint base
/// \param thePrs a presentation
/// \param theColor a color of additiona lines
- virtual void drawLines(const Handle(Prs3d_Presentation) & thePrs,
- Quantity_Color theColor) const;
+ void drawLines(const Handle(Prs3d_Presentation) & thePrs,
+ Quantity_Color theColor) const override;
/// Update myPntArray according to presentation positions
/// \return true in case of success
- virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const;
+ bool updateIfReadyToDisplay(double theStep, bool withColor) const override;
};
#endif
#include <array>
-static SketcherPrs_PositionMgr *MyPosMgr = NULL;
+static SketcherPrs_PositionMgr *MyPosMgr = nullptr;
#define PI 3.1415926535897932
// The class is implemented as a singlton
SketcherPrs_PositionMgr *SketcherPrs_PositionMgr::get() {
- if (MyPosMgr == NULL)
+ if (MyPosMgr == nullptr)
MyPosMgr = new SketcherPrs_PositionMgr();
return MyPosMgr;
}
-SketcherPrs_PositionMgr::SketcherPrs_PositionMgr() {}
+SketcherPrs_PositionMgr::SketcherPrs_PositionMgr() = default;
int SketcherPrs_PositionMgr::getPositionIndex(
ObjectPtr theLine, const SketcherPrs_SymbolPrs *thePrs) {
//*****************************************************************
gp_Pnt
-SketcherPrs_PositionMgr::getPointPosition(ObjectPtr theLine,
+SketcherPrs_PositionMgr::getPointPosition(ObjectPtr /*theLine*/,
const SketcherPrs_SymbolPrs *thePrs,
double theStep, GeomPointPtr thePnt) {
gp_Pnt aP = thePnt->impl<gp_Pnt>();
static bool isPntConstraint(const std::string &theName);
private:
- typedef std::map<const SketcherPrs_SymbolPrs *, int> PositionsMap;
- typedef std::map<const ModelAPI_Feature *, std::array<int, 2>> FeaturesMap;
+ using PositionsMap = std::map<const SketcherPrs_SymbolPrs *, int>;
+ using FeaturesMap = std::map<const ModelAPI_Feature *, std::array<int, 2>>;
/// The map contains position index
std::map<ObjectPtr, PositionsMap> myShapes;
if (anAttr->isObject()) {
// The constraint attached to an object
ObjectPtr aObj = anAttr->object();
- aReadyToDisplay = SketcherPrs_Tools::getShape(aObj).get() != NULL;
+ aReadyToDisplay = SketcherPrs_Tools::getShape(aObj).get() != nullptr;
} else {
// The constraint attached to a point
std::shared_ptr<GeomAPI_Pnt2d> aPnt = SketcherPrs_Tools::getPoint(
theConstraint, SketchPlugin_Constraint::ENTITY_A());
- aReadyToDisplay = aPnt.get() != NULL;
+ aReadyToDisplay = aPnt.get() != nullptr;
}
return aReadyToDisplay;
}
// Else it is a result
aShape = SketcherPrs_Tools::getShape(aObj);
}
- if (aShape.get() == NULL)
+ if (aShape.get() == nullptr)
return;
Handle(Prs3d_PointAspect) aPntAspect =
const std::shared_ptr<GeomAPI_Ax3> &thePlane);
protected:
- virtual const char *iconName() const { return "anchor.png"; }
+ const char *iconName() const override { return "anchor.png"; }
/// Redefine this function in order to add additiona lines of constraint base
/// \param thePrs a presentation
/// \param theColor a color of additiona lines
- virtual void drawLines(const Handle(Prs3d_Presentation) & thePrs,
- Quantity_Color theColor) const;
+ void drawLines(const Handle(Prs3d_Presentation) & thePrs,
+ Quantity_Color theColor) const override;
/// Update myPntArray according to presentation positions
/// \return true in case of success
- virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const;
+ bool updateIfReadyToDisplay(double theStep, bool withColor) const override;
};
#endif
/// Returns number of sub-elements
#if OCC_VERSION_HEX > 0x070400
- Standard_EXPORT virtual Standard_Integer
- NbSubElements() const Standard_OVERRIDE;
+ Standard_EXPORT Standard_Integer NbSubElements() const Standard_OVERRIDE;
#else
Standard_EXPORT virtual Standard_Integer NbSubElements() Standard_OVERRIDE;
#endif
//! Update location of the point
- Standard_EXPORT virtual Handle(Select3D_SensitiveEntity)
+ Standard_EXPORT Handle(Select3D_SensitiveEntity)
GetConnected() Standard_OVERRIDE;
//! Checks whether the point overlaps current selecting volume
//! \param theMgr selection manager
//! \param thePickResult returns pick result
- Standard_EXPORT virtual Standard_Boolean
+ Standard_EXPORT Standard_Boolean
Matches(SelectBasics_SelectingVolumeManager &theMgr,
SelectBasics_PickResult &thePickResult) Standard_OVERRIDE;
//! Returns center of point. If location transformation
//! is set, it will be applied
- Standard_EXPORT virtual gp_Pnt CenterOfGeometry() const Standard_OVERRIDE;
+ Standard_EXPORT gp_Pnt CenterOfGeometry() const Standard_OVERRIDE;
//! Returns bounding box of the point. If location
//! transformation is set, it will be applied
- Standard_EXPORT virtual Select3D_BndBox3d BoundingBox() Standard_OVERRIDE;
+ Standard_EXPORT Select3D_BndBox3d BoundingBox() Standard_OVERRIDE;
/// Clear sub-elements
- Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
+ Standard_EXPORT void Clear() Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(SketcherPrs_SensitivePoint, Select3D_SensitiveEntity)
theObj->myPntArray->Bounds()),
myObj(theObj), myContext(theCtx) {}
- virtual void Render(const Handle(OpenGl_Workspace) & theWorkspace) const {
+ void Render(const Handle(OpenGl_Workspace) & theWorkspace) const override {
ModelAPI_Feature *aConstraint = myObj->feature();
if (aConstraint->data().get() && aConstraint->data()->isValid()) {
Handle(OpenGl_View) aView = theWorkspace->View();
std::string theAttrName) const {
ObjectPtr aObj = SketcherPrs_Tools::getResult(myConstraint, theAttrName);
std::shared_ptr<GeomAPI_Shape> aLine = SketcherPrs_Tools::getShape(aObj);
- if (aLine.get() == NULL)
+ if (aLine.get() == nullptr)
return;
std::shared_ptr<GeomAPI_Edge> aEdge =
std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(aLine));
}
// Pint the group with custom procedure (see Render)
- SketcherPrs_SymbolArray *aElem = new SketcherPrs_SymbolArray(
+ auto *aElem = new SketcherPrs_SymbolArray(
(OpenGl_GraphicDriver *)aDriver->This(), this, GetContext());
aGroup->AddElement(aElem);
for (i = 0; i < aNb; i++) {
aObj = theListAttr->object(i);
std::shared_ptr<GeomAPI_Shape> aShape = SketcherPrs_Tools::getShape(aObj);
- if (aShape.get() != NULL)
+ if (aShape.get() != nullptr)
drawShape(aShape, thePrs, theColor);
}
}
Standard_EXPORT SketcherPrs_SymbolPrs(ModelAPI_Feature *theConstraint,
SketchPlugin_Sketch *theSketcher);
- virtual ~SketcherPrs_SymbolPrs();
+ ~SketcherPrs_SymbolPrs() override;
//! Method which draws selected owners ( for fast presentation draw )
- Standard_EXPORT virtual void
+ Standard_EXPORT void
HilightSelected(const Handle(PrsMgr_PresentationManager3d) & thePM,
- const SelectMgr_SequenceOfOwner &theOwners);
+ const SelectMgr_SequenceOfOwner &theOwners) override;
//! Method which hilight an owner belonging to
- Standard_EXPORT virtual void
- HilightOwnerWithColor(const Handle(PrsMgr_PresentationManager3d) & thePM,
- const Handle(Prs3d_Drawer) & theStyle,
- const Handle(SelectMgr_EntityOwner) & theOwner);
+ Standard_EXPORT void HilightOwnerWithColor(
+ const Handle(PrsMgr_PresentationManager3d) & thePM,
+ const Handle(Prs3d_Drawer) & theStyle,
+ const Handle(SelectMgr_EntityOwner) & theOwner) override;
/// Returns sketcher plane
Standard_EXPORT std::shared_ptr<GeomAPI_Ax3> plane() const {
/// Add a bounding box of the presentation to common bounding box
/// \param theBndBox the common bounding box to update
- Standard_EXPORT virtual void
- BoundingBox(Bnd_Box &theBndBox) Standard_OVERRIDE;
+ Standard_EXPORT void BoundingBox(Bnd_Box &theBndBox) Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(SketcherPrs_SymbolPrs, AIS_InteractiveObject)
protected:
/// Redefinition of virtual function
- Standard_EXPORT virtual void
+ Standard_EXPORT void
Compute(const Handle(PrsMgr_PresentationManager3d) & thePresentationManager,
const Handle(Prs3d_Presentation) & thePresentation,
- const Standard_Integer theMode = 0);
+ const Standard_Integer theMode = 0) override;
/// Redefinition of virtual function
/// \param aSelection selection
/// \param aMode compute mode
- Standard_EXPORT virtual void
- ComputeSelection(const Handle(SelectMgr_Selection) & aSelection,
- const Standard_Integer aMode);
+ Standard_EXPORT void ComputeSelection(const Handle(SelectMgr_Selection) &
+ aSelection,
+ const Standard_Integer aMode) override;
/// Returns an icon file name. Has to be redefined in successors
virtual const char *iconName() const = 0;
ObjectPtr aObj2 = SketcherPrs_Tools::getResult(
theConstraint, SketchPlugin_Constraint::ENTITY_B());
- aReadyToDisplay = SketcherPrs_Tools::getShape(aObj1).get() != NULL &&
- SketcherPrs_Tools::getShape(aObj2).get() != NULL;
+ aReadyToDisplay = SketcherPrs_Tools::getShape(aObj1).get() != nullptr &&
+ SketcherPrs_Tools::getShape(aObj2).get() != nullptr;
return aReadyToDisplay;
}
std::shared_ptr<GeomAPI_Shape> aShape1 = SketcherPrs_Tools::getShape(aObj1);
std::shared_ptr<GeomAPI_Shape> aShape2 = SketcherPrs_Tools::getShape(aObj2);
- if ((aShape1.get() == NULL) || (aShape2.get() == NULL))
+ if ((aShape1.get() == nullptr) || (aShape2.get() == nullptr))
return;
drawShape(aShape1, thePrs, theColor);
drawShape(aShape2, thePrs, theColor);
const std::shared_ptr<GeomAPI_Ax3> &thePlane);
protected:
- virtual const char *iconName() const { return "tangent.png"; }
+ const char *iconName() const override { return "tangent.png"; }
- virtual void drawLines(const Handle(Prs3d_Presentation) & thePrs,
- Quantity_Color theColor) const;
+ void drawLines(const Handle(Prs3d_Presentation) & thePrs,
+ Quantity_Color theColor) const override;
/// Update myPntArray according to presentation positions
/// \return true in case of success
- virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const;
+ bool updateIfReadyToDisplay(double theStep, bool withColor) const override;
};
#endif
aRes = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(
aFeature->lastResult());
}
- if (aRes.get() != NULL && aRes->data()->isValid()) {
+ if (aRes.get() != nullptr && aRes->data()->isValid()) {
/// essential check as it is called in openGl thread
return aRes->shape();
}
theFeature, theAttribute, SketchPlugin_Point::ID(),
SketchPlugin_Point::COORD_ID());
}
- if (aPointAttr.get() != NULL)
+ if (aPointAttr.get() != nullptr)
return aPointAttr->pnt();
return std::shared_ptr<GeomAPI_Pnt2d>();
}
if (!aFeatures)
return aFreePoints;
std::list<ObjectPtr> anObjects = aFeatures->list();
- for (std::list<ObjectPtr>::iterator anObjIt = anObjects.begin();
- anObjIt != anObjects.end(); ++anObjIt) {
- FeaturePtr aCurrent = ModelAPI_Feature::feature(*anObjIt);
+ for (auto &anObject : anObjects) {
+ FeaturePtr aCurrent = ModelAPI_Feature::feature(anObject);
if (aCurrent && aCurrent->getKind() == SketchPlugin_Point::ID()) {
// check point is not referred by any constraints: the feature and result
// of point
break;
}
const std::set<AttributePtr> &aRefs = aReferenced->data()->refsToMe();
- std::set<AttributePtr>::iterator aRIt = aRefs.begin();
+ auto aRIt = aRefs.begin();
for (; aRIt != aRefs.end(); ++aRIt) {
FeaturePtr aRefFeat = ModelAPI_Feature::feature((*aRIt)->owner());
std::shared_ptr<SketchPlugin_Constraint> aRefConstr =
std::shared_ptr<GeomAPI_Pnt>
getAnchorPoint(const ModelAPI_Feature *theConstraint,
const std::shared_ptr<GeomAPI_Ax3> &thePlane) {
- ModelAPI_Feature *aConstraint = const_cast<ModelAPI_Feature *>(theConstraint);
+ auto *aConstraint = const_cast<ModelAPI_Feature *>(theConstraint);
AttributeRefAttrPtr aRefAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
aConstraint->attribute(SketchPlugin_Constraint::ENTITY_A()));
}
void sendEmptyPresentationError(ModelAPI_Feature *theFeature,
- const std::string theError) {
+ const std::string /*theError*/) {
Events_InfoMessage("SketcherPrs_Tools",
"An empty AIS presentation: SketcherPrs_LengthDimension")
.send();
// Get transformated objects list
std::shared_ptr<ModelAPI_AttributeRefList> anAttrB =
aData->reflist(SketchPlugin_Constraint::ENTITY_B());
- if (anAttrB.get() == NULL)
+ if (anAttrB.get() == nullptr)
return aReadyToDisplay;
int aNbB = anAttrB->size();
// Compute points of symbols
for (i = 0; i < aNbB; i++) {
aObj = anAttrB->object(i);
- if (SketcherPrs_Tools::getShape(aObj).get() == NULL)
+ if (SketcherPrs_Tools::getShape(aObj).get() == nullptr)
continue;
aP1 = aMgr->getPosition(aObj, this, theStep);
myPntArray->SetVertice(i + 1, aP1);
std::shared_ptr<ModelAPI_Data> aData = myConstraint->data();
std::shared_ptr<ModelAPI_AttributeRefList> anAttrB =
aData->reflist(SketchPlugin_Constraint::ENTITY_B());
- if (anAttrB.get() == NULL)
+ if (anAttrB.get() == nullptr)
return;
// drawListOfShapes uses myDrawer for attributes definition
const std::shared_ptr<GeomAPI_Ax3> &thePlane);
protected:
- virtual const char *iconName() const {
+ const char *iconName() const override {
return myIsTranslation ? "translate.png" : "rotate.png";
}
/// Redefine this function in order to add additiona lines of constraint base
/// \param thePrs a presentation
/// \param theColor a color of additiona lines
- virtual void drawLines(const Handle(Prs3d_Presentation) & thePrs,
- Quantity_Color theColor) const;
+ void drawLines(const Handle(Prs3d_Presentation) & thePrs,
+ Quantity_Color theColor) const override;
/// Update myPntArray according to presentation positions
/// \return true in case of success
- virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const;
+ bool updateIfReadyToDisplay(double theStep, bool withColor) const override;
private:
bool myIsTranslation;
throw XAO_Exception(MsgBuilder()
<< "Step with number " << step << " already exists.");
- BooleanStep *bstep =
- new BooleanStep(step, stamp, m_nbElements, m_nbComponents);
+ auto *bstep = new BooleanStep(step, stamp, m_nbElements, m_nbComponents);
m_steps.push_back(bstep);
return bstep;
}
BooleanField(XAO::Dimension dimension, int nbElements, int nbComponents,
const std::string &name);
- virtual XAO::Type getType() { return XAO::BOOLEAN; }
+ XAO::Type getType() override { return XAO::BOOLEAN; }
- virtual Step *addNewStep(int step);
+ Step *addNewStep(int step) override;
/**
* Adds a new step.
*/
BooleanStep(int step, int stamp, int nbElements, int nbComponents);
- virtual XAO::Type getType() { return XAO::BOOLEAN; }
+ XAO::Type getType() override { return XAO::BOOLEAN; }
/**
* Gets all the values in a vector by elements and by components.
*/
void setValue(int element, int component, bool value);
- virtual const std::string getStringValue(int element, int component);
- virtual void setStringValue(int element, int component,
- const std::string &value);
+ const std::string getStringValue(int element, int component) override;
+ void setStringValue(int element, int component,
+ const std::string &value) override;
private:
std::vector<std::vector<bool>> m_values;
*/
BrepGeometry(const std::string &name);
- virtual ~BrepGeometry() {}
+ ~BrepGeometry() override = default;
/**
* Gets the format of the geometry.
* @return the format of the geometry.
*/
- virtual XAO::Format getFormat() { return XAO::BREP; }
+ XAO::Format getFormat() override { return XAO::BREP; }
/**
* Gets the shape as a string.
* @return the shape as a string.
*/
- virtual const std::string getShapeString();
+ const std::string getShapeString() override;
/**
* Sets the shape from a string.
* @param shape the shape as a string.
*/
- virtual void setShapeString(const std::string &shape);
+ void setShapeString(const std::string &shape) override;
/**
* Writes shape to a file
* @param fileName the path to the file
*/
- virtual void writeShapeFile(const std::string &fileName);
+ void writeShapeFile(const std::string &fileName) override;
/**
* Reads shape from a file
* @param fileName the path to the file
*/
- virtual void readShapeFile(const std::string &fileName);
+ void readShapeFile(const std::string &fileName) override;
#ifdef SWIG
%pythoncode %{
throw XAO_Exception(MsgBuilder()
<< "Step with number " << step << " already exists.");
- DoubleStep *bstep = new DoubleStep(step, stamp, m_nbElements, m_nbComponents);
+ auto *bstep = new DoubleStep(step, stamp, m_nbElements, m_nbComponents);
m_steps.push_back(bstep);
return bstep;
}
DoubleField(XAO::Dimension dimension, int nbElements, int nbComponents,
const std::string &name);
- virtual XAO::Type getType() { return XAO::DOUBLE; }
+ XAO::Type getType() override { return XAO::DOUBLE; }
- virtual Step *addNewStep(int step);
+ Step *addNewStep(int step) override;
/**
* Adds a new step.
*/
DoubleStep(int step, int stamp, int nbElements, int nbComponents);
- virtual XAO::Type getType() { return XAO::DOUBLE; }
+ XAO::Type getType() override { return XAO::DOUBLE; }
/**
* Gets all the values of the step as a list.
*/
void setValue(int element, int component, double value);
- virtual const std::string getStringValue(int element, int component);
- virtual void setStringValue(int element, int component,
- const std::string &value);
+ const std::string getStringValue(int element, int component) override;
+ void setStringValue(int element, int component,
+ const std::string &value) override;
private:
std::vector<std::vector<double>> m_values;
*/
XAO_Exception(const char *message) : m_message(message) {}
- virtual ~XAO_Exception() noexcept {};
+ ~XAO_Exception() noexcept override = default;
+ ;
/**
* Returns the error message.
* @return the error message.
*/
- virtual const char *what() const noexcept { return m_message; }
+ const char *what() const noexcept override { return m_message; }
#ifdef SWIG
%extend
m_components(nbComponents, ""), m_nbElements(nbElements) {}
Field::~Field() {
- for (unsigned int i = 0; i < m_steps.size(); ++i)
- delete m_steps[i];
+ for (auto &m_step : m_steps)
+ delete m_step;
}
Field *Field::createField(XAO::Type type, XAO::Dimension dimension,
}
bool Field::removeStep(Step *step) {
- std::vector<Step *>::iterator it = m_steps.begin();
+ auto it = m_steps.begin();
for (; it != m_steps.end(); ++it) {
Step *current = *it;
if (step == current) {
}
bool Field::hasStep(int step) {
- std::vector<Step *>::iterator it = m_steps.begin();
+ auto it = m_steps.begin();
for (; it != m_steps.end(); ++it) {
Step *current = *it;
if (current->getStep() == step)
#endif
namespace XAO {
-typedef std::vector<Step *>::iterator stepIterator;
+using stepIterator = std::vector<Step *>::iterator;
/**
* @class Field
m_reference = reference;
}
-GeometricElement::~GeometricElement() {}
+GeometricElement::~GeometricElement() = default;
bool GeometricElement::hasName() { return !m_name.empty(); }
/**
* Destructor.
*/
- virtual ~GeometricElementList() {}
+ virtual ~GeometricElementList() = default;
/**
* Gets the size of the list.
/**
* Iterator on the element of the list.
*/
- typedef std::map<int, GeometricElement>::iterator iterator;
+ using iterator = std::map<int, GeometricElement>::iterator;
/**
* Gets an iterator on the first element.
<< "Geometry format not supported: " << format);
}
-Geometry::~Geometry() {}
+Geometry::~Geometry() = default;
void Geometry::checkReadOnly() {
if (m_readOnly)
m_nbElements = nbElements;
}
-Group::~Group() {}
+Group::~Group() = default;
void Group::checkIndex(int element) {
if (element < (int)m_elements.size() && element >= 0)
*/
int get(int index) {
checkIndex(index);
- std::set<int>::iterator it = m_elements.begin();
+ auto it = m_elements.begin();
std::advance(it, index);
return (*it);
}
throw XAO_Exception(MsgBuilder()
<< "Step with number " << step << " already exists.");
- IntegerStep *bstep =
- new IntegerStep(step, stamp, m_nbElements, m_nbComponents);
+ auto *bstep = new IntegerStep(step, stamp, m_nbElements, m_nbComponents);
m_steps.push_back(bstep);
return bstep;
}
IntegerField(XAO::Dimension dimension, int nbElements, int nbComponents,
const std::string &name);
- virtual XAO::Type getType() { return XAO::INTEGER; }
+ XAO::Type getType() override { return XAO::INTEGER; }
- virtual Step *addNewStep(int step);
+ Step *addNewStep(int step) override;
/**
* Adds a new step.
*/
IntegerStep(int step, int stamp, int nbElements, int nbComponents);
- virtual XAO::Type getType() { return XAO::INTEGER; }
+ XAO::Type getType() override { return XAO::INTEGER; }
/**
* Gets all the values of the step as a list.
*/
void setValue(int element, int component, int value);
- virtual const std::string getStringValue(int element, int component);
- virtual void setStringValue(int element, int component,
- const std::string &value);
+ const std::string getStringValue(int element, int component) override;
+ void setStringValue(int element, int component,
+ const std::string &value) override;
private:
std::vector<std::vector<int>> m_values;
class XAO_EXPORT Step {
protected:
/** Default constructor. */
- Step() {}
+ Step() = default;
public:
/**
* Destructor.
*/
- virtual ~Step() {}
+ virtual ~Step() = default;
/**
* Gets the type of the step.
throw XAO_Exception(MsgBuilder()
<< "Step with number " << step << " already exists.");
- StringStep *bstep = new StringStep(step, stamp, m_nbElements, m_nbComponents);
+ auto *bstep = new StringStep(step, stamp, m_nbElements, m_nbComponents);
m_steps.push_back(bstep);
return bstep;
}
StringField(XAO::Dimension dimension, int nbElements, int nbComponents,
const std::string &name);
- virtual XAO::Type getType() { return XAO::STRING; }
+ XAO::Type getType() override { return XAO::STRING; }
- virtual Step *addNewStep(int step);
+ Step *addNewStep(int step) override;
/**
* Adds a new step.
*/
StringStep(int step, int stamp, int nbElements, int nbComponents);
- virtual XAO::Type getType() { return XAO::STRING; }
+ XAO::Type getType() override { return XAO::STRING; }
/**
* Gets all the values of the step as a list.
*/
void setValue(int element, int component, const std::string &value);
- virtual const std::string getStringValue(int element, int component);
- virtual void setStringValue(int element, int component,
- const std::string &value);
+ const std::string getStringValue(int element, int component) override;
+ void setStringValue(int element, int component,
+ const std::string &value) override;
private:
std::vector<std::vector<std::string>> m_values;
Xao::Xao() {
m_author = "";
m_version = (char *)C_XAO_VERSION;
- m_geometry = NULL;
+ m_geometry = nullptr;
}
Xao::Xao(const std::string &author, const std::string &version) {
m_author = author;
m_version = version;
- m_geometry = NULL;
+ m_geometry = nullptr;
}
Xao::~Xao() {
- if (m_geometry != NULL) {
+ if (m_geometry != nullptr) {
delete m_geometry;
- m_geometry = NULL;
+ m_geometry = nullptr;
}
- for (std::list<Group *>::iterator it = m_groups.begin(); it != m_groups.end();
- ++it) {
- delete (*it);
+ for (auto &m_group : m_groups) {
+ delete m_group;
}
- for (std::list<Field *>::iterator it = m_fields.begin(); it != m_fields.end();
- ++it) {
- delete (*it);
+ for (auto &m_field : m_fields) {
+ delete m_field;
}
}
checkGroupIndex(index);
int i = 0;
- for (std::list<Group *>::iterator it = m_groups.begin(); it != m_groups.end();
- ++it, ++i) {
+ for (auto it = m_groups.begin(); it != m_groups.end(); ++it, ++i) {
if (i == index)
return (*it);
}
- return NULL;
+ return nullptr;
}
Group *Xao::addGroup(XAO::Dimension dim, const std::string &name)
checkGeometry();
checkGroupDimension(dim);
- Group *group = new Group(dim, m_geometry->countElements(dim), name);
+ auto *group = new Group(dim, m_geometry->countElements(dim), name);
m_groups.push_back(group);
return group;
}
bool res = (nb - 1 == countGroups());
if (res) {
delete group;
- group = NULL;
+ group = nullptr;
}
return res;
checkFieldIndex(index);
int i = 0;
- for (std::list<Field *>::iterator it = m_fields.begin(); it != m_fields.end();
- ++it, ++i) {
+ for (auto it = m_fields.begin(); it != m_fields.end(); ++it, ++i) {
if (i == index)
return (*it);
}
{
checkGeometry();
int nbElts = m_geometry->countElements(dim);
- IntegerField *field = new IntegerField(dim, nbElts, nbComponents, name);
+ auto *field = new IntegerField(dim, nbElts, nbComponents, name);
m_fields.push_back(field);
return field;
}
{
checkGeometry();
int nbElts = m_geometry->countElements(dim);
- BooleanField *field = new BooleanField(dim, nbElts, nbComponents, name);
+ auto *field = new BooleanField(dim, nbElts, nbComponents, name);
m_fields.push_back(field);
return field;
}
{
checkGeometry();
int nbElts = m_geometry->countElements(dim);
- DoubleField *field = new DoubleField(dim, nbElts, nbComponents, name);
+ auto *field = new DoubleField(dim, nbElts, nbComponents, name);
m_fields.push_back(field);
return field;
}
{
checkGeometry();
int nbElts = m_geometry->countElements(dim);
- StringField *field = new StringField(dim, nbElts, nbComponents, name);
+ auto *field = new StringField(dim, nbElts, nbComponents, name);
m_fields.push_back(field);
return field;
}
bool res = (nb - 1 == countFields());
if (res) {
delete field;
- field = NULL;
+ field = nullptr;
}
return res;
}
void Xao::checkGeometry() const {
- if (m_geometry == NULL)
+ if (m_geometry == nullptr)
throw XAO_Exception("Geometry is null");
}
* \param geometry the geometry to set.
*/
void setGeometry(Geometry *geometry) {
- if (m_geometry != NULL)
+ if (m_geometry != nullptr)
throw XAO_Exception("Geometry already set.");
m_geometry = geometry;
m_geometry->setReadOnly();
bool required, const std::string &defaultValue,
const std::string &exception /*= std::string() */) {
xmlChar *strAttr = xmlGetProp(node, attribute);
- if (strAttr == NULL) {
+ if (strAttr == nullptr) {
if (required) {
if (exception.size() > 0)
throw XAO_Exception(exception.c_str());
int defaultValue,
const std::string &exception /*= std::string() */) {
xmlChar *strAttr = xmlGetProp(node, attribute);
- if (strAttr == NULL) {
+ if (strAttr == nullptr) {
if (required) {
if (exception.size() > 0)
throw XAO_Exception(exception.c_str());
xmlDocPtr exportXMLDoc(Xao *xaoObject, const std::string &shapeFileName) {
// Creating the Xml document
xmlDocPtr masterDocument = xmlNewDoc(BAD_CAST "1.0");
- xmlNodePtr xao = xmlNewNode(0, C_TAG_XAO);
+ xmlNodePtr xao = xmlNewNode(nullptr, C_TAG_XAO);
xmlDocSetRootElement(masterDocument, xao);
xmlNewProp(xao, C_ATTR_XAO_VERSION, BAD_CAST xaoObject->getVersion().c_str());
xmlNewProp(xao, C_ATTR_XAO_AUTHOR, BAD_CAST xaoObject->getAuthor().c_str());
- if (xaoObject->getGeometry() != NULL) {
+ if (xaoObject->getGeometry() != nullptr) {
exportGeometry(xaoObject->getGeometry(), masterDocument, xao,
shapeFileName);
}
void exportGeometricElements(Geometry *xaoGeometry, xmlNodePtr topology,
XAO::Dimension dim, const xmlChar *colTag,
const xmlChar *eltTag) {
- xmlNodePtr vertices = xmlNewChild(topology, 0, colTag, 0);
+ xmlNodePtr vertices = xmlNewChild(topology, nullptr, colTag, nullptr);
xmlNewProp(
vertices, C_ATTR_COUNT,
BAD_CAST XaoUtils::intToString(xaoGeometry->countElements(dim)).c_str());
- GeometricElementList::iterator it = xaoGeometry->begin(dim);
+ auto it = xaoGeometry->begin(dim);
for (; it != xaoGeometry->end(dim); it++) {
int index = it->first;
GeometricElement elt = it->second;
- xmlNodePtr vertex = xmlNewChild(vertices, 0, eltTag, 0);
+ xmlNodePtr vertex = xmlNewChild(vertices, nullptr, eltTag, nullptr);
xmlNewProp(vertex, C_ATTR_ELT_INDEX,
BAD_CAST XaoUtils::intToString(index).c_str());
xmlNewProp(vertex, C_ATTR_ELT_NAME, BAD_CAST elt.getName().c_str());
void exportGeometry(Geometry *xaoGeometry, xmlDocPtr doc, xmlNodePtr xao,
const std::string &shapeFileName) {
// Geometric part
- xmlNodePtr geometry = xmlNewChild(xao, 0, C_TAG_GEOMETRY, 0);
+ xmlNodePtr geometry = xmlNewChild(xao, nullptr, C_TAG_GEOMETRY, nullptr);
xmlNewProp(geometry, C_ATTR_GEOMETRY_NAME,
BAD_CAST xaoGeometry->getName().c_str());
- xmlNodePtr shape = xmlNewChild(geometry, 0, C_TAG_SHAPE, 0);
+ xmlNodePtr shape = xmlNewChild(geometry, nullptr, C_TAG_SHAPE, nullptr);
xmlNewProp(
shape, C_ATTR_SHAPE_FORMAT,
BAD_CAST XaoUtils::shapeFormatToString(xaoGeometry->getFormat()).c_str());
xaoGeometry->writeShapeFile(shapeFileName);
}
- xmlNodePtr topology = xmlNewChild(geometry, 0, C_TAG_TOPOLOGY, 0);
+ xmlNodePtr topology = xmlNewChild(geometry, nullptr, C_TAG_TOPOLOGY, nullptr);
exportGeometricElements(xaoGeometry, topology, XAO::VERTEX, C_TAG_VERTICES,
C_TAG_VERTEX);
}
void exportGroups(Xao *xaoObject, xmlNodePtr xao) {
- xmlNodePtr groups = xmlNewChild(xao, 0, C_TAG_GROUPS, 0);
+ xmlNodePtr groups = xmlNewChild(xao, nullptr, C_TAG_GROUPS, nullptr);
xmlNewProp(groups, C_ATTR_COUNT,
BAD_CAST XaoUtils::intToString(xaoObject->countGroups()).c_str());
for (int i = 0; i < xaoObject->countGroups(); i++) {
// Group* grp = (*it);
Group *grp = xaoObject->getGroup(i);
- xmlNodePtr group = xmlNewChild(groups, 0, C_TAG_GROUP, 0);
+ xmlNodePtr group = xmlNewChild(groups, nullptr, C_TAG_GROUP, nullptr);
xmlNewProp(group, C_ATTR_GROUP_NAME, BAD_CAST grp->getName().c_str());
xmlNewProp(
group, C_ATTR_GROUP_DIM,
xmlNewProp(group, C_ATTR_COUNT,
BAD_CAST XaoUtils::intToString(grp->count()).c_str());
- for (std::set<int>::iterator it = grp->begin(); it != grp->end(); ++it) {
- int grpElt = (*it);
- xmlNodePtr elt = xmlNewChild(group, 0, C_TAG_ELEMENT, 0);
+ for (int grpElt : *grp) {
+ xmlNodePtr elt = xmlNewChild(group, nullptr, C_TAG_ELEMENT, nullptr);
xmlNewProp(elt, C_ATTR_ELEMENT_INDEX,
BAD_CAST XaoUtils::intToString(grpElt).c_str());
}
}
void exportFields(Xao *xaoObject, xmlNodePtr xao) {
- xmlNodePtr fields = xmlNewChild(xao, 0, C_TAG_FIELDS, 0);
+ xmlNodePtr fields = xmlNewChild(xao, nullptr, C_TAG_FIELDS, nullptr);
xmlNewProp(fields, C_ATTR_COUNT,
BAD_CAST XaoUtils::intToString(xaoObject->countFields()).c_str());
for (int i = 0; i < xaoObject->countFields(); i++) {
Field *field = xaoObject->getField(i);
- xmlNodePtr nodeField = xmlNewChild(fields, 0, C_TAG_FIELD, 0);
+ xmlNodePtr nodeField = xmlNewChild(fields, nullptr, C_TAG_FIELD, nullptr);
xmlNewProp(nodeField, C_ATTR_FIELD_NAME, BAD_CAST field->getName().c_str());
xmlNewProp(nodeField, C_ATTR_FIELD_TYPE,
BAD_CAST XaoUtils::fieldTypeToString(field->getType()).c_str());
BAD_CAST XaoUtils::dimensionToString(field->getDimension()).c_str());
int nbComponents = field->countComponents();
- xmlNodePtr components = xmlNewChild(nodeField, 0, C_TAG_COMPONENTS, 0);
+ xmlNodePtr components =
+ xmlNewChild(nodeField, nullptr, C_TAG_COMPONENTS, nullptr);
xmlNewProp(components, C_ATTR_COUNT,
BAD_CAST XaoUtils::intToString(nbComponents).c_str());
for (int j = 0; j < nbComponents; j++) {
- xmlNodePtr nodeComponent = xmlNewChild(components, 0, C_TAG_COMPONENT, 0);
+ xmlNodePtr nodeComponent =
+ xmlNewChild(components, nullptr, C_TAG_COMPONENT, nullptr);
xmlNewProp(nodeComponent, C_ATTR_COMPONENT_COLUMN,
BAD_CAST XaoUtils::intToString(j).c_str());
xmlNewProp(nodeComponent, C_ATTR_COMPONENT_NAME,
}
int nbSteps = field->countSteps();
- xmlNodePtr nodeSteps = xmlNewChild(nodeField, 0, C_TAG_STEPS, 0);
+ xmlNodePtr nodeSteps =
+ xmlNewChild(nodeField, nullptr, C_TAG_STEPS, nullptr);
xmlNewProp(nodeSteps, C_ATTR_COUNT,
BAD_CAST XaoUtils::intToString(nbSteps).c_str());
- for (stepIterator itStep = field->begin(); itStep != field->end();
- itStep++) {
+ for (auto itStep = field->begin(); itStep != field->end(); itStep++) {
Step *step = *itStep;
exportStep(step, field, nodeSteps);
}
}
void exportStep(Step *step, Field * /*field*/, xmlNodePtr nodeSteps) {
- xmlNodePtr nodeStep = xmlNewChild(nodeSteps, 0, C_TAG_STEP, 0);
+ xmlNodePtr nodeStep = xmlNewChild(nodeSteps, nullptr, C_TAG_STEP, nullptr);
xmlNewProp(nodeStep, C_ATTR_STEP_NUMBER,
BAD_CAST XaoUtils::intToString(step->getStep()).c_str());
if (step->getStamp() >= 0) {
}
for (int i = 0; i < step->countElements(); ++i) {
- xmlNodePtr nodeElt = xmlNewChild(nodeStep, 0, C_TAG_ELEMENT, 0);
+ xmlNodePtr nodeElt = xmlNewChild(nodeStep, nullptr, C_TAG_ELEMENT, nullptr);
xmlNewProp(nodeElt, C_ATTR_ELEMENT_INDEX,
BAD_CAST XaoUtils::intToString(i).c_str());
for (int j = 0; j < step->countComponents(); ++j) {
std::string content = step->getStringValue(i, j);
xmlNodePtr nodeValue =
- xmlNewChild(nodeElt, NULL, C_TAG_VALUE, BAD_CAST content.c_str());
+ xmlNewChild(nodeElt, nullptr, C_TAG_VALUE, BAD_CAST content.c_str());
xmlNewProp(nodeValue, C_ATTR_VALUE_COMPONENT,
BAD_CAST XaoUtils::intToString(j).c_str());
}
void parseGeometryNode(xmlDocPtr doc, xmlNodePtr geometryNode, Xao *xaoObject) {
// get the shape and topo nodes
- xmlNodePtr shapeNode = NULL;
- xmlNodePtr topoNode = NULL;
+ xmlNodePtr shapeNode = nullptr;
+ xmlNodePtr topoNode = nullptr;
for (xmlNodePtr node = geometryNode->children; node; node = node->next) {
if (xmlStrcmp(node->name, C_TAG_SHAPE) == 0)
shapeNode = node;
} else {
// read brep from node content
xmlChar *data = xmlNodeGetContent(shapeNode->children);
- if (data == NULL)
+ if (data == nullptr)
throw XAO_Exception("Missing BREP");
geometry->setShapeString((char *)data);
xmlFree(data);
XAO::Type type = XaoUtils::stringToFieldType(strType);
// we need to get the number of components first to create the field
- xmlNodePtr componentsNode = NULL;
- xmlNodePtr stepsNode = NULL;
+ xmlNodePtr componentsNode = nullptr;
+ xmlNodePtr stepsNode = nullptr;
for (xmlNodePtr node = fieldNode->children; node; node = node->next) {
if (xmlStrcmp(node->name, C_TAG_COMPONENTS) == 0)
}
// ensure that the components node is defined
- if (componentsNode == NULL) {
+ if (componentsNode == nullptr) {
throw XAO_Exception(MsgBuilder() << "Line " << fieldNode->line << ": "
<< "No components defined for field.");
}
field->setName(name);
// read the steps
- if (stepsNode != 0) {
+ if (stepsNode != nullptr) {
for (xmlNodePtr stepNode = stepsNode->children; stepNode;
stepNode = stepNode->next) {
if (xmlStrcmp(stepNode->name, C_TAG_STEP) == 0) {
xmlChar *data = xmlNodeGetContent(valNode->children);
std::string value;
- if (data != NULL) {
+ if (data != nullptr) {
value = (char *)data;
} else if (step->getType() != XAO::STRING) {
throw XAO_Exception(MsgBuilder() << "Line " << valNode->line
{
// parse the file and get the DOM
int options = XML_PARSE_HUGE | XML_PARSE_NOCDATA;
- xmlDocPtr doc = xmlReadFile(fileName.c_str(), NULL, options);
- if (doc == NULL) {
+ xmlDocPtr doc = xmlReadFile(fileName.c_str(), nullptr, options);
+ if (doc == nullptr) {
throw XAO_Exception("Cannot read XAO file");
}
{
int options = XML_PARSE_HUGE | XML_PARSE_NOCDATA;
- xmlDocPtr doc = xmlReadDoc(BAD_CAST xml.c_str(), "", NULL, options);
- if (doc == NULL) {
+ xmlDocPtr doc = xmlReadDoc(BAD_CAST xml.c_str(), "", nullptr, options);
+ if (doc == nullptr) {
throw XAO_Exception("Cannot read XAO stream");
}
class MsgBuilder {
public:
/** Constructor. */
- MsgBuilder(){};
+ MsgBuilder() = default;
+ ;
/** Destructor. */
- ~MsgBuilder(){};
+ ~MsgBuilder() = default;
+ ;
#ifndef SWIG
/** Stream operator. */
Events_Loop *aLoop = Events_Loop::loop();
static Events_ID aStateResponseEventId =
Events_Loop::loop()->eventByName(EVENT_FEATURE_STATE_RESPONSE);
- aLoop->registerListener(this, aStateResponseEventId, NULL, true);
+ aLoop->registerListener(this, aStateResponseEventId, nullptr, true);
}
-XGUI_ActionsMgr::~XGUI_ActionsMgr() {}
+XGUI_ActionsMgr::~XGUI_ActionsMgr() = default;
void XGUI_ActionsMgr::addCommand(QAction *theCmd) {
QString aId = theCmd->data().toString();
}
myActions.insert(aId, theCmd);
#ifdef HAVE_SALOME
- XGUI_Workshop *aWorkshop = static_cast<XGUI_Workshop *>(parent());
+ auto *aWorkshop = static_cast<XGUI_Workshop *>(parent());
const std::shared_ptr<Config_FeatureMessage> &anInfo =
aWorkshop->salomeConnector()->featureInfo(aId);
if (anInfo.get())
updateOnViewSelection();
FeaturePtr anActiveFeature = FeaturePtr();
- ModuleBase_OperationFeature *aFOperation =
- dynamic_cast<ModuleBase_OperationFeature *>(
- myOperationMgr->currentOperation());
+ auto *aFOperation = dynamic_cast<ModuleBase_OperationFeature *>(
+ myOperationMgr->currentOperation());
if (aFOperation) {
anActiveFeature = aFOperation->feature();
QStringList aNested = allNestedCommands(aFOperation);
foreach (QString aId, nestedCommands(aFeatureId)) {
ModelAPI_ValidatorsFactory::Validators aValidators;
aFactory->validators(aId.toStdString(), aValidators);
- ModelAPI_ValidatorsFactory::Validators::iterator aValidatorIt =
- aValidators.begin();
+ auto aValidatorIt = aValidators.begin();
for (; aValidatorIt != aValidators.end(); ++aValidatorIt) {
- const ModuleBase_SelectionValidator *aSelValidator =
+ const auto *aSelValidator =
dynamic_cast<const ModuleBase_SelectionValidator *>(
aFactory->validator(aValidatorIt->first));
if (aSelValidator)
if (!aStateMessage.get())
return;
std::list<std::string> aFeaturesList = aStateMessage->features();
- std::list<std::string>::iterator it = aFeaturesList.begin();
+ auto it = aFeaturesList.begin();
for (; it != aFeaturesList.end(); ++it) {
QString anActionId = QString::fromStdString(*it);
bool theDefaultState = false;
}
QAction *XGUI_ActionsMgr::operationStateAction(OperationStateActionId theId) {
- QAction *aResult = NULL;
+ QAction *aResult = nullptr;
if (myOperationActions.contains(theId)) {
aResult = myOperationActions.value(theId);
// if (theParent && aResult->parent() != theParent) {
QIcon(":pictures/button_help.png"), tr("Help"), aParent);
} break;
case Preview: {
- aResult = ModuleBase_Tools::createAction(
- QIcon(), tr("See preview"), aParent, 0, 0, tr("Compute preview"));
+ aResult = ModuleBase_Tools::createAction(QIcon(), tr("See preview"),
+ aParent, nullptr, nullptr,
+ tr("Compute preview"));
aResult->setStatusTip(aResult->toolTip());
} break;
default:
}
QAction *XGUI_ActionsMgr::action(const QString &theId) {
- QAction *anAction = 0;
+ QAction *anAction = nullptr;
if (myActions.contains(theId)) {
anAction = myActions.value(theId);
}
void XGUI_ActionsMgr::setNestedStackEnabled(
ModuleBase_Operation *theOperation) {
- ModuleBase_OperationFeature *anOperation =
- dynamic_cast<ModuleBase_OperationFeature *>(theOperation);
+ auto *anOperation = dynamic_cast<ModuleBase_OperationFeature *>(theOperation);
if (!anOperation || !anOperation->feature())
return;
FeaturePtr aFeature = anOperation->feature();
QStringList
XGUI_ActionsMgr::allNestedCommands(ModuleBase_Operation *theOperation) {
QStringList aFeatures;
- ModuleBase_OperationFeature *anOperation =
- dynamic_cast<ModuleBase_OperationFeature *>(theOperation);
+ auto *anOperation = dynamic_cast<ModuleBase_OperationFeature *>(theOperation);
if (!anOperation || !anOperation->feature())
return aFeatures;
FeaturePtr aFeature = anOperation->feature();
std::string aStdDocKind = ModelAPI_Session::get()->activeDocument()->kind();
QString aDocKind = QString::fromStdString(aStdDocKind);
#ifdef HAVE_SALOME
- XGUI_Workshop *aWorkshop = static_cast<XGUI_Workshop *>(parent());
+ auto *aWorkshop = static_cast<XGUI_Workshop *>(parent());
#endif
foreach (QAction *eachAction, myActions.values()) {
QString aCmdDocKind;
/// Constructor
/// \param theWorkshop an instance of workshop
XGUI_ActionsMgr(XGUI_Workshop *theWorkshop);
- virtual ~XGUI_ActionsMgr();
+ ~XGUI_ActionsMgr() override;
/// Actions on operations
enum OperationStateActionId {
QKeySequence registerShortcut(const QString &theKeySequence);
/// Redefinition of Events_Listener method
- virtual void processEvent(const std::shared_ptr<Events_Message> &theMessage);
+ void processEvent(const std::shared_ptr<Events_Message> &theMessage) override;
/// Return property panel's action like ok, cancel, help.
/// If there is no such action, it will be created.
protected:
ModuleBase_IWorkshop *myWorkshop; ///< the current workshop
- QList<XGUI_ActiveControlSelector *> mySelectors; ///< workshop selectors
- XGUI_ActiveControlSelector *myActiveSelector{0}; ///< active selector
+ QList<XGUI_ActiveControlSelector *> mySelectors; ///< workshop selectors
+ XGUI_ActiveControlSelector *myActiveSelector{nullptr}; ///< active selector
bool myIsBlocked{
false}; ///< blocking flag to avoid cycling signals processing
RadioButton(QWidget *buddy = nullptr, QWidget *parent = nullptr)
: RadioButton(QString(), buddy, parent) {}
- bool eventFilter(QObject *sender, QEvent *event) {
+ bool eventFilter(QObject *sender, QEvent *event) override {
if (myBuddy != nullptr && sender == myBuddy &&
event->type() == QEvent::MouseButtonPress)
setChecked(true);
return QRadioButton::eventFilter(sender, event);
}
- void changeEvent(QEvent *event) {
+ void changeEvent(QEvent *event) override {
if (myBuddy != nullptr && event->type() == QEvent::EnabledChange)
myBuddy->setEnabled(isEnabled());
QRadioButton::changeEvent(event);
: QDialog(theParent,
Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint) {
setWindowTitle(tr("Color"));
- QGridLayout *aLay = new QGridLayout(this);
+ auto *aLay = new QGridLayout(this);
myColorButton = new QtxColorButton(this);
myColorButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
- QLabel *aRandomLabel = new QLabel(tr("Random"), this);
+ auto *aRandomLabel = new QLabel(tr("Random"), this);
QRadioButton *aColorChoiceBtn = new RadioButton(myColorButton, this);
QRadioButton *aRandomChoiceBtn = new RadioButton(aRandomLabel, this);
aLay->addWidget(aRandomChoiceBtn, 1, 0);
aLay->addWidget(aRandomLabel, 1, 1);
- QDialogButtonBox *aButtons = new QDialogButtonBox(
+ auto *aButtons = new QDialogButtonBox(
QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
connect(aButtons, SIGNAL(accepted()), this, SLOT(accept()));
connect(aButtons, SIGNAL(rejected()), this, SLOT(reject()));
/// \param theParent a parent widget for the dialog
XGUI_EXPORT XGUI_ColorDialog(QWidget *theParent);
- XGUI_EXPORT virtual ~XGUI_ColorDialog(){};
+ XGUI_EXPORT ~XGUI_ColorDialog() override = default;
+ ;
/// Returns whether the random state of color is chosen
/// \return a boolean value
#endif
XGUI_ContextMenuMgr::XGUI_ContextMenuMgr(XGUI_Workshop *theParent)
- : QObject(theParent), myWorkshop(theParent), mySeparator1(0),
- mySeparator2(0), mySeparator3(0) {}
+ : QObject(theParent), myWorkshop(theParent), mySeparator1(nullptr),
+ mySeparator2(nullptr), mySeparator3(nullptr) {}
-XGUI_ContextMenuMgr::~XGUI_ContextMenuMgr() {}
+XGUI_ContextMenuMgr::~XGUI_ContextMenuMgr() = default;
void XGUI_ContextMenuMgr::createActions() {
#ifdef HAVE_SALOME
QAction *XGUI_ContextMenuMgr::action(const QString &theId) const {
if (myActions.contains(theId))
return myActions[theId];
- return 0;
+ return nullptr;
}
QAction *XGUI_ContextMenuMgr::actionByName(const QString &theName) const {
return eachAction;
}
}
- return NULL;
+ return nullptr;
}
QStringList XGUI_ContextMenuMgr::actionIds() const { return myActions.keys(); }
void XGUI_ContextMenuMgr::onAction(bool isChecked) {
- QAction *anAction = static_cast<QAction *>(sender());
+ auto *anAction = static_cast<QAction *>(sender());
emit actionTriggered(anAction->data().toString(), isChecked);
}
void XGUI_ContextMenuMgr::updateCommandsStatus() {}
void XGUI_ContextMenuMgr::onContextMenuRequest(QContextMenuEvent *theEvent) {
- QMenu *aMenu = new QMenu();
+ auto *aMenu = new QMenu();
if (sender() == myWorkshop->objectBrowser()) {
updateObjectBrowserMenu();
addObjBrowserMenu(aMenu);
// Only enable the "Bring To Front" command for Groups
ResultGroupPtr aGroup =
std::dynamic_pointer_cast<ModelAPI_ResultGroup>(aResult);
- action("BRING_TO_FRONT_CMD")->setEnabled(aGroup.get() != NULL);
+ action("BRING_TO_FRONT_CMD")->setEnabled(aGroup.get() != nullptr);
action("BRING_TO_FRONT_CMD")
->setChecked(ModelAPI_Tools::isBringToFront(aResult));
}
if (!aOpMgr->hasOperation() &&
myWorkshop->selectionActivate()->activeSelectionPlace() ==
XGUI_SelectionActivate::Workshop) {
- QMenu *aSelMenu = new QMenu(tr("Selection mode"), theMenu);
+ auto *aSelMenu = new QMenu(tr("Selection mode"), theMenu);
aSelMenu->addAction(action("SELECT_VERTEX_CMD"));
aSelMenu->addAction(action("SELECT_EDGE_CMD"));
aSelMenu->addAction(action("SELECT_FACE_CMD"));
}
if (aSelected == 1) {
ObjectPtr aObject = aPrsList.first()->object();
- if (aObject.get() != NULL) {
+ if (aObject.get() != nullptr) {
std::string aName = aObject->groupName();
if (myViewerMenu.contains(aName))
anActions = myViewerMenu[aName];
anAction->blockSignals(isBlock); \
}
-void XGUI_ContextMenuMgr::onResultSelection(bool theChecked) {
+void XGUI_ContextMenuMgr::onResultSelection(bool /*theChecked*/) {
UNCHECK_ACTION("SELECT_VERTEX_CMD");
UNCHECK_ACTION("SELECT_EDGE_CMD");
UNCHECK_ACTION("SELECT_FACE_CMD");
}
-void XGUI_ContextMenuMgr::onShapeSelection(bool theChecked) {
+void XGUI_ContextMenuMgr::onShapeSelection(bool /*theChecked*/) {
UNCHECK_ACTION("SHOW_RESULTS_CMD");
}
/// Constructor
/// \param theParent a parent object
XGUI_ContextMenuMgr(XGUI_Workshop *theParent);
- virtual ~XGUI_ContextMenuMgr();
+ ~XGUI_ContextMenuMgr() override;
/// Create all actions for context menus. It is called on creation of
/// application
/// Reference to workshop
XGUI_Workshop *myWorkshop;
- typedef QList<QAction *> QActionsList;
+ using QActionsList = QList<QAction *>;
QMap<std::string, QActionsList> myObjBrowserMenus;
QMap<std::string, QActionsList> myViewerMenu;
#endif
static bool isValidNode(const ModuleBase_ITreeNode *theNode) {
- ModuleBase_ITreeNode *aParent = 0;
+ ModuleBase_ITreeNode *aParent = nullptr;
try {
aParent = theNode->parent();
} catch (...) {
: QAbstractItemModel(theParent) //,
// myIsEventsProcessingBlocked(false)
{
- XGUI_ObjectsBrowser *aOB = qobject_cast<XGUI_ObjectsBrowser *>(theParent);
+ auto *aOB = qobject_cast<XGUI_ObjectsBrowser *>(theParent);
myWorkshop = aOB->workshop();
Events_Loop *aLoop = Events_Loop::loop();
//******************************************************
ObjectPtr XGUI_DataModel::object(const QModelIndex &theIndex) const {
if (theIndex.isValid()) {
- ModuleBase_ITreeNode *aNode =
- (ModuleBase_ITreeNode *)theIndex.internalPointer();
+ auto *aNode = (ModuleBase_ITreeNode *)theIndex.internalPointer();
return aNode->object();
}
return ObjectPtr();
//******************************************************
QVariant XGUI_DataModel::data(const QModelIndex &theIndex, int theRole) const {
if (theIndex.isValid()) {
- ModuleBase_ITreeNode *aNode =
- (ModuleBase_ITreeNode *)theIndex.internalPointer();
+ auto *aNode = (ModuleBase_ITreeNode *)theIndex.internalPointer();
return aNode->data(theIndex.column(), theRole);
}
return QVariant();
}
//******************************************************
-QVariant XGUI_DataModel::headerData(int theSection, Qt::Orientation theOrient,
- int theRole) const {
+QVariant XGUI_DataModel::headerData(int /*theSection*/,
+ Qt::Orientation /*theOrient*/,
+ int /*theRole*/) const {
return QVariant();
}
}
//******************************************************
-int XGUI_DataModel::columnCount(const QModelIndex &theParent) const {
+int XGUI_DataModel::columnCount(const QModelIndex & /*theParent*/) const {
return 3;
}
//******************************************************
QModelIndex XGUI_DataModel::parent(const QModelIndex &theIndex) const {
if (theIndex.isValid()) {
- ModuleBase_ITreeNode *aNode =
- (ModuleBase_ITreeNode *)theIndex.internalPointer();
+ auto *aNode = (ModuleBase_ITreeNode *)theIndex.internalPointer();
return getParentIndex(aNode, 1);
}
return QModelIndex();
//******************************************************
Qt::ItemFlags XGUI_DataModel::flags(const QModelIndex &theIndex) const {
if (theIndex.isValid()) {
- ModuleBase_ITreeNode *aNode =
+ auto *aNode =
static_cast<ModuleBase_ITreeNode *>(theIndex.internalPointer());
// Check that the pointer is Valid
if (!isValidNode(aNode))
return Qt::ItemIsDropEnabled | Qt::ItemFlags();
}
-bool XGUI_DataModel::canDropMimeData(const QMimeData *theData,
- Qt::DropAction theAction, int theRow,
- int theColumn,
+bool XGUI_DataModel::canDropMimeData(const QMimeData * /*theData*/,
+ Qt::DropAction /*theAction*/, int theRow,
+ int /*theColumn*/,
const QModelIndex &theParent) const {
if (theParent.isValid())
return false;
}
QByteArray anEncodedData;
QDataStream aStream(&anEncodedData, QIODevice::WriteOnly);
- for (std::set<int>::iterator aRIter = aRows.begin(); aRIter != aRows.end();
- aRIter++)
- aStream << *aRIter;
+ for (int aRow : aRows)
+ aStream << aRow;
- QMimeData *aMimeData = new QMimeData();
+ auto *aMimeData = new QMimeData();
aMimeData->setData("xgui/moved.rows", anEncodedData);
return aMimeData;
}
bool XGUI_DataModel::dropMimeData(const QMimeData *theData,
- Qt::DropAction theAction, int theRow,
- int theColumn, const QModelIndex &theParent) {
+ Qt::DropAction /*theAction*/, int theRow,
+ int /*theColumn*/,
+ const QModelIndex & /*theParent*/) {
FeaturePtr aDropAfter; // after this feature it is dropped, NULL if drop the
// the first place
if (theRow > 0) {
// system by default)
std::list<FeaturePtr> allFeatures =
aSession->get()->moduleDocument()->allFeatures();
- std::list<FeaturePtr>::iterator aFeature = allFeatures.begin();
+ auto aFeature = allFeatures.begin();
for (; aFeature != allFeatures.end(); aFeature++) {
if ((*aFeature)->isInHistory())
break;
aSession->startOperation("Move Part");
DocumentPtr aPartSet = aSession->moduleDocument();
- for (std::list<FeaturePtr>::iterator aDrop = aDropped.begin();
- aDrop != aDropped.end(); aDrop++) {
- aPartSet->moveFeature(*aDrop, aDropAfter);
- aDropAfter = *aDrop;
+ for (auto &aDrop : aDropped) {
+ aPartSet->moveFeature(aDrop, aDropAfter);
+ aDropAfter = aDrop;
}
aSession->finishOperation();
if (theDoc == aRootDoc)
return QModelIndex();
else {
- ModuleBase_ITreeNode *aDocNode = 0;
+ ModuleBase_ITreeNode *aDocNode = nullptr;
foreach (ModuleBase_ITreeNode *aNode, myRoot->children()) {
if (aNode->document() == theDoc) {
aDocNode = aNode;
//******************************************************
bool XGUI_DataModel::hasHiddenState(const QModelIndex &theIndex) {
if (theIndex.isValid()) {
- ModuleBase_ITreeNode *aNode =
- (ModuleBase_ITreeNode *)theIndex.internalPointer();
+ auto *aNode = (ModuleBase_ITreeNode *)theIndex.internalPointer();
return aNode->visibilityState() == ModuleBase_ITreeNode::Hidden;
}
return false;
//******************************************************
bool XGUI_DataModel::hasIndex(const QModelIndex &theIndex) const {
- ModuleBase_ITreeNode *aNode =
- (ModuleBase_ITreeNode *)theIndex.internalPointer();
+ auto *aNode = (ModuleBase_ITreeNode *)theIndex.internalPointer();
return myRoot->hasSubNode(aNode);
}
//******************************************************
DocumentPtr XGUI_DataModel::document(const QModelIndex &theIndex) const {
- ModuleBase_ITreeNode *aNode =
- (ModuleBase_ITreeNode *)theIndex.internalPointer();
+ auto *aNode = (ModuleBase_ITreeNode *)theIndex.internalPointer();
return aNode->document();
}
//**************************************************************
XGUI_Displayer::XGUI_Displayer(XGUI_Workshop *theWorkshop)
- : myWorkshop(theWorkshop), myViewerBlockedRecursiveCount(0), myContextId(0),
- myNeedUpdate(false) {
+ : myWorkshop(theWorkshop), myViewerBlockedRecursiveCount(0),
+ myContextId(nullptr), myNeedUpdate(false) {
BRepMesh_IncrementalMesh::SetParallelDefault(Standard_True);
}
//**************************************************************
-XGUI_Displayer::~XGUI_Displayer() {}
+XGUI_Displayer::~XGUI_Displayer() = default;
//**************************************************************
bool XGUI_Displayer::isVisible(ObjectPtr theObject) const {
GeomPresentablePtr aPrs =
std::dynamic_pointer_cast<GeomAPI_IPresentable>(theObject);
bool isShading = false;
- if (aPrs.get() != NULL) {
+ if (aPrs.get() != nullptr) {
GeomScreenParamsPtr aScreen =
std::dynamic_pointer_cast<GeomAPI_IScreenParams>(theObject);
if (aScreen.get()) {
//**************************************************************
void XGUI_Displayer::deactivateObjects(const QObjectPtrList &theObjList,
- const bool theUpdateViewer) {
+ const bool /*theUpdateViewer*/) {
// Handle(AIS_InteractiveObject) aTrihedron = getTrihedron();
// if (!aTrihedron.IsNull())
// deactivateAIS(aTrihedron);
aResult->groupName() == ModelAPI_ResultBody::group()) {
ResultBodyPtr aCompsolidResult =
std::dynamic_pointer_cast<ModelAPI_ResultBody>(aResult);
- if (aCompsolidResult.get() != NULL) { // change colors for all sub-solids
+ if (aCompsolidResult.get() !=
+ nullptr) { // change colors for all sub-solids
int aNumberOfSubs = aCompsolidResult->numberOfSubs();
bool anAllSubsVisible = aNumberOfSubs > 0;
for (int i = 0; i < aNumberOfSubs && anAllSubsVisible; i++) {
foreach (ModuleBase_ViewerPrsPtr aPrs, theValues) {
const GeomShapePtr &aGeomShape = aPrs->shape();
if (aGeomShape.get() && !aGeomShape->isNull()) {
- const TopoDS_Shape &aShape = aGeomShape->impl<TopoDS_Shape>();
+ const auto &aShape = aGeomShape->impl<TopoDS_Shape>();
#ifdef DEBUG_OCCT_SHAPE_SELECTION
// problem 1: performance
// problem 2: IO is not specified, so the first found owner is selected,
}
//**************************************************************
-void XGUI_Displayer::deactivateSelectionFilters(const bool theAddFilterOnly) {
+void XGUI_Displayer::deactivateSelectionFilters(
+ const bool /*theAddFilterOnly*/) {
Handle(AIS_InteractiveContext) aContext = AISContext();
if (!myAndFilter.IsNull()) {
bool aFound = false;
return false;
AISObjectPtr aAISObj = getAISObject(theObject);
- if (aAISObj.get() == NULL)
+ if (aAISObj.get() == nullptr)
return false;
Handle(AIS_InteractiveObject) anAIS =
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
if (aResult.get()) {
AISObjectPtr aAISObj = getAISObject(aResult);
- if (aAISObj.get() == NULL) {
+ if (aAISObj.get() == nullptr) {
// if result is a result of a composite feature, it is visualized by
// visualization of composite children, so we should get one of this
// presentations
aAISObj = getAISObject(aCompSolid->subResult(0));
}
}
- if (aAISObj.get() != NULL) {
+ if (aAISObj.get() != nullptr) {
Handle(AIS_InteractiveObject) anAIS =
aAISObj->impl<Handle(AIS_InteractiveObject)>();
if (!anAIS.IsNull() && !thePresentations.Contains(anAIS))
std::dynamic_pointer_cast<ModelAPI_Feature>(theObject);
// find presentation of the feature
AISObjectPtr aAISObj = getAISObject(aFeature);
- if (aAISObj.get() != NULL) {
+ if (aAISObj.get() != nullptr) {
Handle(AIS_InteractiveObject) anAIS =
aAISObj->impl<Handle(AIS_InteractiveObject)>();
if (!anAIS.IsNull() && !thePresentations.Contains(anAIS))
aLast = aResults.end();
for (; anIt != aLast; ++anIt) {
AISObjectPtr aCurAISObj = getAISObject(*anIt);
- if (aCurAISObj.get() != NULL) {
+ if (aCurAISObj.get() != nullptr) {
Handle(AIS_InteractiveObject) anAIS =
aCurAISObj->impl<Handle(AIS_InteractiveObject)>();
if (!anAIS.IsNull() && !thePresentations.Contains(anAIS))
: QDialog(parent, Qt::CustomizeWindowHint | Qt::WindowTitleHint |
Qt::WindowSystemMenuHint |
Qt::WindowCloseButtonHint) {
- QVBoxLayout *aDlgLay = new QVBoxLayout(this);
+ auto *aDlgLay = new QVBoxLayout(this);
setWindowTitle(tr("Application errors"));
myErrorLog = new QTextEdit(this);
myErrorLog->setReadOnly(true);
aDlgLay->addWidget(myErrorLog);
- QDialogButtonBox *aButtonBox =
+ auto *aButtonBox =
new QDialogButtonBox(QDialogButtonBox::Close, Qt::Horizontal, this);
aDlgLay->addWidget(aButtonBox);
aDlgLay->setContentsMargins(2, 2, 2, 2);
connect(aButtonBox, SIGNAL(rejected()), this, SLOT(clear()));
}
-XGUI_ErrorDialog::~XGUI_ErrorDialog() {}
+XGUI_ErrorDialog::~XGUI_ErrorDialog() = default;
void XGUI_ErrorDialog::refresh() {
myErrorLog->clear();
/// Constructor
/// \param parent a parent widget
XGUI_EXPORT XGUI_ErrorDialog(QWidget *parent);
- XGUI_EXPORT virtual ~XGUI_ErrorDialog();
+ XGUI_EXPORT ~XGUI_ErrorDialog() override;
public slots:
/// Update dialog box
XGUI_ErrorMgr::XGUI_ErrorMgr(QObject *theParent,
ModuleBase_IWorkshop *theWorkshop)
: ModuleBase_IErrorMgr(theParent), myWorkshop(theWorkshop),
- myErrorDialog(0), myErrorLabel(0), myAcceptToolTip(""),
+ myErrorDialog(nullptr), myErrorLabel(nullptr), myAcceptToolTip(""),
myAcceptAllToolTip(""), myAcceptStatusTip(""), myAcceptAllStatusTip("") {}
-XGUI_ErrorMgr::~XGUI_ErrorMgr() {}
+XGUI_ErrorMgr::~XGUI_ErrorMgr() = default;
void XGUI_ErrorMgr::updateActions(const FeaturePtr &theFeature) {
// update Ok Action and header of property panel if the current operation
// started for the feature
- ModuleBase_OperationFeature *aFOperation =
- dynamic_cast<ModuleBase_OperationFeature *>(
- workshop()->operationMgr()->currentOperation());
+ auto *aFOperation = dynamic_cast<ModuleBase_OperationFeature *>(
+ workshop()->operationMgr()->currentOperation());
if (aFOperation && aFOperation->feature() == theFeature) {
ModuleBase_ModelWidget *anActiveWidget = activeWidget();
bool isApplyEnabledByActiveWidget = false;
bool XGUI_ErrorMgr::isApplyEnabled() const {
bool isEnabled = false;
XGUI_ActionsMgr *anActionsMgr = workshop()->actionsMgr();
- ModuleBase_OperationFeature *aFOperation =
- dynamic_cast<ModuleBase_OperationFeature *>(
- workshop()->operationMgr()->currentOperation());
+ auto *aFOperation = dynamic_cast<ModuleBase_OperationFeature *>(
+ workshop()->operationMgr()->currentOperation());
if (aFOperation) {
QAction *anOkAction =
anActionsMgr->operationStateAction(XGUI_ActionsMgr::Accept);
}
}
void XGUI_ErrorMgr::onWidgetChanged() {
- ModuleBase_ModelWidget *aModelWidget =
- dynamic_cast<ModuleBase_ModelWidget *>(sender());
+ auto *aModelWidget = dynamic_cast<ModuleBase_ModelWidget *>(sender());
if (!aModelWidget || !aModelWidget->feature().get())
return;
QList<QWidget *> aWidgetList = theWidget->getControls();
foreach (QWidget *aWidget, aWidgetList) {
- QLabel *aLabel = qobject_cast<QLabel *>(aWidget);
+ auto *aLabel = qobject_cast<QLabel *>(aWidget);
// We won't set the effect to QLabels - it looks ugly
if (aLabel)
continue;
}
XGUI_Workshop *XGUI_ErrorMgr::workshop() const {
- XGUI_ModuleConnector *aConnector =
- dynamic_cast<XGUI_ModuleConnector *>(myWorkshop);
+ auto *aConnector = dynamic_cast<XGUI_ModuleConnector *>(myWorkshop);
return aConnector->workshop();
}
ModuleBase_ModelWidget *XGUI_ErrorMgr::activeWidget() const {
- ModuleBase_ModelWidget *anActiveWidget = 0;
+ ModuleBase_ModelWidget *anActiveWidget = nullptr;
- ModuleBase_OperationFeature *aFOperation =
- dynamic_cast<ModuleBase_OperationFeature *>(
- workshop()->operationMgr()->currentOperation());
+ auto *aFOperation = dynamic_cast<ModuleBase_OperationFeature *>(
+ workshop()->operationMgr()->currentOperation());
if (aFOperation) {
ModuleBase_IPropertyPanel *aPropertyPanel = aFOperation->propertyPanel();
if (aPropertyPanel) {
/// \param theWorkshop a workshop object
XGUI_ErrorMgr(QObject *theParent, ModuleBase_IWorkshop *theWorkshop);
/// Virtual destructor
- virtual ~XGUI_ErrorMgr();
+ ~XGUI_ErrorMgr() override;
/// Update actions for the given feature
/// \param theFeature a feature
- virtual void updateActions(const FeaturePtr &theFeature);
+ void updateActions(const FeaturePtr &theFeature) override;
/// Update enable state of AcceptAll action if the feature uses it
/// \param theFeature a feature
protected slots:
/// Reimplemented from ModuleBase_ErrorMgr::onWidgetChanged().
- virtual void onWidgetChanged();
+ void onWidgetChanged() override;
private:
/// Stores initial values of accept/accept all tool/status tip to internal
setStyleSheet("::title { position: relative; padding-left: 5px; text-align: "
"left center }");
- QWidget *aContent = new QWidget(this);
- QGridLayout *aMainLayout = new QGridLayout(aContent);
+ auto *aContent = new QWidget(this);
+ auto *aMainLayout = new QGridLayout(aContent);
aMainLayout->setContentsMargins(LayoutMargin, LayoutMargin, LayoutMargin,
LayoutMargin);
setWidget(aContent);
}
//********************************************************************
-void XGUI_FacesPanel::reset(const bool isToFlushRedisplay) {
+void XGUI_FacesPanel::reset(const bool /*isToFlushRedisplay*/) {
if (myLastItemIndex ==
0) // do nothing because there was no activity in the pane after reset
return;
updateProcessedObjects(myItems, myItemObjects);
// remove from container of hidden objects
- for (std::set<ObjectPtr>::const_iterator aHiddenIt = theHiddenObjects.begin();
- aHiddenIt != theHiddenObjects.end(); aHiddenIt++) {
- if (myHiddenObjects.find(*aHiddenIt) !=
+ for (const auto &theHiddenObject : theHiddenObjects) {
+ if (myHiddenObjects.find(theHiddenObject) !=
myHiddenObjects.end()) /// found objects
- myHiddenObjects.erase(*aHiddenIt);
+ myHiddenObjects.erase(theHiddenObject);
}
}
//********************************************************************
void XGUI_FacesPanel::getObjectsMapFromResult(
- ResultGroupPtr theResGroup, FeaturePtr theGroupFeature,
+ ResultGroupPtr /*theResGroup*/, FeaturePtr theGroupFeature,
std::map<ObjectPtr, TopoDS_ListOfShape> &theObjectToShapes,
std::map<ObjectPtr, Handle(ModuleBase_ResultPrs)> &theObjectToPrs) {
XGUI_Displayer *aDisplayer = myWorkshop->displayer();
std::map<ObjectPtr, Handle(ModuleBase_ResultPrs)> anObjectToPrs;
std::set<int> aToRemove;
- for (int i = 0; i < aSelected.size(); i++) {
- ModuleBase_ViewerPrsPtr aPrs = aSelected[i];
+ for (auto aPrs : aSelected) {
ObjectPtr anObject = aPrs->object();
if (!anObject.get())
continue;
ResultGroupPtr aResGroup;
FeaturePtr aGroupFeature;
if (getGroup((*aIt), aResGroup, aGroupFeature)) {
- std::set<ObjectPtr>::iterator aGrpIt = myHiddenGroups.find(aResGroup);
+ auto aGrpIt = myHiddenGroups.find(aResGroup);
if (aGrpIt != myHiddenGroups.end()) {
aResGroup->setDisplayed(true);
myHiddenGroups.erase(aGrpIt);
bool isModified = false;
static Events_ID aDispEvent =
Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
- for (std::set<ObjectPtr>::const_iterator anIt = theObjects.begin();
- anIt != theObjects.end(); anIt++) {
- ObjectPtr anObject = *anIt;
+ for (auto anObject : theObjects) {
if (!anObject->isDisplayed())
continue;
ModelAPI_EventCreator::get()->sendUpdated(anObject, aDispEvent);
}
aIdsToRem.insert(aIt.key());
} else {
- std::map<ObjectPtr, Handle(ModuleBase_ResultPrs)>::iterator aPIt =
- aObjectToPrs.find(theObject);
+ auto aPIt = aObjectToPrs.find(theObject);
if (aPIt != aObjectToPrs.end()) {
ObjectPtr aObj = aPIt->first;
if (aObj == theObject) {
/// Constructor
/// \param theParent is a parent of the property panel
XGUI_FacesPanel(QWidget *theParent, XGUI_Workshop *theWorkshop);
- ~XGUI_FacesPanel() {}
+ ~XGUI_FacesPanel() override = default;
/// Clear content of list widget
/// \param isToFlushRedisplay flag if redisplay should be flushed immediatelly
/// Processing focus in/out for the faces control
/// \param theObject source object of event
/// \param theEvent an event
- virtual bool eventFilter(QObject *theObject, QEvent *theEvent);
+ bool eventFilter(QObject *theObject, QEvent *theEvent) override;
XGUI_Workshop *workshop() const { return myWorkshop; }
protected:
/// Reimplementation to emit a signal about the panel close
- virtual void closeEvent(QCloseEvent *theEvent);
+ void closeEvent(QCloseEvent *theEvent) override;
signals:
/// Signal about activating pane
/// \param thePanel the workshop faces panel
XGUI_EXPORT XGUI_FacesPanelSelector(XGUI_FacesPanel *thePanel);
/// Destructor
- XGUI_EXPORT virtual ~XGUI_FacesPanelSelector(){};
+ XGUI_EXPORT ~XGUI_FacesPanelSelector() override = default;
+ ;
/// Returns name of the selector
XGUI_EXPORT static QString Type() { return "XGUI_FacesPanelSelector"; }
/// Returns name of the selector
- XGUI_EXPORT virtual QString getType() { return Type(); }
+ XGUI_EXPORT QString getType() override { return Type(); }
/// Set empty widget that need to be activated widget if it is not empty
- XGUI_EXPORT virtual void reset();
+ XGUI_EXPORT void reset() override;
/// Sets control active. It should activates/deactivates selection and
/// selection filters. \param isActive if true, the control becomes active
- XGUI_EXPORT virtual void setActive(const bool &isActive);
+ XGUI_EXPORT void setActive(const bool &isActive) override;
/// Processes current selection of workshop. Reaction to selection change in
/// workshop.
- XGUI_EXPORT virtual void processSelection();
+ XGUI_EXPORT void processSelection() override;
protected:
XGUI_FacesPanel *myPanel; ///< processed panel
#include <QWidgetAction>
XGUI_HistoryMenu::XGUI_HistoryMenu(QAction *theParent)
- : QMenu(NULL), myHistoryList(NULL) {
+ : QMenu(nullptr), myHistoryList(nullptr) {
theParent->setMenu(this);
initMenu();
}
XGUI_HistoryMenu::XGUI_HistoryMenu(QToolButton *theParent)
- : QMenu(theParent), myHistoryList(NULL) {
+ : QMenu(theParent), myHistoryList(nullptr) {
theParent->setMenu(this);
theParent->setPopupMode(QToolButton::MenuButtonPopup);
void XGUI_HistoryMenu::initMenu() {
myHistoryList = new QListWidget(this);
- QWidgetAction *aListAction = new QWidgetAction(this);
+ auto *aListAction = new QWidgetAction(this);
aListAction->setDefaultWidget(myHistoryList);
this->addAction(aListAction);
myHistoryList->setMouseTracking(true); // track mouse hover
SLOT(onItemPressed(QListWidgetItem *)));
}
-XGUI_HistoryMenu::~XGUI_HistoryMenu() {}
+XGUI_HistoryMenu::~XGUI_HistoryMenu() = default;
void XGUI_HistoryMenu::setHistory(const QList<ActionInfo> &theActions) {
myHistoryList->clear();
}
void XGUI_HistoryMenu::leaveEvent(QEvent *theEvent) {
- setStackSelectedTo(NULL);
+ setStackSelectedTo(nullptr);
QMenu::leaveEvent(theEvent);
}
void XGUI_HistoryMenu::setStackSelectedTo(QListWidgetItem *theItem) {
- QListWidgetItem *eachItem = NULL;
- bool isSelect = theItem != NULL;
+ QListWidgetItem *eachItem = nullptr;
+ bool isSelect = theItem != nullptr;
for (int aRow = 0; aRow < myHistoryList->count(); ++aRow) {
eachItem = myHistoryList->item(aRow);
myHistoryList->setItemSelected(eachItem, isSelect);
void hideUpToMenuBar(QMenu *theMenu) {
theMenu->hide();
foreach (QWidget *aWidget, theMenu->menuAction()->associatedWidgets()) {
- QMenu *aMenu = qobject_cast<QMenu *>(aWidget);
+ auto *aMenu = qobject_cast<QMenu *>(aWidget);
if (aMenu) {
aMenu->hide();
hideUpToMenuBar(aMenu);
explicit XGUI_HistoryMenu(QToolButton *theParent);
/// Creates history menu for action
explicit XGUI_HistoryMenu(QAction *theParent);
- virtual ~XGUI_HistoryMenu();
+ ~XGUI_HistoryMenu() override;
signals:
/// Signal. Emited then n-th action is selected in stack
protected:
/// Unselects all items when cursor leaves the list
- virtual void leaveEvent(QEvent *);
+ void leaveEvent(QEvent *) override;
protected slots:
/// Selects all items in stack to the given item including it
myStackWgt = new QStackedWidget(this);
// Create shape selection page
- QSplitter *aSplitter = new QSplitter(Qt::Vertical, myStackWgt);
+ auto *aSplitter = new QSplitter(Qt::Vertical, myStackWgt);
// Create an internal widget
- QWidget *aNameWgt = new QWidget(aSplitter);
- QHBoxLayout *aNameLayout = new QHBoxLayout(aNameWgt);
+ auto *aNameWgt = new QWidget(aSplitter);
+ auto *aNameLayout = new QHBoxLayout(aNameWgt);
aNameLayout->setContentsMargins(3, 0, 3, 0);
aNameLayout->addWidget(new QLabel(tr("Object"), aNameWgt));
myNameEdt = new QLineEdit(aNameWgt);
<< tr("VERTEX");
int i = 0;
foreach (QString aType, aSubShapes) {
- QTableWidgetItem *aItem = new QTableWidgetItem(aType);
+ auto *aItem = new QTableWidgetItem(aType);
aItem->setFlags(Qt::ItemIsEnabled);
mySubShapesTab->setItem(i++, 0, aItem);
}
for (i = 0; i < 9; i++) {
- QTableWidgetItem *aItem = new QTableWidgetItem("");
+ auto *aItem = new QTableWidgetItem("");
aItem->setFlags(Qt::ItemIsEnabled);
aItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
mySubShapesTab->setItem(i, 1, aItem);
aSplitter->addWidget(mySubShapesTab);
// Type of object
- QWidget *aTypeWgt = new QWidget(aSplitter);
- QHBoxLayout *aTypeLayout = new QHBoxLayout(aTypeWgt);
+ auto *aTypeWgt = new QWidget(aSplitter);
+ auto *aTypeLayout = new QHBoxLayout(aTypeWgt);
aTypeLayout->setContentsMargins(3, 0, 3, 0);
aTypeLayout->addWidget(new QLabel(tr("Type:"), aTypeWgt));
myShapePanelId = myStackWgt->addWidget(aSplitter);
// Create feature selection page
- QScrollArea *aScroll = new QScrollArea(myStackWgt);
+ auto *aScroll = new QScrollArea(myStackWgt);
aScroll->setWidgetResizable(true);
aScroll->setFrameStyle(QFrame::NoFrame);
}
//********************************************************************
-XGUI_InspectionPanel::~XGUI_InspectionPanel() {}
+XGUI_InspectionPanel::~XGUI_InspectionPanel() = default;
//********************************************************************
void XGUI_InspectionPanel::setSubShapeValue(SudShape theId, int theVal) {
XGUI_InspectionPanel(QWidget *theParent, XGUI_Workshop *theWorkshop);
// Destructor
- virtual ~XGUI_InspectionPanel();
+ ~XGUI_InspectionPanel() override;
// A translator of resource strings, needed for ShapeInfo.
- virtual std::string translate(const char *theSource) override;
+ std::string translate(const char *theSource) override;
protected:
- virtual void showEvent(QShowEvent *theEvent);
+ void showEvent(QShowEvent *theEvent) override;
private slots:
/// A slot to react on selection changed
public:
/// Constructor
XGUI_MenuGroup(const std::string &theName);
- virtual ~XGUI_MenuGroup() {}
+ virtual ~XGUI_MenuGroup() = default;
/// Returns a name of the workbench
/// \return workbench name
std::string aWchName = aWorkbench->getName();
const std::list<std::shared_ptr<XGUI_MenuGroup>> &aGroups =
aWorkbench->groups();
- std::list<std::shared_ptr<XGUI_MenuGroup>>::const_iterator
- aGIt = aGroups.begin(),
- aGLast = aGroups.end();
+ auto aGIt = aGroups.begin(), aGLast = aGroups.end();
for (; aGIt != aGLast; aGIt++) {
const std::shared_ptr<XGUI_MenuGroup> aGroup = *aGIt;
std::string aGName = aGroup->getName();
const std::list<std::shared_ptr<Config_FeatureMessage>> &aFeaturesInfo =
aGroup->featuresInfo();
- std::list<std::shared_ptr<Config_FeatureMessage>>::const_iterator
- aFIt = aFeaturesInfo.begin(),
- aFLast = aFeaturesInfo.end();
+ auto aFIt = aFeaturesInfo.begin(), aFLast = aFeaturesInfo.end();
size_t aFSize = aFeaturesInfo.size();
for (size_t i = 0; aFIt != aFLast; aFIt++, i++) {
std::shared_ptr<Config_FeatureMessage> aMessage = *aFIt;
QAction *XGUI_MenuMgr::buildAction(
const std::shared_ptr<Config_FeatureMessage> &theMessage,
const std::string &theWchName, const bool aUseSeparator) const {
- QAction *anAction = 0;
+ QAction *anAction = nullptr;
#ifdef HAVE_SALOME
XGUI_SalomeConnector *aSalomeConnector = myWorkshop->salomeConnector();
/// Constructor
/// \param theWorkshop the current workshop
XGUI_EXPORT XGUI_MenuMgr(XGUI_Workshop *theWorkshop);
- XGUI_EXPORT virtual ~XGUI_MenuMgr() {}
+ XGUI_EXPORT ~XGUI_MenuMgr() override = default;
/// Creates feature actions
XGUI_EXPORT void createFeatureActions();
/// Redefinition of Events_Listener method
/// \param theMessage a message
- XGUI_EXPORT virtual void
- processEvent(const std::shared_ptr<Events_Message> &theMessage);
+ XGUI_EXPORT void
+ processEvent(const std::shared_ptr<Events_Message> &theMessage) override;
protected:
/// Process event "Add a feature"
/// Constructor
XGUI_MenuWorkbench(const std::string &theName);
/// Destructor
- virtual ~XGUI_MenuWorkbench() {}
+ virtual ~XGUI_MenuWorkbench() = default;
/// Returns a name of the workbench
/// \return workbench name
SIGNAL(selectionChanged()));
}
-XGUI_ModuleConnector::~XGUI_ModuleConnector() {}
+XGUI_ModuleConnector::~XGUI_ModuleConnector() = default;
ModuleBase_ISelection *XGUI_ModuleConnector::selection() const {
return myWorkshop->selector()->selection();
XGUI_OperationMgr *anOperationMgr = workshop()->operationMgr();
if (anOperationMgr->startOperation(theOperation)) {
- ModuleBase_OperationFeature *aFOperation =
+ auto *aFOperation =
dynamic_cast<ModuleBase_OperationFeature *>(theOperation);
if (aFOperation) {
workshop()->propertyPanel()->updateContentWidget(aFOperation->feature());
/// Set data for item editor (name of the item)
/// \param editor a widget of editor
/// \param index the tree item index
- virtual void setEditorData(QWidget *editor, const QModelIndex &index) const {
- QLineEdit *aEditor = dynamic_cast<QLineEdit *>(editor);
+ void setEditorData(QWidget *editor, const QModelIndex &index) const override {
+ auto *aEditor = dynamic_cast<QLineEdit *>(editor);
if (aEditor) {
XGUI_DataModel *aModel = myTreedView->dataModel();
ObjectPtr aObj = aModel->object(index);
- if (aObj.get() != NULL) {
+ if (aObj.get() != nullptr) {
aEditor->setText(QString::fromStdWString(aObj->data()->name()));
return;
}
SLOT(onDoubleClick(const QModelIndex &)));
}
-XGUI_DataTree::~XGUI_DataTree() {}
+XGUI_DataTree::~XGUI_DataTree() = default;
XGUI_DataModel *XGUI_DataTree::dataModel() const {
return static_cast<XGUI_DataModel *>(model());
// We have to check number of enter and exit of this function because it can
// be called recursively by Qt in order to avoid double modifying of a data
aEntrance = 1;
- QLineEdit *aEditor = dynamic_cast<QLineEdit *>(theEditor);
+ auto *aEditor = dynamic_cast<QLineEdit *>(theEditor);
if (aEditor) {
QString aName = aEditor->text();
QModelIndexList aIndexList = selectionModel()->selectedIndexes();
update(aModel->index(i, 1, aParent));
update(aModel->index(i, 2, aParent));
}
- XGUI_ObjectsBrowser *aObjBrowser =
- qobject_cast<XGUI_ObjectsBrowser *>(parent());
+ auto *aObjBrowser = qobject_cast<XGUI_ObjectsBrowser *>(parent());
aObjBrowser->workshop()->displayer()->updateViewer();
}
void XGUI_DataTree::processEyeClick(const QModelIndex &theIndex) {
- XGUI_ObjectsBrowser *aObjBrowser =
- qobject_cast<XGUI_ObjectsBrowser *>(parent());
+ auto *aObjBrowser = qobject_cast<XGUI_ObjectsBrowser *>(parent());
XGUI_DataModel *aModel = dataModel();
ObjectPtr aObj = aModel->object(theIndex);
if (aObj.get()) {
//********************************************************************
XGUI_ObjectsBrowser::XGUI_ObjectsBrowser(QWidget *theParent,
XGUI_Workshop *theWorkshop)
- : QWidget(theParent), myDocModel(0), myWorkshop(theWorkshop) {
- QVBoxLayout *aLayout = new QVBoxLayout(this);
+ : QWidget(theParent), myDocModel(nullptr), myWorkshop(theWorkshop) {
+ auto *aLayout = new QVBoxLayout(this);
ModuleBase_Tools::zeroMargins(aLayout);
aLayout->setSpacing(0);
- QWidget *aLabelWgt = new QWidget(this);
+ auto *aLabelWgt = new QWidget(this);
aLabelWgt->setAutoFillBackground(true);
aLayout->addWidget(aLabelWgt);
- QHBoxLayout *aLabelLay = new QHBoxLayout(aLabelWgt);
+ auto *aLabelLay = new QHBoxLayout(aLabelWgt);
ModuleBase_Tools::zeroMargins(aLabelLay);
aLabelLay->setSpacing(0);
- QLabel *aLbl = new QLabel(aLabelWgt);
+ auto *aLbl = new QLabel(aLabelWgt);
aLbl->setPixmap(QPixmap(":pictures/assembly.png"));
aLbl->setMargin(2);
// Do not paint background of the label (in order to show icon)
}
//***************************************************
-XGUI_ObjectsBrowser::~XGUI_ObjectsBrowser() {}
+XGUI_ObjectsBrowser::~XGUI_ObjectsBrowser() = default;
void XGUI_ObjectsBrowser::initialize(ModuleBase_ITreeNode *theRoot) {
// myDocModel->setXMLReader(theReader);
myIsActive(false) {
qApp->installEventFilter(this);
}
- ~XGUI_ShortCutListener() {}
+ ~XGUI_ShortCutListener() override = default;
/// Switch on short cut listener
void setActive(const bool theIsActive) { myIsActive = theIsActive; }
/// Redefinition of virtual function to process Delete key release
- virtual bool eventFilter(QObject *theObject, QEvent *theEvent);
+ bool eventFilter(QObject *theObject, QEvent *theEvent) override;
private:
XGUI_OperationMgr *myOperationMgr; /// processor for key event
}
if (aName == "NoModal") {
if (theEvent->type() == QEvent::KeyRelease) {
- QKeyEvent *aKeyEvent = dynamic_cast<QKeyEvent *>(theEvent);
+ auto *aKeyEvent = dynamic_cast<QKeyEvent *>(theEvent);
if (aKeyEvent) {
myOperationMgr->setSHIFTPressed(aKeyEvent->modifiers() &
Qt::ShiftModifier);
}
} else if (theEvent->type() == QEvent::KeyPress) {
if (myOperationMgr->hasOperation()) {
- QKeyEvent *aKeyEvent = dynamic_cast<QKeyEvent *>(theEvent);
+ auto *aKeyEvent = dynamic_cast<QKeyEvent *>(theEvent);
myOperationMgr->setSHIFTPressed(aKeyEvent->modifiers() &
Qt::ShiftModifier);
isAccepted = myOperationMgr->onKeyPressed(theObject, aKeyEvent);
XGUI_OperationMgr::XGUI_OperationMgr(QObject *theParent,
ModuleBase_IWorkshop *theWorkshop)
- : QObject(theParent), myWorkshop(theWorkshop), myActiveMessageBox(0),
+ : QObject(theParent), myWorkshop(theWorkshop), myActiveMessageBox(nullptr),
mySHIFTPressed(false) {
/// we need to install filter to the application in order to react to 'Delete'
/// key button this key can not be a short cut for a corresponded action
myShortCutListener = new XGUI_ShortCutListener(this);
}
-XGUI_OperationMgr::~XGUI_OperationMgr() {}
+XGUI_OperationMgr::~XGUI_OperationMgr() = default;
void XGUI_OperationMgr::activate() { myShortCutListener->setActive(true); }
if (anOperation->id() == theId)
return anOperation;
}
- return 0;
+ return nullptr;
}
int XGUI_OperationMgr::operationsCount() const { return myOperations.count(); }
QStringList XGUI_OperationMgr::operationList() const {
QStringList result;
foreach (ModuleBase_Operation *eachOperation, myOperations) {
- ModuleBase_OperationFeature *aFOperation =
+ auto *aFOperation =
dynamic_cast<ModuleBase_OperationFeature *>(eachOperation);
if (aFOperation) {
FeaturePtr aFeature = aFOperation->feature();
XGUI_OperationMgr::previousOperation(ModuleBase_Operation *theOperation) const {
int idx = myOperations.lastIndexOf(theOperation);
if (idx == -1 || idx == 0) {
- return NULL;
+ return nullptr;
}
return myOperations.at(idx - 1);
}
ModuleBase_ModelWidget *XGUI_OperationMgr::activeWidget() const {
- ModuleBase_ModelWidget *anActiveWidget = 0;
+ ModuleBase_ModelWidget *anActiveWidget = nullptr;
ModuleBase_Operation *anOperation = currentOperation();
if (anOperation) {
ModuleBase_IPropertyPanel *aPanel = anOperation->propertyPanel();
myActiveMessageBox =
createMessageBox(tr("All active operations will be aborted."));
aResult = myActiveMessageBox->exec() == QMessageBox::Ok;
- myActiveMessageBox = 0;
+ myActiveMessageBox = nullptr;
} else if (theMessageKind == XGUI_InformationMessage) {
QString aMessage =
tr("Please validate all your active operations before saving.");
myActiveMessageBox = createInformationBox(aMessage);
myActiveMessageBox->exec();
- myActiveMessageBox = 0;
+ myActiveMessageBox = nullptr;
aResult = false; // do not perform abort
}
while (aResult && hasOperation()) {
abortOperation(anOperation);
anOperationProcessed = true;
}
- ModuleBase_OperationFeature *aFOperation =
+ auto *aFOperation =
dynamic_cast<ModuleBase_OperationFeature *>(anOperation);
if (aFOperation) {
FeaturePtr aFeature = aFOperation->feature();
void XGUI_OperationMgr::onValidateOperation() {
if (!hasOperation())
return;
- ModuleBase_OperationFeature *aFOperation =
+ auto *aFOperation =
dynamic_cast<ModuleBase_OperationFeature *>(currentOperation());
if (aFOperation && aFOperation->feature().get())
XGUI_Tools::workshop(myWorkshop)
ModuleBase_Operation *theOperation) {
XGUI_ErrorMgr *anErrorMgr = XGUI_Tools::workshop(myWorkshop)->errorMgr();
if (theOperation) {
- ModuleBase_OperationFeature *aFOperation =
+ auto *aFOperation =
dynamic_cast<ModuleBase_OperationFeature *>(theOperation);
if (aFOperation)
anErrorMgr->updateAcceptAllAction(aFOperation->feature());
if (isGrantedOperation(theOperation->id()))
return true;
if (theOperation && theOperation->isModified()) {
- ModuleBase_OperationFeature *aOp =
- dynamic_cast<ModuleBase_OperationFeature *>(theOperation);
+ auto *aOp = dynamic_cast<ModuleBase_OperationFeature *>(theOperation);
std::string aContext;
if (aOp && aOp->feature())
aContext = aOp->feature()->getKind();
QString aMessage = tr("%1 operation will be aborted.").arg(aTitle);
myActiveMessageBox = createMessageBox(aMessage);
bool aResult = myActiveMessageBox->exec() == QMessageBox::Ok;
- myActiveMessageBox = 0;
+ myActiveMessageBox = nullptr;
return aResult;
} else if (theMessageKind == XGUI_InformationMessage) {
QString aMessage =
tr("Please validate your %1 before saving.").arg(aTitle);
myActiveMessageBox = createInformationBox(aMessage);
myActiveMessageBox->exec();
- myActiveMessageBox = 0;
+ myActiveMessageBox = nullptr;
return false;
}
}
void XGUI_OperationMgr::onAbortAllOperation() { abortAllOperations(); }
void XGUI_OperationMgr::onBeforeOperationStarted() {
- ModuleBase_Operation *aCurrentOperation =
- dynamic_cast<ModuleBase_Operation *>(sender());
+ auto *aCurrentOperation = dynamic_cast<ModuleBase_Operation *>(sender());
if (!aCurrentOperation)
return;
/// Set current feature and remeber old current feature
- ModuleBase_OperationFeature *aFOperation =
+ auto *aFOperation =
dynamic_cast<ModuleBase_OperationFeature *>(aCurrentOperation);
if (aFOperation) {
SessionPtr aMgr = ModelAPI_Session::get();
}
void XGUI_OperationMgr::onOperationStarted() {
- ModuleBase_Operation *aSenderOperation =
- dynamic_cast<ModuleBase_Operation *>(sender());
+ auto *aSenderOperation = dynamic_cast<ModuleBase_Operation *>(sender());
updateApplyOfOperations(aSenderOperation);
XGUI_Workshop *aWorkshop = XGUI_Tools::workshop(myWorkshop);
aWorkshop->operationStarted(aSenderOperation);
}
void XGUI_OperationMgr::onOperationAborted() {
- ModuleBase_Operation *aSenderOperation =
- dynamic_cast<ModuleBase_Operation *>(sender());
+ auto *aSenderOperation = dynamic_cast<ModuleBase_Operation *>(sender());
XGUI_Workshop *aWorkshop = XGUI_Tools::workshop(myWorkshop);
aWorkshop->setStatusBarMessage("");
emit operationAborted(aSenderOperation);
}
void XGUI_OperationMgr::onBeforeOperationCommitted() {
- ModuleBase_Operation *aCurrentOperation =
- dynamic_cast<ModuleBase_Operation *>(sender());
+ auto *aCurrentOperation = dynamic_cast<ModuleBase_Operation *>(sender());
if (!aCurrentOperation)
return;
/// Restore the previous current feature
- ModuleBase_OperationFeature *aFOperation =
+ auto *aFOperation =
dynamic_cast<ModuleBase_OperationFeature *>(aCurrentOperation);
if (aFOperation) {
#ifdef DEBUG_CURRENT_FEATURE
// apply state for all features from the stack of operations should be updated
updateApplyOfOperations();
- ModuleBase_Operation *aSenderOperation =
- dynamic_cast<ModuleBase_Operation *>(sender());
+ auto *aSenderOperation = dynamic_cast<ModuleBase_Operation *>(sender());
emit operationCommitted(aSenderOperation);
}
void XGUI_OperationMgr::onOperationResumed() {
- ModuleBase_Operation *aSenderOperation =
- dynamic_cast<ModuleBase_Operation *>(sender());
+ auto *aSenderOperation = dynamic_cast<ModuleBase_Operation *>(sender());
emit operationResumed(aSenderOperation);
}
void XGUI_OperationMgr::onOperationStopped() {
- ModuleBase_Operation *aSenderOperation =
- dynamic_cast<ModuleBase_Operation *>(sender());
+ auto *aSenderOperation = dynamic_cast<ModuleBase_Operation *>(sender());
ModuleBase_Operation *aCurrentOperation = currentOperation();
if (!aSenderOperation || !aCurrentOperation ||
aSenderOperation != aCurrentOperation)
emit operationStopped(aCurrentOperation);
// get last operation which can be resumed
- ModuleBase_Operation *aResultOp = 0;
+ ModuleBase_Operation *aResultOp = nullptr;
QListIterator<ModuleBase_Operation *> anIt(myOperations);
anIt.toBack();
while (anIt.hasPrevious()) {
if (!isPPChildObject) {
// check for case when the operation is started but property panel is
// not filled
- XGUI_PropertyPanel *aPP = dynamic_cast<XGUI_PropertyPanel *>(aPanel);
+ auto *aPP = dynamic_cast<XGUI_PropertyPanel *>(aPanel);
aPP->setFocusNextPrevChild(theEvent->key() == Qt::Key_Tab);
isAccepted = true;
}
return isAccepted;
}
-bool XGUI_OperationMgr::onKeyPressed(QObject *theObject, QKeyEvent *theEvent) {
+bool XGUI_OperationMgr::onKeyPressed(QObject * /*theObject*/,
+ QKeyEvent *theEvent) {
// Let the manager decide what to do with the given key combination.
bool isAccepted = false;
switch (theEvent->key()) {
if (anActiveWgt) {
isAccepted = anActiveWgt && anActiveWgt->processAction(ActionEscape);
if (isAccepted) {
- ModuleBase_OperationFeature *aFOperation =
+ auto *aFOperation =
dynamic_cast<ModuleBase_OperationFeature *>(currentOperation());
if (aFOperation)
aFOperation->setNeedToBeAborted(true);
return isAccepted;
}
-bool XGUI_OperationMgr::onProcessEnter(QObject *theObject) {
+bool XGUI_OperationMgr::onProcessEnter(QObject * /*theObject*/) {
bool isAccepted = false;
ModuleBase_Operation *aOperation = currentOperation();
// to avoid enter processing when operation has not been started yet
anActiveWgt ? anActiveWgt->attributeID() : "");
if (!isAccepted) {
/// functionality is similar to Apply click
- ModuleBase_OperationFeature *aFOperation =
+ auto *aFOperation =
dynamic_cast<ModuleBase_OperationFeature *>(currentOperation());
if (!aFOperation || myWorkshop->module()
->getFeatureError(aFOperation->feature())
}
bool editorControl(QObject *theObject) {
- QLineEdit *aLineEdit = dynamic_cast<QLineEdit *>(theObject);
+ auto *aLineEdit = dynamic_cast<QLineEdit *>(theObject);
return aLineEdit;
}
bool XGUI_OperationMgr::onProcessDelete(QObject *theObject) {
bool isAccepted = false;
ModuleBase_Operation *aOperation = currentOperation();
- ModuleBase_ModelWidget *anActiveWgt = 0;
+ ModuleBase_ModelWidget *anActiveWgt = nullptr;
// firstly the widget should process Delete action
ModuleBase_IPropertyPanel *aPanel;
bool isPPChildObject = false;
const QObject *theParent) {
bool isPPChild = false;
if (theParent && theObject) {
- QObject *aParent = (QObject *)theObject;
+ auto *aParent = (QObject *)theObject;
while (aParent) {
isPPChild = aParent == theParent;
if (isPPChild)
}
QMessageBox *XGUI_OperationMgr::createMessageBox(const QString &theMessage) {
- QMessageBox *aMessageBox = new QMessageBox(
+ auto *aMessageBox = new QMessageBox(
QMessageBox::Question, QObject::tr("Abort operation"), theMessage,
QMessageBox::Ok | QMessageBox::Cancel, qApp->activeWindow());
aMessageBox->setDefaultButton(QMessageBox::Cancel);
QMessageBox *
XGUI_OperationMgr::createInformationBox(const QString &theMessage) {
- QMessageBox *aMessageBox =
+ auto *aMessageBox =
new QMessageBox(QMessageBox::Question, QObject::tr("Validate operation"),
theMessage, QMessageBox::Ok, qApp->activeWindow());
aMessageBox->setDefaultButton(QMessageBox::Ok);
}
XGUI_Workshop *XGUI_OperationMgr::xworkshop() const {
- XGUI_ModuleConnector *aConnector = (XGUI_ModuleConnector *)myWorkshop;
+ auto *aConnector = (XGUI_ModuleConnector *)myWorkshop;
return aConnector->workshop();
}
XGUI_PropertyDialog::XGUI_PropertyDialog(QWidget *theParent)
: QDialog(theParent,
Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint),
- myContentWidget(0) {
+ myContentWidget(nullptr) {
myLayout = new QGridLayout(this);
- QDialogButtonBox *aButtons = new QDialogButtonBox(
+ auto *aButtons = new QDialogButtonBox(
QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
connect(aButtons, SIGNAL(accepted()), this, SLOT(accept()));
connect(aButtons, SIGNAL(rejected()), this, SLOT(reject()));
/// \param theParent a parent widget for the dialog
XGUI_EXPORT XGUI_PropertyDialog(QWidget *theParent);
- XGUI_EXPORT virtual ~XGUI_PropertyDialog(){};
+ XGUI_EXPORT ~XGUI_PropertyDialog() override = default;
+ ;
/// Set content of the dialog
/// \param theWidget a content widget
XGUI_PropertyPanel::XGUI_PropertyPanel(QWidget *theParent,
XGUI_OperationMgr *theMgr)
- : ModuleBase_IPropertyPanel(theParent), myPanelPage(NULL),
- myActiveWidget(NULL), myPreselectionWidget(NULL),
- myInternalActiveWidget(NULL), myOperationMgr(theMgr) {
+ : ModuleBase_IPropertyPanel(theParent), myPanelPage(nullptr),
+ myActiveWidget(nullptr), myPreselectionWidget(nullptr),
+ myInternalActiveWidget(nullptr), myOperationMgr(theMgr) {
setWindowTitle(tr("Property Panel"));
// MAYBE_UNUSED QAction* aViewAct = toggleViewAction();
setObjectName(PROP_PANEL);
setStyleSheet("::title { position: relative; padding-left: 5px; text-align: "
"left center }");
- QWidget *aContent = new QWidget(this);
- QGridLayout *aMainLayout = new QGridLayout(aContent);
+ auto *aContent = new QWidget(this);
+ auto *aMainLayout = new QGridLayout(aContent);
const int kPanelColumn = 0;
int aPanelRow = 0;
aMainLayout->setContentsMargins(3, 3, 3, 3);
setWidget(aContent);
- QFrame *aFrm = new QFrame(aContent);
+ auto *aFrm = new QFrame(aContent);
aFrm->setFrameStyle(QFrame::Raised);
aFrm->setFrameShape(QFrame::Panel);
- QHBoxLayout *aBtnLay = new QHBoxLayout(aFrm);
+ auto *aBtnLay = new QHBoxLayout(aFrm);
ModuleBase_Tools::zeroMargins(aBtnLay);
aMainLayout->addWidget(aFrm, aPanelRow++, kPanelColumn);
aBtnNames << QString(PROP_PANEL_HELP) << QString(PROP_PANEL_OK)
<< QString(PROP_PANEL_OK_PLUS) << QString(PROP_PANEL_CANCEL);
foreach (QString eachBtnName, aBtnNames) {
- QToolButton *aBtn = new QToolButton(aFrm);
+ auto *aBtn = new QToolButton(aFrm);
aBtn->setObjectName(eachBtnName);
aBtn->setAutoRaise(true);
aBtnLay->addWidget(aBtn);
ModuleBase_Tools::zeroMargins(aBtnLay);
aMainLayout->addWidget(aFrm, aPanelRow++, kPanelColumn);
- QToolButton *aBtn = new QToolButton(aFrm);
+ auto *aBtn = new QToolButton(aFrm);
aBtn->setObjectName(PROP_PANEL_PREVIEW);
aBtnLay->addWidget(aBtn);
}
-XGUI_PropertyPanel::~XGUI_PropertyPanel() {}
+XGUI_PropertyPanel::~XGUI_PropertyPanel() = default;
void XGUI_PropertyPanel::cleanContent() {
if (myActiveWidget)
myWidgets.clear();
myPanelPage->clearPage();
- myActiveWidget = NULL;
+ myActiveWidget = nullptr;
emit propertyPanelDeactivated();
// VSV: It seems that this code is not necessary:
// it is called on propertyPanelDeactivated() event
void XGUI_PropertyPanel::updateContentWidget(FeaturePtr theFeature) {
// Invalid feature case on abort of the operation
- if (theFeature.get() == NULL)
+ if (theFeature.get() == nullptr)
return;
if (theFeature->isAction() || !theFeature->data())
return;
void XGUI_PropertyPanel::createContentPanel(FeaturePtr theFeature) {
// Invalid feature case on abort of the operation
- if (theFeature.get() == NULL)
+ if (theFeature.get() == nullptr)
return;
if (theFeature->isAction() || !theFeature->data())
return;
// Apply button should be update if the feature was modified by the panel
myOperationMgr->onValidateOperation();
}
- ModuleBase_OperationFeature *aFeatureOp =
- dynamic_cast<ModuleBase_OperationFeature *>(anOperation);
+ auto *aFeatureOp = dynamic_cast<ModuleBase_OperationFeature *>(anOperation);
if (aFeatureOp && (!aFeatureOp->isEditOperation()))
updateApplyPlusButton(theFeature);
else
const bool isCheckVisibility) {
// TO CHECK: Editing operation does not have automatical activation of widgets
if (isEditingMode()) {
- activateWidget(NULL);
+ activateWidget(nullptr);
return;
}
ModelAPI_ValidatorsFactory *aValidators =
// widgets it should be performed before activateWidget(NULL) because it emits
// some signals which can be processed by moudule for example as to activate
// another widget with setting focus
- QWidget *aNewFocusWidget = 0;
+ QWidget *aNewFocusWidget = nullptr;
QToolButton *anOkBtn = findButton(PROP_PANEL_OK);
if (anOkBtn->isEnabled())
aNewFocusWidget = anOkBtn;
ModuleBase_Tools::setFocus(aNewFocusWidget,
"XGUI_PropertyPanel::activateNextWidget");
- activateWidget(NULL);
+ activateWidget(nullptr);
}
void findDirectChildren(QWidget *theParent, QList<QWidget *> &theWidgets,
- const bool theDebug) {
+ const bool /*theDebug*/) {
QList<QWidget *> aWidgets;
if (theParent) {
if (aLayout) {
for (int i = 0, aCount = aLayout->count(); i < aCount; i++) {
QLayoutItem *anItem = aLayout->itemAt(i);
- QWidget *aWidget = anItem ? anItem->widget() : 0;
+ QWidget *aWidget = anItem ? anItem->widget() : nullptr;
if (aWidget) {
if (aWidget->isVisible()) {
if (aWidget->focusPolicy() != Qt::NoFocus)
QLayout *anItemLayout = anItem->layout();
for (int it = 0, cnt = anItemLayout->count(); it < cnt; it++) {
QLayoutItem *aCurItem = anItemLayout->itemAt(it);
- QWidget *aCurWidget = aCurItem ? aCurItem->widget() : 0;
+ QWidget *aCurWidget = aCurItem ? aCurItem->widget() : nullptr;
if (aCurWidget) {
if (aCurWidget->isVisible()) {
if (aCurWidget->focusPolicy() != Qt::NoFocus)
// if (aFocusMWidget)
// aFocusMWidget->setHighlighted(false);
- QWidget *aNewFocusWidget = 0;
+ QWidget *aNewFocusWidget = nullptr;
if (aFocusWidget) {
QList<QWidget *> aChildren;
findDirectChildren(this, aChildren, true);
QWidget *aLastFocusControl =
myActiveWidget->getControlAcceptingFocus(isFirstControl);
if (aFocusWidget == aLastFocusControl) {
- setActiveWidget(NULL, false);
+ setActiveWidget(nullptr, false);
}
}
return false;
}
std::string aPreviosAttributeID;
- ModuleBase_ModelWidget *aDeactivatedWidget = NULL, *anActivatedWidget = NULL;
+ ModuleBase_ModelWidget *aDeactivatedWidget = nullptr,
+ *anActivatedWidget = nullptr;
if (myActiveWidget) {
aPreviosAttributeID = myActiveWidget->attributeID();
myActiveWidget->processValueState();
} else {
if (myInternalActiveWidget) {
delete myInternalActiveWidget;
- myInternalActiveWidget = 0;
+ myInternalActiveWidget = nullptr;
}
emit propertyPanelDeactivated();
}
/// \param theMgr operation manager
XGUI_PropertyPanel(QWidget *theParent, XGUI_OperationMgr *theMgr);
- virtual ~XGUI_PropertyPanel();
+ ~XGUI_PropertyPanel() override;
/// Returns header widget
- virtual QWidget *headerWidget() const { return myHeaderWidget; }
+ QWidget *headerWidget() const override { return myHeaderWidget; }
/// Returns main widget of the property panel, which children will be created
/// by WidgetFactory using the XML definition
void setModelWidgets(const QList<ModuleBase_ModelWidget *> &theWidgets);
/// Returns all property panel's widget created by WidgetFactory
- virtual const QList<ModuleBase_ModelWidget *> &modelWidgets() const;
+ const QList<ModuleBase_ModelWidget *> &modelWidgets() const override;
/// Removes all widgets in the widget area of the property panel
- virtual void cleanContent();
+ void cleanContent() override;
/// Returns currently active widget. This is a widget from internal container
/// of widgets (myWidgets) activated/deactivated by focus in property panel.
/// If parameter is true, the method finds firstly the custom widget, after
/// the direct active widget. \param isUseCustomWidget boolean state if the
/// custom widget might be a result
- virtual ModuleBase_ModelWidget *
- activeWidget(const bool isUseCustomWidget = false) const;
+ ModuleBase_ModelWidget *
+ activeWidget(const bool isUseCustomWidget = false) const override;
/// Activate the next widget in the property panel
/// \param theWidget a widget. The next widget should be activated
- virtual void activateNextWidget(ModuleBase_ModelWidget *theWidget);
+ void activateNextWidget(ModuleBase_ModelWidget *theWidget) override;
/// Activate the next from current widget in the property panel
- virtual void activateNextWidget();
+ void activateNextWidget() override;
/// Set focus on the Ok button
- virtual void setFocusOnOkButton();
+ void setFocusOnOkButton() override;
/// Set Enable/Disable state of Cancel button
/// \param theEnabled Enable/Disable state of Cancel button
- virtual void setCancelEnabled(bool theEnabled);
+ void setCancelEnabled(bool theEnabled) override;
/// \return Enable/Disable state of Cancel button
- virtual bool isCancelEnabled() const;
+ bool isCancelEnabled() const override;
/// Editing mode depends on mode of current operation. This value is defined
/// by it. \param isEditing state of editing mode flag
- virtual void setEditingMode(bool isEditing);
+ void setEditingMode(bool isEditing) override;
//! Allows to set predefined actions for the property panel fetched from the
//! ActionsMgr
void setupActions(XGUI_ActionsMgr *theMgr);
/// Returns widget processed by preselection
- virtual ModuleBase_ModelWidget *preselectionWidget() const;
+ ModuleBase_ModelWidget *preselectionWidget() const override;
/// Sets widget processed by preselection
- virtual void setPreselectionWidget(ModuleBase_ModelWidget *theWidget);
+ void setPreselectionWidget(ModuleBase_ModelWidget *theWidget) override;
/// Returns operation manager
XGUI_OperationMgr *operationMgr() const { return myOperationMgr; }
bool setFocusNextPrevChild(bool theIsNext);
/// The method is called on accepting of operation
- virtual void onAcceptData();
+ void onAcceptData() override;
/// Set internal active widget, that can be returned as active widget and
/// participate in active selection filters/modes in application. It emits
* \param theWidget which has to be activated
* \param theEmitSignal a flag to prohibit signal emit
*/
- virtual void activateWidget(ModuleBase_ModelWidget *theWidget,
- const bool theEmitSignal = true);
+ void activateWidget(ModuleBase_ModelWidget *theWidget,
+ const bool theEmitSignal = true) override;
/// Activates the parameter widget if it can accept focus
/// \param theWidget a widget where focus in event happened
/// Emits a signal about focus change
/// If theIsNext is true, this function searches forward, if next is false, it
/// searches backward.
- virtual bool focusNextPrevChild(bool theIsNext);
+ bool focusNextPrevChild(bool theIsNext) override;
/// Activate the next widget in the property panel
/// \param theWidget a widget. The next widget should be activated
/// \param isCheckVisibility flag whether the next widget visibility is
protected:
/// A method called on the property panel closed
/// \param theEvent a close event
- void closeEvent(QCloseEvent *theEvent);
+ void closeEvent(QCloseEvent *theEvent) override;
private:
QWidget *myHeaderWidget; ///< A header widget
//********************************************************************
XGUI_PropertyPanelSelector::XGUI_PropertyPanelSelector(
XGUI_PropertyPanel *thePanel)
- : myPanel(thePanel), myWidgetToBeActivated(NULL) {
+ : myPanel(thePanel), myWidgetToBeActivated(nullptr) {
connect(myPanel, SIGNAL(propertyPanelActivated()), this, SIGNAL(activated()));
connect(myPanel, SIGNAL(propertyPanelDeactivated()), this,
SIGNAL(deactivated()));
}
//********************************************************************
-void XGUI_PropertyPanelSelector::reset() { myWidgetToBeActivated = NULL; }
+void XGUI_PropertyPanelSelector::reset() { myWidgetToBeActivated = nullptr; }
//********************************************************************
void XGUI_PropertyPanelSelector::setActive(const bool &isActive) {
if (isActive && myWidgetToBeActivated) {
// e.g. widget sketch label
myPanel->activateWidget(myWidgetToBeActivated, true);
- myWidgetToBeActivated = NULL;
+ myWidgetToBeActivated = nullptr;
return;
}
if (aWidget && aWidget->needToBeActivated()) {
myWidgetToBeActivated = aWidget;
}
- myPanel->activateWidget(NULL, false);
+ myPanel->activateWidget(nullptr, false);
}
}
//********************************************************************
bool XGUI_PropertyPanelSelector::needToBeActivated() const {
- return myWidgetToBeActivated != NULL;
+ return myWidgetToBeActivated != nullptr;
}
//********************************************************************
/// \param thePanel the workshop property panel
XGUI_EXPORT XGUI_PropertyPanelSelector(XGUI_PropertyPanel *thePanel);
/// Destructor
- XGUI_EXPORT virtual ~XGUI_PropertyPanelSelector(){};
+ XGUI_EXPORT ~XGUI_PropertyPanelSelector() override = default;
+ ;
/// Returns name of the selector
XGUI_EXPORT static QString Type() { return "XGUI_PropertyPanelSelector"; }
/// Returns name of the selector
- XGUI_EXPORT virtual QString getType() { return Type(); }
+ XGUI_EXPORT QString getType() override { return Type(); }
/// Clear need to be activated widget if it exists
- XGUI_EXPORT virtual void reset();
+ XGUI_EXPORT void reset() override;
/// Sets control active. It should activates/deactivates selection and
/// selection filters. \param isActive if true, the control becomes active
- XGUI_EXPORT virtual void setActive(const bool &isActive);
+ XGUI_EXPORT void setActive(const bool &isActive) override;
/// Returns whether the selector should be activated as soon as possible (by
/// deactivatate other) \return boolean result
- XGUI_EXPORT virtual bool needToBeActivated() const;
+ XGUI_EXPORT bool needToBeActivated() const override;
/// Processes current selection of workshop. Reaction to selection change in
/// workshop.
- XGUI_EXPORT virtual void processSelection();
+ XGUI_EXPORT void processSelection() override;
protected:
XGUI_PropertyPanel *myPanel; ///< processed panel
#include "XGUI_SalomeConnector.h"
-XGUI_SalomeConnector::XGUI_SalomeConnector() {}
+XGUI_SalomeConnector::XGUI_SalomeConnector() = default;
-XGUI_SalomeConnector::~XGUI_SalomeConnector() {}
+XGUI_SalomeConnector::~XGUI_SalomeConnector() = default;
aLast = anObjects.end();
for (; anIt != aLast; anIt++) {
ObjectPtr anObject = *anIt;
- if (anObject.get() != NULL && !aPresentationObjects.contains(anObject)) {
+ if (anObject.get() != nullptr && !aPresentationObjects.contains(anObject)) {
thePresentations.append(std::shared_ptr<ModuleBase_ViewerPrs>(
- new ModuleBase_ViewerPrs(anObject, GeomShapePtr(), NULL)));
+ new ModuleBase_ViewerPrs(anObject, GeomShapePtr(), nullptr)));
}
}
}
/// Returns a list of viewer selected presentations
/// \return list of presentations
- virtual QList<std::shared_ptr<ModuleBase_ViewerPrs>>
- getSelected(const SelectionPlace &thePlace = Browser) const;
+ QList<std::shared_ptr<ModuleBase_ViewerPrs>>
+ getSelected(const SelectionPlace &thePlace = Browser) const override;
/// Fills the viewer presentation parameters by the parameters from the owner
/// \param thePrs a container for selection
/// \param theOwner a selection owner
- virtual void fillPresentation(std::shared_ptr<ModuleBase_ViewerPrs> &thePrs,
- const Handle(SelectMgr_EntityOwner) &
- theOwner) const;
+ void fillPresentation(std::shared_ptr<ModuleBase_ViewerPrs> &thePrs,
+ const Handle(SelectMgr_EntityOwner) &
+ theOwner) const override;
/// Returns a list of viewer highlited presentations
/// \return list of presentations
- virtual QList<std::shared_ptr<ModuleBase_ViewerPrs>> getHighlighted() const;
+ QList<std::shared_ptr<ModuleBase_ViewerPrs>> getHighlighted() const override;
/// Returns list of currently selected objects in object browser
- virtual QObjectPtrList selectedObjects() const;
+ QObjectPtrList selectedObjects() const override;
/// Returns list of currently selected results
- virtual QObjectPtrList selectedPresentations() const;
+ QObjectPtrList selectedPresentations() const override;
/// Returns list of currently selected QModelIndexes
- virtual QModelIndexList selectedIndexes() const;
+ QModelIndexList selectedIndexes() const override;
/// Returns list of currently selected owners
/// \return list of owners
/// Return the IO from the viewer presentation.
/// \param thePrs a selected object
/// \return an interactive object
- virtual Handle(AIS_InteractiveObject)
- getIO(const std::shared_ptr<ModuleBase_ViewerPrs> &thePrs);
+ Handle(AIS_InteractiveObject)
+ getIO(const std::shared_ptr<ModuleBase_ViewerPrs> &thePrs) override;
protected:
/// Return a selectable object by the entity owner. It founds AIS object in
/// the viewer and returns the corresponded object \param theOwner an entity
/// owner \return a found object or NULL
ObjectPtr getSelectableObject(const Handle(SelectMgr_EntityOwner) &
- theOwner) const;
+ theOwner) const override;
/// Fills the list of presentations by objects selected in the viewer.
/// \param thePresentations an output list of presentation
//**************************************************************
void XGUI_SelectionActivate::activateObjects(const QIntList &theModes,
const QObjectPtrList &theObjList,
- const bool theUpdateViewer) {
+ const bool /*theUpdateViewer*/) {
setSelectionModes(theModes);
Handle(AIS_InteractiveContext) aContext = AISContext();
std::list<ResultPtr>::iterator aRes;
for (aRes = allRes.begin(); aRes != allRes.end(); aRes++) {
aSelectedPrs.append(std::shared_ptr<ModuleBase_ViewerPrs>(
- new ModuleBase_ViewerPrs(*aRes, GeomShapePtr(), NULL)));
+ new ModuleBase_ViewerPrs(*aRes, GeomShapePtr(), nullptr)));
}
}
}
ResultPtr aResult;
FeaturePtr aFeature;
- bool aHasOperation = (myWorkshop->operationMgr()->currentOperation() != 0);
+ bool aHasOperation =
+ (myWorkshop->operationMgr()->currentOperation() != nullptr);
SessionPtr aMgr = ModelAPI_Session::get();
DocumentPtr anActiveDocument = aMgr->activeDocument();
//******************************************************************
bool isAscii(const QString &theStr) {
char aCh;
- for (int i = 0; i < theStr.size(); i++) {
- aCh = theStr[i].toLatin1();
+ for (auto i : theStr) {
+ aCh = i.toLatin1();
if (aCh == 0)
return false;
if ((aCh >= 0x30) && (aCh <= 0x39))
//******************************************************************
bool isValidName(const QString &theName) {
QChar aChar;
- for (int i = 0; i < theName.size(); i++) {
- aChar = theName[i];
+ for (auto i : theName) {
+ aChar = i;
if (!aChar.isLetterOrNumber()) {
if ((aChar != "_") && (!aChar.isSpace()))
return false;
//**************************************************************
XGUI_Workshop *workshop(ModuleBase_IWorkshop *theWorkshop) {
- XGUI_ModuleConnector *aConnector =
- dynamic_cast<XGUI_ModuleConnector *>(theWorkshop);
- return aConnector ? aConnector->workshop() : 0;
+ auto *aConnector = dynamic_cast<XGUI_ModuleConnector *>(theWorkshop);
+ return aConnector ? aConnector->workshop() : nullptr;
}
//********************************************************************
if (aTmpDir.back() != _separator_)
aTmpDir += _separator_;
- srand((unsigned int)time(NULL));
+ srand((unsigned int)time(nullptr));
// Get a random number to present a name of a sub directory
int aRND = 999 + (int)(100000.0 * rand() / (RAND_MAX + 1.0));
char buffer[127];
}
std::string getTmpDirByEnv(const char *thePathEnv) {
- char *aVal = thePathEnv[0] == 0 ? 0 : getenv(thePathEnv);
+ char *aVal = thePathEnv[0] == 0 ? nullptr : getenv(thePathEnv);
std::string dir = aVal ? aVal : "";
return getTmpDirByPath(dir).c_str();
}
const std::list<std::string> &theFiles) {
std::string aDirName = theDirectory;
- std::list<std::string>::const_iterator aFilesIter = theFiles.cbegin();
+ auto aFilesIter = theFiles.cbegin();
for (; aFilesIter != theFiles.cend(); aFilesIter++) {
const std::string &aFile = *aFilesIter;
if (access(aFile.c_str(), F_OK) != 0)
XGUI_TransparencyWidget::XGUI_TransparencyWidget(
QWidget *theParent, const QString & /*theLabelText*/)
: QWidget(theParent) {
- QVBoxLayout *aLay = new QVBoxLayout(this);
+ auto *aLay = new QVBoxLayout(this);
aLay->setContentsMargins(0, 0, 0, 0);
- QWidget *aInfoWgt = new QWidget(this);
- QHBoxLayout *aInfoLay = new QHBoxLayout(aInfoWgt);
+ auto *aInfoWgt = new QWidget(this);
+ auto *aInfoLay = new QHBoxLayout(aInfoWgt);
aInfoLay->setContentsMargins(0, 0, 0, 0);
aInfoLay->addWidget(new QLabel(tr("Opaque")));
/// the widget
XGUI_EXPORT XGUI_TransparencyWidget(QWidget *theParent,
const QString &theLabelText = QString());
- XGUI_EXPORT virtual ~XGUI_TransparencyWidget(){};
+ XGUI_EXPORT ~XGUI_TransparencyWidget() override = default;
+ ;
/// Initializes the dialog with the given value.
/// \param theValue transparency value
//******************************************************
XGUI_Workshop::XGUI_Workshop(XGUI_SalomeConnector *theConnector)
- : QObject(), myModule(NULL), myObjectBrowser(0), myPropertyPanel(0),
- myFacesPanel(0), myDisplayer(0), mySalomeConnector(theConnector),
- // myViewerSelMode(TopAbs_FACE),
- myInspectionPanel(0) {
+ : QObject(), myModule(nullptr), mySalomeConnector(theConnector) {
mySelector = new XGUI_SelectionMgr(this);
myModuleConnector = new XGUI_ModuleConnector(this);
myOperationMgr = new XGUI_OperationMgr(this, myModuleConnector);
}
//******************************************************
-XGUI_Workshop::~XGUI_Workshop(void) {
+XGUI_Workshop::~XGUI_Workshop() {
#ifdef _DEBUG
#ifdef MISSED_TRANSLATION
// Save Missed translations
void XGUI_Workshop::onAcceptActionClicked() {
XGUI_OperationMgr *anOperationMgr = operationMgr();
if (anOperationMgr) {
- ModuleBase_OperationFeature *aFOperation =
- dynamic_cast<ModuleBase_OperationFeature *>(
- anOperationMgr->currentOperation());
+ auto *aFOperation = dynamic_cast<ModuleBase_OperationFeature *>(
+ anOperationMgr->currentOperation());
if (aFOperation) {
myOperationMgr->commitOperation();
}
void XGUI_Workshop::onAcceptPlusActionClicked() {
XGUI_OperationMgr *anOperationMgr = operationMgr();
if (anOperationMgr) {
- ModuleBase_OperationFeature *aFOperation =
- dynamic_cast<ModuleBase_OperationFeature *>(
- anOperationMgr->currentOperation());
+ auto *aFOperation = dynamic_cast<ModuleBase_OperationFeature *>(
+ anOperationMgr->currentOperation());
if (aFOperation) {
if (myOperationMgr->commitOperation())
module()->launchOperation(aFOperation->id(), false);
//******************************************************
void XGUI_Workshop::fillPropertyPanel(ModuleBase_Operation *theOperation) {
- ModuleBase_OperationFeature *aFOperation =
- dynamic_cast<ModuleBase_OperationFeature *>(theOperation);
+ auto *aFOperation = dynamic_cast<ModuleBase_OperationFeature *>(theOperation);
if (!aFOperation)
return;
->hasXmlRepresentation()) { //!< No need for property panel
fillPropertyPanel(theOperation);
connectToPropertyPanel(true);
- ModuleBase_OperationFeature *aFOperation =
+ auto *aFOperation =
dynamic_cast<ModuleBase_OperationFeature *>(theOperation);
if (aFOperation)
myPropertyPanel->updateApplyPlusButton(aFOperation->feature());
void XGUI_Workshop::onOperationStopped(ModuleBase_Operation *theOperation) {
updateCommandStatus();
- ModuleBase_OperationFeature *aFOperation =
- dynamic_cast<ModuleBase_OperationFeature *>(theOperation);
+ auto *aFOperation = dynamic_cast<ModuleBase_OperationFeature *>(theOperation);
if (!aFOperation)
return;
//******************************************************
void XGUI_Workshop::setGrantedFeatures(ModuleBase_Operation *theOperation) {
- ModuleBase_OperationFeature *aFOperation =
- dynamic_cast<ModuleBase_OperationFeature *>(theOperation);
+ auto *aFOperation = dynamic_cast<ModuleBase_OperationFeature *>(theOperation);
if (!aFOperation)
return;
//******************************************************
void XGUI_Workshop::onNew() {
QApplication::setOverrideCursor(Qt::WaitCursor);
- if (objectBrowser() == 0) {
+ if (objectBrowser() == nullptr) {
createDockWidgets();
mySelector->connectViewers();
}
objectBrowser()->treeView()->setCurrentIndex(QModelIndex());
std::list<std::string> anActionList =
theActionType == ActionUndo ? aMgr->undoList() : aMgr->redoList();
- std::list<std::string>::const_iterator aIt = anActionList.cbegin();
+ auto aIt = anActionList.cbegin();
for (int i = 0; (i < aTimes) && (aIt != anActionList.cend()); ++i, ++aIt) {
if (theActionType == ActionUndo)
aMgr->undo();
//******************************************************
void XGUI_Workshop::onValuesChanged() {
- ModuleBase_ModelWidget *aSenderWidget = (ModuleBase_ModelWidget *)(sender());
+ auto *aSenderWidget = (ModuleBase_ModelWidget *)(sender());
if (!aSenderWidget || aSenderWidget->canAcceptFocus())
return;
- ModuleBase_ModelWidget *anActiveWidget = 0;
+ ModuleBase_ModelWidget *anActiveWidget = nullptr;
ModuleBase_Operation *anOperation = myOperationMgr->currentOperation();
if (anOperation) {
ModuleBase_IPropertyPanel *aPanel = anOperation->propertyPanel();
anActiveWidget = aPanel->activeWidget();
}
if (anActiveWidget) {
- ModuleBase_WidgetValidated *aWidgetValidated =
+ auto *aWidgetValidated =
dynamic_cast<ModuleBase_WidgetValidated *>(anActiveWidget);
if (aWidgetValidated)
aWidgetValidated->clearValidatedCash();
//******************************************************
void XGUI_Workshop::onImportPart() {
if (abortAllOperations()) {
- ModuleBase_OperationFeature *anImportPartOp =
- dynamic_cast<ModuleBase_OperationFeature *>(
- module()->createOperation(ExchangePlugin_ImportPart::ID()));
+ auto *anImportPartOp = dynamic_cast<ModuleBase_OperationFeature *>(
+ module()->createOperation(ExchangePlugin_ImportPart::ID()));
anImportPartOp->setHelpFileName(QString("ExchangePlugin") +
QDir::separator() + "importFeature.html");
myPropertyPanel->updateApplyPlusButton(anImportPartOp->feature());
//******************************************************
void XGUI_Workshop::onImportShape() {
if (abortAllOperations()) {
- ModuleBase_OperationFeature *anImportOp =
- dynamic_cast<ModuleBase_OperationFeature *>(
- module()->createOperation(ExchangePlugin_Import::ID()));
+ auto *anImportOp = dynamic_cast<ModuleBase_OperationFeature *>(
+ module()->createOperation(ExchangePlugin_Import::ID()));
anImportOp->setHelpFileName(QString("ExchangePlugin") + QDir::separator() +
"importFeature.html");
myPropertyPanel->updateApplyPlusButton(anImportOp->feature());
//******************************************************
void XGUI_Workshop::onImportImage() {
if (abortAllOperations()) {
- ModuleBase_OperationFeature *anImportOp =
- dynamic_cast<ModuleBase_OperationFeature *>(
- module()->createOperation(ExchangePlugin_Import_Image::ID()));
+ auto *anImportOp = dynamic_cast<ModuleBase_OperationFeature *>(
+ module()->createOperation(ExchangePlugin_Import_Image::ID()));
anImportOp->setHelpFileName(QString("ExchangePlugin") + QDir::separator() +
"importFeature.html");
myPropertyPanel->updateApplyPlusButton(anImportOp->feature());
//******************************************************
void XGUI_Workshop::onExportShape() {
if (abortAllOperations()) {
- ModuleBase_OperationFeature *anExportOp =
- dynamic_cast<ModuleBase_OperationFeature *>(
- module()->createOperation(ExchangePlugin_ExportFeature::ID()));
+ auto *anExportOp = dynamic_cast<ModuleBase_OperationFeature *>(
+ module()->createOperation(ExchangePlugin_ExportFeature::ID()));
anExportOp->setHelpFileName(QString("ExchangePlugin") + QDir::separator() +
"exportFeature.html");
myPropertyPanel->updateApplyPlusButton(anExportOp->feature());
//******************************************************
void XGUI_Workshop::onExportPart() {
if (abortAllOperations()) {
- ModuleBase_OperationFeature *anExportPartOp =
- dynamic_cast<ModuleBase_OperationFeature *>(
- module()->createOperation(ExchangePlugin_ExportPart::ID()));
+ auto *anExportPartOp = dynamic_cast<ModuleBase_OperationFeature *>(
+ module()->createOperation(ExchangePlugin_ExportPart::ID()));
anExportPartOp->setHelpFileName(QString("ExchangePlugin") +
QDir::separator() + "exportFeature.html");
myPropertyPanel->updateApplyPlusButton(anExportPartOp->feature());
ModuleBase_IModule *XGUI_Workshop::loadModule(const QString &theModule) {
QString libName = QString::fromStdString(library(theModule.toStdString()));
if (libName.isEmpty()) {
- qWarning(qPrintable(
- tr("Information about module \"%1\" doesn't exist.").arg(theModule)));
- return 0;
+ qWarning("%s",
+ qPrintable(tr("Information about module \"%1\" doesn't exist.")
+ .arg(theModule)));
+ return nullptr;
}
QString err;
- CREATE_FUNC crtInst = 0;
+ CREATE_FUNC crtInst = nullptr;
#ifdef WIN32
HINSTANCE modLib = ::LoadLibraryA(qPrintable(libName));
}
#endif
- ModuleBase_IModule *aModule = crtInst ? crtInst(myModuleConnector) : 0;
+ ModuleBase_IModule *aModule = crtInst ? crtInst(myModuleConnector) : nullptr;
if (!err.isEmpty()) {
if (desktop()) {
Events_InfoMessage("XGUI_Workshop", err.toStdString()).send();
} else {
- qWarning(qPrintable(err));
+ qWarning("%s", qPrintable(err));
}
}
return aModule;
//******************************************************
QDockWidget *XGUI_Workshop::createObjectBrowser(QWidget *theParent) {
- QDockWidget *aObjDock = new QDockWidget(theParent);
+ auto *aObjDock = new QDockWidget(theParent);
aObjDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
aObjDock->setWindowTitle(tr("Object browser"));
aObjDock->setStyleSheet("::title { position: relative; padding-left: 5px; "
}
//**************************************************************
-void XGUI_Workshop::onContextMenuCommand(const QString &theId, bool isChecked) {
+void XGUI_Workshop::onContextMenuCommand(const QString &theId,
+ bool /*isChecked*/) {
QObjectPtrList anObjects = mySelector->selection()->selectedObjects();
if (theId == "DELETE_CMD")
deleteObjects();
// generate container of objects taking into account sub elments of compsolid
std::set<ObjectPtr> anAllProcessedObjects;
- for (std::set<ObjectPtr>::const_iterator anObjectsIt = theObjects.begin();
- anObjectsIt != theObjects.end(); anObjectsIt++) {
- ObjectPtr anObject = *anObjectsIt;
+ for (auto anObject : theObjects) {
ResultBodyPtr aCompRes =
std::dynamic_pointer_cast<ModelAPI_ResultBody>(anObject);
if (aCompRes.get()) {
if (allRes.empty()) {
anAllProcessedObjects.insert(anObject);
} else {
- for (std::list<ResultPtr>::iterator aRes = allRes.begin();
- aRes != allRes.end(); aRes++) {
+ for (auto &allRe : allRes) {
ResultBodyPtr aBody =
- std::dynamic_pointer_cast<ModelAPI_ResultBody>(*aRes);
+ std::dynamic_pointer_cast<ModelAPI_ResultBody>(allRe);
if (aBody.get() && aBody->numberOfSubs() == 0)
anAllProcessedObjects.insert(aBody);
}
// find hidden objects in faces panel
std::set<ObjectPtr> aHiddenObjects;
QStringList aHiddenObjectNames;
- for (std::set<ObjectPtr>::const_iterator anObjectsIt =
- anAllProcessedObjects.begin();
- anObjectsIt != anAllProcessedObjects.end(); anObjectsIt++) {
- if (!facesPanel()->isObjectHiddenByPanel(*anObjectsIt))
+ for (const auto &anAllProcessedObject : anAllProcessedObjects) {
+ if (!facesPanel()->isObjectHiddenByPanel(anAllProcessedObject))
continue;
- aHiddenObjects.insert(*anObjectsIt);
+ aHiddenObjects.insert(anAllProcessedObject);
aHiddenObjectNames.append(
- QString::fromStdWString((*anObjectsIt)->data()->name()));
+ QString::fromStdWString(anAllProcessedObject->data()->name()));
}
if (aHiddenObjects.empty()) // in parameter objects there are no hidden
// objects in hide face
QString aDescription = contextMenuMgr()->action("DELETE_CMD")->text() + " %1";
aDescription =
aDescription.arg(XGUI_Tools::unionOfObjectNames(anObjects, ", "));
- ModuleBase_Operation *anOpAction =
- new ModuleBase_Operation(aDescription, module());
+ auto *anOpAction = new ModuleBase_Operation(aDescription, module());
operationMgr()->startOperation(anOpAction);
aDone = ModelAPI_Tools::removeFeatures(aFeatures, false);
}
if (aFolders.size() > 0) {
- std::set<FolderPtr>::const_iterator anIt = aFolders.begin(),
- aLast = aFolders.end();
+ auto anIt = aFolders.begin(), aLast = aFolders.end();
for (; anIt != aLast; anIt++) {
FolderPtr aFolder = *anIt;
if (aFolder.get()) {
// references to it
std::set<FeaturePtr> aMainReferences = theMainList.at(theFeature);
- std::set<FeaturePtr>::const_iterator anIt = aMainReferences.begin(),
- aLast = aMainReferences.end();
+ auto anIt = aMainReferences.begin(), aLast = aMainReferences.end();
for (; anIt != aLast; anIt++) {
FeaturePtr aRefFeature = *anIt;
if (theReferences.find(aRefFeature) == theReferences.end())
for (; aMainIt != aMainLast; aMainIt++) {
FeaturePtr aMainListFeature = aMainIt->first;
std::set<FeaturePtr> aMainRefList = aMainIt->second;
- std::set<FeaturePtr>::const_iterator aRefIt = aMainRefList.begin(),
- aRefLast = aMainRefList.end();
+ auto aRefIt = aMainRefList.begin(), aRefLast = aMainRefList.end();
bool aFeatureOutOfTheList = false;
for (; aRefIt != aRefLast && !aFeatureOutOfTheList; aRefIt++) {
FeaturePtr aRefFeature = *aRefIt;
aDescription +=
"by deleting of " +
aDescription.arg(XGUI_Tools::unionOfObjectNames(anObjects, ", "));
- ModuleBase_Operation *anOpAction =
- new ModuleBase_Operation(aDescription, module());
+ auto *anOpAction = new ModuleBase_Operation(aDescription, module());
operationMgr()->startOperation(anOpAction);
// WORKAROUND, should be done before each object remove, if it presents in
bool isFoundResultType = false;
foreach (ObjectPtr anObj, theObjects) {
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObj);
- if (aResult.get() == NULL)
+ if (aResult.get() == nullptr)
continue;
isFoundResultType = theTypes.find(aResult->groupName()) != theTypes.end();
DocumentPtr aDocument = theObject->document();
std::list<FeaturePtr> anAllFeatures = allFeatures(aDocument);
// find the object iterator
- std::list<FeaturePtr>::iterator anObjectIt =
+ auto anObjectIt =
std::find(anAllFeatures.begin(), anAllFeatures.end(), theObject);
if (anObjectIt == anAllFeatures.end())
return aResult;
// find the current feature iterator
- std::list<FeaturePtr>::iterator aCurrentIt =
- std::find(anAllFeatures.begin(), anAllFeatures.end(),
- aDocument->currentFeature(true));
+ auto aCurrentIt = std::find(anAllFeatures.begin(), anAllFeatures.end(),
+ aDocument->currentFeature(true));
if (aCurrentIt == anAllFeatures.end())
return aResult;
// check the right order
if (!aCanBeShaded) {
ResultBodyPtr aCompRes =
std::dynamic_pointer_cast<ModelAPI_ResultBody>(theObject);
- if (aCompRes.get() != NULL) { // change colors for all sub-solids
+ if (aCompRes.get() != nullptr) { // change colors for all sub-solids
std::list<ResultPtr> allRes;
ModelAPI_Tools::allSubs(aCompRes, allRes);
- std::list<ResultPtr>::iterator aRes = allRes.begin();
+ auto aRes = allRes.begin();
for (; aRes != allRes.end() && !aCanBeShaded; aRes++) {
aCanBeShaded = myDisplayer->canBeShaded(*aRes);
}
if (!abortAllOperations())
return;
// 2. show the dialog to change the value
- XGUI_ColorDialog *aDlg = new XGUI_ColorDialog(desktop());
+ auto *aDlg = new XGUI_ColorDialog(desktop());
aDlg->setColor(aColor);
aDlg->move(QCursor::pos());
bool isDone = aDlg->exec() == QDialog::Accepted;
std::vector<int> aColorResult = aDlg->getColor();
foreach (ObjectPtr anObj, theObjects) {
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObj);
- if (aResult.get() != NULL) {
+ if (aResult.get() != nullptr) {
ResultBodyPtr aBodyResult =
std::dynamic_pointer_cast<ModelAPI_ResultBody>(aResult);
- if (aBodyResult.get() != NULL) { // change colors for all sub-solids
+ if (aBodyResult.get() != nullptr) { // change colors for all sub-solids
std::list<ResultPtr> allRes;
ModelAPI_Tools::allSubs(aBodyResult, allRes);
- for (std::list<ResultPtr>::iterator aRes = allRes.begin();
- aRes != allRes.end(); aRes++) {
+ for (auto &allRe : allRes) {
ModelAPI_Tools::setColor(
- *aRes, !isRandomColor ? aColorResult : aDlg->getRandomColor());
+ allRe, !isRandomColor ? aColorResult : aDlg->getRandomColor());
}
}
ModelAPI_Tools::setColor(
DocumentPtr aDocument = anObj->document();
std::list<FeaturePtr> anAllFeatures = allFeatures(aDocument);
// find the object iterator
- std::list<FeaturePtr>::iterator anObjectIt = anAllFeatures.begin();
+ auto anObjectIt = anAllFeatures.begin();
for (; anObjectIt != anAllFeatures.end(); ++anObjectIt) {
FeaturePtr aFeature = *anObjectIt;
if (aFeature.get()) {
void setTransparency(double theTransparency, const QObjectPtrList &theObjects) {
foreach (ObjectPtr anObj, theObjects) {
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObj);
- if (aResult.get() != NULL) {
+ if (aResult.get() != nullptr) {
ResultBodyPtr aBodyResult =
std::dynamic_pointer_cast<ModelAPI_ResultBody>(aResult);
- if (aBodyResult.get() != NULL) { // change property for all sub-solids
+ if (aBodyResult.get() != nullptr) { // change property for all sub-solids
std::list<ResultPtr> allRes;
ModelAPI_Tools::allSubs(aBodyResult, allRes);
std::list<ResultPtr>::iterator aRes;
if (!abortAllOperations())
return;
// 2. show the dialog to change the value
- XGUI_DeflectionDialog *aDlg = new XGUI_DeflectionDialog(desktop());
+ auto *aDlg = new XGUI_DeflectionDialog(desktop());
aDlg->setDeflection(aDeflection);
aDlg->move(QCursor::pos());
bool isDone = aDlg->exec() == QDialog::Accepted;
aDeflection = aDlg->getDeflection();
foreach (ObjectPtr anObj, theObjects) {
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObj);
- if (aResult.get() != NULL) {
+ if (aResult.get() != nullptr) {
ResultBodyPtr aBodyResult =
std::dynamic_pointer_cast<ModelAPI_ResultBody>(aResult);
- if (aBodyResult.get() != NULL) { // change property for all sub-solids
+ if (aBodyResult.get() != nullptr) { // change property for all sub-solids
std::list<ResultPtr> allRes;
ModelAPI_Tools::allSubs(aBodyResult, allRes);
- for (std::list<ResultPtr>::iterator aRes = allRes.begin();
- aRes != allRes.end(); aRes++) {
- ModelAPI_Tools::setDeflection(*aRes, aDeflection);
+ for (auto &allRe : allRes) {
+ ModelAPI_Tools::setDeflection(allRe, aDeflection);
}
}
ModelAPI_Tools::setDeflection(aResult, aDeflection);
}
//**************************************************************
-double getDefaultTransparency(const ResultPtr &theResult) {
+double getDefaultTransparency(const ResultPtr & /*theResult*/) {
return Config_PropManager::integer("Visualization",
"shaper_default_transparency") /
100.;
return;
// 2. show the dialog to change the value
- XGUI_PropertyDialog *aDlg = new XGUI_PropertyDialog(desktop());
+ auto *aDlg = new XGUI_PropertyDialog(desktop());
aDlg->setWindowTitle(tr("Transparency"));
- XGUI_TransparencyWidget *aTransparencyWidget =
- new XGUI_TransparencyWidget(aDlg);
+ auto *aTransparencyWidget = new XGUI_TransparencyWidget(aDlg);
connect(aTransparencyWidget, SIGNAL(transparencyValueChanged()), this,
SLOT(onTransparencyValueChanged()));
aDlg->setContent(aTransparencyWidget);
//**************************************************************
void XGUI_Workshop::onTransparencyValueChanged() {
- XGUI_TransparencyWidget *aTransparencyWidget =
- (XGUI_TransparencyWidget *)sender();
+ auto *aTransparencyWidget = (XGUI_TransparencyWidget *)sender();
if (!aTransparencyWidget)
return;
AISObjectPtr aAisPtr = myDisplayer->getAISObject(aStep);
Handle(AIS_InteractiveObject) aIO =
aAisPtr->impl<Handle(AIS_InteractiveObject)>();
- ModuleBase_IStepPrs *aPrs =
- dynamic_cast<ModuleBase_IStepPrs *>(aIO.get());
+ auto *aPrs = dynamic_cast<ModuleBase_IStepPrs *>(aIO.get());
if (aPrs) {
ModelAPI_AttributeTables::ValueType aType = aPrs->dataType();
if ((aType == ModelAPI_AttributeTables::DOUBLE) ||
ResultBodyPtr aBodyResult =
std::dynamic_pointer_cast<ModelAPI_ResultBody>(anObj);
- if (aBodyResult.get() != NULL) { // change display mode for all sub-solids
+ if (aBodyResult.get() !=
+ nullptr) { // change display mode for all sub-solids
std::list<ResultPtr> allRes;
ModelAPI_Tools::allSubs(aBodyResult, allRes);
- for (std::list<ResultPtr>::iterator aRes = allRes.begin();
- aRes != allRes.end(); aRes++) {
- myDisplayer->setDisplayMode(*aRes, (XGUI_Displayer::DisplayMode)theMode,
+ for (auto &allRe : allRes) {
+ myDisplayer->setDisplayMode(allRe, (XGUI_Displayer::DisplayMode)theMode,
false);
}
}
void XGUI_Workshop::toggleEdgesDirection(const QObjectPtrList &theList) {
foreach (ObjectPtr anObj, theList) {
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObj);
- if (aResult.get() != NULL) {
+ if (aResult.get() != nullptr) {
bool aToShow = !ModelAPI_Tools::isShowEdgesDirection(aResult);
ResultBodyPtr aBodyResult =
std::dynamic_pointer_cast<ModelAPI_ResultBody>(aResult);
- if (aBodyResult.get() != NULL) { // change property for all sub-solids
+ if (aBodyResult.get() != nullptr) { // change property for all sub-solids
std::list<ResultPtr> allRes;
ModelAPI_Tools::allSubs(aBodyResult, allRes);
std::list<ResultPtr>::iterator aRes;
// Toggle the "BringToFront" state of all objects in the list
foreach (ObjectPtr anObj, theList) {
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObj);
- if (aResult.get() != NULL) {
+ if (aResult.get() != nullptr) {
bool aBringToFront = !ModelAPI_Tools::isBringToFront(aResult);
ModelAPI_Tools::bringToFront(aResult, aBringToFront);
myDisplayer->redisplay(anObj, false);
//******************************************************
void XGUI_Workshop::addHistoryMenu(QObject *theObject, const char *theSignal,
const char *theSlot) {
- XGUI_HistoryMenu *aMenu = NULL;
+ XGUI_HistoryMenu *aMenu = nullptr;
if (isSalomeMode()) {
- QAction *anAction = qobject_cast<QAction *>(theObject);
+ auto *anAction = qobject_cast<QAction *>(theObject);
if (!anAction)
return;
aMenu = new XGUI_HistoryMenu(anAction);
} else {
- QToolButton *aButton = qobject_cast<QToolButton *>(theObject);
+ auto *aButton = qobject_cast<QToolButton *>(theObject);
aMenu = new XGUI_HistoryMenu(aButton);
}
connect(this, theSignal, aMenu, SLOT(setHistory(const QList<ActionInfo> &)));
QList<ActionInfo>
XGUI_Workshop::processHistoryList(const std::list<std::string> &theList) const {
QList<ActionInfo> aResult;
- std::list<std::string>::const_iterator it = theList.cbegin();
+ auto it = theList.cbegin();
for (; it != theList.cend(); it++) {
QString anId = QString::fromStdString(*it);
bool isEditing = anId.endsWith(ModuleBase_OperationFeature::EditSuffix());
return;
ObjectPtr aObj = anObjects.first();
FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
- if (aFeature.get() == NULL)
+ if (aFeature.get() == nullptr)
return;
SessionPtr aMgr = ModelAPI_Session::get();
DocumentPtr aDoc = aMgr->activeDocument();
}
void XGUI_Workshop::onDockSizeChanged() {
- QDockWidget *aDockWgt =
- dynamic_cast<QDockWidget *>(myObjectBrowser->parentWidget());
+ auto *aDockWgt = dynamic_cast<QDockWidget *>(myObjectBrowser->parentWidget());
int aObWidth = aDockWgt->size().width();
if (myPropertyPanel->width() != aObWidth) {
QList<QDockWidget *> aWgtList;
XGUI_PropertyDialog aDlg(desktop());
aDlg.setWindowTitle(tr("Number of Iso-lines"));
- QWidget *aIsosWgt = new QWidget(&aDlg);
- QFormLayout *aLayout = new QFormLayout(aIsosWgt);
+ auto *aIsosWgt = new QWidget(&aDlg);
+ auto *aLayout = new QFormLayout(aIsosWgt);
ModuleBase_Tools::adjustMargins(aLayout);
aDlg.setContent(aIsosWgt);
- QSpinBox *aUNb = new QSpinBox(&aDlg);
+ auto *aUNb = new QSpinBox(&aDlg);
aUNb->setValue(aValues[0]);
aLayout->addRow("U:", aUNb);
- QSpinBox *aVNb = new QSpinBox(&aDlg);
+ auto *aVNb = new QSpinBox(&aDlg);
aVNb->setValue(aValues[1]);
aLayout->addRow("V:", aVNb);
AppElements_MainWindow *myMainWindow; ///< desktop window
#endif
- ModuleBase_IModule *myModule; ///< current module
- XGUI_ErrorMgr *myErrorMgr; ///< updator of error message
- XGUI_ObjectsBrowser *myObjectBrowser; ///< data tree widget
- XGUI_PropertyPanel
- *myPropertyPanel; ///< container of feature attributes widgets
- XGUI_FacesPanel *myFacesPanel; ///< panel for hide object faces
- XGUI_SelectionMgr *mySelector; ///< handler of selection processing
+ ModuleBase_IModule *myModule; ///< current module
+ XGUI_ErrorMgr *myErrorMgr; ///< updator of error message
+ XGUI_ObjectsBrowser *myObjectBrowser{0}; ///< data tree widget
+ XGUI_PropertyPanel *myPropertyPanel{
+ 0}; ///< container of feature attributes widgets
+ XGUI_FacesPanel *myFacesPanel{0}; ///< panel for hide object faces
+ XGUI_SelectionMgr *mySelector; ///< handler of selection processing
XGUI_SelectionActivate
- *mySelectionActivate; /// manager of selection activating
- XGUI_Displayer *myDisplayer; ///< handler of objects display
+ *mySelectionActivate; /// manager of selection activating
+ XGUI_Displayer *myDisplayer{0}; ///< handler of objects display
XGUI_OperationMgr
*myOperationMgr; ///< manager to manipulate through the operations
XGUI_ActionsMgr *myActionsMgr; ///< manager of workshop actions
QString myCurrentFile; ///< cached the last open directory
QIntList myViewerSelMode; ///< selection modes set in the viewer
Config_DataModelReader *myDataModelXMLReader; ///< XML reader of data model
- XGUI_InspectionPanel
- *myInspectionPanel; ///< container of feature attributes widgets
+ XGUI_InspectionPanel *myInspectionPanel{
+ 0}; ///< container of feature attributes widgets
QTemporaryDir myTmpDir; ///< a direcory for uncompressed files
};
: myWorkshop(theWorkshop), myUpdatePrefs(false) {}
//******************************************************
-XGUI_WorkshopListener::~XGUI_WorkshopListener(void) {}
+XGUI_WorkshopListener::~XGUI_WorkshopListener() = default;
//******************************************************
void XGUI_WorkshopListener::initializeEventListening() {
<< "Working in another thread." << std::endl;
#endif
SessionPtr aMgr = ModelAPI_Session::get();
- PostponeMessageQtEvent *aPostponeEvent =
- new PostponeMessageQtEvent(theMessage);
+ auto *aPostponeEvent = new PostponeMessageQtEvent(theMessage);
QApplication::postEvent(this, aPostponeEvent);
return;
}
ModuleBase_ModelWidget *aWidget =
workshop()->propertyPanel()->activeWidget();
if (aWidget) {
- ModuleBase_WidgetSelector *aWidgetSelector =
+ auto *aWidgetSelector =
dynamic_cast<ModuleBase_WidgetSelector *>(aWidget);
if (aWidgetSelector)
workshop()->selector()->setSelected(
std::set<ObjectPtr> aFeatures = theMsg->objects();
XGUI_OperationMgr *anOperationMgr = workshop()->operationMgr();
if (anOperationMgr->hasOperation()) {
- ModuleBase_OperationFeature *aFOperation =
- dynamic_cast<ModuleBase_OperationFeature *>(
- anOperationMgr->currentOperation());
+ auto *aFOperation = dynamic_cast<ModuleBase_OperationFeature *>(
+ anOperationMgr->currentOperation());
if (aFOperation) {
FeaturePtr aCurrentFeature = aFOperation->feature();
std::set<ObjectPtr>::const_iterator aIt;
}
bool XGUI_WorkshopListener::event(QEvent *theEvent) {
- PostponeMessageQtEvent *aPostponedEv =
- dynamic_cast<PostponeMessageQtEvent *>(theEvent);
+ auto *aPostponedEv = dynamic_cast<PostponeMessageQtEvent *>(theEvent);
if (aPostponedEv) {
std::shared_ptr<Events_Message> aEventPtr =
aPostponedEv->postponedMessage();
XGUI_OperationMgr *anOperationMgr = workshop()->operationMgr();
FeaturePtr aCurrentFeature;
if (anOperationMgr->hasOperation()) {
- ModuleBase_OperationFeature *aFOperation =
- dynamic_cast<ModuleBase_OperationFeature *>(
- anOperationMgr->currentOperation());
+ auto *aFOperation = dynamic_cast<ModuleBase_OperationFeature *>(
+ anOperationMgr->currentOperation());
if (aFOperation) {
aCurrentFeature = aFOperation->feature();
}
/// Constructor. Used only if the workshop is launched in Salome environment
/// \param theWorkshop a reference to workshop.
XGUI_WorkshopListener(XGUI_Workshop *theWorkshop);
- virtual ~XGUI_WorkshopListener();
+ ~XGUI_WorkshopListener() override;
/// Register this class in the events loop for several types of events
void initializeEventListening();
//! Redefinition of Events_Listener method
- virtual void processEvent(const std::shared_ptr<Events_Message> &theMessage);
+ void processEvent(const std::shared_ptr<Events_Message> &theMessage) override;
signals:
/// Emitted when error in applivation happens
protected:
/// Procedure to process postponed events
- bool event(QEvent *theEvent);
+ bool event(QEvent *theEvent) override;
/// Process feature update message
/// \param theMsg a message with a container of objects