Salome HOME
Improve tangent presentation
authorvsv <vitaly.smetannikov@opencascade.com>
Tue, 17 Mar 2015 15:16:22 +0000 (18:16 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Tue, 17 Mar 2015 15:16:22 +0000 (18:16 +0300)
src/SketcherPrs/SketcherPrs_Equal.cpp
src/SketcherPrs/SketcherPrs_HVDirection.cpp
src/SketcherPrs/SketcherPrs_Parallel.cpp
src/SketcherPrs/SketcherPrs_Perpendicular.cpp
src/SketcherPrs/SketcherPrs_Rigid.cpp
src/SketcherPrs/SketcherPrs_Tangent.cpp

index e14da56f39e506645ff77e762f3686951c6e7240..d6fa639d9aec9d5a010354210e1e7dccaca129b9 100644 (file)
@@ -8,29 +8,10 @@
 #include "SketcherPrs_Tools.h"
 #include "SketcherPrs_PositionMgr.h"
 
-#include <GeomAPI_Pnt.h>
-
 #include <SketchPlugin_Constraint.h>
 
-#include <AIS_Drawer.hxx>
-#include <gp_Pnt2d.hxx>
-
-#include <Prs3d_PointAspect.hxx>
-#include <Prs3d_Root.hxx>
-#include <Prs3d_LineAspect.hxx>
-
-#include <Graphic3d_MarkerImage.hxx>
-#include <Graphic3d_AspectMarker3d.hxx>
 #include <Graphic3d_AspectLine3d.hxx>
-#include <Graphic3d_ArrayOfSegments.hxx>
-
-#include <Select3D_SensitivePoint.hxx>
-#include <Select3D_SensitiveSegment.hxx>
-
-#include <SelectMgr_SequenceOfOwner.hxx>
-#include <SelectMgr_Selection.hxx>
-#include <SelectMgr_EntityOwner.hxx>
-
+#include <Prs3d_Root.hxx>
 
 
 IMPLEMENT_STANDARD_HANDLE(SketcherPrs_Equal, SketcherPrs_SymbolPrs);
@@ -39,12 +20,12 @@ IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Equal, SketcherPrs_SymbolPrs);
 static Handle(Image_AlienPixMap) MyPixMap;
 
 SketcherPrs_Equal::SketcherPrs_Equal(SketchPlugin_Constraint* theConstraint, 
-                                           const std::shared_ptr<GeomAPI_Ax3>& thePlane) 
+                                     const std::shared_ptr<GeomAPI_Ax3>& thePlane) 
  : SketcherPrs_SymbolPrs(theConstraint, thePlane)
 {
   myPntArray = new Graphic3d_ArrayOfPoints(2);
   myPntArray->AddVertex(0., 0., 0.);
-  myPntArray->AddVertex(0. ,0., 0.);
+  myPntArray->AddVertex(0.0., 0.);
 }  
 
 void SketcherPrs_Equal::Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
index fe083121141a26dd8580267a72999f7b064d1f7d..2c0e892dd0973e70dd28ecab984a2d776c72af9a 100644 (file)
@@ -8,28 +8,10 @@
 #include "SketcherPrs_Tools.h"
 #include "SketcherPrs_PositionMgr.h"
 
-#include <GeomAPI_Pnt.h>
-
 #include <SketchPlugin_Constraint.h>
 
-#include <AIS_Drawer.hxx>
-#include <gp_Pnt2d.hxx>
-
-#include <Prs3d_PointAspect.hxx>
-#include <Prs3d_Root.hxx>
-#include <Prs3d_LineAspect.hxx>
-
-#include <Graphic3d_MarkerImage.hxx>
-#include <Graphic3d_AspectMarker3d.hxx>
 #include <Graphic3d_AspectLine3d.hxx>
-#include <Graphic3d_ArrayOfSegments.hxx>
-
-#include <Select3D_SensitivePoint.hxx>
-#include <Select3D_SensitiveSegment.hxx>
-
-#include <SelectMgr_SequenceOfOwner.hxx>
-#include <SelectMgr_Selection.hxx>
-#include <SelectMgr_EntityOwner.hxx>
+#include <Prs3d_Root.hxx>
 
 
 
index 2736ee169181951f82e156d8c9fd211214cf5e5e..6b7e071946cb9f67986edadae00d4f49ab2b7965 100644 (file)
@@ -8,28 +8,10 @@
 #include "SketcherPrs_Tools.h"
 #include "SketcherPrs_PositionMgr.h"
 
-#include <GeomAPI_Pnt.h>
-
 #include <SketchPlugin_Constraint.h>
 
-#include <AIS_Drawer.hxx>
-#include <gp_Pnt2d.hxx>
-
-#include <Prs3d_PointAspect.hxx>
-#include <Prs3d_Root.hxx>
-#include <Prs3d_LineAspect.hxx>
-
-#include <Graphic3d_MarkerImage.hxx>
-#include <Graphic3d_AspectMarker3d.hxx>
 #include <Graphic3d_AspectLine3d.hxx>
-#include <Graphic3d_ArrayOfSegments.hxx>
-
-#include <Select3D_SensitivePoint.hxx>
-#include <Select3D_SensitiveSegment.hxx>
-
-#include <SelectMgr_SequenceOfOwner.hxx>
-#include <SelectMgr_Selection.hxx>
-#include <SelectMgr_EntityOwner.hxx>
+#include <Prs3d_Root.hxx>
 
 
 
index 5158b932d181f143033f7f5ca29fbe9195019261..d27cf03e57cb1b28e4876ec9d52b7c11ac05f67b 100644 (file)
@@ -8,21 +8,10 @@
 #include "SketcherPrs_Tools.h"
 #include "SketcherPrs_PositionMgr.h"
 
-#include <GeomAPI_Pnt.h>
-
 #include <SketchPlugin_Constraint.h>
 
-#include <AIS_Drawer.hxx>
-#include <gp_Pnt2d.hxx>
-
-#include <Prs3d_PointAspect.hxx>
-#include <Prs3d_Root.hxx>
-#include <Prs3d_LineAspect.hxx>
-
-#include <Graphic3d_MarkerImage.hxx>
-#include <Graphic3d_AspectMarker3d.hxx>
 #include <Graphic3d_AspectLine3d.hxx>
-#include <Graphic3d_ArrayOfSegments.hxx>
+#include <Prs3d_Root.hxx>
 
 
 
index 34c02875139054996100edcf9aaf381b7ea7791f..9c3d812ea7cb26a15695642e78e66fb9a1946ca3 100644 (file)
 #include <AIS_Drawer.hxx>
 #include <gp_Pnt2d.hxx>
 
-#include <Prs3d_PointAspect.hxx>
-#include <Prs3d_Root.hxx>
-#include <Prs3d_LineAspect.hxx>
-
-#include <Graphic3d_MarkerImage.hxx>
-#include <Graphic3d_AspectMarker3d.hxx>
 #include <Graphic3d_AspectLine3d.hxx>
-#include <Graphic3d_ArrayOfSegments.hxx>
-
-#include <Select3D_SensitivePoint.hxx>
-#include <Select3D_SensitiveSegment.hxx>
-
-#include <SelectMgr_SequenceOfOwner.hxx>
-#include <SelectMgr_Selection.hxx>
-#include <SelectMgr_EntityOwner.hxx>
+#include <Prs3d_Root.hxx>
 
 #include <GeomAdaptor_Curve.hxx>
 #include <BRep_Tool.hxx>
index 4d13a6535cc7fe824dd9c231f758c0437bff7d98..d41d5dc1b3923cb528d91692324549114a8880b7 100644 (file)
@@ -8,29 +8,14 @@
 #include "SketcherPrs_Tools.h"
 #include "SketcherPrs_PositionMgr.h"
 
-#include <GeomAPI_Pnt.h>
+#include <GeomAPI_Curve.h>
 
 #include <SketchPlugin_Constraint.h>
 
-#include <AIS_Drawer.hxx>
-#include <gp_Pnt2d.hxx>
-
-#include <Prs3d_PointAspect.hxx>
+#include <GeomAdaptor_Curve.hxx>
 #include <Prs3d_Root.hxx>
-#include <Prs3d_LineAspect.hxx>
-
-#include <Graphic3d_MarkerImage.hxx>
-#include <Graphic3d_AspectMarker3d.hxx>
 #include <Graphic3d_AspectLine3d.hxx>
-#include <Graphic3d_ArrayOfSegments.hxx>
-
-#include <Select3D_SensitivePoint.hxx>
-#include <Select3D_SensitiveSegment.hxx>
-
-#include <SelectMgr_SequenceOfOwner.hxx>
-#include <SelectMgr_Selection.hxx>
-#include <SelectMgr_EntityOwner.hxx>
-
+#include <StdPrs_DeflectionCurve.hxx>
 
 
 IMPLEMENT_STANDARD_HANDLE(SketcherPrs_Tangent, SketcherPrs_SymbolPrs);
@@ -82,7 +67,25 @@ void SketcherPrs_Tangent::drawLines(const Handle(Prs3d_Presentation)& thePrs, Qu
   Handle(Graphic3d_AspectLine3d) aLineAspect = new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2);
   aGroup->SetPrimitivesAspect(aLineAspect);
 
-  addLine(aGroup, SketchPlugin_Constraint::ENTITY_A());
-  addLine(aGroup, SketchPlugin_Constraint::ENTITY_B());
+  ObjectPtr aObj1 = SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_A());
+  ObjectPtr aObj2 = SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_B());
+
+  std::shared_ptr<GeomAPI_Shape> aShape1 = SketcherPrs_Tools::getShape(aObj1);
+  std::shared_ptr<GeomAPI_Shape> aShape2 = SketcherPrs_Tools::getShape(aObj2);
+
+  if ((aShape1.get() == NULL) || (aShape2.get() == NULL))
+    return;
+
+  std::shared_ptr<GeomAPI_Curve> aCurve1 = std::shared_ptr<GeomAPI_Curve>(new GeomAPI_Curve(aShape1));
+  std::shared_ptr<GeomAPI_Curve> aCurve2 = std::shared_ptr<GeomAPI_Curve>(new GeomAPI_Curve(aShape2));
+  if (aCurve1->isLine()) {
+    addLine(aGroup, SketchPlugin_Constraint::ENTITY_A());
+    GeomAdaptor_Curve aAdaptor(aCurve2->impl<Handle(Geom_Curve)>(), aCurve2->startParam(), aCurve2->endParam());
+    StdPrs_DeflectionCurve::Add(thePrs,aAdaptor,myDrawer);
+  } else {
+    addLine(aGroup, SketchPlugin_Constraint::ENTITY_B());
+    GeomAdaptor_Curve aAdaptor(aCurve1->impl<Handle(Geom_Curve)>(), aCurve1->startParam(), aCurve1->endParam());
+    StdPrs_DeflectionCurve::Add(thePrs,aAdaptor,myDrawer);
+  }
 }