1 // Created on: 1993-03-24
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _Geom2d_Geometry_HeaderFile
18 #define _Geom2d_Geometry_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <Standard_Transient.hxx>
24 #include <Standard_Real.hxx>
25 class Standard_ConstructionError;
32 class Geom2d_Geometry;
33 DEFINE_STANDARD_HANDLE(Geom2d_Geometry, Standard_Transient)
36 //! The general abstract class Geometry in 2D space describes
37 //! the common behaviour of all the geometric entities.
39 //! All the objects derived from this class can be move with a
40 //! geometric transformation. Only the transformations which
41 //! doesn't modify the nature of the geometry are available in
43 //! The method Transform which defines a general transformation
44 //! is deferred. The other specifics transformations used the
46 //! All the following transformations modify the object itself.
48 //! Only transformations which do not modify the nature
49 //! of the geometry can be applied to Geom2d objects:
50 //! this is the case with translations, rotations,
51 //! symmetries and scales; this is also the case with
52 //! gp_Trsf2d composite transformations which are
53 //! used to define the geometric transformations applied
54 //! using the Transform or Transformed functions.
55 //! Note: Geometry defines the "prototype" of the
56 //! abstract method Transform which is defined for each
57 //! concrete type of derived object. All other
58 //! transformations are implemented using the Transform method.
59 class Geom2d_Geometry : public Standard_Transient
65 //! Performs the symmetrical transformation of a Geometry
66 //! with respect to the point P which is the center of the
67 //! symmetry and assigns the result to this geometric object.
68 Standard_EXPORT void Mirror (const gp_Pnt2d& P);
70 //! Performs the symmetrical transformation of a Geometry
71 //! with respect to an axis placement which is the axis of the symmetry.
72 Standard_EXPORT void Mirror (const gp_Ax2d& A);
74 //! Rotates a Geometry. P is the center of the rotation.
75 //! Ang is the angular value of the rotation in radians.
76 Standard_EXPORT void Rotate (const gp_Pnt2d& P, const Standard_Real Ang);
78 //! Scales a Geometry. S is the scaling value.
79 Standard_EXPORT void Scale (const gp_Pnt2d& P, const Standard_Real S);
81 //! Translates a Geometry. V is the vector of the tanslation.
82 Standard_EXPORT void Translate (const gp_Vec2d& V);
84 //! Translates a Geometry from the point P1 to the point P2.
85 Standard_EXPORT void Translate (const gp_Pnt2d& P1, const gp_Pnt2d& P2);
87 //! Transformation of a geometric object. This tansformation
88 //! can be a translation, a rotation, a symmetry, a scaling
89 //! or a complex transformation obtained by combination of
90 //! the previous elementaries transformations.
91 //! (see class Transformation of the package Geom2d).
92 //! The following transformations have the same properties
93 //! as the previous ones but they don't modified the object
94 //! itself. A copy of the object is returned.
95 Standard_EXPORT virtual void Transform (const gp_Trsf2d& T) = 0;
97 Standard_NODISCARD Standard_EXPORT Handle(Geom2d_Geometry) Mirrored (const gp_Pnt2d& P) const;
99 Standard_NODISCARD Standard_EXPORT Handle(Geom2d_Geometry) Mirrored (const gp_Ax2d& A) const;
101 Standard_NODISCARD Standard_EXPORT Handle(Geom2d_Geometry) Rotated (const gp_Pnt2d& P, const Standard_Real Ang) const;
103 Standard_NODISCARD Standard_EXPORT Handle(Geom2d_Geometry) Scaled (const gp_Pnt2d& P, const Standard_Real S) const;
105 Standard_NODISCARD Standard_EXPORT Handle(Geom2d_Geometry) Transformed (const gp_Trsf2d& T) const;
107 Standard_NODISCARD Standard_EXPORT Handle(Geom2d_Geometry) Translated (const gp_Vec2d& V) const;
109 Standard_NODISCARD Standard_EXPORT Handle(Geom2d_Geometry) Translated (const gp_Pnt2d& P1, const gp_Pnt2d& P2) const;
111 Standard_EXPORT virtual Handle(Geom2d_Geometry) Copy() const = 0;
113 //! Dumps the content of me into the stream
114 Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
119 DEFINE_STANDARD_RTTIEXT(Geom2d_Geometry,Standard_Transient)
139 #endif // _Geom2d_Geometry_HeaderFile