Exemple #1
0
        public static double GetTrueHeight(double cellRadius, int columns, int rows)
        {
            double cellHeight = HexDrawingInformations.GetCellHeight(cellRadius);

            return(rows * cellHeight
                   + (columns > 1 ? cellHeight / 2 : 0));
        }
Exemple #2
0
 public static void HexLabel_Update(HexDrawingInformations hexDrawingData, Grid gridLabel)
 {
     gridLabel.Width = gridLabel.Height = (2 * hexDrawingData.CellRadius) * 0.8;
     gridLabel.SetValue(Canvas.LeftProperty, hexDrawingData.CellX - hexDrawingData.CellRadius * 0.8);
     gridLabel.SetValue(Canvas.TopProperty, hexDrawingData.CellY - hexDrawingData.CellRadius * 0.8);
     gridLabel.IsHitTestVisible = false;
 }
Exemple #3
0
        public static double GetTrueWidth(double cellRadius, int columns)
        {
            double cellWidth = HexDrawingInformations.GetCellWidth(cellRadius);
            double maxCellX  = HexDrawingInformations.GetCellX(cellRadius, columns - 1);

            return(maxCellX + (cellWidth / 2));
        }
Exemple #4
0
 public static void InsidePolygon_Update(HexDrawingInformations hexDrawingData, Polygon insidePolygon)
 {
     insidePolygon.Points.Clear();
     foreach (var outerSummitPoint in hexDrawingData.ListOuterSummitPoints)
     {
         insidePolygon.Points.Add(outerSummitPoint);
     }
     Canvas.SetZIndex(insidePolygon, ZIndexes.InsidePolygon);
 }
Exemple #5
0
        public static void BorderPolygon_Draw(HexDrawingInformations hexDrawingData, Polygon borderPolygon)
        {
            borderPolygon.Tag = "BorderPolygon";
            borderPolygon.Points.Clear();
            foreach (var outerSummitPoint in hexDrawingData.ListOuterSummitPoints)
            {
                borderPolygon.Points.Add(outerSummitPoint);
            }

            BorderPolygon_UpdateSelected(hexDrawingData, borderPolygon, false);
        }
Exemple #6
0
 public static void HexLineExploration_Update(HexDrawingInformations hexDrawingData, List <Line> listLineExploration)
 {
     for (int i = 0; i < 6; i++)
     {
         listLineExploration[i].X1              = hexDrawingData.ListOuterSummitPoints[i].X;
         listLineExploration[i].Y1              = hexDrawingData.ListOuterSummitPoints[i].Y;
         listLineExploration[i].X2              = hexDrawingData.ListInnerSummitPoints[i].X;
         listLineExploration[i].Y2              = hexDrawingData.ListInnerSummitPoints[i].Y;
         listLineExploration[i].Tag             = "Line";
         listLineExploration[i].Stroke          = new SolidColorBrush(Colors.Gold);
         listLineExploration[i].StrokeThickness = hexDrawingData.CellRadius / 8;
     }
 }
Exemple #7
0
        public static void HexLabel_UpdateLabel(HexDrawingInformations hexDrawingData, Grid gridLabel, string label)
        {
            gridLabel.Children.Clear();
            var labelTextBlock = new TextBlock
            {
                Text       = label,
                FontFamily = new FontFamily("Segoe"),
                FontSize   = hexDrawingData.CellRadius / 3.5,
                Background = new SolidColorBrush(Colors.Azure),
            };

            labelTextBlock.HorizontalAlignment = HorizontalAlignment.Center;
            labelTextBlock.VerticalAlignment   = VerticalAlignment.Bottom;
            labelTextBlock.IsHitTestVisible    = false;
            labelTextBlock.FontWeight          = FontWeights.Bold;
            Canvas.SetZIndex(gridLabel, ZIndexes.HexLabel);
            gridLabel.Children.Add(labelTextBlock);
        }
Exemple #8
0
        public static void HexLineExploration_Draw(HexDrawingInformations hexDrawingData, List <Line> listLineExploration, int degreExploration)
        {
            listLineExploration.Clear();

            for (int i = 0; i < 6; i++)
            {
                Line lineExploration = new Line();
                lineExploration.X1              = hexDrawingData.ListOuterSummitPoints[i].X;
                lineExploration.Y1              = hexDrawingData.ListOuterSummitPoints[i].Y;
                lineExploration.X2              = hexDrawingData.ListInnerSummitPoints[i].X;
                lineExploration.Y2              = hexDrawingData.ListInnerSummitPoints[i].Y;
                lineExploration.Tag             = "Line";
                lineExploration.Stroke          = new SolidColorBrush(Colors.Gold);
                lineExploration.StrokeThickness = hexDrawingData.CellRadius / 8;
                Canvas.SetZIndex(lineExploration, ZIndexes.LineExploration);
                LineExploration_UpdateVisibility(lineExploration, i, degreExploration);
                listLineExploration.Add(lineExploration);
            }
        }
Exemple #9
0
 public static void HexLabel_Draw(HexDrawingInformations hexDrawingData, Grid gridLabel, string label)
 {
     gridLabel.Tag = "Label";
     HexLabel_Update(hexDrawingData, gridLabel);
     HexLabel_UpdateLabel(hexDrawingData, gridLabel, label);
 }
Exemple #10
0
 public static void BorderPolygon_UpdateSelected(HexDrawingInformations hexDrawingData, Polygon borderPolygon, bool selected)
 {
     borderPolygon.Stroke          = new SolidColorBrush(selected ? Colors.DarkOrange : Colors.Black);
     borderPolygon.StrokeThickness = hexDrawingData.CellRadius / (selected ? 5 : 10);
     Canvas.SetZIndex(borderPolygon, selected ? ZIndexes.BorderPlygonSelected : ZIndexes.BorderPlygonUnelected);
 }
Exemple #11
0
 public static void InsidePolygon_Draw(HexDrawingInformations hexDrawingData, Polygon insidePolygon /*, Color color, Bitmap bitmap*/)
 {
     insidePolygon.Tag = "InsidePolygon";
     InsidePolygon_Update(hexDrawingData, insidePolygon);
     //InsidePolygon_UpdateFill(insidePolygon, color, bitmap);
 }