------------------------------------------------------------------------------
| 1489 | |
| 1490 | //------------------------------------------------------------------------------ |
| 1491 | void vtkNetCDFCFReader::Add2DSphericalCoordinates(vtkPoints* points, const int extent[6]) |
| 1492 | { |
| 1493 | points->SetDataTypeToDouble(); |
| 1494 | points->Allocate( |
| 1495 | (extent[1] - extent[0] + 1) * (extent[3] - extent[2] + 1) * (extent[5] - extent[4] + 1)); |
| 1496 | |
| 1497 | vtkDependentDimensionInfo* info = this->FindDependentDimensionInfo(this->LoadingDimensions); |
| 1498 | |
| 1499 | vtkDoubleArray* longitudeCoordinates = info->GetLongitudeCoordinates(); |
| 1500 | vtkDoubleArray* latitudeCoordinates = info->GetLatitudeCoordinates(); |
| 1501 | |
| 1502 | vtkDoubleArray* verticalCoordinates = nullptr; |
| 1503 | if (this->LoadingDimensions->GetNumberOfTuples() == 3) |
| 1504 | { |
| 1505 | int vertDim = this->LoadingDimensions->GetValue(0); |
| 1506 | if (info->GetHasBounds()) |
| 1507 | { |
| 1508 | verticalCoordinates = this->GetDimensionInfo(vertDim)->GetBounds(); |
| 1509 | } |
| 1510 | else |
| 1511 | { |
| 1512 | verticalCoordinates = this->GetDimensionInfo(vertDim)->GetCoordinates(); |
| 1513 | } |
| 1514 | } |
| 1515 | |
| 1516 | // Check the height scale and bias. |
| 1517 | double vertScale = this->VerticalScale; |
| 1518 | double vertBias = this->VerticalBias; |
| 1519 | if (verticalCoordinates) |
| 1520 | { |
| 1521 | double* verticalRange = verticalCoordinates->GetRange(); |
| 1522 | if ((verticalRange[0] * vertScale + vertBias < 0) || |
| 1523 | (verticalRange[1] * vertScale + vertBias < 0)) |
| 1524 | { |
| 1525 | vertBias = -std::min(verticalRange[0], verticalRange[1]) * vertScale; |
| 1526 | } |
| 1527 | } |
| 1528 | else |
| 1529 | { |
| 1530 | if (vertScale + vertBias <= 0) |
| 1531 | { |
| 1532 | vertScale = 1.0; |
| 1533 | vertBias = 0.0; |
| 1534 | } |
| 1535 | } |
| 1536 | |
| 1537 | for (int k = extent[4]; k <= extent[5]; k++) |
| 1538 | { |
| 1539 | double h; |
| 1540 | if (verticalCoordinates) |
| 1541 | { |
| 1542 | h = verticalCoordinates->GetValue(k) * vertScale + vertBias; |
| 1543 | } |
| 1544 | else |
| 1545 | { |
| 1546 | h = vertScale + vertBias; |
| 1547 | } |
| 1548 | for (int j = extent[2]; j <= extent[3]; j++) |
no test coverage detected