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
Branches anton
No related tags found
No related merge requests found
......@@ -103,11 +103,11 @@ namespace WindStressPRM
{
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>
......
......@@ -14,11 +14,11 @@ namespace WindStressPRM
/// <summary>
/// ширина ячейки (расстояние между соседними по X центрами ячеек, в размерности координат)
/// </summary>
public double Width { get; set; }
public double Width { get; private set; }
/// <summary>
/// высота ячейки (расстояние между соседними по Y центрами ячеек, в размерности координат)
/// </summary>
public double Height { get; set; }
public double Height { get; private set; }
/// <summary>
/// designated constructor
/// </summary>
......
......@@ -18,20 +18,24 @@ namespace WindStressPRM
/// Inner index
/// Внутренний индекс
/// </summary>
public int Col { get; private set; }
public int Column { get; private set; }
/// <summary>
/// designated constructor
/// </summary>
/// <param name="Row">row 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;
this.Col = Col;
if (column < 0)
{
throw new System.ArgumentOutOfRangeException("Column", column, "Expected >=0");
}
this.Row = row;
this.Column = column;
}
}
}
......@@ -20,7 +20,7 @@ namespace WindStressPRM
/// <returns></returns>
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>
/// get index of cell for coordinate
......
......@@ -338,21 +338,21 @@ namespace WindStressPRM
}
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
{
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
Index rcBotLeft = new Index(Math.Min(row2, rc.Row), Math.Min(col2, rc.Col));
Index rcBotRight = new Index(Math.Max(row2, rc.Row), Math.Min(col2, rc.Col));
Index rcTopLeft = new Index(Math.Min(row2, rc.Row), Math.Max(col2, rc.Col));
Index rcTopRight = new Index(Math.Max(row2, rc.Row), Math.Max(col2, rc.Col));
double valBotLeft = valueGetter(matrix.Cells[rcBotLeft.Row, rcBotLeft.Col]);
double valBotRight = valueGetter(matrix.Cells[rcBotRight.Row, rcBotRight.Col]);
double valTopLeft = valueGetter(matrix.Cells[rcTopLeft.Row, rcTopLeft.Col]);
double valTopRight = valueGetter(matrix.Cells[rcTopRight.Row, rcTopRight.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.Column));
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.Column));
double valBotLeft = valueGetter(matrix.Cells[rcBotLeft.Row, rcBotLeft.Column]);
double valBotRight = valueGetter(matrix.Cells[rcBotRight.Row, rcBotRight.Column]);
double valTopLeft = valueGetter(matrix.Cells[rcTopLeft.Row, rcTopLeft.Column]);
double valTopRight = valueGetter(matrix.Cells[rcTopRight.Row, rcTopRight.Column]);
Coordinate origin = matrix.CellToProjection(rcBotLeft);
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