#include <GeomAPI_Edge.h>
#include <GeomAPI_Ellipse.h>
#include <GeomAPI_ShapeExplorer.h>
+#include <GeomAPI_Wire.h>
+#include <GeomAPI_WireExplorer.h>
#include <GeomDataAPI_Point2D.h>
#include <GeomDataAPI_Point2DArray.h>
theList->append(theValue);
}
+// Reorder shapes according to the wire's order
+static void reorderShapes(ListOfShape& theShapes, GeomShapePtr theWire)
+{
+ std::set<GeomShapePtr, GeomAPI_Shape::Comparator> aShapes;
+ aShapes.insert(theShapes.begin(), theShapes.end());
+ theShapes.clear();
+
+ GeomWirePtr aWire(new GeomAPI_Wire(theWire));
+ GeomAPI_WireExplorer anExp(aWire);
+ for (; anExp.more(); anExp.next()) {
+ GeomShapePtr aCurEdge = anExp.current();
+ auto aFound = aShapes.find(aCurEdge);
+ if (aFound != aShapes.end()) {
+ theShapes.push_back(aCurEdge);
+ aShapes.erase(aFound);
+ }
+ }
+}
+
static void removeLastFromIndex(AttributeRefListPtr theList, int theListSize, int& theLastIndex)
{
if (theLastIndex < theListSize) {
GeomShapePtr aBaseShape = aBaseFeature->lastResult()->shape();
ListOfShape aNewShapes;
for (ListOfMakeShape::const_iterator anAlgoIt = theOffsetAlgos.begin();
- anAlgoIt != theOffsetAlgos.end() && aNewShapes.empty(); ++anAlgoIt) {
+ anAlgoIt != theOffsetAlgos.end(); ++anAlgoIt) {
(*anAlgoIt)->generated(aBaseShape, aNewShapes);
+ if (!aNewShapes.empty()) {
+ reorderShapes(aNewShapes, (*anAlgoIt)->shape());
+ break;
+ }
}
// store base feature
}
}
+ bool aWasBlocked = data()->blockSendAttributeUpdated(true);
+
// Gather chains of edges
for (anEdgesIt = anEdgesList.begin(); anEdgesIt != anEdgesList.end(); anEdgesIt++) {
FeaturePtr aFeature = ModelAPI_Feature::feature(*anEdgesIt);
}
// TODO: hilight selection in the viewer
+ data()->blockSendAttributeUpdated(aWasBlocked);
return true;
}