handleiding_nieuw:sub_spacematrix
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
handleiding_nieuw:sub_spacematrix [2025/04/07 14:18] – support | handleiding_nieuw:sub_spacematrix [2025/04/15 15:51] (current) – support | ||
---|---|---|---|
Line 1: | Line 1: | ||
< | < | ||
< | < | ||
- | | + | |
- | | + | display: flex; |
- | text-align: | + | align-items: center; |
- | } | + | gap: 10px; |
- | .spacematrix-wrapper img { | + | margin-bottom: |
- | width: 90%; | + | } |
- | | + | .inputrow label { |
- | border: | + | width: 200px; |
- | | + | |
- | } | + | .inputrow input { |
- | .spacematrix-caption | + | |
- | | + | |
- | | + | .resultblock { |
- | color: #666; | + | margin-left: |
- | } | + | font-size: 0.9em; |
+ | min-width: 200px; | ||
+ | | ||
+ | } | ||
+ | table.rekenblok | ||
+ | | ||
+ | | ||
+ | font-size: 0.9em; | ||
+ | | ||
+ | table.rekenblok td, table.rekenblok th { | ||
+ | padding: 4px 6px; | ||
+ | | ||
+ | text-align: right; | ||
+ | } | ||
+ | table.rekenblok th { | ||
+ | | ||
+ | | ||
+ | .scheiding td { | ||
+ | background-color: #fafafa; | ||
+ | | ||
+ | } | ||
+ | .kaartcontainer { | ||
+ | position: absolute; | ||
+ | top: 0; | ||
+ | right: 0; | ||
+ | width: 320px; | ||
+ | } | ||
+ | .kaartcontainer img { | ||
+ | width: 100%; | ||
+ | display: block; | ||
+ | } | ||
+ | .stipje { | ||
+ | position: absolute; | ||
+ | width: 14px; | ||
+ | height: 14px; | ||
+ | background: red; | ||
+ | border-radius: | ||
+ | transform: translate(-50%, | ||
+ | border: 2px solid white; | ||
+ | | ||
</ | </ | ||
- | < | + | < |
- | <img id="spacematrix-img" | + | <div class="kaartcontainer"> |
- | | + | < |
- | | + | <div class=" |
- | alt=" | + | |
- | <div class=" | + | |
</ | </ | ||
- | <map name="spacematrixmap"> | + | <h2> |
- | <area shape="rect" | + | |
- | <area shape="rect" | + | <div class="inputrow"> |
- | <area shape="rect" | + | <label for="opp"> |
- | <area shape="rect" | + | <input id="opp" |
- | <area shape="rect" | + | <div class=" |
- | <area shape="rect" | + | </ |
- | < | + | <div class=" |
- | </map> | + | <label for=" |
+ | <input id="fsi" type="number" | ||
+ | <div class="resultblock" | ||
+ | </ | ||
+ | <div class="inputrow"> | ||
+ | <label for=" | ||
+ | <input id=" | ||
+ | <div class=" | ||
+ | </ | ||
+ | <div class=" | ||
+ | <label for=" | ||
+ | <input id="voorziening" | ||
+ | <div class="resultblock" | ||
+ | </ | ||
+ | |||
+ | <div style="margin-top: 30px;"> | ||
+ | <table class=" | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | <th style="width: 60px;"> | ||
+ | <th style=" | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | <tbody id="woningtypes"></ | ||
+ | <tfoot> | ||
+ | <tr class="scheiding"> | ||
+ | < | ||
+ | <td id="totaal_perc"> | ||
+ | <td id="totaal_gewbvo"> | ||
+ | < | ||
+ | <td id="totaal_bvo"> | ||
+ | </tr> | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | <div id="output"></ | ||
+ | |||
+ | < | ||
+ | const types = [ | ||
+ | "egw sociaal", | ||
+ | "mgw sociaal", | ||
+ | ]; | ||
+ | |||
+ | const tbody = document.getElementById("woningtypes" | ||
+ | |||
+ | types.forEach((type, | ||
+ | const row = document.createElement(" | ||
+ | if (i === 5) row.className = " | ||
+ | row.innerHTML = ` | ||
+ | <td style=" | ||
+ | < | ||
+ | < | ||
+ | <td id="aantal_${i}"> | ||
+ | <td id="totbvo_${i}"> | ||
+ | `; | ||
+ | tbody.appendChild(row); | ||
+ | }); | ||
+ | |||
+ | function formatGetal(n) { | ||
+ | return n.toLocaleString(" | ||
+ | } | ||
+ | |||
+ | function updateStipje(fsi, gsi) { | ||
+ | const stip = document.getElementById(" | ||
+ | const x = Math.min(100, Math.max(0, gsi * 190)); | ||
+ | const y = Math.max(0, Math.min(100, | ||
+ | stip.style.left = `${x}%`; | ||
+ | stip.style.top = `${y}%`; | ||
+ | } | ||
+ | |||
+ | function updateLaadvermogen() { | ||
+ | const opp = parseFloat(document.getElementById("opp" | ||
+ | const fsi = parseFloat(document.getElementById("fsi" | ||
+ | const gsi = parseFloat(document.getElementById(" | ||
+ | const voorzieningPerc = parseFloat(document.getElementById(" | ||
+ | |||
+ | const laadvermogen = Math.round(opp * fsi); | ||
+ | const bvoVoorzieningen | ||
+ | const bvoWonen = laadvermogen - bvoVoorzieningen; | ||
+ | |||
+ | document.getElementById(" | ||
+ | document.getElementById(" | ||
+ | document.getElementById("lv4" | ||
+ | |||
+ | updateStipje(fsi, | ||
+ | bereken(); | ||
+ | } | ||
+ | |||
+ | function bereken() { | ||
+ | const opp = parseFloat(document.getElementById("opp").value); | ||
+ | const fsi = parseFloat(document.getElementById("fsi").value); | ||
+ | const voorzieningPerc | ||
+ | const laadvermogen = opp * fsi; | ||
+ | const woonBVO = laadvermogen * (1 - voorzieningPerc); | ||
+ | |||
+ | let gewogenBVO = 0; | ||
+ | let totalPerc = 0; | ||
+ | const details = []; | ||
+ | |||
+ | for (let i = 0; i < types.length; | ||
+ | const perc = parseFloat(document.getElementById(`perc_${i}`).value) || 0; | ||
+ | const bvo = parseFloat(document.getElementById(`bvo_${i}`).value) || 0; | ||
+ | gewogenBVO += (perc / 100) * bvo; | ||
+ | totalPerc += perc; | ||
+ | details.push({ i, perc, bvo }); | ||
+ | } | ||
+ | |||
+ | if (totalPerc === 0 || gewogenBVO === 0) return; | ||
+ | |||
+ | const totaalWoningenExact = woonBVO / gewogenBVO; | ||
+ | let sumWon = 0; | ||
+ | let sumBVO = 0; | ||
+ | let wonPerType = []; | ||
+ | |||
+ | let restant = Math.round(totaalWoningenExact); | ||
+ | for (let i = 0; i < details.length; | ||
+ | const { perc } = details[i]; | ||
+ | let aant = (perc / 100) * totaalWoningenExact; | ||
+ | let afgerond = Math.floor(aant); | ||
+ | wonPerType.push(afgerond); | ||
+ | restant -= afgerond; | ||
+ | } | ||
+ | |||
+ | const decimaalSort = details.map((d, i) => ({ | ||
+ | i, rest: ((d.perc / 100) * totaalWoningenExact) % 1 | ||
+ | })).sort((a, | ||
+ | |||
+ | for (let j = 0; j < restant; j++) { | ||
+ | wonPerType[decimaalSort[j].i]++; | ||
+ | } | ||
+ | |||
+ | for (let i = 0; i < details.length; | ||
+ | const aant = wonPerType[i]; | ||
+ | const bvoTot = aant * details[i].bvo; | ||
+ | document.getElementById(`aantal_${i}`).innerText = formatGetal(aant); | ||
+ | document.getElementById(`totbvo_${i}`).innerText = formatGetal(bvoTot); | ||
+ | sumWon += aant; | ||
+ | sumBVO += bvoTot; | ||
+ | } | ||
+ | |||
+ | document.getElementById("totaal_perc" | ||
+ | document.getElementById("totaal_gewbvo" | ||
+ | document.getElementById("totaal_won" | ||
+ | document.getElementById("totaal_bvo").innerText = formatGetal(sumBVO); | ||
+ | |||
+ | document.getElementById(" | ||
+ | < | ||
+ | < | ||
+ | `; | ||
+ | } | ||
+ | |||
+ | updateLaadvermogen(); | ||
+ | </script> | ||
</ | </ | ||
+ |
handleiding_nieuw/sub_spacematrix.1744035525.txt.gz · Last modified: 2025/04/07 14:18 by support