Salome HOME
Horisontal and vertical constraints added
[modules/shaper.git] / src / SketcherPrs / SketcherPrs_SymbolPrs.cpp
index 4637f910c08de6a27b2efe79b863997c73aff634..9e051971af61cd2853c8e0ea2b05a2d2ea50719c 100644 (file)
 
 #include <Graphic3d_ArrayOfSegments.hxx>
 
+#include <SelectMgr_Selection.hxx>
+#include <SelectMgr_EntityOwner.hxx>
+#include <Select3D_SensitivePoint.hxx>
+
 
 #ifdef WIN32
 # define FSEP "\\"
@@ -66,7 +70,8 @@ void SketcherPrs_SymbolPrs::prepareAspect()
 
 void SketcherPrs_SymbolPrs::addLine(const Handle(Graphic3d_Group)& theGroup, std::string theAttrName) const
 {
-  std::shared_ptr<GeomAPI_Shape> aLine = SketcherPrs_Tools::getLine(myConstraint, theAttrName);
+  ObjectPtr aObj = SketcherPrs_Tools::getResult(myConstraint, theAttrName);
+  std::shared_ptr<GeomAPI_Shape> aLine = SketcherPrs_Tools::getLine(aObj);
   if (aLine.get() == NULL)
     return;
   std::shared_ptr<GeomAPI_Edge> aEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(aLine));
@@ -79,3 +84,45 @@ void SketcherPrs_SymbolPrs::addLine(const Handle(Graphic3d_Group)& theGroup, std
   aLines->AddVertex(aPnt2->impl<gp_Pnt>());
   theGroup->AddPrimitiveArray(aLines);
 }
+
+void SketcherPrs_SymbolPrs::HilightSelected(const Handle(PrsMgr_PresentationManager3d)& thePM, 
+                                           const SelectMgr_SequenceOfOwner& theOwners)
+{
+
+  Handle( Prs3d_Presentation ) aSelectionPrs = GetSelectPresentation( thePM );
+  aSelectionPrs->Clear();
+  drawLines(aSelectionPrs, Quantity_NOC_WHITE);
+
+  aSelectionPrs->SetDisplayPriority(9);
+  aSelectionPrs->Display();
+  thePM->Highlight(this);
+}
+
+void SketcherPrs_SymbolPrs::HilightOwnerWithColor(const Handle(PrsMgr_PresentationManager3d)& thePM, 
+                                                 const Quantity_NameOfColor theColor, const Handle(SelectMgr_EntityOwner)& theOwner)
+{
+  thePM->Color(this, theColor);
+
+  Handle( Prs3d_Presentation ) aHilightPrs = GetHilightPresentation( thePM );
+  aHilightPrs->Clear();
+  drawLines(aHilightPrs, theColor);
+
+  if (thePM->IsImmediateModeOn())
+    thePM->AddToImmediateList(aHilightPrs);
+}
+
+
+
+void SketcherPrs_SymbolPrs::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
+                                            const Standard_Integer aMode)
+{
+  ClearSelected();
+
+  if (!myPntArray.IsNull()) {
+    Handle(SelectMgr_EntityOwner) aOwn = new SelectMgr_EntityOwner(this);
+    for (int i = 1; i <= myPntArray->VertexNumber(); i++) {
+      Handle(Select3D_SensitivePoint) aSP = new Select3D_SensitivePoint(aOwn, myPntArray->Vertice(i));
+      aSelection->Add(aSP);
+    }
+  }
+}