Exemple #1
0
ArbRamp::ArbRamp(QWidget *parent) : QMainWindow(parent), ui(new Ui::ArbRamp) {
    ui->setupUi(this);
    curLine=-1;
    nLines=0;
    render=new RenderRamp();
    ui->scrollArea->setWidget(render);
    delegate=new RampDelegate(ui->tableWidget);
    ui->tableWidget->setItemDelegate(delegate);
    setCurrentFile("");
    curDir="";
    readSettings();
    addAction=new QAction(tr("Insert"),this);
    delAction=new QAction(tr("Delete"),this);
    updateAction=new QAction(tr("Update view"),this);
    ui->mainToolBar->addAction(addAction);
    ui->mainToolBar->addAction(delAction);
    ui->mainToolBar->addAction(updateAction);
    //Connect signal and slots.
    connect(ui->action_About,SIGNAL(triggered()),this,SLOT(about()));
    connect(ui->action_Quit,SIGNAL(triggered()),this,SLOT(close()));
    connect(ui->action_Save,SIGNAL(triggered()),this,SLOT(save()));
    connect(ui->actionSave_As,SIGNAL(triggered()),this,SLOT(saveAs()));
    connect(ui->action_Open,SIGNAL(triggered()),this,SLOT(open()));
    connect(ui->actionNew,SIGNAL(triggered()),this,SLOT(newRamp()));
    connect(ui->action_Export,SIGNAL(triggered()),this,SLOT(exportRamp()));
    connect(ui->mainToolBar,SIGNAL(actionTriggered(QAction*)),this,
            SLOT(chooseAction(QAction*)));
    connect(this,SIGNAL(renderUpdate(QList<QPoint>)),render,
            SLOT(updatePoints(QList<QPoint>)));
    connect(ui->tableWidget,SIGNAL(currentCellChanged(int,int,int,int)),this,
            SLOT(currentLine(int,int,int,int)));
    //So that wasModified has access to the real size of the RenderRamp object.
    show();
    wasModified();
}
Exemple #2
0
	/**
	  This request is broadcast every time a client viewpoint changes.
	  Internally, it asks the stored CkViewables if they should redraw,
	  and if so, queues up a LV3D_RenderMsg.
	 */
	void viewpoint(const LV3D_ViewpointMsg *m) {
		if (renderRequested) 
		{ // Already wanting to render-- just update the viewpoint:
	status("Updating pending render...\n");
			renderUpdate(m);
		}
		else if (viewable) {
		  if ((!view) || viewable->shouldRender(m->viewpoint,*view)) 
		  { // Need to ask for a new rendering:
	status("Reqesting rendering...\n");
			renderRequested=true;
			renderUpdate(m);
			double sizeAdjust=viewable->getSize(renderViewpoint);
			LV3D_RenderMsg *rm= LV3D_RenderMsg::new_(
				m->clientID,m->frameID,0,sizeAdjust);
			array->thisProxy[array->thisIndexMax].LV3D_Render(rm);
		  }
		}
	}
Exemple #3
0
void renderReshape(int width, int height) {
    if (height == 0) {
        height = 1;
    }

     renderEnv.viewWidth = width;
    renderEnv.viewHeight = height;

    renderUpdate();
}
Exemple #4
0
void ArbRamp::wasModified() {
    isModified=true;
    QList<QPoint> points;
    double tMax=0;
    if(nLines>0)
        tMax=ui->tableWidget->item(nLines-1,0)->text().toDouble();
    for(int i=0;i<nLines;i++) {
        int x=(int)(render->width()*ui->tableWidget->item(i,0)->text()
                    .toDouble()/tMax);
        int y=(int)(render->height()*(1.0-ui->tableWidget->item(i,1)->text()
                                      .toDouble()/1e2));
        points << QPoint(x,y);
    }
    emit renderUpdate(points);
}