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


C++ VisWindow类代码示例

本文整理汇总了C++中VisWindow的典型用法代码示例。如果您正苦于以下问题:C++ VisWindow类的具体用法?C++ VisWindow怎么用?C++ VisWindow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: switch

void
VisWinFrame::GetRange(double &min_x, double &max_x, double &min_y, double &max_y)
{
    VisWindow *vw = mediator;

    switch (vw->GetWindowMode())
    {
      case WINMODE_2D:
        {
        const avtView2D view2D = vw->GetView2D();
        min_x = view2D.window[0];
        max_x = view2D.window[1];
        min_y = view2D.window[2];
        max_y = view2D.window[3];
        }
        break;
      case WINMODE_CURVE:
        {
            const avtViewCurve viewCurve = vw->GetViewCurve();
            min_x = viewCurve.domain[0];
            max_x = viewCurve.domain[1];
            min_y = viewCurve.range[0];
            max_y = viewCurve.range[1];
        }
        break;
      default:
        break;
    }
}
开发者ID:HarinarayanKrishnan,项目名称:VisIt26RC_Trunk,代码行数:29,代码来源:VisWinFrame.C

示例2: switch

void
FlyThrough::OnTimer(void)
{
    vtkRenderWindowInteractor *rwi = Interactor;

    int Pos[2];
    rwi->GetEventPosition(Pos);

    bool matchedUpState = true;
    switch (State)
    {
      case VTKIS_ROTATE:
        RotateAboutCamera3D(Pos[0], Pos[1]);

        rwi->CreateTimer(VTKI_TIMER_UPDATE);
        break;

      case VTKIS_PAN:
        PanCamera3D(Pos[0], Pos[1]);

        rwi->CreateTimer(VTKI_TIMER_UPDATE);
        break;

      case VTKIS_ZOOM:
        DollyCameraAndFocus3D(Pos[0], Pos[1]);

        rwi->CreateTimer(VTKI_TIMER_UPDATE);
        break;

      default:
        matchedUpState = false;
        break;
    }

    if (!matchedUpState && shouldSpin)
    {
        VisWindow *vw = proxy;
        if(!vw->GetSpinModeSuspended())
        {
            if (vw->GetSpinMode())
            {
                OldX = spinOldX;
                OldY = spinOldY;
                RotateAboutCamera3D(spinNewX, spinNewY);
                rwi->CreateTimer(VTKI_TIMER_UPDATE);
            }
            else
            {
                DisableSpinMode();
            }
        }
        else if(vw->GetSpinMode())
        {
            // Don't mess with the camera, just create another timer so
            // we keep getting into this method until spin mode is no
            // longer suspended.
            rwi->CreateTimer(VTKI_TIMER_UPDATE);
        }
    }
}
开发者ID:burlen,项目名称:visit_vtk_7_src,代码行数:60,代码来源:FlyThrough.C

示例3: pow

void
Zoom3D::ZoomCamera(const int x, const int y)
{
    if (OldY != y)
    {
        //
        // Calculate the zoom factor.
        //
        double dyf = MotionFactor * (double)(y - OldY) /
                         (double)(Center[1]);
        double zoomFactor = pow((double)1.1, dyf);

        //
        // Calculate the new parallel scale.
        //
        VisWindow *vw = proxy;

        avtView3D newView3D = vw->GetView3D();

        newView3D.imageZoom = newView3D.imageZoom * zoomFactor;

        OldX = x;
        OldY = y;

        vw->SetView3D(newView3D);
    }
}
开发者ID:burlen,项目名称:visit_vtk_7_src,代码行数:27,代码来源:Zoom3D.C

示例4: VisitInteractor

NavigateAxisArray::NavigateAxisArray(VisWindowInteractorProxy &v) : VisitInteractor(v)
{
    shiftKeyDown = controlKeyDown = false;
    VisWindow *win = v;
    shouldSnap = win->GetInteractorAtts()->GetAxisArraySnap();
    axisOrientation = Vertical;
}
开发者ID:HarinarayanKrishnan,项目名称:VisIt26RC_Trunk,代码行数:7,代码来源:NavigateAxisArray.C

示例5: switch

void
NavigateAxisArray::OnTimer(void)
{
    vtkRenderWindowInteractor *rwi = Interactor;

    int Pos[2];
    rwi->GetEventPosition(Pos);

    VisWindow *win = proxy;
    shouldSnap = win->GetInteractorAtts()->GetAxisArraySnap();

    switch (State)
    {
      case VTKIS_PAN:
        PanCamera(Pos[0], Pos[1], shouldSnap);

        rwi->CreateTimer(VTKI_TIMER_UPDATE);
        break;

      case VTKIS_DOLLY:
        ZoomCamera(Pos[0], Pos[1]);

        rwi->CreateTimer(VTKI_TIMER_UPDATE);
        break;

      default:
        break;
    }
}
开发者ID:HarinarayanKrishnan,项目名称:VisIt26RC_Trunk,代码行数:29,代码来源:NavigateAxisArray.C

示例6: second_pass

// ****************************************************************************
//  Method: RenderTranslucent
//
//  Purpose: Renders translucent geometry within a VisWindow.
//           Expects that opaque geometry has already been rendered.  In the
//           IceT case, our work is a lot simpler because we don't need to
//           read the image back from the framebuffer (we'll read it back from
//           IceT later anyway).
//
//  Programmer: Tom Fogal
//  Creation:   August 4, 2008
//
//  Modifications:
//
// ****************************************************************************
avtDataObject_p
IceTNetworkManager::RenderTranslucent(int windowID, const avtImage_p& input)
{
    VisWindow *viswin = viswinMap.find(windowID)->second.viswin;
    CallProgressCallback("IceTNetworkManager", "Transparent rendering", 0, 1);
    {
        StackTimer second_pass("Second-pass screen capture for SR");

        //
        // We have to disable any gradient background before
        // rendering, as those will overwrite the first pass
        //
        AnnotationAttributes::BackgroundMode bm = viswin->GetBackgroundMode();
        viswin->SetBackgroundMode(AnnotationAttributes::Solid);

        viswin->ScreenRender(
            this->r_mgmt.viewportedMode,
            true,   // Z buffer
            false,  // opaque geometry
            true,   // translucent geometry
            input   // image to composite with
        );

        // Restore the background mode for next time
        viswin->SetBackgroundMode(bm);
    }
    CallProgressCallback("IceTNetworkManager", "Transparent rendering", 1, 1);

    //
    // In this implementation, the user should never use the return value --
    // read it back from IceT instead!
    //
    return NULL;
}
开发者ID:cchriste,项目名称:visit,代码行数:49,代码来源:IceTNetworkManager.C

示例7:

void
VisWinInteractions::SetBoundingBoxMode(int val)
{
    bboxMode = val;
    bool doingBBox = false;
    if (val == InteractorAttributes::Always)
        doingBBox = true;
    VisWindow *vw = mediator;
    bool doingSR = vw->GetScalableRendering();
    if (val == InteractorAttributes::Auto && doingSR)
        doingBBox = true;
    if (doingBBox)
    {
        // The continuous tool update mode does not
        // work when bounding box mode is on.
        if (toolUpdateMode == UPDATE_CONTINUOUS)
            toolUpdateMode = UPDATE_ONRELEASE;
    }
    else
    {
        // The continuous tool update mode does 
        // work when bounding box mode is off.
        if (toolUpdateMode == UPDATE_ONRELEASE)
            toolUpdateMode = UPDATE_CONTINUOUS;
    }
}
开发者ID:HarinarayanKrishnan,项目名称:VisIt28RC_Trunk,代码行数:26,代码来源:VisWinInteractions.C

示例8: pow

void
NavigateAxisArray::ZoomHorizontal(double f)
{
    vtkRenderWindowInteractor *rwi = Interactor;

    //
    // Calculate the zoom factor.
    //
    double zoomFactor = pow((double)1.1, f);

    //
    // Calculate the new parallel scale.
    //
    VisWindow *vw = proxy;

    avtViewAxisArray newViewAxisArray = vw->GetViewAxisArray();

    double xDist = newViewAxisArray.domain[1] - newViewAxisArray.domain[0];
    double dX = ((1. / zoomFactor) - 1.) * (xDist / 2.);

    newViewAxisArray.domain[0] -= dX;
    newViewAxisArray.domain[1] += dX;

    vw->SetViewAxisArray(newViewAxisArray);
}
开发者ID:HarinarayanKrishnan,项目名称:VisIt26RC_Trunk,代码行数:25,代码来源:NavigateAxisArray.C

示例9: RenderGeometry

// ****************************************************************************
//  Method: RenderGeometry
//
//  Purpose: Renders the geometry for a scene; this is always the opaque
//           objects, and may or may not include translucent objects (depending
//           on the current multipass rendering settings).
//           We override this method because we can avoid a readback in the
//           one-pass case (we'll read it back from IceT later anyway).
//
//  Programmer: Tom Fogal
//  Creation:   July 26, 2008
//
//  Modifications:
//
//    Tom Fogal, Mon Jul 28 14:57:01 EDT 2008
//    Need to return NULL in the single-pass case!
//
// ****************************************************************************
avtImage_p
IceTNetworkManager::RenderGeometry()
{
    VisWindow *viswin = viswinMap.find(this->r_mgmt.windowID)->second.viswin;
    if(this->MemoMultipass(viswin))
    {
        return NetworkManager::RenderGeometry();
    }
    CallProgressCallback("IceTNetworkManager", "Render geometry", 0, 1);
        viswin->ScreenRender(this->r_mgmt.viewportedMode, true);
    CallProgressCallback("IceTNetworkManager", "Render geometry", 0, 1);
    return NULL;
}
开发者ID:cchriste,项目名称:visit,代码行数:31,代码来源:IceTNetworkManager.C

示例10: SetCanvasViewport

void
ZoomInteractor::StartRubberBand(int x, int y)
{
    rubberBandMode = true;

    shiftKeyDown = Interactor->GetShiftKey();
    controlKeyDown = Interactor->GetControlKey();

    VisWindow *win = proxy;
    shouldClampSquare = win->GetInteractorAtts()->GetClampSquare();
    shouldDrawGuides = win->GetInteractorAtts()->GetShowGuidelines();

    // Set the actor's color.
    double fg[3];
    proxy.GetForegroundColor(fg);
    rubberBandActor->GetProperty()->SetColor(fg[0], fg[1], fg[2]);

    //
    // Add the rubber band actors to the background.  We do this since the
    // background is in the same display coordinates that the rubber band will
    // be.  From an appearance standpoint it should be in the canvas, which
    // the routine ForceCoordsToViewport ensures.
    //
    vtkRenderer *ren = proxy.GetBackground();
    ren->AddActor2D(rubberBandActor);

    //
    // The anchor of the rubber band will be where the button press was.
    //
    anchorX = x;
    anchorY = y;

    //
    // Determine what to clamp the rubber band to.
    //
    SetCanvasViewport();

    //
    // If the user has clicked outside the viewport, force the back inside.
    //
    ForceCoordsToViewport(anchorX, anchorY);

    //
    // Must update bookkeeping so that OnMouseMove works correctly.
    //
    lastX   = anchorX;
    lastY   = anchorY;

    rubberBandDrawn = false;
}
开发者ID:HarinarayanKrishnan,项目名称:VisIt26RC_Trunk,代码行数:50,代码来源:ZoomInteractor.C

示例11: SNPRINTF

// ****************************************************************************
//  Method: StopTimer
//
//  Purpose: Time the IceT rendering process.
//           IceT includes its own timing code that we might consider using at
//           some point ...
//
//  Programmer: Tom Fogal
//  Creation:   July 14, 2008
//
//  Modifications:
//
//    Hank Childs, Thu Jan 15 11:07:53 CST 2009
//    Changed GetSize call to GetCaptureRegion, since that works for 2D.
//
//    Tom Fogal, Fri May 29 20:37:59 MDT 2009
//    Remove an unused variable.
//
//    Burlen Loring, Tue Sep  1 14:26:30 PDT 2015
//    sync up with network manager(base class) order compositing refactor
//
// ****************************************************************************
void
IceTNetworkManager::StopTimer()
{
    char msg[1024];
    VisWindow *viswin = renderState.window;
    int rows,cols, width_start, height_start;
    // This basically gets the width and the height.
    // The distinction is for 2D rendering, where we only want the
    // width and the height of the viewport.
    viswin->GetCaptureRegion(width_start, height_start, rows,cols,
                             renderState.viewportedMode);

    SNPRINTF(msg, 1023, "IceTNM::Render %lld cells %d pixels",
             renderState.cellCountTotal, rows*cols);
    visitTimer->StopTimer(renderState.timer, msg);
    renderState.timer = -1;
}
开发者ID:burlen,项目名称:visit_vtk_7_src,代码行数:39,代码来源:IceTNetworkManager.C

示例12: SNPRINTF

// ****************************************************************************
//  Method: StopTimer
//
//  Purpose: Time the IceT rendering process.
//           IceT includes its own timing code that we might consider using at
//           some point ...
//
//  Programmer: Tom Fogal
//  Creation:   July 14, 2008
//
//  Modifications:
//
//    Hank Childs, Thu Jan 15 11:07:53 CST 2009
//    Changed GetSize call to GetCaptureRegion, since that works for 2D.
//
//    Tom Fogal, Fri May 29 20:37:59 MDT 2009
//    Remove an unused variable.
//
// ****************************************************************************
void
IceTNetworkManager::StopTimer(int windowID)
{
    char msg[1024];
    VisWindow *viswin = this->viswinMap.find(windowID)->second.viswin;
    int rows,cols, width_start, height_start;
    // This basically gets the width and the height.
    // The distinction is for 2D rendering, where we only want the
    // width and the height of the viewport.
    viswin->GetCaptureRegion(width_start, height_start, rows,cols,
                             this->r_mgmt.viewportedMode);

    SNPRINTF(msg, 1023, "IceTNM::Render %ld cells %d pixels",
             GetTotalGlobalCellCounts(windowID), rows*cols);
    visitTimer->StopTimer(this->r_mgmt.timer, msg);
    this->r_mgmt.timer = -1;
}
开发者ID:cchriste,项目名称:visit,代码行数:36,代码来源:IceTNetworkManager.C

示例13: GetRange

void
VisWinFrame::UpdateView(void)
{
    double  min_x = 0., max_x = 0., min_y = 0., max_y = 0.;
    GetRange(min_x, max_x, min_y, max_y);

    //
    // We put the topBorder in reverse so that its ticks would appear on the
    // correct side of the viewport.  Must propogate kludge by sending
    // range in backwards.
    //
    leftBorder->SetRange(max_y, min_y);
    leftBorder->SetUseOrientationAngle(1);
    leftBorder->SetOrientationAngle(-1.5707963);

    rightBorder->SetRange(min_y, max_y);
    rightBorder->SetUseOrientationAngle(1);
    rightBorder->SetOrientationAngle(1.5707963);

    bottomBorder->SetRange(min_x, max_x);
    bottomBorder->SetUseOrientationAngle(1);
    bottomBorder->SetOrientationAngle(0.);

    topBorder->SetRange(max_x, min_x);
    topBorder->SetUseOrientationAngle(1);
    topBorder->SetOrientationAngle(3.1415926);

    VisWindow *vw = mediator;
    bool logScale[2] = { false, false};
    if (vw->GetWindowMode() == WINMODE_CURVE)
    {
        const avtViewCurve viewCurve = vw->GetViewCurve();
        logScale[0] = viewCurve.domainScale == LOG;
        logScale[1] = viewCurve.rangeScale == LOG;
    }
    else if (vw->GetWindowMode() == WINMODE_2D)
    {
        const avtView2D view2D = vw->GetView2D();
        logScale[0] = view2D.xScale == LOG;
        logScale[1] = view2D.yScale == LOG;
    }
    topBorder->SetLogScale((int)logScale[0]);
    bottomBorder->SetLogScale((int)logScale[0]);
    rightBorder->SetLogScale((int)logScale[1]);
    leftBorder->SetLogScale((int)logScale[1]);
}
开发者ID:HarinarayanKrishnan,项目名称:VisIt26RC_Trunk,代码行数:46,代码来源:VisWinFrame.C

示例14: VisitInteractor

ZoomInteractor::ZoomInteractor(VisWindowInteractorProxy &vw) 
    : VisitInteractor(vw)
{
    rubberBandMode  = false;
    shiftKeyDown = controlKeyDown = false;

    VisWindow *win = vw;
    shouldClampSquare = win->GetInteractorAtts()->GetClampSquare();
    shouldDrawGuides = win->GetInteractorAtts()->GetShowGuidelines();

    //
    // Create the poly data that will map the rubber band onto the screen.
    //
    rubberBand       = vtkPolyData::New();

    vtkPoints *pts = vtkPoints::New();
#if defined(__APPLE__) || defined(_WIN32)
    pts->SetNumberOfPoints(4);
    rubberBand->SetPoints(pts);
    pts->Delete();

    vtkCellArray *lines  = vtkCellArray::New();
    vtkIdType  ids[] = { 0, 1, 2, 3, 0};
    lines->InsertNextCell(5, ids);
    rubberBand->SetLines(lines);
    lines->Delete();
#else
    pts->SetNumberOfPoints(2);
    rubberBand->SetPoints(pts);
    pts->Delete();

    vtkCellArray *lines  = vtkCellArray::New();
    vtkIdType  ids[2] = { 0, 1 };
    lines->InsertNextCell(2, ids);
    rubberBand->SetLines(lines);
    lines->Delete();
#endif

    rubberBandMapper = proxy.CreateRubberbandMapper();
    rubberBandMapper->SetInput(rubberBand);

    rubberBandActor  = vtkActor2D::New();
    rubberBandActor->SetMapper(rubberBandMapper);
    rubberBandActor->GetProperty()->SetColor(0., 0., 0.);
}
开发者ID:HarinarayanKrishnan,项目名称:VisIt26RC_Trunk,代码行数:45,代码来源:ZoomInteractor.C

示例15:

void
Navigate2D::PanCamera(const int x, const int y)
{
    vtkRenderWindowInteractor *rwi = Interactor;

    if ((OldX != x) || (OldY != y))
    {
        //
        // Determine the size of the window.
        //
        int       size[2];

        rwi->GetSize(size);

        //
        // Get the current view information.
        //
        VisWindow *vw = proxy;

        double    viewport[4];
        double    pan[2];

        avtView2D newView2D = vw->GetView2D();

        newView2D.GetActualViewport(viewport, size[0], size[1]);
        
        pan[0] = (double)(x - OldX) /
                 ((viewport[1] - viewport[0]) * (double)(size[0])) *
                 (newView2D.window[1] - newView2D.window[0]);
        pan[1] = (double)(y - OldY) /
                 ((viewport[3] - viewport[2]) * (double)(size[1])) *
                 (newView2D.window[3] - newView2D.window[2]);

        newView2D.window[0] -= pan[0];
        newView2D.window[1] -= pan[0];
        newView2D.window[2] -= pan[1];
        newView2D.window[3] -= pan[1];

        OldX = x;
        OldY = y;

        vw->SetView2D(newView2D);
    }
}
开发者ID:HarinarayanKrishnan,项目名称:VisIt28RC_Trunk,代码行数:44,代码来源:Navigate2D.C


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