1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: SketcherPrs_HVDirection.cpp
4 // Created: 16 February 2015
5 // Author: Vitaly SMETANNIKOV
7 #include "SketcherPrs_HVDirection.h"
8 #include "SketcherPrs_Tools.h"
9 #include "SketcherPrs_PositionMgr.h"
11 #include <GeomAPI_Pnt.h>
13 #include <SketchPlugin_Constraint.h>
15 #include <AIS_Drawer.hxx>
16 #include <gp_Pnt2d.hxx>
18 #include <Prs3d_PointAspect.hxx>
19 #include <Prs3d_Root.hxx>
20 #include <Prs3d_LineAspect.hxx>
22 #include <Graphic3d_MarkerImage.hxx>
23 #include <Graphic3d_AspectMarker3d.hxx>
24 #include <Graphic3d_AspectLine3d.hxx>
25 #include <Graphic3d_ArrayOfSegments.hxx>
27 #include <Select3D_SensitivePoint.hxx>
28 #include <Select3D_SensitiveSegment.hxx>
30 #include <SelectMgr_SequenceOfOwner.hxx>
31 #include <SelectMgr_Selection.hxx>
32 #include <SelectMgr_EntityOwner.hxx>
35 extern std::shared_ptr<GeomAPI_Pnt2d> getFeaturePoint(DataPtr theData,
36 const std::string& theAttribute);
39 IMPLEMENT_STANDARD_HANDLE(SketcherPrs_HVDirection, SketcherPrs_SymbolPrs);
40 IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_HVDirection, SketcherPrs_SymbolPrs);
42 static Handle(Image_AlienPixMap) MyPixMap;
44 SketcherPrs_HVDirection::SketcherPrs_HVDirection(SketchPlugin_Constraint* theConstraint,
45 const std::shared_ptr<GeomAPI_Ax3>& thePlane,
47 : SketcherPrs_SymbolPrs(theConstraint, thePlane), myIsHorisontal(isHorisontal)
49 myPntArray = new Graphic3d_ArrayOfPoints(1);
50 myPntArray->AddVertex(0., 0., 0.);
53 void SketcherPrs_HVDirection::Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
54 const Handle(Prs3d_Presentation)& thePresentation,
55 const Standard_Integer theMode)
59 ObjectPtr aObj1 = SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_A());
60 std::shared_ptr<GeomAPI_Shape> aLine1 = SketcherPrs_Tools::getShape(aObj1);
61 if (aLine1.get() == NULL)
64 SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get();
65 gp_Pnt aP1 = aMgr->getPosition(aObj1, this);
67 Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(thePresentation);
68 aGroup->SetPrimitivesAspect(myAspect);
69 myPntArray->SetVertice(1, aP1);
70 aGroup->AddPrimitiveArray(myPntArray);
73 void SketcherPrs_HVDirection::drawLines(const Handle(Prs3d_Presentation)& thePrs, Quantity_Color theColor) const
75 Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(thePrs);
77 Handle(Graphic3d_AspectLine3d) aLineAspect = new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2);
78 aGroup->SetPrimitivesAspect(aLineAspect);
80 addLine(aGroup, SketchPlugin_Constraint::ENTITY_A());