Skip to content

Commit

Permalink
Add Projection
Browse files Browse the repository at this point in the history
  • Loading branch information
ingalls committed Dec 20, 2024
1 parent 40455b0 commit 4e5a746
Show file tree
Hide file tree
Showing 6 changed files with 332 additions and 317 deletions.
5 changes: 5 additions & 0 deletions api/lib/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ export class toEnum {
}
}

export enum Profile_Projection {
MERCATOR = 'mercator',
GLOBE = 'GLOBE',
}

export enum Basemap_Format {
PNG = 'png',
JPEG = 'jpeg',
Expand Down
3 changes: 2 additions & 1 deletion api/lib/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { TAKGroup, TAKRole } from './api/types.js';
import { Layer_Config } from './models/Layer.js';
import {
Layer_Priority,
Profile_Stale, Profile_Speed, Profile_Elevation, Profile_Distance, Profile_Text,
Profile_Stale, Profile_Speed, Profile_Elevation, Profile_Distance, Profile_Text, Profile_Projection,
Basemap_Type, Basemap_Format, Basemap_Style,
} from './enums.js';
import { json, boolean, uuid, numeric, integer, timestamp, pgTable, serial, varchar, text, unique, index } from 'drizzle-orm/pg-core';
Expand Down Expand Up @@ -42,6 +42,7 @@ export const Profile = pgTable('profile', {
display_distance: text().$type<Profile_Distance>().notNull().default(Profile_Distance.MILE),
display_elevation: text().$type<Profile_Elevation>().notNull().default(Profile_Elevation.FEET),
display_speed: text().$type<Profile_Speed>().notNull().default(Profile_Speed.MPH),
display_projection: text().$type<Profile_Projection>().notNull().default(Profile_Projection.GLOBE),
display_text: text().$type<Profile_Text>().notNull().default(Profile_Text.Medium),
system_admin: boolean().notNull().default(false),
agency_admin: json().notNull().$type<Array<number>>().default([])
Expand Down
2 changes: 2 additions & 0 deletions api/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { createSelectSchema } from 'drizzle-typebox';
import { Type } from '@sinclair/typebox'
import * as schemas from './schema.js';
import { TAKGroup, TAKRole } from './api/types.js';
import { Profile_Projection } from './enums.js';
import { AugmentedData } from './models/Data.js';
import { AugmentedLayer } from './models/Layer.js';
import { Feature } from '@tak-ps/node-cot';
Expand Down Expand Up @@ -73,6 +74,7 @@ export const ProfileResponse = Type.Object({
coordinates: Type.Array(Type.Number())
}), Type.Null()]),
tak_loc_freq: Type.Integer(),
display_projection: Type.Enum(Profile_Projection),
display_stale: Type.String(),
display_text: Type.String(),
display_distance: Type.String(),
Expand Down
3 changes: 2 additions & 1 deletion api/routes/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ProfileResponse } from '../lib/types.js'
import Config from '../lib/config.js';
import { TAKRole, TAKGroup } from '../lib/api/types.js'
import { sql } from 'drizzle-orm';
import { Profile_Text, Profile_Stale, Profile_Speed, Profile_Elevation, Profile_Distance } from '../lib/enums.js';
import { Profile_Text, Profile_Stale, Profile_Speed, Profile_Elevation, Profile_Distance, Profile_Projection } from '../lib/enums.js';

export default async function router(schema: Schema, config: Config) {
await schema.get('/profile', {
Expand Down Expand Up @@ -34,6 +34,7 @@ export default async function router(schema: Schema, config: Config) {
display_stale: Type.Optional(Type.Enum(Profile_Stale)),
display_distance: Type.Optional(Type.Enum(Profile_Distance)),
display_elevation: Type.Optional(Type.Enum(Profile_Elevation)),
display_projection: Type.Optional(Type.Enum(Profile_Projection)),
display_speed: Type.Optional(Type.Enum(Profile_Speed)),
display_text: Type.Optional(Type.Enum(Profile_Text)),
tak_callsign: Type.Optional(Type.String()),
Expand Down
1 change: 1 addition & 0 deletions api/web/src/components/CloudTAK/CoTView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@
<td>
<a
:href='link.url'
target="_blank"
v-text='link.url'
/>
</td>
Expand Down
Loading

0 comments on commit 4e5a746

Please sign in to comment.