public void Update()
{
Drawing.Width = width * Scale;
Drawing.Height = height * Scale;
Drawing.OpenLayers();
var nodes = Nodes.Where(n => n != null).ToArray();
var segments = Segments.Where(n => n != null).ToArray();
foreach (TrafficNode node in nodes)
{
node.Update();
}
foreach (TrafficSegment segment in segments.OrderBy(m => (m?.Description as TrafficSegmentDescription)?.Type))
{
segment.Update();
}
var layer = Drawing.GetLayer(DrawingLayer.Outlines);
var rect = new System.Windows.Rect(0, 0, Drawing.Width, Drawing.Height);
rect.Inflate(-10.0, -10.0);
layer.DrawRectangle(null, new Pen(Brushes.HotPink, 1), rect);
Drawing.CloseLayers();
//Drawing.InvalidateVisual();
}