vrecko
virtual reality framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ColorBucket.h
Go to the documentation of this file.
1 #ifndef _COLOR_BUCKET_H
2 #define _COLOR_BUCKET_H
3 
4 #include "Tool.h"
5 
6 namespace APRoomEdit {
7 
8  // tool to change color of the wall
9  class ColorBucket : public Tool {
10  public:
11  ColorBucket(osg::Vec3 color) {
12  this->color = color;
13  type = COLORBUCKET;
14  }
15 
16  virtual ~ColorBucket() {
17  }
18 
19  virtual void init(osgUtil::LineSegmentIntersector::Intersection* intersection,
20  WG_Wall* curWall,
21  WG_Point* curPoint,
23  vrecko::EnvironmentObject* pEOOwner,
24  std::vector<osg::ref_ptr<WG_Wall> >* walls,
25  std::vector<osg::ref_ptr<WG_Point> >* points,
26  osg::Geode* pOSGGeode,
27  osg::Vec3Array* pOSGVertexArray) {
28 
29  if (curWall == NULL)
30  return;
31 
32  curWall->setColor(color, type);
33  setDirty(true);
34  }
35 
36  virtual bool loadXMLParameters(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *pParametersNode) {
37  if (findXMLNode(pParametersNode, "Color")) {
38  ReaderWriter::getVec3Value(color, pParametersNode, "Color");
39  if (findXMLNode(pParametersNode, "Name")) {
40  ReaderWriter::getStringValue(name, pParametersNode, "Name");
41  } else {
42  name = "ColorBucket";
43  }
44  }
45  else
46  return false;
47  return true;
48  }
49 
50  private:
51  osg::Vec3 color;
52  };
53 
54 }
55 
56 #endif
57