示例#1
0
void ImageCollection::layoutImmCollapsed()
{
    tl.complete();

    _collapseLayer.moveToParent(&_iconItem);
    QPoint p = collapsePoint();

    for(int ii = 0; ii < count(); ++ii) {

        Image *img = image(ii);
        img->imageParent().setValue(0.);
        img->moveToParent(iconItem());

#define PHOTO_OFFSET 7
        switch(ii) {
            case 0:
                img->x().setValue( p.x() - PHOTO_OFFSET);
                img->y().setValue( p.y() - PHOTO_OFFSET);
                img->quality().setValue( 1.);
                img->visible().setValue( 1.);
                break;
            case 1:
                img->x().setValue( p.x() + PHOTO_OFFSET);
                img->y().setValue( p.y() - PHOTO_OFFSET);
                img->quality().setValue( 1.);
                img->visible().setValue( 1.);
                break;
            case 2:
                img->x().setValue( p.x() + PHOTO_OFFSET);
                img->y().setValue( p.y() + PHOTO_OFFSET);
                img->quality().setValue( 1.);
                img->visible().setValue( 1.);
                break;
            case 3:
                img->x().setValue( p.x() - PHOTO_OFFSET);
                img->y().setValue( p.y() + PHOTO_OFFSET);
                img->quality().setValue( 1.);
                img->visible().setValue( 1.);
                break;
            default:
                img->x().setValue( p.x());
                img->y().setValue( p.y());
                img->visible().setValue( 0.);
                break;
        }
        img->imageParent().setValue(1.);
        img->scale().setValue( SMALL_ZOOM * .7);

        int rotate = (qrand() % 40) - 20;
        img->rotate().setValue(rotate);
        img->imageParent().setValue(1.);
    } 
    GfxCanvasItem *i = nameItem();
    i->visible().setValue(1.);
}
示例#2
0
/*
 1.14 collapseWithHoles collapses (or expands) the Face with all of its holes.
 
*/
MFace Face::collapseWithHoles(bool close) {
    MFace ret(collapse(close));

    for (unsigned int i = 0; i < holes.size(); i++) {
        ret.AddConcavity(holes[i].collapse(close, collapsePoint()));
    }

    ret.MergeConcavities();

    return ret;
}
示例#3
0
void ImageCollection::layoutCollapsed()
{
    tl.complete();

    _collapseLayer.moveToParent(&_iconItem);

    QPoint p = collapsePoint();

    int seenOnScreen = 0;
    int f = focused();

    _collapseLayer.z().setValue(-10000.);
    for(int ii = count() - 1; ii >= 0; --ii) {

        Image *img = image(ii);
        img->moveToParent(iconItem());

        if(!isOnScreen(ii))
            continue;

        seenOnScreen++;

        int pauseTime = (seenOnScreen - 1) * 50;
        tl.pause(img->x(), pauseTime);
        tl.pause(img->y(), pauseTime);
        tl.pause(img->rotate(), pauseTime);
        img->z().setValue(-ii);

        if(ii == f) {
            tl.move(img->scale(), SMALL_ZOOM, 50);
            tl.sync(img->z(), img->scale());
            img->z().setValue(1);
            tl.set(img->z(), -ii);

            if(pauseTime > 50)
                tl.pause(img->scale(), pauseTime - 50);
        } else {
            tl.pause(img->scale(), pauseTime);
        }
    }
    seenOnScreen = 0;
    for(int ii = 0; ii < count(); ++ii) {
        if(!isOnScreen(ii))
            continue;
        seenOnScreen++;

        Image *img = image(ii);

#define PHOTO_OFFSET 7
        int idx = seenOnScreen;
        switch(idx) {
            case 0:
                tl.move(img->x(), p.x() - PHOTO_OFFSET, 150);
                tl.move(img->y(), p.y() - PHOTO_OFFSET, 150);
                tl.sync(img->quality(), img->x());
                tl.set(img->quality(), 1.);
                break;
            case 1:
                tl.move(img->x(), p.x() + PHOTO_OFFSET, 150);
                tl.move(img->y(), p.y() - PHOTO_OFFSET, 150);
                tl.sync(img->quality(), img->x());
                tl.set(img->quality(), 1.);
                break;
            case 2:
                tl.move(img->x(), p.x() + PHOTO_OFFSET, 150);
                tl.move(img->y(), p.y() + PHOTO_OFFSET, 150);
                tl.sync(img->quality(), img->x());
                tl.set(img->quality(), 1.);
                break;
            case 3:
                tl.move(img->x(), p.x() - PHOTO_OFFSET, 150);
                tl.move(img->y(), p.y() + PHOTO_OFFSET, 150);
                tl.sync(img->quality(), img->x());
                tl.set(img->quality(), 1.);
                break;
            default:
                tl.move(img->x(), p.x(), 150);
                tl.move(img->y(), p.y(), 150);
                //tl.set(img->quality(), 0.);
                break;
        }
        int rotate = (qrand() % 40) - 20;
        if(isOnScreen(ii)) {
            tl.move(img->scale(), SMALL_ZOOM * .7, 150);
            tl.move(img->rotate(), rotate, 150);
            tl.sync(image(ii)->imageParent(), image(ii)->x());
            tl.set(image(ii)->imageParent(), 1.);
        } else {
            img->scale().setValue(SMALL_ZOOM * .7);
            img->rotate().setValue(rotate);
            img->visible().setValue(0.);
            img->imageParent().setValue(1.);
        }
    } 
    tl.sync();
    seenOnScreen = 0;
    for(int ii = 0; ii < count(); ++ii) {
        if(!isOnScreen(ii))
            continue;
        seenOnScreen++;

        if(seenOnScreen > 4) 
            tl.set(image(ii)->visible(), 0.);
    }
    GfxCanvasItem *i = nameItem();
    tl.move(i->visible(), 1., 300);
}
示例#4
0
/*
  1.15 Wrapper around 1.13 which selects the collapse-point automatically
 
*/
MSegs Face::collapse(bool close) {
    Pt dst = collapsePoint();

    return collapse(close, dst);
}