|  | @@ -0,0 +1,2178 @@
 | 
	
		
			
				|  |  | +#include "vtkVISUnStreamTrace.h"
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +//add by ZhaoYu 2023.2.28 begin.
 | 
	
		
			
				|  |  | +#include <vtkActor.h>
 | 
	
		
			
				|  |  | +#include <vtkRenderer.h>
 | 
	
		
			
				|  |  | +#include <vtkUnstructuredGrid.h>
 | 
	
		
			
				|  |  | +#include <vtkDoubleArray.h>
 | 
	
		
			
				|  |  | +#include "vtkVISUnstructuredGridSource.h"
 | 
	
		
			
				|  |  | +#include <vtkPointData.h>
 | 
	
		
			
				|  |  | +#include <vtkCellData.h>
 | 
	
		
			
				|  |  | +#include <vtkRenderWindow.h>
 | 
	
		
			
				|  |  | +#include <vtkRenderWindowInteractor.h>
 | 
	
		
			
				|  |  | +#include <vtkProperty.h>
 | 
	
		
			
				|  |  | +#include <vtkObject.h>
 | 
	
		
			
				|  |  | +#include <vtkLineSource.h>
 | 
	
		
			
				|  |  | +#include <vtkGlyphSource2D.h>
 | 
	
		
			
				|  |  | +#include <vtkGlyph3D.h>
 | 
	
		
			
				|  |  | +#include <vtkUnstructuredGridWriter.h>
 | 
	
		
			
				|  |  | +#include <vtkMaskPoints.h>
 | 
	
		
			
				|  |  | +#include <vtkArrayCalculator.h>
 | 
	
		
			
				|  |  | +//add by HaoJingjing 2023.2.28 end.
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +vtkStandardNewMacro(vtkVISUnStreamTrace)
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +vtkVISUnStreamTrace::vtkVISUnStreamTrace()
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    lineSeedsNumber = 5;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    MinimumStep = 0.005;
 | 
	
		
			
				|  |  | +    MaxPropagation = 1000;
 | 
	
		
			
				|  |  | +    InitialStep = 0.05;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    tubeRadius = 0.1;
 | 
	
		
			
				|  |  | +    tubeSides = 5;
 | 
	
		
			
				|  |  | +    ribbonWidth = 0.1;
 | 
	
		
			
				|  |  | +    ribbonFactor = 2.0;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    sphereRadius = 0.5;
 | 
	
		
			
				|  |  | +    sphereTheta = 5;
 | 
	
		
			
				|  |  | +    spherePhi = 5;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    SelectState_ = 0;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    streamStyle_ = "Line";
 | 
	
		
			
				|  |  | +    InteDirection_ = "Both";
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    seedstype_ = "Line Source";
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    lineAlignAxis_ = "Y";
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    scalarIndex_ = 0;
 | 
	
		
			
				|  |  | +    vectorIndex_ = 0;
 | 
	
		
			
				|  |  | +    vectorType_ = -1;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    for (int i=0; i<3; i++)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        startPosition[i] = 0;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    streamSource_ = NULL;
 | 
	
		
			
				|  |  | +    integrator4_ = NULL;
 | 
	
		
			
				|  |  | +    streamTracer_ = NULL;
 | 
	
		
			
				|  |  | +    tubeFilter_ = NULL;
 | 
	
		
			
				|  |  | +    ribbonFilter_ = NULL;
 | 
	
		
			
				|  |  | +    streamMapper_ = NULL;
 | 
	
		
			
				|  |  | +    streamActor_ = NULL;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    streamSeeds_ = NULL;
 | 
	
		
			
				|  |  | +    pointWidget_= NULL;
 | 
	
		
			
				|  |  | +    lineWidget_= NULL;
 | 
	
		
			
				|  |  | +    planeWidget_= NULL;
 | 
	
		
			
				|  |  | +    sphereWidget_= NULL;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    oneStreamActor_ = NULL;
 | 
	
		
			
				|  |  | +    oneStreamTracer_ = NULL;
 | 
	
		
			
				|  |  | +    oneTubeFilter_ = NULL;
 | 
	
		
			
				|  |  | +    oneRibbonFilter_ = NULL;
 | 
	
		
			
				|  |  | +    oneIntegrator4_ = NULL;
 | 
	
		
			
				|  |  | +    oneStreamMapper_ = NULL;
 | 
	
		
			
				|  |  | +    style_ = NULL;
 | 
	
		
			
				|  |  | +    positionVec_.clear();
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +vtkVISUnStreamTrace::~vtkVISUnStreamTrace()
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    if (streamActor_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        if (_renderer != NULL)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            _renderer->RemoveActor(streamActor_);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        streamActor_->Delete();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if (oneStreamActor_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        oneStreamActor_->InitTraversal();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        int num = oneStreamActor_->GetNumberOfItems();
 | 
	
		
			
				|  |  | +        vtkActor* actor = NULL;
 | 
	
		
			
				|  |  | +        for (int i=0; i< num;i++)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            actor = (vtkActor* )oneStreamActor_->GetItemAsObject (i);
 | 
	
		
			
				|  |  | +            _renderer->RemoveActor(actor);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (actor != NULL)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            actor->Delete ();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        oneStreamActor_->Delete ();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    if (oneStreamTracer_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        oneStreamTracer_->Delete ();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    if (oneTubeFilter_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        oneTubeFilter_->Delete ();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    if (oneRibbonFilter_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        oneRibbonFilter_->Delete ();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    if (oneIntegrator4_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        oneIntegrator4_->Delete ();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    if (oneStreamMapper_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        oneStreamMapper_->Delete ();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if (streamSeeds_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        streamSeeds_->Delete();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    if (pointWidget_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        pointWidget_->Delete();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    if (lineWidget_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        lineWidget_->Delete();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    if (planeWidget_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        planeWidget_->Delete();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    if (sphereWidget_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        sphereWidget_->Delete();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    if (streamSource_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        streamSource_->Delete();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    if (integrator4_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        integrator4_->Delete();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    if (streamTracer_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        streamTracer_->Delete();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    if (tubeFilter_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        tubeFilter_->Delete();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    if (ribbonFilter_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        ribbonFilter_->Delete();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    if (streamMapper_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        streamMapper_->Delete();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if (style_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        style_->Delete();
 | 
	
		
			
				|  |  | +        style_ = NULL;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    streamSource_ = NULL;
 | 
	
		
			
				|  |  | +    integrator4_ = NULL;
 | 
	
		
			
				|  |  | +    streamTracer_ = NULL;
 | 
	
		
			
				|  |  | +    tubeFilter_ = NULL;
 | 
	
		
			
				|  |  | +    ribbonFilter_ = NULL;
 | 
	
		
			
				|  |  | +    streamMapper_ = NULL;
 | 
	
		
			
				|  |  | +    streamActor_ = NULL;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    streamSeeds_ = NULL;
 | 
	
		
			
				|  |  | +    pointWidget_= NULL;
 | 
	
		
			
				|  |  | +    lineWidget_= NULL;
 | 
	
		
			
				|  |  | +    planeWidget_= NULL;
 | 
	
		
			
				|  |  | +    sphereWidget_= NULL;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    oneStreamActor_ = NULL;
 | 
	
		
			
				|  |  | +    oneStreamTracer_ = NULL;
 | 
	
		
			
				|  |  | +    oneTubeFilter_ = NULL;
 | 
	
		
			
				|  |  | +    oneRibbonFilter_ = NULL;
 | 
	
		
			
				|  |  | +    oneIntegrator4_ = NULL;
 | 
	
		
			
				|  |  | +    oneStreamMapper_ = NULL;
 | 
	
		
			
				|  |  | +    positionVec_.clear();
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +// --------------------------------------------------------------------------
 | 
	
		
			
				|  |  | +/// Set the scalar/vector data source for stream/trace rendering
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @param scalar scalar name
 | 
	
		
			
				|  |  | +/// @param vector vector name
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @return
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @author ZHU Qin
 | 
	
		
			
				|  |  | +/// @date 2010-06-01
 | 
	
		
			
				|  |  | +/// @reviser
 | 
	
		
			
				|  |  | +void vtkVISUnStreamTrace::SetStreamTraceSource(char* scalar, char* vector)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    int scalarIndex = _source->GetScalarIndex(scalar);
 | 
	
		
			
				|  |  | +    int vectorIndex = _source->GetVectorIndex(vector);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /*
 | 
	
		
			
				|  |  | +    if (scalarIndex == -1 && vectorIndex == -1)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        ErrorInfo(1,"Both Scalar and vector data are not existed!");
 | 
	
		
			
				|  |  | +        return;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    */
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    vtkUnstructuredGrid *unGrid = vtkUnstructuredGrid::New();
 | 
	
		
			
				|  |  | +        unGrid->DeepCopy(_source->unstruGrid);
 | 
	
		
			
				|  |  | +        if (scalarIndex != -1)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            scalarIndex_ = scalarIndex;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            if(_source->scalarSource[scalarIndex]->GetDataSize() != 0)
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                (unGrid->GetPointData())->SetScalars(_source->scalarSource[scalarIndex]);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            else
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                (unGrid->GetCellData())->SetScalars(_source->cellScalarSource_[scalarIndex]);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (vectorIndex != -1)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            vectorIndex_ = vectorIndex;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            if(_source->vectorSource[vectorIndex]->GetDataSize() != 0)
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                (unGrid->GetPointData())->SetVectors(_source->vectorSource[vectorIndex]);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            else
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                (unGrid->GetCellData())->SetVectors(_source->cellVectorSource_[vectorIndex]);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            ErrorInfo(1,"Vector data are not existed!");
 | 
	
		
			
				|  |  | +            return;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        unGrid->Modified();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    streamSource_ = unGrid;
 | 
	
		
			
				|  |  | +    scalarIndex_ = scalarIndex;
 | 
	
		
			
				|  |  | +    vectorIndex_ = vectorIndex;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +// --------------------------------------------------------------------------
 | 
	
		
			
				|  |  | +/// creat data source
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @param scalar name u、v、w
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @return
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @author zhaoyu
 | 
	
		
			
				|  |  | +/// @date 20230303
 | 
	
		
			
				|  |  | +void vtkVISUnStreamTrace::SetStreamTraceSource(char* u, char* v, char* w)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    //int scalarIndex = 0;
 | 
	
		
			
				|  |  | +    int uIndex = -1;
 | 
	
		
			
				|  |  | +    int vIndex = -1;
 | 
	
		
			
				|  |  | +    int wIndex = -1;
 | 
	
		
			
				|  |  | +    uIndex = _source->GetScalarIndex(u);
 | 
	
		
			
				|  |  | +    vIndex = _source->GetScalarIndex(v);
 | 
	
		
			
				|  |  | +    wIndex = _source->GetScalarIndex(w);
 | 
	
		
			
				|  |  | +    vtkUnstructuredGrid *unGrid = vtkUnstructuredGrid::New();
 | 
	
		
			
				|  |  | +    unGrid->DeepCopy(_source->unstruGrid);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    vtkDoubleArray* uvwArray = vtkDoubleArray::New();
 | 
	
		
			
				|  |  | +    uvwArray->SetName("vector");
 | 
	
		
			
				|  |  | +    uvwArray->SetNumberOfComponents(3);
 | 
	
		
			
				|  |  | +    if (_source->scalarSource[uIndex] != NULL && _source->scalarSource[vIndex] != NULL && _source->scalarSource[wIndex] != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        if (_source->scalarSource[uIndex]->GetDataSize() != 0 &&
 | 
	
		
			
				|  |  | +                _source->scalarSource[vIndex]->GetDataSize() != 0 &&
 | 
	
		
			
				|  |  | +                _source->scalarSource[wIndex]->GetDataSize() != 0)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            uvwArray->SetNumberOfTuples(unGrid->GetNumberOfPoints());
 | 
	
		
			
				|  |  | +            vectorType_ = 0;
 | 
	
		
			
				|  |  | +            double uvw[3];
 | 
	
		
			
				|  |  | +            for (int i = 0; i < unGrid->GetNumberOfPoints(); i ++)
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                 uvw[0] = _source->scalarSource[uIndex]->GetTuple1(i);
 | 
	
		
			
				|  |  | +                 uvw[1] = _source->scalarSource[vIndex]->GetTuple1(i);
 | 
	
		
			
				|  |  | +                 uvw[2] = _source->scalarSource[wIndex]->GetTuple1(i);
 | 
	
		
			
				|  |  | +                 uvwArray->SetTuple(i, uvw);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }else if (_source->cellScalarSource_[uIndex]->GetDataSize() != 0 &&
 | 
	
		
			
				|  |  | +                  _source->cellScalarSource_[vIndex]->GetDataSize() != 0 &&
 | 
	
		
			
				|  |  | +                  _source->cellScalarSource_[wIndex]->GetDataSize() != 0)
 | 
	
		
			
				|  |  | +         {
 | 
	
		
			
				|  |  | +             uvwArray->SetNumberOfTuples(unGrid->GetNumberOfCells());
 | 
	
		
			
				|  |  | +             vectorType_ = 1;
 | 
	
		
			
				|  |  | +             double uvw[3];
 | 
	
		
			
				|  |  | +             for (int i = 0; i < unGrid->GetNumberOfCells(); i ++)
 | 
	
		
			
				|  |  | +             {
 | 
	
		
			
				|  |  | +                  uvw[0] = _source->cellScalarSource_[uIndex]->GetTuple1(i);
 | 
	
		
			
				|  |  | +                  uvw[1] = _source->cellScalarSource_[vIndex]->GetTuple1(i);
 | 
	
		
			
				|  |  | +                  uvw[2] = _source->cellScalarSource_[wIndex]->GetTuple1(i);
 | 
	
		
			
				|  |  | +                  uvwArray->SetTuple(i, uvw);
 | 
	
		
			
				|  |  | +             }
 | 
	
		
			
				|  |  | +         }else
 | 
	
		
			
				|  |  | +         {
 | 
	
		
			
				|  |  | +             vectorType_ = -1;
 | 
	
		
			
				|  |  | +             return;
 | 
	
		
			
				|  |  | +         }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    /*if (scalarIndex != -1)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        scalarIndex_ = scalarIndex;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if(_source->scalarSource[scalarIndex]->GetDataSize() != 0)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            (unGrid->GetPointData())->SetScalars(_source->scalarSource[scalarIndex]);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            (unGrid->GetCellData())->SetScalars(_source->cellScalarSource_[scalarIndex]);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }*/
 | 
	
		
			
				|  |  | +    if(vectorType_ == 0)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        (unGrid->GetPointData())->SetVectors(uvwArray);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    else if(vectorType_ == 1)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        (unGrid->GetCellData())->SetVectors(uvwArray);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    else
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        return;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    uvwArray->GetRange(vectorRange, -1);
 | 
	
		
			
				|  |  | +    unGrid->Modified();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    streamSource_ = unGrid;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +// --------------------------------------------------------------------------
 | 
	
		
			
				|  |  | +/// Change scalar/vector data source
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @param scalar
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @return
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @author ZHU Qin
 | 
	
		
			
				|  |  | +/// @date 2010-06-01
 | 
	
		
			
				|  |  | +/// @reviser Shen Jie
 | 
	
		
			
				|  |  | +/// @date 2011-01-08
 | 
	
		
			
				|  |  | +void vtkVISUnStreamTrace::ModifyStreamTraceScalar(char* scalar)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    double range[2];
 | 
	
		
			
				|  |  | +    int scalarIndex = -1;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    range[0] = 0;
 | 
	
		
			
				|  |  | +    range[1] = 0;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if(scalar != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        scalarIndex = _source->GetScalarIndex(scalar);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    if (streamSource_ != NULL && scalarIndex != -1)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        if (_source->scalarSource[scalarIndex] != NULL)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            if(scalarIndex != -1)
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                scalarIndex_ = scalarIndex;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                if(_source->scalarSource[scalarIndex]->GetDataSize() != 0)
 | 
	
		
			
				|  |  | +                {
 | 
	
		
			
				|  |  | +                    (streamSource_->GetPointData())->SetScalars(_source->scalarSource[scalarIndex]);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                else
 | 
	
		
			
				|  |  | +                {
 | 
	
		
			
				|  |  | +                    (streamSource_->GetCellData())->SetScalars(_source->cellScalarSource_[scalarIndex]);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            streamSource_->Modified();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            ErrorInfo(1,"This Scalar is empty, Please Load First!");
 | 
	
		
			
				|  |  | +            return;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    else
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        ErrorInfo(1,"StreamTrace source are not setted!");
 | 
	
		
			
				|  |  | +        return;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    if(scalarIndex_ != -1)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        range[0] = _source->scalarRange[scalarIndex_][0];
 | 
	
		
			
				|  |  | +        range[1] = _source->scalarRange[scalarIndex_][1];
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if(streamMapper_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        streamMapper_->SetScalarRange(range[0], range[1]);
 | 
	
		
			
				|  |  | +        streamMapper_->Modified();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    /*if(oneStreamMapper_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        oneStreamMapper_->SetScalarRange(range[0], range[1]);
 | 
	
		
			
				|  |  | +        oneStreamMapper_->Modified();
 | 
	
		
			
				|  |  | +    }*/
 | 
	
		
			
				|  |  | +    if (oneStreamActor_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        oneStreamActor_->InitTraversal();//指针回到第一个actor
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        vtkActor * pActor = oneStreamActor_->GetNextActor();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        while(pActor)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            pActor->GetMapper()->SetScalarRange(range[0], range[1]);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            pActor->GetMapper()->Modified();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            pActor = oneStreamActor_->GetNextActor();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +// --------------------------------------------------------------------------
 | 
	
		
			
				|  |  | +/// Change scalar/vector data source
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @param vector
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @return
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @author ZHU Qin
 | 
	
		
			
				|  |  | +/// @date 2010-06-01
 | 
	
		
			
				|  |  | +/// @reviser
 | 
	
		
			
				|  |  | +void vtkVISUnStreamTrace::ModifyStreamTraceVector(char* vector)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    int vectorIndex = _source->GetVectorIndex(vector);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if (streamSource_ != NULL && vectorIndex != -1)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        if (_source->vectorSource[vectorIndex] != NULL)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            if(_source->vectorSource[vectorIndex]->GetDataSize() != 0)
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                (streamSource_->GetPointData())->SetVectors(_source->vectorSource[vectorIndex]);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            else
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                (streamSource_->GetCellData())->SetVectors(_source->cellVectorSource_[vectorIndex]);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            streamSource_->Modified();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            vectorIndex_ = vectorIndex;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            ErrorInfo(1,"This Vector is empty, Please Load First!");
 | 
	
		
			
				|  |  | +            return;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    else
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        ErrorInfo(1,"StreamTrace source are not setted!");
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +// --------------------------------------------------------------------------
 | 
	
		
			
				|  |  | +/// Create stream trace display pipeline
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @param
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @return
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @author ZHU Qin
 | 
	
		
			
				|  |  | +/// @date 2010-06-01
 | 
	
		
			
				|  |  | +/// @reviser Shen Jie
 | 
	
		
			
				|  |  | +/// @date 2011-01-08
 | 
	
		
			
				|  |  | +void vtkVISUnStreamTrace::CreateStreamTraceDisplay()
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    /*if (scalarIndex_ == -1)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            ErrorInfo(1, "Can't create stream line, scalar not exists.");
 | 
	
		
			
				|  |  | +            return;
 | 
	
		
			
				|  |  | +        }*/
 | 
	
		
			
				|  |  | +        /*double *range;
 | 
	
		
			
				|  |  | +        range = _source->scalarRange[scalarIndex_];*/
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        double range[2];
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if (scalarIndex_ != -1)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            range[0] =  _source->scalarRange[scalarIndex_][0];
 | 
	
		
			
				|  |  | +            range[1] =  _source->scalarRange[scalarIndex_][1];
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            range[0] = 0;
 | 
	
		
			
				|  |  | +            range[1] = 0;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        vtkRungeKutta4 *kutta4 = vtkRungeKutta4::New();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        integrator4_ = vtkRungeKutta4::New();
 | 
	
		
			
				|  |  | +        integrator4_ = kutta4;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        vtkStreamTracer *streamer = vtkStreamTracer::New();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            streamer->SetInputData(streamSource_);
 | 
	
		
			
				|  |  | +            streamer->SetSourceData(streamSeeds_);
 | 
	
		
			
				|  |  | +            streamer->SetIntegrator(integrator4_);
 | 
	
		
			
				|  |  | +            streamer->SetMaximumPropagation(MaxPropagation);
 | 
	
		
			
				|  |  | +             streamer->SetInitialIntegrationStep(InitialStep);
 | 
	
		
			
				|  |  | +            streamer->SetMinimumIntegrationStep(MinimumStep);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            if (InteDirection_ == "Forward")
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                streamer->SetIntegrationDirectionToForward();
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            else if (InteDirection_ == "Backward")
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                streamer->SetIntegrationDirectionToBackward();
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            else
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                streamer->SetIntegrationDirectionToBoth();
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            streamer->Update();cout << streamer->GetOutput()->GetNumberOfPoints() << endl;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        vtkTubeFilter *tFilter = vtkTubeFilter::New();
 | 
	
		
			
				|  |  | +            tFilter->SetInputConnection(streamer->GetOutputPort());
 | 
	
		
			
				|  |  | +            tFilter->SetVaryRadiusToVaryRadiusByVector();
 | 
	
		
			
				|  |  | +            tFilter->SetRadius(tubeRadius);
 | 
	
		
			
				|  |  | +            tFilter->SetNumberOfSides(tubeSides);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        vtkRibbonFilter *rFilter = vtkRibbonFilter::New();
 | 
	
		
			
				|  |  | +            rFilter->SetInputConnection(streamer->GetOutputPort());
 | 
	
		
			
				|  |  | +            rFilter->SetWidth(ribbonWidth);
 | 
	
		
			
				|  |  | +            rFilter->SetWidthFactor(ribbonFactor);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();
 | 
	
		
			
				|  |  | +        mapper->SetInputConnection(streamer->GetOutputPort());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        vtkActor* actor = vtkActor::New();
 | 
	
		
			
				|  |  | +        actor->SetMapper(mapper);
 | 
	
		
			
				|  |  | +        actor->GetProperty()->SetColor(0,0,1);
 | 
	
		
			
				|  |  | +        _renderer->AddActor(actor);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        streamTracer_ = streamer;
 | 
	
		
			
				|  |  | +        tubeFilter_ = tFilter;
 | 
	
		
			
				|  |  | +        ribbonFilter_ = rFilter;
 | 
	
		
			
				|  |  | +        streamMapper_ = mapper;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        _unActor = actor;
 | 
	
		
			
				|  |  | +        _renWin->Render();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            /*mapper->InterpolateScalarsBeforeMappingOn();
 | 
	
		
			
				|  |  | +            mapper->SetScalarRange(range[0], range[1]);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            if (scalarIndex_ != -1)
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                if (_source->scalarSource[scalarIndex_]->GetDataSize() != 0)
 | 
	
		
			
				|  |  | +                {
 | 
	
		
			
				|  |  | +                    mapper->SetScalarModeToUsePointData();
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                else
 | 
	
		
			
				|  |  | +                {
 | 
	
		
			
				|  |  | +                    mapper->SetScalarModeToUseCellData();
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            if (streamStyle_ == "Tube")
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +               // mapper->SetInputConnection(tFilter->GetOutputPort());
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            else if (streamStyle_ == "Ribbon")
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                //mapper->SetInputConnection(rFilter->GetOutputPort());
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            else
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                mapper->SetInputConnection(streamer->GetOutputPort());
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        vtkLookupTable *lut = (vtkLookupTable*)(mapper->GetLookupTable());
 | 
	
		
			
				|  |  | +            lut->GetHueRange(range);
 | 
	
		
			
				|  |  | +            lut->SetHueRange(range[1], range[0]);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        vtkActor *actor = vtkActor::New();
 | 
	
		
			
				|  |  | +            actor->SetMapper(mapper);
 | 
	
		
			
				|  |  | +            actor->VisibilityOn();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        _renderer->AddActor(actor);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        streamTracer_ = streamer;
 | 
	
		
			
				|  |  | +        //tubeFilter_ = tFilter;
 | 
	
		
			
				|  |  | +        //ribbonFilter_ = rFilter;
 | 
	
		
			
				|  |  | +        streamMapper_ = mapper;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        _unActor = actor;*/
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +void vtkVISUnStreamTrace::CreateStreamTraceDisplayByVector()
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    vtkRungeKutta4 *kutta4 = vtkRungeKutta4::New();//算法
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    integrator4_ = vtkRungeKutta4::New();
 | 
	
		
			
				|  |  | +    integrator4_ = kutta4;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    vtkStreamTracer *streamer = vtkStreamTracer::New();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    streamer->SetInputData(streamSource_);
 | 
	
		
			
				|  |  | +    streamer->SetSourceData(streamSeeds_);
 | 
	
		
			
				|  |  | +    streamer->SetIntegrator(integrator4_);//设置积分方法
 | 
	
		
			
				|  |  | +    streamer->SetMaximumPropagation(MaxPropagation);//设置迭代次数
 | 
	
		
			
				|  |  | +    streamer->SetInitialIntegrationStep(InitialStep);//设置迭代步长
 | 
	
		
			
				|  |  | +    streamer->SetMinimumIntegrationStep(MinimumStep);
 | 
	
		
			
				|  |  | +    if (InteDirection_ == "Forward")
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        streamer->SetIntegrationDirectionToForward();//指定流线方向向前
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    else if (InteDirection_ == "Backward")
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        streamer->SetIntegrationDirectionToBackward();//指定流线方向向后
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    else
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        streamer->SetIntegrationDirectionToBoth();//指定流线在两个方向集成
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    streamer->Update();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    vtkTubeFilter *tFilter = vtkTubeFilter::New();//在线条周围生成管道的过滤器
 | 
	
		
			
				|  |  | +        tFilter->SetInputConnection(streamer->GetOutputPort());
 | 
	
		
			
				|  |  | +        //tFilter->SetInputArrayToProcess(1,0,0,vtkDataObject::FIELD_ASSOCIATION_POINTS, "vector");
 | 
	
		
			
				|  |  | +        tFilter->SetRadius(tubeRadius);
 | 
	
		
			
				|  |  | +        tFilter->SetNumberOfSides(tubeSides);
 | 
	
		
			
				|  |  | +        tFilter->SetVaryRadiusToVaryRadiusByVector();
 | 
	
		
			
				|  |  | +        tFilter->Update();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    vtkRibbonFilter *rFilter = vtkRibbonFilter::New();//从多边形数据集中定义的线创建定向色带
 | 
	
		
			
				|  |  | +        rFilter->SetInputConnection(streamer->GetOutputPort());
 | 
	
		
			
				|  |  | +        rFilter->SetWidth(ribbonWidth);
 | 
	
		
			
				|  |  | +        rFilter->SetWidthFactor(ribbonFactor);
 | 
	
		
			
				|  |  | +        rFilter->Update();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        vtkArrayCalculator* calc = vtkArrayCalculator::New();
 | 
	
		
			
				|  |  | +        calc->SetInputConnection(streamer->GetOutputPort());
 | 
	
		
			
				|  |  | +        calc->AddVectorArrayName("vector");
 | 
	
		
			
				|  |  | +        calc->SetFunction("mag(vector)");
 | 
	
		
			
				|  |  | +        calc->SetResultArrayName("vector_mag");
 | 
	
		
			
				|  |  | +        calc->Update();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /*vtkMaskPoints* mask = vtkMaskPoints::New();
 | 
	
		
			
				|  |  | +    mask->SetInputConnection(streamer->GetOutputPort());
 | 
	
		
			
				|  |  | +    mask->SetRandomMode(1);
 | 
	
		
			
				|  |  | +    mask->SetRandomModeType(2);
 | 
	
		
			
				|  |  | +    mask->SetMaximumNumberOfPoints(50);
 | 
	
		
			
				|  |  | +    mask->Update();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    vtkGlyphSource2D* source = vtkGlyphSource2D::New();
 | 
	
		
			
				|  |  | +    source->SetScale(1);//设置字形比例
 | 
	
		
			
				|  |  | +    source->SetGlyphTypeToArrow();
 | 
	
		
			
				|  |  | +    source->SetFilled(0);//关闭字形填充
 | 
	
		
			
				|  |  | +    source->SetOutputPointsPrecision(vtkAlgorithm::SINGLE_PRECISION);//为输入点设置精度
 | 
	
		
			
				|  |  | +    source->Update();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    vtkGlyph3D* glyph = vtkGlyph3D::New();
 | 
	
		
			
				|  |  | +    glyph->SetSourceConnection(source->GetOutputPort());
 | 
	
		
			
				|  |  | +    glyph->SetInputData(mask->GetOutput());
 | 
	
		
			
				|  |  | +    glyph->OrientOn();//关闭向矢量/法线方向输入几何图形
 | 
	
		
			
				|  |  | +    //glyph->SetVectorMode(1);//指定用矢量还是法向量来执行操作
 | 
	
		
			
				|  |  | +    glyph->SetVectorModeToUseVector();
 | 
	
		
			
				|  |  | +    glyph->SetScaleMode(0);//打开缩放功能
 | 
	
		
			
				|  |  | +    glyph->SetScaleModeToScaleByVector();
 | 
	
		
			
				|  |  | +    glyph->SetScaleFactor(0.2);
 | 
	
		
			
				|  |  | +    glyph->SetColorModeToColorByVector();
 | 
	
		
			
				|  |  | +    glyph->Update();*/
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();
 | 
	
		
			
				|  |  | +    if (streamStyle_ == "Tube")
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        mapper->SetInputConnection(tFilter->GetOutputPort());
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    else if (streamStyle_ == "Ribbon")
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        mapper->SetInputConnection(rFilter->GetOutputPort());
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    else
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        /*vtkPolyDataMapper* mapper1 = vtkPolyDataMapper::New();
 | 
	
		
			
				|  |  | +        mapper1->SetInputConnection(glyph->GetOutputPort());
 | 
	
		
			
				|  |  | +        vtkActor* actor = vtkActor::New();
 | 
	
		
			
				|  |  | +        actor->SetMapper(mapper1);
 | 
	
		
			
				|  |  | +        actor->GetProperty()->SetColor(0,0,1);
 | 
	
		
			
				|  |  | +        _renderer->AddActor(actor);*/
 | 
	
		
			
				|  |  | +        mapper->SetInputConnection(streamer->GetOutputPort());
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    vtkActor* actor = vtkActor::New();
 | 
	
		
			
				|  |  | +    actor->SetMapper(mapper);
 | 
	
		
			
				|  |  | +    actor->GetProperty()->SetColor(0,0,1);
 | 
	
		
			
				|  |  | +    _renderer->AddActor(actor);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    streamTracer_ = streamer;
 | 
	
		
			
				|  |  | +    tubeFilter_ = tFilter;
 | 
	
		
			
				|  |  | +    ribbonFilter_ = rFilter;
 | 
	
		
			
				|  |  | +    streamMapper_ = mapper;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    _unActor = actor;
 | 
	
		
			
				|  |  | +    _renWin->Render();
 | 
	
		
			
				|  |  | +    /*vtkStreamTracer *streamer = vtkStreamTracer::New();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        streamer->SetInputData(streamSource_);
 | 
	
		
			
				|  |  | +        //streamer->SetSourceData(streamSeeds_);//指定用于生成种子的源对象
 | 
	
		
			
				|  |  | +        streamer->SetSourceConnection(line->GetOutputPort());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        streamer->SetMinimumIntegrationStep(MinimumStep);//指定线积分最小步长
 | 
	
		
			
				|  |  | +        //streamer->SetMinimumIntegrationStepUnitToLengthUnit();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        streamer->SetMaximumPropagation(MaxPropagation);//指定流线最大长度
 | 
	
		
			
				|  |  | +        //streamer->SetMaximumPropagationUnitToCellLengthUnit();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        streamer->SetInitialIntegrationStep(InitialStep);//指定用于线积分的初始步长
 | 
	
		
			
				|  |  | +        //streamer->SetInitialIntegrationStepUnitToCellLengthUnit();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        streamer->SetIntegrator(integrator4_);//设置用于流线生成的整分器类型
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if (InteDirection_ == "Forward")
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            streamer->SetIntegrationDirectionToForward();//指定流线方向向前
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else if (InteDirection_ == "Backward")
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            streamer->SetIntegrationDirectionToBackward();//指定流线方向向后
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            streamer->SetIntegrationDirectionToBoth();//指定流线在两个方向集成
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    vtkTubeFilter *tFilter = vtkTubeFilter::New();//在线条周围生成管道的过滤器
 | 
	
		
			
				|  |  | +        tFilter->SetInputConnection(streamer->GetOutputPort());
 | 
	
		
			
				|  |  | +        tFilter->SetVaryRadiusToVaryRadiusByVector();
 | 
	
		
			
				|  |  | +        tFilter->SetRadius(tubeRadius);
 | 
	
		
			
				|  |  | +        tFilter->SetNumberOfSides(tubeSides);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    vtkRibbonFilter *rFilter = vtkRibbonFilter::New();//从多边形数据集中定义的线创建定向色带
 | 
	
		
			
				|  |  | +        rFilter->SetInputConnection(streamer->GetOutputPort());
 | 
	
		
			
				|  |  | +        rFilter->SetWidth(ribbonWidth);
 | 
	
		
			
				|  |  | +        rFilter->SetWidthFactor(ribbonFactor);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();
 | 
	
		
			
				|  |  | +        mapper->InterpolateScalarsBeforeMappingOn();//顶点颜色用于将颜色映射到表面
 | 
	
		
			
				|  |  | +        mapper->SetScalarRange(vectorRange[0], vectorRange[1]);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if (vectorType_ == 0)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            mapper->SetScalarModeToUsePointData();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else if (vectorType_ == 1)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            mapper->SetScalarModeToUseCellData();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if (streamStyle_ == "Tube")
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            mapper->SetInputConnection(tFilter->GetOutputPort());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else if (streamStyle_ == "Ribbon")
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            mapper->SetInputConnection(rFilter->GetOutputPort());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            mapper->SetInputConnection(streamer->GetOutputPort());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    vtkLookupTable *lut = (vtkLookupTable*)(mapper->GetLookupTable());
 | 
	
		
			
				|  |  | +        lut->GetHueRange(vectorRange);
 | 
	
		
			
				|  |  | +        lut->SetHueRange(vectorRange[1], vectorRange[0]);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    vtkActor *actor = vtkActor::New();
 | 
	
		
			
				|  |  | +        actor->SetMapper(mapper);
 | 
	
		
			
				|  |  | +        actor->VisibilityOn();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    _renderer->AddActor(actor);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    streamTracer_ = streamer;
 | 
	
		
			
				|  |  | +    tubeFilter_ = tFilter;
 | 
	
		
			
				|  |  | +    ribbonFilter_ = rFilter;
 | 
	
		
			
				|  |  | +    streamMapper_ = mapper;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    _unActor = actor;
 | 
	
		
			
				|  |  | +        //_renWin->Render();*/
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +void vtkVISUnStreamTrace::AlignLineWidget(vtkObject *caller, unsigned long, void *obj, void *)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    vtkVISUnStreamTrace *streamObj = reinterpret_cast<vtkVISUnStreamTrace*>(obj);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    streamObj->lineWidget_->GetPolyData(streamObj->streamSeeds_);
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +void vtkVISUnStreamTrace::GenerateStreamLines(vtkObject *caller, unsigned long, void *obj, void *)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    vtkVISUnStreamTrace *streamObj = reinterpret_cast<vtkVISUnStreamTrace*>(obj);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if ( streamObj->seedstype_ == "Point Source")
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        streamObj->pointWidget_->GetPolyData(streamObj->streamSeeds_);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    else if (streamObj->seedstype_ == "Plane Source")
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        streamObj->planeWidget_->GetPolyData(streamObj->streamSeeds_);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    else if (streamObj->seedstype_ == "Sphere Source")
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        streamObj->sphereWidget_->GetPolyData(streamObj->streamSeeds_);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    else
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        streamObj->lineWidget_->GetPolyData(streamObj->streamSeeds_);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +// --------------------------------------------------------------------------
 | 
	
		
			
				|  |  | +/// Modify StreamTrace Minimum Step
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @param minStep
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @return
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @author ZHU Qin
 | 
	
		
			
				|  |  | +/// @date 2010-06-01
 | 
	
		
			
				|  |  | +/// @reviser Shen Jie
 | 
	
		
			
				|  |  | +/// @date 2011-01-08
 | 
	
		
			
				|  |  | +void vtkVISUnStreamTrace::ModifyMinimumStep(double minStep)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    MinimumStep = minStep;
 | 
	
		
			
				|  |  | +    if (streamTracer_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        streamTracer_->SetMinimumIntegrationStep(MinimumStep);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    if (oneStreamTracer_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        oneStreamTracer_->InitTraversal();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        int num = oneStreamTracer_->GetNumberOfItems();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        for (int i=0; i< num;i++)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            ((vtkStreamTracer* )oneStreamTracer_->GetItemAsObject(i))->SetMinimumIntegrationStep(MinimumStep);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +// --------------------------------------------------------------------------
 | 
	
		
			
				|  |  | +/// Modify StreamTrace Max Propagation
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @param max
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @return
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @author ZHU Qin
 | 
	
		
			
				|  |  | +/// @date 2010-06-01
 | 
	
		
			
				|  |  | +/// @reviser Shen Jie
 | 
	
		
			
				|  |  | +/// @date 2011-01-08
 | 
	
		
			
				|  |  | +void vtkVISUnStreamTrace::ModifyMaxPropagation(double max)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    MaxPropagation = max;
 | 
	
		
			
				|  |  | +    if (streamTracer_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        streamTracer_->SetMaximumPropagation(MaxPropagation);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    if (oneStreamTracer_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        oneStreamTracer_->InitTraversal();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        int num = oneStreamTracer_->GetNumberOfItems();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        for (int i=0; i< num;i++)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            ((vtkStreamTracer* )oneStreamTracer_->GetItemAsObject(i))->SetMaximumPropagation(MaxPropagation);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +// --------------------------------------------------------------------------
 | 
	
		
			
				|  |  | +/// Modify StreamTrace Initial Step
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @param initiStep
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @return
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @author ZHU Qin
 | 
	
		
			
				|  |  | +/// @date 2010-06-01
 | 
	
		
			
				|  |  | +/// @reviser Shen Jie
 | 
	
		
			
				|  |  | +/// @date 2011-01-08
 | 
	
		
			
				|  |  | +void vtkVISUnStreamTrace::ModifyInitialStep(double initiStep)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    InitialStep = initiStep;
 | 
	
		
			
				|  |  | +    if (streamTracer_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        streamTracer_->SetInitialIntegrationStep(InitialStep);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    if (oneStreamTracer_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        oneStreamTracer_->InitTraversal();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        int num = oneStreamTracer_->GetNumberOfItems();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        for (int i=0; i< num;i++)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            ((vtkStreamTracer* )oneStreamTracer_->GetItemAsObject(i))->SetInitialIntegrationStep(InitialStep);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +// --------------------------------------------------------------------------
 | 
	
		
			
				|  |  | +/// Modify Tube Sides Number
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @param num
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @return
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @author ZHU Qin
 | 
	
		
			
				|  |  | +/// @date 2010-06-01
 | 
	
		
			
				|  |  | +/// @reviser Shen Jie
 | 
	
		
			
				|  |  | +/// @date 2011-01-08
 | 
	
		
			
				|  |  | +void vtkVISUnStreamTrace::ModifyTubeSides(int num)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    tubeSides = num;
 | 
	
		
			
				|  |  | +    if (tubeFilter_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        tubeFilter_->SetNumberOfSides(tubeSides);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    if (oneTubeFilter_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        oneTubeFilter_->InitTraversal();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        int num = oneTubeFilter_->GetNumberOfItems();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        for (int i=0; i< num;i++)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            ((vtkTubeFilter* )oneTubeFilter_->GetItemAsObject(i))->SetNumberOfSides(tubeSides);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +// --------------------------------------------------------------------------
 | 
	
		
			
				|  |  | +/// Modify Tube Radius
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @param radius
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @return
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @author ZHU Qin
 | 
	
		
			
				|  |  | +/// @date 2010-06-01
 | 
	
		
			
				|  |  | +/// @reviser Shen Jie
 | 
	
		
			
				|  |  | +/// @date 2011-01-08
 | 
	
		
			
				|  |  | +void vtkVISUnStreamTrace::ModifyTubeRadius(double radius)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    tubeRadius = radius;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if (tubeFilter_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        tubeFilter_->SetRadius(tubeRadius);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if (oneTubeFilter_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        oneTubeFilter_->InitTraversal();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        int num = oneTubeFilter_->GetNumberOfItems();
 | 
	
		
			
				|  |  | +        for (int i=0; i< num;i++)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            ((vtkTubeFilter* )oneTubeFilter_->GetItemAsObject(i))->SetRadius(tubeRadius);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +// --------------------------------------------------------------------------
 | 
	
		
			
				|  |  | +/// Modify Ribbon Width
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @param width
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @return
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @author ZHU Qin
 | 
	
		
			
				|  |  | +/// @date 2010-06-01
 | 
	
		
			
				|  |  | +/// @reviser Shen Jie
 | 
	
		
			
				|  |  | +/// @date 2011-01-08
 | 
	
		
			
				|  |  | +void vtkVISUnStreamTrace::ModifyRibbonWidth(double width)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    ribbonWidth = width;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if (ribbonFilter_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        ribbonFilter_->SetWidth(ribbonWidth);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if (oneRibbonFilter_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        oneRibbonFilter_->InitTraversal();
 | 
	
		
			
				|  |  | +        int num = oneRibbonFilter_->GetNumberOfItems();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        for (int i=0; i< num;i++)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            ((vtkRibbonFilter* )oneRibbonFilter_->GetItemAsObject(i))->SetWidth(ribbonWidth);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +// --------------------------------------------------------------------------
 | 
	
		
			
				|  |  | +/// Modify Ribbon Width Factor
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @param factor
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @return
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @author ZHU Qin
 | 
	
		
			
				|  |  | +/// @reviser Shen Jie
 | 
	
		
			
				|  |  | +/// @date 2011-01-08
 | 
	
		
			
				|  |  | +void vtkVISUnStreamTrace::ModifyRibbonFactor(double factor)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    ribbonFactor = factor;
 | 
	
		
			
				|  |  | +    if (ribbonFilter_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        ribbonFilter_->SetWidthFactor(ribbonFactor);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    if (oneRibbonFilter_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        oneRibbonFilter_->InitTraversal();
 | 
	
		
			
				|  |  | +        int num = oneRibbonFilter_->GetNumberOfItems();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        for (int i=0; i< num;i++)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            ((vtkRibbonFilter* )oneRibbonFilter_->GetItemAsObject(i))->SetWidthFactor(ribbonFactor);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +// --------------------------------------------------------------------------
 | 
	
		
			
				|  |  | +/// Modify Stream Style
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @param type
 | 
	
		
			
				|  |  | +/// @li "Tube"
 | 
	
		
			
				|  |  | +/// @li "Ribbon"
 | 
	
		
			
				|  |  | +/// @li "Line"
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @return
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @author ZHU Qin
 | 
	
		
			
				|  |  | +/// @date 2010-06-01
 | 
	
		
			
				|  |  | +/// @reviser Shen Jie
 | 
	
		
			
				|  |  | +/// @date 2011-01-08
 | 
	
		
			
				|  |  | +void vtkVISUnStreamTrace::ModifyStreamStyle (char* type)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    string s(type);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    streamStyle_ = s;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if (streamMapper_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        if (streamStyle_ == "Tube")
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            streamMapper_->SetInputConnection(tubeFilter_->GetOutputPort());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else if (streamStyle_ == "Ribbon")
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            streamMapper_->SetInputConnection(ribbonFilter_->GetOutputPort());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else {
 | 
	
		
			
				|  |  | +            streamMapper_->SetInputConnection(streamTracer_->GetOutputPort());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        _unActor->SetMapper(streamMapper_);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    if (oneStreamMapper_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        oneStreamMapper_->InitTraversal();
 | 
	
		
			
				|  |  | +        oneStreamTracer_->InitTraversal();
 | 
	
		
			
				|  |  | +        oneTubeFilter_->InitTraversal();
 | 
	
		
			
				|  |  | +        oneRibbonFilter_->InitTraversal();
 | 
	
		
			
				|  |  | +        int num = oneStreamMapper_->GetNumberOfItems();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        for (int i=0; i< num;i++)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            if (streamStyle_ == "Tube")
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                ((vtkPolyDataMapper* )oneStreamMapper_->GetItemAsObject(i))->SetInputConnection(((vtkTubeFilter* )oneTubeFilter_->GetItemAsObject (i))->GetOutputPort());
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            else if (streamStyle_ == "Ribbon")
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                ((vtkPolyDataMapper* )oneStreamMapper_->GetItemAsObject(i))->SetInputConnection(((vtkRibbonFilter* )oneRibbonFilter_->GetItemAsObject (i))->GetOutputPort());
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            else {
 | 
	
		
			
				|  |  | +                ((vtkPolyDataMapper* )oneStreamMapper_->GetItemAsObject(i))->SetInputConnection(((vtkStreamTracer* )oneStreamTracer_->GetItemAsObject (i))->GetOutputPort());
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            ((vtkPolyDataMapper* )oneStreamMapper_->GetItemAsObject(i))->Modified ();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        oneStreamActor_->InitTraversal();
 | 
	
		
			
				|  |  | +        vtkActor * pActor = oneStreamActor_->GetNextActor();
 | 
	
		
			
				|  |  | +        int i = 0;
 | 
	
		
			
				|  |  | +        while(pActor)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            pActor->SetMapper((vtkPolyDataMapper* )oneStreamMapper_->GetItemAsObject(i));
 | 
	
		
			
				|  |  | +            i ++;
 | 
	
		
			
				|  |  | +            pActor = oneStreamActor_->GetNextActor();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +// --------------------------------------------------------------------------
 | 
	
		
			
				|  |  | +/// Modify Integra Direction
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @param direction
 | 
	
		
			
				|  |  | +/// @li "Forward"
 | 
	
		
			
				|  |  | +/// @li "Backward"
 | 
	
		
			
				|  |  | +/// @li "Both"
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @return
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @author ZHU Qin
 | 
	
		
			
				|  |  | +/// @date 2010-06-01
 | 
	
		
			
				|  |  | +/// @reviser Shen Jie
 | 
	
		
			
				|  |  | +/// @date 2011-01-08
 | 
	
		
			
				|  |  | +void vtkVISUnStreamTrace::ModifyIntegraDirection (char* direction)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    string s(direction);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    InteDirection_ = s;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if (streamTracer_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        if (InteDirection_ == "Forward")
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            streamTracer_->SetIntegrationDirectionToForward();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else if (InteDirection_ == "Backward")
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            streamTracer_->SetIntegrationDirectionToBackward();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            streamTracer_->SetIntegrationDirectionToBoth();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    if (oneStreamTracer_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        oneStreamTracer_->InitTraversal();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        int num = oneStreamTracer_->GetNumberOfItems();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        for (int i=0; i< num;i++)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            if (InteDirection_ == "Forward")
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                ((vtkStreamTracer* )oneStreamTracer_->GetItemAsObject(i))->SetIntegrationDirectionToForward();
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            else if (InteDirection_ == "Backward")
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                ((vtkStreamTracer* )oneStreamTracer_->GetItemAsObject(i))->SetIntegrationDirectionToBackward();
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            else
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                ((vtkStreamTracer* )oneStreamTracer_->GetItemAsObject(i))->SetIntegrationDirectionToBoth();
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            ((vtkStreamTracer* )oneStreamTracer_->GetItemAsObject(i))->Modified();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +// --------------------------------------------------------------------------
 | 
	
		
			
				|  |  | +/// Set Seeds Type
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @param type
 | 
	
		
			
				|  |  | +/// @li "Point Source"
 | 
	
		
			
				|  |  | +/// @li "Plane Source"
 | 
	
		
			
				|  |  | +/// @li "Sphere Source"
 | 
	
		
			
				|  |  | +/// @li "Line Source"
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @return
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @author ZHU Qin
 | 
	
		
			
				|  |  | +/// @date 2010-06-01
 | 
	
		
			
				|  |  | +/// @reviser Shen Jie
 | 
	
		
			
				|  |  | +/// @date 2011-01-08
 | 
	
		
			
				|  |  | +void vtkVISUnStreamTrace::SetSeedsType (string type)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    seedstype_ = type;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    double bounds[6];
 | 
	
		
			
				|  |  | +    (_source->unstruGrid)->GetBounds(bounds);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    vtkPolyData *seeds = vtkPolyData::New();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    streamSeeds_ = vtkPolyData::New();
 | 
	
		
			
				|  |  | +    streamSeeds_ = seeds;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    vtkCallbackCommand *callback = vtkCallbackCommand::New();
 | 
	
		
			
				|  |  | +        callback->SetCallback(GenerateStreamLines);
 | 
	
		
			
				|  |  | +        callback->SetClientData(this);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if ( seedstype_ == "Point Source")
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        if (pointWidget_ != NULL)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            pointWidget_->GetPolyData(streamSeeds_);
 | 
	
		
			
				|  |  | +            pointWidget_->On();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            vtkPointWidget *pointWidget= vtkPointWidget::New();
 | 
	
		
			
				|  |  | +                pointWidget_ = pointWidget;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                pointWidget_->SetHandleSize(0.005);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                pointWidget->SetInteractor(_renWin->GetInteractor());
 | 
	
		
			
				|  |  | +                pointWidget->SetPosition(-1.0, 0, 0);
 | 
	
		
			
				|  |  | +                pointWidget->TranslationModeOn();
 | 
	
		
			
				|  |  | +                pointWidget->GetPolyData(streamSeeds_);
 | 
	
		
			
				|  |  | +                pointWidget->AllOff();
 | 
	
		
			
				|  |  | +                pointWidget->AddObserver(vtkCommand::InteractionEvent, callback);
 | 
	
		
			
				|  |  | +                pointWidget->EnabledOn();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +             if (streamActor_ != NULL)
 | 
	
		
			
				|  |  | +             {
 | 
	
		
			
				|  |  | +                streamActor_->VisibilityOff();
 | 
	
		
			
				|  |  | +                ShowOffStreamTraceLines();
 | 
	
		
			
				|  |  | +             }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (lineWidget_ != NULL)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            lineWidget_->Off();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (planeWidget_ != NULL)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            planeWidget_->Off();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (sphereWidget_ != NULL)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            sphereWidget_->Off();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    else if ( seedstype_ == "Plane Source")
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        if (planeWidget_ != NULL)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            planeWidget_->GetPolyData(streamSeeds_);
 | 
	
		
			
				|  |  | +            planeWidget_->On();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            vtkPlaneWidget *planeWidget= vtkPlaneWidget::New();
 | 
	
		
			
				|  |  | +                planeWidget_ = planeWidget;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                planeWidget_->SetHandleSize(0.005);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                planeWidget->SetInteractor(_renWin->GetInteractor());
 | 
	
		
			
				|  |  | +                planeWidget->PlaceWidget(bounds[0], bounds[1], bounds[2], bounds[3], bounds[4], bounds[5]);
 | 
	
		
			
				|  |  | +                planeWidget->SetRepresentationToWireframe();
 | 
	
		
			
				|  |  | +                planeWidget->NormalToYAxisOn();
 | 
	
		
			
				|  |  | +                planeWidget->GetPolyData(streamSeeds_);
 | 
	
		
			
				|  |  | +                planeWidget->AddObserver(vtkCommand::InteractionEvent, callback);
 | 
	
		
			
				|  |  | +                planeWidget->EnabledOn();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            if (streamActor_ != NULL)
 | 
	
		
			
				|  |  | +             {
 | 
	
		
			
				|  |  | +                streamActor_->VisibilityOff();
 | 
	
		
			
				|  |  | +                ShowOffStreamTraceLines();
 | 
	
		
			
				|  |  | +             }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (pointWidget_ != NULL)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            pointWidget_->Off();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (lineWidget_ != NULL)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            lineWidget_->Off();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (sphereWidget_ != NULL)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            sphereWidget_->Off();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    else if ( seedstype_ == "Sphere Source")
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        if (sphereWidget_ != NULL)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            sphereWidget_->GetPolyData(streamSeeds_);
 | 
	
		
			
				|  |  | +            sphereWidget_->On();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            vtkSphereWidget *sphereWidget= vtkSphereWidget::New();
 | 
	
		
			
				|  |  | +                sphereWidget_ = sphereWidget;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                sphereWidget_->SetHandleSize(0.005);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                sphereWidget->SetInteractor(_renWin->GetInteractor());
 | 
	
		
			
				|  |  | +                sphereWidget->PlaceWidget(bounds[0], bounds[1], bounds[2], bounds[3], bounds[4], bounds[5]);
 | 
	
		
			
				|  |  | +                sphereWidget->SetRepresentationToWireframe();
 | 
	
		
			
				|  |  | +                sphereWidget->SetThetaResolution(sphereTheta);
 | 
	
		
			
				|  |  | +                sphereWidget->SetPhiResolution(spherePhi);
 | 
	
		
			
				|  |  | +                sphereWidget->SetRadius(sphereRadius);
 | 
	
		
			
				|  |  | +                sphereWidget->GetPolyData(streamSeeds_);
 | 
	
		
			
				|  |  | +                sphereWidget->AddObserver(vtkCommand::InteractionEvent, callback);
 | 
	
		
			
				|  |  | +                sphereWidget->EnabledOn();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            if (streamActor_ != NULL)
 | 
	
		
			
				|  |  | +             {
 | 
	
		
			
				|  |  | +                streamActor_->VisibilityOff();
 | 
	
		
			
				|  |  | +                ShowOffStreamTraceLines();
 | 
	
		
			
				|  |  | +             }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (pointWidget_ != NULL)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            pointWidget_->Off();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (lineWidget_ != NULL)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            lineWidget_->Off();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (planeWidget_ != NULL)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            planeWidget_->Off();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    else
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        if (lineWidget_ != NULL) {
 | 
	
		
			
				|  |  | +            lineWidget_->GetPolyData(streamSeeds_);
 | 
	
		
			
				|  |  | +            lineWidget_->On();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            vtkLineWidget *lineWidget= vtkLineWidget::New();
 | 
	
		
			
				|  |  | +                lineWidget_ = lineWidget;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                lineWidget_->SetHandleSize(0.005);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            vtkCallbackCommand *alignBack = vtkCallbackCommand::New();
 | 
	
		
			
				|  |  | +                alignBack->SetCallback(AlignLineWidget);
 | 
	
		
			
				|  |  | +                alignBack->SetClientData(this);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                lineWidget->SetInteractor(_renWin->GetInteractor());
 | 
	
		
			
				|  |  | +                lineWidget->PlaceWidget(bounds[0], bounds[1], bounds[2], bounds[3], bounds[4], bounds[5]);
 | 
	
		
			
				|  |  | +                lineWidget->ClampToBoundsOn();
 | 
	
		
			
				|  |  | +                lineWidget->SetResolution(lineSeedsNumber);
 | 
	
		
			
				|  |  | +                lineWidget->GetPolyData(streamSeeds_);
 | 
	
		
			
				|  |  | +                lineWidget->AddObserver(vtkCommand::InteractionEvent, callback);
 | 
	
		
			
				|  |  | +                lineWidget->AddObserver(vtkCommand::ModifiedEvent, alignBack);
 | 
	
		
			
				|  |  | +                lineWidget->EnabledOn();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                if (lineAlignAxis_ == "X")
 | 
	
		
			
				|  |  | +                {
 | 
	
		
			
				|  |  | +                    lineWidget->SetAlignToXAxis();
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                else if (lineAlignAxis_ == "Z")
 | 
	
		
			
				|  |  | +                {
 | 
	
		
			
				|  |  | +                    lineWidget->SetAlignToZAxis();
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                else
 | 
	
		
			
				|  |  | +                {
 | 
	
		
			
				|  |  | +                    lineWidget->SetAlignToYAxis();
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            if (streamActor_ != NULL)
 | 
	
		
			
				|  |  | +             {
 | 
	
		
			
				|  |  | +                streamActor_->VisibilityOff();
 | 
	
		
			
				|  |  | +                ShowOffStreamTraceLines();
 | 
	
		
			
				|  |  | +             }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (pointWidget_ != NULL)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            pointWidget_->Off();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (planeWidget_ != NULL)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            planeWidget_->Off();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (sphereWidget_ != NULL)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            sphereWidget_->Off();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    streamSeeds_->Modified();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if (streamTracer_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        streamTracer_->SetSourceData(streamSeeds_);
 | 
	
		
			
				|  |  | +        streamTracer_->Modified();
 | 
	
		
			
				|  |  | +        streamActor_->VisibilityOn();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    if (oneStreamActor_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        oneStreamActor_->InitTraversal();
 | 
	
		
			
				|  |  | +        oneStreamTracer_->InitTraversal();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        int num = oneStreamActor_->GetNumberOfItems();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        for (int i=0; i< num;i++)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            vtkActor* actor = (vtkActor* )oneStreamActor_->GetItemAsObject (i);
 | 
	
		
			
				|  |  | +            vtkStreamTracer* streamTracer = (vtkStreamTracer* )oneStreamTracer_->GetItemAsObject (i);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            streamTracer->SetSourceData(streamSeeds_);
 | 
	
		
			
				|  |  | +            streamTracer->Modified();
 | 
	
		
			
				|  |  | +            actor->VisibilityOn();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            actor->Delete ();
 | 
	
		
			
				|  |  | +            streamTracer->Delete ();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +// --------------------------------------------------------------------------
 | 
	
		
			
				|  |  | +/// Modify Sphere Widget Radius
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @param radius
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @return
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @author ZHU Qin
 | 
	
		
			
				|  |  | +/// @date 2010-05-31
 | 
	
		
			
				|  |  | +/// @reviser
 | 
	
		
			
				|  |  | +void vtkVISUnStreamTrace::ModifySphereRadius(double radius)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    if (sphereWidget_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        sphereRadius = radius;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        sphereWidget_->SetRadius(sphereRadius);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +// --------------------------------------------------------------------------
 | 
	
		
			
				|  |  | +/// Modify Sphere Widget Theta
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @param theta
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @return
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @author ZHU Qin
 | 
	
		
			
				|  |  | +/// @date 2010-05-31
 | 
	
		
			
				|  |  | +/// @reviser
 | 
	
		
			
				|  |  | +void vtkVISUnStreamTrace::ModifySphereTheta(int theta)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    if (sphereWidget_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        sphereTheta = theta;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        sphereWidget_->SetThetaResolution(sphereTheta);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +// --------------------------------------------------------------------------
 | 
	
		
			
				|  |  | +/// Modify Sphere Widget Phi
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @param phi
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @return
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @author ZHU Qin
 | 
	
		
			
				|  |  | +/// @date 2010-05-31
 | 
	
		
			
				|  |  | +/// @reviser
 | 
	
		
			
				|  |  | +void vtkVISUnStreamTrace::ModifySpherePhi(int phi)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    spherePhi = phi;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if (sphereWidget_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        sphereWidget_->SetPhiResolution(spherePhi);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +// --------------------------------------------------------------------------
 | 
	
		
			
				|  |  | +/// Modify Line Seeds Number
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @param axis
 | 
	
		
			
				|  |  | +/// @li "X"
 | 
	
		
			
				|  |  | +/// @li "Y"
 | 
	
		
			
				|  |  | +/// @li "Z"
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @return
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @author ZHU Qin
 | 
	
		
			
				|  |  | +/// @date 2010-06-01
 | 
	
		
			
				|  |  | +/// @reviser
 | 
	
		
			
				|  |  | +void vtkVISUnStreamTrace::ModifyLineAlignAxis(char* axis)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    string s(axis);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    lineAlignAxis_ = s;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if (lineAlignAxis_ == "X")
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        if (lineWidget_ != NULL)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            lineWidget_->SetAlignToXAxis();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    else if (lineAlignAxis_ == "Z")
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        if (lineWidget_ != NULL)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            lineWidget_->SetAlignToZAxis();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    else
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        if (lineWidget_ != NULL)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            lineWidget_->SetAlignToYAxis();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +// --------------------------------------------------------------------------
 | 
	
		
			
				|  |  | +/// Modify Line Seeds Number
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @param seeds num
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @return
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @author ZHU Qin
 | 
	
		
			
				|  |  | +/// @date 2010-06-01
 | 
	
		
			
				|  |  | +/// @reviser
 | 
	
		
			
				|  |  | +void vtkVISUnStreamTrace::ModifyLineSeedsNumber(int num)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    lineSeedsNumber = num;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if (lineWidget_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        lineWidget_->SetResolution(lineSeedsNumber);
 | 
	
		
			
				|  |  | +        lineWidget_->Modified();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +// --------------------------------------------------------------------------
 | 
	
		
			
				|  |  | +/// Get Line Seeds Number
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @param
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @return line seeds number
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @author ZHU Qin
 | 
	
		
			
				|  |  | +/// @date 2010-06-01
 | 
	
		
			
				|  |  | +/// @reviser
 | 
	
		
			
				|  |  | +int vtkVISUnStreamTrace::GetLineSeedsNumber()
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    return this->lineSeedsNumber;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +// --------------------------------------------------------------------------
 | 
	
		
			
				|  |  | +/// Create One StreamLine
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @param
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @return vtkActor
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @author ZHU Qin
 | 
	
		
			
				|  |  | +/// @date 2010-06-22
 | 
	
		
			
				|  |  | +/// @reviser Shen Jie
 | 
	
		
			
				|  |  | +/// @date 2011-01-08
 | 
	
		
			
				|  |  | +vtkActor* vtkVISUnStreamTrace::CreateOneStreamLine()
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    vtkRungeKutta4 *kutta4 = vtkRungeKutta4::New();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    vtkStreamTracer *streamer = vtkStreamTracer::New();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        streamer->SetInputData(streamSource_);
 | 
	
		
			
				|  |  | +        streamer->SetStartPosition(startPosition[0], startPosition[1], startPosition[2]);
 | 
	
		
			
				|  |  | +        streamer->SetIntegrator(kutta4);
 | 
	
		
			
				|  |  | +        streamer->SetMaximumPropagation(MaxPropagation);
 | 
	
		
			
				|  |  | +        streamer->SetMinimumIntegrationStep(MinimumStep);
 | 
	
		
			
				|  |  | +        streamer->SetInitialIntegrationStep(InitialStep);
 | 
	
		
			
				|  |  | +        if (InteDirection_ == "Forward")
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            streamer->SetIntegrationDirectionToForward();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else if (InteDirection_ == "Backward")
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            streamer->SetIntegrationDirectionToBackward();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            streamer->SetIntegrationDirectionToBoth();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        streamer->Update();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    vtkTubeFilter *tFilter = vtkTubeFilter::New();
 | 
	
		
			
				|  |  | +        tFilter->SetInputConnection(streamer->GetOutputPort());
 | 
	
		
			
				|  |  | +        tFilter->SetVaryRadiusToVaryRadiusByVector();
 | 
	
		
			
				|  |  | +        tFilter->SetRadius(tubeRadius);
 | 
	
		
			
				|  |  | +        tFilter->SetNumberOfSides(tubeSides);
 | 
	
		
			
				|  |  | +        tFilter->Update();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    vtkRibbonFilter *rFilter = vtkRibbonFilter::New();
 | 
	
		
			
				|  |  | +        rFilter->SetInputConnection(streamer->GetOutputPort());
 | 
	
		
			
				|  |  | +        rFilter->SetWidth(ribbonWidth);
 | 
	
		
			
				|  |  | +        rFilter->SetWidthFactor(ribbonFactor);
 | 
	
		
			
				|  |  | +        rFilter->Update();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();
 | 
	
		
			
				|  |  | +        if (streamStyle_ == "Tube")
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            mapper->SetInputConnection(tFilter->GetOutputPort());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else if (streamStyle_ == "Ribbon")
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            mapper->SetInputConnection(rFilter->GetOutputPort());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            mapper->SetInputConnection(streamer->GetOutputPort());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        vtkActor* actor = vtkActor::New();
 | 
	
		
			
				|  |  | +        actor->SetMapper(mapper);
 | 
	
		
			
				|  |  | +        actor->GetProperty()->SetColor(0,0,1);
 | 
	
		
			
				|  |  | +        _renderer->AddActor(actor);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if (oneIntegrator4_ == NULL)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            oneIntegrator4_ = vtkCollection::New();
 | 
	
		
			
				|  |  | +            oneIntegrator4_->AddItem (kutta4);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            oneIntegrator4_->AddItem (kutta4);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if (oneStreamTracer_ == NULL)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            oneStreamTracer_ = vtkCollection::New();
 | 
	
		
			
				|  |  | +            oneStreamTracer_->AddItem (streamer);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            oneStreamTracer_->AddItem (streamer);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if (oneTubeFilter_ == NULL)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            oneTubeFilter_ = vtkCollection::New();
 | 
	
		
			
				|  |  | +            oneTubeFilter_->AddItem (tFilter);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            oneTubeFilter_->AddItem (tFilter);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if (oneRibbonFilter_ == NULL)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            oneRibbonFilter_ = vtkCollection::New();
 | 
	
		
			
				|  |  | +            oneRibbonFilter_->AddItem (rFilter);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            oneRibbonFilter_->AddItem (rFilter);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if (oneStreamMapper_ == NULL)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            oneStreamMapper_ = vtkActorCollection::New();
 | 
	
		
			
				|  |  | +            oneStreamMapper_->AddItem (mapper);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            oneStreamMapper_->AddItem (mapper);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if (oneStreamActor_ == NULL)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            oneStreamActor_ = vtkActorCollection::New();
 | 
	
		
			
				|  |  | +            oneStreamActor_->AddItem (actor);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            oneStreamActor_->AddItem (actor);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        kutta4->Delete();
 | 
	
		
			
				|  |  | +        streamer->Delete();
 | 
	
		
			
				|  |  | +        tFilter->Delete();
 | 
	
		
			
				|  |  | +        rFilter->Delete();
 | 
	
		
			
				|  |  | +        mapper->Delete();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        return actor;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /*if (scalarIndex_ == -1)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        ErrorInfo(1, "Can't create stream line, scalar not exists.");
 | 
	
		
			
				|  |  | +        return NULL;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    double *range;
 | 
	
		
			
				|  |  | +    range = _source->scalarRange[scalarIndex_];*/
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /*double range[2];
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if (scalarIndex_ != -1)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        range[0] = _source->scalarRange[scalarIndex_][0];
 | 
	
		
			
				|  |  | +        range[1] = _source->scalarRange[scalarIndex_][1];
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    else
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        range[0] = 0;
 | 
	
		
			
				|  |  | +        range[1] = 0;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    streamSource_->GetPoint(1500, startPosition);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    vtkRungeKutta4 *kutta4 = vtkRungeKutta4::New();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    vtkStreamTracer *streamer = vtkStreamTracer::New();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        streamer->SetInputData(streamSource_);
 | 
	
		
			
				|  |  | +        streamer->SetStartPosition(startPosition[0], startPosition[1], startPosition[2]);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        //streamer->SetIntegrationStepUnit(vtkStreamTracer::CELL_LENGTH_UNIT);
 | 
	
		
			
				|  |  | +        streamer->SetMinimumIntegrationStep(MinimumStep);
 | 
	
		
			
				|  |  | +        //streamer->SetMinimumIntegrationStepUnitToLengthUnit();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        streamer->SetMaximumPropagation(MaxPropagation);
 | 
	
		
			
				|  |  | +        //streamer->SetMaximumPropagationUnitToCellLengthUnit();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        streamer->SetInitialIntegrationStep(InitialStep);
 | 
	
		
			
				|  |  | +        //streamer->SetInitialIntegrationStepUnitToCellLengthUnit();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        streamer->SetIntegrator(kutta4);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if (InteDirection_ == "Forward")
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            streamer->SetIntegrationDirectionToForward();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else if (InteDirection_ == "Backward")
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            streamer->SetIntegrationDirectionToBackward();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            streamer->SetIntegrationDirectionToBoth();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        streamer->Update();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    vtkTubeFilter *tFilter = vtkTubeFilter::New();
 | 
	
		
			
				|  |  | +        tFilter->SetInputConnection(streamer->GetOutputPort());
 | 
	
		
			
				|  |  | +        tFilter->SetVaryRadiusToVaryRadiusByVector();
 | 
	
		
			
				|  |  | +        tFilter->SetRadius(tubeRadius);
 | 
	
		
			
				|  |  | +        tFilter->SetNumberOfSides(tubeSides);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    vtkRibbonFilter *rFilter = vtkRibbonFilter::New();
 | 
	
		
			
				|  |  | +        rFilter->SetInputConnection(streamer->GetOutputPort());
 | 
	
		
			
				|  |  | +        rFilter->SetWidth(ribbonWidth);
 | 
	
		
			
				|  |  | +        rFilter->SetWidthFactor(ribbonFactor);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();
 | 
	
		
			
				|  |  | +        mapper->InterpolateScalarsBeforeMappingOn();
 | 
	
		
			
				|  |  | +        mapper->SetScalarRange(range[0], range[1]);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if (streamStyle_ == "Tube")
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            mapper->SetInputConnection(tFilter->GetOutputPort());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else if (streamStyle_ == "Ribbon")
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            mapper->SetInputConnection(rFilter->GetOutputPort());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        else {
 | 
	
		
			
				|  |  | +            mapper->SetInputConnection(streamer->GetOutputPort());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if (scalarIndex_ != -1)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            if (_source->scalarSource[scalarIndex_]->GetDataSize() != 0)
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                mapper->SetScalarModeToUsePointData();
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            else
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                mapper->SetScalarModeToUseCellData();
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    vtkLookupTable *lut = (vtkLookupTable*)(mapper->GetLookupTable());
 | 
	
		
			
				|  |  | +        lut->GetHueRange(range);
 | 
	
		
			
				|  |  | +        lut->SetHueRange(range[1], range[0]);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    vtkActor *actor = vtkActor::New();
 | 
	
		
			
				|  |  | +        actor->SetMapper(mapper);
 | 
	
		
			
				|  |  | +        actor->VisibilityOn();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    _renderer->AddActor(actor);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +   /* oneStreamActor_ = actor;
 | 
	
		
			
				|  |  | +    oneStreamMapper_ = mapper;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if (oneIntegrator4_ == NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        oneIntegrator4_ = vtkCollection::New();
 | 
	
		
			
				|  |  | +        oneIntegrator4_->AddItem (kutta4);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    else
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        oneIntegrator4_->AddItem (kutta4);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if (oneStreamTracer_ == NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        oneStreamTracer_ = vtkCollection::New();
 | 
	
		
			
				|  |  | +        oneStreamTracer_->AddItem (streamer);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    else
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        oneStreamTracer_->AddItem (streamer);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if (oneTubeFilter_ == NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        oneTubeFilter_ = vtkCollection::New();
 | 
	
		
			
				|  |  | +        oneTubeFilter_->AddItem (tFilter);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    else
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        oneTubeFilter_->AddItem (tFilter);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if (oneRibbonFilter_ == NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        oneRibbonFilter_ = vtkCollection::New();
 | 
	
		
			
				|  |  | +        oneRibbonFilter_->AddItem (rFilter);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    else
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        oneRibbonFilter_->AddItem (rFilter);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if (oneStreamMapper_ == NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        oneStreamMapper_ = vtkActorCollection::New();
 | 
	
		
			
				|  |  | +        oneStreamMapper_->AddItem (mapper);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    else
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        oneStreamMapper_->AddItem (mapper);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if (oneStreamActor_ == NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        oneStreamActor_ = vtkActorCollection::New();
 | 
	
		
			
				|  |  | +        oneStreamActor_->AddItem (actor);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    else
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        oneStreamActor_->AddItem (actor);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    kutta4->Delete();
 | 
	
		
			
				|  |  | +    streamer->Delete();
 | 
	
		
			
				|  |  | +    tFilter->Delete();
 | 
	
		
			
				|  |  | +    rFilter->Delete();
 | 
	
		
			
				|  |  | +    mapper->Delete();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    return actor;*/
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +// --------------------------------------------------------------------------
 | 
	
		
			
				|  |  | +/// Show On Stream Widget
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @param
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @return
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @author ZHU Qin
 | 
	
		
			
				|  |  | +/// @date 2010-06-22
 | 
	
		
			
				|  |  | +/// @reviser
 | 
	
		
			
				|  |  | +void vtkVISUnStreamTrace::ShowOnStreamWidget()
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    if ( seedstype_ == "Point Source")
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        if (pointWidget_ != NULL)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            pointWidget_->On();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    else if (seedstype_ == "Plane Source")
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        if (planeWidget_ != NULL)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            planeWidget_->On();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    else if (seedstype_ == "Sphere Source")
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        if (sphereWidget_ != NULL)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            sphereWidget_->On();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    else
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        if (lineWidget_ != NULL)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            lineWidget_->On();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +// --------------------------------------------------------------------------
 | 
	
		
			
				|  |  | +/// Show Off Stream Widget
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @param
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @return
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @author ZHU Qin
 | 
	
		
			
				|  |  | +/// @date 2010-06-22
 | 
	
		
			
				|  |  | +/// @reviser
 | 
	
		
			
				|  |  | +void vtkVISUnStreamTrace::ShowOffStreamWidget()
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    if ( seedstype_ == "Point Source")
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        if (pointWidget_ != NULL)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            pointWidget_->Off();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    else if (seedstype_ == "Plane Source")
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        if (planeWidget_ != NULL)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            planeWidget_->Off();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    else if (seedstype_ == "Sphere Source")
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        if (sphereWidget_ != NULL)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            sphereWidget_->Off();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    else
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        if (lineWidget_ != NULL)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            lineWidget_->Off();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +// --------------------------------------------------------------------------
 | 
	
		
			
				|  |  | +/// Show On Stream Lines
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @param
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @return
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @author ZHU Qin
 | 
	
		
			
				|  |  | +/// @date 2010-06-22
 | 
	
		
			
				|  |  | +/// @reviser Shen Jie
 | 
	
		
			
				|  |  | +/// @date 2011-01-08
 | 
	
		
			
				|  |  | +void vtkVISUnStreamTrace::ShowOnStreamTraceLines()
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    if (oneStreamActor_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        oneStreamActor_->InitTraversal();
 | 
	
		
			
				|  |  | +        vtkActor * pActor = oneStreamActor_->GetNextActor();
 | 
	
		
			
				|  |  | +        while(pActor)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            pActor->VisibilityOn();
 | 
	
		
			
				|  |  | +            pActor = oneStreamActor_->GetNextActor();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    if (_unActor != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        _unActor->VisibilityOn();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    else
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        ErrorInfo(1, "stream Trace Actor is not Created!");
 | 
	
		
			
				|  |  | +        return;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +// --------------------------------------------------------------------------
 | 
	
		
			
				|  |  | +/// Show Off Stream Lines
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @param
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @return
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @author ZHU Qin
 | 
	
		
			
				|  |  | +/// @date 2010-06-22
 | 
	
		
			
				|  |  | +/// @reviser Shen Jie
 | 
	
		
			
				|  |  | +/// @date 2011-01-08
 | 
	
		
			
				|  |  | +void vtkVISUnStreamTrace::ShowOffStreamTraceLines()
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    if (oneStreamActor_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        oneStreamActor_->InitTraversal();
 | 
	
		
			
				|  |  | +        vtkActor * pActor = oneStreamActor_->GetNextActor();
 | 
	
		
			
				|  |  | +        while(pActor)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            pActor->VisibilityOff();
 | 
	
		
			
				|  |  | +            pActor = oneStreamActor_->GetNextActor();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if (_unActor != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        _unActor->VisibilityOff();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    else
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        ErrorInfo(1, "stream Trace Actor is not Created!");
 | 
	
		
			
				|  |  | +        return;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +// --------------------------------------------------------------------------
 | 
	
		
			
				|  |  | +/// Set StreamLine Start Position
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @param p0 -- start position x
 | 
	
		
			
				|  |  | +/// @param p1 -- start position y
 | 
	
		
			
				|  |  | +/// @param p2 -- start position z
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @return
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @author ZHU Qin
 | 
	
		
			
				|  |  | +/// @date 2010-06-22
 | 
	
		
			
				|  |  | +/// @reviser
 | 
	
		
			
				|  |  | +void vtkVISUnStreamTrace::SetStreamLineStartPosition(double p0, double p1, double p2)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    startPosition[0] = p0;
 | 
	
		
			
				|  |  | +    startPosition[1] = p1;
 | 
	
		
			
				|  |  | +    startPosition[2] = p2;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +// --------------------------------------------------------------------------
 | 
	
		
			
				|  |  | +/// Modify Seeds Widget Handle Size
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @param size
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @return
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @author ZHU Qin
 | 
	
		
			
				|  |  | +/// @date 2010-12-15
 | 
	
		
			
				|  |  | +/// @reviser
 | 
	
		
			
				|  |  | +void vtkVISUnStreamTrace::ModifySeedsWidgetHandleSize(double size)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    if ( seedstype_ == "Point Source")
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        if (pointWidget_ != NULL)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            pointWidget_->SetHandleSize(size);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    else if (seedstype_ == "Plane Source")
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        if (planeWidget_ != NULL)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            planeWidget_->SetHandleSize(size);
 | 
	
		
			
				|  |  | +            planeWidget_->UpdatePlacement();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    else if (seedstype_ == "Sphere Source")
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        if (sphereWidget_ != NULL)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            sphereWidget_->SetHandleSize(size);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    else
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        if (lineWidget_ != NULL)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            lineWidget_->SetHandleSize(size);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +// --------------------------------------------------------------------------
 | 
	
		
			
				|  |  | +/// Modify Dispaly Scalar Range
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @param size
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @return
 | 
	
		
			
				|  |  | +///
 | 
	
		
			
				|  |  | +/// @author ZHU Qin
 | 
	
		
			
				|  |  | +/// @date 2010-12-15
 | 
	
		
			
				|  |  | +/// @reviser
 | 
	
		
			
				|  |  | +void vtkVISUnStreamTrace::ModifyDispalyScalarRange(double min, double max)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    if(streamMapper_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        streamMapper_->SetScalarRange(min, max);
 | 
	
		
			
				|  |  | +        streamMapper_->Modified();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    if (oneStreamActor_ != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        oneStreamActor_->InitTraversal();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        vtkActor * pActor = oneStreamActor_->GetNextActor();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        while(pActor)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            pActor->GetMapper()->SetScalarRange(min,max);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            pActor->GetMapper()->Modified();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            pActor = oneStreamActor_->GetNextActor();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +void vtkVISUnStreamTrace::vtkSelectPointOn()
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    if (style_ == NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        style_ = MouseInteractorStyle::New();
 | 
	
		
			
				|  |  | +        style_->SetRender(_renderer);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    SelectState_ = 1;
 | 
	
		
			
				|  |  | +    _renWin->GetInteractor()->SetInteractorStyle(style_);
 | 
	
		
			
				|  |  | +    vtkCallbackCommand* selectCommand = vtkCallbackCommand::New();
 | 
	
		
			
				|  |  | +    selectCommand->SetCallback(DrawSelectStream);
 | 
	
		
			
				|  |  | +    selectCommand->SetClientData(this);
 | 
	
		
			
				|  |  | +    _renWin->GetInteractor()->AddObserver(vtkCommand::LeftButtonPressEvent, selectCommand);
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +void vtkVISUnStreamTrace::vtkSelectPointOff()
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    SelectState_ = 0;
 | 
	
		
			
				|  |  | +    vtkInteractorStyleTrackballCamera* style = vtkInteractorStyleTrackballCamera::New();
 | 
	
		
			
				|  |  | +    _renWin->GetInteractor()->SetInteractorStyle(style);
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +void vtkVISUnStreamTrace::DrawSelectStream(vtkObject *caller, unsigned long, void *obj, void *)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    vtkVISUnStreamTrace *streamObj = reinterpret_cast<vtkVISUnStreamTrace*>(obj);
 | 
	
		
			
				|  |  | +    if (streamObj != NULL)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        if (streamObj->SelectState_ == 1)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            streamObj->positionVec_.clear();
 | 
	
		
			
				|  |  | +            streamObj->positionVec_ = streamObj->style_->GetPosition();
 | 
	
		
			
				|  |  | +            if (streamObj->positionVec_.size() == 3)
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                streamObj->SetStreamLineStartPosition(streamObj->positionVec_.at(0), streamObj->positionVec_.at(1), streamObj->positionVec_.at(2));
 | 
	
		
			
				|  |  | +                streamObj->CreateOneStreamLine();
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +vector<double> vtkVISUnStreamTrace::GetPosition()
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    return positionVec_;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 |