Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-26 09:04:34

0001 // Created on: 1998-06-09
0002 // Created by: data exchange team
0003 // Copyright (c) 1998-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 _ShapeBuild_Edge_HeaderFile
0018 #define _ShapeBuild_Edge_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 class TopoDS_Edge;
0025 class TopoDS_Vertex;
0026 class TopoDS_Face;
0027 class Geom_Surface;
0028 class TopLoc_Location;
0029 class Geom2d_Curve;
0030 class gp_Trsf2d;
0031 class Geom_Curve;
0032 
0033 //! This class provides low-level operators for building an edge
0034 //! 3d curve, copying edge with replaced vertices etc.
0035 class ShapeBuild_Edge
0036 {
0037 public:
0038   DEFINE_STANDARD_ALLOC
0039 
0040   //! Copy edge and replace one or both its vertices to a given
0041   //! one(s). Vertex V1 replaces FORWARD vertex, and V2 - REVERSED,
0042   //! as they are found by TopoDS_Iterator.
0043   //! If V1 or V2 is NULL, the original vertex is taken
0044   Standard_EXPORT TopoDS_Edge CopyReplaceVertices(const TopoDS_Edge&   edge,
0045                                                   const TopoDS_Vertex& V1,
0046                                                   const TopoDS_Vertex& V2) const;
0047 
0048   //! Copies ranges for curve3d and all common pcurves from
0049   //! edge <fromedge> into edge <toedge>.
0050   Standard_EXPORT void CopyRanges(const TopoDS_Edge& toedge,
0051                                   const TopoDS_Edge& fromedge,
0052                                   const double       alpha = 0,
0053                                   const double       beta  = 1) const;
0054 
0055   //! Sets range on 3d curve only.
0056   Standard_EXPORT void SetRange3d(const TopoDS_Edge& edge,
0057                                   const double       first,
0058                                   const double       last) const;
0059 
0060   //! Makes a copy of pcurves from edge <fromedge> into edge
0061   //! <toedge>. Pcurves which are already present in <toedge>,
0062   //! are replaced by copies, other are copied. Ranges are also
0063   //! copied.
0064   Standard_EXPORT void CopyPCurves(const TopoDS_Edge& toedge, const TopoDS_Edge& fromedge) const;
0065 
0066   //! Make a copy of <edge> by call to CopyReplaceVertices()
0067   //! (i.e. construct new TEdge with the same pcurves and vertices).
0068   //! If <sharepcurves> is False, pcurves are also replaced by
0069   //! their copies with help of method CopyPCurves
0070   Standard_EXPORT TopoDS_Edge Copy(const TopoDS_Edge& edge, const bool sharepcurves = true) const;
0071 
0072   //! Removes the PCurve(s) which could be recorded in an Edge for
0073   //! the given Face
0074   Standard_EXPORT void RemovePCurve(const TopoDS_Edge& edge, const TopoDS_Face& face) const;
0075 
0076   //! Removes the PCurve(s) which could be recorded in an Edge for
0077   //! the given Surface
0078   Standard_EXPORT void RemovePCurve(const TopoDS_Edge&               edge,
0079                                     const occ::handle<Geom_Surface>& surf) const;
0080 
0081   //! Removes the PCurve(s) which could be recorded in an Edge for
0082   //! the given Surface, with given Location
0083   Standard_EXPORT void RemovePCurve(const TopoDS_Edge&               edge,
0084                                     const occ::handle<Geom_Surface>& surf,
0085                                     const TopLoc_Location&           loc) const;
0086 
0087   //! Replace the PCurve in an Edge for the given Face
0088   //! In case if edge is seam, i.e. has 2 pcurves on that face,
0089   //! only pcurve corresponding to the orientation of the edge is
0090   //! replaced
0091   Standard_EXPORT void ReplacePCurve(const TopoDS_Edge&               edge,
0092                                      const occ::handle<Geom2d_Curve>& pcurve,
0093                                      const TopoDS_Face&               face) const;
0094 
0095   //! Reassign edge pcurve lying on face <old> to another face <sub>.
0096   //! If edge has two pcurves on <old> face, only one of them will be
0097   //! reassigned, and other will left alone. Similarly, if edge already
0098   //! had a pcurve on face <sub>, it will have two pcurves on it.
0099   //! Returns True if succeeded, False if no pcurve lying on <old> found.
0100   Standard_EXPORT bool ReassignPCurve(const TopoDS_Edge& edge,
0101                                       const TopoDS_Face& old,
0102                                       const TopoDS_Face& sub) const;
0103 
0104   //! Transforms the PCurve with given matrix and affinity U factor.
0105   Standard_EXPORT occ::handle<Geom2d_Curve> TransformPCurve(const occ::handle<Geom2d_Curve>& pcurve,
0106                                                             const gp_Trsf2d&                 trans,
0107                                                             const double                     uFact,
0108                                                             double&                          aFirst,
0109                                                             double& aLast) const;
0110 
0111   //! Removes the Curve3D recorded in an Edge
0112   Standard_EXPORT void RemoveCurve3d(const TopoDS_Edge& edge) const;
0113 
0114   //! Calls BRepTools::BuildCurve3D
0115   Standard_EXPORT bool BuildCurve3d(const TopoDS_Edge& edge) const;
0116 
0117   //! Makes edge with curve and location
0118   Standard_EXPORT void MakeEdge(TopoDS_Edge&                   edge,
0119                                 const occ::handle<Geom_Curve>& curve,
0120                                 const TopLoc_Location&         L) const;
0121 
0122   //! Makes edge with curve, location and range [p1, p2]
0123   Standard_EXPORT void MakeEdge(TopoDS_Edge&                   edge,
0124                                 const occ::handle<Geom_Curve>& curve,
0125                                 const TopLoc_Location&         L,
0126                                 const double                   p1,
0127                                 const double                   p2) const;
0128 
0129   //! Makes edge with pcurve and face
0130   Standard_EXPORT void MakeEdge(TopoDS_Edge&                     edge,
0131                                 const occ::handle<Geom2d_Curve>& pcurve,
0132                                 const TopoDS_Face&               face) const;
0133 
0134   //! Makes edge with pcurve, face and range [p1, p2]
0135   Standard_EXPORT void MakeEdge(TopoDS_Edge&                     edge,
0136                                 const occ::handle<Geom2d_Curve>& pcurve,
0137                                 const TopoDS_Face&               face,
0138                                 const double                     p1,
0139                                 const double                     p2) const;
0140 
0141   //! Makes edge with pcurve, surface and location
0142   Standard_EXPORT void MakeEdge(TopoDS_Edge&                     edge,
0143                                 const occ::handle<Geom2d_Curve>& pcurve,
0144                                 const occ::handle<Geom_Surface>& S,
0145                                 const TopLoc_Location&           L) const;
0146 
0147   //! Makes edge with pcurve, surface, location and range [p1, p2]
0148   Standard_EXPORT void MakeEdge(TopoDS_Edge&                     edge,
0149                                 const occ::handle<Geom2d_Curve>& pcurve,
0150                                 const occ::handle<Geom_Surface>& S,
0151                                 const TopLoc_Location&           L,
0152                                 const double                     p1,
0153                                 const double                     p2) const;
0154 };
0155 
0156 #endif // _ShapeBuild_Edge_HeaderFile