00001
00002
00003
00004
00005
00006
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00029
00030 #ifndef INTERFACE0D_H
00031 # define INTERFACE0D_H
00032
00033 # include <string>
00034 # include <iostream>
00035 # include "../system/Id.h"
00036 # include "../system/Precision.h"
00037 # include "../winged_edge/Nature.h"
00038 # include "../geometry/Geom.h"
00039 using namespace std;
00040
00041
00042
00043
00045
00046 class FEdge;
00047 class SVertex;
00048 class ViewVertex;
00049 class NonTVertex;
00050 class TVertex;
00052 class Interface0D
00053 {
00054 public:
00055
00057 virtual string getExactTypeName() const {
00058 return "Interface0D";
00059 }
00060
00061
00062
00064 virtual real getX() const {
00065 cerr << "Warning: method getX() not implemented" << endl;
00066 return 0;
00067 }
00068
00070 virtual real getY() const {
00071 cerr << "Warning: method getY() not implemented" << endl;
00072 return 0;
00073 }
00074
00076 virtual real getZ() const {
00077 cerr << "Warning: method getZ() not implemented" << endl;
00078 return 0;
00079 }
00080
00082 virtual Geometry::Vec3f getPoint3D() const {
00083 cerr << "Warning: method getPoint3D() not implemented" << endl;
00084 return 0;
00085 }
00086
00088 virtual real getProjectedX() const {
00089 cerr << "Warning: method getProjectedX() not implemented" << endl;
00090 return 0;
00091 }
00092
00094 virtual real getProjectedY() const {
00095 cerr << "Warning: method getProjectedY() not implemented" << endl;
00096 return 0;
00097 }
00098
00100 virtual real getProjectedZ() const {
00101 cerr << "Warning: method getProjectedZ() not implemented" << endl;
00102 return 0;
00103 }
00104
00106 virtual Geometry::Vec2f getPoint2D() const {
00107 cerr << "Warning: method getPoint2D() not implemented" << endl;
00108 return 0;
00109 }
00110
00113 virtual FEdge* getFEdge(Interface0D&) {
00114 cerr << "Warning: method getFEdge() not implemented" << endl;
00115 return 0;
00116 }
00117
00119 virtual Id getId() const {
00120 cerr << "Warning: method getId() not implemented" << endl;
00121 return Id(0, 0);
00122 }
00123
00125 virtual Nature::VertexNature getNature() const {
00126 cerr << "Warning: method getNature() not implemented" << endl;
00127 return Nature::POINT;
00128 }
00129
00131 virtual SVertex * castToSVertex(){
00132 cerr << "Warning: can't cast this Interface0D in SVertex" << endl;
00133 return 0;
00134 }
00135
00137 virtual ViewVertex * castToViewVertex(){
00138 cerr << "Warning: can't cast this Interface0D in ViewVertex" << endl;
00139 return 0;
00140 }
00141
00143 virtual NonTVertex * castToNonTVertex(){
00144 cerr << "Warning: can't cast this Interface0D in NonTVertex" << endl;
00145 return 0;
00146 }
00147
00149 virtual TVertex * castToTVertex(){
00150 cerr << "Warning: can't cast this Interface0D in TVertex" << endl;
00151 return 0;
00152 }
00153 };
00154
00155
00156
00157
00158
00160
00161 class Interface0DIteratorNested
00162 {
00163 public:
00164
00165 virtual ~Interface0DIteratorNested() {}
00166
00167 virtual string getExactTypeName() const {
00168 return "Interface0DIteratorNested";
00169 }
00170
00171 virtual Interface0D& operator*() = 0;
00172
00173 virtual Interface0D* operator->() {
00174 return &(operator*());
00175 }
00176
00177 virtual void increment() = 0;
00178
00179 virtual void decrement() = 0;
00180
00181 virtual bool isBegin() const = 0;
00182
00183 virtual bool isEnd() const = 0;
00184
00185 virtual bool operator==(const Interface0DIteratorNested& it) const = 0;
00186
00187 virtual bool operator!=(const Interface0DIteratorNested& it) const {
00188 return !(*this == it);
00189 }
00190
00192 virtual float t() const = 0;
00194 virtual float u() const = 0;
00195
00196 virtual Interface0DIteratorNested* copy() const = 0;
00197 };
00198
00199
00200
00201
00202
00204
00213 class Interface0DIterator
00214 {
00215 public:
00216
00217 Interface0DIterator(Interface0DIteratorNested* it = NULL) {
00218 _iterator = it;
00219 }
00220
00222 Interface0DIterator(const Interface0DIterator& it) {
00223 _iterator = it._iterator->copy();
00224 }
00225
00227 virtual ~Interface0DIterator() {
00228 if (_iterator)
00229 delete _iterator;
00230 }
00231
00238 Interface0DIterator& operator=(const Interface0DIterator& it) {
00239 if(_iterator)
00240 delete _iterator;
00241 _iterator = it._iterator->copy();
00242 return *this;
00243 }
00244
00246 string getExactTypeName() const {
00247 if (!_iterator)
00248 return "Interface0DIterator";
00249 return _iterator->getExactTypeName() + "Proxy";
00250 }
00251
00252
00253
00258 Interface0D& operator*() {
00259 return _iterator->operator*();
00260 }
00261
00265 Interface0D* operator->() {
00266 return &(operator*());
00267 }
00268
00272 Interface0DIterator& operator++() {
00273 _iterator->increment();
00274 return *this;
00275 }
00276
00280 Interface0DIterator operator++(int) {
00281 Interface0DIterator ret(*this);
00282 _iterator->increment();
00283 return ret;
00284 }
00285
00289 Interface0DIterator& operator--() {
00290 _iterator->decrement();
00291 return *this;
00292 }
00293
00297 Interface0DIterator operator--(int) {
00298 Interface0DIterator ret(*this);
00299 _iterator->decrement();
00300 return ret;
00301 }
00302
00304 void increment() {
00305 _iterator->increment();
00306 }
00307
00309 void decrement() {
00310 _iterator->decrement();
00311 }
00312
00317 bool isBegin() const {
00318 return _iterator->isBegin();
00319 }
00320
00324 bool isEnd() const {
00325 return _iterator->isEnd();
00326 }
00327
00329 bool operator==(const Interface0DIterator& it) const {
00330 return _iterator->operator==(*(it._iterator));
00331 }
00332
00334 bool operator!=(const Interface0DIterator& it) const {
00335 return !(*this == it);
00336 }
00337
00339 inline float t() const {
00340 return _iterator->t();
00341 }
00343 inline float u() const {
00344 return _iterator->u();
00345 }
00346 protected:
00347
00348 Interface0DIteratorNested* _iterator;
00349 };
00350
00351 #endif // INTERFACE0D_H