17#include "gflags/gflags.h"
23#include "modules/common_msgs/map_msgs/map.pb.h"
31static void ShiftMap(
Map* map_pb) {
32 for (
auto& lane : *(map_pb->mutable_lane())) {
33 for (
auto& segment : *(lane.mutable_central_curve()->mutable_segment())) {
34 for (
auto& point : *(segment.mutable_line_segment()->mutable_point())) {
35 point.set_x(point.x() + FLAGS_x_offset);
36 point.set_y(point.y() + FLAGS_y_offset);
40 *(lane.mutable_left_boundary()->mutable_curve()->mutable_segment())) {
41 for (
auto& point : *(segment.mutable_line_segment()->mutable_point())) {
42 point.set_x(point.x() + FLAGS_x_offset);
43 point.set_y(point.y() + FLAGS_y_offset);
47 *(lane.mutable_right_boundary()->mutable_curve()->mutable_segment())) {
48 for (
auto& point : *(segment.mutable_line_segment()->mutable_point())) {
49 point.set_x(point.x() + FLAGS_x_offset);
50 point.set_y(point.y() + FLAGS_y_offset);
54 for (
auto& stop_sign : *(map_pb->mutable_stop_sign())) {
55 for (
auto& stop_line : *(stop_sign.mutable_stop_line())) {
56 for (
auto& segment : *(stop_line.mutable_segment())) {
57 for (
auto& point : *(segment.mutable_line_segment()->mutable_point())) {
58 point.set_x(point.x() + FLAGS_x_offset);
59 point.set_y(point.y() + FLAGS_y_offset);
66static void OutputMap(
const Map& map_pb) {
67 const std::string txt_file = FLAGS_output_dir +
"/base_map.txt";
68 const std::string bin_file = FLAGS_output_dir +
"/base_map.bin";
73int main(int32_t argc,
char** argv) {
74 google::InitGoogleLogging(argv[0]);
75 FLAGS_alsologtostderr =
true;
78 google::ParseCommandLineFlags(&argc, &argv,
true);
83 <<
"Fail to open:" << map_file;
86 AINFO <<
"modified map at:" << FLAGS_output_dir;
bool GetProtoFromFile(const std::string &file_name, google::protobuf::Message *message)
Parses the content of the file specified by the file_name as a representation of protobufs,...
bool SetProtoToBinaryFile(const google::protobuf::Message &message, const std::string &file_name)
Sets the content of the file specified by the file_name to be the binary representation of the input ...
bool SetProtoToASCIIFile(const google::protobuf::Message &message, int file_descriptor)
std::string BaseMapFile()
get base map file path from flags.