@armyc2.c5isr.renderer/mil-sym-ts-web 2.2.0
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/LICENSE +201 -0
- package/README.md +57 -0
- package/buildNode.bat +2 -0
- package/buildWeb.bat +2 -0
- package/dist/C5Ren.d.ts +6970 -0
- package/dist/C5Ren.js +2 -0
- package/dist/C5Ren.js.map +1 -0
- package/dist/LICENSE +201 -0
- package/dist/README.md +57 -0
- package/dist/armyc2.c5isr.renderer-mil-sym-ts-web-2.2.0.tgz +0 -0
- package/dist/manifest.json +4 -0
- package/dist/package.json +16 -0
- package/index.ts +169 -0
- package/package.bak +50 -0
- package/package.json +40 -0
- package/package.node.json +43 -0
- package/package.pack.json +19 -0
- package/package.packWeb.json +16 -0
- package/package.web.json +40 -0
- package/src/main/ts/android/graphics/Bitmap.ts +7 -0
- package/src/main/ts/android/graphics/Paint.ts +26 -0
- package/src/main/ts/android/graphics/Path.ts +78 -0
- package/src/main/ts/android/graphics/PointF.ts +14 -0
- package/src/main/ts/android/graphics/Rect.ts +18 -0
- package/src/main/ts/android/graphics/RectF.ts +50 -0
- package/src/main/ts/android/graphics/Region.ts +36 -0
- package/src/main/ts/android/graphics/Typeface.ts +11 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/BasicShapes.ts +99 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/CChannelPoints2.ts +34 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/CELineArray.ts +193 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/Channels.ts +2971 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/DISMSupport.ts +4008 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/POINT2.ts +93 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/Shape2.ts +89 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/TacticalLines.ts +515 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/arraysupport.ts +5403 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/countsupport.ts +1084 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/flot.ts +2173 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/lineutility.ts +4934 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/ref.ts +7 -0
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/Modifier2.ts +5601 -0
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/P1.ts +14 -0
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/TGLight.ts +648 -0
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/clsChannelUtility.ts +647 -0
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/clsMETOC.ts +2994 -0
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/clsUtility.ts +2663 -0
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/mdlGeodesic.ts +669 -0
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsClipPolygon2.ts +971 -0
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsClipQuad.ts +871 -0
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsRenderer.ts +3507 -0
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsRenderer2.ts +500 -0
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsUtility.ts +1089 -0
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsUtilityCPOF.ts +2656 -0
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsUtilityGE.ts +1419 -0
- package/src/main/ts/armyc2/c5isr/data/genc.json +1407 -0
- package/src/main/ts/armyc2/c5isr/data/msd.json +17311 -0
- package/src/main/ts/armyc2/c5isr/data/mse.json +18500 -0
- package/src/main/ts/armyc2/c5isr/data/svgd.json +31214 -0
- package/src/main/ts/armyc2/c5isr/data/svge.json +30558 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/AffineTransform.ts +10 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Area.ts +437 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/BasicStroke.ts +429 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/BasicTypes.ts +7 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/BufferedImage.ts +35 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Font.ts +111 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/FontMetrics.ts +29 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/FontRenderContext.ts +18 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/GeneralPath.ts +211 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Graphics2D.ts +80 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/IPathIterator.ts +33 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/ImageIO.ts +16 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Line2D.ts +726 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/PathIterator.ts +141 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Point.ts +112 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Point2D.ts +261 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Polygon.ts +391 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Rectangle.ts +567 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Rectangle2D.ts +445 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Shape.ts +31 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Stroke.ts +18 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/TextLayout.ts +45 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/TexturePaint.ts +25 -0
- package/src/main/ts/armyc2/c5isr/renderer/IIconRenderer.ts +15 -0
- package/src/main/ts/armyc2/c5isr/renderer/IconRenderer.ts +22 -0
- package/src/main/ts/armyc2/c5isr/renderer/MilStdIconRenderer.ts +269 -0
- package/src/main/ts/armyc2/c5isr/renderer/ModifierRenderer.ts +9882 -0
- package/src/main/ts/armyc2/c5isr/renderer/PatternFillRenderer.ts +146 -0
- package/src/main/ts/armyc2/c5isr/renderer/SinglePointSVGRenderer.ts +1265 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/arc.ts +64 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/bcurve.ts +95 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/ellipse.ts +93 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/line.ts +114 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/path.ts +555 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/pathiterator.ts +62 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/point.ts +120 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/rectangle.ts +431 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/roundedrectangle.ts +99 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/types.ts +25 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/utilities.ts +203 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/AffiliationColors.ts +104 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/Color.ts +481 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/DistanceUnit.ts +40 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/DrawRules.ts +1323 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/EntityCode.ts +51 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/ErrorLogger.ts +736 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/GENCLookup.ts +106 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/GeoPixelConversion3D.ts +84 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/IMultiPointRenderer.ts +87 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/IPointConversion.ts +34 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/ImageInfo.ts +324 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/LRUCache.ts +127 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/LRUEntry.ts +18 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/LogLevel.ts +111 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/MODrawRules.ts +219 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/MSInfo.ts +1008 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/MSLookup.ts +882 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/MilStdAttributes.ts +380 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/MilStdSymbol.ts +797 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/Modifiers.ts +1699 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/PointConversion.ts +178 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/PointConversionDummy.ts +45 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/PointConverter3D.ts +126 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/RectUtilities.ts +118 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/RendererException.ts +11 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/RendererSettings.ts +1201 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/RendererUtilities.ts +591 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGInfo.ts +29 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGLookup.ts +753 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGSymbolInfo.ts +137 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGTextInfo.ts +438 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SettingsChangedEvent.ts +19 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SettingsChangedEventListener.ts +10 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SettingsEventListener.ts +5 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/Shape2SVG.ts +404 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/ShapeInfo.ts +525 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/ShapeUtilities.ts +55 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SymbolDimensionInfo.ts +36 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SymbolID.ts +1055 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SymbolUtilities.ts +2085 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/TextInfo.ts +157 -0
- package/src/main/ts/armyc2/c5isr/web/render/GeoPixelConversion.ts +86 -0
- package/src/main/ts/armyc2/c5isr/web/render/MultiPointHandler.ts +3798 -0
- package/src/main/ts/armyc2/c5isr/web/render/MultiPointHandlerSVG.ts +412 -0
- package/src/main/ts/armyc2/c5isr/web/render/PointConverter.ts +124 -0
- package/src/main/ts/armyc2/c5isr/web/render/SymbolModifiers.ts +26 -0
- package/src/main/ts/armyc2/c5isr/web/render/WebRenderer.ts +677 -0
- package/src/main/ts/armyc2/c5isr/web/render/utilities/JavaRendererUtilities.ts +484 -0
- package/src/main/ts/armyc2/c5isr/web/render/utilities/LineInfo.ts +62 -0
- package/src/main/ts/armyc2/c5isr/web/render/utilities/SymbolInfo.ts +46 -0
- package/src/main/ts/armyc2/c5isr/web/render/utilities/TextInfo.ts +51 -0
- package/src/main/ts/org/gavaghan/geodesy/Angle.ts +31 -0
- package/src/main/ts/org/gavaghan/geodesy/Ellipsoid.ts +71 -0
- package/src/main/ts/org/gavaghan/geodesy/GeodeticCalculator.ts +200 -0
- package/src/main/ts/org/gavaghan/geodesy/GeodeticCurve.ts +55 -0
- package/src/main/ts/org/gavaghan/geodesy/GeodeticMeasurement.ts +68 -0
- package/src/main/ts/org/gavaghan/geodesy/GlobalCoordinates.ts +103 -0
- package/src/main/ts/org/gavaghan/geodesy/GlobalPosition.ts +90 -0
- package/test/ExportSPImages.js +692 -0
- package/test/MPWW.html +556 -0
- package/test/MPWorker.js +318 -0
- package/test/SPWorker.js +233 -0
- package/test/SVGWW.html +363 -0
- package/test/singlePointTester3.html +751 -0
- package/tsconfig.json +54 -0
- package/typedoc.json +30 -0
- package/updateVersion.js +21 -0
- package/webpack.config.js +34 -0
- package/webpackn.config.js +28 -0
- package/webpackr.config.js +47 -0
- package/webpackw.config.js +23 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { Rectangle } from "./rectangle";
|
|
2
|
+
|
|
3
|
+
export class ShapeUtilties
|
|
4
|
+
{
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Returns an indicator of where the specified point
|
|
8
|
+
* {@code (px,py)} lies with respect to the line segment from
|
|
9
|
+
* {@code (x1,y1)} to {@code (x2,y2)}.
|
|
10
|
+
* The return value can be either 1, -1, or 0 and indicates
|
|
11
|
+
* in which direction the specified line must pivot around its
|
|
12
|
+
* first end point, {@code (x1,y1)}, in order to point at the
|
|
13
|
+
* specified point {@code (px,py)}.
|
|
14
|
+
* <p>A return value of 1 indicates that the line segment must
|
|
15
|
+
* turn in the direction that takes the positive X axis towards
|
|
16
|
+
* the negative Y axis. In the default coordinate system used by
|
|
17
|
+
* Java 2D, this direction is counterclockwise.
|
|
18
|
+
* <p>A return value of -1 indicates that the line segment must
|
|
19
|
+
* turn in the direction that takes the positive X axis towards
|
|
20
|
+
* the positive Y axis. In the default coordinate system, this
|
|
21
|
+
* direction is clockwise.
|
|
22
|
+
* <p>A return value of 0 indicates that the point lies
|
|
23
|
+
* exactly on the line segment. Note that an indicator value
|
|
24
|
+
* of 0 is rare and not useful for determining colinearity
|
|
25
|
+
* because of floating point rounding issues.
|
|
26
|
+
* <p>If the point is colinear with the line segment, but
|
|
27
|
+
* not between the end points, then the value will be -1 if the point
|
|
28
|
+
* lies "beyond {@code (x1,y1)}" or 1 if the point lies
|
|
29
|
+
* "beyond {@code (x2,y2)}".
|
|
30
|
+
*
|
|
31
|
+
* @param x1 the X coordinate of the start point of the
|
|
32
|
+
* specified line segment
|
|
33
|
+
* @param y1 the Y coordinate of the start point of the
|
|
34
|
+
* specified line segment
|
|
35
|
+
* @param x2 the X coordinate of the end point of the
|
|
36
|
+
* specified line segment
|
|
37
|
+
* @param y2 the Y coordinate of the end point of the
|
|
38
|
+
* specified line segment
|
|
39
|
+
* @param px the X coordinate of the specified point to be
|
|
40
|
+
* compared with the specified line segment
|
|
41
|
+
* @param py the Y coordinate of the specified point to be
|
|
42
|
+
* compared with the specified line segment
|
|
43
|
+
* @return an integer that indicates the position of the third specified
|
|
44
|
+
* coordinates with respect to the line segment formed
|
|
45
|
+
* by the first two specified coordinates.
|
|
46
|
+
* @since 1.2
|
|
47
|
+
*/
|
|
48
|
+
public static relativeCCW = function(x1, y1, x2, y2, px, py)
|
|
49
|
+
{
|
|
50
|
+
x2 -= x1;
|
|
51
|
+
y2 -= y1;
|
|
52
|
+
px -= x1;
|
|
53
|
+
py -= y1;
|
|
54
|
+
var ccw = px * y2 - py * x2;
|
|
55
|
+
if (ccw === 0.0) {
|
|
56
|
+
// The point is colinear, classify based on which side of
|
|
57
|
+
// the segment the point falls on. We can calculate a
|
|
58
|
+
// relative value using the projection of px,py onto the
|
|
59
|
+
// segment - a negative value indicates the point projects
|
|
60
|
+
// outside of the segment in the direction of the particular
|
|
61
|
+
// endpoint used as the origin for the projection.
|
|
62
|
+
ccw = px * x2 + py * y2;
|
|
63
|
+
if (ccw > 0.0) {
|
|
64
|
+
// Reverse the projection to be relative to the original x2,y2
|
|
65
|
+
// x2 and y2 are simply negated.
|
|
66
|
+
// px and py need to have (x2 - x1) or (y2 - y1) subtracted
|
|
67
|
+
// from them (based on the original values)
|
|
68
|
+
// Since we really want to get a positive answer when the
|
|
69
|
+
// point is "beyond (x2,y2)", then we want to calculate
|
|
70
|
+
// the inverse anyway - thus we leave x2 & y2 negated.
|
|
71
|
+
px -= x2;
|
|
72
|
+
py -= y2;
|
|
73
|
+
ccw = px * x2 + py * y2;
|
|
74
|
+
if (ccw < 0.0) {
|
|
75
|
+
ccw = 0.0;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return (ccw < 0.0) ? -1 : ((ccw > 0.0) ? 1 : 0);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
public static linesIntersect = function(x1,y1,x2,y2,x3,y3,x4,y4)
|
|
83
|
+
{
|
|
84
|
+
var rCCW1 = this.relativeCCW(x1,y1,
|
|
85
|
+
x2,y2,
|
|
86
|
+
x3,y3),
|
|
87
|
+
|
|
88
|
+
rCCW2 = this.relativeCCW(x1,y1,
|
|
89
|
+
x2,y2,
|
|
90
|
+
x4,y4),
|
|
91
|
+
|
|
92
|
+
rCCW3 = this.relativeCCW(x3,y3,
|
|
93
|
+
x4,y4,
|
|
94
|
+
x1,y1),
|
|
95
|
+
|
|
96
|
+
rCCW4 = this.relativeCCW(x3,y3,
|
|
97
|
+
x4,y4,
|
|
98
|
+
x2,y2);
|
|
99
|
+
|
|
100
|
+
return (((rCCW1 * rCCW2) <= 0) && ((rCCW3 * rCCW4) <= 0));
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Intersects the pair of specified source <code>Rectangle</code>
|
|
105
|
+
* objects and puts the result into the specified destination
|
|
106
|
+
* <code>Rectangle</code> object. One of the source rectangles
|
|
107
|
+
* can also be the destination to avoid creating a third Rectangle2D
|
|
108
|
+
* object, but in this case the original points of this source
|
|
109
|
+
* rectangle will be overwritten by this method.
|
|
110
|
+
* @param src1 the first of a pair of <code>Rectangle</code>
|
|
111
|
+
* objects to be intersected with each other
|
|
112
|
+
* @param src2 the second of a pair of <code>Rectangle</code>
|
|
113
|
+
* objects to be intersected with each other
|
|
114
|
+
* @return the <code>Rectangle</code> that holds the
|
|
115
|
+
* results of the intersection of <code>src1</code> and
|
|
116
|
+
* <code>src2</code>
|
|
117
|
+
* @since 1.2
|
|
118
|
+
*/
|
|
119
|
+
public static intersectRects = function(src1:Rectangle,src2:Rectangle):Rectangle
|
|
120
|
+
{
|
|
121
|
+
var x1 = Math.max(src1.getX(), src2.getX()),
|
|
122
|
+
y1 = Math.max(src1.getY(), src2.getY()),
|
|
123
|
+
x2 = Math.min(src1.getX() + src1.getWidth(), src2.getX() + src2.getWidth()),
|
|
124
|
+
y2 = Math.min(src1.getY() + src1.getHeight() , src2.getY() + src2.getHeight());
|
|
125
|
+
|
|
126
|
+
return new Rectangle(x1, y1, x2-x1, y2-y1);
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Unions the pair of source <code>Rectangle</code> objects
|
|
131
|
+
* and puts the result into the specified destination
|
|
132
|
+
* <code>Rectangle</code> object. One of the source rectangles
|
|
133
|
+
* can also be the destination to avoid creating a third Rectangle
|
|
134
|
+
* object, but in this case the original points of this source
|
|
135
|
+
* rectangle will be overwritten by this method.
|
|
136
|
+
* @param src1 the first of a pair of <code>Rectangle</code>
|
|
137
|
+
* objects to be combined with each other
|
|
138
|
+
* @param src2 the second of a pair of <code>Rectangle</code>
|
|
139
|
+
* objects to be combined with each other
|
|
140
|
+
* @return the <code>Rectangle</code> that holds the
|
|
141
|
+
* results of the union of <code>src1</code> and
|
|
142
|
+
* <code>src2</code>
|
|
143
|
+
* @since 1.2
|
|
144
|
+
*/
|
|
145
|
+
/*public static unionRects = function(src1:Rectangle,src2:Rectangle):Rectangle
|
|
146
|
+
{
|
|
147
|
+
var x1 = Math.min(src1.getX(), src2.getX()),
|
|
148
|
+
y1 = Math.min(src1.getY(), src2.getY()),
|
|
149
|
+
x2 = Math.max(src1.getX() + src1.getWidth(), src2.getX() + src2.getWidth()),
|
|
150
|
+
y2 = Math.max(src1.getY() + src1.getHeight(), src2.getY() + src2.getHeight());
|
|
151
|
+
return new Rectangle(x1, y1, x2, y2);
|
|
152
|
+
};//*/
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/*
|
|
156
|
+
if(typeof CanvasRenderingContext2D !== 'undefined' && CanvasRenderingContext2D.prototype.dashedLineTo !== 'undefined')
|
|
157
|
+
{ //public function from:
|
|
158
|
+
//https://davidowens.wordpress.com/2010/09/07/html-5-canvas-dashed-lines/
|
|
159
|
+
CanvasRenderingContext2D.prototype.dashedLineTo = function (fromX, fromY, toX, toY, pattern)
|
|
160
|
+
{
|
|
161
|
+
// Our growth rate for our line can be one of the following:
|
|
162
|
+
// (+,+), (+,-), (-,+), (-,-)
|
|
163
|
+
// Because of this, our algorithm needs to understand if the x-coord and
|
|
164
|
+
// y-coord should be getting smaller or larger and properly cap the values
|
|
165
|
+
// based on (x,y).
|
|
166
|
+
var lt = function (a, b) { return a <= b; };
|
|
167
|
+
var gt = function (a, b) { return a >= b; };
|
|
168
|
+
var capmin = function (a, b) { return Math.min(a, b); };
|
|
169
|
+
var capmax = function (a, b) { return Math.max(a, b); };
|
|
170
|
+
|
|
171
|
+
var checkX = { thereYet: gt, cap: capmin };
|
|
172
|
+
var checkY = { thereYet: gt, cap: capmin };
|
|
173
|
+
|
|
174
|
+
if (fromY - toY > 0) {
|
|
175
|
+
checkY.thereYet = lt;
|
|
176
|
+
checkY.cap = capmax;
|
|
177
|
+
}
|
|
178
|
+
if (fromX - toX > 0)
|
|
179
|
+
{
|
|
180
|
+
checkX.thereYet = lt;
|
|
181
|
+
checkX.cap = capmax;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
this.moveTo(fromX, fromY);
|
|
185
|
+
var offsetX = fromX;
|
|
186
|
+
var offsetY = fromY;
|
|
187
|
+
var idx = 0, dash = true;
|
|
188
|
+
while (!(checkX.thereYet(offsetX, toX) && checkY.thereYet(offsetY, toY)))
|
|
189
|
+
{
|
|
190
|
+
var ang = Math.atan2(toY - fromY, toX - fromX);
|
|
191
|
+
var len = pattern[idx];
|
|
192
|
+
|
|
193
|
+
offsetX = checkX.cap(toX, offsetX + (Math.cos(ang) * len));
|
|
194
|
+
offsetY = checkY.cap(toY, offsetY + (Math.sin(ang) * len));
|
|
195
|
+
|
|
196
|
+
if (dash) this.lineTo(offsetX, offsetY);
|
|
197
|
+
else this.moveTo(offsetX, offsetY);
|
|
198
|
+
|
|
199
|
+
idx = (idx + 1) % pattern.length;
|
|
200
|
+
dash = !dash;
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
}*/
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* To change this template, choose Tools | Templates
|
|
3
|
+
* and open the template in the editor.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
import { Color } from "../../renderer/utilities/Color"
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Default Affiliation Colors for the symbols
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
export class AffiliationColors {
|
|
14
|
+
|
|
15
|
+
//public static colorexists: boolean = (typeof Color === 'function');
|
|
16
|
+
/// <summary>
|
|
17
|
+
/// Friendly Unit Fill Color.
|
|
18
|
+
/// </summary>
|
|
19
|
+
public static FriendlyUnitFillColor: Color = new Color(128, 224, 255);
|
|
20
|
+
/// <summary>
|
|
21
|
+
/// Hostile Unit Fill Color.
|
|
22
|
+
/// </summary>
|
|
23
|
+
public static HostileUnitFillColor: Color = new Color(255, 128, 128);//new Color(255,130,132);//Color.RED;
|
|
24
|
+
/// <summary>
|
|
25
|
+
/// Neutral Unit Fill Color.
|
|
26
|
+
/// </summary>
|
|
27
|
+
public static NeutralUnitFillColor: Color = new Color(170, 255, 170);//new Color(144,238,144);//Color.GREEN;//new Color(0,255,0);//new Color(144,238,144);//light green//Color.GREEN;new Color(0,226,0);
|
|
28
|
+
/// <summary>
|
|
29
|
+
/// Unknown Unit Fill Color.
|
|
30
|
+
/// </summary>
|
|
31
|
+
public static UnknownUnitFillColor: Color = new Color(255, 255, 128);// new Color(255,255,128);//Color.YELLOW;
|
|
32
|
+
|
|
33
|
+
public static SuspectUnitFillColor: Color = new Color(255, 229, 153);
|
|
34
|
+
|
|
35
|
+
/// <summary>
|
|
36
|
+
/// Friendly Graphic Fill Color.
|
|
37
|
+
/// </summary>
|
|
38
|
+
public static FriendlyGraphicFillColor: Color = new Color(128, 224, 255);//Crystal Blue //Color.CYAN;
|
|
39
|
+
/// <summary>
|
|
40
|
+
/// Hostile Graphic Fill Color.
|
|
41
|
+
/// </summary>
|
|
42
|
+
public static HostileGraphicFillColor: Color = new Color(255, 128, 128);//salmon
|
|
43
|
+
/// <summary>
|
|
44
|
+
/// Neutral Graphic Fill Color.
|
|
45
|
+
/// </summary>
|
|
46
|
+
public static NeutralGraphicFillColor: Color = new Color(170, 255, 170);//Bamboo Green //new Color(144,238,144);//light green
|
|
47
|
+
/// <summary>
|
|
48
|
+
/// Unknown Graphic Fill Color.
|
|
49
|
+
/// </summary>
|
|
50
|
+
public static UnknownGraphicFillColor: Color = new Color(255, 255, 128);//light yellow new Color(255,255,224);//light yellow
|
|
51
|
+
|
|
52
|
+
public static SuspectGraphicFillColor: Color = new Color(255, 229, 153);
|
|
53
|
+
|
|
54
|
+
/// <summary>
|
|
55
|
+
/// Friendly Unit Line Color.
|
|
56
|
+
/// </summary>
|
|
57
|
+
public static FriendlyUnitLineColor: Color = Color.BLACK;
|
|
58
|
+
/// <summary>
|
|
59
|
+
/// Hostile Unit Line Color.
|
|
60
|
+
/// </summary>
|
|
61
|
+
public static HostileUnitLineColor: Color = Color.BLACK;
|
|
62
|
+
/// <summary>
|
|
63
|
+
/// Neutral Unit Line Color.
|
|
64
|
+
/// </summary>
|
|
65
|
+
public static NeutralUnitLineColor: Color = Color.BLACK;
|
|
66
|
+
/// <summary>
|
|
67
|
+
/// Unknown Unit Line Color.
|
|
68
|
+
/// </summary>
|
|
69
|
+
public static UnknownUnitLineColor: Color = Color.BLACK;
|
|
70
|
+
|
|
71
|
+
public static SuspectUnitLineColor: Color = Color.BLACK;
|
|
72
|
+
|
|
73
|
+
/// <summary>
|
|
74
|
+
/// Friendly Graphic Line Color.
|
|
75
|
+
/// </summary>
|
|
76
|
+
public static FriendlyGraphicLineColor: Color = Color.BLACK;
|
|
77
|
+
/// <summary>
|
|
78
|
+
/// Hostile Graphic Line Color.
|
|
79
|
+
/// </summary>
|
|
80
|
+
public static HostileGraphicLineColor: Color = Color.RED;
|
|
81
|
+
/// <summary>
|
|
82
|
+
/// Neutral Graphic Line Color.
|
|
83
|
+
/// </summary>
|
|
84
|
+
public static NeutralGraphicLineColor: Color = Color.GREEN;
|
|
85
|
+
/// <summary>
|
|
86
|
+
/// Unknown Graphic Line Color.
|
|
87
|
+
/// </summary>
|
|
88
|
+
public static UnknownGraphicLineColor: Color = Color.YELLOW;
|
|
89
|
+
|
|
90
|
+
public static SuspectGraphicLineColor: Color = new Color(255, 188, 1);
|
|
91
|
+
|
|
92
|
+
public static ObstacleGreenDark: Color = new Color(0,166,81);
|
|
93
|
+
public static ObstacleGreen: Color = new Color(0,255,0);
|
|
94
|
+
|
|
95
|
+
public static WeatherRed: Color = new Color(198, 16, 33);//0xC61021;// 198,16,33
|
|
96
|
+
public static WeatherBlue: Color = new Color(0, 0, 255);//0x0000FF;// 0,0,255
|
|
97
|
+
|
|
98
|
+
public static WeatherPurpleDark: Color = new Color(128, 0, 128);//0x800080;// 128,0,128 Plum Red
|
|
99
|
+
public static WeatherPurpleLight: Color = new Color(226, 159, 255);//0xE29FFF;// 226,159,255 Light Orchid
|
|
100
|
+
|
|
101
|
+
public static WeatherBrownDark: Color = new Color(128, 98, 16);//0x806210;// 128,98,16 Safari
|
|
102
|
+
public static WeatherBrownLight: Color = new Color(210, 176, 106);//0xD2B06A;// 210,176,106 Khaki
|
|
103
|
+
|
|
104
|
+
}
|