Skip to content

Instantly share code, notes, and snippets.

@thw0rted
Created July 27, 2017 12:06
Show Gist options
  • Save thw0rted/0b9cfa1c6c8cf068df17a622b3cbdca2 to your computer and use it in GitHub Desktop.
Save thw0rted/0b9cfa1c6c8cf068df17a622b3cbdca2 to your computer and use it in GitHub Desktop.
Library Typing for milsymbol
type SymbolOptions = {
additionalInformation?: String,
altitudeDepth?: String,
combatEffectiveness?: String,
commonIdentifier?: String,
direction?: Number,
dtg?: String,
equipmentTeardownTime?: String,
evaluationRating?: String,
headquartersElement?: String,
higherFormation?: String,
hostile?: String,
iffSif?: String,
location?: String,
platformType?: String,
quantity?: String,
reinforcedReduced?: String,
sigint?: String,
signatureEquipment?: String,
specialHeadquarters?: String,
speed?: String,
staffComments?: String,
type?: String,
uniqueDesignation?: String,
alternateMedal?: Boolean,
civilianColor?: Boolean,
colorMode?: ColorMode|String,
fill?: Boolean,
fillOpacity?: Number,
frame?: Boolean,
hqStafLength?: Number,
icon?: Boolean,
infoColor?: String,
infoFields?: Boolean,
infoSize?: Number,
monoColor?: String,
outlineColor?: String,
outlineWidth?: Number,
size?: Number,
strokeWidth?: Number,
size?: Number
}
type SymbolProperties = {
activity: Boolean, // Is it an Activity
affiliation: String, // Affiliation it is shown as (Friend/Hostile...)
baseAffilation: String, // Affiliation it belongs to (Friend/Hostile...)
baseDimension: String, // Dimension it belongs to (Air/Ground...)
baseGeometry: Object, // Geometry is a combination of dimension and affiliation (AirFriend/GroundHostile...)
civilian: Boolean, // Is it Civilian
condition: String, // What condition is it in
context: String, // Context of the symbol (Reality/Exercise...)
dimension: String, // Dimension it is shown as (Air/Ground...) for example Ground Equipment is shown with the same shape as Sea.
dimensionUnknown: Boolean, // Is the dimension unknown
echelon: String, //What echelon (Platoon/Company...)
faker: Boolean, // Is it a Faker
fenintDummy: Boolean, // Is it a feint/dummy
fill: Boolean, // Standard says it should be filled
frame: Boolean, // Standard says it should be framed
functionid: String, // Part of SIDC referring to the icon.
headquarters: Boolean, // Is it a Headquarters
installation: Boolean, // Is it an Instalation
joker: Boolean, // Is it a Joker
mobility: String, // What mobility (Tracked/Sled...)
notpresent: String, // Is it Anticipated or Pending
numberSIDC: Boolean, // Is the SIDC number based
space: Boolean, // Is it in Space
taskForce: Boolean // Is it a task force
};
type SymbolColors = {
black: String, // Black parts of the symbol.
fillColor: String, // Symbol fill color.
frameColor: String, // Symbol frame color.
iconColor: String, // Icon color.
iconFillColor: String, // Icon fill color.
none: String, // Transparent parts of the symbol.
white: String // White parts of the symbol.
};
export class Symbol {
constructor(code: String, opts: SymbolOptions);
width: Number;
height: Number;
asCanvas(factor=1.0): Canvas;
asDOM(): Element;
asSVG(): String;
getAnchor(): {x: Number, y:Number};
getColors(): SymbolColors;
getOctagonAnchor(): {x: Number, y:Number};
getProperties(): SymbolProperties;
getSize(): {width:Number, height:Number};
isValid(extended: Boolean): Boolean | Object;
setOptions(opts: SymbolOptions): Symbol;
toDataURL(): String;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment