예제 #1
0
MainWindow::MainWindow()  {
    //We need a scene and a view to do graphics in QT
    scene = new QGraphicsScene();
    view = new QGraphicsView( scene );
		
		//This adds a button to the window and connects it to the timer
		button = new QPushButton("Start/Stop", view);
    connect(button, SIGNAL(clicked()), this, SLOT(buttonPress()));

    //To fill a rectangle use a QBrush. To draw the border of a shape, use a QPen
    QBrush redBrush(Qt::red);

    //First 2 arguments are the x, y, of the upper left of the rectangle.
    //The second 2 arguments are the width and height
    //The last 2 arguments are the velocity in the x, and y, directions
    item = new BouncingRectangle( 11.0, 74.0, 20.0, 20.0, 2, 3 );
    item->setBrush( redBrush );
    scene->addItem( item );

    //This sets the size of the window and gives it a title.
    view->setFixedSize( WINDOW_MAX_X*2, WINDOW_MAX_Y*2 );
    view->setWindowTitle( "Bouncing Rectangles!");

    //This is how we do animation. We use a timer with an interval of 5 milliseconds
    //We connect the signal from the timer - the timeout() function to a function
    //of our own - called handleTimer - which is in this same MainWindow class
    timer = new QTimer(this);
    timer->setInterval(5);
    connect(timer, SIGNAL(timeout()), this, SLOT(handleTimer()));
    
    timer2 = new QTimer(this);
    timer2->setInterval(250);
    connect(timer2, SIGNAL(timeout()), this, SLOT(addRectangle()));

}
예제 #2
0
파일: canvas.cpp 프로젝트: Andreas665/qt
Main::Main(QGraphicsScene& c, QWidget* parent, const char* name, Qt::WindowFlags f) :
    Q3MainWindow(parent,name,f),
    canvas(c)
{
    editor = new FigureEditor(canvas,this);
    QMenuBar* menu = menuBar();

    Q3PopupMenu* file = new Q3PopupMenu( menu );
    file->insertItem("&Fill canvas", this, SLOT(init()), Qt::CTRL+Qt::Key_F);
    file->insertItem("&Erase canvas", this, SLOT(clear()), Qt::CTRL+Qt::Key_E);
    file->insertItem("&New view", this, SLOT(newView()), Qt::CTRL+Qt::Key_N);
    file->insertSeparator();
    file->insertItem("&Print...", this, SLOT(print()), Qt::CTRL+Qt::Key_P);
    file->insertSeparator();
    file->insertItem("E&xit", qApp, SLOT(quit()), Qt::CTRL+Qt::Key_Q);
    menu->insertItem("&File", file);

    Q3PopupMenu* edit = new Q3PopupMenu( menu );
    edit->insertItem("Add &Circle", this, SLOT(addCircle()), Qt::ALT+Qt::Key_C);
    edit->insertItem("Add &Hexagon", this, SLOT(addHexagon()), Qt::ALT+Qt::Key_H);
    edit->insertItem("Add &Polygon", this, SLOT(addPolygon()), Qt::ALT+Qt::Key_P);
    edit->insertItem("Add Spl&ine", this, SLOT(addSpline()), Qt::ALT+Qt::Key_I);
    edit->insertItem("Add &Text", this, SLOT(addText()), Qt::ALT+Qt::Key_T);
    edit->insertItem("Add &Line", this, SLOT(addLine()), Qt::ALT+Qt::Key_L);
    edit->insertItem("Add &Rectangle", this, SLOT(addRectangle()), Qt::ALT+Qt::Key_R);
    edit->insertItem("Add &Sprite", this, SLOT(addSprite()), Qt::ALT+Qt::Key_S);
    edit->insertItem("Create &Mesh", this, SLOT(addMesh()), Qt::ALT+Qt::Key_M );
    edit->insertItem("Add &Alpha-blended image", this, SLOT(addButterfly()), Qt::ALT+Qt::Key_A);
    menu->insertItem("&Edit", edit);

    Q3PopupMenu* view = new Q3PopupMenu( menu );
    view->insertItem("&Enlarge", this, SLOT(enlarge()), Qt::SHIFT+Qt::CTRL+Qt::Key_Plus);
    view->insertItem("Shr&ink", this, SLOT(shrink()), Qt::SHIFT+Qt::CTRL+Qt::Key_Minus);
    view->insertSeparator();
    view->insertItem("&Rotate clockwise", this, SLOT(rotateClockwise()), Qt::CTRL+Qt::Key_PageDown);
    view->insertItem("Rotate &counterclockwise", this, SLOT(rotateCounterClockwise()), Qt::CTRL+Qt::Key_PageUp);
    view->insertItem("&Zoom in", this, SLOT(zoomIn()), Qt::CTRL+Qt::Key_Plus);
    view->insertItem("Zoom &out", this, SLOT(zoomOut()), Qt::CTRL+Qt::Key_Minus);
    view->insertItem("Translate left", this, SLOT(moveL()), Qt::CTRL+Qt::Key_Left);
    view->insertItem("Translate right", this, SLOT(moveR()), Qt::CTRL+Qt::Key_Right);
    view->insertItem("Translate up", this, SLOT(moveU()), Qt::CTRL+Qt::Key_Up);
    view->insertItem("Translate down", this, SLOT(moveD()), Qt::CTRL+Qt::Key_Down);
    view->insertItem("&Mirror", this, SLOT(mirror()), Qt::CTRL+Qt::Key_Home);
    menu->insertItem("&View", view);

    menu->insertSeparator();

    Q3PopupMenu* help = new Q3PopupMenu( menu );
    help->insertItem("&About", this, SLOT(help()), Qt::Key_F1);
    help->setItemChecked(dbf_id, TRUE);
    menu->insertItem("&Help",help);

    statusBar();

    setCentralWidget(editor);

    printer = 0;

    init();
}
예제 #3
0
void MapBox::drawRect()
{
    if (m_markerObjects.count() < 2)  return;
    QGeoMapPixmapObject * p1 = m_markerObjects.at(0);
    QGeoMapPixmapObject * p2 = m_markerObjects.at(1);

    addRectangle(p1->coordinate(), p2->coordinate());
}
예제 #4
0
rectangle_s* addRoomRectangle(room_s* r, rectangle_s rec)
{
	if((!rec.size.x && (!rec.size.z || !rec.size.y)) || (!rec.size.y && !rec.size.z))return NULL;
	rec.hide=false;
	rec.touched=false;
	rec.aar=NULL;
	return addRectangle(rec, &r->rectangles);
}
예제 #5
0
template <typename T> bool
pcl::visualization::ImageViewer::addRectangle (
    const typename pcl::PointCloud<T>::ConstPtr &image,
    const pcl::PointCloud<T> &mask, 
    const std::string &layer_id, double opacity)
{
  return (addRectangle (image, mask, 0.0, 1.0, 0.0, layer_id, opacity));
}
예제 #6
0
void MainWindow::fillView()
{
    for (int i = 0; i < 10; i++) {
        addRectangle();
        addEllipse();
        addLine();
        addText();
    }
    canvas->update();
}
예제 #7
0
파일: UIPanel.cpp 프로젝트: wibbe/three-cpp
  void UIPanel::separatorLine()
  {
    int x = _state.widgetX;
    int y = _state.widgetY; // + DEFAULT_SPACING * 0.5f;
    int w = _state.widgetW;
    int h = 1;
    _state.widgetY += DEFAULT_SPACING * 2;

    addRectangle(_faceMesh->geometry, Vector2(x, y), Vector2(w, h), Color(1, 1, 1, 0.12));
  }
예제 #8
0
void SimpleGraphicsView::mouseReleaseEvent(QMouseEvent* e)
{
    QPointF mendPoint = mapToScene(e->pos());
    QPointF mStartPoint = mapToScene(startPoint_);
    QPointF deltaPoint = mendPoint - mStartPoint;

    if (rubberBandActive_ && (deltaPoint.x()>5 && deltaPoint.y()>5)) {
        if (e->modifiers() == Qt::ShiftModifier) {
            //add a square
            (deltaPoint.x()>deltaPoint.y())?deltaPoint.setY(deltaPoint.x()):deltaPoint.setX(deltaPoint.y());
        }

        if (!readOnly_)
            addRectangle(mStartPoint, deltaPoint);
    }

    rubberBandActive_ = false;
    //e->accept();
    QGraphicsView::mouseReleaseEvent(e);
}
예제 #9
0
MainWindow::MainWindow(QWidget* parent)
	: QMainWindow(parent)
{
	m_view = new WGraphicsView();
	m_scene = new QGraphicsScene(this);
	m_scene->setSceneRect(QRectF(0,0,1000,800));
	m_view->setScene(m_scene);

	QMenu* fileMenu = new QMenu(tr("&File"), this);
	fileMenu->addAction(tr("E&xit"), this, SLOT(close()));

	QMenu* editMenu = new QMenu(tr("&Edit"), this);
	editMenu->addAction(tr("Add &Rectangle"), this, SLOT(addRectangle()));

	QMenuBar* menuBar = this->menuBar();
	menuBar->addMenu(fileMenu);
	menuBar->addMenu(editMenu);

	setCentralWidget(m_view);
}
예제 #10
0
void MapBox::testDateline()
{
    m_mapWidget->setCenter(QGeoCoordinate(0.0, 180.0));
    m_mapWidget->setZoomLevel(5.0);

    QList<QGeoCoordinate> dateline;

    dateline << QGeoCoordinate(-15.0, 180.0);
    dateline << QGeoCoordinate(15.0, 180.0);

    QGeoMapPolylineObject *datelineObject = new QGeoMapPolylineObject();
    datelineObject->setPath(dateline);
    QPen p(Qt::DashLine);
    p.setColor(Qt::black);
    p.setWidth(2);
    //p.setCosmetic(true);
    datelineObject->setPen(p);

    m_mapWidget->addMapObject(datelineObject);

    addRectangle(QGeoCoordinate(-5.0, 179.0), QGeoCoordinate(-6.0, -179.0));
    addCircle(QGeoCoordinate(-7.0, 180.0), 50000.0);

    QList<QGeoCoordinate> polyline;

    polyline << QGeoCoordinate(-3.0, 180.0);
    polyline << QGeoCoordinate(-4.0, 179.0);
    polyline << QGeoCoordinate(-4.0, -179.0);

    addPolyline(polyline);

    QList<QGeoCoordinate> polygon;

    polygon << QGeoCoordinate(0.0, 180.0);
    polygon << QGeoCoordinate(-2.0, 179.0);
    polygon << QGeoCoordinate(-2.0, -179.0);

    addPolygon(polygon);

    QPixmap pixmap(48, 48);
    QPainter pixmapPainter(&pixmap);
    pixmapPainter.fillRect(pixmap.rect(), Qt::yellow);
    pixmapPainter.setPen(QPen(Qt::black));
    pixmapPainter.setBrush(QBrush(Qt::black));

    QFont font = pixmapPainter.font();
    font.setPointSize(8);
    pixmapPainter.setFont(font);

    pixmapPainter.drawText(pixmap.rect(), Qt::AlignCenter, "Pixmap");

    addPixmap(QGeoCoordinate(6.0, 180.0), QPoint(-1 * pixmap.width() / 2, -1 * pixmap.width() / 2), pixmap);

    addText(QGeoCoordinate(4.0, 180.0), QString("Text"));

    QList<QGeoCoordinate> route;

    route << QGeoCoordinate(3.0, 180.0);
    route << QGeoCoordinate(2.5, 179.0);
    route << QGeoCoordinate(1.5, 179.0);
    route << QGeoCoordinate(1.0, 180.0);
    route << QGeoCoordinate(1.5, -179.0);
    route << QGeoCoordinate(2.5, -179.0);

    addFakeRoute(route, 3);

    QGraphicsEllipseItem *ellipseItem = new QGraphicsEllipseItem(QRectF(0.0, 0.0, 96.0, 48.0));
    ellipseItem->setBrush(Qt::red);

    addCustom(QGeoCoordinate(10.0, 180.0), QPoint(-48, -24), ellipseItem);
}
예제 #11
0
QGeoMapRectangleObject * MapBox::addRectangle(qreal top, qreal left, qreal bottom, qreal right)
{
    return addRectangle(QGeoCoordinate(top, left), QGeoCoordinate(bottom, right));
}
예제 #12
0
void blockColoured(float x, float y, float z){
  pushMatrix();
    translate(x, y, z);
    translate(-0.5, -3.0, 0.0);
    pushMatrix();
       addRectangle(vertex(0.0, 1.5, -0.5), vertex(0.0, -1.5, -0.5), 127<<8);
       translate(1.0, 0.0, 0.0);
       addRectangle(vertex(0.0, -1.5, -0.5), vertex(0.0, 1.5, -0.5), 127<<8);
       translate(-0.5, 0.0, -0.5);
       addRectangle(vertex(0.5, 1.5, 0.0), vertex(0.5, -1.5, 0.0), 127<<8);
       translate(0.0, 0.0, 1.0);
       addRectangle(vertex(0.5, -1.5, 0.0), vertex(0.5, 1.5, 0.0), 127<<8);
    popMatrix();
    translate(0.0, 3.0, 0.0);
    pushMatrix();
       addRectangle(vertex(0.0, 1.5, -0.5), vertex(0.0, -1.5, -0.5), 127<<16);
       translate(1.0, 0.0, 0.0);
       addRectangle(vertex(0.0, -1.5, -0.5), vertex(0.0, 1.5, -0.5), 127<<16);
       translate(-0.5, 0.0, -0.5);
       addRectangle(vertex(0.5, 1.5, 0.0), vertex(0.5, -1.5, 0.0), 127<<16);
       translate(0.0, 0.0, 1.0);
       addRectangle(vertex(0.5, -1.5, 0.0), vertex(0.5, 1.5, 0.0), 127<<16);
    popMatrix();
    translate(0.0, 3.0, 0.0);
    pushMatrix();
       addRectangle(vertex(0.0, 1.5, -0.5), vertex(0.0, -1.5, -0.5), 127);
       translate(1.0, 0.0, 0.0);
       addRectangle(vertex(0.0, -1.5, -0.5), vertex(0.0, 1.5, -0.5), 127);
       translate(-0.5, 0.0, -0.5);
       addRectangle(vertex(0.5, 1.5, 0.0), vertex(0.5, -1.5, 0.0), 127);
       translate(0.0, 0.0, 1.0);
       addRectangle(vertex(0.5, -1.5, 0.0), vertex(0.5, 1.5, 0.0), 127);
    popMatrix();
    translate(0.5, 1.5, 0.0);
    addRectangle(vertex(-0.5, 0.0, -0.5), vertex(-0.5, 0.0, 0.5), 127);
    translate(0.0, -9.0, 0.0);
    addRectangle(vertex(-0.5, 0.0, 0.5), vertex(-0.5, 0.0, -0.5), 127<<8);
  popMatrix();
}
예제 #13
0
파일: KiwiPath.cpp 프로젝트: EQ4/KiwiGui
 void Path::addRectangle(Rectangle const& rect, const double r) noexcept
 {
     addRectangle(rect.x(), rect.y(), rect.width(), rect.height(), r, r,
                  Rectangle::TopLeft | Rectangle::TopRight | Rectangle::BottomLeft | Rectangle::BottomRight);
 }
예제 #14
0
void drawA(float x, float y, float z){
  addToStack();
    translate(x, y, z);
    addToStack();
      translate(2.5, 0.0, 0.0);
      addRectangle(vertex(0.0, 1.5, 2.5), vertex(0.0, -1.5, 2.5), YELLOW);
      translate(-5.0, 0.0, 0.0);
      addRectangle(vertex(0.0, -1.5, 2.5), vertex(0.0, 1.5, 2.5), YELLOW);
    removeFromStack();
    addToStack();
      translate(0.5, 0.0, 0.0);
      addRectangle(vertex(0.0, -1.5, 0.5), vertex(0.0, 1.5, 0.5), GREY);
      translate(-1.0, 0.0, 0.0);
      addRectangle(vertex(0.0, 1.5, 0.5), vertex(0.0, -1.5, 0.5), GREY);
    removeFromStack();
    addToStack();
      translate(0.0, 0.0, 2.5);
      addRectangle(vertex(-2.5, 1.5, 0.0), vertex(-2.5, -1.5, 0.0), YELLOW);
      translate(0.0, 0.0, -5.0);
      addRectangle(vertex(-2.5, -1.5, 0.0), vertex(-2.5, 1.5, 0.0), YELLOW);
    removeFromStack();
    addToStack();
      translate(0.0, 0.0, 0.5);
      addRectangle(vertex(-0.5, -1.5, 0.0), vertex(-0.5, 1.5, 0.0), GREY);
      translate(0.0, 0.0, -1.0);
      addRectangle(vertex(-0.5, 1.5, 0.0), vertex(-0.5, -1.5, 0.0), GREY);
    removeFromStack();
    addToStack();
      translate(1.5, 1.5, 0.0);
      addRectangle(vertex(-1.0, 0.0, -0.5), vertex(-1.0, 0.0, 0.5), YELLOW);
      addToStack();
        translate(0.0, -3.0, 0.0);
        addRectangle(vertex(-1.0, 0.0, 0.5), vertex(-1.0, 0.0, -0.5), YELLOW);
      removeFromStack();
      translate(-3.0, 0.0, 0.0);
      addRectangle(vertex(-1.0, 0.0, -0.5), vertex(-1.0, 0.0, 0.5), YELLOW);
      addToStack();
        translate(0.0, -3.0, 0.0);
        addRectangle(vertex(-1.0, 0.0, 0.5), vertex(-1.0, 0.0, -0.5), YELLOW);
      removeFromStack();
    removeFromStack();
    addToStack();
      translate(0.0, 1.5, 1.5);
      addRectangle(vertex(-2.5, 0.0, -1.0), vertex(-2.5, 0.0, 1.0), YELLOW);
      addToStack();
        translate(0.0, -3.0, 0.0);
        addRectangle(vertex(-2.5, 0.0, 1.0), vertex(-2.5, 0.0, -1.0), YELLOW);
      removeFromStack();
      translate(0.0, 0.0, -3.0);
      addRectangle(vertex(-2.5, 0.0, -1.0), vertex(-2.5, 0.0, 1.0), YELLOW);
      addToStack();
        translate(0.0, -3.0, 0.0);
        addRectangle(vertex(-2.5, 0.0, 1.0), vertex(-2.5, 0.0, -1.0), YELLOW);
      removeFromStack();
    removeFromStack();
  removeFromStack();
} 
예제 #15
0
Main::Main(QCanvas& c, QWidget* parent, const char* name, WFlags f) :
    QMainWindow(parent,name,f),
    canvas(c)
{
    editor = new FigureEditor(canvas,this); // 繼承canvas view而來
    QMenuBar* menu = menuBar();

    QPopupMenu* file = new QPopupMenu( menu ); // 當parent被刪除,則子類別也會被刪除
    file->insertItem("&Fill canvas", this, SLOT(init()), CTRL+Key_F);
    file->insertItem("&Erase canvas", this, SLOT(clear()), CTRL+Key_E);
    file->insertItem("&New view", this, SLOT(newView()), CTRL+Key_N);
    file->insertSeparator();
    file->insertItem("&Print...", this, SLOT(print()), CTRL+Key_P);
    file->insertSeparator();
    file->insertItem("E&xit", qApp, SLOT(quit()), CTRL+Key_Q);
    menu->insertItem("&File", file); // 建立一個工具列名為File的label

    QPopupMenu* edit = new QPopupMenu( menu );
    edit->insertItem("Add &Circle", this, SLOT(addCircle()), ALT+Key_C);
    edit->insertItem("Add &Hexagon", this, SLOT(addHexagon()), ALT+Key_H);
    edit->insertItem("Add &Polygon", this, SLOT(addPolygon()), ALT+Key_P);
    edit->insertItem("Add Spl&ine", this, SLOT(addSpline()), ALT+Key_I);
    edit->insertItem("Add &Text", this, SLOT(addText()), ALT+Key_T);
    edit->insertItem("Add &Line", this, SLOT(addLine()), ALT+Key_L);
    edit->insertItem("Add &Rectangle", this, SLOT(addRectangle()), ALT+Key_R);
    edit->insertItem("Add &Sprite", this, SLOT(addSprite()), ALT+Key_S);
    edit->insertItem("Create &Mesh", this, SLOT(addMesh()), ALT+Key_M );
    edit->insertItem("Add &Alpha-blended image", this, SLOT(addButterfly()), ALT+Key_A);
    menu->insertItem("&Edit", edit);

    QPopupMenu* view = new QPopupMenu( menu );
    view->insertItem("&Enlarge", this, SLOT(enlarge()), SHIFT+CTRL+Key_Plus);
    view->insertItem("Shr&ink", this, SLOT(shrink()), SHIFT+CTRL+Key_Minus);
    view->insertSeparator();
    view->insertItem("&Rotate clockwise", this, SLOT(rotateClockwise()), CTRL+Key_PageDown);
    view->insertItem("Rotate &counterclockwise", this, SLOT(rotateCounterClockwise()), CTRL+Key_PageUp);
    view->insertItem("&Zoom in", this, SLOT(zoomIn()), CTRL+Key_Plus);
    view->insertItem("Zoom &out", this, SLOT(zoomOut()), CTRL+Key_Minus);
    view->insertItem("Translate left", this, SLOT(moveL()), CTRL+Key_Left);
    view->insertItem("Translate right", this, SLOT(moveR()), CTRL+Key_Right);
    view->insertItem("Translate up", this, SLOT(moveU()), CTRL+Key_Up);
    view->insertItem("Translate down", this, SLOT(moveD()), CTRL+Key_Down);
    view->insertItem("&Mirror", this, SLOT(mirror()), CTRL+Key_Home);
    menu->insertItem("&View", view);

    options = new QPopupMenu( menu );
    dbf_id = options->insertItem("Double buffer", this, SLOT(toggleDoubleBuffer()));
    options->setItemChecked(dbf_id, TRUE);
    menu->insertItem("&Options",options);

    menu->insertSeparator();

    QPopupMenu* help = new QPopupMenu( menu );
    help->insertItem("&About", this, SLOT(help()), Key_F1);
    help->setItemChecked(dbf_id, TRUE); // 很奇怪,當TRUE時,把dbf_id打勾,不懂
    menu->insertItem("&Help",help);

    statusBar();
    // 返回這個窗口的狀態條。如果沒有的話
    // statusBar()會創建一個空的狀態條,並且如果需要也創建一個工具提示組。

    setCentralWidget(editor);

    printer = 0;

    init();
}
예제 #16
0
void MainWindow::newRectangle()
{
    QtCanvasItem *item = addRectangle();
    canvas->update();
    itemClicked(item);
}
예제 #17
0
void blockWithHole(float x, float y, float z){
  int yellow=127+(127<<8), grey=100+(100<<8)+(100<<16);
  pushMatrix();
    translate(x, y, z);
    pushMatrix();
      translate(2.5, 0.0, 0.0);
if(!q4)       addRectangle(vertex(0.0, 1.5, 2.5), vertex(0.0, -1.5, 2.5), yellow);
      translate(-5.0, 0.0, 0.0);
if(!q4)       addRectangle(vertex(0.0, -1.5, 2.5), vertex(0.0, 1.5, 2.5), yellow);
    popMatrix();
    pushMatrix();
      translate(0.5, 0.0, 0.0);
      addRectangle(vertex(0.0, -1.5, 0.5), vertex(0.0, 1.5, 0.5), grey);
      translate(-1.0, 0.0, 0.0);
      addRectangle(vertex(0.0, 1.5, 0.5), vertex(0.0, -1.5, 0.5), grey);
    popMatrix();
    pushMatrix();
      translate(0.0, 0.0, 2.5);
if(!q4)       addRectangle(vertex(-2.5, 1.5, 0.0), vertex(-2.5, -1.5, 0.0), yellow);
      translate(0.0, 0.0, -5.0);
if(!q4)       addRectangle(vertex(-2.5, -1.5, 0.0), vertex(-2.5, 1.5, 0.0), yellow);
    popMatrix();
    pushMatrix();
      translate(0.0, 0.0, 0.5);
      addRectangle(vertex(-0.5, -1.5, 0.0), vertex(-0.5, 1.5, 0.0), grey);
      translate(0.0, 0.0, -1.0);
      addRectangle(vertex(-0.5, 1.5, 0.0), vertex(-0.5, -1.5, 0.0), grey);
    popMatrix();
    pushMatrix();
      translate(1.5, 1.5, 0.0);
if(!q4)       addRectangle(vertex(-1.0, 0.0, -0.5), vertex(-1.0, 0.0, 0.5), yellow);
      pushMatrix();
        translate(0.0, -3.0, 0.0);
if(!q4)         addRectangle(vertex(-1.0, 0.0, 0.5), vertex(-1.0, 0.0, -0.5), yellow);
      popMatrix();
      translate(-3.0, 0.0, 0.0);
if(!q4)       addRectangle(vertex(-1.0, 0.0, -0.5), vertex(-1.0, 0.0, 0.5), yellow);
      pushMatrix();
        translate(0.0, -3.0, 0.0);
if(!q4)         addRectangle(vertex(-1.0, 0.0, 0.5), vertex(-1.0, 0.0, -0.5), yellow);
      popMatrix();
    popMatrix();
    pushMatrix();
      translate(0.0, 1.5, 1.5);
if(!q4)       addRectangle(vertex(-2.5, 0.0, -1.0), vertex(-2.5, 0.0, 1.0), yellow);
      pushMatrix();
        translate(0.0, -3.0, 0.0);
if(!q4)         addRectangle(vertex(-2.5, 0.0, 1.0), vertex(-2.5, 0.0, -1.0), yellow);
      popMatrix();
      translate(0.0, 0.0, -3.0);
if(!q4)       addRectangle(vertex(-2.5, 0.0, -1.0), vertex(-2.5, 0.0, 1.0), yellow);
      pushMatrix();
        translate(0.0, -3.0, 0.0);
if(!q4)         addRectangle(vertex(-2.5, 0.0, 1.0), vertex(-2.5, 0.0, -1.0), yellow);
      popMatrix();
    popMatrix();
  popMatrix();
}