Commit bbbe34b2 authored by Luís de Sousa's avatar Luís de Sousa
Browse files

Encapsulated rest application

Former-commit-id: 37194e06
Former-commit-id: 02eafe15e53bc1175287510b12f24534bde71539 [formerly aef4c7578467c6ab30ac8f405eed04f52d0c035c]
Former-commit-id: aaf35d935b5f993a958707884e473dc36872cc9d
parent a6e2dd30

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.
monoliths
*.pyc
app.log
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>wsm.rest</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.python.pydev.PyDevBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.python.pydev.pythonNature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?eclipse-pydev version="1.0"?><pydev_project>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python interpreter</pydev_property>
</pydev_project>
// JavaScript Document
/*
* soils layer
*
* Copyright (c) 2013 Pascal Herijgers
* Eigenveren.nl
*
* Version: 1.0 ()
* Requires: jQuery v1.8.0
* Requires: Google Maps JavaScript API v3
*
* Modified by: Jorge S. Mendes de Jesus
* ISRIC - World Soil Information
*/
/*STARTIN POINT - HACK GOOGLE REQUEST FOR panoid */
var panoramaOptions = {
pano: '0yULvdzU1A0AAAQvOixlLg',
pov: {heading: 390,pitch: 0,zoom: 1.0},
visible: true,
};
var panoWidth ;
var panoHeight;
var workItems;
soilinfo = [
'<img src="info.png" width="25" height="25" alt="Info">',
'<img src="detail.png" width="25" height="25" alt="Details">',
'<img src="pdf.png" width="25" height="25" alt="Description">',
'<img src="youtube.png" width="25" height="25" alt="Video">'
];
var panorama;
var displayItems;
function setWorkItems(){
workItems = $.grep(displayItems, function(n) {
return (n.pano == panorama.getPano() );
});
$('[id^="item"]').remove();
for (var i = 0; i < workItems.length; i++) {
str = '<div class="soil" id="item' + i + '"><a target="_blank" href="' + workItems[i].url + '">' + soilinfo[workItems[i].icon] + '</a></div>';
$('#soils').append(str);
}
window.setTimeout(function (){google.maps.event.trigger(panorama, 'pov_changed')}, 500);
//cant get a proper trigger to display the content
}; //end setWorkItems END OF SCRIPT LOGIC
function readSettings(){
$.ajax({
global: false,
type: "GET",
cache: false,
dataType: "json",
url: "assets/tour/leuven_tour.json",
success: function (data) {
// file not foundgi
if (data === false) {
console.log('Cannot load file:' + inputFile + '.json');
return;
}
displayItems = data;
setWorkItems(); //callback jump
},
error: function (jqXHR, textStatus, errorThrown) {
//maybe bit to extreme..
document.write(jqXHR.responseText);
},
async: true
});
} //end of read settings; //
function addEvents(){
google.maps.event.addListener(panorama, 'pano_changed', function() {
//http://10.75.13.42:8000/index_tour.html
//pov forceren om letter te laten zien
var hHeading = panorama.getPov().heading;
var hPitch = panorama.getPov().pitch;
panorama.setPov({heading: hHeading, pitch: hPitch});
try{
setWorkItems();
} catch(err) {
console.log(err)
}
}); //end of pano_changed event
google.maps.event.addListener(panorama, 'pov_changed', function() {
//console.log(panorama)
heading = panorama.getPov().heading;
pitch = panorama.getPov().pitch;
var hSetting = 0, // heading uit de file
vSetting = 0, // pitch uit de file
left = 0, // hulpvar voor left waarbij 360 graden rond verwerkt is
right = 0, // hulpvar voor right waarbij 360 graden rond verwerkt is
leftPos = 0, // hulpvar voor berekende left position
topPos = 0, // hulpvar voor berekende top position
factor = 0, // hulpvar voor horizontale sinus correctie
corrFactor = 0, // hulpvar voor horizontale sinus correctie
aspectRatio = 0, // aspectratio van pano
corrFactorPitch = 0, // hulpvar voor pitch rekning houdend met verschillende viewport aspectratio's
corrPitch = 0, // hulpvar voor pitch rekning houdend met verschillende viewport aspectratio's
widthItem = 0, // breedte van item dat getoond wordt
heightItem = 0; // hoogte van item dat getoond wordt
zoomLevel = panorama.getZoom();// het zoomlevel
var zoomCorrH = Math.pow(1.75, zoomLevel - 1); // correctie heading ivm zoom
var zoomCorrP = Math.pow(1.95, zoomLevel - 1); // correctie pitch ivm zoom
if (panoWidth > panoHeight) {
aspectRatio = panoWidth / panoHeight;
} else {
aspectRatio = panoHeight / panoWidth;
}
//berekenen van verticale aanpassing ivm andere viewport bij andere aspectratio
corrFactorPitch = 50 + 5 * Math.pow(aspectRatio, 2) - 2;
corrPitch = panoHeight / panoWidth * corrFactorPitch;
//start try here
try {
for (var i = 0; i < workItems.length; i++) {
hSetting = parseFloat(workItems[i].heading);
vSetting = parseFloat(workItems[i].pitch);
left = hSetting - (45 / zoomCorrH);
right = hSetting + (45 / zoomCorrH);
if (left < 0) {
left = 360 + left;
}
if (right > 360) {
right = right - 360;
}
if (heading < 0) {
heading = 360 + heading;
}
// this was missing and therefore
if (heading > 360) {
heading = heading -360;
}
if (left > right) {
if (heading < (90 / zoomCorrH)) {
heading = heading + 360;
}
right = right + 360;
}
widthItem = document.getElementById('item'+i).clientWidth;
//right > heading
if (left < heading ) {
document.getElementById('item'+i).style.display = 'block';
//berekenen van horizontale correctie
factor = 1.0*((heading - left) / (90 / zoomCorrH));
corrFactor = 1 + (Math.sin( 2 * Math.PI * factor) / 30);//change to 30 seems to be better
leftPos = panoWidth - Math.round( factor * corrFactor * panoWidth );
document.getElementById('item'+i).style.left = leftPos.toString()+'px';
heightItem = document.getElementById('item'+i).clientHeight;
if (pitch < (vSetting + (corrPitch / zoomCorrP) ) && pitch > (vSetting - (corrPitch / zoomCorrP))) {
topPos = panoHeight - Math.abs( Math.round( ((pitch - vSetting - (corrPitch / zoomCorrP) ) / ((corrPitch * 2 - 2) / zoomCorrP)) * panoHeight ) );
document.getElementById('item'+i).style.top = topPos.toString()+'px';
} else {
document.getElementById('item'+i).style.display = 'none';
}
}
else {
document.getElementById('item'+i).style.display = 'none';
}
} //end of for loop
} catch(err) {
//do nothing
};//try for IE
}); //end of pov end
//Necessary reajust when zoom is changed
google.maps.event.addListener(panorama, 'zoom_changed', function(){google.maps.event.trigger(panorama, 'pov_changed')})
}; // end addevents
function initTour(){
//jQuery( document ).ready(function() {
panorama = new google.maps.StreetViewPanorama(document.getElementById('pano'), panoramaOptions);
panoWidth = document.getElementById('pano').offsetWidth;
panoHeight = document.getElementById('pano').offsetHeight;
addEvents();
readSettings();
//});
}
\ No newline at end of file
[
{
"monolith": "understanding soil nr 1 Dystric regosol",
"url": "http://isis.isric.org/monoliths/reference-soil-id010",
"notes": "pic",
"pitch": -30,
"pano": "1yp4pugP5JAAAAQvOiwz0g",
"heading": 490,
"icon": 0.0
},
{
"monolith": "understanding soil 2 Gleyic acrisol",
"url": "http://isis.isric.org/monoliths/reference-soil-ng015",
"notes": "pic",
"pitch":-30,
"pano": "1yp4pugP5JAAAAQvOiwz0g",
"heading": 420,
"icon": 0.0
},
{
"monolith": "understanding soilvolgnr3 Vertisol",
"url": "http://isis.isric.org/monoliths/reference-soil-zw006",
"notes": "pic",
"pitch": -30,
"pano": "GRAhZRLHDPEAAAQvOi1DOg",
"heading": 485,
"icon": 0.0
},
{
"monolith": "understanding soilvolgnr 4",
"url": "http://isis.isric.org/monoliths/reference-soil-hu020",
"notes": "pic",
"pitch": -30,
"pano": "GRAhZRLHDPEAAAQvOi1DOg",
"heading": 430,
"icon": 0.0
},
{
"monolith": "What are soils made of 5",
"url": "http://isis.isric.org/monoliths/reference-soil-eak11",
"notes": "pic",
"pitch": -30,
"pano": "vH3gxHh52DgAAAQvOiqBsg",
"heading": 415,
"icon": 0.0
},
{
"monolith": "What are soils made of 6",
"url": "http://isis.isric.org/monoliths/reference-soil-ng004",
"notes": "pic",
"pitch": -30,
"pano": "vH3gxHh52DgAAAQvOiqBsg",
"heading": 425,
"icon": 0.0
},
{
"monolith": "What are soils made of 7",
"url": "http://isis.isric.org/monoliths/reference-soil-nig22",
"notes": "pic",
"pitch": -30,
"pano": "vH3gxHh52DgAAAQvOiqBsg",
"heading": 485,
"icon": 0.0
},
{
"monolith": "What are soils made of 8",
"url": "http://isis.isric.org/monoliths/reference-soil-jm004",
"notes": "pic",
"pitch": -30,
"pano": "vH3gxHh52DgAAAQvOiqBsg",
"heading": 495,
"icon":0.0
},
{
"monolith": "vitrine 9 Arenosol",
"url": "http://isis.isric.org/monoliths/reference-soil-ml006",
"notes": "pic",
"pitch": -30,
"pano": "XBpMl7XEPCQAAAQvOiqBsw",
"heading": 480,
"icon": 0.0
} ,
{
"monolith": "vitrine 10 Ferralsol",
"url": "http://isis.isric.org/monoliths/reference-soil-ga004",
"notes": "pic",
"pitch": -30,
"pano": "XBpMl7XEPCQAAAQvOiqBsw",
"heading":490,
"icon": 0.0
} ,
{
"monolith": "Forest CD1 Xantic ferralsol 11",
"url": "http://isis.isric.org/monoliths/reference-soil-cd001",
"notes": "pic",
"pitch": -30,
"pano": "GMBH_aycTdsAAAQvOiloKA",
"heading": 340,
"icon": 0.0
} ,
{
"monolith": "Agroforestry",
"url": "pdf/Atlas-focus-04_A3.pdf",
"notes": "pic",
"pitch":10,
"pano": "GMBH_aycTdsAAAQvOiloKA",
"heading": 306,
"icon": 2.0
} ,
{
"monolith": "Termites",
"url": "pdf/Atlas-focus-02_A3.pdf",
"notes": "pic",
"pitch":-15,
"pano": "sVcHNOIcnhkAAAQvOisMmg",
"heading": 470,
"icon": 2.0
} ,
{
"monolith": "Agroforestry",
"url": "pdf/Atlas-focus-02_A3.pdf",
"notes": "pic",
"pitch":-11,
"pano": "iN5PlwpDWCYAAAQvOi1DPw",
"heading": 423,
"icon": 2.0
} ,
{
"monolith": "vitrine rare vormen bovenste",
"url": "images/leuven_tour/spinshape.jpg",
"notes": "pic",
"pitch":5,
"pano": "iN5PlwpDWCYAAAQvOi1DPw",
"heading": 52,
"icon": 1.0
} ,
{
"monolith": "vitrine rare vormen onder 1",
"url": "images/leuven_tour/Rechts_majorSoilscapes.jpg",
"notes": "pic",
"pitch":-10,
"pano": "iN5PlwpDWCYAAAQvOi1DPw",
"heading": 32,
"icon": 1.0
} ,
{
"monolith": "vitrine rare vormen onder 2",
"url": "images/leuven_tour/Paddestoelvorm.jpg",
"notes": "pic",
"pitch":-10,
"pano": "iN5PlwpDWCYAAAQvOi1DPw",
"heading": 42,
"icon": 1.0
} ,
{
"monolith": "vitrine rare vormen onder 3",
"url": "images/leuven_tour/Gedrochten.jpg",
"notes": "pic",
"pitch":-10,
"pano": "iN5PlwpDWCYAAAQvOi1DPw",
"heading": 52,
"icon": 1.0
} ,
{
"monolith": "Soilscapes of African mountains 12 KE39",
"url": "http://isis.isric.org/monoliths/reference-soil-ke039",
"notes": "pic",
"pitch": -30,
"pano": "SMlqfFM4VCcAAAQvOi1DOw",
"heading": 342,
"icon": 0.0
},
{
"monolith": "The trouble with vertisols",
"url": "pdf/Atlas-focus-05_A3.pdf",
"notes": "pic",
"pitch":-15,
"pano": "SMlqfFM4VCcAAAQvOi1DOw",
"heading": -44,
"icon": 2.0
} ,
{
"monolith": "Soilscapes of African mountains 13 KE44 Nitisol",
"url": "http://isis.isric.org/monoliths/reference-soil-ke044",
"notes": "pic",
"pitch": -30,
"pano": "SMlqfFM4VCcAAAQvOi1DOw",
"heading": 400,
"icon": 0.0
},
{
"monolith": "Soilscapes of African mountains 14 KE70 vertisol",
"url": "http://isis.isric.org/monoliths/reference-soil-ke070",
"notes": "pic",
"pitch": -30,
"pano": "SMlqfFM4VCcAAAQvOi1DOw",
"heading": 410,
"icon": 0.0
},
{
"monolith": "What is a color",
"url": "pdf/Atlas-focus-01_A3.pdf",
"notes": "pic",
"pitch":-15,
"pano": "XBpMl7XEPCQAAAQvOiqBsw",
"heading":96,
"icon": 2.0
} ,
{
"monolith": " 1e vitrine voor hoek, naast color",
"url": "images/leuven_tour/ropy_lava.jpg",
"notes": "pic",
"pitch":-28.02923029837742,
"pano": "XBpMl7XEPCQAAAQvOiqBsw",
"heading":410,
"icon": 1.0
} ,
{
"monolith": " 1e vitrine voor hoek, naast color vanuit hoek gezien",
"url": "images/leuven_tour/ropy_lava.jpg",
"notes": "pic",
"pitch":-25,
"pano": "zCAQow75uOoAAAQvOiloLA",
"heading":135,
"icon": 1.0
} ,
{
"monolith": " 1e vitrine voor hoek, naast color vanuit hoek gezien",
"url": "images/leuven_tour/Plinthite.jpg",
"notes": "pic",
"pitch":-20,
"pano": "zCAQow75uOoAAAQvOiloLA",
"heading":130,
"icon": 1.0
} ,
{
"monolith": "Stenen vitrine bij what is in a color",
"url": "/images/leuven_tour/Plinthite.jpg",
"notes": "pic",
"pitch": -20,
"pano": "XBpMl7XEPCQAAAQvOiqBsw",
"heading": 410,
"icon": 1.0
},
{
"monolith": "open stenen tafel",
"url": "images/leuven_tour/Bauxite.jpg",
"notes": "pic",
"pitch": -10,
"pano": "zCAQow75uOoAAAQvOiloLA",
"heading": -2,
"icon": 1.0
} ,
{
"monolith": "Soilscapes of the Sahel and Savannah zone 16",
"url": "http://rest.museum2.isric.org/monoliths/original/jpg/HU-021-def.jpg",
"notes": "pic",
"pitch": -30,
"pano": "sVcHNOIcnhkAAAQvOisMmg",
"heading": 400,
"icon": 0.0
} ,
{
"monolith": "Soilscapes of the Sahel and Savannah zone 17",
"url": "http://isis.isric.org/monoliths/reference-soil-ng016",
"notes": "pic",
"pitch": -30,
"pano": "sVcHNOIcnhkAAAQvOisMmg",
"heading": 410,
"icon": 0.0
} ,
{
"monolith": "Soilscapes of the Sahel and Savannah zone 18",
"url": "http://isis.isric.org/monoliths/reference-soil-ke003",
"notes": "pic",
"pitch": -30,
"pano": "sVcHNOIcnhkAAAQvOisMmg",
"heading": 320,
"icon": 0.0
} ,
{
"monolith": "Soilscapes of the Sahel and Savannah zone 18",
"url": "http://isis.isric.org/monoliths/reference-soil-ke003",
"notes": "pic",
"pitch": -30,
"pano": "hNlnVEO_8ycAAAQvOiloKw",
"heading": 400,
"icon": 0.0
} ,
{
"monolith": "--ferralsol,plinthosol,plinthosol 19 NIG 021",
"url": "http://isis.isric.org/monoliths/reference-soil-ng021",
"notes": "pic",
"pitch": -30,
"pano": "a61Npy-PHokAAAQvOiPUPg",
"heading": 353,
"icon": 0.0
},
{
"monolith": "ferralsol,--plinthosol,plinthosol 20ZW11",
"url": "http://isis.isric.org/monoliths/reference-soil-zw011",
"notes": "pic",
"pitch": -30,
"pano": "a61Npy-PHokAAAQvOiPUPg",
"heading": 363,
"icon": 0.0
},
{
"monolith": "Unforgiving iron",
"url": "pdf/Atlas-focus-06_A3.pdf",
"notes": "pic",
"pitch":-29,
"pano": "a61Npy-PHokAAAQvOiPUPg",
"heading": 39,
"icon": 2.0
} ,
{
"monolith": "laatste vitrine",
"url": "images/leuven_tour/plinthite.jpg",
"notes": "pic",
"pitch":-6,
"pano": "a61Npy-PHokAAAQvOiPUPg",
"heading":42,
"icon": 1.0
} ,
{
"monolith": "laatste vitrine",
"url": "images/leuven_tour/bauxiet-ra.jpg",
"notes": "pic",
"pitch":-6,
"pano": "a61Npy-PHokAAAQvOiPUPg",
"heading":50,
"icon": 1.0
} ,
{
"monolith": "laatste vitrine",
"url": "images/leuven_tour/bauxiet-rv.jpg",
"notes": "pic",
"pitch":-8,
"pano": "a61Npy-PHokAAAQvOiPUPg",
"heading":50,
"icon": 1.0
} ,