@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,64 +0,0 @@
|
|
|
1
|
-
import { Rectangle } from "./rectangle";
|
|
2
|
-
import { ShapeTypes } from "./types";
|
|
3
|
-
|
|
4
|
-
export class Arc
|
|
5
|
-
{
|
|
6
|
-
|
|
7
|
-
private x:number;
|
|
8
|
-
private y:number;
|
|
9
|
-
private r:number;
|
|
10
|
-
private sa:number;
|
|
11
|
-
private ea:number;
|
|
12
|
-
private rectangle:Rectangle;
|
|
13
|
-
|
|
14
|
-
constructor(x:number,y:number,r:number,sa:number,ea:number)
|
|
15
|
-
{
|
|
16
|
-
|
|
17
|
-
this.x = x,
|
|
18
|
-
this.y = y,
|
|
19
|
-
this.r = r,
|
|
20
|
-
this.sa = sa * (Math.PI / 180),
|
|
21
|
-
this.ea = ea * (Math.PI / 180);
|
|
22
|
-
//not accurate, covers the whole circle, not just the arc.
|
|
23
|
-
this.rectangle = new Rectangle(x-r,y-r,r*2,r*2);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
getShapeType():string
|
|
27
|
-
{
|
|
28
|
-
return ShapeTypes.ARC;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
getBounds():Rectangle
|
|
32
|
-
{
|
|
33
|
-
return new Rectangle(this.rectangle.getX(),
|
|
34
|
-
this.rectangle.getY(),
|
|
35
|
-
this.rectangle.getWidth(),
|
|
36
|
-
this.rectangle.getHeight());
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
shift(x:number,y:number){
|
|
41
|
-
this.x +=x;
|
|
42
|
-
this.y +=y;
|
|
43
|
-
this.rectangle.shift(x,y);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
setPath(context:CanvasRenderingContext2D){
|
|
47
|
-
|
|
48
|
-
//context.beginPath();
|
|
49
|
-
context.arc(this.x,this.y,this.r,this.sa,this.ea,false);//counter-clockwise=false
|
|
50
|
-
|
|
51
|
-
};
|
|
52
|
-
stroke(context:CanvasRenderingContext2D){
|
|
53
|
-
context.beginPath();
|
|
54
|
-
this.setPath(context);
|
|
55
|
-
context.stroke();
|
|
56
|
-
};
|
|
57
|
-
fill(context:CanvasRenderingContext2D){
|
|
58
|
-
context.beginPath();
|
|
59
|
-
this.setPath(context);
|
|
60
|
-
context.fill();
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { Point } from "./point";
|
|
2
|
-
import { Rectangle } from "./rectangle";
|
|
3
|
-
|
|
4
|
-
export class BCurve
|
|
5
|
-
{
|
|
6
|
-
|
|
7
|
-
private x1 = 0;
|
|
8
|
-
private y1 = 0;
|
|
9
|
-
private x2 = 0;
|
|
10
|
-
private y2 = 0;
|
|
11
|
-
private x3 = 0;
|
|
12
|
-
private y3 = 0;
|
|
13
|
-
private x4 = 0;
|
|
14
|
-
private y4 = 0;
|
|
15
|
-
private rectangle:Rectangle;
|
|
16
|
-
|
|
17
|
-
constructor(x1,y1,x2,y2,x3,y3,x4,y4)
|
|
18
|
-
{
|
|
19
|
-
|
|
20
|
-
//will be larger than the actual curve.
|
|
21
|
-
this.rectangle = new Rectangle(x1,y1,1,1);
|
|
22
|
-
this.rectangle.unionPoint(new Point(x2,y2));
|
|
23
|
-
this.rectangle.unionPoint(new Point(x3,y3));
|
|
24
|
-
this.rectangle.unionPoint(new Point(x4,y4));
|
|
25
|
-
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
getShapeType():string
|
|
29
|
-
{
|
|
30
|
-
return "BCURVE";//armyc2.c2sd.renderer.so.ShapeTypes.BCURVE;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
getBounds():Rectangle{
|
|
34
|
-
return new Rectangle(this.rectangle.getX()-1,
|
|
35
|
-
this.rectangle.getY()-1,
|
|
36
|
-
this.rectangle.getWidth()+2,
|
|
37
|
-
this.rectangle.getHeight()+2);
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
shift(x:number,y:number){
|
|
41
|
-
this.x1 += x;
|
|
42
|
-
this.y1 += y;
|
|
43
|
-
this.x2 += x;
|
|
44
|
-
this.y2 += y;
|
|
45
|
-
this.x3 += x;
|
|
46
|
-
this.y3 += y;
|
|
47
|
-
this.x4 += x;
|
|
48
|
-
this.y4 += y;
|
|
49
|
-
this.rectangle.shift(x,y);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
setPath(context:CanvasRenderingContext2D){
|
|
53
|
-
|
|
54
|
-
//context.beginPath();
|
|
55
|
-
context.moveTo(this.x1,this.y1);
|
|
56
|
-
context.bezierCurveTo(this.x2,this.y2,this.x3,this.y3,this.x4,this.y4);//counter-clockwise=false
|
|
57
|
-
|
|
58
|
-
};
|
|
59
|
-
stroke(context:CanvasRenderingContext2D){
|
|
60
|
-
context.beginPath();
|
|
61
|
-
this.setPath(context);
|
|
62
|
-
context.stroke();
|
|
63
|
-
};
|
|
64
|
-
fill(context:CanvasRenderingContext2D){
|
|
65
|
-
context.beginPath();
|
|
66
|
-
this.setPath(context);
|
|
67
|
-
context.fill();
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
toSVGElement(stroke:string | null, strokeWidth:number, fill:string | null):string
|
|
71
|
-
{
|
|
72
|
-
// Q400,50 600,300
|
|
73
|
-
let path = '<path d="M' + this.x1 + ' ' + this.y1;
|
|
74
|
-
path += "C" + this.x2 + " " + this.y2 + " " + this.x3 + " " + this.y3 + " " + this.x4 + " " + this.y4 + '"';
|
|
75
|
-
|
|
76
|
-
if(stroke)
|
|
77
|
-
path += ' stroke="' + stroke + '"';
|
|
78
|
-
|
|
79
|
-
if(strokeWidth)
|
|
80
|
-
path += ' stroke-width="' + (strokeWidth) + '"';
|
|
81
|
-
else if(stroke)
|
|
82
|
-
path += ' stroke-width="2"';
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if(fill)
|
|
86
|
-
path += ' fill="' + fill + '"';
|
|
87
|
-
else
|
|
88
|
-
path += ' fill="none"';
|
|
89
|
-
|
|
90
|
-
path += '/>';
|
|
91
|
-
return path;
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { Rectangle } from "./rectangle";
|
|
2
|
-
import { ShapeTypes } from "./types";
|
|
3
|
-
|
|
4
|
-
export class Ellipse
|
|
5
|
-
{
|
|
6
|
-
private rectangle:Rectangle
|
|
7
|
-
|
|
8
|
-
constructor(x:number,y:number,w:number,h:number)
|
|
9
|
-
{
|
|
10
|
-
this.rectangle = new Rectangle(x,y,w,h);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
getShapeType():string
|
|
14
|
-
{
|
|
15
|
-
return ShapeTypes.ELLIPSE;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
getBounds():Rectangle
|
|
19
|
-
{
|
|
20
|
-
return new Rectangle(this.rectangle.getX()-1,
|
|
21
|
-
this.rectangle.getY()-1,
|
|
22
|
-
this.rectangle.getWidth()+2,
|
|
23
|
-
this.rectangle.getHeight()+2);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
shift(x:number,y:number){
|
|
27
|
-
this.rectangle.shift(x,y);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
setPath(context:CanvasRenderingContext2D){
|
|
31
|
-
var x = this.rectangle.getX(),
|
|
32
|
-
y = this.rectangle.getY(),
|
|
33
|
-
w = this.rectangle.getWidth(),
|
|
34
|
-
h = this.rectangle.getHeight();
|
|
35
|
-
|
|
36
|
-
var kappa = 0.5522848,
|
|
37
|
-
ox = (w/2)*kappa,//control point offset horizontal
|
|
38
|
-
oy = (h/2)*kappa,//control point offset vertical
|
|
39
|
-
xe = x + w, //x-end
|
|
40
|
-
ye = y + h, //y-end
|
|
41
|
-
xm = x + w / 2, //x-middle
|
|
42
|
-
ym = y + h / 2; //y-middle
|
|
43
|
-
|
|
44
|
-
//context.beginPath();
|
|
45
|
-
context.moveTo(x,ym);
|
|
46
|
-
context.bezierCurveTo(x,ym-oy,xm-ox,y,xm,y);
|
|
47
|
-
context.bezierCurveTo(xm + ox,y,xe,ym - oy,xe,ym);
|
|
48
|
-
context.bezierCurveTo(xe,ym+oy,xm+ox,ye,xm,ye);
|
|
49
|
-
context.bezierCurveTo(xm-ox,ye,x,ym+oy,x,ym);
|
|
50
|
-
context.closePath();
|
|
51
|
-
}
|
|
52
|
-
stroke(context:CanvasRenderingContext2D):void
|
|
53
|
-
{
|
|
54
|
-
context.beginPath();
|
|
55
|
-
this.setPath(context);
|
|
56
|
-
context.stroke();
|
|
57
|
-
}
|
|
58
|
-
fill(context:CanvasRenderingContext2D):void
|
|
59
|
-
{
|
|
60
|
-
context.beginPath();
|
|
61
|
-
this.setPath(context);
|
|
62
|
-
context.fill();
|
|
63
|
-
}
|
|
64
|
-
toSVGElement(stroke:string | null, strokeWidth:number, fill:string | null):string
|
|
65
|
-
{
|
|
66
|
-
var cx = this.rectangle.getCenterX();
|
|
67
|
-
var cy = this.rectangle.getCenterY();
|
|
68
|
-
var rx = this.rectangle.getWidth()/2;
|
|
69
|
-
var ry = this.rectangle.getHeight()/2;
|
|
70
|
-
var line = '<ellipse cx="' + cx + '" cy="' + cy;
|
|
71
|
-
line += '" rx="' + rx + '" ry="' + ry + '"';
|
|
72
|
-
|
|
73
|
-
if(strokeWidth)
|
|
74
|
-
line += ' stroke-width="' + strokeWidth + '"';
|
|
75
|
-
else if(stroke)
|
|
76
|
-
line += ' stroke-width="2"';
|
|
77
|
-
|
|
78
|
-
if(stroke)
|
|
79
|
-
line += ' stroke="' + stroke + '"';
|
|
80
|
-
|
|
81
|
-
if(fill)
|
|
82
|
-
line += ' fill="' + fill + '"';
|
|
83
|
-
else
|
|
84
|
-
line += ' fill="none"';
|
|
85
|
-
|
|
86
|
-
line += '/>';
|
|
87
|
-
return line;
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { Point } from "./point";
|
|
2
|
-
import { ShapeTypes } from "./types";
|
|
3
|
-
import { Rectangle } from "./rectangle";
|
|
4
|
-
import { ShapeUtilties } from "./utilities";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export class Line
|
|
8
|
-
{
|
|
9
|
-
private pt1:Point;
|
|
10
|
-
private pt2:Point;
|
|
11
|
-
private rectangle:Rectangle
|
|
12
|
-
|
|
13
|
-
constructor(x1:number,y1:number,x2:number,y2:number) {
|
|
14
|
-
|
|
15
|
-
this.pt1 = new Point(x1,y1);
|
|
16
|
-
this.pt2 = new Point(x2,y2);
|
|
17
|
-
|
|
18
|
-
this.rectangle = new Rectangle(x1,y1,1,1);
|
|
19
|
-
this.rectangle.unionPoint(new Point(x2,y2));
|
|
20
|
-
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
// <editor-fold defaultstate="collapsed" desc="Public Functions">
|
|
24
|
-
getShapeType(){
|
|
25
|
-
return ShapeTypes.LINE;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
getBounds(){
|
|
29
|
-
return new Rectangle(this.rectangle.getX(),
|
|
30
|
-
this.rectangle.getY(),
|
|
31
|
-
this.rectangle.getWidth(),
|
|
32
|
-
this.rectangle.getHeight());
|
|
33
|
-
};
|
|
34
|
-
getP1()
|
|
35
|
-
{
|
|
36
|
-
return this.pt1;
|
|
37
|
-
};
|
|
38
|
-
getP2()
|
|
39
|
-
{
|
|
40
|
-
return this.pt2;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
shift(x:number,y:number){
|
|
44
|
-
|
|
45
|
-
this.rectangle.shift(x,y);
|
|
46
|
-
|
|
47
|
-
this.pt1.shift(x,y);
|
|
48
|
-
this.pt2.shift(x,y);
|
|
49
|
-
|
|
50
|
-
};
|
|
51
|
-
/**
|
|
52
|
-
* Tests if the specified line segment intersects this line segment.
|
|
53
|
-
* @param line the specified <code>Line</code>
|
|
54
|
-
* @return <code>true</code> if this line segment and the specified line
|
|
55
|
-
* segment intersect each other;
|
|
56
|
-
* <code>false</code> otherwise.
|
|
57
|
-
*/
|
|
58
|
-
intersectsLine(line:Line)
|
|
59
|
-
{
|
|
60
|
-
return ShapeUtilties.linesIntersect(
|
|
61
|
-
this.getP1().getX(),this.getP1().getY(),
|
|
62
|
-
this.getP2().getX(),this.getP2().getY(),
|
|
63
|
-
line.getP1().getX(),line.getP1().getY(),
|
|
64
|
-
line.getP2().getX(),line.getP2().getY());
|
|
65
|
-
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
setPath(context:CanvasRenderingContext2D){
|
|
70
|
-
|
|
71
|
-
//context.beginPath();
|
|
72
|
-
context.moveTo(this.pt1.getX(),this.pt1.getY());
|
|
73
|
-
context.lineTo(this.pt2.getX(),this.pt2.getY());
|
|
74
|
-
|
|
75
|
-
};
|
|
76
|
-
stroke(context:CanvasRenderingContext2D){
|
|
77
|
-
context.beginPath();
|
|
78
|
-
context.moveTo(this.pt1.getX(),this.pt1.getY());
|
|
79
|
-
context.lineTo(this.pt2.getX(),this.pt2.getY());
|
|
80
|
-
context.stroke();
|
|
81
|
-
};
|
|
82
|
-
fill(context:CanvasRenderingContext2D){
|
|
83
|
-
context.beginPath();
|
|
84
|
-
context.moveTo(this.pt1.getX(),this.pt1.getY());
|
|
85
|
-
context.lineTo(this.pt2.getX(),this.pt2.getY());
|
|
86
|
-
context.fill();
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
toSVGElement(stroke:string | null, strokeWidth:number, fill:string | null):string
|
|
90
|
-
{
|
|
91
|
-
var line = '<line x1="' + this.pt1.getX() + '" y1="' + this.pt1.getY();
|
|
92
|
-
line += '" x2="' + this.pt2.getX() + '" y2="' + this.pt2.getY() + '"';
|
|
93
|
-
|
|
94
|
-
if(strokeWidth)
|
|
95
|
-
line += ' stroke-width="' + strokeWidth + '"';
|
|
96
|
-
else if(stroke)
|
|
97
|
-
line += ' stroke-width="2"';
|
|
98
|
-
|
|
99
|
-
if(stroke)
|
|
100
|
-
line += ' stroke="' + stroke + '"';
|
|
101
|
-
|
|
102
|
-
if(fill)
|
|
103
|
-
line += ' fill="' + fill + '"';
|
|
104
|
-
else
|
|
105
|
-
line += ' fill="none"';
|
|
106
|
-
|
|
107
|
-
line += '/>';
|
|
108
|
-
return line;
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|