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 }
std::string & replace(std::string &str, const std::string &sb, const std::string &sa)
Modifications controlling boost library behavior.
Definition: ColladaUtil.h:306
char * filename
Definition: cdjpeg.h:133
DblArray12Sequence inlinedShapeTransformMatrices_
TransformedShapeIndexSequence shapeIndices_
Eigen::Matrix4d Matrix44
Definition: Eigen4d.h:18
void applyTriangleMeshShaper(VrmlNodePtr node)
VrmlNodePtr readNode()
Definition: VrmlParser.cpp:496
std::string url_
void load(const std::string &filename)
Definition: VrmlParser.cpp:463
boost::intrusive_ptr< VrmlNode > VrmlNodePtr
Definition: VrmlNodes.h:155
virtual ~SceneInfo_impl()
HRP_UTIL_EXPORT string deleteURLScheme(string url)
Definition: UrlUtil.cpp:25
void load(const std::string &filename)
virtual TransformedShapeIndexSequence * shapeIndices()
Parser for VRML97 format.
Definition: VrmlParser.h:30
virtual char * url()
SceneInfo_impl(PortableServer::POA_ptr poa)
void traverseShapeNodes(VrmlNode *node, const Matrix44 &T, TransformedShapeIndexSequence &io_shapeIndices, DblArray12Sequence &inlinedShapeM, const SFString *url=NULL)
virtual const std::string & topUrl()
The header file of a text scanner class.


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Thu Sep 8 2022 02:24:05