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