Skip to content

Commit

Permalink
documented code
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinDueren committed Oct 22, 2012
1 parent 7c9f2c9 commit c606789
Show file tree
Hide file tree
Showing 6 changed files with 887 additions and 1,049 deletions.
44 changes: 22 additions & 22 deletions generateColorRamp.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
function interpolate(pBegin, pEnd, pStep, pMax) {
if (pBegin < pEnd) {
return ((pEnd - pBegin) * (pStep / pMax)) + pBegin;
} else {
return ((pBegin - pEnd) * (1 - (pStep / pMax))) + pEnd;
}
if (pBegin < pEnd) {
return ((pEnd - pBegin) * (pStep / pMax)) + pBegin;
} else {
return ((pBegin - pEnd) * (1 - (pStep / pMax))) + pEnd;
}

}

function generateColor(theColorBegin, theColorEnd, theNumSteps){
var colorArray = new Array();
theColorBegin = parseInt(theColorBegin, 16);
theColorEnd = parseInt(theColorEnd, 16);
function generateColor(theColorBegin, theColorEnd, theNumSteps) {
var colorArray = new Array();
theColorBegin = parseInt(theColorBegin, 16);
theColorEnd = parseInt(theColorEnd, 16);

theR0 = (theColorBegin & 0xff0000) >> 16;
theG0 = (theColorBegin & 0x00ff00) >> 8;
theB0 = (theColorBegin & 0x0000ff) >> 0;
theR1 = (theColorEnd & 0xff0000) >> 16;
theG1 = (theColorEnd & 0x00ff00) >> 8;
theB1 = (theColorEnd & 0x0000ff) >> 0;
theR0 = (theColorBegin & 0xff0000) >> 16;
theG0 = (theColorBegin & 0x00ff00) >> 8;
theB0 = (theColorBegin & 0x0000ff) >> 0;
theR1 = (theColorEnd & 0xff0000) >> 16;
theG1 = (theColorEnd & 0x00ff00) >> 8;
theB1 = (theColorEnd & 0x0000ff) >> 0;

for (i = 0; i <= theNumSteps; i++) {
theR = interpolate(theR0, theR1, i, theNumSteps);
theG = interpolate(theG0, theG1, i, theNumSteps);
theB = interpolate(theB0, theB1, i, theNumSteps);
theVal = ((( theR << 8 ) | theG ) << 8 ) | theB;
colorArray[i] = theVal.toString(16);
console.log(theVal.toString(16));
for (i = 0; i <= theNumSteps; i++) {
theR = interpolate(theR0, theR1, i, theNumSteps);
theG = interpolate(theG0, theG1, i, theNumSteps);
theB = interpolate(theB0, theB1, i, theNumSteps);
theVal = (((theR << 8) | theG) << 8) | theB;
colorArray[i] = theVal.toString(16);
console.log(theVal.toString(16));
}
return colorArray;
}
113 changes: 55 additions & 58 deletions individualBreaks.js
Original file line number Diff line number Diff line change
@@ -1,62 +1,59 @@
function addIndivBreakField(){
var initialFrom = minValues[activeLayer];
var initialTo = maxValues[activeLayer];

if(breakCount > 0){
initialFrom = document.getElementById("breakTo"+(breakCount)).value;
initialTo = parseInt(document.getElementById("breakTo"+(breakCount)).value);

var d = document.getElementById("td"+breakCount);
var olddiv = document.getElementById("addBtn"+breakCount);
d.removeChild(olddiv);

var rembtn = document.createElement("input");
rembtn.setAttribute("type", "image");
rembtn.setAttribute("id", "rembtn"+(breakCount));
rembtn.setAttribute("onclick", "remIndivBreakField("+breakCount+")");
rembtn.setAttribute("src", "images/close20.png");
d.appendChild(rembtn);
}

breakCount++;
var breaksList = document.getElementById("Breaks");

var breakEntry = document.createElement("tr");
breakEntry.setAttribute("id", "tr" + breakCount);

var breakFieldFrom = document.createElement("td");
breakFieldFrom.innerHTML = '<input type="text" class="range" id="breakFrom' + breakCount + '" value="' + initialFrom + '"></input>';
breakEntry.appendChild(breakFieldFrom);

var breakFieldTo = document.createElement("td");
breakFieldTo.innerHTML = '<input type="text" class="range" id="breakTo' + breakCount + '" value="' + initialTo + '"></input>';
breakEntry.appendChild(breakFieldTo);

var breakColor = document.createElement("td");
breakColor.innerHTML = '<input class="color" id="cp'+breakCount+'" onchange="colorChange('+breakCount+')" style="width:50px;">';
breakEntry.appendChild(breakColor);


var addBreak = document.createElement("td");
addBreak.setAttribute("id", "td"+breakCount);
addBreak.innerHTML = '<input type="image" src="images/plus20.png" id="addBtn'+breakCount+'" onclick="addIndivBreakField()" >';
breakEntry.appendChild(addBreak);


breaksList.appendChild(breakEntry);


jscolor.init();


}
function addIndivBreakField() {
var initialFrom = minValues[activeLayer];
var initialTo = maxValues[activeLayer];

function remIndivBreakField(count){
var d = document.getElementById("Breaks");
var olddiv = document.getElementById("tr"+count);
d.removeChild(olddiv);

}
if (breakCount > 0) {
initialFrom = document.getElementById("breakTo" + (breakCount)).value;
initialTo = parseInt(document.getElementById("breakTo" + (breakCount)).value);

var d = document.getElementById("td" + breakCount);
var olddiv = document.getElementById("addBtn" + breakCount);
d.removeChild(olddiv);

var rembtn = document.createElement("input");
rembtn.setAttribute("type", "image");
rembtn.setAttribute("id", "rembtn" + (breakCount));
rembtn.setAttribute("onclick", "remIndivBreakField(" + breakCount + ")");
rembtn.setAttribute("src", "images/close20.png");
d.appendChild(rembtn);
}

breakCount++;
var breaksList = document.getElementById("Breaks");

var breakEntry = document.createElement("tr");
breakEntry.setAttribute("id", "tr" + breakCount);

var breakFieldFrom = document.createElement("td");
breakFieldFrom.innerHTML = '<input type="text" class="range" id="breakFrom' + breakCount + '" value="' + initialFrom + '"></input>';
breakEntry.appendChild(breakFieldFrom);

var breakFieldTo = document.createElement("td");
breakFieldTo.innerHTML = '<input type="text" class="range" id="breakTo' + breakCount + '" value="' + initialTo + '"></input>';
breakEntry.appendChild(breakFieldTo);

var breakColor = document.createElement("td");
breakColor.innerHTML = '<input class="color" id="cp' + breakCount + '" onchange="colorChange(' + breakCount + ')" style="width:50px;">';
breakEntry.appendChild(breakColor);


var addBreak = document.createElement("td");
addBreak.setAttribute("id", "td" + breakCount);
addBreak.innerHTML = '<input type="image" src="images/plus20.png" id="addBtn' + breakCount + '" onclick="addIndivBreakField()" >';
breakEntry.appendChild(addBreak);


breaksList.appendChild(breakEntry);


jscolor.init();


}

function remIndivBreakField(count) {
var d = document.getElementById("Breaks");
var olddiv = document.getElementById("tr" + count);
d.removeChild(olddiv);

}
103 changes: 24 additions & 79 deletions lwl-style.css
Original file line number Diff line number Diff line change
@@ -1,73 +1,30 @@
.myButton {


background: #9cb5e6;
background-color:#ededed;
-moz-border-radius:6px;
-webkit-border-radius:6px;
border-radius:6px;
border:1px solid #dcdcdc;
display:inline-block;

font-family:verdana;
font-size:15px;
font-weight:bold;
padding:6px 5px;
text-decoration:none;

}.myButton:hover {

background-color:#dbdbdb;

}.myButton:active {
position:right;
top:1px;
}
.icons {
background: #9cb5e6;
background-color:#ededed;
-moz-border-radius:6px;
-webkit-border-radius:6px;
border-radius:6px;
border:1px solid #dcdcdc;
display:inline-block;

.myButtonx {


background: #9cb5e6;
background-color:#ededed;
-moz-border-radius:6px;
-webkit-border-radius:6px;
border-radius:6px;
border:1px solid #dcdcdc;
display:inline-block;

font-family:verdana;
font-size:10px;
font-weight:bold;
padding:4px 5px;
text-decoration:none;

}.myButtonx:hover {

background-color:#dbdbdb;

}.myButtonx:active {
position:right;
top:1px;
}
.simpleInfoWindow, .simpleInfoWindow .title {
border-color: #5C9CFF;
}
.simpleInfoWindow .title{
font-family:verdana;
font-size:15px;
font-weight:bold;
padding:6px 5px;
text-decoration:none;

}.icons:hover {
background-color:#dbdbdb;

}.icons:active {
position:right;
top:1px;
}
html, body {
height: 100%; width: 100%;
margin: 0; padding: 0;
}
body{
background-color: #fff; overflow:hidden;
font-family: sans-serif;
}

.wipe-menu {
background-color:#ededff;
border-radius:6px;
border:1px solid #dcdcdc;
background-color:#ededff;
border-radius:6px;
border:1px solid #dcdcdc;
margin:2em;
padding:0.5em;
text-align:left;
Expand All @@ -90,12 +47,7 @@ top: 00px;
opacity: 0;
}

.simpleInfoWindow, .simpleInfoWindow .title {
border-color: #5C9CFF;
}
.simpleInfoWindow .title{
font-weight:bold;
}

html, body {
height: 100%; width: 100%;
margin: 0; padding: 0;
Expand All @@ -113,13 +65,6 @@ div.title{
font-weight:bold;
}

.range, range{
width:65px;
height:20px;
border:1px solid #9cb5e6;
background-color:#aac3f4;
}

#legend_graphicsLayer1_1 {
max-height: 100px;
max-height: 100px;
}
Loading

0 comments on commit c606789

Please sign in to comment.