Repository navigation
SlopeSpeedIndicator JSON
This page describes the persisted format of the slopeSpeed ("Slope and Speed") indicator in a project, a Mixel and templates. For the user guide on editing .vttp by hand, see Slope and Speed JSON.
The indicator is saved in two modes:
-
toJSON(false)is the real Mixel state: it contains the selected source/sensor, the current property values, and the layer size and position. -
toJSON(true)is the template state: it contains only the values that can be carried between projects. ForSlopeandDistance, the source and sensor are not written and the objects stay empty{}; when the indicator is added from a template, the runtime picks the sensors automatically.
The layer identifier is built from the plugin uid and the indicator name:
{
"name": "com.velitask.plagin.official.slopeSpeed",
"data": {
"properties": {}
}
}Stable parts:
| Part | Value |
|---|---|
| plugin uid | com.velitask.plagin.official |
| indicator name | slopeSpeed |
In a real Mixel, next to properties the runtime stores the layer geometry: size, position and binding to the parent. The exact shape of these State fields depends on the current runtime, so they are shown in abbreviated form.
{
"name": "com.velitask.plagin.official.slopeSpeed",
"data": {
"size": { "...": "layer size state" },
"positionInParent": { "...": "layer position state" },
"properties": {
"Slope": {
"sourceId": { "value": 1 },
"sensorId": { "value": 2 }
},
"Distance": {
"sourceId": { "value": 1 },
"sensorId": { "value": 3 }
},
"Font": { "name": "Dialog", "style": 0, "size": 48 },
"slopeColorUp": { "r": 220, "g": 80, "b": 80, "a": 255 },
"slopeColorDown": { "r": 80, "g": 220, "b": 80, "a": 255 },
"slopeColorPlain": { "r": 128, "g": 128, "b": 128, "a": 255 },
"speedColor": { "r": 255, "g": 255, "b": 255, "a": 255 },
"TextAlign": { "value": 4 }
}
}
}The sourceId and sensorId values are identifiers from a specific project.
A template uses maket, and both sensors stay empty. This is the real output of toJSON(true) for a freshly created indicator.
{
"name": "com.velitask.plagin.official.slopeSpeed",
"data": {
"maket": { "preset": "auto" },
"properties": {
"Slope": {},
"Distance": {},
"Font": { "name": "Dialog", "style": 0, "size": 48 },
"slopeColorUp": { "r": 220, "g": 80, "b": 80, "a": 255 },
"slopeColorDown": { "r": 80, "g": 220, "b": 80, "a": 255 },
"slopeColorPlain": { "r": 128, "g": 128, "b": 128, "a": 255 },
"speedColor": { "r": 255, "g": 255, "b": 255, "a": 255 },
"TextAlign": { "value": 4 }
}
}
}The indicator declares no figures.
The order of rows matches defineProperties().
| JSON key | Java property | SDK type | User meaning | Default |
|---|---|---|---|---|
Slope |
mSlope |
SlopeAtomProperty |
The slope sensor ("Slope"). | Empty selection: {} in a template. |
Distance |
mDistance |
DistanceSensorProperty |
The distance and speed sensor ("Distance"). | Empty selection: {} in a template. |
Font |
mFont |
FontProperty |
The font of both lines ("Font"). |
Dialog, style 0, size 48. |
slopeColorUp |
mSlopeColorUp |
ColorProperty |
Slope color on an uphill ("Slope color (uphill)"). |
220, 80, 80, 255. |
slopeColorDown |
mSlopeColorDown |
ColorProperty |
Slope color on a downhill ("Slope color (downhill)"). |
80, 220, 80, 255. |
slopeColorPlain |
mSlopeColorPlain |
ColorProperty |
Slope color on flat ground ("Slope color (flat)"). |
128, 128, 128, 255. |
speedColor |
mSpeedColor |
ColorProperty |
Speed color ("Speed color"). |
255, 255, 255, 255. |
TextAlign |
mTextAlign |
TextAlignProperty |
Line alignment ("Text alignment"). |
4 (center), range 0..8. |
State formats:
-
Fontis a flat objectname,style(0plain,1bold,2italic),size(1..999). UnlikeFontColorProperty, there is no nestedcolor: the line colors are set by separate properties. - A color is a flat object
r,g,b,a(0..255). -
TextAlignis{ "value": 0..8 }, as in other indicators (4is center). - The names
FontandTextAlignstart with a capital letter (overridden in the indicator); do not confuse them with the standardfontandtextAlignof other indicators. - The
neutralskin ("Neutral") makes four colors white:slopeColorUp,slopeColorDown,slopeColorPlain,speedColor.
Neutral styling, text in the top right corner of the layer:
{
"name": "com.velitask.plagin.official.slopeSpeed",
"data": {
"maket": { "preset": "auto" },
"properties": {
"Slope": {},
"Distance": {},
"Font": { "name": "Dialog", "style": 1, "size": 40 },
"slopeColorUp": { "r": 255, "g": 255, "b": 255, "a": 255 },
"slopeColorDown": { "r": 255, "g": 255, "b": 255, "a": 255 },
"slopeColorPlain": { "r": 255, "g": 255, "b": 255, "a": 255 },
"speedColor": { "r": 255, "g": 255, "b": 255, "a": 255 },
"TextAlign": { "value": 2 }
}
}
}-
VelitaskPlagin.getUID()(com.velitask.plagin.official) must not be changed without a migration of saved projects. -
Indicator.getName()(slopeSpeed) must not be changed without a migration. - Property names (
Slope,Distance,Font,slopeColorUp,slopeColorDown,slopeColorPlain,speedColor,TextAlign) must not be renamed without a migration; case matters. - The order of properties mostly affects the UI, while loading of the persisted state goes by name; renaming is more dangerous than reordering.