Project

General

Profile

Revision 136

Added by Greg Tress over 16 years ago

significant changes to colonet gui, added relative velocity control, task add window, support for individually-paintable image panels, ability to request and parse xbee ID lists, ability to display xbee IDs graphically and in control mode, and other minor fixes.

View differences:

trunk/code/projects/colonet/ColonetGUI/Colonet.xcodeproj/gmtress.pbxuser
9 9
		);
10 10
		breakpoints = (
11 11
		);
12
		breakpointsGroup = A3D78BA80CB6E4FF00A79632 /* XCBreakpointsBucket */;
12 13
		codeSenseManager = A341617F0C989B510007BEF2 /* Code sense */;
13 14
		executables = (
14 15
			130F8B8C001BDBAD11CA292A,
15 16
		);
16 17
		perUserDictionary = {
18
			"PBXConfiguration.PBXBreakpointsDataSource.v1:1CA1AED706398EBD00589147" = {
19
				PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
20
				PBXFileTableDataSourceColumnSortingKey = PBXBreakpointsDataSource_BreakpointID;
21
				PBXFileTableDataSourceColumnWidthsKey = (
22
					20,
23
					20,
24
					210,
25
					20,
26
					110,
27
					109,
28
					20,
29
				);
30
				PBXFileTableDataSourceColumnsKey = (
31
					PBXBreakpointsDataSource_ActionID,
32
					PBXBreakpointsDataSource_TypeID,
33
					PBXBreakpointsDataSource_BreakpointID,
34
					PBXBreakpointsDataSource_UseID,
35
					PBXBreakpointsDataSource_LocationID,
36
					PBXBreakpointsDataSource_ConditionID,
37
					PBXBreakpointsDataSource_ContinueID,
38
				);
39
			};
17 40
			PBXConfiguration.PBXFileTableDataSource3.PBXBookmarksDataSource = {
18 41
				PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
19 42
				PBXFileTableDataSourceColumnSortingKey = PBXBookmarksDataSource_NameID;
......
28 51
					PBXBookmarksDataSource_CommentsID,
29 52
				);
30 53
			};
54
			PBXConfiguration.PBXFileTableDataSource3.PBXErrorsWarningsDataSource = {
55
				PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
56
				PBXFileTableDataSourceColumnSortingKey = PBXErrorsWarningsDataSource_LocationID;
57
				PBXFileTableDataSourceColumnWidthsKey = (
58
					20,
59
					300,
60
					200,
61
				);
62
				PBXFileTableDataSourceColumnsKey = (
63
					PBXErrorsWarningsDataSource_TypeID,
64
					PBXErrorsWarningsDataSource_MessageID,
65
					PBXErrorsWarningsDataSource_LocationID,
66
				);
67
			};
31 68
			PBXConfiguration.PBXFileTableDataSource3.PBXExecutablesDataSource = {
32 69
				PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
33 70
				PBXFileTableDataSourceColumnSortingKey = PBXExecutablesDataSource_NameID;
......
126 163
					PBXFileDataSource_Warnings_ColumnID,
127 164
				);
128 165
			};
129
			PBXPerProjectTemplateStateSaveDate = 213302458;
130
			PBXWorkspaceStateSaveDate = 213302458;
166
			PBXPerProjectTemplateStateSaveDate = 213642084;
167
			PBXWorkspaceStateSaveDate = 213642084;
131 168
		};
132 169
		perUserProjectItems = {
133
			A31266650C9B131A00D15EBF = A31266650C9B131A00D15EBF /* PBXTextBookmark */;
134
			A31266690C9B131A00D15EBF = A31266690C9B131A00D15EBF /* PBXTextBookmark */;
135
			A312666C0C9B131A00D15EBF = A312666C0C9B131A00D15EBF /* PBXTextBookmark */;
136
			A330E0560CA96CB400C8A074 = A330E0560CA96CB400C8A074 /* PBXTextBookmark */;
137
			A35611300CB5380B008C739C = A35611300CB5380B008C739C /* PBXTextBookmark */;
138
			A35611310CB5380B008C739C = A35611310CB5380B008C739C /* PBXTextBookmark */;
139
			A35611320CB5380B008C739C = A35611320CB5380B008C739C /* PBXTextBookmark */;
140
			A356113A0CB539FC008C739C = A356113A0CB539FC008C739C /* PBXTextBookmark */;
141
			A3A687270CB0429000478070 = A3A687270CB0429000478070 /* PBXTextBookmark */;
142
			A3D78AF00CB6BCBE00A79632 /* PBXTextBookmark */ = A3D78AF00CB6BCBE00A79632 /* PBXTextBookmark */;
143
			A3EE6A520C9B3CA800C5C56B = A3EE6A520C9B3CA800C5C56B /* PBXTextBookmark */;
170
			A30FBFA20CBBDC44000A16EC /* PBXTextBookmark */ = A30FBFA20CBBDC44000A16EC /* PBXTextBookmark */;
171
			A30FC0430CBBECA9000A16EC /* PBXTextBookmark */ = A30FC0430CBBECA9000A16EC /* PBXTextBookmark */;
172
			A30FC04E0CBBED0C000A16EC /* PBXTextBookmark */ = A30FC04E0CBBED0C000A16EC /* PBXTextBookmark */;
173
			A30FC0550CBBED7B000A16EC /* PBXTextBookmark */ = A30FC0550CBBED7B000A16EC /* PBXTextBookmark */;
174
			A30FC0560CBBED7B000A16EC /* PBXTextBookmark */ = A30FC0560CBBED7B000A16EC /* PBXTextBookmark */;
175
			A31266650C9B131A00D15EBF /* PBXTextBookmark */ = A31266650C9B131A00D15EBF /* PBXTextBookmark */;
176
			A31266690C9B131A00D15EBF /* PBXTextBookmark */ = A31266690C9B131A00D15EBF /* PBXTextBookmark */;
177
			A312666C0C9B131A00D15EBF /* PBXTextBookmark */ = A312666C0C9B131A00D15EBF /* PBXTextBookmark */;
178
			A330E0560CA96CB400C8A074 /* PBXTextBookmark */ = A330E0560CA96CB400C8A074 /* PBXTextBookmark */;
179
			A3A687270CB0429000478070 /* PBXTextBookmark */ = A3A687270CB0429000478070 /* PBXTextBookmark */;
180
			A3D78CD10CB709FA00A79632 /* PBXTextBookmark */ = A3D78CD10CB709FA00A79632 /* PBXTextBookmark */;
181
			A3D78E650CB72FF100A79632 /* PBXTextBookmark */ = A3D78E650CB72FF100A79632 /* PBXTextBookmark */;
182
			A3D78E860CB7316900A79632 /* PBXTextBookmark */ = A3D78E860CB7316900A79632 /* PBXTextBookmark */;
183
			A3EE6A520C9B3CA800C5C56B /* PBXTextBookmark */ = A3EE6A520C9B3CA800C5C56B /* PBXTextBookmark */;
144 184
		};
145 185
		sourceControlManager = A341617E0C989B510007BEF2 /* Source Control */;
146 186
		userBuildSettings = {
......
148 188
	};
149 189
	00E68290FEC88D7311DB9C8B /* Colonet.java */ = {
150 190
		uiCtxt = {
151
			sepNavIntBoundsRect = "{{0, 0}, {1011, 11522}}";
152
			sepNavSelRange = "{12530, 0}";
153
			sepNavVisRect = "{{0, 4907}, {1011, 643}}";
154
			sepNavWindowFrame = "{{499, 56}, {651, 776}}";
191
			sepNavIntBoundsRect = "{{0, 0}, {1011, 15974}}";
192
			sepNavSelRange = "{10124, 0}";
193
			sepNavVisRect = "{{0, 0}, {1011, 644}}";
194
			sepNavWindowFrame = "{{38, 133}, {613, 699}}";
155 195
		};
156 196
	};
157 197
	00E68291FEC88ED911DB9C8B /* index_colonet.html */ = {
......
198 238
		path = /usr/bin/appletviewer;
199 239
		sourceTree = "<absolute>";
200 240
	};
241
	A30FBFA20CBBDC44000A16EC /* PBXTextBookmark */ = {
242
		isa = PBXTextBookmark;
243
		fRef = A34161900C989CB30007BEF2 /* ColonetServerInterface.java */;
244
		name = "ColonetServerInterface.java: 251";
245
		rLen = 0;
246
		rLoc = 7130;
247
		rType = 0;
248
		vrLen = 1072;
249
		vrLoc = 9011;
250
	};
251
	A30FC0430CBBECA9000A16EC /* PBXTextBookmark */ = {
252
		isa = PBXTextBookmark;
253
		fRef = 00E68290FEC88D7311DB9C8B /* Colonet.java */;
254
		name = "Colonet.java: 98";
255
		rLen = 0;
256
		rLoc = 2449;
257
		rType = 0;
258
		vrLen = 1690;
259
		vrLoc = 2383;
260
	};
261
	A30FC04E0CBBED0C000A16EC /* PBXTextBookmark */ = {
262
		isa = PBXTextBookmark;
263
		fRef = 00E68290FEC88D7311DB9C8B /* Colonet.java */;
264
		name = "Colonet.java: 301";
265
		rLen = 0;
266
		rLoc = 10124;
267
		rType = 0;
268
		vrLen = 1499;
269
		vrLoc = 9227;
270
	};
271
	A30FC0550CBBED7B000A16EC /* PBXTextBookmark */ = {
272
		isa = PBXTextBookmark;
273
		fRef = 00E68290FEC88D7311DB9C8B /* Colonet.java */;
274
		name = "Colonet.java: 300";
275
		rLen = 0;
276
		rLoc = 10124;
277
		rType = 0;
278
		vrLen = 949;
279
		vrLoc = 0;
280
	};
281
	A30FC0560CBBED7B000A16EC /* PBXTextBookmark */ = {
282
		isa = PBXTextBookmark;
283
		fRef = 00E68290FEC88D7311DB9C8B /* Colonet.java */;
284
		name = "Colonet.java: 300";
285
		rLen = 0;
286
		rLoc = 10124;
287
		rType = 0;
288
		vrLen = 0;
289
		vrLoc = 0;
290
	};
201 291
	A31266650C9B131A00D15EBF /* PBXTextBookmark */ = {
202 292
		isa = PBXTextBookmark;
203 293
		fRef = A34161820C989C090007BEF2 /* colonetstyle.css */;
......
213 303
		fRef = A34161900C989CB30007BEF2 /* ColonetServerInterface.java */;
214 304
		name = "ColonetServerInterface.java: 45";
215 305
		rLen = 0;
216
		rLoc = 1124;
306
		rLoc = 1178;
217 307
		rType = 0;
218 308
		vrLen = 1381;
219 309
		vrLoc = 1300;
......
233 323
		fRef = 00E68290FEC88D7311DB9C8B /* Colonet.java */;
234 324
		name = "Colonet.java: 340";
235 325
		rLen = 0;
236
		rLoc = 12540;
326
		rLoc = 12806;
237 327
		rType = 0;
238 328
		vrLen = 790;
239 329
		vrLoc = 755;
......
261 351
	};
262 352
	A34161900C989CB30007BEF2 /* ColonetServerInterface.java */ = {
263 353
		uiCtxt = {
264
			sepNavIntBoundsRect = "{{0, 0}, {1011, 5320}}";
265
			sepNavSelRange = "{7502, 0}";
266
			sepNavVisRect = "{{0, 3444}, {1011, 643}}";
354
			sepNavIntBoundsRect = "{{0, 0}, {1011, 5166}}";
355
			sepNavSelRange = "{7130, 0}";
356
			sepNavVisRect = "{{0, 4522}, {1011, 644}}";
267 357
			sepNavWindowFrame = "{{15, 56}, {651, 776}}";
268 358
		};
269 359
	};
270
	A35611300CB5380B008C739C /* PBXTextBookmark */ = {
360
	A3A687270CB0429000478070 /* PBXTextBookmark */ = {
271 361
		isa = PBXTextBookmark;
272
		fRef = 00E68290FEC88D7311DB9C8B /* Colonet.java */;
273
		name = "Colonet.java: 364";
362
		fRef = 00E68291FEC88ED911DB9C8B /* index_colonet.html */;
363
		name = "index_colonet.html: 12";
274 364
		rLen = 0;
275
		rLoc = 12530;
365
		rLoc = 415;
276 366
		rType = 0;
277
		vrLen = 1365;
278
		vrLoc = 11888;
367
		vrLen = 1681;
368
		vrLoc = 0;
279 369
	};
280
	A35611310CB5380B008C739C /* PBXTextBookmark */ = {
370
	A3D78BA80CB6E4FF00A79632 /* XCBreakpointsBucket */ = {
371
		isa = XCBreakpointsBucket;
372
		name = "Project Breakpoints";
373
		objects = (
374
		);
375
	};
376
	A3D78CD10CB709FA00A79632 /* PBXTextBookmark */ = {
281 377
		isa = PBXTextBookmark;
282 378
		fRef = A34161900C989CB30007BEF2 /* ColonetServerInterface.java */;
283
		name = "ColonetServerInterface.java: 268";
379
		name = "ColonetServerInterface.java: 103";
284 380
		rLen = 0;
285
		rLoc = 7478;
381
		rLoc = 3199;
286 382
		rType = 0;
287
		vrLen = 1173;
288
		vrLoc = 6836;
383
		vrLen = 533;
384
		vrLoc = 3514;
289 385
	};
290
	A35611320CB5380B008C739C /* PBXTextBookmark */ = {
386
	A3D78E650CB72FF100A79632 /* PBXTextBookmark */ = {
291 387
		isa = PBXTextBookmark;
292
		fRef = 00E68290FEC88D7311DB9C8B /* Colonet.java */;
293
		name = "Colonet.java: 364";
294
		rLen = 0;
295
		rLoc = 12530;
296
		rType = 0;
297
		vrLen = 1365;
298
		vrLoc = 11888;
299
	};
300
	A356113A0CB539FC008C739C /* PBXTextBookmark */ = {
301
		isa = PBXTextBookmark;
302 388
		fRef = A34161900C989CB30007BEF2 /* ColonetServerInterface.java */;
303
		name = "ColonetServerInterface.java: 269";
389
		name = "ColonetServerInterface.java: 251";
304 390
		rLen = 0;
305
		rLoc = 7502;
391
		rLoc = 7130;
306 392
		rType = 0;
307
		vrLen = 1052;
308
		vrLoc = 6965;
393
		vrLen = 1077;
394
		vrLoc = 9006;
309 395
	};
310
	A3A687270CB0429000478070 /* PBXTextBookmark */ = {
396
	A3D78E860CB7316900A79632 /* PBXTextBookmark */ = {
311 397
		isa = PBXTextBookmark;
312 398
		fRef = 00E68291FEC88ED911DB9C8B /* index_colonet.html */;
313 399
		name = "index_colonet.html: 12";
314 400
		rLen = 0;
315 401
		rLoc = 415;
316 402
		rType = 0;
317
		vrLen = 1681;
403
		vrLen = 1270;
318 404
		vrLoc = 0;
319 405
	};
320
	A3D78AF00CB6BCBE00A79632 /* PBXTextBookmark */ = {
321
		isa = PBXTextBookmark;
322
		fRef = A34161900C989CB30007BEF2 /* ColonetServerInterface.java */;
323
		name = "ColonetServerInterface.java: 269";
324
		rLen = 0;
325
		rLoc = 7502;
326
		rType = 0;
327
		vrLen = 1050;
328
		vrLoc = 6965;
329
	};
330 406
	A3EE6A520C9B3CA800C5C56B /* PBXTextBookmark */ = {
331 407
		isa = PBXTextBookmark;
332 408
		fRef = 00E68291FEC88ED911DB9C8B /* index_colonet.html */;
trunk/code/projects/colonet/ColonetGUI/Colonet.xcodeproj/gmtress.perspective
226 226
			<key>Layout</key>
227 227
			<array>
228 228
				<dict>
229
					<key>BecomeActive</key>
230
					<true/>
231 229
					<key>ContentConfiguration</key>
232 230
					<dict>
233 231
						<key>PBXBottomSmartGroupGIDs</key>
......
271 269
							<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
272 270
							<array>
273 271
								<array>
274
									<integer>2</integer>
272
									<integer>1</integer>
275 273
									<integer>0</integer>
276 274
								</array>
277 275
							</array>
......
306 304
					<key>Dock</key>
307 305
					<array>
308 306
						<dict>
307
							<key>BecomeActive</key>
308
							<true/>
309 309
							<key>ContentConfiguration</key>
310 310
							<dict>
311 311
								<key>PBXProjectModuleGUID</key>
312 312
								<string>A34161A50C989E610007BEF2</string>
313 313
								<key>PBXProjectModuleLabel</key>
314
								<string>ColonetServerInterface.java</string>
314
								<string>Colonet.java</string>
315 315
								<key>PBXSplitModuleInNavigatorKey</key>
316 316
								<dict>
317 317
									<key>Split0</key>
......
319 319
										<key>PBXProjectModuleGUID</key>
320 320
										<string>A34161A60C989E610007BEF2</string>
321 321
										<key>PBXProjectModuleLabel</key>
322
										<string>ColonetServerInterface.java</string>
322
										<string>Colonet.java</string>
323 323
										<key>_historyCapacity</key>
324 324
										<integer>0</integer>
325 325
										<key>bookmark</key>
326
										<string>A3D78AF00CB6BCBE00A79632</string>
326
										<string>A30FC0550CBBED7B000A16EC</string>
327 327
										<key>history</key>
328 328
										<array>
329 329
											<string>A31266650C9B131A00D15EBF</string>
330
											<string>A3A687270CB0429000478070</string>
331
											<string>A35611300CB5380B008C739C</string>
332
											<string>A356113A0CB539FC008C739C</string>
330
											<string>A3D78E860CB7316900A79632</string>
331
											<string>A30FBFA20CBBDC44000A16EC</string>
332
											<string>A30FC0430CBBECA9000A16EC</string>
333 333
										</array>
334 334
										<key>prevStack</key>
335 335
										<array>
336
											<string>A31266690C9B131A00D15EBF</string>
337 336
											<string>A312666C0C9B131A00D15EBF</string>
338 337
											<string>A3EE6A520C9B3CA800C5C56B</string>
339
											<string>A330E0560CA96CB400C8A074</string>
338
											<string>A3D78E650CB72FF100A79632</string>
340 339
										</array>
341 340
									</dict>
342 341
									<key>SplitCount</key>
......
350 349
							<key>GeometryConfiguration</key>
351 350
							<dict>
352 351
								<key>Frame</key>
353
								<string>{{0, 0}, {1058, 675}}</string>
352
								<string>{{0, 0}, {1058, 676}}</string>
354 353
								<key>RubberWindowFrame</key>
355 354
								<string>0 111 1280 721 0 0 1280 832 </string>
356 355
							</dict>
357 356
							<key>Module</key>
358 357
							<string>PBXNavigatorGroup</string>
359 358
							<key>Proportion</key>
360
							<string>675pt</string>
359
							<string>676pt</string>
361 360
						</dict>
362 361
						<dict>
363 362
							<key>Proportion</key>
......
436 435
			</array>
437 436
			<key>TableOfContents</key>
438 437
			<array>
439
				<string>A3D78AF10CB6BCBE00A79632</string>
438
				<string>A30FC0390CBBEB6D000A16EC</string>
440 439
				<string>1CA23ED40692098700951B8B</string>
441
				<string>A3D78AF20CB6BCBE00A79632</string>
440
				<string>A30FC03A0CBBEB6D000A16EC</string>
442 441
				<string>A34161A50C989E610007BEF2</string>
443
				<string>A3D78AF30CB6BCBE00A79632</string>
442
				<string>A30FC03B0CBBEB6D000A16EC</string>
444 443
				<string>1CA23EDF0692099D00951B8B</string>
445 444
				<string>1CA23EE00692099D00951B8B</string>
446 445
				<string>1CA23EE10692099D00951B8B</string>
......
505 504
							<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
506 505
							<array>
507 506
								<array>
508
									<integer>1</integer>
507
									<integer>2</integer>
509 508
									<integer>0</integer>
510 509
								</array>
511 510
							</array>
......
553 552
										<key>_historyCapacity</key>
554 553
										<integer>0</integer>
555 554
										<key>bookmark</key>
556
										<string>A35611250CB3E0A6008C739C</string>
555
										<string>A30FC0560CBBED7B000A16EC</string>
557 556
										<key>history</key>
558 557
										<array>
559 558
											<string>A31266650C9B131A00D15EBF</string>
560 559
											<string>A3A687270CB0429000478070</string>
561
											<string>A356111A0CB3E092008C739C</string>
562
											<string>A3E52AE60CB3DD9C00A1BC2C</string>
560
											<string>A3D78CD10CB709FA00A79632</string>
561
											<string>A30FC04E0CBBED0C000A16EC</string>
563 562
										</array>
564 563
										<key>prevStack</key>
565 564
										<array>
......
567 566
											<string>A312666C0C9B131A00D15EBF</string>
568 567
											<string>A3EE6A520C9B3CA800C5C56B</string>
569 568
											<string>A330E0560CA96CB400C8A074</string>
570
											<string>A356111B0CB3E092008C739C</string>
571 569
										</array>
572 570
									</dict>
573 571
									<key>SplitCount</key>
......
581 579
							<key>GeometryConfiguration</key>
582 580
							<dict>
583 581
								<key>Frame</key>
584
								<string>{{0, 0}, {1008, 522}}</string>
582
								<string>{{0, 0}, {1008, 0}}</string>
585 583
							</dict>
586 584
							<key>Module</key>
587 585
							<string>PBXNavigatorGroup</string>
588 586
							<key>Proportion</key>
589
							<string>522pt</string>
587
							<string>0pt</string>
590 588
						</dict>
591 589
						<dict>
592 590
							<key>Proportion</key>
593
							<string>153pt</string>
591
							<string>676pt</string>
594 592
							<key>Tabs</key>
595 593
							<array>
596 594
								<dict>
......
608 606
									<key>GeometryConfiguration</key>
609 607
									<dict>
610 608
										<key>Frame</key>
611
										<string>{{10, 27}, {1008, 126}}</string>
609
										<string>{{10, 27}, {0, -27}}</string>
612 610
									</dict>
613 611
									<key>Module</key>
614 612
									<string>PBXBuildResultsModule</string>
......
661 659
									<key>GeometryConfiguration</key>
662 660
									<dict>
663 661
										<key>Frame</key>
664
										<string>{{10, 27}, {1008, 126}}</string>
662
										<string>{{10, 27}, {1008, 649}}</string>
665 663
									</dict>
666 664
									<key>Module</key>
667 665
									<string>PBXRunSessionModule</string>
......
688 686
			</array>
689 687
			<key>TableOfContents</key>
690 688
			<array>
691
				<string>A35611260CB3E0A6008C739C</string>
689
				<string>A30FC0470CBBECAC000A16EC</string>
692 690
				<string>1CA23EE50692099D00951B8B</string>
693
				<string>A35611270CB3E0A6008C739C</string>
691
				<string>A30FC0480CBBECAC000A16EC</string>
694 692
				<string>A34161AC0C989F140007BEF2</string>
695
				<string>A35611280CB3E0A6008C739C</string>
693
				<string>A30FC0490CBBECAC000A16EC</string>
696 694
				<string>XCMainBuildResultsModuleGUID</string>
697 695
				<string>1CA23EE80692099D00951B8B</string>
698
				<string>A35611290CB3E0A6008C739C</string>
696
				<string>A30FC04A0CBBECAC000A16EC</string>
699 697
			</array>
700 698
			<key>ToolbarConfiguration</key>
701 699
			<string>xcode.toolbar.config.buildAndRun</string>
......
826 824
			</array>
827 825
			<key>TableOfContents</key>
828 826
			<array>
829
				<string>A37E8A5E0CAB0F3300CE6680</string>
827
				<string>A3D78B860CB6E3B100A79632</string>
830 828
				<string>1CCC7628064C1048000F2A68</string>
831 829
				<string>1CCC7629064C1048000F2A68</string>
832
				<string>A37E8A5F0CAB0F3300CE6680</string>
833
				<string>A37E8A600CAB0F3300CE6680</string>
834
				<string>A37E8A610CAB0F3300CE6680</string>
835
				<string>A37E8A620CAB0F3300CE6680</string>
836
				<string>A37E8A400CAB0E2800CE6680</string>
837
				<string>A37E8A630CAB0F3300CE6680</string>
830
				<string>A3D78B870CB6E3B100A79632</string>
831
				<string>A3D78B880CB6E3B100A79632</string>
832
				<string>A3D78B890CB6E3B100A79632</string>
833
				<string>A3D78B8A0CB6E3B100A79632</string>
834
				<string>A34161AC0C989F140007BEF2</string>
835
				<string>A3D78B8B0CB6E3B100A79632</string>
838 836
			</array>
839 837
			<key>ToolbarConfiguration</key>
840 838
			<string>xcode.toolbar.config.debug</string>
......
1160 1158
			<string>743 379 452 308 0 0 1280 1002 </string>
1161 1159
		</dict>
1162 1160
		<dict>
1161
			<key>FirstTimeWindowDisplayed</key>
1162
			<false/>
1163 1163
			<key>Identifier</key>
1164 1164
			<string>windowTool.breakpoints</string>
1165 1165
			<key>IsVertical</key>
......
1170 1170
					<key>Dock</key>
1171 1171
					<array>
1172 1172
						<dict>
1173
							<key>BecomeActive</key>
1174
							<true/>
1175 1173
							<key>ContentConfiguration</key>
1176 1174
							<dict>
1177 1175
								<key>PBXBottomSmartGroupGIDs</key>
......
1225 1223
									<real>168</real>
1226 1224
								</array>
1227 1225
								<key>RubberWindowFrame</key>
1228
								<string>315 424 744 409 0 0 1440 878 </string>
1226
								<string>31 398 744 409 0 0 1280 832 </string>
1229 1227
							</dict>
1230 1228
							<key>Module</key>
1231 1229
							<string>PBXSmartGroupTreeModule</string>
......
1233 1231
							<string>185pt</string>
1234 1232
						</dict>
1235 1233
						<dict>
1234
							<key>BecomeActive</key>
1235
							<true/>
1236 1236
							<key>ContentConfiguration</key>
1237 1237
							<dict>
1238 1238
								<key>PBXProjectModuleGUID</key>
......
1245 1245
								<key>Frame</key>
1246 1246
								<string>{{190, 0}, {554, 368}}</string>
1247 1247
								<key>RubberWindowFrame</key>
1248
								<string>315 424 744 409 0 0 1440 878 </string>
1248
								<string>31 398 744 409 0 0 1280 832 </string>
1249 1249
							</dict>
1250 1250
							<key>Module</key>
1251 1251
							<string>XCDetailModule</string>
......
1272 1272
			<true/>
1273 1273
			<key>TableOfContents</key>
1274 1274
			<array>
1275
				<string>1CDDB66807F98D9800BB5817</string>
1276
				<string>1CDDB66907F98D9800BB5817</string>
1275
				<string>A3D78B9F0CB6E4DC00A79632</string>
1276
				<string>A3D78BA00CB6E4DC00A79632</string>
1277 1277
				<string>1CE0B1FE06471DED0097A5F4</string>
1278 1278
				<string>1CA1AED706398EBD00589147</string>
1279 1279
			</array>
1280 1280
			<key>ToolbarConfiguration</key>
1281 1281
			<string>xcode.toolbar.config.breakpoints</string>
1282 1282
			<key>WindowString</key>
1283
			<string>315 424 744 409 0 0 1440 878 </string>
1283
			<string>31 398 744 409 0 0 1280 832 </string>
1284 1284
			<key>WindowToolGUID</key>
1285
			<string>1CDDB66807F98D9800BB5817</string>
1285
			<string>A3D78B9F0CB6E4DC00A79632</string>
1286 1286
			<key>WindowToolIsVisible</key>
1287
			<true/>
1287
			<false/>
1288 1288
		</dict>
1289 1289
		<dict>
1290 1290
			<key>Identifier</key>
......
1368 1368
								<key>PBXProjectModuleGUID</key>
1369 1369
								<string>1CA6456E063B45B4001379D8</string>
1370 1370
								<key>PBXProjectModuleLabel</key>
1371
								<string>Class Browser - javax.swing.AbstractAction</string>
1371
								<string>Class Browser - java.awt.im.InputContext</string>
1372 1372
							</dict>
1373 1373
							<key>GeometryConfiguration</key>
1374 1374
							<dict>
1375 1375
								<key>ClassesFrame</key>
1376
								<string>{{0, 0}, {364, 96}}</string>
1376
								<string>{{0, 0}, {845, 96}}</string>
1377 1377
								<key>ClassesTreeTableConfiguration</key>
1378 1378
								<array>
1379 1379
									<string>PBXClassNameColumnIdentifier</string>
......
1382 1382
									<real>22</real>
1383 1383
								</array>
1384 1384
								<key>Frame</key>
1385
								<string>{{0, 0}, {616, 354}}</string>
1385
								<string>{{0, 0}, {1097, 558}}</string>
1386 1386
								<key>MembersFrame</key>
1387
								<string>{{0, 101}, {364, 253}}</string>
1387
								<string>{{0, 101}, {845, 457}}</string>
1388 1388
								<key>MembersTreeTableConfiguration</key>
1389 1389
								<array>
1390 1390
									<string>PBXMemberTypeIconColumnIdentifier</string>
......
1392 1392
									<string>PBXMemberNameColumnIdentifier</string>
1393 1393
									<real>216</real>
1394 1394
									<string>PBXMemberTypeColumnIdentifier</string>
1395
									<real>87</real>
1395
									<real>568</real>
1396 1396
									<string>PBXMemberBookColumnIdentifier</string>
1397 1397
									<real>22</real>
1398 1398
								</array>
1399 1399
								<key>RubberWindowFrame</key>
1400
								<string>34 620 616 374 0 0 1680 1028 </string>
1400
								<string>21 231 1097 578 0 0 1280 832 </string>
1401 1401
							</dict>
1402 1402
							<key>Module</key>
1403 1403
							<string>PBXClassBrowserModule</string>
1404 1404
							<key>Proportion</key>
1405
							<string>354pt</string>
1405
							<string>558pt</string>
1406 1406
						</dict>
1407 1407
					</array>
1408 1408
					<key>Proportion</key>
1409
					<string>354pt</string>
1409
					<string>558pt</string>
1410 1410
				</dict>
1411 1411
			</array>
1412 1412
			<key>Name</key>
......
1420 1420
			<key>TableOfContents</key>
1421 1421
			<array>
1422 1422
				<string>A30387EF0CAB061700E9D9D2</string>
1423
				<string>A3A687140CB0373B00478070</string>
1423
				<string>A3D78E830CB7312B00A79632</string>
1424 1424
				<string>1CA6456E063B45B4001379D8</string>
1425 1425
			</array>
1426 1426
			<key>ToolbarConfiguration</key>
1427 1427
			<string>xcode.toolbar.config.classbrowser</string>
1428 1428
			<key>WindowString</key>
1429
			<string>34 620 616 374 0 0 1680 1028 </string>
1429
			<string>21 231 1097 578 0 0 1280 832 </string>
1430 1430
			<key>WindowToolGUID</key>
1431 1431
			<string>A30387EF0CAB061700E9D9D2</string>
1432 1432
			<key>WindowToolIsVisible</key>
trunk/code/projects/colonet/ColonetGUI/Colonet.java
3 3
//
4 4

  
5 5
import javax.swing.*;
6
import javax.swing.event.*;
6 7
import java.awt.*;
7 8
import java.awt.image.*;
8 9
import java.awt.event.*;
......
11 12
import java.util.Random;
12 13
import java.applet.*;
13 14

  
14
public class Colonet extends JApplet implements ActionListener, MouseListener, Runnable {
15
public class Colonet extends JApplet implements ActionListener, MouseInputListener, Runnable {
15 16

  
16 17
	final int CANVAS_SIZE = 500;  //don't make this too large, or the applet will be slow.
17 18
	final int BUFFER = 50;
......
44 45
	JTabbedPane tabPaneControl;
45 46
	JPanel panelRobotControl;
46 47
	JPanel panelRobotDirection;
48
	JPanel panelRobotDirectionButtons;
47 49
	JPanel panelRobotCommands;
48 50
	JButton btnF, btnB, btnL, btnR, btnActivate;
49 51
	JComboBox cmbRobotNum;
52
	VectorController vectorController;
53
	BufferedImage imageVectorControl;
50 54
	
51 55
	// Task Manager
52 56
	JPanel panelTaskManager;
......
59 63
	JButton btnRemoveTask;
60 64
	JButton btnMoveTaskUp;
61 65
	JButton btnMoveTaskDown;
66
	JButton btnUpdateTasks;
67
	TaskAddWindow taskAddWindow;
62 68
	
63 69
	// Graphics
64
	JPanel panel;
70
	ImagePanel panel;
65 71
	GraphicsConfiguration gc;
66 72
	volatile BufferedImage image;
67 73
	volatile Graphics2D canvas;
68 74
	int cx, cy;
69 75
	
70 76
	Socket socket;					
71
	OutputStreamWriter out;			//TODO: add a BufferedWriter
77
	OutputStreamWriter out;
72 78
	DataUpdater dataUpdater;  
73 79
	
74 80
	Font botFont;
......
77 83
	volatile int numBots;
78 84
	volatile int selectedBot;  //the user has selected this bot
79 85
	volatile Rectangle[] botRect;  //contains boundary shapes around bots for click detection
86
	volatile int[] xbeeID;
80 87
	
81 88
	Thread drawThread;
82 89
	Simulator simulator;
......
86 93

  
87 94
	
88 95
	public void init () {
89
		// set the default look and feel
90
        String laf = UIManager.getSystemLookAndFeelClassName();
96
		// set the default look and feel - choose one
97
        //String laf = UIManager.getSystemLookAndFeelClassName();
98
		//String laf = UIManager.getCrossPlatformLookAndFeelClassName();
99
		String laf = "com.sun.java.swing.plaf.motif.MotifLookAndFeel";
91 100
        try {
92 101
            UIManager.setLookAndFeel(laf);
93 102
        } catch (UnsupportedLookAndFeelException exc) {
......
107 116
			//Not really sure why we would be in this situation
108 117
			System.out.println(e);
109 118
		} catch (java.lang.reflect.InvocationTargetException e) {
110
			//This should never happen. Seriously.
111
			System.out.println(e);
119
			//This could happen for various reasons if there is a problem in createAndShowGUI
120
			e.printStackTrace();
112 121
		}
113 122
	}
114 123
	
......
120 129

  
121 130
	private synchronized void createAndShowGUI () {
122 131
		// init graphical elements
123
		panel = new JPanel(false);  //set automatic double-buffering to false. we are doing it manually.
132
		// Get the graphics configuration of the screen to create a buffer
133
		gc = GraphicsEnvironment.getLocalGraphicsEnvironment()
134
			.getDefaultScreenDevice().getDefaultConfiguration();
135
		image = gc.createCompatibleImage(CANVAS_SIZE,CANVAS_SIZE);
136
		canvas = image.createGraphics();
137
		canvas.setStroke(new BasicStroke(2));  //set pen width
138
		panel = new ImagePanel(false, image);  //set automatic double-buffering to false. we are doing it manually.
124 139
		
140
		// Calculate center of canvas
141
		cx = image.getWidth() / 2;
142
		cy = image.getHeight() / 2;
143
		
144
		botFont = new Font("Arial", Font.PLAIN, 14);
145
		tokenLoc = 0;
146
		numBots = 0;
147
		selectedBot = 0;
148
		
125 149
		// Connection area
126
		txtMatrix = new JTextArea("- 9 3 - 1\n- - - 5 -\n4 - - - 2\n- - - - -\n1 - - 3 -");
150
		txtMatrix = new JTextArea();
127 151
		txtMatrix.setBorder(BorderFactory.createTitledBorder("Input Matrix"));
128 152
		txtInfo = new JTextArea();
129 153
		txtInfo.setBorder(BorderFactory.createTitledBorder("Info"));
......
164 188

  
165 189
		// Robot direction panel
166 190
		panelRobotDirection = new JPanel();
191
		panelRobotDirectionButtons = new JPanel();
167 192
		btnF = new JButton("^");
168 193
		btnB = new JButton("v");
169 194
		btnL = new JButton("<");
170 195
		btnR = new JButton(">");
171 196
		btnActivate = new JButton("o");
172
		panelRobotDirection = new JPanel();
173
		panelRobotDirection.setLayout(new GridLayout(3,3));
174
		panelRobotDirection.add(new JLabel(""));
175
		panelRobotDirection.add(btnF);
176
		panelRobotDirection.add(new JLabel(""));
177
		panelRobotDirection.add(btnL);
178
		panelRobotDirection.add(btnActivate);
179
		panelRobotDirection.add(btnR);
180
		panelRobotDirection.add(new JLabel(""));
181
		panelRobotDirection.add(btnB);
182
		panelRobotDirection.add(new JLabel(""));
197
		panelRobotDirectionButtons.setLayout(new GridLayout(1,5));
198
		panelRobotDirectionButtons.add(btnActivate);
199
		panelRobotDirectionButtons.add(btnF);
200
		panelRobotDirectionButtons.add(btnB);
201
		panelRobotDirectionButtons.add(btnL);
202
		panelRobotDirectionButtons.add(btnR);
183 203
		
204
		imageVectorControl = gc.createCompatibleImage(380, 210);
205
		vectorController = new VectorController(imageVectorControl);
206
		panelRobotDirection.setLayout(new BorderLayout());
207
		panelRobotDirection.add(vectorController, BorderLayout.CENTER);
208
		panelRobotDirection.add(panelRobotDirectionButtons, BorderLayout.SOUTH);
209
		
184 210
		// Robot Control and Commands
185 211
		panelRobotCommands = new JPanel();
186 212
		panelRobotCommands.setLayout(new FlowLayout());
......
196 222
		panelTaskManager = new JPanel();
197 223
		panelTaskManager.setLayout(new BorderLayout());
198 224
		taskListModel = new DefaultListModel();
199
		taskListModel.addElement("Map the Environment");
200
		taskListModel.addElement("Clean Up Chemical Spill");
201
		taskListModel.addElement("Grow Plants");
202
		taskListModel.addElement("Save the Cheerleader");
203
		taskListModel.addElement("Save the World");
204 225
		taskList = new JList(taskListModel);
205 226
		taskList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
206 227
		taskList.setSelectedIndex(0);
207 228
		spTaskManager = new JScrollPane(taskList);
208 229
		panelTaskManagerControls = new JPanel();
209
		panelTaskManagerControls.setLayout(new GridLayout(1,3));
230
		panelTaskManagerControls.setLayout(new GridLayout(1,4));
210 231
		panelTaskManagerControlsPriority = new JPanel();
211 232
		panelTaskManagerControlsPriority.setLayout(new GridLayout(1,2));
212 233
		btnAddTask = new JButton("Add...");
213 234
		btnRemoveTask = new JButton("Remove");
214 235
		btnMoveTaskUp = new JButton("^");
215 236
		btnMoveTaskDown = new JButton("v");
237
		btnUpdateTasks = new JButton("Update");
216 238
		panelTaskManagerControlsPriority.add(btnMoveTaskUp);
217 239
		panelTaskManagerControlsPriority.add(btnMoveTaskDown);
218 240
		panelTaskManagerControls.add(btnAddTask);
219 241
		panelTaskManagerControls.add(btnRemoveTask);
242
		panelTaskManagerControls.add(btnUpdateTasks);
220 243
		panelTaskManagerControls.add(panelTaskManagerControlsPriority);
221 244
		panelTaskManager.add(spTaskManager, BorderLayout.CENTER);
222 245
		panelTaskManager.add(panelTaskManagerControls, BorderLayout.SOUTH);
223 246
		panelTaskManager.add(new JLabel("Current Task Queue"), BorderLayout.NORTH);
224 247
		
248
		// Task Manager Add Window
249
		taskAddWindow = new TaskAddWindow();
250
		
225 251
		// Message log
226 252
		log = new JTextArea();
227 253
		spLog = new JScrollPane(log,
......
235 261
		panelControl = new JPanel();
236 262
		panelControl.setLayout(new GridLayout(1,1));
237 263
		tabPaneControl = new JTabbedPane(JTabbedPane.TOP);
238
		tabPaneControl.setPreferredSize(new Dimension(300, 0));
264
		tabPaneControl.setPreferredSize(new Dimension(400, 0));
239 265
		tabPaneControl.addTab("Connection", panelServerInterface);
240 266
		tabPaneControl.addTab("Robots", panelRobotControl);
241 267
		tabPaneControl.addTab("Tasks", panelTaskManager);
......
258 284
		btnRemoveTask.addActionListener(this);
259 285
		btnMoveTaskUp.addActionListener(this);
260 286
		btnMoveTaskDown.addActionListener(this);
287
		btnUpdateTasks.addActionListener(this);
261 288
		// Robot Control
262 289
		btnF.addActionListener(this);
263 290
		btnB.addActionListener(this);
264 291
		btnL.addActionListener(this);
265 292
		btnR.addActionListener(this);
266 293
		btnActivate.addActionListener(this);
294
		vectorController.addMouseMotionListener(this);
295
		vectorController.addMouseListener(this);
267 296
		// Other
268 297
		btnGraph.addActionListener(this);
269 298
		btnConnect.addActionListener(this);
270 299
		panel.addMouseListener(this);
300
		this.addMouseMotionListener(this);	
271 301
		
272
		
273
		// Get the graphics configuration of the screen to create a buffer
274
		gc = GraphicsEnvironment.getLocalGraphicsEnvironment()
275
			.getDefaultScreenDevice().getDefaultConfiguration();
276
		image = gc.createCompatibleImage(CANVAS_SIZE,CANVAS_SIZE);
277
		canvas = image.createGraphics();
278
		canvas.setStroke(new BasicStroke(2));  //set pen width
279
		
280
		// Calculate center of canvas
281
		cx = image.getWidth() / 2;
282
		cy = image.getHeight() / 2;
283
		
284
		botFont = new Font("Arial", Font.PLAIN, 30);
285
		tokenLoc = 0;
286
		numBots = 0;
287
		selectedBot = 0;
288
		
302
				
289 303
		// Set up dependent threads
290 304
		indicator = new SelectionIndicator(canvas);
291 305
		indicator.setRadius(RADIUS+3, 15);  //a tad more than the bot radius
292 306
		packetMonitor = new PacketMonitor();
293 307
		simulator = new Simulator();
294 308
		
295
		csi = new ColonetServerInterface(log, txtMatrix);
309
		csi = new ColonetServerInterface(this);
296 310
	
297 311
	}
298 312
	
299 313
	public synchronized void paint (Graphics g) {
300
		/*	First, redraw the graphical components in the applet. 
314
		/*	Redraw the graphical components in the applet. 
301 315
			This paint method overrides the built-in paint of the 
302 316
			JApplet, and we don't want to deal with redrawing the
303 317
			components manually. Fuck that shit. */
318
		step();
304 319
		super.paint(g);
305
		
306
		// Place the buffered image on the screen, inside the panel
307
		panel.getGraphics().drawImage(image, 0, 0, Color.WHITE, this);
308
		
309 320
	}
310 321
	
311 322
	public synchronized void update (Graphics g) {
......
317 328
		if (source == btnGraph) {
318 329
			btnGraph.setEnabled(false);
319 330
			lblConnectionStatus.setText("Simulating");
320
			
331
			//create sample matrix and xbee map
332
			parseMatrix(ColonetServerInterface.RESPONSE_TO_CLIENT_REQUEST + " " + 
333
				ColonetServerInterface.REQUEST_BOM_MATRIX + 
334
				" 5 -1 9 3 -1 1 -1 -1 -1 5 -1 4 -1 -1 -1 2 -1 -1 -1 -1 -1 1 -1 -1 3 -1");
335
			parseXBeeIDs(ColonetServerInterface.RESPONSE_TO_CLIENT_REQUEST + " " + 
336
				ColonetServerInterface.REQUEST_XBEE_IDS +
337
				" 5 12345 76543 98786 87690 2");
321 338
			//Start dependent threads
322 339
			drawThread = new Thread(this, "drawThread");
323 340
			drawThread.start();
......
328 345
			doSocket();
329 346
			dataUpdater = new DataUpdater();
330 347
			dataUpdater.start();
331
		} else if (source == btnRemoveTask) {
332
			try {
333
				taskListModel.remove(taskList.getSelectedIndex());
334
			} catch (ArrayIndexOutOfBoundsException ex) {
335
			}
348
		}
336 349
			
337
		// Robot controls
338
		} else if (source == btnF) {
339
			csi.sendData(ColonetServerInterface.MOTOR1_SET + " 0 200", ColonetServerInterface.GLOBAL_DEST);
340
			csi.sendData(ColonetServerInterface.MOTOR2_SET + " 0 200", ColonetServerInterface.GLOBAL_DEST);
350
		// Robot Movement Controls
351
		else if (source == btnF) {
352
			vectorController.setMaxForward();
353
			vectorController.sendToServer();
341 354
		} else if (source == btnB) {
342
			csi.sendData(ColonetServerInterface.MOTOR1_SET + " 1 200", ColonetServerInterface.GLOBAL_DEST);
343
			csi.sendData(ColonetServerInterface.MOTOR2_SET + " 1 200", ColonetServerInterface.GLOBAL_DEST);
355
			vectorController.setMaxReverse();
356
			vectorController.sendToServer();
344 357
		} else if (source == btnL) {
345
			csi.sendData(ColonetServerInterface.MOTOR1_SET + " 1 200", ColonetServerInterface.GLOBAL_DEST);
346
			csi.sendData(ColonetServerInterface.MOTOR2_SET + " 0 200", ColonetServerInterface.GLOBAL_DEST);
358
			vectorController.setMaxLeft();
359
			vectorController.sendToServer();
347 360
		} else if (source == btnR) {
348
			csi.sendData(ColonetServerInterface.MOTOR1_SET + " 0 200", ColonetServerInterface.GLOBAL_DEST);
349
			csi.sendData(ColonetServerInterface.MOTOR2_SET + " 1 200", ColonetServerInterface.GLOBAL_DEST);
361
			vectorController.setMaxRight();
362
			vectorController.sendToServer();
350 363
		} else if (source == btnActivate) {
351
			csi.sendData(ColonetServerInterface.MOTOR1_SET + " 0 0", ColonetServerInterface.GLOBAL_DEST);
352
			csi.sendData(ColonetServerInterface.MOTOR2_SET + " 0 0", ColonetServerInterface.GLOBAL_DEST);
364
			vectorController.setZero();
365
			vectorController.sendToServer();
366
		}
353 367
			
354
			
355 368
		// Queue Management
356
		} else if (source == btnAddTask) {
357
			String description = JOptionPane.showInputDialog("Description of new task");
358
			String data = JOptionPane.showInputDialog("Command and data for new task");
359
			csi.sendQueueAdd(0, data, description);
369
		else if (source == btnAddTask) {
370
			taskAddWindow.prompt();
360 371
		} else if (source == btnRemoveTask) {
361
			csi.sendQueueRemove(0);
372
			if (taskList.getSelectedIndex() >= 0);
373
				csi.sendQueueRemove(taskList.getSelectedIndex());
374
			csi.sendQueueUpdate();
362 375
		} else if (source == btnMoveTaskUp) {
363
			csi.sendQueueReorder(0, 1);
376
			csi.sendQueueReorder(taskList.getSelectedIndex(), taskList.getSelectedIndex() - 1);
377
			csi.sendQueueUpdate();
364 378
		} else if (source == btnMoveTaskDown) {
365
		
366
		
379
			csi.sendQueueReorder(taskList.getSelectedIndex(), taskList.getSelectedIndex() + 1);
380
			csi.sendQueueUpdate();
381
		} else if (source == btnUpdateTasks) {
382
			csi.sendQueueUpdate();
367 383
		}
368 384
	}
369 385
	
......
401 417
		
402 418
		//draw the label
403 419
		canvas.setFont(botFont);
404
		canvas.drawString("" + id, x-10, y+10);
420
		try {
421
			canvas.drawString("" + xbeeID[id], x-20, y+2);
422
		} catch (Exception e) {
423
			canvas.drawString("???", x-22, y+2);
424
		}
405 425
	}
406 426
	
407 427
	public void drawConnection (int start, int end, int radius, Color color) {
......
448 468
	
449 469
	public void run () {
450 470
		while (true) {
451
			step();
452 471
			repaint();
453 472
			try { 
454 473
				Thread.sleep(90);
......
539 558
		packetMonitor.addTokenPass();
540 559
	}
541 560
	
561
	public JTextArea getLog () {
562
		return log;
563
	}
564
	
565
	public JTextArea getMatrixInput () {
566
		return txtMatrix;
567
	}
568
	
569
	public void parseMatrix (String line) {
570
		txtMatrix.setText("");
571
		String [] str = line.split(" ");
572
		int num = Integer.parseInt(str[2]);
573
		for (int i = 0; i < num; i++) {
574
			for (int j = 0; j < num; j++) {
575
				String next = str[3 + i*num + j];
576
				if (next.equals("-1"))
577
					txtMatrix.append("-");
578
				else 
579
					txtMatrix.append(next);
580
				if (j < num - 1) 
581
					txtMatrix.append(" ");
582
			}
583
			if (i < num - 1) 
584
				txtMatrix.append("\n");
585
		}
586
		
587
	}
588
	
589
	public void parseQueue (String line) {
590
		log.append("Got queue update\n");
591
	
592
	}
593
	
594
	public void parseXBeeIDs (String line) {
595
		log.append("Got XBee ID map: " + line + "\n");
596
		String [] str = line.split(" ");
597
		int num = Integer.parseInt(str[2]);
598
		xbeeID = new int[num];
599
		for (int i = 0; i < num; i++)
600
			xbeeID[i] = Integer.parseInt(str[i+3]);
601
		
602
		//update the list of robots to control
603
		cmbRobotNum.removeAllItems();
604
		cmbRobotNum.addItem(new String("   All   "));
605
		for (int i = 0; i < num; i++)
606
			cmbRobotNum.addItem(new String("" + xbeeID[i]));
607
	}
608
	
542 609
	//
543 610
	// MouseEvent methods
544 611
	//
545 612
	public void mouseExited(MouseEvent e) {}
546 613
	public void mouseEntered(MouseEvent e) {}
547
	public void mouseReleased(MouseEvent e) {}
548
	public void mouseClicked(MouseEvent e) {}
614
	public void mouseReleased(MouseEvent e) {
615
		vectorController.sendToServer();
616
	}
617
	public void mouseClicked(MouseEvent e) {
618
		mouseDragged(e);
619
	}
549 620
	public void mousePressed(MouseEvent e) {
550 621
		try {
551 622
			for (int i = 0; i < numBots; i++) {
......
557 628
		}
558 629
	
559 630
	}
631
	public void mouseDragged(MouseEvent e) {
632
		vectorController.setPoint(e.getX(), e.getY());
633
		vectorController.repaint();
634
	}
635
	public void mouseMoved(MouseEvent e) {}
560 636
	
637
	
561 638
	/*
562 639
	*	SelectionIndicator thread.
563 640
	*	Graphical representation of the selection marker
......
808 885
			while (true) {
809 886
				try {
810 887
					//request more data
811
					if (csi.isReady())
888
					if (csi.isReady()) {
812 889
						csi.sendSensorDataRequest();
890
						csi.sendXBeeIDRequest();
891
					}
813 892
					Thread.sleep(DATAUPDATER_DELAY);
814 893
				} catch (InterruptedException e) {
815 894
					return;
......
818 897
		}
819 898

  
820 899
	}
900
	
901
	/*
902
	*	ImagePanel class
903
	*	Enables more efficient image handling in a component-controlled environment
904
	*/
905
	class ImagePanel extends JPanel {
906
		protected Image img;
907
	
908
		public ImagePanel (Image img) {
909
			super();
910
			this.img = img;
911
		}
912
		
913
		public ImagePanel (boolean isDoubleBuffered, Image img) {
914
			super(isDoubleBuffered);
915
			this.img = img;
916
		}
917
		
918
		public void paint (Graphics g) {
919
			// Place the buffered image on the screen, inside the panel
920
			g.drawImage(img, 0, 0, Color.WHITE, this);
921
		}
922
	
923
	}
924
	
925
	/*
926
	*	VectorController class
927
	*	Manages robot motion control graphically
928
	*/
929
	class VectorController extends ImagePanel {
930
		int x, y, cx, cy;
931
		int width, height;
932
		int side;
933
		
934
		public VectorController (Image img) {
935
			super (img);
936
			width = img.getWidth(null);
937
			height = img.getHeight(null);
938
			cx = img.getWidth(null)/2;
939
			cy = img.getHeight(null)/2;
940
			x = cx;
941
			y = cy;
942
			if (width < height)
943
				side = width;
944
			else
945
				side = height;
946
		}
947
		
948
		public void setPoint (int x, int y) {
949
			if (!isValidPoint(x, y))
950
				return;
951
			this.x = x;
952
			this.y = y;
953
			repaint();
954
		}
955
		
956
		public boolean isValidPoint (int x, int y) {
957
			double xterm = Math.pow(1.0*(x - cx)/(side/2), 2);
958
			double yterm = Math.pow(1.0*(y - cy)/(side/2), 2);
959
			return (xterm + yterm <= 1);
960
		}
961
		
962
		public int getVelocity () {
963
			int dx = x - cx;
964
			int dy = y - cy;
965
			int v = (int) Math.sqrt( Math.pow(dx, 2) + Math.pow(dy, 2) );
966
			return v;
967
		}
968
		
969
		public double getAngle () {
970
			int dx = x - cx;
971
			int dy = cy - y;
972
			double theta = Math.atan2(Math.abs(dx), Math.abs(dy));
973
			theta = (int) (1.0 * theta * 180 / Math.PI);  //transform to degrees
974
			if (dy < 0)
975
				theta = 180 - theta;
976
			theta *= Math.signum(dx);
977
			return theta;
978
		}
979
		
980
		public void paint (Graphics g) {
981
			g.setColor(Color.BLACK);
982
			g.fillRect(0, 0, width, height);
983
			((Graphics2D)g).setStroke(new BasicStroke(1));
984
			g.setColor(Color.RED);
985
			g.drawOval(cx-side/2, cy-side/2, side, side);
986
			((Graphics2D)g).setStroke(new BasicStroke(2));
987
			g.setColor(Color.GREEN);
988
			g.drawLine(cx, cy, x, y);
989
			g.fillOval(x-3, y-3, 6, 6);
990
		}
991
		
992
		public void setMaxForward () {
993
			setPoint(cx, cy - (side/2) + 1);
994
		}
995
		
996
		public void setMaxReverse () {
997
			setPoint(cx, cy + (side/2) - 1);
998
		}
999
		
1000
		public void setMaxLeft () {
1001
			setPoint(cx - (side/2) + 1, cy);
1002
		}
1003
		
1004
		public void setMaxRight () {
1005
			setPoint(cx + (side/2) - 1, cy);
1006
		}
1007
		
1008
		public void setZero () {
1009
			setPoint(cx, cy);
1010
		}
1011
		
1012
		public void sendToServer () {
1013
			if (csi != null)
1014
				csi.sendData(ColonetServerInterface.MOVE + " " + 
1015
					vectorController.getAngle() + " " + 
1016
					vectorController.getVelocity(), ColonetServerInterface.GLOBAL_DEST);
1017
		}
1018
	
1019
	}
1020
	
1021
	/*
1022
	*	TaskAddWindow class
1023
	*	makes it easy to add tasks to the queue
1024
	*/
1025
	class TaskAddWindow extends JFrame implements ActionListener, ListSelectionListener {
1026
		JPanel panelButtons;
1027
		JPanel panelParameters;
1028
		JPanel panelSouth;
1029
		JPanel panelSelection;
1030
		JButton btnSubmit;
1031
		JButton btnCancel;
1032
		DefaultListModel availableListModel;
1033
		JList availableList;
1034
		JScrollPane spAvailableTasks;
1035
		JTextArea txtDescription;
1036
		JTextField txtParameters;
1037
		MouseListener mouseListener;
1038
		
1039
		public TaskAddWindow () {
1040
			super("Add a Task ... if you dare!");
1041
			super.setSize(500,500);
1042
			super.setLayout(new BorderLayout());
1043
			
1044
			// set up buttons
1045
			btnSubmit = new JButton("Submit");
1046
			btnCancel = new JButton("Cancel");
1047
			panelButtons = new JPanel();
1048
			panelButtons.setLayout(new FlowLayout());
1049
			panelButtons.add(btnSubmit);
1050
			panelButtons.add(btnCancel);
1051
			this.getRootPane().setDefaultButton(btnSubmit);
1052
			
1053
			// set up task list
1054
			availableListModel = new DefaultListModel();
1055
			availableListModel.addElement("Map the Environment");
1056
			availableListModel.addElement("Clean Up Chemical Spill");
1057
			availableListModel.addElement("Grow Plants");
1058
			availableListModel.addElement("Save the Cheerleader");
1059
			availableListModel.addElement("Save the World");
1060
			availableList = new JList(availableListModel);
1061
			availableList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
1062
			availableList.setSelectedIndex(-1);
1063
			spAvailableTasks = new JScrollPane(availableList);
1064
			spAvailableTasks.setBorder(BorderFactory.createTitledBorder("Select A Task"));
1065
			txtDescription = new JTextArea();
1066
			txtDescription.setEditable(false);
1067
			txtDescription.setLineWrap(true);
1068
			txtDescription.setWrapStyleWord(true);
1069
			txtDescription.setBorder(BorderFactory.createTitledBorder("Description"));
1070
			
1071
			//set up parameter area
1072
			panelParameters = new JPanel();
1073
			panelParameters.setLayout(new BorderLayout());
1074
			txtParameters = new JTextField();
1075
			panelParameters.add(new JLabel("Optional parameters for this task: "), BorderLayout.WEST);
1076
			panelParameters.add(txtParameters);
1077
			
1078
			// assemble objects
1079
			panelSelection = new JPanel();
1080
			panelSelection.setLayout(new GridLayout(1,2));
1081
			panelSelection.add(spAvailableTasks);
1082
			panelSelection.add(txtDescription);
1083
			
1084
			panelSouth = new JPanel();
1085
			panelSouth.setLayout(new GridLayout(2,1));
1086
			panelSouth.add(panelParameters);
1087
			panelSouth.add(panelButtons);
1088
			
1089
			this.getContentPane().add(panelSouth, BorderLayout.SOUTH);
1090
			this.getContentPane().add(panelSelection, BorderLayout.CENTER);
1091
			this.setLocationRelativeTo(null);
1092
			
1093
			// add listeners here
1094
			availableList.addListSelectionListener(this);
1095
			btnSubmit.addActionListener(this);
1096
			btnCancel.addActionListener(this);
1097
		}
1098
		
1099
		public void prompt () {
1100
			this.setVisible(true);
1101
		}
1102
		
1103
		private String getDescription (int index) {
1104
			if (index < 0)
1105
				return "";
1106
			switch (index) {
1107
				case 0: return "SLAM and junk";
1108
				case 1: return "I'm not sure this works";
1109
				case 2: return "Push them into the light";
1110
				case 3: return "Watch out for clock repair guys";
1111
				case 4: return "But make sure he's dead, geez, why would you let him get away? I mean come on, "
1112
					+"he's just lying there and everyone's too busy looking at people flying through the sky to "
1113
					+"notice? Oh yeah, that's a good transition to a new season, let's make the audience think "
1114
					+"he's dead and then pull a fast one on them, they'll never see that coming.";
1115
			
1116
				default: return "Task not recognized";
1117
			}
1118
		}
1119
		
1120
		public void actionPerformed (ActionEvent e) {
1121
			Object source = e.getSource();
1122
			if (source == btnSubmit) {
1123
				txtParameters.setText(txtParameters.getText().trim());
1124
				
1125
				
1126
				this.setVisible(false);
1127
			} else if (source == btnCancel) {
1128
				this.setVisible(false);
1129
			}
1130
		}
1131
		
1132
		public void valueChanged (ListSelectionEvent e) {
1133
			int index = availableList.getSelectedIndex();
1134
			if (index >= 0)
1135
				txtDescription.setText(getDescription(index));
1136
		}
1137
	
1138
	}
821 1139

  
822 1140
}
trunk/code/projects/colonet/ColonetGUI/ColonetServerInterface.java
43 43
	public static final String REQUEST_FROM_SERVER = "1";
44 44
	public static final String RESPONSE_TO_CLIENT_REQUEST = "2";
45 45
	public static final String REQUEST_BOM_MATRIX = "144";
46
	public static final String REQUEST_XBEE_IDS = "144";
46 47
	
47 48
	public static final String COLONET_COMMAND = "13"; //0x0D
48 49
	public static final String COLONET_REQUEST = "14"; //0x0E
......
87 88
	public static final String ORB_SET_NUM = "21"; //0x15
88 89
	public static final String ORB_SEND = "22"; //0x16
89 90

  
90
	
91
		
92
	Colonet colonet;  //save the entire applet locally
91 93
	Socket socket;
92 94
	OutputStreamWriter out;
93 95
	BufferedReader reader;
94 96
	DataListener dataListener;
95 97
	JTextArea log, txtMatrix;
96 98
	
99
	
97 100
	/*
98 101
	*	FUNCTION IMPLEMENTATIONS
99 102
	*/
100 103

  
101
	public ColonetServerInterface (JTextArea log, JTextArea txtMatrix) {
102
		this.log = log;
103
		this.txtMatrix = txtMatrix;
104
	public ColonetServerInterface (Colonet colonet) {
105
		this.colonet = colonet;
106
		this.log = colonet.getLog();
107
		this.txtMatrix = colonet.getMatrixInput();
104 108
		dataListener = new DataListener();
105 109
	}
106 110

  
......
251 255
		sendRequest(ColonetServerInterface.REQUEST_BOM_MATRIX, "");
252 256
	}
253 257
	
258
	public void sendXBeeIDRequest () {
259
		sendRequest(ColonetServerInterface.REQUEST_XBEE_IDS, "");
260
	}
261
	
254 262
	/*
255 263
	*	Queue management
256 264
	*/
......
289 297
		sendQueueInstruction(packet);
290 298
	}
291 299

  
300
	public void sendQueueUpdate () {
301
		sendQueueInstruction(ColonetServerInterface.QUEUE_UPDATE);
302
	}
292 303
	
293
	
294 304
	/**
295 305
	 * Display informational message box on the screen. Used for casual communicaton to the user.
296 306
	 * @param text Text to display
......
344 354
		
345 355
		public void parseData (String line) {
346 356
			log.append("Incoming data: [" + line + "]\n");
347
			if (line.startsWith(ColonetServerInterface.RESPONSE_TO_CLIENT_REQUEST + " " 
348
				+ ColonetServerInterface.REQUEST_BOM_MATRIX))
349
				parseMatrix(line);
357
			if (line.startsWith(ColonetServerInterface.RESPONSE_TO_CLIENT_REQUEST + " " +
358
				ColonetServerInterface.REQUEST_BOM_MATRIX))
359
				colonet.parseMatrix(line);
350 360
			if (line.startsWith(ColonetServerInterface.COLONET_QUEUE))
351
				parseQueue(line);
361
				colonet.parseQueue(line);
362
			if (line.startsWith(ColonetServerInterface.RESPONSE_TO_CLIENT_REQUEST + " " +
363
				ColonetServerInterface.REQUEST_XBEE_IDS))
364
				colonet.parseXBeeIDs(line);
352 365
		}
353
		
354
		public void parseMatrix (String line) {
355
			txtMatrix.setText("");
356
			String [] str = line.split(" ");
357
			int num = Integer.parseInt(str[2]);
358
			for (int i = 0; i < num; i++) {
359
				for (int j = 0; j < num; j++) {
360
					String next = str[3 + i*num + j];
361
					if (next.equals("-1"))
362
						txtMatrix.append("-");
363
					else 
364
						txtMatrix.append(next);
365
					if (j < num - 1) 
366
						txtMatrix.append(" ");
367
				}
368
				if (i < num - 1) 
369
					txtMatrix.append("\n");
370
			}
371
		}
372
		
373
		public void parseQueue (String line) {
374
			log.append("Got queue data\n");
375
		
376
		}
377 366

  
378 367
	}
379 368

  

Also available in: Unified diff