Esempio n. 1
0
void FileDialogProperty::deserialize(XmlDeserializer& s) {
    Property::deserialize(s);

    // An empty serialized value does not necessarily mean that it wasn't set, but could also mean that it was the
    // same path as the document path passed during serialization, which makes the relative path empty.  We need an
    // extra bool to remember if this was the case.
    try {
        bool noPathSet;
        s.deserialize("noPathSet", noPathSet);
        if(noPathSet) {
            set("");
            return;
        }
    }
    catch (XmlSerializationNoSuchDataException) {
        s.removeLastError();
    }

    std::string value;
    s.deserialize("value", value);

    // convert path relative to the document's path to an absolute one
    if (!s.getDocumentPath().empty())
        value = tgt::FileSystem::absolutePath(tgt::FileSystem::dirName(s.getDocumentPath()) + "/" + value);

    try {
        set(value);
    }
    catch (Condition::ValidationFailed& e) {
        s.addError(e);
    }
}
Esempio n. 2
0
void PlotEntitySettings::deserialize(XmlDeserializer& s) {
    int value;
    s.deserialize("entity", value);
    entity_ = static_cast<Entity>(value);
    s.deserialize("colorMap", colorMap_);
    s.deserialize("mainColumnIndex", mainColumnIndex_);
    s.deserialize("candleTopColumnIndex", candleTopColumnIndex_);
    s.deserialize("candleBottomColumnIndex", candleBottomColumnIndex_);
    s.deserialize("stickTopColumnIndex", stickTopColumnIndex_);
    s.deserialize("stickBottomColumnIndex", stickBottomColumnIndex_);
    s.deserialize("optionalCI", optionalColumnIndex_);
    s.deserialize("secondOptionalCI", secondOptionalColumnIndex_);
    s.deserialize("firstColor", firstColor_);
    s.deserialize("secondColor", secondColor_);
    s.deserialize("lineStyle", value);
    lineStyle_ = static_cast<LineStyle>(value);
    s.deserialize("splineFlag", splineFlag_);
    s.deserialize("errorbarFlag", errorbarFlag_);
    s.deserialize("wireOnlyFlag", wireOnlyFlag_);
    s.deserialize("heightmapFlag", heightmapFlag_);
    s.deserialize("candleStickFlag", candleStickFlag_);
    s.deserialize("minGlyphSize", minGlyphSize_);
    s.deserialize("maxGlyphSize", maxGlyphSize_);
    s.deserialize("glyphStyle", value);
    glyphStyle_ = static_cast<GlyphStyle>(value);
    //see FileDialogProperty
    s.deserialize("texturePath", texturePath_);
    // convert path relative to the document's path to an absolute one
    if (!texturePath_.empty() && !s.getDocumentPath().empty())
        texturePath_ = tgt::FileSystem::absolutePath(
            tgt::FileSystem::dirName(s.getDocumentPath()) + "/" + texturePath_);
    s.deserialize("useTextureFlag", useTextureFlag_);
}
Esempio n. 3
0
void VolumeURLListProperty::deserialize(XmlDeserializer& s) {
    Property::deserialize(s);

    std::vector<std::string> urlList = value_;
    std::map<std::string, bool> selectMap = selectionMap_;
    s.deserialize("VolumeURLs", urlList, "url");

    try {
        s.deserialize("Selection", selectMap, "entry", "url");
    }
    catch (SerializationException& e) {
        s.removeLastError();
        LWARNING("Failed to deserialize selection map: " << e.what());
    }

    // convert URLs to absolute 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::convertURLToAbsolutePath(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));
        }
    }

    value_ = urlList;
    selectionMap_ = selectMap;

    invalidate();
}
Esempio n. 4
0
void OpenCLSource::deserialize(XmlDeserializer& s) {
    //current format:
    s.deserialize("programModified", programModified_);
    s.deserialize("programFilename", programFilename_);
    programFilename_ = tgt::FileSystem::absolutePath(
        tgt::FileSystem::dirName(s.getDocumentPath())) + "/" + programFilename_;
    if (programModified_)
        s.deserialize("programSource", programSource_);
}
Esempio n. 5
0
void VolumeURLProperty::deserialize(XmlDeserializer& s) {
    std::string relativeURL;
    s.deserialize("url", relativeURL);
    if (relativeURL.empty())
        value_ = "";
    else {
        std::string basePath = tgt::FileSystem::dirName(s.getDocumentPath());
        value_ = VolumeURL::convertURLToAbsolutePath(relativeURL, basePath);
    }

    Property::deserialize(s);
}