------------------------------------------------------------------------------
| 223 | |
| 224 | //------------------------------------------------------------------------------ |
| 225 | int vtkExtentSplitter::ComputeSubExtents() |
| 226 | { |
| 227 | // Assume success. |
| 228 | int result = 1; |
| 229 | |
| 230 | vtkExtentSplitterInternals::SubExtentsType subExtents; |
| 231 | int bestPriority; |
| 232 | int dimensionality = 0; |
| 233 | |
| 234 | while (!this->Internal->Queue.empty()) |
| 235 | { |
| 236 | // Pop the next extent off the queue. |
| 237 | vtkExtentSplitterExtent e = this->Internal->Queue.front(); |
| 238 | this->Internal->Queue.pop(); |
| 239 | |
| 240 | // In non-PointMode, intersections must have the same topological |
| 241 | // dimension as the original extent. This will prevent |
| 242 | // high-priority source extents from repeatedly producing |
| 243 | // single-point-wide intersections. |
| 244 | if (!this->PointMode) |
| 245 | { |
| 246 | dimensionality = (((e.extent[1] - e.extent[0] > 0) ? 1 : 0) + |
| 247 | ((e.extent[3] - e.extent[2] > 0) ? 1 : 0) + ((e.extent[5] - e.extent[4] > 0) ? 1 : 0)); |
| 248 | } |
| 249 | |
| 250 | // Intersect the extent with each extent source. |
| 251 | subExtents.clear(); |
| 252 | bestPriority = -1; |
| 253 | vtkExtentSplitterSubExtent se; |
| 254 | for (vtkExtentSplitterInternals::SourcesType::const_iterator src = |
| 255 | this->Internal->Sources.begin(); |
| 256 | src != this->Internal->Sources.end(); ++src) |
| 257 | { |
| 258 | se.source = src->first; |
| 259 | if (this->IntersectExtents(e.extent, src->second.extent, se.extent) && |
| 260 | (this->PointMode || |
| 261 | (dimensionality == |
| 262 | (((se.extent[1] - se.extent[0] > 0) ? 1 : 0) + |
| 263 | ((se.extent[3] - se.extent[2] > 0) ? 1 : 0) + |
| 264 | ((se.extent[5] - se.extent[4] > 0) ? 1 : 0))))) |
| 265 | { |
| 266 | // Non-zero intersection volume. Add the extent as a |
| 267 | // candidate for best extent. |
| 268 | if (src->second.priority > bestPriority) |
| 269 | { |
| 270 | // New highest priority. Clear previous intersections with |
| 271 | // lower priority. |
| 272 | subExtents.clear(); |
| 273 | subExtents.push_back(se); |
| 274 | bestPriority = src->second.priority; |
| 275 | } |
| 276 | else if (src->second.priority == bestPriority) |
| 277 | { |
| 278 | // Matching priority. Add this intersection to the list. |
| 279 | subExtents.push_back(se); |
| 280 | } |
| 281 | } |
| 282 | } |
no test coverage detected