------------------------------------------------------------------------------
| 2985 | |
| 2986 | //------------------------------------------------------------------------------ |
| 2987 | bool EnSightDataSet::ReadRigidBodyGeometryFile() |
| 2988 | { |
| 2989 | if (!this->RigidBodyFile.SetFileNamePattern(this->RigidBodyFileName, true)) |
| 2990 | { |
| 2991 | vtkGenericWarningMacro("Rigid body file " << this->RigidBodyFileName << " could not be opened"); |
| 2992 | return false; |
| 2993 | } |
| 2994 | |
| 2995 | this->RigidBodyTransforms.clear(); |
| 2996 | this->EulerTransformsMap.clear(); |
| 2997 | this->UseEulerTimeSteps = false; |
| 2998 | this->EulerTimeSteps.clear(); |
| 2999 | |
| 3000 | auto result = this->RigidBodyFile.ReadNextLine(); |
| 3001 | if (!result.first || result.second.find("EnSight Rigid Body") == std::string::npos) |
| 3002 | { |
| 3003 | vtkGenericWarningMacro("The first line " << result.second << " is not 'EnSight Rigid Body'."); |
| 3004 | return false; |
| 3005 | } |
| 3006 | |
| 3007 | // read the version now |
| 3008 | result = this->RigidBodyFile.ReadNextLine(); |
| 3009 | if (!result.first || result.second.find("version") == std::string::npos) |
| 3010 | { |
| 3011 | vtkGenericWarningMacro("The first line " << result.second << " is not 'EnSight Rigid Body'."); |
| 3012 | return false; |
| 3013 | } |
| 3014 | |
| 3015 | float version; |
| 3016 | extractLinePart(GetNumRegEx(), result.second, version); |
| 3017 | if (version != 2.0) |
| 3018 | { |
| 3019 | vtkGenericWarningMacro("currently only version 2.0 of the rigid body format is supported."); |
| 3020 | return false; |
| 3021 | } |
| 3022 | |
| 3023 | // read "names" or "numbers" |
| 3024 | result = this->RigidBodyFile.ReadNextLine(); |
| 3025 | if (!result.first) |
| 3026 | { |
| 3027 | vtkGenericWarningMacro("There was an issue reading the names/numbers line"); |
| 3028 | return false; |
| 3029 | } |
| 3030 | this->UsePartNamesRB = result.second.find("names") != std::string::npos; |
| 3031 | |
| 3032 | int numParts; |
| 3033 | this->RigidBodyFile.ReadNumber(&numParts); |
| 3034 | |
| 3035 | // read the number of following part names / part numbers |
| 3036 | result = this->RigidBodyFile.ReadNextLine(); // either a part name or number |
| 3037 | int idx = 0; |
| 3038 | while (result.first && idx < numParts) |
| 3039 | { |
| 3040 | // handle line which is either a part name or number |
| 3041 | int partId; |
| 3042 | std::string partName = result.second; |
| 3043 | sanitize(partName); |
| 3044 | if (!this->UsePartNamesRB) |
nothing calls this directly
no test coverage detected