Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

Commit

Permalink
Merge branch 'release/g3000-v0.3.3' into release/g1000-v0.3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
kaosfere committed Dec 22, 2020
2 parents dc5ef0e + a744b18 commit 4655a0b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
2 changes: 1 addition & 1 deletion PackageDefinitions/workingtitle-g3000-metapackage.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<AssetPackage Name="workingtitle-g3000" Version="0.3.3">
<AssetPackage Name="workingtitle-g3000" Version="0.3.3a">
<ItemSettings>
<ContentType>CUSTOM</ContentType>
<Title>Working Title G3000</Title>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class SvgMap {
this._iterations = 0;
this.configLoaded = false;
this.rotateWithPlane = false;
this.lineCanvasClipping = new Avionics.Intersect();
this.mapElements = [];

this.textManager = new SvgTextManager(this);
Expand All @@ -24,6 +25,7 @@ class SvgMap {
this._angularWidth = 0;
this._angularWidthNorth = 0;
this._angularWidthSouth = 0;
this._frameClipping = new Avionics.Intersect();
this._bottomLeftCoordinates = new LatLongAlt();
this._topRightCoordinates = new LatLongAlt();
this.index = SvgMap.Index;
Expand Down Expand Up @@ -55,6 +57,7 @@ class SvgMap {
this._svgHtmlElement = _root.querySelector("#" + elementId);
}
this.svgHtmlElement.setAttribute("viewBox", "0 0 1000 1000");
this._frameClipping.initRect(1000, 1000);

this.cityLayer = document.createElementNS(Avionics.SVG.NS, "svg");
this.svgHtmlElement.appendChild(this.cityLayer);
Expand Down Expand Up @@ -113,6 +116,17 @@ class SvgMap {
return this._svgHtmlElement;
}

get lineCanvas() {
return this._lineCanvas;
}

set lineCanvas(_canvas) {
this._lineCanvas = _canvas;
if (_canvas) {
this.lineCanvasClipping.initRect(_canvas.width, _canvas.height);
}
}

get lastCenterCoordinates() {
if (this._previousCenterCoordinates.length <= 0)
return null;
Expand Down Expand Up @@ -416,8 +430,11 @@ class SvgMap {
}
this.svgHtmlElement.style.top = top;
this.svgHtmlElement.style.left = left;
this.lineCanvas.width = w;
this.lineCanvas.height = h;
if (this.lineCanvas) {
this.lineCanvas.width = w;
this.lineCanvas.height = h;
this.lineCanvasClipping.initRect(w, h);
}
}

NMToPixels(distanceInNM) {
Expand Down Expand Up @@ -466,23 +483,8 @@ class SvgMap {
ll.long <= this._topRightCoordinates.long + dLong);
}

isSegmentInFrame(s1, s2) {
if (isNaN(s1.x) || isNaN(s1.y) || isNaN(s2.x) || isNaN(s2.y)) {
return false;
}
if (Math.min(s1.x, s2.x) > 1000) {
return false;
}
if (Math.max(s1.x, s2.x) < 0) {
return false;
}
if (Math.min(s1.y, s2.y) > 1000) {
return false;
}
if (Math.max(s1.y, s2.y) < 0) {
return false;
}
return true;
segmentVsFrame(s1, s2, out1, out2) {
return this._frameClipping.segmentVsRect(s1, s2, out1, out2);
}

coordinatesToXY(coordinates) {
Expand Down

0 comments on commit 4655a0b

Please sign in to comment.