Skip to content
Snippets Groups Projects
Commit f8711410 authored by Антон Кудряшов's avatar Антон Кудряшов
Browse files

fixed last comments for index, cellsize, powerline and powerstation classes

parent 45bf6823
No related branches found
No related tags found
No related merge requests found
...@@ -103,11 +103,11 @@ namespace WindStressPRM ...@@ -103,11 +103,11 @@ namespace WindStressPRM
{ {
if (Identifier < 0) if (Identifier < 0)
{ {
throw new System.ArgumentOutOfRangeException("Identifier", Identifier, "Identifer expected to be more than 0"); throw new System.ArgumentOutOfRangeException("Identifier", Identifier, "Expected >=0");
} }
if (Voltage < 0 || Voltage > 1500) if (Voltage <= 0 || Voltage > 1500)
{ {
throw new System.ArgumentOutOfRangeException("Voltage", Voltage, "Voltage expected to be in range (0,1500)"); throw new System.ArgumentOutOfRangeException("Voltage", Voltage, "Expected 0<Voltage<=1500");
} }
} }
/// <summary> /// <summary>
......
...@@ -14,11 +14,11 @@ namespace WindStressPRM ...@@ -14,11 +14,11 @@ namespace WindStressPRM
/// <summary> /// <summary>
/// ширина ячейки (расстояние между соседними по X центрами ячеек, в размерности координат) /// ширина ячейки (расстояние между соседними по X центрами ячеек, в размерности координат)
/// </summary> /// </summary>
public double Width { get; set; } public double Width { get; private set; }
/// <summary> /// <summary>
/// высота ячейки (расстояние между соседними по Y центрами ячеек, в размерности координат) /// высота ячейки (расстояние между соседними по Y центрами ячеек, в размерности координат)
/// </summary> /// </summary>
public double Height { get; set; } public double Height { get; private set; }
/// <summary> /// <summary>
/// designated constructor /// designated constructor
/// </summary> /// </summary>
......
...@@ -18,20 +18,24 @@ namespace WindStressPRM ...@@ -18,20 +18,24 @@ namespace WindStressPRM
/// Inner index /// Inner index
/// Внутренний индекс /// Внутренний индекс
/// </summary> /// </summary>
public int Col { get; private set; } public int Column { get; private set; }
/// <summary> /// <summary>
/// designated constructor /// designated constructor
/// </summary> /// </summary>
/// <param name="Row">row index</param> /// <param name="Row">row index</param>
/// <param name="Col">column index</param> /// <param name="Col">column index</param>
public Index(int Row, int Col) public Index(int row, int column)
{ {
if (Row <= -1 || Col <= -1) if (row < 0)
{ {
throw new System.ArgumentOutOfRangeException("Index must be initialized with nonegative integer value"); throw new System.ArgumentOutOfRangeException("Row", row, "Expected >=0");
} }
this.Row = Row; if (column < 0)
this.Col = Col; {
throw new System.ArgumentOutOfRangeException("Column", column, "Expected >=0");
}
this.Row = row;
this.Column = column;
} }
} }
} }
...@@ -20,7 +20,7 @@ namespace WindStressPRM ...@@ -20,7 +20,7 @@ namespace WindStressPRM
/// <returns></returns> /// <returns></returns>
public Coordinate CellToProjection(Index index) public Coordinate CellToProjection(Index index)
{ {
return new Coordinate(Origin.X + index.Row*Size.Width, Origin.Y - index.Col*Size.Height); return new Coordinate(Origin.X + index.Row*Size.Width, Origin.Y - index.Column*Size.Height);
} }
/// <summary> /// <summary>
/// get index of cell for coordinate /// get index of cell for coordinate
......
...@@ -338,21 +338,21 @@ namespace WindStressPRM ...@@ -338,21 +338,21 @@ namespace WindStressPRM
} }
if ((yDiff >= 0 && normalY) || (!normalY && yDiff < 0)) if ((yDiff >= 0 && normalY) || (!normalY && yDiff < 0))
{ {
col2 = rc.Col >= matrix.ColumnCount() - 1 ? rc.Col - 1 : rc.Col + 1; col2 = rc.Column >= matrix.ColumnCount() - 1 ? rc.Column - 1 : rc.Column + 1;
} }
else else
{ {
col2 = rc.Col > 0 ? rc.Col - 1 : rc.Col + 1; col2 = rc.Column > 0 ? rc.Column - 1 : rc.Column + 1;
} }
// indexes and values at bounds // indexes and values at bounds
Index rcBotLeft = new Index(Math.Min(row2, rc.Row), Math.Min(col2, rc.Col)); Index rcBotLeft = new Index(Math.Min(row2, rc.Row), Math.Min(col2, rc.Column));
Index rcBotRight = new Index(Math.Max(row2, rc.Row), Math.Min(col2, rc.Col)); Index rcBotRight = new Index(Math.Max(row2, rc.Row), Math.Min(col2, rc.Column));
Index rcTopLeft = new Index(Math.Min(row2, rc.Row), Math.Max(col2, rc.Col)); Index rcTopLeft = new Index(Math.Min(row2, rc.Row), Math.Max(col2, rc.Column));
Index rcTopRight = new Index(Math.Max(row2, rc.Row), Math.Max(col2, rc.Col)); Index rcTopRight = new Index(Math.Max(row2, rc.Row), Math.Max(col2, rc.Column));
double valBotLeft = valueGetter(matrix.Cells[rcBotLeft.Row, rcBotLeft.Col]); double valBotLeft = valueGetter(matrix.Cells[rcBotLeft.Row, rcBotLeft.Column]);
double valBotRight = valueGetter(matrix.Cells[rcBotRight.Row, rcBotRight.Col]); double valBotRight = valueGetter(matrix.Cells[rcBotRight.Row, rcBotRight.Column]);
double valTopLeft = valueGetter(matrix.Cells[rcTopLeft.Row, rcTopLeft.Col]); double valTopLeft = valueGetter(matrix.Cells[rcTopLeft.Row, rcTopLeft.Column]);
double valTopRight = valueGetter(matrix.Cells[rcTopRight.Row, rcTopRight.Col]); double valTopRight = valueGetter(matrix.Cells[rcTopRight.Row, rcTopRight.Column]);
Coordinate origin = matrix.CellToProjection(rcBotLeft); Coordinate origin = matrix.CellToProjection(rcBotLeft);
bool testBotLeft = Double.IsNaN(valBotLeft); bool testBotLeft = Double.IsNaN(valBotLeft);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment