All Classes Namespaces Functions Variables Typedefs Enumerations Pages
dynamicindexedfaceset.h
1 /*
2  OpenMBV - Open Multi Body Viewer.
3  Copyright (C) 2009 Markus Friedrich
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 
20 #ifndef _OPENMBV_DYNAMICINDEXEDFACESET_H
21 #define _OPENMBV_DYNAMICINDEXEDFACESET_H
22 
23 #include <openmbvcppinterface/body.h>
24 #include <vector>
25 #include <hdf5serie/vectorserie.h>
26 
27 namespace OpenMBV {
28 
30  class DynamicIndexedFaceSet : public Body {
31  friend class ObjectFactory;
32  protected:
33  double minimalColorValue, maximalColorValue;
34  std::vector<double> diffuseColor;
35  double transparency;
36  std::vector<Index> indices;
37  int numvp;
41  xercesc::DOMElement *writeXMLFile(xercesc::DOMNode *parent);
43  void createHDF5File();
44  void openHDF5File();
45  public:
47  std::string getClassName() { return "DynamicIndexedFaceSet"; }
48 
51  int getNumberOfVertexPositions() const { return numvp; }
52  const std::vector<Index>& getIndices() { return indices; }
53 
58  void setMinimalColorValue(double min) {
59  minimalColorValue=min;
60  }
61 
62  double getMinimalColorValue() { return minimalColorValue; }
63 
67  void setMaximalColorValue(double max) {
68  maximalColorValue=max;
69  }
70 
71  double getMaximalColorValue() { return maximalColorValue; }
72 
76  void setDiffuseColor(const std::vector<double> &hsv) {
77  if(hsv.size()!=3) throw std::runtime_error("the dimension does not match");
78  diffuseColor=hsv;
79  }
80 
81  void setDiffuseColor(double h, double s, double v) {
82  std::vector<double> hsv;
83  hsv.push_back(h);
84  hsv.push_back(s);
85  hsv.push_back(v);
86  diffuseColor=hsv;
87  }
88 
89  std::vector<double> getDiffuseColor() { return diffuseColor; }
90 
92  void setTransparency(double t) {
93  transparency=t;
94  }
95 
96  double getTransparency() { return transparency; }
97 
100  void setNumberOfVertexPositions(int num) { numvp = num; }
101  void setIndices(const std::vector<Index> &indices_) { indices = indices_; }
102 
104  template<typename T>
105  void append(const T& row) {
106  if(data==0) throw std::runtime_error("can not append data to an environment object");
107  data->append(row);
108  }
109 
110  int getRows() { return data?data->getRows():-1; }
111  std::vector<double> getRow(int i) { return data?data->getRow(i):std::vector<double>(1+3*numvp); }
112 
114  virtual void initializeUsingXML(xercesc::DOMElement *element);
115  };
116 
117 }
118 
119 #endif
void setDiffuseColor(const std::vector< double > &hsv)
Definition: dynamicindexedfaceset.h:76
std::vector< double > getRow(int i)
Definition: dynamicindexedfaceset.h:111
int getRows()
Definition: dynamicindexedfaceset.h:110
void createHDF5File()
Definition: dynamicindexedfaceset.cc:58
Definition: objectfactory.h:36
int getNumberOfVertexPositions() const
Definition: dynamicindexedfaceset.h:51
void setMinimalColorValue(double min)
Definition: dynamicindexedfaceset.h:58
void setMaximalColorValue(double max)
Definition: dynamicindexedfaceset.h:67
std::string getClassName()
Definition: dynamicindexedfaceset.h:47
virtual void initializeUsingXML(xercesc::DOMElement *element)
Definition: dynamicindexedfaceset.cc:88
void setTransparency(double t)
Definition: dynamicindexedfaceset.h:92
void getRow(const int row, size_t size, T data[])
void append(const T data[], size_t size)
Definition: dynamicindexedfaceset.h:30
void append(const T &row)
Definition: dynamicindexedfaceset.h:105
void setNumberOfVertexPositions(int num)
Definition: dynamicindexedfaceset.h:100
Definition: body.h:31

Impressum / Disclaimer / Datenschutz Generated by doxygen 1.8.5 Valid HTML