| ofs | hex dump | ascii |
|---|
| 0000 | 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 06 90 00 00 04 1a 08 06 00 00 00 44 97 3b | .PNG........IHDR.............D.; |
| 0020 | 56 00 00 00 06 62 4b 47 44 00 ff 00 ff 00 ff a0 bd a7 93 00 00 00 09 70 48 59 73 00 00 0b 13 00 | V....bKGD..............pHYs..... |
| 0040 | 00 0b 13 01 00 9a 9c 18 00 00 00 07 74 49 4d 45 07 d7 06 0d 0f 1a 38 2d b6 ae 32 00 00 20 00 49 | ............tIME......8-..2....I |
| 0060 | 44 41 54 78 da ec bd db 6e 1d c9 0e 25 48 11 6a b7 fb 0c e6 61 30 98 a7 f9 ff 3f 6c 1c 14 84 0d | DATx....n...%H.j....a0....?l.... |
| 0080 | ba 1f ac 5d ce ca 0a 92 8b 97 88 cc 2d 05 01 c3 b2 2c ed 8c 8c 20 19 bc 2e be 11 d1 ff 24 22 a1 | ...]........-....,...........$". |
| 00a0 | 3f c4 a7 7f 57 49 02 ff df fd 6c 22 22 fa f5 eb 17 bd bd bd fd fd 75 82 b8 71 39 3c 78 e7 27 3d | ?...WI....l"".........u..q9<x.'= |
| 00c0 | de de de 38 b8 a7 d6 9e a5 f6 f3 b9 47 6f 6f 6f 1d 7b 67 ad c9 fa 7a f4 ce dc b4 cf e2 fc bb eb | ...8........Gooo.{g...z......... |
| 00e0 | 1d b9 f8 0e 51 de ec fa 7c 56 64 97 1b 9e c1 ca e7 5a 67 e3 f1 04 4f da c7 99 e7 25 ca 9e 6a 5f | ....Q...|Vd......Zg...O....%..j_ |
| 0100 | 1f d7 f6 83 88 de 93 ba 72 24 67 33 de d3 93 df 88 6e 62 e0 b3 11 59 d4 de 5b 9a f4 fc 94 fb 0b | ........r$g3.....nb...Y..[...... |
| 0120 | d4 6d 5d ef 10 e1 5f 84 67 67 cb 92 24 75 62 64 3d 99 bb e7 fd 79 a7 3b fa ae 4b fe d8 d0 d7 16 | .m]..._.gg..$ubd=....y.;..K..... |
| 0140 | 5f ac 58 5b 45 2f 78 ff ae f0 ed aa 77 1c e9 78 c4 66 58 b1 2e 6b 4f 3a ef fd 2e 3b ca bb 1f 67 | _.X[E/x.....w..x.fX..kO:...;...g |
| 0160 | af 87 27 f0 7c 66 3f 5a 6d 7e c5 16 67 c3 06 43 df e1 8a 33 f2 6c 57 54 4f 56 d7 2e 17 ca 8e 25 | ..'.|f?Zm~..g..C...3.lWTOV.....% |
| 0180 | e7 02 da c0 74 f1 ba 51 be 7e d5 77 5a 49 f2 4d df fb 95 e8 bb 9f cf e6 d1 9a af b3 69 d3 a6 4d | ....t..Q.~.wZI.M............i..M |
| 01a0 | 97 38 68 4c 73 92 47 6c 38 5e d3 9e 7d 4c 76 9c 13 20 cf 7f 07 df 23 f2 7d e4 b3 38 e9 fc 9d 83 | .8hLs.Gl8^..}Lv.......#.}..8.... |
| 01c0 | e6 62 5c 26 a9 e4 d1 71 7f ce 5f 3f ff 34 5c 82 67 de f3 8c 7b 2e 9e 99 1c fe 44 1c 0a 29 f2 bf | .b\&...q.._?.4\.g...{.....D..).. |
| 01e0 | 0c 9c 37 09 ee d9 39 80 c1 0a bf 74 c9 90 90 1e 58 64 65 0f 2b 46 90 80 72 22 4d c1 12 cd b9 d6 | ..7...9....t....Xde.+F..r"M..... |
| 0200 | 9e 39 43 fe cf ff 16 1a 07 53 47 6b 7b 7c fe 99 e5 ac 44 92 fe c8 d7 51 be 61 e3 0c 64 f0 7d e4 | .9C......SGk{|....D....Q.a..d.}. |
| 0220 | 5d 44 d1 a3 9d 49 48 4d 9f f0 84 b3 62 45 3f 78 7c 96 7d 3e 0f f6 dc 4a 44 0a cd 0f a0 45 02 42 | ]D...IHM....bE?x|.}>...JD....E.B |
| 0240 | 33 74 87 f5 ac 8f cf bf df 89 e8 e7 8d 1d bd af e6 80 6e 87 fa eb f9 26 a4 d8 50 b3 ec 36 cb 36 | 3t................n....&..P..6.6 |
| 0260 | af dc bd d5 00 b6 80 7b 96 91 85 51 21 97 80 36 92 b5 36 9e 74 1e 96 cf e3 25 8f 18 e0 b3 cc 59 | .......{...Q!..6..6.t....%.....Y |
| 0280 | 88 62 77 30 f8 3b dd ba 8f 0d 3b 88 41 bb df f2 9b ac df ed be 5b b3 c5 46 92 f0 39 56 14 01 cd | .busing System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Tango.Logging;
using Tango.SharedUI.Controls;
namespace Tango.MachineStudio.Common.Controls
{
/// <summary>
/// Interaction logic for HiveComboControl.xaml
/// </summary>
public partial class HiveComboControl : UserControl
{
public event EventHandler<HexagonControl> SelectedHexagonChanged;
public event EventHandler<int> LAxisValueChanged;
public event EventHandler<int> ResolutionChanged;
public event EventHandler HiveGenerated;
public int Resolution
{
get { return (int)GetValue(ResolutionProperty); }
set { SetValue(ResolutionProperty, value); }
}
public static readonly DependencyProperty ResolutionProperty =
DependencyProperty.Register("Resolution", typeof(int), typeof(HiveComboControl), new PropertyMetadata(1, (d, e) => (d as HiveComboControl).OnResolutionChanged()));
public HexagonControl SelectedHexagon
{
get { return (HexagonControl)GetValue(SelectedHexagonProperty); }
set { SetValue(SelectedHexagonProperty, value); }
}
public static readonly DependencyProperty SelectedHexagonProperty =
DependencyProperty.Register("SelectedHexagon", typeof(HexagonControl), typeof(HiveComboControl), new PropertyMetadata(null, (d, e) => (d as HiveComboControl).OnSelectedHexagonChanged()));
public int LAxisValue
{
get { return (int)GetValue(LAxisValueProperty); }
set { SetValue(LAxisValueProperty, value); }
}
public static readonly DependencyProperty LAxisValueProperty =
DependencyProperty.Register("LAxisValue", typeof(int), typeof(HiveComboControl), new PropertyMetadata(0, (d, e) => (d as HiveComboControl).OnLAxisValueChanged()));
public HexagonControl CenterHexagon
{
get { return hive.CenterHexagon; }
}
public HiveComboControl()
{
InitializeComponent();
hive.HiveGenerated += (x, e) => HiveGenerated?.Invoke(this, new EventArgs());
}
private void OnLAxisValueChanged()
{
LAxisValueChanged?.Invoke(this, LAxisValue);
}
private void OnSelectedHexagonChanged()
{
SelectedHexagonChanged?.Invoke(this, SelectedHexagon);
}
private void OnResolutionChanged()
{
ResolutionChanged?.Invoke(this, Resolution);
}
public void GenerateDemoModeHiveColors(Color originalColor)
{
if (hive.CenterHexagon != null)
{
Random rnd = new Random();
(hive.CenterHexagon.Fill as SolidColorBrush).Color = originalColor;
int counter = 0;
foreach (var hexagon in hive.Hexagons.Where(x => x != hive.CenterHexagon).OrderBy(x => rnd.Next()))
{
(hexagon.Fill as SolidColorBrush).Color = Color.FromRgb((byte)Math.Min(originalColor.R + counter++, 255), (byte)Math.Min((originalColor.G + counter++), 255), (byte)Math.Min((originalColor.B + counter++), 255));
counter += (int)(4d * ((double)Resolution / 4d));
}
}
}
private void OnResolutionUpClicked(object sender, RoutedEventArgs e)
{
if (Resolution < 10)
{
Resolution++;
}
}
private void OnResolutionDownClicked(object sender, RoutedEventArgs e)
{
if (Resolution > 1)
{
Resolution--;
}
}
private void OnRowHiveHexagonSelected(object sender, HexagonControl hexagon)
{
LAxisValue = 2 - hexagon.Row;
}
private void OnHexagonSelected(object sender, HexagonControl e)
{
SelectedHexagon = e;
}
public void SelectHeagon(HexagonControl hexagon)
{
hive.SelectHexagon(hexagon);
SelectedHexagonChanged?.Invoke(this, hexagon);
}
}
}
|