- Copied complete Lts/Tools directory from qt5-before to qt6-after - Updated 32 CMakeLists.txt files (Qt5:: → Qt6::) - Tools subdirectory already included in parent Lts/CMakeLists.txt - All 72 tool submodules now present in qt6-migrated-legatus - Includes: Adler, ArAssets, ConfigX, DBAdministration, DBUpdate, DdsView, InfrastructureManagement, and 67 more tools - C++17 standard (RTI 7.7.0 compatibility maintained) - Tests deferred until final validation phase Migration progress: ✅ Lts/Application (68 files) ✅ Lts/DDS (verified Qt6-ready) ✅ Lts/Plugins (60 submodules, verified) ✅ Lts/Projects (5 submodules, verified) ✅ Lts/Proxies (13 submodules, verified) ✅ Lts/Services (47 submodules, verified) ✅ Lts/Tools (72 submodules, copied + CMake updated) ✅ Lts/Viewer (LtsFileDialog, LtsReportDisplay, SituationMap) 🟡 TetraIF (partial) 🟡 Z (partial: nglwidgets, QtSingleApplication, qsql_informix, WMS_Interface)
175 lines
4.7 KiB
TypeScript
Executable File
175 lines
4.7 KiB
TypeScript
Executable File
import L from "leaflet";
|
|
import Building from "./Building";
|
|
import { Helpers, _, MOBILE } from "./Helpers";
|
|
import { Functions } from "./Functions";
|
|
import { DEBUG } from "./main";
|
|
|
|
export default class MountingPoint extends L.Marker {
|
|
public Name: string = "";
|
|
public Id: number = -1;
|
|
public SupportedAssets: number[] = [];
|
|
public Level: number = -1;
|
|
public MountedAsset: number = -1;
|
|
|
|
private constructor() {
|
|
super(new L.LatLng(0, 0));
|
|
throw new Error("Use static method MountingPoint.Create() instead.");
|
|
// Don't use this.
|
|
// This is just here so you can't use the constructor from
|
|
// outside the class
|
|
}
|
|
|
|
/**
|
|
* MountingPoint factory method
|
|
*/
|
|
public static async Create(
|
|
Raw: {
|
|
id: number;
|
|
designation: string;
|
|
tag: string;
|
|
objectId: number;
|
|
levelId: number;
|
|
roomId: number;
|
|
assetId: number;
|
|
position3d: {
|
|
x: number;
|
|
y: number;
|
|
z: number;
|
|
};
|
|
supportedAssetTypeIds: number[];
|
|
},
|
|
Building: Building
|
|
): Promise<MountingPoint> {
|
|
return new Promise<MountingPoint>(async resolve => {
|
|
// Wrong building?
|
|
if (Building.Id != Raw.objectId) throw new Error("Wrong building");
|
|
|
|
let rotatedRelativePosition = Helpers.Calculations.RotatePoint(
|
|
{
|
|
x: Raw.position3d.x,
|
|
y: Raw.position3d.y
|
|
},
|
|
Helpers.Calculations.DegToRad(Building.RotationDegree)
|
|
); // Rotate mp position around building rotation degree
|
|
|
|
let temp = Object.create(Building.RefPoint);
|
|
temp.Easting += rotatedRelativePosition.x;
|
|
temp.Northing += rotatedRelativePosition.y;
|
|
let position = temp.ToLatLon();
|
|
// Add building ref point to mp relative position
|
|
|
|
let mounted = Raw.assetId != -1;
|
|
|
|
let mp = new L.Marker(new L.LatLng(position.Lat, position.Lon), {
|
|
icon: new L.Icon({
|
|
iconUrl: mounted
|
|
? "img/marker_mounted.png"
|
|
: "img/marker_default.png",
|
|
iconSize: [30, 30]
|
|
})
|
|
}) as MountingPoint; // Setup Leaflet marker
|
|
|
|
mp.Name = _(Raw.tag) ? Raw.designation : Raw.tag;
|
|
mp.SupportedAssets = Raw.supportedAssetTypeIds || [];
|
|
mp.Id = Raw.id;
|
|
mp.Level = Raw.levelId;
|
|
mp.MountedAsset = Raw.assetId;
|
|
|
|
let popup = document.createElement("div") as HTMLDivElement;
|
|
|
|
// <h1>
|
|
let header = document.createElement("h2") as HTMLHeadingElement;
|
|
header.innerText = mp.Name;
|
|
|
|
// <table>
|
|
let table = document.createElement("table") as HTMLTableElement;
|
|
|
|
table.insertRow().insertCell().innerText = "ID";
|
|
table.rows[0].insertCell().innerText = mp.Id.toString();
|
|
|
|
table.insertRow().insertCell().innerText = "Object ID";
|
|
table.rows[1].insertCell().innerText = Raw.objectId.toString();
|
|
|
|
table.insertRow().insertCell().innerText = "Supported asset IDs";
|
|
table.rows[2].insertCell().innerText = mp.SupportedAssets.toString();
|
|
|
|
// <tr>
|
|
let asset = document.createElement("tr") as HTMLTableRowElement;
|
|
try {
|
|
let link = document.createElement("a") as HTMLAnchorElement;
|
|
link.innerText = "Mounted asset ID";
|
|
link.setAttribute(
|
|
"href",
|
|
await Functions.GetMountedAssetIp(mp.MountedAsset)
|
|
);
|
|
link.setAttribute("target", MOBILE ? "_parent" : "_blank");
|
|
asset.insertCell().appendChild(link);
|
|
} catch {
|
|
asset.insertCell().innerText = "Mounted asset ID";
|
|
}
|
|
asset.insertCell().innerText = mp.MountedAsset.toString();
|
|
if (mounted) table.appendChild(asset);
|
|
|
|
// <button>
|
|
let button = document.createElement("button") as HTMLButtonElement;
|
|
button.innerText = MOBILE ? "Show in AR" : "Raw info";
|
|
button.onclick = MOBILE
|
|
? () => window.AR.StartAr(mp.Id)
|
|
: () =>
|
|
window.MP.MoreInfo(
|
|
escape(JSON.stringify(Raw, null, "\t"))
|
|
);
|
|
|
|
// Build popup
|
|
popup.appendChild(header);
|
|
popup.appendChild(table);
|
|
popup.appendChild(document.createElement("hr") as HTMLHRElement);
|
|
popup.appendChild(button);
|
|
|
|
mp.bindPopup(popup);
|
|
|
|
if (DEBUG) console.log(`new MountingPoint() with ID = ${mp.Id}`);
|
|
|
|
return resolve(mp);
|
|
});
|
|
}
|
|
}
|
|
|
|
function _moreInfo(info: string) {
|
|
let popup = open("", Helpers.GenUuid()) as Window;
|
|
|
|
// <pre>
|
|
let display = popup.document.createElement("pre") as HTMLPreElement;
|
|
display.innerHTML = unescape(info);
|
|
display.style.fontSize = "15";
|
|
|
|
// <button>
|
|
let finish = popup.document.createElement("button") as HTMLButtonElement;
|
|
finish.innerHTML = "Done";
|
|
finish.setAttribute("onclick", "window.close()");
|
|
|
|
// build popup
|
|
popup.document.body.appendChild(popup.document.createElement(
|
|
"hr"
|
|
) as HTMLHRElement);
|
|
popup.document.body.appendChild(display);
|
|
popup.document.body.appendChild(popup.document.createElement(
|
|
"hr"
|
|
) as HTMLHRElement);
|
|
popup.document.body.appendChild(finish);
|
|
}
|
|
|
|
//#region
|
|
declare global {
|
|
interface Window {
|
|
MP: {
|
|
MoreInfo: (info: string) => void;
|
|
};
|
|
}
|
|
}
|
|
|
|
window.MP = window.MP || {
|
|
MoreInfo: _moreInfo
|
|
};
|
|
//#endregion
|