~ubuntu-branches/ubuntu/precise/grass/precise

« back to all changes in this revision

Viewing changes to gui/wxpython/nviz/change_view.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Francesco Paolo Lovergine
  • Date: 2011-04-13 17:08:41 UTC
  • mfrom: (8.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20110413170841-ss1t9bic0d0uq0gz
Tags: 6.4.1-1
* New upstream version.
* Now build-dep on libjpeg-dev and current libreadline6-dev.
* Removed patch swig: obsolete.
* Policy bumped to 3.9.2, without changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**
2
 
   \file nviz/change_view.cpp
3
 
   
4
 
   \brief wxNviz extension (3D view mode) - change view settings
5
 
   
6
 
   This program is free software under the GNU General Public
7
 
   License (>=v2). Read the file COPYING that comes with GRASS
8
 
   for details.
9
 
 
10
 
   (C) 2008-2009 by Martin Landa, and the GRASS development team
11
 
 
12
 
   \author Martin Landa <landa.martin gmail.com> (Google SoC 2008)
13
 
*/
14
 
 
15
 
#include "nviz.h"
16
 
 
17
 
/*!
18
 
  \brief GL canvas resized
19
 
 
20
 
  \param width window width
21
 
  \param height window height
22
 
 
23
 
  \return 1 on success
24
 
  \return 0 on failure (window resized by dafault to 20x20 px)
25
 
 */
26
 
int Nviz::ResizeWindow(int width, int height)
27
 
{
28
 
    int ret;
29
 
 
30
 
    ret = Nviz_resize_window(width, height);
31
 
 
32
 
    G_debug(1, "Nviz::ResizeWindow(): width=%d height=%d",
33
 
            width, height);
34
 
 
35
 
    return ret;
36
 
}
37
 
 
38
 
/*!
39
 
  \brief Set default view (based on loaded data)
40
 
 
41
 
  \return z-exag value, default, min and max height
42
 
*/
43
 
std::vector<double> Nviz::SetViewDefault()
44
 
{
45
 
    std::vector<double> ret;
46
 
 
47
 
    float hdef, hmin, hmax, z_exag;
48
 
 
49
 
    /* determine z-exag */
50
 
    z_exag = Nviz_get_exag();
51
 
    ret.push_back(z_exag);
52
 
    Nviz_change_exag(data,
53
 
                     z_exag);
54
 
 
55
 
    /* determine height */
56
 
    Nviz_get_exag_height(&hdef, &hmin, &hmax);
57
 
    ret.push_back(hdef);
58
 
    ret.push_back(hmin);
59
 
    ret.push_back(hmax);
60
 
 
61
 
    G_debug(1, "Nviz::SetViewDefault(): hdef=%f, hmin=%f, hmax=%f",
62
 
            hdef, hmin, hmax);
63
 
 
64
 
    return ret;
65
 
}
66
 
 
67
 
/*!
68
 
  \brief Change view settings
69
 
 
70
 
  \param x,y position
71
 
  \param height
72
 
  \param persp perpective
73
 
  \param twist
74
 
 
75
 
  \return 1 on success
76
 
*/
77
 
int Nviz::SetView(float x, float y,
78
 
                  float height, float persp, float twist)
79
 
{
80
 
    Nviz_set_viewpoint_height(data,
81
 
                              height);
82
 
    Nviz_set_viewpoint_position(data,
83
 
                                x, y);
84
 
    Nviz_set_viewpoint_twist(data,
85
 
                             twist);
86
 
    Nviz_set_viewpoint_persp(data,
87
 
                             persp);
88
 
 
89
 
    G_debug(1, "Nviz::SetView(): x=%f, y=%f, height=%f, persp=%f, twist=%f",
90
 
            x, y, height, persp, twist);
91
 
        
92
 
    return 1;
93
 
}
94
 
 
95
 
/*!
96
 
  \brief Set z-exag value
97
 
 
98
 
  \param z_exag value
99
 
 
100
 
  \return 1
101
 
*/
102
 
int Nviz::SetZExag(float z_exag)
103
 
{
104
 
    int ret;
105
 
    
106
 
    ret = Nviz_change_exag(data, z_exag);
107
 
 
108
 
    G_debug(1, "Nviz::SetZExag(): z_exag=%f", z_exag);
109
 
 
110
 
    return ret;
111
 
}