Exemple #1
0
/**
 * The default implementation calls the \ref REntity::exportEntity() function
 * of the entity.
 * This method may use the \c currentEntity stack to access the
 * entity that is currently being exported.
 * Exporters can choose to reimplement this function to export an entity
 * in a target platform specific manner (e.g. to optimize things for
 * a specific platform).
 */
void RExporter::exportCurrentEntity(bool preview) {
    REntity* entity = getEntity();
    if (entity==NULL) {
        return;
    }

    // if this exporter exports a visual
    // representation of the drawing (scene, view, print)...
    if (isVisualExporter()) {
        // ... only export entities on visible layers:
        if (currentLayer!=NULL && currentLayer->isFrozen()) {
            return;
        }

        // ... only export entities in visible blocks:
        RBlockReferenceEntity* blockRef = dynamic_cast<RBlockReferenceEntity*>(entity);
        if (blockRef!=NULL) {
            RBlock::Id blockId = blockRef->getReferencedBlockId();
            if (blockId!=RBlock::INVALID_ID) {
                QSharedPointer<RBlock> block = document->queryBlockDirect(blockId);
                if (!block.isNull() && block->isFrozen()) {
                    return;
                }
            }
        }
    }

    setEntityAttributes();
    entity->exportEntity(*this, preview);
}
Exemple #2
0
/**
 * The default implementation calls the \ref REntity::exportEntity() function
 * of the entity.
 * This method may use the \c currentEntity stack to access the
 * entity that is currently being exported.
 * Exporters can choose to reimplement this function to export an entity
 * in a target platform specific manner (e.g. to optimize things for
 * a specific platform).
 */
void RExporter::exportCurrentEntity(bool preview, bool forceSelected) {
    REntity* entity = getEntity();
    if (entity==NULL) {
        return;
    }

    // if this exporter exports a visual
    // representation of the drawing (scene, view, print)...
    if (isVisualExporter()) {
        // ... only export entities on visible layers:
        if (currentLayer!=NULL && currentLayer->isFrozen()) {
            return;
        }

        // ... only export entities in visible blocks:
        RBlockReferenceEntity* blockRef = dynamic_cast<RBlockReferenceEntity*>(entity);
        if (blockRef!=NULL) {
            RBlock::Id blockId = blockRef->getReferencedBlockId();
            if (blockId!=RBlock::INVALID_ID) {
                QSharedPointer<RBlock> block = document->queryBlockDirect(blockId);
                if (!block.isNull() && block->isFrozen()) {
                    return;
                }
            }
        }
    }

    setEntityAttributes(forceSelected);

    //bool sblt = getScreenBasedLinetypes();
    if ((forceSelected || entity->isSelected()) && RSettings::getUseSecondarySelectionColor()) {
        // first part of two color selection:
        //setScreenBasedLinetypes(true);
        twoColorSelectedMode = true;
    }

    entity->exportEntity(*this, preview, forceSelected);

    // selected? export again with second color and pattern:
    if (visualExporter) {
        if ((forceSelected || entity->isSelected()) &&
            RSettings::getUseSecondarySelectionColor() &&
            entity->getType()!=RS::EntityBlockRef &&
            entity->getType()!=RS::EntityText &&
            entity->getType()!=RS::EntityAttribute &&
            entity->getType()!=RS::EntityAttributeDefinition) {

            RColor secondarySelectionColor = RSettings::getColor("GraphicsViewColors/SecondarySelectionColor", RColor(Qt::white));
            setColor(secondarySelectionColor);
            //setStyle(Qt::CustomDashLine);
            setDashPattern(QVector<qreal>() << 2 << 3);
            entity->exportEntity(*this, preview, forceSelected);
        }
    }
    twoColorSelectedMode = false;
    //setScreenBasedLinetypes(sblt);
}