Skip to content

User JSON DistanceTextIndicator

roosit edited this page Nov 15, 2026 · 4 revisions

Distance Text JSON

Back to list | Indicator page | Русский

Purpose

This page describes the JSON template of the distanceText indicator for manual editing of .vttp: which fields exist and which values are allowed.

Full Template

{
  "name": "com.velitask.plagin.official.distanceText",
  "data": {
    "maket": { "preset": "auto" },
    "properties": {
      "Distance": {},
      "valueText": {
        "name": "Dialog",
        "style": 0,
        "size": 48,
        "color": { "r": 255, "g": 255, "b": 255, "a": 255 }
      },
      "unitFont": {
        "name": "Dialog",
        "style": 0,
        "size": 28
      },
      "textAlign": { "value": 4 },
      "measurement": {
        "system": { "value": 0 },
        "format": { "value": 0 },
        "distance": { "value": "MM" }
      },
      "textTemplate": {
        "template": "{currNum} {currUnit} of {fullNum} {fullUnit}",
        "vars": {
          "currNum": "%.2f",
          "currUnit": "%s",
          "fullNum": "%.0f",
          "fullUnit": "%s"
        }
      }
    }
  }
}

The default template value depends on the interface language: in the Russian version "из" stands instead of of.

Settings

Distance

Selects the distance sensor. Leave it empty in a template: the sensor is picked automatically when the indicator is added to a project.

{
  "Distance": {}
}
Field Values What it does
sourceId {"value": number} Identifier of the source in the project. Not specified in a template.
sensorId {"value": number} Identifier of the sensor in the source. Not specified in a template.

valueText

The font and color of the text ("Value font"). All of the text is drawn with this font.

{
  "valueText": {
    "name": "Dialog",
    "style": 0,
    "size": 48,
    "color": { "r": 255, "g": 255, "b": 255, "a": 255 }
  }
}
Field Values What it does
name string Font name.
style 0, 1, 2 Style: 0 plain, 1 bold, 2 italic.
size 1..999 Font size.
color.r 0..255 Red channel.
color.g 0..255 Green channel.
color.b 0..255 Blue channel.
color.a 0..255 Opacity: 0 fully transparent, 255 opaque.

unitFont

The unit font ("Unit font"). In the current version the value is saved but does not affect how the text looks.

{
  "unitFont": {
    "name": "Dialog",
    "style": 0,
    "size": 28
  }
}
Field Values What it does
name string Font name.
style 0, 1, 2 Style: 0 plain, 1 bold, 2 italic.
size 1..999 Font size.

textAlign

The position of the text inside the layer.

{
  "textAlign": {
    "value": 4
  }
}
Field Values What it does
value 0..8 Index of the text position.
value Position
0 top left
1 top center
2 top right
3 middle left
4 center (default)
5 middle right
6 bottom left
7 bottom center
8 bottom right

measurement

The measurement system, the format of the unit caption and the distance unit ("Units").

{
  "measurement": {
    "system": { "value": 0 },
    "format": { "value": 0 },
    "distance": { "value": "MM" }
  }
}
Field Values What it does
system.value 0..4 Measurement system.
format.value 0..3 Format of the unit caption.
distance.value MM, CM, M, KM, IN, FT, YD, MI, NM Distance unit.
system.value System
0 From global settings (default)
1 Metric
2 Imperial
3 Nautical
4 Mixed
format.value Caption format
0 Full (kilometers)
1 Normal (km)
2 Short
3 Symbol

The allowed units depend on the system: metric allows KM, M, CM, MM; imperial allows MI, YD, FT, IN; nautical allows NM, YD, FT; mixed allows any of the nine. With system 0 the distance field is not used: the unit is picked automatically for the value. If you set distance together with system 1-3, pick a unit from the list of that system; if the unit is not from the list, the system switches to "Mixed".

textTemplate

A string that is built from the current and the full distance.

{
  "textTemplate": {
    "template": "{currNum} {currUnit} of {fullNum} {fullUnit}",
    "vars": {
      "currNum": "%.2f",
      "currUnit": "%s",
      "fullNum": "%.0f",
      "fullUnit": "%s"
    }
  }
}
Field Values What it does
template string The resulting text with variables in curly braces.
vars object Formats of the variables.

Template variables

Variable Default format What it shows
{currNum} %.2f The distance covered from the start of the track to the current moment, in the selected units.
{currUnit} %s The unit of measurement for {currNum}.
{fullNum} %.0f The full track distance, in the selected units.
{fullUnit} %s The unit of measurement for {fullNum}.

For {currNum} and {fullNum}, the format is applied to a floating-point number: %.2f, %.1f, %.0f, etc. are allowed. The %d format does not work: the variable will be replaced with an empty string. For {currUnit} and {fullUnit}, use %s.

The "Minimal" skin replaces template with {currNum} {currUnit}; the formats do not change.

Clone this wiki locally