shape_doc 0.1
|
00001 /***************************************************************************** 00002 * M a t h e m a g i x 00003 ***************************************************************************** 00004 * TopologyCurve 00005 * 2008-05-16 00006 * Julien Wintz & Bernard Mourrain 00007 ***************************************************************************** 00008 * Copyright (C) 2006 INRIA Sophia-Antipolis 00009 ***************************************************************************** 00010 * Comments : 00011 ****************************************************************************/ 00012 00013 # ifndef shape_cell3d_factory_hpp 00014 # define shape_cell3d_factory_hpp 00015 00016 # include <shape/algebraic_curve.hpp> 00017 # include <shape/surface_algebraic.hpp> 00018 # include <shape/cell.hpp> 00019 # include <shape/cell3d_algebraic_curve.hpp> 00020 # include <shape/cell3d_surface_algebraic.hpp> 00021 # include <shape/cell3d_list.hpp> 00022 # include <algorithm> 00023 00024 # define TMPL template<class C,class V> 00025 # define TMPL1 template<class V> 00026 # define Viewer viewer<axel,V> 00027 00028 # undef AlgebraicCurve 00029 00030 namespace mmx { 00031 namespace shape { 00032 00033 # define Cell3dFactory cell3d_factory<C,V> 00034 00035 TMPL 00036 class cell3d_factory { 00037 public: 00038 typedef typename SHAPE_OF(V) Shape; 00039 typedef REF_OF(V) Ref; 00040 typedef bounding_box<C,Ref> BoundingBox; 00041 typedef cell3d<C,Ref> Cell; 00042 typedef algebraic_curve<C,Ref> AlgebraicCurve; 00043 typedef surface_algebraic<C,Ref> AlgebraicSurface; 00044 //typedef cell3d_algebraic_curve<C,Ref> Cell3dAlgebraicCurve; 00045 typedef cell3d_surface_algebraic<C,Ref> Cell3dAlgebraicSurface; 00046 // typedef cell3d_parametric_curve<C,Ref> Cell3dParametricCurve; 00047 typedef cell3d_list<C,Ref> Cell3dList; 00048 00049 00050 static Cell3dFactory * instance(void) { 00051 if(!m_instance) 00052 m_instance = new Cell3dFactory ; 00053 00054 return m_instance ; 00055 } 00056 00057 Cell * create(Shape * s,const BoundingBox& bx) { 00058 Cell * cell = NULL ; 00059 00060 if(AlgebraicSurface* isurface = dynamic_cast<AlgebraicSurface *>(s)) { 00061 cell = new Cell3dAlgebraicSurface(*isurface,bx); 00062 } 00063 00064 // if(AlgebraicCurve* ic = dynamic_cast<AlgebraicCurve *>(s)) { 00065 // cell = new Cell3dAlgebraicCurve(ic, bx); 00066 // } 00067 00068 //if(ParametricSurface* psurface = dynamic_cast<ParametricSurface *>(s)) { 00069 // cell = new Cell_ParametricSurface(psurface); 00070 // } 00071 00072 return cell ; 00073 } 00074 00075 Cell * create(const Seq<Shape*>& s, const BoundingBox& bx) { 00076 Cell * cell = NULL ; 00077 00078 if(s.size()==1) 00079 return create(s[0],bx); 00080 else if(s.size()>1) { 00081 Cell3dList* l= new Cell3dList(bx); 00082 foreach(Shape* o, s) 00083 l->push_back(create(o,bx)) ; 00084 cell = l; 00085 } 00086 00087 return cell; 00088 } 00089 00090 00091 private: 00092 Cell3dFactory(void) {} ; 00093 00094 private: 00095 static Cell3dFactory * m_instance; 00096 } ; 00097 00098 TMPL Cell3dFactory* Cell3dFactory::m_instance = NULL; 00099 00100 00101 //==================================================================== 00102 } ; // namespace shape 00103 } ; // namespace mmx 00104 //==================================================================== 00105 # undef TMPL 00106 # undef TMPL1 00107 # undef Viewer 00108 # endif 00109 /*********************************************************************/