//Adding each control point
if( ifControlPoints )
+ {
AddControlPoints();
+ }
RefreshContour();
Refresh();
}
DeleteVtkObjects();
_pts = vtkPoints::New();
_pts->SetNumberOfPoints(nps);
- for (i=0 ; i<nps ; i++){
+ for (i=0 ; i<nps ; i++)
+ {
_pts->SetPoint(i, 0 , 0 , 0 );
}
// This is for the boundaring inicialisation
_pts->SetPoint(0, -1000 , -1000 , -1000 );
_pts->SetPoint(1, 1000 , 1000 , 1000 );
- vtkCellArray *lines = vtkCellArray::New();
- lines->InsertNextCell( nps /* +1 */ );
- for ( i=0 ; i<nps+1 ; i++ ){
- lines->InsertCellPoint(i % nps );
+ // This is the structure for the spline
+ _splineCell = vtkCellArray::New();
+ _splineCell->InsertNextCell( nps /* +1 */ );
+ for ( i=0 ; i<nps+1 ; i++ )
+ {
+ _splineCell->InsertCellPoint(i % nps );
}
+
+ // This is the structure for the spline justo to points (line)
+ // This will be use in the refresh part, in case the spline have only 2 points
+ _lineCell = vtkCellArray::New();
+ _lineCell->InsertNextCell(2);
+ _lineCell->InsertCellPoint(0);
+ _lineCell->InsertCellPoint(1);
+
_pd = vtkPolyData::New();
_pd->SetPoints( _pts );
- _pd->SetLines( lines );
- lines->Delete(); //do not delete lines ??
+ _pd->SetLines( _splineCell );
+ // lines->Delete(); //do not delete lines ??
_contourVtkActor = vtkActor::New();
_bboxMapper = vtkPolyDataMapper::New();
InitTextActor();
}
+void manualViewBaseContour::SetCellArray(bool type)
+{
+ if (type==true)
+ {
+ _pd->SetLines( _splineCell );
+ } else {
+ _pd->SetLines( _lineCell );
+ }// if type
+}
+
// ----------------------------------------------------------------------------
void manualViewBaseContour::InitTextActor()
{
// ----------------------------------------------------------------------------
void manualViewBaseContour::Refresh() // virtual
{
- if (_contourVtkActor!=NULL){
+ if (_contourVtkActor!=NULL)
+ {
RefreshContour();
}
int i,size=_lstViewPoints.size();