From 02aba5b179c82a0064fbd63aab7939cedb5d0ef5 Mon Sep 17 00:00:00 2001 From: mkroehnert <mkroehnert@042f3d55-54a8-47e9-b7fb-15903f145c44> Date: Fri, 11 Apr 2014 12:25:51 +0000 Subject: [PATCH] replace spaces with tabs (tabs seem to be used more often) git-svn-id: http://svn.code.sf.net/p/simox/code/trunk@548 042f3d55-54a8-47e9-b7fb-15903f145c44 --- CMakeLists.txt | 16 +- .../Visualization/VisualizationNode.cpp | 6 +- .../Visualization/VisualizationNode.h | 14 +- VirtualRobot/XML/BaseIO.cpp | 194 +++++++++--------- .../examples/SceneViewer/showSceneWindow.cpp | 14 +- 5 files changed, 122 insertions(+), 122 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b37ea30ea..45ecced70 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ PROJECT(Simox) cmake_minimum_required(VERSION 2.8.3) if(NOT ("${CMAKE_VERSION}" VERSION_LESS 2.8.12)) - cmake_policy(SET CMP0022 OLD) # avoid INTERFACE_LINK_LIBRARIES warnings + cmake_policy(SET CMP0022 OLD) # avoid INTERFACE_LINK_LIBRARIES warnings ENDIF() MESSAGE(STATUS "******************** Configuring Simox ************************") @@ -30,18 +30,18 @@ if (Simox_BUILD_GraspStudio) list(APPEND SIMOX_EXPORT_TARGET_LIST GraspStudio) list(APPEND SIMOX_EXPORT_TARGET_LIST qhull) list(APPEND SIMOX_EXPORT_TARGET_LIST powercrust) - list (APPEND Simox_LIBRARIES GraspStudio) + list (APPEND Simox_LIBRARIES GraspStudio) endif() if (Simox_BUILD_SimDynamics) add_subdirectory(SimDynamics) list(APPEND SIMOX_EXPORT_TARGET_LIST SimDynamics) - list (APPEND Simox_LIBRARIES SimDynamics) - if (SimDynamics_BULLET_OpenGL) - list(APPEND SIMOX_EXPORT_TARGET_LIST BulletOpenGLSupport) - endif() + list (APPEND Simox_LIBRARIES SimDynamics) + if (SimDynamics_BULLET_OpenGL) + list(APPEND SIMOX_EXPORT_TARGET_LIST BulletOpenGLSupport) + endif() - list (APPEND Simox_EXTERNAL_LIBRARIES ${Simox_SimDynamics_EXTERNAL_LIBRARIES}) - list (APPEND Simox_EXTERNAL_INCLUDE_DIRS ${Simox_SimDynamics_INCLUDE_DIRS}) + list (APPEND Simox_EXTERNAL_LIBRARIES ${Simox_SimDynamics_EXTERNAL_LIBRARIES}) + list (APPEND Simox_EXTERNAL_INCLUDE_DIRS ${Simox_SimDynamics_INCLUDE_DIRS}) diff --git a/VirtualRobot/Visualization/VisualizationNode.cpp b/VirtualRobot/Visualization/VisualizationNode.cpp index 8b87177b7..6cd2ac079 100644 --- a/VirtualRobot/Visualization/VisualizationNode.cpp +++ b/VirtualRobot/Visualization/VisualizationNode.cpp @@ -1,6 +1,6 @@ /** * @package VirtualRobot -* @author Manfred Kroehnert +* @author Manfred Kroehnert * @author Nikolaus Vahrenkamp * @copyright 2010 Manfred Kroehnert */ @@ -24,7 +24,7 @@ VisualizationNode::VisualizationNode() boundingBox = false; globalPose.setIdentity(); } - + VisualizationNode::~VisualizationNode() { attachedVisualizations.clear(); @@ -208,7 +208,7 @@ bool VisualizationNode::saveModel(const std::string &modelPath, const std::strin void VisualizationNode::scale( Eigen::Vector3f &scaleFactor ) { - VR_WARNING << "not implemented..." << endl; + VR_WARNING << "not implemented..." << endl; } diff --git a/VirtualRobot/Visualization/VisualizationNode.h b/VirtualRobot/Visualization/VisualizationNode.h index 57608b8a8..1fb05a237 100644 --- a/VirtualRobot/Visualization/VisualizationNode.h +++ b/VirtualRobot/Visualization/VisualizationNode.h @@ -61,7 +61,7 @@ public: /*! Clone this visualization. - \param deepCopy When true, the underlying visualization is copied, otherwise a reference to the existing visualization is passed. + \param deepCopy When true, the underlying visualization is copied, otherwise a reference to the existing visualization is passed. \param scaling Scale Can be set to create a scaled version of this visual data. Since the underlying implementation may be able to re-use the visualization data, a deep copy may not be necessary in some cases. */ @@ -96,7 +96,7 @@ public: virtual void setupVisualization(bool showVisualization, bool showAttachedVisualizations); /*! - Enables/Disables the visualization updates. + Enables/Disables the visualization updates. Usually if a SceneObject or a RobotNode changes its state, the visualization is automatically updated. This behavior can be changed here. */ @@ -127,7 +127,7 @@ public: std::string toXML(const std::string &basePath, const std::string &filename, int tabs); /*! - Create a united visualization. Behavior depends on the derived implementation, + Create a united visualization. Behavior depends on the derived implementation, but usually the visualizations are copied and united to one object. */ static VisualizationNodePtr CreateUnitedVisualization(const std::vector<VisualizationNodePtr> &visualizations); @@ -137,13 +137,13 @@ public: */ BoundingBox getBoundingBox(); - /*! - Saves model file to model path. + /*! + Saves model file to model path. \param modelPath The directory. - */ + */ virtual bool saveModel(const std::string &modelPath, const std::string &filename); - virtual void scale(Eigen::Vector3f &scaleFactor); + virtual void scale(Eigen::Vector3f &scaleFactor); protected: bool boundingBox; //!< Indicates, if the bounding box model was used diff --git a/VirtualRobot/XML/BaseIO.cpp b/VirtualRobot/XML/BaseIO.cpp index 3a76f0d49..00cb89816 100644 --- a/VirtualRobot/XML/BaseIO.cpp +++ b/VirtualRobot/XML/BaseIO.cpp @@ -96,9 +96,9 @@ float BaseIO::getFloatByAttributeName(rapidxml::xml_node<char>* xmlNode, const s /** * This method gets an optional attribute \p attributeName from xml_node \p xmlNode and - * returns its value as float. + * returns its value as float. * When no attribute \p attributeName is present the \p standardValue is returned. - * + * */ float BaseIO::getOptionalFloatByAttributeName(rapidxml::xml_node<char>* xmlNode, const std::string& attributeName, float standardValue) { @@ -173,8 +173,8 @@ void BaseIO::processTransformNode(rapidxml::xml_node<char> *transformXMLNode, co while (node) { std::string nodeName = getLowerCase(node->name()); - - + + // Homogeneous Matrix 4x4 //rapidxml::xml_node<> *matrixXMLNode = trXMLNode->first_node("matrix4x4",0,false); if (nodeName=="matrix4x4") @@ -317,33 +317,33 @@ void BaseIO::processTransformNode(rapidxml::xml_node<char> *transformXMLNode, co void BaseIO::processDHNode(rapidxml::xml_node<char> *dhXMLNode, DHParameter &dh) { - rapidxml::xml_attribute<> *attr; - std::vector< Units > unitsAttr = getUnitsAttributes(dhXMLNode); - Units uAngle("rad"); - Units uLength("mm"); - for (size_t i=0;i<unitsAttr.size();i++) - { - if (unitsAttr[i].isAngle()) - uAngle = unitsAttr[i]; - if (unitsAttr[i].isLength()) - uLength = unitsAttr[i]; - } - - dh.isSet = true; - bool isRadian = uAngle.isRadian(); - - attr = dhXMLNode->first_attribute("a", 0, false); - if (attr) - dh.setAInMM(uLength.toMillimeter(convertToFloat(attr->value()))); - attr = dhXMLNode->first_attribute("d", 0, false); - if (attr) - dh.setDInMM(uLength.toMillimeter(convertToFloat(attr->value()))); - attr = dhXMLNode->first_attribute("alpha", 0, false); - if (attr) - dh.setAlphaRadian(convertToFloat(attr->value()), isRadian); - attr = dhXMLNode->first_attribute("theta", 0, false); - if (attr) - dh.setThetaRadian(convertToFloat(attr->value()), isRadian); + rapidxml::xml_attribute<> *attr; + std::vector< Units > unitsAttr = getUnitsAttributes(dhXMLNode); + Units uAngle("rad"); + Units uLength("mm"); + for (size_t i=0;i<unitsAttr.size();i++) + { + if (unitsAttr[i].isAngle()) + uAngle = unitsAttr[i]; + if (unitsAttr[i].isLength()) + uLength = unitsAttr[i]; + } + + dh.isSet = true; + bool isRadian = uAngle.isRadian(); + + attr = dhXMLNode->first_attribute("a", 0, false); + if (attr) + dh.setAInMM(uLength.toMillimeter(convertToFloat(attr->value()))); + attr = dhXMLNode->first_attribute("d", 0, false); + if (attr) + dh.setDInMM(uLength.toMillimeter(convertToFloat(attr->value()))); + attr = dhXMLNode->first_attribute("alpha", 0, false); + if (attr) + dh.setAlphaRadian(convertToFloat(attr->value()), isRadian); + attr = dhXMLNode->first_attribute("theta", 0, false); + if (attr) + dh.setThetaRadian(convertToFloat(attr->value()), isRadian); } bool BaseIO::hasUnitsAttribute(rapidxml::xml_node<char> *node) @@ -369,7 +369,7 @@ void BaseIO::getAllAttributes(rapidxml::xml_node<char> *node, const std::string { std::string s(attr->value()); storeValues.push_back(s); - + attr = attr->next_attribute(attrString.c_str(), 0, false); } } @@ -389,7 +389,7 @@ std::vector< Units > BaseIO::getUnitsAttributes(rapidxml::xml_node<char> *node) Units unitsAttribute(getLowerCase(attrStr[i].c_str())); result.push_back(unitsAttribute); } - + return result; } @@ -618,21 +618,21 @@ void BaseIO::makeRelativePath( const std::string &basePath, std::string &filenam if (filename.empty()) return; - boost::filesystem::path diffpath; - boost::filesystem::path tmppath = filename; - while(tmppath != basePath) - { - diffpath = tmppath.filename() / diffpath; - tmppath = tmppath.parent_path(); - if (tmppath.empty()) - { - // no relative path found, take complete path - diffpath = filename; - break; - } - } - - filename = diffpath.string(); + boost::filesystem::path diffpath; + boost::filesystem::path tmppath = filename; + while(tmppath != basePath) + { + diffpath = tmppath.filename() / diffpath; + tmppath = tmppath.parent_path(); + if (tmppath.empty()) + { + // no relative path found, take complete path + diffpath = filename; + break; + } + } + + filename = diffpath.string(); /* bool found = true; @@ -775,7 +775,7 @@ VisualizationNodePtr BaseIO::processVisualizationTag(rapidxml::xml_node<char> *v VR_WARNING << "No visualization present..." << endl; } else visuCoordType = attr->value(); - + getLowerCase(visuCoordType); VisualizationFactoryPtr visualizationFactory = VisualizationFactory::fromName(visuCoordType, NULL); @@ -842,7 +842,7 @@ CollisionModelPtr BaseIO::processCollisionTag(rapidxml::xml_node<char> *colXMLNo collisionFileType = attr->value(); getLowerCase(collisionFileType); collisionFile = processFileNode(colFileXMLNode,basePath); - + attr = colFileXMLNode->first_attribute("boundingbox", 0, false); if (attr) { @@ -929,8 +929,8 @@ void BaseIO::processPhysicsTag(rapidxml::xml_node<char> *physicsXMLNode, const s } } - - } + + } rapidxml::xml_node<> *inMatXMLNode = physicsXMLNode->first_node("inertiamatrix",0,false); if (inMatXMLNode) { @@ -960,29 +960,29 @@ void BaseIO::processPhysicsTag(rapidxml::xml_node<char> *physicsXMLNode, const s physics.intertiaMatrix.setZero(); // this will trigger an automatically determination of the inertia matrix during initialization } rapidxml::xml_node<> *ignoreColXMLNode = physicsXMLNode->first_node("ignorecollision",0,false); - while (ignoreColXMLNode) - { - rapidxml::xml_attribute<> *attr = ignoreColXMLNode->first_attribute("name", 0, false); - THROW_VR_EXCEPTION_IF(!attr, "Expecting 'name' attribute in <IgnoreCollision> tag..." << endl) - std::string s(attr->value()); - physics.ignoreCollisions.push_back(s); - ignoreColXMLNode = ignoreColXMLNode->next_sibling("ignorecollision",0,false); - } - rapidxml::xml_node<> *simulationtype = physicsXMLNode->first_node("simulationtype",0,false); - if (simulationtype) - { - rapidxml::xml_attribute<> *attr = simulationtype->first_attribute("value", 0, false); - THROW_VR_EXCEPTION_IF(!attr, "Expecting 'value' attribute in <SimulationType> tag..." << endl) - std::string s(attr->value()); - getLowerCase(s); - if (s=="dynamic" || s=="dynamics") - physics.simType = VirtualRobot::SceneObject::Physics::eDynamic; - else if (s=="static") - physics.simType = VirtualRobot::SceneObject::Physics::eStatic; - else if (s=="kinematic") - physics.simType = VirtualRobot::SceneObject::Physics::eKinematic; - // otherwise eUnknown remains - } + while (ignoreColXMLNode) + { + rapidxml::xml_attribute<> *attr = ignoreColXMLNode->first_attribute("name", 0, false); + THROW_VR_EXCEPTION_IF(!attr, "Expecting 'name' attribute in <IgnoreCollision> tag..." << endl) + std::string s(attr->value()); + physics.ignoreCollisions.push_back(s); + ignoreColXMLNode = ignoreColXMLNode->next_sibling("ignorecollision",0,false); + } + rapidxml::xml_node<> *simulationtype = physicsXMLNode->first_node("simulationtype",0,false); + if (simulationtype) + { + rapidxml::xml_attribute<> *attr = simulationtype->first_attribute("value", 0, false); + THROW_VR_EXCEPTION_IF(!attr, "Expecting 'value' attribute in <SimulationType> tag..." << endl) + std::string s(attr->value()); + getLowerCase(s); + if (s=="dynamic" || s=="dynamics") + physics.simType = VirtualRobot::SceneObject::Physics::eDynamic; + else if (s=="static") + physics.simType = VirtualRobot::SceneObject::Physics::eStatic; + else if (s=="kinematic") + physics.simType = VirtualRobot::SceneObject::Physics::eKinematic; + // otherwise eUnknown remains + } } std::string BaseIO::processFileNode( rapidxml::xml_node<char> *fileNode, const std::string &basePath ) @@ -1004,26 +1004,26 @@ std::string BaseIO::processFileNode( rapidxml::xml_node<char> *fileNode, const s } } else { - + // check file absolute boost::filesystem::path fn(fileName); - try { - if (boost::filesystem::exists(fn)) - return fileName; - } catch (...){} + try { + if (boost::filesystem::exists(fn)) + return fileName; + } catch (...){} // check file relative std::string absFileName = fileName; makeAbsolutePath(basePath,absFileName); fn = absFileName; - try { + try { if (boost::filesystem::exists(fn)) return absFileName; - } catch (...){} + } catch (...){} // check file in data paths absFileName = fileName; if (RuntimeEnvironment::getDataFileAbsolute(absFileName)) return absFileName; - + VR_ERROR << "Could not determine valid filename from " << fileName << endl; } return fileName; @@ -1252,10 +1252,10 @@ TrajectoryPtr BaseIO::processTrajectory(rapidxml::xml_node<char> *trajectoryXMLN bool BaseIO::writeXMLFile(const std::string &filename, const std::string &content, bool overwrite) { - try { + try { if (!overwrite && boost::filesystem::exists(filename)) return false; - } catch (...){} + } catch (...){} // save file std::ofstream out(filename.c_str(),std::ios::out|std::ios::trunc); @@ -1270,18 +1270,18 @@ bool BaseIO::writeXMLFile(const std::string &filename, const std::string &conten std::string BaseIO::toXML( const Eigen::Matrix4f &m, std::string ident /*= "\t"*/ ) { - std::stringstream ss; - ss << ident << "<Matrix4x4 units='mm'>"<< endl; - for (int r=1;r<=4;r++) - { - ss << ident << "\t<row" << r << " "; - - for (int i=1;i<=4;i++) - ss << "c" << i << "='" << m(r-1,i-1) <<"' "; - ss << "/>"<< endl; - } - ss << ident << "</Matrix4x4>"<< endl; - return ss.str(); + std::stringstream ss; + ss << ident << "<Matrix4x4 units='mm'>"<< endl; + for (int r=1;r<=4;r++) + { + ss << ident << "\t<row" << r << " "; + + for (int i=1;i<=4;i++) + ss << "c" << i << "='" << m(r-1,i-1) <<"' "; + ss << "/>"<< endl; + } + ss << ident << "</Matrix4x4>"<< endl; + return ss.str(); } diff --git a/VirtualRobot/examples/SceneViewer/showSceneWindow.cpp b/VirtualRobot/examples/SceneViewer/showSceneWindow.cpp index f0d12172c..44aef3ff7 100644 --- a/VirtualRobot/examples/SceneViewer/showSceneWindow.cpp +++ b/VirtualRobot/examples/SceneViewer/showSceneWindow.cpp @@ -39,7 +39,7 @@ showSceneWindow::showSceneWindow(std::string &sSceneFile, Qt::WFlags flags) sceneSep->addChild(graspVisu); setupUI(); - + loadScene(); viewer->viewAll(); @@ -160,7 +160,7 @@ void showSceneWindow::updateGraspVisu() std::string t = currentGrasp->getName(); SoSeparator* visu = CoinVisualizationFactory::CreateCoordSystemVisualization(1.0f,&t); - + if (visu) graspVisu->addChild(visu); } @@ -183,7 +183,7 @@ void showSceneWindow::quit() void showSceneWindow::sliderMoved(int pos) -{ +{ if (!currentTrajectory) return; @@ -215,7 +215,7 @@ void showSceneWindow::loadScene() cout << e.what(); return; } - + if (!scene) { cout << " ERROR while creating scene" << endl; @@ -262,7 +262,7 @@ void showSceneWindow::loadScene() else selectJoint(0); - + displayTriangles(); @@ -303,7 +303,7 @@ void showSceneWindow::selectRobot(int nr) if (tr.size()>0) UI.comboBoxTrajectory->setCurrentIndex(0); - + std::vector<VirtualRobot::EndEffectorPtr> eefs = currentRobot->getEndEffectors(); for (size_t i=0;i<eefs.size();i++) { @@ -469,7 +469,7 @@ void showSceneWindow::closeHand() } void showSceneWindow::openHand() -{ +{ if (!currentEEF) return; currentEEF->openActors(); -- GitLab