1 /*----------------------------------------------------------------------------
2                       frame.h (definitions of frame 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(__frame_h)
25 #define __frame_h
26 
27 #include "plobj.h"
28 #include "pointdefs.h"
29 #include <string>
30 #include "col.h"
31 #include "vect.h"
32 #include "axis.h"
33 #include "data.h"
34 #include "parts.h"
35 #include "valbuff.h"
36 
37 typedef vect<axis> axisarray;
38 typedef vect<data> dataarray;
39 typedef vect<parts> partsarray;
40 
41 #define FRAME_BOX       0
42 #define FRAME_XY        1
43 #define FRAME_INDIV     2
44 
45 
46 class frame: public plobj
47 {
48  public:
49   frame();
50   ~frame();
51 
52   frame& operator = (const frame& fr);
53 
54   bool get(std::string* member,  tokenbuff* outvalue);
55   bool set(std::string* member,  std::string* setvalue);
56   bool exec(std::string* function, buffarray *argument, tokenbuff* outvalue);
57   void arrangeaxes();
58 
59   bool paint(bool flag, FILE* f);
60   int wtov_x(int wx);
61   int wtov_y(int wy);
62   int scale(int x);
63   double doubleworld_to_view_x(double wx);
64   double doubleworld_to_view_y(double wy);
65   int doubleworldtoshortworld(double x);
66 
67   int vtow_x(int vx);
68   int vtow_y(int vy);
69   double doubleview_to_world_x(double vx);
70   double doubleview_to_world_y(double vy);
71 
72 
73   bool axispaintmajorline(bool flag, FILE* f, axis *axis);
74   bool axispaintminorline(bool flag, FILE* f, axis *axis);
75 
76   bool setaxisid(int arrayno);
77   bool setdataid(int arrayno);
78   bool setpartsid(int arrayno);
79 
80   int getaxisindex(int id);
81   int getdataindex(int id);
82   int getpartsindex(int id);
83 
84   void getBBbox(intrect *r);
85 
86   void autoscaleunit(axis *AUnit, double Start, double End, bool Spacing, int Spacingfactor);
87   void autoscale(bool BFlag, bool LFlag, bool TFlag, bool RFlag, bool Spacing, int Spacingfactor);
88 
89 
90   /* frame read / write  */
91   bool readframe(FILE *fp);
92   bool writeframe(FILE *fp);
93   void setwithdata();
94 
95   int id;
96   std::string *label;
97   std::string *paintorder;
98   axisarray *axarray;
99   dataarray *darray;
100   partsarray *parray;
101   VariantBuff *usrconst, *usrfnc;
102 
103   intpoint p1, p2;
104   Capcolor framelinecolor, framebodycolor;
105   Caplinestyle framelinestyle;
106   Capfillstyle framebodyfillstyle;
107   int frametype;
108   int selected;
109   bool withdata;
110 };
111 
112 #endif
113 
114 
115 
116