#include "vtkPointData.h"
#include "vtkRenderWindow.h"
#include "vtkProperty.h"
+#include "vtkPolyDataWriter.h"
+
creaVtkStreamLine::creaVtkStreamLine()
{
- _source = vtkPointSource::New();
- _vPointWidget = vtkPointWidget::New();
- _streamMapper2 = vtkPolyDataMapper::New();
- _streamer = vtkStreamTracer::New();
-
+// _source = vtkPointSource::New();
+// _vPointWidget = vtkPointWidget::New();
+ _streamMapper2 = vtkPolyDataMapper::New();
_tubefilter = vtkTubeFilter::New();
- _ribbonfilter = vtkRibbonFilter::New();
+ _ribbonfilter = vtkRibbonFilter::New();
}
{
}
+
//---------------------------------------------
-void creaVtkStreamLine::SetSourcePoints( vtkDataSet* sourcepoints)
+void creaVtkStreamLine::SetPolyData( vtkPolyData* polydata)
{
- _sourcePoints = sourcepoints;
+ _polydata = polydata;
}
//---------------------------------------------
void creaVtkStreamLine::Process()
{
-
-printf("creaVtkStreamLine::Process Start \n");
- if (_active==false)
- { //bbGetInputPlaneFieldShow
- _vPointWidget->Off();
- } else {
+
+ if (_polydata!=NULL)
+ {
+ if (_active==true)
+ {
+/*
//---------------------------Stream Lines-----------------------
_vPointWidget->SetInput( (vtkDataSet*) GetDataObject() );
if (_firsttime==true)
}
//EED1 _vPointWidget->On();
-
double c[3];
_vPointWidget->GetPosition(c);
_source->SetCenter( c );
_source->Update();
_streamer->SetInput( GetDataObject() );
-
-//EED1 _streamer->SetSource( _source->GetOutput() );
+//EED1 _streamer->SetSource( _source->GetOutput() );
_streamer->SetSource( _sourcePoints );
-
_streamer->SetIntegratorTypeToRungeKutta45();
-
//EED _streamer->SetMaximumPropagation(500000);
_streamer->SetMaximumPropagation(500);
-//EED _streamer->SetMaximumPropagationUnitToTimeUnit();
-
+//EED _streamer->SetMaximumPropagationUnitToTimeUnit();
_streamer->SetInitialIntegrationStep (0.001);
//EED _streamer->SetInitialIntegrationStepUnitToCellLengthUnit();
-
_streamer->SetIntegrationDirectionToBoth();
//EED streamer->ComputeVorticityOn ();
_streamer->Update();
-printf("EED creaVtkStreamLine::Process StreamLine PrintSelf\n");
- _streamer->Print(std::cout);
-
-printf("EED creaVtkStreamLine::Process StreamLine->GetOutput() PrintSelf\n");
- _streamer->GetOutput()->Print(std::cout);
+// _streamer->Print(std::cout);
+// _streamer->GetOutput()->Print(std::cout);
//EED 3aout2011
- _tubefilter->SetInput(_streamer->GetOutput());
- _tubefilter->SetRadius( GetScaleFactor() );
- _tubefilter->SetNumberOfSides(12);
- _tubefilter->SetVaryRadiusToVaryRadiusOff();
-
+ _tubefilter->SetInput( _streamer->GetOutput() );
_ribbonfilter->SetInput(_streamer->GetOutput());
- _ribbonfilter->SetWidth( GetScaleFactor() );
- _ribbonfilter->SetWidthFactor( GetScaleFactor()*10 );
- _ribbonfilter->GlobalWarningDisplayOff (); //EED this is to avoid the "BEVEL WARNING"
+*/
-//BORRAME _streamer->GetOutput()->GetScalarRange( range );
- if (GetTypeForm()==0) {
+ _polydata->Modified();
+
+
+ if (GetTypeForm()==0)
+ {
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
+ _tubefilter->SetInput( _polydata );
+#else
+ _tubefilter->SetInputData( _polydata );
+#endif
+ _tubefilter->SetRadius( GetScaleFactor() );
+ _tubefilter->SetNumberOfSides(12);
+ _tubefilter->SetVaryRadiusToVaryRadiusOff();
+ _tubefilter->Modified();
+ _tubefilter->Update();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
_streamMapper2->SetInput( _tubefilter->GetOutput() );
- } else {
+#else
+ _streamMapper2->SetInputData( _tubefilter->GetOutput() );
+#endif
+ }
+ if (GetTypeForm()==1)
+ {
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
+ _ribbonfilter->SetInput( _polydata );
+#else
+ _ribbonfilter->SetInputData( _polydata );
+#endif
+ _ribbonfilter->SetWidth( GetScaleFactor() );
+ _ribbonfilter->SetWidthFactor( GetScaleFactor()*10 );
+ _ribbonfilter->GlobalWarningDisplayOff (); //EED this is to avoid the "BEVEL WARNING"
+ _ribbonfilter->Modified();
+ _ribbonfilter->Update();
+
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
_streamMapper2->SetInput( _ribbonfilter->GetOutput() );
+#else
+ _streamMapper2->SetInputData( _ribbonfilter->GetOutput() );
+#endif
+ }
+ if (GetTypeForm()==2)
+ {
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
+ _streamMapper2->SetInput( _polydata );
+#else
+ _streamMapper2->SetInputData( _polydata );
+#endif
}
//EED _streamMapper2->SetLookupTable(vGreenToRedLut);
-
-
- vtkPolyData *pd = _streamer->GetOutput();
- vtkPointData *pointdata = pd->GetPointData();
+
+/*
+vtkDoubleArray* _velocity = vtkDoubleArray::New();
+_velocity->SetName("velocity"); // ... fill the colors array
+for (int ivelocity=0; ivelocity<=4000; ivelocity++ )
+{
+ _velocity->InsertTuple3 (ivelocity, 1, 0, 0);
+}
+_polydata->GetPointData()->AddArray(_velocity);
+*/
+
+
+// vtkFieldData *data = _polydata->GetFieldData();
// vtkDataArray *da = pointdata->GetArray("Normals");
- int i,sizeDa = pointdata->GetNumberOfArrays();
- printf("EED creaVtkStreamLine::Process sizeDa %d \n", sizeDa );
- for (i=0;i<sizeDa;i++)
- {
- printf("EED creaVtkStreamLine::Process-name %d, %s \n", i, pointdata->GetArrayName(i) );
- }
+// vtkPointData *data = _polydata->GetPointData();
+// int i,sizeDa = data->GetNumberOfArrays();
+// printf("EED creaVtkStreamLine::Process sizeDa %d \n", sizeDa );
+// for (i=0;i<sizeDa;i++)
+// {
+// printf("EED creaVtkStreamLine::Process-name %d, %s \n", i, data->GetArrayName(i) );
+// data->GetArray(i)->Print(std::cout);
+// }
+
+
+
+/*
+//EED
+ vtkPolyDataWriter *writer3 = vtkPolyDataWriter::New();
+ writer3->SetFileName( "/home/davila/Borrame/streamline-eed-c.vtk" );
+ writer3->SetInput( _polydata );
+ writer3->Write();
+*/
+
// vtkDataArray *nda = vtkDoubleArray::New();
// nda->DeepCopy(da);
//Config 1 (Normals)
// _streamMapper2->ScalarVisibilityOn();
// _streamMapper2->SetScalarModeToUsePointFieldData();
-// _streamMapper2->SetLookupTable( vLutEED );
+// _streamMapper2->SetLookupTable( _LutEED );
// _streamMapper2->SelectColorArray( "Normals" );
+
//Config 2 Orientation vectors
_streamMapper2->ScalarVisibilityOn();
_streamMapper2->SetScalarModeToUsePointFieldData();
_streamMapper2->SetLookupTable( _LutEED );
- _streamMapper2->SelectColorArray( "velocity" );
+
+ if (_colorlaw==0)
+ {
+ _LutEED->SetVectorModeToRGBColors();
+ _streamMapper2->SelectColorArray( "creaColorDirection" );
+ }
+ if (_colorlaw==1)
+ {
+// _LutEED->SetVectorModeToMagnitude();
+ vtkLookupTable *lookuptable = vtkLookupTable::New();
+ _streamMapper2->SetLookupTable( lookuptable );
+ _streamMapper2->SelectColorArray( "creaMagnitud" );
+ }
+ if (_colorlaw==2)
+ {
+
+ _streamMapper2->SelectColorArray( "xx" );
+ _actor->GetProperty()->SetColor(_colorR,_colorG,_colorB);
+ }
+
+/*
+ _vtkglyph->SetInput( GetDataObject() );
+ _vtkglyph->SetSource( _vtkarrowsource->GetOutput() );
+ _vtkglyph->SetScaleModeToScaleByVector();
+ _vtkglyph->SetColorModeToColorByVector();
+ _vtkglyph->SetScaleFactor( GetScaleFactor() );
+ _vtkglyph->Update();
+ _pdm->SetInput( _vtkglyph->GetOutput());
+ _pdm->SetScalarModeToUsePointFieldData();
+ _pdm->SetLookupTable( _LutEED );
+ _pdm->SelectColorArray( "GlyphVector" );
+*/
+
+
+
//Config 3 Position
// ???????
-
_actor->SetMapper( _streamMapper2 );
-
-printf("EED lib creaVTK creaVtkStreamLine::Process opacity %f\n", GetOpacity() );
_actor->GetProperty()->SetOpacity( GetOpacity() );
}// _active
VisibilityActor();
+ } // polydata
+
-
}
+
+
+