SceneInfo_impl.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008, AIST, the University of Tokyo and General Robotix Inc.
3  * All rights reserved. This program is made available under the terms of the
4  * Eclipse Public License v1.0 which accompanies this distribution, and is
5  * available at http://www.eclipse.org/legal/epl-v10.html
6  * Contributors:
7  * National Institute of Advanced Industrial Science and Technology (AIST)
8  */
9 
15 #include "SceneInfo_impl.h"
16 
17 #include <map>
18 #include <vector>
19 #include <iostream>
20 #include <boost/bind.hpp>
21 
22 #include <hrpCorba/ViewSimulator.hh>
23 #include <hrpUtil/EasyScanner.h>
24 #include <hrpUtil/VrmlNodes.h>
25 #include <hrpUtil/VrmlParser.h>
26 
27 #include "VrmlUtil.h"
28 
29 
30 using namespace std;
31 using namespace boost;
32 
33 SceneInfo_impl::SceneInfo_impl(PortableServer::POA_ptr poa) :
35 {
36 
37 }
38 
39 
41 {
42 
43 }
44 
45 
46 const std::string& SceneInfo_impl::topUrl()
47 {
48  return url_;
49 }
50 
51 
53 {
54  return CORBA::string_dup(url_.c_str());
55 }
56 
57 
58 TransformedShapeIndexSequence* SceneInfo_impl::shapeIndices()
59 {
60  return new TransformedShapeIndexSequence(shapeIndices_);
61 }
62 
63 
64 void SceneInfo_impl::load(const std::string& url)
65 {
66  string filename(deleteURLScheme(url));
67 
68  // URL文字列の' \' 区切り子を'/' に置き換え Windows ファイルパス対応
69  string url2;
70  url2 = filename;
71  replace( url2, string("\\"), string("/") );
72  filename = url2;
73  url_ = CORBA::string_dup(url2.c_str());
74 
75  try {
76  VrmlParser parser;
77  parser.load(filename);
78 
79  Matrix44 E(Matrix44::Identity());
80 
81  while(VrmlNodePtr node = parser.readNode()){
82  if(!node->isCategoryOf(PROTO_DEF_NODE)){
85  }
86  }
87  } catch(EasyScanner::Exception& ex){
88  cout << ex.getFullMessage() << endl;
89  throw ModelLoader::ModelLoaderException(ex.getFullMessage().c_str());
90  }
91 }
SceneInfo_impl.h
hrp::EasyScanner::Exception::getFullMessage
std::string getFullMessage()
Definition: EasyScanner.cpp:106
SceneInfo_impl::inlinedShapeTransformMatrices_
DblArray12Sequence inlinedShapeTransformMatrices_
Definition: SceneInfo_impl.h:48
hrp::PROTO_DEF_NODE
@ PROTO_DEF_NODE
Definition: VrmlNodes.h:85
hrp::deleteURLScheme
HRP_UTIL_EXPORT string deleteURLScheme(string url)
Definition: UrlUtil.cpp:25
boost
Modifications controlling boost library behavior.
Definition: ColladaUtil.h:306
VrmlNodes.h
hrp::VrmlParser::load
void load(const std::string &filename)
Definition: VrmlParser.cpp:463
SceneInfo_impl::shapeIndices_
TransformedShapeIndexSequence shapeIndices_
Definition: SceneInfo_impl.h:47
ShapeSetInfo_impl::applyTriangleMeshShaper
void applyTriangleMeshShaper(VrmlNodePtr node)
Definition: ShapeSetInfo_impl.cpp:56
hrp::VrmlParser::readNode
VrmlNodePtr readNode()
Definition: VrmlParser.cpp:496
hrp::VrmlParser
Parser for VRML97 format.
Definition: VrmlParser.h:30
filename
char * filename
Definition: cdjpeg.h:133
VrmlUtil.h
hrp::Matrix44
Eigen::Matrix4d Matrix44
Definition: Eigen4d.h:18
hrp::VrmlNodePtr
boost::intrusive_ptr< VrmlNode > VrmlNodePtr
Definition: VrmlNodes.h:155
SceneInfo_impl::url_
std::string url_
Definition: SceneInfo_impl.h:46
SceneInfo_impl::~SceneInfo_impl
virtual ~SceneInfo_impl()
Definition: SceneInfo_impl.cpp:40
SceneInfo_impl::url
virtual char * url()
Definition: SceneInfo_impl.cpp:52
ShapeSetInfo_impl::SceneInfo_impl
friend class SceneInfo_impl
Definition: ShapeSetInfo_impl.h:93
SceneInfo_impl::shapeIndices
virtual TransformedShapeIndexSequence * shapeIndices()
Definition: SceneInfo_impl.cpp:58
VrmlParser.h
SceneInfo_impl::load
void load(const std::string &filename)
Definition: SceneInfo_impl.cpp:64
ShapeSetInfo_impl::replace
std::string & replace(std::string &str, const std::string &sb, const std::string &sa)
Definition: ShapeSetInfo_impl.cpp:74
hrp::EasyScanner::Exception
Definition: EasyScanner.h:35
ShapeSetInfo_impl
Definition: ShapeSetInfo_impl.h:30
ShapeSetInfo_impl::traverseShapeNodes
void traverseShapeNodes(VrmlNode *node, const Matrix44 &T, TransformedShapeIndexSequence &io_shapeIndices, DblArray12Sequence &inlinedShapeM, const SFString *url=NULL)
Definition: ShapeSetInfo_impl.cpp:124
EasyScanner.h
The header file of a text scanner class.
SceneInfo_impl::topUrl
virtual const std::string & topUrl()
Definition: SceneInfo_impl.cpp:46


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Wed Sep 7 2022 02:51:04