Esempio n. 1
0
void OpenCLSource::serialize(XmlSerializer& s) const {
    s.serialize("programModified", programModified_);
    std::string relPath = tgt::FileSystem::relativePath(tgt::FileSystem::dirName(programFilename_),
        tgt::FileSystem::dirName(s.getDocumentPath()));
    std::string relProgramFilename = relPath + "/" + tgt::FileSystem::fileName(programFilename_);
    s.serialize("programFilename", relProgramFilename);
    if (programModified_)
        s.serialize("programSource", programSource_);
}
Esempio n. 2
0
void VolumeURLProperty::serialize(XmlSerializer& s) const {
    Property::serialize(s);

    std::string relativeURL;
    if (!value_.empty()) {
        std::string basePath = tgt::FileSystem::dirName(s.getDocumentPath());
        relativeURL = VolumeURL::convertURLToRelativePath(value_, basePath);
    }
    s.serialize("url", relativeURL);
}
Esempio n. 3
0
void FileDialogProperty::serialize(XmlSerializer& s) const {
    Property::serialize(s);

    // convert path to an relative one with respect to the document's path
    std::string path = value_;
    if (path.empty())
        s.serialize("noPathSet", true);
    else
        s.serialize("noPathSet", false);

    if (!path.empty() && !s.getDocumentPath().empty())
        path = tgt::FileSystem::relativePath(path, tgt::FileSystem::dirName(s.getDocumentPath()));

    // cleanup path: replace backslashes
    std::string::size_type pos = path.find("\\");
    while (pos != std::string::npos) {
        path[pos] = '/';
        pos = path.find("\\");
    }

    s.serialize("value", path);
}
Esempio n. 4
0
void PlotEntitySettings::serialize(XmlSerializer& s) const {
    s.serialize("entity", static_cast<int>(entity_));
    s.serialize("colorMap", colorMap_);
    s.serialize("mainColumnIndex", mainColumnIndex_);
    s.serialize("candleTopColumnIndex", candleTopColumnIndex_);
    s.serialize("candleBottomColumnIndex", candleBottomColumnIndex_);
    s.serialize("stickTopColumnIndex", stickTopColumnIndex_);
    s.serialize("stickBottomColumnIndex", stickBottomColumnIndex_);
    s.serialize("optionalCI", optionalColumnIndex_);
    s.serialize("secondOptionalCI", secondOptionalColumnIndex_);
    s.serialize("firstColor", firstColor_);
    s.serialize("secondColor", secondColor_);
    s.serialize("lineStyle", static_cast<int>(lineStyle_));
    s.serialize("splineFlag", splineFlag_);
    s.serialize("errorbarFlag", errorbarFlag_);
    s.serialize("wireOnlyFlag", wireOnlyFlag_);
    s.serialize("heightmapFlag", heightmapFlag_);
    s.serialize("candleStickFlag", candleStickFlag_);
    s.serialize("minGlyphSize", minGlyphSize_);
    s.serialize("maxGlyphSize", maxGlyphSize_);
    s.serialize("glyphStyle", static_cast<int>(glyphStyle_));

    //see FileDialogProperty
    // convert path to an relative one with respect to the document's path
    std::string path = texturePath_;
    if (!path.empty() && !s.getDocumentPath().empty())
        path = tgt::FileSystem::relativePath(path, tgt::FileSystem::dirName(s.getDocumentPath()));

    // cleanup path: replace backslashes
    std::string::size_type pos = path.find("\\");
    while (pos != std::string::npos) {
        path[pos] = '/';
        pos = path.find("\\");
    }
    s.serialize("texturePath", path);
    s.serialize("useTextureFlag", useTextureFlag_);
}
Esempio n. 5
0
void VolumeURLListProperty::serialize(XmlSerializer& s) const {
    Property::serialize(s);

    std::vector<std::string> urlList = value_;
    std::map<std::string, bool> selectMap = selectionMap_;

    // convert URLs to relative path
    std::string basePath = tgt::FileSystem::dirName(s.getDocumentPath());
    for (size_t i=0; i<urlList.size(); i++) {
        std::string url = urlList[i];
        std::string urlConv = VolumeURL::convertURLToRelativePath(url, basePath);
        urlList[i] = urlConv;
        if (selectMap.find(url) != selectMap.end()) {
            bool selected = selectMap[url];
            selectMap.erase(url);
            selectMap.insert(std::pair<std::string, bool>(urlConv, selected));
        }
    }

    s.serialize("VolumeURLs", urlList, "url");
    s.serialize("Selection", selectMap, "entry", "url");
}