@armyc2.c5isr.renderer/mil-sym-ts-web 2.2.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{dist/armyc2.c5isr.renderer-mil-sym-ts-web-2.2.0.tgz → armyc2.c5isr.renderer-mil-sym-ts-web-2.2.1.tgz} +0 -0
- package/package.json +15 -39
- package/buildNode.bat +0 -2
- package/buildWeb.bat +0 -2
- package/dist/LICENSE +0 -201
- package/dist/README.md +0 -57
- package/dist/package.json +0 -16
- package/index.ts +0 -169
- package/package.bak +0 -50
- package/package.node.json +0 -43
- package/package.pack.json +0 -19
- package/package.packWeb.json +0 -16
- package/package.web.json +0 -40
- package/src/main/ts/android/graphics/Bitmap.ts +0 -7
- package/src/main/ts/android/graphics/Paint.ts +0 -26
- package/src/main/ts/android/graphics/Path.ts +0 -78
- package/src/main/ts/android/graphics/PointF.ts +0 -14
- package/src/main/ts/android/graphics/Rect.ts +0 -18
- package/src/main/ts/android/graphics/RectF.ts +0 -50
- package/src/main/ts/android/graphics/Region.ts +0 -36
- package/src/main/ts/android/graphics/Typeface.ts +0 -11
- package/src/main/ts/armyc2/c5isr/JavaLineArray/BasicShapes.ts +0 -99
- package/src/main/ts/armyc2/c5isr/JavaLineArray/CChannelPoints2.ts +0 -34
- package/src/main/ts/armyc2/c5isr/JavaLineArray/CELineArray.ts +0 -193
- package/src/main/ts/armyc2/c5isr/JavaLineArray/Channels.ts +0 -2971
- package/src/main/ts/armyc2/c5isr/JavaLineArray/DISMSupport.ts +0 -4008
- package/src/main/ts/armyc2/c5isr/JavaLineArray/POINT2.ts +0 -93
- package/src/main/ts/armyc2/c5isr/JavaLineArray/Shape2.ts +0 -89
- package/src/main/ts/armyc2/c5isr/JavaLineArray/TacticalLines.ts +0 -515
- package/src/main/ts/armyc2/c5isr/JavaLineArray/arraysupport.ts +0 -5403
- package/src/main/ts/armyc2/c5isr/JavaLineArray/countsupport.ts +0 -1084
- package/src/main/ts/armyc2/c5isr/JavaLineArray/flot.ts +0 -2173
- package/src/main/ts/armyc2/c5isr/JavaLineArray/lineutility.ts +0 -4934
- package/src/main/ts/armyc2/c5isr/JavaLineArray/ref.ts +0 -7
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/Modifier2.ts +0 -5601
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/P1.ts +0 -14
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/TGLight.ts +0 -648
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/clsChannelUtility.ts +0 -647
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/clsMETOC.ts +0 -2994
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/clsUtility.ts +0 -2663
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/mdlGeodesic.ts +0 -669
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsClipPolygon2.ts +0 -971
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsClipQuad.ts +0 -871
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsRenderer.ts +0 -3507
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsRenderer2.ts +0 -500
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsUtility.ts +0 -1089
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsUtilityCPOF.ts +0 -2656
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsUtilityGE.ts +0 -1419
- package/src/main/ts/armyc2/c5isr/data/genc.json +0 -1407
- package/src/main/ts/armyc2/c5isr/data/msd.json +0 -17311
- package/src/main/ts/armyc2/c5isr/data/mse.json +0 -18500
- package/src/main/ts/armyc2/c5isr/data/svgd.json +0 -31214
- package/src/main/ts/armyc2/c5isr/data/svge.json +0 -30558
- package/src/main/ts/armyc2/c5isr/graphics2d/AffineTransform.ts +0 -10
- package/src/main/ts/armyc2/c5isr/graphics2d/Area.ts +0 -437
- package/src/main/ts/armyc2/c5isr/graphics2d/BasicStroke.ts +0 -429
- package/src/main/ts/armyc2/c5isr/graphics2d/BasicTypes.ts +0 -7
- package/src/main/ts/armyc2/c5isr/graphics2d/BufferedImage.ts +0 -35
- package/src/main/ts/armyc2/c5isr/graphics2d/Font.ts +0 -111
- package/src/main/ts/armyc2/c5isr/graphics2d/FontMetrics.ts +0 -29
- package/src/main/ts/armyc2/c5isr/graphics2d/FontRenderContext.ts +0 -18
- package/src/main/ts/armyc2/c5isr/graphics2d/GeneralPath.ts +0 -211
- package/src/main/ts/armyc2/c5isr/graphics2d/Graphics2D.ts +0 -80
- package/src/main/ts/armyc2/c5isr/graphics2d/IPathIterator.ts +0 -33
- package/src/main/ts/armyc2/c5isr/graphics2d/ImageIO.ts +0 -16
- package/src/main/ts/armyc2/c5isr/graphics2d/Line2D.ts +0 -726
- package/src/main/ts/armyc2/c5isr/graphics2d/PathIterator.ts +0 -141
- package/src/main/ts/armyc2/c5isr/graphics2d/Point.ts +0 -112
- package/src/main/ts/armyc2/c5isr/graphics2d/Point2D.ts +0 -261
- package/src/main/ts/armyc2/c5isr/graphics2d/Polygon.ts +0 -391
- package/src/main/ts/armyc2/c5isr/graphics2d/Rectangle.ts +0 -567
- package/src/main/ts/armyc2/c5isr/graphics2d/Rectangle2D.ts +0 -445
- package/src/main/ts/armyc2/c5isr/graphics2d/Shape.ts +0 -31
- package/src/main/ts/armyc2/c5isr/graphics2d/Stroke.ts +0 -18
- package/src/main/ts/armyc2/c5isr/graphics2d/TextLayout.ts +0 -45
- package/src/main/ts/armyc2/c5isr/graphics2d/TexturePaint.ts +0 -25
- package/src/main/ts/armyc2/c5isr/renderer/IIconRenderer.ts +0 -15
- package/src/main/ts/armyc2/c5isr/renderer/IconRenderer.ts +0 -22
- package/src/main/ts/armyc2/c5isr/renderer/MilStdIconRenderer.ts +0 -269
- package/src/main/ts/armyc2/c5isr/renderer/ModifierRenderer.ts +0 -9882
- package/src/main/ts/armyc2/c5isr/renderer/PatternFillRenderer.ts +0 -146
- package/src/main/ts/armyc2/c5isr/renderer/SinglePointSVGRenderer.ts +0 -1265
- package/src/main/ts/armyc2/c5isr/renderer/shapes/arc.ts +0 -64
- package/src/main/ts/armyc2/c5isr/renderer/shapes/bcurve.ts +0 -95
- package/src/main/ts/armyc2/c5isr/renderer/shapes/ellipse.ts +0 -93
- package/src/main/ts/armyc2/c5isr/renderer/shapes/line.ts +0 -114
- package/src/main/ts/armyc2/c5isr/renderer/shapes/path.ts +0 -555
- package/src/main/ts/armyc2/c5isr/renderer/shapes/pathiterator.ts +0 -62
- package/src/main/ts/armyc2/c5isr/renderer/shapes/point.ts +0 -120
- package/src/main/ts/armyc2/c5isr/renderer/shapes/rectangle.ts +0 -431
- package/src/main/ts/armyc2/c5isr/renderer/shapes/roundedrectangle.ts +0 -99
- package/src/main/ts/armyc2/c5isr/renderer/shapes/types.ts +0 -25
- package/src/main/ts/armyc2/c5isr/renderer/shapes/utilities.ts +0 -203
- package/src/main/ts/armyc2/c5isr/renderer/utilities/AffiliationColors.ts +0 -104
- package/src/main/ts/armyc2/c5isr/renderer/utilities/Color.ts +0 -481
- package/src/main/ts/armyc2/c5isr/renderer/utilities/DistanceUnit.ts +0 -40
- package/src/main/ts/armyc2/c5isr/renderer/utilities/DrawRules.ts +0 -1323
- package/src/main/ts/armyc2/c5isr/renderer/utilities/EntityCode.ts +0 -51
- package/src/main/ts/armyc2/c5isr/renderer/utilities/ErrorLogger.ts +0 -736
- package/src/main/ts/armyc2/c5isr/renderer/utilities/GENCLookup.ts +0 -106
- package/src/main/ts/armyc2/c5isr/renderer/utilities/GeoPixelConversion3D.ts +0 -84
- package/src/main/ts/armyc2/c5isr/renderer/utilities/IMultiPointRenderer.ts +0 -87
- package/src/main/ts/armyc2/c5isr/renderer/utilities/IPointConversion.ts +0 -34
- package/src/main/ts/armyc2/c5isr/renderer/utilities/ImageInfo.ts +0 -324
- package/src/main/ts/armyc2/c5isr/renderer/utilities/LRUCache.ts +0 -127
- package/src/main/ts/armyc2/c5isr/renderer/utilities/LRUEntry.ts +0 -18
- package/src/main/ts/armyc2/c5isr/renderer/utilities/LogLevel.ts +0 -111
- package/src/main/ts/armyc2/c5isr/renderer/utilities/MODrawRules.ts +0 -219
- package/src/main/ts/armyc2/c5isr/renderer/utilities/MSInfo.ts +0 -1008
- package/src/main/ts/armyc2/c5isr/renderer/utilities/MSLookup.ts +0 -882
- package/src/main/ts/armyc2/c5isr/renderer/utilities/MilStdAttributes.ts +0 -380
- package/src/main/ts/armyc2/c5isr/renderer/utilities/MilStdSymbol.ts +0 -797
- package/src/main/ts/armyc2/c5isr/renderer/utilities/Modifiers.ts +0 -1699
- package/src/main/ts/armyc2/c5isr/renderer/utilities/PointConversion.ts +0 -178
- package/src/main/ts/armyc2/c5isr/renderer/utilities/PointConversionDummy.ts +0 -45
- package/src/main/ts/armyc2/c5isr/renderer/utilities/PointConverter3D.ts +0 -126
- package/src/main/ts/armyc2/c5isr/renderer/utilities/RectUtilities.ts +0 -118
- package/src/main/ts/armyc2/c5isr/renderer/utilities/RendererException.ts +0 -11
- package/src/main/ts/armyc2/c5isr/renderer/utilities/RendererSettings.ts +0 -1201
- package/src/main/ts/armyc2/c5isr/renderer/utilities/RendererUtilities.ts +0 -591
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGInfo.ts +0 -29
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGLookup.ts +0 -753
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGSymbolInfo.ts +0 -137
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGTextInfo.ts +0 -438
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SettingsChangedEvent.ts +0 -19
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SettingsChangedEventListener.ts +0 -10
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SettingsEventListener.ts +0 -5
- package/src/main/ts/armyc2/c5isr/renderer/utilities/Shape2SVG.ts +0 -404
- package/src/main/ts/armyc2/c5isr/renderer/utilities/ShapeInfo.ts +0 -525
- package/src/main/ts/armyc2/c5isr/renderer/utilities/ShapeUtilities.ts +0 -55
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SymbolDimensionInfo.ts +0 -36
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SymbolID.ts +0 -1055
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SymbolUtilities.ts +0 -2085
- package/src/main/ts/armyc2/c5isr/renderer/utilities/TextInfo.ts +0 -157
- package/src/main/ts/armyc2/c5isr/web/render/GeoPixelConversion.ts +0 -86
- package/src/main/ts/armyc2/c5isr/web/render/MultiPointHandler.ts +0 -3798
- package/src/main/ts/armyc2/c5isr/web/render/MultiPointHandlerSVG.ts +0 -412
- package/src/main/ts/armyc2/c5isr/web/render/PointConverter.ts +0 -124
- package/src/main/ts/armyc2/c5isr/web/render/SymbolModifiers.ts +0 -26
- package/src/main/ts/armyc2/c5isr/web/render/WebRenderer.ts +0 -677
- package/src/main/ts/armyc2/c5isr/web/render/utilities/JavaRendererUtilities.ts +0 -484
- package/src/main/ts/armyc2/c5isr/web/render/utilities/LineInfo.ts +0 -62
- package/src/main/ts/armyc2/c5isr/web/render/utilities/SymbolInfo.ts +0 -46
- package/src/main/ts/armyc2/c5isr/web/render/utilities/TextInfo.ts +0 -51
- package/src/main/ts/org/gavaghan/geodesy/Angle.ts +0 -31
- package/src/main/ts/org/gavaghan/geodesy/Ellipsoid.ts +0 -71
- package/src/main/ts/org/gavaghan/geodesy/GeodeticCalculator.ts +0 -200
- package/src/main/ts/org/gavaghan/geodesy/GeodeticCurve.ts +0 -55
- package/src/main/ts/org/gavaghan/geodesy/GeodeticMeasurement.ts +0 -68
- package/src/main/ts/org/gavaghan/geodesy/GlobalCoordinates.ts +0 -103
- package/src/main/ts/org/gavaghan/geodesy/GlobalPosition.ts +0 -90
- package/test/ExportSPImages.js +0 -692
- package/test/MPWW.html +0 -556
- package/test/MPWorker.js +0 -318
- package/test/SPWorker.js +0 -233
- package/test/SVGWW.html +0 -363
- package/test/singlePointTester3.html +0 -751
- package/tsconfig.json +0 -54
- package/typedoc.json +0 -30
- package/updateVersion.js +0 -21
- package/webpack.config.js +0 -34
- package/webpackn.config.js +0 -28
- package/webpackr.config.js +0 -47
- package/webpackw.config.js +0 -23
- /package/{dist/C5Ren.d.ts → C5Ren.d.ts} +0 -0
- /package/{dist/C5Ren.js → C5Ren.js} +0 -0
- /package/{dist/C5Ren.js.map → C5Ren.js.map} +0 -0
- /package/{dist/manifest.json → manifest.json} +0 -0
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import { type double, type int } from "../../graphics2d/BasicTypes";
|
|
2
|
-
|
|
3
|
-
import { Font } from "../../graphics2d/Font"
|
|
4
|
-
import { Point2D } from "../../graphics2d/Point2D"
|
|
5
|
-
import { Rectangle2D } from "../../graphics2d/Rectangle2D"
|
|
6
|
-
import { RendererSettings } from "../../renderer/utilities/RendererSettings"
|
|
7
|
-
import { ShapeUtilities } from "../../renderer/utilities/ShapeUtilities";
|
|
8
|
-
import { RectUtilities } from "./RectUtilities";
|
|
9
|
-
|
|
10
|
-
import { Canvas, CanvasRenderingContext2D, createCanvas } from 'canvas';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*/
|
|
16
|
-
export class TextInfo {
|
|
17
|
-
protected _text: string = "";
|
|
18
|
-
protected _location: Point2D;
|
|
19
|
-
protected _bounds: Rectangle2D;
|
|
20
|
-
protected _descent: double = 0;
|
|
21
|
-
protected _aboveBaseHeight: double = 0;
|
|
22
|
-
|
|
23
|
-
private isNode = typeof process !== 'undefined' && process.versions != null && process.versions.node != null;
|
|
24
|
-
private isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
25
|
-
private OSCDefined = typeof OffscreenCanvasRenderingContext2D !== 'undefined';//web workers fail isBrowser test
|
|
26
|
-
private OSCanvasDefined = typeof OffscreenCanvas !== 'undefined';//web workers fail isBrowser test
|
|
27
|
-
|
|
28
|
-
public constructor(text: string, x: int, y: int, font: Font | string, context: OffscreenCanvasRenderingContext2D | CanvasRenderingContext2D | null)
|
|
29
|
-
{
|
|
30
|
-
let ctx:any;//OffscreenCanvasRenderingContext2D | CanvasRenderingContext2D;
|
|
31
|
-
let tm:TextMetrics | any;//node-canvas doesn't fully implement TextMetics so must set to any
|
|
32
|
-
let top:number;
|
|
33
|
-
let left:number;
|
|
34
|
-
let width:number;
|
|
35
|
-
let height:number;
|
|
36
|
-
let bounds:Rectangle2D;
|
|
37
|
-
|
|
38
|
-
if(context == null)
|
|
39
|
-
{
|
|
40
|
-
let osc:OffscreenCanvas | Canvas
|
|
41
|
-
if(this.OSCDefined)
|
|
42
|
-
osc = new OffscreenCanvas(10,10);
|
|
43
|
-
else
|
|
44
|
-
osc = createCanvas(10,10);
|
|
45
|
-
|
|
46
|
-
ctx = osc.getContext("2d");
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
else
|
|
50
|
-
{
|
|
51
|
-
ctx = context;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if(typeof font === 'string')
|
|
55
|
-
ctx.font = font;
|
|
56
|
-
else
|
|
57
|
-
ctx.font = font.toString();
|
|
58
|
-
|
|
59
|
-
this._text = text;
|
|
60
|
-
tm = ctx.measureText(text);
|
|
61
|
-
|
|
62
|
-
if(tm.fontBoundingBoxAscent != null)
|
|
63
|
-
top = y - tm.fontBoundingBoxAscent;
|
|
64
|
-
else
|
|
65
|
-
{
|
|
66
|
-
top = y - tm.emHeightAscent;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
left = x;
|
|
70
|
-
this._location = new Point2D(x, y);
|
|
71
|
-
|
|
72
|
-
width = tm.width;
|
|
73
|
-
width = tm.actualBoundingBoxRight + tm.actualBoundingBoxLeft;
|
|
74
|
-
|
|
75
|
-
if(this.OSCDefined)
|
|
76
|
-
{
|
|
77
|
-
height = tm.fontBoundingBoxDescent + tm.fontBoundingBoxAscent;
|
|
78
|
-
this._descent = tm.fontBoundingBoxDescent;
|
|
79
|
-
this._aboveBaseHeight = tm.fontBoundingBoxAscent;
|
|
80
|
-
}
|
|
81
|
-
else
|
|
82
|
-
{
|
|
83
|
-
height = tm.emHeightDescent + tm.emHeightAscent;
|
|
84
|
-
this._descent = tm.emHeightDescent;
|
|
85
|
-
this._aboveBaseHeight = tm.emHeightAscent;
|
|
86
|
-
}
|
|
87
|
-
bounds = new Rectangle2D(top, left, width, height);
|
|
88
|
-
|
|
89
|
-
RectUtilities.grow(bounds,1);
|
|
90
|
-
|
|
91
|
-
this._bounds = bounds;
|
|
92
|
-
/*console.log(this._text);
|
|
93
|
-
console.log(this._bounds);
|
|
94
|
-
console.log(tm);//*/
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
public setLocation(x: int, y: int): void {
|
|
98
|
-
|
|
99
|
-
this._bounds.setRect(x, y - this._aboveBaseHeight, this._bounds.getWidth(), this._bounds.getHeight());
|
|
100
|
-
RectUtilities.grow(this._bounds,1);
|
|
101
|
-
this._location.setLocation(x, y);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
public getLocation(): Point2D {
|
|
105
|
-
return this._location;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
public shift(x: int, y: int): void {
|
|
109
|
-
ShapeUtilities.offset(this._bounds, x, y);
|
|
110
|
-
ShapeUtilities.offset(this._location, x, y);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
public getText(): string {
|
|
114
|
-
return this._text;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* includes the descent
|
|
119
|
-
* @returns
|
|
120
|
-
*/
|
|
121
|
-
public getTextBounds(): Rectangle2D {
|
|
122
|
-
return this._bounds;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
public getTextOutlineBounds(): Rectangle2D {
|
|
127
|
-
let RS: RendererSettings = RendererSettings.getInstance();
|
|
128
|
-
let outlineOffset: int = RS.getTextOutlineWidth();
|
|
129
|
-
let bounds: Rectangle2D = this._bounds.clone() as Rectangle2D;
|
|
130
|
-
|
|
131
|
-
if (outlineOffset > 0) {
|
|
132
|
-
if (RS.getTextBackgroundMethod() === RendererSettings.TextBackgroundMethod_OUTLINE) {
|
|
133
|
-
|
|
134
|
-
ShapeUtilities.grow(bounds, outlineOffset / 2);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
else {
|
|
138
|
-
|
|
139
|
-
ShapeUtilities.grow(bounds, outlineOffset);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
return bounds;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
public getDescent(): double {
|
|
148
|
-
return this._descent;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
public strokeText = function(context:OffscreenCanvasRenderingContext2D){
|
|
152
|
-
context.strokeText(this.text,this.location.getX(),this.location.getY());
|
|
153
|
-
};
|
|
154
|
-
public fillText = function(context:OffscreenCanvasRenderingContext2D){
|
|
155
|
-
context.fillText(this.text,this.location.getX(),this.location.getY());
|
|
156
|
-
};
|
|
157
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { type double } from "../../../../armyc2/c5isr/graphics2d/BasicTypes";
|
|
5
|
-
import { RendererSettings } from "../../renderer/utilities/RendererSettings";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export class GeoPixelConversion {
|
|
10
|
-
|
|
11
|
-
public static readonly INCHES_PER_METER: double = 39.3700787;
|
|
12
|
-
public static readonly METERS_PER_DEG: double = 40075017 / 360; // Earth's circumference in meters / 360 degrees
|
|
13
|
-
|
|
14
|
-
public static metersPerPixel(scale: double): double {
|
|
15
|
-
let step1: double = scale / RendererSettings.getInstance().getDeviceDPI();
|
|
16
|
-
return step1 / GeoPixelConversion.INCHES_PER_METER;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
public static lat2y(latitude: double, scale: double, latOrigin: double, metPerPix: double): double {
|
|
20
|
-
|
|
21
|
-
let latRem: double = -(latitude - latOrigin);
|
|
22
|
-
let pixDis: double = (latRem * GeoPixelConversion.METERS_PER_DEG) / metPerPix;
|
|
23
|
-
return pixDis;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
public static y2lat(yPosition: double, scale: double, latOrigin: double, metPerPix: double): double {
|
|
27
|
-
|
|
28
|
-
let latitude: double = latOrigin - ((yPosition * metPerPix) / GeoPixelConversion.METERS_PER_DEG);
|
|
29
|
-
return latitude;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
public static long2x(longitude: double, scale: double, longOrigin: double, latitude: double, metPerPix: double, normalize: boolean): double {
|
|
33
|
-
|
|
34
|
-
let longRem: double = longitude - longOrigin;
|
|
35
|
-
if (normalize) {
|
|
36
|
-
if (longRem > 180) {
|
|
37
|
-
longRem -= 360;
|
|
38
|
-
}
|
|
39
|
-
if (longRem < -180) {
|
|
40
|
-
longRem += 360;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
let metersPerDeg: double = GeoPixelConversion.GetMetersPerDegAtLat(latitude);
|
|
44
|
-
let pixDis: double = (longRem * metersPerDeg) / metPerPix;
|
|
45
|
-
return pixDis;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
public static x2long(xPosition: double, scale: double, longOrigin: double, latitude: double, metPerPix: double): double {
|
|
49
|
-
|
|
50
|
-
let metersPerDeg: double = GeoPixelConversion.GetMetersPerDegAtLat(latitude);
|
|
51
|
-
let longitude: double = longOrigin + ((xPosition * metPerPix) / metersPerDeg);
|
|
52
|
-
|
|
53
|
-
if (longitude < -180) {
|
|
54
|
-
longitude += 360;
|
|
55
|
-
} else {
|
|
56
|
-
if (longitude > 180) {
|
|
57
|
-
longitude -= 360;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return longitude;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
public static Deg2Rad(deg: double): double {
|
|
66
|
-
let conv_factor: double = (2.0 * Math.PI) / 360.0;
|
|
67
|
-
return (deg * conv_factor);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
public static GetMetersPerDegAtLat(lat: double): double {
|
|
71
|
-
// Convert latitude to radians
|
|
72
|
-
lat = GeoPixelConversion.Deg2Rad(lat);
|
|
73
|
-
// Set up "Constants"
|
|
74
|
-
let p1: double = 111412.84; // longitude calculation term 1
|
|
75
|
-
|
|
76
|
-
let p2: double = -93.5; // longitude calculation term 2
|
|
77
|
-
|
|
78
|
-
let p3: double = 0.118; // longitude calculation term 3
|
|
79
|
-
|
|
80
|
-
// Calculate the length of a degree of longitude in meters at given
|
|
81
|
-
// latitude
|
|
82
|
-
let longlen: double = (p1 * Math.cos(lat)) + (p2 * Math.cos(3 * lat)) + (p3 * Math.cos(5 * lat));
|
|
83
|
-
|
|
84
|
-
return longlen;
|
|
85
|
-
}
|
|
86
|
-
}
|