26 #include "utility/utils/stl/pdeque.h" 32 template <
typename GO>
35 static const GO *downcast(
const GeomObj *p)
36 {
return dynamic_cast<const GO *
>(p); }
38 {
return dynamic_cast<GO *
>(p); }
44 void copia_objetos(
const pdeque_geom_obj &objs);
46 typedef typename pdeque_geom_obj::const_iterator const_iterator;
47 typedef typename pdeque_geom_obj::iterator iterator;
49 inline bool empty(
void)
const 50 {
return objetos.empty(); }
52 inline const_iterator begin(
void)
const 53 {
return objetos.begin(); }
54 inline const_iterator end(
void)
const 55 {
return objetos.end(); }
56 inline bool Vacio(
void)
const 57 {
return objetos.empty(); }
61 { copia_objetos(other.
objetos); }
62 virtual GEOM_FT GetMax(
unsigned short int i)
const;
63 virtual GEOM_FT GetMin(
unsigned short int i)
const;
64 virtual unsigned short int Dimension(
void)
const;
65 size_t size(
void)
const 66 {
return objetos.size(); }
67 void push_back(
const GO &obj)
68 { objetos.push_back(downcast(obj.getCopy())); }
70 virtual GEOM_FT
getArea(
void)
const;
72 void Print(std::ostream &os)
const;
75 template <
typename GO>
78 for(const_iterator i= objs.begin();i!=objs.end();i++)
79 objetos.push_back(downcast((*i)->getCopy()));
83 template <
typename GO>
86 if(objetos.empty())
return true;
87 const_iterator i(objetos.begin());
88 const unsigned short int d((*i)->Dimension());
90 for(;i!=objetos.end();i++)
91 if(d!=(*i)->Dimension())
return false;
96 template <
typename GO>
99 if(objetos.empty())
return 0;
100 const_iterator i(objetos.begin());
101 unsigned short int d((*i)->Dimension());
103 for(;i!=objetos.end();i++)
104 d= std::max(d,(*i)->Dimension());
108 template <
typename GO>
111 if(objetos.empty())
return 0.0;
112 const_iterator j=objetos.begin();
113 GEOM_FT mx= (*j)->GetMax(i);
115 for(;j != objetos.end();j++)
116 mx= std::max((*j)->GetMax(i),mx);
119 template <
typename GO>
122 if(objetos.empty())
return 0.0;
123 const_iterator j=objetos.begin();
124 GEOM_FT mn= (*j)->GetMin(i);
126 for(;j != objetos.end();j++)
127 mn= std::min((*j)->GetMin(i),mn);
132 template <
typename GO>
135 if(objetos.empty())
return 0.0;
136 const_iterator i(objetos.begin());
137 GEOM_FT retval((*i)->getLength());
139 for(;i!=objetos.end();i++)
140 retval+= (*i)->getLength();
145 template <
typename GO>
148 if(objetos.empty())
return 0.0;
149 const_iterator i(objetos.begin());
150 GEOM_FT retval((*i)->getArea());
152 for(;i!=objetos.end();i++)
153 retval+= (*i)->getArea();
158 template <
typename GO>
161 if(objetos.empty())
return 0.0;
162 const_iterator i(objetos.begin());
163 GEOM_FT retval((*i)->getVolume());
165 for(;i!=objetos.end();i++)
166 retval+= (*i)->getVolume();
170 template <
typename GO>
174 const_iterator i= begin();
177 os << std::endl << **i;
virtual GEOM_FT getArea(void) const
Return the object area.
Definition: GeomGroup.h:146
bool equal_dimension(void) const
Return true if all objects have the same dimension.
Definition: GeomGroup.h:84
virtual GEOM_FT getLength(void) const
Return the length of the object.
Definition: GeomGroup.h:133
Base class for geometric entities groups.
Definition: GeomGroup.h:33
pdeque_geom_obj objetos
Objects of the group.
Definition: GeomGroup.h:41
virtual GEOM_FT getVolume(void) const
Return the volume of the object.
Definition: GeomGroup.h:159
virtual unsigned short int Dimension(void) const
Return the dimension of the object 0, 1, 2 or 3.
Definition: GeomGroup.h:97
Clase base para las entidades geométricas.
Definition: GeomObj.h:40