------------------------------------------------------------------------------
| 203 | |
| 204 | //------------------------------------------------------------------------------ |
| 205 | int vtkVRMLImporter::ImportBegin() |
| 206 | { |
| 207 | int ret = 1; |
| 208 | try |
| 209 | { |
| 210 | this->ActorCollection->RemoveAllItems(); |
| 211 | this->LightCollection->RemoveAllItems(); |
| 212 | |
| 213 | if (this->CurrentTransform) |
| 214 | { |
| 215 | this->CurrentTransform->Delete(); |
| 216 | } |
| 217 | this->CurrentTransform = vtkTransform::New(); |
| 218 | |
| 219 | this->Parser->CurrentProtoStack = nullptr; |
| 220 | this->Parser->memyyInput_i = 0; |
| 221 | this->Parser->memyyInput_j = 0; |
| 222 | |
| 223 | vtkVRMLAllocator::Initialize(); |
| 224 | this->Parser->typeList = new vtkVRMLVectorType<VrmlNodeType*>; |
| 225 | this->Parser->typeList->Init(); |
| 226 | |
| 227 | this->Parser->useList = new vtkVRMLVectorType<vtkVRMLUseStruct*>; |
| 228 | this->Parser->useList->Init(); |
| 229 | |
| 230 | this->Parser->currentField = new vtkVRMLVectorType<VrmlNodeType::FieldRec*>; |
| 231 | this->Parser->currentField->Init(); |
| 232 | |
| 233 | if (!this->OpenImportFile()) |
| 234 | { |
| 235 | throw std::exception(); |
| 236 | } |
| 237 | |
| 238 | // This is actually where it all takes place, Since VRML is a SG |
| 239 | // And is state based, I need to create actors, cameras, and lights |
| 240 | // as I go. The Import* routines are not used. |
| 241 | this->Parser->CurrentProtoStack = new vtkVRMLVectorType<VrmlNodeType*>; |
| 242 | |
| 243 | // Lets redefine the YY_INPUT macro on Flex and get chars from memory |
| 244 | this->Parser->theyyInput = vtkVRMLYaccData::memyyInput; |
| 245 | // Crank up the yacc parser... |
| 246 | this->Parser->yydebug = 0; |
| 247 | this->Parser->yy_flex_debug = 0; |
| 248 | this->Parser->yyparse(this); |
| 249 | this->Parser->yyin = nullptr; |
| 250 | this->Parser->yyResetLineNumber(); |
| 251 | |
| 252 | // Not sure why I have to do this but its not working when |
| 253 | // When I use the FileFD file pointer... |
| 254 | // File existence already checked. |
| 255 | this->Parser->yyin = vtksys::SystemTools::Fopen(this->GetFileName(), "r"); |
| 256 | if (!this->Parser->yyin) |
| 257 | { |
| 258 | throw std::exception(); |
| 259 | } |
| 260 | |
| 261 | // reset the lex input routine |
| 262 | this->Parser->theyyInput = vtkVRMLYaccData::defyyInput; |
nothing calls this directly
no test coverage detected