1 /*----------------------------------------------------------------------------
2                        axis.h (definition of axis object)
3                        This file is a part of topaz systems
4                   Copyright: Hisao Kawaura, All rights reserved
5                                    1997 - 98
6 
7 
8     This program is free software; you can redistribute it and/or modify
9     it under the terms of the GNU General Public License as published by
10     the Free Software Foundation; either version 2 of the License, or
11     (at your option) any later version.
12 
13     This program is distributed in the hope that it will be useful,
14     but WITHOUT ANY WARRANTY; without even the implied warranty of
15     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16     GNU General Public License for more details.
17 
18     You should have received a copy of the GNU General Public License
19     along with this program; if not, write to the Free Software
20     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21 
22 ----------------------------------------------------------------------------*/
23 
24 #if !defined(__axis_h)
25 #define __axis_h
26 
27 #include "plobj.h"
28 #include "pointdefs.h"
29 #include "col.h"
30 
31 #define DELTA_AXIS          1e-7
32 
33 #define TICKPARITY_NULL     0
34 #define TICKPARITY_PLUS     1
35 #define TICKPARITY_MINUS    2
36 #define TICKPARITY_BOTH     3
37 
38 #define SCALE_LINEAR        0
39 #define SCALE_LOG           1
40 #define SCALE_INV           2
41 #define SCALE_LOGLINEAR     3
42 #define SCALE_INVLINEAR     4
43 
44 #define AXISTYPE_NILL       0
45 #define AXISTYPE_X          1
46 #define AXISTYPE_Y          2
47 #define AXISTYPE_T          3
48 #define AXISTYPE_R          4
49 
50 #define LABEL_FORMAT_NULL     0
51 #define LABEL_FORMAT_DECIMAL  1
52 #define LABEL_FORMAT_EXP      2
53 
54 #define LABELPARITY_PLUS     0
55 #define LABELPARITY_MINUS    1
56 
57 #define CROSSPOINTPARITY_CENTER   0
58 #define CROSSPOINTPARITY_MINUS    1
59 #define CROSSPOINTPARITY_PLUS     2
60 #define CROSSPOINTPARITY_NULL     3
61 
62 
63 class axis:public plobj
64 {
65  public:
66   axis();
67   ~axis();
68   axis& operator = (const axis& ax);
69 
70   bool get(std::string* member,  tokenbuff* outvalue);
71   bool set(std::string* member,  std::string* setvalue);
72   bool exec(std::string* function, buffarray *argument, tokenbuff* outvalue);
73 
74   bool paint(bool flag, FILE *f);
75   bool paintmajortick(bool flag, FILE *f);
76   bool paintminortick(bool flag, FILE *f);
77   bool drawlabel(bool flag, FILE *f);
78 
79   doublepoint virtual_to_doubleworld(double x);
80   intpoint virtual_to_world(double x);
81   double virtual_to_axis(double x);
82   doublepoint axis_to_world(double x, double y);
83 
84   double axis_to_virtual(double x);
85   double world_to_axis(double x, double y);
86   double doubleworld_to_virtual(double x, double y);
87 
88   /* axis read / write  */
89   bool readaxis(FILE *fp);
90   bool writeaxis(FILE *fp);
91 
92 
93   int id;
94   std::string *label;
95   int selected;
96   /*base*/
97   int axistype;
98   bool display;
99   bool commonset;
100   int scaling;
101   bool invertscale;
102   intpoint origin;
103   int length;
104   double angle;
105   Caplinestyle baselinestyle;
106   Capcolor basecolor;
107   double tickarea_start;
108   double tickarea_end;
109 
110 
111   /*mumerical range*/
112   double start;
113   double end;
114   double unit;
115   double crosspoint;
116   bool autocrosspoint;
117 
118   /*tick*/
119   int tickparity;
120   int tickwidth;
121   int ticklength;
122   int division;
123 
124   /*tickline*/
125   Capcolor majorticklinecolor, minorticklinecolor;
126   Caplinestyle majorticklinestyle, minorticklinestyle;
127 
128   /*label*/
129   Capfont fo;
130   Capcolor fontcolor;
131   int format;
132   bool addplus;
133   int offset;
134   int skip;
135   bool autoprecision;
136   int intprecision;
137   int decimalprecision;
138   int labelparity;
139   int crosspointparity;
140   /* this member is impricit*/
141   int crosspointoffset;
142 };
143 
144 #endif
145 
146 
147 
148 
149 
150