CARLA
 
载入中...
搜索中...
未找到
GraphParser.h
浏览该文件的文档.
1// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
2// de Barcelona (UAB).
3//
4// This work is licensed under the terms of the MIT license.
5// For a copy, see <https://opensource.org/licenses/MIT>.
6
7#pragma once
8
10#include "GraphTypes.h"
12
13#include <vector>
14
15namespace MapGen {
16
17 class DoublyConnectedEdgeList;
18
19 class GraphParser : private NonCopyable
20 {
21 public:
22
24
25 bool HasRoadSegments() const {
26 return !RoadSegments.empty();
27 }
28
29 bool HasCityAreas() const {
30 return !CityAreas.empty();
31 }
32
33 size_t RoadSegmentCount() const {
34 return RoadSegments.size();
35 }
36
37 size_t CityAreaCount() const {
38 return CityAreas.size();
39 }
40
42 return *RoadSegments[i];
43 }
44
45 const CityAreaDescription &GetCityAreaAt(size_t i) const {
46 return *CityAreas[i];
47 }
48
49 TUniquePtr<RoadSegmentDescription> PopRoadSegment() {
50 TUniquePtr<RoadSegmentDescription> ptr{RoadSegments.back().Release()};
51 RoadSegments.pop_back();
52 return ptr;
53 }
54
55 TUniquePtr<CityAreaDescription> PopCityArea() {
56 TUniquePtr<CityAreaDescription> ptr{CityAreas.back().Release()};
57 CityAreas.pop_back();
58 return ptr;
59 }
60
61 private:
62
63 using RoadSegmentList = std::vector<TUniquePtr<RoadSegmentDescription>>;
64
65 using CityAreaList = std::vector<TUniquePtr<CityAreaDescription>>;
66
68
70 };
71
72} // namespace MapGen
Simple doubly-connected edge list structure.
std::vector< TUniquePtr< RoadSegmentDescription > > RoadSegmentList
Definition GraphParser.h:63
RoadSegmentList RoadSegments
Definition GraphParser.h:67
GraphParser(DoublyConnectedEdgeList &Dcel)
TUniquePtr< RoadSegmentDescription > PopRoadSegment()
Definition GraphParser.h:49
const RoadSegmentDescription & GetRoadSegmentAt(size_t i) const
Definition GraphParser.h:41
bool HasCityAreas() const
Definition GraphParser.h:29
bool HasRoadSegments() const
Definition GraphParser.h:25
std::vector< TUniquePtr< CityAreaDescription > > CityAreaList
Definition GraphParser.h:65
CityAreaList CityAreas
Definition GraphParser.h:69
size_t RoadSegmentCount() const
Definition GraphParser.h:33
const CityAreaDescription & GetCityAreaAt(size_t i) const
Definition GraphParser.h:45
TUniquePtr< CityAreaDescription > PopCityArea()
Definition GraphParser.h:55
size_t CityAreaCount() const
Definition GraphParser.h:37