~ubuntu-branches/ubuntu/trusty/ginkgocadx/trusty

« back to all changes in this revision

Viewing changes to src/cadxcore/VTKInria3D/wxVTK/wxVTKRenderWindowInteractor.cpp

  • Committer: Package Import Robot
  • Author(s): Dmitry Smirnov
  • Date: 2013-07-21 11:58:53 UTC
  • mfrom: (7.2.1 sid)
  • Revision ID: package-import@ubuntu.com-20130721115853-44e7n1xujqglu78e
Tags: 3.4.0.928.29+dfsg-1
* New upstream release [July 2013]
  + new B-D: "libjsoncpp-dev".
  + new patch "unbundle-libjsoncpp.patch" to avoid building bundled
    "libjsoncpp-dev".
  + new patch "fix-wx.patch" to avoid FTBFS due to missing
    "-lwx_gtk2u_html-2.8".
* Removed unnecessary versioned Build-Depends.
* Removed obsolete lintian override.
* Reference get-orig-source implementation for orig.tar clean-up and
  DFSG-repackaging.
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1398
1398
 
1399
1399
}
1400
1400
 
 
1401
void wxVTKRenderWindowInteractor::GetCamVectors(double camPos[4], double camDir[4], double camUp[4]) {
 
1402
        bool available = false;
 
1403
 
 
1404
        if (m_pPicker != NULL && m_pImageViewer != NULL) {
 
1405
                int x = Size[0] >> 1;
 
1406
                int y = Size[1] >> 1;
 
1407
                vtkRenderer* ren = FindPokedRenderer(x, y);
 
1408
 
 
1409
                if (ren != NULL) {
 
1410
                        vtkCamera* cam = ren->GetActiveCamera();
 
1411
                        cam->GetPosition(camPos);
 
1412
                        cam->GetDirectionOfProjection(camDir);
 
1413
                        cam->GetViewUp(camUp);
 
1414
                        camPos[3] = camDir[3] = camUp[3] = 1.0;
 
1415
                        available = true;
 
1416
                }
 
1417
        }
 
1418
        if (!available) {
 
1419
                for (int i = 0; i < 4; i++) {
 
1420
                        camPos[i] = camDir[i] = camUp[i] = std::numeric_limits<double>::quiet_NaN();
 
1421
                }
 
1422
        }
 
1423
}
 
1424
 
 
1425
void wxVTKRenderWindowInteractor::RayPick(double displayPos[2], double worldPos[4]) {
 
1426
 
 
1427
        bool error = true;
 
1428
 
 
1429
        if (m_pPicker != NULL && m_pImageViewer != NULL) {
 
1430
                int x = (int)(displayPos[0]);
 
1431
                int y = Size[1] - (int)(displayPos[1]) - 1;
 
1432
                vtkRenderer* ren = FindPokedRenderer(x, y);
 
1433
 
 
1434
                if (ren != NULL) {
 
1435
                        vtkCamera* cam = ren->GetActiveCamera();
 
1436
                        double pt[3]  = { x, y, 0.0f };
 
1437
                        double world[4] = {0.0f, 0.0f, 0.0f, 0.0f};
 
1438
                        m_pPicker->Pick(pt, ren);
 
1439
                        m_pPicker->GetPickPosition(world);
 
1440
 
 
1441
                        double cpos[3];
 
1442
                        double cdir[3];
 
1443
                        cam->GetPosition(cpos);
 
1444
                        cam->GetDirectionOfProjection(cdir);
 
1445
                        if (cam->GetParallelProjection()) {
 
1446
                                this->m_pImageViewer->IntersectarRayo(world, cdir, worldPos);
 
1447
                                worldPos[3] = 1.0;
 
1448
                                error = false;
 
1449
                        }
 
1450
                }
 
1451
        }
 
1452
        if (error) {
 
1453
                worldPos[0] = worldPos[1] = worldPos[2] = worldPos[3] = std::numeric_limits<double>::quiet_NaN();
 
1454
        }
 
1455
 
 
1456
}
 
1457
 
 
1458
void wxVTKRenderWindowInteractor::RayPick(double worldPos[4]) {
 
1459
 
 
1460
        bool error = true;
 
1461
 
 
1462
        if (m_pPicker != NULL && m_pImageViewer != NULL) {
 
1463
                int x = Size[0] >> 1;
 
1464
                int y = Size[1] >> 1;
 
1465
                vtkRenderer* ren = FindPokedRenderer(x, y);
 
1466
 
 
1467
                if (ren != NULL) {
 
1468
                        vtkCamera* cam = ren->GetActiveCamera();
 
1469
                        double cpos[3];
 
1470
                        double cdir[3];
 
1471
                        cam->GetPosition(cpos);
 
1472
                        cam->GetDirectionOfProjection(cdir);
 
1473
                        this->m_pImageViewer->IntersectarRayo(cpos, cdir, worldPos);
 
1474
                        worldPos[3] = 1.0;
 
1475
                        error = false;
 
1476
                }
 
1477
        }
 
1478
        if (error) {
 
1479
                worldPos[0] = worldPos[1] = worldPos[2] = worldPos[3] = std::numeric_limits<double>::quiet_NaN();
 
1480
        }
 
1481
 
 
1482
}
 
1483
 
1401
1484
//endregion
1402
1485
 
1403
1486
//----------------------------------------------------------------------------------------------------
1404
1487
//region "Helpers de contexto de dibujado"
1405
1488
 
 
1489
 
1406
1490
void wxVTKRenderWindowInteractor::TransformarEvento(wxMouseEvent &event)
1407
1491
{
1408
1492
        if (m_pPicker != NULL && m_pImageViewer != NULL) {