Skip to content

Commit

Permalink
Merge pull request #38 from dfpc-coe/routes
Browse files Browse the repository at this point in the history
TAK Routes
  • Loading branch information
ingalls authored Sep 9, 2024
2 parents eea5e7e + f78f095 commit 3435a39
Show file tree
Hide file tree
Showing 7 changed files with 646 additions and 99 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@

### Pending Fixed

### v12.1.0 - 2024-09-09

- :rocket: Add preliminary support for TAK Routes => GeoJSON LineStrings

### v12.0.0 - 2024-09-05

- :rocket: Add `object` type support to COT Constructor definition
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,6 @@ These are less common properties that can be used:
| `b-i-r-r` | Remote Resource |
| `b-f-t-r` | File Transfer Request |
| `b-i-x-i` | QuickPic |
| `b-m-r` | Route |
| `b-m-p-c` | Route Control Point |
| `b-m-p-w` | Route Way Point |
2 changes: 1 addition & 1 deletion lib/cot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ export default class CoT {
feat.properties.precisionlocation = raw.event.detail.precisionlocation._attributes;
}

if (['u-d-f', 'u-d-r'].includes(raw.event._attributes.type) && Array.isArray(raw.event.detail.link)) {
if (['u-d-f', 'u-d-r', 'b-m-r'].includes(raw.event._attributes.type) && Array.isArray(raw.event.detail.link)) {
const coordinates = [];

for (const l of raw.event.detail.link) {
Expand Down
43 changes: 43 additions & 0 deletions lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,46 @@ export const Link = Type.Object({
_attributes: LinkAttributes
})

// Ref: https://git.tak.gov/standards/takcot/-/blob/master/xsd/Route.xsd
export const LinkAttrRouteFil = Type.Enum({
Infil: 'Infil',
Exfil: 'Exfil'
});

export const LinkAttrRouteMethod = Type.Enum({
Driving: 'Driving',
Walking: 'Walking',
Flying: 'Flying',
Swimming: 'Swimming',
Watercraft: 'Watercraft'
});

export const LinkAttrRouteType = Type.Enum({
Primary: 'Primary',
Secondary: 'Secondary',
});

export const LinkAttrRouteOrder = Type.Enum({
Ascending: 'Ascending Check Points',
Descending: 'Descending Check Points',
});

export const LinkAttrAttributes = Type.Object({
planningmethod: Type.Optional(LinkAttrRouteFil),
color: Type.Optional(Type.Integer()),
method: LinkAttrRouteMethod,
prefix: Type.String(),
stroke: Type.Optional(Type.String()),
type: Type.Optional(Type.String()),
routetype: LinkAttrRouteType,
direction: Type.Optional(LinkAttrRouteFil),
order: LinkAttrRouteOrder
})

export const LinkAttr = Type.Object({
_attributes: LinkAttrAttributes
})

export const ProtocolSupportAttributes = Type.Object({
_attributes: Type.Optional(Type.Object({
version: Type.Optional(Type.String())
Expand Down Expand Up @@ -436,7 +476,10 @@ export const Detail = Type.Object({
fillColor: Type.Optional(GenericAttributes),
mission: Type.Optional(Mission),
shape: Type.Optional(Shape),

link: Type.Optional(Type.Union([Link, Type.Array(Link)])),
link_attr: Type.Optional(LinkAttr),

usericon: Type.Optional(UserIcon),
track: Type.Optional(Track),
sensor: Type.Optional(Sensor),
Expand Down
Loading

0 comments on commit 3435a39

Please sign in to comment.