17 ReaderWriter::getStringValue(filename, pParametersNode,
"FileName");
19 if (
findXMLNode(pParametersNode,
"UseEmbeddedGeometry")) {
20 useEG = ReaderWriter::getBoolValue(pParametersNode,
"UseEmbeddedGeometry");
28 virtual void init(osgUtil::LineSegmentIntersector::Intersection* intersection,
33 std::vector<osg::ref_ptr<WG_Wall> >* walls,
34 std::vector<osg::ref_ptr<WG_Point> >* points,
35 osg::Geode* pOSGGeode,
36 osg::Vec3Array* pOSGVertexArray) {
39 std::ifstream file(filename.c_str());
41 logger.
errorLog(
"RoomEdit Plugin: ERROR in loading scene - file: '%s' doesn't exists", filename.c_str());
49 std::vector<osg::ref_ptr<WG_Point> > tempPoints;
52 XercesDOMParser* Parser =
new XercesDOMParser();
54 F = (filename.c_str());
56 XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* Document = Parser->getDocument();
59 XERCES_CPP_NAMESPACE_QUALIFIER
DOMNode* RootNode = Document->getDocumentElement();
64 XERCES_CPP_NAMESPACE_QUALIFIER
DOMNode* wallGeometryNode =
findXMLNode(RootNode,
"WallGeometry");
72 int pointSize = ReaderWriter::getIntValue(pointsNodes,
"PointsCount");
73 tempPoints.resize(pointSize);
76 for (
int i = 1; i < pointSize+1; i++) {
77 XERCES_CPP_NAMESPACE_QUALIFIER
DOMNode* pointNode = pointsNodes->getChildNodes()->item(i);
78 id = ReaderWriter::getIntValue(pointNode,
"Id");
79 height = ReaderWriter::getFloatValue(pointNode,
"Height");
80 ReaderWriter::getVec2Value(position, pointNode,
"Position");
82 std::cout <<
id <<
": " << height <<
", " << position.x() <<
", " << position.y() << std::endl;
84 tempPoint =
new WG_Point(position, height);
86 tempPoints[id] = tempPoint;
91 int wallSize = ReaderWriter::getIntValue(wallsNodes,
"WallsCount");
95 for (
unsigned int a=0; a<tempPoints.size(); a++)
96 points->push_back(tempPoints.at(a));
112 for (
int j = 1; j < wallSize+1; j++) {
113 XERCES_CPP_NAMESPACE_QUALIFIER
DOMNode* wallNode = wallsNodes->getChildNodes()->item(j);
116 qId = ReaderWriter::getIntValue(qNode,
"Id");
117 rId = ReaderWriter::getIntValue(rNode,
"Id");
119 cout<<
"loaded ids "<< j <<
": " << qId <<
", " << rId << endl;
121 tempWall =
new WG_Wall(points->at(qId).get(), points->at(rId).get(),
false);
123 ReaderWriter::getVec3Value(tempVec3, qNode,
"Color");
126 ReaderWriter::getVec3Value(tempVec3, rNode,
"Color");
130 ReaderWriter::getVec3Value(tempVec3, qNode,
"tCWV");
133 ReaderWriter::getVec3Value(tempVec3, qNode,
"tCCWV");
136 ReaderWriter::getVec3Value(tempVec3, qNode,
"bCWV");
139 ReaderWriter::getVec3Value(tempVec3, qNode,
"bCCWV");
142 ReaderWriter::getVec2Value(tempVec2, qNode,
"nCWV");
145 ReaderWriter::getVec2Value(tempVec2, qNode,
"nCCWV");
148 ReaderWriter::getVec3Value(tempVec3, rNode,
"tCWV");
151 ReaderWriter::getVec3Value(tempVec3, rNode,
"tCCWV");
154 ReaderWriter::getVec3Value(tempVec3, rNode,
"bCWV");
157 ReaderWriter::getVec3Value(tempVec3, rNode,
"bCCWV");
160 ReaderWriter::getVec2Value(tempVec2, rNode,
"nCWV");
163 ReaderWriter::getVec2Value(tempVec2, rNode,
"nCCWV");
166 ReaderWriter::getVec3Value(tempVec3, wallNode,
"topNormal");
169 ReaderWriter::getVec3Value(tempVec3, wallNode,
"bottomNormal");
172 ReaderWriter::getVec3Value(tempVec3, wallNode,
"qrNormal");
175 ReaderWriter::getVec3Value(tempVec3, wallNode,
"rqNormal");
180 walls->push_back(tempWall);
184 for (
unsigned int k=0; k<walls->size(); k++) {
188 for (
unsigned int k=0; k<walls->size(); k++) {
190 walls->at(k)->computeAttrVertices();
200 std::string filename;