Skip to content

User JSON DistanceTextIndicator

roosit edited this page Oct 16, 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

Chooses 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} The source identifier in the project. Not specified in a template.
sensorId {"value": number} The sensor identifier 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 The font name.
style 0, 1, 2 Style: 0 plain, 1 bold, 2 italic.
size 1..999 The font size.
color.r 0..255 Red channel.
color.g 0..255 Green channel.
color.b 0..255 Blue channel.
color.a 0..255 Transparency: 0 is fully transparent, 255 is 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 The font name.
style 0, 1, 2 Style: 0 plain, 1 bold, 2 italic.
size 1..999 The font size.

textAlign

The position of the text inside the layer.

{
  "textAlign": {
    "value": 4
  }
}
Field Values What it does
value 0..8 The text position index.
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 unit label format and the distance unit ("Units").

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

The allowed units depend on the system: metric — KM, M, CM, MM; imperial — MI, YD, FT, IN; nautical — NM, YD, FT; mixed — any of the nine. With system 0 the distance field is not used: the unit is chosen automatically to fit the value. If you set distance and a system of 1–3, pick a unit from that system's list; if the unit is not in the list, the system switches to "Mixed".

textTemplate

A string 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 The variable formats.

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}.

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

Clone this wiki locally