OpenRoadCode
Public API reference for OpenRoadCode
Loading...
Searching...
No Matches
map_command_server.hpp
1// SPDX-FileCopyrightText: 2026 Mark G. Russell
2// SPDX-License-Identifier: MIT
3
4#pragma once
5
6#include <optional>
7#include <string>
8
9#include <zmq.hpp>
10
12struct MapCommand {
13 std::string command;
14 std::string operationId;
15 double latitude = 0.0;
16 double longitude = 0.0;
17 double zoom = 0.0;
18 double bearing = 0.0;
19 double pitch = 0.0;
20 double south = 0.0;
21 double west = 0.0;
22 double north = 0.0;
23 double east = 0.0;
24 double padding = 40.0;
25 double opacity = 0.65;
26 double rightPx = 0.0;
27 double upPx = 0.0;
28 std::string geojson;
29 std::string category;
30 std::string tileUrl;
31 long long frameTime = 0;
32 long long requestId = 0;
33 int maxZoom = 22;
34 bool enabled = false;
35};
36
37class MapCommandServer {
38public:
39 explicit MapCommandServer(std::string endpoint = "tcp://127.0.0.1:5557");
40 ~MapCommandServer() = default;
41 MapCommandServer(const MapCommandServer&) = delete;
42 MapCommandServer& operator=(const MapCommandServer&) = delete;
43 std::optional<MapCommand> poll();
44
45private:
46 std::optional<MapCommand> parseCommand(const std::string& payload) const;
47 std::string endpoint;
48 zmq::context_t context{1};
49 zmq::socket_t socket{context, zmq::socket_type::sub};
50};
Parsed command accepted by the native MapLibre renderer.
Definition map_command_server.hpp:12