Bladeren bron

0.0.3

+ Добавлена возможность рисования рёбер
+ Добавлена возможность рисования направленных графов (Вид - Направленность)
+ Добавлен экспорт в PNG

- Поехал холст (thx XAML)
0nt0n 5 jaren geleden
bovenliggende
commit
15aa680f16
35 gewijzigde bestanden met toevoegingen van 995 en 115 verwijderingen
  1. BIN
      .vs/Drawer/v16/.suo
  2. BIN
      .vs/GraphDrawer/v16/.suo
  3. BIN
      .vs/GraphDrawer/v16/Server/sqlite3/storage.ide
  4. BIN
      .vs/slnx.sqlite
  5. 105 0
      GraphDrawer/ArrowLine.cs
  6. 176 0
      GraphDrawer/ArrowLineBase.cs
  7. 36 0
      GraphDrawer/Edge.cs
  8. 23 10
      GraphDrawer/GraphByClick.xaml
  9. 217 36
      GraphDrawer/GraphByClick.xaml.cs
  10. 3 0
      GraphDrawer/GraphDrawer.csproj
  11. 14 0
      GraphDrawer/GraphState.cs
  12. 8 8
      GraphDrawer/MainWindow.xaml
  13. 20 6
      GraphDrawer/MainWindow.xaml.cs
  14. BIN
      GraphDrawer/bin/Debug/GraphDrawer.exe
  15. BIN
      GraphDrawer/bin/Debug/GraphDrawer.pdb
  16. BIN
      GraphDrawer/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
  17. BIN
      GraphDrawer/obj/Debug/GraphByClick.baml
  18. 105 20
      GraphDrawer/obj/Debug/GraphByClick.g.cs
  19. 105 20
      GraphDrawer/obj/Debug/GraphByClick.g.i.cs
  20. BIN
      GraphDrawer/obj/Debug/GraphDrawer.csprojAssemblyReference.cache
  21. BIN
      GraphDrawer/obj/Debug/GraphDrawer.exe
  22. BIN
      GraphDrawer/obj/Debug/GraphDrawer.g.resources
  23. BIN
      GraphDrawer/obj/Debug/GraphDrawer.pdb
  24. 1 1
      GraphDrawer/obj/Debug/GraphDrawer_MarkupCompile.cache
  25. 4 4
      GraphDrawer/obj/Debug/GraphDrawer_MarkupCompile.i.cache
  26. BIN
      GraphDrawer/obj/Debug/GraphDrawer_i3pw5gct_wpftmp.csprojAssemblyReference.cache
  27. BIN
      GraphDrawer/obj/Debug/GraphDrawer_trntodke_wpftmp.csprojAssemblyReference.cache
  28. BIN
      GraphDrawer/obj/Debug/MainWindow.baml
  29. 1 1
      GraphDrawer/obj/Debug/MainWindow.g.cs
  30. 1 1
      GraphDrawer/obj/Debug/MainWindow.g.i.cs
  31. 9 1
      GraphDrawer/obj/Release/ChoiseRegime.g.cs
  32. 165 5
      GraphDrawer/obj/Release/GraphByClick.g.cs
  33. BIN
      GraphDrawer/obj/Release/GraphDrawer.csprojAssemblyReference.cache
  34. 1 1
      GraphDrawer/obj/Release/GraphDrawer_MarkupCompile.cache
  35. 1 1
      GraphDrawer/obj/Release/MainWindow.g.cs

BIN
.vs/Drawer/v16/.suo


BIN
.vs/GraphDrawer/v16/.suo


BIN
.vs/GraphDrawer/v16/Server/sqlite3/storage.ide


BIN
.vs/slnx.sqlite


+ 105 - 0
GraphDrawer/ArrowLine.cs

@@ -0,0 +1,105 @@
+//------------------------------------------
+// ArrowLine.cs (c) 2007 by Charles Petzold
+//------------------------------------------
+using System;
+using System.Windows;
+using System.Windows.Media;
+
+namespace GraphDrawer
+{
+    public class ArrowLine : ArrowLineBase
+    {
+        /// <summary>
+        ///     Identifies the X1 dependency property.
+        /// </summary>
+        public static readonly DependencyProperty X1Property =
+            DependencyProperty.Register("X1",
+                typeof(double), typeof(ArrowLine),
+                new FrameworkPropertyMetadata(0.0,
+                        FrameworkPropertyMetadataOptions.AffectsMeasure));
+
+        /// <summary>
+        ///     Gets or sets the x-coordinate of the ArrowLine start point.
+        /// </summary>
+        public double X1
+        {
+            set { SetValue(X1Property, value); }
+            get { return (double)GetValue(X1Property); }
+        }
+
+        /// <summary>
+        ///     Identifies the Y1 dependency property.
+        /// </summary>
+        public static readonly DependencyProperty Y1Property =
+            DependencyProperty.Register("Y1",
+                typeof(double), typeof(ArrowLine),
+                new FrameworkPropertyMetadata(0.0,
+                        FrameworkPropertyMetadataOptions.AffectsMeasure));
+
+        /// <summary>
+        ///     Gets or sets the y-coordinate of the ArrowLine start point.
+        /// </summary>
+        public double Y1
+        {
+            set { SetValue(Y1Property, value); }
+            get { return (double)GetValue(Y1Property); }
+        }
+
+        /// <summary>
+        ///     Identifies the X2 dependency property.
+        /// </summary>
+        public static readonly DependencyProperty X2Property =
+            DependencyProperty.Register("X2",
+                typeof(double), typeof(ArrowLine),
+                new FrameworkPropertyMetadata(0.0,
+                        FrameworkPropertyMetadataOptions.AffectsMeasure));
+
+        /// <summary>
+        ///     Gets or sets the x-coordinate of the ArrowLine end point.
+        /// </summary>
+        public double X2
+        {
+            set { SetValue(X2Property, value); }
+            get { return (double)GetValue(X2Property); }
+        }
+
+        /// <summary>
+        ///     Identifies the Y2 dependency property.
+        /// </summary>
+        public static readonly DependencyProperty Y2Property =
+            DependencyProperty.Register("Y2",
+                typeof(double), typeof(ArrowLine),
+                new FrameworkPropertyMetadata(0.0,
+                        FrameworkPropertyMetadataOptions.AffectsMeasure));
+
+        /// <summary>
+        ///     Gets or sets the y-coordinate of the ArrowLine end point.
+        /// </summary>
+        public double Y2
+        {
+            set { SetValue(Y2Property, value); }
+            get { return (double)GetValue(Y2Property); }
+        }
+
+        /// <summary>
+        ///     Gets a value that represents the Geometry of the ArrowLine.
+        /// </summary>
+        protected override Geometry DefiningGeometry
+        {
+            get
+            {
+                // Clear out the PathGeometry.
+                pathgeo.Figures.Clear();
+
+                // Define a single PathFigure with the points.
+                pathfigLine.StartPoint = new Point(X1, Y1);
+                polysegLine.Points.Clear();
+                polysegLine.Points.Add(new Point(X2, Y2));
+                pathgeo.Figures.Add(pathfigLine);
+
+                // Call the base property to add arrows on the ends.
+                return base.DefiningGeometry;
+            }
+        }
+    }
+}

+ 176 - 0
GraphDrawer/ArrowLineBase.cs

@@ -0,0 +1,176 @@
+//----------------------------------------------
+// ArrowLineBase.cs (c) 2007 by Charles Petzold
+//----------------------------------------------
+using System;
+using System.Windows;
+using System.Windows.Media;
+using System.Windows.Shapes;
+
+namespace GraphDrawer
+{
+    public enum ArrowEnds
+    {
+        None = 0,
+        Start = 1,
+        End = 2,
+        Both = 3
+    }
+
+    public abstract class ArrowLineBase : Shape
+    {
+        protected PathGeometry pathgeo;
+        protected PathFigure pathfigLine;
+        protected PolyLineSegment polysegLine;
+
+        PathFigure pathfigHead1;
+        PolyLineSegment polysegHead1;
+        PathFigure pathfigHead2;
+        PolyLineSegment polysegHead2;
+
+        /// <summary>
+        ///     Identifies the ArrowAngle dependency property.
+        /// </summary>
+        public static readonly DependencyProperty ArrowAngleProperty =
+            DependencyProperty.Register("ArrowAngle",
+                typeof(double), typeof(ArrowLineBase),
+                new FrameworkPropertyMetadata(45.0,
+                        FrameworkPropertyMetadataOptions.AffectsMeasure));
+
+        /// <summary>
+        ///     Gets or sets the angle between the two sides of the arrowhead.
+        /// </summary>
+        public double ArrowAngle
+        {
+            set { SetValue(ArrowAngleProperty, value); }
+            get { return (double)GetValue(ArrowAngleProperty); }
+        }
+
+        /// <summary>
+        ///     Identifies the ArrowLength dependency property.
+        /// </summary>
+        public static readonly DependencyProperty ArrowLengthProperty =
+            DependencyProperty.Register("ArrowLength",
+                typeof(double), typeof(ArrowLineBase),
+                new FrameworkPropertyMetadata(12.0,
+                        FrameworkPropertyMetadataOptions.AffectsMeasure));
+
+        /// <summary>
+        ///     Gets or sets the length of the two sides of the arrowhead.
+        /// </summary>
+        public double ArrowLength
+        {
+            set { SetValue(ArrowLengthProperty, value); }
+            get { return (double)GetValue(ArrowLengthProperty); }
+        }
+
+        /// <summary>
+        ///     Identifies the ArrowEnds dependency property.
+        /// </summary>
+        public static readonly DependencyProperty ArrowEndsProperty =
+            DependencyProperty.Register("ArrowEnds",
+                typeof(ArrowEnds), typeof(ArrowLineBase),
+                new FrameworkPropertyMetadata(ArrowEnds.End,
+                        FrameworkPropertyMetadataOptions.AffectsMeasure));
+
+        /// <summary>
+        ///     Gets or sets the property that determines which ends of the
+        ///     line have arrows.
+        /// </summary>
+        public ArrowEnds ArrowEnds
+        {
+            set { SetValue(ArrowEndsProperty, value); }
+            get { return (ArrowEnds)GetValue(ArrowEndsProperty); }
+        }
+
+        /// <summary>
+        ///     Identifies the IsArrowClosed dependency property.
+        /// </summary>
+        public static readonly DependencyProperty IsArrowClosedProperty =
+            DependencyProperty.Register("IsArrowClosed",
+                typeof(bool), typeof(ArrowLineBase),
+                new FrameworkPropertyMetadata(false,
+                        FrameworkPropertyMetadataOptions.AffectsMeasure));
+
+        /// <summary>
+        ///     Gets or sets the property that determines if the arrow head
+        ///     is closed to resemble a triangle.
+        /// </summary>
+        public bool IsArrowClosed
+        {
+            set { SetValue(IsArrowClosedProperty, value); }
+            get { return (bool)GetValue(IsArrowClosedProperty); }
+        }
+
+        /// <summary>
+        ///     Initializes a new instance of ArrowLineBase.
+        /// </summary>
+        public ArrowLineBase()
+        {
+            pathgeo = new PathGeometry();
+
+            pathfigLine = new PathFigure();
+            polysegLine = new PolyLineSegment();
+            pathfigLine.Segments.Add(polysegLine);
+
+            pathfigHead1 = new PathFigure();
+            polysegHead1 = new PolyLineSegment();
+            pathfigHead1.Segments.Add(polysegHead1);
+
+            pathfigHead2 = new PathFigure();
+            polysegHead2 = new PolyLineSegment();
+            pathfigHead2.Segments.Add(polysegHead2);
+        }
+
+        /// <summary>
+        ///     Gets a value that represents the Geometry of the ArrowLine.
+        /// </summary>
+        protected override Geometry DefiningGeometry
+        {
+            get
+            {
+                int count = polysegLine.Points.Count;
+
+                if (count > 0)
+                {
+                    // Draw the arrow at the start of the line.
+                    if ((ArrowEnds & ArrowEnds.Start) == ArrowEnds.Start)
+                    {
+                        Point pt1 = pathfigLine.StartPoint;
+                        Point pt2 = polysegLine.Points[0];
+                        pathgeo.Figures.Add(CalculateArrow(pathfigHead1, pt2, pt1));
+                    }
+
+                    // Draw the arrow at the end of the line.
+                    if ((ArrowEnds & ArrowEnds.End) == ArrowEnds.End)
+                    {
+                        Point pt1 = count == 1 ? pathfigLine.StartPoint :
+                                                 polysegLine.Points[count - 2];
+                        Point pt2 = polysegLine.Points[count - 1];
+                        pathgeo.Figures.Add(CalculateArrow(pathfigHead2, pt1, pt2));
+                    }
+                }
+                return pathgeo;
+            }
+        }
+
+        PathFigure CalculateArrow(PathFigure pathfig, Point pt1, Point pt2)
+        {
+            Matrix matx = new Matrix();
+            Vector vect = pt1 - pt2;
+            vect.Normalize();
+            vect *= ArrowLength;
+
+            PolyLineSegment polyseg = pathfig.Segments[0] as PolyLineSegment;
+            polyseg.Points.Clear();
+            matx.Rotate(ArrowAngle / 2);
+            pathfig.StartPoint = pt2 + vect * matx;
+            polyseg.Points.Add(pt2);
+
+            matx.Rotate(-ArrowAngle);
+            polyseg.Points.Add(pt2 + vect * matx);
+            pathfig.IsClosed = IsArrowClosed;
+
+            return pathfig;
+        }
+    }
+}

+ 36 - 0
GraphDrawer/Edge.cs

@@ -7,6 +7,7 @@ namespace GraphDrawer
     public class Edge
     {
         public Line line { get; set; }
+        public ArrowLine arrowLine { get; set; }
         public Vertex startVertex { get; set; }
         public Vertex finishVertex { get; set; }
         
@@ -16,5 +17,40 @@ namespace GraphDrawer
             startVertex = v1;
             finishVertex = v2;
         }
+
+        public Edge(ArrowLine line, Vertex v1, Vertex v2)
+        {
+            this.arrowLine = line;
+            startVertex = v1;
+            finishVertex = v2;
+        }
+
+        public static double GetCenterByX(Edge edge)
+        {
+            int x;
+            if (edge.finishVertex.X - edge.startVertex.X > 0)
+            {
+                x = edge.finishVertex.X - edge.startVertex.X;
+            }
+            else
+            {
+                x = edge.startVertex.X - edge.finishVertex.X;
+            }
+            return x;
+        }
+
+        public static double GetCenterByY(Edge edge)
+        {
+            int y;
+            if (edge.finishVertex.Y - edge.startVertex.Y > 0)
+            {
+                y = edge.finishVertex.Y - edge.startVertex.Y;
+            }
+            else
+            {
+                y = edge.startVertex.Y - edge.finishVertex.Y;
+            }
+            return y;
+        }
     }
 }

+ 23 - 10
GraphDrawer/GraphByClick.xaml

@@ -5,19 +5,32 @@
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
         xmlns:local="clr-namespace:GraphDrawer"
         mc:Ignorable="d"
-        Title="GraphByClick" Height="450" Width="800">
-    <Grid MouseUp="Grid_MouseUp" Background="LightBlue">
-        <Canvas Background="White" x:Name="canvas" MouseUp="canvas_MouseUp" Margin="0,39,0,46"/>
-        <Button x:Name="backBtn" HorizontalAlignment="Right" VerticalAlignment="Bottom" Content="Режим" Padding="20,10" Background="Blue" Foreground="White" BorderThickness="0" Margin="5" Click="backBtn_Click"/>
-        <Grid x:Name="choiceGrid" Margin="10,10,607,380">
+        Title="Graph Drawer" Height="450" Width="800">
+    <Grid MouseMove="Grid_MouseMove" Background="LightBlue" Margin="0,0,-74,-62">
+        <Menu Height="25" VerticalAlignment="Top" Margin="0,0,0,1">
+            <MenuItem Header="Вид" VerticalAlignment="Center" Height="25">
+                <MenuItem Header="Петли">
+                    <MenuItem Header="Мультиграф" x:Name="multiGraphBtn" Click="multiGraphBtn_Click"/>
+                    <MenuItem Header="Псевдограф" x:Name="pseudoGraphBtn" Click="pseudoGraphBtn_Click"/>
+                </MenuItem>
+                <MenuItem Header="Направление">
+                    <MenuItem Header="Направленный" Name="focusedGraphBtn" Click="focusedGraphBtn_Click"/>
+                    <MenuItem Header="Без направления" Name="unfocusedGraphBtn" Click="unfocusedGraphBtn_Click"/>
+                </MenuItem>
+            </MenuItem>
+        </Menu>
+        <Canvas Background="White" x:Name="canvas" MouseUp="canvas_MouseUp" Margin="0,51,0,115"/>
+        <Button x:Name="backBtn" HorizontalAlignment="Right" VerticalAlignment="Bottom" Content="Режим" Padding="20,10" Background="Blue" Foreground="White" BorderThickness="0" Margin="0,0,10,53" Click="backBtn_Click"/>
+        <Grid x:Name="choiceGrid" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10,25,0,0">
             <Grid.ColumnDefinitions>
-                <ColumnDefinition/>
+                <ColumnDefinition Width="1.5*"/>
                 <ColumnDefinition/>
             </Grid.ColumnDefinitions>
-            <RadioButton x:Name="vertexRb" Content="Точка" FontSize="20"/>
-            <RadioButton x:Name="edgeRb" Content="Связь" FontSize="20" Grid.Column="1"/>
+            <RadioButton IsChecked="True" x:Name="vertexRb" Content="Вершина" FontSize="20"/>
+            <RadioButton x:Name="edgeRb" Content="Ребро" FontSize="20" Grid.Column="1"/>
         </Grid>
-        <Label HorizontalAlignment="Center" x:Name="test"/>
-        <Button x:Name="clearBtn" HorizontalAlignment="Right" VerticalAlignment="Bottom" Content="Очистить" Padding="20,10" Background="Blue" Foreground="White" BorderThickness="0" Margin="0,0,695,5" Click="clearBtn_Click"/>
+        <Label x:Name="coords" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="5" FontSize="18"/>
+        <Button x:Name="clearBtn" HorizontalAlignment="Right" VerticalAlignment="Bottom" Content="Очистить" Padding="20,10" Background="Blue" Foreground="White" BorderThickness="0" Margin="0,0,738,53" Click="clearBtn_Click" Width="118"/>
+        <Button x:Name="exportPngBtn" HorizontalAlignment="Right" VerticalAlignment="Bottom" Content="Скачать PNG" Padding="20,10" Background="Blue" Foreground="White" BorderThickness="0" Margin="0,0,615,53" Click="exportPngBtn_Click" Width="118"/>
     </Grid>
 </Window>

+ 217 - 36
GraphDrawer/GraphByClick.xaml.cs

@@ -1,4 +1,5 @@
-using System;
+using Microsoft.Win32;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
@@ -22,58 +23,91 @@ namespace GraphDrawer
         public GraphByClick()
         {
             InitializeComponent();
+
+            VertexArray.vertexCount = 0;
         }
 
-        private void backBtn_Click(object sender, RoutedEventArgs e)
+        private void backBtn_Click(object sender, RoutedEventArgs e) // Выбор режима рисования
         {
             ChoiseRegime regime = new ChoiseRegime();
             regime.Show();
             Close();
         }
 
-        private void Grid_MouseUp(object sender, MouseButtonEventArgs e)
-        {
-        }
-
+        Vertex[] buffer = new Vertex[2];
         private void canvas_MouseUp(object sender, MouseButtonEventArgs e)
         {
-            var point = e.GetPosition(canvas);
-            int x = Convert.ToInt32(point.X);
+            
+            var point = e.GetPosition(canvas); // Получение позиции курсора
+            int x = Convert.ToInt32(point.X); // Перевод в координаты
             int y = Convert.ToInt32(point.Y);
             if (vertexRb.IsChecked == true)
             {
-                Ellipse ellipse = new Ellipse();
-                Vertex vertex = new Vertex(x, y);
-                DrawVertex(ellipse, canvas, vertex);
-                test.Content = vertex.X;
+                VertexArray.AddVertex(canvas, x, y);
+            }
+            if(edgeRb.IsChecked == true)
+            {
+                if (GraphState.focused)
+                {
+                    var point1 = e.GetPosition(canvas);
+                    int X = Convert.ToInt32(point1.X);
+                    int Y = Convert.ToInt32(point1.Y);
+                    for (int i = 0; i <= VertexArray.vertexCount - 1; i++)// Проверка на принадлежность точки к какой-либо вершине
+                    {
+                        if (((X - VertexArray.vertex[i].X <= 8) && (X - VertexArray.vertex[i].X >= 0)) ||
+                            ((VertexArray.vertex[i].X - X <= 8) && (VertexArray.vertex[i].X - X >= 0)))
+                        {
+                            if (((Y - VertexArray.vertex[i].Y <= 8) && (Y - VertexArray.vertex[i].Y >= 0)) ||
+                            ((VertexArray.vertex[i].Y - Y <= 8) && (VertexArray.vertex[i].Y - Y >= 0)))
+                            {
+                                if (VertexArray.buffer[0] == null)
+                                {
+                                    VertexArray.buffer[0] = VertexArray.vertex[i];
+                                }
+                                else
+                                {
+                                    VertexArray.buffer[1] = VertexArray.vertex[i];
+                                    ArrowedEdgeArray.AddArrowedEdge(canvas, VertexArray.buffer[0], VertexArray.buffer[1]);
+                                    VertexArray.buffer[0] = null;
+                                    VertexArray.buffer[1] = null;
+                                }
+                            }
+                        }
+                    } // Конец проверки
+                }
+                else
+                {
+                    var point1 = e.GetPosition(canvas);
+                    int X = Convert.ToInt32(point1.X);
+                    int Y = Convert.ToInt32(point1.Y);
+                    for (int i = 0; i <= VertexArray.vertexCount - 1; i++)// Проверка на принадлежность точки к какой-либо вершине
+                    {
+                        if (((X - VertexArray.vertex[i].X <= 8) && (X - VertexArray.vertex[i].X >= 0)) ||
+                            ((VertexArray.vertex[i].X - X <= 8) && (VertexArray.vertex[i].X - X >= 0)))
+                        {
+                            if (((Y - VertexArray.vertex[i].Y <= 8) && (Y - VertexArray.vertex[i].Y >= 0)) ||
+                            ((VertexArray.vertex[i].Y - Y <= 8) && (VertexArray.vertex[i].Y - Y >= 0)))
+                            {
+                                if (VertexArray.buffer[0] == null)
+                                {
+                                    VertexArray.buffer[0] = VertexArray.vertex[i];
+                                }
+                                else
+                                {
+                                    VertexArray.buffer[1] = VertexArray.vertex[i];
+                                    EdgeArray.AddEdge(canvas, VertexArray.buffer[0], VertexArray.buffer[1]);
+                                    VertexArray.buffer[0] = null;
+                                    VertexArray.buffer[1] = null;
+                                }
+                            }
+                        }
+                    } // Конец проверки
+                }
             }
         }
 
-        public void DrawEdge(Canvas canvas, Line line, Edge edge)
-        {
-            line = new Line();
-            line.Stroke = GetBrush();
-            line.StrokeThickness = 2;
-            line.X1 = edge.startVertex.X + 5;
-            line.Y1 = edge.startVertex.Y + 5;
-            line.X2 = edge.finishVertex.X + 5;
-            line.Y2 = edge.finishVertex.Y + 5;
-            canvas.Children.Add(line);
-        }
 
-        public void DrawVertex(Ellipse ellipse, Canvas canvas, Vertex vertex)
-        {
-            SolidColorBrush brush = new SolidColorBrush(Color.FromRgb(0, 0, 0));
-            ellipse = new Ellipse();
-            ellipse.Height = 10;
-            ellipse.Width = 10;
-            ellipse.StrokeThickness = 2;
-            ellipse.Stroke = brush;
-            ellipse.Fill = brush;
-            Canvas.SetLeft(ellipse, vertex.X);
-            Canvas.SetTop(ellipse, vertex.Y);
-            canvas.Children.Add(ellipse);
-        }
+        // Получение рандомной кисти из заданных цветов
         Random rand = new Random((DateTime.Now.Millisecond * DateTime.Now.Second) % DateTime.Now.Hour);
         public SolidColorBrush GetBrush()
         {
@@ -90,9 +124,156 @@ namespace GraphDrawer
             return brush[rand.Next(0, 8)];
         }
 
+
+        // Очистка канваса
         private void clearBtn_Click(object sender, RoutedEventArgs e)
         {
             canvas.Children.Clear();
+            VertexArray.vertexCount = 0;
+            EdgeArray.edgeCount = 0;
+            Array.Clear(VertexArray.edge, 0, VertexArray.edge.Length);
+            Array.Clear(VertexArray.ellipse, 0, VertexArray.ellipse.Length);
+            Array.Clear(EdgeArray.edge, 0, EdgeArray.edge.Length);
+            Array.Clear(EdgeArray.line, 0, EdgeArray.line.Length);
+        }
+
+
+        // Дебаг-фича
+        private void Grid_MouseMove(object sender, MouseEventArgs e)
+        {
+            var point = e.GetPosition(canvas);
+            coords.Content = point.X.ToString() + "; " + point.Y.ToString();
+        }
+
+
+        // Кнопки меню
+        private void pseudoGraphBtn_Click(object sender, RoutedEventArgs e)
+        {
+            GraphState.supergraph = false;
+        }
+
+        private void multiGraphBtn_Click(object sender, RoutedEventArgs e)
+        {
+            GraphState.supergraph = true;
+        }
+
+        private void unfocusedGraphBtn_Click(object sender, RoutedEventArgs e)
+        {
+            GraphState.focused = false;
+        }
+
+        private void focusedGraphBtn_Click(object sender, RoutedEventArgs e)
+        {
+            GraphState.focused = true;
+        }
+
+        private void exportPngBtn_Click(object sender, RoutedEventArgs e)
+        {
+            SaveFileDialog sfg = new SaveFileDialog();
+            sfg.Filter = "PNG (*.png) | *.png";
+            sfg.ShowDialog();
+            string filename = sfg.FileName;
+            Rect rect = new Rect(canvas.Margin.Left, canvas.Margin.Top, canvas.ActualWidth, canvas.ActualHeight);
+
+            double dpi = 96d;
+
+            RenderTargetBitmap rtb = new RenderTargetBitmap((int)rect.Right, (int)rect.Bottom, dpi, dpi, System.Windows.Media.PixelFormats.Default);
+
+            rtb.Render(canvas);
+
+            BitmapEncoder pngEncoder = new PngBitmapEncoder();
+            pngEncoder.Frames.Add(BitmapFrame.Create(rtb));
+
+            try
+            {
+                System.IO.MemoryStream ms = new System.IO.MemoryStream();
+
+                pngEncoder.Save(ms);
+                ms.Close();
+
+                System.IO.File.WriteAllBytes(filename, ms.ToArray());
+            }
+            catch (Exception err)
+            {
+                MessageBox.Show(err.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error);
+            }
+        }
+    }
+
+    public class VertexArray
+    {
+        public static int vertexCount;
+        public static Vertex[] vertex = new Vertex[vertexCount];
+        public static Ellipse[] ellipse = new Ellipse[vertexCount];
+        public static Edge[] edge = new Edge[vertexCount];
+        public static Vertex[] buffer = new Vertex[2];
+
+        public static int AddVertex(Canvas canvas, int x, int y)
+        {
+
+            vertexCount++;
+            Array.Resize(ref vertex, vertexCount);
+            Array.Resize(ref ellipse, vertexCount);
+            vertex[vertexCount-1] = new Vertex(x, y);
+            ellipse[vertexCount-1] = new Ellipse();
+            ellipse[vertexCount-1].Height = 10;
+            ellipse[vertexCount-1].Width = 10;
+            ellipse[vertexCount-1].StrokeThickness = 2;
+            ellipse[vertexCount-1].Stroke = new SolidColorBrush(Color.FromRgb(0, 0, 0));
+            ellipse[vertexCount-1].Fill = ellipse[vertexCount-1].Stroke;
+            Canvas.SetTop(ellipse[vertexCount-1], vertex[vertexCount-1].Y);
+            Canvas.SetLeft(ellipse[vertexCount-1], vertex[vertexCount-1].X);
+            canvas.Children.Add(ellipse[vertexCount-1]);
+            return vertexCount-1;
+        }
+    }
+
+    public class EdgeArray
+    {
+        public static int edgeCount;
+        public static Edge[] edge = new Edge[edgeCount];
+        public static Line[] line = new Line[edgeCount];
+
+        public static void AddEdge(Canvas canvas, Vertex v1, Vertex v2)
+        {
+            if (edgeCount == 0) edgeCount++;
+
+            edgeCount++;
+            Array.Resize(ref edge, edgeCount);
+            Array.Resize(ref line, edgeCount);
+            line[edgeCount-1] = new Line();
+            edge[edgeCount-1] = new Edge(line[edgeCount-1], v1, v2);
+            line[edgeCount - 1].Stroke = new SolidColorBrush(Color.FromRgb(0, 0, 0));
+            line[edgeCount - 1].StrokeThickness = 2;
+            line[edgeCount - 1].X1 = v1.X+5;
+            line[edgeCount - 1].Y1 = v1.Y+5;
+            line[edgeCount - 1].X2 = v2.X+5;
+            line[edgeCount - 1].Y2 = v2.Y+5;
+            canvas.Children.Add(line[edgeCount - 1]);
+        }
+    }
+
+    public class ArrowedEdgeArray
+    {
+        public static ArrowLine[] line = new ArrowLine[EdgeArray.edgeCount];
+        public static Edge[] edge = new Edge[EdgeArray.edgeCount];
+
+        public static void AddArrowedEdge(Canvas canvas, Vertex v1, Vertex v2)
+        {
+            int edgeCount = EdgeArray.edgeCount;
+            edgeCount++;
+            Array.Resize(ref edge, edgeCount);
+            Array.Resize(ref line, edgeCount);
+            line[edgeCount - 1] = new ArrowLine();
+            edge[edgeCount - 1] = new Edge(line[edgeCount - 1], v1, v2);
+            line[edgeCount - 1].Stroke = new SolidColorBrush(Color.FromRgb(0, 0, 0));
+            line[edgeCount - 1].StrokeThickness = 2;
+            line[edgeCount - 1].X1 = v1.X + 5;
+            line[edgeCount - 1].Y1 = v1.Y + 5;
+            line[edgeCount - 1].X2 = v2.X + 5;
+            line[edgeCount - 1].Y2 = v2.Y + 5;
+            canvas.Children.Add(line[edgeCount - 1]);
+            EdgeArray.edgeCount = edgeCount;
         }
     }
 }

+ 3 - 0
GraphDrawer/GraphDrawer.csproj

@@ -55,6 +55,8 @@
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </ApplicationDefinition>
+    <Compile Include="ArrowLine.cs" />
+    <Compile Include="ArrowLineBase.cs" />
     <Compile Include="ChoiseRegime.xaml.cs">
       <DependentUpon>ChoiseRegime.xaml</DependentUpon>
     </Compile>
@@ -62,6 +64,7 @@
     <Compile Include="GraphByClick.xaml.cs">
       <DependentUpon>GraphByClick.xaml</DependentUpon>
     </Compile>
+    <Compile Include="GraphState.cs" />
     <Compile Include="Vertex.cs" />
     <Page Include="ChoiseRegime.xaml">
       <SubType>Designer</SubType>

+ 14 - 0
GraphDrawer/GraphState.cs

@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace GraphDrawer
+{
+    class GraphState
+    {
+        public static bool supergraph = true;
+        public static bool focused = false;
+    }
+}

+ 8 - 8
GraphDrawer/MainWindow.xaml

@@ -13,16 +13,16 @@
             <RowDefinition Height="0.1*"/>
         </Grid.RowDefinitions>
         <Grid.ColumnDefinitions>
-            <ColumnDefinition/>
-            <ColumnDefinition/>
+            <ColumnDefinition Width="259*"/>
+            <ColumnDefinition Width="137*"/>
         </Grid.ColumnDefinitions>
         <Canvas x:Name="canvas" Grid.ColumnSpan="2"/>
-        <TextBlock Text="Количество вершин:" Grid.Row="1" HorizontalAlignment="Right" Margin="0,0,5,0" VerticalAlignment="Center" FontSize="20"/>
-        <TextBlock Text="Количество ребер у каждой вершины:" Grid.Row="2" HorizontalAlignment="Right" Margin="0,0,5,0" VerticalAlignment="Center" FontSize="20"/>
+        <TextBlock Text="Количество вершин:" Grid.Row="1" HorizontalAlignment="Right" Margin="0,4,5,4" VerticalAlignment="Center" FontSize="20" Height="27" Width="189"/>
+        <TextBlock Text="Максимальное количество ребер у каждой вершины:" Grid.Row="2" HorizontalAlignment="Right" Margin="0,4,5,4" VerticalAlignment="Center" FontSize="20" Height="27" Width="501"/>
 
-        <TextBox TabIndex="1" x:Name="vertexBox" Grid.Row="1" Grid.Column="1" Height="30" Width="100" HorizontalAlignment="Left"/>
-        <TextBox TabIndex="2" x:Name="edgeBox" Grid.Row="2" Grid.Column="1" Height="30" Width="100" HorizontalAlignment="Left"/>
-        <Button TabIndex="3" x:Name="generateBtn" Grid.Row="2" Grid.Column="1" Width="100" Height="25" Content="Генерировать" Background="Blue" Foreground="White" BorderThickness="0" Click="generateBtn_Click"/>
-        <Button TabIndex="3" x:Name="choiceBtn" Grid.Row="2" Grid.Column="1" Width="100" Height="25" Content="Режим" Background="Blue" Foreground="White" BorderThickness="0" Margin="253,5,43,5" Click="choiceBtn_Click"/>
+        <TextBox TabIndex="1" x:Name="vertexBox" Grid.Row="1" Grid.Column="1" Width="100" HorizontalAlignment="Left" Margin="0,3,0,2"/>
+        <TextBox TabIndex="2" x:Name="edgeBox" Grid.Row="2" Grid.Column="1" Width="100" HorizontalAlignment="Left" Margin="0,2,0,3"/>
+        <Button TabIndex="3" x:Name="generateBtn" Grid.Row="1" Grid.Column="1" Content="Генерировать" Background="Blue" Foreground="White" BorderThickness="0" Click="generateBtn_Click" Margin="174,5,10,5"/>
+        <Button TabIndex="4" x:Name="choiceBtn" Grid.Row="2" Grid.Column="1" Content="Режим" Background="Blue" Foreground="White" BorderThickness="0" Margin="174,4,10,6" Click="choiceBtn_Click"/>
     </Grid>
 </Window>

+ 20 - 6
GraphDrawer/MainWindow.xaml.cs

@@ -52,22 +52,36 @@ namespace GraphDrawer
                     DrawVertex(ellipse[i], canvas, vertices[i]);
                 }
 
-                for(int i = 0; i < vertexCount; i++)
+                for (int i = 0; i < vertexCount; i++)
                 {
-                    if (vertices[i].edgeCount <= edgeCount)
+                    if (vertices[i].edgeCount < edgeCount)
                     {
-                        vertices[i].edgeCount++;
                         for (int j = 0; j < vertexCount; j++)
                         {
-                            vertices[j].edgeCount++;
-                            if (vertices[j].edgeCount <= edgeCount)
+                            if (vertices[j].edgeCount < edgeCount)
                             {
-                                edges[i] = new Edge(lines[i], vertices[i], vertices[j]);
+                                edges[i] = new Edge(lines[i], vertices[j], vertices[i]);
+                                vertices[i].edgeCount++;
+                                vertices[j].edgeCount++;
                                 DrawEdge(canvas, lines[i], edges[i]);
                             }
                         }
                     }
                 }
+
+                //for (int i = 0; i < vertexCount; i++)
+                //{
+                //    for (int j = i; j < vertexCount; j++ )
+                //    {
+                //        if (vertices[j].edgeCount <= edgeCount && vertices[i].edgeCount<=edgeCount)
+                //        {
+                //            edges[i] = new Edge(lines[i], vertices[j], vertices[i]);
+                //            vertices[j].edgeCount++;
+                //            vertices[i].edgeCount++;
+                //            DrawEdge(canvas, lines[i], edges[i]);
+                //        }
+                //    }
+                //}
             }
         }
 

BIN
GraphDrawer/bin/Debug/GraphDrawer.exe


BIN
GraphDrawer/bin/Debug/GraphDrawer.pdb


BIN
GraphDrawer/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache


BIN
GraphDrawer/obj/Debug/GraphByClick.baml


+ 105 - 20
GraphDrawer/obj/Debug/GraphByClick.g.cs

@@ -1,4 +1,4 @@
-#pragma checksum "..\..\GraphByClick.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "3E6614424510BE2D44463A1B32BD72B98C3DD81831FE1E6F5DB8B6A2D9184E9F"
+#pragma checksum "..\..\GraphByClick.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "934C912879B70A3B7F57A7D3879477438A1E10A95EC1500236D243D483C63CA2"
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     This code was generated by a tool.
@@ -41,7 +41,39 @@ namespace GraphDrawer {
     public partial class GraphByClick : System.Windows.Window, System.Windows.Markup.IComponentConnector {
         
         
-        #line 10 "..\..\GraphByClick.xaml"
+        #line 13 "..\..\GraphByClick.xaml"
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
+        internal System.Windows.Controls.MenuItem multiGraphBtn;
+        
+        #line default
+        #line hidden
+        
+        
+        #line 14 "..\..\GraphByClick.xaml"
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
+        internal System.Windows.Controls.MenuItem pseudoGraphBtn;
+        
+        #line default
+        #line hidden
+        
+        
+        #line 17 "..\..\GraphByClick.xaml"
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
+        internal System.Windows.Controls.MenuItem focusedGraphBtn;
+        
+        #line default
+        #line hidden
+        
+        
+        #line 18 "..\..\GraphByClick.xaml"
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
+        internal System.Windows.Controls.MenuItem unfocusedGraphBtn;
+        
+        #line default
+        #line hidden
+        
+        
+        #line 22 "..\..\GraphByClick.xaml"
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
         internal System.Windows.Controls.Canvas canvas;
         
@@ -49,7 +81,7 @@ namespace GraphDrawer {
         #line hidden
         
         
-        #line 11 "..\..\GraphByClick.xaml"
+        #line 23 "..\..\GraphByClick.xaml"
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
         internal System.Windows.Controls.Button backBtn;
         
@@ -57,7 +89,7 @@ namespace GraphDrawer {
         #line hidden
         
         
-        #line 12 "..\..\GraphByClick.xaml"
+        #line 24 "..\..\GraphByClick.xaml"
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
         internal System.Windows.Controls.Grid choiceGrid;
         
@@ -65,7 +97,7 @@ namespace GraphDrawer {
         #line hidden
         
         
-        #line 17 "..\..\GraphByClick.xaml"
+        #line 29 "..\..\GraphByClick.xaml"
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
         internal System.Windows.Controls.RadioButton vertexRb;
         
@@ -73,7 +105,7 @@ namespace GraphDrawer {
         #line hidden
         
         
-        #line 18 "..\..\GraphByClick.xaml"
+        #line 30 "..\..\GraphByClick.xaml"
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
         internal System.Windows.Controls.RadioButton edgeRb;
         
@@ -81,21 +113,29 @@ namespace GraphDrawer {
         #line hidden
         
         
-        #line 20 "..\..\GraphByClick.xaml"
+        #line 32 "..\..\GraphByClick.xaml"
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
-        internal System.Windows.Controls.Label test;
+        internal System.Windows.Controls.Label coords;
         
         #line default
         #line hidden
         
         
-        #line 21 "..\..\GraphByClick.xaml"
+        #line 33 "..\..\GraphByClick.xaml"
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
         internal System.Windows.Controls.Button clearBtn;
         
         #line default
         #line hidden
         
+        
+        #line 34 "..\..\GraphByClick.xaml"
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
+        internal System.Windows.Controls.Button exportPngBtn;
+        
+        #line default
+        #line hidden
+        
         private bool _contentLoaded;
         
         /// <summary>
@@ -129,50 +169,95 @@ namespace GraphDrawer {
             case 1:
             
             #line 9 "..\..\GraphByClick.xaml"
-            ((System.Windows.Controls.Grid)(target)).MouseUp += new System.Windows.Input.MouseButtonEventHandler(this.Grid_MouseUp);
+            ((System.Windows.Controls.Grid)(target)).MouseMove += new System.Windows.Input.MouseEventHandler(this.Grid_MouseMove);
             
             #line default
             #line hidden
             return;
             case 2:
+            this.multiGraphBtn = ((System.Windows.Controls.MenuItem)(target));
+            
+            #line 13 "..\..\GraphByClick.xaml"
+            this.multiGraphBtn.Click += new System.Windows.RoutedEventHandler(this.multiGraphBtn_Click);
+            
+            #line default
+            #line hidden
+            return;
+            case 3:
+            this.pseudoGraphBtn = ((System.Windows.Controls.MenuItem)(target));
+            
+            #line 14 "..\..\GraphByClick.xaml"
+            this.pseudoGraphBtn.Click += new System.Windows.RoutedEventHandler(this.pseudoGraphBtn_Click);
+            
+            #line default
+            #line hidden
+            return;
+            case 4:
+            this.focusedGraphBtn = ((System.Windows.Controls.MenuItem)(target));
+            
+            #line 17 "..\..\GraphByClick.xaml"
+            this.focusedGraphBtn.Click += new System.Windows.RoutedEventHandler(this.focusedGraphBtn_Click);
+            
+            #line default
+            #line hidden
+            return;
+            case 5:
+            this.unfocusedGraphBtn = ((System.Windows.Controls.MenuItem)(target));
+            
+            #line 18 "..\..\GraphByClick.xaml"
+            this.unfocusedGraphBtn.Click += new System.Windows.RoutedEventHandler(this.unfocusedGraphBtn_Click);
+            
+            #line default
+            #line hidden
+            return;
+            case 6:
             this.canvas = ((System.Windows.Controls.Canvas)(target));
             
-            #line 10 "..\..\GraphByClick.xaml"
+            #line 22 "..\..\GraphByClick.xaml"
             this.canvas.MouseUp += new System.Windows.Input.MouseButtonEventHandler(this.canvas_MouseUp);
             
             #line default
             #line hidden
             return;
-            case 3:
+            case 7:
             this.backBtn = ((System.Windows.Controls.Button)(target));
             
-            #line 11 "..\..\GraphByClick.xaml"
+            #line 23 "..\..\GraphByClick.xaml"
             this.backBtn.Click += new System.Windows.RoutedEventHandler(this.backBtn_Click);
             
             #line default
             #line hidden
             return;
-            case 4:
+            case 8:
             this.choiceGrid = ((System.Windows.Controls.Grid)(target));
             return;
-            case 5:
+            case 9:
             this.vertexRb = ((System.Windows.Controls.RadioButton)(target));
             return;
-            case 6:
+            case 10:
             this.edgeRb = ((System.Windows.Controls.RadioButton)(target));
             return;
-            case 7:
-            this.test = ((System.Windows.Controls.Label)(target));
+            case 11:
+            this.coords = ((System.Windows.Controls.Label)(target));
             return;
-            case 8:
+            case 12:
             this.clearBtn = ((System.Windows.Controls.Button)(target));
             
-            #line 21 "..\..\GraphByClick.xaml"
+            #line 33 "..\..\GraphByClick.xaml"
             this.clearBtn.Click += new System.Windows.RoutedEventHandler(this.clearBtn_Click);
             
             #line default
             #line hidden
             return;
+            case 13:
+            this.exportPngBtn = ((System.Windows.Controls.Button)(target));
+            
+            #line 34 "..\..\GraphByClick.xaml"
+            this.exportPngBtn.Click += new System.Windows.RoutedEventHandler(this.exportPngBtn_Click);
+            
+            #line default
+            #line hidden
+            return;
             }
             this._contentLoaded = true;
         }

+ 105 - 20
GraphDrawer/obj/Debug/GraphByClick.g.i.cs

@@ -1,4 +1,4 @@
-#pragma checksum "..\..\GraphByClick.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "3E6614424510BE2D44463A1B32BD72B98C3DD81831FE1E6F5DB8B6A2D9184E9F"
+#pragma checksum "..\..\GraphByClick.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "934C912879B70A3B7F57A7D3879477438A1E10A95EC1500236D243D483C63CA2"
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     This code was generated by a tool.
@@ -41,7 +41,39 @@ namespace GraphDrawer {
     public partial class GraphByClick : System.Windows.Window, System.Windows.Markup.IComponentConnector {
         
         
-        #line 10 "..\..\GraphByClick.xaml"
+        #line 13 "..\..\GraphByClick.xaml"
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
+        internal System.Windows.Controls.MenuItem multiGraphBtn;
+        
+        #line default
+        #line hidden
+        
+        
+        #line 14 "..\..\GraphByClick.xaml"
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
+        internal System.Windows.Controls.MenuItem pseudoGraphBtn;
+        
+        #line default
+        #line hidden
+        
+        
+        #line 17 "..\..\GraphByClick.xaml"
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
+        internal System.Windows.Controls.MenuItem focusedGraphBtn;
+        
+        #line default
+        #line hidden
+        
+        
+        #line 18 "..\..\GraphByClick.xaml"
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
+        internal System.Windows.Controls.MenuItem unfocusedGraphBtn;
+        
+        #line default
+        #line hidden
+        
+        
+        #line 22 "..\..\GraphByClick.xaml"
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
         internal System.Windows.Controls.Canvas canvas;
         
@@ -49,7 +81,7 @@ namespace GraphDrawer {
         #line hidden
         
         
-        #line 11 "..\..\GraphByClick.xaml"
+        #line 23 "..\..\GraphByClick.xaml"
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
         internal System.Windows.Controls.Button backBtn;
         
@@ -57,7 +89,7 @@ namespace GraphDrawer {
         #line hidden
         
         
-        #line 12 "..\..\GraphByClick.xaml"
+        #line 24 "..\..\GraphByClick.xaml"
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
         internal System.Windows.Controls.Grid choiceGrid;
         
@@ -65,7 +97,7 @@ namespace GraphDrawer {
         #line hidden
         
         
-        #line 17 "..\..\GraphByClick.xaml"
+        #line 29 "..\..\GraphByClick.xaml"
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
         internal System.Windows.Controls.RadioButton vertexRb;
         
@@ -73,7 +105,7 @@ namespace GraphDrawer {
         #line hidden
         
         
-        #line 18 "..\..\GraphByClick.xaml"
+        #line 30 "..\..\GraphByClick.xaml"
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
         internal System.Windows.Controls.RadioButton edgeRb;
         
@@ -81,21 +113,29 @@ namespace GraphDrawer {
         #line hidden
         
         
-        #line 20 "..\..\GraphByClick.xaml"
+        #line 32 "..\..\GraphByClick.xaml"
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
-        internal System.Windows.Controls.Label test;
+        internal System.Windows.Controls.Label coords;
         
         #line default
         #line hidden
         
         
-        #line 21 "..\..\GraphByClick.xaml"
+        #line 33 "..\..\GraphByClick.xaml"
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
         internal System.Windows.Controls.Button clearBtn;
         
         #line default
         #line hidden
         
+        
+        #line 34 "..\..\GraphByClick.xaml"
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
+        internal System.Windows.Controls.Button exportPngBtn;
+        
+        #line default
+        #line hidden
+        
         private bool _contentLoaded;
         
         /// <summary>
@@ -129,50 +169,95 @@ namespace GraphDrawer {
             case 1:
             
             #line 9 "..\..\GraphByClick.xaml"
-            ((System.Windows.Controls.Grid)(target)).MouseUp += new System.Windows.Input.MouseButtonEventHandler(this.Grid_MouseUp);
+            ((System.Windows.Controls.Grid)(target)).MouseMove += new System.Windows.Input.MouseEventHandler(this.Grid_MouseMove);
             
             #line default
             #line hidden
             return;
             case 2:
+            this.multiGraphBtn = ((System.Windows.Controls.MenuItem)(target));
+            
+            #line 13 "..\..\GraphByClick.xaml"
+            this.multiGraphBtn.Click += new System.Windows.RoutedEventHandler(this.multiGraphBtn_Click);
+            
+            #line default
+            #line hidden
+            return;
+            case 3:
+            this.pseudoGraphBtn = ((System.Windows.Controls.MenuItem)(target));
+            
+            #line 14 "..\..\GraphByClick.xaml"
+            this.pseudoGraphBtn.Click += new System.Windows.RoutedEventHandler(this.pseudoGraphBtn_Click);
+            
+            #line default
+            #line hidden
+            return;
+            case 4:
+            this.focusedGraphBtn = ((System.Windows.Controls.MenuItem)(target));
+            
+            #line 17 "..\..\GraphByClick.xaml"
+            this.focusedGraphBtn.Click += new System.Windows.RoutedEventHandler(this.focusedGraphBtn_Click);
+            
+            #line default
+            #line hidden
+            return;
+            case 5:
+            this.unfocusedGraphBtn = ((System.Windows.Controls.MenuItem)(target));
+            
+            #line 18 "..\..\GraphByClick.xaml"
+            this.unfocusedGraphBtn.Click += new System.Windows.RoutedEventHandler(this.unfocusedGraphBtn_Click);
+            
+            #line default
+            #line hidden
+            return;
+            case 6:
             this.canvas = ((System.Windows.Controls.Canvas)(target));
             
-            #line 10 "..\..\GraphByClick.xaml"
+            #line 22 "..\..\GraphByClick.xaml"
             this.canvas.MouseUp += new System.Windows.Input.MouseButtonEventHandler(this.canvas_MouseUp);
             
             #line default
             #line hidden
             return;
-            case 3:
+            case 7:
             this.backBtn = ((System.Windows.Controls.Button)(target));
             
-            #line 11 "..\..\GraphByClick.xaml"
+            #line 23 "..\..\GraphByClick.xaml"
             this.backBtn.Click += new System.Windows.RoutedEventHandler(this.backBtn_Click);
             
             #line default
             #line hidden
             return;
-            case 4:
+            case 8:
             this.choiceGrid = ((System.Windows.Controls.Grid)(target));
             return;
-            case 5:
+            case 9:
             this.vertexRb = ((System.Windows.Controls.RadioButton)(target));
             return;
-            case 6:
+            case 10:
             this.edgeRb = ((System.Windows.Controls.RadioButton)(target));
             return;
-            case 7:
-            this.test = ((System.Windows.Controls.Label)(target));
+            case 11:
+            this.coords = ((System.Windows.Controls.Label)(target));
             return;
-            case 8:
+            case 12:
             this.clearBtn = ((System.Windows.Controls.Button)(target));
             
-            #line 21 "..\..\GraphByClick.xaml"
+            #line 33 "..\..\GraphByClick.xaml"
             this.clearBtn.Click += new System.Windows.RoutedEventHandler(this.clearBtn_Click);
             
             #line default
             #line hidden
             return;
+            case 13:
+            this.exportPngBtn = ((System.Windows.Controls.Button)(target));
+            
+            #line 34 "..\..\GraphByClick.xaml"
+            this.exportPngBtn.Click += new System.Windows.RoutedEventHandler(this.exportPngBtn_Click);
+            
+            #line default
+            #line hidden
+            return;
             }
             this._contentLoaded = true;
         }

BIN
GraphDrawer/obj/Debug/GraphDrawer.csprojAssemblyReference.cache


BIN
GraphDrawer/obj/Debug/GraphDrawer.exe


BIN
GraphDrawer/obj/Debug/GraphDrawer.g.resources


BIN
GraphDrawer/obj/Debug/GraphDrawer.pdb


+ 1 - 1
GraphDrawer/obj/Debug/GraphDrawer_MarkupCompile.cache

@@ -12,7 +12,7 @@ DEBUG;TRACE
 C:\Users\locadm\Desktop\Drawer\GraphDrawer\App.xaml
 3616127476
 
-91140760115
+12871213070
 13-1505183044
 ChoiseRegime.xaml;GraphByClick.xaml;MainWindow.xaml;
 

+ 4 - 4
GraphDrawer/obj/Debug/GraphDrawer_MarkupCompile.i.cache

@@ -4,17 +4,17 @@
 winexe
 C#
 .cs
-C:\Users\locadm\source\repos\GraphDrawer\GraphDrawer\obj\Debug\
+C:\Users\locadm\Desktop\Drawer\GraphDrawer\obj\Debug\
 GraphDrawer
 none
 false
 DEBUG;TRACE
-C:\Users\locadm\source\repos\GraphDrawer\GraphDrawer\App.xaml
+C:\Users\locadm\Desktop\Drawer\GraphDrawer\App.xaml
 3616127476
 
-101540994140
+131271447095
 13-1505183044
 ChoiseRegime.xaml;GraphByClick.xaml;MainWindow.xaml;
 
-True
+False
 

BIN
GraphDrawer/obj/Debug/GraphDrawer_i3pw5gct_wpftmp.csprojAssemblyReference.cache


BIN
GraphDrawer/obj/Debug/GraphDrawer_trntodke_wpftmp.csprojAssemblyReference.cache


BIN
GraphDrawer/obj/Debug/MainWindow.baml


+ 1 - 1
GraphDrawer/obj/Debug/MainWindow.g.cs

@@ -1,4 +1,4 @@
-#pragma checksum "..\..\MainWindow.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "EA4890CA949A3AD40607C1860AF94A22181B5C1737C9CACAEC0664D75CA6C91C"
+#pragma checksum "..\..\MainWindow.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "6E2532B15930216500B7BC2E409C789521A4EDDA84BB517CED108A7E919418AA"
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     This code was generated by a tool.

+ 1 - 1
GraphDrawer/obj/Debug/MainWindow.g.i.cs

@@ -1,4 +1,4 @@
-#pragma checksum "..\..\MainWindow.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "EA4890CA949A3AD40607C1860AF94A22181B5C1737C9CACAEC0664D75CA6C91C"
+#pragma checksum "..\..\MainWindow.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "6E2532B15930216500B7BC2E409C789521A4EDDA84BB517CED108A7E919418AA"
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     This code was generated by a tool.

+ 9 - 1
GraphDrawer/obj/Release/ChoiseRegime.g.cs

@@ -1,4 +1,4 @@
-#pragma checksum "..\..\ChoiseRegime.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "589FDD0FFE6718A12B7C08997C37B77220CEC5DBF6BDB969395C2581D8511ED4"
+#pragma checksum "..\..\ChoiseRegime.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "A8ADBB8E4B9B0AD408883526C6DDA9A250B34E1B14EF12ACC6EA854889AA1C50"
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     This code was generated by a tool.
@@ -78,6 +78,14 @@ namespace GraphDrawer {
             #line default
             #line hidden
             return;
+            case 2:
+            
+            #line 21 "..\..\ChoiseRegime.xaml"
+            ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_1);
+            
+            #line default
+            #line hidden
+            return;
             }
             this._contentLoaded = true;
         }

+ 165 - 5
GraphDrawer/obj/Release/GraphByClick.g.cs

@@ -1,4 +1,4 @@
-#pragma checksum "..\..\GraphByClick.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "9B98E94BA1B2BCABC70B7C81DAA7DD5566174A287DB337B5F3EEEA922B0A2385"
+#pragma checksum "..\..\GraphByClick.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "934C912879B70A3B7F57A7D3879477438A1E10A95EC1500236D243D483C63CA2"
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     This code was generated by a tool.
@@ -41,7 +41,47 @@ namespace GraphDrawer {
     public partial class GraphByClick : System.Windows.Window, System.Windows.Markup.IComponentConnector {
         
         
-        #line 11 "..\..\GraphByClick.xaml"
+        #line 13 "..\..\GraphByClick.xaml"
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
+        internal System.Windows.Controls.MenuItem multiGraphBtn;
+        
+        #line default
+        #line hidden
+        
+        
+        #line 14 "..\..\GraphByClick.xaml"
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
+        internal System.Windows.Controls.MenuItem pseudoGraphBtn;
+        
+        #line default
+        #line hidden
+        
+        
+        #line 17 "..\..\GraphByClick.xaml"
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
+        internal System.Windows.Controls.MenuItem focusedGraphBtn;
+        
+        #line default
+        #line hidden
+        
+        
+        #line 18 "..\..\GraphByClick.xaml"
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
+        internal System.Windows.Controls.MenuItem unfocusedGraphBtn;
+        
+        #line default
+        #line hidden
+        
+        
+        #line 22 "..\..\GraphByClick.xaml"
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
+        internal System.Windows.Controls.Canvas canvas;
+        
+        #line default
+        #line hidden
+        
+        
+        #line 23 "..\..\GraphByClick.xaml"
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
         internal System.Windows.Controls.Button backBtn;
         
@@ -49,13 +89,53 @@ namespace GraphDrawer {
         #line hidden
         
         
-        #line 12 "..\..\GraphByClick.xaml"
+        #line 24 "..\..\GraphByClick.xaml"
         [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
         internal System.Windows.Controls.Grid choiceGrid;
         
         #line default
         #line hidden
         
+        
+        #line 29 "..\..\GraphByClick.xaml"
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
+        internal System.Windows.Controls.RadioButton vertexRb;
+        
+        #line default
+        #line hidden
+        
+        
+        #line 30 "..\..\GraphByClick.xaml"
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
+        internal System.Windows.Controls.RadioButton edgeRb;
+        
+        #line default
+        #line hidden
+        
+        
+        #line 32 "..\..\GraphByClick.xaml"
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
+        internal System.Windows.Controls.Label coords;
+        
+        #line default
+        #line hidden
+        
+        
+        #line 33 "..\..\GraphByClick.xaml"
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
+        internal System.Windows.Controls.Button clearBtn;
+        
+        #line default
+        #line hidden
+        
+        
+        #line 34 "..\..\GraphByClick.xaml"
+        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
+        internal System.Windows.Controls.Button exportPngBtn;
+        
+        #line default
+        #line hidden
+        
         private bool _contentLoaded;
         
         /// <summary>
@@ -87,17 +167,97 @@ namespace GraphDrawer {
             switch (connectionId)
             {
             case 1:
+            
+            #line 9 "..\..\GraphByClick.xaml"
+            ((System.Windows.Controls.Grid)(target)).MouseMove += new System.Windows.Input.MouseEventHandler(this.Grid_MouseMove);
+            
+            #line default
+            #line hidden
+            return;
+            case 2:
+            this.multiGraphBtn = ((System.Windows.Controls.MenuItem)(target));
+            
+            #line 13 "..\..\GraphByClick.xaml"
+            this.multiGraphBtn.Click += new System.Windows.RoutedEventHandler(this.multiGraphBtn_Click);
+            
+            #line default
+            #line hidden
+            return;
+            case 3:
+            this.pseudoGraphBtn = ((System.Windows.Controls.MenuItem)(target));
+            
+            #line 14 "..\..\GraphByClick.xaml"
+            this.pseudoGraphBtn.Click += new System.Windows.RoutedEventHandler(this.pseudoGraphBtn_Click);
+            
+            #line default
+            #line hidden
+            return;
+            case 4:
+            this.focusedGraphBtn = ((System.Windows.Controls.MenuItem)(target));
+            
+            #line 17 "..\..\GraphByClick.xaml"
+            this.focusedGraphBtn.Click += new System.Windows.RoutedEventHandler(this.focusedGraphBtn_Click);
+            
+            #line default
+            #line hidden
+            return;
+            case 5:
+            this.unfocusedGraphBtn = ((System.Windows.Controls.MenuItem)(target));
+            
+            #line 18 "..\..\GraphByClick.xaml"
+            this.unfocusedGraphBtn.Click += new System.Windows.RoutedEventHandler(this.unfocusedGraphBtn_Click);
+            
+            #line default
+            #line hidden
+            return;
+            case 6:
+            this.canvas = ((System.Windows.Controls.Canvas)(target));
+            
+            #line 22 "..\..\GraphByClick.xaml"
+            this.canvas.MouseUp += new System.Windows.Input.MouseButtonEventHandler(this.canvas_MouseUp);
+            
+            #line default
+            #line hidden
+            return;
+            case 7:
             this.backBtn = ((System.Windows.Controls.Button)(target));
             
-            #line 11 "..\..\GraphByClick.xaml"
+            #line 23 "..\..\GraphByClick.xaml"
             this.backBtn.Click += new System.Windows.RoutedEventHandler(this.backBtn_Click);
             
             #line default
             #line hidden
             return;
-            case 2:
+            case 8:
             this.choiceGrid = ((System.Windows.Controls.Grid)(target));
             return;
+            case 9:
+            this.vertexRb = ((System.Windows.Controls.RadioButton)(target));
+            return;
+            case 10:
+            this.edgeRb = ((System.Windows.Controls.RadioButton)(target));
+            return;
+            case 11:
+            this.coords = ((System.Windows.Controls.Label)(target));
+            return;
+            case 12:
+            this.clearBtn = ((System.Windows.Controls.Button)(target));
+            
+            #line 33 "..\..\GraphByClick.xaml"
+            this.clearBtn.Click += new System.Windows.RoutedEventHandler(this.clearBtn_Click);
+            
+            #line default
+            #line hidden
+            return;
+            case 13:
+            this.exportPngBtn = ((System.Windows.Controls.Button)(target));
+            
+            #line 34 "..\..\GraphByClick.xaml"
+            this.exportPngBtn.Click += new System.Windows.RoutedEventHandler(this.exportPngBtn_Click);
+            
+            #line default
+            #line hidden
+            return;
             }
             this._contentLoaded = true;
         }

BIN
GraphDrawer/obj/Release/GraphDrawer.csprojAssemblyReference.cache


+ 1 - 1
GraphDrawer/obj/Release/GraphDrawer_MarkupCompile.cache

@@ -12,7 +12,7 @@ TRACE
 C:\Users\locadm\Desktop\Drawer\GraphDrawer\App.xaml
 3616127476
 
-91140760115
+12871213070
 13-1505183044
 ChoiseRegime.xaml;GraphByClick.xaml;MainWindow.xaml;
 

+ 1 - 1
GraphDrawer/obj/Release/MainWindow.g.cs

@@ -1,4 +1,4 @@
-#pragma checksum "..\..\MainWindow.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "EA4890CA949A3AD40607C1860AF94A22181B5C1737C9CACAEC0664D75CA6C91C"
+#pragma checksum "..\..\MainWindow.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "6E2532B15930216500B7BC2E409C789521A4EDDA84BB517CED108A7E919418AA"
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     This code was generated by a tool.