Пример #1
0
std::string VisualizationNode::toXML(const std::string &basePath, const std::string &filename, int tabs)
{
	std::stringstream ss;
	std::string t = "\t";
	std::string pre = "";
	for (int i=0;i<tabs;i++)
		pre += "\t";

	ss << pre << "<Visualization";
	if (usedBoundingBoxVisu())
	{
		ss << " BoundingBox='true'";
	}
	ss << ">\n";
	if (!filename.empty())
	{
		boost::filesystem::path localPath(basePath);
		boost::filesystem::path fn(filename);
		boost::filesystem::path completeFile = boost::filesystem::operator/(localPath,fn);

		ss << pre << t << "<File type='" << getType() << "'>" << completeFile.string() << "</File>\n";
	}
	ss << pre << "</Visualization>\n";

	return ss.str();
}
Пример #2
0
    std::string VisualizationNode::toXML(const std::string& basePath, const std::string& filename, int tabs)
    {
        std::stringstream ss;
        std::string t = "\t";
        std::string pre = "";

        for (int i = 0; i < tabs; i++)
        {
            pre += "\t";
        }

        ss << pre << "<Visualization";

        if (usedBoundingBoxVisu())
        {
            ss << " BoundingBox='true'";
        }

        ss << ">\n";

        if (!filename.empty())
        {
            std::string tmpFilename = filename;
            BaseIO::makeRelativePath(basePath, tmpFilename);
            ss << pre << t << "<File type='" << getType() << "'>" << tmpFilename << "</File>\n";
        }
        else if (primitives.size() != 0)
        {
            ss << pre << "\t<Primitives>\n";
            std::vector<Primitive::PrimitivePtr>::const_iterator it;

            for (it = primitives.begin(); it != primitives.end(); it++)
            {
                ss << (*it)->toXMLString(tabs + 1);
            }

            ss << pre << "\t</Primitives>\n";
        }

        ss << pre << "</Visualization>\n";

        return ss.str();
    }