File: ogldiag.cpp

package info (click to toggle)
pgadmin3 1.20.0~beta2-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 73,704 kB
  • ctags: 18,591
  • sloc: cpp: 193,786; ansic: 18,736; sh: 5,154; pascal: 1,120; yacc: 927; makefile: 516; lex: 421; xml: 126; perl: 40
file content (736 lines) | stat: -rw-r--r-- 17,295 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
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
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
//////////////////////////////////////////////////////////////////////////
//
// pgAdmin III - PostgreSQL Tools
//
// Portions Copyright (C) 1998 - 2011, Julian Smart
// Portions Copyright (C) 2011 - 2014, The pgAdmin Development Team
// This software is released under the PostgreSQL Licence
//
// ogldiag.cpp - wxDiagram
//
//////////////////////////////////////////////////////////////////////////

#include "pgAdmin3.h"

#include <ctype.h>
#include <math.h>
#include <stdlib.h>

#include "ogl/ogl.h"


IMPLEMENT_DYNAMIC_CLASS(wxDiagram, wxObject)

// Object canvas
wxDiagram::wxDiagram()
{
	m_diagramCanvas = NULL;
	m_quickEditMode = FALSE;
	m_snapToGrid = TRUE;
	m_gridSpacing = 5.0;
	m_shapeList = new wxList;
	m_mouseTolerance = DEFAULT_MOUSE_TOLERANCE;
}

wxDiagram::~wxDiagram()
{
	if (m_shapeList)
		delete m_shapeList;
}

void wxDiagram::SetSnapToGrid(bool snap)
{
	m_snapToGrid = snap;
}

void wxDiagram::SetGridSpacing(double spacing)
{
	m_gridSpacing = spacing;
}

void wxDiagram::Snap(double *x, double *y)
{
	if (m_snapToGrid)
	{
		*x = m_gridSpacing * ((int)(*x / m_gridSpacing + 0.5));
		*y = m_gridSpacing * ((int)(*y / m_gridSpacing + 0.5));
	}
}


void wxDiagram::Redraw(wxDC &dc)
{
	if (m_shapeList)
	{
		if (GetCanvas())
			GetCanvas()->SetCursor(* wxHOURGLASS_CURSOR);
		wxNode *current = m_shapeList->GetFirst();

		while (current)
		{
			wxShape *object = (wxShape *)current->GetData();
			if (!object->GetParent())
				object->Draw(dc);

			current = current->GetNext();
		}
		if (GetCanvas())
			GetCanvas()->SetCursor(* wxSTANDARD_CURSOR);
	}
}

void wxDiagram::Clear(wxDC &dc)
{
	dc.Clear();
}

// Insert object after addAfter, or at end of list.
void wxDiagram::AddShape(wxShape *object, wxShape *addAfter)
{
	wxNode *nodeAfter = NULL;


	if (addAfter)
	{
#if wxCHECK_VERSION(2, 9, 0)
		nodeAfter = m_shapeList->Find(addAfter);
#else
		nodeAfter = m_shapeList->Member(addAfter);
#endif
	}

	if (!m_shapeList->Member(object))
	{
		if (nodeAfter)
		{
			if (nodeAfter->GetNext())
				m_shapeList->Insert(nodeAfter->GetNext(), object);
			else
				m_shapeList->Append(object);
		}
		else
			m_shapeList->Append(object);
		object->SetCanvas(GetCanvas());
	}
}

void wxDiagram::InsertShape(wxShape *object)
{
	m_shapeList->Insert(object);
	object->SetCanvas(GetCanvas());
}

void wxDiagram::RemoveShape(wxShape *object)
{
	m_shapeList->DeleteObject(object);
	object->RemoveChildren();
}

// Should this delete the actual objects too? I think not.
void wxDiagram::RemoveAllShapes()
{
	m_shapeList->Clear();
}

void wxDiagram::DeleteAllShapes()
{
	wxNode *node = m_shapeList->GetFirst();
	while (node)
	{
		wxShape *shape = (wxShape *)node->GetData();
		if (!shape->GetParent())
		{
			RemoveShape(shape);
			delete shape;
			node = m_shapeList->GetFirst();
		}
		else
			node = node->GetNext();
	}
}

void wxDiagram::ShowAll(bool show)
{
	wxNode *current = m_shapeList->GetFirst();

	while (current)
	{
		wxShape *object = (wxShape *)current->GetData();
		object->Show(show);

		current = current->GetNext();
	}
}

void wxDiagram::DrawOutline(wxDC &dc, double x1, double y1, double x2, double y2)
{
	wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
	dc.SetPen(dottedPen);
	dc.SetBrush((* wxTRANSPARENT_BRUSH));

	wxPoint points[5];

	points[0].x = (int) x1;
	points[0].y = (int) y1;

	points[1].x = (int) x2;
	points[1].y = (int) y1;

	points[2].x = (int) x2;
	points[2].y = (int) y2;

	points[3].x = (int) x1;
	points[3].y = (int) y2;

	points[4].x = (int) x1;
	points[4].y = (int) y1;
	dc.DrawLines(5, points);
}

// Make sure all text that should be centred, is centred.
void wxDiagram::RecentreAll(wxDC &dc)
{
	wxNode *object_node = m_shapeList->GetFirst();
	while (object_node)
	{
		wxShape *obj = (wxShape *)object_node->GetData();
		obj->Recentre(dc);
		object_node = object_node->GetNext();
	}
}

// Input/output
#if wxUSE_PROLOGIO
bool wxDiagram::SaveFile(const wxString &filename)
{
	wxBeginBusyCursor();

	wxExprDatabase *database = new wxExprDatabase;

	// First write the diagram type
	wxExpr *header = new wxExpr(wxT("diagram"));
	OnHeaderSave(*database, *header);

	database->Append(header);

	wxNode *node = m_shapeList->GetFirst();
	while (node)
	{
		wxShape *shape = (wxShape *)node->GetData();

		if (!shape->IsKindOf(CLASSINFO(wxControlPoint)))
		{
			wxExpr *expr;
			if (shape->IsKindOf(CLASSINFO(wxLineShape)))
				expr = new wxExpr(wxT("line"));
			else
				expr = new wxExpr(wxT("shape"));

			OnShapeSave(*database, *shape, *expr);
		}
		node = node->GetNext();
	}
	OnDatabaseSave(*database);

	wxString tempFile;
	wxGetTempFileName(wxT("diag"), tempFile);
	FILE *file = fopen(tempFile.mb_str(wxConvFile), "w");
	if (! file)
	{
		wxEndBusyCursor();
		delete database;
		return FALSE;
	}

	database->Write(file);
	fclose(file);
	delete database;

	/*
	  // Save backup
	  if (FileExists(filename))
	  {
	    char buf[400];
	#ifdef __X__
	    sprintf(buf, "%s.bak", filename);
	#endif
	#ifdef __WXMSW__
	    sprintf(buf, "_diagram.bak");
	#endif
	    if (FileExists(buf)) wxRemoveFile(buf);
	    if (!wxRenameFile(filename, buf))
	    {
	      wxCopyFile(filename, buf);
	      wxRemoveFile(filename);
	    }
	  }
	*/

	// Copy the temporary file to the correct filename
	if (!wxRenameFile(tempFile, filename))
	{
		wxCopyFile(tempFile, filename);
		wxRemoveFile(tempFile);
	}

	wxEndBusyCursor();
	return TRUE;
}

bool wxDiagram::LoadFile(const wxString &filename)
{
	wxBeginBusyCursor();

	wxExprDatabase database(wxExprInteger, wxT("id"));
	if (!database.Read(filename))
	{
		wxEndBusyCursor();
		return FALSE;
	}

	DeleteAllShapes();

	database.BeginFind();
	wxExpr *header = database.FindClauseByFunctor(wxT("diagram"));

	if (header)
		OnHeaderLoad(database, *header);

	// Scan through all clauses and register the ids
	wxNode *node = database.GetFirst();
	while (node)
	{
		wxExpr *clause = (wxExpr *)node->GetData();
		long id = -1;
		clause->GetAttributeValue(wxT("id"), id);
		wxRegisterId(id);
		node = node->GetNext();
	}

	ReadNodes(database);
	ReadContainerGeometry(database);
	ReadLines(database);

	OnDatabaseLoad(database);

	wxEndBusyCursor();

	return TRUE;
}

void wxDiagram::ReadNodes(wxExprDatabase &database)
{
	// Find and create the node images
	database.BeginFind();
	wxExpr *clause = database.FindClauseByFunctor(wxT("shape"));
	while (clause)
	{
		wxChar *type = NULL;
		long parentId = -1;

		clause->AssignAttributeValue(wxT("type"), &type);
		clause->AssignAttributeValue(wxT("parent"), &parentId);
		wxClassInfo *classInfo = wxClassInfo::FindClass(type);
		if (classInfo)
		{
			wxShape *shape = (wxShape *)classInfo->CreateObject();
			OnShapeLoad(database, *shape, *clause);

			shape->SetCanvas(GetCanvas());
			shape->Show(TRUE);

			m_shapeList->Append(shape);

			// If child of composite, link up
			if (parentId > -1)
			{
				wxExpr *parentExpr = database.HashFind(wxT("shape"), parentId);
				if (parentExpr && parentExpr->GetClientData())
				{
					wxShape *parent = (wxShape *)parentExpr->GetClientData();
					shape->SetParent(parent);
					parent->GetChildren().Append(shape);
				}
			}

			clause->SetClientData(shape);
		}
		if (type)
			delete[] type;

		clause = database.FindClauseByFunctor(wxT("shape"));
	}
	return;
}

void wxDiagram::ReadLines(wxExprDatabase &database)
{
	database.BeginFind();
	wxExpr *clause = database.FindClauseByFunctor(wxT("line"));
	while (clause)
	{
		wxString type;
		long parentId = -1;

		clause->GetAttributeValue(wxT("type"), type);
		clause->GetAttributeValue(wxT("parent"), parentId);
		wxClassInfo *classInfo = wxClassInfo::FindClass(type);
		if (classInfo)
		{
			wxLineShape *shape = (wxLineShape *)classInfo->CreateObject();
			shape->Show(TRUE);

			OnShapeLoad(database, *shape, *clause);
			shape->SetCanvas(GetCanvas());

			long image_to = -1;
			long image_from = -1;
			clause->GetAttributeValue(wxT("to"), image_to);
			clause->GetAttributeValue(wxT("from"), image_from);

			wxExpr *image_to_expr = database.HashFind(wxT("shape"), image_to);

			if (!image_to_expr)
			{
				// Error
			}
			wxExpr *image_from_expr = database.HashFind(wxT("shape"), image_from);

			if (!image_from_expr)
			{
				// Error
			}

			if (image_to_expr && image_from_expr)
			{
				wxShape *image_to_object = (wxShape *)image_to_expr->GetClientData();
				wxShape *image_from_object = (wxShape *)image_from_expr->GetClientData();

				if (image_to_object && image_from_object)
				{
					image_from_object->AddLine(shape, image_to_object, shape->GetAttachmentFrom(), shape->GetAttachmentTo());
				}
			}
			clause->SetClientData(shape);

			m_shapeList->Append(shape);
		}

		clause = database.FindClauseByFunctor(wxT("line"));
	}
}

// Containers have divisions that reference adjoining divisions,
// so we need a separate pass to link everything up.
// Also used by Symbol Library.
void wxDiagram::ReadContainerGeometry(wxExprDatabase &database)
{
	database.BeginFind();
	wxExpr *clause = database.FindClauseByFunctor(wxT("shape"));
	while (clause)
	{
		wxShape *image = (wxShape *)clause->GetClientData();
		if (image && image->IsKindOf(CLASSINFO(wxCompositeShape)))
		{
			wxCompositeShape *composite = (wxCompositeShape *)image;
			wxExpr *divisionExpr = NULL;

			// Find the list of divisions in the composite
			clause->GetAttributeValue(wxT("divisions"), &divisionExpr);
			if (divisionExpr)
			{
				int i = 0;
				wxExpr *idExpr = divisionExpr->Nth(i);
				while (idExpr)
				{
					long divisionId = idExpr->IntegerValue();
					wxExpr *childExpr = database.HashFind(wxT("shape"), divisionId);
					if (childExpr && childExpr->GetClientData())
					{
						wxDivisionShape *child = (wxDivisionShape *)childExpr->GetClientData();
						composite->GetDivisions().Append(child);

						// Find the adjoining shapes
						long leftSideId = -1;
						long topSideId = -1;
						long rightSideId = -1;
						long bottomSideId = -1;
						childExpr->GetAttributeValue(wxT("left_side"), leftSideId);
						childExpr->GetAttributeValue(wxT("top_side"), topSideId);
						childExpr->GetAttributeValue(wxT("right_side"), rightSideId);
						childExpr->GetAttributeValue(wxT("bottom_side"), bottomSideId);
						if (leftSideId > -1)
						{
							wxExpr *leftExpr = database.HashFind(wxT("shape"), leftSideId);
							if (leftExpr && leftExpr->GetClientData())
							{
								wxDivisionShape *leftSide = (wxDivisionShape *)leftExpr->GetClientData();
								child->SetLeftSide(leftSide);
							}
						}
						if (topSideId > -1)
						{
							wxExpr *topExpr = database.HashFind(wxT("shape"), topSideId);
							if (topExpr && topExpr->GetClientData())
							{
								wxDivisionShape *topSide = (wxDivisionShape *)topExpr->GetClientData();
								child->SetTopSide(topSide);
							}
						}
						if (rightSideId > -1)
						{
							wxExpr *rightExpr = database.HashFind(wxT("shape"), rightSideId);
							if (rightExpr && rightExpr->GetClientData())
							{
								wxDivisionShape *rightSide = (wxDivisionShape *)rightExpr->GetClientData();
								child->SetRightSide(rightSide);
							}
						}
						if (bottomSideId > -1)
						{
							wxExpr *bottomExpr = database.HashFind(wxT("shape"), bottomSideId);
							if (bottomExpr && bottomExpr->GetClientData())
							{
								wxDivisionShape *bottomSide = (wxDivisionShape *)bottomExpr->GetClientData();
								child->SetBottomSide(bottomSide);
							}
						}
					}
					i ++;
					idExpr = divisionExpr->Nth(i);
				}
			}
		}

		clause = database.FindClauseByFunctor(wxT("shape"));
	}
}

// Allow for modifying file
bool wxDiagram::OnDatabaseLoad(wxExprDatabase &WXUNUSED(db))
{
	return TRUE;
}

bool wxDiagram::OnDatabaseSave(wxExprDatabase &WXUNUSED(db))
{
	return TRUE;
}

bool wxDiagram::OnShapeSave(wxExprDatabase &db, wxShape &shape, wxExpr &expr)
{
	shape.WriteAttributes(&expr);
	db.Append(&expr);

	if (shape.IsKindOf(CLASSINFO(wxCompositeShape)))
	{
		wxNode *node = shape.GetChildren().GetFirst();
		while (node)
		{
			wxShape *childShape = (wxShape *)node->GetData();
			wxExpr *childExpr = new wxExpr(wxT("shape"));
			OnShapeSave(db, *childShape, *childExpr);
			node = node->GetNext();
		}
	}

	return TRUE;
}

bool wxDiagram::OnShapeLoad(wxExprDatabase &WXUNUSED(db), wxShape &shape, wxExpr &expr)
{
	shape.ReadAttributes(&expr);
	return TRUE;
}

bool wxDiagram::OnHeaderSave(wxExprDatabase &WXUNUSED(db), wxExpr &WXUNUSED(expr))
{
	return TRUE;
}

bool wxDiagram::OnHeaderLoad(wxExprDatabase &WXUNUSED(db), wxExpr &WXUNUSED(expr))
{
	return TRUE;
}

#endif

void wxDiagram::SetCanvas(wxShapeCanvas *can)
{
	m_diagramCanvas = can;
}

// Find a shape by its id
wxShape *wxDiagram::FindShape(long id) const
{
	wxNode *node = GetShapeList()->GetFirst();
	while (node)
	{
		wxShape *shape = (wxShape *) node->GetData();
		if (shape->GetId() == id)
			return shape;
		node = node->GetNext();
	}
	return NULL;
}


//// Crossings classes

wxLineCrossings::wxLineCrossings()
{
}

wxLineCrossings::~wxLineCrossings()
{
	ClearCrossings();
}

void wxLineCrossings::FindCrossings(wxDiagram &diagram)
{
	ClearCrossings();
	wxNode *node1 = diagram.GetShapeList()->GetFirst();
	while (node1)
	{
		wxShape *shape1 = (wxShape *) node1->GetData();
		if (shape1->IsKindOf(CLASSINFO(wxLineShape)))
		{
			wxLineShape *lineShape1 = (wxLineShape *) shape1;
			// Iterate through the segments
			wxList *pts1 = lineShape1->GetLineControlPoints();
			size_t i;
			for (i = 0; i < (pts1->GetCount() - 1); i++)
			{
				wxRealPoint *pt1_a = (wxRealPoint *) (pts1->Item(i)->GetData());
				wxRealPoint *pt1_b = (wxRealPoint *) (pts1->Item(i + 1)->GetData());

				// Now we iterate through the segments again

				wxNode *node2 = diagram.GetShapeList()->GetFirst();
				while (node2)
				{
					wxShape *shape2 = (wxShape *) node2->GetData();

					// Assume that the same line doesn't cross itself
					if (shape2->IsKindOf(CLASSINFO(wxLineShape)) && (shape1 != shape2))
					{
						wxLineShape *lineShape2 = (wxLineShape *) shape2;
						// Iterate through the segments
						wxList *pts2 = lineShape2->GetLineControlPoints();
						int j;
						for (j = 0; j < (int) (pts2->GetCount() - 1); j++)
						{
							wxRealPoint *pt2_a = (wxRealPoint *) (pts2->Item(j)->GetData());
							wxRealPoint *pt2_b = (wxRealPoint *) (pts2->Item(j + 1)->GetData());

							// Now let's see if these two segments cross.
							double ratio1, ratio2;
							oglCheckLineIntersection(pt1_a->x, pt1_a->y, pt1_b->x, pt1_b->y,
							                         pt2_a->x, pt2_a->y, pt2_b->x, pt2_b->y,
							                         & ratio1, & ratio2);

							if ((ratio1 < 1.0) && (ratio1 > -1.0))
							{
								// Intersection!
								wxLineCrossing *crossing = new wxLineCrossing;
								crossing->m_intersect.x = (pt1_a->x + (pt1_b->x - pt1_a->x) * ratio1);
								crossing->m_intersect.y = (pt1_a->y + (pt1_b->y - pt1_a->y) * ratio1);

								crossing->m_pt1 = * pt1_a;
								crossing->m_pt2 = * pt1_b;
								crossing->m_pt3 = * pt2_a;
								crossing->m_pt4 = * pt2_b;

								crossing->m_lineShape1 = lineShape1;
								crossing->m_lineShape2 = lineShape2;

								m_crossings.Append(crossing);
							}
						}
					}
					node2 = node2->GetNext();
				}
			}
		}

		node1 = node1->GetNext();
	}
}

void wxLineCrossings::DrawCrossings(wxDiagram &WXUNUSED(diagram), wxDC &dc)
{
	dc.SetBrush(*wxTRANSPARENT_BRUSH);

	long arcWidth = 8;

	wxNode *node = m_crossings.GetFirst();
	while (node)
	{
		wxLineCrossing *crossing = (wxLineCrossing *) node->GetData();
//        dc.DrawEllipse((long) (crossing->m_intersect.x - (arcWidth/2.0) + 0.5), (long) (crossing->m_intersect.y - (arcWidth/2.0) + 0.5),
//           arcWidth, arcWidth);


		// Let's do some geometry to find the points on either end of the arc.
		/*

		(x1, y1)
		    |\
		    | \
		    |  \
		    |   \
		    |    \
		    |    |\ c    c1
		    |  a | \
		         |  \
		    |     -  x <-- centre of arc
		 a1 |     b  |\
		    |        | \ c2
		    |     a2 |  \
		    |         -  \
		    |         b2  \
		    |              \
		    |_______________\ (x2, y2)
		          b1

		*/

		double a1 = wxMax(crossing->m_pt1.y, crossing->m_pt2.y) - wxMin(crossing->m_pt1.y, crossing->m_pt2.y) ;
		double b1 = wxMax(crossing->m_pt1.x, crossing->m_pt2.x) - wxMin(crossing->m_pt1.x, crossing->m_pt2.x) ;
		double c1 = sqrt( (a1 * a1) + (b1 * b1) );

		double c = arcWidth / 2.0;
		double a = c * a1 / c1 ;
		double b = c * b1 / c1 ;

		// I'm not sure this is right, since we don't know which direction we should be going in - need
		// to know which way the line slopes and choose the sign appropriately.
		double arcX1 = crossing->m_intersect.x - b;
		double arcY1 = crossing->m_intersect.y - a;

		double arcX2 = crossing->m_intersect.x + b;
		double arcY2 = crossing->m_intersect.y + a;

		dc.SetPen(*wxBLACK_PEN);
		dc.DrawArc( (long) arcX1, (long) arcY1, (long) arcX2, (long) arcY2,
		            (long) crossing->m_intersect.x, (long) crossing->m_intersect.y);

		dc.SetPen(*wxWHITE_PEN);
		dc.DrawLine( (long) arcX1, (long) arcY1, (long) arcX2, (long) arcY2 );

		node = node->GetNext();
	}
}

void wxLineCrossings::ClearCrossings()
{
	wxNode *node = m_crossings.GetFirst();
	while (node)
	{
		wxLineCrossing *crossing = (wxLineCrossing *) node->GetData();
		delete crossing;
		node = node->GetNext();
	}
	m_crossings.Clear();
}