bool ArcPlan::Get_Location_Data (Location_File &file, Location_Data &location_rec) { int link, dir, index; double offset, setback, side; Point_Map_Stat map_stat; Link_Data *link_ptr; if (Data_Service::Get_Location_Data (file, location_rec)) { link = location_rec.Link (); dir = location_rec.Dir (); offset = UnRound (location_rec.Offset ()); setback = UnRound (location_rec.Setback ()); side = location_side; if (setback > side) side = setback; link_ptr = &link_array [link]; if (lanes_flag) { bool dir_flag; int center, num_lanes; Dir_Data *dir_ptr; if (dir == 0) { index = link_ptr->AB_Dir (); dir_flag = (link_ptr->BA_Dir () >= 0); } else { index = link_ptr->BA_Dir (); dir_flag = (link_ptr->AB_Dir () >= 0); } if (index >= 0) { dir_ptr = &dir_array [index]; num_lanes = dir_ptr->Lanes () + dir_ptr->Left () + dir_ptr->Right (); } else { num_lanes = 0; } if (center_flag && !dir_flag) { center = num_lanes + 1; } else { center = 1; } side += (2 * num_lanes - center) * lane_width / 2.0; } Link_Shape (link_ptr, dir, points, offset, 0.0, side); //---- save the location point data ---- map_stat = location_pt.insert (Point_Map_Data (location_rec.Location (), points [0])); if (!map_stat.second) { Warning ("Duplicate Location Record = ") << location_rec.Location (); } return (true); } return (false); }
bool Data_Service::Get_Location_Data (Location_File &file, Location_Data &location_rec) { int link, dir, offset; double setback; Link_Data *link_ptr; //---- read and save the data ---- location_rec.Location (file.Location ()); if (location_rec.Location () == 0) return (false); //---- check/convert the link number and direction ---- link = file.Link (); dir = file.Dir (); offset = Round (file.Offset ()); link_ptr = Set_Link_Direction (file, link, dir, offset); location_rec.Link (link); location_rec.Dir (dir); location_rec.Offset (offset); setback = file.Setback (); location_rec.Setback (setback); if (Location_XY_Flag ()) { Points points; Link_Shape (link_ptr, dir, points, UnRound (offset), 0.0, setback); if (points.size () > 0) { location_rec.X (points [0].x); location_rec.Y (points [0].y); } else { Node_Data *node_ptr = &node_array [link_ptr->Anode ()]; location_rec.X (node_ptr->X ()); location_rec.Y (node_ptr->Y ()); } } location_rec.Zone (file.Zone ()); if (location_rec.Zone () > 0 && System_Data_Flag (ZONE)) { Int_Map_Itr map_itr = zone_map.find (location_rec.Zone ()); if (map_itr == zone_map.end ()) { Warning (String ("Location %d Zone %d was Not Found") % location_rec.Location () % location_rec.Zone ()); return (false); } location_rec.Zone (map_itr->second); } else if (location_rec.Zone () == 0) { location_rec.Zone (-1); //---- delete extra activity location used for transit stops ---- if (file.Version () <= 40) return (false); } location_rec.Notes (file.Notes ()); return (true); }