diff --git a/software/cnip/cnip/.gitattributes b/software/cnip/cnip/.gitattributes
new file mode 100644
index 0000000000..1ff0c42304
--- /dev/null
+++ b/software/cnip/cnip/.gitattributes
@@ -0,0 +1,63 @@
+###############################################################################
+# Set default behavior to automatically normalize line endings.
+###############################################################################
+* text=auto
+
+###############################################################################
+# Set default behavior for command prompt diff.
+#
+# This is need for earlier builds of msysgit that does not have it on by
+# default for csharp files.
+# Note: This is only used by command line
+###############################################################################
+#*.cs diff=csharp
+
+###############################################################################
+# Set the merge driver for project and solution files
+#
+# Merging from the command prompt will add diff markers to the files if there
+# are conflicts (Merging from VS is not affected by the settings below, in VS
+# the diff markers are never inserted). Diff markers may cause the following
+# file extensions to fail to load in VS. An alternative would be to treat
+# these files as binary and thus will always conflict and require user
+# intervention with every merge. To do so, just uncomment the entries below
+###############################################################################
+#*.sln merge=binary
+#*.csproj merge=binary
+#*.vbproj merge=binary
+#*.vcxproj merge=binary
+#*.vcproj merge=binary
+#*.dbproj merge=binary
+#*.fsproj merge=binary
+#*.lsproj merge=binary
+#*.wixproj merge=binary
+#*.modelproj merge=binary
+#*.sqlproj merge=binary
+#*.wwaproj merge=binary
+
+###############################################################################
+# behavior for image files
+#
+# image files are treated as binary by default.
+###############################################################################
+#*.jpg binary
+#*.png binary
+#*.gif binary
+
+###############################################################################
+# diff behavior for common document formats
+#
+# Convert binary document formats to text before diffing them. This feature
+# is only available from the command line. Turn it on by uncommenting the
+# entries below.
+###############################################################################
+#*.doc diff=astextplain
+#*.DOC diff=astextplain
+#*.docx diff=astextplain
+#*.DOCX diff=astextplain
+#*.dot diff=astextplain
+#*.DOT diff=astextplain
+#*.pdf diff=astextplain
+#*.PDF diff=astextplain
+#*.rtf diff=astextplain
+#*.RTF diff=astextplain
diff --git a/software/cnip/cnip/.gitignore b/software/cnip/cnip/.gitignore
new file mode 100644
index 0000000000..3c4efe206b
--- /dev/null
+++ b/software/cnip/cnip/.gitignore
@@ -0,0 +1,261 @@
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+
+# User-specific files
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+bld/
+[Bb]in/
+[Oo]bj/
+[Ll]og/
+
+# Visual Studio 2015 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUNIT
+*.VisualState.xml
+TestResult.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# DNX
+project.lock.json
+project.fragment.lock.json
+artifacts/
+
+*_i.c
+*_p.c
+*_i.h
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+*.VC.db
+*.VC.VC.opendb
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# JustCode is a .NET coding add-in
+.JustCode
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# TODO: Comment the next line if you want to checkin your web deploy settings
+# but database connection strings (with potential passwords) will be unencrypted
+#*.pubxml
+*.publishproj
+
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+PublishScripts/
+
+# NuGet Packages
+*.nupkg
+# The packages folder can be ignored because of Package Restore
+**/packages/*
+# except build/, which is used as an MSBuild target.
+!**/packages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/packages/repositories.config
+# NuGet v3's project.json files produces more ignoreable files
+*.nuget.props
+*.nuget.targets
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
+AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.jfm
+*.pfx
+*.publishsettings
+node_modules/
+orleans.codegen.cs
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+
+# SQL Server files
+*.mdf
+*.ldf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+.fake/
+
+# JetBrains Rider
+.idea/
+*.sln.iml
+
+# CodeRush
+.cr/
+
+# Python Tools for Visual Studio (PTVS)
+__pycache__/
+*.pyc
\ No newline at end of file
diff --git a/software/cnip/cnip/Properties/PublishProfiles/CustomProfile.pubxml.user b/software/cnip/cnip/Properties/PublishProfiles/CustomProfile.pubxml.user
deleted file mode 100644
index 30c4148817..0000000000
--- a/software/cnip/cnip/Properties/PublishProfiles/CustomProfile.pubxml.user
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/software/cnip/cnip/Scripts/cnip/webui/dialogs/linkprofile.js b/software/cnip/cnip/Scripts/cnip/webui/dialogs/linkprofile.js
deleted file mode 100644
index 428c52391f..0000000000
--- a/software/cnip/cnip/Scripts/cnip/webui/dialogs/linkprofile.js
+++ /dev/null
@@ -1,369 +0,0 @@
-/* global variables*/
-var userDisplay = false;
-var linkData;
-var siteAData;
-var siteBData;
-var linksCount;
-var currLink;
-var elevChart;
-/* char js global setup */
-Chart.defaults.global.pointHitDetectionRadius = 1;
-Chart.defaults.LineWithLine = Chart.defaults.line;
-Chart.controllers.LineWithLine = Chart.controllers.line.extend({
- draw: function (ease) {
- Chart.controllers.line.prototype.draw.call(this, ease);
- if (this.chart.tooltip._active && this.chart.tooltip._active.length) {
- let activePoint = this.chart.tooltip._active[0],
- ctx = this.chart.ctx,
- x = activePoint.tooltipPosition().x,
- topY = this.chart.legend.bottom,
- bottomY = this.chart.chartArea.bottom;
- ctx.save();
- ctx.beginPath();
- ctx.moveTo(x, topY);
- ctx.lineTo(x, bottomY);
- ctx.lineWidth = 1;
- ctx.strokeStyle = '#07C';
- ctx.stroke();
- ctx.restore();
- }
- }
-});
-var customTooltips = function (tooltip) {
- let tooltipEl = document.getElementById('chartjs-tooltip');
- if (!tooltipEl) {
- tooltipEl = document.createElement('div');
- tooltipEl.id = 'chartjs-tooltip';
- tooltipEl.innerHTML = '
';
- this._chart.canvas.parentNode.appendChild(tooltipEl);
- }
- if (tooltip.opacity === 0) {
- tooltipEl.style.opacity = 0;
- return;
- }
- tooltipEl.classList.remove('above', 'below', 'no-transform');
- if (tooltip.yAlign) {
- tooltipEl.classList.add(tooltip.yAlign);
- } else {
- tooltipEl.classList.add('no-transform');
- }
- function getBody(bodyItem) {
- return bodyItem.lines;
- }
- if (tooltip.body) {
- let titleLines = tooltip.title || [];
- let bodyLines = tooltip.body.map(getBody);
- let tDistance, tElevation, tLosHeight, tFreznelZone;
- titleLines.forEach(function (title) {
- tDistance = round(Number(title), 2);
- });
- bodyLines.forEach(function (body, i) {
- if (body) {
- if (body[0].includes('Elevation')) tElevation = Number(body[0].split(':')[1]);
- if (body[0].includes('LosHeight')) tLosHeight = Number(body[0].split(':')[1]);
- if (body[0].includes('FresnelZone')) tFresnelZone = Number(body[0].split(':')[1]);
- }
- });
- let innerHtml = '';
- innerHtml += ' ';
- innerHtml += ' ';
- if (tDistance !== undefined && tElevation !== undefined && tLosHeight !== undefined && tFresnelZone !== undefined) {
- innerHtml += 'Distance (Km): ' + tDistance.toString() + ' ';
- innerHtml += 'Elevation (m): ' + tElevation.toString() + ' ';
- innerHtml += 'Los Height (m): ' + round(tLosHeight - tElevation, 2).toString() + ' ';
- innerHtml += 'Fresnel Height (m): ' + round(tFresnelZone - tElevation, 2).toString() + ' ';
- }
- innerHtml += ' ';
- let tableRoot = tooltipEl.querySelector('table');
- tableRoot.innerHTML = innerHtml;
- }
- let positionY = this._chart.canvas.offsetTop;
- let positionX = this._chart.canvas.offsetLeft;
- tooltipEl.style.opacity = 1;
- tooltipEl.style.left = positionX + tooltip.caretX + 161 + 'px';
- tooltipEl.style.top = positionY + tooltip.caretY - 50 + 'px';
- tooltipEl.style.fontFamily = tooltip._bodyFontFamily;
- tooltipEl.style.fontSize = tooltip.bodyFontSize + 'px';
- tooltipEl.style.fontStyle = tooltip._bodyFontStyle;
- tooltipEl.style.padding = tooltip.yPadding + 'px ' + tooltip.xPadding + 'px';
-};
-/* linkprofile functions*/
-function fillLinkData(linkData) {
- document.getElementById('linkid').innerHTML = linkData[0].toString();
- document.getElementById('linkname').innerHTML = linkData[1] === undefined ? '' : linkData[1].toString();
- document.getElementById('linktype').innerHTML = linkData[2] === undefined ? '' : linkData[2].toString();
- let linktype = linkData[2] === undefined ? '' : linkData[2].toString();
- if (linktype === 'public') {
- document.getElementById('sitebp').innerHTML = 'Site B (Public)';
- document.getElementById('sitebp').style.width = '100px';
- } else {
- document.getElementById('sitebp').innerHTML = 'Site B';
- document.getElementById('sitebp').style.width = '50px';
- }
- document.getElementById('siteida').value = linkData[3] === undefined ? '' : linkData[3].toString();
- document.getElementById('sitenamea').value = siteAData[1] === undefined ? '' : siteAData[1].toString();
- document.getElementById('deviceheighta').value =
- round(Number(siteAData[4] === undefined ? '' : siteAData[4].toString()), 0).toString() + ' / ' +
- round(Number(linkData[4] === undefined ? '' : linkData[4].toString()), 0).toString();
- document.getElementById('channelwidtha').value = linkData[6] === undefined ? '' : linkData[6].toString();
- document.getElementById('frequencya').value = linkData[7] === undefined ? '' : linkData[7].toString();
- document.getElementById('outputpowera').value = linkData[8] === undefined ? '' : linkData[8].toString();
- document.getElementById('antennagaina').value = linkData[9] === undefined ? '' : linkData[9].toString();
- document.getElementById('lossesa').value = linkData[10] === undefined ? '' : linkData[10].toString();
- document.getElementById('siteidb').value = linkData[11] === undefined ? '' : linkData[11].toString();
- document.getElementById('sitenameb').value = siteBData[1] === undefined ? '' : siteBData[1].toString();
- document.getElementById('deviceheightb').value =
- round(Number(siteBData[4] === undefined ? '' : siteBData[4].toString()), 0).toString() + ' / ' +
- round(Number(linkData[12] === undefined ? '' : linkData[12].toString()), 0).toString();
- document.getElementById('channelwidthb').value = linkData[14] === undefined ? '' : linkData[14].toString();
- document.getElementById('frequencyb').value = linkData[15] === undefined ? '' : linkData[15].toString();
- document.getElementById('outputpowerb').value = linkData[16] === undefined ? '' : linkData[16].toString();
- document.getElementById('antennagainb').value = linkData[17] === undefined ? '' : linkData[17].toString();
- document.getElementById('lossesb').value = linkData[18] === undefined ? '' : linkData[18].toString();
- document.getElementById('distance').innerHTML =
- round(Number(linkData[19] === undefined ? '' : linkData[19].toString()), 1).toString() + ' Km';
- let xDistanceKm = Number(linkData[19] === undefined ? '' : linkData[19].toString());
- let deviceheightAm = Number(siteAData[4] === undefined ? '' : siteAData[4].toString()) +
- Number(linkData[4] === undefined ? '' : linkData[4].toString());
- let deviceheightBm = Number(siteBData[4] === undefined ? '' : siteBData[4].toString()) +
- Number(linkData[12] === undefined ? '' : linkData[12].toString());
- let tiltAd = 0; tiltBd = 0;
- if (deviceheightAm > deviceheightBm) {
- tiltAd = round(turf.radiansToDegrees(Math.atan(deviceheightAm / (xDistanceKm * 1000))), 2);
- tiltBd = round(turf.radiansToDegrees(-1 * Math.atan((deviceheightAm - deviceheightBm) / (xDistanceKm * 1000))), 2);
- }
- else {
- tiltAd = round(turf.radiansToDegrees(-1 * Math.atan((deviceheightBm - deviceheightAm) / (xDistanceKm * 1000))), 2);
- tiltBd = round(turf.radiansToDegrees(Math.atan(deviceheightBm / (xDistanceKm * 1000))), 2);
- }
- document.getElementById('headinga').value =
- round(Number(linkData[5] === undefined ? '' : linkData[5].toString()), 2).toString() + ' / ' + tiltAd;
- document.getElementById('headingb').value =
- round(Number(linkData[13] === undefined ? '' : linkData[13].toString()), 2).toString() + ' / ' + tiltBd;
- let xFrequencyGHz = Number(linkData[7] === undefined ? '' : linkData[7].toString());
- let channelwidthMHz = Number(linkData[6] === undefined ? '' : linkData[6].toString());
- let lossesAdB = Number(linkData[10] === undefined ? '' : linkData[10].toString());
- let lossesBdB = Number(linkData[18] === undefined ? '' : linkData[18].toString());
- let antennagainAdBi = Number(linkData[9] === undefined ? '' : linkData[9].toString());
- let antennagainBdBi = Number(linkData[17] === undefined ? '' : linkData[17].toString());
- let outputpowerAdBm = Number(linkData[8] === undefined ? '' : linkData[8].toString());
- let outputpowerBdBm = Number(linkData[16] === undefined ? '' : linkData[16].toString());
- let outputpowerAdBW = outputpowerAdBm - 30;
- let outputpowerBdBW = outputpowerBdBm - 30;
- let freespacelossdB = (20 * Math.log10(xDistanceKm)) + (20 * Math.log10(xFrequencyGHz * 1000)) + 32.44;
- let erpAdBm = outputpowerAdBm + antennagainAdBi - lossesAdB;
- let erpBdBm = outputpowerBdBm + antennagainBdBi - lossesBdB;
- let erpAdBW = outputpowerAdBW + antennagainAdBi - lossesAdB;
- let erpBdBW = outputpowerBdBW + antennagainBdBi - lossesBdB;
- let rxlevAdBm = erpBdBm - freespacelossdB + antennagainAdBi;
- let rxlevBdBm = erpAdBm - freespacelossdB + antennagainBdBi;
- let rxlevAdBW = erpBdBW - freespacelossdB + antennagainAdBi;
- let rxlevBdBW = erpAdBW - freespacelossdB + antennagainBdBi;
- let johnsonNoisedBm = -174 + (10 * Math.log10(channelwidthMHz * 1000 * 1000));
- let johnsonNoisedBW = johnsonNoisedBm - 30;
- let snrAdB = rxlevAdBW - johnsonNoisedBW;
- let snrBdB = rxlevBdBW - johnsonNoisedBW;
- let snrnumberA = Math.pow(10, snrAdB / 10);
- let snrnumberB = Math.pow(10, snrBdB / 10);
- let datarateAMbps = ((channelwidthMHz * 1000 * 1000) * Math.log2(1 + snrnumberA)) / 1000000;
- let datarateBMbps = ((channelwidthMHz * 1000 * 1000) * Math.log2(1 + snrnumberB)) / 1000000;
- let xElevations = linkData[20] === undefined ? '' : linkData[20].toString().split('@');
- let xDataset = [];
- let minYaxis = 50000;
- let losBreak = false;
- let fzoneBreak = false;
- let f6zoneBreak = false;
- for (let x = 0; x < xElevations.length; x++) {
- let xElevationm = Number(xElevations[x].split('&')[3]);
- let xCdistanceKm = Number(xElevations[x].split('&')[2]);
- if (minYaxis > xElevationm) { minYaxis = xElevationm; }
- let xLoS = ((x * (deviceheightBm - deviceheightAm)) /
- (xElevations.length)) + deviceheightAm;
- let xMaxx = xElevations.length - 1;
- let xFresnelFactor = 17.3 * Math.sqrt((xCdistanceKm *
- (xDistanceKm - xCdistanceKm)) / (xDistanceKm * xFrequencyGHz));
- let xFresnelZone = xLoS - xFresnelFactor;
- let xFZTop = xLoS + xFresnelFactor;
- let xFZ6 = xLoS - (xFresnelFactor * 0.6);
- let xFZ6Top = xLoS + (xFresnelFactor * 0.6);
- if (xLoS - xElevationm < 0) { losBreak = true; }
- if (xFresnelZone - xElevationm < 0) { fzoneBreak = true; }
- if (xFZ6 - xElevationm < 0) { f6zoneBreak = true; }
- xDataset.push({
- Tower: (x === 0 ? deviceheightAm : x === xMaxx ? deviceheightBm : xElevationm),
- TowerBackgroundColor: (x === 0 ? 'rgba(57,204,100,1)' :
- x === xMaxx ? 'rgba(57,204,100,1)' : 'rgba(57,204,100,0)'),
- TowerBorderColor: (x === 0 ? 'rgba(57,204,100,1)' :
- x === xMaxx ? 'rgba(57,204,100,1)' : 'rgba(57,204,100,0)'),
- TowerBorderWidth: (x === 0 ? 6 : x === xMaxx ? 6 : 3),
- TowerBarThickness: (x === 0 ? 6 : x === xMaxx ? 6 : 3),
- Location: [Number(xElevations[x].split('&')[0]), Number(xElevations[x].split('&')[1])],
- Distance: xCdistanceKm,
- Elevation: xElevationm,
- LoS: xLoS,
- FresnelZone: xFresnelZone,
- FZTop: xFZTop,
- FZ6: xFZ6,
- FZ6Top: xFZ6Top
- });
- }
- if (!losBreak) {
- document.getElementById('effca').innerHTML = '';
- document.getElementById('ratea').innerHTML = round(datarateAMbps, 0);
- document.getElementById('leva').innerHTML = round(rxlevAdBm, 0);
- document.getElementById('effcb').innerHTML = '';
- document.getElementById('rateb').innerHTML = round(datarateBMbps, 0);
- document.getElementById('levb').innerHTML = round(rxlevBdBm, 0);
- document.getElementById('connectivityInfo').innerHTML = '';
- }
- else {
- document.getElementById('effca').innerHTML = '';
- document.getElementById('ratea').innerHTML = '';
- document.getElementById('leva').innerHTML = '';
- document.getElementById('effcb').innerHTML = '';
- document.getElementById('rateb').innerHTML = '';
- document.getElementById('levb').innerHTML = '';
- document.getElementById('connectivityInfo').innerHTML = 'Link Obstructed';
- }
- let chartData = {
- labels: xDataset.map(d => d.Distance),
- datasets: [
- {
- type: 'bar',
- label: 'Towers',
- data: xDataset.map(d => d.Tower),
- backgroundColor: xDataset.map(d => d.TowerBackgroundColor),
- borderColor: xDataset.map(d => d.TowerBorderColor),
- borderWidth: xDataset.map(d => d.TowerBorderWidth),
- barThickness: xDataset.map(d => d.TowerBarThickness)
- }, {
- label: 'Location',
- data: xDataset.map(d => d.Location),
- showLine: false
- }, {
- label: 'Elevation',
- data: xDataset.map(d => d.Elevation),
- borderWidth: 0,
- pointRadius: 0
- }, {
- label: 'LosHeight',
- data: xDataset.map(d => d.LoS),
- borderWidth: 2,
- pointRadius: 1,
- borderColor: losBreak ? 'rgba(255, 0, 0, 0.7)' : 'rgba(114,119,122,1)',
- fill: false
- }, {
- label: 'FresnelZone',
- data: xDataset.map(d => d.FresnelZone),
- borderWidth: 1,
- pointRadius: 0,
- fill: false,
- borderColor: fzoneBreak ? 'rgba(255,165,0,1)' : 'rgba(0,255,0,1)'
- }, {
- label: 'FZTop',
- data: xDataset.map(d => d.FZTop),
- borderWidth: 1,
- pointRadius: 0,
- fill: false,
- borderColor: fzoneBreak ? 'rgba(255,165,0,1)' : 'rgba(0,255,0,1)'
- }, {
- label: 'FZ6',
- data: xDataset.map(d => d.FZ6),
- borderWidth: 1,
- pointRadius: 0,
- fill: false,
- borderColor: f6zoneBreak ? 'rgba(255,165,0,1)' : 'rgba(0,255,0,1)',
- borderDash: [7, 7]
- }, {
- label: 'FZ6Top',
- data: xDataset.map(d => d.FZ6Top),
- borderWidth: 1,
- pointRadius: 0,
- fill: false,
- borderColor: f6zoneBreak ? 'rgba(255,165,0,1)' : 'rgba(0,255,0,1)',
- borderDash: [7, 7]
- }]
- };
- let elevChartContext = document.getElementById('chart1').getContext('2d');
- if (elevChart) { elevChart.destroy(); }
- elevChart = new Chart(elevChartContext, {
- type: 'LineWithLine',
- data: chartData,
- options: {
- animation: {
- duration: 0
- },
- responsive: false,
- tooltips: {
- enabled: false,
- mode: 'index',
- intersect: false,
- custom: customTooltips
- },
- hover: {
- mode: 'index',
- intersect: false
- },
- onHover: function (e, elements) {
- if (e) { e.stopPropagation(); }
- if (elements) {
- if (elements.length > 0) {
- if (elements[0]._index) {
- $("#chart1").css("cursor", elements[0] ? "pointer" : "default");
- window.parent.highlightPoint(
- elevChart.data.datasets[1].data[elements[0]._index]);
- }
- }
- }
- },
- legend: {
- display: false
- },
- scales: {
- xAxes: [{
- display: false
- }],
- yAxes: [{
- display: false,
- ticks: {
- min: minYaxis
- }
- }]
- }
- }
- });
-}
-function refreshLinkData(refreshType, Idx = null) {
- let currLinkId = linkData === undefined ? 0 : linkData[0].toString();
- linkData = undefined; linksCount = '0';
- linksCount = window.parent.getLinksCount();
- if (Idx !== null) { currLink = Idx.toString(); } else {
- if (refreshType === 'start') { currLink = '0'; }
- else if (refreshType === 'add') {
- currLink = (Number(linksCount) - 1).toString();
- }
- else if (refreshType === 'cursor') {
- currLink = window.parent.getLinkIdxById(currLinkId).toString();
- }
- else if (refreshType === 'delete') /*delete*/ {
- if (Number(currLink) > Number(linksCount) - 1) {
- currLink = (Number(linksCount) - 1).toString();
- }
- }
- }
- linkData = window.parent.getLinkProfileByIdx(currLink).split('\t');
- let siteida = linkData[3] === undefined ? -1 : linkData[3].toString();
- let siteidb = linkData[11] === undefined ? -1 : linkData[11].toString();
- let linktype = linkData[2] === undefined ? '' : linkData[2].toString();
- let email = linkData[22] === undefined ? '' : linkData[22].toString();
- siteAData = window.parent.getSiteDataById(siteida).split('\t');
- if (linktype === 'public') {
- siteBData = window.parent.getPublicSiteData(siteidb, email).split('\t');
- } else {
- siteBData = window.parent.getSiteDataById(siteidb).split('\t');
- }
- fillLinkData(linkData);
-}
-function refreshLinkDataById(linkid) {
- refreshLinkData('', window.parent.getLinkIdxById(linkid).toString());
-}
\ No newline at end of file
diff --git a/software/cnip/cnip/Scripts/cnip/webui/dialogs/polyoptions.js b/software/cnip/cnip/Scripts/cnip/webui/dialogs/polyoptions.js
deleted file mode 100644
index c97b1fe0f4..0000000000
--- a/software/cnip/cnip/Scripts/cnip/webui/dialogs/polyoptions.js
+++ /dev/null
@@ -1,70 +0,0 @@
-/* global variables*/
-var userDisplay = false;
-var polygonData;
-var polygonsCount;
-var currPolygon;
-/* setup listeners*/
-document.getElementById('defaultOpen').click();
-document.getElementById('polygonname').addEventListener('change', polygonNameChange);
-function polygonNameChange(e) {
- document.getElementById('polygonname').value = fixStringName(document.getElementById('polygonname').value);
- savePolygonData(e);
-}
-/* polyoptions functions*/
-function fillPolygonData(polygonData) {
- document.getElementById('polygonid').value = polygonData[0].toString();
- document.getElementById('polygonname').value = polygonData[1] === undefined ? '' : polygonData[1].toString();
-}
-function refreshPolygonData(refreshType, Idx = null) {
- let currPolygonId = polygonData === undefined ? 0 : polygonData[0].toString();
- polygonData = undefined; polygonsCount = '0';
- polygonsCount = window.parent.getPolygonsCount();
- if (Idx !== null) { currPolygon = Idx.toString(); }
- else {
- if (refreshType === 'start') { currPolygon = '0'; }
- else if (refreshType === 'add') {
- currPolygon = (Number(polygonsCount) - 1).toString();
- }
- else if (refreshType === 'cursor') {
- currPolygon = window.parent.getPolygonIdxById(currPolygonId).toString();
- }
- else if (refreshType === 'delete') /*delete*/ {
- if (Number(currPolygon) > Number(polygonsCount) - 1) {
- currPolygon = (Number(polygonsCount) - 1).toString();
- }
- }
- }
- polygonData = window.parent.getPolygonDataByIdx(currPolygon).split('\t');
- fillPolygonData(polygonData);
-}
-function refreshPolygonDataById(polygonid) {
- refreshPolygonData('', window.parent.getPolygonIdxById(polygonid).toString());
-}
-function nextPolygon(e) {
- if (e) { e.stopPropagation(); }
- if (Number(polygonsCount) - 1 > Number(currPolygon)) {
- refreshPolygonData('', (Number(currPolygon) + 1).toString());
- }
-}
-function previousPolygon(e) {
- if (e) { e.stopPropagation(); }
- if (Number(currPolygon) > 0) {
- refreshPolygonData('', (Number(currPolygon) - 1).toString());
- }
-}
-function savePolygonData(e) {
- if (e) { e.stopPropagation(); }
- let polygonname = document.getElementById('polygonname').value;
- window.parent.updatePolygonDataByIdx(currPolygon, polygonname);
- refreshPolygonData('cursor');
-}
-function deletePolygon(e) {
- if (e) { e.stopPropagation(); }
- window.parent.deletePolygonByIdx(currPolygon);
- refreshPolygonData('delete');
-}
-function zoomToPolygon(e) {
- if (e) { e.stopPropagation(); }
- window.parent.document.getElementById('polyOptions').style.display = 'none';
- window.parent.zoomToPolygonByIdx(currPolygon);
-}
\ No newline at end of file
diff --git a/software/cnip/cnip/Scripts/cnip/webui/ol.vector.extension.js b/software/cnip/cnip/Scripts/cnip/webui/ol.vector.extension.js
deleted file mode 100644
index e693cde15d..0000000000
--- a/software/cnip/cnip/Scripts/cnip/webui/ol.vector.extension.js
+++ /dev/null
@@ -1,83 +0,0 @@
-ol.source.Vector.prototype.clone = function () {
- let JsonFeatures = new ol.format.GeoJSON().writeFeaturesObject(
- this.getFeatures(),
- { featureProjection: 'EPSG:3857', dataProjection: 'EPSG:4326' });
- let source = new ol.source.Vector({
- features: new ol.format.GeoJSON({
- extractStyles: true,
- extractAttributes: true
- }).readFeatures(JsonFeatures),
- wrapX: false
- });
- return source;
-};
-ol.source.Vector.prototype.getJSONString = function (beautify = false) {
- let JSONString;
- if (beautify) {
- JSONString = JSON.stringify(
- new ol.format.GeoJSON().writeFeaturesObject(
- this.getFeatures(),
- { featureProjection: 'EPSG:3857', dataProjection: 'EPSG:4326' }
- ), undefined, '\t'
- );
- } else {
- JSONString = JSON.stringify(
- new ol.format.GeoJSON().writeFeaturesObject(
- this.getFeatures(),
- { featureProjection: 'EPSG:3857', dataProjection: 'EPSG:4326' }
- )
- );
- }
- return JSONString;
-};
-ol.source.Vector.prototype.getKMLString = function (beautify = false) {
- let KMLString;
- if (beautify) {
- KMLString =
- JSON.stringify(
- new ol.format.KML({
- extractStyles: true,
- showPointNames: true,
- writeStyles: true
- }).writeFeatures(
- this.getFeatures(),
- { featureProjection: 'EPSG:3857', dataProjection: 'EPSG:4326' }
- ), undefined, '\t'
- );
- } else {
- KMLString =
- JSON.stringify(
- new ol.format.KML({
- extractStyles: true,
- showPointNames: true,
- writeStyles: true
- }).writeFeatures(
- this.getFeatures(),
- { featureProjection: 'EPSG:3857', dataProjection: 'EPSG:4326' }
- )
- );
- }
- KMLString = KMLString.replace(/\\/g, '');
- KMLString = KMLString.slice(1, -1);
- return KMLString;
-};
-ol.source.Vector.prototype.getFeatureByProperty = function (propertyname, propertyvalue) {
- let matchedfeature = undefined;
- if (propertyname && propertyvalue) {
- let features = this.getFeatures();
- for (let i = 0; i < features.length; i++) {
- if (features[i].get(propertyname).toString() === propertyvalue.toString()) {
- matchedfeature = features[i]; break;
- }
- }
- }
- return matchedfeature;
-};
-ol.source.Vector.prototype.clearFeatures = function () {
- while (this.getFeatures().length > 0) {
- let features = this.getFeatures();
- for (let i = 0; i < features.length; i++) {
- this.removeFeature(features[i]);
- }
- }
-};
\ No newline at end of file
diff --git a/software/cnip/cnip/Scripts/cnip/webui/sidebar/toolbox.js b/software/cnip/cnip/Scripts/cnip/webui/sidebar/toolbox.js
deleted file mode 100644
index 8cba5e1a27..0000000000
--- a/software/cnip/cnip/Scripts/cnip/webui/sidebar/toolbox.js
+++ /dev/null
@@ -1,346 +0,0 @@
-$('#analysisDiv').collapse({
- toggle: true
-});
-$('#predictDiv').collapse({
- toggle: true
-});
-$('#reportDiv').collapse({
- toggle: true
-});
-function analyseBestCan(sites, polygonid) {
- if (getActionRunning()) { return; }
- _saveSettings();
- saveAllVectors();
- minimizeAllDialogs();
- showProgress('Analysing Candidates');
- setTimeout(function () {
- let newid = Ajax_runccmd("GetNewResultId", "");
- Ajax_runccmd("BestCandidate",
- "{" +
- "'resultid':'" + newid + "'," +
- "'sites':'" + sites + "'," +
- "'polygonid':'" + polygonid + "'" +
- "}");
- function processLoop() {
- let chk = getForecastRunning();
- if (chk === false) {
- showResult(Ajax_runccmd("GetResultString",
- "{'resultid':'" + newid + "'}"));
- loadAllVectors(); closeProgress(); toggleSelect();
- } else {
- setTimeout(processLoop, 2000);
- }
- }
- processLoop();
- }, 500);
-}
-function analysePredictSites(polygonid, technology) {
- if (getActionRunning()) { return; }
- _saveSettings();
- saveAllVectors();
- minimizeAllDialogs();
- showProgress('Predicting Sites');
- setTimeout(function () {
- let newid = Ajax_runccmd("GetNewResultId", "");
- Ajax_runccmd("PredictSites",
- "{" +
- "'resultid':'" + newid + "'," +
- "'polygonid':'" + polygonid + "'," +
- "'technology':'" + technology + "'" +
- "}");
- function processLoop() {
- let chk = getForecastRunning();
- if (chk === false) {
- showResult(Ajax_runccmd("GetResultString",
- "{'resultid':'" + newid + "'}"));
- loadAllVectors();
- showNetworkReport(null);
- showLinksReport(null, Ajax_runccmd("GetLinksResult", ""));
- closeProgress(); toggleSelect();
- } else {
- setTimeout(processLoop, 2000);
- }
- }
- processLoop();
- }, 500);
-}
-function predictCoverage(sites) {
- if (getActionRunning()) { return; }
- _saveSettings();
- saveAllVectors();
- minimizeAllDialogs();
- showProgress('Predicting Coverage');
- setTimeout(function () {
- let newid = Ajax_runccmd("GetNewResultId", "");
- Ajax_runccmd("PredictCoverage",
- "{" +
- "'resultid':'" + newid + "'," +
- "'sites':'" + sites + "'" +
- "}");
- function processLoop() {
- let chk = getForecastRunning();
- if (chk === false) {
- showResult(Ajax_runccmd("GetResultString",
- "{'resultid':'" + newid + "'}"));
- loadAllVectors();
- showNetworkReport(null);
- closeProgress(); toggleSelect();
- } else {
- setTimeout(processLoop, 2000);
- }
- }
- processLoop();
- }, 500);
-}
-function predictRadioPlan(sites) {
- if (getActionRunning()) { return; }
- _saveSettings();
- saveAllVectors();
- minimizeAllDialogs();
- showProgress('Predicting Radio Plan');
- setTimeout(function () {
- Ajax_runccmd("RadioPlan",
- "{" +
- "'sites':'" + sites + "'" +
- "}");
- function processLoop() {
- let chk = getForecastRunning();
- if (chk === false) {
- loadAllVectors();
- showNetworkReport(null);
- closeProgress(); toggleSelect();
- } else {
- setTimeout(processLoop, 2000);
- }
- }
- processLoop();
- }, 500);
-}
-function predictLinks(sites) {
- if (getActionRunning()) { return; }
- _saveSettings();
- saveAllVectors();
- minimizeAllDialogs();
- showProgress('Predicting Links');
- setTimeout(function () {
- Ajax_runccmd("Links",
- "{" +
- "'sites':'" + sites + "'" +
- "}");
- function processLoop() {
- let chk = getForecastRunning();
- if (chk === false) {
- loadAllVectors();
- showLinksReport(null, Ajax_runccmd("GetLinksResult", ""));
- closeProgress(); toggleSelect();
- } else {
- setTimeout(processLoop, 2000);
- }
- }
- processLoop();
- }, 500);
-}
-function showNetworkReport(e = null) {
- if (e) { e.stopPropagation(); }
- let header = ['Site Id', 'Site Name', 'Longitude', 'Latitude', 'Tower Height', 'Technology', 'Band', 'Bandwidth',
- 'Cell ID', 'TAC / LAC', 'EARFCN / ARFCN', 'PCI / BSIC', 'DL Frequency', 'UL Frequency', 'RF Power',
- 'Antenna Height', 'Azimuth', 'Antenna Model', 'Antenna Type', 'Polarization', 'V-Beamwidth', 'H-Beamwidth', 'Downtilt', 'Antenna Gain', 'Feeder Loss'];
- let csvString;
- csvString = header.join(',') + '\r\n';
- header = header.map(h => '' + h + ' ');
- header.unshift('');
- header.push(' ');
- let properties = [];
- let features = myNetworkLayer.getSource().getFeatures();
- features.forEach(function (f) {
- properties.push('');
- properties.push('' + f.get('siteid') + ' ');
- properties.push('' + f.get('sitename') + ' ');
- properties.push('' + round(f.get('longitude'), 6).toString() + '°' + ' ');
- properties.push('' + round(f.get('latitude'), 6).toString() + '°' + ' ');
- properties.push('' + round(f.get('height'), 0).toString() + ' m' + ' ');
- properties.push('' + f.get('technology') + ' ');
- properties.push('' + f.get('band') + ' ');
- properties.push('' + f.get('bandwidth') + ' MHz' + ' ');
- properties.push('' + f.get('cellid') + ' ');
- properties.push('' + f.get('lac') + ' ');
- properties.push('' + f.get('rfcn') + ' ');
- properties.push('' + f.get('rfid') + ' ');
- properties.push('' + f.get('dlfrequency') + ' MHz' + ' ');
- properties.push('' + f.get('ulfrequency') + ' MHz' + ' ');
- properties.push('' + f.get('rfpower') + ' W' + ' ');
- properties.push('' + round(f.get('hba'), 0).toString() + ' m' + ' ');
- properties.push('' + f.get('azimuth') + '°' + ' ');
- properties.push('' + f.get('antennamodel') + ' ');
- properties.push('' + f.get('antennatype') + ' ');
- properties.push('' + f.get('polarization') + ' ');
- properties.push('' + f.get('vbeamwidth') + '°' + ' ');
- properties.push('' + f.get('hbeamwidth') + '°' + ' ');
- properties.push('' + f.get('downtilt') + '°' + ' ');
- properties.push('' + f.get('antennagain') + ' dBi' + ' ');
- properties.push('' + f.get('feederloss') + ' dB' + ' ');
- properties.push(' ');
- });
- csvString += properties.join(',');
- while (csvString.includes('')) {
- csvString = csvString.replace(' ', '');
- }
- while (csvString.includes(' ')) {
- csvString = csvString.replace('', '');
- }
- while (csvString.includes(',')) {
- csvString = csvString.replace(' ,', '');
- }
- while (csvString.includes(' ,')) {
- csvString = csvString.replace(',', '\r\n');
- }
- while (csvString.includes('')) {
- csvString = csvString.replace('', '');
- }
- let details = '' + header.join('') + properties.join('') + '
';
- let loadObj = [];
- loadObj.push({ title: 'Network details', contentType: 'table', contentHTML: details, contentPadding: '0', contentData: csvString, contentExtension: '.csv' });
- ddsCreate('Network Report', loadObj);
-}
-function showLinksReport(e = null, transmsg = undefined) {
- if (e) { e.stopPropagation(); }
- let summary = '';
- let modifiedLinks = undefined;
- if (transmsg) {
- let modified = transmsg.split('@');
- let internal = modified[0];
- let external = modified[1];
- modifiedLinks = {
- internal: internal.length > 0 ? internal.split(',') : [],
- external: external.length > 0 ? external.split(',') : []
- }
- }
- if (modifiedLinks) {
- summary = 'Links created ';
- let publicLink = myLinksLayer.getSource().getFeatureByProperty('linktype', 'public');
- if (publicLink) {
- let publicSite = getPublicSite(publicLink.get('siteidb'), publicLink.get('email'));
- summary += 'Public Link: Site Id: ' + publicSite.get('siteid') + ' Site Name: ' + publicSite.get('sitename') + ' from Public Network has been found,'
- + ' Link Id: ' + publicLink.get('linkid') + ' has been added to link Public Site,' +
- ' You can contact user: ' + publicSite.get('name') + ' on email address: ' + publicSite.get('email') + ' for correspondance. ';
- if (modifiedLinks.external.length > 0) {
- summary += 'Links adjusted to meet ' + document.getElementById('opt_fresnelclearance').value + '% Fresnel Zone clearance requirement: ';
- let adjustedSite = myNetworkLayer.getSource().getFeatureByProperty('siteid', modifiedLinks.external[0]);
- summary += 'Site Id: ' + adjustedSite.get('siteid') + ' Site Name: ' + adjustedSite.get('sitename') + ', height has been adjusted to ' +
- round(adjustedSite.get('height'), 0) + ' meters to link with Public Site ';
- }
- }
- if (modifiedLinks.internal.length > 0) {
- if (modifiedLinks.external.length === 0) {
- summary += 'Links adjusted to meet ' + document.getElementById('opt_fresnelclearance').value + '% Fresnel Zone clearance requirement: ';
- }
- for (i = 0; i < modifiedLinks.internal.length; i++) {
- let adjustedSite = myNetworkLayer.getSource().getFeatureByProperty('siteid', modifiedLinks.internal[i]);
- summary += 'Site Id: ' + adjustedSite.get('siteid') + ' Site Name: ' + adjustedSite.get('sitename') + ', height has been adjusted to ' +
- round(adjustedSite.get('height'), 0) + ' meters, internal adjustment ';
- }
- }
- summary += '
';
- }
- let textString = summary;
- while (textString.includes('')) {
- textString = textString.replace('
', '');
- }
- while (textString.includes('
')) {
- textString = textString.replace('
', '');
- }
- while (textString.includes(' ')) {
- textString = textString.replace(' ', '\r\n');
- }
- while (textString.includes('')) {
- textString = textString.replace('', '');
- }
- while (textString.includes(' ')) {
- textString = textString.replace(' ', '');
- }
-
- let header = ['Link Id', 'Link Name', 'Link Type',
- 'Site Id A', 'Site Name A', 'Height / Elevation A', 'Bearing / Tilt A', 'Frequency A', 'Channel Width A', 'Output Power A', 'Antenna Gain A', 'Losses A',
- 'Site Id B', 'Site Name B', 'Height / Elevation B', 'Bearing / Tilt B', 'Frequency B', 'Channel Width B', 'Output Power B', 'Antenna Gain B', 'Losses B'];
- let csvString;
- csvString = header.join(',') + '\r\n';
- header = header.map(h => '' + h + ' ');
- header.unshift('');
- header.push(' ');
- let properties = [];
- let features = myLinksLayer.getSource().getFeatures();
- features.forEach(function (f) {
- let siteA = myNetworkLayer.getSource().getFeatureByProperty('siteid', f.get('siteida'));
- let siteB = undefined;
- if (f.get('linktype') === 'public') {
- siteB = getPublicSite(f.get('siteidb'), f.get('email'));
- } else {
- siteB = myNetworkLayer.getSource().getFeatureByProperty('siteid', f.get('siteidb'));
- }
- let xDistanceKm = Number(f.get('distance'));
- let deviceheightAm = Number(siteA.get('height')) + Number(f.get('locheighta'));
- let deviceheightBm = Number(siteB.get('height')) + Number(f.get('locheightb'));
- let tiltAd = 0; tiltBd = 0;
- if (deviceheightAm > deviceheightBm) {
- tiltAd = round(turf.radiansToDegrees(Math.atan(deviceheightAm / (xDistanceKm * 1000))), 2);
- tiltBd = round(turf.radiansToDegrees(-1 * Math.atan((deviceheightAm - deviceheightBm) / (xDistanceKm * 1000))), 2);
- }
- else {
- tiltAd = round(turf.radiansToDegrees(-1 * Math.atan((deviceheightBm - deviceheightAm) / (xDistanceKm * 1000))), 2);
- tiltBd = round(turf.radiansToDegrees(Math.atan(deviceheightBm / (xDistanceKm * 1000))), 2);
- }
- properties.push('');
- properties.push('' + f.get('linkid') + ' ');
- properties.push('' + f.get('linkname') + ' ');
- properties.push('' + titleCase(f.get('linktype')) + ' ');
- properties.push('' + f.get('siteida') + ' ');
- properties.push('' + siteA.get('sitename') + ' ');
- properties.push('' + round(parseFloat(siteA.get('height')), 0).toString() + ' m / ' + round(parseFloat(f.get('locheighta')), 0).toString() + ' m ');
- properties.push('' + round(parseFloat(f.get('bearinga')), 2).toString() + '° / ' + (tiltAd).toString() + '° ');
- properties.push('' + f.get('frequencya') + ' GHz ');
- properties.push('' + f.get('channelwidtha') + ' MHz ');
- properties.push('' + f.get('outputpowera') + ' dBm ');
- properties.push('' + f.get('antennagaina') + ' dBi ');
- properties.push('' + f.get('lossesa') + ' dB ');
- properties.push('' + f.get('siteidb') + ' ');
- properties.push('' + siteB.get('sitename') + ' ');
- properties.push('' + round(parseFloat(siteB.get('height')), 0).toString() + ' m / ' + round(parseFloat(f.get('locheightb')), 0).toString() + ' m ');
- properties.push('' + round(parseFloat(f.get('bearingb')), 2).toString() + '° / ' + (tiltBd).toString() + '° ');
- properties.push('' + f.get('frequencyb') + ' GHz ');
- properties.push('' + f.get('channelwidthb') + ' MHz ');
- properties.push('' + f.get('outputpowerb') + ' dBm ');
- properties.push('' + f.get('antennagainb') + ' dBi ');
- properties.push('' + f.get('lossesb') + ' dB ');
- properties.push(' ');
- });
- csvString += properties.join(',');
- while (csvString.includes('')) {
- csvString = csvString.replace(' ', '');
- }
- while (csvString.includes(' ')) {
- csvString = csvString.replace('', '');
- }
- while (csvString.includes(',')) {
- csvString = csvString.replace(' ,', '');
- }
- while (csvString.includes(' ,')) {
- csvString = csvString.replace(',', '\r\n');
- }
- while (csvString.includes('')) {
- csvString = csvString.replace('', '');
- }
- let details = '' + header.join('') + properties.join('') + '
';
- let loadObj = [];
- if (modifiedLinks) {
- loadObj.push({ title: 'Links summary', contentType: 'text', contentHTML: summary, contentPadding: '15px 10px', contentData: textString, contentExtension: '.txt' });
- loadObj.push({ title: 'Links details', contentType: 'table', contentHTML: details, contentPadding: '0', contentData: csvString, contentExtension: '.csv' });
- ddsCreate('Links Report', loadObj);
- }
- else {
- loadObj.push({ title: 'Links details', contentType: 'table', contentHTML: details, contentPadding: '0', contentData: csvString, contentExtension: '.csv' });
- ddsCreate('Links Report', loadObj);
- }
-}
-var getForecastRunning = function () { return Ajax_runccmd("GetForecastRunning", "") === 'true'; };
-var getActionRunning = function () { return getForecastRunning() || actionRunning; };
-
diff --git a/software/cnip/cnip/cnip.csproj.user b/software/cnip/cnip/cnip.csproj.user
deleted file mode 100644
index 7119d771de..0000000000
--- a/software/cnip/cnip/cnip.csproj.user
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
- true
-
-
-
-
-
-
-
- Debug|Any CPU
- CustomProfile
-
-
-
-
-
-
-
- CurrentPage
- True
- False
- False
- False
-
-
-
-
-
-
-
-
- True
- True
-
-
-
-
-
\ No newline at end of file
diff --git a/software/cnip/cnip.sln b/software/cnip/cnip/cnip.sln
similarity index 100%
rename from software/cnip/cnip.sln
rename to software/cnip/cnip/cnip.sln
diff --git a/software/cnip/cnip/App_Start/BundleConfig.cs b/software/cnip/cnip/cnip/App_Start/BundleConfig.cs
similarity index 100%
rename from software/cnip/cnip/App_Start/BundleConfig.cs
rename to software/cnip/cnip/cnip/App_Start/BundleConfig.cs
diff --git a/software/cnip/cnip/App_Start/FilterConfig.cs b/software/cnip/cnip/cnip/App_Start/FilterConfig.cs
similarity index 100%
rename from software/cnip/cnip/App_Start/FilterConfig.cs
rename to software/cnip/cnip/cnip/App_Start/FilterConfig.cs
diff --git a/software/cnip/cnip/App_Start/RouteConfig.cs b/software/cnip/cnip/cnip/App_Start/RouteConfig.cs
similarity index 100%
rename from software/cnip/cnip/App_Start/RouteConfig.cs
rename to software/cnip/cnip/cnip/App_Start/RouteConfig.cs
diff --git a/software/cnip/cnip/ApplicationInsights.config b/software/cnip/cnip/cnip/ApplicationInsights.config
similarity index 100%
rename from software/cnip/cnip/ApplicationInsights.config
rename to software/cnip/cnip/cnip/ApplicationInsights.config
diff --git a/software/cnip/cnip/Content/all.css b/software/cnip/cnip/cnip/Content/all.css
similarity index 100%
rename from software/cnip/cnip/Content/all.css
rename to software/cnip/cnip/cnip/Content/all.css
diff --git a/software/cnip/cnip/Content/all.min.css b/software/cnip/cnip/cnip/Content/all.min.css
similarity index 100%
rename from software/cnip/cnip/Content/all.min.css
rename to software/cnip/cnip/cnip/Content/all.min.css
diff --git a/software/cnip/cnip/Content/bootstrap-theme.css b/software/cnip/cnip/cnip/Content/bootstrap-theme.css
similarity index 100%
rename from software/cnip/cnip/Content/bootstrap-theme.css
rename to software/cnip/cnip/cnip/Content/bootstrap-theme.css
diff --git a/software/cnip/cnip/Content/bootstrap-theme.css.map b/software/cnip/cnip/cnip/Content/bootstrap-theme.css.map
similarity index 100%
rename from software/cnip/cnip/Content/bootstrap-theme.css.map
rename to software/cnip/cnip/cnip/Content/bootstrap-theme.css.map
diff --git a/software/cnip/cnip/Content/bootstrap-theme.min.css b/software/cnip/cnip/cnip/Content/bootstrap-theme.min.css
similarity index 100%
rename from software/cnip/cnip/Content/bootstrap-theme.min.css
rename to software/cnip/cnip/cnip/Content/bootstrap-theme.min.css
diff --git a/software/cnip/cnip/Content/bootstrap-theme.min.css.map b/software/cnip/cnip/cnip/Content/bootstrap-theme.min.css.map
similarity index 100%
rename from software/cnip/cnip/Content/bootstrap-theme.min.css.map
rename to software/cnip/cnip/cnip/Content/bootstrap-theme.min.css.map
diff --git a/software/cnip/cnip/Content/bootstrap.css b/software/cnip/cnip/cnip/Content/bootstrap.css
similarity index 100%
rename from software/cnip/cnip/Content/bootstrap.css
rename to software/cnip/cnip/cnip/Content/bootstrap.css
diff --git a/software/cnip/cnip/Content/bootstrap.css.map b/software/cnip/cnip/cnip/Content/bootstrap.css.map
similarity index 100%
rename from software/cnip/cnip/Content/bootstrap.css.map
rename to software/cnip/cnip/cnip/Content/bootstrap.css.map
diff --git a/software/cnip/cnip/Content/bootstrap.min.css b/software/cnip/cnip/cnip/Content/bootstrap.min.css
similarity index 100%
rename from software/cnip/cnip/Content/bootstrap.min.css
rename to software/cnip/cnip/cnip/Content/bootstrap.min.css
diff --git a/software/cnip/cnip/Content/bootstrap.min.css.map b/software/cnip/cnip/cnip/Content/bootstrap.min.css.map
similarity index 100%
rename from software/cnip/cnip/Content/bootstrap.min.css.map
rename to software/cnip/cnip/cnip/Content/bootstrap.min.css.map
diff --git a/software/cnip/cnip/Content/cnip/acc.css b/software/cnip/cnip/cnip/Content/cnip/acc.css
similarity index 100%
rename from software/cnip/cnip/Content/cnip/acc.css
rename to software/cnip/cnip/cnip/Content/cnip/acc.css
diff --git a/software/cnip/cnip/Content/cnip/cnip.css b/software/cnip/cnip/cnip/Content/cnip/cnip.css
similarity index 98%
rename from software/cnip/cnip/Content/cnip/cnip.css
rename to software/cnip/cnip/cnip/Content/cnip/cnip.css
index 0a63bfafac..b5546c6bcd 100644
--- a/software/cnip/cnip/Content/cnip/cnip.css
+++ b/software/cnip/cnip/cnip/Content/cnip/cnip.css
@@ -539,4 +539,14 @@ td {
background-color: var(--backcolor) !important;
color: var(--hovercolor) !important;
font-weight: 600;
- }
\ No newline at end of file
+ }
+
+/* Sortable tables */
+table.sortable thead {
+ font-weight: bold;
+ cursor:pointer;
+}
+table.sortable th:not(.sorttable_sorted):not(.sorttable_sorted_reverse):not(.sorttable_nosort):after {
+ content: " \25B4\25BE"
+}
+
\ No newline at end of file
diff --git a/software/cnip/cnip/Content/cnip/root.css b/software/cnip/cnip/cnip/Content/cnip/root.css
similarity index 100%
rename from software/cnip/cnip/Content/cnip/root.css
rename to software/cnip/cnip/cnip/Content/cnip/root.css
diff --git a/software/cnip/cnip/Content/cnip/webui.css b/software/cnip/cnip/cnip/Content/cnip/webui.css
similarity index 97%
rename from software/cnip/cnip/Content/cnip/webui.css
rename to software/cnip/cnip/cnip/Content/cnip/webui.css
index b97cc6af41..20a0268d42 100644
--- a/software/cnip/cnip/Content/cnip/webui.css
+++ b/software/cnip/cnip/cnip/Content/cnip/webui.css
@@ -100,10 +100,19 @@
#about {
z-index: 99;
position: absolute;
- bottom: 33px;
+ bottom: 27px;
right: 151px;
}
+#tileMapCopyright {
+ z-index: 99;
+ position: absolute;
+ bottom: 0px;
+ right: 0px;
+ background-color: rgba(255,255,255,0.9);
+ font-size: 11px;
+}
+
#activeInteraction {
z-index: 99;
position: absolute;
@@ -172,8 +181,8 @@
#locationInfo {
z-index: 99;
position: absolute;
- left: calc(50vw - (/* width */150px / 2));
- bottom: 10px;
+ left: calc(50vw - (/* width */260px / 2));
+ bottom: 29px;
width: 260px;
height: auto;
border: 3px solid transparent;
@@ -182,7 +191,7 @@
background-color: var(--opbackcolor);
color: var(--opfontcolor);
transition: opacity 100ms ease-in;
- opacity: 1;
+ opacity: 0;
font-size: smaller;
text-align: center;
}
@@ -365,7 +374,7 @@
left: auto;
right: 4px;
top: auto;
- bottom: 40px;
+ bottom: 29px;
color: var(--opfontcolor);
background-color: var(--opbackcolor);
}
diff --git a/software/cnip/cnip/Controllers/GlavniController.cs b/software/cnip/cnip/cnip/Controllers/GlavniController.cs
similarity index 100%
rename from software/cnip/cnip/Controllers/GlavniController.cs
rename to software/cnip/cnip/cnip/Controllers/GlavniController.cs
diff --git a/software/cnip/cnip/Controllers/HomeController.cs b/software/cnip/cnip/cnip/Controllers/HomeController.cs
similarity index 100%
rename from software/cnip/cnip/Controllers/HomeController.cs
rename to software/cnip/cnip/cnip/Controllers/HomeController.cs
diff --git a/software/cnip/cnip/GdalConfiguration.cs b/software/cnip/cnip/cnip/GdalConfiguration.cs
similarity index 100%
rename from software/cnip/cnip/GdalConfiguration.cs
rename to software/cnip/cnip/cnip/GdalConfiguration.cs
diff --git a/software/cnip/cnip/GdalConfiguration.vb b/software/cnip/cnip/cnip/GdalConfiguration.vb
similarity index 100%
rename from software/cnip/cnip/GdalConfiguration.vb
rename to software/cnip/cnip/cnip/GdalConfiguration.vb
diff --git a/software/cnip/cnip/Global.asax b/software/cnip/cnip/cnip/Global.asax
similarity index 100%
rename from software/cnip/cnip/Global.asax
rename to software/cnip/cnip/cnip/Global.asax
diff --git a/software/cnip/cnip/Global.asax.cs b/software/cnip/cnip/cnip/Global.asax.cs
similarity index 100%
rename from software/cnip/cnip/Global.asax.cs
rename to software/cnip/cnip/cnip/Global.asax.cs
diff --git a/software/cnip/cnip/Models/bfspbvg.cs b/software/cnip/cnip/cnip/Models/bfspbvg.cs
similarity index 100%
rename from software/cnip/cnip/Models/bfspbvg.cs
rename to software/cnip/cnip/cnip/Models/bfspbvg.cs
diff --git a/software/cnip/cnip/Models/gdalext.cs b/software/cnip/cnip/cnip/Models/gdalext.cs
similarity index 100%
rename from software/cnip/cnip/Models/gdalext.cs
rename to software/cnip/cnip/cnip/Models/gdalext.cs
diff --git a/software/cnip/cnip/Models/generic.cs b/software/cnip/cnip/cnip/Models/generic.cs
similarity index 91%
rename from software/cnip/cnip/Models/generic.cs
rename to software/cnip/cnip/cnip/Models/generic.cs
index a31068e7fd..8c56aa440d 100644
--- a/software/cnip/cnip/Models/generic.cs
+++ b/software/cnip/cnip/cnip/Models/generic.cs
@@ -84,12 +84,12 @@ namespace cnip.Models
{
string retval = "";
int loca = 0, locb = 0;
- double prevLon = 0.000000000001, prevLat = 0.000000000001;
double longitude = 0.000000000000, latitude = 0.000000000000;
double[] pGT = new double[6];
string[] locations = pointsArray.Split('@');
int col = 0, row = 0, lastElev = 0;
int[] pRBB = new int[1];
+ string prevDem = ""; string currDem = "";
Dataset ds = Gdal.Open(GetRasterPath(-200, -200),
Access.GA_ReadOnly);
Band band = ds.GetRasterBand(1);
@@ -100,16 +100,12 @@ namespace cnip.Models
{
longitude = locations[i].Split('&')[0].ToDouble();
latitude = locations[i].Split('&')[1].ToDouble();
- if (latitude.ToString().Trim().Split('.')[0] !=
- prevLat.ToString().Trim().Split('.')[0] &&
- longitude.ToString().Trim().Split('.')[0] !=
- prevLon.ToString().Trim().Split('.')[0])
+ currDem = GetRasterPath(longitude, latitude);
+ if (currDem != prevDem)
{
- prevLat = latitude; prevLon = longitude;
+ prevDem = currDem;
ds.Dispose();
- ds = Gdal.Open(
- GetRasterPath(longitude, latitude),
- Access.GA_ReadOnly);
+ ds = Gdal.Open(currDem, Access.GA_ReadOnly);
pGT = new double[6];
ds.GetGeoTransform(pGT);
band = ds.GetRasterBand(1);
@@ -121,7 +117,7 @@ namespace cnip.Models
if (pRBB[0] < 0) { pRBB[0] = lastElev; }
lastElev = pRBB[0];
if (i == 0) { loca = pRBB[0]; }
- if (i == locations.Length - 2) { locb = pRBB[0]; }
+ if (i == locations.Length - 1) { locb = pRBB[0]; }
retval += locations[i] + "&" + pRBB[0].ToString() + "@";
}
catch (Exception)
@@ -131,7 +127,14 @@ namespace cnip.Models
}
if (retval.Length > 0)
{
- retval = loca.ToString() + "#" + locb.ToString() + "#" + retval.TrimEnd(1);
+ if (locb == 0)
+ {
+ retval = loca.ToString() + "#" + pRBB[0].ToString() + "#" + retval.TrimEnd(1);
+ }
+ else
+ {
+ retval = loca.ToString() + "#" + locb.ToString() + "#" + retval.TrimEnd(1);
+ }
}
else
{
@@ -144,14 +147,13 @@ namespace cnip.Models
public static double GetAverageElevationFromPointsArray(
string pointsArray)
{
- int loca = 0, locb = 0;
double averageElevation = 0;
- double prevLon = 0.000000000001, prevLat = 0.000000000001;
double longitude = 0.000000000000, latitude = 0.000000000000;
double[] pGT = new double[6];
string[] locations = pointsArray.Split('@');
int col = 0, row = 0, lastElev = 0;
int[] pRBB = new int[1];
+ string prevDem = ""; string currDem = "";
Dataset ds = Gdal.Open(GetRasterPath(-200, -200),
Access.GA_ReadOnly);
Band band = ds.GetRasterBand(1);
@@ -162,16 +164,12 @@ namespace cnip.Models
{
longitude = locations[i].Split('&')[0].ToDouble();
latitude = locations[i].Split('&')[1].ToDouble();
- if (latitude.ToString().Trim().Split('.')[0] !=
- prevLat.ToString().Trim().Split('.')[0] &&
- longitude.ToString().Trim().Split('.')[0] !=
- prevLon.ToString().Trim().Split('.')[0])
+ currDem = GetRasterPath(longitude, latitude);
+ if (currDem != prevDem)
{
- prevLat = latitude; prevLon = longitude;
+ prevDem = currDem;
ds.Dispose();
- ds = Gdal.Open(
- GetRasterPath(longitude, latitude),
- Access.GA_ReadOnly);
+ ds = Gdal.Open(currDem, Access.GA_ReadOnly);
pGT = new double[6];
ds.GetGeoTransform(pGT);
band = ds.GetRasterBand(1);
@@ -182,8 +180,6 @@ namespace cnip.Models
band.ReadRaster(col, row, 1, 1, pRBB, 1, 1, 0, 0);
if (pRBB[0] < 0) { pRBB[0] = lastElev; }
lastElev = pRBB[0];
- if (i == 0) { loca = pRBB[0]; }
- if (i == locations.Length - 2) { locb = pRBB[0]; }
averageElevation = (averageElevation + pRBB[0]) / 2;
}
catch (Exception)
@@ -243,7 +239,7 @@ namespace cnip.Models
if (lon.StartsWith("-"))
{
path += "W" +
- (lon.Replace("-", "").ToInt() + 1).ToString("000");
+ (lon.Replace("-", "").ToInt() + 1).ToString("000") + ".hgt";
}
else
{
@@ -296,7 +292,7 @@ namespace cnip.Models
unitLength += row[1].ToString().ToDouble() / 1000;
pointsArray += location2[0] + "&" +
location2[1] + "&" + unitLength.ToString() + "@";
- }
+ }
}
pointsArray = pointsArray.TrimEnd(1);
return GetElevationStringFromPointsArray(pointsArray);
diff --git a/software/cnip/cnip/Models/gisext.cs b/software/cnip/cnip/cnip/Models/gisext.cs
similarity index 100%
rename from software/cnip/cnip/Models/gisext.cs
rename to software/cnip/cnip/cnip/Models/gisext.cs
diff --git a/software/cnip/cnip/Models/kruskal.cs b/software/cnip/cnip/cnip/Models/kruskal.cs
similarity index 100%
rename from software/cnip/cnip/Models/kruskal.cs
rename to software/cnip/cnip/cnip/Models/kruskal.cs
diff --git a/software/cnip/cnip/Models/pgsql.cs b/software/cnip/cnip/cnip/Models/pgsql.cs
similarity index 100%
rename from software/cnip/cnip/Models/pgsql.cs
rename to software/cnip/cnip/cnip/Models/pgsql.cs
diff --git a/software/cnip/cnip/Models/rfantenna.cs b/software/cnip/cnip/cnip/Models/rfantenna.cs
similarity index 100%
rename from software/cnip/cnip/Models/rfantenna.cs
rename to software/cnip/cnip/cnip/Models/rfantenna.cs
diff --git a/software/cnip/cnip/Models/settings.cs b/software/cnip/cnip/cnip/Models/settings.cs
similarity index 100%
rename from software/cnip/cnip/Models/settings.cs
rename to software/cnip/cnip/cnip/Models/settings.cs
diff --git a/software/cnip/cnip/Models/site.cs b/software/cnip/cnip/cnip/Models/site.cs
similarity index 100%
rename from software/cnip/cnip/Models/site.cs
rename to software/cnip/cnip/cnip/Models/site.cs
diff --git a/software/cnip/cnip/Models/strext.cs b/software/cnip/cnip/cnip/Models/strext.cs
similarity index 100%
rename from software/cnip/cnip/Models/strext.cs
rename to software/cnip/cnip/cnip/Models/strext.cs
diff --git a/software/cnip/cnip/Models/webext.cs b/software/cnip/cnip/cnip/Models/webext.cs
similarity index 100%
rename from software/cnip/cnip/Models/webext.cs
rename to software/cnip/cnip/cnip/Models/webext.cs
diff --git a/software/cnip/cnip/Properties/AssemblyInfo.cs b/software/cnip/cnip/cnip/Properties/AssemblyInfo.cs
similarity index 100%
rename from software/cnip/cnip/Properties/AssemblyInfo.cs
rename to software/cnip/cnip/cnip/Properties/AssemblyInfo.cs
diff --git a/software/cnip/cnip/Properties/PublishProfiles/CustomProfile.pubxml b/software/cnip/cnip/cnip/Properties/PublishProfiles/CustomProfile.pubxml
similarity index 100%
rename from software/cnip/cnip/Properties/PublishProfiles/CustomProfile.pubxml
rename to software/cnip/cnip/cnip/Properties/PublishProfiles/CustomProfile.pubxml
diff --git a/software/cnip/cnip/Scripts/Chart.bundle.js b/software/cnip/cnip/cnip/Scripts/Chart.bundle.js
similarity index 100%
rename from software/cnip/cnip/Scripts/Chart.bundle.js
rename to software/cnip/cnip/cnip/Scripts/Chart.bundle.js
diff --git a/software/cnip/cnip/Scripts/Chart.bundle.min.js b/software/cnip/cnip/cnip/Scripts/Chart.bundle.min.js
similarity index 100%
rename from software/cnip/cnip/Scripts/Chart.bundle.min.js
rename to software/cnip/cnip/cnip/Scripts/Chart.bundle.min.js
diff --git a/software/cnip/cnip/Scripts/Chart.css b/software/cnip/cnip/cnip/Scripts/Chart.css
similarity index 100%
rename from software/cnip/cnip/Scripts/Chart.css
rename to software/cnip/cnip/cnip/Scripts/Chart.css
diff --git a/software/cnip/cnip/Scripts/Chart.js b/software/cnip/cnip/cnip/Scripts/Chart.js
similarity index 100%
rename from software/cnip/cnip/Scripts/Chart.js
rename to software/cnip/cnip/cnip/Scripts/Chart.js
diff --git a/software/cnip/cnip/Scripts/Chart.min.css b/software/cnip/cnip/cnip/Scripts/Chart.min.css
similarity index 100%
rename from software/cnip/cnip/Scripts/Chart.min.css
rename to software/cnip/cnip/cnip/Scripts/Chart.min.css
diff --git a/software/cnip/cnip/Scripts/Chart.min.js b/software/cnip/cnip/cnip/Scripts/Chart.min.js
similarity index 100%
rename from software/cnip/cnip/Scripts/Chart.min.js
rename to software/cnip/cnip/cnip/Scripts/Chart.min.js
diff --git a/software/cnip/cnip/Scripts/FileSaver.min.js b/software/cnip/cnip/cnip/Scripts/FileSaver.min.js
similarity index 100%
rename from software/cnip/cnip/Scripts/FileSaver.min.js
rename to software/cnip/cnip/cnip/Scripts/FileSaver.min.js
diff --git a/software/cnip/cnip/Scripts/bootstrap.4.1.1/bootstrap.min.css b/software/cnip/cnip/cnip/Scripts/bootstrap.4.1.1/bootstrap.min.css
similarity index 100%
rename from software/cnip/cnip/Scripts/bootstrap.4.1.1/bootstrap.min.css
rename to software/cnip/cnip/cnip/Scripts/bootstrap.4.1.1/bootstrap.min.css
diff --git a/software/cnip/cnip/Scripts/bootstrap.4.1.1/bootstrap.min.js b/software/cnip/cnip/cnip/Scripts/bootstrap.4.1.1/bootstrap.min.js
similarity index 100%
rename from software/cnip/cnip/Scripts/bootstrap.4.1.1/bootstrap.min.js
rename to software/cnip/cnip/cnip/Scripts/bootstrap.4.1.1/bootstrap.min.js
diff --git a/software/cnip/cnip/Scripts/bootstrap.js b/software/cnip/cnip/cnip/Scripts/bootstrap.js
similarity index 100%
rename from software/cnip/cnip/Scripts/bootstrap.js
rename to software/cnip/cnip/cnip/Scripts/bootstrap.js
diff --git a/software/cnip/cnip/Scripts/bootstrap.min.js b/software/cnip/cnip/cnip/Scripts/bootstrap.min.js
similarity index 100%
rename from software/cnip/cnip/Scripts/bootstrap.min.js
rename to software/cnip/cnip/cnip/Scripts/bootstrap.min.js
diff --git a/software/cnip/cnip/Scripts/cnip/acc/accsrv.js b/software/cnip/cnip/cnip/Scripts/cnip/acc/accsrv.js
similarity index 100%
rename from software/cnip/cnip/Scripts/cnip/acc/accsrv.js
rename to software/cnip/cnip/cnip/Scripts/cnip/acc/accsrv.js
diff --git a/software/cnip/cnip/Scripts/cnip/acc/accsrvrq.js b/software/cnip/cnip/cnip/Scripts/cnip/acc/accsrvrq.js
similarity index 100%
rename from software/cnip/cnip/Scripts/cnip/acc/accsrvrq.js
rename to software/cnip/cnip/cnip/Scripts/cnip/acc/accsrvrq.js
diff --git a/software/cnip/cnip/Scripts/cnip/acc/accui.js b/software/cnip/cnip/cnip/Scripts/cnip/acc/accui.js
similarity index 100%
rename from software/cnip/cnip/Scripts/cnip/acc/accui.js
rename to software/cnip/cnip/cnip/Scripts/cnip/acc/accui.js
diff --git a/software/cnip/cnip/Scripts/cnip/webui/activeinteraction.js b/software/cnip/cnip/cnip/Scripts/cnip/webui/activeinteraction.js
similarity index 100%
rename from software/cnip/cnip/Scripts/cnip/webui/activeinteraction.js
rename to software/cnip/cnip/cnip/Scripts/cnip/webui/activeinteraction.js
diff --git a/software/cnip/cnip/Scripts/cnip/webui/contextmenu.js b/software/cnip/cnip/cnip/Scripts/cnip/webui/contextmenu.js
similarity index 100%
rename from software/cnip/cnip/Scripts/cnip/webui/contextmenu.js
rename to software/cnip/cnip/cnip/Scripts/cnip/webui/contextmenu.js
diff --git a/software/cnip/cnip/Scripts/cnip/webui/controlbar.js b/software/cnip/cnip/cnip/Scripts/cnip/webui/controlbar.js
similarity index 100%
rename from software/cnip/cnip/Scripts/cnip/webui/controlbar.js
rename to software/cnip/cnip/cnip/Scripts/cnip/webui/controlbar.js
diff --git a/software/cnip/cnip/Scripts/cnip/webui/dds.js b/software/cnip/cnip/cnip/Scripts/cnip/webui/dds.js
similarity index 94%
rename from software/cnip/cnip/Scripts/cnip/webui/dds.js
rename to software/cnip/cnip/cnip/Scripts/cnip/webui/dds.js
index 3a4ecb3598..b61838ad22 100644
--- a/software/cnip/cnip/Scripts/cnip/webui/dds.js
+++ b/software/cnip/cnip/cnip/Scripts/cnip/webui/dds.js
@@ -138,9 +138,9 @@ function ddsCreate(title, loadObj) {
ddsContentExtension[ddsCount][i] = '';
ddsContentChart[ddsCount][i] = '';
ddsContentChartPngString[ddsCount][i] = '';
+ dsBodyTabContents[i].contentType = loadObj[i].contentType;
if (loadObj[i].contentType === 'chart') {
ddsContentChartPngString[ddsCount][i] = loadObj[i].pngString;
- dsBodyTabContents[i].contentType = 'chart';
let contentTitleDiv = document.createElement('div');
let chDiv = document.createElement('div');
let chCanvas = document.createElement('canvas');
@@ -216,7 +216,6 @@ function ddsCreate(title, loadObj) {
}
});
} else {
- dsBodyTabContents[i].contentType = 'table';
dsBodyTabContents[i].innerHTML = loadObj[i].contentHTML;
ddsContentData[ddsCount][i] = loadObj[i].contentData;
ddsContentExtension[ddsCount][i] = loadObj[i].contentExtension;
@@ -227,6 +226,15 @@ function ddsCreate(title, loadObj) {
ddsCount += 1;
// set draggable
setDraggable();
+ $(document).ready(function () {
+ for (let i = 0; i < loadObj.length; i++) {
+ if (loadObj[i].contentType === 'table') {
+ let table = document.getElementById('table' + (ddsCount - 1).toString());
+ sorttable.makeSortable(table);
+ sorttable.innerSortFunction.apply(table.getElementsByTagName("th")[0], []);
+ }
+ }
+ });
}
function ddsOpenPage(ddsId, tabContentId, tabLink) {
$('button[id^="chdds' + ddsId.toString() + 'TabLink"]').css({ 'background-color': '', 'color': '' });
@@ -287,6 +295,11 @@ function ddsDownloadActiveContent(ddsId) {
let realData = block[1].split(",")[1];
let canvasBlob = b64toBlob(realData, mimeType);
saveAs(canvasBlob, "chart.png");
+ } else if (tabContent[i].contentType === 'table') {
+ let csvdata = $('#table' + ddsId.toString()).table2CSV({ delivery: 'value' });
+ let blob = new Blob([csvdata], { type: "text/plain;charset=utf-8" });
+ saveAs(blob, $('#chdds' + ddsId.toString() + 'TabLink' + i.toString()).html() +
+ ddsContentExtension[ddsId][i]);
} else {
let blob = new Blob([ddsContentData[ddsId][i]], { type: "text/plain;charset=utf-8" });
saveAs(blob, $('#chdds' + ddsId.toString() + 'TabLink' + i.toString()).html() +
diff --git a/software/cnip/cnip/Scripts/cnip/webui/dialogs.js b/software/cnip/cnip/cnip/Scripts/cnip/webui/dialogs.js
similarity index 100%
rename from software/cnip/cnip/Scripts/cnip/webui/dialogs.js
rename to software/cnip/cnip/cnip/Scripts/cnip/webui/dialogs.js
diff --git a/software/cnip/cnip/Scripts/cnip/webui/dialogs/linkoptions.js b/software/cnip/cnip/cnip/Scripts/cnip/webui/dialogs/linkoptions.js
similarity index 51%
rename from software/cnip/cnip/Scripts/cnip/webui/dialogs/linkoptions.js
rename to software/cnip/cnip/cnip/Scripts/cnip/webui/dialogs/linkoptions.js
index b1f04a5a79..094a5f0bb8 100644
--- a/software/cnip/cnip/Scripts/cnip/webui/dialogs/linkoptions.js
+++ b/software/cnip/cnip/cnip/Scripts/cnip/webui/dialogs/linkoptions.js
@@ -4,7 +4,8 @@ var linkData;
var siteAData;
var siteBData;
var linksCount;
-var currLink;
+var currLinkIdx;
+var deleteLinkIdx = -1;
/* initialize controls*/
initSingleSlider(document.getElementById('frequencya'), '', '1', '15', '0.1', '5');
initSelectOpt(document.getElementById('channelwidtha'), '100%', '10\t20\t30\t40\t50\t60\t80\t100', '20');
@@ -19,11 +20,13 @@ initSingleSlider(document.getElementById('lossesb'), '', '0', '51', '0.1', '0');
/* setup listeners*/
document.getElementById('defaultOpen').click();
document.getElementById('linkname').addEventListener('change', linkNameChange);
+document.getElementById('heighta').addEventListener('change', heightAChange);
document.getElementById('frequencya').addEventListener('change', saveLinkData);
document.getElementById('channelwidtha').addEventListener('change', saveLinkData);
document.getElementById('outputpowera').addEventListener('change', saveLinkData);
document.getElementById('antennagaina').addEventListener('change', saveLinkData);
document.getElementById('lossesa').addEventListener('change', saveLinkData);
+document.getElementById('heightb').addEventListener('change', heightBChange);
document.getElementById('frequencyb').addEventListener('change', saveLinkData);
document.getElementById('channelwidthb').addEventListener('change', saveLinkData);
document.getElementById('outputpowerb').addEventListener('change', saveLinkData);
@@ -34,6 +37,29 @@ function linkNameChange(e) {
document.getElementById('linkname').value = fixStringName(document.getElementById('linkname').value);
saveLinkData(e);
}
+function heightAChange(e) {
+ // height of site a siteAData[4];
+ document.getElementById('heighta').value = Number(document.getElementById('heighta').value);
+ if (Number(document.getElementById('siteheighta').value) < Number(document.getElementById('heighta').value)) {
+ window.parent.updateSiteHeightById((siteAData[0] === undefined ? '' : siteAData[0].toString()), document.getElementById('heighta').value);
+ }
+ saveLinkData(e);
+}
+function heightBChange(e) {
+ // height of site b siteBData[4];
+ document.getElementById('heightb').value = Number(document.getElementById('heightb').value);
+ if (document.getElementById('linktype').value === 'public') {
+ if (Number(document.getElementById('siteheightb').value) < Number(document.getElementById('heightb').value)) {
+ document.getElementById('heightb').value = Number(document.getElementById('siteheightb').value);
+ }
+ }
+ else {
+ if (Number(document.getElementById('siteheightb').value) < Number(document.getElementById('heightb').value)) {
+ window.parent.updateSiteHeightById((siteBData[0] === undefined ? '' : siteBData[0].toString()), document.getElementById('heightb').value);
+ }
+ }
+ saveLinkData(e);
+}
function fillLinkData(linkData) {
document.getElementById('linkid').value = linkData[0].toString();
document.getElementById('linkname').value = linkData[1] === undefined ? '' : linkData[1].toString();
@@ -59,53 +85,70 @@ function fillLinkData(linkData) {
document.getElementById('spanname').hidden = true;
document.getElementById('spanemail').hidden = true;
}
- document.getElementById('siteida').value = linkData[3] === undefined ? '' : linkData[3].toString();
document.getElementById('sitenamea').value = siteAData[1] === undefined ? '' : siteAData[1].toString();
- document.getElementById('heighta').value = siteAData[4] === undefined ? '' : siteAData[4].toString();
- document.getElementById('locheighta').value = linkData[4] === undefined ? '' : linkData[4].toString();
- document.getElementById('bearinga').value = linkData[5] === undefined ? '' : linkData[5].toString();
- document.getElementById('channelwidtha').setOpt(linkData[6] === undefined ? '' : linkData[6].toString());
- document.getElementById('frequencya').setValue(linkData[7] === undefined ? '' : linkData[7].toString());
- document.getElementById('outputpowera').setValue(linkData[8] === undefined ? '' : linkData[8].toString());
- document.getElementById('antennagaina').setValue(linkData[9] === undefined ? '' : linkData[9].toString());
- document.getElementById('lossesa').setValue(linkData[10] === undefined ? '' : linkData[10].toString());
- document.getElementById('siteidb').value = linkData[11] === undefined ? '' : linkData[11].toString();
+ document.getElementById('siteheighta').value = siteAData[4] === undefined ? '' : siteAData[4].toString();
document.getElementById('sitenameb').value = siteBData[1] === undefined ? '' : siteBData[1].toString();
- document.getElementById('heightb').value = siteBData[4] === undefined ? '' : siteBData[4].toString();
- document.getElementById('locheightb').value = linkData[12] === undefined ? '' : linkData[12].toString();
- document.getElementById('bearingb').value = linkData[13] === undefined ? '' : linkData[13].toString();
- document.getElementById('channelwidthb').setOpt(linkData[14] === undefined ? '' : linkData[14].toString());
- document.getElementById('frequencyb').setValue(linkData[15] === undefined ? '' : linkData[15].toString());
- document.getElementById('outputpowerb').setValue(linkData[16] === undefined ? '' : linkData[16].toString());
- document.getElementById('antennagainb').setValue(linkData[17] === undefined ? '' : linkData[17].toString());
- document.getElementById('lossesb').setValue(linkData[18] === undefined ? '' : linkData[18].toString());
- document.getElementById('distance').value = linkData[19] === undefined ? '' : linkData[19].toString();
- document.getElementById('name').value = linkData[20] === undefined ? '' : linkData[20].toString();
- document.getElementById('email').value = linkData[21] === undefined ? '' : linkData[21].toString();
+ document.getElementById('siteheightb').value = siteBData[4] === undefined ? '' : siteBData[4].toString();
+
+ document.getElementById('siteida').value = linkData[3] === undefined ? '' : linkData[3].toString();
+ document.getElementById('locheighta').value = linkData[4] === undefined ? '' : linkData[4].toString();
+ document.getElementById('heighta').value = linkData[5] === undefined ? '' : linkData[5].toString();
+ document.getElementById('bearinga').value = linkData[6] === undefined ? '' : linkData[6].toString();
+ document.getElementById('channelwidtha').setOpt(linkData[7] === undefined ? '' : linkData[7].toString());
+ document.getElementById('frequencya').setValue(linkData[8] === undefined ? '' : linkData[8].toString());
+ document.getElementById('outputpowera').setValue(linkData[9] === undefined ? '' : linkData[9].toString());
+ document.getElementById('antennagaina').setValue(linkData[10] === undefined ? '' : linkData[10].toString());
+ document.getElementById('lossesa').setValue(linkData[11] === undefined ? '' : linkData[11].toString());
+ document.getElementById('siteidb').value = linkData[12] === undefined ? '' : linkData[12].toString();
+ document.getElementById('locheightb').value = linkData[13] === undefined ? '' : linkData[13].toString();
+ document.getElementById('heightb').value = linkData[14] === undefined ? '' : linkData[14].toString();
+ document.getElementById('bearingb').value = linkData[15] === undefined ? '' : linkData[15].toString();
+ document.getElementById('channelwidthb').setOpt(linkData[16] === undefined ? '' : linkData[16].toString());
+ document.getElementById('frequencyb').setValue(linkData[17] === undefined ? '' : linkData[17].toString());
+ document.getElementById('outputpowerb').setValue(linkData[18] === undefined ? '' : linkData[18].toString());
+ document.getElementById('antennagainb').setValue(linkData[19] === undefined ? '' : linkData[19].toString());
+ document.getElementById('lossesb').setValue(linkData[20] === undefined ? '' : linkData[20].toString());
+ document.getElementById('distance').value = linkData[21] === undefined ? '' : linkData[21].toString();
+ document.getElementById('name').value = linkData[22] === undefined ? '' : linkData[22].toString();
+ document.getElementById('email').value = linkData[23] === undefined ? '' : linkData[23].toString();
}
function refreshLinkData(refreshType, Idx = null) {
- let currLinkId = linkData === undefined ? 0 : linkData[0].toString();
+ let currLinkId = linkData === undefined ? '0' : linkData[0].toString();
linkData = undefined; linksCount = '0';
linksCount = window.parent.getLinksCount();
- if (Idx !== null) { currLink = Idx.toString(); } else {
- if (refreshType === 'start') { currLink = '0'; }
- else if (refreshType === 'add') {
- currLink = (Number(linksCount) - 1).toString();
+ if (Idx !== null) { currLinkIdx = Idx.toString(); } else {
+ if (refreshType === 'start') {
+ if (Number(linksCount) > 0) {
+ currLinkIdx = window.parent.sLinksTree[0][0].toString();
+ } else { currLinkIdx = '-1'; }
}
- else if (refreshType === 'cursor') {
- currLink = window.parent.getLinkIdxById(currLinkId).toString();
+ else if (refreshType === 'add') { /* add */
+ if (Number(linksCount) > 0) {
+ currLinkIdx = window.parent.sLinksTree[Number(linksCount) - 1][0].toString();
+ } else { currLinkIdx = '-1'; }
+ }
+ else if (refreshType === 'cursor') { /* update */
+ if (Number(linksCount) > 0) {
+ currLinkIdx = window.parent.getLinkIdxById(currLinkId).toString();
+ } else { currLinkIdx = '-1'; }
}
else if (refreshType === 'delete') /*delete*/ {
- if (Number(currLink) > Number(linksCount) - 1) {
- currLink = (Number(linksCount) - 1).toString();
- }
+ if (Number(linksCount) > 0) {
+ if (deleteLinkIdx > Number(linksCount) - 1) {
+ currLinkIdx = window.parent.sLinksTree[Number(linksCount) - 1][0].toString();
+ } else {
+ if (deleteLinkIdx > -1) {
+ currLinkIdx = window.parent.sLinksTree[deleteLinkIdx][0].toString();
+ } else { currLinkIdx = '-1'; }
+ }
+ } else { currLinkIdx = '-1'; }
}
}
- linkData = window.parent.getLinkDataByIdx(currLink).split('\t');
- let siteida = linkData[3] === undefined ? -1 : linkData[3].toString();
- let siteidb = linkData[11] === undefined ? -1 : linkData[11].toString();
+ linkData = window.parent.getLinkDataByIdx(currLinkIdx).split('\t');
let linktype = linkData[2] === undefined ? '' : linkData[2].toString();
- let email = linkData[21] === undefined ? '' : linkData[21].toString();
+ let siteida = linkData[3] === undefined ? -1 : linkData[3].toString();
+ let siteidb = linkData[12] === undefined ? -1 : linkData[12].toString();
+ let email = linkData[23] === undefined ? '' : linkData[23].toString();
siteAData = window.parent.getSiteDataById(siteida).split('\t');
if (linktype === 'public') {
siteBData = window.parent.getPublicSiteData(siteidb, email).split('\t');
@@ -119,26 +162,30 @@ function refreshLinkDataById(linkid) {
}
function nextLink(e) {
if (e) { e.stopPropagation(); }
- if (Number(linksCount) - 1 > Number(currLink)) {
- refreshLinkData('', (Number(currLink) + 1).toString());
+ let sortedIdx = window.parent.sLinksTree.findIndex(x => x[0].toString() === currLinkIdx);
+ if (sortedIdx < Number(linksCount) - 1) {
+ refreshLinkData('', (window.parent.sLinksTree[sortedIdx + 1][0]).toString());
}
}
function previousLink(e) {
if (e) { e.stopPropagation(); }
- if (Number(currLink) > 0) {
- refreshLinkData('', (Number(currLink) - 1).toString());
+ let sortedIdx = window.parent.sLinksTree.findIndex(x => x[0].toString() === currLinkIdx);
+ if (sortedIdx > 0) {
+ refreshLinkData('', (window.parent.sLinksTree[sortedIdx - 1][0]).toString());
}
}
function saveLinkData(e) {
if (e) { e.stopPropagation(); }
window.parent.updateLinkDataByIdx({
- idx: currLink,
+ idx: currLinkIdx,
linkname: document.getElementById('linkname').value,
+ heighta: document.getElementById('heighta').value,
channelwidtha: document.getElementById('channelwidtha').value,
frequencya: document.getElementById('frequencya').value,
outputpowera: document.getElementById('outputpowera').value,
antennagaina: document.getElementById('antennagaina').value,
lossesa: document.getElementById('lossesa').value,
+ heightb: document.getElementById('heightb').value,
channelwidthb: document.getElementById('channelwidthb').value,
frequencyb: document.getElementById('frequencyb').value,
outputpowerb: document.getElementById('outputpowerb').value,
@@ -146,16 +193,18 @@ function saveLinkData(e) {
lossesb: document.getElementById('lossesb').value
});
window.parent.document.getElementById('linkProfileFrame').contentWindow.refreshLinkData('cursor');
+ window.parent.document.getElementById('siteOptionsFrame').contentWindow.refreshSiteData('cursor');
refreshLinkData('cursor');
}
function deleteLink(e) {
if (e) { e.stopPropagation(); }
- window.parent.deleteLinkByIdx(currLink);
+ deleteLinkIdx = window.parent.sLinksTree.findIndex(x => x[0].toString() === currLinkIdx);
+ window.parent.deleteLinkByIdx(currLinkIdx);
window.parent.document.getElementById('linkProfileFrame').contentWindow.refreshLinkData('delete');
refreshLinkData('delete');
}
function zoomToLink(e) {
if (e) { e.stopPropagation(); }
window.parent.document.getElementById('linkOptions').style.display = 'none';
- window.parent.zoomToLinkByIdx(currLink);
+ window.parent.zoomToLinkByIdx(currLinkIdx);
}
\ No newline at end of file
diff --git a/software/cnip/cnip/cnip/Scripts/cnip/webui/dialogs/linkprofile.js b/software/cnip/cnip/cnip/Scripts/cnip/webui/dialogs/linkprofile.js
new file mode 100644
index 0000000000..9161add810
--- /dev/null
+++ b/software/cnip/cnip/cnip/Scripts/cnip/webui/dialogs/linkprofile.js
@@ -0,0 +1,757 @@
+/* global variables*/
+var userDisplay = false;
+var linkData;
+var siteAData;
+var siteBData;
+var linksCount;
+var currLinkIdx;
+var elevChart;
+var deleteLinkIdx = -1;
+
+initSingleSlider(document.getElementById('dheighta'), '', '0', '100', '0.5', '0');
+initSingleSlider(document.getElementById('dheightb'), '', '0', '100', '0.5', '0');
+initSingleSlider(document.getElementById('dfrequencya'), '', '1', '15', '0.1', '5');
+initSingleSlider(document.getElementById('dchannelwidtha'), '', '10', '100', '10', '10');
+initSingleSlider(document.getElementById('doutputpowera'), '', '27', '47', '0.5', '30');
+initSingleSlider(document.getElementById('dantennagaina'), '', '19', '51', '0.1', '34');
+initSingleSlider(document.getElementById('dlossesa'), '', '0', '51', '0.1', '0');
+initSingleSlider(document.getElementById('dfrequencyb'), '', '1', '15', '0.1', '5');
+initSingleSlider(document.getElementById('dchannelwidthb'), '', '10', '100', '10', '10');
+initSingleSlider(document.getElementById('doutputpowerb'), '', '27', '47', '0.5', '30');
+initSingleSlider(document.getElementById('dantennagainb'), '', '19', '51', '0.1', '34');
+initSingleSlider(document.getElementById('dlossesb'), '', '0', '51', '0.1', '0');
+
+document.getElementById('linkname').addEventListener('change', linkNameChange);
+document.getElementById('dheighta').addEventListener('change', heightAChange);
+document.getElementById('dfrequencya').addEventListener('change', frequencyAChange);
+document.getElementById('dchannelwidtha').addEventListener('change', channelwidthAChange);
+document.getElementById('doutputpowera').addEventListener('change', outputpowerAChange);
+document.getElementById('dantennagaina').addEventListener('change', antennagainAChange);
+document.getElementById('dlossesa').addEventListener('change', lossesAChange);
+document.getElementById('dheightb').addEventListener('change', heightBChange);
+document.getElementById('dfrequencyb').addEventListener('change', frequencyBChange);
+document.getElementById('dchannelwidthb').addEventListener('change', channelwidthBChange);
+document.getElementById('doutputpowerb').addEventListener('change', outputpowerBChange);
+document.getElementById('dantennagainb').addEventListener('change', antennagainBChange);
+document.getElementById('dlossesb').addEventListener('change', lossesBChange);
+
+function frequencyAChange(e) {
+ document.getElementById('frequencya').value = Number(document.getElementById('dfrequencya').value);
+ saveLinkData(e);
+}
+function channelwidthAChange(e) {
+ document.getElementById('channelwidtha').value = Number(document.getElementById('dchannelwidtha').value);
+ saveLinkData(e);
+}
+function outputpowerAChange(e) {
+ document.getElementById('outputpowera').value = Number(document.getElementById('doutputpowera').value);
+ saveLinkData(e);
+}
+function antennagainAChange(e) {
+ document.getElementById('antennagaina').value = Number(document.getElementById('dantennagaina').value);
+ saveLinkData(e);
+}
+function lossesAChange(e) {
+ document.getElementById('lossesa').value = Number(document.getElementById('dlossesa').value);
+ saveLinkData(e);
+}
+function frequencyBChange(e) {
+ document.getElementById('frequencyb').value = Number(document.getElementById('dfrequencyb').value);
+ saveLinkData(e);
+}
+function channelwidthBChange(e) {
+ document.getElementById('channelwidthb').value = Number(document.getElementById('dchannelwidthb').value);
+ saveLinkData(e);
+}
+function outputpowerBChange(e) {
+ document.getElementById('outputpowerb').value = Number(document.getElementById('doutputpowerb').value);
+ saveLinkData(e);
+}
+function antennagainBChange(e) {
+ document.getElementById('antennagainb').value = Number(document.getElementById('dantennagainb').value);
+ saveLinkData(e);
+}
+function lossesBChange(e) {
+ document.getElementById('lossesb').value = Number(document.getElementById('dlossesb').value);
+ saveLinkData(e);
+}
+function linkNameChange(e) {
+ document.getElementById('linkname').value = fixStringName(document.getElementById('linkname').value);
+ saveLinkData(e);
+}
+function heightAChange(e) {
+ // height of site a siteAData[4];
+ document.getElementById('heighta').value = Number(document.getElementById('dheighta').value);
+ if (Number(siteAData[4] === undefined ? '' : siteAData[4].toString()) < Number(document.getElementById('heighta').value)) {
+ window.parent.updateSiteHeightById((siteAData[0] === undefined ? '' : siteAData[0].toString()), document.getElementById('heighta').value);
+ }
+ saveLinkData(e, true);
+}
+function heightBChange(e) {
+ // height of site b siteBData[4];
+ document.getElementById('heightb').value = Number(document.getElementById('dheightb').value);
+ if (document.getElementById('linktype').innerHTML === 'public') {
+ if (Number(siteBData[4] === undefined ? '' : siteBData[4].toString()) < Number(document.getElementById('heightb').value)) {
+ document.getElementById('heightb').value = Number(siteBData[4] === undefined ? '' : siteBData[4].toString());
+ }
+ }
+ else {
+ if (Number(siteBData[4] === undefined ? '' : siteBData[4].toString()) < Number(document.getElementById('heightb').value)) {
+ window.parent.updateSiteHeightById((siteBData[0] === undefined ? '' : siteBData[0].toString()), document.getElementById('heightb').value);
+ }
+ }
+ saveLinkData(e, true);
+}
+/* char js global setup */
+Chart.defaults.global.pointHitDetectionRadius = 1;
+Chart.defaults.LineWithLine = Chart.defaults.line;
+Chart.controllers.LineWithLine = Chart.controllers.line.extend({
+ draw: function (ease) {
+ Chart.controllers.line.prototype.draw.call(this, ease);
+ if (this.chart.tooltip._active && this.chart.tooltip._active.length) {
+ let activePoint = this.chart.tooltip._active[0],
+ ctx = this.chart.ctx,
+ x = activePoint.tooltipPosition().x,
+ topY = this.chart.legend.bottom,
+ bottomY = this.chart.chartArea.bottom;
+ ctx.save();
+ ctx.beginPath();
+ ctx.moveTo(x, topY);
+ ctx.lineTo(x, bottomY);
+ ctx.lineWidth = 1;
+ ctx.strokeStyle = '#07C';
+ ctx.stroke();
+ ctx.restore();
+ }
+ }
+});
+var customTooltips = function (tooltip) {
+ let tooltipEl = document.getElementById('chartjs-tooltip');
+ if (!tooltipEl) {
+ tooltipEl = document.createElement('div');
+ tooltipEl.id = 'chartjs-tooltip';
+ tooltipEl.innerHTML = '';
+ this._chart.canvas.parentNode.appendChild(tooltipEl);
+ }
+ if (tooltip.opacity === 0) {
+ tooltipEl.style.opacity = 0;
+ return;
+ }
+ tooltipEl.classList.remove('above', 'below', 'no-transform');
+ if (tooltip.yAlign) {
+ tooltipEl.classList.add(tooltip.yAlign);
+ } else {
+ tooltipEl.classList.add('no-transform');
+ }
+ function getBody(bodyItem) {
+ return bodyItem.lines;
+ }
+ if (tooltip.body) {
+ let titleLines = tooltip.title || [];
+ let bodyLines = tooltip.body.map(getBody);
+ let tDistance, tElevation, tLosHeight, tFreznelZone;
+ titleLines.forEach(function (title) {
+ tDistance = round(Number(title), 2);
+ });
+ bodyLines.forEach(function (body, i) {
+ if (body) {
+ if (body[0].includes('Elevation')) tElevation = Number(body[0].split(':')[1]);
+ if (body[0].includes('LosHeight')) tLosHeight = Number(body[0].split(':')[1]);
+ if (body[0].includes('FresnelZone')) tFresnelZone = Number(body[0].split(':')[1]);
+ }
+ });
+ let innerHtml = '';
+ innerHtml += ' ';
+ innerHtml += ' ';
+ if (tDistance !== undefined && tElevation !== undefined && tLosHeight !== undefined && tFresnelZone !== undefined) {
+ innerHtml += 'Distance (Km): ' + tDistance.toString() + ' ';
+ innerHtml += 'Elevation (m): ' + tElevation.toString() + ' ';
+ innerHtml += 'Los Height (m): ' + round(tLosHeight - tElevation, 2).toString() + ' ';
+ innerHtml += 'Fresnel Height (m): ' + round(tFresnelZone - tElevation, 2).toString() + ' ';
+ }
+ innerHtml += ' ';
+ let tableRoot = tooltipEl.querySelector('table');
+ tableRoot.innerHTML = innerHtml;
+ }
+ let positionY = this._chart.canvas.offsetTop;
+ let positionX = this._chart.canvas.offsetLeft;
+ tooltipEl.style.opacity = 1;
+ tooltipEl.style.left = positionX + tooltip.caretX + 161 + 'px';
+ tooltipEl.style.top = positionY + tooltip.caretY - 50 + 'px';
+ tooltipEl.style.fontFamily = tooltip._bodyFontFamily;
+ tooltipEl.style.fontSize = tooltip.bodyFontSize + 'px';
+ tooltipEl.style.fontStyle = tooltip._bodyFontStyle;
+ tooltipEl.style.padding = tooltip.yPadding + 'px ' + tooltip.xPadding + 'px';
+};
+/* linkprofile functions*/
+function fillLinkData(linkData, refreshGraph) {
+
+ document.getElementById('dheighta').setValue(linkData[5] === undefined ? '' : linkData[5].toString());
+ document.getElementById('dchannelwidtha').setValue(linkData[7] === undefined ? '' : linkData[7].toString());
+ document.getElementById('dfrequencya').setValue(linkData[8] === undefined ? '' : linkData[8].toString());
+ document.getElementById('doutputpowera').setValue(linkData[9] === undefined ? '' : linkData[9].toString());
+ document.getElementById('dantennagaina').setValue(linkData[10] === undefined ? '' : linkData[10].toString());
+ document.getElementById('dlossesa').setValue(linkData[11] === undefined ? '' : linkData[11].toString());
+ document.getElementById('dheightb').setValue(linkData[14] === undefined ? '' : linkData[14].toString());
+ document.getElementById('dchannelwidthb').setValue(linkData[16] === undefined ? '' : linkData[16].toString());
+ document.getElementById('dfrequencyb').setValue(linkData[17] === undefined ? '' : linkData[17].toString());
+ document.getElementById('doutputpowerb').setValue(linkData[18] === undefined ? '' : linkData[18].toString());
+ document.getElementById('dantennagainb').setValue(linkData[19] === undefined ? '' : linkData[19].toString());
+ document.getElementById('dlossesb').setValue(linkData[20] === undefined ? '' : linkData[20].toString());
+
+ document.getElementById('linkid').innerHTML = linkData[0].toString();
+ document.getElementById('linkname').value = linkData[1] === undefined ? '' : linkData[1].toString();
+ document.getElementById('linktype').innerHTML = linkData[2] === undefined ? '' : linkData[2].toString();
+ let linktype = linkData[2] === undefined ? '' : linkData[2].toString();
+ if (linktype === 'public') {
+ document.getElementById('sitebp').innerHTML = 'Site B (Public)';
+ document.getElementById('sitebp').style.width = '100px';
+ } else {
+ document.getElementById('sitebp').innerHTML = 'Site B';
+ document.getElementById('sitebp').style.width = '50px';
+ }
+ document.getElementById('siteida').value = linkData[3] === undefined ? '' : linkData[3].toString();
+ document.getElementById('sitenamea').value = siteAData[1] === undefined ? '' : siteAData[1].toString();
+ document.getElementById('siteheighteleva').value =
+ round(siteAData[4] === undefined ? '' : siteAData[4].toString(), 0).toString() + ' / ' +
+ round(Number(linkData[4] === undefined ? '' : linkData[4].toString()), 0).toString();
+ document.getElementById('heighta').value = linkData[5] === undefined ? '' : linkData[5].toString();
+ document.getElementById('channelwidtha').value = linkData[7] === undefined ? '' : linkData[7].toString();
+ document.getElementById('frequencya').value = linkData[8] === undefined ? '' : linkData[8].toString();
+ document.getElementById('outputpowera').value = linkData[9] === undefined ? '' : linkData[9].toString();
+ document.getElementById('antennagaina').value = linkData[10] === undefined ? '' : linkData[10].toString();
+ document.getElementById('lossesa').value = linkData[11] === undefined ? '' : linkData[11].toString();
+ document.getElementById('siteidb').value = linkData[12] === undefined ? '' : linkData[12].toString();
+ document.getElementById('sitenameb').value = siteBData[1] === undefined ? '' : siteBData[1].toString();
+ document.getElementById('siteheightelevb').value =
+ round(siteBData[4] === undefined ? '' : siteBData[4].toString(), 0).toString() + ' / ' +
+ round(Number(linkData[13] === undefined ? '' : linkData[13].toString()), 0).toString();
+ document.getElementById('heightb').value = linkData[14] === undefined ? '' : linkData[14].toString();
+ document.getElementById('channelwidthb').value = linkData[16] === undefined ? '' : linkData[16].toString();
+ document.getElementById('frequencyb').value = linkData[17] === undefined ? '' : linkData[17].toString();
+ document.getElementById('outputpowerb').value = linkData[18] === undefined ? '' : linkData[18].toString();
+ document.getElementById('antennagainb').value = linkData[19] === undefined ? '' : linkData[19].toString();
+ document.getElementById('lossesb').value = linkData[20] === undefined ? '' : linkData[20].toString();
+ document.getElementById('distance').innerHTML =
+ round(Number(linkData[21] === undefined ? '' : linkData[21].toString()), 1).toString() + ' Km';
+ let xDistanceKm = Number(linkData[21] === undefined ? '' : linkData[21].toString());
+ let deviceheightAm = Number(linkData[5] === undefined ? '' : linkData[5].toString()) +
+ Number(linkData[4] === undefined ? '' : linkData[4].toString());
+ let deviceheightBm = Number(linkData[14] === undefined ? '' : linkData[14].toString()) +
+ Number(linkData[13] === undefined ? '' : linkData[13].toString());
+ let tiltAd = 0; tiltBd = 0;
+ if (deviceheightAm > deviceheightBm) {
+ tiltAd = -1 * round(turf.radiansToDegrees(Math.atan((deviceheightAm - deviceheightBm) / (xDistanceKm * 1000))), 2);
+ tiltBd = round(turf.radiansToDegrees(Math.atan((deviceheightAm - deviceheightBm) / (xDistanceKm * 1000))), 2);
+ } else if (deviceheightAm < deviceheightBm) {
+ tiltAd = round(turf.radiansToDegrees(Math.atan((deviceheightBm - deviceheightAm) / (xDistanceKm * 1000))), 2);
+ tiltBd = -1 * round(turf.radiansToDegrees(Math.atan((deviceheightBm - deviceheightAm) / (xDistanceKm * 1000))), 2);
+ } else {
+ tiltAd = 0; tiltBd = 0;
+ }
+ document.getElementById('headinga').value =
+ round(Number(linkData[6] === undefined ? '' : linkData[6].toString()), 2).toString() + ' / ' + tiltAd;
+ document.getElementById('headingb').value =
+ round(Number(linkData[15] === undefined ? '' : linkData[15].toString()), 2).toString() + ' / ' + tiltBd;
+ let channelwidthMHz = Number(linkData[7] === undefined ? '' : linkData[7].toString());
+ let xFrequencyGHz = Number(linkData[8] === undefined ? '' : linkData[8].toString());
+ let lossesAdB = Number(linkData[11] === undefined ? '' : linkData[11].toString());
+ let lossesBdB = Number(linkData[20] === undefined ? '' : linkData[20].toString());
+ let antennagainAdBi = Number(linkData[10] === undefined ? '' : linkData[10].toString());
+ let antennagainBdBi = Number(linkData[19] === undefined ? '' : linkData[19].toString());
+ let outputpowerAdBm = Number(linkData[9] === undefined ? '' : linkData[9].toString());
+ let outputpowerBdBm = Number(linkData[18] === undefined ? '' : linkData[18].toString());
+ let outputpowerAdBW = outputpowerAdBm - 30;
+ let outputpowerBdBW = outputpowerBdBm - 30;
+ let freespacelossdB = (20 * Math.log10(xDistanceKm)) + (20 * Math.log10(xFrequencyGHz * 1000)) + 32.44;
+ let erpAdBm = outputpowerAdBm + antennagainAdBi - lossesAdB;
+ let erpBdBm = outputpowerBdBm + antennagainBdBi - lossesBdB;
+ let erpAdBW = outputpowerAdBW + antennagainAdBi - lossesAdB;
+ let erpBdBW = outputpowerBdBW + antennagainBdBi - lossesBdB;
+ let rxlevAdBm = erpBdBm - freespacelossdB + antennagainAdBi;
+ let rxlevBdBm = erpAdBm - freespacelossdB + antennagainBdBi;
+ let rxlevAdBW = erpBdBW - freespacelossdB + antennagainAdBi;
+ let rxlevBdBW = erpAdBW - freespacelossdB + antennagainBdBi;
+ let johnsonNoisedBm = -174 + (10 * Math.log10(channelwidthMHz * 1000 * 1000));
+ let johnsonNoisedBW = johnsonNoisedBm - 30;
+ let snrAdB = rxlevAdBW - johnsonNoisedBW;
+ let snrBdB = rxlevBdBW - johnsonNoisedBW;
+ let snrnumberA = Math.pow(10, snrAdB / 10);
+ let snrnumberB = Math.pow(10, snrBdB / 10);
+ let datarateAMbps = ((channelwidthMHz * 1000 * 1000) * Math.log2(1 + snrnumberA)) / 1000000;
+ let datarateBMbps = ((channelwidthMHz * 1000 * 1000) * Math.log2(1 + snrnumberB)) / 1000000;
+ if (document.getElementById('connectivityInfo').innerHTML === 'Link Obstructed') {
+ document.getElementById('effca').innerHTML = '';
+ document.getElementById('ratea').innerHTML = '';
+ document.getElementById('leva').innerHTML = '';
+ document.getElementById('effcb').innerHTML = '';
+ document.getElementById('rateb').innerHTML = '';
+ document.getElementById('levb').innerHTML = '';
+ }
+ else {
+ document.getElementById('effca').innerHTML = '';
+ document.getElementById('ratea').innerHTML = round(datarateAMbps, 0);
+ document.getElementById('leva').innerHTML = round(rxlevAdBm, 0);
+ document.getElementById('effcb').innerHTML = '';
+ document.getElementById('rateb').innerHTML = round(datarateBMbps, 0);
+ document.getElementById('levb').innerHTML = round(rxlevBdBm, 0);
+ }
+ if (refreshGraph) {
+ let losBreak = false;
+ let xElevations = linkData[22] === undefined ? '' : linkData[22].toString().split('@');
+ let xDataset = [];
+ let minYaxis = 50000;
+ let fzoneBreak = false;
+ let f6zoneBreak = false;
+ for (let x = 0; x < xElevations.length; x++) {
+ let xElevationm = Number(xElevations[x].split('&')[3]);
+ let xCdistanceKm = Number(xElevations[x].split('&')[2]);
+ if (minYaxis > xElevationm) { minYaxis = xElevationm; }
+ let xLoS = ((x * (deviceheightBm - deviceheightAm)) /
+ (xElevations.length)) + deviceheightAm;
+ let xMaxx = xElevations.length - 1;
+ let xFresnelFactor = 17.3 * Math.sqrt((xCdistanceKm *
+ (xDistanceKm - xCdistanceKm)) / (xDistanceKm * xFrequencyGHz));
+ let xFresnelZone = xLoS - xFresnelFactor;
+ let xFZTop = xLoS + xFresnelFactor;
+ let xFZ6 = xLoS - (xFresnelFactor * 0.6);
+ let xFZ6Top = xLoS + (xFresnelFactor * 0.6);
+ if (xLoS - xElevationm < 0) { losBreak = true; }
+ if (xFresnelZone - xElevationm < 0) { fzoneBreak = true; }
+ if (xFZ6 - xElevationm < 0) { f6zoneBreak = true; }
+ xDataset.push({
+ Tower: (x === 0 ? deviceheightAm : x === xMaxx ? deviceheightBm : xElevationm),
+ TowerBackgroundColor: (x === 0 ? 'rgba(57,204,100,1)' :
+ x === xMaxx ? 'rgba(57,204,100,1)' : 'rgba(57,204,100,0)'),
+ TowerBorderColor: (x === 0 ? 'rgba(57,204,100,1)' :
+ x === xMaxx ? 'rgba(57,204,100,1)' : 'rgba(57,204,100,0)'),
+ TowerBorderWidth: (x === 0 ? 6 : x === xMaxx ? 6 : 3),
+ TowerBarThickness: (x === 0 ? 6 : x === xMaxx ? 6 : 3),
+ Location: [Number(xElevations[x].split('&')[0]), Number(xElevations[x].split('&')[1])],
+ Distance: xCdistanceKm,
+ Elevation: xElevationm,
+ LoS: xLoS,
+ FresnelZone: xFresnelZone,
+ FZTop: xFZTop,
+ FZ6: xFZ6,
+ FZ6Top: xFZ6Top
+ });
+ }
+ if (!losBreak) {
+ document.getElementById('effca').innerHTML = '';
+ document.getElementById('ratea').innerHTML = round(datarateAMbps, 0);
+ document.getElementById('leva').innerHTML = round(rxlevAdBm, 0);
+ document.getElementById('effcb').innerHTML = '';
+ document.getElementById('rateb').innerHTML = round(datarateBMbps, 0);
+ document.getElementById('levb').innerHTML = round(rxlevBdBm, 0);
+ document.getElementById('connectivityInfo').innerHTML = '';
+ }
+ else {
+ document.getElementById('effca').innerHTML = '';
+ document.getElementById('ratea').innerHTML = '';
+ document.getElementById('leva').innerHTML = '';
+ document.getElementById('effcb').innerHTML = '';
+ document.getElementById('rateb').innerHTML = '';
+ document.getElementById('levb').innerHTML = '';
+ document.getElementById('connectivityInfo').innerHTML = 'Link Obstructed';
+ }
+ let chartData = {
+ labels: xDataset.map(d => d.Distance),
+ datasets: [
+ {
+ type: 'bar',
+ label: 'Towers',
+ data: xDataset.map(d => d.Tower),
+ backgroundColor: xDataset.map(d => d.TowerBackgroundColor),
+ borderColor: xDataset.map(d => d.TowerBorderColor),
+ borderWidth: xDataset.map(d => d.TowerBorderWidth),
+ barThickness: xDataset.map(d => d.TowerBarThickness)
+ }, {
+ label: 'Location',
+ data: xDataset.map(d => d.Location),
+ showLine: false
+ }, {
+ label: 'Elevation',
+ data: xDataset.map(d => d.Elevation),
+ borderWidth: 0,
+ pointRadius: 0
+ }, {
+ label: 'LosHeight',
+ data: xDataset.map(d => d.LoS),
+ borderWidth: 2,
+ pointRadius: 1,
+ borderColor: losBreak ? 'rgba(255, 0, 0, 0.7)' : 'rgba(114,119,122,1)',
+ fill: false
+ }, {
+ label: 'FresnelZone',
+ data: xDataset.map(d => d.FresnelZone),
+ borderWidth: 1,
+ pointRadius: 0,
+ fill: false,
+ borderColor: fzoneBreak ? 'rgba(255,165,0,1)' : 'rgba(0,255,0,1)'
+ }, {
+ label: 'FZTop',
+ data: xDataset.map(d => d.FZTop),
+ borderWidth: 1,
+ pointRadius: 0,
+ fill: false,
+ borderColor: fzoneBreak ? 'rgba(255,165,0,1)' : 'rgba(0,255,0,1)'
+ }, {
+ label: 'FZ6',
+ data: xDataset.map(d => d.FZ6),
+ borderWidth: 1,
+ pointRadius: 0,
+ fill: false,
+ borderColor: f6zoneBreak ? 'rgba(255,165,0,1)' : 'rgba(0,255,0,1)',
+ borderDash: [7, 7]
+ }, {
+ label: 'FZ6Top',
+ data: xDataset.map(d => d.FZ6Top),
+ borderWidth: 1,
+ pointRadius: 0,
+ fill: false,
+ borderColor: f6zoneBreak ? 'rgba(255,165,0,1)' : 'rgba(0,255,0,1)',
+ borderDash: [7, 7]
+ }]
+ };
+ let elevChartContext = document.getElementById('chart1').getContext('2d');
+ if (elevChart) { elevChart.destroy(); }
+ elevChart = new Chart(elevChartContext, {
+ type: 'LineWithLine',
+ data: chartData,
+ options: {
+ animation: {
+ duration: 0
+ },
+ responsive: false,
+ tooltips: {
+ enabled: false,
+ mode: 'index',
+ intersect: false,
+ custom: customTooltips
+ },
+ hover: {
+ mode: 'index',
+ intersect: false
+ },
+ onHover: function (e, elements) {
+ if (e) { e.stopPropagation(); }
+ if (elements) {
+ if (elements.length > 0) {
+ if (elements[0]._index) {
+ $("#chart1").css("cursor", elements[0] ? "pointer" : "default");
+ window.parent.highlightPoint(
+ elevChart.data.datasets[1].data[elements[0]._index]);
+ }
+ }
+ }
+ },
+ legend: {
+ display: false
+ },
+ scales: {
+ xAxes: [{
+ display: false
+ }],
+ yAxes: [{
+ display: false,
+ ticks: {
+ min: minYaxis
+ }
+ }]
+ }
+ }
+ });
+ }
+}
+function saveLinkData(e, refreshGraph = false) {
+ if (e) { e.stopPropagation(); }
+ window.parent.updateLinkDataByIdx({
+ idx: currLinkIdx,
+ linkname: document.getElementById('linkname').value,
+ heighta: document.getElementById('heighta').value,
+ channelwidtha: document.getElementById('channelwidtha').value,
+ frequencya: document.getElementById('frequencya').value,
+ outputpowera: document.getElementById('outputpowera').value,
+ antennagaina: document.getElementById('antennagaina').value,
+ lossesa: document.getElementById('lossesa').value,
+ heightb: document.getElementById('heightb').value,
+ channelwidthb: document.getElementById('channelwidthb').value,
+ frequencyb: document.getElementById('frequencyb').value,
+ outputpowerb: document.getElementById('outputpowerb').value,
+ antennagainb: document.getElementById('antennagainb').value,
+ lossesb: document.getElementById('lossesb').value
+ });
+ window.parent.document.getElementById('linkOptionsFrame').contentWindow.refreshLinkData('cursor');
+ window.parent.document.getElementById('siteOptionsFrame').contentWindow.refreshSiteData('cursor');
+ refreshLinkData('cursor', null, refreshGraph);
+}
+function refreshLinkData(refreshType, Idx = null, refreshGraph = true) {
+ let currLinkId = linkData === undefined ? '0' : linkData[0].toString();
+ linkData = undefined; linksCount = '0';
+ linksCount = window.parent.getLinksCount();
+ if (Idx !== null) { currLinkIdx = Idx.toString(); } else {
+ if (refreshType === 'start') {
+ if (Number(linksCount) > 0) {
+ currLinkIdx = window.parent.sLinksTree[0][0].toString();
+ } else { currLinkIdx = '-1'; }
+ }
+ else if (refreshType === 'add') { /* add */
+ if (Number(linksCount) > 0) {
+ currLinkIdx = window.parent.sLinksTree[Number(linksCount) - 1][0].toString();
+ } else { currLinkIdx = '-1'; }
+ }
+ else if (refreshType === 'cursor') { /* update */
+ if (Number(linksCount) > 0) {
+ currLinkIdx = window.parent.getLinkIdxById(currLinkId).toString();
+ } else { currLinkIdx = '-1'; }
+ }
+ else if (refreshType === 'delete') /*delete*/ {
+ if (Number(linksCount) > 0) {
+ if (deleteLinkIdx > Number(linksCount) - 1) {
+ currLinkIdx = window.parent.sLinksTree[Number(linksCount) - 1][0].toString();
+ } else {
+ if (deleteLinkIdx > -1) {
+ currLinkIdx = window.parent.sLinksTree[deleteLinkIdx][0].toString();
+ } else { currLinkIdx = '-1'; }
+ }
+ } else { currLinkIdx = '-1'; }
+ }
+ }
+ linkData = window.parent.getLinkProfileByIdx(currLinkIdx).split('\t');
+ let linktype = linkData[2] === undefined ? '' : linkData[2].toString();
+ let siteida = linkData[3] === undefined ? -1 : linkData[3].toString();
+ let siteidb = linkData[12] === undefined ? -1 : linkData[12].toString();
+ let email = linkData[24] === undefined ? '' : linkData[24].toString();
+ siteAData = window.parent.getSiteDataById(siteida).split('\t');
+ if (linktype === 'public') {
+ siteBData = window.parent.getPublicSiteData(siteidb, email).split('\t');
+ } else {
+ siteBData = window.parent.getSiteDataById(siteidb).split('\t');
+ }
+ fillLinkData(linkData, refreshGraph);
+}
+function refreshLinkDataById(linkid) {
+ refreshLinkData('', window.parent.getLinkIdxById(linkid).toString());
+}
+function pop(item) {
+ switch (item) {
+ case 'heighta':
+ document.getElementById('ddfrequencya').style.display = 'none';
+ document.getElementById('ddchannelwidtha').style.display = 'none';
+ document.getElementById('ddoutputpowera').style.display = 'none';
+ document.getElementById('ddantennagaina').style.display = 'none';
+ document.getElementById('ddlossesa').style.display = 'none';
+ document.getElementById('ddfrequencyb').style.display = 'none';
+ document.getElementById('ddchannelwidthb').style.display = 'none';
+ document.getElementById('ddoutputpowerb').style.display = 'none';
+ document.getElementById('ddantennagainb').style.display = 'none';
+ document.getElementById('ddlossesb').style.display = 'none';
+ document.getElementById('ddheightb').style.display = 'none';
+ if (document.getElementById('ddheighta').style.display === 'none') {
+ document.getElementById('ddheighta').style.display = 'block';
+ } else {
+ document.getElementById('ddheighta').style.display = 'none';
+ }
+ break;
+ case 'heightb':
+ document.getElementById('ddfrequencya').style.display = 'none';
+ document.getElementById('ddchannelwidtha').style.display = 'none';
+ document.getElementById('ddoutputpowera').style.display = 'none';
+ document.getElementById('ddantennagaina').style.display = 'none';
+ document.getElementById('ddlossesa').style.display = 'none';
+ document.getElementById('ddfrequencyb').style.display = 'none';
+ document.getElementById('ddchannelwidthb').style.display = 'none';
+ document.getElementById('ddoutputpowerb').style.display = 'none';
+ document.getElementById('ddantennagainb').style.display = 'none';
+ document.getElementById('ddlossesb').style.display = 'none';
+ document.getElementById('ddheighta').style.display = 'none';
+ if (document.getElementById('ddheightb').style.display === 'none') {
+ document.getElementById('ddheightb').style.display = 'block';
+ } else {
+ document.getElementById('ddheightb').style.display = 'none';
+ }
+ break;
+ case 'frequencya':
+ document.getElementById('ddchannelwidtha').style.display = 'none';
+ document.getElementById('ddoutputpowera').style.display = 'none';
+ document.getElementById('ddantennagaina').style.display = 'none';
+ document.getElementById('ddlossesa').style.display = 'none';
+ document.getElementById('ddfrequencyb').style.display = 'none';
+ document.getElementById('ddchannelwidthb').style.display = 'none';
+ document.getElementById('ddoutputpowerb').style.display = 'none';
+ document.getElementById('ddantennagainb').style.display = 'none';
+ document.getElementById('ddlossesb').style.display = 'none';
+ document.getElementById('ddheighta').style.display = 'none';
+ document.getElementById('ddheightb').style.display = 'none';
+ if (document.getElementById('ddfrequencya').style.display === 'none') {
+ document.getElementById('ddfrequencya').style.display = 'block';
+ } else {
+ document.getElementById('ddfrequencya').style.display = 'none';
+ }
+ break;
+ case 'channelwidtha':
+ document.getElementById('ddfrequencya').style.display = 'none';
+ document.getElementById('ddoutputpowera').style.display = 'none';
+ document.getElementById('ddantennagaina').style.display = 'none';
+ document.getElementById('ddlossesa').style.display = 'none';
+ document.getElementById('ddfrequencyb').style.display = 'none';
+ document.getElementById('ddchannelwidthb').style.display = 'none';
+ document.getElementById('ddoutputpowerb').style.display = 'none';
+ document.getElementById('ddantennagainb').style.display = 'none';
+ document.getElementById('ddlossesb').style.display = 'none';
+ document.getElementById('ddheighta').style.display = 'none';
+ document.getElementById('ddheightb').style.display = 'none';
+ if (document.getElementById('ddchannelwidtha').style.display === 'none') {
+ document.getElementById('ddchannelwidtha').style.display = 'block';
+ } else {
+ document.getElementById('ddchannelwidtha').style.display = 'none';
+ }
+ break;
+ case 'outputpowera':
+ document.getElementById('ddchannelwidtha').style.display = 'none';
+ document.getElementById('ddfrequencya').style.display = 'none';
+ document.getElementById('ddantennagaina').style.display = 'none';
+ document.getElementById('ddlossesa').style.display = 'none';
+ document.getElementById('ddfrequencyb').style.display = 'none';
+ document.getElementById('ddchannelwidthb').style.display = 'none';
+ document.getElementById('ddoutputpowerb').style.display = 'none';
+ document.getElementById('ddantennagainb').style.display = 'none';
+ document.getElementById('ddlossesb').style.display = 'none';
+ document.getElementById('ddheighta').style.display = 'none';
+ document.getElementById('ddheightb').style.display = 'none';
+ if (document.getElementById('ddoutputpowera').style.display === 'none') {
+ document.getElementById('ddoutputpowera').style.display = 'block';
+ } else {
+ document.getElementById('ddoutputpowera').style.display = 'none';
+ }
+ break;
+ case 'antennagaina':
+ document.getElementById('ddchannelwidtha').style.display = 'none';
+ document.getElementById('ddoutputpowera').style.display = 'none';
+ document.getElementById('ddfrequencya').style.display = 'none';
+ document.getElementById('ddlossesa').style.display = 'none';
+ document.getElementById('ddfrequencyb').style.display = 'none';
+ document.getElementById('ddchannelwidthb').style.display = 'none';
+ document.getElementById('ddoutputpowerb').style.display = 'none';
+ document.getElementById('ddantennagainb').style.display = 'none';
+ document.getElementById('ddlossesb').style.display = 'none';
+ document.getElementById('ddheighta').style.display = 'none';
+ document.getElementById('ddheightb').style.display = 'none';
+ if (document.getElementById('ddantennagaina').style.display === 'none') {
+ document.getElementById('ddantennagaina').style.display = 'block';
+ } else {
+ document.getElementById('ddantennagaina').style.display = 'none';
+ }
+ break;
+ case 'lossesa':
+ document.getElementById('ddchannelwidtha').style.display = 'none';
+ document.getElementById('ddoutputpowera').style.display = 'none';
+ document.getElementById('ddantennagaina').style.display = 'none';
+ document.getElementById('ddfrequencya').style.display = 'none';
+ document.getElementById('ddfrequencyb').style.display = 'none';
+ document.getElementById('ddchannelwidthb').style.display = 'none';
+ document.getElementById('ddoutputpowerb').style.display = 'none';
+ document.getElementById('ddantennagainb').style.display = 'none';
+ document.getElementById('ddlossesb').style.display = 'none';
+ document.getElementById('ddheighta').style.display = 'none';
+ document.getElementById('ddheightb').style.display = 'none';
+ if (document.getElementById('ddlossesa').style.display === 'none') {
+ document.getElementById('ddlossesa').style.display = 'block';
+ } else {
+ document.getElementById('ddlossesa').style.display = 'none';
+ }
+ break;
+ case 'frequencyb':
+ document.getElementById('ddchannelwidthb').style.display = 'none';
+ document.getElementById('ddoutputpowerb').style.display = 'none';
+ document.getElementById('ddantennagainb').style.display = 'none';
+ document.getElementById('ddlossesb').style.display = 'none';
+ document.getElementById('ddfrequencya').style.display = 'none';
+ document.getElementById('ddchannelwidtha').style.display = 'none';
+ document.getElementById('ddoutputpowera').style.display = 'none';
+ document.getElementById('ddantennagaina').style.display = 'none';
+ document.getElementById('ddlossesa').style.display = 'none';
+ document.getElementById('ddheighta').style.display = 'none';
+ document.getElementById('ddheightb').style.display = 'none';
+ if (document.getElementById('ddfrequencyb').style.display === 'none') {
+ document.getElementById('ddfrequencyb').style.display = 'block';
+ } else {
+ document.getElementById('ddfrequencyb').style.display = 'none';
+ }
+ break;
+ case 'channelwidthb':
+ document.getElementById('ddfrequencyb').style.display = 'none';
+ document.getElementById('ddoutputpowerb').style.display = 'none';
+ document.getElementById('ddantennagainb').style.display = 'none';
+ document.getElementById('ddlossesb').style.display = 'none';
+ document.getElementById('ddfrequencya').style.display = 'none';
+ document.getElementById('ddchannelwidtha').style.display = 'none';
+ document.getElementById('ddoutputpowera').style.display = 'none';
+ document.getElementById('ddantennagaina').style.display = 'none';
+ document.getElementById('ddlossesa').style.display = 'none';
+ document.getElementById('ddheighta').style.display = 'none';
+ document.getElementById('ddheightb').style.display = 'none';
+ if (document.getElementById('ddchannelwidthb').style.display === 'none') {
+ document.getElementById('ddchannelwidthb').style.display = 'block';
+ } else {
+ document.getElementById('ddchannelwidthb').style.display = 'none';
+ }
+ break;
+ case 'outputpowerb':
+ document.getElementById('ddchannelwidthb').style.display = 'none';
+ document.getElementById('ddfrequencyb').style.display = 'none';
+ document.getElementById('ddantennagainb').style.display = 'none';
+ document.getElementById('ddlossesb').style.display = 'none';
+ document.getElementById('ddfrequencya').style.display = 'none';
+ document.getElementById('ddchannelwidtha').style.display = 'none';
+ document.getElementById('ddoutputpowera').style.display = 'none';
+ document.getElementById('ddantennagaina').style.display = 'none';
+ document.getElementById('ddlossesa').style.display = 'none';
+ document.getElementById('ddheighta').style.display = 'none';
+ document.getElementById('ddheightb').style.display = 'none';
+ if (document.getElementById('ddoutputpowerb').style.display === 'none') {
+ document.getElementById('ddoutputpowerb').style.display = 'block';
+ } else {
+ document.getElementById('ddoutputpowerb').style.display = 'none';
+ }
+ break;
+ case 'antennagainb':
+ document.getElementById('ddchannelwidthb').style.display = 'none';
+ document.getElementById('ddoutputpowerb').style.display = 'none';
+ document.getElementById('ddfrequencyb').style.display = 'none';
+ document.getElementById('ddlossesb').style.display = 'none';
+ document.getElementById('ddfrequencya').style.display = 'none';
+ document.getElementById('ddchannelwidtha').style.display = 'none';
+ document.getElementById('ddoutputpowera').style.display = 'none';
+ document.getElementById('ddantennagaina').style.display = 'none';
+ document.getElementById('ddlossesa').style.display = 'none';
+ document.getElementById('ddheighta').style.display = 'none';
+ document.getElementById('ddheightb').style.display = 'none';
+ if (document.getElementById('ddantennagainb').style.display === 'none') {
+ document.getElementById('ddantennagainb').style.display = 'block';
+ } else {
+ document.getElementById('ddantennagainb').style.display = 'none';
+ }
+ break;
+ case 'lossesb':
+ document.getElementById('ddchannelwidthb').style.display = 'none';
+ document.getElementById('ddoutputpowerb').style.display = 'none';
+ document.getElementById('ddantennagainb').style.display = 'none';
+ document.getElementById('ddfrequencyb').style.display = 'none';
+ document.getElementById('ddfrequencya').style.display = 'none';
+ document.getElementById('ddchannelwidtha').style.display = 'none';
+ document.getElementById('ddoutputpowera').style.display = 'none';
+ document.getElementById('ddantennagaina').style.display = 'none';
+ document.getElementById('ddlossesa').style.display = 'none';
+ document.getElementById('ddheighta').style.display = 'none';
+ document.getElementById('ddheightb').style.display = 'none';
+ if (document.getElementById('ddlossesb').style.display === 'none') {
+ document.getElementById('ddlossesb').style.display = 'block';
+ } else {
+ document.getElementById('ddlossesb').style.display = 'none';
+ }
+ break;
+ default: break;
+ }
+}
\ No newline at end of file
diff --git a/software/cnip/cnip/Scripts/cnip/webui/dialogs/noteoptions.js b/software/cnip/cnip/cnip/Scripts/cnip/webui/dialogs/noteoptions.js
similarity index 52%
rename from software/cnip/cnip/Scripts/cnip/webui/dialogs/noteoptions.js
rename to software/cnip/cnip/cnip/Scripts/cnip/webui/dialogs/noteoptions.js
index 4613a25f8e..922b146a93 100644
--- a/software/cnip/cnip/Scripts/cnip/webui/dialogs/noteoptions.js
+++ b/software/cnip/cnip/cnip/Scripts/cnip/webui/dialogs/noteoptions.js
@@ -2,7 +2,8 @@
var userDisplay = false;
var noteData;
var notesCount;
-var currNote;
+var currNoteIdx;
+var deleteNoteIdx = -1;
/* setup listeners*/
$('#description').keypress(function (event) {
if (event.keyCode === 13) {
@@ -10,7 +11,7 @@ $('#description').keypress(function (event) {
}
});
document.getElementById('defaultOpen').click();
-initSelectOpt(document.getElementById('notetype'), '100%', 'Public\tPrivate', 'Public');
+initSelectOpt(document.getElementById('notetype'), '100%', 'public\tprivate', 'public');
document.getElementById('notename').addEventListener('change', noteNameChange);
document.getElementById('notetype').addEventListener('change', saveNoteData);
document.getElementById('description').addEventListener('change', descriptionChange);
@@ -30,25 +31,39 @@ function fillNoteData(noteData) {
document.getElementById('description').value = noteData[3] === undefined ? '' : noteData[3].toString();
}
function refreshNoteData(refreshType, Idx = null) {
- let currNoteId = noteData === undefined ? 0 : noteData[0].toString();
+ let currNoteId = noteData === undefined ? '0' : noteData[0].toString();
noteData = undefined; notesCount = '0';
notesCount = window.parent.getNotesCount();
- if (Idx !== null) { currNote = Idx.toString(); }
+ if (Idx !== null) { currNoteIdx = Idx.toString(); }
else {
- if (refreshType === 'start') { currNote = '0'; }
- else if (refreshType === 'add') {
- currNote = (Number(notesCount) - 1).toString();
+ if (refreshType === 'start') {
+ if (Number(notesCount) > 0) {
+ currNoteIdx = window.parent.sNotesTree[0][0].toString();
+ } else { currNoteIdx = '-1'; }
}
- else if (refreshType === 'cursor') {
- currNote = window.parent.getNoteIdxById(currNoteId).toString();
+ else if (refreshType === 'add') { /* add */
+ if (Number(notesCount) > 0) {
+ currNoteIdx = window.parent.sNotesTree[Number(notesCount) - 1][0].toString();
+ } else { currNoteIdx = '-1'; }
+ }
+ else if (refreshType === 'cursor') { /* update */
+ if (Number(notesCount) > 0) {
+ currNoteIdx = window.parent.getNoteIdxById(currNoteId).toString();
+ } else { currNoteIdx = '-1'; }
}
else if (refreshType === 'delete') /*delete*/ {
- if (Number(currNote) > Number(notesCount) - 1) {
- currNote = (Number(notesCount) - 1).toString();
- }
+ if (Number(notesCount) > 0) {
+ if (deleteNoteIdx > Number(notesCount) - 1) {
+ currNoteIdx = window.parent.sNotesTree[Number(notesCount) - 1][0].toString();
+ } else {
+ if (deleteNoteIdx > -1) {
+ currNoteIdx = window.parent.sNotesTree[deleteNoteIdx][0].toString();
+ } else { currNoteIdx = '-1'; }
+ }
+ } else { currNoteIdx = '-1'; }
}
}
- noteData = window.parent.getNoteDataByIdx(currNote).split('\t');
+ noteData = window.parent.getNoteDataByIdx(currNoteIdx).split('\t');
fillNoteData(noteData);
}
function refreshNoteDataById(noteid) {
@@ -56,14 +71,16 @@ function refreshNoteDataById(noteid) {
}
function nextNote(e) {
if (e) { e.stopPropagation(); }
- if (Number(notesCount) - 1 > Number(currNote)) {
- refreshNoteData('', (Number(currNote) + 1).toString());
+ let sortedIdx = window.parent.sNotesTree.findIndex(x => x[0].toString() === currNoteIdx);
+ if (sortedIdx < Number(notesCount) - 1) {
+ refreshNoteData('', (window.parent.sNotesTree[sortedIdx + 1][0]).toString());
}
}
function previousNote(e) {
if (e) { e.stopPropagation(); }
- if (Number(currNote) > 0) {
- refreshNoteData('', (Number(currNote) - 1).toString());
+ let sortedIdx = window.parent.sNotesTree.findIndex(x => x[0].toString() === currNoteIdx);
+ if (sortedIdx > 0) {
+ refreshNoteData('', (window.parent.sNotesTree[sortedIdx - 1][0]).toString());
}
}
function saveNoteData(e) {
@@ -71,16 +88,17 @@ function saveNoteData(e) {
let notename = document.getElementById('notename').value;
let notetype = document.getElementById('notetype').value;
let description = document.getElementById('description').value;
- window.parent.updateNoteDataByIdx(currNote, notename, notetype, description);
+ window.parent.updateNoteDataByIdx(currNoteIdx, notename, notetype, description);
refreshNoteData('cursor');
}
function deleteNote(e) {
if (e) { e.stopPropagation(); }
- window.parent.deleteNoteByIdx(currNote);
+ deleteNoteIdx = window.parent.sNotesTree.findIndex(x => x[0].toString() === currNoteIdx);
+ window.parent.deleteNoteByIdx(currNoteIdx);
refreshNoteData('delete');
}
function zoomToNote(e) {
if (e) { e.stopPropagation(); }
window.parent.document.getElementById('noteOptions').style.display = 'none';
- window.parent.zoomToNoteByIdx(currNote);
+ window.parent.zoomToNoteByIdx(currNoteIdx);
}
\ No newline at end of file
diff --git a/software/cnip/cnip/cnip/Scripts/cnip/webui/dialogs/polyoptions.js b/software/cnip/cnip/cnip/Scripts/cnip/webui/dialogs/polyoptions.js
new file mode 100644
index 0000000000..6ec07da368
--- /dev/null
+++ b/software/cnip/cnip/cnip/Scripts/cnip/webui/dialogs/polyoptions.js
@@ -0,0 +1,88 @@
+/* global variables*/
+var userDisplay = false;
+var polygonData;
+var polygonsCount;
+var currPolygonIdx;
+var deletePolygonIdx = -1;
+/* setup listeners*/
+document.getElementById('defaultOpen').click();
+document.getElementById('polygonname').addEventListener('change', polygonNameChange);
+function polygonNameChange(e) {
+ document.getElementById('polygonname').value = fixStringName(document.getElementById('polygonname').value);
+ savePolygonData(e);
+}
+/* polyoptions functions*/
+function fillPolygonData(polygonData) {
+ document.getElementById('polygonid').value = polygonData[0].toString();
+ document.getElementById('polygonname').value = polygonData[1] === undefined ? '' : polygonData[1].toString();
+}
+function refreshPolygonData(refreshType, Idx = null) {
+ let currPolygonId = polygonData === undefined ? '0' : polygonData[0].toString();
+ polygonData = undefined; polygonsCount = '0';
+ polygonsCount = window.parent.getPolygonsCount();
+ if (Idx !== null) { currPolygonIdx = Idx.toString(); }
+ else {
+ if (refreshType === 'start') {
+ if (Number(polygonsCount) > 0) {
+ currPolygonIdx = window.parent.sPolygonsTree[0][0].toString();
+ } else { currPolygonIdx = '-1'; }
+ }
+ else if (refreshType === 'add') { /* add */
+ if (Number(polygonsCount) > 0) {
+ currPolygonIdx = window.parent.sPolygonsTree[Number(polygonsCount) - 1][0].toString();
+ } else { currPolygonIdx = '-1'; }
+ }
+ else if (refreshType === 'cursor') { /* update */
+ if (Number(polygonsCount) > 0) {
+ currPolygonIdx = window.parent.getPolygonIdxById(currPolygonId).toString();
+ } else { currPolygonIdx = '-1'; }
+ }
+ else if (refreshType === 'delete') /*delete*/ {
+ if (Number(polygonsCount) > 0) {
+ if (deletePolygonIdx > Number(polygonsCount) - 1) {
+ currPolygonIdx = window.parent.sPolygonsTree[Number(polygonsCount) - 1][0].toString();
+ } else {
+ if (deletePolygonIdx > -1) {
+ currPolygonIdx = window.parent.sPolygonsTree[deletePolygonIdx][0].toString();
+ } else { currPolygonIdx = '-1'; }
+ }
+ } else { currPolygonIdx = '-1'; }
+ }
+ }
+ polygonData = window.parent.getPolygonDataByIdx(currPolygonIdx).split('\t');
+ fillPolygonData(polygonData);
+}
+function refreshPolygonDataById(polygonid) {
+ refreshPolygonData('', window.parent.getPolygonIdxById(polygonid).toString());
+}
+function nextPolygon(e) {
+ if (e) { e.stopPropagation(); }
+ let sortedIdx = window.parent.sPolygonsTree.findIndex(x => x[0].toString() === currPolygonIdx);
+ if (sortedIdx < Number(polygonsCount) - 1) {
+ refreshPolygonData('', (window.parent.sPolygonsTree[sortedIdx + 1][0]).toString());
+ }
+}
+function previousPolygon(e) {
+ if (e) { e.stopPropagation(); }
+ let sortedIdx = window.parent.sPolygonsTree.findIndex(x => x[0].toString() === currPolygonIdx);
+ if (sortedIdx > 0) {
+ refreshPolygonData('', (window.parent.sPolygonsTree[sortedIdx - 1][0]).toString());
+ }
+}
+function savePolygonData(e) {
+ if (e) { e.stopPropagation(); }
+ let polygonname = document.getElementById('polygonname').value;
+ window.parent.updatePolygonDataByIdx(currPolygonIdx, polygonname);
+ refreshPolygonData('cursor');
+}
+function deletePolygon(e) {
+ if (e) { e.stopPropagation(); }
+ deletePolygonIdx = window.parent.sPolygonsTree.findIndex(x => x[0].toString() === currPolygonIdx);
+ window.parent.deletePolygonByIdx(currPolygonIdx);
+ refreshPolygonData('delete');
+}
+function zoomToPolygon(e) {
+ if (e) { e.stopPropagation(); }
+ window.parent.document.getElementById('polyOptions').style.display = 'none';
+ window.parent.zoomToPolygonByIdx(currPolygonIdx);
+}
\ No newline at end of file
diff --git a/software/cnip/cnip/Scripts/cnip/webui/dialogs/predict.js b/software/cnip/cnip/cnip/Scripts/cnip/webui/dialogs/predict.js
similarity index 97%
rename from software/cnip/cnip/Scripts/cnip/webui/dialogs/predict.js
rename to software/cnip/cnip/cnip/Scripts/cnip/webui/dialogs/predict.js
index 7ae68924df..2fb2bbd275 100644
--- a/software/cnip/cnip/Scripts/cnip/webui/dialogs/predict.js
+++ b/software/cnip/cnip/cnip/Scripts/cnip/webui/dialogs/predict.js
@@ -147,9 +147,9 @@
pcList2.id = 'lstBox2pc';
pcList2.className = 'listBox';
pcList2.multiple = 'multiple';
- for (let i = 0; i < sites.length; i++) {
- pcList1Option[i].innerHTML = sites[i].getProperties().sitename;
- pcList1Option[i].value = sites[i].getProperties().siteid;
+ for (let i = 0; i < sNetworkTree.length; i++) {
+ pcList1Option[i].innerHTML = sNetworkTree[i][2].toString();
+ pcList1Option[i].value = sNetworkTree[i][1].toString();
}
pcTransferDiv.className = 'transferButtons';
buttonRight.id = 'btnRightpc';
diff --git a/software/cnip/cnip/Scripts/cnip/webui/dialogs/predictbestcan.js b/software/cnip/cnip/cnip/Scripts/cnip/webui/dialogs/predictbestcan.js
similarity index 96%
rename from software/cnip/cnip/Scripts/cnip/webui/dialogs/predictbestcan.js
rename to software/cnip/cnip/cnip/Scripts/cnip/webui/dialogs/predictbestcan.js
index 2c7bc82900..5b754798b5 100644
--- a/software/cnip/cnip/Scripts/cnip/webui/dialogs/predictbestcan.js
+++ b/software/cnip/cnip/cnip/Scripts/cnip/webui/dialogs/predictbestcan.js
@@ -144,9 +144,9 @@
bcList2.id = 'lstBox2';
bcList2.className = 'listBox';
bcList2.multiple = 'multiple';
- for (let i = 0; i < sites.length; i++) {
- bcList1Option[i].innerHTML = sites[i].getProperties().sitename;
- bcList1Option[i].value = sites[i].getProperties().siteid;
+ for (let i = 0; i < sNetworkTree.length; i++) {
+ bcList1Option[i].innerHTML = sNetworkTree[i][2].toString();
+ bcList1Option[i].value = sNetworkTree[i][1].toString();
}
bcTransferDiv.className = 'transferButtons';
buttonRight.id = 'btnRight';
@@ -162,8 +162,8 @@
let polygons = myPolygonsLayer.getSource().getFeatures();
let polygonslst = "";
- for (let i = 0; i < polygons.length; i++) {
- polygonslst += polygons[i].getProperties().polygonname + '\t';
+ for (let i = 0; i < sPolygonsTree.length; i++) {
+ polygonslst += sPolygonsTree[i][2].toString() + '\t';
}
polygonslst = polygonslst.substr(0, polygonslst.length - 1);
initSelectOpt(bcPolygonDiv, '100%', polygonslst, '');
diff --git a/software/cnip/cnip/Scripts/cnip/webui/dialogs/predictsites.js b/software/cnip/cnip/cnip/Scripts/cnip/webui/dialogs/predictsites.js
similarity index 97%
rename from software/cnip/cnip/Scripts/cnip/webui/dialogs/predictsites.js
rename to software/cnip/cnip/cnip/Scripts/cnip/webui/dialogs/predictsites.js
index 6c6063a27d..d07277bf98 100644
--- a/software/cnip/cnip/Scripts/cnip/webui/dialogs/predictsites.js
+++ b/software/cnip/cnip/cnip/Scripts/cnip/webui/dialogs/predictsites.js
@@ -100,8 +100,8 @@
};
let polygons = myPolygonsLayer.getSource().getFeatures();
let polygonsList = "";
- for (let i = 0; i < polygons.length; i++) {
- polygonsList += polygons[i].getProperties().polygonname + '\t';
+ for (let i = 0; i < sPolygonsTree.length; i++) {
+ polygonsList += sPolygonsTree[i][2].toString() + '\t';
}
polygonsList = polygonsList.substr(0, polygonsList.length - 1);
initSelectOpt(psPolygonDiv, '100%', polygonsList, '');
diff --git a/software/cnip/cnip/Scripts/cnip/webui/dialogs/siteoptions.js b/software/cnip/cnip/cnip/Scripts/cnip/webui/dialogs/siteoptions.js
similarity index 83%
rename from software/cnip/cnip/Scripts/cnip/webui/dialogs/siteoptions.js
rename to software/cnip/cnip/cnip/Scripts/cnip/webui/dialogs/siteoptions.js
index f99c52ef41..036950ddcf 100644
--- a/software/cnip/cnip/Scripts/cnip/webui/dialogs/siteoptions.js
+++ b/software/cnip/cnip/cnip/Scripts/cnip/webui/dialogs/siteoptions.js
@@ -2,7 +2,8 @@
var userDisplay = false;
var siteData;
var sitesCount;
-var currSite;
+var currSiteIdx;
+var deleteSiteIdx = -1;
/* initialize controls*/
document.getElementById('defaultOpen').click();
initSelectOpt(document.getElementById('antennamodel'), '100%', 'LT OD9-5 890-950 MHz\tLT OD9-6 865-945 MHz\tLT OD9-6 860-960 MHz\tLT OD9-8 865-945 MHz\tLT OD9-8 860-960 MHz\tLT OD9-11 860-960 MHz\tLT OD9-11D1 860-960 MHz', 'LT OD9-5 890-950 MHz');
@@ -42,15 +43,15 @@ function propertyChange(e) {
}
function longitudeChange(e) {
document.getElementById('longitude').value = Number(document.getElementById('longitude').value);
- if (document.getElementById('longitude').value.toString() !== siteData[2].toString()) {
- window.parent.deleteLinksBySiteId(siteData[0].toString());
+ if (document.getElementById('longitude').value.toString() !== (siteData[2] === undefined ? '' : siteData[2].toString())) {
+ window.parent.deleteLinksBySiteId(document.getElementById('siteid').value);
}
saveSiteData(e);
}
function latitudeChange(e) {
document.getElementById('latitude').value = Number(document.getElementById('latitude').value);
- if (document.getElementById('latitude').value.toString() !== siteData[3].toString()) {
- window.parent.deleteLinksBySiteId(siteData[0].toString());
+ if (document.getElementById('latitude').value.toString() !== (siteData[3] === undefined ? '' : siteData[3].toString())) {
+ window.parent.deleteLinksBySiteId(document.getElementById('siteid').value);
}
saveSiteData(e);
}
@@ -129,7 +130,7 @@ function rfPowerChange(e) {
}
function hbaChange(e) {
document.getElementById('hba').value = Number(document.getElementById('hba').value);
- if (Number(document.getElementById('hba').value) > Number(document.getElementById('height').value)) {
+ if (Number(document.getElementById('height').value) < Number(document.getElementById('hba').value)) {
document.getElementById('height').value = document.getElementById('hba').value;
}
saveSiteData(e);
@@ -139,6 +140,18 @@ function heightChange(e) {
if (Number(document.getElementById('height').value) < Number(document.getElementById('hba').value)) {
document.getElementById('hba').value = document.getElementById('height').value;
}
+ // find all associated links siteida
+ window.parent.getLinkidsBySiteidA(document.getElementById('siteid').value).split('\t').forEach(function (linkid) {
+ if (Number(linkid) > 0) {
+ window.parent.updateLinkHeightAById(linkid, document.getElementById('height').value);
+ }
+ });
+ // find all associated links siteidb
+ window.parent.getLinkidsBySiteidB(document.getElementById('siteid').value).split('\t').forEach(function (linkid) {
+ if (Number(linkid) > 0) {
+ window.parent.updateLinkHeightBById(linkid, document.getElementById('height').value);
+ }
+ });
saveSiteData(e);
}
function antennaModelChange(e) {
@@ -207,48 +220,64 @@ function fillSiteData(siteData) {
document.getElementById('azimuth').disabled = false;
}
}
-function refreshSiteData(refreshType, Idx = null) {
- let currSiteId = siteData === undefined ? 0 : siteData[0].toString();
- siteData = undefined; sitesCount = '0';
- sitesCount = window.parent.getSitesCount();
- if (Idx !== null) { currSite = Idx.toString(); }
- else {
- if (refreshType === 'start') { currSite = '0'; }
- else if (refreshType === 'add') { /* update */
- currSite = (Number(sitesCount) - 1).toString();
- }
- else if (refreshType === 'cursor') { /* update */
- currSite = window.parent.getSiteIdxById(currSiteId).toString();
- }
- else if (refreshType === 'delete') /*delete*/ {
- if (Number(currSite) > Number(sitesCount) - 1) {
- currSite = (Number(sitesCount) - 1).toString();
- }
- }
- }
- siteData = window.parent.getSiteDataByIdx(currSite).split('\t');
- fillSiteData(siteData);
-}
function refreshSiteDataById(siteid) {
refreshSiteData('', window.parent.getSiteIdxById(siteid).toString());
}
+function refreshSiteData(refreshType, Idx = null) {
+ let currSiteId = siteData === undefined ? '0' : siteData[0].toString();
+ siteData = undefined; sitesCount = '0';
+ sitesCount = window.parent.getSitesCount();
+ if (Idx !== null) { currSiteIdx = Idx.toString(); }
+ else {
+ if (refreshType === 'start') {
+ if (Number(sitesCount) > 0) {
+ currSiteIdx = window.parent.sNetworkTree[0][0].toString();
+ } else { currSiteIdx = '-1'; }
+ }
+ else if (refreshType === 'add') { /* add */
+ if (Number(sitesCount) > 0) {
+ currSiteIdx = window.parent.sNetworkTree[Number(sitesCount) - 1][0].toString();
+ } else { currSiteIdx = '-1'; }
+ }
+ else if (refreshType === 'cursor') { /* update */
+ if (Number(sitesCount) > 0) {
+ currSiteIdx = window.parent.getSiteIdxById(currSiteId).toString();
+ } else { currSiteIdx = '-1'; }
+ }
+ else if (refreshType === 'delete') /*delete*/ {
+ if (Number(sitesCount) > 0) {
+ if (deleteSiteIdx > Number(sitesCount) - 1) {
+ currSiteIdx = window.parent.sNetworkTree[Number(sitesCount) - 1][0].toString();
+ } else {
+ if (deleteSiteIdx > -1) {
+ currSiteIdx = window.parent.sNetworkTree[deleteSiteIdx][0].toString();
+ } else { currSiteIdx = '-1'; }
+ }
+ } else { currSiteIdx = '-1'; }
+ }
+ }
+ siteData = window.parent.getSiteDataByIdx(currSiteIdx).split('\t');
+ fillSiteData(siteData);
+}
function nextSite(e) {
if (e) { e.stopPropagation(); }
- if (Number(sitesCount) - 1 > Number(currSite)) {
- refreshSiteData('', (Number(currSite) + 1).toString());
+ let sortedIdx = window.parent.sNetworkTree.findIndex(x => x[0].toString() === currSiteIdx);
+ if (sortedIdx < Number(sitesCount) - 1) {
+ refreshSiteData('', (window.parent.sNetworkTree[sortedIdx + 1][0]).toString());
}
}
function previousSite(e) {
if (e) { e.stopPropagation(); }
- if (Number(currSite) > 0) {
- refreshSiteData('', (Number(currSite) - 1).toString());
+ let sortedIdx = window.parent.sNetworkTree.findIndex(x => x[0].toString() === currSiteIdx);
+ if (sortedIdx > 0) {
+ refreshSiteData('', (window.parent.sNetworkTree[sortedIdx - 1][0]).toString());
}
}
function saveSiteData(e) {
if (e) { e.stopPropagation(); }
window.parent.updateSiteDataByIdx({
//site
- idx: currSite,
+ idx: currSiteIdx,
sitename: document.getElementById('sitename').value,
longitude: document.getElementById('longitude').value,
latitude: document.getElementById('latitude').value,
@@ -291,7 +320,8 @@ function saveSiteData(e) {
}
function deleteSite(e) {
if (e) { e.stopPropagation(); }
- window.parent.deleteSiteByIdx(currSite);
+ deleteSiteIdx = window.parent.sNetworkTree.findIndex(x => x[0].toString() === currSiteIdx);
+ window.parent.deleteSiteByIdx(currSiteIdx);
refreshSiteData('delete');
window.parent.document.getElementById('linkOptionsFrame').contentWindow.refreshLinkData('delete');
window.parent.document.getElementById('linkProfileFrame').contentWindow.refreshLinkData('delete');
@@ -299,5 +329,5 @@ function deleteSite(e) {
function zoomToSite(e) {
if (e) { e.stopPropagation(); }
window.parent.document.getElementById('siteOptions').style.display = 'none';
- window.parent.zoomToSiteByIdx(currSite);
+ window.parent.zoomToSiteByIdx(currSiteIdx);
}
\ No newline at end of file
diff --git a/software/cnip/cnip/Scripts/cnip/webui/generic.js b/software/cnip/cnip/cnip/Scripts/cnip/webui/generic.js
similarity index 84%
rename from software/cnip/cnip/Scripts/cnip/webui/generic.js
rename to software/cnip/cnip/cnip/Scripts/cnip/webui/generic.js
index 0b2ca3ab15..4e512e506d 100644
--- a/software/cnip/cnip/Scripts/cnip/webui/generic.js
+++ b/software/cnip/cnip/cnip/Scripts/cnip/webui/generic.js
@@ -91,12 +91,11 @@ function titleCase(str) {
}
function fixStringName(stringName) {
if (stringName) {
- return stringName.toString().replace(/[^A-Za-z0-9\s!?]/g, '');
+ return stringName.toString().replace(/[\n\r]+/g, ' ').replace(/\s{2,}/g, ' ').replace(/^\s+|\s+$/, '').replace(/[^A-Za-z0-9\s_!?\-]/g, '');
} else {
return '';
}
}
-
function allLetter(inputtxt) {
var letters = /^[A-Za-z]+$/;
if (inputtxt.toString().match(letters)) {
@@ -106,7 +105,6 @@ function allLetter(inputtxt) {
return false;
}
}
-
var truncate = function (str, length) {
if (str.length > length) {
return str.substr(0, length - 3) + '...';
@@ -114,8 +112,55 @@ var truncate = function (str, length) {
return str;
}
};
+/**
+ * Sorts an array of objects by column/property.
+ * @param {Array} array - The array of objects.
+ * @param {object} sortObject - The object that contains the sort order keys with directions (asc/desc). e.g. { age: 'desc', name: 'asc' }
+ * @returns {Array} The sorted array.
+ */
+function multiSort(array, sortObject = {}) {
+ const sortKeys = Object.keys(sortObject);
+ // Return array if no sort object is supplied.
+ if (!sortKeys.length) {
+ return array;
+ }
+ // Change the values of the sortObject keys to -1, 0, or 1.
+ for (let key in sortObject) {
+ sortObject[key] = sortObject[key] === 'desc' || sortObject[key] === -1 ? -1 : (sortObject[key] === 'skip' || sortObject[key] === 0 ? 0 : 1);
+ }
+
+ const keySort = (a, b, direction) => {
+ direction = direction !== null ? direction : 1;
+
+ if (a === b) { // If the values are the same, do not switch positions.
+ return 0;
+ }
+
+ // If b > a, multiply by -1 to get the reverse direction.
+ return a > b ? direction : -1 * direction;
+ };
+
+ return array.sort((a, b) => {
+ let sorted = 0;
+ let index = 0;
+
+ // Loop until sorted (-1 or 1) or until the sort keys have been processed.
+ while (sorted === 0 && index < sortKeys.length) {
+ const key = sortKeys[index];
+
+ if (key) {
+ const direction = sortObject[key];
+
+ sorted = keySort(a[key], b[key], direction);
+ index++;
+ }
+ }
+
+ return sorted;
+ });
+}
/* no ui slider extension with value span control */
function initSingleSlider(target, width, minValue, maxValue, stepSize, defaultValue) {
if (!target.hasChildNodes()) {
@@ -138,10 +183,15 @@ function initSingleSlider(target, width, minValue, maxValue, stepSize, defaultVa
sliSpan.id = target.id + '_span';
sliTable.style.width = '100%';
sliTable.style.marginBottom = '5px';
+ sliTable.style.backgroundColor = 'transparent';
+ sliTbody.style.backgroundColor = 'transparent';
+ sliTr.style.backgroundColor = 'transparent';
sliTd1.style.width = '85%';
sliTd1.style.verticalAlign = 'middle';
+ sliTd1.style.backgroundColor = 'transparent';
sliTd2.style.width = '15%';
sliTd2.style.verticalAlign = 'middle';
+ sliTd2.style.backgroundColor = 'transparent';
sliSpan.style.backgroundColor = 'var(--facecolor)';
sliSpan.style.display = 'flex';
sliSpan.style.padding = '5px 10px 5px 10px';
diff --git a/software/cnip/cnip/Scripts/cnip/webui/interactions.js b/software/cnip/cnip/cnip/Scripts/cnip/webui/interactions.js
similarity index 90%
rename from software/cnip/cnip/Scripts/cnip/webui/interactions.js
rename to software/cnip/cnip/cnip/Scripts/cnip/webui/interactions.js
index 88bd9644a9..56d4ec9622 100644
--- a/software/cnip/cnip/Scripts/cnip/webui/interactions.js
+++ b/software/cnip/cnip/cnip/Scripts/cnip/webui/interactions.js
@@ -19,6 +19,9 @@ selection.on('add', function (e) {
document.getElementById('linkProfileFrame').contentWindow.refreshLinkDataById(feature.get('linkid'));
document.getElementById('linkProfileFrame').contentWindow.userDisplay = true;
setDialogZIndex(null, 'linkProfile');
+ if (document.getElementById('linkOptionsFrame').contentWindow.userDisplay = true) {
+ document.getElementById('linkOptionsFrame').contentWindow.refreshLinkDataById(feature.get('linkid'));
+ }
clearInteractions();
}
if (feature.get('noteid') !== undefined) {
@@ -90,16 +93,6 @@ addedLink.on('add', function (e) {
clearInteractions();
}
});
-//document.addEventListener('click', function (e) {
-// //if (siteASelected) {
-// // if (e) { e.stopPropagation(); }
-// // pointCount = pointCount + 1;
-// // if (pointCount > 1) {
-// // drawLink.removeLastPoint();
-// // pointCount = pointCount - 1;
-// // }
-// //}
-//});
var drawLink = new ol.interaction.Draw({ source: myLinksLayer.getSource(), type: 'LineString', style: drawLinkLineStyle });
myMap.addInteraction(drawLink);
drawLink.setActive(false);
@@ -129,6 +122,12 @@ selectedLink.on('add', function (e) {
myLinksLayer.getSource().removeFeature(feature);
myMap.render();
});
+ document.getElementById('linkOptionsFrame').contentWindow.deleteLinkIdx =
+ sLinksTree.findIndex(x => x[0].toString() ===
+ document.getElementById('linkOptionsFrame').contentWindow.currLinkIdx);
+ document.getElementById('linkProfileFrame').contentWindow.deleteLinkIdx =
+ sLinksTree.findIndex(x => x[0].toString() ===
+ document.getElementById('linkProfileFrame').contentWindow.currLinkIdx);
loadLinksTreeFromSource();
document.getElementById('linkOptionsFrame').contentWindow.refreshLinkData('delete');
document.getElementById('linkProfileFrame').contentWindow.refreshLinkData('delete');
@@ -190,6 +189,9 @@ selectedPolygon.on('add', function (e) {
myPolygonsLayer.getSource().removeFeature(feature);
myMap.render();
});
+ document.getElementById('polyOptionsFrame').contentWindow.deletePolygonIdx =
+ sPolygonsTree.findIndex(x => x[0].toString() ===
+ document.getElementById('polyOptionsFrame').contentWindow.currPolygonIdx);
loadPolygonsTreeFromSource();
document.getElementById('polyOptionsFrame').contentWindow.refreshPolygonData('delete');
// clear all tools here
@@ -231,6 +233,9 @@ selectedSite.on('add', function (e) {
myNetworkLayer.getSource().removeFeature(feature);
myMap.render();
});
+ document.getElementById('siteOptionsFrame').contentWindow.deleteSiteIdx =
+ sNetworkTree.findIndex(x => x[0].toString() ===
+ document.getElementById('siteOptionsFrame').contentWindow.currSiteIdx);
loadSitesTreeFromSource();
document.getElementById('siteOptionsFrame').contentWindow.refreshSiteData('delete');
document.getElementById('linkOptionsFrame').contentWindow.refreshLinkData('delete');
@@ -293,6 +298,9 @@ selectedNote.on('add', function (e) {
myNotesLayer.getSource().removeFeature(feature);
myMap.render();
});
+ document.getElementById('noteOptionsFrame').contentWindow.deleteNoteIdx =
+ sNotesTree.findIndex(x => x[0].toString() ===
+ document.getElementById('noteOptionsFrame').contentWindow.currNoteIdx);
loadNotesTreeFromSource();
document.getElementById('noteOptionsFrame').contentWindow.refreshNoteData('delete');
// clear all tools here
diff --git a/software/cnip/cnip/Scripts/cnip/webui/legend.js b/software/cnip/cnip/cnip/Scripts/cnip/webui/legend.js
similarity index 100%
rename from software/cnip/cnip/Scripts/cnip/webui/legend.js
rename to software/cnip/cnip/cnip/Scripts/cnip/webui/legend.js
diff --git a/software/cnip/cnip/cnip/Scripts/cnip/webui/ol.vector.extension.js b/software/cnip/cnip/cnip/Scripts/cnip/webui/ol.vector.extension.js
new file mode 100644
index 0000000000..10f78e91ba
--- /dev/null
+++ b/software/cnip/cnip/cnip/Scripts/cnip/webui/ol.vector.extension.js
@@ -0,0 +1,173 @@
+ol.source.Vector.prototype.clone = function () {
+ let JsonFeatures = new ol.format.GeoJSON().writeFeaturesObject(
+ this.getFeatures(),
+ { featureProjection: 'EPSG:3857', dataProjection: 'EPSG:4326' });
+ let source = new ol.source.Vector({
+ features: new ol.format.GeoJSON({
+ extractStyles: true,
+ extractAttributes: true
+ }).readFeatures(JsonFeatures),
+ wrapX: false
+ });
+ return source;
+};
+ol.source.Vector.prototype.getJSONString = function (beautify = false) {
+ let JSONString;
+ if (beautify) {
+ JSONString = JSON.stringify(
+ new ol.format.GeoJSON().writeFeaturesObject(
+ this.getFeatures(),
+ { featureProjection: 'EPSG:3857', dataProjection: 'EPSG:4326' }
+ ), undefined, '\t'
+ );
+ } else {
+ JSONString = JSON.stringify(
+ new ol.format.GeoJSON().writeFeaturesObject(
+ this.getFeatures(),
+ { featureProjection: 'EPSG:3857', dataProjection: 'EPSG:4326' }
+ )
+ );
+ }
+ return JSONString;
+};
+ol.source.Vector.prototype.getKMLString = function (beautify = false) {
+ let KMLString;
+ if (beautify) {
+ KMLString =
+ JSON.stringify(
+ new ol.format.KML({
+ extractStyles: true,
+ showPointNames: true,
+ writeStyles: true
+ }).writeFeatures(
+ this.getFeatures(),
+ { featureProjection: 'EPSG:3857', dataProjection: 'EPSG:4326' }
+ ), undefined, '\t'
+ );
+ } else {
+ KMLString =
+ JSON.stringify(
+ new ol.format.KML({
+ extractStyles: true,
+ showPointNames: true,
+ writeStyles: true
+ }).writeFeatures(
+ this.getFeatures(),
+ { featureProjection: 'EPSG:3857', dataProjection: 'EPSG:4326' }
+ )
+ );
+ }
+ KMLString = KMLString.replace(/\\/g, '');
+ KMLString = KMLString.slice(1, -1);
+ return KMLString;
+};
+ol.source.Vector.prototype.getFeatureByProperty = function (propertyname, propertyvalue) {
+ let matchedfeature = undefined;
+ if (propertyname && propertyvalue) {
+ let features = this.getFeatures();
+ for (let i = 0; i < features.length; i++) {
+ if (features[i].get(propertyname)) {
+ if (features[i].get(propertyname).toString() === propertyvalue.toString()) {
+ matchedfeature = features[i]; break;
+ }
+ }
+ }
+ }
+ return matchedfeature;
+};
+ol.source.Vector.prototype.getFeatureByProperties = function (properties) {
+ const array = Object.keys(properties).map(property => ({ key: property, value: properties[property] }));
+ let matchedfeature = undefined;
+ if (array.length > 0) {
+ let features = this.getFeatures();
+ for (let i = 0; i < features.length; i++) {
+ let matched = 0;
+ for (let j = 0; j < array.length; j++) {
+ if (features[i].get(array[j].key)) {
+ if (array[j].value) {
+ if (features[i].get(array[j].key).toString() === array[j].value.toString()) {
+ matched += 1;
+ }
+ }
+ }
+ }
+ if (matched === array.length) {
+ matchedfeature = features[i]; break;
+ }
+ }
+ }
+ return matchedfeature;
+};
+ol.source.Vector.prototype.getFeaturesByProperty = function (propertyname, propertyvalue) {
+ let matchedfeatures = [];
+ if (propertyname && propertyvalue) {
+ let features = this.getFeatures();
+ for (let i = 0; i < features.length; i++) {
+ if (features[i].get(propertyname)) {
+ if (Array.isArray(propertyvalue)) {
+ let matched = 0;
+ propertyvalue.forEach(function (value) {
+ if (value) {
+ if (features[i].get(propertyname).toString() === value.toString()) {
+ matched += 1;
+ }
+ }
+ });
+ if (matched > 0) {
+ matchedfeatures.push(features[i]);
+ }
+ } else {
+ if (features[i].get(propertyname).toString() === propertyvalue.toString()) {
+ matchedfeatures.push(features[i]);
+ }
+ }
+ }
+ }
+ }
+ return matchedfeatures;
+};
+ol.source.Vector.prototype.getFeaturesByProperties = function (properties) {
+ const array = Object.keys(properties).map(property => ({ key: property, value: properties[property] }));
+ let matchedfeatures = [];
+ if (array.length > 0) {
+ let features = this.getFeatures();
+ for (let i = 0; i < features.length; i++) {
+ let matched = 0;
+ for (let j = 0; j < array.length; j++) {
+ if (features[i].get(array[j].key)) {
+ if (Array.isArray(array[j].value)) {
+ let matchedOr = 0;
+ array[j].value.forEach(function (value) {
+ if (value) {
+ if (features[i].get(array[j].key).toString() === value.toString()) {
+ matchedOr += 1;
+ }
+ }
+ });
+ if (matchedOr > 0) {
+ matched += 1;
+ }
+ } else {
+ if (array[j].value) {
+ if (features[i].get(array[j].key).toString() === array[j].value.toString()) {
+ matched += 1;
+ }
+ }
+ }
+ }
+ }
+ if (matched === array.length) {
+ matchedfeatures.push(features[i]);
+ }
+ }
+ }
+ return matchedfeatures;
+};
+ol.source.Vector.prototype.clearFeatures = function () {
+ while (this.getFeatures().length > 0) {
+ let features = this.getFeatures();
+ for (let i = 0; i < features.length; i++) {
+ this.removeFeature(features[i]);
+ }
+ }
+};
\ No newline at end of file
diff --git a/software/cnip/cnip/Scripts/cnip/webui/rendermap.js b/software/cnip/cnip/cnip/Scripts/cnip/webui/rendermap.js
similarity index 87%
rename from software/cnip/cnip/Scripts/cnip/webui/rendermap.js
rename to software/cnip/cnip/cnip/Scripts/cnip/webui/rendermap.js
index 0373606d26..30d9b0eebc 100644
--- a/software/cnip/cnip/Scripts/cnip/webui/rendermap.js
+++ b/software/cnip/cnip/cnip/Scripts/cnip/webui/rendermap.js
@@ -46,16 +46,16 @@ myMap.on('click', function (e) {
}
}
- if (actionRunning) { return; }
- if (!select.getActive()) { return; }
- let pixel = myMap.getEventPixel(e.originalEvent);
- let feature = myMap.forEachFeatureAtPixel(pixel,
- function (feature) { return feature; });
- if (!feature) { return; }
- if (feature.get('linkid') !== undefined) {
- if (e) { e.stopPropagation(); }
- document.getElementById('linkOptionsFrame').contentWindow.refreshLinkDataById(feature.get('linkid'));
- }
+ //if (actionRunning) { return; }
+ //if (!select.getActive()) { return; }
+ //let pixel = myMap.getEventPixel(e.originalEvent);
+ //let feature = myMap.forEachFeatureAtPixel(pixel,
+ // function (feature) { return feature; });
+ //if (!feature) { return; }
+ //if (feature.get('linkid') !== undefined) {
+ // if (e) { e.stopPropagation(); }
+ // document.getElementById('linkOptionsFrame').contentWindow.refreshLinkDataById(feature.get('linkid'));
+ //}
//if (feature.get('polygonid') !== undefined) {
// if (e) { e.stopPropagation(); }
// document.getElementById('polyOptionsFrame').contentWindow.refreshPolygonDataById(feature.get('polygonid'));
@@ -96,4 +96,6 @@ document.getElementById('linkProfileFrame').contentWindow.document.onclick =
setDialogZIndex(null, 'linkProfile');
};
-myMap.render();
\ No newline at end of file
+
+myMap.render();
+
diff --git a/software/cnip/cnip/Scripts/cnip/webui/sidebar/account.js b/software/cnip/cnip/cnip/Scripts/cnip/webui/sidebar/account.js
similarity index 100%
rename from software/cnip/cnip/Scripts/cnip/webui/sidebar/account.js
rename to software/cnip/cnip/cnip/Scripts/cnip/webui/sidebar/account.js
diff --git a/software/cnip/cnip/Scripts/cnip/webui/sidebar/myclutter.js b/software/cnip/cnip/cnip/Scripts/cnip/webui/sidebar/myclutter.js
similarity index 100%
rename from software/cnip/cnip/Scripts/cnip/webui/sidebar/myclutter.js
rename to software/cnip/cnip/cnip/Scripts/cnip/webui/sidebar/myclutter.js
diff --git a/software/cnip/cnip/Scripts/cnip/webui/sidebar/mylinks.js b/software/cnip/cnip/cnip/Scripts/cnip/webui/sidebar/mylinks.js
similarity index 67%
rename from software/cnip/cnip/Scripts/cnip/webui/sidebar/mylinks.js
rename to software/cnip/cnip/cnip/Scripts/cnip/webui/sidebar/mylinks.js
index be86573e5b..5aba2e2e0a 100644
--- a/software/cnip/cnip/Scripts/cnip/webui/sidebar/mylinks.js
+++ b/software/cnip/cnip/cnip/Scripts/cnip/webui/sidebar/mylinks.js
@@ -1,4 +1,6 @@
-$('#linksDiv').collapse({
+var sLinksTree = [];
+
+$('#linksDiv').collapse({
toggle: true
});
var linksTree = document.getElementById('linksUl');
@@ -6,64 +8,78 @@ initSingleSlider(document.getElementById('linksStrokeOpacity'), '', '0', '1', '0
document.getElementById('linksStrokeOpacity').addEventListener('change', setLinksStyle);
loadLinksTreeFromFile();
/* link functions*/
+function setLinksLabel(e) {
+ setLinksStyle(e);
+}
function setLinksStyle(e) {
if (e) { e.stopPropagation(); }
let custStyle = function (feature) {
let strokeOpacity = Number($('#linksStrokeOpacity').val());
return [new ol.style.Style({
stroke: new ol.style.Stroke({
- color: feature.get('linktype') === 'internal' ?
+ color: feature.get('linktype') === 'private' ?
colorWithAlpha('#00ffff', strokeOpacity) :
colorWithAlpha('#ffe300', strokeOpacity),
lineDash: [7, 7],
width: 4
}),
text: new ol.style.Text({
- text: feature.get('linkname'),
+ text: document.getElementById("linksLabel").checked ? feature.get('linkname') : '',
font: '14px "Liberation Sans", "Lucida Sans", "Lucida Sans Regular", "Lucida Grande", "Lucida Sans Unicode", Geneva, Verdana, sans-serif',
fill: new ol.style.Fill({ color: 'rgba(0,0,0,' + strokeOpacity + ')' }),
- stroke: new ol.style.Stroke({ color: 'rgba(0,0,0,' + strokeOpacity + ')', width: 2 })
+ stroke: new ol.style.Stroke({ color: 'rgba(255,255,255,' + strokeOpacity + ')', width: 2 }),
+ overflow: false
})
})];
};
myLinksLayer.setStyle(custStyle);
myMap.render();
}
+function setLinksVisiblity() {
+ if (myLinksLayer) {
+ if (document.getElementById("linksVisibility").checked === true) {
+ myLinksLayer.setVisible(true);
+ } else {
+ myLinksLayer.setVisible(false);
+ }
+ myMap.render();
+ ol.control.LayerSwitcher.renderPanel(myMap, toc);
+ }
+}
function loadLinksTreeFromFile() {
let httpRequest = new XMLHttpRequest();
- httpRequest.open('GET', '../' + vectorsPath + 'mylinks.geojson', true);
- httpRequest.send();
+ httpRequest.open('GET', '../' + vectorsPath + 'mylinks.geojson');
httpRequest.onload = function () {
let source = JSON.parse(httpRequest.responseText);
- linksTree.innerHTML = '';
- if (typeof source.features !== 'undefined') {
- for (let i = 0; i < source.features.length; i++) {
- linksTree.innerHTML = linksTree.innerHTML +
- ' ' +
- source.features[i].properties.linkname + ' ';
+ function processLoop() {
+ if (source.features.length === myLinksLayer.getSource().getFeatures().length) {
+ loadLinksTreeFromSource();
+ } else {
+ setTimeout(processLoop, 500);
}
}
+ processLoop();
};
+ httpRequest.send();
}
function loadLinksTreeFromSource() {
- let features = myLinksLayer.getSource().getFeatures();
+ sLinksTree = buildSortedTreeFromSource(myLinksLayer, 'linkid', 'linkname');
linksTree.innerHTML = '';
- for (let i = 0; i < features.length; i++) {
+ for (let i = 0; i < sLinksTree.length; i++) {
linksTree.innerHTML = linksTree.innerHTML +
' ' +
- features[i].getProperties().linkname + ' ';
+ sLinksTree[i][0].toString() + ');"> ' +
+ truncate(sLinksTree[i][2].toString(), 27) + '';
}
}
function showLinkOptionsByIdx(e, Idx) {
if (e) { e.stopPropagation(); }
if (actionRunning) { return; }
document.getElementById('linkOptions').style.display = 'block';
- document.getElementById('linkOptions').style.left = 'calc(50vw - 651px / 2)';
- document.getElementById('linkOptions').style.top = 'calc(50vh - 432px / 2)';
- document.getElementById('linkOptions').style.width = '651px';
- document.getElementById('linkOptions').style.height = '432px';
+ //document.getElementById('linkOptions').style.left = 'calc(50vw - 651px / 2)';
+ //document.getElementById('linkOptions').style.top = 'calc(50vh - 432px / 2)';
+ //document.getElementById('linkOptions').style.width = '651px';
+ //document.getElementById('linkOptions').style.height = '432px';
document.getElementById('linkOptionsFrame').contentWindow.userDisplay = true;
document.getElementById('linkOptionsFrame').contentWindow.refreshLinkData('', Idx);
setDialogZIndex(null, 'linkOptions');
@@ -79,7 +95,12 @@ function getLinkProfileByIdx(Idx) {
let keys = feature.getKeys();
for (let j = 0; j < keys.length; j++) {
if (keys[j] !== 'geometry') {
- returnString += feature.get(keys[j]).toString() + '\t';
+ if (feature.get(keys[j])) {
+ returnString += feature.get(keys[j]).toString() + '\t';
+ }
+ else {
+ returnString += '\t';
+ }
}
}
returnString = returnString.substring(0, returnString.length - 1);
@@ -87,51 +108,62 @@ function getLinkProfileByIdx(Idx) {
}
return returnString;
}
-function getPublicSiteData(siteidb, email) {
- let feature = getPublicSite(siteidb, email);
- let returnString = '';
- if (feature) {
- let keys = feature.getKeys();
- for (let j = 0; j < keys.length; j++) {
- if (keys[j] !== 'geometry') {
- returnString += feature.get(keys[j]).toString() + '\t';
- }
- }
- returnString = returnString.substring(0, returnString.length - 1);
- }
- return returnString;
-}
-function getPublicSite(siteidb, email) {
- if (siteidb) {
- if (Number(siteidb) > -1) {
- if (email) {
- let features = publicNetworkLayer.getSource().getFeatures();
- for (let i = 0; i < features.length; i++) {
- if (features[i].get('siteid') === siteidb && features[i].get('email') === email) {
- return features[i];
- break;
- }
- }
- }
- }
- }
-}
function getLinkIdxById(linkid) {
- return getIdxById(myLinksLayer.getSource(), 'linkid', linkid);
+ return getIdxByProperty(myLinksLayer.getSource(), 'linkid', linkid);
}
function zoomToLinkByIdx(Idx) {
zoomToFeatureByIdx(myLinksLayer.getSource(), Idx);
}
+function getLinkidsBySiteidA(siteida) {
+ let linkids = '';
+ myLinksLayer.getSource().getFeatures().forEach(function (f) {
+ if (f.get('siteida').toString() === siteida.toString()) {
+ linkids += f.get('linkid').toString() + '\t';
+ }
+ });
+ if (linkids.length > 0) {
+ linkids = linkids.substring(0, linkids.length - 1);
+ }
+ return linkids;
+}
+function getLinkidsBySiteidB(siteidb) {
+ let linkids = '';
+ myLinksLayer.getSource().getFeatures().forEach(function (f) {
+ if (f.get('siteidb').toString() === siteidb.toString() && f.get('linktype') === 'private') {
+ linkids += f.get('linkid').toString() + '\t';
+ }
+ });
+ if (linkids.length > 0) {
+ linkids = linkids.substring(0, linkids.length - 1);
+ }
+ return linkids;
+}
+function updateLinkHeightAById(linkid, height) {
+ let feature = myLinksLayer.getSource().getFeatureByProperty('linkid', linkid);
+ if (Number(feature.get('heighta').toString()) > Number(height.toString())) {
+ feature.set('heighta', height.toString());
+ }
+ myMap.render();
+}
+function updateLinkHeightBById(linkid, height) {
+ let feature = myLinksLayer.getSource().getFeatureByProperty('linkid', linkid);
+ if (Number(feature.get('heightb').toString()) > Number(height.toString())) {
+ feature.set('heightb', height.toString());
+ }
+ myMap.render();
+}
function updateLinkDataByIdx(options) {
if (options.idx) {
if (Number(options.idx) > -1) {
let feature = myLinksLayer.getSource().getFeatures()[options.idx];
feature.set('linkname', options.linkname.toString());
+ feature.set('heighta', options.heighta.toString());
feature.set('channelwidtha', options.channelwidtha.toString());
feature.set('frequencya', options.frequencya.toString());
feature.set('outputpowera', options.outputpowera.toString());
feature.set('antennagaina', options.antennagaina.toString());
feature.set('lossesa', options.lossesa.toString());
+ feature.set('heightb', options.heightb.toString());
feature.set('channelwidthb', options.channelwidthb.toString());
feature.set('frequencyb', options.frequencyb.toString());
feature.set('outputpowerb', options.outputpowerb.toString());
@@ -157,12 +189,14 @@ function deleteLinksBySiteId(siteid) {
myLinksLayer.getSource().removeFeature(feature);
feature = myLinksLayer.getSource().getFeatureByProperty('siteida', siteid);
}
- feature = myLinksLayer.getSource().getFeatureByProperty('siteidb', siteid);
+ feature = myLinksLayer.getSource().getFeatureByProperties({ 'siteidb': siteid, 'linktype': 'private' });
while (feature) {
myLinksLayer.getSource().removeFeature(feature);
- feature = myLinksLayer.getSource().getFeatureByProperty('siteidb', siteid);
+ feature = myLinksLayer.getSource().getFeatureByProperties({ 'siteidb': siteid, 'linktype': 'private' });
}
myMap.render();
+ document.getElementById('linkOptionsFrame').contentWindow.deleteLinkIdx = -1;
+ document.getElementById('linkProfileFrame').contentWindow.deleteLinkIdx = -1;
loadLinksTreeFromSource();
clearInteractions();
}
@@ -223,9 +257,10 @@ function createLink(options) {
let feature = new ol.Feature({
'linkid': linkid,
'linkname': 'my link ' + linkid,
- 'linktype': 'internal',
+ 'linktype': 'private',
'siteida': options.siteida,
'locheighta': elevationString[0],
+ 'heighta': '',
'bearinga': round(turf.bearingToAzimuth(turf.bearing(
turf.point(options.locationA), turf.point(options.locationB))), 2),
'channelwidtha': document.getElementById('opt_channelwidth').value,
@@ -235,6 +270,7 @@ function createLink(options) {
'lossesa': document.getElementById('opt_losses').value,
'siteidb': options.siteidb,
'locheightb': elevationString[1],
+ 'heightb': '',
'bearingb': round(turf.bearingToAzimuth(turf.bearing(
turf.point(options.locationB), turf.point(options.locationA))), 2),
'channelwidthb': document.getElementById('opt_channelwidth').value,
@@ -244,6 +280,8 @@ function createLink(options) {
'lossesb': document.getElementById('opt_losses').value,
'distance': distanceToLocationB,
'elevstr': elevationString[2],
+ 'name': '',
+ 'email': '',
geometry: new ol.geom.LineString(
[options.locationA, options.locationB]).transform('EPSG:4326', 'EPSG:3857')
});
diff --git a/software/cnip/cnip/Scripts/cnip/webui/sidebar/mynetwork.js b/software/cnip/cnip/cnip/Scripts/cnip/webui/sidebar/mynetwork.js
similarity index 64%
rename from software/cnip/cnip/Scripts/cnip/webui/sidebar/mynetwork.js
rename to software/cnip/cnip/cnip/Scripts/cnip/webui/sidebar/mynetwork.js
index 524ab5135d..59a4cfc5b0 100644
--- a/software/cnip/cnip/Scripts/cnip/webui/sidebar/mynetwork.js
+++ b/software/cnip/cnip/cnip/Scripts/cnip/webui/sidebar/mynetwork.js
@@ -1,11 +1,65 @@
-$('#sitesDiv').collapse({
+var sNetworkTree = [];
+
+$('#sitesDiv').collapse({
toggle: true
});
var sitesTree = document.getElementById('sitesUl');
+
+//https://www.plupload.com/examples/core
+
+var fileupload1 = document.getElementById("FileUpload11");
+var button1 = document.getElementById("btnFileUpload1");
+button1.onclick = function () {
+ fileupload1.click();
+};
+fileupload1.onchange = function (evt) {
+ if (evt) { evt.stopPropagation(); }
+ if (getActionRunning()) { return; }
+ if (evt.target.files) {
+ var reader = new FileReader();
+ var file = evt.currentTarget.files[0];
+ var filename = file.name;
+ if (!filename.includes('json') ||
+ !filename.includes('geojson')) {
+ showMessage("Network Upload", "Please provide sites in Geojson format.");
+ }
+ else {
+ reader.readAsText(file, "UTF-8");
+ reader.onload = function (evt) {
+ showProgress('Loading Network');
+ setTimeout(function () {
+ // save current network
+ uploadDataToUrl(myNetworkLayer.getSource().getJSONString(),
+ vectorsPath + 'mynetwork.geojson');
+ Ajax_runccmd("UploadNetworkToDB", "");
+ myMap.render();
+ loadSitesTreeFromFile();
+ // load user network
+ uploadDataToUrl(evt.target.result,
+ vectorsPath + "t" + filename);
+ Ajax_runccmd("UploadUserNetworkToDB",
+ "{'sitename':'t" + filename + "'}");
+ // reload polygons from server
+ Ajax_runccmd("GetNetworkFromDB", "");
+ Ajax_loadSourceFromFile(myNetworkLayer.getSource(),
+ "../" + vectorsPath + "mynetwork.geojson");
+ myMap.render();
+ loadSitesTreeFromFile();
+ closeProgress();
+ }, 500);
+ };
+ }
+ fileupload.value = null;
+ }
+};
+
initSingleSlider(document.getElementById('sitesIconOpacity'), '', '0', '1', '0.1', '1');
document.getElementById('sitesIconOpacity').addEventListener('change', setSitesStyle);
loadSitesTreeFromFile();
/* site functions*/
+function setSitesLabel(e) {
+ setSitesStyle(e);
+}
function setSitesStyle(e) {
if (e) { e.stopPropagation(); }
let custStyle = function (feature) {
@@ -22,58 +76,93 @@ function setSitesStyle(e) {
}),
text: new ol.style.Text({
offsetY: 25,
- text: feature.get('sitename'),
+ text: document.getElementById("sitesLabel").checked ? feature.get('sitename') : '',
font: '14px "Liberation Sans", "Lucida Sans", "Lucida Sans Regular", "Lucida Grande", "Lucida Sans Unicode", Geneva, Verdana, sans-serif',
fill: new ol.style.Fill({ color: 'rgba(0,0,0,' + iconOpacity + ')' }),
- stroke: new ol.style.Stroke({ color: 'rgba(255,255,255,' + iconOpacity + ')', width: 2 })
+ stroke: new ol.style.Stroke({ color: 'rgba(255,255,255,' + iconOpacity + ')', width: 2 }),
+ overflow: false
})
})];
};
myNetworkLayer.setStyle(custStyle);
myMap.render();
}
-function loadSitesTreeFromFile() {
- let httpRequest = new XMLHttpRequest();
- httpRequest.open('GET', '../' + vectorsPath + 'mynetwork.geojson', true);
- httpRequest.send();
- httpRequest.onload = function () {
- let source = JSON.parse(httpRequest.responseText);
- sitesTree.innerHTML = '';
- if (typeof source.features !== 'undefined') {
- for (let i = 0; i < source.features.length; i++) {
- sitesTree.innerHTML = sitesTree.innerHTML +
- ' ' +
- truncate(source.features[i].properties.sitename,27) + ' ';
- }
+function setSitesVisiblity() {
+ if (myNetworkLayer) {
+ if (document.getElementById("sitesVisibility").checked === true) {
+ myNetworkLayer.setVisible(true);
+ } else {
+ myNetworkLayer.setVisible(false);
}
- };
-}
-function loadSitesTreeFromSource() {
- let features = myNetworkLayer.getSource().getFeatures();
- sitesTree.innerHTML = '';
- for (let i = 0; i < features.length; i++) {
- sitesTree.innerHTML = sitesTree.innerHTML +
- ' ' +
- truncate(features[i].getProperties().sitename,27) + ' ';
+ myMap.render();
+ ol.control.LayerSwitcher.renderPanel(myMap, toc);
}
}
-function showSiteOptionsByIdx(e,Idx) {
+function setPublicSitesVisiblity() {
+ if (publicNetworkLayer) {
+ if (document.getElementById("publicSitesVisibility").checked === true) {
+ publicNetworkLayer.setVisible(true);
+ } else {
+ publicNetworkLayer.setVisible(false);
+ }
+ myMap.render();
+ ol.control.LayerSwitcher.renderPanel(myMap, toc);
+ }
+}
+function loadSitesTreeFromFile() {
+ let httpRequest = new XMLHttpRequest();
+ httpRequest.open('GET', '../' + vectorsPath + 'mynetwork.geojson');
+ httpRequest.onload = function () {
+ let source = JSON.parse(httpRequest.responseText);
+ function processLoop() {
+ if (source.features.length === myNetworkLayer.getSource().getFeatures().length) {
+ loadSitesTreeFromSource();
+ } else {
+ setTimeout(processLoop, 500);
+ }
+ }
+ processLoop();
+ };
+ httpRequest.send();
+}
+function loadSitesTreeFromSource() {
+ sNetworkTree = buildSortedTreeFromSource(myNetworkLayer, 'siteid', 'sitename', true);
+ sitesTree.innerHTML = '';
+ for (let i = 0; i < sNetworkTree.length; i++) {
+ sitesTree.innerHTML = sitesTree.innerHTML +
+ ' ' +
+ truncate(sNetworkTree[i][2].toString(), 27) + ' ';
+ }
+}
+function buildSortedTreeFromSource(layer, id, name, tech = false) {
+ let tree = [];
+ let features = layer.getSource().getFeatures();
+ for (let idx = 0; idx < features.length; idx++) {
+ if (tech) {
+ tree.push([idx, Number(features[idx].get(id)), features[idx].get(name), features[idx].get('technology')]);
+ } else {
+ tree.push([idx, Number(features[idx].get(id)), features[idx].get(name)]);
+ }
+ }
+ tree = multiSort(tree, {
+ 1: 'asc'
+ });
+ return tree;
+}
+function showSiteOptionsByIdx(e, Idx) {
if (e) { e.stopPropagation(); }
if (actionRunning) { return; }
document.getElementById('siteOptions').style.display = 'block';
- document.getElementById('siteOptions').style.left = 'calc(50vw - 651px / 2)';
- document.getElementById('siteOptions').style.top = 'calc(50vh - 432px / 2)';
- document.getElementById('siteOptions').style.width = '651px';
- document.getElementById('siteOptions').style.height = '432px';
+ //document.getElementById('siteOptions').style.left = 'calc(50vw - 651px / 2)';
+ //document.getElementById('siteOptions').style.top = 'calc(50vh - 432px / 2)';
+ //document.getElementById('siteOptions').style.width = '651px';
+ //document.getElementById('siteOptions').style.height = '432px';
document.getElementById('siteOptionsFrame').contentWindow.userDisplay = true;
document.getElementById('siteOptionsFrame').contentWindow.refreshSiteData('', Idx);
- setDialogZIndex(null,'siteOptions');
+ setDialogZIndex(null, 'siteOptions');
}
myNetworkLayer.getSource().on('addfeature', function (event) {
if (event.feature.get('siteid') === undefined) {
@@ -134,7 +223,7 @@ function getSiteDataByIdx(Idx) {
return getDataByIdx(myNetworkLayer.getSource(), Idx);
}
function getSiteIdxById(siteid) {
- return getIdxById(myNetworkLayer.getSource(), 'siteid', siteid);
+ return getIdxByProperty(myNetworkLayer.getSource(), 'siteid', siteid);
}
function getSiteDataById(siteid) {
return getSiteDataByIdx(getSiteIdxById(siteid));
@@ -142,6 +231,44 @@ function getSiteDataById(siteid) {
function zoomToSiteByIdx(Idx) {
zoomToFeatureByIdx(myNetworkLayer.getSource(), Idx);
}
+function getPublicSiteData(siteidb, email) {
+ let feature = getPublicSite(siteidb, email);
+ let returnString = '';
+ if (feature) {
+ let keys = feature.getKeys();
+ for (let j = 0; j < keys.length; j++) {
+ if (keys[j] !== 'geometry') {
+ if (feature.get(keys[j])) {
+ returnString += feature.get(keys[j]).toString() + '\t';
+ }
+ else {
+ returnString += '\t';
+ }
+ }
+ }
+ returnString = returnString.substring(0, returnString.length - 1);
+ }
+ return returnString;
+}
+function getPublicSite(siteidb, email) {
+ if (siteidb) {
+ if (Number(siteidb) > -1) {
+ if (email) {
+ let features = publicNetworkLayer.getSource().getFeatures();
+ for (let i = 0; i < features.length; i++) {
+ if (features[i].get('siteid') === siteidb && features[i].get('email') === email) {
+ return features[i];
+ }
+ }
+ }
+ }
+ }
+}
+function updateSiteHeightById(siteid, height) {
+ let feature = myNetworkLayer.getSource().getFeatureByProperty('siteid', siteid);
+ feature.set('height', height.toString());
+ myMap.render();
+}
function updateSiteDataByIdx(options) {
if (options.idx) {
if (Number(options.idx) > -1) {
@@ -194,7 +321,7 @@ function getSitesCount() {
return getFeaturesCount(myNetworkLayer.getSource());
}
function deleteSiteByIdx(Idx) {
- let siteData = getSiteDataByIdx(Idx);
+ let siteData = getSiteDataByIdx(Idx).split('\t');
if (siteData) { deleteLinksBySiteId(siteData[0].toString()); }
deleteFeatureByIdx(myNetworkLayer.getSource(), Idx);
loadSitesTreeFromSource();
@@ -227,6 +354,18 @@ function downloadSitesKML(e) {
closeProgress();
}, 500);
}
+function getGSMDlfrequency(rfcn) {
+ return 890 + (0.2 * Number(rfcn)) + 45;
+}
+function getGSMUlfrequency(rfcn) {
+ return 890 + (0.2 * Number(rfcn));
+}
+function getLTEDlfrequency(rfcn) {
+ return 925 + (0.1 * (Number(rfcn) - 3450));
+}
+function getLTEUlfrequency(rfcn) {
+ return 880 + (0.1 * (Number(rfcn) + 18000 - 21450));
+}
function getAntennaOptions(antennaModel) {
let Options;
switch (antennaModel.toString()) {
diff --git a/software/cnip/cnip/Scripts/cnip/webui/sidebar/mynotes.js b/software/cnip/cnip/cnip/Scripts/cnip/webui/sidebar/mynotes.js
similarity index 66%
rename from software/cnip/cnip/Scripts/cnip/webui/sidebar/mynotes.js
rename to software/cnip/cnip/cnip/Scripts/cnip/webui/sidebar/mynotes.js
index 78bc9acf96..6b7082f3d5 100644
--- a/software/cnip/cnip/Scripts/cnip/webui/sidebar/mynotes.js
+++ b/software/cnip/cnip/cnip/Scripts/cnip/webui/sidebar/mynotes.js
@@ -1,4 +1,6 @@
-$('#notesDiv').collapse({
+var sNotesTree = [];
+
+$('#notesDiv').collapse({
toggle: true
});
var notesTree = document.getElementById('notesUl');
@@ -6,12 +8,15 @@ initSingleSlider(document.getElementById('notesOpacity'), '', '0', '1', '0.1', '
document.getElementById('notesOpacity').addEventListener('change', setNotesStyle);
loadNotesTreeFromFile();
/* note functions*/
+function setNotesLabel(e) {
+ setNotesStyle(e);
+}
function setNotesStyle(e) {
if (e) { e.stopPropagation(); }
let custStyle = function (feature) {
let noteOpacity = Number($('#notesOpacity').val());
return [new ol.style.Style({
- image: feature.get('notetype') === 'Public' ? new ol.style.Icon({
+ image: feature.get('notetype') === 'public' ? new ol.style.Icon({
scale: 1,
src: '../img/notePublic.png',
opacity: noteOpacity
@@ -22,49 +27,73 @@ function setNotesStyle(e) {
}),
text: new ol.style.Text({
offsetY: 25,
- text: feature.get('notename'),
+ text: document.getElementById("notesLabel").checked ? feature.get('notename') : '',
font: '14px "Liberation Sans", "Lucida Sans", "Lucida Sans Regular", "Lucida Grande", "Lucida Sans Unicode", Geneva, Verdana, sans-serif',
- fill: new ol.style.Fill({ color: 'rgba(0,0,0,'+noteOpacity+')' }),
- stroke: new ol.style.Stroke({ color: 'rgba(255,255,255,' + noteOpacity + ')', width: 2 })
+ fill: new ol.style.Fill({ color: 'rgba(0,0,0,' + noteOpacity + ')' }),
+ stroke: new ol.style.Stroke({ color: 'rgba(255,255,255,' + noteOpacity + ')', width: 2 }),
+ overflow: false
})
})];
};
myNotesLayer.setStyle(custStyle);
myMap.render();
}
+function setNotesVisiblity() {
+ if (myNotesLayer) {
+ if (document.getElementById("notesVisibility").checked === true) {
+ myNotesLayer.setVisible(true);
+ } else {
+ myNotesLayer.setVisible(false);
+ }
+ myMap.render();
+ ol.control.LayerSwitcher.renderPanel(myMap, toc);
+ }
+}
+function setPublicNotesVisiblity() {
+ if (publicNotesLayer) {
+ if (document.getElementById("publicNotesVisibility").checked === true) {
+ publicNotesLayer.setVisible(true);
+ } else {
+ publicNotesLayer.setVisible(false);
+ }
+ myMap.render();
+ ol.control.LayerSwitcher.renderPanel(myMap, toc);
+ }
+}
function loadNotesTreeFromFile() {
let httpRequest = new XMLHttpRequest();
- httpRequest.open('GET', '../' + vectorsPath + 'mynotes.geojson', true);
- httpRequest.send();
+ httpRequest.open('GET', '../' + vectorsPath + 'mynotes.geojson');
httpRequest.onload = function () {
let source = JSON.parse(httpRequest.responseText);
- notesTree.innerHTML = '';
- if (typeof source.features !== 'undefined') {
- for (let i = 0; i < source.features.length; i++) {
- notesTree.innerHTML = notesTree.innerHTML +
- ' ' +
- truncate(source.features[i].properties.notename,27) + ' ';
+ function processLoop() {
+ if (source.features.length === myNotesLayer.getSource().getFeatures().length) {
+ loadNotesTreeFromSource();
+ } else {
+ setTimeout(processLoop, 500);
}
}
+ processLoop();
};
+ httpRequest.send();
}
function loadNotesTreeFromSource() {
- let features = myNotesLayer.getSource().getFeatures();
+ sNotesTree = buildSortedTreeFromSource(myNotesLayer, 'noteid', 'notename');
notesTree.innerHTML = '';
- for (let i = 0; i < features.length; i++) {
+ for (let i = 0; i < sNotesTree.length; i++) {
notesTree.innerHTML = notesTree.innerHTML +
- ' ' +
- truncate(features[i].getProperties().notename,27) + ' ';
+ ' ' +
+ truncate(sNotesTree[i][2].toString(), 27) + ' ';
}
}
function showNoteOptionsByIdx(e, Idx) {
if (e) { e.stopPropagation(); }
if (actionRunning) { return; }
document.getElementById('noteOptions').style.display = 'block';
- document.getElementById('noteOptions').style.left = 'calc(50vw - 451px / 2)';
- document.getElementById('noteOptions').style.top = 'calc(50vh - 236px / 2)';
- document.getElementById('noteOptions').style.width = '451px';
- document.getElementById('noteOptions').style.height = '236px';
+ //document.getElementById('noteOptions').style.left = 'calc(50vw - 451px / 2)';
+ //document.getElementById('noteOptions').style.top = 'calc(50vh - 236px / 2)';
+ //document.getElementById('noteOptions').style.width = '451px';
+ //document.getElementById('noteOptions').style.height = '236px';
document.getElementById('noteOptionsFrame').contentWindow.userDisplay = true;
document.getElementById('noteOptionsFrame').contentWindow.refreshNoteData('', Idx);
setDialogZIndex(null, 'noteOptions');
@@ -75,7 +104,7 @@ myNotesLayer.getSource().on('addfeature', function (event) {
event.feature.setProperties({
'noteid': newid,
'notename': 'new note ' + newid,
- 'notetype': 'Private',
+ 'notetype': 'private',
'description': 'new note'
});
loadNotesTreeFromSource();
@@ -86,7 +115,7 @@ function getNoteDataByIdx(Idx) {
return getDataByIdx(myNotesLayer.getSource(), Idx);
}
function getNoteIdxById(noteid) {
- return getIdxById(myNotesLayer.getSource(), 'noteid', noteid);
+ return getIdxByProperty(myNotesLayer.getSource(), 'noteid', noteid);
}
function zoomToNoteByIdx(Idx) {
zoomToFeatureByIdx(myNotesLayer.getSource(), Idx);
diff --git a/software/cnip/cnip/Scripts/cnip/webui/sidebar/mypolygons.js b/software/cnip/cnip/cnip/Scripts/cnip/webui/sidebar/mypolygons.js
similarity index 79%
rename from software/cnip/cnip/Scripts/cnip/webui/sidebar/mypolygons.js
rename to software/cnip/cnip/cnip/Scripts/cnip/webui/sidebar/mypolygons.js
index 292aa5136e..67ab9ac430 100644
--- a/software/cnip/cnip/Scripts/cnip/webui/sidebar/mypolygons.js
+++ b/software/cnip/cnip/cnip/Scripts/cnip/webui/sidebar/mypolygons.js
@@ -1,4 +1,6 @@
-$('#polygonsDiv').collapse({
+var sPolygonsTree = [];
+
+$('#polygonsDiv').collapse({
toggle: true
});
var polygonsTree = document.getElementById('polygonsUl');
@@ -54,6 +56,9 @@ document.getElementById('polygonsFillOpacity').addEventListener('change', setPol
document.getElementById('polygonsStrokeOpacity').addEventListener('change', setPolygonsStyle);
loadPolygonsTreeFromFile();
/* polygon functions*/
+function setPolygonsLabel(e) {
+ setPolygonsStyle(e);
+}
function setPolygonsStyle(e) {
if (e) { e.stopPropagation(); }
let custStyle = function (feature) {
@@ -68,51 +73,62 @@ function setPolygonsStyle(e) {
width: 3
}),
text: new ol.style.Text({
- text: feature.get('polygonname'),
+ text: document.getElementById("polygonsLabel").checked ? feature.get('polygonname') : '',
font: '14px "Liberation Sans", "Lucida Sans", "Lucida Sans Regular", "Lucida Grande", "Lucida Sans Unicode", Geneva, Verdana, sans-serif',
fill: new ol.style.Fill({ color: 'rgba(0,0,0,' + strokeOpacity + ')' }),
- stroke: new ol.style.Stroke({ color: 'rgba(255,255,255,' + strokeOpacity + ')', width: 2 })
+ stroke: new ol.style.Stroke({ color: 'rgba(255,255,255,' + strokeOpacity + ')', width: 2 }),
+ overflow: false
})
})];
};
myPolygonsLayer.setStyle(custStyle);
myMap.render();
}
+function setPolygonsVisiblity() {
+ if (myPolygonsLayer) {
+ if (document.getElementById("polygonsVisibility").checked === true) {
+ myPolygonsLayer.setVisible(true);
+ } else {
+ myPolygonsLayer.setVisible(false);
+ }
+ myMap.render();
+ ol.control.LayerSwitcher.renderPanel(myMap, toc);
+ }
+}
function loadPolygonsTreeFromFile() {
let httpRequest = new XMLHttpRequest();
- httpRequest.open('GET', '../' + vectorsPath + 'mypolygons.geojson', true);
- httpRequest.send();
+ httpRequest.open('GET', '../' + vectorsPath + 'mypolygons.geojson');
httpRequest.onload = function () {
let source = JSON.parse(httpRequest.responseText);
- polygonsTree.innerHTML = '';
- if (typeof source.features !== 'undefined') {
- for (let i = 0; i < source.features.length; i++) {
- polygonsTree.innerHTML = polygonsTree.innerHTML +
- ' ' +
- truncate(source.features[i].properties.polygonname, 27) + ' ';
+ function processLoop() {
+ if (source.features.length === myPolygonsLayer.getSource().getFeatures().length) {
+ loadPolygonsTreeFromSource();
+ } else {
+ setTimeout(processLoop, 500);
}
}
+ processLoop();
};
+ httpRequest.send();
}
function loadPolygonsTreeFromSource() {
- let features = myPolygonsLayer.getSource().getFeatures();
+ sPolygonsTree = buildSortedTreeFromSource(myPolygonsLayer, 'polygonid', 'polygonname');
polygonsTree.innerHTML = '';
- for (let i = 0; i < features.length; i++) {
+ for (let i = 0; i < sPolygonsTree.length; i++) {
polygonsTree.innerHTML = polygonsTree.innerHTML +
' ' +
- truncate(features[i].getProperties().polygonname, 27) + ' ';
+ sPolygonsTree[i][0].toString() + ');"> ' +
+ truncate(sPolygonsTree[i][2].toString(), 27) + '';
}
}
function showPolygonOptionsByIdx(e, Idx) {
if (e) { e.stopPropagation(); }
if (actionRunning) { return; }
document.getElementById('polyOptions').style.display = 'block';
- document.getElementById('polyOptions').style.left = 'calc(50vw - 351px / 2)';
- document.getElementById('polyOptions').style.top = 'calc(50vh - 236px / 2)';
- document.getElementById('polyOptions').style.width = '351px';
- document.getElementById('polyOptions').style.height = '236px';
+ //document.getElementById('polyOptions').style.left = 'calc(50vw - 351px / 2)';
+ //document.getElementById('polyOptions').style.top = 'calc(50vh - 236px / 2)';
+ //document.getElementById('polyOptions').style.width = '351px';
+ //document.getElementById('polyOptions').style.height = '236px';
document.getElementById('polyOptionsFrame').contentWindow.userDisplay = true;
document.getElementById('polyOptionsFrame').contentWindow.refreshPolygonData('', Idx);
setDialogZIndex(null, 'polyOptions');
@@ -129,7 +145,7 @@ function getPolygonDataByIdx(Idx) {
return getDataByIdx(myPolygonsLayer.getSource(), Idx);
}
function getPolygonIdxById(polygonid) {
- return getIdxById(myPolygonsLayer.getSource(), 'polygonid', polygonid);
+ return getIdxByProperty(myPolygonsLayer.getSource(), 'polygonid', polygonid);
}
function zoomToPolygonByIdx(Idx) {
zoomToFeatureByIdx(myPolygonsLayer.getSource(), Idx);
diff --git a/software/cnip/cnip/Scripts/cnip/webui/sidebar/myresults.js b/software/cnip/cnip/cnip/Scripts/cnip/webui/sidebar/myresults.js
similarity index 73%
rename from software/cnip/cnip/Scripts/cnip/webui/sidebar/myresults.js
rename to software/cnip/cnip/cnip/Scripts/cnip/webui/sidebar/myresults.js
index 094a9e003c..5adcc04416 100644
--- a/software/cnip/cnip/Scripts/cnip/webui/sidebar/myresults.js
+++ b/software/cnip/cnip/cnip/Scripts/cnip/webui/sidebar/myresults.js
@@ -1,4 +1,6 @@
-$('#resultsDiv').collapse({
+var sResultsTree = [];
+
+$('#resultsDiv').collapse({
toggle: true
});
var raster;
@@ -6,8 +8,15 @@ var resultsTree = document.getElementById('resultsUl');
initSingleSlider(document.getElementById('rasterOpacity'), '', '0', '1', '0.1', '0.8');
document.getElementById('rasterOpacity').addEventListener('change', setRasterStyle);
loadResultsTreeFromFile();
-/* polygon functions*/
-
+/* result functions*/
+function setRasterStyle(e) {
+ if (e) { e.stopPropagation(); }
+ if (raster) {
+ let opacity = Number($('#rasterOpacity').val());
+ raster.setOpacity(opacity);
+ myMap.render();
+ }
+}
function setRasterVisiblity() {
if (raster) {
if (document.getElementById("rasterVisibility").checked === true) {
@@ -19,125 +28,36 @@ function setRasterVisiblity() {
ol.control.LayerSwitcher.renderPanel(myMap, toc);
}
}
-function setLinksVisiblity() {
- if (myLinksLayer) {
- if (document.getElementById("linksVisibility").checked === true) {
- myLinksLayer.setVisible(true);
- } else {
- myLinksLayer.setVisible(false);
- }
- myMap.render();
- ol.control.LayerSwitcher.renderPanel(myMap, toc);
- }
-}
-
-function setPolygonsVisiblity() {
- if (myPolygonsLayer) {
- if (document.getElementById("polygonsVisibility").checked === true) {
- myPolygonsLayer.setVisible(true);
- } else {
- myPolygonsLayer.setVisible(false);
- }
- myMap.render();
- ol.control.LayerSwitcher.renderPanel(myMap, toc);
- }
-}
-
-function setNotesVisiblity() {
- if (myNotesLayer) {
- if (document.getElementById("notesVisibility").checked === true) {
- myNotesLayer.setVisible(true);
- } else {
- myNotesLayer.setVisible(false);
- }
- myMap.render();
- ol.control.LayerSwitcher.renderPanel(myMap, toc);
- }
-}
-function setSitesVisiblity() {
- if (myNetworkLayer) {
- if (document.getElementById("sitesVisibility").checked === true) {
- myNetworkLayer.setVisible(true);
- } else {
- myNetworkLayer.setVisible(false);
- }
- myMap.render();
- ol.control.LayerSwitcher.renderPanel(myMap, toc);
- }
-}
-
-function setPublicNotesVisiblity() {
- if (publicNotesLayer) {
- if (document.getElementById("publicNotesVisibility").checked === true) {
- publicNotesLayer.setVisible(true);
- } else {
- publicNotesLayer.setVisible(false);
- }
- myMap.render();
- ol.control.LayerSwitcher.renderPanel(myMap, toc);
- }
-}
-
-function setPublicSitesVisiblity() {
- if (publicNetworkLayer) {
- if (document.getElementById("publicSitesVisibility").checked === true) {
- publicNetworkLayer.setVisible(true);
- } else {
- publicNetworkLayer.setVisible(false);
- }
- myMap.render();
- ol.control.LayerSwitcher.renderPanel(myMap, toc);
- }
-}
-
-function setRasterStyle(e) {
- if (e) { e.stopPropagation(); }
- if (raster) {
- let opacity = Number($('#rasterOpacity').val());
- raster.setOpacity(opacity);
- myMap.render();
- }
-}
function loadResultsTreeFromFile() {
let httpRequest = new XMLHttpRequest();
- httpRequest.open('GET', '../' + vectorsPath + 'results.geojson', true);
- httpRequest.send();
+ httpRequest.open('GET', '../' + vectorsPath + 'results.geojson');
httpRequest.onload = function () {
let source = JSON.parse(httpRequest.responseText);
- resultsTree.innerHTML = '';
- if (typeof source.features !== 'undefined') {
- for (let i = 0; i < source.features.length; i++) {
- resultsTree.innerHTML = resultsTree.innerHTML +
- '' +
- '' +
- ' ' +
- ' ' + truncate(source.features[i].properties.resultname, 23) +
- ' ' +
- ' ' +
- '' +
- ' ' +
- ' ' +
- ' ';
+ function processLoop() {
+ if (source.features.length === resultsLayer.getSource().getFeatures().length) {
+ loadResultsTreeFromSource();
+ } else {
+ setTimeout(processLoop, 500);
}
}
+ processLoop();
};
+ httpRequest.send();
}
function loadResultsTreeFromSource() {
- let features = resultsLayer.getSource().getFeatures();
+ sResultsTree = buildSortedTreeFromSource(resultsLayer, 'resultid', 'resultname');
resultsTree.innerHTML = '';
- for (let i = 0; i < features.length; i++) {
+ for (let i = 0; i < sResultsTree.length; i++) {
resultsTree.innerHTML = resultsTree.innerHTML +
'' +
'' +
+ ' onclick="showResultByIdx(event,' + sResultsTree[i][0].toString() + ');">' +
' ' +
- ' ' + truncate(features[i].getProperties().resultname, 23) +
+ ' ' + truncate(sResultsTree[i][2].toString(), 23) +
' ' +
' ' +
'' +
+ ' onclick="deleteResultByIdx(event,' + sResultsTree[i][0].toString() + ');">' +
' ' +
' ' +
' ';
@@ -189,7 +109,7 @@ function showResultByIdx(e, Idx) {
}
function showResult(resultstring) {
if (resultstring) {
- if (resultstring.length == 0) {
+ if (resultstring.length === 0) {
return;
}
let result = resultstring.split('>');
@@ -224,7 +144,7 @@ function loadRaster(pngString) {
if (pngString) {
if (pngString.length > 0) {
let png = pngString.split(',');
- let extent = [png[1], png[2], png[3], png[4]];
+ let extent = [Number(png[1]), Number(png[2]), Number(png[3]), Number(png[4])];
if (raster) {
overlayLayers.getLayers().pop(raster);
}
@@ -240,6 +160,12 @@ function loadRaster(pngString) {
projection: 'EPSG:4326'
})
});
+ if (document.getElementById("zoomToRaster").checked === true) {
+ myMap.getView().animate({
+ duration: 700,
+ center: ol.extent.getCenter(ol.proj.transformExtent(extent, 'EPSG:4326', 'EPSG:3857'))
+ });
+ }
document.getElementById('rasterOpacity').setValue('0.8');
overlayLayers.getLayers().push(raster);
myNetworkLayer.setZIndex(9);
diff --git a/software/cnip/cnip/Scripts/cnip/webui/sidebar/settings.js b/software/cnip/cnip/cnip/Scripts/cnip/webui/sidebar/settings.js
similarity index 100%
rename from software/cnip/cnip/Scripts/cnip/webui/sidebar/settings.js
rename to software/cnip/cnip/cnip/Scripts/cnip/webui/sidebar/settings.js
diff --git a/software/cnip/cnip/cnip/Scripts/cnip/webui/sidebar/toolbox.js b/software/cnip/cnip/cnip/Scripts/cnip/webui/sidebar/toolbox.js
new file mode 100644
index 0000000000..4884272c9f
--- /dev/null
+++ b/software/cnip/cnip/cnip/Scripts/cnip/webui/sidebar/toolbox.js
@@ -0,0 +1,356 @@
+$('#analysisDiv').collapse({
+ toggle: true
+});
+$('#predictDiv').collapse({
+ toggle: true
+});
+$('#reportDiv').collapse({
+ toggle: true
+});
+function analyseBestCan(sites, polygonid) {
+ if (getActionRunning()) { return; }
+ _saveSettings();
+ saveAllVectors();
+ minimizeAllDialogs();
+ showProgress('Analysing Candidates');
+ setTimeout(function () {
+ let newid = Ajax_runccmd("GetNewResultId", "");
+ Ajax_runccmd("BestCandidate",
+ "{" +
+ "'resultid':'" + newid + "'," +
+ "'sites':'" + sites + "'," +
+ "'polygonid':'" + polygonid + "'" +
+ "}");
+ function processLoop() {
+ let chk = getForecastRunning();
+ if (chk === false) {
+ showResult(Ajax_runccmd("GetResultString",
+ "{'resultid':'" + newid + "'}"));
+ loadAllVectors(); closeProgress(); toggleSelect();
+ } else {
+ setTimeout(processLoop, 2000);
+ }
+ }
+ processLoop();
+ }, 500);
+}
+function analysePredictSites(polygonid, technology) {
+ if (getActionRunning()) { return; }
+ _saveSettings();
+ saveAllVectors();
+ minimizeAllDialogs();
+ showProgress('Predicting Sites');
+ setTimeout(function () {
+ let newid = Ajax_runccmd("GetNewResultId", "");
+ Ajax_runccmd("PredictSites",
+ "{" +
+ "'resultid':'" + newid + "'," +
+ "'polygonid':'" + polygonid + "'," +
+ "'technology':'" + technology + "'" +
+ "}");
+ function processLoop() {
+ let chk = getForecastRunning();
+ if (chk === false) {
+ showResult(Ajax_runccmd("GetResultString",
+ "{'resultid':'" + newid + "'}"));
+ loadAllVectors();
+ showNetworkReport(null, newid, Ajax_runccmd("GetRadioPlanResult", ""));
+ showLinksReport(null, newid, Ajax_runccmd("GetLinksResult", ""));
+ closeProgress(); toggleSelect();
+ } else {
+ setTimeout(processLoop, 2000);
+ }
+ }
+ processLoop();
+ }, 500);
+}
+function predictCoverage(sites) {
+ if (getActionRunning()) { return; }
+ _saveSettings();
+ saveAllVectors();
+ minimizeAllDialogs();
+ showProgress('Predicting Coverage');
+ setTimeout(function () {
+ let newid = Ajax_runccmd("GetNewResultId", "");
+ Ajax_runccmd("PredictCoverage",
+ "{" +
+ "'resultid':'" + newid + "'," +
+ "'sites':'" + sites + "'" +
+ "}");
+ function processLoop() {
+ let chk = getForecastRunning();
+ if (chk === false) {
+ showResult(Ajax_runccmd("GetResultString",
+ "{'resultid':'" + newid + "'}"));
+ loadAllVectors();
+ showNetworkReport(null, newid, Ajax_runccmd("GetRadioPlanResult", ""));
+ closeProgress(); toggleSelect();
+ } else {
+ setTimeout(processLoop, 2000);
+ }
+ }
+ processLoop();
+ }, 500);
+}
+function predictRadioPlan(sites) {
+ if (getActionRunning()) { return; }
+ _saveSettings();
+ saveAllVectors();
+ minimizeAllDialogs();
+ let d = new Date();
+ let resultid = Math.round(d.getTime() / 1000, 0).toString();
+ showProgress('Predicting Radio Plan');
+ setTimeout(function () {
+ Ajax_runccmd("RadioPlan",
+ "{" +
+ "'resultid':'" + resultid + "'," +
+ "'sites':'" + sites + "'" +
+ "}");
+ function processLoop() {
+ let chk = getForecastRunning();
+ if (chk === false) {
+ loadAllVectors();
+ showNetworkReport(null, resultid, Ajax_runccmd("GetRadioPlanResult", ""));
+ closeProgress(); toggleSelect();
+ } else {
+ setTimeout(processLoop, 2000);
+ }
+ }
+ processLoop();
+ }, 500);
+}
+function predictLinks(sites) {
+ if (getActionRunning()) { return; }
+ _saveSettings();
+ saveAllVectors();
+ minimizeAllDialogs();
+ let d = new Date();
+ let resultid = Math.round(d.getTime() / 1000, 0).toString();
+ showProgress('Predicting Links');
+ setTimeout(function () {
+ Ajax_runccmd("Links",
+ "{" +
+ "'resultid':'" + resultid + "'," +
+ "'sites':'" + sites + "'" +
+ "}");
+ function processLoop() {
+ let chk = getForecastRunning();
+ if (chk === false) {
+ loadAllVectors();
+ showLinksReport(null, resultid, Ajax_runccmd("GetLinksResult", ""));
+ closeProgress(); toggleSelect();
+ } else {
+ setTimeout(processLoop, 2000);
+ }
+ }
+ processLoop();
+ }, 500);
+}
+function showNetworkReport(e = null, testResultid = '', resultString = undefined) {
+ if (e) { e.stopPropagation(); }
+ let resultid = '';
+ let sites = [];
+ if (resultString) {
+ resultid = resultString.split('@')[0];
+ }
+ if (resultid.toString() === testResultid.toString() && resultid.length > 0) {
+ sites = resultString.split('@')[1].length > 0 ? resultString.split('@')[1].split(',') : [];
+ }
+ let features;
+ if (sites.length > 0) {
+ features = myNetworkLayer.getSource().getFeaturesByProperty('siteid', sites);
+ }
+ else {
+ features = myNetworkLayer.getSource().getFeatures();
+ }
+ if (features.length > 0) {
+ let header = [
+ 'Site Id', 'Site Name', 'Longitude', 'Latitude', 'Tower Height', 'Technology', 'Band', 'Bandwidth',
+ 'Cell ID', 'TAC / LAC', 'EARFCN / ARFCN', 'PCI / BSIC', 'DL Frequency', 'UL Frequency', 'RF Power',
+ 'Antenna Height', 'Azimuth', 'Antenna Model', 'Antenna Type', 'Polarization', 'V-Beamwidth', 'H-Beamwidth',
+ 'Downtilt', 'Antenna Gain', 'Feeder Loss'
+ ];
+ let th = '';
+ header = header.map(h => th + h + ' ');
+ header.unshift('');
+ header.push(' ');
+ let td = '';
+ let properties = [];
+ features.forEach(function (f) {
+ properties.push(' ');
+ properties.push(td + f.get('siteid') + '');
+ properties.push(td + f.get('sitename') + '');
+ properties.push(td + round(f.get('longitude'), 6).toString() + '°' + '');
+ properties.push(td + round(f.get('latitude'), 6).toString() + '°' + '');
+ properties.push(td + round(f.get('height'), 0).toString() + ' m' + '');
+ properties.push(td + f.get('technology') + '');
+ properties.push(td + f.get('band') + '');
+ properties.push(td + f.get('bandwidth') + ' MHz' + '');
+ properties.push(td + f.get('cellid') + '');
+ properties.push(td + f.get('lac') + '');
+ properties.push(td + f.get('rfcn') + '');
+ properties.push(td + f.get('rfid') + '');
+ properties.push(td + f.get('dlfrequency') + ' MHz' + '');
+ properties.push(td + f.get('ulfrequency') + ' MHz' + '');
+ properties.push(td + f.get('rfpower') + ' W' + '');
+ properties.push(td + round(f.get('hba'), 0).toString() + ' m' + '');
+ properties.push(td + f.get('azimuth') + '°' + '');
+ properties.push(td + f.get('antennamodel') + '');
+ properties.push(td + f.get('antennatype') + '');
+ properties.push(td + f.get('polarization') + '');
+ properties.push(td + f.get('vbeamwidth') + '°' + '');
+ properties.push(td + f.get('hbeamwidth') + '°' + '');
+ properties.push(td + f.get('downtilt') + '°' + '');
+ properties.push(td + f.get('antennagain') + ' dBi' + '');
+ properties.push(td + f.get('feederloss') + ' dB' + '');
+ properties.push(' ');
+ });
+ let details = '' + header.join('') + ' ' + properties.join('') + '
';
+ let loadObj = [];
+ loadObj.push({ title: 'Network details', contentType: 'table', contentHTML: details, contentPadding: '0', contentData: '', contentExtension: '.csv' });
+ ddsCreate('Network Report', loadObj);
+ }
+}
+function showLinksReport(e = null, testResultid = '', resultString = undefined) {
+ if (e) { e.stopPropagation(); }
+ let resultid = '';
+ let links = [];
+ let privateAdjustments = [];
+ let publicAdjustments = [];
+ let summaryHTML = '';
+ let summaryText = '';
+ if (resultString) {
+ resultid = resultString.split('@')[0];
+ }
+ if (resultid.toString() === testResultid.toString() && resultid.length > 0) {
+ links = resultString.split('@')[1].length > 0 ? resultString.split('@')[1].split(',') : [];
+ privateAdjustments = resultString.split('@')[2].length > 0 ? resultString.split('@')[2].split(',') : [];
+ publicAdjustments = resultString.split('@')[3].length > 0 ? resultString.split('@')[3].split(',') : [];
+ }
+ if (links.length > 0) {
+ summaryHTML = 'Links created ';
+ summaryText = 'Links created' + '\r\n';
+ let publicLink;
+ for (let i = 0; i < links.length; i++) {
+ publicLink = myLinksLayer.getSource().getFeatureByProperties({ 'linkid': links[i], 'linktype': 'public' });
+ if (publicLink) {
+ break;
+ }
+ }
+ if (publicLink) {
+ let publicSite = getPublicSite(publicLink.get('siteidb'), publicLink.get('email'));
+ summaryHTML += 'Public Link: Site Id: ' + publicSite.get('siteid') + ' Site Name: ' + publicSite.get('sitename') + ' from Public Network has been found,'
+ + ' Link Id: ' + publicLink.get('linkid') + ' has been added to link Public Site,' +
+ ' You can contact user: ' + publicSite.get('name') + ' on email address: ' + publicSite.get('email') + ' for correspondance. ';
+ summaryText += '\r\nPublic Link:\r\nSite Id:' + publicSite.get('siteid') + ' Site Name: ' + publicSite.get('sitename') + ' from Public Network has been found,'
+ + ' Link Id: ' + publicLink.get('linkid') + ' has been added to link Public Site,' +
+ ' You can contact user: ' + publicSite.get('name') + ' on email address: ' + publicSite.get('email') + ' for correspondance.\r\n';
+ if (publicAdjustments.length > 0) {
+ summaryHTML += 'Links adjusted to meet ' + document.getElementById('opt_fresnelclearance').value + '% Fresnel Zone clearance requirement. ';
+ summaryText += '\r\nLinks adjusted to meet ' + document.getElementById('opt_fresnelclearance').value + '% Fresnel Zone clearance requirement.\r\n';
+ for (let i = 0; i < publicAdjustments.length; i++) {
+ let adjustedSite = myNetworkLayer.getSource().getFeatureByProperty('siteid', publicAdjustments[i]);
+ summaryHTML += 'Site Id: ' + adjustedSite.get('siteid') + ' Site Name: ' + adjustedSite.get('sitename') + ', height has been adjusted to ' +
+ round(adjustedSite.get('height'), 0) + ' meters to link with Public Site ';
+ summaryText += 'Site Id: ' + adjustedSite.get('siteid') + ' Site Name: ' + adjustedSite.get('sitename') + ', height has been adjusted to ' +
+ round(adjustedSite.get('height'), 0) + ' meters to link with Public Site\r\n';
+ }
+ }
+ }
+ if (privateAdjustments.length > 0) {
+ if (publicAdjustments.length === 0) {
+ summaryHTML += 'Links adjusted to meet ' + document.getElementById('opt_fresnelclearance').value + '% Fresnel Zone clearance requirement. ';
+ summaryText += '\r\nLinks adjusted to meet ' + document.getElementById('opt_fresnelclearance').value + '% Fresnel Zone clearance requirement.\r\n';
+ }
+ for (i = 0; i < privateAdjustments.length; i++) {
+ let adjustedSite = myNetworkLayer.getSource().getFeatureByProperty('siteid', privateAdjustments[i]);
+ summaryHTML += 'Site Id: ' + adjustedSite.get('siteid') + ' Site Name: ' + adjustedSite.get('sitename') + ', height has been adjusted to ' +
+ round(adjustedSite.get('height'), 0) + ' meters. ';
+ summaryText += 'Site Id: ' + adjustedSite.get('siteid') + ' Site Name: ' + adjustedSite.get('sitename') + ', height has been adjusted to ' +
+ round(adjustedSite.get('height'), 0) + ' meters.\r\n';
+ }
+ }
+ summaryHTML += '
';
+ }
+ let features;
+ if (links.length > 0) {
+ features = myLinksLayer.getSource().getFeaturesByProperty('linkid', links);
+ }
+ else {
+ features = myLinksLayer.getSource().getFeatures();
+ }
+ if (features.length > 0) {
+ let header = [
+ 'Link Id', 'Link Name', 'Link Type',
+ 'Site Id A', 'Site Name A', 'Height / Elevation A', 'Bearing / Tilt A', 'Frequency A',
+ 'Channel Width A', 'Output Power A', 'Antenna Gain A', 'Losses A',
+ 'Site Id B', 'Site Name B', 'Height / Elevation B', 'Bearing / Tilt B', 'Frequency B',
+ 'Channel Width B', 'Output Power B', 'Antenna Gain B', 'Losses B'
+ ];
+ let th = '';
+ header = header.map(h => th + h + ' ');
+ header.unshift('');
+ header.push(' ');
+ let td = '';
+ let properties = [];
+ features.forEach(function (f) {
+ let siteA = myNetworkLayer.getSource().getFeatureByProperty('siteid', f.get('siteida'));
+ let siteB = undefined;
+ if (f.get('linktype') === 'public') {
+ siteB = getPublicSite(f.get('siteidb'), f.get('email'));
+ } else {
+ siteB = myNetworkLayer.getSource().getFeatureByProperty('siteid', f.get('siteidb'));
+ }
+ let xDistanceKm = Number(f.get('distance'));
+ let deviceheightAm = Number(f.get('heighta')) + Number(f.get('locheighta'));
+ let deviceheightBm = Number(f.get('heightb')) + Number(f.get('locheightb'));
+ let tiltAd = 0; tiltBd = 0;
+ if (deviceheightAm > deviceheightBm) {
+ tiltAd = -1 * round(turf.radiansToDegrees(Math.atan((deviceheightAm - deviceheightBm) / (xDistanceKm * 1000))), 2);
+ tiltBd = round(turf.radiansToDegrees(Math.atan((deviceheightAm - deviceheightBm) / (xDistanceKm * 1000))), 2);
+ } else if (deviceheightAm < deviceheightBm) {
+ tiltAd = round(turf.radiansToDegrees(Math.atan((deviceheightBm - deviceheightAm) / (xDistanceKm * 1000))), 2);
+ tiltBd = -1 * round(turf.radiansToDegrees(Math.atan((deviceheightBm - deviceheightAm) / (xDistanceKm * 1000))), 2);
+ } else {
+ tiltAd = 0; tiltBd = 0;
+ }
+ properties.push(' ');
+ properties.push(td + f.get('linkid') + '');
+ properties.push(td + f.get('linkname') + '');
+ properties.push(td + titleCase(f.get('linktype')) + '');
+ properties.push(td + f.get('siteida') + '');
+ properties.push(td + siteA.get('sitename') + '');
+ properties.push(td + round(parseFloat(f.get('heighta')), 1).toString() + ' m / ' + round(parseFloat(f.get('locheighta')), 0).toString() + ' m ');
+ properties.push(td + round(parseFloat(f.get('bearinga')), 2).toString() + '° / ' + (tiltAd).toString() + '° ');
+ properties.push(td + f.get('frequencya') + ' GHz');
+ properties.push(td + f.get('channelwidtha') + ' MHz');
+ properties.push(td + f.get('outputpowera') + ' dBm');
+ properties.push(td + f.get('antennagaina') + ' dBi');
+ properties.push(td + f.get('lossesa') + ' dB');
+ properties.push(td + f.get('siteidb') + '');
+ properties.push(td + siteB.get('sitename') + '');
+ properties.push(td + round(parseFloat(f.get('heightb')), 1).toString() + ' m / ' + round(parseFloat(f.get('locheightb')), 0).toString() + ' m ');
+ properties.push(td + round(parseFloat(f.get('bearingb')), 2).toString() + '° / ' + (tiltBd).toString() + '° ');
+ properties.push(td + f.get('frequencyb') + ' GHz');
+ properties.push(td + f.get('channelwidthb') + ' MHz');
+ properties.push(td + f.get('outputpowerb') + ' dBm');
+ properties.push(td + f.get('antennagainb') + ' dBi');
+ properties.push(td + f.get('lossesb') + ' dB');
+ properties.push(' ');
+ });
+ let details = '' + header.join('') + ' ' + properties.join('') + '
';
+ let loadObj = [];
+ if (summaryHTML.length > 0) {
+ loadObj.push({ title: 'Links summary', contentType: 'text', contentHTML: summaryHTML, contentPadding: '15px 10px', contentData: summaryText, contentExtension: '.txt' });
+ loadObj.push({ title: 'Links details', contentType: 'table', contentHTML: details, contentPadding: '0', contentData: '', contentExtension: '.csv' });
+ ddsCreate('Links Report', loadObj);
+ }
+ else {
+ loadObj.push({ title: 'Links details', contentType: 'table', contentHTML: details, contentPadding: '0', contentData: '', contentExtension: '.csv' });
+ ddsCreate('Links Report', loadObj);
+ }
+ }
+}
+var getForecastRunning = function () { return Ajax_runccmd("GetForecastRunning", "") === 'true'; };
+var getActionRunning = function () { return getForecastRunning() || actionRunning; };
+
diff --git a/software/cnip/cnip/Scripts/cnip/webui/styles.js b/software/cnip/cnip/cnip/Scripts/cnip/webui/styles.js
similarity index 100%
rename from software/cnip/cnip/Scripts/cnip/webui/styles.js
rename to software/cnip/cnip/cnip/Scripts/cnip/webui/styles.js
diff --git a/software/cnip/cnip/Scripts/cnip/webui/tileLayers/bingmaps.layers.js b/software/cnip/cnip/cnip/Scripts/cnip/webui/tileLayers/bingmaps.layers.js
similarity index 100%
rename from software/cnip/cnip/Scripts/cnip/webui/tileLayers/bingmaps.layers.js
rename to software/cnip/cnip/cnip/Scripts/cnip/webui/tileLayers/bingmaps.layers.js
diff --git a/software/cnip/cnip/Scripts/cnip/webui/tileLayers/googlemaps.layers.js b/software/cnip/cnip/cnip/Scripts/cnip/webui/tileLayers/googlemaps.layers.js
similarity index 100%
rename from software/cnip/cnip/Scripts/cnip/webui/tileLayers/googlemaps.layers.js
rename to software/cnip/cnip/cnip/Scripts/cnip/webui/tileLayers/googlemaps.layers.js
diff --git a/software/cnip/cnip/Scripts/cnip/webui/tileLayers/maptiler.layers.js b/software/cnip/cnip/cnip/Scripts/cnip/webui/tileLayers/maptiler.layers.js
similarity index 99%
rename from software/cnip/cnip/Scripts/cnip/webui/tileLayers/maptiler.layers.js
rename to software/cnip/cnip/cnip/Scripts/cnip/webui/tileLayers/maptiler.layers.js
index 2b63dbc54a..a2ceeed675 100644
--- a/software/cnip/cnip/Scripts/cnip/webui/tileLayers/maptiler.layers.js
+++ b/software/cnip/cnip/cnip/Scripts/cnip/webui/tileLayers/maptiler.layers.js
@@ -61,7 +61,7 @@ var lyrMapTilerHybrid = new ol.layer.Tile({
var lyrMapTilerStreets = new ol.layer.Tile({
title: 'Streets',
type: 'base',
- visible: true,
+ visible: false,
source: new ol.source.XYZ({
url: 'https://api.maptiler.com/maps/streets/{z}/{x}/{y}.png?key=aIokLGbrqIsRfBnnPIFP',
crossOrigin: 'anonymous',
diff --git a/software/cnip/cnip/Scripts/cnip/webui/tileLayers/mapzen.layers.js b/software/cnip/cnip/cnip/Scripts/cnip/webui/tileLayers/mapzen.layers.js
similarity index 100%
rename from software/cnip/cnip/Scripts/cnip/webui/tileLayers/mapzen.layers.js
rename to software/cnip/cnip/cnip/Scripts/cnip/webui/tileLayers/mapzen.layers.js
diff --git a/software/cnip/cnip/Scripts/cnip/webui/tileLayers/osm.layers.js b/software/cnip/cnip/cnip/Scripts/cnip/webui/tileLayers/osm.layers.js
similarity index 54%
rename from software/cnip/cnip/Scripts/cnip/webui/tileLayers/osm.layers.js
rename to software/cnip/cnip/cnip/Scripts/cnip/webui/tileLayers/osm.layers.js
index 22f34036d5..bc3d593e81 100644
--- a/software/cnip/cnip/Scripts/cnip/webui/tileLayers/osm.layers.js
+++ b/software/cnip/cnip/cnip/Scripts/cnip/webui/tileLayers/osm.layers.js
@@ -1,7 +1,10 @@
-var lyrOpenStreetMap = new ol.layer.Tile({
+var osmCopyright = '© OpenStreetMap contributors ';
+var topoCopyright = 'Kartendaten: © OpenStreetMap -Mitwirkende, SRTM | Kartendarstellung: © OpenTopoMap (CC-BY-SA )';
+
+var lyrOpenStreetMap = new ol.layer.Tile({
title: 'Street',
type: 'base',
- visible: false,
+ visible: true,
source: new ol.source.OSM({
wrapX: false
})
diff --git a/software/cnip/cnip/Scripts/cnip/webui/tileLayers/stamen.layers.js b/software/cnip/cnip/cnip/Scripts/cnip/webui/tileLayers/stamen.layers.js
similarity index 58%
rename from software/cnip/cnip/Scripts/cnip/webui/tileLayers/stamen.layers.js
rename to software/cnip/cnip/cnip/Scripts/cnip/webui/tileLayers/stamen.layers.js
index 46b0d3db9b..e8363a2a7c 100644
--- a/software/cnip/cnip/Scripts/cnip/webui/tileLayers/stamen.layers.js
+++ b/software/cnip/cnip/cnip/Scripts/cnip/webui/tileLayers/stamen.layers.js
@@ -1,10 +1,14 @@
-var lyrStamenToner = new ol.layer.Tile({
+var stamenTonerCopyright = 'Map tiles by Stamen Design , under CC BY 3.0 . Data by OpenStreetMap , under ODbL .';
+var stamenWatercolorCopyright = 'Map tiles by Stamen Design , under CC BY 3.0 . Data by OpenStreetMap , under CC BY SA .';
+
+var lyrStamenToner = new ol.layer.Tile({
title: 'Toner',
type: 'base',
visible: false,
source: new ol.source.Stamen({
layer: 'toner',
- wrapX: false})
+ wrapX: false
+ })
});
var lyrStamenTonerLite = new ol.layer.Tile({
title: 'Toner-Lite',
@@ -12,7 +16,8 @@ var lyrStamenTonerLite = new ol.layer.Tile({
visible: false,
source: new ol.source.Stamen({
layer: 'toner-lite',
- wrapX: false })
+ wrapX: false
+ })
});
var lyrStamenTerrain = new ol.layer.Tile({
title: 'Terrain',
@@ -20,7 +25,8 @@ var lyrStamenTerrain = new ol.layer.Tile({
visible: false,
source: new ol.source.Stamen({
layer: 'terrain',
- wrapX: false })
+ wrapX: false
+ })
});
var lyrStamenTerrainBackground = new ol.layer.Tile({
title: 'Terrain Background',
@@ -28,7 +34,8 @@ var lyrStamenTerrainBackground = new ol.layer.Tile({
visible: false,
source: new ol.source.Stamen({
layer: 'terrain-background',
- wrapX: false})
+ wrapX: false
+ })
});
var lyrStamenWaterColor = new ol.layer.Tile({
title: 'Water Color',
@@ -36,7 +43,8 @@ var lyrStamenWaterColor = new ol.layer.Tile({
visible: false,
source: new ol.source.Stamen({
layer: 'watercolor',
- wrapX: false})
+ wrapX: false
+ })
});
var StamenLayers = new ol.layer.Group({
title: 'Stamen',
diff --git a/software/cnip/cnip/Scripts/cnip/webui/tileLayers/thunderforest.layers.js b/software/cnip/cnip/cnip/Scripts/cnip/webui/tileLayers/thunderforest.layers.js
similarity index 90%
rename from software/cnip/cnip/Scripts/cnip/webui/tileLayers/thunderforest.layers.js
rename to software/cnip/cnip/cnip/Scripts/cnip/webui/tileLayers/thunderforest.layers.js
index 503b02c615..0fd3084ec1 100644
--- a/software/cnip/cnip/Scripts/cnip/webui/tileLayers/thunderforest.layers.js
+++ b/software/cnip/cnip/cnip/Scripts/cnip/webui/tileLayers/thunderforest.layers.js
@@ -1,4 +1,6 @@
-var thunderforestAttributions = [
+var thunderforestCopyright = 'Maps © Thunderforest , Data © OpenStreetMap contributors';
+
+var thunderforestAttributions = [
'Tiles © Thunderforest ',
ol.source.OSM.ATTRIBUTION
];
diff --git a/software/cnip/cnip/Scripts/cnip/webui/vectorLayers/vector.layers.js b/software/cnip/cnip/cnip/Scripts/cnip/webui/vectorLayers/vector.layers.js
similarity index 96%
rename from software/cnip/cnip/Scripts/cnip/webui/vectorLayers/vector.layers.js
rename to software/cnip/cnip/cnip/Scripts/cnip/webui/vectorLayers/vector.layers.js
index 6078559e31..01945d9243 100644
--- a/software/cnip/cnip/Scripts/cnip/webui/vectorLayers/vector.layers.js
+++ b/software/cnip/cnip/cnip/Scripts/cnip/webui/vectorLayers/vector.layers.js
@@ -14,7 +14,7 @@ var publicNotesLayer = new ol.layer.Vector({
maxResolution: 1000,
style: function (feature) {
return [new ol.style.Style({
- image: feature.get('notetype') === 'Public' ? new ol.style.Icon({
+ image: feature.get('notetype') === 'public' ? new ol.style.Icon({
scale: 1,
src: '../img/note_Public.png',
opacity: 1
@@ -49,7 +49,7 @@ var myNotesLayer = new ol.layer.Vector({
maxResolution: 1000,
style: function (feature) {
return [new ol.style.Style({
- image: feature.get('notetype') === 'Public' ? new ol.style.Icon({
+ image: feature.get('notetype') === 'public' ? new ol.style.Icon({
scale: 1,
src: '../img/notePublic.png',
opacity: 1
@@ -187,7 +187,7 @@ var myLinksLayer = new ol.layer.Vector({
style: function (feature, resolution) {
return [new ol.style.Style({
stroke: new ol.style.Stroke({
- color: feature.get('linktype') === 'internal' ? 'rgba(0,255,255,1)' : 'rgba(255,0,220,1)',
+ color: feature.get('linktype') === 'private' ? 'rgba(0,255,255,1)' : 'rgba(255,0,220,1)',
lineDash: [7, 7],
width: 4
}),
@@ -260,11 +260,11 @@ var baseLayers = new ol.layer.Group({
'title': 'Base Layers',
fold: 'close',
layers: [
- GoogleMapsLayers,
- BingMapsLayers,
- MapzenLayers,
+ //GoogleMapsLayers,
+ //BingMapsLayers,
+ //MapzenLayers,
ThunderForestLayers,
- MapTilerLayers,
+ //MapTilerLayers,
StamenLayers,
OSMLayers
]
diff --git a/software/cnip/cnip/Scripts/cnip/webui/vectorrequests.js b/software/cnip/cnip/cnip/Scripts/cnip/webui/vectorrequests.js
similarity index 91%
rename from software/cnip/cnip/Scripts/cnip/webui/vectorrequests.js
rename to software/cnip/cnip/cnip/Scripts/cnip/webui/vectorrequests.js
index 6c227ec8f4..59b2b3917a 100644
--- a/software/cnip/cnip/Scripts/cnip/webui/vectorrequests.js
+++ b/software/cnip/cnip/cnip/Scripts/cnip/webui/vectorrequests.js
@@ -6,7 +6,12 @@
let keys = feature.getKeys();
for (let j = 0; j < keys.length; j++) {
if (keys[j] !== 'geometry' && keys[j] !== 'elevstr') {
- returnString += feature.get(keys[j]).toString() + '\t';
+ if (feature.get(keys[j])) {
+ returnString += feature.get(keys[j]).toString() + '\t';
+ }
+ else {
+ returnString += '\t';
+ }
}
}
returnString = returnString.substring(0, returnString.length - 1);
@@ -14,15 +19,17 @@
}
return returnString;
}
-function getIdxById(source, key, id) {
+function getIdxByProperty(source, propertyname, propertyvalue) {
let features = source.getFeatures();
- let returnString = '';
+ let returnIdx = '-1';
for (let i = 0; i < features.length; i++) {
- if (features[i].get(key).toString() === id.toString()) {
- returnString = i.toString(); break;
+ if (features[i].get(propertyname)) {
+ if (features[i].get(propertyname).toString() === propertyvalue.toString()) {
+ returnIdx = i.toString(); break;
+ }
}
}
- return returnString;
+ return returnIdx;
}
function getFeaturesCount(source) {
return source.getFeatures().length;
@@ -104,6 +111,9 @@ var download = {
cols.push('type');
cols.push('coord');
}
+ csv = multiSort(csv, {
+ 0: 'asc'
+ });
csv.unshift(cols);
result = Papa.unparse(csv);
let blob = new Blob([result], { type: 'text/plain;charset=utf-8' });
diff --git a/software/cnip/cnip/Scripts/cnip/webui/webui.js b/software/cnip/cnip/cnip/Scripts/cnip/webui/webui.js
similarity index 67%
rename from software/cnip/cnip/Scripts/cnip/webui/webui.js
rename to software/cnip/cnip/cnip/Scripts/cnip/webui/webui.js
index b6a3ce2ac8..db246593be 100644
--- a/software/cnip/cnip/Scripts/cnip/webui/webui.js
+++ b/software/cnip/cnip/cnip/Scripts/cnip/webui/webui.js
@@ -2,6 +2,11 @@
var about = document.getElementById('about');
about.innerHTML = ' ';
about.style.display = 'block';
+
+var tileMapCopyright = document.getElementById('tileMapCopyright');
+tileMapCopyright.style.display = 'block';
+tileMapCopyright.innerHTML = '(DTM) courtesy of the U.S. Geological Survey , (Map) ' + osmCopyright;
+
// action status
var actionRunning = false;
// initialize map
@@ -11,8 +16,9 @@ var myMap = new ol.Map({
interactions: ol.interaction.defaults({ altShiftDragRotate: false, pinchRotate: false }),
target: 'myMap',
view: new ol.View({
- center: ol.proj.fromLonLat([67.056848, 24.808224]),
- zoom: 15
+ center: ol.proj.fromLonLat([-119.2471, 35.7688]),
+ zoom: 15,
+ constrainResolution: false
}),
layers: [
baseLayers,
@@ -67,11 +73,17 @@ var displayFeatureInfo = function (e) {
if (feature.getGeometry().getType() === 'Polygon') {
let geom = feature.clone().getGeometry().transform('EPSG:3857', 'EPSG:4326');
let polygon = turf.polygon(geom.getCoordinates());
- let area = round(turf.area(polygon) / 1000000, 2);
+ let area = turf.area(polygon);
+ let areaString;
+ if (area <= 1000000) {
+ areaString = round(area, 2).toString() + ' m²';
+ } else {
+ areaString = round(area / 1000000, 2).toString() + ' Km²';
+ }
let centerOfMass = turf.getCoord(turf.centerOfMass(polygon));
let center = turf.getCoord(turf.center(polygon));
properties.push('Calculated ');
- properties.push('Area : ' + area.toString() + ' Km²' + ' ');
+ properties.push('Area : ' + areaString + ' ');
properties.push('Center : ' + round(center[0], 6).toString() + ',' + round(center[1], 6).toString() + ' ');
properties.push('Center of Mass : ' + round(centerOfMass[0], 6).toString() + ',' + round(centerOfMass[1], 6).toString() + ' ');
properties.push(' ');
@@ -82,8 +94,9 @@ var displayFeatureInfo = function (e) {
properties.push('' + titleCase(key) +
' : ' +
(isNumber(feature.get(key)) ? round(parseFloat(feature.get(key)), 6) :
- feature.get(key).toString().length > 15 ?
- feature.get(key).toString().substr(0, 15) : feature.get(key)) +
+ key === 'email' || key === 'name' ? feature.get(key) :
+ feature.get(key).toString().length > 15 ?
+ feature.get(key).toString().substr(0, 15) : feature.get(key)) +
' ');
}
}
@@ -178,3 +191,65 @@ $('#sidebar div ul li a').click(function () {
toggleSelect();
});
+lyrOpenStreetMap.on('change:visible', function () {
+ if (lyrOpenStreetMap.getVisible()) {
+ tileMapCopyright.innerHTML = '(DTM) courtesy of the U.S. Geological Survey , (Map) ' + osmCopyright;
+ }
+});
+lyrOpenTopoMap.on('change:visible', function () {
+ if (lyrOpenTopoMap.getVisible()) {
+ tileMapCopyright.innerHTML = '(DTM) courtesy of the U.S. Geological Survey , (Map) ' + topoCopyright;
+ }
+});
+
+lyrStamenToner.on('change:visible', function () {
+ if (lyrStamenToner.getVisible()) {
+ tileMapCopyright.innerHTML = '(DTM) courtesy of the U.S. Geological Survey , (Map) ' + stamenTonerCopyright;
+ }
+});
+lyrStamenTonerLite.on('change:visible', function () {
+ if (lyrStamenToner.getVisible()) {
+ tileMapCopyright.innerHTML = '(DTM) courtesy of the U.S. Geological Survey , (Map) ' + stamenTonerCopyright;
+ }
+});
+lyrStamenTerrain.on('change:visible', function () {
+ if (lyrStamenTerrain.getVisible()) {
+ tileMapCopyright.innerHTML = '(DTM) courtesy of the U.S. Geological Survey , (Map) ' + stamenTonerCopyright;
+ }
+});
+lyrStamenTerrainBackground.on('change:visible', function () {
+ if (lyrStamenTerrainBackground.getVisible()) {
+ tileMapCopyright.innerHTML = '(DTM) courtesy of the U.S. Geological Survey , (Map) ' + stamenTonerCopyright;
+ }
+});
+lyrStamenWaterColor.on('change:visible', function () {
+ if (lyrStamenWaterColor.getVisible()) {
+ tileMapCopyright.innerHTML = '(DTM) courtesy of the U.S. Geological Survey , (Map) ' + stamenWatercolorCopyright;
+ }
+});
+
+lyrThunderForestCycleMap.on('change:visible', function () {
+ if (lyrThunderForestCycleMap.getVisible()) {
+ tileMapCopyright.innerHTML = '(DTM) courtesy of the U.S. Geological Survey , (Map) ' + thunderforestCopyright;
+ }
+});
+lyrThunderForestTransport.on('change:visible', function () {
+ if (lyrThunderForestTransport.getVisible()) {
+ tileMapCopyright.innerHTML = '(DTM) courtesy of the U.S. Geological Survey , (Map) ' + thunderforestCopyright;
+ }
+});
+lyrThunderForestTransportDark.on('change:visible', function () {
+ if (lyrThunderForestTransportDark.getVisible()) {
+ tileMapCopyright.innerHTML = '(DTM) courtesy of the U.S. Geological Survey , (Map) ' + thunderforestCopyright;
+ }
+});
+lyrThunderForestLandscape.on('change:visible', function () {
+ if (lyrThunderForestLandscape.getVisible()) {
+ tileMapCopyright.innerHTML = '(DTM) courtesy of the U.S. Geological Survey , (Map) ' + thunderforestCopyright;
+ }
+});
+lyrThunderForestOutdoors.on('change:visible', function () {
+ if (lyrThunderForestOutdoors.getVisible()) {
+ tileMapCopyright.innerHTML = '(DTM) courtesy of the U.S. Geological Survey , (Map) ' + thunderforestCopyright;
+ }
+});
diff --git a/software/cnip/cnip/Scripts/dom-to-image.min.js b/software/cnip/cnip/cnip/Scripts/dom-to-image.min.js
similarity index 100%
rename from software/cnip/cnip/Scripts/dom-to-image.min.js
rename to software/cnip/cnip/cnip/Scripts/dom-to-image.min.js
diff --git a/software/cnip/cnip/Scripts/html2canvas.min.js b/software/cnip/cnip/cnip/Scripts/html2canvas.min.js
similarity index 100%
rename from software/cnip/cnip/Scripts/html2canvas.min.js
rename to software/cnip/cnip/cnip/Scripts/html2canvas.min.js
diff --git a/software/cnip/cnip/Scripts/jquery-3.4.1.intellisense.js b/software/cnip/cnip/cnip/Scripts/jquery-3.4.1.intellisense.js
similarity index 100%
rename from software/cnip/cnip/Scripts/jquery-3.4.1.intellisense.js
rename to software/cnip/cnip/cnip/Scripts/jquery-3.4.1.intellisense.js
diff --git a/software/cnip/cnip/Scripts/jquery-3.4.1.js b/software/cnip/cnip/cnip/Scripts/jquery-3.4.1.js
similarity index 100%
rename from software/cnip/cnip/Scripts/jquery-3.4.1.js
rename to software/cnip/cnip/cnip/Scripts/jquery-3.4.1.js
diff --git a/software/cnip/cnip/Scripts/jquery-3.4.1.min.js b/software/cnip/cnip/cnip/Scripts/jquery-3.4.1.min.js
similarity index 100%
rename from software/cnip/cnip/Scripts/jquery-3.4.1.min.js
rename to software/cnip/cnip/cnip/Scripts/jquery-3.4.1.min.js
diff --git a/software/cnip/cnip/Scripts/jquery-3.4.1.min.map b/software/cnip/cnip/cnip/Scripts/jquery-3.4.1.min.map
similarity index 100%
rename from software/cnip/cnip/Scripts/jquery-3.4.1.min.map
rename to software/cnip/cnip/cnip/Scripts/jquery-3.4.1.min.map
diff --git a/software/cnip/cnip/Scripts/jquery-3.4.1.slim.js b/software/cnip/cnip/cnip/Scripts/jquery-3.4.1.slim.js
similarity index 100%
rename from software/cnip/cnip/Scripts/jquery-3.4.1.slim.js
rename to software/cnip/cnip/cnip/Scripts/jquery-3.4.1.slim.js
diff --git a/software/cnip/cnip/Scripts/jquery-3.4.1.slim.min.js b/software/cnip/cnip/cnip/Scripts/jquery-3.4.1.slim.min.js
similarity index 100%
rename from software/cnip/cnip/Scripts/jquery-3.4.1.slim.min.js
rename to software/cnip/cnip/cnip/Scripts/jquery-3.4.1.slim.min.js
diff --git a/software/cnip/cnip/Scripts/jquery-3.4.1.slim.min.map b/software/cnip/cnip/cnip/Scripts/jquery-3.4.1.slim.min.map
similarity index 100%
rename from software/cnip/cnip/Scripts/jquery-3.4.1.slim.min.map
rename to software/cnip/cnip/cnip/Scripts/jquery-3.4.1.slim.min.map
diff --git a/software/cnip/cnip/Scripts/jquery.min.js b/software/cnip/cnip/cnip/Scripts/jquery.min.js
similarity index 100%
rename from software/cnip/cnip/Scripts/jquery.min.js
rename to software/cnip/cnip/cnip/Scripts/jquery.min.js
diff --git a/software/cnip/cnip/Scripts/jquery.validate-vsdoc.js b/software/cnip/cnip/cnip/Scripts/jquery.validate-vsdoc.js
similarity index 100%
rename from software/cnip/cnip/Scripts/jquery.validate-vsdoc.js
rename to software/cnip/cnip/cnip/Scripts/jquery.validate-vsdoc.js
diff --git a/software/cnip/cnip/Scripts/jquery.validate.js b/software/cnip/cnip/cnip/Scripts/jquery.validate.js
similarity index 100%
rename from software/cnip/cnip/Scripts/jquery.validate.js
rename to software/cnip/cnip/cnip/Scripts/jquery.validate.js
diff --git a/software/cnip/cnip/Scripts/jquery.validate.min.js b/software/cnip/cnip/cnip/Scripts/jquery.validate.min.js
similarity index 100%
rename from software/cnip/cnip/Scripts/jquery.validate.min.js
rename to software/cnip/cnip/cnip/Scripts/jquery.validate.min.js
diff --git a/software/cnip/cnip/Scripts/jquery.validate.unobtrusive.js b/software/cnip/cnip/cnip/Scripts/jquery.validate.unobtrusive.js
similarity index 100%
rename from software/cnip/cnip/Scripts/jquery.validate.unobtrusive.js
rename to software/cnip/cnip/cnip/Scripts/jquery.validate.unobtrusive.js
diff --git a/software/cnip/cnip/Scripts/jquery.validate.unobtrusive.min.js b/software/cnip/cnip/cnip/Scripts/jquery.validate.unobtrusive.min.js
similarity index 100%
rename from software/cnip/cnip/Scripts/jquery.validate.unobtrusive.min.js
rename to software/cnip/cnip/cnip/Scripts/jquery.validate.unobtrusive.min.js
diff --git a/software/cnip/cnip/Scripts/modernizr-2.8.3.js b/software/cnip/cnip/cnip/Scripts/modernizr-2.8.3.js
similarity index 100%
rename from software/cnip/cnip/Scripts/modernizr-2.8.3.js
rename to software/cnip/cnip/cnip/Scripts/modernizr-2.8.3.js
diff --git a/software/cnip/cnip/Scripts/nouislider.min.css b/software/cnip/cnip/cnip/Scripts/nouislider.min.css
similarity index 100%
rename from software/cnip/cnip/Scripts/nouislider.min.css
rename to software/cnip/cnip/cnip/Scripts/nouislider.min.css
diff --git a/software/cnip/cnip/Scripts/nouislider.min.js b/software/cnip/cnip/cnip/Scripts/nouislider.min.js
similarity index 100%
rename from software/cnip/cnip/Scripts/nouislider.min.js
rename to software/cnip/cnip/cnip/Scripts/nouislider.min.js
diff --git a/software/cnip/cnip/Scripts/ol-contextmenu.js b/software/cnip/cnip/cnip/Scripts/ol-contextmenu.js
similarity index 100%
rename from software/cnip/cnip/Scripts/ol-contextmenu.js
rename to software/cnip/cnip/cnip/Scripts/ol-contextmenu.js
diff --git a/software/cnip/cnip/Scripts/ol-contextmenu.min.css b/software/cnip/cnip/cnip/Scripts/ol-contextmenu.min.css
similarity index 100%
rename from software/cnip/cnip/Scripts/ol-contextmenu.min.css
rename to software/cnip/cnip/cnip/Scripts/ol-contextmenu.min.css
diff --git a/software/cnip/cnip/Scripts/ol-debug.js b/software/cnip/cnip/cnip/Scripts/ol-debug.js
similarity index 100%
rename from software/cnip/cnip/Scripts/ol-debug.js
rename to software/cnip/cnip/cnip/Scripts/ol-debug.js
diff --git a/software/cnip/cnip/Scripts/ol-ext.min.css b/software/cnip/cnip/cnip/Scripts/ol-ext.min.css
similarity index 100%
rename from software/cnip/cnip/Scripts/ol-ext.min.css
rename to software/cnip/cnip/cnip/Scripts/ol-ext.min.css
diff --git a/software/cnip/cnip/Scripts/ol-ext.min.js b/software/cnip/cnip/cnip/Scripts/ol-ext.min.js
similarity index 100%
rename from software/cnip/cnip/Scripts/ol-ext.min.js
rename to software/cnip/cnip/cnip/Scripts/ol-ext.min.js
diff --git a/software/cnip/cnip/Scripts/ol-layerswitcher.css b/software/cnip/cnip/cnip/Scripts/ol-layerswitcher.css
similarity index 100%
rename from software/cnip/cnip/Scripts/ol-layerswitcher.css
rename to software/cnip/cnip/cnip/Scripts/ol-layerswitcher.css
diff --git a/software/cnip/cnip/Scripts/ol-layerswitcher.js b/software/cnip/cnip/cnip/Scripts/ol-layerswitcher.js
similarity index 100%
rename from software/cnip/cnip/Scripts/ol-layerswitcher.js
rename to software/cnip/cnip/cnip/Scripts/ol-layerswitcher.js
diff --git a/software/cnip/cnip/Scripts/ol.css b/software/cnip/cnip/cnip/Scripts/ol.css
similarity index 100%
rename from software/cnip/cnip/Scripts/ol.css
rename to software/cnip/cnip/cnip/Scripts/ol.css
diff --git a/software/cnip/cnip/Scripts/ol.js b/software/cnip/cnip/cnip/Scripts/ol.js
similarity index 100%
rename from software/cnip/cnip/Scripts/ol.js
rename to software/cnip/cnip/cnip/Scripts/ol.js
diff --git a/software/cnip/cnip/Scripts/ol3-sidebar.css b/software/cnip/cnip/cnip/Scripts/ol3-sidebar.css
similarity index 100%
rename from software/cnip/cnip/Scripts/ol3-sidebar.css
rename to software/cnip/cnip/cnip/Scripts/ol3-sidebar.css
diff --git a/software/cnip/cnip/Scripts/ol3-sidebar.js b/software/cnip/cnip/cnip/Scripts/ol3-sidebar.js
similarity index 100%
rename from software/cnip/cnip/Scripts/ol3-sidebar.js
rename to software/cnip/cnip/cnip/Scripts/ol3-sidebar.js
diff --git a/software/cnip/cnip/Scripts/papaparse.min.js b/software/cnip/cnip/cnip/Scripts/papaparse.min.js
similarity index 100%
rename from software/cnip/cnip/Scripts/papaparse.min.js
rename to software/cnip/cnip/cnip/Scripts/papaparse.min.js
diff --git a/software/cnip/cnip/Scripts/polyfill.min.js b/software/cnip/cnip/cnip/Scripts/polyfill.min.js
similarity index 100%
rename from software/cnip/cnip/Scripts/polyfill.min.js
rename to software/cnip/cnip/cnip/Scripts/polyfill.min.js
diff --git a/software/cnip/cnip/cnip/Scripts/sorttable.js b/software/cnip/cnip/cnip/Scripts/sorttable.js
new file mode 100644
index 0000000000..21ddd36961
--- /dev/null
+++ b/software/cnip/cnip/cnip/Scripts/sorttable.js
@@ -0,0 +1,508 @@
+/*
+ SortTable
+ version 2
+ 7th April 2007
+ Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/
+ Instructions:
+ Download this file
+ Add to your HTML
+ Add class="sortable" to any table you'd like to make sortable
+ Click on the headers to sort
+ Thanks to many, many people for contributions and suggestions.
+ Licenced as X11: http://www.kryogenix.org/code/browser/licence.html
+ This basically means: do what you want with it.
+*/
+
+/* jshint -W051, -W083, -W027 */
+
+var stIsIE = /*@cc_on!@*/false;
+
+sorttable = {
+ init: function () {
+ // quit if this function has already been called
+ if (arguments.callee.done) return;
+ // flag this function so we don't do the same thing twice
+ arguments.callee.done = true;
+ // kill the timer
+ if (_timer) clearInterval(_timer);
+
+ if (!document.createElement || !document.getElementsByTagName) return;
+
+ sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/;
+
+ forEach(document.getElementsByTagName('table'), function (table) {
+ if (table.className.search(/\bsortable\b/) != -1) {
+ sorttable.makeSortable(table);
+ }
+ });
+
+ },
+
+ makeSortable: function (table) {
+ if (table.getElementsByTagName('thead').length === 0) {
+ // table doesn't have a tHead. Since it should have, create one and
+ // put the first table row in it.
+ the = document.createElement('thead');
+ the.appendChild(table.rows[0]);
+ table.insertBefore(the, table.firstChild);
+ }
+ // Safari doesn't support table.tHead, sigh
+ if (table.tHead === null) table.tHead = table.getElementsByTagName('thead')[0];
+
+ if (table.tHead.rows.length != 1) return; // can't cope with two header rows
+
+ // Sorttable v1 put rows with a class of "sortbottom" at the bottom (as
+ // "total" rows, for example). This is B&R, since what you're supposed
+ // to do is put them in a tfoot. So, if there are sortbottom rows,
+ // for backwards compatibility, move them to tfoot (creating it if needed).
+ sortbottomrows = [];
+ for (var i = 0; i < table.rows.length; i++) {
+ if (table.rows[i].className.search(/\bsortbottom\b/) != -1) {
+ sortbottomrows[sortbottomrows.length] = table.rows[i];
+ }
+ }
+ if (sortbottomrows) {
+ if (table.tFoot === null) {
+ // table doesn't have a tfoot. Create one.
+ tfo = document.createElement('tfoot');
+ table.appendChild(tfo);
+ }
+ for (i = 0; i < sortbottomrows.length; i++) {
+ tfo.appendChild(sortbottomrows[i]);
+ }
+ //delete sortbottomrows;
+ }
+
+ // work through each column and calculate its type
+ headrow = table.tHead.rows[0].cells;
+ for (i = 0; i < headrow.length; i++) {
+ // manually override the type with a sorttable_type attribute
+ if (!headrow[i].className.match(/\bsorttable_nosort\b/)) { // skip this col
+ mtch = headrow[i].className.match(/\bsorttable_([a-z0-9]+)\b/);
+ if (mtch) { override = mtch[1]; }
+ if (mtch && typeof sorttable["sort_" + override] == 'function') {
+ headrow[i].sorttable_sortfunction = sorttable["sort_" + override];
+ } else {
+ headrow[i].sorttable_sortfunction = sorttable.guessType(table, i);
+ }
+ // make it clickable to sort
+ headrow[i].sorttable_columnindex = i;
+ headrow[i].sorttable_tbody = table.tBodies[0];
+ dean_addEvent(headrow[i], "click", sorttable.innerSortFunction = function (e) {
+
+ if (this.className.search(/\bsorttable_sorted\b/) != -1) {
+ // if we're already sorted by this column, just
+ // reverse the table, which is quicker
+ sorttable.reverse(this.sorttable_tbody);
+ this.className = this.className.replace('sorttable_sorted',
+ 'sorttable_sorted_reverse');
+ if (this.hasChildNodes) {
+ if (this.lastChild.id === 'sorttable_sortfwdind' || this.lastChild.id === 'sorttable_sortrevind') {
+ this.removeChild(this.lastChild);
+ }
+ }
+ sortrevind = document.createElement('span');
+ sortrevind.id = "sorttable_sortrevind";
+ sortrevind.innerHTML = stIsIE ? ' 5 ' : ' ▴';
+ this.appendChild(sortrevind);
+ return;
+ }
+ if (this.className.search(/\bsorttable_sorted_reverse\b/) != -1) {
+ // if we're already sorted by this column in reverse, just
+ // re-reverse the table, which is quicker
+ sorttable.reverse(this.sorttable_tbody);
+ this.className = this.className.replace('sorttable_sorted_reverse',
+ 'sorttable_sorted');
+ if (this.hasChildNodes) {
+ if (this.lastChild.id === 'sorttable_sortfwdind' || this.lastChild.id === 'sorttable_sortrevind') {
+ this.removeChild(this.lastChild);
+ }
+ } //if (this.childNodes.item('sorttable_sortrevind')) {
+ // this.removeChild(this.childNodes.item('sorttable_sortrevind'));
+ //}
+ sortfwdind = document.createElement('span');
+ sortfwdind.id = "sorttable_sortfwdind";
+ sortfwdind.innerHTML = stIsIE ? ' 6 ' : ' ▾';
+ this.appendChild(sortfwdind);
+ return;
+ }
+
+ // remove sorttable_sorted classes
+ theadrow = this.parentNode;
+ forEach(theadrow.childNodes, function (cell) {
+ if (cell.nodeType == 1) { // an element
+ cell.className = cell.className.replace('sorttable_sorted_reverse', '');
+ cell.className = cell.className.replace('sorttable_sorted', '');
+ }
+ });
+ sortfwdind = document.getElementById('sorttable_sortfwdind');
+ if (sortfwdind) { sortfwdind.parentNode.removeChild(sortfwdind); }
+ sortrevind = document.getElementById('sorttable_sortrevind');
+ if (sortrevind) { sortrevind.parentNode.removeChild(sortrevind); }
+
+ this.className += ' sorttable_sorted';
+ sortfwdind = document.createElement('span');
+ sortfwdind.id = "sorttable_sortfwdind";
+ sortfwdind.innerHTML = stIsIE ? ' 6 ' : ' ▾';
+ this.appendChild(sortfwdind);
+
+ // build an array to sort. This is a Schwartzian transform thing,
+ // i.e., we "decorate" each row with the actual sort key,
+ // sort based on the sort keys, and then put the rows back in order
+ // which is a lot faster because you only do getInnerText once per row
+ row_array = [];
+ col = this.sorttable_columnindex;
+ rows = this.sorttable_tbody.rows;
+ for (var j = 0; j < rows.length; j++) {
+ row_array[row_array.length] = [sorttable.getInnerText(rows[j].cells[col]), rows[j]];
+ }
+ /* If you want a stable sort, uncomment the following line */
+ //sorttable.shaker_sort(row_array, this.sorttable_sortfunction);
+ /* and comment out this one */
+ row_array.sort(this.sorttable_sortfunction);
+
+ tb = this.sorttable_tbody;
+ for (j = 0; j < row_array.length; j++) {
+ tb.appendChild(row_array[j][1]);
+ }
+
+ //delete row_array;
+ });
+ }
+ }
+ },
+
+ guessType: function (table, column) {
+ // guess the type of a column based on its first non-blank row
+ sortfn = sorttable.sort_alpha;
+ for (var i = 0; i < table.tBodies[0].rows.length; i++) {
+ text = sorttable.getInnerText(table.tBodies[0].rows[i].cells[column]);
+ if (text !== '') {
+ if (text.match(/^-?[£$¤]?[\d,.]+%?$/)) {
+ return sorttable.sort_numeric;
+ }
+ // check for a date: dd/mm/yyyy or dd/mm/yy
+ // can have / or . or - as separator
+ // can be mm/dd as well
+ possdate = text.match(sorttable.DATE_RE);
+ if (possdate) {
+ // looks like a date
+ first = parseInt(possdate[1], 10);
+ second = parseInt(possdate[2], 10);
+ if (first > 12) {
+ // definitely dd/mm
+ return sorttable.sort_ddmm;
+ } else if (second > 12) {
+ return sorttable.sort_mmdd;
+ } else {
+ // looks like a date, but we can't tell which, so assume
+ // that it's dd/mm (English imperialism!) and keep looking
+ sortfn = sorttable.sort_ddmm;
+ }
+ }
+ }
+ }
+ return sortfn;
+ },
+
+ getInnerText: function (node) {
+ // gets the text we want to use for sorting for a cell.
+ // strips leading and trailing whitespace.
+ // this is *not* a generic getInnerText function; it's special to sorttable.
+ // for example, you can override the cell text with a customkey attribute.
+ // it also gets .value for fields.
+
+ if (!node) return "";
+
+ hasInputs = (typeof node.getElementsByTagName == 'function') &&
+ node.getElementsByTagName('input').length;
+
+ if (node.nodeType == 1 && node.getAttribute("sorttable_customkey") !== null) {
+ return node.getAttribute("sorttable_customkey");
+ }
+ else if (typeof node.textContent != 'undefined' && !hasInputs) {
+ return node.textContent.replace(/^\s+|\s+$/g, '');
+ }
+ else if (typeof node.innerText != 'undefined' && !hasInputs) {
+ return node.innerText.replace(/^\s+|\s+$/g, '');
+ }
+ else if (typeof node.text != 'undefined' && !hasInputs) {
+ return node.text.replace(/^\s+|\s+$/g, '');
+ }
+ else {
+ switch (node.nodeType) {
+ case 3:
+ if (node.nodeName.toLowerCase() == 'input') {
+ return node.value.replace(/^\s+|\s+$/g, '');
+ }
+ break;
+ case 4:
+ return node.nodeValue.replace(/^\s+|\s+$/g, '');
+ break;
+ case 1:
+ case 11:
+ var innerText = '';
+ for (var i = 0; i < node.childNodes.length; i++) {
+ innerText += sorttable.getInnerText(node.childNodes[i]);
+ }
+ return innerText.replace(/^\s+|\s+$/g, '');
+ break;
+ default:
+ return '';
+ }
+ }
+ },
+
+ reverse: function (tbody) {
+ // reverse the rows in a tbody
+ newrows = [];
+ for (var i = 0; i < tbody.rows.length; i++) {
+ newrows[newrows.length] = tbody.rows[i];
+ }
+ for (i = newrows.length - 1; i >= 0; i--) {
+ tbody.appendChild(newrows[i]);
+ }
+ //delete newrows;
+ },
+
+ /* sort functions
+ each sort function takes two parameters, a and b
+ you are comparing a[0] and b[0] */
+ sort_numeric: function (a, b) {
+ aa = parseFloat(a[0].replace(/[^0-9.-]/g, ''));
+ if (isNaN(aa)) aa = 0;
+ bb = parseFloat(b[0].replace(/[^0-9.-]/g, ''));
+ if (isNaN(bb)) bb = 0;
+ return aa - bb;
+ },
+ sort_alpha: function (a, b) {
+ return a[0].localeCompare(b[0]);
+ /*
+ if (a[0]==b[0]) return 0;
+ if (a[0] 0) {
+ q = list[i]; list[i] = list[i + 1]; list[i + 1] = q;
+ swap = true;
+ }
+ } // for
+ t--;
+
+ if (!swap) break;
+
+ for (i = t; i > b; --i) {
+ if (comp_func(list[i], list[i - 1]) < 0) {
+ q = list[i]; list[i] = list[i - 1]; list[i - 1] = q;
+ swap = true;
+ }
+ } // for
+ b++;
+
+ } // while(swap)
+ }
+};
+
+/* ******************************************************************
+ Supporting functions: bundled here to avoid depending on a library
+ ****************************************************************** */
+
+// Dean Edwards/Matthias Miller/John Resig
+
+/* for Mozilla/Opera9 */
+if (document.addEventListener) {
+ document.addEventListener("DOMContentLoaded", sorttable.init, false);
+}
+
+/* for Internet Explorer */
+/*@cc_on @*/
+/*@if (@_win32)
+ document.write("
@@ -22,16 +22,16 @@
@@ -74,7 +79,7 @@
@@ -82,12 +87,15 @@
+
+
+
+
Community Network Interactive Planner
-
- an online radio propagation and network design tool
-
- fast, easy, reliable and full of unique insights
-
+
+
+ A Cloud Based Radio Network Planning And Design Tool
+
-