diff --git a/WindStressPRM/Objects/PowerStation.cs b/WindStressPRM/Objects/PowerStation.cs index 0e7846038b5442a7bf761efc8b67ce28437b5484..90120465245bafd9a752de1a96406520b094f89e 100644 --- a/WindStressPRM/Objects/PowerStation.cs +++ b/WindStressPRM/Objects/PowerStation.cs @@ -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> diff --git a/WindStressPRM/Utils/CellSize.cs b/WindStressPRM/Utils/CellSize.cs index f0e5f19cb1d7131e06c24d5221946a51995b7df4..c0f9848917411e2694af7cb158eda312fa113530 100644 --- a/WindStressPRM/Utils/CellSize.cs +++ b/WindStressPRM/Utils/CellSize.cs @@ -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> diff --git a/WindStressPRM/Utils/Index.cs b/WindStressPRM/Utils/Index.cs index 089241c066d0c31ddad48279d4562075e6f5c660..bca01ce9c3b3bfa4641e1ac827829df821cd02e4 100644 --- a/WindStressPRM/Utils/Index.cs +++ b/WindStressPRM/Utils/Index.cs @@ -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; } } } diff --git a/WindStressPRM/Utils/Matrix.cs b/WindStressPRM/Utils/Matrix.cs index 51f81f64afd78429be5c92ce5a32d8405ed4da27..abfbbf2d6bd78f10122d28538a5d0dcad4993823 100644 --- a/WindStressPRM/Utils/Matrix.cs +++ b/WindStressPRM/Utils/Matrix.cs @@ -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 diff --git a/WindStressPRM/WindStressPRM.cs b/WindStressPRM/WindStressPRM.cs index 99f8551cd35ea20bb8e46f5b2dead9dae65c94b0..6ee183a730f7d90c3fb48e73a5e43e3515703f86 100644 --- a/WindStressPRM/WindStressPRM.cs +++ b/WindStressPRM/WindStressPRM.cs @@ -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);