h o m e | d o c u m e n t a t i o n | c l a s s h i e r a r c h y |
00001 // 00002 // Filename : Functions0D.h 00003 // Author(s) : Stephane Grabli, Emmanuel Turquin 00004 // Purpose : Functions taking 0D input 00005 // Date of creation : 01/07/2003 00006 // 00008 00009 00010 // 00011 // Copyright (C) : Please refer to the COPYRIGHT file distributed 00012 // with this source distribution. 00013 // 00014 // This program is free software; you can redistribute it and/or 00015 // modify it under the terms of the GNU General Public License 00016 // as published by the Free Software Foundation; either version 2 00017 // of the License, or (at your option) any later version. 00018 // 00019 // This program is distributed in the hope that it will be useful, 00020 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00021 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00022 // GNU General Public License for more details. 00023 // 00024 // You should have received a copy of the GNU General Public License 00025 // along with this program; if not, write to the Free Software 00026 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00027 // 00029 00030 #ifndef FUNCTIONS0D_H 00031 # define FUNCTIONS0D_H 00032 00033 # include "../system/Precision.h" 00034 # include "Interface0D.h" 00035 # include "../geometry/Geom.h" 00036 # include "../system/Exception.h" 00037 # include "../scene_graph/Material.h" 00038 # include <set> 00039 # include <vector> 00040 class FEdge; 00041 class ViewEdge; 00042 class SShape; 00043 00044 using namespace Geometry; 00045 00046 // 00047 // UnaryFunction0D (base class for functions in 0D) 00048 // 00050 00051 template <class T> 00069 class /*LIB_VIEW_MAP_EXPORT*/ UnaryFunction0D 00070 { 00071 public: 00072 00076 typedef T ReturnedValueType; 00078 UnaryFunction0D() {} 00080 virtual ~UnaryFunction0D() {} 00082 virtual string getName() const { 00083 return "UnaryFunction0D"; 00084 } 00092 virtual T operator()(Interface0DIterator& iter) { 00093 cerr << "Warning: operator() not implemented" << endl; 00094 return T(); 00095 } 00096 }; 00097 00098 # ifdef SWIG 00099 %feature("director") UnaryFunction0D<void>; 00100 %feature("director") UnaryFunction0D<unsigned>; 00101 %feature("director") UnaryFunction0D<float>; 00102 %feature("director") UnaryFunction0D<double>; 00103 %feature("director") UnaryFunction0D<Vec2f>; 00104 %feature("director") UnaryFunction0D<Vec3f>; 00105 %feature("director") UnaryFunction0D<Id>; 00106 00107 %template(UnaryFunction0DVoid) UnaryFunction0D<void>; 00108 %template(UnaryFunction0DUnsigned) UnaryFunction0D<unsigned>; 00109 %template(UnaryFunction0DFloat) UnaryFunction0D<float>; 00110 %template(UnaryFunction0DDouble) UnaryFunction0D<double>; 00111 %template(UnaryFunction0DVec2f) UnaryFunction0D<Vec2f>; 00112 %template(UnaryFunction0DVec3f) UnaryFunction0D<Vec3f>; 00113 %template(UnaryFunction0DId) UnaryFunction0D<Id>; 00114 %template(UnaryFunction0DViewShape) UnaryFunction0D<ViewShape*>; 00115 %template(UnaryFunction0DVectorViewShape) UnaryFunction0D<std::vector<ViewShape*> >; 00116 # endif // SWIG 00117 00118 00119 // 00120 // Functions definitions 00121 // 00123 class ViewShape; 00124 namespace Functions0D { 00125 00126 // GetXF0D 00128 class LIB_VIEW_MAP_EXPORT GetXF0D : public UnaryFunction0D<real> 00129 { 00130 public: 00132 string getName() const { 00133 return "GetXF0D"; 00134 } 00136 real operator()(Interface0DIterator& iter) { 00137 return iter->getX(); 00138 } 00139 }; 00140 00141 // GetYF0D 00143 class LIB_VIEW_MAP_EXPORT GetYF0D : public UnaryFunction0D<real> 00144 { 00145 public: 00147 string getName() const { 00148 return "GetYF0D"; 00149 } 00151 real operator()(Interface0DIterator& iter) { 00152 return iter->getY(); 00153 } 00154 }; 00155 00156 // GetZF0D 00158 class LIB_VIEW_MAP_EXPORT GetZF0D : public UnaryFunction0D<real> 00159 { 00160 public: 00162 string getName() const { 00163 return "GetZF0D"; 00164 } 00166 real operator()(Interface0DIterator& iter) { 00167 return iter->getZ(); 00168 } 00169 }; 00170 00171 // GetProjectedXF0D 00173 class LIB_VIEW_MAP_EXPORT GetProjectedXF0D : public UnaryFunction0D<real> 00174 { 00175 public: 00177 string getName() const { 00178 return "GetProjectedXF0D"; 00179 } 00181 real operator()(Interface0DIterator& iter) { 00182 return iter->getProjectedX(); 00183 } 00184 }; 00185 00186 // GetProjectedYF0D 00188 class LIB_VIEW_MAP_EXPORT GetProjectedYF0D : public UnaryFunction0D<real> 00189 { 00190 public: 00192 string getName() const { 00193 return "GetProjectedYF0D"; 00194 } 00196 real operator()(Interface0DIterator& iter) { 00197 return iter->getProjectedY(); 00198 } 00199 }; 00200 00201 // GetProjectedZF0D 00203 class LIB_VIEW_MAP_EXPORT GetProjectedZF0D : public UnaryFunction0D<real> 00204 { 00205 public: 00207 string getName() const { 00208 return "GetProjectedZF0D"; 00209 } 00211 real operator()(Interface0DIterator& iter) { 00212 return iter->getProjectedZ(); 00213 } 00214 }; 00215 00216 // GetCurvilinearAbscissaF0D 00218 class LIB_VIEW_MAP_EXPORT GetCurvilinearAbscissaF0D : public UnaryFunction0D<float> 00219 { 00220 public: 00222 string getName() const { 00223 return "GetCurvilinearAbscissaF0D"; 00224 } 00226 float operator()(Interface0DIterator& iter) { 00227 return iter.t(); 00228 } 00229 }; 00230 00231 // GetParameterF0D 00233 class LIB_VIEW_MAP_EXPORT GetParameterF0D : public UnaryFunction0D<float> 00234 { 00235 public: 00237 string getName() const { 00238 return "GetParameterF0D"; 00239 } 00241 float operator()(Interface0DIterator& iter) { 00242 return iter.u(); 00243 } 00244 }; 00245 00246 // VertexOrientation2DF0D 00251 class LIB_VIEW_MAP_EXPORT VertexOrientation2DF0D : public UnaryFunction0D<Vec2f> 00252 { 00253 public: 00255 string getName() const { 00256 return "VertexOrientation2DF0D"; 00257 } 00259 Vec2f operator()(Interface0DIterator& iter); 00260 }; 00261 00262 // VertexOrientation3DF0D 00267 class LIB_VIEW_MAP_EXPORT VertexOrientation3DF0D : public UnaryFunction0D<Vec3f> 00268 { 00269 public: 00271 string getName() const { 00272 return "VertexOrientation3DF0D"; 00273 } 00275 Vec3f operator()(Interface0DIterator& iter); 00276 }; 00277 00278 // Curvature2DAngleF0D 00283 class LIB_VIEW_MAP_EXPORT Curvature2DAngleF0D : public UnaryFunction0D<real> 00284 { 00285 public: 00287 string getName() const { 00288 return "Curvature2DAngleF0D"; 00289 } 00291 real operator()(Interface0DIterator& iter); 00292 }; 00293 00294 // ZDiscontinuity 00301 class LIB_VIEW_MAP_EXPORT ZDiscontinuityF0D : public UnaryFunction0D<real> 00302 { 00303 public: 00305 string getName() const { 00306 return "ZDiscontinuityF0D"; 00307 } 00309 real operator()(Interface0DIterator& iter); 00310 }; 00311 00312 // Normal2DF0D 00317 class LIB_VIEW_MAP_EXPORT Normal2DF0D : public UnaryFunction0D<Vec2f> 00318 { 00319 public: 00321 string getName() const { 00322 return "Normal2DF0D"; 00323 } 00325 Vec2f operator()(Interface0DIterator& iter); 00326 }; 00327 00328 // MaterialF0D 00340 class LIB_VIEW_MAP_EXPORT MaterialF0D : public UnaryFunction0D<Material> 00341 { 00342 public: 00344 string getName() const { 00345 return "MaterialF0D"; 00346 } 00348 Material operator()(Interface0DIterator& iter); 00349 }; 00350 00351 // ShapeIdF0D 00361 class LIB_VIEW_MAP_EXPORT ShapeIdF0D : public UnaryFunction0D<Id> 00362 { 00363 public: 00365 string getName() const { 00366 return "ShapeIdF0D"; 00367 } 00369 Id operator()(Interface0DIterator& iter); 00370 }; 00371 00372 // QiF0D 00382 class LIB_VIEW_MAP_EXPORT QuantitativeInvisibilityF0D : public UnaryFunction0D<unsigned int> 00383 { 00384 public: 00386 string getName() const { 00387 return "QuantitativeInvisibilityF0D"; 00388 } 00390 unsigned int operator()(Interface0DIterator& iter); 00391 }; 00392 00393 // CurveNatureF0D 00397 class LIB_VIEW_MAP_EXPORT CurveNatureF0D : public UnaryFunction0D<Nature::EdgeNature> 00398 { 00399 public: 00401 string getName() const { 00402 return "CurveNatureF0D"; 00403 } 00405 Nature::EdgeNature operator()(Interface0DIterator& iter); 00406 }; 00407 00408 // GetShapeF0D 00412 class LIB_VIEW_MAP_EXPORT GetShapeF0D : public UnaryFunction0D< ViewShape*> 00413 { 00414 public: 00416 string getName() const { 00417 return "GetShapeF0D"; 00418 } 00420 ViewShape* operator()(Interface0DIterator& iter); 00421 }; 00422 00423 // GetOccludersF0D 00427 class LIB_VIEW_MAP_EXPORT GetOccludersF0D : public UnaryFunction0D< std::vector<ViewShape*> > 00428 { 00429 public: 00431 string getName() const { 00432 return "GetOccludersF0D"; 00433 } 00435 std::vector<ViewShape*> operator()(Interface0DIterator& iter); 00436 }; 00437 00438 // GetOccludeeF0D 00442 class LIB_VIEW_MAP_EXPORT GetOccludeeF0D: public UnaryFunction0D< ViewShape*> 00443 { 00444 public: 00446 string getName() const { 00447 return "GetOccludeeF0D"; 00448 } 00450 ViewShape* operator()(Interface0DIterator& iter); 00451 }; 00452 00453 00454 00456 00457 // getFEdge 00458 LIB_VIEW_MAP_EXPORT 00459 FEdge* getFEdge(Interface0D& it1, Interface0D& it2); 00460 00461 // getFEdges 00462 LIB_VIEW_MAP_EXPORT 00463 void getFEdges(Interface0DIterator& it, 00464 FEdge*& fe1, 00465 FEdge*& fe2); 00466 00467 // getViewEdges 00468 LIB_VIEW_MAP_EXPORT 00469 void getViewEdges(Interface0DIterator& it, 00470 ViewEdge *&ve1, 00471 ViewEdge *&ve2); 00472 00473 // getShapeF0D 00474 LIB_VIEW_MAP_EXPORT 00475 ViewShape* getShapeF0D(Interface0DIterator& it); 00476 00477 // getOccludersF0D 00478 LIB_VIEW_MAP_EXPORT 00479 void getOccludersF0D(Interface0DIterator& it, std::set<ViewShape*>& oOccluders); 00480 00481 // getOccludeeF0D 00482 LIB_VIEW_MAP_EXPORT 00483 ViewShape* getOccludeeF0D(Interface0DIterator& it); 00484 00485 } // end of namespace Functions0D 00486 00487 #endif // FUNCTIONS0D_H