Bind
C++ UI toolkit for Arduino
 
Loading...
Searching...
No Matches
BindMap.hpp
1#ifndef __BINDMAP_HPP
2#define __BINDMAP_HPP
3#include "BindView.hpp"
4#include "BindUtils.hpp"
5
7#define BIND_MAP_USER_ZOOM -1
8
34class BindMap : public BindView
35{
36
37public:
38 int16_t x;
39 int16_t y;
40 uint8_t cmdId = 0;
41 int16_t width = 100;
42 int16_t height = 100;
43 float lat = 0.0f;
44 float lon = 0.0f;
45 float mapOrientation = 0.0f;
46 int8_t zoom = 1;
47
57 uint16_t getBytes(uint8_t *out) override
58 {
59 tag = 1; // Only one map for now! May extend it in future updates.
60 offset = 0;
61 copyAndOffset(out, &offset, &objID, sizeof(objID));
62 copyAndOffset(out, &offset, &x, sizeof(x));
63 copyAndOffset(out, &offset, &y, sizeof(y));
64 copyAndOffset(out, &offset, &tag, sizeof(tag));
65 copyAndOffset(out, &offset, &cmdId, sizeof(cmdId));
66 copyAndOffset(out, &offset, &width, sizeof(width));
67 copyAndOffset(out, &offset, &height, sizeof(height));
68 copyAndOffset(out, &offset, &lat, sizeof(lat));
69 copyAndOffset(out, &offset, &lon, sizeof(lon));
70 copyAndOffset(out, &offset, &mapOrientation, sizeof(mapOrientation));
71 copyAndOffset(out, &offset, &zoom, sizeof(zoom));
72 return offset;
73 }
74
75private:
76 uint8_t objID = BIND_ID_MAP_VIEW;
77 uint16_t offset = 0;
78};
79
80#endif /* __BINDMAP_HPP */
Represents a Map Object for BindCanvas.
Definition BindMap.hpp:35
float lon
Longitude of the map's center.
Definition BindMap.hpp:44
int16_t height
Height of the map.
Definition BindMap.hpp:42
float lat
Latitude of the map's center.
Definition BindMap.hpp:43
uint16_t getBytes(uint8_t *out) override
Get the serialized bytes of the BindMap object.
Definition BindMap.hpp:57
int16_t width
Width of the map.
Definition BindMap.hpp:41
int8_t zoom
Zoom level of the map.
Definition BindMap.hpp:46
int16_t y
Y-coordinate position of the map.
Definition BindMap.hpp:39
int16_t x
X-coordinate position of the map.
Definition BindMap.hpp:38
float mapOrientation
Orientation angle of the map (in degrees).
Definition BindMap.hpp:45
uint8_t cmdId
Command identifier for the map. See the notes for possible cmdId values.
Definition BindMap.hpp:40
Definition BindView.hpp:22