Commit 8b532b40 authored by BujarMuharemi's avatar BujarMuharemi
Browse files

fixed pvPotential radio btn controller; works now

parent bb156b4f
//Shadow palette for coloring the roofs
// color pallet from https://colorbrewer2.org/#type=sequential&scheme=BuGn&n=3
var pvPotentialPallet = ['#fff7fb', '#ece7f2', '#d0d1e6', '#a6bddb', '#74a9cf', '#3690c0', '#0570b0', '#034e7b']
var pvPotentialPallet = ['#d0d1e6', '#a6bddb', '#74a9cf', '#3690c0', '#0570b0', '#034e7b']
pvPotentialPallet = pvPotentialPallet.reverse();
//color pallet white->black
......
......@@ -20,6 +20,7 @@ var roofViewActivated = false;
var chosenAttributeRadioBtnFlag = "shadowValue";
function chosenAttributeHandler(radioBtnValue) {
chosenAttributeRadioBtnFlag = radioBtnValue.value;
}
......@@ -319,6 +320,7 @@ viewer.screenSpaceEventHandler.setInputAction(function onLeftClick(movement) {
//Surface View @onLeftClick
if (document.getElementById("surface").checked) {
resetRoofColors();
setMinAndMax(chosenAttributeRadioBtnFlag);
//save the selected feature's original color
if (pickedhigh) {
highlightedFeatures.forEach(h => {
......@@ -334,7 +336,7 @@ viewer.screenSpaceEventHandler.setInputAction(function onLeftClick(movement) {
//used for debugging, when clicking on a surface
//console.log(t.getProperty("description") + "\n" + t.getProperty("feature_type") + "\n" + t.getProperty("gml_id") + "\n" + t.getProperty("gml_parent_id"));
t.color = Cesium.Color.LIME;
//t.color = Cesium.Color.LIME;
//color surfaces depending on their shadow value
for (const [key, value] of Object.entries(shadowdata)) { //looping threw the shadowdata array
......@@ -353,15 +355,15 @@ viewer.screenSpaceEventHandler.setInputAction(function onLeftClick(movement) {
console.log(pvPotentialSurfaces);
//coloring surfaces on pv potential
setMinAndMax(chosenAttributeRadioBtnFlag);
console.log("minie maus", minAndMaxPvPotentials);
for (const [key, value] of Object.entries(pvPotentialSurfaces)) {
if (value["id"] === t.getProperty("gml_id")) { //checking if the ids of the current surface match the id in the shadowdata array
//console.log("hour:",chosenDate.hour);
var normalizedPvValue;
chosenPvPotentialValue = value["attributes"]["pvPotential"][chosenAttributeRadioBtnFlag];
//console.log("normalisierter",chosenPvPotentialValue);
console.log("klick");
console.log("chosenPvPotentialValue",chosenPvPotentialValue);
normalizedPvValue = getNormalizedValue(chosenPvPotentialValue);
console.log("normalisierter", normalizedPvValue);
t.color = Cesium.Color.fromCssColorString(getColorFromPalette(normalizedPvValue, "pvPotential")); //coloring the surface
......
......@@ -18,6 +18,7 @@ function setMinAndMax(pvPotentialValue) {
minAndMaxPvPotentials=[];
minAndMaxPvPotentials.push(pvPotentials[0]);
minAndMaxPvPotentials.push(pvPotentials[pvPotentials.length - 1]);
console.log("setMinAndMax calculated");
}
function getNormalizedValue(selectedPvPotentialValue) {
......
......@@ -8,13 +8,11 @@
<!-- Tell IE to use the latest, best version. -->
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<!-- Make the application on mobile take up the full browser screen and disable user scaling. -->
<meta name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" />
<!-- Website Title -->
<title>Team3dViewer!</title>
<!-- import bootstrap -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<link href="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.1.0/css/flag-icon.min.css" rel="stylesheet">
<!-- import font-awesome -->
......@@ -33,6 +31,7 @@
margin: 0;
overflow: hidden;
}
</style>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/2.1.2/sweetalert.min.js" integrity="sha512-AA1Bzp5Q0K1KanKKmvN/4d3IRKVlv9PYgwFPvm32nPO6QS8yH1HO7LbgB1pgiOxPtfeg5zEn2ba64MUcqJx6CA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
......@@ -106,22 +105,22 @@
};
// Process translation
$(function () {
$('.translate').click(function () {
$(function() {
$('.translate').click(function() {
var lang = $(this).attr('id');
if (lang === "de") {
document.getElementById("submitID").value = "Senden";
}
else if (lang === "en") {
} else if (lang === "en") {
document.getElementById("submitID").value = "Submit";
}
$('.lang').each(function (index, item) {
$('.lang').each(function(index, item) {
$(this).text(arrLang[lang][$(this).attr('key')]);
});
});
});
</script>
</head>
......@@ -151,8 +150,7 @@
<!--Chart and Dropup Button-->
<div id="areaChartContainer">
<div id="dupbutton" class="btn-group dropup">
<button type="button" class="btn btn-secondary dropdown-toggle lang" data-toggle="dropdown" aria-haspopup="true"
aria-expanded="false" key='attributes'>Attributes</button>
<button type="button" class="btn btn-secondary dropdown-toggle lang" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" key='attributes'>Attributes</button>
<div class="dropdown-menu">
<button id="surfaceChartAttribute" class="dropdown-item lang" key="surface">Surface</button>
<button id="height" class="dropdown-item lang" type="button" key="height">Height</button>
......@@ -191,8 +189,7 @@
<!--small chart for single Building-->
<div id="singleChartContainer">
<div id="dupbutton2" class="btn-group dropup">
<button type="button" class="btn btn-secondary dropdown-toggle lang" data-toggle="dropdown" aria-haspopup="true"
aria-expanded="false" key="attributes">Attributes
<button type="button" class="btn btn-secondary dropdown-toggle lang" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" key="attributes">Attributes
</button>
<div class="dropdown-menu">
<a id="monthlyHeating" class="dropdown-item lang" key="monthlyheating">Monthly Heating</a>
......@@ -236,13 +233,13 @@
<br><br>
<input id="submitID" type="button" class="btn btn-primary" value="Submit">
</div>
<!--SELECT Adresse-->
<div class="item">
<!--SELECT Adresse-->
<div class="item">
<label class="lang" key="chooseaarea" id="arealabel" for="SearchAddress">Search Address:</label>
<input id="SearchAddress" type="text" name="SearchAddress" >
<input id="SearchAddress" type="text" name="SearchAddress">
<br><br>
<input id="SerachID" type="button" onclick="searchaddress()" class="btn btn-primary" value="Search">
</div>
</div>
<!--SELECT VIEW-->
<div class="item">
<div id="radio-group" class="cc-selector">
......@@ -271,7 +268,7 @@
</div>
<div class="dropp-body">
<label><input id="pvPotential" type="radio" key="pvPotential" name="dropp" value="pvPotential" onclick="chosenAttributeHandler(this);"> PV-Value</label>
<label for="specificYield">Specific Yield
<input id="specificYield" type="radio" key="specificYield" name="specificYield" value="specificYield" onclick="chosenAttributeHandler(this);">
</label>
......@@ -301,8 +298,8 @@
</label>
<label for="discountedPaybackPeriod">Discounted Payback Period
<input id="discountedPaybackPeriod" type="radio" key="discountedPaybackPeriod" name="dropp" value="discountedPaybackPeriod" onclick="chosenAttributeHandler(this);">
</label>
<label><input id="shadowValue" type="radio" name="dropp" value="shadowValue" onclick="chosenAttributeHandler(this);"> Shadow-Value</label>
</label>Shadow-Value
<input id="shadowValue" type="radio" name="dropp" value="shadowValue" onclick="chosenAttributeHandler(this);" checked> </label>
</div>
</div>
<div id="chartButton" class="button">
......@@ -311,8 +308,7 @@
<!--Draw-menu-->
<button class="dropdown-btn"><span class='lang' key='drawbox'>Draw box</span><i class="fa fa-caret-down"></i></button>
<div class="dropdown-container">
<button class="buttonBlue1" type="button" style="background: rgb(208, 247, 37)"
onclick="drawBounding()">
<button class="buttonBlue1" type="button" style="background: rgb(208, 247, 37)" onclick="drawBounding()">
<div class='lang' key='drawbox'>Draw box</div>
</button>
<br>
......@@ -385,18 +381,16 @@
</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous">
</script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous">
</script>
<script type="text/javascript" src="js/colorPalettes.js"></script>
<script type="text/javascript" src="js/sidebar.js"></script>
<script type="text/javascript" src="js/globe.js"></script>
<script type="text/javascript" src="js/areaCharts.js"></script>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment