CNIP Code

Code
This commit is contained in:
Ali Raza Anis
2020-05-01 04:55:04 +05:00
parent d65b9bd4e4
commit cbc6b96734
271 changed files with 207511 additions and 0 deletions

25
software/cnip/cnip.sln Normal file
View File

@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27703.2035
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cnip", "cnip\cnip.csproj", "{2C887228-E646-4C6F-9F6F-371CC0FDFC1C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2C887228-E646-4C6F-9F6F-371CC0FDFC1C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2C887228-E646-4C6F-9F6F-371CC0FDFC1C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2C887228-E646-4C6F-9F6F-371CC0FDFC1C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2C887228-E646-4C6F-9F6F-371CC0FDFC1C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {CD3DCDFD-DC8B-48AB-A7CC-6763A817A580}
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,30 @@
using System.Web;
using System.Web.Optimization;
namespace cnip
{
public class BundleConfig
{
// For more information on bundling, visit https://go.microsoft.com/fwlink/?LinkId=301862
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.validate*"));
// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at https://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.js"));
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css"));
}
}
}

View File

@@ -0,0 +1,13 @@
using System.Web;
using System.Web.Mvc;
namespace cnip
{
public class FilterConfig
{
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new HandleErrorAttribute());
}
}
}

View File

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
namespace cnip
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Glavni", action = "Index", id = UrlParameter.Optional }
);
}
}
}

View File

@@ -0,0 +1,106 @@
<?xml version="1.0" encoding="utf-8"?>
<ApplicationInsights xmlns="http://schemas.microsoft.com/ApplicationInsights/2013/Settings">
<TelemetryInitializers>
<Add Type="Microsoft.ApplicationInsights.DependencyCollector.HttpDependenciesParsingTelemetryInitializer, Microsoft.AI.DependencyCollector"/>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.AzureRoleEnvironmentTelemetryInitializer, Microsoft.AI.WindowsServer"/>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.AzureWebAppRoleEnvironmentTelemetryInitializer, Microsoft.AI.WindowsServer"/>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.BuildInfoConfigComponentVersionTelemetryInitializer, Microsoft.AI.WindowsServer"/>
<Add Type="Microsoft.ApplicationInsights.Web.WebTestTelemetryInitializer, Microsoft.AI.Web"/>
<Add Type="Microsoft.ApplicationInsights.Web.SyntheticUserAgentTelemetryInitializer, Microsoft.AI.Web">
<!-- Extended list of bots:
search|spider|crawl|Bot|Monitor|BrowserMob|BingPreview|PagePeeker|WebThumb|URL2PNG|ZooShot|GomezA|Google SketchUp|Read Later|KTXN|KHTE|Keynote|Pingdom|AlwaysOn|zao|borg|oegp|silk|Xenu|zeal|NING|htdig|lycos|slurp|teoma|voila|yahoo|Sogou|CiBra|Nutch|Java|JNLP|Daumoa|Genieo|ichiro|larbin|pompos|Scrapy|snappy|speedy|vortex|favicon|indexer|Riddler|scooter|scraper|scrubby|WhatWeb|WinHTTP|voyager|archiver|Icarus6j|mogimogi|Netvibes|altavista|charlotte|findlinks|Retreiver|TLSProber|WordPress|wsr-agent|http client|Python-urllib|AppEngine-Google|semanticdiscovery|facebookexternalhit|web/snippet|Google-HTTP-Java-Client-->
<Filters>search|spider|crawl|Bot|Monitor|AlwaysOn</Filters>
</Add>
<Add Type="Microsoft.ApplicationInsights.Web.ClientIpHeaderTelemetryInitializer, Microsoft.AI.Web"/>
<Add Type="Microsoft.ApplicationInsights.Web.OperationNameTelemetryInitializer, Microsoft.AI.Web"/>
<Add Type="Microsoft.ApplicationInsights.Web.OperationCorrelationTelemetryInitializer, Microsoft.AI.Web"/>
<Add Type="Microsoft.ApplicationInsights.Web.UserTelemetryInitializer, Microsoft.AI.Web"/>
<Add Type="Microsoft.ApplicationInsights.Web.AuthenticatedUserIdTelemetryInitializer, Microsoft.AI.Web"/>
<Add Type="Microsoft.ApplicationInsights.Web.AccountIdTelemetryInitializer, Microsoft.AI.Web"/>
<Add Type="Microsoft.ApplicationInsights.Web.SessionTelemetryInitializer, Microsoft.AI.Web"/>
</TelemetryInitializers>
<TelemetryModules>
<Add Type="Microsoft.ApplicationInsights.DependencyCollector.DependencyTrackingTelemetryModule, Microsoft.AI.DependencyCollector">
<ExcludeComponentCorrelationHttpHeadersOnDomains>
<!--
Requests to the following hostnames will not be modified by adding correlation headers.
Add entries here to exclude additional hostnames.
NOTE: this configuration will be lost upon NuGet upgrade.
-->
<Add>core.windows.net</Add>
<Add>core.chinacloudapi.cn</Add>
<Add>core.cloudapi.de</Add>
<Add>core.usgovcloudapi.net</Add>
<Add>localhost</Add>
<Add>127.0.0.1</Add>
</ExcludeComponentCorrelationHttpHeadersOnDomains>
<IncludeDiagnosticSourceActivities>
<Add>Microsoft.Azure.EventHubs</Add>
<Add>Microsoft.Azure.ServiceBus</Add>
</IncludeDiagnosticSourceActivities>
</Add>
<Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.PerformanceCollectorModule, Microsoft.AI.PerfCounterCollector">
<!--
Use the following syntax here to collect additional performance counters:
<Counters>
<Add PerformanceCounter="\Process(??APP_WIN32_PROC??)\Handle Count" ReportAs="Process handle count" />
...
</Counters>
PerformanceCounter must be either \CategoryName(InstanceName)\CounterName or \CategoryName\CounterName
NOTE: performance counters configuration will be lost upon NuGet upgrade.
The following placeholders are supported as InstanceName:
??APP_WIN32_PROC?? - instance name of the application process for Win32 counters.
??APP_W3SVC_PROC?? - instance name of the application IIS worker process for IIS/ASP.NET counters.
??APP_CLR_PROC?? - instance name of the application CLR process for .NET counters.
-->
</Add>
<Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.QuickPulse.QuickPulseTelemetryModule, Microsoft.AI.PerfCounterCollector"/>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.DeveloperModeWithDebuggerAttachedTelemetryModule, Microsoft.AI.WindowsServer"/>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.UnhandledExceptionTelemetryModule, Microsoft.AI.WindowsServer"/>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.UnobservedExceptionTelemetryModule, Microsoft.AI.WindowsServer">
<!--</Add>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.FirstChanceExceptionStatisticsTelemetryModule, Microsoft.AI.WindowsServer">-->
</Add>
<Add Type="Microsoft.ApplicationInsights.Web.RequestTrackingTelemetryModule, Microsoft.AI.Web">
<Handlers>
<!--
Add entries here to filter out additional handlers:
NOTE: handler configuration will be lost upon NuGet upgrade.
-->
<Add>Microsoft.VisualStudio.Web.PageInspector.Runtime.Tracing.RequestDataHttpHandler</Add>
<Add>System.Web.StaticFileHandler</Add>
<Add>System.Web.Handlers.AssemblyResourceLoader</Add>
<Add>System.Web.Optimization.BundleHandler</Add>
<Add>System.Web.Script.Services.ScriptHandlerFactory</Add>
<Add>System.Web.Handlers.TraceHandler</Add>
<Add>System.Web.Services.Discovery.DiscoveryRequestHandler</Add>
<Add>System.Web.HttpDebugHandler</Add>
</Handlers>
</Add>
<Add Type="Microsoft.ApplicationInsights.Web.ExceptionTrackingTelemetryModule, Microsoft.AI.Web"/>
<Add Type="Microsoft.ApplicationInsights.Web.AspNetDiagnosticTelemetryModule, Microsoft.AI.Web"/>
</TelemetryModules>
<TelemetryProcessors>
<Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.QuickPulse.QuickPulseTelemetryProcessor, Microsoft.AI.PerfCounterCollector"/>
<Add Type="Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor, Microsoft.ApplicationInsights"/>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.AdaptiveSamplingTelemetryProcessor, Microsoft.AI.ServerTelemetryChannel">
<MaxTelemetryItemsPerSecond>5</MaxTelemetryItemsPerSecond>
<ExcludedTypes>Event</ExcludedTypes>
</Add>
<Add Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.AdaptiveSamplingTelemetryProcessor, Microsoft.AI.ServerTelemetryChannel">
<MaxTelemetryItemsPerSecond>5</MaxTelemetryItemsPerSecond>
<IncludedTypes>Event</IncludedTypes>
</Add>
</TelemetryProcessors>
<TelemetryChannel Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.ServerTelemetryChannel, Microsoft.AI.ServerTelemetryChannel"/>
<!--
Learn more about Application Insights configuration with ApplicationInsights.config here:
http://go.microsoft.com/fwlink/?LinkID=513840
Note: If not present, please add <InstrumentationKey>Your Key</InstrumentationKey> to the top of this file.
--></ApplicationInsights>

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,587 @@
/*!
* Bootstrap v3.3.7 (http://getbootstrap.com)
* Copyright 2011-2016 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
.btn-default,
.btn-primary,
.btn-success,
.btn-info,
.btn-warning,
.btn-danger {
text-shadow: 0 -1px 0 rgba(0, 0, 0, .2);
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 1px rgba(0, 0, 0, .075);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 1px rgba(0, 0, 0, .075);
}
.btn-default:active,
.btn-primary:active,
.btn-success:active,
.btn-info:active,
.btn-warning:active,
.btn-danger:active,
.btn-default.active,
.btn-primary.active,
.btn-success.active,
.btn-info.active,
.btn-warning.active,
.btn-danger.active {
-webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);
box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);
}
.btn-default.disabled,
.btn-primary.disabled,
.btn-success.disabled,
.btn-info.disabled,
.btn-warning.disabled,
.btn-danger.disabled,
.btn-default[disabled],
.btn-primary[disabled],
.btn-success[disabled],
.btn-info[disabled],
.btn-warning[disabled],
.btn-danger[disabled],
fieldset[disabled] .btn-default,
fieldset[disabled] .btn-primary,
fieldset[disabled] .btn-success,
fieldset[disabled] .btn-info,
fieldset[disabled] .btn-warning,
fieldset[disabled] .btn-danger {
-webkit-box-shadow: none;
box-shadow: none;
}
.btn-default .badge,
.btn-primary .badge,
.btn-success .badge,
.btn-info .badge,
.btn-warning .badge,
.btn-danger .badge {
text-shadow: none;
}
.btn:active,
.btn.active {
background-image: none;
}
.btn-default {
text-shadow: 0 1px 0 #fff;
background-image: -webkit-linear-gradient(top, #fff 0%, #e0e0e0 100%);
background-image: -o-linear-gradient(top, #fff 0%, #e0e0e0 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#e0e0e0));
background-image: linear-gradient(to bottom, #fff 0%, #e0e0e0 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe0e0e0', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
background-repeat: repeat-x;
border-color: #dbdbdb;
border-color: #ccc;
}
.btn-default:hover,
.btn-default:focus {
background-color: #e0e0e0;
background-position: 0 -15px;
}
.btn-default:active,
.btn-default.active {
background-color: #e0e0e0;
border-color: #dbdbdb;
}
.btn-default.disabled,
.btn-default[disabled],
fieldset[disabled] .btn-default,
.btn-default.disabled:hover,
.btn-default[disabled]:hover,
fieldset[disabled] .btn-default:hover,
.btn-default.disabled:focus,
.btn-default[disabled]:focus,
fieldset[disabled] .btn-default:focus,
.btn-default.disabled.focus,
.btn-default[disabled].focus,
fieldset[disabled] .btn-default.focus,
.btn-default.disabled:active,
.btn-default[disabled]:active,
fieldset[disabled] .btn-default:active,
.btn-default.disabled.active,
.btn-default[disabled].active,
fieldset[disabled] .btn-default.active {
background-color: #e0e0e0;
background-image: none;
}
.btn-primary {
background-image: -webkit-linear-gradient(top, #337ab7 0%, #265a88 100%);
background-image: -o-linear-gradient(top, #337ab7 0%, #265a88 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#265a88));
background-image: linear-gradient(to bottom, #337ab7 0%, #265a88 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff265a88', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
background-repeat: repeat-x;
border-color: #245580;
}
.btn-primary:hover,
.btn-primary:focus {
background-color: #265a88;
background-position: 0 -15px;
}
.btn-primary:active,
.btn-primary.active {
background-color: #265a88;
border-color: #245580;
}
.btn-primary.disabled,
.btn-primary[disabled],
fieldset[disabled] .btn-primary,
.btn-primary.disabled:hover,
.btn-primary[disabled]:hover,
fieldset[disabled] .btn-primary:hover,
.btn-primary.disabled:focus,
.btn-primary[disabled]:focus,
fieldset[disabled] .btn-primary:focus,
.btn-primary.disabled.focus,
.btn-primary[disabled].focus,
fieldset[disabled] .btn-primary.focus,
.btn-primary.disabled:active,
.btn-primary[disabled]:active,
fieldset[disabled] .btn-primary:active,
.btn-primary.disabled.active,
.btn-primary[disabled].active,
fieldset[disabled] .btn-primary.active {
background-color: #265a88;
background-image: none;
}
.btn-success {
background-image: -webkit-linear-gradient(top, #5cb85c 0%, #419641 100%);
background-image: -o-linear-gradient(top, #5cb85c 0%, #419641 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#5cb85c), to(#419641));
background-image: linear-gradient(to bottom, #5cb85c 0%, #419641 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff419641', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
background-repeat: repeat-x;
border-color: #3e8f3e;
}
.btn-success:hover,
.btn-success:focus {
background-color: #419641;
background-position: 0 -15px;
}
.btn-success:active,
.btn-success.active {
background-color: #419641;
border-color: #3e8f3e;
}
.btn-success.disabled,
.btn-success[disabled],
fieldset[disabled] .btn-success,
.btn-success.disabled:hover,
.btn-success[disabled]:hover,
fieldset[disabled] .btn-success:hover,
.btn-success.disabled:focus,
.btn-success[disabled]:focus,
fieldset[disabled] .btn-success:focus,
.btn-success.disabled.focus,
.btn-success[disabled].focus,
fieldset[disabled] .btn-success.focus,
.btn-success.disabled:active,
.btn-success[disabled]:active,
fieldset[disabled] .btn-success:active,
.btn-success.disabled.active,
.btn-success[disabled].active,
fieldset[disabled] .btn-success.active {
background-color: #419641;
background-image: none;
}
.btn-info {
background-image: -webkit-linear-gradient(top, #5bc0de 0%, #2aabd2 100%);
background-image: -o-linear-gradient(top, #5bc0de 0%, #2aabd2 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#5bc0de), to(#2aabd2));
background-image: linear-gradient(to bottom, #5bc0de 0%, #2aabd2 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2aabd2', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
background-repeat: repeat-x;
border-color: #28a4c9;
}
.btn-info:hover,
.btn-info:focus {
background-color: #2aabd2;
background-position: 0 -15px;
}
.btn-info:active,
.btn-info.active {
background-color: #2aabd2;
border-color: #28a4c9;
}
.btn-info.disabled,
.btn-info[disabled],
fieldset[disabled] .btn-info,
.btn-info.disabled:hover,
.btn-info[disabled]:hover,
fieldset[disabled] .btn-info:hover,
.btn-info.disabled:focus,
.btn-info[disabled]:focus,
fieldset[disabled] .btn-info:focus,
.btn-info.disabled.focus,
.btn-info[disabled].focus,
fieldset[disabled] .btn-info.focus,
.btn-info.disabled:active,
.btn-info[disabled]:active,
fieldset[disabled] .btn-info:active,
.btn-info.disabled.active,
.btn-info[disabled].active,
fieldset[disabled] .btn-info.active {
background-color: #2aabd2;
background-image: none;
}
.btn-warning {
background-image: -webkit-linear-gradient(top, #f0ad4e 0%, #eb9316 100%);
background-image: -o-linear-gradient(top, #f0ad4e 0%, #eb9316 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#f0ad4e), to(#eb9316));
background-image: linear-gradient(to bottom, #f0ad4e 0%, #eb9316 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffeb9316', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
background-repeat: repeat-x;
border-color: #e38d13;
}
.btn-warning:hover,
.btn-warning:focus {
background-color: #eb9316;
background-position: 0 -15px;
}
.btn-warning:active,
.btn-warning.active {
background-color: #eb9316;
border-color: #e38d13;
}
.btn-warning.disabled,
.btn-warning[disabled],
fieldset[disabled] .btn-warning,
.btn-warning.disabled:hover,
.btn-warning[disabled]:hover,
fieldset[disabled] .btn-warning:hover,
.btn-warning.disabled:focus,
.btn-warning[disabled]:focus,
fieldset[disabled] .btn-warning:focus,
.btn-warning.disabled.focus,
.btn-warning[disabled].focus,
fieldset[disabled] .btn-warning.focus,
.btn-warning.disabled:active,
.btn-warning[disabled]:active,
fieldset[disabled] .btn-warning:active,
.btn-warning.disabled.active,
.btn-warning[disabled].active,
fieldset[disabled] .btn-warning.active {
background-color: #eb9316;
background-image: none;
}
.btn-danger {
background-image: -webkit-linear-gradient(top, #d9534f 0%, #c12e2a 100%);
background-image: -o-linear-gradient(top, #d9534f 0%, #c12e2a 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#d9534f), to(#c12e2a));
background-image: linear-gradient(to bottom, #d9534f 0%, #c12e2a 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc12e2a', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
background-repeat: repeat-x;
border-color: #b92c28;
}
.btn-danger:hover,
.btn-danger:focus {
background-color: #c12e2a;
background-position: 0 -15px;
}
.btn-danger:active,
.btn-danger.active {
background-color: #c12e2a;
border-color: #b92c28;
}
.btn-danger.disabled,
.btn-danger[disabled],
fieldset[disabled] .btn-danger,
.btn-danger.disabled:hover,
.btn-danger[disabled]:hover,
fieldset[disabled] .btn-danger:hover,
.btn-danger.disabled:focus,
.btn-danger[disabled]:focus,
fieldset[disabled] .btn-danger:focus,
.btn-danger.disabled.focus,
.btn-danger[disabled].focus,
fieldset[disabled] .btn-danger.focus,
.btn-danger.disabled:active,
.btn-danger[disabled]:active,
fieldset[disabled] .btn-danger:active,
.btn-danger.disabled.active,
.btn-danger[disabled].active,
fieldset[disabled] .btn-danger.active {
background-color: #c12e2a;
background-image: none;
}
.thumbnail,
.img-thumbnail {
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .075);
box-shadow: 0 1px 2px rgba(0, 0, 0, .075);
}
.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus {
background-color: #e8e8e8;
background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
background-image: -o-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#f5f5f5), to(#e8e8e8));
background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);
background-repeat: repeat-x;
}
.dropdown-menu > .active > a,
.dropdown-menu > .active > a:hover,
.dropdown-menu > .active > a:focus {
background-color: #2e6da4;
background-image: -webkit-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
background-image: -o-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2e6da4));
background-image: linear-gradient(to bottom, #337ab7 0%, #2e6da4 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);
background-repeat: repeat-x;
}
.navbar-default {
background-image: -webkit-linear-gradient(top, #fff 0%, #f8f8f8 100%);
background-image: -o-linear-gradient(top, #fff 0%, #f8f8f8 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#f8f8f8));
background-image: linear-gradient(to bottom, #fff 0%, #f8f8f8 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff8f8f8', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
background-repeat: repeat-x;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 5px rgba(0, 0, 0, .075);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 1px 5px rgba(0, 0, 0, .075);
}
.navbar-default .navbar-nav > .open > a,
.navbar-default .navbar-nav > .active > a {
background-image: -webkit-linear-gradient(top, #dbdbdb 0%, #e2e2e2 100%);
background-image: -o-linear-gradient(top, #dbdbdb 0%, #e2e2e2 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#dbdbdb), to(#e2e2e2));
background-image: linear-gradient(to bottom, #dbdbdb 0%, #e2e2e2 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdbdbdb', endColorstr='#ffe2e2e2', GradientType=0);
background-repeat: repeat-x;
-webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, .075);
box-shadow: inset 0 3px 9px rgba(0, 0, 0, .075);
}
.navbar-brand,
.navbar-nav > li > a {
text-shadow: 0 1px 0 rgba(255, 255, 255, .25);
}
.navbar-inverse {
background-image: -webkit-linear-gradient(top, #3c3c3c 0%, #222 100%);
background-image: -o-linear-gradient(top, #3c3c3c 0%, #222 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#3c3c3c), to(#222));
background-image: linear-gradient(to bottom, #3c3c3c 0%, #222 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c', endColorstr='#ff222222', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
background-repeat: repeat-x;
border-radius: 4px;
}
.navbar-inverse .navbar-nav > .open > a,
.navbar-inverse .navbar-nav > .active > a {
background-image: -webkit-linear-gradient(top, #080808 0%, #0f0f0f 100%);
background-image: -o-linear-gradient(top, #080808 0%, #0f0f0f 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#080808), to(#0f0f0f));
background-image: linear-gradient(to bottom, #080808 0%, #0f0f0f 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff080808', endColorstr='#ff0f0f0f', GradientType=0);
background-repeat: repeat-x;
-webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, .25);
box-shadow: inset 0 3px 9px rgba(0, 0, 0, .25);
}
.navbar-inverse .navbar-brand,
.navbar-inverse .navbar-nav > li > a {
text-shadow: 0 -1px 0 rgba(0, 0, 0, .25);
}
.navbar-static-top,
.navbar-fixed-top,
.navbar-fixed-bottom {
border-radius: 0;
}
@media (max-width: 767px) {
.navbar .navbar-nav .open .dropdown-menu > .active > a,
.navbar .navbar-nav .open .dropdown-menu > .active > a:hover,
.navbar .navbar-nav .open .dropdown-menu > .active > a:focus {
color: #fff;
background-image: -webkit-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
background-image: -o-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2e6da4));
background-image: linear-gradient(to bottom, #337ab7 0%, #2e6da4 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);
background-repeat: repeat-x;
}
}
.alert {
text-shadow: 0 1px 0 rgba(255, 255, 255, .2);
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 2px rgba(0, 0, 0, .05);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 2px rgba(0, 0, 0, .05);
}
.alert-success {
background-image: -webkit-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%);
background-image: -o-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#dff0d8), to(#c8e5bc));
background-image: linear-gradient(to bottom, #dff0d8 0%, #c8e5bc 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0);
background-repeat: repeat-x;
border-color: #b2dba1;
}
.alert-info {
background-image: -webkit-linear-gradient(top, #d9edf7 0%, #b9def0 100%);
background-image: -o-linear-gradient(top, #d9edf7 0%, #b9def0 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#d9edf7), to(#b9def0));
background-image: linear-gradient(to bottom, #d9edf7 0%, #b9def0 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0);
background-repeat: repeat-x;
border-color: #9acfea;
}
.alert-warning {
background-image: -webkit-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%);
background-image: -o-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#fcf8e3), to(#f8efc0));
background-image: linear-gradient(to bottom, #fcf8e3 0%, #f8efc0 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0);
background-repeat: repeat-x;
border-color: #f5e79e;
}
.alert-danger {
background-image: -webkit-linear-gradient(top, #f2dede 0%, #e7c3c3 100%);
background-image: -o-linear-gradient(top, #f2dede 0%, #e7c3c3 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#f2dede), to(#e7c3c3));
background-image: linear-gradient(to bottom, #f2dede 0%, #e7c3c3 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0);
background-repeat: repeat-x;
border-color: #dca7a7;
}
.progress {
background-image: -webkit-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%);
background-image: -o-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#ebebeb), to(#f5f5f5));
background-image: linear-gradient(to bottom, #ebebeb 0%, #f5f5f5 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0);
background-repeat: repeat-x;
}
.progress-bar {
background-image: -webkit-linear-gradient(top, #337ab7 0%, #286090 100%);
background-image: -o-linear-gradient(top, #337ab7 0%, #286090 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#286090));
background-image: linear-gradient(to bottom, #337ab7 0%, #286090 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff286090', GradientType=0);
background-repeat: repeat-x;
}
.progress-bar-success {
background-image: -webkit-linear-gradient(top, #5cb85c 0%, #449d44 100%);
background-image: -o-linear-gradient(top, #5cb85c 0%, #449d44 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#5cb85c), to(#449d44));
background-image: linear-gradient(to bottom, #5cb85c 0%, #449d44 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0);
background-repeat: repeat-x;
}
.progress-bar-info {
background-image: -webkit-linear-gradient(top, #5bc0de 0%, #31b0d5 100%);
background-image: -o-linear-gradient(top, #5bc0de 0%, #31b0d5 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#5bc0de), to(#31b0d5));
background-image: linear-gradient(to bottom, #5bc0de 0%, #31b0d5 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0);
background-repeat: repeat-x;
}
.progress-bar-warning {
background-image: -webkit-linear-gradient(top, #f0ad4e 0%, #ec971f 100%);
background-image: -o-linear-gradient(top, #f0ad4e 0%, #ec971f 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#f0ad4e), to(#ec971f));
background-image: linear-gradient(to bottom, #f0ad4e 0%, #ec971f 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0);
background-repeat: repeat-x;
}
.progress-bar-danger {
background-image: -webkit-linear-gradient(top, #d9534f 0%, #c9302c 100%);
background-image: -o-linear-gradient(top, #d9534f 0%, #c9302c 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#d9534f), to(#c9302c));
background-image: linear-gradient(to bottom, #d9534f 0%, #c9302c 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0);
background-repeat: repeat-x;
}
.progress-bar-striped {
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
}
.list-group {
border-radius: 4px;
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .075);
box-shadow: 0 1px 2px rgba(0, 0, 0, .075);
}
.list-group-item.active,
.list-group-item.active:hover,
.list-group-item.active:focus {
text-shadow: 0 -1px 0 #286090;
background-image: -webkit-linear-gradient(top, #337ab7 0%, #2b669a 100%);
background-image: -o-linear-gradient(top, #337ab7 0%, #2b669a 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2b669a));
background-image: linear-gradient(to bottom, #337ab7 0%, #2b669a 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2b669a', GradientType=0);
background-repeat: repeat-x;
border-color: #2b669a;
}
.list-group-item.active .badge,
.list-group-item.active:hover .badge,
.list-group-item.active:focus .badge {
text-shadow: none;
}
.panel {
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
}
.panel-default > .panel-heading {
background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
background-image: -o-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#f5f5f5), to(#e8e8e8));
background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);
background-repeat: repeat-x;
}
.panel-primary > .panel-heading {
background-image: -webkit-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
background-image: -o-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2e6da4));
background-image: linear-gradient(to bottom, #337ab7 0%, #2e6da4 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);
background-repeat: repeat-x;
}
.panel-success > .panel-heading {
background-image: -webkit-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%);
background-image: -o-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#dff0d8), to(#d0e9c6));
background-image: linear-gradient(to bottom, #dff0d8 0%, #d0e9c6 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0);
background-repeat: repeat-x;
}
.panel-info > .panel-heading {
background-image: -webkit-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%);
background-image: -o-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#d9edf7), to(#c4e3f3));
background-image: linear-gradient(to bottom, #d9edf7 0%, #c4e3f3 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0);
background-repeat: repeat-x;
}
.panel-warning > .panel-heading {
background-image: -webkit-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%);
background-image: -o-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#fcf8e3), to(#faf2cc));
background-image: linear-gradient(to bottom, #fcf8e3 0%, #faf2cc 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0);
background-repeat: repeat-x;
}
.panel-danger > .panel-heading {
background-image: -webkit-linear-gradient(top, #f2dede 0%, #ebcccc 100%);
background-image: -o-linear-gradient(top, #f2dede 0%, #ebcccc 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#f2dede), to(#ebcccc));
background-image: linear-gradient(to bottom, #f2dede 0%, #ebcccc 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0);
background-repeat: repeat-x;
}
.well {
background-image: -webkit-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%);
background-image: -o-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#e8e8e8), to(#f5f5f5));
background-image: linear-gradient(to bottom, #e8e8e8 0%, #f5f5f5 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0);
background-repeat: repeat-x;
border-color: #dcdcdc;
-webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, .05), 0 1px 0 rgba(255, 255, 255, .1);
box-shadow: inset 0 1px 3px rgba(0, 0, 0, .05), 0 1px 0 rgba(255, 255, 255, .1);
}
/*# sourceMappingURL=bootstrap-theme.css.map */

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

6757
software/cnip/cnip/Content/bootstrap.css vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,95 @@
@import "root.css";
html, body {
background-color: var(--backcolor);
color: var(--fontcolor);
height: 100%;
margin: 0;
}
* {
font-family: "Liberation Sans", "Lucida Sans", "Lucida Sans Regular", "Lucida Grande", "Lucida Sans Unicode", Geneva, Verdana, sans-serif;
font-weight: lighter;
}
.navbar {
border: none;
background: none;
}
.navbar-header {
background: none;
}
.navbar-nav {
margin: 0;
}
.navbar-right {
margin-right: 0;
}
#userGuide {
background-color: transparent;
border: none;
color: var(--fontcolor);
left: -7px;
width: 120px;
}
.container {
height: 100%;
align-content: center;
}
.card {
height: 440px;
margin-top: -75px;
margin-bottom: auto;
width: 400px;
border-color: var(--bordercolor) !important;
background-color: var(--backcolor);
color: var(--fontcolor);
}
.card-header {
background-color: var(--backcolor);
color: var(--fontcolor);
}
.card-footer {
background-color: var(--backcolor);
color: var(--fontcolor);
border-top: none;
}
.input-group-prepend span {
width: 50px;
background-color: var(--backcolor);
color: var(--fontcolor);
border: 0 !important;
}
input:focus {
outline: 0 0 0 0 !important;
box-shadow: 0 0 0 0 !important;
}
.login_btn {
background-color: rgba(30,144,255,1);
color: var(--backcolor);
width: 100px;
}
.login_btn:hover {
color: var(--backcolor);
background-color: rgba(30,144,255,0.7);
}
.links {
color: var(--backcolor);
}
.links a {
margin-left: 4px;
}

View File

@@ -0,0 +1,542 @@
@import "root.css";
@import "../../Scripts/nouislider.min.css";
* {
box-sizing: border-box;
font-weight: lighter;
font-family: "Liberation Sans", "Lucida Sans", "Lucida Sans Regular", "Lucida Grande", "Lucida Sans Unicode", Geneva, Verdana, sans-serif;
}
/* single slider client user control */
.noUi-horizontal {
height: 4px;
}
.noUi-target {
border: none;
border-radius: 0;
box-shadow: none;
}
.noUi-connects {
background-color: var(--bordercolor);
}
.noUi-connect {
background-color: var(--fontcolor);
}
.noUi-handle {
height: 12px !important;
width: 12px !important;
top: -4px !important;
left: 50% !important;
background-color: var(--fontcolor);
border: none;
box-shadow: none;
}
.noUi-handle:hover {
background-color: var(--hovercolor);
cursor: pointer;
}
.noUi-handle:after, .noUi-handle:before {
height: 0;
width: 0;
}
.noUi-handle.noUi-handle-lower, .noUi-handle.noUi-handle-upper {
margin-left: 7px !important;
outline: none;
border: none;
}
.noUi-pips-horizontal {
top: -5px !important;
height: 30px !important;
}
.noUi-marker.noUi-marker-horizontal.noUi-marker-normal {
display: none;
}
.noUi-marker.noUi-marker-horizontal.noUi-marker-large {
height: 5px;
width: 1px;
}
.noUi-value.noUi-value-horizontal.noUi-value-large {
font-weight: lighter;
font-size: xx-small;
color: var(--fontcolor);
}
/*customized checkbox styling*/
[type="checkbox"]:not(:checked),
[type="checkbox"]:checked {
position: absolute;
left: -9999px;
}
[type="checkbox"]:not(:checked) + label,
[type="checkbox"]:checked + label {
position: relative;
padding-left: 1.95em;
cursor: pointer;
font-weight: lighter;
}
/* checkbox aspect */
[type="checkbox"]:not(:checked) + label:before,
[type="checkbox"]:checked + label:before {
content: '';
position: absolute;
left: 0;
top: 0;
width: 1.25em;
height: 1.25em;
border: 2px solid var(--bordercolor);
background-color: var(--facecolor);
border-radius: 1px;
/*box-shadow: inset 0 1px 3px rgba(0,0,0,.1);*/
}
/* checked mark aspect */
[type="checkbox"]:not(:checked) + label:after,
[type="checkbox"]:checked + label:after {
content: '\2713\0020';
position: absolute;
top: .15em;
left: .22em;
font-size: 1.3em;
line-height: 0.8;
color: var(--checkcolor);
transition: all .2s;
}
/* checked mark aspect changes */
[type="checkbox"]:not(:checked) + label:after {
opacity: 0;
transform: scale(0);
}
[type="checkbox"]:checked + label:after {
opacity: 1;
transform: scale(1);
}
/* disabled checkbox */
[type="checkbox"]:disabled:not(:checked) + label:before,
[type="checkbox"]:disabled:checked + label:before {
box-shadow: none;
border-color: var(--disabledfontcolor);
background-color: var(--disabledbackcolor);
}
[type="checkbox"]:disabled:checked + label:after {
color: var(--disabledfontcolor);
}
[type="checkbox"]:disabled + label {
color: var(--disabledfontcolor);
}
/* accessibility */
[type="checkbox"]:checked:focus + label:before,
[type="checkbox"]:not(:checked):focus + label:before {
border: 2px solid var(--checkcolor);
}
/* hover style */
label:hover:before {
border: 2px solid var(--checkcolor) !important;
}
/* radio button styling*/
[type="radio"]:checked,
[type="radio"]:not(:checked) {
position: absolute;
left: -9999px;
}
[type="radio"]:checked + label,
[type="radio"]:not(:checked) + label {
position: relative;
padding-left: 28px;
cursor: pointer;
line-height: 20px;
display: inline-block;
font-weight: lighter;
}
[type="radio"]:checked + label:before,
[type="radio"]:not(:checked) + label:before {
content: '';
position: absolute;
left: 0;
top: 0;
width: 18px;
height: 18px;
border: 2px solid var(--bordercolor);
border-radius: 100%;
background-color: var(--facecolor);
}
[type="radio"]:checked + label:after,
[type="radio"]:not(:checked) + label:after {
content: '';
width: 10px;
height: 10px;
background-color: var(--checkcolor);
position: absolute;
top: 4px;
left: 4px;
border-radius: 100%;
-webkit-transition: all 0.2s ease;
transition: all 0.2s ease;
}
[type="radio"]:not(:checked) + label:after {
opacity: 0;
-webkit-transform: scale(0);
transform: scale(0);
}
[type="radio"]:checked + label:after {
opacity: 1;
-webkit-transform: scale(1);
transform: scale(1);
}
.label {
font-weight: lighter
}
.toolsButton {
background-color: var(--backcolor);
border: 1px solid var(--backcolor);
color: var(--fontcolor);
cursor: pointer;
width: 20px;
height: 20px;
padding: 0 0;
margin: 0 0;
outline: none;
}
.toolsButton:hover {
color: var(--hovercolor);
}
.toolsButton > * {
font-size: 18px !important;
}
.textInput {
border: 1px solid var(--bordercolor);
background-color: var(--backcolor);
color: var(--fontcolor);
border-radius: 4px !important;
cursor: pointer;
height: 1.971428571em;
text-align: left;
outline: none;
padding: 3px;
width: 100%;
margin-top: 3px;
margin-bottom: 5px;
}
.textInput:hover {
color: var(--hovercolor);
font-weight: 900;
}
.textInput:disabled {
color: var(--disabledfontcolor);
cursor: pointer;
}
/*visual collapsible bar*/
.visualBar {
color: dodgerblue;
cursor: pointer;
height: 35px;
width: 100%;
border: none;
text-align: left;
outline: none;
background-color: var(--facecolor);
margin-bottom: 2px;
margin-top: 2px;
}
.visualBar.collapsed {
background-color: var(--facecolor);
}
.visualBar:active, .visualBar:hover {
color: var(--hovercolor);
font-weight: 900;
}
.visualBar:after {
content: '\2212';
float: right;
}
.visualBar.collapsed:after {
content: '\002B';
float: right;
}
.visualBar:disabled {
background-color: var(--disabledbackcolor);
color: var(--disabledfontcolor);
}
.visualDiv {
background-color: var(--menucolor);
padding: 0 5px;
margin-top: 5px;
}
.visualUl {
list-style-type: none;
margin: 0;
padding: 0 10px;
}
.visualLi {
color: var(--fontcolor);
cursor: pointer;
}
.visualLi:hover {
color: var(--hovercolor);
}
/* visual button*/
.visualButton {
background-color: var(--facecolor);
cursor: pointer;
height: 70px;
width: 79px;
text-align: center;
border-radius: 2px;
border-color: var(--bordercolor);
border-style: solid;
border-width: thin;
border: none;
outline: none;
font-size: x-small;
vertical-align: middle;
margin-bottom: 3px;
}
.visualButton:hover {
color: var(--hovercolor);
font-weight: 700;
}
.visualButton:disabled {
background-color: var(--disabledbackcolor);
color: var(--disabledfontcolor);
}
/* select bar user control*/
.selectBar {
border: 1px solid var(--bordercolor);
border-radius: 4px;
background-color: var(--facecolor);
cursor: pointer;
height: 1.971428571em;
width: 100%;
text-align: left;
outline: none;
margin-top: 3px;
margin-bottom: 3px;
}
.selectBar.collapsed {
background-color: var(--facecolor);
}
.selectBar:active, .selectBar:hover {
color: var(--hovercolor);
font-weight: 900;
}
.selectBar:disabled {
background-color: var(--disabledbackcolor);
color: var(--disabledfontcolor);
}
.selectDiv {
margin-top: -1px;
width: 100%;
border: 1px solid var(--bordercolor);
border-radius: 1px;
display: none;
padding: 0;
position: absolute;
z-index: 1000;
}
.selectList {
background-color: var(--menucolor);
cursor: pointer;
height: 1.971428571em;
border: none;
text-align: left;
outline: none;
padding: 0 5px;
}
.selectList:hover {
color: var(--hovercolor);
font-weight: 900;
}
.pageTabLink {
background-color: var(--backcolor);
color: var(--fontcolor);
float: left;
border: none;
outline: none;
cursor: pointer;
padding: 5px 16px;
font-size: 14px;
width: auto;
}
.pageTabLink:hover {
background-color: #555;
color: white;
}
.pageTabContent {
color: var(--fontcolor);
background-color: var(--backcolor);
display: none;
padding: 15px 10px;
height: 100%;
}
.pageTopButton {
float: right;
border: none;
outline: none;
cursor: pointer;
font-size: large;
background-color: var(--backcolor);
color: var(--fontcolor);
}
.pageTopButton:hover {
color: var(--hovercolor);
}
.pageTopButton > * {
font-size: 18px !important;
}
.pageBottomButton {
position: absolute;
bottom: 10px;
border: none;
outline: none;
cursor: pointer;
font-size: large;
background-color: var(--backcolor);
color: var(--fontcolor);
}
.pageBottomButton:hover {
color: var(--hovercolor);
}
.pageBottomButton > * {
font-size: 18px !important;
}
.panel-heading {
border: none;
color: var(--facecolor) !important;
background-color: var(--barcolor) !important;
padding: 7px 7px;
border-top-right-radius: 0;
border-top-left-radius: 0;
}
.panel-action {
border: none;
color: var(--facecolor);
background-color: var(--barcolor);
padding: 7px 7px;
width: 32.4px;
height: 34px;
}
.panel-action-button {
border: none;
outline: none;
color: var(--facecolor);
background: none;
cursor: pointer;
padding: 0 0;
font-size: large;
}
.panel-action-button:hover {
color: var(--hovercolor);
}
.panel-body {
padding: 0 0 0 0;
overflow: hidden;
background-color: white;
margin: 0 0 0 0;
}
.draggable-handler {
cursor: move;
z-index: 200;
}
.draggable {
position: absolute;
z-index: 199;
}
.dragging {
z-index: 999 !important
}
hr {
margin: 0 0 0 0 !important;
padding: 0 0 0 0 !important;
background-color: var(--bordercolor);
width: 100%;
height: 1px;
border: none;
}
table {
width: 100%;
}
td {
vertical-align: top;
}
.btn {
border-color: var(--bordercolor) !important;
color: var(--fontcolor) !important;
background-color: var(--backcolor) !important;
padding: 3px 12px;
font-size: 12px;
}
.btn:hover {
background-color: var(--backcolor) !important;
color: var(--hovercolor) !important;
font-weight: 600;
}

View File

@@ -0,0 +1,14 @@
:root {
--hovercolor: rgba(49,52,53,1);
--fontcolor: rgba(114,119,122,1);
--backcolor: rgba(255, 255, 255, 1);
--opfontcolor: rgba(20, 30, 40,1);
--opbackcolor: rgba(255, 255, 255, 1);
--disabledbackcolor: rgba(233,236,239,1);
--disabledfontcolor: rgba(165,142,150,1);
--checkcolor: rgba(102,102,102,1);
--bordercolor: rgba(206,212,218,1);
--menucolor: rgb(255, 255, 255);
--facecolor: rgb(255, 255, 255);
--barcolor: rgba(30, 144, 255,0.7);
}

View File

@@ -0,0 +1,508 @@
body {
height: 100%;
padding: 0;
margin: 0;
overflow: hidden;
}
.fullscreen:-moz-full-screen {
height: 100%;
}
.fullscreen:-webkit-full-screen {
height: 100%;
}
.fullscreen:-ms-fullscreen {
height: 100%;
}
.fullscreen:fullscreen {
height: 100%;
}
.fullscreen {
width: 100%;
height: 100%;
}
#myMap {
width: 100%;
height: 100%;
z-index: 1;
top: 0;
bottom: 0;
position: absolute;
float: left;
background-color: black;
}
.sidebar {
width: 350px;
}
.sidebar-tabs {
background-color: var(--backcolor);
color: var(--fontcolor);
}
.sidebar-tabs > ul > li.active {
background-color: var(--backcolor);
color: var(--fontcolor);
}
.sidebar-tabs > ul > li:hover,
.sidebar-tabs > ul > li:focus {
background-color: var(--backcolor);
}
.sidebar-tabs > ul > li > a > i {
color: var(--fontcolor);
}
.sidebar-tabs > ul > li > a > i:hover,
.sidebar-tabs > ul > li > a > i:focus {
color: var(--hovercolor);
}
.sidebar-header {
background-color: var(--backcolor);
color: var(--fontcolor);
}
.sidebar-content {
background-color: var(--backcolor);
color: var(--fontcolor);
}
.layer-switcher {
position: initial;
}
.layer-switcher li.group > label {
margin-left: 6px;
font-weight: lighter;
}
.layer-switcher li.layer {
margin-left: -18px;
}
.layer-switcher li.group {
margin-left: -18px;
}
.layer-switcher .group button {
background-color: var(--menucolor);
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnMAABJzAYwiuQcAAABUSURBVDhPY/z//z8DJYAJSpMNRg1gYECJhSs3H8I5OuryjFAmGOCSQ3EBsgSyBnwGY00HyBqQAbpmEMAaBtgUYhMDAZyBiKwBl2YQGE3KFBvAwAAA4Voh3ZnNAcsAAAAASUVORK5CYII=')
}
#about {
z-index: 99;
position: absolute;
bottom: 33px;
right: 151px;
}
#activeInteraction {
z-index: 99;
position: absolute;
top: 11px;
left: calc(50vw + (/* width */160px / 2));
height: 22px;
width: 22px;
border: 3px solid transparent;
border-radius: 4px;
margin: 0;
background-color: rgba(255,152,0,0.7);
color: var(--opfontcolor);
transition: opacity 100ms ease-in;
opacity: 1;
text-align: center;
vertical-align: middle;
}
#featureInfo {
z-index: 99;
position: absolute;
right: 4px;
bottom: 70px;
border: 3px solid transparent;
border-radius: 4px;
margin: 0;
background-color: var(--opbackcolor);
color: var(--opfontcolor);
transition: opacity 100ms ease-in;
opacity: 1;
}
/*#featureTip {
z-index: 99;
position: absolute;
left: 1px;
bottom: 1px;
width: 1px;
height: 1px;
border: 3px solid transparent;
border-radius: 4px;
margin: 0;
background-color: var(--opbackcolor);
color: var(--opfontcolor);
transition: opacity 100ms ease-in;
opacity: 1;
}*/
#noteInfo {
z-index: 99;
max-width: 172.98px;
min-width: 172.98px;
position: absolute;
border: 3px solid transparent;
border-radius: 4px;
margin: 0;
background-color: #fff7d1;
color: var(--opfontcolor);
transition: opacity 100ms ease-in;
opacity: 1;
font-size: smaller;
overflow: auto;
text-align: left;
}
#locationInfo {
z-index: 99;
position: absolute;
left: calc(50vw - (/* width */150px / 2));
bottom: 10px;
width: 260px;
height: auto;
border: 3px solid transparent;
border-radius: 4px;
margin: 0;
background-color: var(--opbackcolor);
color: var(--opfontcolor);
transition: opacity 100ms ease-in;
opacity: 1;
font-size: smaller;
text-align: center;
}
#progressBar {
position: absolute;
left: calc(50vw - (/* width */403px / 2));
top: calc(50vh - (/* height */203px / 2));
width: 403px;
height: 203px;
border: 3px solid transparent;
border-radius: 4px;
margin: 0;
background-color: var(--backcolor);
color: var(--opfontcolor);
transition: opacity 100ms ease-in;
display: none;
text-align: center;
vertical-align: middle;
overflow: auto;
}
#siteOptions {
position: absolute;
left: calc(50vw - (/* width */651px / 2));
top: calc(50vh - (/* height */432px / 2));
width: 651px;
height: 432px;
border: 3px solid transparent;
border-radius: 4px;
margin: 0;
background-color: var(--opbackcolor);
color: var(--opfontcolor);
transition: opacity 100ms ease-in;
display: none;
overflow: hidden;
}
#polyOptions {
position: absolute;
left: calc(50vw - (351px / 2));
top: calc(50vh - (236px / 2));
width: 351px;
height: 236px;
border: 3px solid transparent;
border-radius: 4px;
margin: 0;
background-color: var(--opbackcolor);
color: var(--opfontcolor);
transition: opacity 100ms ease-in;
display: none;
overflow: hidden;
}
#noteOptions {
position: absolute;
left: calc(50vw - (451px / 2));
top: calc(50vh - (236px / 2));
width: 451px;
height: 236px;
border: 3px solid transparent;
border-radius: 4px;
margin: 0;
background-color: var(--opbackcolor);
color: var(--opfontcolor);
transition: opacity 100ms ease-in;
display: none;
overflow: hidden;
}
#linkOptions {
position: absolute;
left: calc(50vw - (/* width */651px / 2));
top: calc(50vh - (/* height */432px / 2));
width: 651px;
height: 432px;
border: 3px solid transparent;
border-radius: 4px;
margin: 0;
background-color: var(--opbackcolor);
color: var(--opfontcolor);
transition: opacity 100ms ease-in;
display: none;
overflow: hidden;
}
#linkProfile {
position: absolute;
left: calc(60vw - (1103px / 2));
bottom: 70px;
width: 1103px;
height: 333px;
border: 3px solid transparent;
border-radius: 4px;
margin: 0;
background-color: var(--opbackcolor);
color: var(--opfontcolor);
transition: opacity 100ms ease-in;
display: none;
overflow: hidden;
}
.datasheet {
position: absolute;
left: calc(50vw - (/* width */651px / 2));
top: calc(50vh - (/* height */432px / 2));
width: 651px;
height: 432px;
border: 3px solid transparent;
border-radius: 4px;
margin: 0;
background-color: var(--opbackcolor);
color: var(--opfontcolor);
transition: opacity 100ms ease-in;
display: none;
overflow: auto;
}
.ol-control button {
background-color: var(--opbackcolor);
color: var(--opfontcolor);
}
.ol-control button:hover,
.ol-control button:focus {
background-color: var(--backcolor);
color: var(--hovercolor);
}
.ol-control.ol-bar .ol-toggle.ol-active button:hover,
.ol-control.ol-bar .ol-toggle.ol-active > button {
background-color: var(--opbackcolor);
}
.ol-searchgps.ol-search.ol-unselectable.ol-control.ol-collapsed {
width: 27.94px;
height: 27.94px;
}
.ol-search {
right: 4px;
left: auto;
}
.ol-control.ol-legend {
left: auto;
right: 4px;
top: 100px;
bottom: auto;
}
.ol-control.ol-legend button.ol-closebox {
left: 1px;
}
.ol-control.ol-legend button.ol-closebox:before {
color: var(--fontcolor);
}
.ol-legend.ol-unselectable.ol-control {
max-height: calc(77vh);
}
.ol-legend ul li {
color: var(--fontcolor);
text-align: left;
}
.ol-legend ul li.ol-title {
background-color: var(--facecolor);
color: var(--fontcolor);
}
.ol-legend ul li.ol-title div {
background-color: var(--facecolor);
color: var(--fontcolor);
}
.ol-scale-line {
left: auto;
right: 4px;
top: auto;
bottom: 40px;
color: var(--opfontcolor);
background-color: var(--opbackcolor);
}
.ol-scale-line-inner {
background-color: var(--opbackcolor);
color: var(--opfontcolor);
border-top: none;
border-left: 1px solid var(--opfontcolor);
border-right: 1px solid var(--opfontcolor);
border-bottom: 1px solid var(--opfontcolor);
}
.ol-rotate {
display: none;
}
.ol-zoom {
left: auto;
right: 4px;
top: 40px;
}
.tooltip.in {
opacity: 1;
}
.tooltip.top .tooltip-arrow {
border-top-color: white;
}
.tooltip-inner {
white-space: nowrap;
border: 2px solid var(--bordercolor);
background-color: var(--opbackcolor);
color: var(--opfontcolor);
}
.hidden-content {
display: none;
}
.page-disabler {
position: fixed;
z-index: 3000;
background-color: rgba(0,0,0,.25);
width: 100vw;
height: 100vh;
top: 0;
left: 0;
}
.page-enabler {
position: absolute;
z-index: 3100;
}
#messageBoxBar {
z-index: 200;
position: absolute;
left: calc(50vw - (/* width */403px / 2));
top: calc(50vh - (/* height */203px / 2));
width: 403px;
height: 203px;
border: 3px solid transparent;
border-radius: 4px;
margin: 0;
background-color: var(--backcolor);
color: var(--opfontcolor);
transition: opacity 100ms ease-in;
display: block;
text-align: center;
overflow: auto;
}
.predictSites {
position: absolute;
left: calc(50vw - (351px / 2));
top: calc(50vh - (236px / 2));
width: 351px;
height: 236px;
border: 3px solid transparent;
border-radius: 4px;
margin: 0;
background-color: var(--opbackcolor);
color: var(--opfontcolor);
transition: opacity 100ms ease-in;
display: none;
overflow: auto;
}
.predictBestCan {
position: absolute;
left: calc(50vw - (521px / 2));
top: calc(50vh - (293px / 2));
width: 521px;
height: 293px;
border: 3px solid transparent;
border-radius: 4px;
margin: 0;
background-color: var(--opbackcolor);
color: var(--opfontcolor);
transition: opacity 100ms ease-in;
display: none;
overflow: auto;
}
.transferContainer {
display: flex;
justify-content: center;
}
.transferButtons {
margin-right: 30px;
margin-left: 30px;
float: left;
align-self: center;
}
.listBox {
height: 86px !important;
width: 200px;
background-color: var(--backcolor);
color: var(--fontcolor);
border: 1px solid var(--bordercolor);
border-radius: 4px;
cursor: pointer;
text-align: left;
outline: none;
}
.listBox:active, .listBox:hover {
color: var(--hovercolor);
font-weight: 900;
}
.listBox:disabled {
background-color: var(--disabledbackcolor);
color: var(--disabledfontcolor);
}

View File

@@ -0,0 +1,36 @@
using System.Data;
using System.Web.Mvc;
using static cnip.Models.pgsql;
namespace cnip.Controllers
{
public class GlavniController : Controller
{
public ActionResult Index()
{
string puid = (string)Session["uid"];
string pukey = (string)Session["ukey"];
// check if ukey is valid
if (!(puid is null) && !(pukey is null) && puid != "" && pukey != "")
{
DataTable dt = GetDataTableFromQuery(
"SELECT ukey FROM pusers WHERE uid='" + puid + "';");
if (dt.Rows.Count > 0)
{
if ((string)dt.Rows[0][0] == pukey)
{
//user s already logged in
if (puid == "99999999")
{
ViewBag.Data = "redirecttowebadmin";
}
else
{
ViewBag.Data = "redirecttowebui";
}
}
}
}
return View();
}
}
}

View File

@@ -0,0 +1,12 @@
using System.Web.Mvc;
namespace cnip.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
}
}

View File

@@ -0,0 +1,215 @@
/******************************************************************************
*
* Name: GdalConfiguration.cs.pp
* Project: GDAL CSharp Interface
* Purpose: A static configuration utility class to enable GDAL/OGR.
* Author: Felix Obermaier
*
******************************************************************************
* Copyright (c) 2012-2018, Felix Obermaier
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*****************************************************************************/
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using Gdal = OSGeo.GDAL.Gdal;
using Ogr = OSGeo.OGR.Ogr;
namespace cnip
{
public static partial class GdalConfiguration
{
private static volatile bool _configuredOgr;
private static volatile bool _configuredGdal;
private static volatile bool _usable;
[DllImport("kernel32", CharSet = CharSet.Auto, SetLastError = true)]
static extern bool SetDefaultDllDirectories(uint directoryFlags);
// LOAD_LIBRARY_SEARCH_USER_DIRS | LOAD_LIBRARY_SEARCH_SYSTEM32
private const uint DllSearchFlags = 0x00000400 | 0x00000800;
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool AddDllDirectory(string lpPathName);
/// <summary>
/// Construction of Gdal/Ogr
/// </summary>
static GdalConfiguration()
{
string executingDirectory = null, gdalPath = null, nativePath = null;
try
{
if (!IsWindows)
{
const string notSet = "_Not_set_";
string tmp = Gdal.GetConfigOption("GDAL_DATA", notSet);
_usable = tmp != notSet;
return;
}
string executingAssemblyFile = new Uri(Assembly.GetExecutingAssembly().GetName().CodeBase).LocalPath;
executingDirectory = Path.GetDirectoryName(executingAssemblyFile);
if (string.IsNullOrEmpty(executingDirectory))
throw new InvalidOperationException("cannot get executing directory");
// modify search place and order
SetDefaultDllDirectories(DllSearchFlags);
gdalPath = Path.Combine(executingDirectory, "gdal");
nativePath = Path.Combine(gdalPath, GetPlatform());
if (!Directory.Exists(nativePath))
throw new DirectoryNotFoundException($"GDAL native directory not found at '{nativePath}'");
if (!File.Exists(Path.Combine(nativePath, "gdal_wrap.dll")))
throw new FileNotFoundException(
$"GDAL native wrapper file not found at '{Path.Combine(nativePath, "gdal_wrap.dll")}'");
// Add directories
AddDllDirectory(nativePath);
AddDllDirectory(Path.Combine(nativePath, "plugins"));
// Set the additional GDAL environment variables.
string gdalData = Path.Combine(gdalPath, "data");
Environment.SetEnvironmentVariable("GDAL_DATA", gdalData);
Gdal.SetConfigOption("GDAL_DATA", gdalData);
string driverPath = Path.Combine(nativePath, "plugins");
Environment.SetEnvironmentVariable("GDAL_DRIVER_PATH", driverPath);
Gdal.SetConfigOption("GDAL_DRIVER_PATH", driverPath);
Environment.SetEnvironmentVariable("GEOTIFF_CSV", gdalData);
Gdal.SetConfigOption("GEOTIFF_CSV", gdalData);
string projSharePath = Path.Combine(gdalPath, "share");
Environment.SetEnvironmentVariable("PROJ_LIB", projSharePath);
Gdal.SetConfigOption("PROJ_LIB", projSharePath);
_usable = true;
}
catch (Exception e)
{
_usable = false;
Trace.WriteLine(e, "error");
Trace.WriteLine($"Executing directory: {executingDirectory}", "error");
Trace.WriteLine($"gdal directory: {gdalPath}", "error");
Trace.WriteLine($"native directory: {nativePath}", "error");
//throw;
}
}
/// <summary>
/// Gets a value indicating if the GDAL package is set up properly.
/// </summary>
public static bool Usable
{
get { return _usable; }
}
/// <summary>
/// Method to ensure the static constructor is being called.
/// </summary>
/// <remarks>Be sure to call this function before using Gdal/Ogr/Osr</remarks>
public static void ConfigureOgr()
{
if (!_usable) return;
if (_configuredOgr) return;
// Register drivers
Ogr.RegisterAll();
_configuredOgr = true;
PrintDriversOgr();
}
/// <summary>
/// Method to ensure the static constructor is being called.
/// </summary>
/// <remarks>Be sure to call this function before using Gdal/Ogr/Osr</remarks>
public static void ConfigureGdal()
{
if (!_usable) return;
if (_configuredGdal) return;
// Register drivers
Gdal.AllRegister();
_configuredGdal = true;
PrintDriversGdal();
}
/// <summary>
/// Function to determine which platform we're on
/// </summary>
private static string GetPlatform()
{
return Environment.Is64BitProcess ? "x64" : "x86";
}
/// <summary>
/// Gets a value indicating if we are on a windows platform
/// </summary>
private static bool IsWindows
{
get
{
var res = !(Environment.OSVersion.Platform == PlatformID.Unix ||
Environment.OSVersion.Platform == PlatformID.MacOSX);
return res;
}
}
private static void PrintDriversOgr()
{
#if DEBUG
if (_usable)
{
var num = Ogr.GetDriverCount();
for (var i = 0; i < num; i++)
{
var driver = Ogr.GetDriver(i);
Trace.WriteLine($"OGR {i}: {driver.GetName()}", "Debug");
}
}
#endif
}
private static void PrintDriversGdal()
{
#if DEBUG
if (_usable)
{
var num = Gdal.GetDriverCount();
for (var i = 0; i < num; i++)
{
var driver = Gdal.GetDriver(i);
Trace.WriteLine($"GDAL {i}: {driver.ShortName}-{driver.LongName}");
}
}
#endif
}
}
}

View File

@@ -0,0 +1,218 @@
'******************************************************************************
'*
'* Name: GdalConfiguration.vb.pp
'* Project: GDAL VB.NET Interface
'* Purpose: A static configuration utility class to enable GDAL/OGR.
'* Author: Felix Obermaier
'*
'******************************************************************************
'* Copyright (c) 2012-2018, Felix Obermaier
'*
'* Permission is hereby granted, free of charge, to any person obtaining a
'* copy of this software and associated documentation files (the "Software"),
'* to deal in the Software without restriction, including without limitation
'* the rights to use, copy, modify, merge, publish, distribute, sublicense,
'* and/or sell copies of the Software, and to permit persons to whom the
'* Software is furnished to do so, subject to the following conditions:
'*
'* The above copyright notice and this permission notice shall be included
'* in all copies or substantial portions of the Software.
'*
'* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
'* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
'* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
'* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
'* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
'* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
'* DEALINGS IN THE SOFTWARE.
'*****************************************************************************/
Option Infer On
Imports System
Imports System.Diagnostics
Imports System.IO
Imports System.Reflection
Imports System.Runtime.InteropServices
Imports Gdal = OSGeo.GDAL.Gdal
Imports Ogr = OSGeo.OGR.Ogr
Namespace cnip
''' <summary>
''' Configuration class for GDAL/OGR
''' </summary>
Public Partial Class GdalConfiguration
Private Shared _configuredOgr As Boolean
Private Shared _configuredGdal As Boolean
Private Shared _usable As Boolean
<DllImport("kernel32.dll", CharSet:=CharSet.Auto, SetLastError:=True)>
Public Shared Function SetDefaultDllDirectories(ByVal directoryFlags As UInteger) As Boolean
End Function
' LOAD_LIBRARY_SEARCH_USER_DIRS | LOAD_LIBRARY_SEARCH_SYSTEM32
Private Const DllSearchFlags As UInteger = &H400 Or &H800
<DllImport("kernel32.dll", CharSet:=CharSet.Unicode, SetLastError:=True)>
Public Shared Function AddDllDirectory(ByVal lpPathName As String) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function
''' <summary>
''' Construction of Gdal/Ogr
''' </summary>
Shared Sub New()
Dim nativePath As String = Nothing
Dim executingDirectory As String = Nothing
Dim gdalPath As String = Nothing
Try
If Not IsWindows Then
Const notSet As String = "_Not_set_"
Dim tmp As String = Gdal.GetConfigOption("GDAL_DATA", notSet)
_usable = (tmp <> notSet)
Return
End If
Dim executingAssemblyFile As String = New Uri(Assembly.GetExecutingAssembly.GetName.CodeBase).LocalPath
executingDirectory = Path.GetDirectoryName(executingAssemblyFile)
If String.IsNullOrEmpty(executingDirectory) Then
Throw New InvalidOperationException("cannot get executing directory")
End If
SetDefaultDllDirectories(DllSearchFlags)
gdalPath = Path.Combine(executingDirectory, "gdal")
nativePath = Path.Combine(gdalPath, GetPlatform())
If Not Directory.Exists(nativePath) Then
Throw New DirectoryNotFoundException($"GDAL native directory not found at '{nativePath}'")
End If
If Not File.Exists(Path.Combine(nativePath, "gdal_wrap.dll")) Then
Throw New FileNotFoundException($"GDAL native wrapper file not found at '{Path.Combine(nativePath, ", gdal_wrap.dll, ")}'")
End If
AddDllDirectory(nativePath)
AddDllDirectory(Path.Combine(nativePath, "plugins"))
' Set the additional GDAL environment variables.
Dim gdalData As String = Path.Combine(gdalPath, "data")
Environment.SetEnvironmentVariable("GDAL_DATA", gdalData)
Gdal.SetConfigOption("GDAL_DATA", gdalData)
Dim driverPath As String = Path.Combine(nativePath, "plugins")
Environment.SetEnvironmentVariable("GDAL_DRIVER_PATH", driverPath)
Gdal.SetConfigOption("GDAL_DRIVER_PATH", driverPath)
Environment.SetEnvironmentVariable("GEOTIFF_CSV", gdalData)
Gdal.SetConfigOption("GEOTIFF_CSV", gdalData)
Dim projSharePath As String = Path.Combine(gdalPath, "share")
Environment.SetEnvironmentVariable("PROJ_LIB", projSharePath)
Gdal.SetConfigOption("PROJ_LIB", projSharePath)
_usable = True
Catch e As Exception
_usable = False
Trace.WriteLine(e, "error")
Trace.WriteLine($"Executing directory: {executingDirectory}", "error")
Trace.WriteLine($"gdal directory: {gdalPath}", "error")
Trace.WriteLine($"native directory: {nativePath}", "error")
'throw;
End Try
End Sub
''' <summary>
''' Gets a value indicating if the GDAL package is set up properly.
''' </summary>
Public Shared ReadOnly Property Usable As Boolean
Get
Return _usable
End Get
End Property
''' <summary>
''' Method to ensure the static constructor is being called.
''' </summary>
''' <remarks>Be sure to call this function before using Gdal/Ogr/Osr</remarks>
Public Shared Sub ConfigureOgr()
If Not _usable Then
Return
End If
If _configuredOgr Then
Return
End If
' Register drivers
Ogr.RegisterAll
_configuredOgr = True
PrintDriversOgr()
End Sub
''' <summary>
''' Method to ensure the static constructor is being called.
''' </summary>
''' <remarks>Be sure to call this function before using Gdal/Ogr/Osr</remarks>
Public Shared Sub ConfigureGdal()
If Not _usable Then
Return
End If
If _configuredGdal Then
Return
End If
' Register drivers
Gdal.AllRegister
_configuredGdal = True
PrintDriversGdal()
End Sub
''' <summary>
''' Function to determine which platform we're on
''' </summary>
Private Shared Function GetPlatform() As String
If (Environment.Is64BitProcess) Then Return "x64"
return "x86"
End Function
''' <summary>
''' Gets a value indicating if we are on a windows platform
''' </summary>
Private Shared ReadOnly Property IsWindows As Boolean
Get
Dim res = Not ((Environment.OSVersion.Platform = PlatformID.Unix) _
OrElse (Environment.OSVersion.Platform = PlatformID.MacOSX))
Return res
End Get
End Property
Private Shared Sub PrintDriversOgr()
#if (DEBUG)
If _usable Then
Dim num = Ogr.GetDriverCount
Dim i = 0
Do While (i < num)
Dim driver = Ogr.GetDriver(i)
Trace.WriteLine($"OGR {i}: {driver.GetName()}", "Debug")
i = (i + 1)
Loop
End If
#End If
End Sub
Private Shared Sub PrintDriversGdal()
#if (DEBUG)
If _usable Then
Dim num = Gdal.GetDriverCount
Dim i = 0
Do While (i < num)
Dim driver = Gdal.GetDriver(i)
Trace.WriteLine($"GDAL {i}: {driver.ShortName}-{driver.LongName}")
i = (i + 1)
Loop
End If
#End If
End Sub
End Class
End Namespace

View File

@@ -0,0 +1 @@
<%@ Application Codebehind="Global.asax.cs" Inherits="cnip.MvcApplication" Language="C#" %>

View File

@@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Web;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using System.Web.Security;
using System.Web.SessionState;
using OSGeo.GDAL;
using OSGeo.OGR;
using OSGeo.OSR;
using cnip.Models;
using System.Data;
using System.Web.UI;
using System.Web.Services;
using System.Xml;
using Newtonsoft;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Diagnostics;
using System.Text;
namespace cnip
{
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
Application["Name"] = "CNIP";
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleTable.EnableOptimizations = true;
BundleConfig.RegisterBundles(BundleTable.Bundles);
GdalConfiguration.ConfigureGdal();
GdalConfiguration.ConfigureOgr();
}
}
}

View File

@@ -0,0 +1,80 @@
using System.Collections.Generic;
using System.Linq;
namespace cnip.Models
{
//https://www.geeksforgeeks.org/find-if-there-is-a-path-between-two-vertices-in-a-given-graph/
// modified for undirected graph
public static class bfspbvg
{
public class Graph
{
private readonly int V; // No. of vertices
private readonly List<int>[] adj; // An array containing adjacency lists
public Graph(int V) // Constructor
{
this.V = V;
adj = new List<int>[V];
for (int i = 0; i < V; i++)
{
adj[i] = new List<int>();
}
}
public void AddEdge(int v, int w) // function to add an edge to graph
{
adj[v].Add(w);
adj[w].Add(v);
}
// A BFS based function to check whether d is reachable from s.
public bool IsReachable(int s, int d)
{
// Base case
if (s == d)
{
return true;
}
// Mark all the vertices as not visited
bool[] visited = new bool[V];
for (int i = 0; i < V; i++)
{
visited[i] = false;
}
// Create a queue for BFS
List<int> queue = new List<int>();
// Mark the current node as visited and enqueue it
visited[s] = true;
queue.Add(s);
// it will be used to get all adjacent vertices of a vertex
List<int>.Enumerator j;
while (queue.Count > 0)
{
// Dequeue a vertex from queue
s = queue.First();
queue.Remove(queue.First());
// Get all adjacent vertices of the dequeued vertex s
// If a adjacent has not been visited, then mark it visited
// and enqueue it
for (j = adj[s].GetEnumerator(); j.MoveNext();)
{
// If this adjacent node is the destination node, then
// return true
if (j.Current == d)
{
return true;
}
// Else, continue to do BFS
if (!visited[j.Current])
{
visited[j.Current] = true;
queue.Add(j.Current);
}
}
}
// If BFS is complete without visiting d
return false;
}
}
}
}

View File

@@ -0,0 +1,191 @@
using System;
using System.Runtime.InteropServices;
using OSGeo.GDAL;
namespace cnip.Models
{
public static class gdalext
{
public struct GdalInfo
{
// GDAL affine transform coefficients
// GT[0], X Min
// GT[1], X Pixel Size
// GT[2], X Coefficients
// GT[3], Y Max
// GT[4], Y Coefficients
// GT[5], Y Pixel size
public double XMin { get; set; }
public double XPixelSize { get; set; }
public double XCoefficient { get; set; }
public double YMax { get; set; }
public double YCoefficient { get; set; }
public double YPixelSize { get; set; }
public double XMax { get; set; } // extended properties
public double YMin { get; set; } // extended properties
public double XRasterSize { get; set; } // extended properties
public double YRasterSize { get; set; } // extended properties
public GdalInfo(
double xmin,
double xpixelsize,
double ymax,
double ypixelsize)
{
XMin = xmin;
XPixelSize = xpixelsize;
YMax = ymax;
YPixelSize = ypixelsize;
XRasterSize = 0;
YRasterSize = 0;
XCoefficient = 0;
YCoefficient = 0;
XMax = 0;
YMin = 0;
}
}
public static bool Pgsql2Json(
string pgSqlConn, string jsonFile, string[] options)
{
using (Dataset inputds = Gdal.OpenEx(
pgSqlConn, (uint)GdalConst.OF_VECTOR, null, null, null))
{
if (inputds == null) { return false; }
try
{
Dataset test = Gdal.wrapper_GDALVectorTranslateDestName(
jsonFile, inputds,
new GDALVectorTranslateOptions(options), null, null);
if (test == null)
{
inputds.Dispose();
return false;
}
test.Dispose();
}
catch (Exception) { return false; }
finally
{
inputds.Dispose();
}
}
return true;
}
public static bool Json2Pgsql(
string jsonFile, string pgSqlConn, string[] options)
{
using (Dataset inputds = Gdal.OpenEx(
jsonFile, (uint)GdalConst.OF_READONLY, null, null, null))
{
if (inputds == null) { return false; }
Dataset outputds = Gdal.OpenEx(
pgSqlConn, (uint)(GdalConst.OF_VECTOR), null, null, null);
if (outputds == null) { inputds.Dispose(); return false; }
try
{
int test = Gdal.wrapper_GDALVectorTranslateDestDS(
outputds, inputds,
new GDALVectorTranslateOptions(options), null, null);
}
catch (Exception) { return false; }
finally
{
inputds.Dispose();
outputds.Dispose();
}
}
return true;
}
public static GdalInfo GetGdalInfo(string inputFile)
{
GdalInfo info = new GdalInfo();
Dataset ds = Gdal.Open(inputFile, Access.GA_ReadOnly);
double[] GT = new double[6];
ds.GetGeoTransform(GT);
info.XMin = GT[0];
info.XPixelSize = GT[1];
info.XCoefficient = GT[2];
info.YMax = GT[3];
info.YCoefficient = GT[4];
info.YPixelSize = GT[5];
info.XMax = GT[0] + GT[1] * ds.RasterXSize + GT[2] * ds.RasterYSize;
info.YMin = GT[3] + GT[4] * ds.RasterXSize + GT[5] * ds.RasterYSize;
info.XRasterSize = ds.RasterXSize;
info.YRasterSize = ds.RasterYSize;
ds.Dispose();
return info;
}
public static void SetGdalInfo(string inputFile, GdalInfo info)
{
Dataset ds = Gdal.Open(inputFile, Access.GA_Update);
double[] GT = new double[6];
ds.GetGeoTransform(GT);
GT[1] = info.XPixelSize; GT[5] = info.YPixelSize;
GT[0] = info.XMin; GT[3] = info.YMax;
ds.SetGeoTransform(GT);
ds.Dispose();
}
public static bool Translate(
string inputFile, string outputFile, string[] options)
{
using (Dataset inputds = Gdal.OpenEx(
inputFile, (uint)GdalConst.OF_RASTER, null, null, null))
{
if (inputds == null) { return false; }
try
{
Dataset test = Gdal.wrapper_GDALTranslate(
outputFile, inputds,
new GDALTranslateOptions(options), null, null);
if (test == null)
{
inputds.Dispose();
return false;
}
test.Dispose();
}
catch (Exception) { return false; }
finally
{
inputds.Dispose();
}
}
return true;
}
public static bool Warp(
string inputFile, string outputFile, string[] options)
{
using (Dataset inputds = Gdal.Open(
inputFile, Access.GA_ReadOnly))
{
if (inputds == null)
{
return false;
}
IntPtr[] ptr = { Dataset.getCPtr(inputds).Handle };
GCHandle gcHandle = GCHandle.Alloc(ptr, GCHandleType.Pinned);
Dataset result = null;
try
{
SWIGTYPE_p_p_GDALDatasetShadow dss =
new SWIGTYPE_p_p_GDALDatasetShadow(
gcHandle.AddrOfPinnedObject(), false, null);
result = Gdal.wrapper_GDALWarpDestName(
outputFile, 1, dss,
new GDALWarpAppOptions(options), null, null);
if (result == null)
{
throw new Exception("GdalWarp failed: " +
Gdal.GetLastErrorMsg());
}
}
catch (Exception) { return false; }
finally
{
gcHandle.Free();
result.Dispose();
}
}
return true;
}
}
}

View File

@@ -0,0 +1,412 @@
using System;
using System.Data;
using System.Diagnostics;
using System.IO;
using OSGeo.GDAL;
using static cnip.Models.gisext;
using static cnip.Models.pgsql;
using static cnip.Models.strext;
namespace cnip.Models
{
public static class generic
{
public static int RandomNumber(int min, int max)
{
Random random = new Random(); return random.Next(min, max);
}
public static double DbmToWatt(double dbm)
{
return Math.Pow(10, dbm / 10) / 1000;
}
public static double WattToDbm(double watt)
{
return 10 * Math.Log10(watt * 1000);
}
public enum Extent
{
Center = 0,
BottomLeft = 1,
BottomRight = 2,
TopLeft = 3,
TopRight = 4
}
public static Coords GetExtent(
string puid,
string values,
string columnname,
string tableName,
Extent extent)
{
Coords c = new Coords(0, 0);
string sitesWhere = BuildWhere(values, columnname);
foreach (DataRow row in GetDataTableFromQuery(
"SELECT " +
(extent == Extent.Center ?
"(MAX(longitude)+MIN(longitude))/2 AS X, " +
"(MAX(latitude)+MIN(latitude))/2 AS Y " :
extent == Extent.BottomLeft ?
"MIN(longitude) AS X, " +
"MIN(latitude) AS Y " :
extent == Extent.BottomRight ?
"MAX(longitude) AS X, " +
"MIN(latitude) AS Y " :
extent == Extent.TopLeft ?
"MIN(longitude) AS X, " +
"MAX(latitude) AS Y " :
"MAX(longitude) AS X, " +
"MAX(latitude) AS Y "
) +
"FROM " +
tableName + " WHERE " +
"uid='" + puid + "' AND " +
sitesWhere + "GROUP BY uid;").Rows)
{
c.X = row[0].ToString().ToDouble();
c.Y = row[1].ToString().ToDouble();
}
return c;
}
public static void StartProcess(string path, string args = "", bool wait = true)
{
Process process = new Process();
process.StartInfo.FileName = path;
process.StartInfo.UseShellExecute = false;
process.StartInfo.CreateNoWindow = true;
process.StartInfo.Arguments = args;
process.Start();
if (wait) process.WaitForExit();
process.Close();
}
public static string GetElevationStringFromPointsArray(
string pointsArray)
{
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];
Dataset ds = Gdal.Open(GetRasterPath(-200, -200),
Access.GA_ReadOnly);
Band band = ds.GetRasterBand(1);
CPLErr error;
for (int i = 0; i < locations.Length; i++)
{
try
{
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])
{
prevLat = latitude; prevLon = longitude;
ds.Dispose();
ds = Gdal.Open(
GetRasterPath(longitude, latitude),
Access.GA_ReadOnly);
pGT = new double[6];
ds.GetGeoTransform(pGT);
band = ds.GetRasterBand(1);
}
col = Math.Abs((int)((longitude - pGT[0]) / pGT[1]));
row = Math.Abs((int)((pGT[3] - latitude) / -pGT[5]));
error =
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]; }
retval += locations[i] + "&" + pRBB[0].ToString() + "@";
}
catch (Exception)
{
break;
}
}
if (retval.Length > 0)
{
retval = loca.ToString() + "#" + locb.ToString() + "#" + retval.TrimEnd(1);
}
else
{
retval = "0#0#0&0&0&0";
}
band.Dispose();
ds.Dispose();
return retval;
}
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];
Dataset ds = Gdal.Open(GetRasterPath(-200, -200),
Access.GA_ReadOnly);
Band band = ds.GetRasterBand(1);
CPLErr error;
for (int i = 0; i < locations.Length; i++)
{
try
{
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])
{
prevLat = latitude; prevLon = longitude;
ds.Dispose();
ds = Gdal.Open(
GetRasterPath(longitude, latitude),
Access.GA_ReadOnly);
pGT = new double[6];
ds.GetGeoTransform(pGT);
band = ds.GetRasterBand(1);
}
col = Math.Abs((int)((longitude - pGT[0]) / pGT[1]));
row = Math.Abs((int)((pGT[3] - latitude) / -pGT[5]));
error =
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)
{
break;
}
}
band.Dispose();
ds.Dispose();
return averageElevation;
}
public static int GetElevationFromLonLat(
double longitude, double latitude)
{
try
{
Dataset ds = Gdal.Open(
GetRasterPath(longitude, latitude),
Access.GA_ReadOnly);
double[] pGT = new double[6];
ds.GetGeoTransform(pGT);
int col = Math.Abs((int)((longitude - pGT[0]) / pGT[1]));
int row = Math.Abs((int)((pGT[3] - latitude) / -pGT[5]));
Band band = ds.GetRasterBand(1);
CPLErr error;
// p read block byte
int[] pRBB = new int[1];
error =
band.ReadRaster(col, row, 1, 1, pRBB, 1, 1, 0, 0);
if (pRBB[0] < 0) { pRBB[0] = 0; }
band.Dispose();
ds.Dispose();
return pRBB[0];
}
catch (Exception)
{
return 0;
}
}
public static string GetRasterPath(
double longitude, double latitude)
{
string path = "dummy.tif";
string lon = longitude.ToString().Trim().Split('.')[0];
string lat = latitude.ToString().Trim().Split('.')[0];
if (longitude != -200 && latitude != -200)
{
if (lat.StartsWith("-"))
{
path = "S" +
(lat.Replace("-", "").ToInt() + 1).ToString("00");
}
else
{
path = "N" + lat.ToInt().ToString("00");
}
if (lon.StartsWith("-"))
{
path += "W" +
(lon.Replace("-", "").ToInt() + 1).ToString("000");
}
else
{
path += "E" + lon.ToInt().ToString("000") + ".hgt";
}
}
return @"C:/SPLAT/sdf-hd/" + path;
}
public static string GetElevationStringFromLineString(
string lineString, int resolution = 100)
{
string pointsArray = ""; double unitLength = 0;
foreach (DataRow row in GetDataTableFromQuery(
"SELECT locations, dist FROM (" +
"SELECT " +
"ST_AsText(ST_LineSubstring(wkb_geometry, " +
"length/" + resolution.ToString() + "*n/length," +
"CASE WHEN length/" + resolution.ToString() + "*(n+1)<length " +
"THEN length/" + resolution.ToString() + "*(n+1)/length " +
"ELSE 1 END)) AS locations, " +
"ST_Length(Geography(ST_LineSubstring(wkb_geometry, " +
"length/" + resolution.ToString() + "*n/length," +
"CASE WHEN length/" + resolution.ToString() + "*(n+1)<length " +
"THEN length/" + resolution.ToString() + "*(n+1)/length " +
"ELSE 1 END)),TRUE) As dist FROM " +
"(SELECT " +
"ST_LineMerge(ST_GeomFromText('" +
lineString + "',4326)) AS wkb_geometry," +
"ROUND(ST_Length(Geography(ST_GeomFromText('" +
lineString + "',4326)),TRUE)) As length" +
")tmp " +
"CROSS JOIN generate_series(0,10000) AS n " +
"WHERE n*length/" + resolution.ToString() + "/length<1" +
")tmp WHERE dist>0;").Rows)
{
string[] locations = row[0].ToString().Replace(
"LINESTRING(", "").Replace(")", "").Split(',');
string[] location1 = locations[0].Split(' ');
string[] location2 = locations[1].Split(' ');
if (pointsArray.Length == 0)
{
pointsArray += location1[0] + "&" +
location1[1] + "&" + unitLength.ToString() + "@";
unitLength += row[1].ToString().ToDouble() / 1000;
pointsArray += location2[0] + '&' +
location2[1] + "&" + unitLength.ToString() + "@";
}
else
{
unitLength += row[1].ToString().ToDouble() / 1000;
pointsArray += location2[0] + "&" +
location2[1] + "&" + unitLength.ToString() + "@";
}
}
pointsArray = pointsArray.TrimEnd(1);
return GetElevationStringFromPointsArray(pointsArray);
}
public static double GetAverageElevationFromLineString(
string lineString, int resolution = 100)
{
string pointsArray = "";
foreach (DataRow row in GetDataTableFromQuery(
"SELECT locations, dist FROM (" +
"SELECT " +
"ST_AsText(ST_LineSubstring(wkb_geometry, " +
"length/" + resolution.ToString() + "*n/length," +
"CASE WHEN length/" + resolution.ToString() + "*(n+1)<length " +
"THEN length/" + resolution.ToString() + "*(n+1)/length " +
"ELSE 1 END)) AS locations, " +
"ST_Length(Geography(ST_LineSubstring(wkb_geometry, " +
"length/" + resolution.ToString() + "*n/length," +
"CASE WHEN length/" + resolution.ToString() + "*(n+1)<length " +
"THEN length/" + resolution.ToString() + "*(n+1)/length " +
"ELSE 1 END)),TRUE) As dist FROM " +
"(SELECT " +
"ST_LineMerge(ST_GeomFromText('" +
lineString + "',4326)) AS wkb_geometry," +
"ROUND(ST_Length(Geography(ST_GeomFromText('" +
lineString + "',4326)),TRUE)) As length" +
")tmp " +
"CROSS JOIN generate_series(0,10000) AS n " +
"WHERE n*length/" + resolution.ToString() + "/length<1" +
")tmp WHERE dist>0;").Rows)
{
string[] locations = row[0].ToString().Replace(
"LINESTRING(", "").Replace(")", "").Split(',');
string[] location1 = locations[0].Split(' ');
string[] location2 = locations[1].Split(' ');
if (pointsArray.Length == 0)
{
pointsArray += location1[0] + "&" +
location1[1] + "@";
pointsArray += location2[0] + '&' +
location2[1] + "@";
}
else
{
pointsArray += location2[0] + "&" +
location2[1] + "@";
}
}
pointsArray = pointsArray.TrimEnd(1);
return GetAverageElevationFromPointsArray(pointsArray);
}
public static double AverageElevationFromCluster(Coords center, double radiusMeters)
{
string pointsArray = "";
foreach (DataRow point in GetDataTableFromQuery(
"SELECT ST_AsText((ST_Dump(ST_GeneratePoints(" +
"Geometry(ST_Buffer(Geography(ST_GeomFromText(" +
"'POINT(" + center.X.ToString() + " " + center.Y.ToString() + ")'" +
",4326))," + radiusMeters.ToString() + ")),600))).geom);"
).Rows)
{
string[] location = point[0].ToString().
Replace("POINT(", "").Replace(")", "").Split(' ');
pointsArray += location[0] + "&" + location[1] + "@";
}
pointsArray = pointsArray.TrimEnd(1);
return GetAverageElevationFromPointsArray(pointsArray);
}
public static double AverageElevationFromCenter(Coords center, double radiusMeters)
{
Coords locA, locB;
locA = Destination(center, 0, radiusMeters);
locB = Destination(center, 180, radiusMeters);
string lineString1 = "LINESTRING(" +
locA.X.ToString() + " " + locA.Y.ToString() + "," +
locB.X.ToString() + " " + locB.Y.ToString() + ")";
locA = Destination(center, 90, radiusMeters);
locB = Destination(center, 270, radiusMeters);
string lineString2 = "LINESTRING(" +
locA.X.ToString() + " " + locA.Y.ToString() + "," +
locB.X.ToString() + " " + locB.Y.ToString() + ")";
locA = Destination(center, 45, radiusMeters);
locB = Destination(center, 225, radiusMeters);
string lineString3 = "LINESTRING(" +
locA.X.ToString() + " " + locA.Y.ToString() + "," +
locB.X.ToString() + " " + locB.Y.ToString() + ")";
locA = Destination(center, 135, radiusMeters);
locB = Destination(center, 315, radiusMeters);
string lineString4 = "LINESTRING(" +
locA.X.ToString() + " " + locA.Y.ToString() + "," +
locB.X.ToString() + " " + locB.Y.ToString() + ")";
return
(
(
GetAverageElevationFromLineString(lineString1) +
GetAverageElevationFromLineString(lineString2) +
GetAverageElevationFromLineString(lineString3) +
GetAverageElevationFromLineString(lineString4)
)
/ 4
);
}
public static void ClearTempPath(string tempfol)
{
try
{
Array.ForEach(Directory.GetFiles(tempfol),
delegate (string path) { File.Delete(path); });
}
catch (Exception) { }
}
}
}

View File

@@ -0,0 +1,276 @@
using System;
namespace cnip.Models
{
public static class gisext
{
public enum UnitSystem
{
SI = 0,
US = 1
}
public enum DistanceFormula
{
Haversine = 0,
SphericalLawOfCosines = 1,
SphericalEarthProjection = 2
}
#region internal: properties (read-only)
internal static double EarthRadiusKm { get { return _radiusEarthKM; } }
internal static double EarthRadiusMiles { get { return _radiusEarthMiles; } }
internal static double M2Km { get { return _m2Km; } }
internal static double Deg2rad { get { return _toRad; } }
internal static double Rad2deg { get { return _toDeg; } }
#endregion
#region private: const
private const double _radiusEarthMiles = 3959;
private const double _radiusEarthKM = 6371;
private const double _m2Km = 1.60934;
private const double _toRad = Math.PI / 180;
private const double _toDeg = 180 / Math.PI;
#endregion
#region Method 1: Haversine algo
/// <summary>
/// Distance between two geographic points on surface, km/miles
/// Haversine formula to calculate
/// great-circle (orthodromic) distance on Earth
/// High Accuracy, Medium speed
/// re: http://en.wikipedia.org/wiki/Haversine_formula
/// </summary>
/// <param name="Lat1">double: 1st point Latitude</param>
/// <param name="Lon1">double: 1st point Longitude</param>
/// <param name="Lat2">double: 2nd point Latitude</param>
/// <param name="Lon2">double: 2nd point Longitude</param>
/// <returns>double: distance, km/miles</returns>
private static double DistanceHaversine(
Coords loc1,
Coords loc2,
UnitSystem unitSystem)
{
try
{
double _radLat1 = loc1.Y * _toRad;
double _radLat2 = loc2.Y * _toRad;
double _dLatHalf = (_radLat2 - _radLat1) / 2;
double _dLonHalf = Math.PI * (loc2.Y - loc1.X) / 360;
// intermediate result
double _a = Math.Sin(_dLatHalf);
_a *= _a;
// intermediate result
double _b = Math.Sin(_dLonHalf);
_b *= _b * Math.Cos(_radLat1) * Math.Cos(_radLat2);
// central angle, aka arc segment angular distance
double _centralAngle =
2 * Math.Atan2(
Math.Sqrt(_a + _b),
Math.Sqrt(1 - _a - _b)
);
// great-circle (orthodromic) distance on Earth between 2 points
if (unitSystem == UnitSystem.SI)
{
return _radiusEarthKM * _centralAngle * 1000;
}
else
{
return _radiusEarthMiles * _centralAngle;
}
}
catch { throw; }
}
#endregion
#region Method 2: Spherical Law of Cosines
/// <summary>
/// Distance between two geographic points on surface, km/miles
/// Spherical Law of Cosines formula to calculate
/// great-circle (orthodromic) distance on Earth;
/// High Accuracy, Medium speed
/// re: http://en.wikipedia.org/wiki/Spherical_law_of_cosines
/// </summary>
/// <param name="Lat1">double: 1st point Latitude</param>
/// <param name="Lon1">double: 1st point Longitude</param>
/// <param name="Lat2">double: 2nd point Latitude</param>
/// <param name="Lon2">double: 2nd point Longitude</param>
/// <returns>double: distance, km/miles</returns>
private static double DistanceSLC(
Coords loc1,
Coords loc2,
UnitSystem unitSystem)
{
try
{
double _radLat1 = loc1.Y * _toRad;
double _radLat2 = loc2.Y * _toRad;
double _radLon1 = loc1.X * _toRad;
double _radLon2 = loc2.X * _toRad;
// central angle, aka arc segment angular distance
double _centralAngle =
Math.Acos(Math.Sin(_radLat1) *
Math.Sin(_radLat2) +
Math.Cos(_radLat1) *
Math.Cos(_radLat2) *
Math.Cos(_radLon2 - _radLon1));
// great-circle (orthodromic) distance on Earth between 2 points
if (unitSystem == UnitSystem.SI)
{
return _radiusEarthKM * _centralAngle * 1000;
}
else
{
return _radiusEarthMiles * _centralAngle;
}
}
catch { throw; }
}
#endregion
#region Method 3: Spherical Earth projection
/// <summary>
/// Distance between two geographic points on surface, km/miles
/// Spherical Earth projection to a plane formula (using Pythagorean Theorem)
/// to calculate great-circle (orthodromic) distance on Earth.
/// central angle =
/// Sqrt((_radLat2 - _radLat1)^2 + (Cos((_radLat1 + _radLat2)/2) * (Lon2 - Lon1))^2)
/// Medium Accuracy, Fast,
/// relative error less than 0.1% in search area smaller than 250 miles
/// re: http://en.wikipedia.org/wiki/Geographical_distance
/// </summary>
/// <param name="Lat1">double: 1st point Latitude</param>
/// <param name="Lon1">double: 1st point Longitude</param>
/// <param name="Lat2">double: 2nd point Latitude</param>
/// <param name="Lon2">double: 2nd point Longitude</param>
/// <returns>double: distance, km/miles</returns>
private static double DistanceSEP(Coords loc1,
Coords loc2,
UnitSystem unitSystem)
{
try
{
double _radLat1 = loc1.Y * _toRad;
double _radLat2 = loc2.Y * _toRad;
double _dLat = (_radLat2 - _radLat1);
double _dLon = (loc2.X - loc1.X) * _toRad;
double _a = (_dLon) * Math.Cos((_radLat1 + _radLat2) / 2);
// central angle, aka arc segment angular distance
double _centralAngle = Math.Sqrt(_a * _a + _dLat * _dLat);
// great-circle (orthodromic) distance on Earth between 2 points
if (unitSystem == UnitSystem.SI)
{
return _radiusEarthKM * _centralAngle * 1000;
}
else
{
return _radiusEarthMiles * _centralAngle;
}
}
catch { throw; }
}
#endregion
public struct Coords
{
public double X { get; set; }
public double Y { get; set; }
public Coords(double x, double y)
{
X = x; Y = y;
}
}
public struct Bounds
{
public double XMin { get; set; }
public double YMin { get; set; }
public double XMax { get; set; }
public double YMax { get; set; }
public Bounds(
double xmin,
double ymin,
double xmax,
double ymax)
{
XMin = xmin;
YMin = ymin;
XMax = xmax;
YMax = ymax;
}
}
public static Bounds MBR(
Coords center, double radius)
{
Bounds mbr = new Bounds();
Coords bottomLeft, topRight;
bottomLeft =
Destination(center, 225,
Math.Sqrt(2 * Math.Pow(radius, 2)));
topRight =
Destination(center, 45,
Math.Sqrt(2 * Math.Pow(radius, 2)));
mbr.XMin = bottomLeft.X > topRight.X ?
topRight.X : bottomLeft.X;
mbr.XMax = bottomLeft.X > topRight.X ?
bottomLeft.X : topRight.X;
mbr.YMin = bottomLeft.Y > topRight.Y ?
topRight.Y : bottomLeft.Y;
mbr.YMax = bottomLeft.Y > topRight.Y ?
bottomLeft.Y : topRight.Y;
return mbr;
}
public static Coords Destination(
Coords source, double bearing, double distance)
{
Coords destination = new Coords();
source.X = source.X * _toRad;
source.Y = source.Y * _toRad;
distance = distance / 1000;
bearing = bearing * _toRad;
destination.Y = Math.Asin(
(
Math.Sin(source.Y) *
Math.Cos(distance / _radiusEarthKM)
) +
(
Math.Cos(source.Y) *
Math.Sin(distance / _radiusEarthKM) *
Math.Cos(bearing)
)
);
destination.X = source.X + Math.Atan2(
Math.Sin(bearing) *
Math.Sin(distance / _radiusEarthKM) *
Math.Cos(source.Y),
Math.Cos(distance / _radiusEarthKM) -
Math.Sin(source.Y) *
Math.Sin(destination.Y)
);
destination.Y = destination.Y * _toDeg;
destination.X = destination.X * _toDeg;
return destination;
}
public static double Distance(
Coords loc1,
Coords loc2,
UnitSystem unitSystem = UnitSystem.SI,
DistanceFormula distanceFormula =
DistanceFormula.SphericalEarthProjection)
{
switch (distanceFormula)
{
case DistanceFormula.Haversine:
return DistanceHaversine(loc1, loc2, unitSystem);
case DistanceFormula.SphericalEarthProjection:
return DistanceSEP(loc1, loc2, unitSystem);
case DistanceFormula.SphericalLawOfCosines:
return DistanceSLC(loc1, loc2, unitSystem);
default:
return DistanceSEP(loc1, loc2, unitSystem);
}
}
}
}

View File

@@ -0,0 +1,135 @@
using System;
namespace cnip.Models
{
// https://www.geeksforgeeks.org/kruskals-minimum-spanning-tree-algorithm-greedy-algo-2/
public static class kruskal
{
// A class to represent a graph edge
public class Edge : IComparable<Edge>
{
public int src, dest, weight;
// Comparator function used for sorting edges
// based on their weight
public int CompareTo(Edge compareEdge)
{
return this.weight - compareEdge.weight;
}
}
public class Graph
{
// A class to represent a subset for union-find
private class Subset
{
public int parent, rank;
};
private readonly int V, E; // V-> no. of vertices & E->no.of edges
public Edge[] edge; // collection of all edges
// Creates a graph with V vertices and E edges
public Graph(int v, int e)
{
V = v;
E = e;
edge = new Edge[E];
for (int i = 0; i < e; ++i)
edge[i] = new Edge();
}
// A utility function to find set of an element i
// (uses path compression technique)
private int Find(Subset[] subsets, int i)
{
// find root and make root as
// parent of i (path compression)
if (subsets[i].parent != i)
subsets[i].parent = Find(subsets,
subsets[i].parent);
return subsets[i].parent;
}
// A function that does union of
// two sets of x and y (uses union by rank)
private void Union(Subset[] subsets, int x, int y)
{
int xroot = Find(subsets, x);
int yroot = Find(subsets, y);
// Attach smaller rank tree under root of
// high rank tree (Union by Rank)
if (subsets[xroot].rank < subsets[yroot].rank)
subsets[xroot].parent = yroot;
else if (subsets[xroot].rank > subsets[yroot].rank)
subsets[yroot].parent = xroot;
// If ranks are same, then make one as root
// and increment its rank by one
else
{
subsets[yroot].parent = xroot;
subsets[xroot].rank++;
}
}
// The main function to construct MST
// using Kruskal's algorithm
public Edge[] KruskalMST()
{
Edge[] result = new Edge[V]; // This will store the resultant MST
int e = 0; // An index variable, used for result[]
int i = 0; // An index variable, used for sorted edges
for (i = 0; i < V; ++i)
result[i] = new Edge();
// Step 1: Sort all the edges in non-decreasing
// order of their weight. If we are not allowed
// to change the given graph, we can create
// a copy of array of edges
Array.Sort(edge);
// Allocate memory for creating V ssubsets
Subset[] subsets = new Subset[V];
for (i = 0; i < V; ++i)
subsets[i] = new Subset();
// Create V subsets with single elements
for (int v = 0; v < V; ++v)
{
subsets[v].parent = v;
subsets[v].rank = 0;
}
i = 0; // Index used to pick next edge
// Number of edges to be taken is equal to V-1
while (e < V - 1)
{
// Step 2: Pick the smallest edge. And increment
// the index for next iteration
Edge next_edge = new Edge();
next_edge = edge[i++];
int x = Find(subsets, next_edge.src);
int y = Find(subsets, next_edge.dest);
// If including this edge does't cause cycle,
// include it in result and increment the index
// of result for next edge
if (x != y)
{
result[e++] = next_edge;
Union(subsets, x, y);
}
// Else discard the next_edge
}
return result;
}
}
}
}

View File

@@ -0,0 +1,141 @@
using System;
using System.Data;
using static System.Configuration.ConfigurationManager;
using Npgsql;
using static Npgsql.NpgsqlConnection;
using static cnip.Models.gisext;
using System.Linq;
namespace cnip.Models
{
public static class pgsql
{
public static void DropTable(string tablename)
{
ExecuteNonQuery("DROP TABLE IF EXISTS " + tablename + ";");
}
public static bool TableExists(string tablename)
{
DataTable dt = GetDataTableFromQuery("SELECT * FROM " +
"information_schema.tables WHERE table_schema = 'public' " +
"AND table_name = '" + tablename + "';");
return dt.Rows.Count > 0 ? true : false;
}
public static bool TableHasData(string tablename)
{
DataTable dt = GetDataTableFromQuery("SELECT EXISTS(SELECT * FROM " +
tablename + ") AS has_row;");
return dt.Rows.Count == 0 ? false :
dt.Rows[0][0].ToString().ToLower() == "true" ? true : false;
}
public static DataTable GetDataTableFromQuery(
string query, string connstr = "")
{
if (connstr == "")
{
connstr = ConnectionStrings["cnipdb"].ConnectionString;
}
GlobalTypeMapper.UseNetTopologySuite();
using (NpgsqlConnection con = new NpgsqlConnection(connstr))
using (NpgsqlDataAdapter da = new NpgsqlDataAdapter(query, con))
{
DataSet ds = new DataSet();
da.Fill(ds);
return ds.Tables[0];
}
}
public static void ExecuteNonQuery(string query, string connstr = "")
{
if (connstr == "")
{
connstr = ConnectionStrings["cnipdb"].ConnectionString;
}
GlobalTypeMapper.UseNetTopologySuite();
using (NpgsqlConnection con = new NpgsqlConnection(connstr))
using (NpgsqlCommand cmd = new NpgsqlCommand(query, con))
{
con.Open();
cmd.CommandTimeout = 0;
cmd.CommandType = CommandType.Text;
cmd.ExecuteNonQuery();
con.Close();
}
}
public static string BuildWhere(
string values,
string columnname,
bool equals = true)
{
string where = "";
if (values.Length > 0)
{
where = String.Join(" ",
values.Split(',').
Select(x => columnname +
(equals ? "=" : "<>") +
"'" + x + "' " +
(equals ? "OR" : "AND")).
ToArray());
where =where.TrimEnd(equals ? 3 : 4);
where = "(" + where + ") ";
}
return where;
}
public static Bounds MBR(Coords center, double radius)
{
Bounds mbr = new Bounds();
Coords bottomLeft = new Coords();
Coords topRight = new Coords();
foreach (DataRow row in GetDataTableFromQuery(
"SELECT ST_Project(Geography(ST_GeomFromText(" +
"'POINT(" +
center.X.ToString() + " " +
center.Y.ToString() + ")',4326))," +
Math.Sqrt(2 * Math.Pow(radius, 2)).ToString() +
",radians(225));").Rows)
{
bottomLeft.X = row[0].ToString().Replace(
"POINT(", "").Replace(")", "").Split(' ')[0].ToDouble();
bottomLeft.Y = row[0].ToString().Replace(
"POINT(", "").Replace(")", "").Split(' ')[1].ToDouble();
}
foreach (DataRow row in GetDataTableFromQuery(
"SELECT ST_Project(Geography(ST_GeomFromText(" +
"'POINT(" +
center.X.ToString() + " " +
center.Y.ToString() + ")',4326))," +
Math.Sqrt(2 * Math.Pow(radius, 2)).ToString() +
",radians(45));").Rows)
{
topRight.X = row[0].ToString().Replace(
"POINT(", "").Replace(")", "").Split(' ')[0].ToDouble();
topRight.Y = row[0].ToString().Replace(
"POINT(", "").Replace(")", "").Split(' ')[1].ToDouble();
}
mbr.XMin = bottomLeft.X > topRight.X ? topRight.X : bottomLeft.X;
mbr.XMax = bottomLeft.X > topRight.X ? bottomLeft.X : topRight.X;
mbr.YMin = bottomLeft.Y > topRight.Y ? topRight.Y : bottomLeft.Y;
mbr.YMax = bottomLeft.Y > topRight.Y ? bottomLeft.Y : topRight.Y;
return mbr;
}
public static double Distance(Coords loc1, Coords loc2)
{
double d = 0;
foreach (DataRow row in GetDataTableFromQuery(
"SELECT ST_Distance(" +
"Geography(ST_GeomFromText(" +
"'POINT(" +
loc1.X.ToString() + " " +
loc1.Y.ToString() + ")',4326))," +
"Geography(ST_GeomFromText(" +
"'POINT(" +
loc2.X.ToString() + " " +
loc2.Y.ToString() + ")',4326))," +
"true);").Rows)
{
d = row[0].ToString().ToDouble();
}
return d;
}
}
}

View File

@@ -0,0 +1,96 @@
namespace cnip.Models
{
class rfantenna
{
public struct RFAntenna
{
public string AntennaModel { get; set; }
public string AntennaType { get; set; }
public string Polarization { get; set; }
public string VBeamWidth { get; set; }
public string HBeamWidth { get; set; }
public string DownTilt { get; set; }
public string AntennaGain { get; set; }
}
public static RFAntenna GetRFAntennaParameters(string antennaModel)
{
RFAntenna rfAntenna = new RFAntenna();
switch (antennaModel)
{
case "LT OD9-5 890-950 MHz":
rfAntenna.AntennaModel = "LT OD9-5 890-950 MHz";
rfAntenna.AntennaType = "Omni";
rfAntenna.Polarization = "Vertical";
rfAntenna.VBeamWidth = "36";
rfAntenna.HBeamWidth = "360";
rfAntenna.DownTilt = "0";
rfAntenna.AntennaGain = "5";
break;
case "LT OD9-6 865-945 MHz":
rfAntenna.AntennaModel = "LT OD9-6 865-945 MHz";
rfAntenna.AntennaType = "Omni";
rfAntenna.Polarization = "Vertical";
rfAntenna.VBeamWidth = "16";
rfAntenna.HBeamWidth = "360";
rfAntenna.DownTilt = "0";
rfAntenna.AntennaGain = "6";
break;
case "LT OD9-6 860-960 MHz":
rfAntenna.AntennaModel = "LT OD9-6 860-960 MHz";
rfAntenna.AntennaType = "Omni";
rfAntenna.Polarization = "Vertical";
rfAntenna.VBeamWidth = "16";
rfAntenna.HBeamWidth = "360";
rfAntenna.DownTilt = "0";
rfAntenna.AntennaGain = "6";
break;
case "LT OD9-8 865-945 MHz":
rfAntenna.AntennaModel = "LT OD9-8 865-945 MHz";
rfAntenna.AntennaType = "Omni";
rfAntenna.Polarization = "Vertical";
rfAntenna.VBeamWidth = "10";
rfAntenna.HBeamWidth = "360";
rfAntenna.DownTilt = "0";
rfAntenna.AntennaGain = "8";
break;
case "LT OD9-8 860-960 MHz":
rfAntenna.AntennaModel = "LT OD9-8 860-960 MHz";
rfAntenna.AntennaType = "Omni";
rfAntenna.Polarization = "Vertical";
rfAntenna.VBeamWidth = "10";
rfAntenna.HBeamWidth = "360";
rfAntenna.DownTilt = "0";
rfAntenna.AntennaGain = "8";
break;
case "LT OD9-11 860-960 MHz":
rfAntenna.AntennaModel = "LT OD9-11 860-960 MHz";
rfAntenna.AntennaType = "Omni";
rfAntenna.Polarization = "Vertical";
rfAntenna.VBeamWidth = "7";
rfAntenna.HBeamWidth = "360";
rfAntenna.DownTilt = "0";
rfAntenna.AntennaGain = "11";
break;
case "LT OD9-11D1 860-960 MHz":
rfAntenna.AntennaModel = "LT OD9-11D1 860-960 MHz";
rfAntenna.AntennaType = "Omni";
rfAntenna.Polarization = "Vertical";
rfAntenna.VBeamWidth = "7";
rfAntenna.HBeamWidth = "360";
rfAntenna.DownTilt = "1";
rfAntenna.AntennaGain = "11";
break;
default:
rfAntenna.AntennaModel = "LT OD9-5 890-950 MHz";
rfAntenna.AntennaType = "Omni";
rfAntenna.Polarization = "Vertical";
rfAntenna.VBeamWidth = "36";
rfAntenna.HBeamWidth = "360";
rfAntenna.DownTilt = "0";
rfAntenna.AntennaGain = "5";
break;
}
return rfAntenna;
}
}
}

View File

@@ -0,0 +1,275 @@
using System.Data;
using static cnip.Models.pgsql;
namespace cnip.Models
{
class settings
{
public struct Settings
{
public string Pl_MeasurementType { get; set; }
public string Pl_TerrainResolution { get; set; }
public string Pl_Thematic { get; set; }
public string Pl_Radius { get; set; }
public string Pl_PropagationModel { get; set; }
public string Pl_ReliabilityS { get; set; }
public string Pl_ReliabilityT { get; set; }
public string Pl_TerrainConductivity { get; set; }
public string Pl_RadioClimate { get; set; }
public string Pl_ReceiverHeight { get; set; }
public string Pl_ReceiverGain { get; set; }
public string Pl_ReceiverSensitivity { get; set; }
public string Rp_AntennaModel { get; set; }
public string Rp_CellRadius { get; set; }
public string Rp_GSMBand { get; set; }
public string Rp_GSMBandwidth { get; set; }
public string Rp_LTEBand { get; set; }
public string Rp_LTEBandwidth { get; set; }
public string Mw_Frequency { get; set; }
public string Mw_Channelwidth { get; set; }
public string Mw_OutputPower { get; set; }
public string Mw_AntennaGain { get; set; }
public string Mw_Losses { get; set; }
public string Mw_FresnelClearance { get; set; }
public string EarthDielectricConstant { get; set; }
public string EarthConductivity { get; set; }
public string RadioClimateNumber { get; set; }
public string AtmosphericBendingConstant { get; set; }
public string ThematicBaseType { get; set; }
public string ThematicExtension { get; set; }
public string Resolution { get; set; }
public double XPixelSize { get; set; }
public double YPixelSize { get; set; }
public void SetPl_MeasurementType(string pl_measurementType)
{
Pl_MeasurementType = pl_measurementType;
ThematicBaseType =
Pl_MeasurementType == "Received Power (dBm)" ? "trp" :
Pl_MeasurementType == "Field Strength (dBµV/m)" ? "tfs" : "tpl";
ThematicExtension =
Pl_MeasurementType == "Received Power (dBm)" ? "trp" :
Pl_MeasurementType == "Field Strength (dBµV/m)" ? "tfs" :
Pl_MeasurementType == "Path Loss (dB)" ? "tfs" :
Pl_MeasurementType == "SNR (dB)" ? "tsn" :
Pl_MeasurementType == "Voice Quality Score" ? "tvq" :
Pl_MeasurementType == "Data Rate Score" ? "tdr" : "tpl";
}
public Settings(string puid)
{
// default values
Pl_MeasurementType = "Received Power (dBm)";
Pl_TerrainResolution = "90m";
Pl_Thematic = "default";
Pl_Radius = "1.5";
Pl_PropagationModel = "ITWOM 3.0 (< 20GHz)";
Pl_ReliabilityS = "50";
Pl_ReliabilityT = "90";
Pl_TerrainConductivity = "Average ground";
Pl_RadioClimate = "Maritime Temperate (Land)";
Pl_ReceiverHeight = "1.5";
Pl_ReceiverGain = "2.14";
Pl_ReceiverSensitivity = "-90";
Rp_AntennaModel = "LT OD9-5 890-950 MHz";
Rp_CellRadius = "1.5";
Rp_GSMBand = "GSM900 PGSM";
Rp_GSMBandwidth = "0.2";
Rp_LTEBand = "B08_FDD_900 E-GSM";
Rp_LTEBandwidth = "10";
Mw_Frequency = "5";
Mw_Channelwidth = "20";
Mw_OutputPower = "47";
Mw_AntennaGain = "22.5";
Mw_Losses = "0";
Mw_FresnelClearance = "60";
// dependent variables
Resolution = Pl_TerrainResolution == "90m" ? "sd" : "hd";
XPixelSize = Pl_TerrainResolution == "90m" ?
0.0008333333333333333868 : 0.0002777777777777777775;
YPixelSize = Pl_TerrainResolution == "90m" ?
-0.0008333333333333333868 : -0.0002777777777777777775;
ThematicBaseType =
Pl_MeasurementType == "Received Power (dBm)" ? "trp" :
Pl_MeasurementType == "Field Strength (dBµV/m)" ? "tfs" : "tpl";
ThematicExtension =
Pl_MeasurementType == "Received Power (dBm)" ? "trp" :
Pl_MeasurementType == "Field Strength (dBµV/m)" ? "tfs" :
Pl_MeasurementType == "Path Loss (dB)" ? "tfs" :
Pl_MeasurementType == "SNR (dB)" ? "tsn" :
Pl_MeasurementType == "Voice Quality Score" ? "tvq" :
Pl_MeasurementType == "Data Rate Score" ? "tdr" : "tpl";
EarthDielectricConstant = EarthDielectricConstant(Pl_TerrainConductivity);
EarthConductivity = EarthConductivity(Pl_TerrainConductivity);
RadioClimateNumber = RadioClimateNumber(Pl_RadioClimate);
AtmosphericBendingConstant = AtmosphericBendingConstant(Pl_RadioClimate);
foreach (DataRow row in GetDataTableFromQuery("SELECT " +
"pl_measurementtype, pl_terrainresolution, pl_thematic, " +
"pl_radius, pl_propagationmodel, pl_reliabilitys, " +
"pl_reliabilityt, pl_terrainconductivity, pl_radioclimate, " +
"pl_receiverheight, pl_receivergain, pl_receiversensitivity, " +
"rp_antennamodel, rp_cellradius, rp_gsmband, " +
"rp_gsmbandwidth, rp_lteband, rp_ltebandwidth, " +
"mw_frequency, mw_channelwidth, mw_outputpower, " +
"mw_antennagain, mw_losses, mw_fresnelclearance " +
"FROM puserssettings WHERE uid='" + puid + "';").Rows)
{
Pl_MeasurementType = row[0].ToString();
Pl_TerrainResolution = row[1].ToString();
Pl_Thematic = row[2].ToString();
Pl_Radius = row[3].ToString();
Pl_PropagationModel = row[4].ToString();
Pl_ReliabilityS = row[5].ToString();
Pl_ReliabilityT = row[6].ToString();
Pl_TerrainConductivity = row[7].ToString();
Pl_RadioClimate = row[8].ToString();
Pl_ReceiverHeight = row[9].ToString();
Pl_ReceiverGain = row[10].ToString();
Pl_ReceiverSensitivity = row[11].ToString();
Rp_AntennaModel = row[12].ToString();
Rp_CellRadius = row[13].ToString();
Rp_GSMBand = row[14].ToString();
Rp_GSMBandwidth = row[15].ToString();
Rp_LTEBand = row[16].ToString();
Rp_LTEBandwidth = row[17].ToString();
Mw_Frequency = row[18].ToString();
Mw_Channelwidth = row[19].ToString();
Mw_OutputPower = row[20].ToString();
Mw_AntennaGain = row[21].ToString();
Mw_Losses = row[22].ToString();
Mw_FresnelClearance = row[23].ToString();
// dependent variables
Resolution = Pl_TerrainResolution == "90m" ? "sd" : "hd";
XPixelSize = Pl_TerrainResolution == "90m" ?
0.0008333333333333333868 : 0.0002777777777777777775;
YPixelSize = Pl_TerrainResolution == "90m" ?
-0.0008333333333333333868 : -0.0002777777777777777775;
ThematicBaseType =
Pl_MeasurementType == "Received Power (dBm)" ? "trp" :
Pl_MeasurementType == "Field Strength (dBµV/m)" ? "tfs" : "tpl";
ThematicExtension =
Pl_MeasurementType == "Received Power (dBm)" ? "trp" :
Pl_MeasurementType == "Field Strength (dBµV/m)" ? "tfs" :
Pl_MeasurementType == "Path Loss (dB)" ? "tfs" :
Pl_MeasurementType == "SNR (dB)" ? "tsn" :
Pl_MeasurementType == "Voice Quality Score" ? "tvq" :
Pl_MeasurementType == "Data Rate Score" ? "tdr" : "tpl";
EarthDielectricConstant = EarthDielectricConstant(Pl_TerrainConductivity);
EarthConductivity = EarthConductivity(Pl_TerrainConductivity);
RadioClimateNumber = RadioClimateNumber(Pl_RadioClimate);
AtmosphericBendingConstant = AtmosphericBendingConstant(Pl_RadioClimate);
}
}
}
public static string EarthDielectricConstant(string terrainConductivity)
{
string earthDielectricConstant = "";
switch (terrainConductivity)
{
case "Salt water":
earthDielectricConstant = "80.000"; break;
case "Good ground":
earthDielectricConstant = "25.000"; break;
case "Fresh water":
earthDielectricConstant = "80.000"; break;
case "Marshy land":
earthDielectricConstant = "12.000"; break;
case "Farm land":
earthDielectricConstant = "15.000"; break;
case "Forest":
earthDielectricConstant = "15.000"; break;
case "Average ground":
earthDielectricConstant = "15.000"; break;
case "Mountain / Sand":
earthDielectricConstant = "13.000"; break;
case "City":
earthDielectricConstant = "05.000"; break;
case "Poor ground":
earthDielectricConstant = "04.000"; break;
default: earthDielectricConstant = "15.000"; break;
}
return earthDielectricConstant;
}
public static string EarthConductivity(string terrainConductivity)
{
string earthConductivity = "";
switch (terrainConductivity)
{
case "Salt water":
earthConductivity = "5.000"; break;
case "Good ground":
earthConductivity = "0.020"; break;
case "Fresh water":
earthConductivity = "0.010"; break;
case "Marshy land":
earthConductivity = "0.007"; break;
case "Farm land":
earthConductivity = "0.005"; break;
case "Forest":
earthConductivity = "0.005"; break;
case "Average ground":
earthConductivity = "0.005"; break;
case "Mountain / Sand":
earthConductivity = "0.002"; break;
case "City":
earthConductivity = "0.001"; break;
case "Poor ground":
earthConductivity = "0.001"; break;
default: earthConductivity = "0.005"; break;
}
return earthConductivity;
}
public static string RadioClimateNumber(string radioClimate)
{
string radioClimateNumber = "";
switch (radioClimate)
{
case "Equatorial (Congo)":
radioClimateNumber = "1"; break;
case "Continental Subtropical (Sudan)":
radioClimateNumber = "2"; break;
case "Maritime Subtropical (W. Africa)":
radioClimateNumber = "3"; break;
case "Desert (Sahara)":
radioClimateNumber = "4"; break;
case "Continental Temperate":
radioClimateNumber = "5"; break;
case "Maritime Temperate (Land)":
radioClimateNumber = "6"; break;
case "Maritime Temperate (Sea)":
radioClimateNumber = "7"; break;
default: radioClimateNumber = "5"; break;
}
return radioClimateNumber;
}
public static string AtmosphericBendingConstant(string radioClimate)
{
string atmosphericBendingConstant = "";
switch (radioClimate)
{
case "Equatorial (Congo)":
atmosphericBendingConstant = "360.000"; break;
case "Continental Subtropical (Sudan)":
atmosphericBendingConstant = "320.000"; break;
case "Maritime Subtropical (W. Africa)":
atmosphericBendingConstant = "370.000"; break;
case "Desert (Sahara)":
atmosphericBendingConstant = "280.000"; break;
case "Continental Temperate":
atmosphericBendingConstant = "301.000"; break;
case "Maritime Temperate (Land)":
atmosphericBendingConstant = "320.000"; break;
case "Maritime Temperate (Sea)":
atmosphericBendingConstant = "350.000"; break;
default: atmosphericBendingConstant = "301.000"; break;
}
return atmosphericBendingConstant;
}
}
}

View File

@@ -0,0 +1,159 @@
using System;
using System.Data;
using static cnip.Models.gisext;
using static cnip.Models.settings;
using static cnip.Models.pgsql;
using static cnip.Models.generic;
namespace cnip.Models
{
public static class site
{
public struct Site
{
public string Puid { get; set; }
public string Siteid { get; set; }
public string SiteName { get; set; }
public string Latitude { get; set; }
public string Longitude { get; set; }
public string HBA { get; set; }
public string Frequency { get; set; }
public string Polarization { get; set; }
public string PolarizationNumber { get; set; }
public string EIRP { get; set; }
public string AntennaType { get; set; }
public string AntennaModel { get; set; }
public double AntennaGain { get; set; }
public double FeederLoss { get; set; }
public double RfPower { get; set; }
public string Azimuth { get; set; }
public string DownTilt { get; set; }
public double Bandwidth { get; set; }
public string SnrFactor { get; set; }
public string Technology { get; set; }
public string Height { get; set; }
public Coords Location;
public Site(string puid, string siteid)
{
Settings settings = new Settings(puid);
Puid = "";
Siteid = "";
SiteName = "";
Latitude = "";
Longitude = "";
HBA = "";
Frequency = "";
Polarization = "";
PolarizationNumber = "";
EIRP = "";
AntennaType = "";
AntennaModel = "";
AntennaGain = 0;
FeederLoss = 0;
RfPower = 0;
Azimuth = "";
DownTilt = "";
Bandwidth = 0;
SnrFactor = "";
Technology = "";
Height = "";
Location = new Coords(0, 0);
foreach (DataRow row in GetDataTableFromQuery("SELECT " +
"siteid, sitename, latitude, longitude*-1, " +
"hba, dlfrequency, polarization, rfpower, " +
"antennatype, azimuth, downtilt, antennamodel, " +
"antennagain, feederloss, bandwidth, technology, height " +
"FROM pusersnetwork WHERE uid = '" + puid + "' AND " +
"siteid = '" + siteid + "';").Rows)
{
Puid = puid;
Siteid = row[0].ToString();
SiteName = row[1].ToString();
Latitude = row[2].ToString();
Longitude = row[3].ToString();
HBA = row[4].ToString() + " m ";
Frequency = row[5].ToString();
Polarization = row[6].ToString();
RfPower = row[7].ToString().ToDouble();
AntennaType = row[8].ToString().ToLower();
Azimuth = row[9].ToString();
DownTilt = row[10].ToString();
AntennaModel = row[11].ToString();
AntennaGain = row[12].ToString().ToDouble();
FeederLoss = row[13].ToString().ToDouble();
Bandwidth = row[14].ToString().ToDouble() * 1000000; // unit hertz
Technology = row[15].ToString();
Height = row[16].ToString();
// dependent variables , calculated
PolarizationNumber =
Polarization.ToLower() == "vertical" ? "1" : "0";
// rfpower (W) + antennagain (dBi) - feederloss (dB) + recievergain (dBi)
EIRP = DbmToWatt(WattToDbm(RfPower) + AntennaGain - FeederLoss +
settings.Pl_ReceiverGain.ToDouble()).ToString();
double eirpdbW = WattToDbm(EIRP.ToDouble()) - 30;
double noisedbW = -174 + (10 * Math.Log10(Bandwidth)) - 30;
SnrFactor = (eirpdbW - noisedbW).ToString();
Location = new Coords(Longitude.ToDouble() * -1, Latitude.ToDouble());
}
}
public Site(
string puid,
string siteid,
Coords location)
{
Puid = puid;
Siteid = siteid;
Location = location;
SiteName = "";
Latitude = "";
Longitude = "";
HBA = "";
Frequency = "";
Polarization = "";
PolarizationNumber = "";
EIRP = "";
AntennaType = "";
AntennaModel = "";
AntennaGain = 0;
FeederLoss = 0;
RfPower = 0;
Azimuth = "";
DownTilt = "";
Bandwidth = 0;
SnrFactor = "";
Technology = "";
Height = "";
}
public Site(
string puid,
string siteid,
double x,
double y)
{
Puid = puid;
Siteid = siteid;
Location = new Coords(x, y);
SiteName = "";
Latitude = "";
Longitude = "";
HBA = "";
Frequency = "";
Polarization = "";
PolarizationNumber = "";
EIRP = "";
AntennaType = "";
AntennaModel = "";
AntennaGain = 0;
FeederLoss = 0;
RfPower = 0;
Azimuth = "";
DownTilt = "";
Bandwidth = 0;
SnrFactor = "";
Technology = "";
Height = "";
}
}
}
}

View File

@@ -0,0 +1,68 @@
using System;
namespace cnip.Models
{
public static class strext
{
public static int ToInt(this string value)
{
int parsedInt;
if (int.TryParse(value, out parsedInt))
{
return parsedInt;
}
return 0;
}
public static double ToDouble(this string value)
{
double parsedDouble;
if (double.TryParse(value, out parsedDouble))
{
return parsedDouble;
}
return 0.0;
}
public static String TrimEnd(this string value, int NumChar)
{
if (value.Length > NumChar)
{
return value.Substring(0, value.Length - NumChar);
}
return "";
}
public static String Left(this string input, int length)
{
var result = "";
if ((input.Length <= 0)) return result;
if ((length > input.Length))
{
length = input.Length;
}
result = input.Substring(0, length);
return result;
}
public static String Mid(this string input, int start, int length)
{
var result = "";
if (((input.Length <= 0) ||
(start >= input.Length))) return result;
if ((start + length > input.Length))
{
length = (input.Length - start);
}
result = input.Substring(start, length);
return result;
}
public static String Right(this string input, int length)
{
var result = "";
if ((input.Length <= 0)) return result;
if ((length > input.Length))
{
length = input.Length;
}
result = input.Substring((input.Length - length), length);
return result;
}
}
}

View File

@@ -0,0 +1,57 @@
using System.Web;
namespace cnip.Models
{
public class webext
{
public static string GetUserIP()
{
string ipList = string.Empty;
HttpContext context = HttpContext.Current;
if (context.Request.Headers["True-Client-IP"] != null)
{
ipList = context.Request.Headers["True-Client-IP"];
}
else if (context.Request.Headers["X-ClientSide"] != null)
{
ipList = context.Request.Headers["X-ClientSide"];
}
if (string.IsNullOrEmpty(ipList))
{
ipList = context.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
}
if (string.IsNullOrEmpty(ipList))
{
ipList = context.Request.ServerVariables["HTTP_CLIENT_IP"];
}
if (string.IsNullOrEmpty(ipList))
{
ipList = context.Request.ServerVariables["HTTP_X_FORWARDED"];
}
if (string.IsNullOrEmpty(ipList))
{
ipList = context.Request.ServerVariables["HTTP_X_CLUSTER_CLIENT_IP"];
}
if (string.IsNullOrEmpty(ipList))
{
ipList = context.Request.ServerVariables["HTTP_FORWARDED_FOR"];
}
if (string.IsNullOrEmpty(ipList))
{
ipList = context.Request.ServerVariables["HTTP_FORWARDED"];
}
if (string.IsNullOrEmpty(ipList))
{
ipList = context.Request.ServerVariables["HTTP_VIA"];
}
if (string.IsNullOrEmpty(ipList))
{
ipList = context.Request.UserHostAddress;
}
if (!string.IsNullOrEmpty(ipList))
{
return ipList.Split(',')[0];
}
return context.Request.ServerVariables["REMOTE_ADDR"];
}
}
}

View File

@@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("cnip")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HP Inc.")]
[assembly: AssemblyProduct("cnip")]
[assembly: AssemblyCopyright("Copyright © HP Inc. 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("aadcf23e-c85e-4bdf-b600-9c75aac4d402")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,41 @@
<?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>
<WebPublishMethod>MSDeploy</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish>
</SiteUrlToLaunchAfterPublish>
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<MSDeployServiceURL>localhost</MSDeployServiceURL>
<DeployIisAppPath>Default Web Site/cnip</DeployIisAppPath>
<RemoteSitePhysicalPath />
<SkipExtraFilesOnServer>True</SkipExtraFilesOnServer>
<MSDeployPublishMethod>InProc</MSDeployPublishMethod>
<EnableMSDeployBackup>False</EnableMSDeployBackup>
<UserName />
<_SavePWD>False</_SavePWD>
<PublishDatabaseSettings>
<Objects xmlns="">
<ObjectGroup Name="cnipdb" Order="1" Enabled="False">
<Destination Path="" />
<Object Type="DbDacFx">
<PreSource Path="Host=localhost;Database=cnip;Username=postgres;Password=root" includeData="False" />
<Source Path="$(IntermediateOutputPath)AutoScripts\cnipdb_IncrementalSchemaOnly.dacpac" dacpacAction="Deploy" />
</Object>
<UpdateFrom Type="Web.Config">
<Source MatchValue="Host=localhost;Database=cnip;Username=postgres;Password=root" MatchAttributes="$(UpdateFromConnectionStringAttributes)" />
</UpdateFrom>
</ObjectGroup>
</Objects>
</PublishDatabaseSettings>
</PropertyGroup>
<ItemGroup>
<MSDeployParameterValue Include="$(DeployParameterPrefix)cnipdb-Web.config Connection String" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,11 @@
<?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>

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,47 @@
/*
* DOM element rendering detection
* https://davidwalsh.name/detect-node-insertion
*/
@keyframes chartjs-render-animation {
from { opacity: 0.99; }
to { opacity: 1; }
}
.chartjs-render-monitor {
animation: chartjs-render-animation 0.001s;
}
/*
* DOM element resizing detection
* https://github.com/marcj/css-element-queries
*/
.chartjs-size-monitor,
.chartjs-size-monitor-expand,
.chartjs-size-monitor-shrink {
position: absolute;
direction: ltr;
left: 0;
top: 0;
right: 0;
bottom: 0;
overflow: hidden;
pointer-events: none;
visibility: hidden;
z-index: -1;
}
.chartjs-size-monitor-expand > div {
position: absolute;
width: 1000000px;
height: 1000000px;
left: 0;
top: 0;
}
.chartjs-size-monitor-shrink > div {
position: absolute;
width: 200%;
height: 200%;
left: 0;
top: 0;
}

16151
software/cnip/cnip/Scripts/Chart.js vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1 @@
@keyframes chartjs-render-animation{from{opacity:.99}to{opacity:1}}.chartjs-render-monitor{animation:chartjs-render-animation 1ms}.chartjs-size-monitor,.chartjs-size-monitor-expand,.chartjs-size-monitor-shrink{position:absolute;direction:ltr;left:0;top:0;right:0;bottom:0;overflow:hidden;pointer-events:none;visibility:hidden;z-index:-1}.chartjs-size-monitor-expand>div{position:absolute;width:1000000px;height:1000000px;left:0;top:0}.chartjs-size-monitor-shrink>div{position:absolute;width:200%;height:200%;left:0;top:0}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */
var saveAs=saveAs||function(e){"use strict";if(typeof e==="undefined"||typeof navigator!=="undefined"&&/MSIE [1-9]\./.test(navigator.userAgent)){return}var t=e.document,n=function(){return e.URL||e.webkitURL||e},r=t.createElementNS("http://www.w3.org/1999/xhtml","a"),o="download"in r,a=function(e){var t=new MouseEvent("click");e.dispatchEvent(t)},i=/constructor/i.test(e.HTMLElement)||e.safari,f=/CriOS\/[\d]+/.test(navigator.userAgent),u=function(t){(e.setImmediate||e.setTimeout)(function(){throw t},0)},s="application/octet-stream",d=1e3*40,c=function(e){var t=function(){if(typeof e==="string"){n().revokeObjectURL(e)}else{e.remove()}};setTimeout(t,d)},l=function(e,t,n){t=[].concat(t);var r=t.length;while(r--){var o=e["on"+t[r]];if(typeof o==="function"){try{o.call(e,n||e)}catch(a){u(a)}}}},p=function(e){if(/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)){return new Blob([String.fromCharCode(65279),e],{type:e.type})}return e},v=function(t,u,d){if(!d){t=p(t)}var v=this,w=t.type,m=w===s,y,h=function(){l(v,"writestart progress write writeend".split(" "))},S=function(){if((f||m&&i)&&e.FileReader){var r=new FileReader;r.onloadend=function(){var t=f?r.result:r.result.replace(/^data:[^;]*;/,"data:attachment/file;");var n=e.open(t,"_blank");if(!n)e.location.href=t;t=undefined;v.readyState=v.DONE;h()};r.readAsDataURL(t);v.readyState=v.INIT;return}if(!y){y=n().createObjectURL(t)}if(m){e.location.href=y}else{var o=e.open(y,"_blank");if(!o){e.location.href=y}}v.readyState=v.DONE;h();c(y)};v.readyState=v.INIT;if(o){y=n().createObjectURL(t);setTimeout(function(){r.href=y;r.download=u;a(r);h();c(y);v.readyState=v.DONE});return}S()},w=v.prototype,m=function(e,t,n){return new v(e,t||e.name||"download",n)};if(typeof navigator!=="undefined"&&navigator.msSaveOrOpenBlob){return function(e,t,n){t=t||e.name||"download";if(!n){e=p(e)}return navigator.msSaveOrOpenBlob(e,t)}}w.abort=function(){};w.readyState=w.INIT=0;w.WRITING=1;w.DONE=2;w.error=w.onwritestart=w.onprogress=w.onwrite=w.onabort=w.onerror=w.onwriteend=null;return m}(typeof self!=="undefined"&&self||typeof window!=="undefined"&&window||this.content);if(typeof module!=="undefined"&&module.exports){module.exports.saveAs=saveAs}else if(typeof define!=="undefined"&&define!==null&&define.amd!==null){define("FileSaver.js",function(){return saveAs})}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2377
software/cnip/cnip/Scripts/bootstrap.js vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,182 @@
// Account activation messages
if (pmsg === 'activate : account already activated' || pmsg === 'activate : account activated successfully') {
document.getElementById('th1').innerHTML = 'Your account has been activated successfully';
document.getElementById('sh1').innerHTML = 'You can now login to your account using your email address and password. Please click Login to login to your account.';
document.getElementById('th2').innerHTML = 'Activate 2-Step Verification?';
document.getElementById('sh2').innerHTML = '2-step Verification adds another layer of security to prevent unauthorized access to your account. Please click the Turn On 2-Step Verification? link to activate 2-Step Verification for your account.';
document.getElementById('btn').hidden = false;
document.getElementById('btn').value = 'Login';
document.getElementById('btnlnk').href = 'accui.aspx?uaction=login';
document.getElementById('g2steplnk').hidden = false;
}
if (pmsg === 'activate : error accessing server') {
document.getElementById('th1').innerHTML = 'Oops. Something went wrong. Please try again later';
document.getElementById('sh1').innerHTML = 'Please look for the verification email in your inbox and click the link in that email. A confirmation message will appear in your web browser.';
document.getElementById('th2').innerHTML = '';
document.getElementById('sh2').innerHTML = 'If you continue facing this issue, please send an email to us at opencellularcnip@gmail.com';
}
if (pmsg === 'activate : link expired') {
document.getElementById('th1').innerHTML = 'Oops. Link expired. Please try again later';
document.getElementById('sh1').innerHTML = 'Your account activation link has been expired. If your account is not activated you can reset your password to activate your account. Please click the Forgot your password? link to try resetting the password to activate your account.';
document.getElementById('th2').innerHTML = '';
document.getElementById('sh2').innerHTML = 'If you continue facing this issue, please send an email to us at opencellularcnip@gmail.com';
document.getElementById('forgotlnk').hidden = false;
}
// Reset password messages
if (pmsg === 'resetpassword : password changed successfully') {
document.getElementById('th1').innerHTML = 'Your password has been changed successfully';
document.getElementById('sh1').innerHTML = 'You can now login to your account using your email address and password. Please click Login to login to your account.';
document.getElementById('th2').innerHTML = '';
document.getElementById('sh2').innerHTML = '';
document.getElementById('btn').hidden = false;
document.getElementById('btn').value = 'Login';
document.getElementById('btnlnk').href = 'accui.aspx?uaction=login';
}
if (pmsg === 'resetpassword : error accessing server') {
document.getElementById('th1').innerHTML = 'Oops. Something went wrong. Please try again later';
document.getElementById('sh1').innerHTML = 'Please look for the reset password email in your inbox and click the link in that email. New password request form will appear in your web browser.';
document.getElementById('th2').innerHTML = '';
document.getElementById('sh2').innerHTML = 'If you continue facing this issue, please send an email to us at opencellularcnip@gmail.com';
}
if (pmsg === 'resetpassword : link expired') {
document.getElementById('th1').innerHTML = 'Oops. Link expired. Please try again later';
document.getElementById('sh1').innerHTML = 'Your password reset link has been expired. Please click the Forgot your password? link to try resetting your password.';
document.getElementById('th2').innerHTML = '';
document.getElementById('sh2').innerHTML = 'If you continue facing this issue, please send an email to us at opencellularcnip@gmail.com';
document.getElementById('forgotlnk').hidden = false;
}
// turn off 2-step verification messages
if (pmsg === 'turnoff2step : 2-Step Verification turned off') {
document.getElementById('th1').innerHTML = '2-Step Verification deactivated successfully';
document.getElementById('sh1').innerHTML = 'You can now login to your account using your email address and password. Please click Login to login to your account.';
document.getElementById('th2').innerHTML = 'Activate 2-Step Verification?';
document.getElementById('sh2').innerHTML = '2-step Verification adds another layer of security to prevent unauthorized access to your account. Please click the Turn On 2-Step Verification? link to activate 2-Step Verification for your account.';
document.getElementById('btn').hidden = false;
document.getElementById('btn').value = 'Login';
document.getElementById('btnlnk').href = 'accui.aspx?uaction=login';
document.getElementById('g2steplnk').hidden = false;
}
if (pmsg === 'turnoff2step : error accessing server') {
document.getElementById('th1').innerHTML = 'Oops. Something went wrong. Please try again later';
document.getElementById('sh1').innerHTML = 'Please look for the deactivate 2-Step Verification email in your inbox and click the link in that email. A confirmation message will appear in your web browser.';
document.getElementById('th2').innerHTML = '';
document.getElementById('sh2').innerHTML = 'If you continue facing this issue, please send an email to us at opencellularcnip@gmail.com';
}
if (pmsg === 'turnoff2step : link expired') {
document.getElementById('th1').innerHTML = 'Oops. Link expired. Please try again later';
document.getElementById('sh1').innerHTML = 'Your deactivate 2-Step Verification link has been expired. Please click the Turn Off 2-Step Verification? link to try deactivating 2-Step Verification for your account.';
document.getElementById('th2').innerHTML = '';
document.getElementById('sh2').innerHTML = 'If you continue facing this issue, please send an email to us at opencellularcnip@gmail.com';
document.getElementById('lostlnk').hidden = false;
}
// turn on 2-step verification messages
if (pmsg === 'turnon2stepact : email not registered or invalid password') {
document.getElementById('th1').innerHTML = 'Email address not registered or Invalid password';
document.getElementById('sh1').innerHTML = 'Make sure you entered the correct email address and password. Pease click Turn On 2-Step Verification? link to try activating 2-Step Verification for your account.';
document.getElementById('th2').innerHTML = 'Don\'t have an account or Forgot your password?';
document.getElementById('sh2').innerHTML = '1. Click Sign Up to create your free account.<br/>2. Click the Forgot your password? link if you don\'t remember your password.';
document.getElementById('btn').hidden = false;
document.getElementById('btn').value = 'Sign Up';
document.getElementById('btnlnk').href = 'accui.aspx?uaction=signup';
document.getElementById('forgotlnk').hidden = false;
document.getElementById('g2steplnk').hidden = false;
}
if (pmsg === 'turnon2stepact : 2-Step Verification already setup') {
document.getElementById('th1').innerHTML = '2-Step Verification is already activated for your account';
document.getElementById('sh1').innerHTML = 'In addition to your password, you\'ll also need a code generated by the Google Authenticator app on your device. Please click Login to login to your account.';
document.getElementById('th2').innerHTML = '';
document.getElementById('sh2').innerHTML = '';
document.getElementById('btn').hidden = false;
document.getElementById('btn').value = 'Login';
document.getElementById('btnlnk').href = 'accui.aspx?uaction=login';
}
if (pmsg === 'turnon2stepact : error accessing server' || pmsg === 'turnon2step : error accessing server') {
document.getElementById('th1').innerHTML = 'Oops. Something went wrong. Please try again later';
document.getElementById('sh1').innerHTML = '2-step Verification adds another layer of security to prevent unauthorized access to your account. Please click the Turn On 2-Step Verification? link to activate 2-Step Verification for your account.';
document.getElementById('th2').innerHTML = '';
document.getElementById('sh2').innerHTML = '';
document.getElementById('g2steplnk').hidden = false;
}
if (pmsg === 'turnon2step : 2-Step Verification turned on') {
document.getElementById('th1').innerHTML = '2-Step Verification has been activated for your account successfully';
document.getElementById('sh1').innerHTML = 'In addition to your password, you\'ll also need a code generated by the Google Authenticator app on your device. Please click Login to login to your account.';
document.getElementById('th2').innerHTML = '';
document.getElementById('sh2').innerHTML = '';
document.getElementById('btn').hidden = false;
document.getElementById('btn').value = 'Login';
document.getElementById('btnlnk').href = 'accui.aspx?uaction=login';
}
if (pmsg === 'turnon2step : link expired') {
document.getElementById('th1').innerHTML = 'Oops. Link expired. Please try again later';
document.getElementById('sh1').innerHTML = 'Your activate 2-Step Verification link has been expired. Please click the Turn On 2-Step Verification? link to try activating 2-Step Verification for your account.';
document.getElementById('th2').innerHTML = '';
document.getElementById('sh2').innerHTML = 'If you continue facing this issue, please send an email to us at opencellularcnip@gmail.com';
document.getElementById('btn').hidden = true;
document.getElementById('g2steplnk').hidden = false;
}
// login messages
if (pmsg === 'loginact : account suspended') {
document.getElementById('th1').innerHTML = 'Your account has been suspended';
document.getElementById('sh1').innerHTML = 'Your account may have been suspended due to multiple unsuccessful login attempts. This is an automated security feature and cannot be disabled.';
document.getElementById('sh2').innerHTML = 'Please click the Forgot your password? link to reset password and un-suspend your account.';
document.getElementById('forgotlnk').hidden = false;
}
if (pmsg === 'login : login successful') {
document.getElementById('th1').innerHTML = 'login successful';
}
if (pmsg === 'login : invalid passcode') {
document.getElementById('th1').innerHTML = 'You have entered an invalid passcode, please try again';
document.getElementById('sh1').innerHTML = 'Please click Login to try login to your account.';
document.getElementById('th2').innerHTML = 'Lost your 2-Step Verification device?';
document.getElementById('sh2').innerHTML = 'Please click the Turn Off 2-Step Verification? link to deactivate 2-Step Verification for your account.';
document.getElementById('btn').hidden = false;
document.getElementById('btn').value = 'Login';
document.getElementById('btnlnk').href = 'accui.aspx?uaction=login';
document.getElementById('lostlnk').hidden = false;
}
if (pmsg === 'login : invalid password') {
document.getElementById('th1').innerHTML = 'You have entered an invalid password, please try again';
document.getElementById('sh1').innerHTML = 'Please click Login to try login to your account.';
document.getElementById('th2').innerHTML = 'Lost your password?';
document.getElementById('sh2').innerHTML = 'Please click the Forgot your password? link to reset your password.';
document.getElementById('btn').hidden = false;
document.getElementById('btn').value = 'Login';
document.getElementById('btnlnk').href = 'accui.aspx?uaction=login';
document.getElementById('forgotlnk').hidden = false;
}
if (pmsg === 'login : link expired') {
document.getElementById('th1').innerHTML = 'Oops. Link expired. Please try again later';
document.getElementById('sh1').innerHTML = 'Your login link has been expired. Please click Login to try login to your account.';
document.getElementById('th2').innerHTML = '';
document.getElementById('sh2').innerHTML = 'If you continue facing this issue, please send an email to us at opencellularcnip@gmail.com';
document.getElementById('btn').hidden = false;
document.getElementById('btn').value = 'Login';
document.getElementById('btnlnk').href = 'accui.aspx?uaction=login';
}
if (pmsg === 'login : error accessing server' || pmsg === 'loginact : error accessing server') {
document.getElementById('th1').innerHTML = 'Oops. Something went wrong. Please try again later';
document.getElementById('sh1').innerHTML = 'Please click Login to try login to your account.';
document.getElementById('th2').innerHTML = '';
document.getElementById('sh2').innerHTML = 'If you continue facing this issue, please send an email to us at opencellularcnip@gmail.com';
document.getElementById('btn').hidden = false;
document.getElementById('btn').value = 'Login';
document.getElementById('btnlnk').href = 'accui.aspx?uaction=login';
}
if (pmsg === 'loginact : email not registered') {
document.getElementById('th1').innerHTML = 'Email address not registered';
document.getElementById('sh1').innerHTML = 'We didn\'t find any account associated with your email address. Please make sure you entered the correct email address. Please click Login to try login to your account.';
document.getElementById('btn').hidden = false;
document.getElementById('btn').value = 'Login';
document.getElementById('btnlnk').href = 'accui.aspx?uaction=login';
}
if (pmsg === 'loginact : account not active') {
document.getElementById('th1').innerHTML = 'Your account is not activated';
document.getElementById('sh1').innerHTML = 'Please look for the verification email in your inbox and click the link in that email. A confirmation message will appear in your web browser.';
document.getElementById('th2').innerHTML = 'Didn\'t get the email?';
document.getElementById('sh2').innerHTML = 'Check your spam folder to make sure it didn\'t end up there. You can also add the email address opencellularcnip@gmail.com to your address book and then try sending the email again.' +
'<br /><br />' +
'If you\'re still not able to find the email, please send an email to us at opencellularcnip@gmail.com';
}
if (pmsg === 'blank form submitted') {
document.getElementById('th1').innerHTML = 'Blank form submitted';
}

View File

@@ -0,0 +1,119 @@
if (pmsg === 'turnoff2step : account not active') {
document.getElementById('th1').innerHTML = 'Your account is not activated';
document.getElementById('sh1').innerHTML = 'Please look for the verification email in your inbox and click the link in that email. A confirmation message will appear in your web browser.';
document.getElementById('th2').innerHTML = 'Didn\'t get the email?';
document.getElementById('sh2').innerHTML = 'Check your spam folder to make sure it didn\'t end up there. You can also add the email address opencellularcnip@gmail.com to your address book and then try sending the email again.' +
'<br /><br />' +
'If you\'re still not able to find the email, please send an email to us at opencellularcnip@gmail.com';
}
if (pmsg === 'turnoff2step : 2-Step Verification not setup') {
document.getElementById('th1').innerHTML = '2-Step Verification is not activated for your account';
document.getElementById('sh1').innerHTML = '';
document.getElementById('th2').innerHTML = 'Activate 2-Step Verification?';
document.getElementById('sh2').innerHTML = '2-step Verification adds another layer of security to prevent unauthorized access to your account. Please click the Turn On 2-Step Verification? link to activate 2-Step Verification for your account.';
document.getElementById('g2steplnk').hidden = false;
}
if (pmsg === 'turnoff2step : turn off 2-Step Verification link sent') {
document.getElementById('th1').innerHTML = 'A link has been sent to your email address to deactivate 2-Step Verification for your account';
document.getElementById('sh1').innerHTML = 'Please look for the deactivate 2-Step Verification email in your inbox and click the link in that email. A confirmation message will appear in your web browser.';
document.getElementById('th2').innerHTML = 'Didn\'t get the email?';
document.getElementById('sh2').innerHTML = 'Check your spam folder to make sure it didn\'t end up there. You can also add the email address opencellularcnip@gmail.com to your address book and then try sending the email again.' +
'<br /><br />' +
'If you\'re still not receiving the email, please send an email to us at opencellularcnip@gmail.com';
}
if (pmsg === 'turnoff2step : error accessing server') {
document.getElementById('th1').innerHTML = 'Oops. Something went wrong. Please try again later';
document.getElementById('sh1').innerHTML = 'Please click the Turn Off 2-Step Verification? link to try deactivating 2-Step Verification for your account.';
document.getElementById('th2').innerHTML = '';
document.getElementById('sh2').innerHTML = 'If you continue facing this issue, please send an email to us at opencellularcnip@gmail.com';
document.getElementById('lostlnk').hidden = false;
}
if (pmsg === 'turnoff2step : failed to send email') {
document.getElementById('th1').innerHTML = 'Oops. Something went wrong. Please try again later';
document.getElementById('sh1').innerHTML = 'We are unable to send deactivate 2-Step Verification link to your email address at this time. Please click the Turn Off 2-Step Verification? link to try deactivating 2-Step Verification for your account.';
document.getElementById('th2').innerHTML = '';
document.getElementById('sh2').innerHTML = 'If you continue facing this issue, please send an email to us at opencellularcnip@gmail.com';
document.getElementById('lostlnk').hidden = false;
}
if (pmsg === 'turnoff2step : email not registered or invalid password') {
document.getElementById('th1').innerHTML = 'Email address not registered or Invalid password';
document.getElementById('sh1').innerHTML = 'Make sure you entered the correct email address and password. Pease click Turn Off 2-Step Verification? link to try deactivating 2-Step Verification for your account.';
document.getElementById('th2').innerHTML = 'Don\'t have an account or Forgot your password?';
document.getElementById('sh2').innerHTML = '1. Click Sign Up to create your free account.<br/>2. Click the Forgot your password? link if you don\'t remember your password.';
document.getElementById('btn').hidden = false;
document.getElementById('btn').value = 'Sign Up';
document.getElementById('btnlnk').href = 'accui.aspx?uaction=signup';
document.getElementById('forgotlnk').hidden = false;
document.getElementById('lostlnk').hidden = false;
}
if (pmsg === 'resetpassword : email not registered') {
document.getElementById('th1').innerHTML = 'Email address not registered';
document.getElementById('sh1').innerHTML = 'We didn\'t find any account associated with your email address. Please make sure you entered the correct email address. Please click the Forgot your password? link to try resetting your password.';
document.getElementById('th2').innerHTML = 'Don\'t have an account?';
document.getElementById('sh2').innerHTML = 'Please click Sign Up to create your free account.';
document.getElementById('btn').hidden = false;
document.getElementById('btn').value = 'Sign Up';
document.getElementById('btnlnk').href = 'accui.aspx?uaction=signup';
document.getElementById('forgotlnk').hidden = false;
}
if (pmsg === 'resetpassword : link sent') {
document.getElementById('th1').innerHTML = 'A reset password link has been sent to your email address';
document.getElementById('sh1').innerHTML = 'Please look for the reset password email in your inbox and click the link in that email. New password request form will appear in your web browser.';
document.getElementById('th2').innerHTML = 'Didn\'t get the email?';
document.getElementById('sh2').innerHTML = 'Check your spam folder to make sure it didn\'t end up there. You can also add the email address opencellularcnip@gmail.com to your address book and then try sending the email again.' +
'<br /><br />' +
'If you\'re still not receiving the email, please send an email to us at opencellularcnip@gmail.com';
}
if (pmsg === 'resetpassword : failed to send email') {
document.getElementById('th1').innerHTML = 'Oops. Something went wrong. Please try again later';
document.getElementById('sh1').innerHTML = 'We are unable to send reset password link to your email address at this time. Please click the Forgot your password? link to try resetting your password.';
document.getElementById('th2').innerHTML = '';
document.getElementById('sh2').innerHTML = 'If you continue facing this issue, please send an email to us at opencellularcnip@gmail.com';
document.getElementById('forgotlnk').hidden = false;
}
if (pmsg === 'resetpassword : error accessing server') {
document.getElementById('th1').innerHTML = 'Oops. Something went wrong. Please try again later';
document.getElementById('sh1').innerHTML = 'Please click the Forgot your password? link to try resetting your password.';
document.getElementById('th2').innerHTML = '';
document.getElementById('sh2').innerHTML = 'If you continue facing this issue, please send an email to us at opencellularcnip@gmail.com';
document.getElementById('forgotlnk').hidden = false;
}
if (pmsg === 'signup : email address already registered') {
document.getElementById('th1').innerHTML = 'Email address already in use';
document.getElementById('sh1').innerHTML = 'There\'s already an account associated with your email address, if you don\'t own that account, please send an email to us at opencellularcnip@gmail.com.';
document.getElementById('th2').innerHTML = 'To access your account:';
document.getElementById('sh2').innerHTML = '1. Click Login.<br/>2. Click the Forgot your password? link if you don\'t remember your password.';
document.getElementById('btn').hidden = false;
document.getElementById('btn').value = 'Login';
document.getElementById('btnlnk').href = 'accui.aspx?uaction=login';
document.getElementById('forgotlnk').hidden = false;
}
if (pmsg === 'signup : user created successfully') {
document.getElementById('th1').innerHTML = 'A verfication link has been sent to your email address';
document.getElementById('sh1').innerHTML = 'Please look for the verification email in your inbox and click the link in that email. A confirmation message will appear in your web browser.';
document.getElementById('th2').innerHTML = 'Didn\'t get the email?';
document.getElementById('sh2').innerHTML = 'Check your spam folder to make sure it didn\'t end up there. You can also add the email address opencellularcnip@gmail.com to your address book and then try sending the email again.' +
'<br /><br />' +
'If you\'re still not receiving the email, please send an email to us at opencellularcnip@gmail.com';
}
if (pmsg === 'signup : failed to send email') {
document.getElementById('th1').innerHTML = 'Oops. Something went wrong. Please try again later';
document.getElementById('sh1').innerHTML = 'We are unable to send verification link to your email address. Please make sure you typed the correct email address. Please click Sign Up to try creating your free account.';
document.getElementById('th2').innerHTML = '';
document.getElementById('sh2').innerHTML = 'If you continue facing this issue, please send an email to us at opencellularcnip@gmail.com';
document.getElementById('btn').hidden = false;
document.getElementById('btn').value = 'Sign Up';
document.getElementById('btnlnk').href = 'accui.aspx?uaction=signup';
}
if (pmsg === 'signup : error accessing server') {
document.getElementById('th1').innerHTML = 'Oops. Something went wrong. Please try again later';
document.getElementById('sh1').innerHTML = 'We are unable to successfully complete your registration at this time. Please click Sign Up to try creating your free account.';
document.getElementById('th2').innerHTML = '';
document.getElementById('sh2').innerHTML = 'If you continue facing this issue, please send an email to us at opencellularcnip@gmail.com';
document.getElementById('btn').hidden = false;
document.getElementById('btn').value = 'Sign Up';
document.getElementById('btnlnk').href = 'accui.aspx?uaction=signup';
}
if (pmsg === 'blank form submitted') {
document.getElementById('th1').innerHTML = 'Blank form submitted';
}

View File

@@ -0,0 +1,199 @@
if (puaction === 'login') {
document.title = 'cnip - Login';
document.getElementById('headl3').hidden = false;
document.getElementById('headl3').innerHTML = 'Sign In';
document.getElementById('pname').disabled = true;
document.getElementById('pcompany').disabled = true;
document.getElementById('pemaili').hidden = false;
document.getElementById('pemail').hidden = false;
document.getElementById('pemail').disabled = false;
document.getElementById('pemail').focus();
document.getElementById('pemail').select();
document.getElementById('ppassword').disabled = true;
document.getElementById('ppasscode').disabled = true;
document.getElementById('btnSubmit').value = 'Login';
document.getElementById('signuplnk').hidden = false;
document.getElementById('signupllnk').hidden = false;
document.getElementById('resetpasswordlnk').hidden = false;
document.getElementById('turnon2steplnk').hidden = false;
document.getElementById('turnoff2steplnk').hidden = false;
}
if (puaction === 'loginact') {
document.title = 'cnip - Login';
document.getElementById('headl3').hidden = false;
document.getElementById('headl3').innerHTML = 'Sign In';
document.getElementById('pname').disabled = true;
document.getElementById('pcompany').disabled = true;
document.getElementById('pemail').disabled = true;
document.getElementById('ppasswordi').hidden = false;
document.getElementById('ppassword').hidden = false;
document.getElementById('ppassword').disabled = false;
document.getElementById('ppassword').focus();
document.getElementById('ppassword').select();
g2stepen = p2stepen;
if (g2stepen === 'true') {
document.getElementById('ppasscodei').hidden = false;
document.getElementById('ppasscode').hidden = false;
document.getElementById('ppasscode').disabled = false;
}
else {
document.getElementById('ppasscode').disabled = true;
}
loginattempt = loginattempt;
document.getElementById('loginl').hidden = false;
document.getElementById('loginc').hidden = false;
document.getElementById('loginc').innerHTML = '<br/><br/>Login Attempt : ' + loginattempt;
document.getElementById('btnSubmit').value = 'Login';
document.getElementById('resetpasswordlnk').hidden = false;
document.getElementById('turnoff2steplnk').hidden = false;
}
if (puaction === 'signup') {
document.title = 'cnip - Sign Up';
document.getElementById('headl3').hidden = false;
document.getElementById('headl3').innerHTML = 'Sign Up';
document.getElementById('pnamei').hidden = false;
document.getElementById('pname').hidden = false;
document.getElementById('pname').disabled = false;
document.getElementById('pname').focus();
document.getElementById('pname').select();
document.getElementById('pcompanyi').hidden = false;
document.getElementById('pcompany').hidden = false;
document.getElementById('pcompany').disabled = false;
document.getElementById('pemaili').hidden = false;
document.getElementById('pemail').hidden = false;
document.getElementById('pemail').disabled = false;
document.getElementById('ppasswordi').hidden = false;
document.getElementById('ppassword').hidden = false;
document.getElementById('ppassword').disabled = false;
document.getElementById('ppasscode').disabled = true;
document.getElementById('btnSubmit').value = 'Submit';
document.getElementById('loginllnk').hidden = false;
document.getElementById('loginlnk').hidden = false;
}
if (puaction === 'resetpassword') {
document.title = 'cnip - Reset Password';
document.getElementById('headl5').hidden = false;
document.getElementById('headl5').innerHTML = 'Reset Password';
document.getElementById('pname').disabled = true;
document.getElementById('pcompany').disabled = true;
document.getElementById('pemaili').hidden = false;
document.getElementById('pemail').hidden = false;
document.getElementById('pemail').disabled = false;
document.getElementById('pemail').focus();
document.getElementById('pemail').select();
document.getElementById('ppassword').disabled = true;
document.getElementById('ppasscode').disabled = true;
document.getElementById('btnSubmit').value = 'Submit';
}
if (puaction === 'resetpasswordact') {
document.title = 'cnip - Reset Password';
document.getElementById('headl5').hidden = false;
document.getElementById('headl5').innerHTML = 'Reset Password';
document.getElementById('pname').disabled = true;
document.getElementById('pcompany').disabled = true;
document.getElementById('pemail').disabled = true;
document.getElementById('ppasswordi').hidden = false;
document.getElementById('ppassword').hidden = false;
document.getElementById('ppassword').disabled = false;
document.getElementById('ppassword').focus();
document.getElementById('ppassword').select();
document.getElementById('ppasscode').disabled = true;
document.getElementById('btnSubmit').value = 'Submit';
}
if (puaction === 'turnoff2step') {
document.title = 'cnip - Turn Off 2-Step Verification';
document.getElementById('headl5').hidden = false;
document.getElementById('headl5').innerHTML = 'Turn Off 2-Step Verification';
document.getElementById('pname').disabled = true;
document.getElementById('pcompany').disabled = true;
document.getElementById('pemaili').hidden = false;
document.getElementById('pemail').hidden = false;
document.getElementById('pemail').disabled = false;
document.getElementById('pemail').focus();
document.getElementById('pemail').select();
document.getElementById('ppasswordi').hidden = false;
document.getElementById('ppassword').hidden = false;
document.getElementById('ppassword').disabled = false;
document.getElementById('ppasscode').disabled = true;
document.getElementById('btnSubmit').value = 'Submit';
}
if (puaction === 'turnon2step') {
document.title = 'cnip - Turn On 2-Step Verification';
document.getElementById('headl5').hidden = false;
document.getElementById('headl5').innerHTML = 'Turn On 2-Step Verification';
document.getElementById('pname').disabled = true;
document.getElementById('pcompany').disabled = true;
document.getElementById('pemaili').hidden = false;
document.getElementById('pemail').hidden = false;
document.getElementById('pemail').disabled = false;
document.getElementById('pemail').focus();
document.getElementById('pemail').select();
document.getElementById('ppasswordi').hidden = false;
document.getElementById('ppassword').hidden = false;
document.getElementById('ppassword').disabled = false;
document.getElementById('ppasscode').disabled = true;
document.getElementById('btnSubmit').value = 'Submit';
document.getElementById('g2step2i').hidden = false;
document.getElementById('g2step2l').hidden = false;
}
if (puaction === 'turnon2stepact') {
document.title = 'cnip - Turn On 2-Step Verification';
document.getElementById('headl5').hidden = false;
document.getElementById('headl5').innerHTML = 'Turn On 2-Step Verification';
document.getElementById('pname').disabled = true;
document.getElementById('pcompany').disabled = true;
document.getElementById('pemail').disabled = true;
document.getElementById('ppassword').disabled = true;
document.getElementById('ppasscode').disabled = true;
document.getElementById('btnSubmit').value = 'Submit';
document.getElementById('g2stepi').hidden = false;
document.getElementById('g2stepl').hidden = false;
document.getElementById('barcodeimgi').hidden = false;
document.getElementById('barcodeimg').hidden = false;
document.getElementById('barcodeimg').src = barcode;
document.getElementById('setupcode').innerHTML = setupcode;
}
function doSubmit() {
let vpname = document.getElementById('pname').value;
let vpcompany = document.getElementById('pcompany').value;
let vpemail = document.getElementById('pemail').value;
let vppassword = document.getElementById('ppassword').value;
let vppasscode = document.getElementById('ppasscode').value;
vpemail = vpemail.toLowerCase();
if (puaction === 'signup') {
if (vpemail !== '' && vpname !== '' && vpcompany !== '' && vppassword !== '') {
window.open('../pages/accsrvrq.aspx?uaction=signup&name=' + vpname + '&company=' + vpcompany + '&email=' + vpemail + '&password=' + vppassword, '_self');
}
}
if (puaction === 'resetpassword') {
if (vpemail !== '') {
window.open('../pages/accsrvrq.aspx?uaction=resetpassword&email=' + vpemail, '_self');
}
}
if (puaction === 'turnoff2step') {
if (vpemail !== '' && vppassword !== '') {
window.open('../pages/accsrvrq.aspx?uaction=turnoff2step&email=' + vpemail + '&password=' + vppassword, '_self');
}
}
if (puaction === 'login') {
if (vpemail !== '') {
window.open('../pages/accui.aspx?uaction=loginact&email=' + vpemail, '_self');
}
}
if (puaction === 'turnon2step') {
if (vpemail !== '' && vppassword !== '') {
window.open('../pages/accui.aspx?uaction=turnon2stepact&email=' + vpemail + '&password=' + vppassword, '_self');
}
}
if (puaction === 'loginact') {
window.open('../pages/accsrv.aspx?uid=' + puid + '&ukey=' + pukey + '&password=' + vppassword + '&passcode=' + vppasscode + '&uaction=login', '_self');
}
if (puaction === 'resetpasswordact') {
if (vppassword !== '') {
window.open('../pages/accsrv.aspx?uid=' + puid + '&ukey=' + pukey + '&password=' + vppassword + '&uaction=resetpassword', '_self');
}
}
if (puaction === 'turnon2stepact') {
window.open('../pages/accsrv.aspx?uid=' + puid + '&ukey=' + pukey + '&uaction=turnon2step', '_self');
}
}

View File

@@ -0,0 +1,591 @@
// ************* active interaction function *****************
var activeInteraction = document.getElementById('activeInteraction');
activeInteraction.style.width = '22px';
activeInteraction.innerHTML = '<span><i class="fas fa-mouse-pointer"></i></span>';
activeInteraction.setAttribute('data-original-title', 'Active Tool - Measure Area');
activeInteraction.style.display = 'block';
// *****************************************************
function setActiveInteraction(e = null, interactionName, active) {
if (e) { e.stopPropagation(); }
highlightLayer.setStyle(highlightStyle);
if (actionRunning) {
selectPolygon.setActive(false);
drawPolygon.setActive(false);
modifyPolygon.setActive(false);
transformPolygon.setActive(false);
deletePolygonActive = false;
snapPolygon.setActive(false);
selectSite.setActive(false);
drawSite2G.setActive(false);
drawSite4G.setActive(false);
modifySite.setActive(false);
deleteSiteActive = false;
snapSite.setActive(false);
addLink.setActive(false);
selectLink.setActive(false);
drawLink.setActive(false);
deleteLinkActive = false;
snapLink.setActive(false);
selectNote.setActive(false);
drawNote.setActive(false);
modifyNote.setActive(false);
deleteNoteActive = false;
snapNote.setActive(false);
select.setActive(false);
measureLine.setActive(false);
measureArea.setActive(false);
activeInteraction.style.width = '22px';
activeInteraction.innerHTML = '';
activeInteraction.setAttribute('data-original-title', '');
activeInteraction.style.display = 'none';
return;
}
switch (interactionName) {
case 'drawPolygon':
selectPolygon.setActive(false);
drawPolygon.setActive(active);
modifyPolygon.setActive(false);
transformPolygon.setActive(false);
deletePolygonActive = false;
snapPolygon.setActive(false);
selectSite.setActive(false);
drawSite2G.setActive(false);
drawSite4G.setActive(false);
modifySite.setActive(false);
deleteSiteActive = false;
snapSite.setActive(false);
addLink.setActive(false);
selectLink.setActive(false);
drawLink.setActive(false);
deleteLinkActive = false;
snapLink.setActive(false);
selectNote.setActive(false);
drawNote.setActive(false);
modifyNote.setActive(false);
deleteNoteActive = false;
snapNote.setActive(false);
select.setActive(false);
measureLine.setActive(false);
measureArea.setActive(false);
activeInteraction.style.width = '55px';
activeInteraction.innerHTML = '<span><i class="fas fa-draw-polygon" style="color: rgb(127,58,183);"></i></span>&nbsp;-&nbsp;<span><i class="fas fa-edit"></i></span>';
activeInteraction.setAttribute('data-original-title', 'Active Tool - Draw Polygon');
activeInteraction.style.display = 'block';
break;
case 'modifyPolygon':
selectPolygon.setActive(active);
drawPolygon.setActive(false);
modifyPolygon.setActive(active);
transformPolygon.setActive(false);
deletePolygonActive = false;
snapPolygon.setActive(active);
selectSite.setActive(false);
drawSite2G.setActive(false);
drawSite4G.setActive(false);
modifySite.setActive(false);
deleteSiteActive = false;
snapSite.setActive(false);
selectLink.setActive(false);
addLink.setActive(false);
drawLink.setActive(false);
deleteLinkActive = false;
snapLink.setActive(false);
selectNote.setActive(false);
drawNote.setActive(false);
modifyNote.setActive(false);
deleteNoteActive = false;
snapNote.setActive(false);
select.setActive(false);
measureLine.setActive(false);
measureArea.setActive(false);
activeInteraction.style.width = '55px';
activeInteraction.innerHTML = '<span><i class="fas fa-draw-polygon" style="color: rgb(127,58,183);"></i></span>&nbsp;-&nbsp;<span><i class="fas fa-external-link-alt"></i></span>';
activeInteraction.setAttribute('data-original-title', 'Active Tool - Modify Polygon');
activeInteraction.style.display = 'block';
break;
case 'transformPolygon':
selectPolygon.setActive(active);
drawPolygon.setActive(false);
modifyPolygon.setActive(false);
transformPolygon.setActive(active);
deletePolygonActive = false;
snapPolygon.setActive(active);
selectSite.setActive(false);
drawSite2G.setActive(false);
drawSite4G.setActive(false);
modifySite.setActive(false);
deleteSiteActive = false;
snapSite.setActive(false);
addLink.setActive(false);
selectLink.setActive(false);
drawLink.setActive(false);
deleteLinkActive = false;
snapLink.setActive(false);
selectNote.setActive(false);
drawNote.setActive(false);
modifyNote.setActive(false);
deleteNoteActive = false;
snapNote.setActive(false);
select.setActive(false);
measureLine.setActive(false);
measureArea.setActive(false);
activeInteraction.style.width = '55px';
activeInteraction.innerHTML = '<span><i class="fas fa-draw-polygon" style="color: rgb(127,58,183);"></i></span>&nbsp;-&nbsp;<span><i class="fas fa-retweet"></i></span>';
activeInteraction.setAttribute('data-original-title', 'Active Tool - Transform Polygon');
activeInteraction.style.display = 'block';
break;
case 'deletePolygon':
highlightLayer.setStyle(deletePolygonStyle);
selectPolygon.setActive(active);
drawPolygon.setActive(false);
modifyPolygon.setActive(false);
transformPolygon.setActive(false);
deletePolygonActive = active;
snapPolygon.setActive(active);
selectSite.setActive(false);
drawSite2G.setActive(false);
drawSite4G.setActive(false);
modifySite.setActive(false);
deleteSiteActive = false;
snapSite.setActive(false);
addLink.setActive(false);
selectLink.setActive(false);
drawLink.setActive(false);
deleteLinkActive = false;
snapLink.setActive(false);
selectNote.setActive(false);
drawNote.setActive(false);
modifyNote.setActive(false);
deleteNoteActive = false;
snapNote.setActive(false);
select.setActive(false);
measureLine.setActive(false);
measureArea.setActive(false);
activeInteraction.style.width = '55px';
activeInteraction.innerHTML = '<span><i class="fas fa-draw-polygon" style="color: rgb(127,58,183);"></i></span>&nbsp;-&nbsp;<span><i class="fas fa-trash-alt"></i></span>';
activeInteraction.setAttribute('data-original-title', 'Active Tool - Delete Polygon');
activeInteraction.style.display = 'block';
break;
case 'drawLink':
highlightLayer.setStyle(drawLinkSiteStyle);
selectPolygon.setActive(false);
drawPolygon.setActive(false);
modifyPolygon.setActive(false);
transformPolygon.setActive(false);
deletePolygonActive = false;
snapPolygon.setActive(false);
selectSite.setActive(false);
drawSite2G.setActive(false);
drawSite4G.setActive(false);
modifySite.setActive(false);
deleteSiteActive = false;
snapSite.setActive(false);
addLink.setActive(active);
selectLink.setActive(false);
drawLink.setActive(false);
deleteLinkActive = false;
snapLink.setActive(false);
selectNote.setActive(false);
drawNote.setActive(false);
modifyNote.setActive(false);
deleteNoteActive = false;
snapNote.setActive(false);
select.setActive(false);
measureLine.setActive(false);
measureArea.setActive(false);
activeInteraction.style.width = '55px';
activeInteraction.innerHTML = '<span><i class="fas fa-link" style="color: rgb(127,58,183);"></i></span>&nbsp;-&nbsp;<span><i class="fas fa-edit"></i></span>';
activeInteraction.setAttribute('data-original-title', 'Active Tool - Draw Link');
activeInteraction.style.display = 'block';
break;
case 'deleteLink':
highlightLayer.setStyle(deleteLinkStyle);
selectPolygon.setActive(false);
drawPolygon.setActive(false);
modifyPolygon.setActive(false);
transformPolygon.setActive(false);
deletePolygonActive = false;
snapPolygon.setActive(false);
selectSite.setActive(false);
drawSite2G.setActive(false);
drawSite4G.setActive(false);
modifySite.setActive(false);
deleteSiteActive = false;
snapSite.setActive(false);
addLink.setActive(false);
selectLink.setActive(active);
drawLink.setActive(false);
deleteLinkActive = active;
snapLink.setActive(active);
selectNote.setActive(false);
drawNote.setActive(false);
modifyNote.setActive(false);
deleteNoteActive = false;
snapNote.setActive(false);
select.setActive(false);
measureLine.setActive(false);
measureArea.setActive(false);
activeInteraction.style.width = '55px';
activeInteraction.innerHTML = '<span><i class="fas fa-link" style="color: rgb(127,58,183);"></i></span>&nbsp;-&nbsp;<span><i class="fas fa-trash-alt"></i></span>';
activeInteraction.setAttribute('data-original-title', 'Active Tool - Delete Link');
activeInteraction.style.display = 'block';
break;
case 'drawSite2G':
selectPolygon.setActive(false);
drawPolygon.setActive(false);
modifyPolygon.setActive(false);
transformPolygon.setActive(false);
deletePolygonActive = false;
snapPolygon.setActive(false);
selectSite.setActive(false);
drawSite2G.setActive(active);
drawSite4G.setActive(false);
modifySite.setActive(false);
deleteSiteActive = false;
snapSite.setActive(false);
addLink.setActive(false);
selectLink.setActive(false);
drawLink.setActive(false);
deleteLinkActive = false;
snapLink.setActive(false);
selectNote.setActive(false);
drawNote.setActive(false);
modifyNote.setActive(false);
deleteNoteActive = false;
snapNote.setActive(false);
select.setActive(false);
measureLine.setActive(false);
measureArea.setActive(false);
activeInteraction.style.width = '55px';
activeInteraction.innerHTML = '<span><i class="fas fa-broadcast-tower" style="color: rgb(33,163,246);"></i></span>&nbsp;-&nbsp;<span><i class="fas fa-edit"></i></span>';
activeInteraction.setAttribute('data-original-title', 'Active Tool - Draw Site');
activeInteraction.style.display = 'block';
break;
case 'drawSite4G':
selectPolygon.setActive(false);
drawPolygon.setActive(false);
modifyPolygon.setActive(false);
transformPolygon.setActive(false);
deletePolygonActive = false;
snapPolygon.setActive(false);
selectSite.setActive(false);
drawSite2G.setActive(false);
drawSite4G.setActive(active);
modifySite.setActive(false);
deleteSiteActive = false;
snapSite.setActive(false);
addLink.setActive(false);
selectLink.setActive(false);
drawLink.setActive(false);
deleteLinkActive = false;
snapLink.setActive(false);
selectNote.setActive(false);
drawNote.setActive(false);
modifyNote.setActive(false);
deleteNoteActive = false;
snapNote.setActive(false);
select.setActive(false);
measureLine.setActive(false);
measureArea.setActive(false);
activeInteraction.style.width = '55px';
activeInteraction.innerHTML = '<span><i class="fas fa-broadcast-tower" style="color: rgb(33,163,246);"></i></span>&nbsp;-&nbsp;<span><i class="fas fa-edit" style="color:rgb(255,106,0);"></i></span>';
activeInteraction.setAttribute('data-original-title', 'Active Tool - Draw Site');
activeInteraction.style.display = 'block';
break;
case 'modifySite':
selectPolygon.setActive(false);
drawPolygon.setActive(false);
modifyPolygon.setActive(false);
transformPolygon.setActive(false);
deletePolygonActive = false;
snapPolygon.setActive(false);
selectSite.setActive(active);
drawSite2G.setActive(false);
drawSite4G.setActive(false);
modifySite.setActive(active);
deleteSiteActive = false;
snapSite.setActive(active);
addLink.setActive(false);
selectLink.setActive(false);
drawLink.setActive(false);
deleteLinkActive = false;
snapLink.setActive(false);
selectNote.setActive(false);
drawNote.setActive(false);
modifyNote.setActive(false);
deleteNoteActive = false;
snapNote.setActive(false);
select.setActive(false);
measureLine.setActive(false);
measureArea.setActive(false);
activeInteraction.style.width = '55px';
activeInteraction.innerHTML = '<span><i class="fas fa-broadcast-tower" style="color: rgb(33,163,246);"></i></span>&nbsp;-&nbsp;<span><i class="fas fa-external-link-alt"></i></span>';
activeInteraction.setAttribute('data-original-title', 'Active Tool - Modify Site');
activeInteraction.style.display = 'block';
break;
case 'deleteSite':
highlightLayer.setStyle(deleteSiteStyle);
selectPolygon.setActive(false);
drawPolygon.setActive(false);
modifyPolygon.setActive(false);
transformPolygon.setActive(false);
deletePolygonActive = false;
snapPolygon.setActive(false);
selectSite.setActive(active);
drawSite2G.setActive(false);
drawSite4G.setActive(false);
modifySite.setActive(false);
deleteSiteActive = active;
snapSite.setActive(active);
addLink.setActive(false);
selectLink.setActive(false);
drawLink.setActive(false);
deleteLinkActive = false;
snapLink.setActive(false);
selectNote.setActive(false);
drawNote.setActive(false);
modifyNote.setActive(false);
deleteNoteActive = false;
snapNote.setActive(false);
select.setActive(false);
measureLine.setActive(false);
measureArea.setActive(false);
activeInteraction.style.width = '55px';
activeInteraction.innerHTML = '<span><i class="fas fa-broadcast-tower" style="color: rgb(33,163,246);"></i></span>&nbsp;-&nbsp;<span><i class="fas fa-trash-alt"></i></span>';
activeInteraction.setAttribute('data-original-title', 'Active Tool - Delete Site');
activeInteraction.style.display = 'block';
break;
case 'drawNote':
selectPolygon.setActive(false);
drawPolygon.setActive(false);
modifyPolygon.setActive(false);
transformPolygon.setActive(false);
deletePolygonActive = false;
snapPolygon.setActive(false);
selectSite.setActive(false);
drawSite2G.setActive(false);
drawSite4G.setActive(false);
modifySite.setActive(false);
deleteSiteActive = false;
snapSite.setActive(false);
addLink.setActive(false);
selectLink.setActive(false);
drawLink.setActive(false);
deleteLinkActive = false;
snapLink.setActive(false);
selectNote.setActive(false);
drawNote.setActive(active);
modifyNote.setActive(false);
deleteNoteActive = false;
snapNote.setActive(false);
select.setActive(false);
measureLine.setActive(false);
measureArea.setActive(false);
activeInteraction.style.width = '55px';
activeInteraction.innerHTML = '<span><i class="fas fa-flag" style="color: rgb(33,163,246);"></i></span>&nbsp;-&nbsp;<span><i class="fas fa-edit"></i></span>';
activeInteraction.setAttribute('data-original-title', 'Active Tool - Draw Note');
activeInteraction.style.display = 'block';
break;
case 'modifyNote':
selectPolygon.setActive(false);
drawPolygon.setActive(false);
modifyPolygon.setActive(false);
transformPolygon.setActive(false);
deletePolygonActive = false;
snapPolygon.setActive(false);
selectSite.setActive(false);
drawSite2G.setActive(false);
drawSite4G.setActive(false);
modifySite.setActive(false);
deleteSiteActive = false;
snapSite.setActive(false);
addLink.setActive(false);
selectLink.setActive(false);
drawLink.setActive(false);
deleteLinkActive = false;
snapLink.setActive(false);
selectNote.setActive(active);
drawNote.setActive(false);
modifyNote.setActive(active);
deleteNoteActive = false;
snapNote.setActive(active);
select.setActive(false);
measureLine.setActive(false);
measureArea.setActive(false);
activeInteraction.style.width = '55px';
activeInteraction.innerHTML = '<span><i class="fas fa-flag" style="color: rgb(33,163,246);"></i></span>&nbsp;-&nbsp;<span><i class="fas fa-external-link-alt"></i></span>';
activeInteraction.setAttribute('data-original-title', 'Active Tool - Modify Note');
activeInteraction.style.display = 'block';
break;
case 'deleteNote':
highlightLayer.setStyle(deleteNoteStyle);
selectPolygon.setActive(false);
drawPolygon.setActive(false);
modifyPolygon.setActive(false);
transformPolygon.setActive(false);
deletePolygonActive = false;
snapPolygon.setActive(false);
selectSite.setActive(false);
drawSite2G.setActive(false);
drawSite4G.setActive(false);
modifySite.setActive(false);
deleteSiteActive = false;
snapSite.setActive(false);
addLink.setActive(false);
selectLink.setActive(false);
drawLink.setActive(false);
deleteLinkActive = false;
snapLink.setActive(false);
selectNote.setActive(active);
drawNote.setActive(false);
modifyNote.setActive(false);
deleteNoteActive = active;
snapNote.setActive(active);
select.setActive(false);
measureLine.setActive(false);
measureArea.setActive(false);
activeInteraction.style.width = '55px';
activeInteraction.innerHTML = '<span><i class="fas fa-flag" style="color: rgb(33,163,246);"></i></span>&nbsp;-&nbsp;<span><i class="fas fa-trash-alt"></i></span>';
activeInteraction.setAttribute('data-original-title', 'Active Tool - Delete Note');
activeInteraction.style.display = 'block';
break;
case 'toggleSelect':
selectPolygon.setActive(false);
drawPolygon.setActive(false);
modifyPolygon.setActive(false);
transformPolygon.setActive(false);
deletePolygonActive = false;
snapPolygon.setActive(false);
selectSite.setActive(false);
drawSite2G.setActive(false);
drawSite4G.setActive(false);
modifySite.setActive(false);
deleteSiteActive = false;
snapSite.setActive(false);
addLink.setActive(false);
selectLink.setActive(false);
drawLink.setActive(false);
deleteLinkActive = false;
snapLink.setActive(false);
selectNote.setActive(false);
drawNote.setActive(false);
modifyNote.setActive(false);
deleteNoteActive = false;
snapNote.setActive(false);
select.setActive(active);
measureLine.setActive(false);
measureArea.setActive(false);
if (active) {
activeInteraction.style.width = '22px';
activeInteraction.innerHTML = '<span><i class="fas fa-mouse-pointer"></i></span>';
activeInteraction.setAttribute('data-original-title', 'Active Tool - Select');
activeInteraction.style.display = 'block';
} else {
activeInteraction.style.width = '22px';
activeInteraction.innerHTML = '';
activeInteraction.setAttribute('data-original-title', '');
activeInteraction.style.display = 'none';
}
break;
case 'toggleMeasureLine':
selectPolygon.setActive(false);
drawPolygon.setActive(false);
modifyPolygon.setActive(false);
transformPolygon.setActive(false);
deletePolygonActive = false;
snapPolygon.setActive(false);
selectSite.setActive(false);
drawSite2G.setActive(false);
drawSite4G.setActive(false);
modifySite.setActive(false);
deleteSiteActive = false;
snapSite.setActive(false);
addLink.setActive(false);
selectLink.setActive(false);
drawLink.setActive(false);
deleteLinkActive = false;
snapLink.setActive(false);
selectNote.setActive(false);
drawNote.setActive(false);
modifyNote.setActive(false);
deleteNoteActive = false;
snapNote.setActive(false);
select.setActive(false);
measureLine.setActive(!measureLine.getActive());
measureArea.setActive(false);
if (measureLine.getActive()) {
activeInteraction.style.width = '22px';
activeInteraction.innerHTML = '<span><i class="fas fa-ruler"></i></span>';
activeInteraction.setAttribute('data-original-title', 'Active Tool - Measure Line');
activeInteraction.style.display = 'block';
} else {
activeInteraction.style.width = '22px';
activeInteraction.innerHTML = '';
activeInteraction.setAttribute('data-original-title', '');
activeInteraction.style.display = 'none';
}
break;
case 'toggleMeasureArea':
selectPolygon.setActive(false);
drawPolygon.setActive(false);
modifyPolygon.setActive(false);
transformPolygon.setActive(false);
deletePolygonActive = false;
snapPolygon.setActive(false);
selectSite.setActive(false);
drawSite2G.setActive(false);
drawSite4G.setActive(false);
modifySite.setActive(false);
deleteSiteActive = false;
snapSite.setActive(false);
addLink.setActive(false);
selectLink.setActive(false);
drawLink.setActive(false);
deleteLinkActive = false;
snapLink.setActive(false);
selectNote.setActive(false);
drawNote.setActive(false);
modifyNote.setActive(false);
deleteNoteActive = false;
snapNote.setActive(false);
select.setActive(false);
measureLine.setActive(false);
measureArea.setActive(!measureArea.getActive());
if (measureArea.getActive()) {
activeInteraction.style.width = '22px';
activeInteraction.innerHTML = '<span><i class="fas fa-ruler-combined"></i></span>';
activeInteraction.setAttribute('data-original-title', 'Active Tool - Measure Area');
activeInteraction.style.display = 'block';
} else {
activeInteraction.style.width = '22px';
activeInteraction.innerHTML = '';
activeInteraction.setAttribute('data-original-title', '');
activeInteraction.style.display = 'none';
}
break;
}
clearInteractions();
}
function clearInteractions() {
select.getFeatures().clear();
selectPolygon.getFeatures().clear();
selectSite.getFeatures().clear();
selectLink.getFeatures().clear();
selectNote.getFeatures().clear();
addLink.getFeatures().clear(); pointCount = 0; siteASelected = undefined;
transformPolygon.getFeatures().clear();
transformPolygon.setActive(!transformPolygon.getActive());
transformPolygon.setActive(!transformPolygon.getActive());
highlightLayer.getSource().clear();
highlightFeature = undefined;
featureInfo.innerHTML = '';
featureInfo.style.opacity = 0;
noteInfo.innerHTML = '';
noteInfo.style.opacity = 0;
//featureTip.attr('data-original-title', '').tooltip('hide');
}
function toggleSelect() {
setActiveInteraction(null, 'toggleSelect', true);
setActiveInteraction(null, 'toggleSelect', true);
}

View File

@@ -0,0 +1,96 @@
//// context menu *********************************
//var contextmenu_items = [
// {
// text: 'Center map here',
// classname: 'bold',
// icon: '../img/center.png',
// callback: center
// },
// //{
// // text: 'Some Actions',
// // icon: '../img/view_list.png',
// // items: [
// // {
// // text: 'Center map here',
// // icon: '../img/center.png',
// // callback: center
// // },
// // {
// // text: 'Add Site',
// // icon: '../img/site2G.png',
// // callback: marker
// // }
// // ]
// //},
// , '-',
// {
// text: 'Add Site',
// icon: '../img/site2G.png',
// callback: marker
// },
// //'-' // this is a separator
//];
//var propertiesItem = {
// text: 'Site Options',
// icon: '../img/options.png',
// callback: showsiteOptions
//};
//var removeMarkerItem = {
// text: 'Delete Site',
// icon: '../img/delete.png',
// callback: removeMarker
//};
//var contextmenu = new ContextMenu({
// width: 180,
// items: contextmenu_items
//});
//myMap.addControl(contextmenu);
//contextmenu.on('open', function (evt) {
// var feature = myMap.forEachFeatureAtPixel(evt.pixel, function (ft, l) {
// return ft;
// });
// if (feature /*&& feature.get('type') === 'removable'*/) {
// contextmenu.clear();
// propertiesItem.data = {
// marker: feature
// };
// contextmenu.push(propertiesItem);
// contextmenu.push('-');
// removeMarkerItem.data = {
// marker: feature
// };
// contextmenu.push(removeMarkerItem);
// } else {
// contextmenu.clear();
// contextmenu.extend(contextmenu_items);
// //contextmenu.extend(contextmenu.getDefaultItems());
// }
//});
//function showsiteOptions(obj) {
// var siteid = obj.data.marker.get('siteid');
// document.getElementById('siteOptions').style.display = 'block';
// document.getElementById('siteOptionsFrame').contentWindow.showsite(siteid);
//}
//function center(obj) {
// let view = myMap.getView();
// view.animate({
// duration: 700,
// center: obj.coordinate
// });
//}
//function removeMarker(obj) {
// var siteid = obj.data.marker.get('siteid');
// deleteSite(siteid);
// createmynetwork();
// myNetworkLayer.getSource().clear();
// document.getElementById('siteOptionsFrame').contentWindow.refreshsitedata();
//}
//function marker(obj) {
// var coord4326 = ol.proj.transform(obj.coordinate, 'EPSG:3857', 'EPSG:4326');
// var longitude = ol.coordinate.format(coord4326, '{x}', 6);
// var latitude = ol.coordinate.format(coord4326, '{y}', 6);
// AddNewSite(longitude, latitude);
// createmynetwork();
// myNetworkLayer.getSource().clear();
// document.getElementById('siteOptionsFrame').contentWindow.refreshsitedata();
//}

View File

@@ -0,0 +1,145 @@
var mainControlBar = new ol.control.Bar();
myMap.addControl(mainControlBar);
var nestedControlBar = new ol.control.Bar({ toggleOne: true, group: true });
mainControlBar.addControl(nestedControlBar);
var selectControl = new ol.control.Toggle(
{
html: '<i class="fas fa-mouse-pointer"></i>',
className: 'select',
title: 'Select',
interaction: select,
active: true,
onToggle: function (active) {
setActiveInteraction(null,'toggleSelect', active);
}
});
nestedControlBar.addControl(selectControl);
var measureLineControl = new ol.control.Toggle(
{
html: '<i class="fas fa-ruler"></i>',
className: 'draw',
title: 'Measure Line',
active: false,
onToggle: function (active) {
setActiveInteraction(null,'toggleMeasureLine', active);
}
});
nestedControlBar.addControl(measureLineControl);
var measureAreaControl = new ol.control.Toggle(
{
html: '<i class="fas fa-ruler-combined"></i>',
className: 'draw',
title: 'Measure Area',
active: false,
onToggle: function (active) {
setActiveInteraction(null,'toggleMeasureArea', active);
}
});
nestedControlBar.addControl(measureAreaControl);
var downloadPngControl = new ol.control.Button(
{
html: '<i class="fa fa-download"></i>',
className: 'download',
title: 'Download PNG',
handleClick: function () {
if (actionRunning) { return; }
myMap.once('postrender', function (event) {
hideAllDialogs();
showProgress('Exporting PNG');
setTimeout(function () {
closeProgress();
if (browser === 'edge') {
html2canvas(myMap.getTargetElement(), { ignoreElements: ignoreElements }).then(function (canvas) {
let base64image = canvas.toDataURL("image/png");
let block = base64image.split(";");
let mimeType = block[0].split(":")[1];
let realData = block[1].split(",")[1];
let canvasBlob = b64toBlob(realData, mimeType);
saveAs(canvasBlob, "map.png");
});
}
else {
domtoimage.toBlob(myMap.getTargetElement(), { filter: selectElements })
.then(function (blob) {
saveAs(blob, 'map.png');
});
}
unHideAllDialogs();
}, 500);
});
myMap.render();
}
});
function selectElements(element) {
return (element.className ? element.className.indexOf('ol-control') === -1 : true)
&& element.id !== 'activeInteraction';
}
function ignoreElements(element) {
return (element.className ? element.className.indexOf('ol-control') !== -1 : false)
|| element.id === 'activeInteraction';
}
function b64toBlob(b64Data, contentType, sliceSize) {
contentType = contentType || '';
sliceSize = sliceSize || 512;
let byteCharacters = atob(b64Data);
let byteArrays = [];
for (let offset = 0; offset < byteCharacters.length; offset += sliceSize) {
let slice = byteCharacters.slice(offset, offset + sliceSize);
let byteNumbers = new Array(slice.length);
for (let i = 0; i < slice.length; i++) {
byteNumbers[i] = slice.charCodeAt(i);
}
let byteArray = new Uint8Array(byteNumbers);
byteArrays.push(byteArray);
}
let blob = new Blob(byteArrays, { type: contentType });
return blob;
}
mainControlBar.addControl(downloadPngControl);
var myLocationControl = new ol.control.Button(
{
html: '<i class="fas fa-map-marker-alt"></i>',
className: 'mylocation',
title: 'My Location',
handleClick: function () {
if (actionRunning) { return; }
//let geolocation = new ol.Geolocation();
//geolocation.setTracking(true);
//geolocation.on('change', function () {
// myMap.getView().animate({
// duration: 700,
// center: ol.proj.fromLonLat(geolocation.getPosition())
// });
// geolocation.setTracking(false);
//});
navigator.geolocation.getCurrentPosition(function (pos) {
myMap.getView().animate({
duration: 700,
center: ol.proj.fromLonLat([pos.coords.longitude, pos.coords.latitude])
});
}, function (error) {
}, {
enableHighAccuracy: true,
timeout: 5000,
maximumAge: 0
});
}
});
mainControlBar.addControl(myLocationControl);
myLocationControl.button_.click();
var fullscreenControl = new ol.control.FullScreen({
source: 'fullscreen'
});
mainControlBar.addControl(fullscreenControl);
var searchGpsControl = new ol.control.SearchGPS({
});
myMap.addControl(searchGpsControl);
searchGpsControl.button.title = 'Search GPS';
searchGpsControl.on('select', function (event) {
if (actionRunning) { return; }
myMap.getView().animate({
center: event.search.coordinate,
zoom: Math.max(myMap.getView().getZoom(), 5)
});
});

View File

@@ -0,0 +1,308 @@
var ddsCount = 0;
var ddsContentData = [];
var ddsContentExtension = [];
var ddsContentChart = [];
var ddsContentChartPngString = [];
function ddsCreate(title, loadObj) {
let dsDiv = document.createElement('div');
let dsTable = document.createElement('table');
let dsTBody = document.createElement('tbody');
let dsTr = document.createElement('tr');
let dsTd1 = document.createElement('td');
let dsTitleDiv = document.createElement('div');
dsTd1.appendChild(dsTitleDiv);
let dsTd21 = document.createElement('td');
let dsMinDiv = document.createElement('div');
let dsMinButton = document.createElement('button');
let dsMinButtonI = document.createElement('i');
dsMinButton.appendChild(dsMinButtonI);
dsMinDiv.appendChild(dsMinButton);
dsTd21.appendChild(dsMinDiv);
let dsTd22 = document.createElement('td');
let dsMaxDiv = document.createElement('div');
let dsMaxButton = document.createElement('button');
let dsMaxButtonI = document.createElement('i');
dsMaxButton.appendChild(dsMaxButtonI);
dsMaxDiv.appendChild(dsMaxButton);
dsTd22.appendChild(dsMaxDiv);
let dsTd2 = document.createElement('td');
let dsCloseDiv = document.createElement('div');
let dsCloseButton = document.createElement('button');
let dsCloseButtonI = document.createElement('i');
dsCloseButton.appendChild(dsCloseButtonI);
dsCloseDiv.appendChild(dsCloseButton);
dsTd2.appendChild(dsCloseDiv);
dsTr.appendChild(dsTd1);
dsTr.appendChild(dsTd21);
dsTr.appendChild(dsTd22);
dsTr.appendChild(dsTd2);
dsTBody.appendChild(dsTr);
dsTable.appendChild(dsTBody);
dsDiv.appendChild(dsTable);
let dsBodyDiv = document.createElement('div');
let dsBodyTabLinkDiv = document.createElement('div');
let dsBodyTabContentDiv = document.createElement('div');
let dsBodyTabLinks = [];
let dsBodyTabContents = [];
for (let i = 0; i < loadObj.length; i++) {
dsBodyTabLinks.push(document.createElement('button'));
dsBodyTabContents.push(document.createElement('div'));
dsBodyTabLinkDiv.appendChild(dsBodyTabLinks[i]);
dsBodyTabContentDiv.appendChild(dsBodyTabContents[i]);
}
dsBodyTopButton = document.createElement('button');
let dsBodyTopButtonI = document.createElement('i');
dsBodyTopButton.appendChild(dsBodyTopButtonI);
dsBodyTabLinkDiv.appendChild(dsBodyTopButton);
dsBodyTabLinkDiv.appendChild(document.createElement('hr'));
dsBodyDiv.appendChild(dsBodyTabLinkDiv);
dsBodyDiv.appendChild(dsBodyTabContentDiv);
dsDiv.appendChild(dsBodyDiv);
document.getElementById('myMap').insertBefore(dsDiv, document.getElementsByClassName('ol-viewport')[0]);
dsDiv.id = 'dds' + ddsCount.toString();
dsDiv.className = 'datasheet panel panel-primary draggable';
dsDiv.style.display = 'block';
dsDiv.onclick = function (e) {
setDialogZIndex(e, this.value);
};
dsDiv.value = dsDiv.id;
dsTable.style.width = '100%';
dsTd1.style.width = '94%';
dsTd21.style.width = '2%';
dsTd22.style.width = '2%';
dsTd2.style.width = '2%';
dsTitleDiv.id = 'ch' + dsDiv.id + 'Title';
dsTitleDiv.className = 'panel-heading draggable-handler';
dsTitleDiv.innerHTML = '&nbsp;&nbsp;&nbsp;' + title + '...';
dsMinDiv.className = 'panel-action';
dsMinButton.className = 'panel-action-button';
dsMinButton.title = 'Minimize';
dsMinButtonI.className = 'fas fa-window-minimize';
dsMinButton.onclick = function (e) {
minimizeDialog(e, 'dds' + this.value.toString());
};
dsMinButton.value = ddsCount;
dsMaxDiv.className = 'panel-action';
dsMaxButton.className = 'panel-action-button';
dsMaxButton.title = 'Restore';
dsMaxButtonI.className = 'fas fa-window-restore';
dsMaxButton.onclick = function (e) {
restoreDialog(e, 'dds' + this.value.toString());
};
dsMaxButton.value = ddsCount;
dsCloseDiv.className = 'panel-action';
dsCloseButton.className = 'panel-action-button';
dsCloseButton.title = 'Close';
dsCloseButtonI.className = 'fas fa-window-close';
dsCloseButton.onclick = function (e) {
if (e) { e.stopPropagation(); }
ddsDestroy(this.value);
};
dsCloseButton.value = ddsCount;
dsBodyDiv.className = 'panel-body';
dsBodyDiv.style.width = (Number(dsDiv.style.width.replace('px')) - 6).toString() + 'px';
dsBodyDiv.style.height = (Number(dsDiv.style.height.replace('px')) - 37).toString() + 'px';
dsBodyTabLinkDiv.style.overflow = 'hidden';
dsBodyTabContentDiv.style.overflow = 'auto';
dsBodyTabContentDiv.style.height = (360 - (Math.ceil(loadObj.length / 5) - 1) * 27.14).toString() + 'px';
dsBodyTopButtonI.className = 'fas fa-file-csv'; //fas fa-chart-line
dsBodyTopButtonI.id = 'ch' + dsDiv.id + 'TopButton'; //fas fa-chart-line
dsBodyTopButton.className = 'pageTopButton';
dsBodyTopButton.title = 'Download Content';
dsBodyTopButton.onclick = function (e) {
if (e) { e.stopPropagation(); }
ddsDownloadActiveContent(this.value);
};
dsBodyTopButton.value = ddsCount;
ddsContentData.push([ddsCount]);
ddsContentExtension.push([ddsCount]);
ddsContentChart.push([ddsCount]);
ddsContentChartPngString.push([ddsCount]);
for (let i = 0; i < loadObj.length; i++) {
dsBodyTabLinks[i].className = 'pageTabLink';
dsBodyTabLinks[i].onclick = function (e) {
if (e) { e.stopPropagation(); }
ddsOpenPage(this.value, this.index, this);
};
dsBodyTabLinks[i].value = ddsCount;
dsBodyTabLinks[i].index = i;
dsBodyTabLinks[i].id = 'ch' + dsDiv.id + 'TabLink' + i.toString();
dsBodyTabLinks[i].style.display = 'block';
dsBodyTabLinks[i].innerHTML = loadObj[i].title;
dsBodyTabLinks[i].style.fontSize = '12px';
dsBodyTabContents[i].className = 'pageTabContent';
dsBodyTabContents[i].id = 'ch' + dsDiv.id + 'TabContent' + i.toString();
dsBodyTabContents[i].style.padding = loadObj[i].contentPadding;
dsBodyTabContents[i].style.fontSize = '12px';
ddsContentData[ddsCount][i] = '';
ddsContentExtension[ddsCount][i] = '';
ddsContentChart[ddsCount][i] = '';
ddsContentChartPngString[ddsCount][i] = '';
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');
dsBodyTabContents[i].appendChild(contentTitleDiv);
chDiv.appendChild(chCanvas);
dsBodyTabContents[i].appendChild(chDiv);
contentTitleDiv.style.textAlign = 'center';
contentTitleDiv.style.color =
loadObj[i].contentTitle.includes('Passed') ? 'green' :
loadObj[i].contentTitle.includes('Failed') ? 'red' : 'blue';
contentTitleDiv.innerHTML = loadObj[i].contentTitle;
chCanvas.id = 'ch' + dsDiv.id + 'Chart' + i.toString();
chCanvas.width = '570';
chCanvas.height = '342'; // should be 60% of width
chCanvas.style.msUserSelect = 'none';
chCanvas.style.userSelect = 'none';
chCanvas.style.webkitUserSelect = 'none';
let xDataset = [];
let dataString = loadObj[i].dataString; //rate&value&r,g,b
dataString.split('$').forEach(function (d) {
xDataset.push({
Label: d.split('&')[0],
Data: d.split('&')[1],
BackgroundColor: getColorFromLabel(d.split('&')[2], true),
BorderColor: getColorFromLabel(d.split('&')[2], false)
});
});
let chartData = {
labels: xDataset.map(d => d.Label),
datasets: [
{
type: 'bar',
label: loadObj[i].title,
data: xDataset.map(d => d.Data),
backgroundColor: xDataset.map(d => d.BackgroundColor),
borderColor: xDataset.map(d => d.BorderColor)
}]
};
let chartContext = document.getElementById(chCanvas.id).getContext('2d');
ddsContentChart[ddsCount][i] = new Chart(chartContext, {
type: 'bar',
data: chartData,
options: {
animation: {
duration: 0
},
responsive: false,
tooltips: {
enabled: true,
mode: 'index',
intersect: false,
position: 'average'
},
legend: {
display: false
},
scales: {
xAxes: [{
gridLines: {
drawOnChartArea: false
}
}],
yAxes: [{
gridLines: {
drawOnChartArea: false
},
scaleLabel: {
display: true,
labelString: '% Polygon Area Covered'
}
}]
}
}
});
} else {
dsBodyTabContents[i].contentType = 'table';
dsBodyTabContents[i].innerHTML = loadObj[i].contentHTML;
ddsContentData[ddsCount][i] = loadObj[i].contentData;
ddsContentExtension[ddsCount][i] = loadObj[i].contentExtension;
}
}
if (dsBodyTabLinks[0]) { dsBodyTabLinks[0].click(); }
setDialogZIndex(null, dsDiv.id);
ddsCount += 1;
// set draggable
setDraggable();
}
function ddsOpenPage(ddsId, tabContentId, tabLink) {
$('button[id^="chdds' + ddsId.toString() + 'TabLink"]').css({ 'background-color': '', 'color': '' });
$('div[id^="chdds' + ddsId.toString() + 'TabContent"]').css('display', 'none');
$('#chdds' + ddsId.toString() + 'TabContent' + tabContentId.toString()).css('display', 'block');
if (document.getElementById('chdds' + ddsId.toString() + 'TabContent' + tabContentId.toString()).contentType === 'chart') {
document.getElementById('chdds' + ddsId.toString() + 'TopButton').className = 'fas fa-chart-line';
if (ddsContentChartPngString[ddsId][tabContentId] !== '') {
loadRaster(ddsContentChartPngString[ddsId][tabContentId]);
}
} else {
document.getElementById('chdds' + ddsId.toString() + 'TopButton').className = 'fas fa-file-csv';
}
tabLink.style.backgroundColor = '#555';
tabLink.style.color = 'white';
}
function ddsDestroyAll() {
for (let i = 0; i < ddsCount; i++) {
for (let j = 0; j < $('div[id^="chdds' + i.toString() + 'TabContent"]').length; j++) {
if (ddsContentChart[i][j].hasOwnProperty('destroy')) { ddsContentChart[i][j].destroy; }
}
}
for (let i = 0; i < ddsCount; i++) {
let dds = document.getElementById('dds' + i.toString());
if (dds) {
while (dds.firstChild) {
dds.firstChild.remove();
}
document.getElementById('myMap').removeChild(dds);
}
}
ddsCount = 0; ddsContentChart = [];
ddsContentData = []; ddsContentExtension = [];
}
function ddsDestroy(ddsId) {
for (let j = 0; j < $('div[id^="chdds' + ddsId.toString() + 'TabContent"]').length; j++) {
if (ddsContentChart[ddsId][j].hasOwnProperty('destroy')) { ddsContentChart[i][j].destroy; }
ddsContentChart[ddsId][j] = '';
ddsContentData[ddsId][j] = '';
ddsContentExtension[ddsId][j] = '';
}
let dds = document.getElementById('dds' + ddsId.toString());
if (dds) {
while (dds.firstChild) {
dds.firstChild.remove();
}
document.getElementById('myMap').removeChild(dds);
}
}
function ddsDownloadActiveContent(ddsId) {
let tabContent = $('div[id^="chdds' + ddsId.toString() + 'TabContent"]');
for (i = 0; i < tabContent.length; i++) {
if (tabContent[i].style.display === 'block') {
if (tabContent[i].contentType === 'chart') {
let base64image = document.getElementById('chdds' + ddsId.toString() + 'Chart' + i.toString()).toDataURL("image/png");
let block = base64image.split(";");
let mimeType = block[0].split(":")[1];
let realData = block[1].split(",")[1];
let canvasBlob = b64toBlob(realData, mimeType);
saveAs(canvasBlob, "chart.png");
} else {
let blob = new Blob([ddsContentData[ddsId][i]], { type: "text/plain;charset=utf-8" });
saveAs(blob, $('#chdds' + ddsId.toString() + 'TabLink' + i.toString()).html() +
ddsContentExtension[ddsId][i]);
}
}
}
}
function getColorFromLabel(label, background) {
let color = 'rgba(0,0,0,0)';
let rgb = label.split(',');
color = 'rgba('
+ rgb[0] + ','
+ rgb[1] + ','
+ rgb[2] + ','
+ (background ? '0.8' : '1')
+ ')';
return color;
}

View File

@@ -0,0 +1,140 @@
function _minimizeDialog(e) {
e.style.left = 'calc(80vw)';
e.style.top = 'calc(80vh)';
e.style.width = '220px';
e.style.height = '37px';
e.style.overflow = 'hidden';
}
function minimizeDialog(e = null, dialogId) {
if (e) { e.stopPropagation(); }
let dds = document.getElementById(dialogId);
_minimizeDialog(dds);
}
function restoreDialog(e = null, dialogId, width = '651px', height = '432px') {
if (e) { e.stopPropagation(); }
let dds = document.getElementById(dialogId);
dds.style.left = 'calc(50vw - (' + width + ' / 2))';
dds.style.top = 'calc(50vh - (' + height + ' / 2))';
dds.style.width = width;
dds.style.height = height;
dds.style.overflow = 'auto';
}
function hideAllDialogs() {
closePredictBestCan();
closePredictSites();
closePredict();
[...document.getElementsByClassName('draggable')].forEach(function (e) {
if (e.id !== 'progressBar' && e.id !== 'messageBoxBar') {
e.style.display = 'none';
}
});
}
function unHideAllDialogs() {
[...document.getElementsByClassName('draggable')].forEach(function (e) {
if (e.id !== 'progressBar' && e.id !== 'messageBoxBar') {
switch (e.id) {
case 'siteOptions':
if (document.getElementById('siteOptionsFrame').contentWindow.userDisplay) { e.style.display = 'block'; } break;
case 'polyOptions':
if (document.getElementById('polyOptionsFrame').contentWindow.userDisplay) { e.style.display = 'block'; } break;
case 'noteOptions':
if (document.getElementById('noteOptionsFrame').contentWindow.userDisplay) { e.style.display = 'block'; } break;
case 'linkOptions':
if (document.getElementById('linkOptionsFrame').contentWindow.userDisplay) { e.style.display = 'block'; } break;
case 'linkProfile':
if (document.getElementById('linkProfileFrame').contentWindow.userDisplay) { e.style.display = 'block'; } break;
default:
e.style.display = 'block'; break;
}
}
});
}
function minimizeAllDialogs() {
closePredictBestCan();
closePredictSites();
closePredict();
[...document.getElementsByClassName('draggable')].forEach(function (e) {
if (e.id !== 'progressBar' && e.id !== 'messageBoxBar') {
switch (e.id) {
case 'siteOptions':
if (document.getElementById('siteOptionsFrame').contentWindow.userDisplay) { _minimizeDialog(e); } break;
case 'polyOptions':
if (document.getElementById('polyOptionsFrame').contentWindow.userDisplay) { _minimizeDialog(e); } break;
case 'noteOptions':
if (document.getElementById('noteOptionsFrame').contentWindow.userDisplay) { _minimizeDialog(e); } break;
case 'linkOptions':
if (document.getElementById('linkOptionsFrame').contentWindow.userDisplay) { _minimizeDialog(e); } break;
case 'linkProfile':
if (document.getElementById('linkProfileFrame').contentWindow.userDisplay) { _minimizeDialog(e); } break;
default:
_minimizeDialog(e); break;
}
}
});
}
function closeAllDialogs() {
document.getElementById('siteOptions').style.display = 'none';
document.getElementById('polyOptions').style.display = 'none';
document.getElementById('noteOptions').style.display = 'none';
document.getElementById('linkOptions').style.display = 'none';
document.getElementById('linkProfile').style.display = 'none';
closePredictBestCan();
closePredictSites();
closePredict();
ddsDestroyAll();
}
function setDialogZIndex(e = null, dialogId) {
if (document.getElementById(dialogId)) {
if (document.getElementById(dialogId).style.zIndex !== '199') {
if (e) { e.stopPropagation(); }
[...document.getElementsByClassName('draggable')].forEach(function (e) { e.style.zIndex = '99'; });
document.getElementById(dialogId).style.zIndex = 199;
}
}
}
function showProgress(msg) {
actionRunning = true;
document.getElementById('progressBar').style.display = 'block';
setDialogZIndex(null, 'progressBar');
document.getElementById('progressTitle').innerHTML = '&nbsp;&nbsp;&nbsp;' + msg + '...';
document.body.style.cursor = 'wait';
}
function closeProgress() {
sleep(1000);
document.getElementById('progressBar').style.display = 'none';
document.getElementById('progressBar').style.zIndex = 99;
document.body.style.cursor = 'default';
actionRunning = false;
}
// message box setup
document.getElementById("yesMessageBox").addEventListener("click", function () {
document.querySelector(".page-enabler").classList.add("hidden-content");
document.querySelector(".page-disabler").classList.add("hidden-content");
document.getElementById("main").removeEventListener("focus", function (e) { e.preventDefault(); });
document.getElementById('messageBoxBar').style.zIndex = 99;
});
document.getElementById("okcancelMessageBox").addEventListener("click", function () {
document.querySelector(".page-enabler").classList.add("hidden-content");
document.querySelector(".page-disabler").classList.add("hidden-content");
document.getElementById("main").removeEventListener("focus", function (e) { e.preventDefault(); });
document.getElementById('messageBoxBar').style.zIndex = 99;
});
function showMessage(title, msg, request=false) {
setDialogZIndex(null, 'messageBoxBar');
if (request) {
document.getElementById("yesMessageBox").style.display = 'block';
document.getElementById("okcancelMessageBox").innerHTML = 'No';
} else {
document.getElementById("yesMessageBox").style.display = 'none';
document.getElementById("okcancelMessageBox").innerHTML = 'Ok';
}
document.getElementById('messageBoxBar').style.left = 'calc(50vw - 403px / 2)';
document.getElementById('messageBoxBar').style.top = 'calc(50vh - 203px / 2)';
document.getElementById('messageBoxBar').style.width = '403px';
document.getElementById('messageBoxBar').style.height = '203px';
document.getElementById('messageBoxTitle').innerHTML = '&nbsp;&nbsp;&nbsp;' + title + '...';
document.getElementById('messageBoxContent').innerHTML = '<br />&nbsp;&nbsp;&nbsp;' + msg;
document.querySelector(".page-enabler").classList.remove("hidden-content");
document.querySelector(".page-disabler").classList.remove("hidden-content");
document.getElementById("main").addEventListener("focus", function (e) { e.preventDefault(); });
}

View File

@@ -0,0 +1,161 @@
/* global variables*/
var userDisplay = false;
var linkData;
var siteAData;
var siteBData;
var linksCount;
var currLink;
/* 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');
initSingleSlider(document.getElementById('outputpowera'), '', '27', '47', '0.5', '30');
initSingleSlider(document.getElementById('antennagaina'), '', '19', '51', '0.1', '34');
initSingleSlider(document.getElementById('lossesa'), '', '0', '51', '0.1', '0');
initSingleSlider(document.getElementById('frequencyb'), '', '1', '15', '0.1', '5');
initSelectOpt(document.getElementById('channelwidthb'), '100%', '10\t20\t30\t40\t50\t60\t80\t100', '20');
initSingleSlider(document.getElementById('outputpowerb'), '', '27', '47', '0.5', '30');
initSingleSlider(document.getElementById('antennagainb'), '', '19', '51', '0.1', '34');
initSingleSlider(document.getElementById('lossesb'), '', '0', '51', '0.1', '0');
/* setup listeners*/
document.getElementById('defaultOpen').click();
document.getElementById('linkname').addEventListener('change', linkNameChange);
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('frequencyb').addEventListener('change', saveLinkData);
document.getElementById('channelwidthb').addEventListener('change', saveLinkData);
document.getElementById('outputpowerb').addEventListener('change', saveLinkData);
document.getElementById('antennagainb').addEventListener('change', saveLinkData);
document.getElementById('lossesb').addEventListener('change', saveLinkData);
/* linkoptions functions*/
function linkNameChange(e) {
document.getElementById('linkname').value = fixStringName(document.getElementById('linkname').value);
saveLinkData(e);
}
function fillLinkData(linkData) {
document.getElementById('linkid').value = linkData[0].toString();
document.getElementById('linkname').value = linkData[1] === undefined ? '' : linkData[1].toString();
document.getElementById('linkname1').value = linkData[1] === undefined ? '' : linkData[1].toString();
document.getElementById('linktype').value = linkData[2] === undefined ? '' : linkData[2].toString();
let linktype = linkData[2] === undefined ? '' : linkData[2].toString();
if (linktype === 'public') {
document.getElementById('sitebtd1').innerText = 'Site B (Public)';
document.getElementById('sitebtd2').innerText = 'Site B (Public)';
document.getElementById('user').hidden = false;
document.getElementById('userhr').hidden = false;
document.getElementById('name').hidden = false;
document.getElementById('email').hidden = false;
document.getElementById('spanname').hidden = false;
document.getElementById('spanemail').hidden = false;
} else {
document.getElementById('sitebtd1').innerText = 'Site B';
document.getElementById('sitebtd2').innerText = 'Site B';
document.getElementById('user').hidden = true;
document.getElementById('userhr').hidden = true;
document.getElementById('name').hidden = true;
document.getElementById('email').hidden = true;
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('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();
}
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.getLinkDataByIdx(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[21] === undefined ? '' : linkData[21].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());
}
function nextLink(e) {
if (e) { e.stopPropagation(); }
if (Number(linksCount) - 1 > Number(currLink)) {
refreshLinkData('', (Number(currLink) + 1).toString());
}
}
function previousLink(e) {
if (e) { e.stopPropagation(); }
if (Number(currLink) > 0) {
refreshLinkData('', (Number(currLink) - 1).toString());
}
}
function saveLinkData(e) {
if (e) { e.stopPropagation(); }
window.parent.updateLinkDataByIdx({
idx: currLink,
linkname: document.getElementById('linkname').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,
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('linkProfileFrame').contentWindow.refreshLinkData('cursor');
refreshLinkData('cursor');
}
function deleteLink(e) {
if (e) { e.stopPropagation(); }
window.parent.deleteLinkByIdx(currLink);
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);
}

View File

@@ -0,0 +1,369 @@
/* 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

@@ -0,0 +1,86 @@
/* global variables*/
var userDisplay = false;
var noteData;
var notesCount;
var currNote;
/* setup listeners*/
$('#description').keypress(function (event) {
if (event.keyCode === 13) {
event.preventDefault();
}
});
document.getElementById('defaultOpen').click();
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);
function noteNameChange(e) {
document.getElementById('notename').value = fixStringName(document.getElementById('notename').value);
saveNoteData(e);
}
function descriptionChange(e) {
document.getElementById('description').value = fixStringName(document.getElementById('description').value);
saveNoteData(e);
}
/* noteoptions functions*/
function fillNoteData(noteData) {
document.getElementById('noteid').value = noteData[0].toString();
document.getElementById('notename').value = noteData[1] === undefined ? '' : noteData[1].toString();
document.getElementById('notetype').setOpt(noteData[2] === undefined ? '' : noteData[2].toString());
document.getElementById('description').value = noteData[3] === undefined ? '' : noteData[3].toString();
}
function refreshNoteData(refreshType, Idx = null) {
let currNoteId = noteData === undefined ? 0 : noteData[0].toString();
noteData = undefined; notesCount = '0';
notesCount = window.parent.getNotesCount();
if (Idx !== null) { currNote = Idx.toString(); }
else {
if (refreshType === 'start') { currNote = '0'; }
else if (refreshType === 'add') {
currNote = (Number(notesCount) - 1).toString();
}
else if (refreshType === 'cursor') {
currNote = window.parent.getNoteIdxById(currNoteId).toString();
}
else if (refreshType === 'delete') /*delete*/ {
if (Number(currNote) > Number(notesCount) - 1) {
currNote = (Number(notesCount) - 1).toString();
}
}
}
noteData = window.parent.getNoteDataByIdx(currNote).split('\t');
fillNoteData(noteData);
}
function refreshNoteDataById(noteid) {
refreshNoteData('', window.parent.getNoteIdxById(noteid).toString());
}
function nextNote(e) {
if (e) { e.stopPropagation(); }
if (Number(notesCount) - 1 > Number(currNote)) {
refreshNoteData('', (Number(currNote) + 1).toString());
}
}
function previousNote(e) {
if (e) { e.stopPropagation(); }
if (Number(currNote) > 0) {
refreshNoteData('', (Number(currNote) - 1).toString());
}
}
function saveNoteData(e) {
if (e) { e.stopPropagation(); }
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);
refreshNoteData('cursor');
}
function deleteNote(e) {
if (e) { e.stopPropagation(); }
window.parent.deleteNoteByIdx(currNote);
refreshNoteData('delete');
}
function zoomToNote(e) {
if (e) { e.stopPropagation(); }
window.parent.document.getElementById('noteOptions').style.display = 'none';
window.parent.zoomToNoteByIdx(currNote);
}

View File

@@ -0,0 +1,70 @@
/* 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

@@ -0,0 +1,199 @@
function showPredict(e, predict) {
if (e) { e.stopPropagation(); }
if (!document.getElementById('pcDiv')) {
let pcDiv = document.createElement('div');
let pcTable = document.createElement('table');
let pcTBody = document.createElement('tbody');
let pcTr = document.createElement('tr');
let pcTd1 = document.createElement('td');
let pcTitleDiv = document.createElement('div');
pcTd1.appendChild(pcTitleDiv);
let pcTd2 = document.createElement('td');
let pcCloseDiv = document.createElement('div');
let pcCloseButton = document.createElement('button');
let pcCloseButtonI = document.createElement('i');
pcCloseButton.appendChild(pcCloseButtonI);
pcCloseDiv.appendChild(pcCloseButton);
pcTd2.appendChild(pcCloseDiv);
pcTr.appendChild(pcTd1);
pcTr.appendChild(pcTd2);
pcTBody.appendChild(pcTr);
pcTable.appendChild(pcTBody);
pcDiv.appendChild(pcTable);
let pcBodyDiv = document.createElement('div');
pcBodyDiv.appendChild(document.createTextNode('Select Sites'));
let pcContainer = document.createElement('div');
//
let pcList1Div = document.createElement('div');
let pcList1 = document.createElement('select');
let sites = myNetworkLayer.getSource().getFeatures();
pcList1Option = [];
for (let i = 0; i < sites.length; i++) {
pcList1Option.push(document.createElement('option'));
pcList1.appendChild(pcList1Option[i]);
}
pcList1Div.appendChild(document.createTextNode('Available Sites'));
pcList1Div.appendChild(pcList1);
pcContainer.appendChild(pcList1Div);
let pcTransferDiv = document.createElement('div');
let buttonRight = document.createElement('button');
let buttonLeft = document.createElement('button');
pcTransferDiv.appendChild(buttonRight);
pcTransferDiv.appendChild(document.createElement('br'));
pcTransferDiv.appendChild(document.createElement('br'));
pcTransferDiv.appendChild(buttonLeft);
pcContainer.appendChild(pcTransferDiv);
let pcList2 = document.createElement('select');
let pcList2Div = document.createElement('div');
pcList2Div.appendChild(document.createTextNode('Selected Sites'));
pcList2Div.appendChild(pcList2);
pcContainer.appendChild(pcList2Div);
pcBodyDiv.appendChild(pcContainer);
pcButtonRun = document.createElement('button');
pcBodyDiv.appendChild(pcButtonRun);
pcButtonCancel = document.createElement('button');
pcBodyDiv.appendChild(pcButtonCancel);
pcDiv.appendChild(pcBodyDiv);
document.getElementById('myMap').insertBefore(pcDiv,
document.getElementsByClassName('ol-viewport')[0]);
pcDiv.id = 'pcDiv';
pcDiv.className = 'predictBestCan panel panel-primary draggable';
pcDiv.style.display = 'block';
pcDiv.onclick = function (e) {
if (e) { e.stopPropagation(); }
setDialogZIndex(e, 'pcDiv');
};
pcTable.style.width = '100%';
pcTd1.style.width = '98%';
pcTd2.style.width = '2%';
pcTitleDiv.id = pcDiv.id + 'Title';
pcTitleDiv.className = 'panel-heading draggable-handler';
if (predict === 'Coverage') {
pcTitleDiv.innerHTML = '&nbsp;&nbsp;&nbsp;Predict Coverage Options...';
}
if (predict === 'RadioPlan') {
pcTitleDiv.innerHTML = '&nbsp;&nbsp;&nbsp;Predict Radio Plan Options...';
}
if (predict === 'Links') {
pcTitleDiv.innerHTML = '&nbsp;&nbsp;&nbsp;Predict Links Options...';
}
pcCloseDiv.className = 'panel-action';
pcCloseButton.className = 'panel-action-button';
pcCloseButton.title = 'Close';
pcCloseButtonI.className = 'fas fa-window-close';
pcCloseButton.onclick = function (e) {
if (e) { e.stopPropagation(); }
closePredict();
};
pcDiv.style.height = '243px';
pcBodyDiv.className = 'panel-body';
pcBodyDiv.style.width =
(Number(pcDiv.style.width.replace('px')) - 6).toString() + 'px';
pcBodyDiv.style.height =
(Number(pcDiv.style.height.replace('px')) - 37).toString() + 'px';
pcBodyDiv.style.padding = '15px 10px';
pcBodyDiv.style.color = 'var(--fontcolor)';
pcBodyDiv.style.fontSize = '12px';
pcButtonRun.className = 'btn btn-default';
pcButtonRun.style.position = 'absolute';
pcButtonRun.style.right = '10px';
pcButtonRun.style.bottom = '10px';
pcButtonRun.title = 'Run';
pcButtonRun.innerHTML = 'Run';
pcButtonRun.onclick = function (e) {
if (e) { e.stopPropagation(); }
var testSites = [];
testSites = $('#lstBox2pc option').map(function () {
return $(this).val();
}).get();
if (testSites) {
if (testSites.length > 50) {
testSites = testSites.slice(0, 50);
}
}
closePredict();
if (testSites.length > 0) {
if (predict === 'Coverage') {
predictCoverage(testSites);
}
if (predict === 'RadioPlan') {
predictRadioPlan(testSites);
}
if (predict === 'Links') {
predictLinks(testSites);
}
}
};
pcButtonCancel.className = 'btn btn-default';
pcButtonCancel.style.position = 'absolute';
pcButtonCancel.style.right = '70px';
pcButtonCancel.style.bottom = '10px';
pcButtonCancel.title = 'Cancel';
pcButtonCancel.innerHTML = 'Cancel';
pcButtonCancel.onclick = function (e) {
if (e) { e.stopPropagation(); }
closePredict();
};
pcContainer.className = 'transferContainer';
pcList1.className = 'listBox';
pcList1.id = 'lstBox1pc';
pcList1.multiple = 'multiple';
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;
}
pcTransferDiv.className = 'transferButtons';
buttonRight.id = 'btnRightpc';
buttonRight.innerHTML = ' > ';
buttonRight.value = ' > ';
buttonRight.type = 'button';
buttonLeft.id = 'btnLeftpc';
buttonLeft.innerHTML = ' < ';
buttonLeft.value = ' < ';
buttonLeft.type = 'button';
buttonRight.className = 'btn btn-default';
buttonLeft.className = 'btn btn-default';
// set draggable
$(document).ready(function () {
$('#btnRightpc').click(function (e) {
let selectedOpts = $('#lstBox1pc option:selected');
if (selectedOpts.length === 0) {
e.preventDefault();
}
$('#lstBox2pc').append($(selectedOpts).clone());
$(selectedOpts).remove();
e.preventDefault();
});
$('#btnLeftpc').click(function (e) {
let selectedOpts = $('#lstBox2pc option:selected');
if (selectedOpts.length === 0) {
e.preventDefault();
}
$('#lstBox1pc').append($(selectedOpts).clone());
$(selectedOpts).remove();
e.preventDefault();
});
});
setDraggable();
setDialogZIndex(null, pcDiv.id);
}
}
function closePredict() {
let pcd = document.getElementById('pcDiv');
if (pcd) {
while (pcd.firstChild) {
pcd.firstChild.remove();
}
document.getElementById('myMap').removeChild(pcd);
}
}

View File

@@ -0,0 +1,203 @@
function showPredictBestCan(e) {
if (e) { e.stopPropagation(); }
if (!document.getElementById('pbcDiv')) {
let bcDiv = document.createElement('div');
let bcTable = document.createElement('table');
let bcTBody = document.createElement('tbody');
let bcTr = document.createElement('tr');
let bcTd1 = document.createElement('td');
let bcTitleDiv = document.createElement('div');
bcTd1.appendChild(bcTitleDiv);
let bcTd2 = document.createElement('td');
let bcCloseDiv = document.createElement('div');
let bcCloseButton = document.createElement('button');
let bcCloseButtonI = document.createElement('i');
bcCloseButton.appendChild(bcCloseButtonI);
bcCloseDiv.appendChild(bcCloseButton);
bcTd2.appendChild(bcCloseDiv);
bcTr.appendChild(bcTd1);
bcTr.appendChild(bcTd2);
bcTBody.appendChild(bcTr);
bcTable.appendChild(bcTBody);
bcDiv.appendChild(bcTable);
let bcBodyDiv = document.createElement('div');
let bcPolygonDiv = document.createElement('div');
bcBodyDiv.appendChild(document.createTextNode('Select Polygon'));
bcBodyDiv.appendChild(bcPolygonDiv);
bcBodyDiv.appendChild(document.createTextNode('Select Candidate Sites'));
let bcContainer = document.createElement('div');
//
let bcList1Div = document.createElement('div');
let bcList1 = document.createElement('select');
let sites = myNetworkLayer.getSource().getFeatures();
bcList1Option = [];
for (let i = 0; i < sites.length; i++) {
bcList1Option.push(document.createElement('option'));
bcList1.appendChild(bcList1Option[i]);
}
bcList1Div.appendChild(document.createTextNode('Available Sites'));
bcList1Div.appendChild(bcList1);
bcContainer.appendChild(bcList1Div);
let bcTransferDiv = document.createElement('div');
let buttonRight = document.createElement('button');
let buttonLeft = document.createElement('button');
bcTransferDiv.appendChild(buttonRight);
bcTransferDiv.appendChild(document.createElement('br'));
bcTransferDiv.appendChild(document.createElement('br'));
bcTransferDiv.appendChild(buttonLeft);
bcContainer.appendChild(bcTransferDiv);
let bcList2 = document.createElement('select');
let bcList2Div = document.createElement('div');
bcList2Div.appendChild(document.createTextNode('Selected Sites'));
bcList2Div.appendChild(bcList2);
bcContainer.appendChild(bcList2Div);
bcBodyDiv.appendChild(bcContainer);
bcButtonRun = document.createElement('button');
bcBodyDiv.appendChild(bcButtonRun);
bcButtonCancel = document.createElement('button');
bcBodyDiv.appendChild(bcButtonCancel);
bcDiv.appendChild(bcBodyDiv);
document.getElementById('myMap').insertBefore(bcDiv,
document.getElementsByClassName('ol-viewport')[0]);
bcDiv.id = 'pbcDiv';
bcDiv.className = 'predictBestCan panel panel-primary draggable';
bcDiv.style.display = 'block';
bcDiv.onclick = function (e) {
if (e) { e.stopPropagation(); }
setDialogZIndex(e, 'pbcDiv');
};
bcTable.style.width = '100%';
bcTd1.style.width = '98%';
bcTd2.style.width = '2%';
bcTitleDiv.id = bcDiv.id + 'Title';
bcTitleDiv.className = 'panel-heading draggable-handler';
bcTitleDiv.innerHTML = '&nbsp;&nbsp;&nbsp;Best Candidate Options...';
bcCloseDiv.className = 'panel-action';
bcCloseButton.className = 'panel-action-button';
bcCloseButton.title = 'Close';
bcCloseButtonI.className = 'fas fa-window-close';
bcCloseButton.onclick = function (e) {
if (e) { e.stopPropagation(); }
closePredictBestCan();
};
bcBodyDiv.className = 'panel-body';
bcBodyDiv.style.width =
(Number(bcDiv.style.width.replace('px')) - 6).toString() + 'px';
bcBodyDiv.style.height =
(Number(bcDiv.style.height.replace('px')) - 37).toString() + 'px';
bcBodyDiv.style.padding = '15px 10px';
bcBodyDiv.style.color = 'var(--fontcolor)';
bcBodyDiv.style.fontSize = '12px';
bcPolygonDiv.id = 'pbcPolygon';
bcButtonRun.className = 'btn btn-default';
bcButtonRun.style.position = 'absolute';
bcButtonRun.style.right = '10px';
bcButtonRun.style.bottom = '10px';
bcButtonRun.title = 'Run';
bcButtonRun.innerHTML = 'Run';
bcButtonRun.onclick = function (e) {
if (e) { e.stopPropagation(); }
var testSites = [];
var testPolygon = undefined;
testSites = $('#lstBox2 option').map(function () {
return $(this).val();
}).get();
if (testSites) {
if (testSites.length > 50) {
testSites = testSites.slice(0, 50);
}
}
let feature = myPolygonsLayer.getSource().getFeatureByProperty('polygonname',
document.getElementById('pbcPolygon').value);
if (feature) {
if (feature.get('polygonid') !== undefined) {
testPolygon = feature.get('polygonid');
}
}
closePredictBestCan();
if (testPolygon) {
if (testSites.length > 0) {
analyseBestCan(testSites, testPolygon);
}
}
};
bcButtonCancel.className = 'btn btn-default';
bcButtonCancel.style.position = 'absolute';
bcButtonCancel.style.right = '70px';
bcButtonCancel.style.bottom = '10px';
bcButtonCancel.title = 'Cancel';
bcButtonCancel.innerHTML = 'Cancel';
bcButtonCancel.onclick = function (e) {
if (e) { e.stopPropagation(); }
closePredictBestCan();
};
bcContainer.className = 'transferContainer';
bcList1.className = 'listBox';
bcList1.id = 'lstBox1';
bcList1.multiple = 'multiple';
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;
}
bcTransferDiv.className = 'transferButtons';
buttonRight.id = 'btnRight';
buttonRight.innerHTML = ' > ';
buttonRight.value = ' > ';
buttonRight.type = 'button';
buttonLeft.id = 'btnLeft';
buttonLeft.innerHTML = ' < ';
buttonLeft.value = ' < ';
buttonLeft.type = 'button';
buttonRight.className = 'btn btn-default';
buttonLeft.className = 'btn btn-default';
let polygons = myPolygonsLayer.getSource().getFeatures();
let polygonslst = "";
for (let i = 0; i < polygons.length; i++) {
polygonslst += polygons[i].getProperties().polygonname + '\t';
}
polygonslst = polygonslst.substr(0, polygonslst.length - 1);
initSelectOpt(bcPolygonDiv, '100%', polygonslst, '');
// set draggable
$(document).ready(function () {
$('#btnRight').click(function (e) {
let selectedOpts = $('#lstBox1 option:selected');
if (selectedOpts.length === 0) {
e.preventDefault();
}
$('#lstBox2').append($(selectedOpts).clone());
$(selectedOpts).remove();
e.preventDefault();
});
$('#btnLeft').click(function (e) {
let selectedOpts = $('#lstBox2 option:selected');
if (selectedOpts.length === 0) {
e.preventDefault();
}
$('#lstBox1').append($(selectedOpts).clone());
$(selectedOpts).remove();
e.preventDefault();
});
});
setDraggable();
setDialogZIndex(null, bcDiv.id);
}
}
function closePredictBestCan() {
let bcd = document.getElementById('pbcDiv');
if (bcd) {
while (bcd.firstChild) {
bcd.firstChild.remove();
}
document.getElementById('myMap').removeChild(bcd);
}
}

View File

@@ -0,0 +1,122 @@
function showPredictSites(e) {
if (e) { e.stopPropagation(); }
if (!document.getElementById('pnDiv')) {
let psDiv = document.createElement('div');
let psTable = document.createElement('table');
let psTBody = document.createElement('tbody');
let psTr = document.createElement('tr');
let psTd1 = document.createElement('td');
let psTitleDiv = document.createElement('div');
psTd1.appendChild(psTitleDiv);
let psTd2 = document.createElement('td');
let psCloseDiv = document.createElement('div');
let psCloseButton = document.createElement('button');
let psCloseButtonI = document.createElement('i');
psCloseButton.appendChild(psCloseButtonI);
psCloseDiv.appendChild(psCloseButton);
psTd2.appendChild(psCloseDiv);
psTr.appendChild(psTd1);
psTr.appendChild(psTd2);
psTBody.appendChild(psTr);
psTable.appendChild(psTBody);
psDiv.appendChild(psTable);
let psBodyDiv = document.createElement('div');
let psPolygonDiv = document.createElement('div');
let psTechnologyDiv = document.createElement('div');
psBodyDiv.appendChild(document.createTextNode('Select Polygon'));
psBodyDiv.appendChild(psPolygonDiv);
psBodyDiv.appendChild(document.createTextNode('Select Technology'));
psBodyDiv.appendChild(psTechnologyDiv);
psButtonCancel = document.createElement('button');
psBodyDiv.appendChild(psButtonCancel);
psButtonRun = document.createElement('button');
psBodyDiv.appendChild(psButtonRun);
psDiv.appendChild(psBodyDiv);
document.getElementById('myMap').insertBefore(psDiv,
document.getElementsByClassName('ol-viewport')[0]);
psDiv.id = 'pnDiv';
psDiv.className = 'predictSites panel panel-primary draggable';
psDiv.style.display = 'block';
psDiv.onclick = function (e) {
if (e) { e.stopPropagation(); }
setDialogZIndex(e, 'pnDiv');
};
psTable.style.width = '100%';
psTd1.style.width = '98%';
psTd2.style.width = '2%';
psTitleDiv.id = psDiv.id + 'Title';
psTitleDiv.className = 'panel-heading draggable-handler';
psTitleDiv.innerHTML = '&nbsp;&nbsp;&nbsp;Predict Sites Options...';
psCloseDiv.className = 'panel-action';
psCloseButton.className = 'panel-action-button';
psCloseButton.title = 'Close';
psCloseButtonI.className = 'fas fa-window-close';
psCloseButton.onclick = function (e) {
if (e) { e.stopPropagation(); }
closePredictSites();
};
psBodyDiv.className = 'panel-body';
psBodyDiv.style.width =
(Number(psDiv.style.width.replace('px')) - 6).toString() + 'px';
psBodyDiv.style.height =
(Number(psDiv.style.height.replace('px')) - 37).toString() + 'px';
psBodyDiv.style.padding = '15px 10px';
psBodyDiv.style.color = 'var(--fontcolor)';
psBodyDiv.style.fontSize = '12px';
psPolygonDiv.id = 'pnPolygon';
psTechnologyDiv.id = 'pnTechnology';
psButtonRun.className = 'btn btn-default';
psButtonRun.style.position = 'absolute';
psButtonRun.style.right = '10px';
psButtonRun.style.bottom = '10px';
psButtonRun.title = 'Run';
psButtonRun.innerHTML = 'Run';
psButtonRun.onclick = function (e) {
if (e) { e.stopPropagation(); }
var testPolygon = undefined;
var testTechnology = undefined;
testTechnology = document.getElementById('pnTechnology').value;
let feature = myPolygonsLayer.getSource().getFeatureByProperty('polygonname',
document.getElementById('pnPolygon').value);
if (feature) {
if (feature.get('polygonid') !== undefined) {
testPolygon = feature.get('polygonid');
}
}
closePredictSites();
if (testPolygon) {
analysePredictSites(testPolygon, testTechnology);
}
};
psButtonCancel.className = 'btn btn-default';
psButtonCancel.style.position = 'absolute';
psButtonCancel.style.right = '70px';
psButtonCancel.style.bottom = '10px';
psButtonCancel.title = 'Cancel';
psButtonCancel.innerHTML = 'Cancel';
psButtonCancel.onclick = function (e) {
if (e) { e.stopPropagation(); }
closePredictSites();
};
let polygons = myPolygonsLayer.getSource().getFeatures();
let polygonsList = "";
for (let i = 0; i < polygons.length; i++) {
polygonsList += polygons[i].getProperties().polygonname + '\t';
}
polygonsList = polygonsList.substr(0, polygonsList.length - 1);
initSelectOpt(psPolygonDiv, '100%', polygonsList, '');
initSelectOpt(psTechnologyDiv, '100%', '2G\t4G', '');
// set draggable
setDraggable();
setDialogZIndex(null, psDiv.id);
}
}
function closePredictSites() {
let psd = document.getElementById('pnDiv');
if (psd) {
while (psd.firstChild) {
psd.firstChild.remove();
}
document.getElementById('myMap').removeChild(psd);
}
}

View File

@@ -0,0 +1,303 @@
/* global variables*/
var userDisplay = false;
var siteData;
var sitesCount;
var currSite;
/* 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');
/* setup listeners*/
document.getElementById('sitename').addEventListener('change', siteNameChange);
document.getElementById('longitude').addEventListener('change', longitudeChange);
document.getElementById('latitude').addEventListener('change', latitudeChange);
document.getElementById('height').addEventListener('change', heightChange);
document.getElementById('region').addEventListener('change', propertyChange);
document.getElementById('country').addEventListener('change', propertyChange);
document.getElementById('city').addEventListener('change', propertyChange);
document.getElementById('district').addEventListener('change', propertyChange);
document.getElementById('province').addEventListener('change', propertyChange);
document.getElementById('address').addEventListener('change', propertyChange);
document.getElementById('comments').addEventListener('change', propertyChange);
document.getElementById('rfcn').addEventListener('change', rfcnChange);
document.getElementById('rfid').addEventListener('change', rfidChange);
document.getElementById('rfpower').addEventListener('change', rfPowerChange);
document.getElementById('hba').addEventListener('change', hbaChange);
document.getElementById('antennamodel').addEventListener('change', antennaModelChange);
document.getElementById('azimuth').addEventListener('change', azimuthChange);
document.getElementById('feederloss').addEventListener('change', feederLossChange);
/* siteoptions functions*/
function siteNameChange(e) {
document.getElementById('sitename').value = fixStringName(document.getElementById('sitename').value);
saveSiteData(e);
}
function propertyChange(e) {
document.getElementById('region').value = fixStringName(document.getElementById('region').value);
document.getElementById('country').value = fixStringName(document.getElementById('country').value);
document.getElementById('city').value = fixStringName(document.getElementById('city').value);
document.getElementById('district').value = fixStringName(document.getElementById('district').value);
document.getElementById('province').value = fixStringName(document.getElementById('province').value);
document.getElementById('address').value = fixStringName(document.getElementById('address').value);
document.getElementById('comments').value = fixStringName(document.getElementById('comments').value);
saveSiteData(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());
}
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());
}
saveSiteData(e);
}
function feederLossChange(e) {
document.getElementById('feederloss').value = Number(document.getElementById('feederloss').value);
if (Number(document.getElementById('feederloss').value) > 50) {
document.getElementById('feederloss').value = 50;
} else if (Number(document.getElementById('feederloss').value) < 0) {
document.getElementById('feederloss').value = 0;
}
saveSiteData(e);
}
function azimuthChange(e) {
document.getElementById('azimuth').value = Number(document.getElementById('azimuth').value);
if (Number(document.getElementById('azimuth').value) > 359) {
document.getElementById('azimuth').value = 359;
} else if (Number(document.getElementById('azimuth').value) < 0) {
document.getElementById('azimuth').value = 0;
}
saveSiteData(e);
}
function rfidChange(e) {
document.getElementById('rfid').value = Number(document.getElementById('rfid').value);
switch (document.getElementById('technology').value) {
case '2G':
if (Number(document.getElementById('rfid').value) > 77) {
document.getElementById('rfid').value = 77;
} else if (Number(document.getElementById('rfid').value) < 0) {
document.getElementById('rfid').value = 0;
}
break;
case '4G':
if (Number(document.getElementById('rfid').value) > 503) {
document.getElementById('rfid').value = 503;
} else if (Number(document.getElementById('rfid').value) < 0) {
document.getElementById('rfid').value = 0;
}
break;
default: break;
}
saveSiteData(e);
}
function rfcnChange(e) {
document.getElementById('rfcn').value = Number(document.getElementById('rfcn').value);
switch (document.getElementById('technology').value) {
case '2G':
if (Number(document.getElementById('rfcn').value) > 124) {
document.getElementById('rfcn').value = 124;
} else if (Number(document.getElementById('rfcn').value) < 1) {
document.getElementById('rfcn').value = 1;
}
document.getElementById('dlfrequency').value = window.parent.getGSMDlfrequency(document.getElementById('rfcn').value);
document.getElementById('ulfrequency').value = window.parent.getGSMUlfrequency(document.getElementById('rfcn').value);
break;
case '4G':
if (Number(document.getElementById('rfcn').value) > 3799) {
document.getElementById('rfcn').value = 3799;
} else if (Number(document.getElementById('rfcn').value) < 3450) {
document.getElementById('rfcn').value = 3450;
}
document.getElementById('dlfrequency').value = window.parent.getLTEDlfrequency(document.getElementById('rfcn').value);
document.getElementById('ulfrequency').value = window.parent.getLTEUlfrequency(document.getElementById('rfcn').value);
break;
default: break;
}
saveSiteData(e);
}
function rfPowerChange(e) {
document.getElementById('rfpower').value = Number(document.getElementById('rfpower').value);
if (Number(document.getElementById('rfpower').value) > 40) {
document.getElementById('rfpower').value = 40;
} else if (Number(document.getElementById('rfpower').value) < 1) {
document.getElementById('rfpower').value = 1;
}
saveSiteData(e);
}
function hbaChange(e) {
document.getElementById('hba').value = Number(document.getElementById('hba').value);
if (Number(document.getElementById('hba').value) > Number(document.getElementById('height').value)) {
document.getElementById('height').value = document.getElementById('hba').value;
}
saveSiteData(e);
}
function heightChange(e) {
document.getElementById('height').value = Number(document.getElementById('height').value);
if (Number(document.getElementById('height').value) < Number(document.getElementById('hba').value)) {
document.getElementById('hba').value = document.getElementById('height').value;
}
saveSiteData(e);
}
function antennaModelChange(e) {
let antennaOptions = window.parent.getAntennaOptions(document.getElementById('antennamodel').value);
document.getElementById('antennatype').value = antennaOptions.antennaType;
document.getElementById('polarization').value = antennaOptions.polarization;
document.getElementById('vbeamwidth').value = antennaOptions.vBeamWidth;
document.getElementById('hbeamwidth').value = antennaOptions.hBeamWidth;
document.getElementById('downtilt').value = antennaOptions.downTilt;
document.getElementById('antennagain').value = antennaOptions.antennaGain;
document.getElementById('azimuth').value = '0';
if (document.getElementById('antennatype').value === 'Omni') {
document.getElementById('azimuth').readonly = true;
document.getElementById('azimuth').disabled = true;
} else {
document.getElementById('azimuth').readonly = false;
document.getElementById('azimuth').disabled = false;
}
saveSiteData(e);
}
function fillSiteData(siteData) {
// site
document.getElementById('siteid').value = siteData[0] === undefined ? '' : siteData[0].toString();
document.getElementById('sitename').value = siteData[1] === undefined ? '' : siteData[1].toString();
document.getElementById('sitename1').value = siteData[1] === undefined ? '' : siteData[1].toString();
document.getElementById('longitude').value = siteData[2] === undefined ? '' : siteData[2].toString();
document.getElementById('latitude').value = siteData[3] === undefined ? '' : siteData[3].toString();
// tower
document.getElementById('height').value = siteData[4] === undefined ? '' : siteData[4].toString();
// property
document.getElementById('region').value = siteData[5] === undefined ? '' : siteData[5].toString();
document.getElementById('country').value = siteData[6] === undefined ? '' : siteData[6].toString();
document.getElementById('city').value = siteData[7] === undefined ? '' : siteData[7].toString();
document.getElementById('district').value = siteData[8] === undefined ? '' : siteData[8].toString();
document.getElementById('province').value = siteData[9] === undefined ? '' : siteData[9].toString();
document.getElementById('address').value = siteData[10] === undefined ? '' : siteData[10].toString();
document.getElementById('comments').value = siteData[11] === undefined ? '' : siteData[11].toString();
// radio
document.getElementById('technology').value = siteData[12] === undefined ? '' : siteData[12].toString();
document.getElementById('technology1').value = siteData[12] === undefined ? '' : siteData[12].toString();
document.getElementById('band').value = siteData[13] === undefined ? '' : siteData[13].toString();
document.getElementById('bandwidth').value = siteData[14] === undefined ? '' : siteData[14].toString();
document.getElementById('cellid').value = siteData[15] === undefined ? '' : siteData[15].toString();
document.getElementById('lac').value = siteData[16] === undefined ? '' : siteData[16].toString();
document.getElementById('rfcn').value = siteData[17] === undefined ? '' : siteData[17].toString();
document.getElementById('rfid').value = siteData[18] === undefined ? '' : siteData[18].toString();
document.getElementById('dlfrequency').value = siteData[19] === undefined ? '' : siteData[19].toString();
document.getElementById('ulfrequency').value = siteData[20] === undefined ? '' : siteData[20].toString();
document.getElementById('rfpower').value = siteData[21] === undefined ? '' : siteData[21].toString();
// antenna
document.getElementById('hba').value = siteData[22] === undefined ? '' : siteData[22].toString();
document.getElementById('azimuth').value = siteData[23] === undefined ? '' : siteData[23].toString();
document.getElementById('antennamodel').setOpt(siteData[24] === undefined ? '' : siteData[24].toString());
document.getElementById('antennatype').value = siteData[25] === undefined ? '' : siteData[25].toString();
document.getElementById('polarization').value = siteData[26] === undefined ? '' : siteData[26].toString();
document.getElementById('vbeamwidth').value = siteData[27] === undefined ? '' : siteData[27].toString();
document.getElementById('hbeamwidth').value = siteData[28] === undefined ? '' : siteData[28].toString();
document.getElementById('downtilt').value = siteData[29] === undefined ? '' : siteData[29].toString();
document.getElementById('antennagain').value = siteData[30] === undefined ? '' : siteData[30].toString();
document.getElementById('feederloss').value = siteData[31] === undefined ? '' : siteData[31].toString();
if (document.getElementById('antennatype').value === 'Omni') {
document.getElementById('azimuth').readonly = true;
document.getElementById('azimuth').disabled = true;
} else {
document.getElementById('azimuth').readonly = false;
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 nextSite(e) {
if (e) { e.stopPropagation(); }
if (Number(sitesCount) - 1 > Number(currSite)) {
refreshSiteData('', (Number(currSite) + 1).toString());
}
}
function previousSite(e) {
if (e) { e.stopPropagation(); }
if (Number(currSite) > 0) {
refreshSiteData('', (Number(currSite) - 1).toString());
}
}
function saveSiteData(e) {
if (e) { e.stopPropagation(); }
window.parent.updateSiteDataByIdx({
//site
idx: currSite,
sitename: document.getElementById('sitename').value,
longitude: document.getElementById('longitude').value,
latitude: document.getElementById('latitude').value,
// tower
height: document.getElementById('height').value,
// property
region: document.getElementById('region').value,
country: document.getElementById('country').value,
city: document.getElementById('city').value,
district: document.getElementById('district').value,
province: document.getElementById('province').value,
address: document.getElementById('address').value,
comments: document.getElementById('comments').value,
//radio
technology: document.getElementById('technology').value,
band: document.getElementById('band').value,
bandwidth: document.getElementById('bandwidth').value,
cellid: document.getElementById('cellid').value,
lac: document.getElementById('lac').value,
rfcn: document.getElementById('rfcn').value,
rfid: document.getElementById('rfid').value,
dlfrequency: document.getElementById('dlfrequency').value,
ulfrequency: document.getElementById('ulfrequency').value,
rfpower: document.getElementById('rfpower').value,
//antenna
hba: document.getElementById('hba').value,
azimuth: document.getElementById('azimuth').value,
antennamodel: document.getElementById('antennamodel').value,
antennatype: document.getElementById('antennatype').value,
polarization: document.getElementById('polarization').value,
vbeamwidth: document.getElementById('vbeamwidth').value,
hbeamwidth: document.getElementById('hbeamwidth').value,
downtilt: document.getElementById('downtilt').value,
antennagain: document.getElementById('antennagain').value,
feederloss: document.getElementById('feederloss').value
});
refreshSiteData('cursor');
window.parent.document.getElementById('linkOptionsFrame').contentWindow.refreshLinkData('cursor');
window.parent.document.getElementById('linkProfileFrame').contentWindow.refreshLinkData('cursor');
}
function deleteSite(e) {
if (e) { e.stopPropagation(); }
window.parent.deleteSiteByIdx(currSite);
refreshSiteData('delete');
window.parent.document.getElementById('linkOptionsFrame').contentWindow.refreshLinkData('delete');
window.parent.document.getElementById('linkProfileFrame').contentWindow.refreshLinkData('delete');
}
function zoomToSite(e) {
if (e) { e.stopPropagation(); }
window.parent.document.getElementById('siteOptions').style.display = 'none';
window.parent.zoomToSiteByIdx(currSite);
}

View File

@@ -0,0 +1,293 @@
var pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
setDraggable();
function setDraggable() {
$('.draggable-handler').mousedown(function (e) {
drag = $(this).closest('.draggable');
drag.addClass('dragging');
e = e || window.event;
e.preventDefault();
pos3 = e.clientX;
pos4 = e.clientY;
$(this).on('mousemove', function (e) {
e = e || window.event;
e.preventDefault();
pos1 = pos3 - e.clientX;
pos2 = pos4 - e.clientY;
pos3 = e.clientX;
pos4 = e.clientY;
drag.css('top', $(this).offset().top - pos2 - /* border width*/3);
drag.css('left', $(this).offset().left - pos1 - /* border width*/3);
window.getSelection().removeAllRanges();
});
});
$('.draggable-handler').mouseleave(stopDragging);
$('.draggable-handler').mouseup(stopDragging);
}
function stopDragging(e) {
if (e) { e.stopPropagation(); }
drag = $(this).closest('.draggable');
drag.removeClass('dragging');
$(this).off('mousemove');
}
function openPage(e, pageName, elmnt) {
if (e) { e.stopPropagation(); }
var i, tabContent, tabLinks;
tabContent = document.getElementsByClassName('pageTabContent');
for (i = 0; i < tabContent.length; i++) {
tabContent[i].style.display = 'none';
}
tabLinks = document.getElementsByClassName('pageTabLink');
for (i = 0; i < tabLinks.length; i++) {
tabLinks[i].style.backgroundColor = '';
tabLinks[i].style.color = '';
}
document.getElementById(pageName).style.display = 'block';
elmnt.style.backgroundColor = '#555';
elmnt.style.color = 'white';
}
function round(value, precision) {
return +(Math.round(value + 'e+' + precision) + 'e-' + precision);
}
function colorWithAlpha(color, alpha) {
const [r, g, b] = Array.from(ol.color.asArray(color));
return ol.color.asString([r, g, b, alpha]);
}
function sleep(milliseconds) {
const date = Date.now();
let currentDate = null;
do {
currentDate = Date.now();
} while (currentDate - date < milliseconds);
}
var browser = (function (agent) {
switch (true) {
case agent.indexOf('edge') > -1: return 'edge';
case agent.indexOf('edg') > -1: return 'chromium based edge (dev or canary)';
case agent.indexOf('opr') > -1 && !!window.opr: return 'opera';
case agent.indexOf('chrome') > -1 && !!window.chrome: return 'chrome';
case agent.indexOf('trident') > -1: return 'ie';
case agent.indexOf('firefox') > -1: return 'firefox';
case agent.indexOf('safari') > -1: return 'safari';
default: return 'other';
}
})(window.navigator.userAgent.toLowerCase());
// digits obly check
const digits_only = string => [...string].every(c => '.0123456789'.includes(c));
// number check
function isANumber(str) {
return !/\D/.test(str);
}
// isnumeric
var isNumber = function (value) { return /^\d+\.\d+$/.test(value); };
// convert to title case
function titleCase(str) {
if (str) {
return str.toString().toLowerCase().split(' ').map(function (word) {
return word.replace(word[0], word[0].toUpperCase());
}).join(' ');
} else {
return '';
}
}
function fixStringName(stringName) {
if (stringName) {
return stringName.toString().replace(/[^A-Za-z0-9\s!?]/g, '');
} else {
return '';
}
}
function allLetter(inputtxt) {
var letters = /^[A-Za-z]+$/;
if (inputtxt.toString().match(letters)) {
return true;
}
else {
return false;
}
}
var truncate = function (str, length) {
if (str.length > length) {
return str.substr(0, length - 3) + '...';
} else {
return str;
}
};
/* no ui slider extension with value span control */
function initSingleSlider(target, width, minValue, maxValue, stepSize, defaultValue) {
if (!target.hasChildNodes()) {
let sliTable = document.createElement('table');
let sliTbody = document.createElement('tbody');
let sliTr = document.createElement('tr');
let sliTd1 = document.createElement('td');
let sliTd2 = document.createElement('td');
let sliDiv = document.createElement('div');
let sliSpan = document.createElement('span');
sliTd1.appendChild(sliDiv);
sliTd2.appendChild(sliSpan);
sliTr.appendChild(sliTd1);
sliTr.appendChild(sliTd2);
sliTbody.appendChild(sliTr);
sliTable.appendChild(sliTbody);
target.appendChild(sliTable);
sliTable.id = target.id + '_table';
sliDiv.id = target.id + '_slider';
sliSpan.id = target.id + '_span';
sliTable.style.width = '100%';
sliTable.style.marginBottom = '5px';
sliTd1.style.width = '85%';
sliTd1.style.verticalAlign = 'middle';
sliTd2.style.width = '15%';
sliTd2.style.verticalAlign = 'middle';
sliSpan.style.backgroundColor = 'var(--facecolor)';
sliSpan.style.display = 'flex';
sliSpan.style.padding = '5px 10px 5px 10px';
sliSpan.style.marginLeft = '17px';
sliSpan.style.justifyContent = 'center';
sliSpan.style.width = '50px';
sliSpan.style.fontSize = 'x-small';
sliSpan.style.borderRadius = '4px';
}
let table_ = document.getElementById(target.id + '_table');
let slider_ = document.getElementById(target.id + '_slider');
let span_ = document.getElementById(target.id + '_span');
if (width !== '') {
table_.style.width = width;
}
span_.innerHTML = round(parseFloat(defaultValue), 1);
target.value = parseFloat(defaultValue);
noUiSlider.create(slider_, {
start: parseFloat(defaultValue),
connect: true,
step: parseFloat(stepSize),
range: {
'min': parseFloat(minValue),
'max': parseFloat(maxValue)
}
});
slider_.noUiSlider.on('change', function (values, handle) {
let value = values[handle];
span_.innerHTML = round(value, 1);
target.value = value;
if ('createEvent' in document) {
let evt = document.createEvent('Event');
evt.initEvent('change', true, true);
target.dispatchEvent(evt);
} else {
target.fireEvent('onchange');
}
});
slider_.noUiSlider.on('set', function (values, handle) {
let value = values[handle];
span_.innerHTML = round(value, 1);
target.value = value;
});
target.setValue = function (value) {
if (this.hasChildNodes) {
if (this.firstChild.id.includes('_table')) {
this.firstChild.firstChild.firstChild.firstChild.firstChild.noUiSlider.set(value);
}
}
};
}
/* Select Option no ui control */
function initSelectOpt(target, width, lstOpt, defaultValue) {
if (!target.hasChildNodes()) {
let sopButton = document.createElement('button');
let sopDiv = document.createElement('div');
target.appendChild(sopButton);
target.appendChild(sopDiv);
sopButton.id = target.id + '_selectBar';
sopButton.className = 'selectBar collapsed';
sopButton.setAttribute('data-toggle', 'collapse');
sopDiv.id = target.id + '_selectDiv';
sopDiv.className = 'selectDiv collapse';
}
let selectBar = target.firstChild;
let selectDiv = selectBar.nextElementSibling;
let dataset = [];
lstOpt.split('\t').forEach(function (item, index) {
dataset.push({ columnname: item, datatype: 'str', class: 'datatypstr' });
});
if (width !== '') {
selectBar.style.width = width;
}
selectBar.dataset.target = '#' + selectDiv.id;
target.value = '';
selectBar.innerHTML = '<i class="fa fa-caret-down" style="float: right"></i>';
selectDiv.innerHTML = '';
for (let i = 0; i < dataset.length; i++) {
selectDiv.innerHTML += '<div class="selectList" onclick="this.parentElement.choose(event);" data-value="'
+ dataset[i].columnname + '">' + dataset[i].columnname + '</div>';
if (dataset[i].columnname === defaultValue) {
target.value = defaultValue;
selectBar.innerHTML = defaultValue + '<i class="fa fa-caret-down" style="float: right"></i>';
}
}
if (target.value === '' && dataset.length > 0) {
target.value = dataset[0].columnname;
selectBar.innerHTML = dataset[0].columnname + '<i class="fa fa-caret-down" style="float: right"></i>';
}
selectBar.hide = function (e) {
if (e) { e.stopPropagation(); }
let selectBar = e.currentTarget;
let selectDiv = selectBar.nextElementSibling;
if (selectDiv.mouseIsOver === false) {
selectDiv.className = 'selectDiv collapse';
selectBar.className = 'selectBar collapsed';
}
};
selectBar.focus = function (e) {
if (e) { e.stopPropagation(); }
let selectBar = e.currentTarget;
let selectDiv = selectBar.nextElementSibling;
selectDiv.style.width = selectBar.offsetWidth + 'px';
};
selectDiv.choose = function (e) {
if (e) { e.stopPropagation(); }
let target = e.currentTarget.parentElement.parentElement;
let selectBar = e.currentTarget.parentElement.previousElementSibling;
let selectDiv = e.currentTarget.parentElement;
target.value = e.currentTarget.dataset.value;
selectBar.innerHTML = e.currentTarget.dataset.value + '<i class="fa fa-caret-down" style="float: right"></i>';
selectDiv.className = 'selectDiv collapse';
selectBar.className = 'selectBar collapsed';
if ('createEvent' in document) {
var evt = document.createEvent('Event');
evt.initEvent('change', true, true);
target.dispatchEvent(evt);
} else {
target.fireEvent('onchange');
}
};
selectBar.addEventListener('focus', selectBar.focus);
selectBar.addEventListener('focusout', selectBar.hide);
selectDiv.mouseIsOver = false;
selectDiv.onmouseover = () => {
selectDiv.mouseIsOver = true;
};
selectDiv.onmouseout = () => {
selectDiv.mouseIsOver = false;
};
target.setOpt = function (value) {
if (this.hasChildNodes) {
if (this.firstChild.className.includes('selectBar') && this.firstChild.id.includes('selectBar')) {
this.firstChild.innerHTML = value + '<i class="fa fa-caret-down" style="float: right"></i>';
this.value = value;
}
}
};
target.reloadOpt = function (value) {
if (this.hasChildNodes) {
if (this.firstChild.className.includes('selectBar') && this.firstChild.id.includes('selectBar')) {
initSelectOpt(this, '', value, '');
}
}
};
selectBar.addEventListener('click', function () {
$(selectBar.getAttribute('data-target')).collapse('toggle');
});
}

View File

@@ -0,0 +1,318 @@
// Select interaction
var select = new ol.interaction.Select({
condition: ol.events.condition.singleClick,
hitTolerance: 10,
wrapX: false,
toggleCondition: ol.events.condition.shiftKeyOnly,
style: selectStyle
});
myMap.addInteraction(select);
select.setActive(false);
selection = select.getFeatures();
selection.on('add', function (e) {
if (actionRunning) { return; }
let feature = e.target.getArray()[0];
if (feature.get('linkid') !== undefined) {
if (e) { e.stopPropagation(); }
//display link profile
document.getElementById('linkProfile').style.display = 'block';
document.getElementById('linkProfileFrame').contentWindow.refreshLinkDataById(feature.get('linkid'));
document.getElementById('linkProfileFrame').contentWindow.userDisplay = true;
setDialogZIndex(null, 'linkProfile');
clearInteractions();
}
if (feature.get('noteid') !== undefined) {
if (feature.get('email') === undefined) {
if (e) { e.stopPropagation(); }
document.getElementById('noteOptions').style.display = 'block';
document.getElementById('noteOptionsFrame').contentWindow.refreshNoteDataById(feature.get('noteid'));
document.getElementById('noteOptionsFrame').contentWindow.userDisplay = true;
setDialogZIndex(null, 'noteOptions');
clearInteractions();
}
}
if (feature.get('polygonid') !== undefined) {
if (e) { e.stopPropagation(); }
document.getElementById('polyOptions').style.display = 'block';
document.getElementById('polyOptionsFrame').contentWindow.refreshPolygonDataById(feature.get('polygonid'));
document.getElementById('polyOptionsFrame').contentWindow.userDisplay = true;
setDialogZIndex(null, 'polyOptions');
clearInteractions();
}
if (feature.get('siteid') !== undefined) {
if (feature.get('email') === undefined) {
if (e) { e.stopPropagation(); }
document.getElementById('siteOptions').style.display = 'block';
document.getElementById('siteOptionsFrame').contentWindow.refreshSiteDataById(feature.get('siteid'));
document.getElementById('siteOptionsFrame').contentWindow.userDisplay = true;
setDialogZIndex(null, 'siteOptions');
clearInteractions();
}
}
});
// ******* Link interactions
var addLink = new ol.interaction.Select({
condition: ol.events.condition.singleClick,
hitTolerance: 1,
wrapX: false,
layers: function (layer) { return layer === myNetworkLayer; },
style: drawLinkSiteStyle
});
myMap.addInteraction(addLink);
addLink.setActive(false);
var siteASelected = undefined;
var pointCount = 0;
var addedLink = addLink.getFeatures();
addedLink.on('add', function (e) {
if (!siteASelected) {
if (e) { e.stopPropagation(); }
drawLink.setActive(true);
let feature = e.target.getArray()[0];
siteASelected = feature;
let coordinate = feature.getGeometry().getCoordinates();
let clickEvent = $.Event('click');
clickEvent.map = myMap;
clickEvent.coordinate = coordinate;
drawLink.startDrawing_(clickEvent);
}
else {
if (e) { e.stopPropagation(); }
drawLink.finishDrawing();
drawLink.setActive(false);
let feature = e.target.getArray()[0];
createLink({
siteida: siteASelected.get('siteid'),
locationA: ol.proj.toLonLat(siteASelected.getGeometry().getCoordinates()),
siteidb: feature.get('siteid'),
locationB: ol.proj.toLonLat(feature.getGeometry().getCoordinates())
});
document.getElementById('linkOptionsFrame').contentWindow.refreshLinkData('add');
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);
var drawLinkTip = new ol.Overlay.Tooltip();
myMap.addOverlay(drawLinkTip);
drawLink.on('drawstart', function () { drawLinkTip.setInfo('Select site B to create link'); drawLinkTip.setFeature.bind(drawLinkTip); pointCount = 1; });
drawLink.on(['change:active', 'drawend'], function () { drawLinkTip.setInfo(''); drawLinkTip.removeFeature.bind(drawLinkTip); });
var selectLink = new ol.interaction.Select({
condition: ol.events.condition.singleClick,
hitTolerance: 5,
wrapX: false,
toggleCondition: ol.events.condition.shiftKeyOnly,
layers: function (layer) { return layer === myLinksLayer; },
style: selectStyle
});
myMap.addInteraction(selectLink);
selectLink.setActive(false);
var deleteLinkActive = false;
var snapLink = new ol.interaction.Snap({ source: myLinksLayer.getSource() });
myMap.addInteraction(snapLink);
snapLink.setActive(false);
var selectedLink = selectLink.getFeatures();
selectedLink.on('add', function (e) {
if (deleteLinkActive === true) {
if (e) { e.stopPropagation(); }
selectLink.getFeatures().forEach(function (feature) {
myLinksLayer.getSource().removeFeature(feature);
myMap.render();
});
loadLinksTreeFromSource();
document.getElementById('linkOptionsFrame').contentWindow.refreshLinkData('delete');
document.getElementById('linkProfileFrame').contentWindow.refreshLinkData('delete');
// clear all tools here
clearInteractions();
}
});
// ******* Polygon interactions
var selectPolygon = new ol.interaction.Select({
condition: ol.events.condition.singleClick,
hitTolerance: 5,
wrapX: false,
toggleCondition: ol.events.condition.shiftKeyOnly,
layers: function (layer) { return layer === myPolygonsLayer; },
style: selectStyle
});
myMap.addInteraction(selectPolygon);
selectPolygon.setActive(false);
var drawPolygon = new ol.interaction.Draw({ source: myPolygonsLayer.getSource(), type: 'Polygon', style: drawPolygonStyle });
myMap.addInteraction(drawPolygon);
drawPolygon.setActive(false);
document.addEventListener('keydown', function (e) {
if (e.which === 27) {
if (drawPolygon.getActive()) {
if (e) { e.stopPropagation(); }
drawPolygon.removeLastPoint();
}
if (addLink.getActive()) {
drawLink.removeLastPoint();
drawLink.setActive(false);
clearInteractions();
}
}
});
var drawPolygonTip = new ol.Overlay.Tooltip();
myMap.addOverlay(drawPolygonTip);
drawPolygon.on('drawstart', function () { drawPolygonTip.setInfo('Click ESC to remove last point'); drawPolygonTip.setFeature.bind(drawPolygonTip); });
drawPolygon.on(['change:active', 'drawend'], function () { drawPolygonTip.setInfo(''); drawPolygonTip.removeFeature.bind(drawPolygonTip); });
var modifyPolygon = new ol.interaction.Modify({ features: selectPolygon.getFeatures() });
myMap.addInteraction(modifyPolygon);
modifyPolygon.setActive(false);
var transformPolygon = new ol.interaction.Transform({ features: selectPolygon.getFeatures() });
myMap.addInteraction(transformPolygon);
transformPolygon.setActive(false);
var deletePolygonActive = false;
var snapPolygon = new ol.interaction.Snap({ source: myPolygonsLayer.getSource() });
myMap.addInteraction(snapPolygon);
snapPolygon.setActive(false);
var selectedPolygon = selectPolygon.getFeatures();
selectedPolygon.on('add', function (e) {
if (transformPolygon.getActive() === true) {
transformPolygon.setSelection(selectPolygon.getFeatures());
}
if (deletePolygonActive === true) {
if (e) { e.stopPropagation(); }
selectPolygon.getFeatures().forEach(function (feature) {
myPolygonsLayer.getSource().removeFeature(feature);
myMap.render();
});
loadPolygonsTreeFromSource();
document.getElementById('polyOptionsFrame').contentWindow.refreshPolygonData('delete');
// clear all tools here
clearInteractions();
}
});
// ******* Site interactions
var selectSite = new ol.interaction.Select({
condition: ol.events.condition.singleClick,
hitTolerance: 5,
wrapX: false,
toggleCondition: ol.events.condition.shiftKeyOnly,
layers: function (layer) { return layer === myNetworkLayer; },
style: selectStyle
});
myMap.addInteraction(selectSite);
selectSite.setActive(false);
var drawSite2G = new ol.interaction.Draw({ source: myNetworkLayer.getSource(), type: 'Point', style: drawSiteStyle });
myMap.addInteraction(drawSite2G);
drawSite2G.setActive(false);
var drawSite4G = new ol.interaction.Draw({ source: myNetworkLayer.getSource(), type: 'Point', style: drawSiteStyle });
myMap.addInteraction(drawSite4G);
drawSite4G.setActive(false);
var modifySite = new ol.interaction.Modify({ features: selectSite.getFeatures() });
myMap.addInteraction(modifySite);
modifySite.setActive(false);
var deleteSiteActive = false;
var snapSite = new ol.interaction.Snap({ source: myNetworkLayer.getSource() });
myMap.addInteraction(snapSite);
snapSite.setActive(false);
var selectedSite = selectSite.getFeatures();
selectedSite.on('add', function (e) {
if (deleteSiteActive === true) {
if (e) { e.stopPropagation(); }
selectSite.getFeatures().forEach(function (feature) {
deleteLinksBySiteId(feature.get('siteid'));
myNetworkLayer.getSource().removeFeature(feature);
myMap.render();
});
loadSitesTreeFromSource();
document.getElementById('siteOptionsFrame').contentWindow.refreshSiteData('delete');
document.getElementById('linkOptionsFrame').contentWindow.refreshLinkData('delete');
document.getElementById('linkProfileFrame').contentWindow.refreshLinkData('delete');
// clear all tools here
clearInteractions();
}
});
modifySite.on('modifyend', function (e) {
let feature = e.features.getArray()[0];
if (feature.get('siteid') !== undefined) {
if (e) { e.stopPropagation(); }
let coordinates3857 = feature.getGeometry().getCoordinates();
let coordinates4326 = ol.proj.transform(coordinates3857, 'EPSG:3857', 'EPSG:4326');
feature.setProperties({
'longitude': coordinates4326[0],
'latitude': coordinates4326[1]
});
myMap.render();
deleteLinksBySiteId(feature.get('siteid'));
loadSitesTreeFromSource();
document.getElementById('siteOptionsFrame').contentWindow.refreshSiteData('cursor');
document.getElementById('linkOptionsFrame').contentWindow.refreshLinkData('delete');
document.getElementById('linkProfileFrame').contentWindow.refreshLinkData('delete');
// clear all tools here
clearInteractions();
}
});
// notes interactions
// ******* Note interactions
var selectNote = new ol.interaction.Select({
condition: ol.events.condition.singleClick,
hitTolerance: 5,
wrapX: false,
toggleCondition: ol.events.condition.shiftKeyOnly,
layers: function (layer) { return layer === myNotesLayer; },
style: selectStyle
});
myMap.addInteraction(selectNote);
selectNote.setActive(false);
var drawNote = new ol.interaction.Draw({
source: myNotesLayer.getSource(),
type: 'Point', style: drawNoteStyle
});
myMap.addInteraction(drawNote);
drawNote.setActive(false);
var modifyNote = new ol.interaction.Modify({ features: selectNote.getFeatures() });
myMap.addInteraction(modifyNote);
modifyNote.setActive(false);
var deleteNoteActive = false;
var snapNote = new ol.interaction.Snap({ source: myNotesLayer.getSource() });
myMap.addInteraction(snapNote);
snapNote.setActive(false);
var selectedNote = selectNote.getFeatures();
selectedNote.on('add', function (e) {
if (deleteNoteActive === true) {
if (e) { e.stopPropagation(); }
selectNote.getFeatures().forEach(function (feature) {
myNotesLayer.getSource().removeFeature(feature);
myMap.render();
});
loadNotesTreeFromSource();
document.getElementById('noteOptionsFrame').contentWindow.refreshNoteData('delete');
// clear all tools here
clearInteractions();
}
});
// measure line && area interactions
var measureLine = new ol.interaction.Draw({ type: 'LineString' });
myMap.addInteraction(measureLine);
measureLine.setActive(false);
var measureArea = new ol.interaction.Draw({ type: 'Polygon' });
myMap.addInteraction(measureArea);
measureArea.setActive(false);
var measureTip = new ol.Overlay.Tooltip();
myMap.addOverlay(measureTip);
measureLine.on('drawstart', measureTip.setFeature.bind(measureTip));
measureLine.on(['change:active', 'drawend'], measureTip.removeFeature.bind(measureTip));
measureArea.on('drawstart', measureTip.setFeature.bind(measureTip));
measureArea.on(['change:active', 'drawend'], measureTip.removeFeature.bind(measureTip));

View File

@@ -0,0 +1,79 @@
var myLegend = new ol.control.Legend({
title: 'Legend',
collapsed: true,
margin: 5,
size: [20, 10]
});
myMap.addControl(myLegend);
myLegend.addRow({ title: 'Legend' });
function setLegend(thematicString) {
// ,&$#@>
// result : thematicString>pngString>polygonsString@polygonsString
// thematicString
// rate&r,g,b$rate&r,g,b
// pngString
// png,1,2,3,4
// polygonsString
// polygonid,polygonname#siteid,sitename#png,1,2,3,4#
// cttrue,ctext1234#rate&value&r,g,b$rate&value&r,g,b#bestcandidate
clearLegend();
if (thematicString) {
if (thematicString.length > 0) {
let rows = thematicString.split('$');
let lastTitleValue = '+s';
for (let i = 0; i < rows.length; i++) {
let titleValue = rows[i].split('&')[0];
let rgb = rows[i].split('&')[1].split(',');
myLegend.addRow(
{
title: allLetter(titleValue) ? titleValue : lastTitleValue + ' to ' + titleValue,
typeGeom: 'Point',
style: new ol.style.Style({
image: new ol.style.RegularShape({
points: 4,
radius: 5,
stroke: new ol.style.Stroke({ color: [rgb[0], rgb[1], rgb[2], 1], width: 1.5 }),
fill: new ol.style.Fill({ color: [rgb[0], rgb[1], rgb[2], 0.85] })
})
})
}
);
lastTitleValue = titleValue;
}
myLegend.show();
}
}
}
function clearLegend() {
while (myLegend.getLength() > 0) {
for (let i = 0; i < myLegend.getLength(); i++) {
myLegend.removeRow(i);
}
}
}
function showLegend() {
let button = document.getElementById('myMap').querySelector(
'div.ol-legend.ol-unselectable.ol-control.ol-collapsed button'
);
if (button) {
fireClick(button);
}
}
var fireClick = function (node) {
if (typeof MouseEvent === 'function') {
var mevt = new MouseEvent('click', {
bubbles: false,
cancelable: true
});
node.dispatchEvent(mevt);
} else if (document.createEvent) {
// Fallback
var evt = document.createEvent('MouseEvents');
evt.initEvent('click', false, false);
node.dispatchEvent(evt);
} else if (document.createEventObject) {
node.fireEvent('onclick');
} else if (typeof node.onclick === 'function') {
node.onclick();
}
};

View File

@@ -0,0 +1,83 @@
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

@@ -0,0 +1,99 @@
$('.ol-control.ol-bar button[title]').tooltip({
placement: 'bottom', trigger: 'hover'
});
$('#activeInteraction').tooltip({
placement: 'bottom', trigger: 'hover'
});
$('.ol-zoom button[title]').tooltip({
placement: 'left', trigger: 'hover'
});
$('.ol-search button[title]').tooltip({
placement: 'left', trigger: 'hover'
});
$('.ol-legend.ol-unselectable.ol-control.ol-collapsed').attr('title', 'Legend');
$('.ol-legend.ol-unselectable.ol-control.ol-collapsed').tooltip({
placement: 'left', trigger: 'hover'
});
$('.ol-full-screen-false').html('<i class=\"fas fa-expand-arrows-alt\"></i>');
while (!select) { let i = 0; }
while (!addedLink) { let i = 0; }
myMap.on('pointermove', function (e) {
if (actionRunning) { return; }
if (e.dragging) {
//featureTip.attr('data-original-title', '').tooltip('hide');
locationInfo.style.opacity = 0; locationInfo.innerHTML = '';
noteInfo.style.opacity = 0; noteInfo.innerHTML = '';
return;
}
setPointerStyle(e);
if (select.getActive()) {
displayElevation(e);
}
if (select.getActive() || addLink.getActive() ||
deleteSiteActive || deleteLinkActive ||
deletePolygonActive || deleteNoteActive) {
displayFeatureInfo(e);
}
});
myMap.on('click', function (e) {
if (siteASelected) {
if (e) { e.stopPropagation(); }
pointCount = pointCount + 1;
if (pointCount > 1) {
drawLink.removeLastPoint();
pointCount = pointCount - 1;
}
}
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'));
//}
//if (feature.get('siteid') !== undefined) {
// if (e) { e.stopPropagation(); }
// document.getElementById('siteOptionsFrame').contentWindow.refreshSiteDataById(feature.get('siteid'));
//}
//if (feature.get('noteid') !== undefined) {
// if (e) { e.stopPropagation(); }
// document.getElementById('noteOptionsFrame').contentWindow.refreshNoteDataById(feature.get('noteid'));
//}
});
while (!document.getElementById('siteOptionsFrame').contentWindow.document) { let i = 0; }
while (!document.getElementById('polyOptionsFrame').contentWindow.document) { let i = 0; }
while (!document.getElementById('noteOptionsFrame').contentWindow.document) { let i = 0; }
while (!document.getElementById('linkOptionsFrame').contentWindow.document) { let i = 0; }
while (!document.getElementById('linkProfileFrame').contentWindow.document) { let i = 0; }
document.getElementById('siteOptionsFrame').contentWindow.document.onclick =
function () {
setDialogZIndex(null, 'siteOptions');
};
document.getElementById('polyOptionsFrame').contentWindow.document.onclick =
function () {
setDialogZIndex(null, 'polyOptions');
};
document.getElementById('noteOptionsFrame').contentWindow.document.onclick =
function () {
setDialogZIndex(null, 'noteOptions');
};
document.getElementById('linkOptionsFrame').contentWindow.document.onclick =
function () {
setDialogZIndex(null, 'linkOptions');
};
document.getElementById('linkProfileFrame').contentWindow.document.onclick =
function () {
setDialogZIndex(null, 'linkProfile');
};
myMap.render();

View File

@@ -0,0 +1,9 @@
document.getElementById('uname').innerHTML = username;
document.getElementById('uemail').innerHTML = email;
/* account functions*/
function Logoff(e) {
if (e) { e.stopPropagation(); }
if (actionRunning) { return; }
Ajax_runccmd("Logoff", "");
window.open('../pages/glavni.aspx', '_self');
}

View File

@@ -0,0 +1 @@


View File

@@ -0,0 +1,253 @@
$('#linksDiv').collapse({
toggle: true
});
var linksTree = document.getElementById('linksUl');
initSingleSlider(document.getElementById('linksStrokeOpacity'), '', '0', '1', '0.1', '1');
document.getElementById('linksStrokeOpacity').addEventListener('change', setLinksStyle);
loadLinksTreeFromFile();
/* link functions*/
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' ?
colorWithAlpha('#00ffff', strokeOpacity) :
colorWithAlpha('#ffe300', strokeOpacity),
lineDash: [7, 7],
width: 4
}),
text: new ol.style.Text({
text: 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 })
})
})];
};
myLinksLayer.setStyle(custStyle);
myMap.render();
}
function loadLinksTreeFromFile() {
let httpRequest = new XMLHttpRequest();
httpRequest.open('GET', '../' + vectorsPath + 'mylinks.geojson', true);
httpRequest.send();
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 loadLinksTreeFromSource() {
let features = myLinksLayer.getSource().getFeatures();
linksTree.innerHTML = '';
for (let i = 0; i < features.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>';
}
}
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('linkOptionsFrame').contentWindow.userDisplay = true;
document.getElementById('linkOptionsFrame').contentWindow.refreshLinkData('', Idx);
setDialogZIndex(null, 'linkOptions');
}
function getLinkDataByIdx(Idx) {
return getDataByIdx(myLinksLayer.getSource(), Idx);
}
function getLinkProfileByIdx(Idx) {
let returnString = '';
if (Idx) {
if (Number(Idx) > -1) {
let feature = myLinksLayer.getSource().getFeatures()[Idx];
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 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);
}
function zoomToLinkByIdx(Idx) {
zoomToFeatureByIdx(myLinksLayer.getSource(), Idx);
}
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('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('channelwidthb', options.channelwidthb.toString());
feature.set('frequencyb', options.frequencyb.toString());
feature.set('outputpowerb', options.outputpowerb.toString());
feature.set('antennagainb', options.antennagainb.toString());
feature.set('lossesb', options.lossesb.toString());
myMap.render();
loadLinksTreeFromSource();
}
}
}
function getLinksCount() {
return getFeaturesCount(myLinksLayer.getSource());
}
function deleteLinkByIdx(Idx) {
deleteFeatureByIdx(myLinksLayer.getSource(), Idx);
loadLinksTreeFromSource();
clearInteractions();
}
function deleteLinksBySiteId(siteid) {
let feature = undefined;
feature = myLinksLayer.getSource().getFeatureByProperty('siteida', siteid);
while (feature) {
myLinksLayer.getSource().removeFeature(feature);
feature = myLinksLayer.getSource().getFeatureByProperty('siteida', siteid);
}
feature = myLinksLayer.getSource().getFeatureByProperty('siteidb', siteid);
while (feature) {
myLinksLayer.getSource().removeFeature(feature);
feature = myLinksLayer.getSource().getFeatureByProperty('siteidb', siteid);
}
myMap.render();
loadLinksTreeFromSource();
clearInteractions();
}
myLinksLayer.getSource().on('addfeature', function (event) {
if (event.feature.get('linkid') === undefined) {
myLinksLayer.getSource().removeFeature(event.feature);
}
});
function downloadLinksCSV(e) {
if (e) { e.stopPropagation(); }
if (actionRunning) { return; }
showProgress('Exporting CSV');
setTimeout(function () {
download.CSV(myLinksLayer.getSource(), 'mylinks');
closeProgress();
}, 500);
}
function downloadLinksJson(e) {
if (e) { e.stopPropagation(); }
if (actionRunning) { return; }
showProgress('Exporting JSON');
setTimeout(function () {
download.JSON(myLinksLayer.getSource(), 'mylinks');
closeProgress();
}, 500);
}
function downloadLinksKML(e) {
if (e) { e.stopPropagation(); }
if (actionRunning) { return; }
showProgress('Exporting KML');
setTimeout(function () {
download.KML(myLinksLayer.getSource(), 'mylinks');
closeProgress();
}, 500);
}
function saveVectorsToServer(e) {
if (e) { e.stopPropagation(); }
if (getActionRunning()) { return; }
showProgress('Saving Vectors');
setTimeout(function () {
saveAllVectors();
closeProgress();
}, 500);
}
function createLink(options) {
let linkid = getNewIdx(myLinksLayer.getSource(), 'linkid');
let elevationString = Ajax_runccmd("GetElevationStringFromLineString",
"{'lineString':'LINESTRING(" +
options.locationA[0] + " " +
options.locationA[1] + "," +
options.locationB[0] + " " +
options.locationB[1] + ")'}").split('#');
let distanceToLocationB = Ajax_runccmd("Distance",
"{'longitude1':'" + options.locationA[0] +
"','latitude1':'" + options.locationA[1] +
"','longitude2':'" + options.locationB[0] +
"','latitude2':'" + options.locationB[1] + "'}") / 1000;
let feature = new ol.Feature({
'linkid': linkid,
'linkname': 'my link ' + linkid,
'linktype': 'internal',
'siteida': options.siteida,
'locheighta': elevationString[0],
'bearinga': round(turf.bearingToAzimuth(turf.bearing(
turf.point(options.locationA), turf.point(options.locationB))), 2),
'channelwidtha': document.getElementById('opt_channelwidth').value,
'frequencya': document.getElementById('opt_frequency').value,
'outputpowera': document.getElementById('opt_outputpower').value,
'antennagaina': document.getElementById('opt_antennagain').value,
'lossesa': document.getElementById('opt_losses').value,
'siteidb': options.siteidb,
'locheightb': elevationString[1],
'bearingb': round(turf.bearingToAzimuth(turf.bearing(
turf.point(options.locationB), turf.point(options.locationA))), 2),
'channelwidthb': document.getElementById('opt_channelwidth').value,
'frequencyb': document.getElementById('opt_frequency').value,
'outputpowerb': document.getElementById('opt_outputpower').value,
'antennagainb': document.getElementById('opt_antennagain').value,
'lossesb': document.getElementById('opt_losses').value,
'distance': distanceToLocationB,
'elevstr': elevationString[2],
geometry: new ol.geom.LineString(
[options.locationA, options.locationB]).transform('EPSG:4326', 'EPSG:3857')
});
myLinksLayer.getSource().addFeature(feature);
myMap.render();
loadLinksTreeFromSource();
}

View File

@@ -0,0 +1,323 @@
$('#sitesDiv').collapse({
toggle: true
});
var sitesTree = document.getElementById('sitesUl');
initSingleSlider(document.getElementById('sitesIconOpacity'), '', '0', '1', '0.1', '1');
document.getElementById('sitesIconOpacity').addEventListener('change', setSitesStyle);
loadSitesTreeFromFile();
/* site functions*/
function setSitesStyle(e) {
if (e) { e.stopPropagation(); }
let custStyle = function (feature) {
let iconOpacity = Number($('#sitesIconOpacity').val());
return [new ol.style.Style({
image: feature.get('technology') === '4G' ? new ol.style.Icon({
scale: .6,
src: '../img/site4G.png',
opacity: iconOpacity
}) : new ol.style.Icon({
scale: .6,
src: '../img/site2G.png',
opacity: iconOpacity
}),
text: new ol.style.Text({
offsetY: 25,
text: 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 })
})
})];
};
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 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>';
}
}
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('siteOptionsFrame').contentWindow.userDisplay = true;
document.getElementById('siteOptionsFrame').contentWindow.refreshSiteData('', Idx);
setDialogZIndex(null,'siteOptions');
}
myNetworkLayer.getSource().on('addfeature', function (event) {
if (event.feature.get('siteid') === undefined) {
let newid = getNewIdx(myNetworkLayer.getSource(), 'siteid');
let coordinates3857 = event.feature.getGeometry().getCoordinates();
let coordinates4326 = ol.proj.transform(
coordinates3857, 'EPSG:3857', 'EPSG:4326');
let antennaOptions = getAntennaOptions(
document.getElementById('opt_antennamodel').value);
event.feature.setProperties({
//site
'siteid': newid,
'sitename': 'new site ' + newid,
'longitude': coordinates4326[0],
'latitude': coordinates4326[1],
//tower
'height': '',
//property
'region': '',
'country': '',
'city': '',
'district': '',
'province': '',
'address': '',
'comments': '',
//radio
'technology': drawSite2G.getActive() ? '2G' : '4G',
'band': drawSite2G.getActive() ?
document.getElementById('opt_gsmband').value :
document.getElementById('opt_lteband').value,
'bandwidth': drawSite2G.getActive() ?
document.getElementById('opt_gsmbandwidth').value :
document.getElementById('opt_ltebandwidth').value,
'cellid': 10000 + parseInt(newid),
'lac': LAC,
'rfcn': '',
'rfid': '',
'dlfrequency': '',
'ulfrequency': '',
'rfpower': '',
//antenna
'hba': '',
'azimuth': '0',
'antennamodel': antennaOptions.antennaModel,
'antennatype': antennaOptions.antennaType,
'polarization': antennaOptions.polarization,
'vbeamwidth': antennaOptions.vBeamWidth,
'hbeamwidth': antennaOptions.hBeamWidth,
'downtilt': antennaOptions.downTilt,
'antennagain': antennaOptions.antennaGain,
'feederloss': '0'
});
loadSitesTreeFromSource();
document.getElementById('siteOptionsFrame').contentWindow.refreshSiteData('add');
}
});
function getSiteDataByIdx(Idx) {
return getDataByIdx(myNetworkLayer.getSource(), Idx);
}
function getSiteIdxById(siteid) {
return getIdxById(myNetworkLayer.getSource(), 'siteid', siteid);
}
function getSiteDataById(siteid) {
return getSiteDataByIdx(getSiteIdxById(siteid));
}
function zoomToSiteByIdx(Idx) {
zoomToFeatureByIdx(myNetworkLayer.getSource(), Idx);
}
function updateSiteDataByIdx(options) {
if (options.idx) {
if (Number(options.idx) > -1) {
let feature = myNetworkLayer.getSource().getFeatures()[options.idx];
//site
feature.set('sitename', options.sitename.toString());
feature.set('longitude', options.longitude.toString());
feature.set('latitude', options.latitude.toString());
//tower
feature.set('height', options.height.toString());
//property
feature.set('region', options.region.toString());
feature.set('country', options.country.toString());
feature.set('city', options.city.toString());
feature.set('district', options.district.toString());
feature.set('province', options.province.toString());
feature.set('address', options.address.toString());
feature.set('comments', options.comments.toString());
//radio
feature.set('technology', options.technology.toString());
feature.set('band', options.band.toString());
feature.set('bandwidth', options.bandwidth.toString());
feature.set('cellid', options.cellid.toString());
feature.set('lac', options.lac.toString());
feature.set('rfcn', options.rfcn.toString());
feature.set('rfid', options.rfid.toString());
feature.set('dlfrequency', options.dlfrequency.toString());
feature.set('ulfrequency', options.ulfrequency.toString());
feature.set('rfpower', options.rfpower.toString());
//antenna
feature.set('hba', options.hba.toString());
feature.set('azimuth', options.azimuth.toString());
feature.set('antennamodel', options.antennamodel.toString());
feature.set('antennatype', options.antennatype.toString());
feature.set('polarization', options.polarization.toString());
feature.set('vbeamwidth', options.vbeamwidth.toString());
feature.set('hbeamwidth', options.hbeamwidth.toString());
feature.set('downtilt', options.downtilt.toString());
feature.set('antennagain', options.antennagain.toString());
feature.set('feederloss', options.feederloss.toString());
//geometry
feature.set('geometry', new ol.geom.Point(ol.proj.fromLonLat(
[Number(options.longitude), Number(options.latitude)])));
myMap.render();
loadSitesTreeFromSource();
}
}
}
function getSitesCount() {
return getFeaturesCount(myNetworkLayer.getSource());
}
function deleteSiteByIdx(Idx) {
let siteData = getSiteDataByIdx(Idx);
if (siteData) { deleteLinksBySiteId(siteData[0].toString()); }
deleteFeatureByIdx(myNetworkLayer.getSource(), Idx);
loadSitesTreeFromSource();
clearInteractions();
}
function downloadSitesCSV(e) {
if (e) { e.stopPropagation(); }
if (actionRunning) { return; }
showProgress('Exporting CSV');
setTimeout(function () {
download.CSV(myNetworkLayer.getSource(), 'mynetwork');
closeProgress();
}, 500);
}
function downloadSitesJson(e) {
if (e) { e.stopPropagation(); }
if (actionRunning) { return; }
showProgress('Exporting JSON');
setTimeout(function () {
download.JSON(myNetworkLayer.getSource(), 'mynetwork');
closeProgress();
}, 500);
}
function downloadSitesKML(e) {
if (e) { e.stopPropagation(); }
if (actionRunning) { return; }
showProgress('Exporting KML');
setTimeout(function () {
download.KML(myNetworkLayer.getSource(), 'mynetwork');
closeProgress();
}, 500);
}
function getAntennaOptions(antennaModel) {
let Options;
switch (antennaModel.toString()) {
case 'LT OD9-5 890-950 MHz':
Options = {
antennaModel: 'LT OD9-5 890-950 MHz',
antennaType: 'Omni',
polarization: 'Vertical',
vBeamWidth: '36',
hBeamWidth: '360',
downTilt: '0',
antennaGain: '5'
};
break;
case 'LT OD9-6 865-945 MHz':
Options = {
antennaModel: 'LT OD9-6 865-945 MHz',
antennaType: 'Omni',
polarization: 'Vertical',
vBeamWidth: '16',
hBeamWidth: '360',
downTilt: '0',
antennaGain: '6'
};
break;
case 'LT OD9-6 860-960 MHz':
Options = {
antennaModel: 'LT OD9-6 860-960 MHz',
antennaType: 'Omni',
polarization: 'Vertical',
vBeamWidth: '16',
hBeamWidth: '360',
downTilt: '0',
antennaGain: '6'
};
break;
case 'LT OD9-8 865-945 MHz':
Options = {
antennaModel: 'LT OD9-8 865-945 MHz',
antennaType: 'Omni',
polarization: 'Vertical',
vBeamWidth: '10',
hBeamWidth: '360',
downTilt: '0',
antennaGain: '8'
};
break;
case 'LT OD9-8 860-960 MHz':
Options = {
antennaModel: 'LT OD9-8 860-960 MHz',
antennaType: 'Omni',
polarization: 'Vertical',
vBeamWidth: '10',
hBeamWidth: '360',
downTilt: '0',
antennaGain: '8'
};
break;
case 'LT OD9-11 860-960 MHz':
Options = {
antennaModel: 'LT OD9-11 860-960 MHz',
antennaType: 'Omni',
polarization: 'Vertical',
vBeamWidth: '7',
hBeamWidth: '360',
downTilt: '0',
antennaGain: '11'
};
break;
case 'LT OD9-11D1 860-960 MHz':
Options = {
antennaModel: 'LT OD9-11D1 860-960 MHz',
antennaType: 'Omni',
polarization: 'Vertical',
vBeamWidth: '7',
hBeamWidth: '360',
downTilt: '1',
antennaGain: '11'
};
break;
default:
Options = {
antennaModel: 'LT OD9-5 890-950 MHz',
antennaType: 'Omni',
polarization: 'Vertical',
vBeamWidth: '36',
hBeamWidth: '360',
downTilt: '0',
antennaGain: '5'
};
break;
}
return Options;
}

View File

@@ -0,0 +1,140 @@
$('#notesDiv').collapse({
toggle: true
});
var notesTree = document.getElementById('notesUl');
initSingleSlider(document.getElementById('notesOpacity'), '', '0', '1', '0.1', '1');
document.getElementById('notesOpacity').addEventListener('change', setNotesStyle);
loadNotesTreeFromFile();
/* note functions*/
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({
scale: 1,
src: '../img/notePublic.png',
opacity: noteOpacity
}) : new ol.style.Icon({
scale: 1,
src: '../img/notePrivate.png',
opacity: noteOpacity
}),
text: new ol.style.Text({
offsetY: 25,
text: 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 })
})
})];
};
myNotesLayer.setStyle(custStyle);
myMap.render();
}
function loadNotesTreeFromFile() {
let httpRequest = new XMLHttpRequest();
httpRequest.open('GET', '../' + vectorsPath + 'mynotes.geojson', true);
httpRequest.send();
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 loadNotesTreeFromSource() {
let features = myNotesLayer.getSource().getFeatures();
notesTree.innerHTML = '';
for (let i = 0; i < features.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>';
}
}
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('noteOptionsFrame').contentWindow.userDisplay = true;
document.getElementById('noteOptionsFrame').contentWindow.refreshNoteData('', Idx);
setDialogZIndex(null, 'noteOptions');
}
myNotesLayer.getSource().on('addfeature', function (event) {
if (event.feature.get('noteid') === undefined) {
let newid = getNewIdx(myNotesLayer.getSource(), 'noteid');
event.feature.setProperties({
'noteid': newid,
'notename': 'new note ' + newid,
'notetype': 'Private',
'description': 'new note'
});
loadNotesTreeFromSource();
document.getElementById('noteOptionsFrame').contentWindow.refreshNoteData('add');
}
});
function getNoteDataByIdx(Idx) {
return getDataByIdx(myNotesLayer.getSource(), Idx);
}
function getNoteIdxById(noteid) {
return getIdxById(myNotesLayer.getSource(), 'noteid', noteid);
}
function zoomToNoteByIdx(Idx) {
zoomToFeatureByIdx(myNotesLayer.getSource(), Idx);
}
function updateNoteDataByIdx(Idx, notename, notetype, description) {
if (Idx) {
if (Number(Idx) > -1) {
let feature = myNotesLayer.getSource().getFeatures()[Idx];
feature.set('notename', notename.toString());
feature.set('notetype', notetype.toString());
feature.set('description', description.toString());
myMap.render();
loadNotesTreeFromSource();
}
}
}
function getNotesCount() {
return getFeaturesCount(myNotesLayer.getSource());
}
function deleteNoteByIdx(Idx) {
deleteFeatureByIdx(myNotesLayer.getSource(), Idx);
loadNotesTreeFromSource();
clearInteractions();
}
function downloadNotesCSV(e) {
if (e) { e.stopPropagation(); }
if (actionRunning) { return; }
showProgress('Exporting CSV');
setTimeout(function () {
download.CSV(myNotesLayer.getSource(), 'mynotes');
closeProgress();
}, 500);
}
function downloadNotesJson(e) {
if (e) { e.stopPropagation(); }
if (actionRunning) { return; }
showProgress('Exporting JSON');
setTimeout(function () {
download.JSON(myNotesLayer.getSource(), 'mynotes');
closeProgress();
}, 500);
}
function downloadNotesKML(e) {
if (e) { e.stopPropagation(); }
if (actionRunning) { return; }
showProgress('Exporting KML');
setTimeout(function () {
download.KML(myNotesLayer.getSource(), 'mynotes');
closeProgress();
}, 500);
}

View File

@@ -0,0 +1,181 @@
$('#polygonsDiv').collapse({
toggle: true
});
var polygonsTree = document.getElementById('polygonsUl');
var fileupload = document.getElementById("FileUpload1");
var button = document.getElementById("btnFileUpload");
button.onclick = function () {
fileupload.click();
};
fileupload.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("Polygon Upload", "Please provide polygons in Geojson format.");
}
else {
reader.readAsText(file, "UTF-8");
reader.onload = function (evt) {
showProgress('Loading Polygons');
setTimeout(function () {
// save current polygons
uploadDataToUrl(myPolygonsLayer.getSource().getJSONString(),
vectorsPath + 'mypolygons.geojson');
Ajax_runccmd("UploadPolygonsToDB", "");
myMap.render();
loadPolygonsTreeFromFile();
// load user polygons
uploadDataToUrl(evt.target.result,
vectorsPath + "t" + filename);
Ajax_runccmd("UploadUserPolygonsToDB",
"{'polygonname':'t" + filename + "'}");
// reload polygons from server
Ajax_runccmd("GetPolygonsFromDB", "");
Ajax_loadSourceFromFile(myPolygonsLayer.getSource(),
"../" + vectorsPath + "mypolygons.geojson");
myMap.render();
loadPolygonsTreeFromFile();
closeProgress();
}, 500);
};
}
fileupload.value = null;
}
};
initSingleSlider(document.getElementById('polygonsFillOpacity'), '', '0', '1', '0.1', '0.2');
initSingleSlider(document.getElementById('polygonsStrokeOpacity'), '', '0', '1', '0.1', '1');
document.getElementById('polygonsFillOpacity').addEventListener('change', setPolygonsStyle);
document.getElementById('polygonsStrokeOpacity').addEventListener('change', setPolygonsStyle);
loadPolygonsTreeFromFile();
/* polygon functions*/
function setPolygonsStyle(e) {
if (e) { e.stopPropagation(); }
let custStyle = function (feature) {
let fillOpacity = Number($('#polygonsFillOpacity').val());
let strokeOpacity = Number($('#polygonsStrokeOpacity').val());
return [new ol.style.Style({
fill: new ol.style.Fill({
color: colorWithAlpha('#ffffff', fillOpacity)
}),
stroke: new ol.style.Stroke({
color: colorWithAlpha('#ffcc33', strokeOpacity),
width: 3
}),
text: new ol.style.Text({
text: 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 })
})
})];
};
myPolygonsLayer.setStyle(custStyle);
myMap.render();
}
function loadPolygonsTreeFromFile() {
let httpRequest = new XMLHttpRequest();
httpRequest.open('GET', '../' + vectorsPath + 'mypolygons.geojson', true);
httpRequest.send();
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 loadPolygonsTreeFromSource() {
let features = myPolygonsLayer.getSource().getFeatures();
polygonsTree.innerHTML = '';
for (let i = 0; i < features.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>';
}
}
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('polyOptionsFrame').contentWindow.userDisplay = true;
document.getElementById('polyOptionsFrame').contentWindow.refreshPolygonData('', Idx);
setDialogZIndex(null, 'polyOptions');
}
myPolygonsLayer.getSource().on('addfeature', function (event) {
if (event.feature.get('polygonid') === undefined) {
let newid = getNewIdx(myPolygonsLayer.getSource(), 'polygonid');
event.feature.setProperties({ 'polygonid': newid, 'polygonname': 'new polygon ' + newid });
loadPolygonsTreeFromSource();
document.getElementById('polyOptionsFrame').contentWindow.refreshPolygonData('add');
}
});
function getPolygonDataByIdx(Idx) {
return getDataByIdx(myPolygonsLayer.getSource(), Idx);
}
function getPolygonIdxById(polygonid) {
return getIdxById(myPolygonsLayer.getSource(), 'polygonid', polygonid);
}
function zoomToPolygonByIdx(Idx) {
zoomToFeatureByIdx(myPolygonsLayer.getSource(), Idx);
}
function updatePolygonDataByIdx(Idx, polygonname) {
if (Idx) {
if (Number(Idx) > -1) {
let feature = myPolygonsLayer.getSource().getFeatures()[Idx];
feature.set('polygonname', polygonname.toString());
myMap.render();
loadPolygonsTreeFromSource();
}
}
}
function getPolygonsCount() {
return getFeaturesCount(myPolygonsLayer.getSource());
}
function deletePolygonByIdx(Idx) {
deleteFeatureByIdx(myPolygonsLayer.getSource(), Idx);
loadPolygonsTreeFromSource();
clearInteractions();
}
function downloadPolygonsCSV(e) {
if (e) { e.stopPropagation(); }
if (actionRunning) { return; }
showProgress('Exporting CSV');
setTimeout(function () {
download.CSV(myPolygonsLayer.getSource(), 'mypolygons');
closeProgress();
}, 500);
}
function downloadPolygonsJson(e) {
if (e) { e.stopPropagation(); }
if (actionRunning) { return; }
showProgress('Exporting JSON');
setTimeout(function () {
download.JSON(myPolygonsLayer.getSource(), 'mypolygons');
closeProgress();
}, 500);
}
function downloadPolygonsKML(e) {
if (e) { e.stopPropagation(); }
if (actionRunning) { return; }
showProgress('Exporting KML');
setTimeout(function () {
download.KML(myPolygonsLayer.getSource(), 'mypolygons');
closeProgress();
}, 500);
}

View File

@@ -0,0 +1,333 @@
$('#resultsDiv').collapse({
toggle: true
});
var raster;
var resultsTree = document.getElementById('resultsUl');
initSingleSlider(document.getElementById('rasterOpacity'), '', '0', '1', '0.1', '0.8');
document.getElementById('rasterOpacity').addEventListener('change', setRasterStyle);
loadResultsTreeFromFile();
/* polygon functions*/
function setRasterVisiblity() {
if (raster) {
if (document.getElementById("rasterVisibility").checked === true) {
raster.setVisible(true);
} else {
raster.setVisible(false);
}
myMap.render();
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.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 loadResultsTreeFromSource() {
let features = resultsLayer.getSource().getFeatures();
resultsTree.innerHTML = '';
for (let i = 0; i < 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(features[i].getProperties().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>';
}
}
var deleteResultIdx = null;
function deleteResultByIdx(e, Idx) {
if (e) { e.stopPropagation(); }
if (getActionRunning()) { return; }
deleteResultIdx = Idx;
document.getElementById("yesMessageBox").addEventListener("click", deleteResult);
document.getElementById("okcancelMessageBox").addEventListener("click", removeDeleteResult);
let feature = resultsLayer.getSource().getFeatures()[deleteResultIdx];
showMessage('Delete Result', 'Are you sure you want to permanently delete<br/>&nbsp;&nbsp;&nbsp;"'
+ feature.get('resultname') + '" ?', true);
}
function removeDeleteResult() {
document.getElementById("yesMessageBox").removeEventListener("click", deleteResult);
document.getElementById("okcancelMessageBox").removeEventListener("click", removeDeleteResult);
}
function deleteResult() {
showProgress('Deleting Result');
setTimeout(function () {
let feature = resultsLayer.getSource().getFeatures()[deleteResultIdx];
let result = feature.get('resultstring').split('>');
let pngString = result[1];
let polygonsString = result[2];
let pngs = [];
pngs.push(pngString.split(',')[0]);
if (polygonsString.length > 0) {
polygonsString.split('@').forEach(function (ps) {
pngs.push(ps.split('#')[2].split(',')[0]);
});
}
pngs = [...new Set(pngs)];
Ajax_runccmd("DeleteResult", "{'resultid':'" +
feature.get('resultid') + "','pngs':'" + pngs.join(',') + "'}");
loadResultsFromDB();
deleteResultIdx = null;
document.getElementById("yesMessageBox").removeEventListener("click", deleteResult);
document.getElementById("okcancelMessageBox").removeEventListener("click", removeDeleteResult);
closeProgress();
}, 500);
}
function showResultByIdx(e, Idx) {
if (e) { e.stopPropagation(); }
if (actionRunning) { return; }
showResult(resultsLayer.getSource().getFeatures()[Idx].get('resultstring'));
}
function showResult(resultstring) {
if (resultstring) {
if (resultstring.length == 0) {
return;
}
let result = resultstring.split('>');
let thematicString = result[0];
let pngString = result[1];
let polygonsString = result[2];
setLegend(thematicString);
if (polygonsString.length === 0) {
loadRaster(pngString);
}
showPolygonsCoverageReport(polygonsString);
}
}
function loadResultsFromDB() {
Ajax_runccmd("GetResultsFromDB", "");
Ajax_loadSourceFromFile(resultsLayer.getSource(),
"../" + vectorsPath + "results.geojson");
loadResultsTreeFromSource();
}
function loadRaster(pngString) {
// ,&$#@>
// result : thematicString>pngString>polygonsString@polygonsString
// thematicString
// rate&r,g,b$rate&r,g,b
// pngString
// png,1,2,3,4
// polygonsString
// polygonid,polygonname#siteid,sitename#png,1,2,3,4#cttrue,ctext1234#rate&value&r,g,b$rate&value&r,g,b#bestcandidate
if (pngString) {
if (pngString.length > 0) {
let png = pngString.split(',');
let extent = [png[1], png[2], png[3], png[4]];
if (raster) {
overlayLayers.getLayers().pop(raster);
}
raster = new ol.layer.Image({
title: 'Result',
visible: true,
name: 'Result',
opacity: 0.8,
crossOrigin: '',
source: new ol.source.ImageStatic({
url: '../' + resultsPath + png[0],
imageExtent: extent,
projection: 'EPSG:4326'
})
});
document.getElementById('rasterOpacity').setValue('0.8');
overlayLayers.getLayers().push(raster);
myNetworkLayer.setZIndex(9);
publicNetworkLayer.setZIndex(6);
myLinksLayer.setZIndex(5);
myNotesLayer.setZIndex(4);
publicNotesLayer.setZIndex(3);
myPolygonsLayer.setZIndex(2);
raster.setZIndex(1);
myMap.updateSize();
myMap.render();
document.getElementById("rasterVisibility").checked = true;
ol.control.LayerSwitcher.renderPanel(myMap, toc);
}
}
}
function showPolygonsCoverageReport(polygonsString) {
// ,&$#@>
// result : thematicString>pngString>polygonsString@polygonsString
// thematicString
// rate&r,g,b$rate&r,g,b
// pngString
// png,1,2,3,4
// polygonsString
// polygonid,polygonname#siteid,sitename#png,1,2,3,4#cttrue,ctext1234#rate&value&r,g,b$rate&value&r,g,b#bestcandidate
if (polygonsString) {
if (polygonsString.length > 0) {
let loadObj = []; let i = 0; let bestCandidate = 0; let bestCandidateCT = 0;
let reportTitle = 'Polygons Coverage Report';
polygonsString.split('@').forEach(function (ps) {
if (i < 20) {
let coverageTestExt = Number(ps.split('#')[3].split(',')[1]);
if (bestCandidateCT < coverageTestExt) {
bestCandidateCT = coverageTestExt;
bestCandidate = i;
}
i += 1;
}
});
i = 0;
polygonsString.split('@').forEach(function (ps) {
if (i < 20) {
let polygonid = ps.split('#')[0].split(',')[0];
let polygonname = ps.split('#')[0].split(',')[1];
let sites = ps.split('#')[1].split('&');
let siteids = '', sitenames = '';
sites.forEach(function (site) {
siteids += site.split(',')[0] + ', ';
sitenames += site.split(',')[1] + ', ';
});
siteids = siteids.substr(0, siteids.length - 2);
sitenames = sitenames.substr(0, sitenames.length - 2);
let pngString = ps.split('#')[2];
let coverageTest = ps.split('#')[3].split(',')[0];
let coverageTestExt = ps.split('#')[3].split(',')[1];
let dataString = ps.split('#')[4];
let bestCandidateType = ps.split('#')[5];
let tabTitle = '';
coverageTest =
coverageTest.toLowerCase() === 'true' ? 'Coverage Test: <b>Passed</b>' :
coverageTest.toLowerCase() === 'false' ? 'Coverage Test: <b>Failed</b>' :
coverageTest.toLowerCase() === 'n/a' ? 'Coverage Test: <b>Not Applicable</b>' :
'Coverage Test: <b>Failed</b>';
if (bestCandidateType !== '') {
if (bestCandidate === i) {
coverageTest = '<span style="color: #000000; background-color: #ffff00;"><strong>&lt;Best Candidate&gt;</strong></span>' + ' <b>' + polygonname + '</b>, <b>' + sitenames + '</b>, ' + coverageTest;
} else {
coverageTest = '<b>' + polygonname + '</b>, <b>' + sitenames + '</b>, ' + coverageTest;
}
tabTitle = 'Polygon Id: ' + polygonid + ', Site Id: ' + siteids;
reportTitle = 'Best Candidate Report';
} else {
coverageTest = 'Site Ids: <b>' + siteids + '</b>, ' + coverageTest;
tabTitle = 'Polygon Id: ' + polygonid + ', ' + polygonname;
}
loadObj.push({
title: tabTitle,
contentType: 'chart', contentTitle: coverageTest,
contentPadding: '0', dataString: dataString,
pngString: pngString
});
i += 1;
}
});
ddsCreate(reportTitle, loadObj);
}
}
}

View File

@@ -0,0 +1,196 @@
$('#coverage').collapse({
toggle: true
});
$('#radioOptions').collapse({
toggle: true
});
// initialize controls
initSelectOpt(document.getElementById('opt_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');
initSingleSlider(document.getElementById('opt_cellradius'), '', '0.5', '3', '0.1', '1');
initSelectOpt(document.getElementById('opt_gsmband'), '100%', 'GSM900 PGSM', 'GSM900 PGSM');
initSelectOpt(document.getElementById('opt_gsmbandwidth'), '100%', '0.2', '0.2');
initSelectOpt(document.getElementById('opt_lteband'), '100%', 'B08_FDD_900 E-GSM', 'B08_FDD_900 E-GSM');
initSelectOpt(document.getElementById('opt_ltebandwidth'), '100%', '1.4\t3\t5\t10', '10');
initSingleSlider(document.getElementById('opt_frequency'), '', '1', '15', '0.1', '5');
initSelectOpt(document.getElementById('opt_channelwidth'), '100%', '10\t20\t30\t40\t50\t60\t80\t100', '20');
initSingleSlider(document.getElementById('opt_outputpower'), '', '27', '47', '0.5', '47');
initSingleSlider(document.getElementById('opt_antennagain'), '', '19', '51', '0.1', '22.5');
initSingleSlider(document.getElementById('opt_losses'), '', '0', '51', '0.1', '0');
initSingleSlider(document.getElementById('opt_fresnelclearance'), '', '60', '100', '5', '60');
initSelectOpt(document.getElementById('opt_measurementtype'), '100%', 'Path Loss (dB)\tReceived Power (dBm)\tField Strength (dBµV/m)\tSNR (dB)\tVoice Quality Score\tData Rate Score', 'Path Loss (dB)');
initSelectOpt(document.getElementById('opt_terrainresolution'), '100%', '90m\t30m', '90m');
initSelectOpt(document.getElementById('opt_thematic'), '100%', 'default', 'default');
initSingleSlider(document.getElementById('opt_radius'), '', '0.5', '5', '0.1', '1');
initSelectOpt(document.getElementById('opt_propagationmodel'), '100%', 'ITM / Longley-Rice (< 20GHz)\tITWOM 3.0 (< 20GHz)', 'ITM / Longley-Rice (< 20GHz)');
initSingleSlider(document.getElementById('opt_reliabilitys'), '', '0', '99', '1', '1');
initSingleSlider(document.getElementById('opt_reliabilityt'), '', '0', '99', '1', '1');
initSelectOpt(document.getElementById('opt_terrainconductivity'), '100%', 'Salt water\tGood ground\tFresh water\tMarshy land\tFarm land\tForest\tAverage ground\tMountain / Sand\tCity\tPoor ground', 'Average ground');
initSelectOpt(document.getElementById('opt_radioclimate'), '100%', 'Equatorial (Congo)\tContinental Subtropical (Sudan)\tMaritime Subtropical (W. Africa)\tDesert (Sahara)\tContinental Temperate\tMaritime Temperate (Land)\tMaritime Temperate (Sea)', 'Continental Temperate');
initSingleSlider(document.getElementById('opt_receiverheight'), '', '0.1', '5', '0.1', '1.5');
initSingleSlider(document.getElementById('opt_receivergain'), '', '0', '5', '0.01', '2.14');
initSingleSlider(document.getElementById('opt_receiversensitivity'), '', '-140', '-40', '1', '-90');
document.getElementById('opt_lteband').addEventListener('change', setLTEBandwidths);
loadSettings();
/* settings functions*/
function setLTEBandwidths(e) {
if (e) { e.stopPropagation(); }
let ltebandwidth;
switch (document.getElementById('opt_lteband').value) {
case 'B01_FDD_2100 IMT': ltebandwidth = '5\t10\t15\t20'; break;
case 'B02_FDD_1900 PCS': ltebandwidth = '1.4\t3\t5\t10\t15\t20'; break;
case 'B03_FDD_1800 (+) DCS': ltebandwidth = '1.4\t3\t5\t10\t15\t20'; break;
case 'B04_FDD_1700 AWS-1': ltebandwidth = '1.4\t3\t5\t10\t15\t20'; break;
case 'B05_FDD_850 Cellular': ltebandwidth = '1.4\t3\t5\t10'; break;
case 'B06_FDD_850 UMTS only': ltebandwidth = '5\t10'; break;
case 'B07_FDD_2600 E-IMT': ltebandwidth = '5\t10\t15\t20'; break;
case 'B08_FDD_900 E-GSM': ltebandwidth = '1.4\t3\t5\t10'; break;
case 'B09_FDD_1800': ltebandwidth = '5\t10\t15\t20'; break;
case 'B10_FDD_1700 AWS-1+': ltebandwidth = '5\t10\t15\t20'; break;
case 'B11_FDD_1500 Lower PDC': ltebandwidth = '5\t10'; break;
case 'B12_FDD_700 a Lower SMH': ltebandwidth = '1.4\t3\t5\t10'; break;
case 'B13_FDD_700 c Upper SMH': ltebandwidth = '5\t10'; break;
case 'B14_FDD_700 PS Upper SMH': ltebandwidth = '5\t10'; break;
case 'B17_FDD_700 b Lower SMH': ltebandwidth = '5\t10'; break;
case 'B18_FDD_800 Lower (Japan)': ltebandwidth = '5\t10\t15'; break;
case 'B19_FDD_800 Upper (Japan)': ltebandwidth = '5\t10\t15'; break;
case 'B20_FDD_800 Digital Div... (EU)': ltebandwidth = '5\t10\t15\t20'; break;
case 'B21_FDD_1500 Upper PDC': ltebandwidth = '5\t10\t15'; break;
case 'B22_FDD_3500': ltebandwidth = '5\t10\t15\t20'; break;
case 'B23_FDD_2000 S-band': ltebandwidth = '1.4\t3\t5\t10\t15\t20'; break;
case 'B24_FDD_1600 Upper L-band (US)': ltebandwidth = '5\t10'; break;
case 'B25_FDD_1900 (+) E-PCS': ltebandwidth = '1.4\t3\t5\t10\t15\t20'; break;
case 'B26_FDD_850 (+) E-Cellular': ltebandwidth = '1.4\t3\t5\t10\t15'; break;
case 'B27_FDD_800 SMR': ltebandwidth = '1.4\t3\t5\t10'; break;
case 'B28_FDD_700 APT': ltebandwidth = '3\t5\t10\t15\t20'; break;
case 'B29_SDL_700 d Lower SMH': ltebandwidth = '3\t5\t10'; break;
case 'B30_FDD_2300 WCS': ltebandwidth = '5\t10'; break;
case 'B31_FDD_450 NMT': ltebandwidth = '1.4\t3\t5'; break;
case 'B32_SDL_1500 L-band (EU)': ltebandwidth = '5\t10\t15\t20'; break;
case 'B33_TDD_1900': ltebandwidth = '5\t10\t15\t20'; break;
case 'B34_TDD_2000 IMT': ltebandwidth = '5\t10\t15'; break;
case 'B35_TDD_1900 PCS Lower': ltebandwidth = '1.4\t3\t5\t10\t15\t20'; break;
case 'B36_TDD_1900 PCS Upper': ltebandwidth = '1.4\t3\t5\t10\t15\t20'; break;
case 'B37_TDD_1900 PCS Center gap': ltebandwidth = '5\t10\t15\t20'; break;
case 'B38_TDD_2600 E-IMT': ltebandwidth = '5\t10\t15\t20'; break;
case 'B39_TDD_1900 (+) DCS-IMT Gap': ltebandwidth = '5\t10\t15\t20'; break;
case 'B40_TDD_2300 S-Band': ltebandwidth = '5\t10\t15\t20'; break;
case 'B41_TDD_2600 (+) BRS': ltebandwidth = '5\t10\t15\t20'; break;
case 'B42_TDD_3500 CBRS (EU/Japan)': ltebandwidth = '5\t10\t15\t20'; break;
case 'B43_TDD_3700 C-Band': ltebandwidth = '5\t10\t15\t20'; break;
case 'B44_TDD_700 APT': ltebandwidth = '3\t5\t10\t15\t20'; break;
case 'B45_TDD_1500': ltebandwidth = '5\t10\t15\t20'; break;
case 'B46_TDD_5200 Unlicensed U-NII': ltebandwidth = '10\t20'; break;
case 'B47_TDD_5900 V2X U-NII4': ltebandwidth = '10\t20'; break;
case 'B48_TDD_3600 CBRS (US)': ltebandwidth = '5\t10\t15\t20'; break;
case 'B49_TDD_3600 (r) C-Band': ltebandwidth = '10\t20'; break;
case 'B50_TDD_1500 (+) L-Band (EU)': ltebandwidth = '3\t5\t10\t15\t20'; break;
case 'B51_TDD_1500 (-) E-(L-Band) (EU)': ltebandwidth = '3\t5'; break;
case 'B52_TDD_3300 C-Band': ltebandwidth = '5\t10\t15\t20'; break;
case 'B53_TDD_2500 S-Band': ltebandwidth = '1.4\t3\t5\t10'; break;
case 'B65_FDD_2100 (+) E-IMT': ltebandwidth = '1.4\t3\t5\t10\t15\t20'; break;
case 'B66_FDD_1700 AWS-3 E-AWS': ltebandwidth = '1.4\t3\t5\t10\t15\t20'; break;
case 'B67_SDL_700 (EU)': ltebandwidth = '5\t10\t15\t20'; break;
case 'B68_FDD_700 (ME)': ltebandwidth = '5\t10\t15'; break;
case 'B69_SDL_2500 DL E-IMT': ltebandwidth = '5\t10\t15\t20'; break;
case 'B70_FDD_1700 AWS-4 Supp...': ltebandwidth = '5\t10\t15\t20'; break;
case 'B71_FDD_600 Digital Dividend': ltebandwidth = '5\t10\t15\t20'; break;
case 'B72_FDD_450 PMR/PAMR (EU)': ltebandwidth = '1.4\t3\t5'; break;
case 'B73_FDD_450 APAC PMT (APT)': ltebandwidth = '1.4\t3\t5'; break;
case 'B74_FDD_1500 Lower LBand (US)': ltebandwidth = '1.4\t3\t5\t10\t15\t20'; break;
case 'B75_SDL_1500 (+) DL L-Band (EU)': ltebandwidth = '5\t10\t15\t20'; break;
case 'B76_SDL_1500 (-) DL E-(L-B) (EU)': ltebandwidth = '5\t10\t15\t20'; break;
case 'B85_FDD_700 a+ E-Lower SMH': ltebandwidth = '5\t10'; break;
case 'B87_FDD_410 PMR (APT)': ltebandwidth = '1.4\t3\t5'; break;
case 'B88_FDD_410 (+) PMR (EU)': ltebandwidth = '1.4\t3\t5'; break;
default: ltebandwidth = '1.4\t3\t5\t10\t15\t20'; break;
}
document.getElementById('opt_ltebandwidth').reloadOpt(ltebandwidth);
}
function loadSettings() {
let settings = Ajax_runccmd("GetSettings", "").split('\t');
document.getElementById('opt_measurementtype').setOpt(settings[1]);
document.getElementById('opt_terrainresolution').setOpt(settings[2]);
document.getElementById('opt_thematic').setOpt(settings[3]);
document.getElementById('opt_radius').setValue(settings[4]);
document.getElementById('opt_propagationmodel').setOpt(settings[5]);
document.getElementById('opt_reliabilitys').setValue(settings[6]);
document.getElementById('opt_reliabilityt').setValue(settings[7]);
document.getElementById('opt_terrainconductivity').setOpt(settings[8]);
document.getElementById('opt_radioclimate').setOpt(settings[9]);
document.getElementById('opt_receiverheight').setValue(settings[10]);
document.getElementById('opt_receivergain').setValue(settings[11]);
document.getElementById('opt_receiversensitivity').setValue(settings[12]);
document.getElementById('opt_antennamodel').setOpt(settings[13]);
document.getElementById('opt_cellradius').setValue(settings[14]);
document.getElementById('opt_gsmband').setOpt(settings[15]);
document.getElementById('opt_gsmbandwidth').setOpt(settings[16]);
document.getElementById('opt_lteband').setOpt(settings[17]);
document.getElementById('opt_ltebandwidth').setOpt(settings[18]);
document.getElementById('opt_frequency').setValue(settings[19]);
document.getElementById('opt_channelwidth').setOpt(settings[20]);
document.getElementById('opt_outputpower').setValue(settings[21]);
document.getElementById('opt_antennagain').setValue(settings[22]);
document.getElementById('opt_losses').setValue(settings[23]);
document.getElementById('opt_fresnelclearance').setValue(settings[24]);
}
function saveSettings(e) {
if (e) { e.stopPropagation(); }
if (getActionRunning()) { return; }
showProgress('Saving Settings');
setTimeout(function () {
_saveSettings();
closeProgress();
}, 500);
}
function _saveSettings() {
let pl_measurementtype = document.getElementById('opt_measurementtype').value;
let pl_terrainresolution = document.getElementById('opt_terrainresolution').value;
let pl_thematic = document.getElementById('opt_thematic').value;
let pl_radius = document.getElementById('opt_radius').value;
let pl_propagationmodel = document.getElementById('opt_propagationmodel').value;
let pl_reliabilitys = document.getElementById('opt_reliabilitys').value;
let pl_reliabilityt = document.getElementById('opt_reliabilityt').value;
let pl_terrainconductivity = document.getElementById('opt_terrainconductivity').value;
let pl_radioclimate = document.getElementById('opt_radioclimate').value;
let pl_receiverheight = document.getElementById('opt_receiverheight').value;
let pl_receivergain = document.getElementById('opt_receivergain').value;
let pl_receiversensitivity = document.getElementById('opt_receiversensitivity').value;
let rp_antennamodel = document.getElementById('opt_antennamodel').value;
let rp_cellradius = document.getElementById('opt_cellradius').value;
let rp_gsmband = document.getElementById('opt_gsmband').value;
let rp_gsmbandwidth = document.getElementById('opt_gsmbandwidth').value;
let rp_lteband = document.getElementById('opt_lteband').value;
let rp_ltebandwidth = document.getElementById('opt_ltebandwidth').value;
let mw_frequency = document.getElementById('opt_frequency').value;
let mw_channelwidth = document.getElementById('opt_channelwidth').value;
let mw_outputpower = document.getElementById('opt_outputpower').value;
let mw_antennagain = document.getElementById('opt_antennagain').value;
let mw_losses = document.getElementById('opt_losses').value;
let mw_fresnelclearance = document.getElementById('opt_fresnelclearance').value;
Ajax_runccmd("SetSettings", "{'options':'" +
pl_measurementtype + "\t" +
pl_terrainresolution + "\t" +
pl_thematic + "\t" +
pl_radius + "\t" +
pl_propagationmodel + "\t" +
pl_reliabilitys + "\t" +
pl_reliabilityt + "\t" +
pl_terrainconductivity + "\t" +
pl_radioclimate + "\t" +
pl_receiverheight + "\t" +
pl_receivergain + "\t" +
pl_receiversensitivity + "\t" +
rp_antennamodel + "\t" +
rp_cellradius + "\t" +
rp_gsmband + "\t" +
rp_gsmbandwidth + "\t" +
rp_lteband + "\t" +
rp_ltebandwidth + "\t" +
mw_frequency + "\t" +
mw_channelwidth + "\t" +
mw_outputpower + "\t" +
mw_antennagain + "\t" +
mw_losses + "\t" +
mw_fresnelclearance + "'}");
}

View File

@@ -0,0 +1,346 @@
$('#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

@@ -0,0 +1,115 @@
// pointer move functionality
var highlightStyle = function (feature, layer) {
return [new ol.style.Style({
image: feature.get('sitename') === undefined ?
new ol.style.Icon({ scale: 1, src: '../img/note_highlight.png', opacity: 0.7 }) :
new ol.style.Icon({ scale: .6, src: '../img/site_highlight.png', opacity: 0.7 }),
stroke: new ol.style.Stroke({
color: 'rgba(0,255,0,0.7)',
width: 2
}),
fill: new ol.style.Fill({
color: 'rgba(0,255,0,0.1)'
})
})];
};
var highlightPointStyle = new ol.style.Style({
image: new ol.style.Circle({
radius: 5,
stroke: new ol.style.Stroke({
color: 'rgba(0,255,0,1)',
width: 5
}),
fill: new ol.style.Fill({
color: 'rgba(0,255,0,1)'
})
})
});
// ******interactions ***********************//
// Select style
var selectStyle = function (feature, layer) {
return [new ol.style.Style({
image: feature.get('sitename') === undefined ?
new ol.style.Icon({ scale: 1, src: '../img/note_selected.png', opacity: 0.7 }) :
new ol.style.Icon({ scale: .6, src: '../img/site_selected.png', opacity: 0.7 }),
text: new ol.style.Text({
offsetY: feature.get('sitename') === undefined && feature.get('notename') === undefined ? 0 : 25,
text: feature.get('sitename') === undefined ? feature.get('polygonname') === undefined ?
feature.get('linkname') === undefined ?
feature.get('notename') : feature.get('linkname') :
feature.get('polygonname') : 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: '#0099ff' }),
stroke: new ol.style.Stroke({ color: 'rgba(255, 255, 255, 0.2)', width: 3 })
}),
fill: new ol.style.Fill({
color: 'rgba(255, 255, 255, 0.2)'
}),
stroke: new ol.style.Stroke({
color: '#0099ff',
width: 2
})
})];
};
var drawSiteStyle = new ol.style.Style({
image: new ol.style.Icon({ scale: .6, src: '../img/site_selected.png', opacity: 0.7 })
});
var drawNoteStyle = new ol.style.Style({
image: new ol.style.Icon({ scale: 1, src: '../img/note_selected.png', opacity: 0.7 })
});
var drawLinkSiteStyle = new ol.style.Style({
image: new ol.style.Icon({ scale: .6, src: '../img/site_link_add.png', opacity: 0.7 })
});
var drawLinkLineStyle = new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'rgba(0, 255, 255, 1)',
lineDash: [10, 10],
width: 3
})
});
var drawPolygonStyle = new ol.style.Style({
image: new ol.style.Circle({
fill: new ol.style.Fill({
color: 'rgba(0, 153, 255, 1)'
}),
stroke: new ol.style.Stroke({
color: 'rgba(255, 255, 255, 0.8)',
width: 1.5
}),
radius: 6
}),
fill: new ol.style.Fill({
color: 'rgba(255, 255, 255, 0.7)'
}),
stroke: new ol.style.Stroke({
color: 'rgba(0, 153, 255, 1)',
lineDash: [10, 10],
width: 2
})
});
var deleteSiteStyle = new ol.style.Style({
image: new ol.style.Icon({ scale: 0.6, src: '../img/site_delete.png', opacity: 1 })
});
var deleteNoteStyle = new ol.style.Style({
image: new ol.style.Icon({ scale: 1.3, src: '../img/note_delete.png', opacity: 1 })
});
var deleteLinkStyle = new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'rgba(255, 0, 0, 1)',
lineDash: [7, 7],
width: 5
})
});
var deletePolygonStyle = new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'rgba(255,0,0,1)',
width: 3
}),
fill: new ol.style.Fill({
color: 'rgba(255,0,0,0.1)'
})
});

View File

@@ -0,0 +1,54 @@
var lyrBingMapsAerial = new ol.layer.Tile({
source: new ol.source.BingMaps({
imagerySet: 'Aerial',
key: 'AjabU18xKFl_N3WgLVzRwdDDjcaQTIftpixGXL3Dk93ucbLfm27eEdiQts5lQ0Bt',
crossOrigin: 'anonymous',
wrapX: false
}),
title: 'Aerial',
type: 'base',
visible: false
});
var lyrBingMapsAerialWithLabels = new ol.layer.Tile({
source: new ol.source.BingMaps({
imagerySet: 'AerialWithLabels',
key: 'AjabU18xKFl_N3WgLVzRwdDDjcaQTIftpixGXL3Dk93ucbLfm27eEdiQts5lQ0Bt',
crossOrigin: 'anonymous',
wrapX: false
}),
title: 'Aerial With Labels',
type: 'base',
visible: false
});
var lyrBingMapsRoad = new ol.layer.Tile({
source: new ol.source.BingMaps({
imagerySet: 'Road',
key: 'AjabU18xKFl_N3WgLVzRwdDDjcaQTIftpixGXL3Dk93ucbLfm27eEdiQts5lQ0Bt',
crossOrigin: 'anonymous',
wrapX: false
}),
title: 'Road',
type: 'base',
visible: false
});
var lyrBingMapsRoadOnDemand = new ol.layer.Tile({
source: new ol.source.BingMaps({
imagerySet: 'RoadOnDemand',
key: 'AjabU18xKFl_N3WgLVzRwdDDjcaQTIftpixGXL3Dk93ucbLfm27eEdiQts5lQ0Bt',
crossOrigin: 'anonymous',
wrapX: false
}),
title: 'Road On Demand',
type: 'base',
visible: false
});
var BingMapsLayers = new ol.layer.Group({
title: 'Bing Maps',
fold: 'close',
layers: [
lyrBingMapsRoadOnDemand,
lyrBingMapsRoad,
lyrBingMapsAerialWithLabels,
lyrBingMapsAerial
]
});

View File

@@ -0,0 +1,69 @@
var lyrGoogleMapsRoadNames = new ol.layer.Tile({
title: "Road Names",
source: new ol.source.TileImage({
url: 'http://mt1.google.com/vt/lyrs=h&x={x}&y={y}&z={z}',
wrapX: false}),
type: 'base',
visible: false
});
var lyrGoogleMapsRoadmap = new ol.layer.Tile({
title: "Road Map",
source: new ol.source.TileImage({
url: 'http://mt1.google.com/vt/lyrs=m&x={x}&y={y}&z={z}',
wrapX: false}),
type: 'base',
visible: false
});
var lyrGoogleMapsSatellite = new ol.layer.Tile({
title: "Satellite",
source: new ol.source.TileImage({
url: 'http://mt1.google.com/vt/lyrs=s&hl=pl&&x={x}&y={y}&z={z}',
wrapX: false }),
type: 'base',
visible: false
});
var lyrGoogleMapsHybrid = new ol.layer.Tile({
title: "Satellite & Roads",
source: new ol.source.TileImage({
url: 'http://mt1.google.com/vt/lyrs=y&x={x}&y={y}&z={z}',
wrapX: false}),
type: 'base',
visible: false
});
var lyrGoogleMapsTerrain = new ol.layer.Tile({
title: "Terrain",
source: new ol.source.TileImage({
url: 'http://mt1.google.com/vt/lyrs=t&x={x}&y={y}&z={z}',
wrapX: false }),
type: 'base',
visible: false
});
var lyrGoogleMapsHybrid2 = new ol.layer.Tile({
title: "Terrain & Roads",
source: new ol.source.TileImage({
url: 'http://mt1.google.com/vt/lyrs=p&x={x}&y={y}&z={z}',
wrapX: false}),
type: 'base',
visible: false
});
var lyrGoogleMapsOnlyRoad = new ol.layer.Tile({
title: "Road without Building",
source: new ol.source.TileImage({
url: 'http://mt1.google.com/vt/lyrs=r&x={x}&y={y}&z={z}',
wrapX: false}),
type: 'base',
visible: false
});
var GoogleMapsLayers = new ol.layer.Group({
title: 'Google Maps',
fold: 'close',
layers: [
lyrGoogleMapsHybrid2,
lyrGoogleMapsHybrid,
lyrGoogleMapsTerrain,
lyrGoogleMapsOnlyRoad,
lyrGoogleMapsRoadNames,
lyrGoogleMapsRoadmap,
lyrGoogleMapsSatellite
]
});

View File

@@ -0,0 +1,116 @@
var lyrMapTilerBasic = new ol.layer.Tile({
title: 'Basic',
type: 'base',
visible: false,
source: new ol.source.XYZ({
url: 'https://api.maptiler.com/maps/basic/{z}/{x}/{y}.png?key=aIokLGbrqIsRfBnnPIFP',
crossOrigin: 'anonymous',
wrapX: false
})
});
var lyrMapTilerBright = new ol.layer.Tile({
title: 'Bright',
type: 'base',
visible: false,
source: new ol.source.XYZ({
url: 'https://api.maptiler.com/maps/bright/{z}/{x}/{y}.png?key=aIokLGbrqIsRfBnnPIFP',
crossOrigin: 'anonymous',
wrapX: false
})
});
var lyrMapTilerDarkmatter = new ol.layer.Tile({
title: 'Darkmatter',
type: 'base',
visible: false,
source: new ol.source.XYZ({
url: 'https://api.maptiler.com/maps/darkmatter/{z}/{x}/{y}.png?key=aIokLGbrqIsRfBnnPIFP',
crossOrigin: 'anonymous',
wrapX: false
})
});
var lyrMapTilerPastel = new ol.layer.Tile({
title: 'Pastel',
type: 'base',
visible: false,
source: new ol.source.XYZ({
url: 'https://api.maptiler.com/maps/pastel/{z}/{x}/{y}.png?key=aIokLGbrqIsRfBnnPIFP',
crossOrigin: 'anonymous',
wrapX: false
})
});
var lyrMapTilerPositron = new ol.layer.Tile({
title: 'Positron',
type: 'base',
visible: false,
source: new ol.source.XYZ({
url: 'https://api.maptiler.com/maps/positron/{z}/{x}/{y}.png?key=aIokLGbrqIsRfBnnPIFP',
crossOrigin: 'anonymous',
wrapX: false
})
});
var lyrMapTilerHybrid = new ol.layer.Tile({
title: 'Hybrid',
type: 'base',
visible: false,
source: new ol.source.XYZ({
url: 'https://api.maptiler.com/maps/hybrid/{z}/{x}/{y}.jpg?key=aIokLGbrqIsRfBnnPIFP',
crossOrigin: 'anonymous',
wrapX: false
})
});
var lyrMapTilerStreets = new ol.layer.Tile({
title: 'Streets',
type: 'base',
visible: true,
source: new ol.source.XYZ({
url: 'https://api.maptiler.com/maps/streets/{z}/{x}/{y}.png?key=aIokLGbrqIsRfBnnPIFP',
crossOrigin: 'anonymous',
wrapX: false
})
});
var lyrMapTilerTopo = new ol.layer.Tile({
title: 'Topo',
type: 'base',
visible: false,
source: new ol.source.XYZ({
url: 'https://api.maptiler.com/maps/topo/{z}/{x}/{y}.png?key=aIokLGbrqIsRfBnnPIFP',
crossOrigin: 'anonymous',
wrapX: false
})
});
var lyrMapTilerTopographique = new ol.layer.Tile({
title: 'Topographique',
type: 'base',
visible: false,
source: new ol.source.XYZ({
url: 'https://api.maptiler.com/maps/topographique/{z}/{x}/{y}.png?key=aIokLGbrqIsRfBnnPIFP',
crossOrigin: 'anonymous',
wrapX: false
})
});
var lyrMapTilerVoyager = new ol.layer.Tile({
title: 'Voyager',
type: 'base',
visible: false,
source: new ol.source.XYZ({
url: 'https://api.maptiler.com/maps/voyager/{z}/{x}/{y}.png?key=aIokLGbrqIsRfBnnPIFP',
crossOrigin: 'anonymous',
wrapX: false
})
});
var MapTilerLayers = new ol.layer.Group({
title: 'Maptiler',
fold: 'open',
layers: [
lyrMapTilerVoyager,
lyrMapTilerTopographique,
lyrMapTilerTopo,
lyrMapTilerStreets,
lyrMapTilerHybrid,
lyrMapTilerPositron,
lyrMapTilerPastel,
lyrMapTilerDarkmatter,
lyrMapTilerBright,
lyrMapTilerBasic
]
});

View File

@@ -0,0 +1,28 @@
var lyrMapzenTerrarium = new ol.layer.Tile({
title: 'Terrarium',
type: 'base',
visible: false,
source: new ol.source.XYZ({
url: 'https://s3.amazonaws.com/elevation-tiles-prod/terrarium/{z}/{x}/{y}.png',
crossOrigin: 'anonymous',
wrapX: false
})
});
var lyrMapzenNormal = new ol.layer.Tile({
title: 'Normal',
type: 'base',
visible: false,
source: new ol.source.XYZ({
url: 'https://s3.amazonaws.com/elevation-tiles-prod/normal/{z}/{x}/{y}.png',
crossOrigin: 'anonymous',
wrapX: false
})
});
var MapzenLayers = new ol.layer.Group({
title: 'Mapzen',
fold: 'close',
layers: [
lyrMapzenTerrarium,
lyrMapzenNormal
]
});

View File

@@ -0,0 +1,26 @@
var lyrOpenStreetMap = new ol.layer.Tile({
title: 'Street',
type: 'base',
visible: false,
source: new ol.source.OSM({
wrapX: false
})
});
var lyrOpenTopoMap = new ol.layer.Tile({
title: 'Topo',
type: 'base',
visible: false,
source: new ol.source.XYZ({
url: 'https://{a-c}.tile.opentopomap.org/{z}/{x}/{y}.png',
crossOrigin: 'anonymous',
wrapX: false
})
});
var OSMLayers = new ol.layer.Group({
title: 'Open Street Map',
fold: 'close',
layers: [
lyrOpenTopoMap,
lyrOpenStreetMap
]
});

View File

@@ -0,0 +1,51 @@
var lyrStamenToner = new ol.layer.Tile({
title: 'Toner',
type: 'base',
visible: false,
source: new ol.source.Stamen({
layer: 'toner',
wrapX: false})
});
var lyrStamenTonerLite = new ol.layer.Tile({
title: 'Toner-Lite',
type: 'base',
visible: false,
source: new ol.source.Stamen({
layer: 'toner-lite',
wrapX: false })
});
var lyrStamenTerrain = new ol.layer.Tile({
title: 'Terrain',
type: 'base',
visible: false,
source: new ol.source.Stamen({
layer: 'terrain',
wrapX: false })
});
var lyrStamenTerrainBackground = new ol.layer.Tile({
title: 'Terrain Background',
type: 'base',
visible: false,
source: new ol.source.Stamen({
layer: 'terrain-background',
wrapX: false})
});
var lyrStamenWaterColor = new ol.layer.Tile({
title: 'Water Color',
type: 'base',
visible: false,
source: new ol.source.Stamen({
layer: 'watercolor',
wrapX: false})
});
var StamenLayers = new ol.layer.Group({
title: 'Stamen',
fold: 'close',
layers: [
lyrStamenTerrainBackground,
lyrStamenTerrain,
lyrStamenTonerLite,
lyrStamenToner,
lyrStamenWaterColor
]
});

View File

@@ -0,0 +1,66 @@
var thunderforestAttributions = [
'Tiles &copy; <a href="http://www.thunderforest.com/">Thunderforest</a>',
ol.source.OSM.ATTRIBUTION
];
var lyrThunderForestCycleMap = new ol.layer.Tile({
title: 'Cycle',
type: 'base',
visible: false,
source: new ol.source.OSM(
{
'url': 'http://tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=ec248890a6ed43b8841ea243819f8d0d',
attributions: thunderforestAttributions,
wrapX: false
})
});
var lyrThunderForestTransport = new ol.layer.Tile({
title: 'Transport',
type: 'base',
visible: false,
source: new ol.source.OSM(
{
'url': 'http://tile.thunderforest.com/transport/{z}/{x}/{y}.png?apikey=ec248890a6ed43b8841ea243819f8d0d',
wrapX: false
})
});
var lyrThunderForestTransportDark = new ol.layer.Tile({
title: 'Transport Dark',
type: 'base',
visible: false,
source: new ol.source.OSM(
{
'url': 'http://tile.thunderforest.com/transport-dark/{z}/{x}/{y}.png?apikey=ec248890a6ed43b8841ea243819f8d0d',
wrapX: false
})
});
var lyrThunderForestLandscape = new ol.layer.Tile({
title: 'Landscape',
type: 'base',
visible: false,
source: new ol.source.OSM(
{
'url': 'http://tile.thunderforest.com/landscape/{z}/{x}/{y}.png?apikey=ec248890a6ed43b8841ea243819f8d0d',
wrapX: false
})
});
var lyrThunderForestOutdoors = new ol.layer.Tile({
title: 'Outdoors',
type: 'base',
visible: false,
source: new ol.source.OSM(
{
'url': 'http://tile.thunderforest.com/outdoors/{z}/{x}/{y}.png?apikey=ec248890a6ed43b8841ea243819f8d0d',
wrapX: false
})
});
var ThunderForestLayers = new ol.layer.Group({
title: 'Thunder Forest',
fold: 'close',
layers: [
lyrThunderForestTransportDark,
lyrThunderForestTransport,
lyrThunderForestCycleMap,
lyrThunderForestLandscape,
lyrThunderForestOutdoors
]
});

View File

@@ -0,0 +1,271 @@
var publicNotesSource = new ol.source.Vector({
url: '../' + vectorsPath + 'publicnotes.geojson',
format: new ol.format.GeoJSON({
extractStyles: true,
extractAttributes: true
}),
wrapX: false
});
var publicNotesLayer = new ol.layer.Vector({
title: 'Public Notes',
visible: true,
source: publicNotesSource,
minResolution: 0,
maxResolution: 1000,
style: function (feature) {
return [new ol.style.Style({
image: feature.get('notetype') === 'Public' ? new ol.style.Icon({
scale: 1,
src: '../img/note_Public.png',
opacity: 1
}) : new ol.style.Icon({
scale: 1,
src: '../img/note_Public.png',
opacity: 1
}),
text: new ol.style.Text({
offsetY: 25,
text: 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: '#000' }),
stroke: new ol.style.Stroke({ color: '#fff', width: 2 })
})
})];
}
});
var myNotesSource = new ol.source.Vector({
url: '../' + vectorsPath + 'mynotes.geojson',
format: new ol.format.GeoJSON({
extractStyles: true,
extractAttributes: true
}),
wrapX: false
});
var myNotesLayer = new ol.layer.Vector({
title: 'My Notes',
visible: true,
source: myNotesSource,
minResolution: 0,
maxResolution: 1000,
style: function (feature) {
return [new ol.style.Style({
image: feature.get('notetype') === 'Public' ? new ol.style.Icon({
scale: 1,
src: '../img/notePublic.png',
opacity: 1
}) : new ol.style.Icon({
scale: 1,
src: '../img/notePrivate.png',
opacity: 1
}),
text: new ol.style.Text({
offsetY: 25,
text: 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: '#000' }),
stroke: new ol.style.Stroke({ color: '#fff', width: 2 })
})
})];
}
});
var publicNetworkSource = new ol.source.Vector({
url: '../' + vectorsPath + 'publicnetwork.geojson',
format: new ol.format.GeoJSON({
extractStyles: true,
extractAttributes: true
}),
wrapX: false
});
var publicNetworkLayer = new ol.layer.Vector({
title: 'Public Network',
visible: true,
source: publicNetworkSource,
minResolution: 0,
maxResolution: 1000,
style: function (feature) {
return [new ol.style.Style({
image: feature.get('technology') === '4G' ? new ol.style.Icon({
scale: .6,
src: '../img/site_Public.png',
opacity: 1
}) : new ol.style.Icon({
scale: .6,
src: '../img/site_Public.png',
opacity: 1
}),
text: new ol.style.Text({
offsetY: 25,
text: 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: '#000' }),
stroke: new ol.style.Stroke({ color: '#fff', width: 2 })
})
})];
}
});
var myNetworkSource = new ol.source.Vector({
url: '../' + vectorsPath + 'mynetwork.geojson',
format: new ol.format.GeoJSON({
extractStyles: true,
extractAttributes: true
}),
wrapX: false
});
var myNetworkLayer = new ol.layer.Vector({
title: 'My Network',
visible: true,
source: myNetworkSource,
minResolution: 0,
maxResolution: 1000,
style: function (feature) {
return [new ol.style.Style({
image: feature.get('technology') === '4G' ? new ol.style.Icon({
scale: .6,
src: '../img/site4G.png',
opacity: 1
}) : new ol.style.Icon({
scale: .6,
src: '../img/site2G.png',
opacity: 1
}),
text: new ol.style.Text({
offsetY: 25,
text: 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: '#000' }),
stroke: new ol.style.Stroke({ color: '#fff', width: 2 })
})
})];
}
});
var myPolygonsSource = new ol.source.Vector({
url: '../' + vectorsPath + 'mypolygons.geojson',
format: new ol.format.GeoJSON({
extractStyles: true,
extractAttributes: true
}),
wrapX: false
});
var myPolygonsLayer = new ol.layer.Vector({
title: 'My Polygons',
visible: true,
source: myPolygonsSource,
minResolution: 0,
maxResolution: 1000,
style: function (feature, resolution) {
return [new ol.style.Style({
fill: new ol.style.Fill({
color: 'rgba(255, 255, 255, 0.2)'
}),
stroke: new ol.style.Stroke({
color: '#ffcc33',
width: 2
}),
text: new ol.style.Text({
text: 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: '#000' }),
stroke: new ol.style.Stroke({ color: '#fff', width: 2 })
})
})];
}
});
var myLinksSource = new ol.source.Vector({
url: '../' + vectorsPath + 'mylinks.geojson',
format: new ol.format.GeoJSON({
extractStyles: true,
extractAttributes: true
}),
wrapX: false
});
var myLinksLayer = new ol.layer.Vector({
title: 'My Links',
visible: true,
source: myLinksSource,
minResolution: 0,
maxResolution: 1000,
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)',
lineDash: [7, 7],
width: 4
}),
text: new ol.style.Text({
text: 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: '#000' }),
stroke: new ol.style.Stroke({ color: '#fff', width: 2 })
})
})];
}
});
var myClutterSource = new ol.source.Vector({
url: '../' + vectorsPath + 'myclutter.geojson',
format: new ol.format.GeoJSON({
extractStyles: true,
extractAttributes: true
}),
wrapX: false
});
var myClutterLayer = new ol.layer.Vector({
title: 'My Clutter',
visible: true,
source: myClutterSource,
minResolution: 0,
maxResolution: 1000,
style: function (feature, resolution) {
return [new ol.style.Style({
fill: new ol.style.Fill({
color: 'rgba(255, 255, 255, 0.2)'
}),
stroke: new ol.style.Stroke({
color: '#11f0ff',
width: 2
}),
text: new ol.style.Text({
text: feature.get('cluttertype'),
font: '14px "Liberation Sans", "Lucida Sans", "Lucida Sans Regular", "Lucida Grande", "Lucida Sans Unicode", Geneva, Verdana, sans-serif',
fill: new ol.style.Fill({ color: '#000' }),
stroke: new ol.style.Stroke({ color: '#fff', width: 2 })
})
})];
}
});
var resultsSource = new ol.source.Vector({
url: '../' + vectorsPath + 'results.geojson',
format: new ol.format.GeoJSON({
extractStyles: true,
extractAttributes: true
}),
wrapX: false
});
var resultsLayer = new ol.layer.Vector({
source: resultsSource
});
var overlayLayers = new ol.layer.Group({
title: 'Overlay Layers',
fold: 'close',
layers: [
resultsLayer,
myPolygonsLayer,
publicNotesLayer,
myNotesLayer,
myLinksLayer,
publicNetworkLayer,
myNetworkLayer
]
});
var baseLayers = new ol.layer.Group({
'title': 'Base Layers',
fold: 'close',
layers: [
GoogleMapsLayers,
BingMapsLayers,
MapzenLayers,
ThunderForestLayers,
MapTilerLayers,
StamenLayers,
OSMLayers
]
});

View File

@@ -0,0 +1,213 @@
function getDataByIdx(source, Idx) {
let returnString = '';
if (Idx) {
if (Number(Idx) > -1) {
let feature = source.getFeatures()[Idx];
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';
}
}
returnString = returnString.substring(0, returnString.length - 1);
}
}
return returnString;
}
function getIdxById(source, key, id) {
let features = source.getFeatures();
let returnString = '';
for (let i = 0; i < features.length; i++) {
if (features[i].get(key).toString() === id.toString()) {
returnString = i.toString(); break;
}
}
return returnString;
}
function getFeaturesCount(source) {
return source.getFeatures().length;
}
function deleteFeatureByIdx(source, Idx) {
if (Idx) {
if (Number(Idx) > -1) {
let feature = source.getFeatures()[Idx];
source.removeFeature(feature);
myMap.render();
}
}
}
function zoomToFeatureByIdx(source, Idx) {
if (Idx) {
if (Number(Idx) > -1) {
let feature = source.getFeatures()[Idx];
myMap.getView().animate({
duration: 700,
center: ol.extent.getCenter(feature.getGeometry().getExtent())
});
}
}
}
function getNewIdx(source, key) {
let features = source.getFeatures();
let newIdx = 0; let eIdx = 0;
features.forEach(function (feature) {
eIdx = Number(feature.get(key));
if (newIdx < eIdx) { newIdx = eIdx; }
});
return (newIdx + 1).toString();
}
var download = {
KML: function (source, name) {
let blob = new Blob([source.getKMLString(true)], { type: 'text/plain;charset=utf-8' });
saveAs(blob, name + '.kml');
},
JSON: function (source, name) {
let blob = new Blob([source.getJSONString(true)], { type: 'text/plain;charset=utf-8' });
saveAs(blob, name + '.geojson');
},
CSV: function (source, name) {
let csv = [];
let header = {};
let n = 0;
let isPt = true;
let features = JSON.parse(source.getJSONString()).features;
features.forEach(function (f) {
for (let p in f.properties) {
if (header[p] === undefined) {
header[p] = n++;
}
}
if (f.geometry.type !== 'Point') isPt = false;
});
features.forEach(function (f) {
let row = [];
for (let p in header) {
row[header[p]] = f.properties[p];
}
if (isPt) {
row.push(f.geometry.coordinates[0]);
row.push(f.geometry.coordinates[1]);
} else {
row.push(f.geometry.type);
row.push(JSON.stringify(f.geometry.coordinates));
}
csv.push(row);
});
let cols = [];
for (let p in header) {
cols.push(p);
}
if (isPt) {
cols.push('lon');
cols.push('lat');
} else {
cols.push('type');
cols.push('coord');
}
csv.unshift(cols);
result = Papa.unparse(csv);
let blob = new Blob([result], { type: 'text/plain;charset=utf-8' });
saveAs(blob, name + '.csv');
}
};
function saveAllVectors() {
uploadDataToUrl(myNetworkLayer.getSource().getJSONString(),
vectorsPath + 'mynetwork.geojson');
Ajax_runccmd("UploadNetworkToDB", "");
myMap.render();
loadSitesTreeFromFile();
uploadDataToUrl(myPolygonsLayer.getSource().getJSONString(),
vectorsPath + 'mypolygons.geojson');
Ajax_runccmd("UploadPolygonsToDB", "");
myMap.render();
loadPolygonsTreeFromFile();
uploadDataToUrl(myLinksLayer.getSource().getJSONString(),
vectorsPath + 'mylinks.geojson');
Ajax_runccmd("UploadLinksToDB", "");
myMap.render();
loadLinksTreeFromFile();
uploadDataToUrl(myNotesLayer.getSource().getJSONString(),
vectorsPath + 'mynotes.geojson');
Ajax_runccmd("UploadNotesToDB", "");
myMap.render();
loadNotesTreeFromFile();
}
function loadAllVectors() {
Ajax_runccmd("GetVectorsFromDB", "");
Ajax_loadSourceFromFile(myNetworkLayer.getSource(),
"../" + vectorsPath + "mynetwork.geojson");
loadSitesTreeFromSource();
Ajax_loadSourceFromFile(myPolygonsLayer.getSource(),
"../" + vectorsPath + "mypolygons.geojson");
loadPolygonsTreeFromSource();
Ajax_loadSourceFromFile(myLinksLayer.getSource(),
"../" + vectorsPath + "mylinks.geojson");
loadLinksTreeFromSource();
Ajax_loadSourceFromFile(myNotesLayer.getSource(),
"../" + vectorsPath + "mynotes.geojson");
loadNotesTreeFromSource();
Ajax_loadSourceFromFile(resultsLayer.getSource(),
"../" + vectorsPath + "results.geojson");
loadResultsTreeFromSource();
}
function Ajax_loadSourceFromFile(source, url) {
$.ajax({
type: "GET",
url: url,
data: "",
async: false,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (r) {
source.clearFeatures();
source.addFeatures(
new ol.format.GeoJSON().readFeatures(r,
{
dataProjection: 'EPSG:4326',
featureProjection: 'EPSG:3857'
}
));
myMap.render();
},
failure: function (r) {
source.clearFeatures();
myMap.render();
},
error: function (r) {
source.clearFeatures();
myMap.render();
}
});
}
function uploadDataToUrl(data, url) {
Ajax_runccmd("UploadDataToUrl", "{'data':'" + data + "','url':'" + url + "'}");
}
function Ajax_runccmd(command, args) {
let result;
$.ajax({
async: false,
type: "POST",
url: "webui.aspx/" + command,
data: args,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (r) {
result = r.d;
},
failure: function (r) {
return "";
},
error: function (r) {
return "";
}
});
return result;
}

View File

@@ -0,0 +1,180 @@
// about
var about = document.getElementById('about');
about.innerHTML = '<img alt="" style="width:113px;height:30px;" src="../img/cnip.png" />';
about.style.display = 'block';
// action status
var actionRunning = false;
// initialize map
var myMap = new ol.Map({
loadTilesWhileAnimating: false,
loadTilesWhileInteracting: false,
interactions: ol.interaction.defaults({ altShiftDragRotate: false, pinchRotate: false }),
target: 'myMap',
view: new ol.View({
center: ol.proj.fromLonLat([67.056848, 24.808224]),
zoom: 15
}),
layers: [
baseLayers,
overlayLayers
]
});
var sidebar = new ol.control.Sidebar({ element: 'sidebar', position: 'left' });
var toc = document.getElementById('layers');
ol.control.LayerSwitcher.renderPanel(myMap, toc);
myMap.addControl(sidebar);
myMap.addControl(new ol.control.ScaleLine({ units: 'metric' }));
myMap.getControls().forEach(function (control) {
if (control instanceof ol.control.Attribution) {
myMap.removeControl(control);
}
}, this);
// pointer move functionality
var highlightLayer = new ol.layer.Vector({
source: new ol.source.Vector(),
map: myMap
});
highlightLayer.setStyle(highlightStyle);
var highlightFeature;
//var featureTip = $('#featureTip');
//featureTip.tooltip({ animation: false, trigger: 'manual' });
var noteInfo = document.getElementById('noteInfo');
var featureInfo = document.getElementById('featureInfo');
var locationInfo = document.getElementById('locationInfo');
var displayFeatureInfo = function (e) {
let pixel = myMap.getEventPixel(e.originalEvent);
let features = []; let feature = undefined;
let layers = []; let layer = undefined;
myMap.forEachFeatureAtPixel(pixel,
function (feature, layer) { layers.push(layer); features.push(feature); });
let layerIndex = 0;
features.forEach(function (f) {
if (f.get('sitename') !== undefined || f.get('linkname') !== undefined || f.get('notename') !== undefined) {
feature = f; layer = layers[layerIndex];
}
layerIndex += 1;
});
if (feature === undefined) {
layerIndex = 0;
features.forEach(function (f) {
feature = f; layer = layers[layerIndex];
});
layerIndex += 1;
}
if (!addLink.getActive() && !deleteSiteActive && !deleteLinkActive && !deleteNoteActive && !deletePolygonActive) {
if (feature) {
let properties = [];
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 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;">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>');
}
feature.getKeys().forEach(function (key) {
if (key !== 'geometry' && key !== 'elevstr' && !key.toString().includes('id')) {
if (feature.get(key)) {
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)) +
'</td></tr>');
}
}
});
featureInfo.innerHTML = '<table><tbody><tr><td style="color:var(--facecolor);background-color:var(--barcolor);padding-left:5px;">Quick Info</td><td style="color:var(--facecolor);background-color:var(--barcolor)"></td><td style="color:var(--facecolor);background-color:var(--barcolor)"></td></tr>' + properties.join('') + '</tbody></table>' || '(unknown)';
featureInfo.style.opacity = 1;
if (layer === myNotesLayer || layer === publicNotesLayer) {
noteInfo.style.left = (pixel[0] + 5).toString() + 'px';
noteInfo.style.top = (pixel[1] - 15).toString() + 'px';
noteInfo.innerHTML = '<span style="background-color: #fff2ab;">+ Description&nbsp;' +
'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' +
'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...&nbsp;&nbsp;</span><br/>' +
'<span style="background-color: #fff7d1;">' + truncate(feature.get('description'), 255) + '</span>';
noteInfo.style.opacity = 1;
}
//featureTip.css({ left: pixel[0] + 'px', top: pixel[1] - 15 + 'px' });
//featureTip.attr('data-original-title', feature.get('sitename') === undefined ?
// feature.get('polygonname') === undefined ? feature.get('linkname') :
// feature.get('polygonname') : feature.get('sitename')).tooltip('show');
} else {
featureInfo.innerHTML = ''; featureInfo.style.opacity = 0;
noteInfo.innerHTML = ''; noteInfo.style.opacity = 0;
//featureTip.attr('data-original-title', '').tooltip('hide');
}
}
if (feature !== highlightFeature) {
if (highlightFeature) {
highlightLayer.getSource().clear();
}
if (feature) {
if (!addLink.getActive() && !deleteSiteActive && !deleteLinkActive && !deleteNoteActive && !deletePolygonActive) {
highlightLayer.getSource().addFeature(feature);
} else {
if (addLink.getActive() || deleteSiteActive) {
if (layer === myNetworkLayer) {
highlightLayer.getSource().addFeature(feature);
}
}
if (deleteNoteActive) {
if (layer === myNotesLayer) {
highlightLayer.getSource().addFeature(feature);
}
}
if (deleteLinkActive) {
if (layer === myLinksLayer) {
highlightLayer.getSource().addFeature(feature);
}
}
if (deletePolygonActive) {
if (layer === myPolygonsLayer) {
highlightLayer.getSource().addFeature(feature);
}
}
}
}
highlightFeature = feature;
}
};
function highlightPoint(loc) {
let feature = new ol.Feature(new ol.geom.Point(ol.proj.fromLonLat(loc)));
feature.setStyle(highlightPointStyle);
highlightLayer.getSource().clear();
highlightLayer.getSource().addFeature(feature);
highlightFeature = feature;
}
var displayElevation = function (e) {
let lonlat = ol.proj.toLonLat(e.coordinate);
let elev = ''; //Ajax_runccmd("GetElevationFromLonLat", "{'longitude':'" + lonlat[0] + "','latitude':'" + lonlat[1] + "'}");
locationInfo.style.opacity = 1;
locationInfo.innerHTML =
ol.coordinate.format(lonlat, 'lon {x}\xB0 lat {y}\xB0 ', 6);//elev ', 6) + elev;
};
var setPointerStyle = function (e) {
if (modifyNote.getActive()) {
let hit = e.map.hasFeatureAtPixel(e.pixel, {
layerFilter: function (layer) {
return layer === myNotesLayer;
}
});
e.map.getTargetElement().style.cursor = hit ? 'move' : '';
}
if (modifySite.getActive()) {
let hit = e.map.hasFeatureAtPixel(e.pixel, {
layerFilter: function (layer) {
return layer === myNetworkLayer;
}
});
e.map.getTargetElement().style.cursor = hit ? 'move' : '';
}
};
$('#sidebar div ul li a').click(function () {
toggleSelect();
});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

10598
software/cnip/cnip/Scripts/jquery-3.4.1.js vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

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