/// <summary>
        ///     Draw a Rectangle
        /// </summary>
        /// <param name="transition"></param>
        /// <autor>Thomas Meents, Krystian Zielonka</autor>
        private ExtendedThumb DrawTransition(Transition transition)
        {
            String        name            = transition.Name.Trim();
            ExtendedThumb transitionThumb = new ExtendedThumb
            {
                Name   = "Transition",
                Width  = Settings.Default.TransitionWidth,
                Height = Settings.Default.TransitionHeight
            };

            transitionThumb.Margin   = new Thickness(-transitionThumb.Width / 2, -transitionThumb.Height / 2, 0, 0);
            transitionThumb.Template = GetTransitionTemplate();

            transitionThumb.ToolTip = name;

            transitionThumb.SetValue(ContentControl.ContentProperty, name);

            ContextMenu contextMenu = new ContextMenu();
            Label       labelText   = new Label {
                Content = name
            };

            contextMenu.Items.Add(labelText);
            transitionThumb.ContextMenu = contextMenu;

            return(transitionThumb);
        }
        /// <summary>
        ///     Draw a Ellipse
        /// </summary>
        /// <param Name="myCanvas"></param>
        /// <param name="place"></param>
        /// <autor>Thomas Meents, Krystian Zielonka</autor>
        private ExtendedThumb DrawPlace(Place place)
        {
            String        name       = place.Name.Trim();
            ExtendedThumb placeThumb = new ExtendedThumb
            {
                Name   = "Place",
                Width  = Settings.Default.PlaceRadius,
                Height = Settings.Default.PlaceRadius
            };

            placeThumb.Margin   = new Thickness(-placeThumb.Width / 2);
            placeThumb.Template = GetPlaceTemplate();
            placeThumb.SetValue(ContentControl.ContentProperty, name);
            placeThumb.InternName = place.ToString();

            return(placeThumb);
        }
        /// <summary>
        ///     This event listener is called when a thumb was dragged and is now being dropped.
        ///     It updates the Left and Top values and also checks if the canvas has to be enlarged for the Thumb to fit.
        ///     It also stores the new values in the Nodes for future drawing.
        /// </summary>
        /// <autor>Krystian Zielonka, Jannik Arndt</autor>
        protected void DragAndDropThumb(object sender, DragDeltaEventArgs e)
        {
            Canvas parent = ((Thumb)sender).Parent as Canvas;

            if (parent == null)
            {
                return;
            }

            ExtendedThumb thumb = (ExtendedThumb)sender;

            // If the element is dragged beyond the bottom border
            if (Canvas.GetTop(thumb) > parent.Height)
            {
                parent.Height = parent.Height + thumb.Height + 20;
            }

            // If the element is dragged beyond the right border
            if (Canvas.GetLeft(thumb) > parent.Width)
            {
                parent.Width = parent.Width + thumb.Width + 20;
            }

            // If the element is dragged beyond the left border
            if (Canvas.GetLeft(thumb) < 0)
            {
                parent.Width = parent.Width + (Canvas.GetLeft(thumb) * -1) + thumb.Width + 20;
            }

            // Calculate the point in the grid, where the Thumb snaps to.
            int newX = NearestMultiple(Canvas.GetLeft(thumb) + e.HorizontalChange, Settings.Default.ColumnWidth / 2);
            int newY = NearestMultiple(Canvas.GetTop(thumb) + e.VerticalChange, Settings.Default.RowHeight / 2);

            // Place Thumb in Canvas
            Canvas.SetLeft(thumb, newX);
            Canvas.SetTop(thumb, newY);

            // Update values in the original Node
            thumb.BaseNode.PositionX = newX;
            thumb.BaseNode.PositionY = newY;
        }
        /// <summary>
        /// The method returns a list of points for a given list of affected places
        /// </summary>
        /// <param name="listOfPlacesWithBadLines">List fo places</param>
        /// <param name="conformanceCheckingCanvas">Canvas</param>
        /// <returns></returns>
        /// <autor>Andrej Albrecht</autor>
        private List <Point2D> GetListWithPointsFromCanvas(List <Place> listOfPlacesWithBadLines, Canvas conformanceCheckingCanvas)
        {
            List <Point2D> listWithPointsFrom = new List <Point2D>();

            foreach (Object child in conformanceCheckingCanvas.Children)
            {
                ExtendedThumb thumb = child as ExtendedThumb;
                if (thumb != null && thumb.Name.Equals("Place"))
                {
                    foreach (Place place in listOfPlacesWithBadLines)
                    {
                        if (thumb.InternName.Equals(place.ToString()))
                        {
                            listWithPointsFrom.Add(new Point2D(Canvas.GetLeft(thumb), Canvas.GetTop(thumb)));
                        }
                    }
                }
            }

            return(listWithPointsFrom);
        }