updated version

This commit is contained in:
Ali Raza Anis
2020-05-12 02:19:41 +05:00
parent cbc6b96734
commit a1ec1cf924
282 changed files with 4331 additions and 1746 deletions

63
software/cnip/cnip/.gitattributes vendored Normal file
View File

@@ -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

261
software/cnip/cnip/.gitignore vendored Normal file
View File

@@ -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

View File

@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TimeStampOfAssociatedLegacyPublishXmlFile />
<EncryptedPassword />
</PropertyGroup>
</Project>

View File

@@ -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 = '<table></table>';
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 = '<thead>';
innerHtml += '<tr><th></th></tr>';
innerHtml += '</thead><tbody>';
if (tDistance !== undefined && tElevation !== undefined && tLosHeight !== undefined && tFresnelZone !== undefined) {
innerHtml += '<tr><td style="background-color:rgba(0,0,0,0.7);color:white;font-size:12px;" >Distance (Km): ' + tDistance.toString() + '</td></tr>';
innerHtml += '<tr><td style="background-color:rgba(0,0,0,0.7);color:white;font-size:12px;" >Elevation (m): ' + tElevation.toString() + '</td></tr>';
innerHtml += '<tr><td style="background-color:rgba(0,0,0,0.7);color:white;font-size:12px;" >Los Height (m): ' + round(tLosHeight - tElevation, 2).toString() + '</td></tr>';
innerHtml += '<tr><td style="background-color:rgba(0,0,0,0.7);color:white;font-size:12px;" >Fresnel Height (m): ' + round(tFresnelZone - tElevation, 2).toString() + '</td></tr>';
}
innerHtml += '</tbody>';
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());
}

View File

@@ -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);
}

View File

@@ -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]);
}
}
};

View File

@@ -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 => '<td style="color:var(--facecolor);background-color:var(--barcolor);white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + h + '</td>');
header.unshift('<tr>');
header.push('</tr>');
let properties = [];
let features = myNetworkLayer.getSource().getFeatures();
features.forEach(function (f) {
properties.push('<tr>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + f.get('siteid') + '</td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + f.get('sitename') + '</td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + round(f.get('longitude'), 6).toString() + '°' + '</td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + round(f.get('latitude'), 6).toString() + '°' + '</td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + round(f.get('height'), 0).toString() + ' m' + '</td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + f.get('technology') + '</td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + f.get('band') + '</td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + f.get('bandwidth') + ' MHz' + '</td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + f.get('cellid') + '</td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + f.get('lac') + '</td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + f.get('rfcn') + '</td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + f.get('rfid') + '</td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + f.get('dlfrequency') + ' MHz' + '</td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + f.get('ulfrequency') + ' MHz' + '</td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + f.get('rfpower') + ' W' + '</td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + round(f.get('hba'), 0).toString() + ' m' + '</td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + f.get('azimuth') + '°' + '</td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + f.get('antennamodel') + '</td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + f.get('antennatype') + '</td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + f.get('polarization') + '</td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + f.get('vbeamwidth') + '°' + '</td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + f.get('hbeamwidth') + '°' + '</td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + f.get('downtilt') + '°' + '</td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + f.get('antennagain') + ' dBi' + '</td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + f.get('feederloss') + ' dB' + '</td>');
properties.push('</tr>');
});
csvString += properties.join(',');
while (csvString.includes('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">')) {
csvString = csvString.replace('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">', '');
}
while (csvString.includes('</td>')) {
csvString = csvString.replace('</td>', '');
}
while (csvString.includes('<tr>,')) {
csvString = csvString.replace('<tr>,', '');
}
while (csvString.includes('</tr>,')) {
csvString = csvString.replace('</tr>,', '\r\n');
}
while (csvString.includes('</tr>')) {
csvString = csvString.replace('</tr>', '');
}
let details = '<table><tbody>' + header.join('') + properties.join('') + '</tbody></table>';
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 = '<div><b>Links created</b><br/>';
let publicLink = myLinksLayer.getSource().getFeatureByProperty('linktype', 'public');
if (publicLink) {
let publicSite = getPublicSite(publicLink.get('siteidb'), publicLink.get('email'));
summary += '<br/><b>Public Link:</b><br/>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.<br/>';
if (modifiedLinks.external.length > 0) {
summary += '<br/><b>Links adjusted to meet ' + document.getElementById('opt_fresnelclearance').value + '% Fresnel Zone clearance requirement:</b><br/>';
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<br/>';
}
}
if (modifiedLinks.internal.length > 0) {
if (modifiedLinks.external.length === 0) {
summary += '<br/><b>Links adjusted to meet ' + document.getElementById('opt_fresnelclearance').value + '% Fresnel Zone clearance requirement:</b><br/>';
}
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<br/>';
}
}
summary += '</div>';
}
let textString = summary;
while (textString.includes('<div>')) {
textString = textString.replace('<div>', '');
}
while (textString.includes('</div>')) {
textString = textString.replace('</div>', '');
}
while (textString.includes('<br/>')) {
textString = textString.replace('<br/>', '\r\n');
}
while (textString.includes('<b>')) {
textString = textString.replace('<b>', '');
}
while (textString.includes('</b>')) {
textString = textString.replace('</b>', '');
}
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 => '<td style="color:var(--facecolor);background-color:var(--barcolor);white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + h + '</td>');
header.unshift('<tr>');
header.push('</tr>');
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('<tr>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + f.get('linkid') + '</td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + f.get('linkname') + '</td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + titleCase(f.get('linktype')) + '</td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + f.get('siteida') + '</td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + siteA.get('sitename') + '</td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + round(parseFloat(siteA.get('height')), 0).toString() + ' m / ' + round(parseFloat(f.get('locheighta')), 0).toString() + ' m </td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + round(parseFloat(f.get('bearinga')), 2).toString() + '° / ' + (tiltAd).toString() + '° </td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + f.get('frequencya') + ' GHz</td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + f.get('channelwidtha') + ' MHz</td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + f.get('outputpowera') + ' dBm</td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + f.get('antennagaina') + ' dBi</td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + f.get('lossesa') + ' dB</td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + f.get('siteidb') + '</td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + siteB.get('sitename') + '</td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + round(parseFloat(siteB.get('height')), 0).toString() + ' m / ' + round(parseFloat(f.get('locheightb')), 0).toString() + ' m </td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + round(parseFloat(f.get('bearingb')), 2).toString() + '° / ' + (tiltBd).toString() + '° </td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + f.get('frequencyb') + ' GHz</td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + f.get('channelwidthb') + ' MHz</td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + f.get('outputpowerb') + ' dBm</td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + f.get('antennagainb') + ' dBi</td>');
properties.push('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">' + f.get('lossesb') + ' dB</td>');
properties.push('</tr>');
});
csvString += properties.join(',');
while (csvString.includes('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">')) {
csvString = csvString.replace('<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">', '');
}
while (csvString.includes('</td>')) {
csvString = csvString.replace('</td>', '');
}
while (csvString.includes('<tr>,')) {
csvString = csvString.replace('<tr>,', '');
}
while (csvString.includes('</tr>,')) {
csvString = csvString.replace('</tr>,', '\r\n');
}
while (csvString.includes('</tr>')) {
csvString = csvString.replace('</tr>', '');
}
let details = '<table><tbody>' + header.join('') + properties.join('') + '</tbody></table>';
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; };

View File

@@ -1,40 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<UseIISExpress>true</UseIISExpress>
<Use64BitIISExpress>
</Use64BitIISExpress>
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
<UseGlobalApplicationHostFile />
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
<NameOfLastUsedPublishProfile>CustomProfile</NameOfLastUsedPublishProfile>
</PropertyGroup>
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<StartPageUrl>
</StartPageUrl>
<StartAction>CurrentPage</StartAction>
<AspNetDebugging>True</AspNetDebugging>
<SilverlightDebugging>False</SilverlightDebugging>
<NativeDebugging>False</NativeDebugging>
<SQLDebugging>False</SQLDebugging>
<ExternalProgram>
</ExternalProgram>
<StartExternalURL>
</StartExternalURL>
<StartCmdLineArguments>
</StartCmdLineArguments>
<StartWorkingDirectory>
</StartWorkingDirectory>
<EnableENC>True</EnableENC>
<AlwaysStartWebServerOnDebug>True</AlwaysStartWebServerOnDebug>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
</Project>

View File

@@ -539,4 +539,14 @@ td {
background-color: var(--backcolor) !important;
color: var(--hovercolor) !important;
font-weight: 600;
}
}
/* 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"
}

View File

@@ -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);
}

View File

@@ -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);

View File

@@ -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() +

View File

@@ -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);
}

View File

@@ -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 = '<table></table>';
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 = '<thead>';
innerHtml += '<tr><th></th></tr>';
innerHtml += '</thead><tbody>';
if (tDistance !== undefined && tElevation !== undefined && tLosHeight !== undefined && tFresnelZone !== undefined) {
innerHtml += '<tr><td style="background-color:rgba(0,0,0,0.7);color:white;font-size:12px;" >Distance (Km): ' + tDistance.toString() + '</td></tr>';
innerHtml += '<tr><td style="background-color:rgba(0,0,0,0.7);color:white;font-size:12px;" >Elevation (m): ' + tElevation.toString() + '</td></tr>';
innerHtml += '<tr><td style="background-color:rgba(0,0,0,0.7);color:white;font-size:12px;" >Los Height (m): ' + round(tLosHeight - tElevation, 2).toString() + '</td></tr>';
innerHtml += '<tr><td style="background-color:rgba(0,0,0,0.7);color:white;font-size:12px;" >Fresnel Height (m): ' + round(tFresnelZone - tElevation, 2).toString() + '</td></tr>';
}
innerHtml += '</tbody>';
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;
}
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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';

View File

@@ -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, '');

View File

@@ -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, '');

View File

@@ -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);
}

View File

@@ -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';

View File

@@ -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

View File

@@ -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]);
}
}
};

View File

@@ -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();
myMap.render();

View File

@@ -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 +
'<li class="visualLi" onclick="showLinkOptionsByIdx(event,' +
i.toString() + ');"><i class="fas fa-link"></i>&nbsp;' +
source.features[i].properties.linkname + '</li>';
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 +
'<li class="visualLi" onclick="showLinkOptionsByIdx(event,' +
i.toString() + ');"><i class="fas fa-link"></i>&nbsp;' +
features[i].getProperties().linkname + '</li>';
sLinksTree[i][0].toString() + ');"><i class="fas fa-link"></i>&nbsp;' +
truncate(sLinksTree[i][2].toString(), 27) + '</li>';
}
}
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')
});

View File

@@ -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 +
'<li class="visualLi" onclick="showSiteOptionsByIdx(event,' +
i.toString() + ');"><i class="fas fa-broadcast-tower"' +
(source.features[i].properties.technology === '4G' ?
' style="color:rgb(255,106,0);" ' : '') + '></i>&nbsp;' +
truncate(source.features[i].properties.sitename,27) + '</li>';
}
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 +
'<li class="visualLi" onclick="showSiteOptionsByIdx(event,' +
i.toString() + ');"><i class="fas fa-broadcast-tower"' +
(features[i].getProperties().technology === '4G' ?
' style="color:rgb(255,106,0);" ' : '') + '></i>&nbsp;' +
truncate(features[i].getProperties().sitename,27) + '</li>';
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 +
'<li class="visualLi" onclick="showSiteOptionsByIdx(event,' +
sNetworkTree[i][0].toString() + ');"><i class="fas fa-broadcast-tower"' +
(sNetworkTree[i][3].toString() === '4G' ?
' style="color:rgb(255,106,0);" ' : '') + '></i>&nbsp;' +
truncate(sNetworkTree[i][2].toString(), 27) + '</li>';
}
}
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()) {

View File

@@ -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 +
'<li class="visualLi" onclick="showNoteOptionsByIdx(event,' + i.toString() + ');"><i class="fas fa-flag"></i>&nbsp;' +
truncate(source.features[i].properties.notename,27) + '</li>';
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 +
'<li class="visualLi" onclick="showNoteOptionsByIdx(event,' + i.toString() + ');"><i class="fas fa-flag"></i>&nbsp;' +
truncate(features[i].getProperties().notename,27) + '</li>';
'<li class="visualLi" onclick="showNoteOptionsByIdx(event,' +
sNotesTree[i][0].toString() + ');"><i class="fas fa-flag"></i>&nbsp;' +
truncate(sNotesTree[i][2].toString(), 27) + '</li>';
}
}
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);

View File

@@ -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 +
'<li class="visualLi" onclick="showPolygonOptionsByIdx(event,' +
i.toString() + ');"><i class="fas fa-draw-polygon"></i>&nbsp;' +
truncate(source.features[i].properties.polygonname, 27) + '</li>';
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 +
'<li class="visualLi" onclick="showPolygonOptionsByIdx(event,' +
i.toString() + ');"><i class="fas fa-draw-polygon"></i>&nbsp;' +
truncate(features[i].getProperties().polygonname, 27) + '</li>';
sPolygonsTree[i][0].toString() + ');"><i class="fas fa-draw-polygon"></i>&nbsp;' +
truncate(sPolygonsTree[i][2].toString(), 27) + '</li>';
}
}
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);

View File

@@ -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 +
'<li class="visualLi">' +
'<button class="toolsButton" style="width:auto;height:auto;"' +
' onclick="showResultByIdx(event,' + i.toString() + ');">' +
'<i class="fas fa-poll" style="font-size:14px !important;"></i>' +
'&nbsp;' + truncate(source.features[i].properties.resultname, 23) +
'</button>' +
'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' +
'<button class="toolsButton" style="width:auto;height:auto;float:right;"' +
' onclick="deleteResultByIdx(event,' + i.toString() + ');">' +
'<i class="fas fa-trash-alt" style="font-size:14px !important;"></i>' +
'</button>' +
'</li>';
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 +
'<li class="visualLi">' +
'<button class="toolsButton" style="width:auto;height:auto;"' +
' onclick="showResultByIdx(event,' + i.toString() + ');">' +
' onclick="showResultByIdx(event,' + sResultsTree[i][0].toString() + ');">' +
'<i class="fas fa-poll" style="font-size:14px !important;"></i>' +
'&nbsp;' + truncate(features[i].getProperties().resultname, 23) +
'&nbsp;' + truncate(sResultsTree[i][2].toString(), 23) +
'</button>' +
'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' +
'<button class="toolsButton" style="width:auto;height:auto;float:right;"' +
' onclick="deleteResultByIdx(event,' + i.toString() + ');">' +
' onclick="deleteResultByIdx(event,' + sResultsTree[i][0].toString() + ');">' +
'<i class="fas fa-trash-alt" style="font-size:14px !important;"></i>' +
'</button>' +
'</li>';
@@ -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);

View File

@@ -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 = '<th style="color:var(--facecolor);background-color:var(--barcolor);white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">';
header = header.map(h => th + h + '</th>');
header.unshift('<tr>');
header.push('</tr>');
let td = '<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">';
let properties = [];
features.forEach(function (f) {
properties.push('<tr>');
properties.push(td + f.get('siteid') + '</td>');
properties.push(td + f.get('sitename') + '</td>');
properties.push(td + round(f.get('longitude'), 6).toString() + '°' + '</td>');
properties.push(td + round(f.get('latitude'), 6).toString() + '°' + '</td>');
properties.push(td + round(f.get('height'), 0).toString() + ' m' + '</td>');
properties.push(td + f.get('technology') + '</td>');
properties.push(td + f.get('band') + '</td>');
properties.push(td + f.get('bandwidth') + ' MHz' + '</td>');
properties.push(td + f.get('cellid') + '</td>');
properties.push(td + f.get('lac') + '</td>');
properties.push(td + f.get('rfcn') + '</td>');
properties.push(td + f.get('rfid') + '</td>');
properties.push(td + f.get('dlfrequency') + ' MHz' + '</td>');
properties.push(td + f.get('ulfrequency') + ' MHz' + '</td>');
properties.push(td + f.get('rfpower') + ' W' + '</td>');
properties.push(td + round(f.get('hba'), 0).toString() + ' m' + '</td>');
properties.push(td + f.get('azimuth') + '°' + '</td>');
properties.push(td + f.get('antennamodel') + '</td>');
properties.push(td + f.get('antennatype') + '</td>');
properties.push(td + f.get('polarization') + '</td>');
properties.push(td + f.get('vbeamwidth') + '°' + '</td>');
properties.push(td + f.get('hbeamwidth') + '°' + '</td>');
properties.push(td + f.get('downtilt') + '°' + '</td>');
properties.push(td + f.get('antennagain') + ' dBi' + '</td>');
properties.push(td + f.get('feederloss') + ' dB' + '</td>');
properties.push('</tr>');
});
let details = '<table id="table' + ddsCount.toString() + '" class="sortable"><thead>' + header.join('') + '</thead><tbody>' + properties.join('') + '</tbody></table>';
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 = '<div><b>Links created</b><br/>';
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 += '<br/><b>Public Link:</b><br/>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.<br/>';
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 += '<br/><b>Links adjusted to meet ' + document.getElementById('opt_fresnelclearance').value + '% Fresnel Zone clearance requirement.</b><br/>';
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<br/>';
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 += '<br/><b>Links adjusted to meet ' + document.getElementById('opt_fresnelclearance').value + '% Fresnel Zone clearance requirement.</b><br/>';
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.<br/>';
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 += '</div>';
}
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 = '<th style="color:var(--facecolor);background-color:var(--barcolor);white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">';
header = header.map(h => th + h + '</th>');
header.unshift('<tr>');
header.push('</tr>');
let td = '<td style="white-space:nowrap;border:thin solid #C0C0C0;vertical-align:middle;text-align:center;padding:5px;">';
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('<tr>');
properties.push(td + f.get('linkid') + '</td>');
properties.push(td + f.get('linkname') + '</td>');
properties.push(td + titleCase(f.get('linktype')) + '</td>');
properties.push(td + f.get('siteida') + '</td>');
properties.push(td + siteA.get('sitename') + '</td>');
properties.push(td + round(parseFloat(f.get('heighta')), 1).toString() + ' m / ' + round(parseFloat(f.get('locheighta')), 0).toString() + ' m </td>');
properties.push(td + round(parseFloat(f.get('bearinga')), 2).toString() + '° / ' + (tiltAd).toString() + '° </td>');
properties.push(td + f.get('frequencya') + ' GHz</td>');
properties.push(td + f.get('channelwidtha') + ' MHz</td>');
properties.push(td + f.get('outputpowera') + ' dBm</td>');
properties.push(td + f.get('antennagaina') + ' dBi</td>');
properties.push(td + f.get('lossesa') + ' dB</td>');
properties.push(td + f.get('siteidb') + '</td>');
properties.push(td + siteB.get('sitename') + '</td>');
properties.push(td + round(parseFloat(f.get('heightb')), 1).toString() + ' m / ' + round(parseFloat(f.get('locheightb')), 0).toString() + ' m </td>');
properties.push(td + round(parseFloat(f.get('bearingb')), 2).toString() + '° / ' + (tiltBd).toString() + '° </td>');
properties.push(td + f.get('frequencyb') + ' GHz</td>');
properties.push(td + f.get('channelwidthb') + ' MHz</td>');
properties.push(td + f.get('outputpowerb') + ' dBm</td>');
properties.push(td + f.get('antennagainb') + ' dBi</td>');
properties.push(td + f.get('lossesb') + ' dB</td>');
properties.push('</tr>');
});
let details = '<table id="table' + ddsCount.toString() + '" class="sortable"><thead>' + header.join('') + '</thead><tbody>' + properties.join('') + '</tbody></table>';
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; };

View File

@@ -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',

View File

@@ -1,7 +1,10 @@
var lyrOpenStreetMap = new ol.layer.Tile({
var osmCopyright = '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap contributors<a>';
var topoCopyright = 'Kartendaten: © <a href="https://openstreetmap.org/copyright">OpenStreetMap</a>-Mitwirkende, SRTM | Kartendarstellung: © <a href="http://opentopomap.org">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)';
var lyrOpenStreetMap = new ol.layer.Tile({
title: 'Street',
type: 'base',
visible: false,
visible: true,
source: new ol.source.OSM({
wrapX: false
})

View File

@@ -1,10 +1,14 @@
var lyrStamenToner = new ol.layer.Tile({
var stamenTonerCopyright = 'Map tiles by <a href="http://stamen.com">Stamen Design</a>, under <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. Data by <a href="http://openstreetmap.org">OpenStreetMap</a>, under <a href="http://www.openstreetmap.org/copyright">ODbL</a>.';
var stamenWatercolorCopyright = 'Map tiles by <a href="http://stamen.com">Stamen Design</a>, under <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. Data by <a href="http://openstreetmap.org">OpenStreetMap</a>, under <a href="http://creativecommons.org/licenses/by-sa/3.0">CC BY SA</a>.';
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',

View File

@@ -1,4 +1,6 @@
var thunderforestAttributions = [
var thunderforestCopyright = 'Maps © <a href="http://www.thunderforest.com">Thunderforest</a>, Data © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap contributors';
var thunderforestAttributions = [
'Tiles &copy; <a href="http://www.thunderforest.com/">Thunderforest</a>',
ol.source.OSM.ATTRIBUTION
];

View File

@@ -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
]

View File

@@ -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' });

View File

@@ -2,6 +2,11 @@
var about = document.getElementById('about');
about.innerHTML = '<img alt="" style="width:113px;height:30px;" src="../img/cnip.png" />';
about.style.display = 'block';
var tileMapCopyright = document.getElementById('tileMapCopyright');
tileMapCopyright.style.display = 'block';
tileMapCopyright.innerHTML = '(DTM) courtesy of the <a href="https://www.usgs.gov/">U.S. Geological Survey</a>, (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('<tr><td style="text-align:left;padding-left:5px;">Calculated</td><td>&nbsp;&nbsp;</td><td style="text-align:left;padding-right:5px;"></td></tr>');
properties.push('<tr><td style="text-align:left;padding-left:5px;">Area</td><td>&nbsp;:&nbsp;</td><td style="text-align:left;padding-right:5px;">' + area.toString() + ' Km²' + '</td></tr>');
properties.push('<tr><td style="text-align:left;padding-left:5px;">Area</td><td>&nbsp;:&nbsp;</td><td style="text-align:left;padding-right:5px;">' + areaString + '</td></tr>');
properties.push('<tr><td style="text-align:left;padding-left:5px;">Center</td><td>&nbsp;:&nbsp;</td><td style="text-align:left;padding-right:5px;">' + round(center[0], 6).toString() + ',' + round(center[1], 6).toString() + '</td></tr>');
properties.push('<tr><td style="text-align:left;padding-left:5px;">Center of Mass</td><td>&nbsp;:&nbsp;</td><td style="text-align:left;padding-right:5px;">' + round(centerOfMass[0], 6).toString() + ',' + round(centerOfMass[1], 6).toString() + '</td></tr>');
properties.push('<tr><td style="text-align:left;padding-left:5px;"></td><td>&nbsp;&nbsp;</td><td style="text-align:left;padding-right:5px;"></td></tr>');
@@ -82,8 +94,9 @@ var displayFeatureInfo = function (e) {
properties.push('<tr><td style="text-align:left;padding-left:5px;">' + titleCase(key) +
'</td><td>&nbsp;:&nbsp;</td><td style="text-align:left;padding-right:5px;">' +
(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)) +
'</td></tr>');
}
}
@@ -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 <a href="https://www.usgs.gov/">U.S. Geological Survey</a>, (Map) ' + osmCopyright;
}
});
lyrOpenTopoMap.on('change:visible', function () {
if (lyrOpenTopoMap.getVisible()) {
tileMapCopyright.innerHTML = '(DTM) courtesy of the <a href="https://www.usgs.gov/">U.S. Geological Survey</a>, (Map) ' + topoCopyright;
}
});
lyrStamenToner.on('change:visible', function () {
if (lyrStamenToner.getVisible()) {
tileMapCopyright.innerHTML = '(DTM) courtesy of the <a href="https://www.usgs.gov/">U.S. Geological Survey</a>, (Map) ' + stamenTonerCopyright;
}
});
lyrStamenTonerLite.on('change:visible', function () {
if (lyrStamenToner.getVisible()) {
tileMapCopyright.innerHTML = '(DTM) courtesy of the <a href="https://www.usgs.gov/">U.S. Geological Survey</a>, (Map) ' + stamenTonerCopyright;
}
});
lyrStamenTerrain.on('change:visible', function () {
if (lyrStamenTerrain.getVisible()) {
tileMapCopyright.innerHTML = '(DTM) courtesy of the <a href="https://www.usgs.gov/">U.S. Geological Survey</a>, (Map) ' + stamenTonerCopyright;
}
});
lyrStamenTerrainBackground.on('change:visible', function () {
if (lyrStamenTerrainBackground.getVisible()) {
tileMapCopyright.innerHTML = '(DTM) courtesy of the <a href="https://www.usgs.gov/">U.S. Geological Survey</a>, (Map) ' + stamenTonerCopyright;
}
});
lyrStamenWaterColor.on('change:visible', function () {
if (lyrStamenWaterColor.getVisible()) {
tileMapCopyright.innerHTML = '(DTM) courtesy of the <a href="https://www.usgs.gov/">U.S. Geological Survey</a>, (Map) ' + stamenWatercolorCopyright;
}
});
lyrThunderForestCycleMap.on('change:visible', function () {
if (lyrThunderForestCycleMap.getVisible()) {
tileMapCopyright.innerHTML = '(DTM) courtesy of the <a href="https://www.usgs.gov/">U.S. Geological Survey</a>, (Map) ' + thunderforestCopyright;
}
});
lyrThunderForestTransport.on('change:visible', function () {
if (lyrThunderForestTransport.getVisible()) {
tileMapCopyright.innerHTML = '(DTM) courtesy of the <a href="https://www.usgs.gov/">U.S. Geological Survey</a>, (Map) ' + thunderforestCopyright;
}
});
lyrThunderForestTransportDark.on('change:visible', function () {
if (lyrThunderForestTransportDark.getVisible()) {
tileMapCopyright.innerHTML = '(DTM) courtesy of the <a href="https://www.usgs.gov/">U.S. Geological Survey</a>, (Map) ' + thunderforestCopyright;
}
});
lyrThunderForestLandscape.on('change:visible', function () {
if (lyrThunderForestLandscape.getVisible()) {
tileMapCopyright.innerHTML = '(DTM) courtesy of the <a href="https://www.usgs.gov/">U.S. Geological Survey</a>, (Map) ' + thunderforestCopyright;
}
});
lyrThunderForestOutdoors.on('change:visible', function () {
if (lyrThunderForestOutdoors.getVisible()) {
tileMapCopyright.innerHTML = '(DTM) courtesy of the <a href="https://www.usgs.gov/">U.S. Geological Survey</a>, (Map) ' + thunderforestCopyright;
}
});

Some files were not shown because too many files have changed in this diff Show More