rllib  1
rlsvgvdi.h
Go to the documentation of this file.
1 /***************************************************************************
2  rlsvgvdi.h - description
3  -------------------
4  begin : Tu Mar 22 2016
5  copyright : (C) 2016 by R. Lehrig
6  email : lehrig@t-online.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 #ifndef _RL_SVGVDI_H_
18 #define _RL_SVGVDI_H_
19 
20 #include <stdio.h>
21 #include "rlstring.h"
22 #include "rlspawn.h"
23 #define MAXARRAY 1024*4 // maximum array size for line(x,y,n)
24 
25 #ifndef PROCESSVIEWSERVER_H
26 /* font alignment */
27 enum rlFontAlignment { /* */
28 ALIGN_LEFT=0, /* example */
29 ALIGN_CENTER, /* example */
30 ALIGN_RIGHT, /* example */
32 }; /* x */
33  /* a */
34  /* m */
35  /* p */
36  /* l */
37  /* e */
38  /* */
39 
40 /* linestyle for lines in axis */
49 };
50 #endif
51 
79 class rlSvgVdi
80 {
81 public:
82  rlSvgVdi();
83  ~rlSvgVdi();
84  int setOutput(int *socket_out, int idForPvbrowser=0);
85  int setOutput(FILE *fout);
86  int setOutput(const char *outputfilename);
87  int setOutput(rlSpawn *pipe);
88  int endOutput();
89  const char *svgHeader(int width=1280, int height=1024, int rbackground=255, int gbackground=255, int bbackground=255);
90  const char *svgTrailer();
91  const char *drawEllipse(int x, int y, int rx, int ry);
92  const char *moveTo(int x, int y);
93  const char *lineTo(int x, int y);
94  const char *line(int x1, int y1, int x2, int y2);
95  const char *text(int x, int y, const char *text, int alignment=ALIGN_LEFT);
96  const char *textInAxis(float x, float y, const char *text, int alignment);
97  const char *box(int x, int y, int w, int h);
98  const char *boxWithText(int x, int y, int w, int h, int fontsize, const char *xlabel, const char *ylabel, const char * rylabel);
99  const char *rect(int x, int y, int w, int h);
100  const char *xAxis(float start, float delta, float end, int draw=1);
101  const char *yAxis(float start, float delta, float end, int draw=1);
102  const char *xGrid();
103  const char *yGrid();
104  const char *rightYAxis(float start, float delta, float end, int draw=1);
105  const char *drawSymbol(int x, int y, int type);
106  const char *line(float *x, float *y, int n, int linestayle=LINESTYLE_NONE);
107  const char *setColor(int r, int g, int b);
108  const char *setFont(const char *family, int size, int weight, int italic);
109  const char *setWidth(int w);
110  const char *setLinestyle(const char *dasharray);
111  const char *comment(const char *text);
112  const char *svg_put(const char *text);
113  const char *svg_printf(const char *format, ...);
114  const char *svg_d(int *x, int *y, int count);
115  const char *svg_points(int *x, int *y, int count);
117  int getFontsize();
118  int getBoxX();
119  int getBoxY();
120  int getBoxW();
121  int getBoxH();
122 
123 private:
124  int *sout;
125  FILE *fout;
130  char stroke[16];
131  int width;
134  int perhapsSend(const char *text);
135  int xold, yold;
136  float xmin,dx,xmax;
137  float ymin,dy,ymax;
138  int tx(float x);
139  int ty(float y);
141  int fontsize;
142  int sr; // symbol radius
143  char floatFormat[80];
144 };
145 
146 #endif
const char * setWidth(int w)
Definition: rlsvgvdi.cpp:639
int xold
Definition: rlsvgvdi.h:135
int outputState
Definition: rlsvgvdi.h:116
const char * rect(int x, int y, int w, int h)
Definition: rlsvgvdi.cpp:377
const char * svgHeader(int width=1280, int height=1024, int rbackground=255, int gbackground=255, int bbackground=255)
Definition: rlsvgvdi.cpp:257
float ymin
Definition: rlsvgvdi.h:137
rlString fontstring
Definition: rlsvgvdi.h:129
rlSvgVdi()
Definition: rlsvgvdi.cpp:40
int getBoxX()
Definition: rlsvgvdi.cpp:749
const char * comment(const char *text)
Definition: rlsvgvdi.cpp:677
const char * moveTo(int x, int y)
Definition: rlsvgvdi.cpp:280
const char * xGrid()
Definition: rlsvgvdi.cpp:405
const char * lineTo(int x, int y)
Definition: rlsvgvdi.cpp:287
int getFontsize()
Definition: rlsvgvdi.cpp:744
const char * svg_points(int *x, int *y, int count)
Definition: rlsvgvdi.cpp:718
rlString lineoptions
Definition: rlsvgvdi.h:133
const char * yGrid()
Definition: rlsvgvdi.cpp:416
float dy
Definition: rlsvgvdi.h:137
int idForPvbrowser
Definition: rlsvgvdi.h:128
const char * textInAxis(float x, float y, const char *text, int alignment)
Definition: rlsvgvdi.cpp:311
const char * svg_d(int *x, int *y, int count)
Definition: rlsvgvdi.cpp:702
const char * box(int x, int y, int w, int h)
Definition: rlsvgvdi.cpp:354
const char * setColor(int r, int g, int b)
Definition: rlsvgvdi.cpp:609
rlSpawn * pipe
Definition: rlsvgvdi.h:126
const char * line(int x1, int y1, int x2, int y2)
Definition: rlsvgvdi.cpp:299
float ymax
Definition: rlsvgvdi.h:137
rlString filename
Definition: rlsvgvdi.h:127
int yold
Definition: rlsvgvdi.h:135
int getBoxW()
Definition: rlsvgvdi.cpp:759
const char * drawEllipse(int x, int y, int rx, int ry)
Definition: rlsvgvdi.cpp:273
int perhapsSend(const char *text)
Definition: rlsvgvdi.cpp:201
rlString svg2
Definition: rlsvgvdi.h:129
int * sout
Definition: rlsvgvdi.h:124
rlString svg
Definition: rlsvgvdi.h:129
int ty(float y)
Definition: rlsvgvdi.cpp:737
float xmin
Definition: rlsvgvdi.h:136
const char * yAxis(float start, float delta, float end, int draw=1)
Definition: rlsvgvdi.cpp:460
int boxy
Definition: rlsvgvdi.h:140
rlFontAlignment
Definition: rlsvgvdi.h:27
const char * text(int x, int y, const char *text, int alignment=ALIGN_LEFT)
Definition: rlsvgvdi.cpp:330
int sr
Definition: rlsvgvdi.h:142
int width
Definition: rlsvgvdi.h:131
const char * svgTrailer()
Definition: rlsvgvdi.cpp:266
const char * drawSymbol(int x, int y, int type)
Definition: rlsvgvdi.cpp:536
const char * rightYAxis(float start, float delta, float end, int draw=1)
Definition: rlsvgvdi.cpp:493
int getBoxY()
Definition: rlsvgvdi.cpp:754
rlLinestyle
Definition: rlsvgvdi.h:41
~rlSvgVdi()
Definition: rlsvgvdi.cpp:64
const char * setLinestyle(const char *dasharray)
Definition: rlsvgvdi.cpp:658
FILE * fout
Definition: rlsvgvdi.h:125
rlString dasharray
Definition: rlsvgvdi.h:132
int boxw
Definition: rlsvgvdi.h:140
const char * boxWithText(int x, int y, int w, int h, int fontsize, const char *xlabel, const char *ylabel, const char *rylabel)
Definition: rlsvgvdi.cpp:368
char floatFormat[80]
Definition: rlsvgvdi.h:143
rlString outputfilename
Definition: rlsvgvdi.h:127
int fontsize
Definition: rlsvgvdi.h:141
int tx(float x)
Definition: rlsvgvdi.cpp:732
int setOutput(int *socket_out, int idForPvbrowser=0)
Definition: rlsvgvdi.cpp:69
rlString svg3
Definition: rlsvgvdi.h:129
int boxh
Definition: rlsvgvdi.h:140
int endOutput()
Definition: rlsvgvdi.cpp:163
const char * setFont(const char *family, int size, int weight, int italic)
Definition: rlsvgvdi.cpp:629
char stroke[16]
Definition: rlsvgvdi.h:130
float xmax
Definition: rlsvgvdi.h:136
const char * xAxis(float start, float delta, float end, int draw=1)
Definition: rlsvgvdi.cpp:427
rlString textoptions
Definition: rlsvgvdi.h:133
const char * svg_put(const char *text)
Definition: rlsvgvdi.cpp:684
float dx
Definition: rlsvgvdi.h:136
int boxx
Definition: rlsvgvdi.h:140
int getBoxH()
Definition: rlsvgvdi.cpp:764
const char * svg_printf(const char *format,...)
Definition: rlsvgvdi.cpp:690