-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocumentation.conf
More file actions
371 lines (345 loc) · 11.2 KB
/
Copy pathdocumentation.conf
File metadata and controls
371 lines (345 loc) · 11.2 KB
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
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
extensionName = "view2.5d"
markdownTemplate = """
# NetLogo View2.5D Extension
The `view2.5d` extension allows you to visualize 2d models on a 3d surface, using height to represent agent properties.
{{> BUILDING.md}}
{{> USING.md}}
## Primitives
{{#contents}}{{#prims}}
[`{{name}}`](#{{primitive.extensionName}}{{primitive.name}})
{{/prims}}{{/contents}}
{{#primitives}}
{{> primTemplate}}{{/primitives}}
## Acknowledgement
For development of the View 2.5D NetLogo Extension, we acknowledge financial support from Joshua M. Epstein's NIH Director's Pioneer Award (DP1).
"""
primTemplate = """
### `{{name}}`
```NetLogo
{{#examples}}
{{primitive.fullName}}{{#args}} {{name}}{{/args}}
{{/examples}}
```
{{{description}}}
"""
filesToIncludeInManual = [ "USING.md", "primitives" ]
tableOfContents = { }
primitives = [
{
name: patch-view,
type: command,
agentContext: [ "observer" ],
arguments: [
{ name: Title, type: string },
{ name: Reporter, type: "reporter" }
],
description: """
This command must be called from the Observer context. (Attempting to call from another context causes an error)
The Title is a string, which will be used to label the new Window and to call for subsequent updates and modifications.
Specification of the Reporter uses the NetLogo anonymous procedure syntax, from the Observer perspective.
Example:
```NetLogo
view2.5d:patch-view "Test" [ [the-patch] -> [pxcor] of the-patch ]
```
"""
},
{
name: decorate-patch-view,
arguments: [ { name: Title, type: string } ],
agentContext: [ "observer" ],
type: command,
description: """
This command must be called from the Observer context. (Attempting to call from another context causes an error)
The Title is a string, the label of an existing Patch View Window.
Effect: draws the turtles of the model at their current location, on top of the Patch view display
> NOTE: only has an effect in the "structures" patch view (in the others, the patch value is inclined based on neighbors & gradient)
> NOTE: for negative patch values, the turtle shapes are drawn below (orbit underneath to see them)
Example:
```NetLogo
view2.5d:decorate-patch-view "Test"
```
"""
},
{
name: undecorate-patch-view,
type: command,
agentContext: [ "observer" ],
arguments: [ { name: Title, type: string } ],
description: """
This command must be called from the Observer context. (Attempting to call from another context causes an error)
The Title is a string, the label of an existing Patch View Window.
Effect: STOPS drawing the turtles of the model at their current location, on top of the Patch view display
Example:
```NetLogo
view2.5d:undecorate-patch-view "Test"
```
"""
},
{
name: turtle-view,
type: command,
agentContext: [ "observer" ],
arguments: [
{ name: Title, type: string },
{ name: Agents, type: turtleset },
{ name: Reporter, type: reporter }
],
description: """
This command must be called from the Observer context. (Attempting to call from another context causes an error)
The Title is a string, which will be used to label the new Window and to call for subsequent updates.
The turtle-set is any selector for turtles.
Reporter is an anonymous reporter that should take a turtle as input, and report some number from it.
Example:
```
view2.5d:turtle-view "Test" turtles with [color = red] [ the-turtle -> [energy] of the-turtle]
; This would create a new 2.5d window, plotting the ENERGY value of all turtles that are red.
```
"""
},
{
name: update-all-patch-views,
type: command,
agentContext: [ "observer" ],
description: """
This command must be called from the Observer context.
Updates all existing patch-view windows according to the latest values.
"""
},
{
name: update-patch-view,
type: command,
agentContext: [ "observer" ],
arguments: [ { name: Title, type: string } ]
description: """
This command must be called from the Observer context.
Updates only the patch-view window with the specified title (if any).
"""
},
{
name: update-turtle-view,
type: command,
agentContext: [ "observer" ],
arguments: [
{ name: Title, type: string },
{ name: Agents, type: turtleset }
],
description: """
This command must be called from the Observer context.
Updates only the turtle-view window with the specified title (if any).
The turtle-set selector must be supplied to refresh the set of turtles.
"""
},
{
name: get-z-scale,
type: reporter,
returns: number,
agentContext: [ "observer" ],
arguments: [ { name: title, type: string } ],
description: """
This reporter must be called from the Observer context.
Returns the current z-scale of the turtle-view or patch-view window with the specified title (if any).
"""
},
{
name: set-z-scale,
type: command,
agentContext: [ "observer" ],
arguments: [
{ name: Title, type: string },
{name: new-z-scale, type: number }
],
description: """
This command must be called from the Observer context.
Updates only the turtle-view or patch-view window with the specified title (if any).
The view is now displayed with the new z-scale.
"""
},
{
name: set-turtle-stem-thickness,
type: command,
agentContext: [ "observer" ],
arguments: [
{ name: Title, type: string },
{ name: thickness, type: number }
],
description: """
This command must be called from the Observer context.
Updates only the turtle-view window with the specified title (if any).
Turtles are now drawn with "pins" or "stems" that have the specified thickness (instead of the hairline default).
"""
},
{
name: set-turtle-stem-color,
type: command,
agentContext: [ "observer" ],
arguments: [
{ name: Title, type: string },
{ name: colorReporter, type: reporter }
],
description: """
This command must be called from the Observer context.
Updates only the turtle-view window with the specified title (if any).
colorReporter is an anonymous reporter that should take a turtle as input, and report some number representing a color from it.
Turtles are now drawn with "pins" or "stems" that have the specified color (instead of the grey default).
Example:
```
;; setup view with 2 turtles
crt 1 [ set color green setxy 2 3]
crt 1 [ set color red setxy 5 4]
view2.5d:turtle-view "Test" turtles [ the-turtle -> [ xcor] of the-turtle ]
view2.5d:set-observer-distance "Test" 40
view2.5d:set-z-scale "Test" 2
view2.5d:set-observer-angles "Test" 25 30
;; increase the stem thickness
view2.5d:set-turtle-stem-thickness "Test" .2
;; change the stem color to match the turtle-color
view2.5d:set-turtle-stem-color "Test" [ the-turtle -> [ color ] of the-turtle ]
; now make the stems orange
view2.5d:set-turtle-stem-color "Test" [ orange ]
```
"""
},
{
name: show-links-xy-plane,
type: command,
agentContext: [ "observer" ],
arguments: [
{ name: Title, type: string },
],
description: """
This command must be called from the Observer context.
Updates only the turtle-view or patch-view window with the specified title (if any).
Links are drawn in the xy-plane (instead of the turtle to turtle default).
This option can be selected using the Link Options xy-plane radio Button in the 3D view.
"""
},
{
name: show-links-xyz,
type: command,
agentContext: [ "observer" ],
arguments: [
{ name: Title, type: string },
],
description: """
This command must be called from the Observer context.
Updates only the turtle-view or patch-view window with the specified title (if any).
Links are drawn from turtle to turtle (this is the default way links are displayed).
This option can be selected using the Link Options xyz radio Button in the 3D view.
"""
},
{
name: get-observer-angles,
type: reporter,
returns: list,
agentContext: [ "observer" ],
arguments: [ { name: Title, type: string } ],
description: """
This reporter must be called from the Observer context.
Returns a list reflecting the observer's angular perspective { heading pitch } (the place on an imaginary sphere at the zoom distance is updated to obey heading & pitch given)
"""
},
{
name: set-observer-angles,
type: command,
agentContext: [ "observer" ],
arguments: [
{ name: Title, type: string },
{ name: heading, type: number },
{ name: pitch, type: number }
],
description: """
This command must be called from the Observer context.
Updates only the turtle-view window with the specified title (if any).
Sets the observer's angular perspective (the place on an imaginary sphere at the zoom distance is updated to obey heading & pitch given)
"""
},
{
name: get-observer-xy-focus,
type: reporter,
returns: list,
agentContext: [ "observer" ],
arguments: [ { name: Title, type: string } ],
description: """
This reporter must be called from the Observer context.
Returns a list reflecting the x and y coordinates the observer is "looking at" in the patch plane.
"""
},
{
name: set-observer-xy-focus,
type: command,
agentContext: [ "observer" ],
arguments: [
{ name: Title, type: string },
{ type: xcor, type: number },
{ name: ycor, type: number }
],
description: """
This command must be called from the Observer context.
Updates only the turtle-view window with the specified title (if any).
Sets the x and y coordinates the observer that is "looking at" in the patch plane.
"""
},
{
name: get-observer-distance,
type: reporter,
returns: number,
agentContext: [ "observer" ],
arguments: [ { name: Title, type: string } ],
description: """
This reporter must be called from the Observer context.
Returns the observer's distance from its "focus point"
"""
},
{
name: set-observer-distance,
type: command,
agentContext: [ "observer" ],
arguments: [
{ name: Title, type: string },
{ name: new-distance, type: number }
],
description: """
This command must be called from the Observer context.
Updates only the turtle-view window with the specified title (if any).
Sets the observer's distance from its "focus point"
"""
},
{
name: remove-patch-view,
type: command,
arguments: [ { name: Title, type: string } ],
description: """
This command closes and removes the specified patch view programmatically (equivalent to closing the window manually).
"""
},
{
name: remove-turtle-view,
type: command,
arguments: [ { name: Title, type: string } ],
description: """
This command closes and removes the specified turtle view programmatically (equivalent to closing the window manually).
"""
},
{
name: remove-all-patch-views,
type: command,
description: """
This command closes and removes all patch views programmatically (equivalent to closing the windows manually).
"""
},
{
name: remove-all-turtle-views,
type: command,
description: """
This command closes and removes all turtle views programmatically (equivalent to closing the windows manually).
"""
},
{
name: count-windows,
type: reporter,
returns: number,
description: """
This reporter returns the number of turtle and patch views that are currently active.
"""
}
]