-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/graph names and widths (#384)
* Graph data structure: default lane widths and a step towards #378 * use same QFont object across all Vertex::draw calls Signed-off-by: Morgan Quigley <[email protected]>
- Loading branch information
Showing
9 changed files
with
166 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Copyright (C) 2021 Open Source Robotics Foundation | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
#include "graph.h" | ||
using std::string; | ||
|
||
Graph::Graph() | ||
{ | ||
} | ||
|
||
Graph::~Graph() | ||
{ | ||
} | ||
|
||
bool Graph::from_yaml(const int _idx, const YAML::Node& data) | ||
{ | ||
if (!data.IsMap()) | ||
throw std::runtime_error("Graph::from_yaml() expected a map"); | ||
idx = _idx; | ||
//idx = std::stoi(idx_str); | ||
|
||
if (data["name"]) | ||
name = data["name"].as<string>(); | ||
|
||
if (data["default_lane_width"]) | ||
default_lane_width = data["default_lane_width"].as<double>(); | ||
|
||
return true; | ||
} | ||
|
||
YAML::Node Graph::to_yaml() const | ||
{ | ||
YAML::Node data; | ||
data["name"] = name; | ||
data["default_lane_width"] = default_lane_width; | ||
return data; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright (C) 2021 Open Source Robotics Foundation | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
#ifndef TRAFFIC_EDITOR_GRAPH_H | ||
#define TRAFFIC_EDITOR_GRAPH_H | ||
|
||
#include <string> | ||
|
||
#include <yaml-cpp/yaml.h> | ||
|
||
class Graph | ||
{ | ||
public: | ||
Graph(); | ||
~Graph(); | ||
|
||
int idx = 0; | ||
std::string name; | ||
double default_lane_width = 1.0; | ||
|
||
bool from_yaml(const int _idx, const YAML::Node& data); | ||
YAML::Node to_yaml() const; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters