Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-22 08:59:09

0001 // Created on: 1996-12-05
0002 // Created by: Flore Lantheaume/Odile Olivier
0003 // Copyright (c) 1996-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _PrsDim_FixRelation_HeaderFile
0018 #define _PrsDim_FixRelation_HeaderFile
0019 
0020 #include <gp_Circ.hxx>
0021 #include <TopoDS_Wire.hxx>
0022 #include <PrsDim_Relation.hxx>
0023 
0024 class Geom_Plane;
0025 
0026 //! Constructs and manages a constraint by a fixed
0027 //! relation between two or more interactive datums. This
0028 //! constraint is represented by a wire from a shape -
0029 //! point, vertex, or edge - in the first datum and a
0030 //! corresponding shape in the second.
0031 //! Warning: This relation is not bound with any kind of parametric
0032 //! constraint : it represents the "status" of an parametric
0033 //! object.
0034 class PrsDim_FixRelation : public PrsDim_Relation
0035 {
0036   DEFINE_STANDARD_RTTIEXT(PrsDim_FixRelation, PrsDim_Relation)
0037 public:
0038   //! initializes the vertex aShape, the
0039   //! plane aPlane and the wire aWire, which connects
0040   //! the two vertices in a fixed relation.
0041   Standard_EXPORT PrsDim_FixRelation(const TopoDS_Shape&            aShape,
0042                                      const occ::handle<Geom_Plane>& aPlane,
0043                                      const TopoDS_Wire&             aWire);
0044 
0045   //! initializes the vertex aShape, the
0046   //! plane aPlane and the wire aWire, the position
0047   //! aPosition, the arrow size anArrowSize and the
0048   //! wire aWire, which connects the two vertices in a fixed relation.
0049   Standard_EXPORT PrsDim_FixRelation(const TopoDS_Shape&            aShape,
0050                                      const occ::handle<Geom_Plane>& aPlane,
0051                                      const TopoDS_Wire&             aWire,
0052                                      const gp_Pnt&                  aPosition,
0053                                      const double                   anArrowSize = 0.01);
0054 
0055   //! initializes the edge aShape and the plane aPlane.
0056   Standard_EXPORT PrsDim_FixRelation(const TopoDS_Shape&            aShape,
0057                                      const occ::handle<Geom_Plane>& aPlane);
0058 
0059   //! initializes the edge aShape, the
0060   //! plane aPlane, the position aPosition and the arrow
0061   //! size anArrowSize.
0062   Standard_EXPORT PrsDim_FixRelation(const TopoDS_Shape&            aShape,
0063                                      const occ::handle<Geom_Plane>& aPlane,
0064                                      const gp_Pnt&                  aPosition,
0065                                      const double                   anArrowSize = 0.01);
0066 
0067   //! Returns the wire which connects vertices in a fixed relation.
0068   const TopoDS_Wire& Wire() { return myWire; }
0069 
0070   //! Constructs the wire aWire. This connects vertices
0071   //! which are in a fixed relation.
0072   void SetWire(const TopoDS_Wire& aWire) { myWire = aWire; }
0073 
0074   //! Returns true if the Interactive Objects in the relation
0075   //! are movable.
0076   bool IsMovable() const override { return true; }
0077 
0078 private:
0079   Standard_EXPORT void Compute(const occ::handle<PrsMgr_PresentationManager>& thePrsMgr,
0080                                const occ::handle<Prs3d_Presentation>&         thePrs,
0081                                const int                                      theMode) override;
0082 
0083   Standard_EXPORT void ComputeSelection(const occ::handle<SelectMgr_Selection>& theSel,
0084                                         const int                               theMode) override;
0085 
0086   //! computes the presentation for <myFixShape> if it's a vertex.
0087   Standard_EXPORT void ComputeVertex(const TopoDS_Vertex& FixVertex, gp_Pnt& curpos);
0088 
0089   Standard_EXPORT gp_Pnt ComputePosition(const occ::handle<Geom_Curve>& curv1,
0090                                          const occ::handle<Geom_Curve>& curv2,
0091                                          const gp_Pnt&                  firstp1,
0092                                          const gp_Pnt&                  lastp1,
0093                                          const gp_Pnt&                  firstp2,
0094                                          const gp_Pnt&                  lastp2) const;
0095 
0096   Standard_EXPORT gp_Pnt ComputePosition(const occ::handle<Geom_Curve>& curv,
0097                                          const gp_Pnt&                  firstp,
0098                                          const gp_Pnt&                  lastp) const;
0099 
0100   //! computes the presentation for <myFixShape> if it's a
0101   //! edge.
0102   Standard_EXPORT void ComputeEdge(const TopoDS_Edge& FixEdge, gp_Pnt& curpos);
0103 
0104   Standard_EXPORT void ComputeLinePosition(const gp_Lin& glin,
0105                                            gp_Pnt&       pos,
0106                                            double&       pfirst,
0107                                            double&       plast);
0108 
0109   Standard_EXPORT void ComputeCirclePosition(const gp_Circ& gcirc,
0110                                              gp_Pnt&        pos,
0111                                              double&        pfirst,
0112                                              double&        plast);
0113 
0114   Standard_EXPORT static bool ConnectedEdges(const TopoDS_Wire&   aWire,
0115                                              const TopoDS_Vertex& aVertex,
0116                                              TopoDS_Edge&         Edge1,
0117                                              TopoDS_Edge&         Edge2);
0118 
0119 private:
0120   TopoDS_Wire myWire;
0121   gp_Pnt      myPntAttach;
0122 };
0123 
0124 #endif // _PrsDim_FixRelation_HeaderFile