SET(PROJECT_HEADERS
SketcherPrs.h
SketcherPrs_Coincident.h
+ SketcherPrs_Collinear.h
SketcherPrs_Factory.h
SketcherPrs_Parallel.h
SketcherPrs_Tools.h
SketcherPrs_SensitivePoint.h
SketcherPrs_Radius.h
SketcherPrs_LengthDimension.h
+ SketcherPrs_Middle.h
SketcherPrs_Mirror.h
SketcherPrs_Transformation.h
SketcherPrs_Angle.h
SET(PROJECT_SOURCES
SketcherPrs_Coincident.cpp
+ SketcherPrs_Collinear.cpp
SketcherPrs_Factory.cpp
SketcherPrs_Parallel.cpp
SketcherPrs_Tools.cpp
SketcherPrs_SensitivePoint.cpp
SketcherPrs_Radius.cpp
SketcherPrs_LengthDimension.cpp
+ SketcherPrs_Middle.cpp
SketcherPrs_Mirror.cpp
SketcherPrs_Transformation.cpp
SketcherPrs_Angle.cpp
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: SketcherPrs_Collinear.cpp
+// Created: 29 February 2016
+// Author: Natalia ERMOLAEVA
+
+#include "SketcherPrs_Collinear.h"
+#include "SketcherPrs_Tools.h"
+#include "SketcherPrs_PositionMgr.h"
+
+#include <SketchPlugin_Constraint.h>
+
+#include "Events_Error.h"
+
+#include <Graphic3d_AspectLine3d.hxx>
+#include <Prs3d_Root.hxx>
+
+
+IMPLEMENT_STANDARD_HANDLE(SketcherPrs_Collinear, SketcherPrs_SymbolPrs);
+IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Collinear, SketcherPrs_SymbolPrs);
+
+static Handle(Image_AlienPixMap) MyPixMap;
+
+SketcherPrs_Collinear::SketcherPrs_Collinear(ModelAPI_Feature* theConstraint,
+ 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.);
+}
+
+bool SketcherPrs_Collinear::IsReadyToDisplay(ModelAPI_Feature* theConstraint,
+ const std::shared_ptr<GeomAPI_Ax3>&/* thePlane*/)
+{
+ bool aReadyToDisplay = false;
+
+ ObjectPtr aObj1 = SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_A());
+ ObjectPtr aObj2 = SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_B());
+
+ aReadyToDisplay = SketcherPrs_Tools::getShape(aObj1).get() != NULL &&
+ SketcherPrs_Tools::getShape(aObj2).get() != NULL;
+
+ return aReadyToDisplay;
+}
+
+bool SketcherPrs_Collinear::updatePoints(double theStep) const
+{
+ if (!IsReadyToDisplay(myConstraint, myPlane))
+ return false;
+
+ ObjectPtr aObj1 = SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_A());
+ ObjectPtr aObj2 = SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_B());
+
+ // Set points of the presentation
+ SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get();
+ gp_Pnt aP1 = aMgr->getPosition(aObj1, this, theStep);
+ gp_Pnt aP2 = aMgr->getPosition(aObj2, this, theStep);
+ myPntArray->SetVertice(1, aP1);
+ myPntArray->SetVertice(2, aP2);
+ return true;
+}
+
+void SketcherPrs_Collinear::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);
+
+ // 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);
+}
+
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: SketcherPrs_Collinear.h
+// Created: 29 February 2016
+// Author: Natalia ERMOLAEVA
+
+#ifndef SketcherPrs_Collinear_H
+#define SketcherPrs_Collinear_H
+
+#include "SketcherPrs_SymbolPrs.h"
+
+
+DEFINE_STANDARD_HANDLE(SketcherPrs_Collinear, SketcherPrs_SymbolPrs)
+
+/**
+* \ingroup GUI
+* A redefinition of standard AIS Interactive Object in order to provide
+* presentation of Equal constraint
+*/
+class SketcherPrs_Collinear: public SketcherPrs_SymbolPrs
+{
+public:
+ /// Constructor
+ /// \param theConstraint a constraint feature
+ /// \param thePlane a coordinate plane of current sketch
+ Standard_EXPORT SketcherPrs_Collinear(ModelAPI_Feature* theConstraint,
+ const std::shared_ptr<GeomAPI_Ax3>& thePlane);
+ DEFINE_STANDARD_RTTI(SketcherPrs_Collinear)
+
+ /// Returns true if the constraint feature arguments are correcly filled to build AIS presentation
+ /// \param theConstraint a constraint feature
+ /// \param thePlane a coordinate plane of current sketch
+ /// \return boolean result value
+ static bool IsReadyToDisplay(ModelAPI_Feature* theConstraint,
+ const std::shared_ptr<GeomAPI_Ax3>& thePlane);
+protected:
+
+ virtual const char* iconName() const { return "equal.png"; }
+
+ virtual void drawLines(const Handle(Prs3d_Presentation)& thePrs, Quantity_Color theColor) const;
+
+ /// Update myPntArray according to presentation positions
+ /// \return true in case of success
+ virtual bool updatePoints(double theStep) const;
+};
+
+#endif
\ No newline at end of file
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: SketcherPrs_Middle.cpp
+// Created: 29 February 2016
+// Author: Natalia ERMOLAEVA
+
+#include "SketcherPrs_Middle.h"
+#include "SketcherPrs_Tools.h"
+#include "SketcherPrs_PositionMgr.h"
+
+#include <SketchPlugin_Constraint.h>
+
+#include "Events_Error.h"
+
+#include <Graphic3d_AspectLine3d.hxx>
+#include <Prs3d_Root.hxx>
+
+
+IMPLEMENT_STANDARD_HANDLE(SketcherPrs_Middle, SketcherPrs_SymbolPrs);
+IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Middle, SketcherPrs_SymbolPrs);
+
+static Handle(Image_AlienPixMap) MyPixMap;
+
+SketcherPrs_Middle::SketcherPrs_Middle(ModelAPI_Feature* theConstraint,
+ 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.);
+}
+
+bool SketcherPrs_Middle::IsReadyToDisplay(ModelAPI_Feature* theConstraint,
+ const std::shared_ptr<GeomAPI_Ax3>&/* thePlane*/)
+{
+ bool aReadyToDisplay = false;
+
+ ObjectPtr aObj1 = SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_A());
+ ObjectPtr aObj2 = SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_B());
+
+ aReadyToDisplay = SketcherPrs_Tools::getShape(aObj1).get() != NULL &&
+ SketcherPrs_Tools::getShape(aObj2).get() != NULL;
+
+ return aReadyToDisplay;
+}
+
+bool SketcherPrs_Middle::updatePoints(double theStep) const
+{
+ if (!IsReadyToDisplay(myConstraint, myPlane))
+ return false;
+
+ ObjectPtr aObj1 = SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_A());
+ ObjectPtr aObj2 = SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_B());
+
+ // Set points of the presentation
+ SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get();
+ gp_Pnt aP1 = aMgr->getPosition(aObj1, this, theStep);
+ gp_Pnt aP2 = aMgr->getPosition(aObj2, this, theStep);
+ myPntArray->SetVertice(1, aP1);
+ myPntArray->SetVertice(2, aP2);
+ return true;
+}
+
+void SketcherPrs_Middle::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);
+
+ // 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);
+}
+
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: SketcherPrs_Middle.h
+// Created: 29 February 2016
+// Author: Natalia ERMOLAEVA
+
+#ifndef SketcherPrs_Middle_H
+#define SketcherPrs_Middle_H
+
+#include "SketcherPrs_SymbolPrs.h"
+
+
+DEFINE_STANDARD_HANDLE(SketcherPrs_Middle, SketcherPrs_SymbolPrs)
+
+/**
+* \ingroup GUI
+* A redefinition of standard AIS Interactive Object in order to provide
+* presentation of Equal constraint
+*/
+class SketcherPrs_Middle: public SketcherPrs_SymbolPrs
+{
+public:
+ /// Constructor
+ /// \param theConstraint a constraint feature
+ /// \param thePlane a coordinate plane of current sketch
+ Standard_EXPORT SketcherPrs_Middle(ModelAPI_Feature* theConstraint,
+ const std::shared_ptr<GeomAPI_Ax3>& thePlane);
+ DEFINE_STANDARD_RTTI(SketcherPrs_Middle)
+
+ /// Returns true if the constraint feature arguments are correcly filled to build AIS presentation
+ /// \param theConstraint a constraint feature
+ /// \param thePlane a coordinate plane of current sketch
+ /// \return boolean result value
+ static bool IsReadyToDisplay(ModelAPI_Feature* theConstraint,
+ const std::shared_ptr<GeomAPI_Ax3>& thePlane);
+protected:
+
+ virtual const char* iconName() const { return "equal.png"; }
+
+ virtual void drawLines(const Handle(Prs3d_Presentation)& thePrs, Quantity_Color theColor) const;
+
+ /// Update myPntArray according to presentation positions
+ /// \return true in case of success
+ virtual bool updatePoints(double theStep) const;
+};
+
+#endif
\ No newline at end of file