------------------------------------------------------------------------------
| 224 | |
| 225 | //------------------------------------------------------------------------------ |
| 226 | bool OMFProject::ProcessJSON(vtkPartitionedDataSetCollection* output, |
| 227 | vtkDataArraySelection* selection, bool writeOutTextures, bool columnMajorOrder) |
| 228 | { |
| 229 | // loop thru elements and add processed elements to output |
| 230 | |
| 231 | // here we have the higher level elements of the data set |
| 232 | // eg line set, point set, surfaces, etc |
| 233 | // projRoot["elements"] only contains the uid of these elements |
| 234 | const Json::Value& projRoot = this->Impl->ProjectFile->JSONRoot()[this->Impl->UID]; |
| 235 | if (projRoot.isNull()) |
| 236 | { |
| 237 | vtkGenericWarningMacro(<< "Missing project root node for UID " << this->Impl->UID); |
| 238 | return false; |
| 239 | } |
| 240 | |
| 241 | std::string name; |
| 242 | helper::GetStringValue(projRoot["name"], name); |
| 243 | if (name.empty()) |
| 244 | { |
| 245 | name = "OMF"; |
| 246 | } |
| 247 | output->GetDataAssembly()->SetRootNodeName(name.c_str()); |
| 248 | |
| 249 | const Json::Value& elements = projRoot["elements"]; |
| 250 | if (elements.isNull() || !elements.isArray()) |
| 251 | { |
| 252 | vtkGenericWarningMacro(<< "ProcessJSON: Missing elements node under project node"); |
| 253 | return false; |
| 254 | } |
| 255 | |
| 256 | for (Json::Value::ArrayIndex i = 0; i < elements.size(); ++i) |
| 257 | { |
| 258 | if (elements[i].isNull()) |
| 259 | { |
| 260 | continue; |
| 261 | } |
| 262 | if (!elements[i].isString()) |
| 263 | { |
| 264 | vtkGenericWarningMacro(<< "element " << i << " is not a string. It should be a UID."); |
| 265 | continue; |
| 266 | } |
| 267 | std::string uid; |
| 268 | helper::GetStringValue(elements[i], uid); |
| 269 | this->Impl->ProcessElement(uid, output, selection, writeOutTextures, columnMajorOrder); |
| 270 | } |
| 271 | return true; |
| 272 | } |
| 273 | |
| 274 | VTK_ABI_NAMESPACE_END |
| 275 | } // end namespace omf |
no test coverage detected