Beispiel #1
0
        private void EndDrawingPolygon(object sender, RoutedEventArgs e)
        {
            DisableSettingVerticles();

            if (_currentPolygon.Vertexes.Count <= 2)
            {
                foreach (var edge in _currentPolygon.Edges)
                {
                    canvas.Children.Remove(edge.Lin);
                    _currentPolygon = new Polygon();
                    return;
                }
            }

            if (_currentPolygon.Vertexes.Count != _currentPolygon.Edges.Count)
            {
                Vertex firstVertex  = _currentPolygon.GetFirstVertex();
                Vertex lastVerticle = _currentPolygon.GetLastVertex();

                _currentPolygon.AddNewEdge(firstVertex, lastVerticle,
                                           CreateEdgeLine(firstVertex.Coordinates, lastVerticle.Coordinates));
            }

            _polygons.Add(_currentPolygon);
            _currentPolygon = new Polygon();
        }
Beispiel #2
0
 private void StartDrawingPolygon(object sender, RoutedEventArgs e)
 {
     _currentPolygon             = new Polygon();
     canvas.MouseLeftButtonDown += SetVerticle;
 }