示例#1
0
/**
 * Sets given model to edit widget.
 */
void TopologyWidget::setModel(TopologyEditModel* model){
	this->model = model;
    npw->setModel(model);

    //clears widget when NULL pointer given
	if(model == NULL){
		ui->itemName->setText(QString());
		clearView();
    }
    //fills view with model data
    else{
		bool saved = model->isSaved();
		ui->itemName->setText(model->name());
		clearView();
		makeView();
		connect(
			model, SIGNAL(changed(ChangeType)),
			this, SLOT(modelChanged(ChangeType)),
			Qt::UniqueConnection
		);
        if(model->selectedLayer() >= 0 && model->selectedLayer() < layerEditList.length()){
            layerEditList[model->selectedLayer()]->setSelected(true);
            widgetPressed(layerEditList[model->selectedLayer()]);
        }
        else if(layerEditList.length() > 0){
            model->setSelectedLayer(layerEditList.length()-1);
            layerEditList[model->selectedLayer()]->setSelected(true);
            widgetPressed(layerEditList[model->selectedLayer()]);
        }
		model->setSaved(saved);
	}
}
示例#2
0
/**
 * Removes layer, redraws view and emmits modelChanged signal.
 */
void TopologyWidget::removeLayer(LayerEditWidget* widget){
	int layer = layerEditList.indexOf(widget)-1;
	model->removeLayer(layer);
	clearView();
	makeView();
	model->modelChanged(TopologyChange);
}
示例#3
0
/**
 * Removes selected layer, redraws view and emmits modelChanged signal.
 */
void TopologyWidget::removeSelected(){
	int layer = selectedLayer();
	if(layer == -2) return;
	model->removeLayer(layer);
	clearView();
	makeView();
	model->modelChanged(TopologyChange);
}
int main()
{
     /*#TS*/
     makeView("mainView", "wholeGraph","Higraph.PDV", "PlacedNode");
     setTitle("mainView", "Matrices PDV");
     setDefaultNodeValueShow(true, CENTER);
     setDefaultNodeValueColor(MARKER_RED);
     setDefaultNodeShape(RECTANGLE);
	 //ScriptManager::relay("HigraphManager", "setDefaultZoneColor", BLUE);
     ScriptManager::relay("HigraphManager", "setDefaultNodeFillColor", WHITE);
     ScriptManager::relay("HigraphManager", "setDefaultNodeValueShow", true, CENTER);
     ScriptManager::relay("HigraphManager", "setDefaultNodeValueColor", BLACK);
     ScriptManager::relay("HigraphManager", "setDefaultNodeNameShow", true, WEST);
     ScriptManager::relay("HigraphManager", "setDefaultNodeNameColor", MAGENTA);
	 ScriptManager::relay("HigraphManager", "setDefaultNodeShape", RECTANGLE);
	 ScriptManager::relay("HigraphManager","setDefaultNodeSize", 40, 40);
       
     /*#/TS*/
     const int rows = 2;
     const int cols = 3;
	 int val = 10;/*#TS*/ setupval(val);
	 /*#/TS*/
     
     int matrix[rows*cols];
     /*#TS*/makeArray(matrix,(rows*cols),true,"matrix[]");/*#/TS*/
	 int i,j;/*#TS*//*nodes for i & j*/setup_i_j(i,j);/*#/TS*/
	 
	 /*#TS*/int **mat = new int*[rows];
     for(int k=0;k<rows;k++)
        mat[k]=new int[cols];
     makeMatrix(mat,rows,cols,true,"Theoretical representation");/*#/TS*/
	 
     for(i = 0; i < rows; i++)
     {
        for(j = 0; j < cols; j++)
            {	/*#TS*/ScriptManager::relay("HigraphManager","setNodeFillColor", mat[i][j], YELLOW);
					ScriptManager::relay("HigraphManager","setNodeFillColor", matrix[(i*cols)+j], YELLOW);/*#/TS*/
				/*#TS*/	mat[i][j]=val;/*#/TS*/
                matrix[(i*cols)+j]=val++;
				/*#TS*/ScriptManager::relay("HigraphManager","setNodeFillColor", mat[i][j], WHITE);
					ScriptManager::relay("HigraphManager","setNodeFillColor", matrix[(i*cols)+j], WHITE);/*#/TS*/
			}
     }
	 
	 //Call module to add 1 to each element of matrix
	
	 add1(matrix, rows, cols);
	 
	 
	 
	 //See that the values of the original matrix have changed
     
     /*#TS*/
	 //ScriptManager::relay("HigraphManager","setNodeNameLabel",matrix,"matrix[]");
     /*#/TS*/
     return 0;
}
示例#5
0
void HPSThumbManager::loadThumbs(const QString &dir)
{
    qDebug() << Q_FUNC_INFO << dir;

        mListWidget->clear();
        QList<QStringList> list;
        list = mDatabaseHandler.hashPaths(dir);
        makeView(list);

}
示例#6
0
ValidDocument::ValidDocument(Document d){
    mdate=d.getDate();
    price=d.getTotalPrice();
    docType=d.m_docType;
    payment=d.m_payment;
    idCustomer=d.m_idCustomer;
    idDocument=d.getId();
    id=-1;
    view=makeView();
    tva=d.m_tva;
}
void ProcessPanelPresenter::on_focusedViewModelChanged(const LayerModel* theLM)
{
    if(theLM != m_layerModel)
    {
        m_layerModel = theLM;
        delete m_processPresenter;
        m_processPresenter = nullptr;

        if(!m_layerModel)
            return;

        auto& sharedmodel = m_layerModel->sharedProcessModel();
        auto fact = ProcessList::getFactory(sharedmodel.processName());

        auto proxy = m_layerModel->make_panelProxy(this);

        delete m_obj;
        m_obj = new ProcessPanelGraphicsProxy{*theLM, *this};
        // Add the items to the scene early because
        // the presenters might call scene() in their ctor.
        auto panelview = static_cast<ProcessPanelView*>(view());
        panelview->scene()->addItem(m_obj);

        m_layer = fact->makeView(proxy->viewModel(),
                                       m_obj);

        m_processPresenter = fact->makePresenter(proxy->viewModel(),
                                                 m_layer,
                                                 this);

        connect(m_layerModel, &QObject::destroyed,
                this, &ProcessPanelPresenter::cleanup);


        // Have a zoom here too. For now the process should be the size of the window.
        on_sizeChanged(panelview->view()->size());

        on_zoomChanged(0.03);
    }
}
示例#8
0
		WStringView name() const override{ return makeView( filename ); }
示例#9
0
/**
 * Appends layer, redraws view and emmits modelChanged signal.
 */
void TopologyWidget::appendLayer(){
	model->appendLayer();
	clearView();
	makeView();
	model->modelChanged(TopologyChange);
}
示例#10
0
		ByteView read( unsigned amount ){
			position += amount;
			return makeView( position - amount, amount );
		}
int main()
{    /*#TS*/
     makeView("mainView", "wholeGraph","Higraph.PDV", "PlacedNode");
     setTitle("mainView", "Matrices PDV");
     setDefaultNodeValueShow(true, CENTER);
     setDefaultNodeValueColor(BLACK);
     setDefaultNodeShape(RECTANGLE);
	 ScriptManager::relay("HigraphManager", "setDefaultNodeFillColor", WHITE);
     ScriptManager::relay("HigraphManager", "setDefaultNodeNameShow", true, WEST);
     ScriptManager::relay("HigraphManager", "setDefaultNodeNameColor", MAGENTA);
	 ScriptManager::relay("HigraphManager","setDefaultNodeSize", 40, 40);
       
     /*#/TS*/
     const int rows = 2;
     const int columns = 3;
	 double val = 10.0;/*#TS*/ setupval(val);
	 /*#/TS*/
     
     double A[rows*columns];/*#TS*/makeArray(A,rows,columns,true,"A[]", 320, 0);/*#/TS*/
     
	 int i,j;/*#TS*//*nodes for i & j*/setup_i_j(i,j);/*#/TS*//*#TS*/mat = new double*[rows];
     for(int k=0;k<rows;k++)
        mat[k]=new double[columns];
     makeMatrix(mat,rows,columns,true,"Matrix Form of A[]");
	 for(int k=0;k<rows;k++)
		for(int l=0;l<columns;l++)
			mat[k][l]=A[(k*columns)+l];/*#/TS*/
	 for(i = 0; i < rows; i++)
     {
        for(j = 0; j < columns; j++)
            {	/*#TS*/ScriptManager::relay("HigraphManager","setNodeFillColor", mat[i][j], YELLOW);
					ScriptManager::relay("HigraphManager","setNodeFillColor", A[(i*columns)+j], YELLOW);/*#/TS*/
				/*#TS*/	mat[i][j]=val;/*#/TS*/
                A[(i*columns)+j]=val;
				val+=1.5;/*#TS*/ScriptManager::relay("HigraphManager","setNodeFillColor", mat[i][j], color_lookup(i));
					ScriptManager::relay("HigraphManager","setNodeFillColor", A[(i*columns)+j], color_lookup(i));/*#/TS*/
			}
     }
	 
	 double scale_factor = .25;
	 /*#TS*/ScriptManager::relay("HigraphManager","makeNode", scale_factor);
	 ScriptManager::relay("HigraphManager","placeNode", scale_factor, 5, 320);
	 ScriptManager::relay("HigraphManager","setNodeValueShow", scale_factor, true);
	 ScriptManager::relay("HigraphManager","setNodeNameLabel", scale_factor, "scale_factor");
	 ScriptManager::relay("HigraphManager","setNodeNameNudge",scale_factor,-5,0);
	 /*#/TS*//*#TS*/p1=&i;p2=&j;/*#/TS*/
	 scale(A, rows, columns, scale_factor);
	   /*#TS*/ //UnHiding  i  and j 
	 ScriptManager::relay("HigraphManager","setNodeValueShow",i, true);
	 ScriptManager::relay("HigraphManager","setNodeNameShow", i, true);
	 ScriptManager::relay("HigraphManager","setNodeColor", i, BLACK);
	 ScriptManager::relay("HigraphManager","setNodeValueShow",j, true);
	 ScriptManager::relay("HigraphManager","setNodeNameShow", j, true);
	 ScriptManager::relay("HigraphManager","setNodeColor", j, BLACK);/*#/TS*/
	 double C[2*2];
	 /*#TS*/makeArray(C,2,2,true,"C[]", 400, 0);
	 ScriptManager::relay("HigraphManager","deleteNode", temp);
	 delete[] mat;
	 mat = new double*[2];
     for(int k=0;k<2;k++)
        mat[k]=new double[2];
     makeMatrix(mat,2,2,true,"Matrix Form of C[]");
	 for(int k=0;k<2;k++)
		for(int l=0;l<2;l++)
			mat[k][l]=C[(k*2)+l];/*#/TS*/
	 for(i = 0; i < 2; i++)
     {
        for(j = 0; j < 2; j++)
            {	/*#TS*/ScriptManager::relay("HigraphManager","setNodeFillColor", mat[i][j], YELLOW);ScriptManager::relay("HigraphManager","setNodeFillColor", C[(i*2)+j], YELLOW);/*#/TS*/ /*#TS*/	mat[i][j]=val;/*#/TS*/
                C[(i*2)+j]=val;
				val+=1.5; /*#TS*/ScriptManager::relay("HigraphManager","setNodeFillColor", mat[i][j], color_lookup(i));
					ScriptManager::relay("HigraphManager","setNodeFillColor", C[(i*2)+j], color_lookup(i));/*#/TS*/
			}
     }
	 
	 scale(C, 2, 2, scale_factor);  /*#TS*/ //UnHiding  i  and j 
	 ScriptManager::relay("HigraphManager","setNodeValueShow",i, true);
	 ScriptManager::relay("HigraphManager","setNodeNameShow", i, true);
	 ScriptManager::relay("HigraphManager","setNodeColor", i, BLACK);
	 ScriptManager::relay("HigraphManager","setNodeValueShow",j, true);
	 ScriptManager::relay("HigraphManager","setNodeNameShow", j, true);
	 ScriptManager::relay("HigraphManager","setNodeColor", j, BLACK);/*#/TS*/ /*#TS*/  ScriptManager::relay("HigraphManager","deleteNode", temp); /*#/TS*/
	 return 0;
}