}
-bool GeomAPI_Edge::isEqual(std::shared_ptr<GeomAPI_Shape> theEdge)
+bool GeomAPI_Edge::isEqual(const std::shared_ptr<GeomAPI_Shape> theEdge) const
{
const TopoDS_Shape& aMyShape = const_cast<GeomAPI_Edge*>(this)->impl<TopoDS_Shape>();
const TopoDS_Shape& aInShape = theEdge->impl<TopoDS_Shape>();
std::shared_ptr<GeomAPI_Circ> circle();
/// Returns true if the current edge is geometrically equal to the given edge
- bool isEqual(std::shared_ptr<GeomAPI_Shape> theEdge);
+ bool isEqual(const std::shared_ptr<GeomAPI_Shape> theEdge) const;
};
#endif
return std::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aPoint.X(), aPoint.Y(), aPoint.Z()));
}
-bool GeomAPI_Vertex::isEqual(std::shared_ptr<GeomAPI_Shape> theVert)
+bool GeomAPI_Vertex::isEqual(const std::shared_ptr<GeomAPI_Shape> theVert) const
{
const TopoDS_Shape& aMyShape = const_cast<GeomAPI_Vertex*>(this)->impl<TopoDS_Shape>();
const TopoDS_Shape& aInShape = theVert->impl<TopoDS_Shape>();
std::shared_ptr<GeomAPI_Pnt> point();
/// Returns true if the current edge is geometrically equal to the given edge
- bool isEqual(std::shared_ptr<GeomAPI_Shape> theVert);
+ bool isEqual(const std::shared_ptr<GeomAPI_Shape> theVert) const;
};
#endif
<!-- Major module parameters -->
<parameter name="name" value="NewGeom"/>
<parameter name="icon" value="newgeom.png"/>
- <parameter name="version" value="0.6.1"/>
+ <parameter name="version" value="0.7.0"/>
</section>
<section name="resources">
<!-- Module resources -->
<!-- Major module parameters -->
<parameter name="name" value="NewGeom"/>
<parameter name="icon" value="newgeom.png"/>
- <parameter name="version" value="0.6.1"/>
+ <parameter name="version" value="0.7.0"/>
</section>
<section name="resources">
<!-- Module resources -->
void PartSet_SketcherMgr::stopSketch(ModuleBase_Operation* theOperation)
{
+ XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myModule->workshop());
+ XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer();
+
DataPtr aData = myCurrentSketch->data();
if ((!aData) || (!aData->isValid())) {
// The sketch was aborted
myCurrentSketch = CompositeFeaturePtr();
myModule->workshop()->viewer()->removeSelectionFilter(myPlaneFilter);
+
+ // Erase all sketcher objects
+ QStringList aSketchIds = sketchOperationIdList();
+ QObjectPtrList aObjects = aDisplayer->displayedObjects();
+ foreach (ObjectPtr aObj, aObjects) {
+ DataPtr aObjData = aObj->data();
+ if ((!aObjData) || (!aObjData->isValid()))
+ aDisplayer->erase(aObj);
+ }
return;
}
// Hide all sketcher sub-Objects
- XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myModule->workshop());
- XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer();
for (int i = 0; i < myCurrentSketch->numberOfSubs(); i++) {
FeaturePtr aFeature = myCurrentSketch->subFeature(i);
std::list<ResultPtr> aResults = aFeature->results();
Handle(AIS_InteractiveContext) aContext = AISContext();
if (aContext.IsNull())
return;
+ // Check that the visualized shape is the same and the redisplay is not necessary
+ // Redisplay of AIS object leads to this object selection compute and the selection
+ // in the browser is lost
+ // become
+ ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
+ if (aResult.get() != NULL) {
+ Handle(AIS_Shape) aShapePrs = Handle(AIS_Shape)::DownCast(aAISIO);
+ if (!aShapePrs.IsNull()) {
+ std::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(aResult);
+ const TopoDS_Shape& aShape = aShapePrs->Shape();
+ std::shared_ptr<GeomAPI_Shape> anAISShapePtr(new GeomAPI_Shape());
+ anAISShapePtr->setImpl(new TopoDS_Shape(aShape));
+
+ if (aShapePtr->isEqual(anAISShapePtr))
+ return;
+ }
+ }
aContext->Redisplay(aAISIO, false);
if (isUpdateViewer)
updateViewer();
//myUseExternalObjects = true;
AIS_ListOfInteractive aPrsList;
- displayedObjects(aContext, aPrsList);
+ ::displayedObjects(aContext, aPrsList);
Handle(AIS_Trihedron) aTrihedron;
AIS_ListIteratorOfListOfInteractive aLIt(aPrsList);
//aContext->NotUseDisplayedObjects();
AIS_ListOfInteractive aPrsList;
- displayedObjects(aContext, aPrsList);
+ ::displayedObjects(aContext, aPrsList);
AIS_ListIteratorOfListOfInteractive aLIt;
//Handle(AIS_Trihedron) aTrihedron;
/// Returns number of displayed objects
int objectsCount() const { return myResult2AISObjectMap.size(); }
+ QObjectPtrList displayedObjects() const { return myResult2AISObjectMap.keys(); }
+
+ /// Returns true if the given object can be shown in shaded mode
bool canBeShaded(ObjectPtr theObject) const;
protected: