X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPartSet%2FPartSet_ResultSketchPrs.cpp;h=d23125683ca8ae9868af9b340982a876810e5b84;hb=383021cb51c4720904096ca851db5ee79255b402;hp=04d9318eabb70215e7688025b63059ad978b19ed;hpb=917398577a81534c6fb2119ed24960000af29444;p=modules%2Fshaper.git diff --git a/src/PartSet/PartSet_ResultSketchPrs.cpp b/src/PartSet/PartSet_ResultSketchPrs.cpp index 04d9318ea..d23125683 100755 --- a/src/PartSet/PartSet_ResultSketchPrs.cpp +++ b/src/PartSet/PartSet_ResultSketchPrs.cpp @@ -13,11 +13,13 @@ #include #include -#include +#include #include #include +#include + #include #include @@ -61,21 +63,9 @@ PartSet_ResultSketchPrs::PartSet_ResultSketchPrs(ResultPtr theResult) SetAutoHilight(aCompSolid.get() == NULL); } -bool PartSet_ResultSketchPrs::isValidShapeType(const TopAbs_ShapeEnum& theBaseType, - const TopAbs_ShapeEnum& theCheckedType) -{ - bool aValid = theBaseType == theCheckedType; - if (!aValid) { - // currently this functionality is for all, as we have no separate wire selection mode - // lately it should be corrected to have the following check only for sketch presentations - aValid = theBaseType == TopAbs_FACE && theCheckedType == TopAbs_WIRE; - } - return aValid; -} - void PartSet_ResultSketchPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, - const Handle(Prs3d_Presentation)& thePresentation, - const Standard_Integer theMode) + const Handle(Prs3d_Presentation)& thePresentation, + const Standard_Integer theMode) { thePresentation->Clear(); @@ -84,21 +74,21 @@ void PartSet_ResultSketchPrs::Compute(const Handle(PrsMgr_PresentationManager3d) NCollection_List aFaceList; fillShapes(aResultShape, anAuxiliaryCompound, mySketchFaceList); - bool isEmptyPresentation = aResultShape.IsNull() && anAuxiliaryCompound.IsNull(); + bool aReadyToDisplay = !aResultShape.IsNull() || !anAuxiliaryCompound.IsNull(); - if (!aResultShape.IsNull()) { - myOriginalShape = aResultShape; - if (!myOriginalShape.IsNull()) - Set(myOriginalShape); - } - - if (!anAuxiliaryCompound.IsNull()) + if (aReadyToDisplay) { + if (!aResultShape.IsNull()) { + myOriginalShape = aResultShape; + if (!myOriginalShape.IsNull()) + Set(myOriginalShape); + } myAuxiliaryCompound = anAuxiliaryCompound; + } setAuxiliaryPresentationStyle(false); - // change deviation coefficient to provide more precise circle - ModuleBase_Tools::setDefaultDeviationCoefficient(Shape(), Attributes()); + // change deviation coefficient to provide more precise circle + ModuleBase_Tools::setDefaultDeviationCoefficient(myResult, Attributes()); AIS_Shape::Compute(thePresentationManager, thePresentation, theMode); if (!myAuxiliaryCompound.IsNull()) { @@ -108,8 +98,8 @@ void PartSet_ResultSketchPrs::Compute(const Handle(PrsMgr_PresentationManager3d) StdPrs_WFDeflectionShape::Add(thePresentation, myAuxiliaryCompound, aDrawer); } - if (isEmptyPresentation) { - Events_Error::throwException("An empty AIS presentation: PartSet_ResultSketchPrs"); + if (!aReadyToDisplay) { + Events_InfoMessage("PartSet_ResultSketchPrs", "An empty AIS presentation: PartSet_ResultSketchPrs").send(); static const Events_ID anEvent = Events_Loop::eventByName(EVENT_EMPTY_AIS_PRESENTATION); ModelAPI_EventCreator::get()->sendUpdated(myResult, anEvent); } @@ -132,13 +122,21 @@ void debugInfo(const TopoDS_Shape& theShape, const TopAbs_ShapeEnum theType) #endif void PartSet_ResultSketchPrs::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection, - const Standard_Integer aMode) + const Standard_Integer theMode) { - if (aMode > 8) + int aMode = theMode; + + if (aMode > 8 && + aMode != SketcherPrs_Tools::Sel_Sketch_Face && + aMode != SketcherPrs_Tools::Sel_Sketch_Wire) // In order to avoid using custom selection modes return; - if (aMode == AIS_Shape::SelectionMode(TopAbs_FACE)) { + bool aShapeIsChanged = false; + if (aMode == SketcherPrs_Tools::Sel_Sketch_Face || + aMode == SketcherPrs_Tools::Sel_Sketch_Wire) { + aMode = (aMode == SketcherPrs_Tools::Sel_Sketch_Face) ? AIS_Shape::SelectionMode(TopAbs_FACE) + : AIS_Shape::SelectionMode(TopAbs_WIRE); #ifdef DEBUG_WIRE const TopoDS_Shape& aShape = Shape(); debugInfo(aShape, TopAbs_VERTEX); // 24 @@ -154,9 +152,6 @@ void PartSet_ResultSketchPrs::ComputeSelection(const Handle(SelectMgr_Selection) for(NCollection_List::Iterator anIt(mySketchFaceList); anIt.More(); anIt.Next()) { const TopoDS_Shape& aFace = anIt.Value(); aBuilder.Add(aComp, aFace); - // for sketch presentation in the face mode wires should be selectable also - // accoring to #1343 Improvement of Extrusion and Revolution operations - appendShapeSelection(aSelection, aFace, TopAbs_WIRE); } #ifdef DEBUG_WIRE debugInfo(aComp, TopAbs_VERTEX); // 24 @@ -165,18 +160,23 @@ void PartSet_ResultSketchPrs::ComputeSelection(const Handle(SelectMgr_Selection) debugInfo(aComp, TopAbs_FACE); // 2 #endif Set(aComp); - } else + aShapeIsChanged = true; + } + else Set(myOriginalShape); // append auxiliary compound to selection of edges/vertices if (aMode == AIS_Shape::SelectionMode(TopAbs_EDGE) || aMode == AIS_Shape::SelectionMode(TopAbs_VERTEX)) { - bool isVertex = aMode == AIS_Shape::SelectionMode(TopAbs_VERTEX); + bool isVertex = aMode == AIS_Shape::SelectionMode(TopAbs_VERTEX); appendShapeSelection(aSelection, myAuxiliaryCompound, isVertex ? TopAbs_VERTEX : TopAbs_EDGE); } AIS_Shape::ComputeSelection(aSelection, aMode); + + if (aShapeIsChanged) + Set(myOriginalShape); } void PartSet_ResultSketchPrs::appendShapeSelection(const Handle(SelectMgr_Selection)& theSelection, @@ -210,9 +210,9 @@ void PartSet_ResultSketchPrs::setAuxiliaryPresentationStyle(const bool isAuxilia aLineStyle = SketchPlugin_SketchEntity::SKETCH_LINE_STYLE(); } else { - aColor = Config_PropManager::color("Visualization", "sketch_auxiliary_color", - SKETCH_AUXILIARY_COLOR); - aWidth = SketchPlugin_SketchEntity::SKETCH_LINE_WIDTH_AUXILIARY(); + aColor = Config_PropManager::color("Visualization", "result_construction_color", + ModelAPI_ResultConstruction::DEFAULT_COLOR()); + aWidth = PartSet_Tools::getAISDefaultWidth();// default width value aLineStyle = SketchPlugin_SketchEntity::SKETCH_LINE_STYLE_AUXILIARY(); }