void t_layer::add_path(const short int _code, const short int _type, const std::list< cd::t_xy<int> >& _path) { if(_path.size() < 2) { return; } for(std::vector< t_line >::iterator it = m_line.begin(); it != m_line.end(); ++it) { if(it->do_intention_coordinate(_path)) { return; } if(it->is_intentioned_coordinate(_path)) { it->renewal_coordinate_list(_path); return; } } m_line.push_back(t_line(*this, m_line.size() + 1, _code, _type, _path)); }
t_layer::t_layer(t_layer& _origin, t_secondary_mesh& _invoker) : m_invoker(_invoker) { m_code = _origin.m_code; m_line.clear(); for(std::vector< t_line >::const_iterator it = _origin.m_line.begin(); it != _origin.m_line.end(); ++it) { m_line.push_back(t_line(*it, *this)); } }
t_layer& t_layer::operator=(const t_layer& _rhs) { m_invoker = _rhs.m_invoker; m_code = _rhs.m_code; m_line.clear(); for(std::vector< t_line >::const_iterator it = _rhs.m_line.begin(); it != _rhs.m_line.end(); ++it) { m_line.push_back(t_line(*it)); } return *this; }
bool Circuit::loadMap(const std::string& filename) { // D_MYLOG("filename=" << filename); // open std::ifstream ifs; ifs.open(filename, std::ifstream::in); if (!ifs.is_open()) { // D_MYLOG("fail to open"); return false; } // loop std::string line; std::string label; while (ifs.good()) { std::getline(ifs, line); if (line.empty()) { // D_MYLOG("[empty line]"); continue; } // D_MYLOG("line=" << line); std::stringstream sstr(line); sstr >> label; // // checkpoints if (label == "checkpoint") { // D_MYLOG("processing checkpoint"); std::vector<float> vals; float val; while (sstr >> val) { if (std::isnan(val)) { // D_MYLOG("invalid value -> Not a Number"); return false; } vals.push_back(val); } if (vals.size() != 4) { // D_MYLOG("invalid number of values"); return false; } // D_MYLOG("processed checkpoint"); // D_MYLOG("vals: " << vals[0] << "," << vals[1] << " " << vals[2] << "," << vals[3]); t_vec2f p1(vals[0],vals[1]); t_vec2f p2(vals[2],vals[3]); m_checkpoints.push_back( t_line(p1, p2) ); } // checkpoints // else { // D_MYLOG("unidentified line"); } }
void t_layer::add_line_record(const t_line _target) { m_line.push_back(t_line(_target)); }