-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainWindow.xaml
139 lines (138 loc) · 9.04 KB
/
MainWindow.xaml
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
<Window x:Class="PolygonEditor.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:PolygonEditor"
mc:Ignorable="d" AllowDrop="True"
ResizeMode="NoResize" Name="mainWindow"
Title="PolygonEditor" Height="650" Width="1080">
<Window.Resources>
<local:VerticesConverter x:Key="VerticesConverter"/>
<local:EdgesConverter x:Key="EdgesConverter"/>
<local:RelationConverter x:Key="RelationConverter"/>
<Style x:Key="myHeaderStyle" TargetType="{x:Type GridViewColumnHeader}">
<Setter Property="Visibility" Value="Collapsed" />
</Style>
</Window.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="4*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" Background="DarkGray">
<DockPanel LastChildFill="False">
<TabControl DockPanel.Dock="Top" DataContext="{Binding ElementName=mainWindow, Path=currentPolygon}">
<TabItem Header="Wierzchołki">
<ListView ItemsSource="{Binding vertices, UpdateSourceTrigger=PropertyChanged}"
IsSynchronizedWithCurrentItem="True" Height="200" >
<ListView.ItemTemplate>
<DataTemplate>
<TextBlock>
<TextBlock.Text>
<MultiBinding Converter="{StaticResource VerticesConverter}">
<Binding Path="VertexText" UpdateSourceTrigger="PropertyChanged" />
<Binding Path="X" UpdateSourceTrigger="PropertyChanged" />
<Binding Path="Y" UpdateSourceTrigger="PropertyChanged" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</TabItem>
<TabItem Header="Krawędzie">
<ListView ItemsSource="{Binding edges, UpdateSourceTrigger=PropertyChanged}"
IsSynchronizedWithCurrentItem="True" Height="200" >
<ListView.ItemTemplate>
<DataTemplate>
<TextBlock>
<TextBlock.Text>
<MultiBinding Converter="{StaticResource EdgesConverter}">
<Binding Path="leftVertex.VertexText" UpdateSourceTrigger="PropertyChanged" />
<Binding Path="rightVertex.VertexText" UpdateSourceTrigger="PropertyChanged" />
<Binding Path="leftVertex.X" UpdateSourceTrigger="PropertyChanged" />
<Binding Path="rightVertex.X" UpdateSourceTrigger="PropertyChanged" />
<Binding Path="leftVertex.Y" UpdateSourceTrigger="PropertyChanged" />
<Binding Path="rightVertex.Y" UpdateSourceTrigger="PropertyChanged" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</TabItem>
<TabItem Header="Relacje">
<StackPanel>
<ListView ItemsSource="{Binding edgesWithRelation, UpdateSourceTrigger=PropertyChanged}"
IsSynchronizedWithCurrentItem="True" Height="200" >
<ListView.View>
<GridView ColumnHeaderContainerStyle="{StaticResource myHeaderStyle}">
<GridViewColumn Width="140">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock>
<TextBlock.Text>
<MultiBinding Converter="{StaticResource RelationConverter}">
<Binding Path="." UpdateSourceTrigger="PropertyChanged"/>
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn>
<GridViewColumn.CellTemplate>
<DataTemplate>
<Button Click="ButtonRemoveRelation_Click">Usuń</Button>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
<!--<ListView.ItemTemplate>
<DataTemplate>
<TextBlock>
<TextBlock.Text>
<MultiBinding Converter="{StaticResource RelationConverter}">
<Binding Path="." UpdateSourceTrigger="PropertyChanged"/>
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</DataTemplate>
</ListView.ItemTemplate>-->
</ListView>
<!--<DockPanel LastChildFill="False" Margin="2,10,2,0">
<Button>Dodaj relacje ORTH:</Button>
<TextBox Name="TextVertex4" DockPanel.Dock="Right" Width="17"/>
<TextBox Name="TextVertex3" DockPanel.Dock="Right" Width="17" />
<TextBlock Margin="5,0,5,0" DockPanel.Dock="Right">,</TextBlock>
<TextBox Name="TextVertex2" DockPanel.Dock="Right" Width="17"/>
<TextBox Name="TextVertex1" DockPanel.Dock="Right" Width="17"/>
</DockPanel>-->
</StackPanel>
</TabItem>
</TabControl>
<DockPanel DockPanel.Dock="Top" Margin="10,20,10,0">
<Button DockPanel.Dock="Top" Click="RemovePolygon_Click">Usuń wielokąt</Button>
<Button DockPanel.Dock="Top" Click="OrthogonalStart_Click" Margin="0,5,0,5" >Dodaj relacje ORTH</Button>
<DockPanel DockPanel.Dock="Top">
<Button Name="BresButt" Click="BresButt_Click" DockPanel.Dock="Left" Margin="0,0,13,0" Width="90">Bresenham</Button>
<Button Name="LibButt" Click="LibButt_Click" DockPanel.Dock="Right" Width="90">Library</Button>
</DockPanel>
</DockPanel>
<DockPanel DockPanel.Dock="Bottom" LastChildFill="False" Margin="0,0,0,30">
<TextBlock TextAlignment="Center" DockPanel.Dock="Bottom" Text="{Binding ActualState, Mode=TwoWay}" Foreground="Black"/>
</DockPanel>
</DockPanel>
</Grid>
<Canvas Name="canvas" Grid.Column="1" Background="LightGray"
MouseRightButtonDown="canvas_MouseRightButtonDown"
MouseMove="canvas_MouseMove"
MouseLeftButtonUp="canvas_MouseLeftButtonUp" MouseLeftButtonDown="canvas_MouseLeftButtonDown"
VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
<Image Name="canvasImage" Source="{Binding PolygonBitmap, Mode=TwoWay}"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
</Canvas>
</Grid>
</Window>