Example #1
0
void RMemoryStorage::clear() {
    RStorage::clear();

    maxLineweight = RLineweight::Weight000;
    inTransaction = false;
    boundingBoxChanged = true;
    boundingBox[0][0] = RBox();
    boundingBox[0][1] = RBox();
    boundingBox[1][0] = RBox();
    boundingBox[1][1] = RBox();
    objectMap.clear();
    objectHandleMap.clear();
    entityMap.clear();
    blockEntityMap.clear();
    blockMap.clear();
    layerMap.clear();
    linetypeMap.clear();
    transactionMap.clear();
    documentVariables.clear();
    variables.clear();
    variableCaseMap.clear();
    if (!documentVariables.isNull()) {
        documentVariables->clear();
    }
    //linetypeScale = 1.0;
    setLastTransactionId(-1);
}
Example #2
0
RMemoryStorage::RMemoryStorage() :
    maxLineweight(RLineweight::Weight000), 
    boundingBoxChanged(true),
    //boundingBoxIgnoreHiddenLayers(false),
    //boundingBoxIgnoreEmpty(false),
    inTransaction(false) {

    setLastTransactionId(-1);
}
Example #3
0
RMemoryStorage::RMemoryStorage() :
    maxLineweight(RLineweight::Weight000), 
    inTransaction(false), 
    boundingBoxChanged(true),
    unit(RS::None),
    linetypeScale(1.0) {

    setLastTransactionId(-1);
}
Example #4
0
void RMemoryStorage::saveTransaction(RTransaction& transaction) {
    // if the given transaction is not undoable, we don't need to
    // store anything here:
    if (!transaction.isUndoable()) {
        return;
    }

    // assign new unique ID for this transaction:
    transaction.setId(getLastTransactionId() + 1);

    // delete transactions that are lost for good due to this transaction:
    //deleteTransactionsFrom(transaction.getId());

    transactionMap[transaction.getId()] = transaction;

    setLastTransactionId(transaction.getId());
}
Example #5
0
void RMemoryStorage::clear() {
    RStorage::clear();

    maxLineweight = RLineweight::Weight000;
    inTransaction = false;
    boundingBoxChanged = true;
    boundingBox = RBox();
    objectMap.clear();
    entityMap.clear();
    blockEntityMap.clear();
    blockMap.clear();
    layerMap.clear();
    transactionMap.clear();
    variables.clear();
    variableCaseMap.clear();
    knownVariables.clear();
    linetypeScale = 1.0;
    setLastTransactionId(-1);
}
Example #6
0
void RMemoryStorage::deleteTransactionsFrom(int transactionId) {
    QSet<int> keysToRemove;

    {
        QHash<int, RTransaction>::iterator it;
        for (it = transactionMap.begin(); it!=transactionMap.end(); ++it) {
            if (it.key()>=transactionId) {
                // delete orphaned objects:
                QList<RObject::Id> affectedObjects =
                    it.value().getAffectedObjects();

                QList<RObject::Id>::iterator it2;
                for (it2=affectedObjects.begin(); it2!=affectedObjects.end(); ++it2) {
                    QSharedPointer<RObject> obj = queryObjectDirect(*it2);
                    if (!obj.isNull() && obj->isUndone()) {
                        deleteObject(*it2);
                    }
                }

                // mark transaction for removal:
                keysToRemove.insert(it.key());
            }
        }
    }

    {
        QSet<int>::iterator it;
        for (it=keysToRemove.begin(); it!=keysToRemove.end(); ++it) {
            transactionMap.remove(*it);
        }
    }

    if (!transactionMap.contains(getLastTransactionId())) {
        setLastTransactionId(getMaxTransactionId());
    }
}
Example #7
0
void RMemoryStorage::resetTransactionStack() {
    transactionMap.clear();
    setLastTransactionId(-1);
}