
Wed, 01/12/2022 - 09:52
Example
in the source code , using such as example:
Geom_Geometry < ---- Geom_Surface < ---- Geom_SweptSurface < ---- Geom_SurfaceOfRevolution
Detail
Geom_Geometry & Geom_Surfaces are abstract classes , have no data members.
Geom_SweptSurface has 3 data members:
// handle whose template T is abstract
Handle(Geom_Curve) basisCurve;
// as name says
gp_Dir direction;
// not concerned
GeomAbs_Shape smooth;
Geom_SurfaceOfRevolution has 3 data members
// handle whose template T is abstract
Handle(Geom_Curve) myBaseCurve;
// handle whose template T is abstract
Handle(Adaptor3d_HCurve) myBaseAdaptor; // not concerned
gp_Ax1 myRotAxis;
Questions
1.how can abstract handle be used?
For I know , when creating a ptr pointing to a object , it will be initialized first .
But as an abstract class , it can't be initialized .
So how does this worked?s
2.where is the points?
Mentioned abstract classes have no data members .
Or have no data members to store the points data.
Meanwhile , the curves need the points to constitute themselves , don't they?
So where is the points data ?
Wed, 01/12/2022 - 10:55
Maybe you can reformulate the question or share a code snippet to clarify where your doubts come from?
Wed, 01/12/2022 - 12:01
Thanks for your reply , dear K·G!
I am sorry that my English is not good enough .
Also I am kinda new to the OCC developing , if something is pretty wrong , please let me know , gracias!
So simplifying my question:
1.
In the source code files , I've seen many code that using Class Handle , whose base type is a abstract class(means they have pure virtual functions , right?)
Won't this raise a exception?
2
The Surfaces are made of curves which made of points , but I don't know how does the system transfer the valid points data?
If I want to define some kind of Surfaces , does the descriptions below correct?
Again , most appreciation for your reply !
Wed, 01/12/2022 - 12:42
Handle() is just an OCCT-specific implementation of smart pointer. Nowadays C++ implements standard smart pointers like std::shared_ptr, but OCCT's Handle() is still useful as it has a couple of nice properties that std::shared_ptr doesn't have. In any case, you may consider replacing Handle() with a raw pointer, e.g. Handle(GeomSurface) -> GeomSurface* to see how to work with it - the "smart" part is just intended to call delete when pointer is no more used.
In this context an empty constructor of Handle(GeomSurface) as a class field becomes:
Initialization of abstract class will lead to a compiler error:
but construction of classes inherited from pure interface and implementing all methods is perfectly fine:
Thu, 01/13/2022 - 03:58
Thanks for your reply , and it helps a lot !
Wish you a good day!
^_^,谢谢~