void readDoubleList3D( const std::string& str, std::vector<std::vector<std::vector<double> > >& vec ) { // ((1.6,2.0,4.9382),(3.78,23.34,039.938367),(938.034,3.0,-3.45,6.9182)) const char* ch = str.c_str(); const unsigned int argsize = (unsigned int)str.size(); if( argsize == 0 ) { return; } unsigned int i=0; unsigned int num_par_open=0; unsigned int last_token = 0; while( i<argsize ) { if( ch[i] == ',' ) { if( num_par_open == 1 ) { std::vector<std::vector<double> > inner_vec; vec.push_back(inner_vec); readDoubleList2D( str.substr( last_token, i-last_token ), vec.back() ); last_token = i; } } else if( ch[i] == '(' ) { ++num_par_open; last_token = i; } else if( ch[i] == ')' ) { --num_par_open; if( num_par_open == 0 ) { std::vector<std::vector<double> > inner_vec; vec.push_back(inner_vec); readDoubleList2D( str.substr( last_token, i-last_token ), vec.back() ); return; } } ++i; } }
void IfcRationalBSplineSurfaceWithKnots::readStepData( std::vector<std::string>& args, const std::map<int,shared_ptr<IfcTunnelEntity> >& map ) { const int num_args = (int)args.size(); if( num_args<13 ){ std::stringstream strserr; strserr << "Wrong parameter count for entity IfcRationalBSplineSurfaceWithKnots, expecting 13, having " << num_args << ". Object id: " << getId() << std::endl; throw IfcTunnelException( strserr.str().c_str() ); } #ifdef _DEBUG if( num_args>13 ){ std::cout << "Wrong parameter count for entity IfcRationalBSplineSurfaceWithKnots, expecting 13, having " << num_args << ". Object id: " << getId() << std::endl; } #endif readIntValue( args[0], m_UDegree ); readIntValue( args[1], m_VDegree ); readEntityReferenceList2D( args[2], m_ControlPointsList, map ); m_SurfaceForm = IfcBSplineSurfaceForm::readStepData( args[3] ); if( _stricmp( args[4].c_str(), ".F." ) == 0 ) { m_UClosed = false; } else if( _stricmp( args[4].c_str(), ".T." ) == 0 ) { m_UClosed = true; } if( _stricmp( args[5].c_str(), ".F." ) == 0 ) { m_VClosed = false; } else if( _stricmp( args[5].c_str(), ".T." ) == 0 ) { m_VClosed = true; } if( _stricmp( args[6].c_str(), ".F." ) == 0 ) { m_SelfIntersect = false; } else if( _stricmp( args[6].c_str(), ".T." ) == 0 ) { m_SelfIntersect = true; } readIntList( args[7], m_UMultiplicities ); readIntList( args[8], m_VMultiplicities ); readTypeOfRealList( args[9], m_UKnots ); readTypeOfRealList( args[10], m_VKnots ); m_KnotSpec = IfcKnotType::readStepData( args[11] ); readDoubleList2D( args[12], m_WeightsData ); }