]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Set point presentation as '+' by default
authorvsv <vitaly.smetannikov@opencascade.com>
Wed, 1 Jul 2015 09:23:08 +0000 (12:23 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Wed, 1 Jul 2015 09:23:19 +0000 (12:23 +0300)
src/ConstructionPlugin/ConstructionPlugin_Point.cpp
src/ModuleBase/ModuleBase_ResultPrs.cpp
src/SketchPlugin/SketchPlugin_SketchEntity.h
src/SketcherPrs/SketcherPrs_Transformation.cpp

index 9bca1063cb4d08a760949383d07fc890bba34749..c164e44a40225855d89111b0ed14b17be1a45e2e 100644 (file)
@@ -52,6 +52,6 @@ bool ConstructionPlugin_Point::customisePresentation(ResultPtr theResult,
 {
   bool isCustomized = theDefaultPrs.get() != NULL &&
                       theDefaultPrs->customisePresentation(theResult, thePrs, theDefaultPrs);
-  thePrs->setPointMarker(1, 1.); // Set point as a '+' symbol
+  //thePrs->setPointMarker(1, 1.); // Set point as a '+' symbol
   return true;
 }
index 29648d9b255aa304681681d75efb60a0e1bb93f2..5dd2f536b8a825107dd5961046d5ffb3fd8665b0 100644 (file)
@@ -11,6 +11,8 @@
 #include <GeomAPI_PlanarEdges.h>
 
 #include <BRep_Builder.hxx>
+#include <Prs3d_Drawer.hxx>
+#include <Prs3d_PointAspect.hxx>
 #include <Prs3d_IsoAspect.hxx>
 #include <TopoDS_Builder.hxx>
 
@@ -30,7 +32,15 @@ ModuleBase_ResultPrs::ModuleBase_ResultPrs(ResultPtr theResult)
       myIsSketchMode = true;
     }
   }
-  Set(aShapePtr->impl<TopoDS_Shape>());
+  TopoDS_Shape aShape = aShapePtr->impl<TopoDS_Shape>();
+  Set(aShape);
+  if (aShape.ShapeType() == TopAbs_VERTEX) {
+    Handle(Prs3d_Drawer) aDrawer = Attributes();
+    if (aDrawer->HasOwnPointAspect()) 
+      aDrawer->PointAspect()->SetTypeOfMarker(Aspect_TOM_PLUS);
+    else
+      aDrawer->SetPointAspect(new Prs3d_PointAspect(Aspect_TOM_PLUS, Quantity_NOC_YELLOW, 1.));
+  }
 }
 
 
index 19bc0428cf82f6dfd2284bb1f6b2ee996786e2e9..cffdee549483e335a54c19f171fbaa17ef9a1717 100644 (file)
@@ -98,9 +98,9 @@ class SketchPlugin_SketchEntity : public SketchPlugin_Feature, public GeomAPI_IC
         isCustomized = thePrs->setLineStyle(0) || isCustomized;
       }
     }
-    else if (aShapeType == 7) { // otherwise this is a vertex
-      thePrs->setPointMarker(1, 1.); // Set point as a '+' symbol
-    }
+    //else if (aShapeType == 7) { // otherwise this is a vertex
+    //  thePrs->setPointMarker(1, 1.); // Set point as a '+' symbol
+    //}
     return isCustomized;
   }
 
index dcbe96667a82d537539bf8b6d19d67c5d492264b..280d14e34b3dc1201a70ac1bb5c3a236beb40ffa 100644 (file)
@@ -9,10 +9,16 @@
 #include "SketcherPrs_PositionMgr.h"
 
 #include <SketchPlugin_Constraint.h>
+#include <SketchPlugin_MultiTranslation.h>
+#include <SketchPlugin_MultiRotation.h>
 #include <ModelAPI_AttributeRefList.h>
+#include <GeomDataAPI_Point2D.h>
 
 #include <Graphic3d_AspectLine3d.hxx>
 #include <Prs3d_Root.hxx>
+#include <Geom_CartesianPoint.hxx>
+#include <gp_Pnt.hxx>
+#include <StdPrs_Point.hxx>
 
 
 
@@ -67,5 +73,29 @@ void SketcherPrs_Transformation::drawLines(const Handle(Prs3d_Presentation)& the
   aGroup->SetPrimitivesAspect(aLineAspect);
 
   drawListOfShapes(anAttrB, thePrs);
+  if (myConstraint->getKind() == SketchPlugin_MultiTranslation::ID()) {
+    std::shared_ptr<GeomDataAPI_Point2D> aStart = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+        aData->attribute(SketchPlugin_MultiTranslation::START_POINT_ID()));
+    std::shared_ptr<GeomDataAPI_Point2D> aEnd = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+        aData->attribute(SketchPlugin_MultiTranslation::END_POINT_ID()));
+  
+    if (aStart.get() && aEnd.get() && aStart->isInitialized() && aEnd->isInitialized()) {
+      std::shared_ptr<GeomAPI_Pnt> aPnt = myPlane->to3D(aStart->x(), aStart->y());
+      Handle(Geom_CartesianPoint) aPoint = new Geom_CartesianPoint(aPnt->impl<gp_Pnt>());
+      StdPrs_Point::Add(thePrs, aPoint, myDrawer);
+
+      aPnt = myPlane->to3D(aEnd->x(), aEnd->y());
+      aPoint = new Geom_CartesianPoint(aPnt->impl<gp_Pnt>());
+      StdPrs_Point::Add(thePrs, aPoint, myDrawer);
+    }
+  } else if (myConstraint->getKind() == SketchPlugin_MultiRotation::ID()) {
+    std::shared_ptr<GeomDataAPI_Point2D> aCenter = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+        aData->attribute(SketchPlugin_MultiRotation::CENTER_ID()));
+    if (aCenter.get() && aCenter->isInitialized()) {
+      std::shared_ptr<GeomAPI_Pnt> aPnt = myPlane->to3D(aCenter->x(), aCenter->y());
+      Handle(Geom_CartesianPoint) aPoint = new Geom_CartesianPoint(aPnt->impl<gp_Pnt>());
+      StdPrs_Point::Add(thePrs, aPoint, myDrawer);
+    }
+  }
 }