source: branches/nanovis2/src/objects/RpScatter.cc @ 3305

Last change on this file since 3305 was 3305, checked in by ldelgass, 11 years ago

sync with trunk

File size: 3.4 KB
Line 
1/*
2 * ----------------------------------------------------------------------
3 *  Rappture 2.0 Scatter Object Source
4 *
5 * ======================================================================
6 *  AUTHOR:  Derrick Kearney, Purdue University
7 *  Copyright (c) 2004-2012  HUBzero Foundation, LLC
8 *
9 *  See the file "license.terms" for information on usage and
10 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
11 * ======================================================================
12 */
13
14#include "RpScatter.h"
15
16using namespace Rappture;
17
18Scatter::Scatter ()
19    : Curve()
20{
21    this->path("");
22    this->label("");
23    this->desc("");
24    this->group("");
25    propstr("type","scatter");
26}
27
28Scatter::Scatter (const char *path)
29    : Curve()
30{
31    this->path(path);
32    this->label("");
33    this->desc("");
34    this->group("");
35    propstr("type","scatter");
36}
37
38Scatter::Scatter (const char *path, const char *label, const char *desc,
39              const char *group)
40    : Curve()
41{
42    this->path(path);
43    this->label(label);
44    this->desc(desc);
45    this->group(group);
46    propstr("type","scatter");
47}
48
49// copy constructor
50Scatter::Scatter ( const Scatter& o )
51    :   Curve(o)
52{
53    this->path(o.path());
54    this->label(o.label());
55    this->desc(o.desc());
56    this->group(o.group());
57
58    // need to copy _axisList
59}
60
61// default destructor
62Scatter::~Scatter ()
63{
64    // clean up dynamic memory
65    // unallocate the _axisList?
66
67}
68
69/**********************************************************************/
70// METHOD: xml()
71/// Return the xml of the object
72/**
73 * Return the xml of the object
74 */
75
76/*
77const char *
78Scatter::xml(size_t indent, size_t tabstop)
79{
80// FIXME: the xml function should just read an array
81// of path/value or path/function pairs, get the value by executing
82// the function if needed, and place the data in an xml tree.
83    Path p(path());
84
85    Array1D *tmpAxis = NULL;
86    size_t nmemb = 0;
87
88    const double *dataArr[dims()];
89
90    _tmpBuf.clear();
91
92    _tmpBuf.appendf(
93"<curve id=\"%s\">\n\
94    <about>\n\
95        <group>%s</group>\n\
96        <label>%s</label>\n\
97        <description>%s</description>\n\
98        <type>scatter</type>\n\
99    </about>\n", p.id(),group(),label(),desc());
100
101    for (size_t dim=0; dim < dims(); dim++) {
102        tmpAxis = getNthAxis(dim);
103        nmemb = tmpAxis->nmemb();
104        dataArr[dim] = tmpAxis->data();
105        _tmpBuf.appendf(
106"    <%s>\n\
107        <label>%s</label>\n\
108        <description>%s</description>\n\
109        <units>%s</units>\n\
110        <scale>%s</scale>\n\
111    </%s>\n",
112        tmpAxis->name(), tmpAxis->label(), tmpAxis->desc(),
113        tmpAxis->units(), tmpAxis->scale(), tmpAxis->name());
114    }
115
116    _tmpBuf.append("    <component>\n        <xy>\n");
117    for (size_t idx=0; idx < nmemb; idx++) {
118        for(size_t dim=0; dim < dims(); dim++) {
119            _tmpBuf.appendf("%10g",dataArr[dim][idx]);
120        }
121        _tmpBuf.append("\n",1);
122    }
123    _tmpBuf.append("        </xy>\n    </component>\n</curve>");
124    _tmpBuf.append("\0",1);
125
126    return _tmpBuf.bytes();
127}
128*/
129
130/**********************************************************************/
131// METHOD: is()
132/// what kind of object is this
133/**
134 * return hex value telling what kind of object this is.
135 */
136
137const int
138Scatter::is() const
139{
140    // return "scat" in hex
141    return 0x73636174;
142}
143
144
145// -------------------------------------------------------------------- //
146
Note: See TracBrowser for help on using the repository browser.