1 /** @file sd_line_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
9 classes relating to each 'line' to be plotted
10 includes conversion mechanisms from real coords to window coords
11 handles 'actual' plotting too
14 #include "sd_line_t.hpp"
19 // number of pixels left blank as buffer outside plot area.
20 // X is both left and right, Y is both top and bot.
21 // MUST be natural number and not too big.
28 int YAXISNOTCHLABELOFFSET = 38; // from y axis
29 int YAXISLABELOFFSET = 58;
30 // // in addition to the padding above...
31 double Y_HALF_FUDGE_FACTOR = 0.03; // like 0.03
32 // // fudge real Y-axis extrema on each side by this much.
33 // // MUST be nonnegative. can set to 0 if you don't want it to.
34 int X_HALF_FUDGE_INCREMENT = 1; // like 1
35 // // how much to fudge the real x-axis on both side: MUST be natural number
37 void drawBoundary(QPainter& P) { // boundary JUST OUTSIDE the actual paint area
38 // if PADDINGs are 0, should seem to do nothing
39 int LEFT= sd_line_t::XWINPAD - 1;
40 int RIGHT= sd_line_t::WIDTH - sd_line_t::XWINPAD;
41 int TOP= sd_line_t::YWINPAD - 1;
42 int BOT= sd_line_t::HEIGHT - sd_line_t::YWINPAD;
43 P.setPen( Qt::black );
44 P.drawLine(LEFT , TOP, RIGHT, TOP); // (x1,y1,x2,y2) >>inclusive<<
45 P.drawLine(RIGHT, TOP, RIGHT, BOT);
46 P.drawLine(RIGHT, BOT, LEFT , BOT);
47 P.drawLine(LEFT , BOT, LEFT , TOP);
48 } // --drawBoundary() in namespace sd_line_t
50 /** don't wanna define it in QPainter to respect Qt library *
51 * puts a big ugly smudge of paint at (cx, cy) without changing Pen */
52 void drawBigPoint(QPainter& P, int cx, int cy) {
54 for(x = cx-1; x <= cx+1; x++) {
55 for(y = cy-1; y <= cy+1; y++) {
59 P.drawPoint(cx-2,cy-2);
60 P.drawPoint(cx-2,cy+2);
61 P.drawPoint(cx+2,cy-2);
62 P.drawPoint(cx+2,cy+2);
67 } // --drawBigPoint() in namespace sd_line_t
69 }; // -- namespace sd_line_t, for now