Esempio n. 1
0
 /// <summary>
 /// Another constructor for lines
 /// </summary>
 /// <param name="lineEntity"></param>
 /// <param name="x"></param>
 /// <param name="y"></param>
 public AllPurpuseEntity(LineEntity lineEntity, int x, int y)
 {
     LineEntity = lineEntity;
     X          = x;
     Y          = y;
     TypeE      = EntityType.Line;
     ColorBrush = Brushes.Black;
 }
Esempio n. 2
0
 public PowerGrid(int x, int y)
 {
     _width        = x;
     _height       = y;
     Grid          = new PowerEntity[_width + 1, _height + 1];
     LineGrid      = new LineEntity[_width + 1, _height + 1];
     PowerEntities = new Dictionary <long, PowerEntity>();
     LineEntities  = new Dictionary <long, LineEntity>();
 }
Esempio n. 3
0
 public void AssignLine(LineEntity l)
 {
     /*
      * if (PowerEntities.Values.Where(x => x.Id == l.FirstEnd).Count() > 0 && PowerEntities.Values.Where(x => x.Id == l.SecondEnd).Count() > 0
      *  && LineEntities.Values.Where(x => x.FirstEnd == l.FirstEnd && x.SecondEnd == l.SecondEnd).Count() == 0)
      * {
      *  LineEntities.Add(l.Id, l);
      * }
      */
     LineEntities.Add(l.Id, l);
 }
Esempio n. 4
0
        private double GetLineLenght(LineEntity l)
        {
            PowerEntity start = PowerEntities[l.FirstEnd];
            PowerEntity end   = PowerEntities[l.SecondEnd];

            double diffX = start.GridPosition.Item1 - end.GridPosition.Item1;
            double diffY = start.GridPosition.Item2 - end.GridPosition.Item2;

            double lenght = Math.Sqrt((diffX) * (diffX) + (diffY) * (diffY));

            return(lenght);
        }
Esempio n. 5
0
 public void AddEdge(LineEntity edge)
 {
     foreach (var node in AdjacencyList.Keys)
     {
         if (node != null)                        // ako nije prazno polje matrice
         {
             if (node.Entity.Id == edge.FirstEnd) // ako im se poklapaju
             {
                 foreach (var node2 in AdjacencyList.Keys)
                 {
                     if (node2 != null)
                     {
                         if (node2.Entity.Id == edge.SecondEnd)
                         {
                             AdjacencyList[node].Add(node2);
                             AdjacencyList[node2].Add(node);
                         }
                     }
                 }
             }
         }
     }
 }
Esempio n. 6
0
 public AllPurpuseEntity(LineEntity lineEntity, EntityType typeE, Brush colorBrush)
 {
     LineEntity = lineEntity;
     TypeE      = typeE;
     ColorBrush = colorBrush;
 }