File: STEntityTypeLayout.h

package info (click to toggle)
paje.app 1.98-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,428 kB
  • sloc: objc: 24,517; ansic: 6,998; makefile: 134; sh: 42; java: 31
file content (254 lines) | stat: -rw-r--r-- 6,748 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
/*
    Copyright (c) 1998, 1999, 2000, 2001, 2003, 2004 Benhur Stein
    
    This file is part of Pajé.

    Pajé is free software; you can redistribute it and/or modify it under
    the terms of the GNU Lesser General Public License as published by the
    Free Software Foundation; either version 2 of the License, or (at your
    option) any later version.

    Pajé is distributed in the hope that it will be useful, but WITHOUT ANY
    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
    for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with Pajé; if not, write to the Free Software Foundation, Inc.,
    59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _STEntityTypeLayout_h_
#define _STEntityTypeLayout_h_

// Paje
// ----
// STEntityTypeLayout.h
// holds the layout of an entity type, with information
// on how and where to draw one entity of this type.

// 25.aug.2004 BS  creation


#include <Foundation/Foundation.h>
#include "../General/Protocols.h"
#include "../General/PajeContainer.h"
#include "Shape.h"

@class STContainerTypeLayout;
@class STController;

@interface STEntityTypeLayout : NSObject
{
    PajeEntityType *entityType;

    // pointer to function that creates a path of the entity representation.
    ShapeFunction *shapeFunction;
    // pointer to function that draws a path created by pathFunction.
    DrawFunction *drawFunction;

    float height;
    float offset;   // from start of container 
                    // alternatively, could be rectincontainer (like container)
    BOOL drawsName;
                    
    STContainerTypeLayout *containerDescriptor;
    NSMutableDictionary *rectInContainer;
}

+ (STEntityTypeLayout *)descriptorWithEntityType:(PajeEntityType *)etype
                                     drawingType:(PajeDrawingType)dtype
                             containerDescriptor:(STContainerTypeLayout *)cDesc
                                      controller:(STController *)controller;
- (id)initWithEntityType:(PajeEntityType *)etype
     containerDescriptor:(STContainerTypeLayout *)cDesc
              controller:(STController *)controller;

- (void)registerDefaultsWithController:(STController *)controller;
- (NSString *)defaultKeyForKey:(NSString*)key;
- (float)defaultFloatForKey:(NSString *)key;
- (void)setDefaultFloat:(float)val forKey:(NSString *)key;
- (BOOL)defaultBoolForKey:(NSString *)key;
- (void)setDefaultBool:(BOOL)value forKey:(NSString *)key;

// accessor methods
- (PajeEntityType *)entityType;

- (void)setShapeFunction:(ShapeFunction *)f;
- (void)setDrawFunction:(DrawFunction *)f;
- (ShapeFunction *)shapeFunction;
- (DrawFunction *)drawFunction;

- (void)setHeight:(float)newHeight;
- (float)height;

- (void)setDrawsName:(BOOL)draws;
- (BOOL)drawsName;

- (void)setOffset:(float)val;
- (float)offset;
- (float)yInContainer:(id)container;

- (void)setRect:(NSRect)rect inContainer:(id)container;
- (NSRect)rectInContainer:(id)container;
- (BOOL)intersectsRect:(NSRect)rect inContainer:(id)container;
- (BOOL)isPoint:(NSPoint)point
    inContainer:(id)container;
- (void)reset;

// methods to be implemented by subclasses
- (PajeDrawingType)drawingType;
- (BOOL)isContainer;

// from NSObject protocol
- (unsigned int)hash;
- (BOOL)isEqual:(id)other;
- (NSString *)description;
@end


@interface STEventTypeLayout : STEntityTypeLayout
{
    float width;
}

- (void)setWidth:(float)val;
- (float)width;

- (BOOL)isSupEvent;
@end

@interface STStateTypeLayout : STEntityTypeLayout
{
    float inset;    // Number of points one entity should be shorter than
                    //   another when imbricated.
}

// Number of points one entity should be shorter than another when imbricated.
- (void)setInsetAmount:(float)newInsetAmount;
- (float)insetAmount;
@end


@interface STLinkTypeLayout : STEntityTypeLayout
{
    // sourceOffset is offset of superclass
//    float sourceOffset; // from start of container 
    float destOffset;
    float lineWidth;
}

- (void)setLineWidth:(float)val;
- (float)lineWidth;

- (void)setSourceOffset:(float)val;
- (float)sourceOffset;

- (void)setDestOffset:(float)val;
- (float)destOffset;

@end


@interface STVariableTypeLayout : STEntityTypeLayout
{
    float lineWidth;
    float minValue;
    float maxValue;
    BOOL showMinMax;
    NSMutableArray *hashMarkValues;
    NSString *hashValueFormat;
}

- (void)setLineWidth:(float)val;
- (float)lineWidth;
- (void)setShowMinMax:(BOOL)flag;
- (BOOL)showMinMax;

- (void)setMinValue:(float)val;
- (float)minValue;
- (void)setMaxValue:(float)val;
- (float)maxValue;

- (NSArray *)hashMarkValues;
- (NSString *)hashValueFormat;

@end


@interface STContainerTypeLayout : STEntityTypeLayout
{
    float supEventsOffset;  // base of superior events
    float infEventsOffset;  // base of inferior events
    float subcontainersOffset;  // start of subcontainers
    float variablesOffset;
    float heightForVariables;
    
    float siblingSeparation; // separation from other containers of same type
                             // in same container
    float subtypeSeparation; // separation between two subtypes

    NSMutableDictionary *rectsOfInstances;

    // Subtypes:
    NSMutableArray *eventSubtypes;
    NSMutableArray *supEventSubtypes;
    NSMutableArray *stateSubtypes;
    NSMutableArray *infEventSubtypes;
    NSMutableArray *variableSubtypes;
    NSMutableArray *linkSubtypes;
    NSMutableArray *containerSubtypes;

    float minValue;
    float maxValue;
    NSMutableArray *hashMarkValues;
    NSString *hashValueFormat;
}
    
- (void)setSiblingSeparation:(float)val;
- (float)siblingSeparation;

- (void)setSubtypeSeparation:(float)val;
- (float)subtypeSeparation;

- (void)setSupEventsOffset:(float)val;
- (float)supEventsOffset;

- (void)setInfEventsOffset:(float)val;
- (float)infEventsOffset;

- (void)setSubcontainersOffset:(float)val;
- (float)subcontainersOffset;

- (void)setHeightForVariables:(float)val;
- (float)heightForVariables;

- (float)variablesOffset;

- (float)linkOffset;

// rect of each instance of this type
- (void)setRect:(NSRect)rect ofInstance:(id)entity;
- (NSRect)rectOfInstance:(id)entity;
- (BOOL)isInstance:(id)entity inRect:(NSRect)rect;
- (BOOL)isPoint:(NSPoint)point inInstance:(id)entity;
- (id)instanceWithPoint:(NSPoint)point;

- (NSEnumerator *)instanceEnumerator;

- (void)addSubtype:(STEntityTypeLayout *)subtype;

- (NSArray *)subtypes;

- (void)setOffsets;

- (void)setMinValue:(float)val;
- (float)minValue;
- (void)setMaxValue:(float)val;
- (float)maxValue;

- (NSArray *)hashMarkValues;
- (NSString *)hashValueFormat;

@end

#endif