File: AnnotationObjectList.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 (372 lines) | stat: -rw-r--r-- 13,561 bytes parent folder | download | duplicates (4)
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
Function: ProcessOldVersions
Declaration: virtual void ProcessOldVersions(DataNode *parentNode, const char *configVersion);
Definition:
// ****************************************************************************
// Method: AnnotationObjectList::ProcessOldVersions
//
// Purpose: 
//   This method maps old AnnotationAttributes fields to the 1.9.0 version of
//   the data node tree for AnnotationAttributes.
//
// Programmer: Kathleen Bonnell
// Creation:   Thu Sep 17 10:06:49 PDT 2009
//
// Modifications:
//
// ****************************************************************************

void
AnnotationObjectList::ProcessOldVersions(DataNode *parentNode,
    const char *configVersion)
{
    if (parentNode == 0)
        return;

    DataNode *searchNode = parentNode->GetNode("AnnotationObjectList");
    if (searchNode == 0)
        return;

    int nChildren = searchNode->GetNumChildren();
    DataNode **children = searchNode->GetChildren();

    for (int i = 0; i < nChildren; ++i)
    {
        AnnotationObject annot;
        annot.ProcessOldVersions(children[i], configVersion);
    }
}

Function: RemoveAnnotation2
Declaration: bool RemoveAnnotation(const std::string &);
Definition:
// ****************************************************************************
//  Method: AnnotationObjectList::RemoveAnnotation
//
//  Purpose: Removes the named annotation.
//
//  Programmer: Brad Whitlock
//  Creation:   Tue Mar 20 09:24:05 PDT 2007
//
//  Modifications:
//
// ****************************************************************************

bool
AnnotationObjectList::RemoveAnnotation(const std::string &name)
{
    int index = IndexForName(name);
    if(index != -1)
    {
        RemoveAnnotation(index);
        return true;
    }

    return false;
}

Function: GetNewObjectName
Declaration: std::string GetNewObjectName() const;
Definition:
// ****************************************************************************
//  Method: AnnotationObjectList::GetNewObjectName
//
//  Purpose: Returns a new name for the annotation.
//
//  Programmer: Brad Whitlock
//  Creation:   Tue Mar 20 09:24:05 PDT 2007
//
//  Modifications:
//
// ****************************************************************************

std::string
AnnotationObjectList::GetNewObjectName() const
{
    int index = 0;
    std::string name;
    bool found;
    char tmp[200];
    do
    {
        SNPRINTF(tmp, 200, "NewObject%d", index++);
        name = tmp;
        found = IndexForName(name) != -1;
    } while(found);

    return name;
}

Function: IndexForName
Declaration: int IndexForName(const std::string &name) const;
Definition:
// ****************************************************************************
//  Method: AnnotationObjectList::IndexForName
//
//  Purpose: Returns the index for the named annotation.
//
//  Programmer: Brad Whitlock
//  Creation:   Tue Mar 20 09:24:05 PDT 2007
//
//  Modifications:
//
// ****************************************************************************

int
AnnotationObjectList::IndexForName(const std::string &name) const
{
    int index = -1;
    for(int i = 0; i < GetNumAnnotations(); ++i)
    {
        if(GetAnnotation(i).GetObjectName() == name)
            return i;
    }

    return -1;
}

Target: xml2java
Function: GetAnnotation2
Declaration: GetAnnotation2
Definition:
    /**
     * Returned the annotation object with the specified name
     *
     * @param name Name of the annotation object we want to return.
     * @return The named annotationn object or null.
     */
    public AnnotationObject GetAnnotation(String name)
    {
        for(int i = 0; i < annotation.size(); ++i)
        {
            AnnotationObject a = (AnnotationObject)annotation.elementAt(i);
            if(a.GetObjectName().equals(name))
                return a;
        }
        return null;
    }

Function: SetTimeSliderOptions
Declaration: SetTimeSliderOptions
Definition:
    /**
     * Sets the options for the named time slider annotation object.
     *
     * @param annotName Name of the time slider annotation that we want to modify.
     * @param x X location of the lower left corner in the visualization window [0.,1.]
     * @param y Y location of the lower left corner in the visualization window [0.,1.]
     * @param width Width of the annotation [0.,1.]
     * @param height Height of the annotation [0.,1.]
     * @param label Label to be used in the time slider
     * @param timeFormat C-style format string for the time number, such as "%1.3f"
     * @param startColor Color used for the left progress part of the time slider.
     * @param endColor Color used for the right part of the time slider progress.
     * @param textColor Color used for the text if we're not using the fg color.
     * @param useForegroundColor True to use the foreground color as the text color
     * @param timeDisplay 0=All frames, 1=Frames for plot, 2=States for plot
     * @param visible Whether the annotation is visible.
     * @param rounded Whether the ends of the progress bar are rounded
     * @param shaded Whether the progress bar is shaded 
     */
    public void SetTimeSliderOptions(String annotName, 
        double x, double y, double width, double height,
        String label, String timeFormat, 
        ColorAttribute startColor, ColorAttribute endColor, 
        ColorAttribute textColor, boolean useForegroundColor, 
        int timeDisplay,
        boolean visible, boolean rounded, boolean shaded)
    {
        AnnotationObject annot = GetAnnotation(annotName);
        if(annot != null)
        {
            annot.SetPosition(x, y, 0.);
            annot.SetPosition2(width, height, 0.);
            Vector sArgs = new Vector();
            sArgs.addElement(new String(label));
            sArgs.addElement(new String(timeFormat));
            annot.SetText(sArgs);
            annot.SetColor1(startColor);
            annot.SetColor2(endColor);
            annot.SetTextColor(textColor);
            annot.SetUseForegroundForTextColor(useForegroundColor);
            annot.SetVisible(visible);
            int flags = (timeDisplay << 2) | (shaded ? 2 : 0) | (rounded ? 1 : 0);
            annot.SetIntAttribute1(flags);
        }
    }

Function: SetText2DOptions
Declaration: SetText2DOptions
Definition:
    /**
     * Sets the options for the named 2D text annotation object.
     *
     * @param annotName Name of the text annotation that we want to modify.
     * @param x X location of the lower left corner in the visualization window [0.,1.]
     * @param y Y location of the lower left corner in the visualization window [0.,1.]
     * @param width Width of the annotation [0.,1.]
     * @param text Text to be displayed
     * @param textColor Color used for the text if we're not using the fg color.
     * @param useForegroundColor True to use the foreground color as the text color
     * @param fontFamily 0=Arial, 1=Courier, 2=Times
     * @param bold Whether the font is bold
     * @param italic Whether the font is italic
     * @param shadow Whether the font has a shadow.
     * @param visible Whether the annotation is visible.
     */
    public void SetText2DOptions(String annotName, 
        double x, double y, double width,
        String text, 
        ColorAttribute textColor, boolean useForegroundColor, 
        int fontFamily, boolean bold, boolean italic, boolean shadow,
        boolean visible)
    {
        AnnotationObject annot = GetAnnotation(annotName);
        if(annot != null)
        {
            annot.SetPosition(x, y, 0.);
            annot.SetPosition2(width, annot.GetPosition2()[1], annot.GetPosition2()[2]);
            Vector sArgs = new Vector();
            sArgs.addElement(new String(text));
            annot.SetText(sArgs);
            annot.SetTextColor(textColor);
            annot.SetUseForegroundForTextColor(useForegroundColor);
            annot.SetFontFamily(fontFamily);
            annot.SetFontBold(bold);
            annot.SetFontItalic(italic);
            annot.SetFontShadow(shadow);
            annot.SetVisible(visible);
        }
    }

Function: SetText3DOptions
Declaration: SetText3DOptions
Definition:
    /**
     * Sets the options for the named 3D text annotation object.
     *
     * @param annotName Name of the text annotation that we want to modify.
     * @param x X location of the text
     * @param y Y location of the text
     * @param z Z location of the text
     * @param text Text to be displayed
     * @param heightMode 0=relative, 1=fixed
     * @param fixedHeight Height to use when heightMode==0
     * @param relativeHeight Height to use when heightMode==1. Percent of original height [1,100]
     * @param facesCamera Whether the text should face the camera.
     * @param rotX X rotation in degrees.
     * @param rotY Y rotation in degrees.
     * @param rotZ Z rotation in degrees.
     * @param textColor Color used for the text if we're not using the fg color.
     * @param useForegroundColor True to use the foreground color as the text color
     * @param visible Whether the annotation is visible.
     */
    public void SetText3DOptions(String annotName, 
        double x, double y, double z,
        String text,
        boolean heightMode, double fixedHeight, int relativeHeight,
        boolean facesCamera,
        double rotX, double rotY, double rotZ,
        ColorAttribute textColor, boolean useForegroundColor, 
        boolean visible)
    {
        AnnotationObject annot = GetAnnotation(annotName);
        if(annot != null)
        {
            annot.SetPosition(x, y, z);
            annot.SetPosition2(rotX, rotY, rotZ);
            Vector sArgs = new Vector();
            sArgs.addElement(new String(text));
            annot.SetText(sArgs);
            annot.SetTextColor(textColor);
            annot.SetUseForegroundForTextColor(useForegroundColor);
            annot.SetIntAttribute1(relativeHeight);
            annot.SetDoubleAttribute1(fixedHeight);
            annot.SetFontItalic(heightMode);
            annot.SetFontBold(facesCamera);
            annot.SetVisible(visible);
        }
    }

Function: SetLine2DOptions
Declaration: SetLine2DOptions
Definition:
    /**
     * Sets the options for the named 2D line annotation object.
     *
     * @param annotName Name of the text annotation that we want to modify.
     * @param x0 X location of the start point in the visualization window [0.,1.]
     * @param y0 Y location of the start point in the visualization window [0.,1.]
     * @param x1 X location of the end point in the visualization window [0.,1.]
     * @param y1 Y location of the end point in the visualization window [0.,1.]
     * @param lineWidth Width of the line.
     * @param startArrow 0=None, 1=Line, 2=Solid
     * @param endArrow 0=None, 1=Line, 2=Solid
     * @param color Color used for the line if we're not using the fg color.
     * @param useForegroundColor True to use the foreground color as the text color
     * @param visible Whether the annotation is visible.
     */
    public void SetLine2DOptions(String annotName, 
        double x0, double y0, double x1, double y1,
        int lineWidth,
        int startArrow, int endArrow,
        ColorAttribute color, boolean useForegroundColor, 
        boolean visible)
    {
        AnnotationObject annot = GetAnnotation(annotName);
        if(annot != null)
        {
            annot.SetPosition(x0, y0, 0.);
            annot.SetPosition2(x1, y1, 0.);
            annot.SetColor1(color);
            annot.SetColor2(new ColorAttribute(lineWidth, startArrow, endArrow, 255));
            annot.SetUseForegroundForTextColor(useForegroundColor);
            annot.SetVisible(visible);
        }
    }

Function: SetImageOptions
Declaration: SetImageOptions
Definition:
    /**
     * Sets the options for the named image annotation object.
     *
     * @param annotName Name of the text annotation that we want to modify.
     * @param filename Filename that contains the image.
     * @param x X location of the start point in the visualization window [0.,1.]
     * @param y Y location of the start point in the visualization window [0.,1.]
     * @param xScale X scale.
     * @param yScale Y scale.
     * @param scalesLinked Keeps the scales linked.
     * @param transColor The color to remove from the image so it becomes clear.
     * @param removeTransColor Tells VisIt to remove the transparent color.
     * @param opacity Overal opacity of the image.
     * @param visible Whether the annotation is visible.
     */
    public void SetImageOptions(String annotName, 
        String filename,
        double x, double y,
        double xScale, double yScale, boolean scalesLinked,
        ColorAttribute transColor, boolean removeTransColor, 
        double opacity,
        boolean visible)
    {
        AnnotationObject annot = GetAnnotation(annotName);
        if(annot != null)
        {
            Vector sArgs = new Vector();
            sArgs.addElement(new String(filename));
            annot.SetText(sArgs);
            annot.SetPosition(x, y, 0.);
            annot.SetPosition2(xScale * 100., yScale * 100., 0.);
            ColorAttribute c = new ColorAttribute(
                transColor.Red(), 
                transColor.Green(), 
                transColor.Blue(),
                (int)(opacity * 255.));
            annot.SetColor1(c);
            annot.SetFontShadow(scalesLinked);
            annot.SetIntAttribute1(removeTransColor?1:0);
            annot.SetVisible(visible);
        }
    }