Ejemplo n.º 1
0
 public  ModelBuilder(IdentifiedObject thisModelObject)
 {
     modelObject = thisModelObject;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Adds the icon and connection for a piece of equipment that has only one terminal at the location
 /// </summary>
 /// <param name="t"></param>
 /// <param name="icns"></param>
 /// <param name="r"></param>
 int fillInSingle(Terminal t, Equipment eq, string[,] icns, int r, IdentifiedObject[,] refs){
     var c = nodeColumns[t.ConnectionPoint];
     icns[r, c] = "connectedbus";
     icns[r, c + 1] = String.Format("{0}{1}", eq.Type, eq.State());
     refs[r, c + 1] = eq;
     return c + 2;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Returns a definition for a view with no connections between busses
 /// </summary>
 /// <param name="busCount"></param>
 /// <param name="width"></param>
 /// <param name="height"></param>
 /// <returns></returns>
 private Tuple<string[,],IdentifiedObject[,]> emptyView(int busCount, int width, int height){
     var expDim = (2 * busCount);
     var expH = thisLocation.Terminals.Count;
     Width = Math.Max(expDim, width);
     Height = Math.Max(expH, height);
     var icns = new string[Height, Width];
     var refs = new IdentifiedObject[Height, Width];            
     //Draw each bus and the adjoining space at the same time
     var bw = busCount * 2 - 1;
     for (int i = 0; i <= bw; i += 2){
         ConnectivityNode thisref = nodeColumns.Single(x => x.Value == i).Key;
         for (int j = 0; j < Height; j++){
             icns[j, i] = "bus";
             icns[j, i + 1] = "blank";
             refs[j, i] = thisref;
         }
     }
     for (int i = bw; i < Width; i++){
         for (int j = 0; j < Height; j++){
             icns[j, i] = "blank";
         }
     }
     return new Tuple<string[,],IdentifiedObject[,]>(icns,refs);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Draws the Equipment and wires which span between terminals.
 /// </summary>
 /// <param name="t1"></param>
 /// <param name="t2"></param>
 /// <param name="pe"></param>
 /// <param name="icns"></param>
 /// <param name="r"></param>
 /// <returns></returns>
 int fillInConnection(Terminal t1, Terminal t2, Equipment pe, string[,] icns, int r, IdentifiedObject[,] refs){
     int st = nodeColumns[t1.ConnectionPoint];
     int en = nodeColumns[t2.ConnectionPoint];
     icns[r, st] = "connectedbus";
     icns[r, en] = "connectedbus";
     icns[r, st + 1] = String.Format("{0}{1}", pe.Type, pe.State());
     refs[r, st + 1] = pe;
     for(int i = st + 2; i < en; i++){
         icns[r, i] = (icns[r, i] == "bus") ? "noconnectionbus" : "wire";
     }
     return en;
 }