1 /** @file line_real_t.cpp
2 @package snark14Display
3 @author Bruno M. Carvalho and Deniz Sarioz
4 licensed under (open-source) QPL v1.0
5 which accompanies this distribution in the file QPL
13 #include "sd_line_t.hpp"
14 #include "line_real_t.hpp"
15 #include "line_real_set_t.hpp"
19 class line_real_set_t;
21 line_real_t::line_real_t(QString name) {
26 line_real_t::line_real_t(QString name, int fromX, int toX, double atY) { // good for phantom
29 for(int x = fromX; x <= toX; x++) {
34 bool line_real_t::empty() { return data.empty(); }
36 void line_real_t::add(int x, double y) {
37 point_real_t p = {x, y};
39 } // --line_real_t::add()
41 void line_real_t::clear() { data.clear(); }
43 // these 4 must wait until the end of line_real_set_t def
45 int line_real_t::getMinX() {
47 throw std::logic_error("line_real's set not set!");
48 return mySetP->getMinX();
51 int line_real_t::getMaxX() {
53 throw std::logic_error("line_real's set not set!");
54 return mySetP->getMaxX();
57 double line_real_t::getMinY() {
59 throw std::logic_error("line_real's set not set!");
60 return mySetP->getMinY();
63 double line_real_t::getMaxY() {
65 throw std::logic_error("line_real's set not set!");
66 return mySetP->getMaxY();
69 QString line_real_t::getName() { return plotname; }
71 void line_real_t::setset(line_real_set_t* sp) { mySetP = sp; }
73 /** debug routine -- caller is responsible */
74 void line_real_t::show() {
75 for(data_real_t::const_iterator it = data.begin(); it != data.end(); it++) {
76 std::cerr << "(" << (it->x) << "," << (it->y) << ")" << " ";
78 std::cerr << " ##### ";