/**
 * @return Paper size in graphic units.
 */
RS_Vector RS_Graphic::getPaperSize() {
    RS_Vector def = RS_Units::convert(RS_Vector(210.0,297.0),
                                      RS2::Millimeter, getUnit());

    RS_Vector v1 = getVariableVector("$PLIMMIN", RS_Vector(0.0,0.0));
    RS_Vector v2 = getVariableVector("$PLIMMAX", def);

    return v2-v1;
}
예제 #2
0
/**
 * @return Paper size in graphic units.
 */
RS_Vector RS_Graphic::getPaperSize() {
    RS_SETTINGS->beginGroup("/Print");
    bool okX,okY;
    double sX = RS_SETTINGS->readEntry("/PaperSizeX", "0.0").toDouble(&okX);
    double sY = RS_SETTINGS->readEntry("/PaperSizeY", "0.0").toDouble(&okY);
    RS_SETTINGS->endGroup();
    RS_Vector def ;
    if(okX&&okY && sX>RS_TOLERANCE && sY>RS_TOLERANCE) {
        def=RS_Units::convert(RS_Vector(sX,sY),
                              RS2::Millimeter, getUnit());
    }else{
        def= RS_Units::convert(RS_Vector(210.0,297.0),
                               RS2::Millimeter, getUnit());
    }

    RS_Vector v1 = getVariableVector("$PLIMMIN", RS_Vector(0.0,0.0));
    RS_Vector v2 = getVariableVector("$PLIMMAX", def);

    return v2-v1;
}
예제 #3
0
bool Stepper::isDependentOn( Stepper const* aStepper )
{
    // Every Stepper depends on the SystemStepper.
    // FIXME: UGLY -- reimplement SystemStepper in a different way
    if( typeid( *aStepper ) == typeid( SystemStepper ) )
        {
        return true;
    }

    VariableVector const& aTargetVector( aStepper->getVariableVector() );
    
    VariableVector::const_iterator aReadOnlyTargetVariableIterator(
        aTargetVector.begin() +
            aStepper->getReadOnlyVariableOffset() );

    VariableVector::const_iterator aReadWriteTargetVariableIterator(
        aTargetVector.begin() +
            aStepper->getReadWriteVariableOffset() );
    
    // if at least one Variable in this::readlist appears in
    // the target::write list.
    for( VariableVector::const_iterator i( getVariableVector().begin() +
                                        theReadWriteVariableOffset ); 
         i != getVariableVector().end(); ++i )
    {
        Variable* const aVariablePtr( *i );
        
        // search in target::write or readwrite lists.
        if( std::binary_search( aTargetVector.begin(),    // write-only
                                aReadWriteTargetVariableIterator,
                                aVariablePtr )
            || std::binary_search( aReadWriteTargetVariableIterator,
                                   aReadOnlyTargetVariableIterator,
                                   aVariablePtr ) )
        {
            return true;
        }
    }
    
    return false;
}
예제 #4
0
/**
 * @return The insertion point of the drawing into the paper space.
 * This is the distance from the lower left paper edge to the zero
 * point of the drawing. DXF: $PINSBASE.
 */
RS_Vector RS_Graphic::getPaperInsertionBase() {
    return getVariableVector("$PINSBASE", RS_Vector(0.0,0.0));
}