File: View2DAttributes.code

package info (click to toggle)
paraview 4.1.0%2Bdfsg%2B1-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 278,136 kB
  • ctags: 340,527
  • sloc: cpp: 2,314,053; ansic: 817,139; python: 245,770; xml: 68,996; tcl: 48,285; fortran: 39,116; yacc: 5,713; java: 3,827; perl: 3,108; sh: 2,045; lex: 1,809; makefile: 935; asm: 471; pascal: 228
file content (131 lines) | stat: -rw-r--r-- 3,656 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
Target: xml2java
Constant: DEFAULT_FULL_FRAME_AUTO_THRESHOLD
Declaration: DEFAULT_FULL_FRAME_AUTO_THRESHOLD
Definition: 
    public final static double DEFAULT_FULL_FRAME_AUTO_THRESHOLD = 100.0;

Target: xml2atts
Constant: DEFAULT_FULL_FRAME_AUTO_THRESHOLD
Declaration: static const double DEFAULT_FULL_FRAME_AUTO_THRESHOLD;
Definition: const double View2DAttributes::DEFAULT_FULL_FRAME_AUTO_THRESHOLD = 100.0;


Function: GetUseFullFrame
Declaration: bool GetUseFullFrame(const double *limits=0) const;
Definition:
// ****************************************************************************
// Method: View2DAttributes::GetUseFullFrame
//
// Purpose: Together with the full frame activation mode and, optionally,
// limits, this method determines if full frame mode should be used.
//
// Programmer: Mark C. Miller
// Creation:   July 20, 2005
//
//  Modifications:
//    Shelly Prevost, Fri Mar 23 15:03:31 PDT 2007
//    Added code to check for DBL_MAX to avoid doing math that
//    exceeded maximums and cause a crash.
// ****************************************************************************

bool
View2DAttributes::GetUseFullFrame(const double *limits) const
{
    if (fullFrameActivationMode == Off)
        return false;

    if (fullFrameActivationMode == On)
        return true;

    if (limits == 0)
        return false;
        
    // if the limits are not initialized then doing math
    // with them will cause an error so check them first.
    if ( limits[1] == -DBL_MAX  && limits[0] == DBL_MAX ||
         limits[3] == -DBL_MAX  && limits[2] == DBL_MAX   )
    {
        return false;
    }
    
    double dlimit1 = limits[1] - limits[0];
    double dlimit2 = limits[3] - limits[2];
    double aspect;

    if (dlimit1 > dlimit2)
    {
        if (dlimit2 != 0)
            aspect = dlimit1 / dlimit2;
        else
            aspect = fullFrameAutoThreshold;
    }
    else
    {
        if (dlimit1 != 0)
            aspect = dlimit2 / dlimit1;
        else
            aspect = fullFrameAutoThreshold;
    }

    if (aspect >= fullFrameAutoThreshold)
        return true;
    else
        return false;
}

Function: SetUseFullFrame
Declaration: void SetUseFullFrame(bool ff);
Definition:
// ****************************************************************************
// Method: View2DAttributes::SetUseFullFrame
//
// Purpose: Sets full frame activation mode to On/Off if it is not currently
// in Auto mode. Otherwise, it does not change the mode.
//
// Programmer: Mark C. Miller
// Creation:   July 20, 2005
//
// ****************************************************************************

void
View2DAttributes::SetUseFullFrame(bool ff)
{
    if (fullFrameActivationMode == Auto)
        return;

    if (ff)
        fullFrameActivationMode = On;
    else
        fullFrameActivationMode = Off;
}

Function: ResetView
Declaration: void ResetView(const double *bbox);
Definition:
#include <math.h>
// ****************************************************************************
// Method: View2DAttributes::ResetView
//
// Purpose: 
//   Resets the view to something that can accommodate the bbox.
//
// Arguments:
//   bbox : The 2D extents that we're trying to look at.
//
// Programmer: Brad Whitlock
// Creation:   Tue Mar  3 16:21:14 PST 2009
//
// Modifications:
//   
// ****************************************************************************
void
View2DAttributes::ResetView(const double *bbox)
{
    const double vpc[] = {0.2, 0.95, 0.15, 0.95};
    View2DAttributes view2D;
    view2D.SetWindowCoords(bbox);
    view2D.SetViewportCoords(vpc);

    // Copy the object into this.
    *this = view2D;
}