HyperspaceExplorer 0.7.1
Displayable.h
00001 /*
00002 Hyperspace Explorer - visualizing higher-dimensional geometry
00003 Copyright (C) 2010  Lene Preuss <lene.preuss@gmail.com>
00004 
00005 This program is free software; you can redistribute it and/or modify
00006 it under the terms of the GNU General Public License as published by
00007 the Free Software Foundation; either version 2 of the License, or
00008 (at your option) any later version.
00009 
00010 This program is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 GNU General Public License for more details.
00014 
00015 You should have received a copy of the GNU General Public License along
00016 with this program; if not, write to the Free Software Foundation, Inc.,
00017 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00018 
00019 */
00020 
00021 #if !defined(DISPLAYABLE_H)
00022 #define DISPLAYABLE_H
00023 
00024 #include "FunctionParameter.h"
00025 #include "FunctionFactory.h"
00026 #include "DisplayableClass.h"
00027 
00028 #include <vector>
00029 
00030 namespace UI {
00031   class View;
00032 }
00033 
00034 namespace VecMath {
00035     template <unsigned D, typename N> class Rotation;
00036     template <unsigned D, typename N> class Vector;
00037     template <typename T, unsigned D> class MultiDimensionalVector;
00038 }
00039 class ParameterMap;
00040 
00052 
00054 
00100 class Displayable {
00101 
00102     public:
00103 
00105         typedef void(*function_on_fourspace_vertex)(const VecMath::Vector<4, double> &);
00107         typedef void(*function_on_fourspace_and_transformed_vertex)(const VecMath::Vector<4, double> &,
00108                                                                     const VecMath::Vector<4, double> &);
00110         typedef void(*function_on_fourspace_transformed_and_projected_vertex)(const VecMath::Vector<4, double> &,
00111                                                                               const VecMath::Vector<4, double> &,
00112                                                                               const VecMath::Vector<3, double> &);
00114         typedef void(*function_on_projected_vertex)(const VecMath::Vector<3, double> &);
00115 
00117         Displayable();
00119         Displayable (ParameterMap parameters);
00120         virtual ~Displayable();
00121 
00123         virtual void Transform (const VecMath::Rotation<4, double> &R,
00124                                 const VecMath::Vector<4, double> &T,
00125                                 const VecMath::Vector<4, double> &scale = 1.) = 0;
00127         void resetTransform();
00129         virtual void Project (double ScrW, double CamW, bool DepthCue4D) = 0;
00130 
00132         virtual void Draw (UI::View *) = 0;
00133 
00135         virtual void ReInit(double _tmin, double _tmax, double _dt,
00136                             double _umin, double _umax, double _du,
00137                             double _vmin, double _vmax, double _dv) = 0;
00138 
00140         virtual void calibrateColors() = 0;
00141 
00143         virtual std::string getFunctionName() const = 0;
00144 
00146         virtual unsigned getDefinitionSpaceDimensions() = 0;
00147 
00149         virtual void SetParameters(const ParameterMap &);
00150 
00152         ParameterMap getParameters();
00153 
00155         FunctionParameter::parameter_ptr_type getParameter(const std::string &name);
00156 
00158         virtual unsigned getNumParameters();
00159 
00161         FunctionParameter::value_ptr_type getParameterValue(const std::string &name);
00162 
00164 
00166         template <typename T> void setParameter(const ParameterMap &parms,
00167                                                 T &parm,
00168                                                 const std::string &key);
00169 
00171         virtual void for_each_vertex(function_on_fourspace_vertex apply) = 0;
00174 
00179         virtual void for_each_vertex_transformed(function_on_fourspace_and_transformed_vertex apply);
00182 
00187         virtual void for_each_vertex_transformed_projected(function_on_fourspace_transformed_and_projected_vertex apply);
00189         virtual void for_each_projected(function_on_projected_vertex apply) = 0;
00190 
00191     protected:
00193 
00196         virtual VecMath::Vector<4> &operator () (double, double, double);
00197 
00199 
00202         virtual VecMath::MultiDimensionalVector< VecMath::Vector<4>, 1 > df (double, double, double);
00203 
00205         virtual void Initialize (void) = 0;
00206 
00208         virtual unsigned long MemRequired (void);
00209 
00211 
00213         template <typename T> void declareParameter(const std::string &,
00214                                                     const T &);
00216 
00218         template <typename T> void declareParameter(const std::string &,
00219                 const T &, const T &);
00220 
00221     private:
00222 
00223       class Impl;
00224       Impl *pImpl_;
00225 
00226 };
00227 
00228 namespace {
00229   static const DisplayableClass &displayable_class_root = DisplayableClass::makeRootNode("Displayable", "Objects");
00230 }
00231 
00232 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends

Generated on Mon Apr 9 2012 20:25:14 for HyperspaceExplorer 0.7.1 by doxygen 1.7.4  -  Hosted bySourceForge.net Logo