Apollo 11.0
自动驾驶开放平台
pyramid_map_config.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2019 The Apollo Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
17
18#include <string>
19
20namespace apollo {
21namespace localization {
22namespace msf {
23namespace pyramid_map {
24
25PyramidMapConfig::PyramidMapConfig(const std::string& map_version)
26 : BaseMapConfig(map_version) {}
27
29
30bool PyramidMapConfig::CreateXml(boost::property_tree::ptree* config) const {
31 bool success = BaseMapConfig::CreateXml(config);
32 if (success) {
33 config->put("map.map_config.has_intensity", has_intensity_);
34 config->put("map.map_config.has_intensity_var", has_intensity_var_);
35 config->put("map.map_config.has_altitude", has_altitude_);
36 config->put("map.map_config.has_altitude_var", has_altitude_var_);
37 config->put("map.map_config.has_ground_altitude", has_ground_altitude_);
38 config->put("map.map_config.has_count", has_count_);
39 config->put("map.map_config.has_ground_count", has_ground_count_);
40 config->put("map.map_config.resolution_num", resolution_num_);
41 config->put("map.map_config.resolution_ratio", resolution_ratio_);
42 config->put("map.map_config.coordinate_type", coordinate_type_);
43 config->put("map.map_runtime.max_intensity_value", max_intensity_value_);
44 config->put("map.map_runtime.max_intensity_var_value",
46 return true;
47 } else {
48 return false;
49 }
50}
51
52bool PyramidMapConfig::LoadXml(const boost::property_tree::ptree& config) {
53 bool success = BaseMapConfig::LoadXml(config);
54 if (success) {
55 auto has_intensity =
56 config.get_optional<bool>("map.map_config.has_intensity");
57 auto has_intensity_var =
58 config.get_optional<bool>("map.map_config.has_intensity_var");
59 auto has_altitude =
60 config.get_optional<bool>("map.map_config.has_altitude");
61 auto has_altitude_var =
62 config.get_optional<bool>("map.map_config.has_altitude_var");
63 auto has_ground_altitude =
64 config.get_optional<bool>("map.map_config.has_ground_altitude");
65 auto has_count = config.get_optional<bool>("map.map_config.has_count");
66 auto has_ground_count =
67 config.get_optional<bool>("map.map_config.has_ground_count");
68 auto resolution_num =
69 config.get_optional<unsigned int>("map.map_config.resolution_num");
70 auto resolution_ratio =
71 config.get_optional<unsigned int>("map.map_config.resolution_ratio");
72 auto coordinate_type =
73 config.get_optional<std::string>("map.map_config.coordinate_type");
74 auto max_intensity_value =
75 config.get_optional<float>("map.map_runtime.max_intensity_value");
76 auto max_intensity_var_value =
77 config.get_optional<float>("map.map_runtime.max_intensity_var_value");
78
79 if (has_intensity) {
80 has_intensity_ = *has_intensity;
81 }
82
83 if (has_intensity_var) {
84 has_intensity_var_ = *has_intensity_var;
85 }
86
87 if (has_altitude) {
88 has_altitude_ = *has_altitude;
89 }
90
91 if (has_altitude_var) {
92 has_altitude_var_ = *has_altitude_var;
93 }
94
95 if (has_ground_altitude) {
96 has_ground_altitude_ = *has_ground_altitude;
97 }
98
99 if (has_count) {
100 has_count_ = *has_count;
101 }
102
103 if (has_ground_count) {
104 has_ground_count_ = *has_ground_count;
105 }
106
107 if (resolution_num) {
108 resolution_num_ = *resolution_num;
109 }
110
111 if (resolution_ratio) {
112 resolution_ratio_ = *resolution_ratio;
113 }
114
115 if (coordinate_type) {
116 coordinate_type_ = *coordinate_type;
117 }
118
119 if (max_intensity_value) {
120 max_intensity_value_ = *max_intensity_value;
121 }
122
123 if (max_intensity_var_value) {
124 max_intensity_var_value_ = *max_intensity_var_value;
125 }
126
127 return true;
128 }
129
130 return false;
131}
132
133} // namespace pyramid_map
134} // namespace msf
135} // namespace localization
136} // namespace apollo
virtual bool CreateXml(boost::property_tree::ptree *config) const
Create the XML structure.
virtual bool LoadXml(const boost::property_tree::ptree &config)
Load the map options from a XML structure.
float max_intensity_value_
During the visualization (for example, Call the function get_image() of map node layer),...
float max_intensity_var_value_
During the visualization (for example, Call the function get_image() of map node layer),...
virtual bool LoadXml(const boost::property_tree::ptree &config)
Load the map options from a XML structure.
virtual bool CreateXml(boost::property_tree::ptree *config) const
Create the XML structure.
class register implement
Definition arena_queue.h:37