当前位置: 首页>>代码示例>>C++>>正文


C++ GeoPoint::getPoint方法代码示例

本文整理汇总了C++中GeoPoint::getPoint方法的典型用法代码示例。如果您正苦于以下问题:C++ GeoPoint::getPoint方法的具体用法?C++ GeoPoint::getPoint怎么用?C++ GeoPoint::getPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GeoPoint的用法示例。


在下文中一共展示了GeoPoint::getPoint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: VisualisePath

void PathVisualiser::VisualisePath(int* path, int len) {

    int totColours = 256 * 3;
    int thisColour;
    renderer->SetBackground(1, 1, 1);
    for (int i = 0; i < len; i++) {
        int viewIndex = path[i];
        GeoPoint* view = oc->geoSphere->getView(oc->path[i]);
        float* pos = view->getPoint();

        vtkSmartPointer<vtkSphereSource> aViewSphereS = vtkSmartPointer<vtkSphereSource>::New();

        aViewSphereS->SetCenter(pos[0], pos[1], pos[2]);
        aViewSphereS->SetRadius(sphereRadius);
        aViewSphereS->SetPhiResolution(20);
        aViewSphereS->SetThetaResolution(20);
        thisColour = (totColours / len) * i;

        float b = 0;
        float g = 0;
        float r = 0;
        float ifl = (float) i;
        float len3rd = (float) (len / 3);
        if (ifl < len3rd) {
            b = ifl / len3rd;
        }
        if (ifl >= len3rd && ifl < (2 * len3rd)) {
            g = (ifl - len3rd) / len3rd;
        }
        if (ifl > (2 * len3rd)) {
            r = (ifl - (2 * len3rd)) / len3rd;
        }


        //
        ////        if(b>1){
        ////            g=--b;
        ////        }
        ////        if(b>1){
        ////            r=--b;
        ////            g--;
        ////        }

        cout << " for view " << i << " view " << viewIndex << " pos " << pos[0] << " " << pos[1] << " " << pos[2] << " colours " << r << " " << g << " " << b << endl;
        aViewSphereS->Update();
        vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
        mapper->SetInputConnection(aViewSphereS->GetOutputPort());
        vtkSmartPointer<vtkActor> aViewSphereActor = vtkSmartPointer<vtkActor>::New();
        aViewSphereActor->SetMapper(mapper);
        aViewSphereActor->GetProperty()->SetAmbient(1); //SetShading(0);
        aViewSphereActor->GetProperty()->SetDiffuse(0.5); //SetShading(0);
        aViewSphereActor->GetProperty()->SetSpecular(0.5); //SetShading(0);
        //aViewSphereActor->GetProperty()->SetInterpolationToFlat(); //aViewSphereActor->GetProperty()->SetOpacity(0.5);
        aViewSphereActor->GetProperty()->SetColor(r, g, b);
        renderer->AddActor(aViewSphereActor);
        //cout<<"adding actor at "<<pos[0]<<" "<<pos[1]<<" "<<pos[2]<<endl;
    }

    // Create a sphere
    //  vtkSmartPointer<vtkSphereSource> sphereSource =
    //    vtkSmartPointer<vtkSphereSource>::New();
    //  sphereSource->SetCenter(0.0, 0.0, 0.0);
    //  sphereSource->SetRadius(2.0);
    //
    //  vtkSmartPointer<vtkPolyDataMapper> mapper =
    //    vtkSmartPointer<vtkPolyDataMapper>::New();
    //  mapper->SetInputConnection(sphereSource->GetOutputPort());
    //
    //  vtkSmartPointer<vtkActor> actor =
    //    vtkSmartPointer<vtkActor>::New();
    //  actor->SetMapper(mapper);
    // renderer->AddActor(actor);

    vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =
            vtkSmartPointer<vtkRenderWindowInteractor>::New();
    renderWindowInteractor->SetRenderWindow(renderWindow);

    renderWindow->Render();
    renderWindowInteractor->Start();
    vtkSmartPointer<vtkWindowToImageFilter> windowToImageFilter = vtkSmartPointer<vtkWindowToImageFilter>::New();
    windowToImageFilter->SetInput(renderWindow);
    vtkSmartPointer<vtkPNGWriter> writer = vtkSmartPointer<vtkPNGWriter>::New();
    writer->SetInput(windowToImageFilter->GetOutput());
    string filename = "pathVis.png";
    windowToImageFilter->Update();
    filename = *(oc->resultsPath) + filename;
    cout << "OUTPUTTING to " << filename << endl;
    writer->SetFileName(filename.c_str());
    writer->Write();


}
开发者ID:eeue56,项目名称:ovas-2,代码行数:92,代码来源:PathVisualiser.cpp


注:本文中的GeoPoint::getPoint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。