Esempio n. 1
0
void ProxyObject::setParent(const ProxyObjectPtr &parent,
               TemporalValue<Location>::Time timeStamp,
               const Location &absLocation,
               const Location &relLocation) {
    if (!parent) {
        unsetParent(timeStamp, absLocation);
        return;
    }
    ProxyObjectPtr oldParent (getParentProxy());
    if (oldParent) {
        oldParent->ProxyObjectProvider::removeListener(this);
    }
    parent->ProxyObjectProvider::addListener(this);

    // Using now() should best allow a linear extrapolation to work.
    Location lastPosition(globalLocation(timeStamp));

    mParentId = parent->getObjectReference();
    Location newparentLastGlobal(parent->globalLocation(timeStamp));
/*
    std::cout<<" Last parent global "<<std::endl<<newparentLastGlobal<<std::endl<<
        "global loc = "<<std::endl<<lastPosition<<
        std::endl<<"local loc = "<<std::endl<<lastPosition.toLocal(newparentLastGlobal)<<std::endl;
*/
    mLocation.resetValue(timeStamp, lastPosition.toLocal(newparentLastGlobal));
    mLocation.updateValue(timeStamp, relLocation);

    PositionProvider::notify(&PositionListener::setParent,
                             parent,
                             timeStamp,
                             absLocation,
                             relLocation);
}
Esempio n. 2
0
void Picture::Remove (Iterator& i) {
    UList* doomed = Elem(i);
    Graphic* g = graphic(doomed);

    Next(i);
    unsetParent(g);
    _kids->Remove(doomed);
    delete doomed;
    uncacheExtent();
    uncacheParents();
}
Esempio n. 3
0
void ProxyObject::setParent(const ProxyObjectPtr &parent,
               TemporalValue<Location>::Time timeStamp) {
    if (!parent) {
        unsetParent(timeStamp);
        return;
    }
    Location globalParent (parent->globalLocation(timeStamp));
    Location globalLoc (globalLocation(timeStamp));

//    std::cout << "Extrapolated = "<<extrapolateLocation(timeStamp)<<std::endl;

    Location localLoc (globalLoc.toLocal(globalParent));
/*
    std::cout<<" Setting parent "<<std::endl<<globalParent<<std::endl<<
        "global loc = "<<std::endl<<globalLoc<<
        std::endl<<"local loc = "<<std::endl<<localLoc<<std::endl;
*/
    setParent(parent, timeStamp, globalLoc, localLoc);
}
Esempio n. 4
0
void Picture::Remove (Graphic* g) {
    unsetParent(g);
    _kids->Delete(g);
    uncacheExtent();
    uncacheParents();
}
Esempio n. 5
0
// protected:
// Notification that the Parent has been destroyed
void ProxyObject::destroyed() {
    unsetParent(TemporalValue<Location>::Time::now());
}
Esempio n. 6
0
void ProxyObject::unsetParent(TemporalValue<Location>::Time timeStamp) {
    unsetParent(timeStamp, globalLocation(timeStamp));
}