示例#1
0
void PropertyOwner::deserialize(IvwDeserializer& d) {

    // This is for finding renamed composites, and moving old properties to new composites.
    NodeVersionConverter tvc(this, &PropertyOwner::findPropsForComposites);
    d.convertVersion(&tvc);

    std::vector<std::string> identifers;
    for (Property* p : properties_) identifers.push_back(p->getIdentifier());

    StandardIdentifier<Property> propertyIdentifier;
    d.deserialize("Properties", properties_, "Property", propertyIdentifier);

    for (size_t i = 0; i < properties_.size(); ++i) {
        Property* p = properties_[i];
        auto it =
            std::find_if(identifers.begin(), identifers.end(),
                         [&p](const std::string& id) -> bool { return id == p->getIdentifier(); });

        // Property is created in the de-serialization, assume ownership
        if (it == identifers.end()) {
            notifyObserversWillAddProperty(p, i);
            p->setOwner(this);
            if (dynamic_cast<EventProperty*>(p)) {
                eventProperties_.push_back(static_cast<EventProperty*>(p));
            }
            if (dynamic_cast<CompositeProperty*>(p)) {
                compositeProperties_.push_back(static_cast<CompositeProperty*>(p));
            }
            ownedProperties_.emplace_back(p);
            notifyObserversDidAddProperty(p, i);
        }
    }
}
示例#2
0
IvwDeserializer::IvwDeserializer(IvwDeserializer& s, bool allowReference)
    : IvwSerializeBase(s.getFileName(), allowReference) {
    try {
        doc_.LoadFile();
        rootElement_ = doc_.FirstChildElement();
        storeReferences(rootElement_);
    } catch (TxException& e) {
        throw AbortException(e.what(), IvwContext);
    }
}
示例#3
0
void TrackballAction::deserialize(IvwDeserializer& d) {
    d.deserialize("action", name_);

    for (int i = 0; i < COUNT; ++i) {
        if (actionNames_[i] == name_) {
            action_ = i;
            break;
        }
    }
}
示例#4
0
void Processor::deserialize(IvwDeserializer& d) {
    std::string identifier;
    d.deserialize("identifier", identifier, true);
    setIdentifier(identifier);  // Need to use setIdentifier to make sure we get a unique id.

    d.deserialize("InteractonHandlers", interactionHandlers_, "InteractionHandler");

    StandardIdentifier<Port> inportIdentifier;
    d.deserialize("InPorts", inports_, "InPort", inportIdentifier);
    d.deserialize("OutPorts", outports_, "OutPort", inportIdentifier);

    for (auto elem : inports_) {
        elem->setProcessor(this);
    }
    for (auto elem : outports_) {
        elem->setProcessor(this);
    }

    PropertyOwner::deserialize(d);
    MetaDataOwner::deserialize(d);
}
示例#5
0
文件: port.cpp 项目: sarbi127/inviwo
void Port::deserialize(IvwDeserializer& d) { d.deserialize("identifier", identifier_, true); }
示例#6
0
 virtual void deserialize(IvwDeserializer& d) { d.deserialize("classVariable", value_); }
示例#7
0
void MouseEvent::deserialize(IvwDeserializer& d) {
    InteractionEvent::deserialize(d);
    d.deserialize("button", button_);
    d.deserialize("state", state_);
    d.deserialize("wheelOrientation", wheelOrientation_);
}
示例#8
0
void CompositeProperty::deserialize(IvwDeserializer& d){
    Property::deserialize(d);
    PropertyOwner::deserialize(d);
    d.deserialize("collapsed", collapsed_);
}
示例#9
0
void PropertySemantics::deserialize(IvwDeserializer& d) {
    d.deserialize("semantics", semantic_, true);
}