Skip to content

LatLonTextIndicator JSON

roosit edited this page Oct 16, 2026 · 1 revision

LatLonTextIndicator JSON

Up | Code | Русский

Purpose

This page describes the persisted format of the latLonText indicator in a project, a Mixel, and templates. For the user guide to editing .vttp by hand, see Coordinates Text JSON.

Two save modes

The indicator layer is saved in two modes:

  • toJSON(false) — the real Mixel state: the sensor is written as sourceId and sensorId, and the layer has size and positionInParent.
  • toJSON(true) — the template state: the sensor does not write the sourceId and sensorId keys (the object is empty), and maket is written instead of size and positionInParent. When a template is loaded, a suitable geo sensor of the project is picked automatically for the Geo property.

The other properties are written the same way in both modes.

Common indicator wrapper

{
  "name": "com.velitask.plagin.official.latLonText",
  "data": {
    "properties": {}
  }
}
Part Value
plugin uid com.velitask.plagin.official
indicator name latLonText

Besides properties, data holds the common layer fields (visibility, transparency, nested layers, and so on); they do not belong to the indicator and are not described here.

Real mixel state

The shape of size and positionInParent is defined by the current runtime, so it is shown in abbreviated form. The numbers sourceId and sensorId in the example are arbitrary.

{
  "name": "com.velitask.plagin.official.latLonText",
  "data": {
    "size": { "...": "layer size state" },
    "positionInParent": { "...": "layer position state" },
    "properties": {
      "Geo": {
        "sourceId": { "value": 1 },
        "sensorId": { "value": 4 }
      },
      "font": { "name": "Dialog", "style": 0, "size": 48, "color": { "r": 255, "g": 255, "b": 255, "a": 255 } },
      "textAlign": { "value": 4 },
      "displayType": { "value": 0 },
      "precision": {}
    }
  }
}

Template state

{
  "name": "com.velitask.plagin.official.latLonText",
  "data": {
    "maket": { "preset": "auto" },
    "properties": {
      "Geo": {},
      "font": { "name": "Dialog", "style": 0, "size": 48, "color": { "r": 255, "g": 255, "b": 255, "a": 255 } },
      "textAlign": { "value": 4 },
      "displayType": { "value": 0 },
      "precision": {}
    }
  }
}

The values are the initial values from the code. An untouched precision property has no saved value (it is returned by getDefault()), so it may be written as {}; when reading, a missing key yields the value 7. When a template is written, maket in toJSON(true) mode is the proportional preset with the fractions x, y, w, h; auto and fill are also accepted when reading.

Properties

The row order matches defineProperties().

JSON key Java property SDK type Meaning for the user Default
Geo mGeo GeoSensorProperty Geo sensor ("Geo"). Empty selection: {} in the template.
font mFont FontColorProperty Font and text color. Dialog, plain, 48, white.
textAlign mTextAlign TextAlignProperty Text alignment in the layer. {"value":4} (CENTER).
displayType mDisplayType EnumArrayProperty<DisplayType> Coordinate format ("Format"). {"value":0} (DECIMAL).
precision mPrecision IntegerProperty Number of decimal places ("Decimal places"). 7.

Value formats:

  • Geo — sourceId and sensorId, each of the form {"value": <long>}; the object is empty in a template.
  • font — a flat object: name (string), style (0 plain, 1 bold, 2 italic), size (integer 1–999), color (r, g, b, a in the range 0–255).
  • textAlign — {"value": 0..8}: 0 TOP_LEFT, 1 TOP_CENTER, 2 TOP_RIGHT, 3 CENTER_LEFT, 4 CENTER, 5 CENTER_RIGHT, 6 BOTTOM_LEFT, 7 BOTTOM_CENTER, 8 BOTTOM_RIGHT. A value out of range is treated as CENTER_LEFT.
  • displayType — the format index:
value Format Example
0 DECIMAL 55.7558000, 37.6173000
1 DECIMAL_NSEW 55.7558000°N, 37.6173000°E
2 DMS 55°45'20.88"N, 37°37'02.28"E
  • precision — {"value": 0..12}. The range 0–12 is applied when the property sets a value; a value read from JSON is not clamped to the range, and when drawing, a negative value is replaced with zero. It is not used in the DMS format.

Examples

Coordinates with compass letters and four decimal places:

{
  "displayType": { "value": 1 },
  "precision": { "value": 4 }
}

Compatibility

  • VelitaskPlagin.getUID() (com.velitask.plagin.official) must not be changed without migrating saved projects.
  • Indicator.getName() (latLonText) must not be changed without a migration.
  • Property names (Geo, font, textAlign, displayType, precision) must not be renamed without a migration: loading goes by name.
  • The order of the DisplayType elements defines the displayType.value value: reordering or inserting in the middle changes the meaning of already saved projects.
  • Renaming a property is more dangerous than changing the order: the order mostly affects the interface.

Clone this wiki locally