------------------------------------------------------------------------------
| 106 | |
| 107 | //------------------------------------------------------------------------------ |
| 108 | bool vtkSegYReaderInternal::Is3DComputeParameters( |
| 109 | int* extent, double origin[3], double spacing[3][3], int* spacingSign, bool force2D) |
| 110 | { |
| 111 | this->ReadHeader(); |
| 112 | std::streamoff traceStartPos = FIRST_TRACE_START_POS; |
| 113 | std::streamoff fileSize = vtkSegYIOUtils::Instance()->getFileSize(this->In); |
| 114 | int inlineNumber = 0, crosslineNumber; |
| 115 | int xCoord = 0, yCoord = 0; |
| 116 | short coordMultiplier = 0; |
| 117 | |
| 118 | size_t traceCount = 0; |
| 119 | |
| 120 | // for the forced 2D case we ignore lines/crosslines and just stitch together the |
| 121 | // traces in order applying their x,y coordinates |
| 122 | if (force2D) |
| 123 | { |
| 124 | while (traceStartPos + 240 < fileSize) |
| 125 | { |
| 126 | this->TraceReader->ReadInlineCrossline(traceStartPos, this->In, this->FormatCode, |
| 127 | &inlineNumber, &crosslineNumber, &xCoord, &yCoord, &coordMultiplier); |
| 128 | traceCount++; |
| 129 | } |
| 130 | extent[0] = 0; |
| 131 | extent[1] = static_cast<int>(traceCount - 1); |
| 132 | extent[2] = 0; |
| 133 | extent[3] = 0; |
| 134 | extent[4] = 0; |
| 135 | extent[5] = this->SampleCountPerTrace - 1; |
| 136 | return false; |
| 137 | } |
| 138 | |
| 139 | // compute the dimensions of the dataset, to be safe we |
| 140 | // look at all the traces and compute the set of inline |
| 141 | // and crossline indices |
| 142 | std::set<int> crossLines; |
| 143 | std::map<int, std::array<double, 3>> crossCoordinates; |
| 144 | std::set<int> inLines; |
| 145 | int basisPointCount = 0; |
| 146 | double basisCoords[3][3]; |
| 147 | int basisIndex[3][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 } }; |
| 148 | double iBasis[2][3]; |
| 149 | double basisLength[2]; |
| 150 | |
| 151 | while (traceStartPos + 240 < fileSize) |
| 152 | { |
| 153 | this->TraceReader->ReadInlineCrossline(traceStartPos, this->In, this->FormatCode, &inlineNumber, |
| 154 | &crosslineNumber, &xCoord, &yCoord, &coordMultiplier); |
| 155 | traceCount++; |
| 156 | double coordinateMultiplier = decodeMultiplier(coordMultiplier); |
| 157 | |
| 158 | // store a third point, must have different basis from |
| 159 | // first two |
| 160 | if (basisPointCount == 2) |
| 161 | { |
| 162 | iBasis[1][0] = crosslineNumber - basisIndex[0][0]; |
| 163 | iBasis[1][1] = inlineNumber - basisIndex[0][1]; |
| 164 | iBasis[1][2] = 0.0; |
| 165 | basisLength[1] = vtkMath::Normalize(iBasis[1]); |
no test coverage detected