void SketcherPrs_Collinear::drawLines(const Handle(Prs3d_Presentation)& thePrs,
Quantity_Color theColor) const
{
- Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(thePrs);
+ Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(thePrs);
Handle(Graphic3d_AspectLine3d) aLineAspect =
new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2);
void SketcherPrs_Equal::drawLines(const Handle(Prs3d_Presentation)& thePrs,
Quantity_Color theColor) const
{
- Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(thePrs);
-
- Handle(Graphic3d_AspectLine3d) aLineAspect =
- new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2);
- aGroup->SetPrimitivesAspect(aLineAspect);
-
// Draw first line
ObjectPtr aObj = SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_A());
std::shared_ptr<GeomAPI_Shape> aLine = SketcherPrs_Tools::getShape(aObj);
if (aLine.get() == NULL)
return;
- drawShape(aLine, thePrs);
+ drawShape(aLine, thePrs, theColor);
// Draw second line
aObj = SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_B());
aLine = SketcherPrs_Tools::getShape(aObj);
if (aLine.get() == NULL)
return;
- drawShape(aLine, thePrs);
+ drawShape(aLine, thePrs, theColor);
}
void SketcherPrs_HVDirection::drawLines(const Handle(Prs3d_Presentation)& thePrs,
Quantity_Color theColor) const
{
- Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(thePrs);
+ Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(thePrs);
// Draw constrained object
Handle(Graphic3d_AspectLine3d) aLineAspect =
void SketcherPrs_Middle::drawLines(const Handle(Prs3d_Presentation)& thePrs,
Quantity_Color theColor) const
{
- Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(thePrs);
+ Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(thePrs);
Handle(Graphic3d_AspectLine3d) aLineAspect =
new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2);
ResultPtr aResult = aResults.front();
std::shared_ptr<GeomAPI_Shape> aLine = SketcherPrs_Tools::getShape(aResult);
if (aLine.get() != NULL)
- drawShape(aLine, thePrs);
+ drawShape(aLine, thePrs, theColor);
}
}
else {
std::shared_ptr<GeomAPI_Shape> aLine = SketcherPrs_Tools::getShape(theObject);
if (aLine.get() != NULL)
- drawShape(aLine, thePrs);
+ drawShape(aLine, thePrs, theColor);
}
}
if (aNb != anAttrC->size())
return;
- Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(thePrs);
+ Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(thePrs);
// drawListOfShapes uses myDrawer for attributes definition
Handle(Prs3d_LineAspect) aLnAspect = new Prs3d_LineAspect(theColor, Aspect_TOL_SOLID, 1);
addLine(aGroup, SketchPlugin_Constraint::ENTITY_A());
// Draw source objects
- drawListOfShapes(anAttrB, thePrs);
+ drawListOfShapes(anAttrB, thePrs, theColor);
// draw mirrored objects
- drawListOfShapes(anAttrC, thePrs);
+ drawListOfShapes(anAttrC, thePrs, theColor);
}
void SketcherPrs_Parallel::drawLines(const Handle(Prs3d_Presentation)& thePrs,
Quantity_Color theColor) const
{
- Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(thePrs);
+ Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(thePrs);
Handle(Graphic3d_AspectLine3d) aLineAspect =
new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2);
void SketcherPrs_Perpendicular::drawLines(const Handle(Prs3d_Presentation)& thePrs,
Quantity_Color theColor) const
{
- Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(thePrs);
+ Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(thePrs);
Handle(Graphic3d_AspectLine3d) aLineAspect =
new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2);
if (aShape.get() == NULL)
return;
- Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(thePrs);
- Handle(Graphic3d_AspectLine3d) aLineAspect =
- new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2);
- aGroup->SetPrimitivesAspect(aLineAspect);
-
Handle(Prs3d_PointAspect) aPntAspect = new Prs3d_PointAspect(Aspect_TOM_PLUS, theColor, 1);
myDrawer->SetPointAspect(aPntAspect);
- drawShape(aShape, thePrs);
+ drawShape(aShape, thePrs, theColor);
}
#include <StdPrs_DeflectionCurve.hxx>
#include <StdPrs_Point.hxx>
#include <StdPrs_Curve.hxx>
+#include <Prs3d_LineAspect.hxx>
#include <OpenGl_Element.hxx>
#include <OpenGl_GraphicDriver.hxx>
void SketcherPrs_SymbolPrs::HilightSelected(const Handle(PrsMgr_PresentationManager3d)& thePM,
const SelectMgr_SequenceOfOwner& theOwners)
{
-
Handle( Prs3d_Presentation ) aSelectionPrs = GetSelectPresentation( thePM );
aSelectionPrs->Clear();
drawLines(aSelectionPrs, GetContext()->SelectionStyle()->Color());
//*********************************************************************************
void SketcherPrs_SymbolPrs::drawShape(const std::shared_ptr<GeomAPI_Shape>& theShape,
- const Handle(Prs3d_Presentation)& thePrs) const
+ const Handle(Prs3d_Presentation)& thePrs,
+ Quantity_Color theColor) const
{
+ Handle(Graphic3d_AspectLine3d) aLineAspect =
+ new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2);
+
+ Handle(Prs3d_LineAspect) aLinesStyle = myDrawer->LineAspect();
+ Handle(Graphic3d_AspectLine3d) aOldStyle = aLinesStyle->Aspect();
+ aLinesStyle->SetAspect(aLineAspect);
+ myDrawer->SetLineAspect(aLinesStyle);
+
if (theShape->isEdge()) {
// The shape is edge
std::shared_ptr<GeomAPI_Curve> aCurve =
Handle(Geom_CartesianPoint) aPoint = new Geom_CartesianPoint(aPnt->impl<gp_Pnt>());
StdPrs_Point::Add(thePrs, aPoint, myDrawer);
}
+
+ aLinesStyle->SetAspect(aOldStyle);
+ myDrawer->SetLineAspect(aLinesStyle);
}
//*********************************************************************************
void SketcherPrs_SymbolPrs::drawListOfShapes(
const std::shared_ptr<ModelAPI_AttributeRefList>& theListAttr,
- const Handle(Prs3d_Presentation)& thePrs) const
+ const Handle(Prs3d_Presentation)& thePrs, Quantity_Color theColor) const
{
int aNb = theListAttr->size();
if (aNb == 0)
aObj = theListAttr->object(i);
std::shared_ptr<GeomAPI_Shape> aShape = SketcherPrs_Tools::getShape(aObj);
if (aShape.get() != NULL)
- drawShape(aShape, thePrs);
+ drawShape(aShape, thePrs, theColor);
}
}
/// \param theShape the shape to draw
/// \param thePrs the presentation scene
void drawShape(const std::shared_ptr<GeomAPI_Shape>& theShape,
- const Handle(Prs3d_Presentation)& thePrs) const;
+ const Handle(Prs3d_Presentation)& thePrs, Quantity_Color theColor) const;
/// Draw a list of shapes stored in a RefListAttribute
/// \param theListAttr the attribute of reference3s list
/// \param thePrs the presentation scene
void drawListOfShapes(const std::shared_ptr<ModelAPI_AttributeRefList>& theListAttr,
- const Handle(Prs3d_Presentation)& thePrs) const;
+ const Handle(Prs3d_Presentation)& thePrs, Quantity_Color theColor) const;
protected:
/// Constraint feature
void SketcherPrs_Tangent::drawLines(const Handle(Prs3d_Presentation)& thePrs,
Quantity_Color theColor) const
{
- Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(thePrs);
-
- Handle(Graphic3d_AspectLine3d) aLineAspect =
- new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2);
- aGroup->SetPrimitivesAspect(aLineAspect);
-
ObjectPtr aObj1 = SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_A());
ObjectPtr aObj2 = SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_B());
if ((aShape1.get() == NULL) || (aShape2.get() == NULL))
return;
- drawShape(aShape1, thePrs);
- drawShape(aShape2, thePrs);
+ drawShape(aShape1, thePrs, theColor);
+ drawShape(aShape2, thePrs, theColor);
}
if (anAttrB.get() == NULL)
return;
- Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(thePrs);
-
// drawListOfShapes uses myDrawer for attributes definition
- Handle(Prs3d_LineAspect) aLnAspect = new Prs3d_LineAspect(theColor, Aspect_TOL_SOLID, 1);
- myDrawer->SetLineAspect(aLnAspect);
+ //Handle(Prs3d_LineAspect) aLnAspect = new Prs3d_LineAspect(theColor, Aspect_TOL_SOLID, 1);
+ //myDrawer->SetLineAspect(aLnAspect);
- drawListOfShapes(anAttrB, thePrs);
+ drawListOfShapes(anAttrB, thePrs, theColor);
if (myConstraint->getKind() == SketchPlugin_MultiTranslation::ID()) {
// If it is translation
AttributePoint2DPtr aStart = GeomDataAPI_Point2D::getPoint2D(aData,