Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:40

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 DEFINE_STANDARD_HANDLE(PrsDim_FixRelation, PrsDim_Relation)
0027 
0028 //! Constructs and manages a constraint by a fixed
0029 //! relation between two or more interactive datums. This
0030 //! constraint is represented by a wire from a shape -
0031 //! point, vertex, or edge - in the first datum and a
0032 //! corresponding shape in the second.
0033 //! Warning: This relation is not bound with any kind of parametric
0034 //! constraint : it represents the "status" of an parametric
0035 //! object.
0036 class PrsDim_FixRelation : public PrsDim_Relation
0037 {
0038   DEFINE_STANDARD_RTTIEXT(PrsDim_FixRelation, PrsDim_Relation)
0039 public:
0040   
0041   //! initializes the vertex aShape, the
0042   //! plane aPlane and the wire aWire, which connects
0043   //! the two vertices in a fixed relation.
0044   Standard_EXPORT PrsDim_FixRelation(const TopoDS_Shape& aShape, const Handle(Geom_Plane)& aPlane, const TopoDS_Wire& aWire);
0045   
0046   //! initializes the vertex aShape, the
0047   //! plane aPlane and the wire aWire, the position
0048   //! aPosition, the arrow size anArrowSize and the
0049   //! wire aWire, which connects the two vertices in a fixed relation.
0050   Standard_EXPORT PrsDim_FixRelation(const TopoDS_Shape& aShape, const Handle(Geom_Plane)& aPlane, const TopoDS_Wire& aWire, const gp_Pnt& aPosition, const Standard_Real anArrowSize = 0.01);
0051   
0052   //! initializes the edge aShape and the plane aPlane.
0053   Standard_EXPORT PrsDim_FixRelation(const TopoDS_Shape& aShape, const Handle(Geom_Plane)& aPlane);
0054   
0055   //! initializes the edge aShape, the
0056   //! plane aPlane, the position aPosition and the arrow
0057   //! size anArrowSize.
0058   Standard_EXPORT PrsDim_FixRelation(const TopoDS_Shape& aShape, const Handle(Geom_Plane)& aPlane, const gp_Pnt& aPosition, const Standard_Real anArrowSize = 0.01);
0059   
0060   //! Returns the wire which connects vertices in a fixed relation.
0061   const TopoDS_Wire& Wire() { return myWire; }
0062   
0063   //! Constructs the wire aWire. This connects vertices
0064   //! which are in a fixed relation.
0065   void SetWire (const TopoDS_Wire& aWire) { myWire = aWire; }
0066   
0067   //! Returns true if the Interactive Objects in the relation
0068   //! are movable.
0069   virtual Standard_Boolean IsMovable() const Standard_OVERRIDE { return Standard_True; }
0070 
0071 private:
0072 
0073   Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
0074                                         const Handle(Prs3d_Presentation)& thePrs,
0075                                         const Standard_Integer theMode) Standard_OVERRIDE;
0076 
0077   Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSel,
0078                                                  const Standard_Integer theMode) Standard_OVERRIDE;
0079 
0080   //! computes the presentation for <myFixShape> if it's a vertex.
0081   Standard_EXPORT void ComputeVertex (const TopoDS_Vertex& FixVertex, gp_Pnt& curpos);
0082   
0083   Standard_EXPORT gp_Pnt ComputePosition (const Handle(Geom_Curve)& curv1, const Handle(Geom_Curve)& curv2, const gp_Pnt& firstp1, const gp_Pnt& lastp1, const gp_Pnt& firstp2, const gp_Pnt& lastp2) const;
0084   
0085   Standard_EXPORT gp_Pnt ComputePosition (const Handle(Geom_Curve)& curv, const gp_Pnt& firstp, const gp_Pnt& lastp) const;
0086   
0087   //! computes the presentation for <myFixShape> if it's a
0088   //! edge.
0089   Standard_EXPORT void ComputeEdge (const TopoDS_Edge& FixEdge, gp_Pnt& curpos);
0090   
0091   Standard_EXPORT void ComputeLinePosition (const gp_Lin& glin, gp_Pnt& pos, Standard_Real& pfirst, Standard_Real& plast);
0092   
0093   Standard_EXPORT void ComputeCirclePosition (const gp_Circ& gcirc, gp_Pnt& pos, Standard_Real& pfirst, Standard_Real& plast);
0094   
0095   Standard_EXPORT static Standard_Boolean ConnectedEdges (const TopoDS_Wire& aWire, const TopoDS_Vertex& aVertex, TopoDS_Edge& Edge1, TopoDS_Edge& Edge2);
0096 
0097 private:
0098 
0099   TopoDS_Wire myWire;
0100   gp_Pnt myPntAttach;
0101 
0102 };
0103 
0104 #endif // _PrsDim_FixRelation_HeaderFile