Class GeoJsonGraphFileSaver

Inheritance Relationships

Base Type

Class Documentation

class GeoJsonGraphFileSaver : public nav2_route::GraphFileSaver

A GraphFileSaver plugin to save a geojson graph representation.

Public Types

using Json = nlohmann::json

Public Functions

GeoJsonGraphFileSaver() = default

Constructor.

~GeoJsonGraphFileSaver() = default

Destructor.

void configure(const nav2_util::LifecycleNode::SharedPtr node) override

Configure, but do not store the node.

Parameters:

parent – pointer to user’s node

virtual bool saveGraphToFile(Graph &graph, std::string filepath) override

Saves the graph to a geojson file.

Parameters:
  • graph – The graph to save to the geojson file

  • filepath – The path to save the graph to

Returns:

True if successful

Protected Functions

void loadNodesFromGraph(Graph &graph, std::vector<Json> &json_features)

Add nodes into the graph.

Parameters:
  • graph[out] The graph that will contain the new nodes

  • json_features[in] Json array to add the nodes to

void loadEdgesFromGraph(Graph &graph, std::vector<Json> &json_edges)

Add edges into the graph.

Parameters:
  • graph[out] The graph that will contain the new edges

  • json_edges[in] Json array to add the edges to

void convertMetaDataToJson(const Metadata &metadata, Json &json_metadata)

Convert graph metadata to Json.

Parameters:
  • metadataMetadata from a node or edge in the graph

  • json_metadata – Json entry to store metadata in

void convertOperationsToJson(const Operations &operations, Json &json_operations)

Convert graph operation to Json.

Parameters:
  • Operations – Operations information from the graph

  • json_operations – Json entry to store operation data in

Protected Attributes

rclcpp::Logger logger_ = {rclcpp::get_logger("GeoJsonGraphFileSaver")}