[vtkusers] is there any thing wrong?

胡健09060017 hujian198681 at 126.com
Sat Nov 13 08:09:21 EST 2010


#include <vtkSmartPointer.h>
#include <vtkHAVSVolumeMapper.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkUnstructuredGridReader.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkStructuredPointsReader.h>
#include <vtkSLCReader.h>
#include <vtkStructuredPoints.h>
#include <vtkUnstructuredGrid.h>
#include <vtkDataSetTriangleFilter.h>
#include <vtkPiecewiseFunction.h>
#include <vtkColorTransferFunction.h>
#include <vtkVolumeProperty.h>
#include <vtkVolume.h>
#include <vtkContourFilter.h>
#include <vtkPolyDataMapper.h>
#include <vtkActor.h>
#include <vtkStdString.h>
#include <vtkTesting.h>
#include <vtkPLOT3DReader.h>
#include <vtkXMLUnstructuredGridReader.h>
#include <vtkStructuredGridOutlineFilter.h>
#include <vtkPlaneSource.h>
#include <vtkStreamLine.h>
#include <vtkProperty.h>
#include <vtkXMLRectilinearGridReader.h>
#include <vtkRectilinearGridReader.h>
#include <vtkAssignAttribute.h>
#include <vtkPointSource.h>


int main(int, char*[])
{
    vtkSmartPointer<vtkRenderer> ren1 =vtkSmartPointer<vtkRenderer>::New();
    vtkSmartPointer<vtkRenderWindow> renWin = vtkSmartPointer<vtkRenderWindow>::New();
    renWin->AddRenderer(ren1);

    vtkSmartPointer<vtkRenderWindowInteractor> iren = vtkSmartPointer<vtkRenderWindowInteractor>::New();
    iren->SetRenderWindow(renWin);

    std::string dataRoot = "E:\\vtkdata-5.4.2\\VTKData";
    /*std::string xyzFile = dataRoot + "/Data/" + "combxyz.bin";
    std::string qFile = dataRoot + "/Data/" + "combq.bin";
    vtkSmartPointer<vtkPLOT3DReader> pl3d = vtkSmartPointer<vtkPLOT3DReader>::New();
    pl3d->SetXYZFileName(xyzFile.c_str());
    pl3d->SetQFileName(qFile.c_str());
    pl3d->SetScalarFunctionNumber(100);
    pl3d->SetVectorFunctionNumber(202);
    pl3d->Update();*/

    std::string filename = dataRoot + "/Data/bore.vtk";
    vtkSmartPointer<vtkXMLUnstructuredGridReader> reader = vtkSmartPointer<vtkXMLUnstructuredGridReader>::New();
    reader->SetFileName(filename.c_str());
    reader->Update();

    vtkSmartPointer<vtkPlaneSource> seeds = vtkSmartPointer<vtkPlaneSource>::New();
    seeds->SetXResolution(4);
    seeds->SetYResolution(4);
    seeds->SetOrigin(2,-2,4);
    seeds->SetPoint1(2,2,6);
    seeds->SetPoint2(2,-2,8);

    vtkSmartPointer<vtkStreamLine> streamLine = vtkSmartPointer<vtkStreamLine>::New();
    streamLine->SetInputConnection(reader->GetOutputPort());
    streamLine->SetSource(seeds->GetOutput());

    streamLine->SetMaximumPropagationTime(200);
    streamLine->SetIntegrationStepLength(.2);
    streamLine->SetStepLength(.001);
    streamLine->SetNumberOfThreads(1);
    streamLine->SetIntegrationDirectionToForward();
    streamLine->VorticityOn();

    vtkSmartPointer<vtkPolyDataMapper> streamLineMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
    streamLineMapper->SetInputConnection(streamLine->GetOutputPort());
    //建立actor
    vtkSmartPointer<vtkActor> streamLineActor = vtkSmartPointer<vtkActor>::New();
    streamLineActor->SetMapper(streamLineMapper);
    streamLineActor->VisibilityOn();

    ren1->AddViewProp(streamLineActor);

    renWin->Render();

    iren->Start();

    return EXIT_SUCCESS;
}
the code above is my problem, do you know where is wrong place? please tell me. thank you in advance!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20101113/a339c5e3/attachment.htm>


More information about the vtkusers mailing list