Пример #1
0
/**
 * Sets the current entity to the given entity and calls \ref exportEntity().
 * Note that entity is a temporary clone.
 */
void RExporter::exportEntity(REntity& entity, bool preview, bool allBlocks, bool forceSelected) {
    RDocument* doc = entity.getDocument();
    if (doc==NULL) {
        doc = document;
    }

    // entity not on current block and allBlocks==false, break:
    if (!allBlocks && doc->getCurrentBlockId()!=entity.getBlockId()) {
        //unexportEntity(entity.getId());
        return;
    }

    entityStack.push(&entity);

    // find layer of the current entity
    QSharedPointer<RLayer> layer;
    if (layerSource!=NULL) {
        RLayer::Id layerId = entity.getLayerId();
        layer = layerSource->queryLayerDirect(layerId);
        Q_ASSERT(!layer.isNull());
    }
    else {
        layer = doc->queryLayerDirect(entity.getLayerId());
        if (layer.isNull()) {
            qDebug() << "Document: " << *doc;
            qDebug() << "Layer ID: " << entity.getLayerId();
            Q_ASSERT_X(false, "RExporter::exportEntity", "layer is NULL");
        }
    }
    if (!layer.isNull()) {
        currentLayer = layer.data();
    }

    // find block reference of the current entity, ignore this entity:
    bool blockRefOrViewportSet = false;
    // check if this entity is a block reference:
    RBlockReferenceEntity* blockRef = dynamic_cast<RBlockReferenceEntity*>(&entity);
    if (blockRef!=NULL) {
        blockRefStack.push(blockRef);
        blockRefOrViewportSet = true;
    }
    // check if this entity is a viewport:
    RViewportEntity* viewPort = dynamic_cast<RViewportEntity*>(&entity);
    if (viewPort!=NULL) {
        blockRefStack.push(viewPort);
        blockRefOrViewportSet = true;
    }

    startEntity(/* topLevelEntity = */ blockRefOrViewportSet || blockRefStack.isEmpty());
    exportCurrentEntity(preview, forceSelected);
    endEntity();

    if (blockRefOrViewportSet) {
        blockRefStack.pop();
        //blockRefBS.clear();
    }
    currentLayer = NULL;

    entityStack.pop();
}
Пример #2
0
bool  QXmlDefaultHandler_QtDShell::__override_endEntity(const QString&  name0, bool static_call)
{
    if (static_call) {
        return QXmlDefaultHandler::endEntity((const QString& )name0);
    } else {
        return endEntity((const QString& )name0);
    }
}