[vtk-developers] Problem with Rendering?

Martin Waitzbauer mazzok at gmx.at
Tue Dec 28 18:07:55 EST 2010


Hi there

I have a problem with a vtkChartXY displaying 3 line plots
i have defiuned scaler widgets to call a method, that sets the parameter for the line

to di this
i create a vtkTable, add 4 columns(column 0 is the x axis, 1-4 are the lines), set the number of rows(512), and fill column  1-3 with zeros
(column zero is filled with user defined interval  values)
thats the initializing part
when the user use on of the scalers1-3, the double value is passed and draws line 1-3 with the passed value.
this is done by

setting the value of the column1-3 (representing a line) selected by scaler1-3 to the value (1-3)*SelectedScalerValue
-add a vtkPLot o the chart
-render the window
-remove all plots fomr the chartxy

the problem i have is that when the user uses scaler 1 , sets it to 1, line 1 is drawn with 1, so good for that
but when the sclaer is set back to 0, the line at 1 is still there, and remains there even if the scaler is drawn towards higher numbers -> line at 1 is always there

here is the code when the user hits a Scaler () used by Kwwidgets)
column defines the TableColumn, value is the passed value


void vtkContextView2::SetGaussData(int column, double scalerValue){
	int c = this->Table->GetNumberOfColumns();
	int r = this->Table->GetNumberOfRows();

	//set the new Value
	for(int i =0; i < 512;i++){
		double v = scalerValue*column;
		this->Table->SetValue(i,column,v);		
	}
	//add new LinePlots to the Chart
	int R [3]= {255, 0, 0};
	int G [3]= {0, 255, 0};
	int B [3]= {0, 0, 255};
	for (int i = 1;i < c;i++){
		vtkPlot *line = this->chart->AddPlot(vtkChart::LINE);
		line->SetInput(this->Table, 0,i);
		line->SetColor(R[i-1], G[i-1], B[i-1],255);
		line->SetWidth(1.0);
	}
	
	//Render
	this->RenderWindow->Render();

	//Remove all Plots
	for (int r = 1; r < c;r++){
		this->chart->RemovePlot(r);
	}
}
-- 
GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt auch mit 
gratis Notebook-Flat! http://portal.gmx.net/de/go/dsl



More information about the vtk-developers mailing list