("#txtPlotNo")!;
+const plotInformation = document.createElement("div") as HTMLDivElement;
+document.body.appendChild(plotInformation);
+
+const setPlotInformation = (plotDetail: PlotDetail | null | undefined = null) => {
+ if (plotDetail) {
+ plotInformation.innerHTML = "Plot Number: " + plotDetail.plotno + "
Area: " + (plotDetail.plotArea/1000).toFixed(3) + " acres
";
+ } else {
+ plotInformation.innerHTML = "Plot Number:
Area: 0.000 acres
";
+ }
+};
+setPlotInformation();
+
+let plotDetailContent = "";
+let plotLabelContent = "";
+
+downloadSVGButton.addEventListener("click", e => {
+ e.preventDefault();
+ const element = document.createElement("a");
+ element.setAttribute(
+ "href",
+ "data:text/plain;charset=utf-8," + encodeURIComponent(plotDetailContent + plotLabelContent)
+ );
+ element.setAttribute("download", "map.svg");
+ element.style.display = "none";
+ document.body.appendChild(element);
+ element.click();
+ document.body.removeChild(element);
+});
+
+const downloadPDF = (labelPoints: boolean = true) => {
+ generateWebPage(
+ getDownloadMapPDFPageContent({
+ mapContent: plotDetailContent + (labelPoints ? plotLabelContent : "")
+ }),
+ "map"
+ );
+};
+
+downloadPDFButton.addEventListener("click", e => {
+ e.preventDefault();
+ downloadPDF();
+});
+
+downloadPDFWithOutLabelButton.addEventListener("click", e => {
+ e.preventDefault();
+ downloadPDF(false);
+});
+
+(async () => {
+ const searchParams = new URLSearchParams(window.location.search);
+ const response1 = await fetch(
+ "/BanglarBhumi/sheetMap_populateLayerData?lstSheetNo=" + searchParams.get("lstSheetNo"),
+ {
+ method: "POST"
+ });
+ const plotDetailList: PlotDetail[] = (await response1.json()).features;
+ const response2 = await fetch(
+ "/BanglarBhumi/sheetMap_populateCentroidData?lstSheetNo=" + searchParams.get("lstSheetNo"),
+ {
+ method: "POST"
+ });
+ const plotLabelList: PlotLabel[] = (await response2.json()).features;
+ let plotDetails: { [key: string]: PlotDetail } = {};
+
+ for (const plotDetail of plotDetailList) {
+ const plotPolygonPoints = plotDetail.polygon.split("(((")[1].split(")))")[0];
+ plotDetailContent += getMapSVGPathElementContent({
+ polygonData: plotPolygonPoints
+ });
+ }
+
+ for (const plotLabel of plotLabelList) {
+ const plotLabelPoint = plotLabel.point.split("(")[1].split(")")[0].split(" ");
+ plotLabelContent += getMapPlotLabelElementContent({
+ plotLabelX: plotLabelPoint[0],
+ plotLabelY: plotLabelPoint[1],
+ plotNumber: plotLabel.plotno
+ });
+ }
+
+ document.querySelector("#btnSearch")!.addEventListener("click", () => {
+ let plotDetail;
+ for (const p of plotDetailList) {
+ if (p.plotno === plotNumberInput.value) {
+ plotDetail = p;
+ break;
+ }
+ }
+ setPlotInformation(plotDetail);
+ });
+
+ await new Promise((resolve, reject) => {
+ const plotElementIdsControl = setInterval(() => {
+ let i = 0;
+ let plotElements = document.querySelector("#OpenLayers_Layer_Vector_25_vroot")?.children || [];
+ if (plotElements.length) {
+ clearInterval(plotElementIdsControl);
+ for (let i = 0; i < plotElements.length; i++) {
+ plotDetails[plotElements[i].id] = plotDetailList[i];
+ }
+ resolve();
+ }
+ }, 300);
+ });
+
+ setInterval(() => {
+ for (const plotElementId in plotDetails) {
+ const e = document.getElementById(plotElementId);
+ if (e) {
+ e.removeEventListener("click", handlePlotClick);
+ e.addEventListener("click", handlePlotClick);
+ }
+ }
+ }, 300);
+
+ const handlePlotClick = (e: MouseEvent) => {
+ document.querySelectorAll("path").forEach(e => {
+ e.setAttribute("fill", "#ffcc66");
+ });
+
+ const target = e.target as SVGPathElement;
+
+ target.setAttribute("fill", "#8aeeef");
+ setPlotInformation(plotDetails[target.id]);
+ };
+})();
diff --git a/src/scripts/functionality/sheet-map/map-svg-path-element.html b/src/scripts/functionality/sheet-map/map-svg-path-element.html
new file mode 100644
index 0000000..673707e
--- /dev/null
+++ b/src/scripts/functionality/sheet-map/map-svg-path-element.html
@@ -0,0 +1,11 @@
+
+
diff --git a/src/scripts/functionality/sheet-map/map-svg-plot-label-element.html b/src/scripts/functionality/sheet-map/map-svg-plot-label-element.html
new file mode 100644
index 0000000..b4eefec
--- /dev/null
+++ b/src/scripts/functionality/sheet-map/map-svg-plot-label-element.html
@@ -0,0 +1,3 @@
+
+ $plotNumber$
+
--
cgit v1.2.3