HyperspaceExplorer 0.7.1
View.h
00001 /*
00002 Hyperspace Explorer - visualizing higher-dimensional geometry
00003 Copyright (C) 2008-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 #ifndef VIEW_H
00022 #define VIEW_H 1
00023 
00024 #include "ParameterMap.h"
00025 
00026 #include <vector>
00027 
00028 class Displayable;
00029 class Light;
00030 namespace VecMath {
00031   template <typename T, unsigned D> class MultiDimensionalVector;
00032 }
00033 
00035 namespace UI {
00036 
00038 
00043 class View {
00044 
00046   class FunctionNotSupportedException: public std::runtime_error {
00047   public:
00049     FunctionNotSupportedException(const std::string &what): std::runtime_error(what) { }
00050   };
00051 
00052 public:
00053 
00054   View() { }
00055   virtual ~View() { }
00056 
00058   virtual const std::shared_ptr<Displayable> &F() const = 0;
00060 
00061   virtual void setF(Displayable *f) = 0;
00062 
00064 
00066   template <typename T>
00067   void setParameter(const std::string &parmName, const T &value) {
00068     ApplyChanges(ParameterMap(parmName, value));
00069   }
00070 
00072 
00076   virtual void applyTransform(const VecMath::Rotation<4> &R,
00077                               const VecMath::Vector<4> &T) = 0;
00078 
00080   virtual const VecMath::Rotation<4> &getdR() = 0;
00082 
00083   virtual void setdR(const VecMath::Rotation<4> &_dr) = 0;
00084 
00086   virtual void setNumFrames(unsigned _numFrames) = 0;
00088   virtual void setNumLoops(unsigned _numLoops) = 0;
00089 
00091   virtual void animate() = 0;
00092 
00094   virtual void setSize(unsigned, unsigned) = 0;
00095 
00097   virtual const std::string &getImgDir() = 0;
00099   virtual void setImgDir(const std::string &) = 0;
00100 
00102   virtual const std::string &getImgPrefix() = 0;
00104   virtual void setImgPrefix(const std::string &) = 0;
00105 
00107   virtual void setBackground(const Color &) = 0;
00109   virtual const Color &getBackground() = 0;
00110 
00112   virtual void addLight(Light *) = 0;
00114   virtual void removeLight(std::vector<Light *>::iterator) = 0;
00116 
00117   virtual const std::vector<Light *> &getLights() = 0;
00118 
00120   virtual bool getColors() const = 0;
00122   virtual void setColors(bool) = 0;
00123 
00125   virtual bool getCoordinates() const = 0;
00127   virtual void setCoordinates(bool) = 0;
00128 
00130   virtual bool getFog() const = 0;
00132   virtual void setFog(bool) = 0;
00133 
00135   virtual bool getHyperfog() const = 0;
00137   virtual void setHyperfog(bool) = 0;
00138 
00140   virtual bool getLighting() const = 0;
00142   virtual void setLighting(bool) = 0;
00143 
00145   virtual bool getShading() const = 0;
00147   virtual void setShading(bool) = 0;
00148 
00150   virtual bool getSolid() const = 0;
00152 
00153   virtual void setSolid(bool on) = 0;
00154 
00156   virtual bool getTransparence() const = 0;
00158   virtual void setTransparence(bool) = 0;
00159 
00161 
00166   virtual void drawVertex(const VecMath::Vector< 4 > &x, const VecMath::Vector< 3 > &xscr) = 0;
00168 
00174   virtual void drawLine(const VecMath::Vector< 4 > &x0, const VecMath::Vector< 4 > &x1,
00175                         const VecMath::Vector< 3 > &xscr0, const VecMath::Vector< 3 > &xscr1) = 0;
00177   virtual void drawTriangle(const VecMath::Vector< 4 > &x0, const VecMath::Vector< 4 > &x1,
00178                             const VecMath::Vector< 4 > &x2,
00179                             const VecMath::Vector< 3 > &xscr0, const VecMath::Vector< 3 > &xscr1,
00180                             const VecMath::Vector< 3 > &xscr2) = 0;
00182   virtual void drawQuadrangle(const VecMath::Vector< 4 > &x0, const VecMath::Vector< 4 > &x1,
00183                               const VecMath::Vector< 4 > &x2, const VecMath::Vector< 4 > &x3,
00184                               const VecMath::Vector< 3 > &xscr0, const VecMath::Vector< 3 > &xscr1,
00185                               const VecMath::Vector< 3 > &xscr2, const VecMath::Vector< 3 > &xscr3) = 0;
00187   virtual void drawPolygon(const std::vector< VecMath::Vector< 4 > > &x0,
00188                             const std::vector< VecMath::Vector< 3 > > &xscr0) = 0;
00190 
00193   virtual void drawCube(const VecMath::MultiDimensionalVector< VecMath::Vector<4>, 3 > &X,
00194                         unsigned t, unsigned u, unsigned v,
00195                         const VecMath::Vector<3> &v0, const VecMath::Vector<3> &v1,
00196                         const VecMath::Vector<3> &v2, const VecMath::Vector<3> &v3,
00197                         const VecMath::Vector<3> &v4, const VecMath::Vector<3> &v5,
00198                         const VecMath::Vector<3> &v6, const VecMath::Vector<3> &v7) = 0;
00200 
00205   virtual void commitDraw() = 0;
00206 
00207 protected:
00208 
00210   virtual void ApplyChanges(const ParameterMap &) = 0;
00211 
00213   virtual unsigned getNumFrames() = 0;
00215   virtual unsigned getNumLoops() = 0;
00216 
00218   virtual bool getWriteImages() = 0;
00220   virtual void setWriteImages(bool) = 0;
00221 
00223   virtual void setDefaultBackground() = 0;
00224 
00225 };
00226 
00227 }
00228 
00229 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends

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