Commit 65a0d3c1 authored by Clément Igonet's avatar Clément Igonet

Main web site.

parent 1aa5b7ea
localhost:8080
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Open Earth View - about</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet">
<link rel="stylesheet" href="css/mybootstrap.css" type="text/css">
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="brand" href="index.html">\O/pen Earth View</a>
<div class="nav-collapse collapse">
<ul class="nav">
<li><a href="home.html">Home</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Demo <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="mapsimple.html">Map simple</a></li>
<li><a href="mapbuilding.html">Map with buildings</a></li>
<li><a href="mapelevation.html">Map with elevation</a></li>
</ul>
</li>
<li><a href="dev.html">Dev</a></li>
<li><a href="contact.html">Contact</a></li>
<li class="active"><a href="about.html">About</a></li>
</ul>
</div>
</div>
</div>
</div>
<div class="container main">
<h1>Open Earth View</h1>
<p>Welcome to the Open Earth View project.<br>
Open Earth View is an open source and free (libre) project.<br>
The goal is to provide a project that rely on open standards</p>
</div>
<script src="bower_components/jquery/dist/jquery.min.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
</body>
</html>
{
"name": "open-earth-view-viewer-earth3",
"authors": [
"Clément Igonet <clement@igonet.fr>"
],
"description": "Open Earth View project - Earth viewer 3",
"main": "index.html",
"moduleType": [
"none"
],
"keywords": [
"threejs",
"3D",
"osm"
],
"license": "MIT",
"homepage": "http://wiki.openstreetmap.org/wiki/Open_Earth_View",
"ignore": [
"**/.*",
"node_modules",
"bower_components"
],
"dependencies": {
"three.js": "",
"turf": "",
"bootstrap": "",
"jquery": ""
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Open Earth View - web site</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
<style>
body {
min-height: 2000px;
padding-top: 40px;
}
</style>
<link href="bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet">
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="brand" href="index.html">\O/pen Earth View</a>
<div class="nav-collapse collapse">
<ul class="nav">
<li><a href="home.html">Home</a></li>
<li><a href="demo.html">Demo</a></li>
<li><a href="dev.html">Dev</a></li>
<li class="active"><a href="contact.html">Contact</a></li>
<li><a href="about.html">About</a></li>
</ul>
</div>
</div>
</div>
</div>
<div class="container main">
<h1>Open Earth View</h1>
<p>Welcome to the Open Earth View project.
<br> You will discover our mission.</p>
</div>
<script src="bower_components/jquery/dist/jquery.min.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
</body>
</html>
html {
/*margin: 0;*/
height: 100%;
/*width: 100%;*/
}
body {
/*padding-top: 40px;*/
margin: 0;
height: 100%;
padding-left: 0px;
padding-right: 0px;
/*width: 100%;*/
}
#osmworld {
height: 100%;
margin: 0;
width: 100%;
}
.fill {
margin: 0;
margin-left: 0;
margin-right: 0;
min-height: 100%;
height: 100%;
width: 100%;
}
.navbar {
margin-bottom: 0px;
margin-left: 0px;
margin-right: 0px;
}
.container {
margin: 0px;
padding-left: 10px;
}
#openearthviewcanvas {
width: 100%;
height: 100%
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Open Earth View - demo</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet">
<link rel="stylesheet" href="css/mybootstrap.css" type="text/css">
<link rel="stylesheet" href="css/openearthview.css" type="text/css">
<script src="node_modules/three/build/three.js"></script>
<script src="js/turf/v2.0.2/turf.min.js"></script>
<script src="js/openearthview.js" type="text/javascript"></script>
<script src="js/toolbox.js" type="text/javascript"></script>
<script src="js/loaders/TileLoader.js" type="text/javascript"></script>
<script src="js/loaders/TerrainLoader.js" type="text/javascript"></script>
<script src="js/loaders/GeojsonLoader.js"></script>
<script src="js/loaders/mapzenGeojsonLoader.js"></script>
<script src="js/controls/EarthControls.js"></script>
<script src="js/layers/Layer.js"></script>
<script src="js/layers/OsmLayer.js"></script>
<script src="js/layers/BuildingLayer.js"></script>
<script src="js/terrains/Terrain.js"></script>
<script src="js/terrains/FlatTerrain.js"></script>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="brand" href="index.html">\O/pen Earth View</a>
<div class="nav-collapse collapse">
<ul class="nav">
<li><a href="home.html">Home</a></li>
<li class="dropdown active">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Demo <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="mapsimple.html">Map simple</a></li>
<li><a href="mapbuilding.html">Map with buildings</a></li>
<li><a href="mapelevation.html">Map with elevation</a></li>
</ul>
</li>
<li><a href="dev.html">Dev</a></li>
<li><a href="contact.html">Contact</a></li>
<li><a href="about.html">About</a></li>
</ul>
</div>
</div>
</div>
</div>
<div class="fill">
<div id="osmworld"></div>
</div>
<script type="text/javascript">
var world = new OpenEarthView.World("osmworld");
world.addLayer(new OpenEarthView.Layer.OSM(
"OpenStreetMap", [
"https://a.tile.openstreetmap.org/${z}/${x}/${y}.png",
"https://b.tile.openstreetmap.org/${z}/${x}/${y}.png",
"https://c.tile.openstreetmap.org/${z}/${x}/${y}.png"
]));
world.setCenter(2.3364709900972684, 48.86045538042749);
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
world.setCenter(position.coords.longitude, position.coords.latitude);
});
}
</script>
<!-- <script src="bower_components/jquery/dist/jquery.min.js"></script> -->
<!-- <script src="bower_components/jquery/dist/jquery.js"></script> -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Open Earth View - dev</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet">
<link rel="stylesheet" href="css/mybootstrap.css" type="text/css">
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="brand" href="index.html">\O/pen Earth View</a>
<div class="nav-collapse collapse">
<ul class="nav">
<li><a href="home.html">Home</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Demo <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="mapsimple.html">Map simple</a></li>
<li><a href="mapbuilding.html">Map with buildings</a></li>
<li><a href="mapelevation.html">Map with elevation</a></li>
</ul>
</li>
<li class="active"><a href="dev.html">Dev</a></li>
<li><a href="contact.html">Contact</a></li>
<li><a href="about.html">About</a></li>
</ul>
</div>
</div>
</div>
</div>
<div class="container main">
<h1>Open Earth View - dev</h1>
<p>Welcomes to developers.<br>
Here you will learn how to start with Open Earth View features.</p>
</div>
<script src="bower_components/jquery/dist/jquery.min.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Open Earth View - home</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet">
<link rel="stylesheet" href="css/mybootstrap.css" type="text/css">
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="brand" href="index.html">\O/pen Earth View</a>
<div class="nav-collapse collapse">
<ul class="nav">
<li class="active"><a href="home.html">Home</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Demo <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="mapsimple.html">Map simple</a></li>
<li><a href="mapbuilding.html">Map with buildings</a></li>
<li><a href="mapelevation.html">Map with elevation</a></li>
</ul>
</li>
<li><a href="dev.html">Dev</a></li>
<li><a href="contact.html">Contact</a></li>
<li><a href="about.html">About</a></li>
</ul>
</div>
</div>
</div>
</div>
<div class="container main">
<h1>Open Earth View</h1>
<p>Welcome to the Open Earth View project.
<br> You will discover our mission.</p>
</div>
<script src="bower_components/jquery/dist/jquery.min.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Open Earth View - web site</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet">
<link rel="stylesheet" href="css/mybootstrap.css" type="text/css">
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="brand active" href="index.html">\O/pen Earth View</a>
<div class="nav-collapse collapse">
<ul class="nav">
<li><a href="home.html">Home</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Demo <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="mapsimple.html">Map simple</a></li>
<li><a href="mapbuilding.html">Map with buildings</a></li>
<li><a href="mapelevation.html">Map with elevation</a></li>
</ul>
</li>
<li><a href="dev.html">Dev</a></li>
<li><a href="contact.html">Contact</a></li>
<li><a href="about.html">About</a></li>
</ul>
</div>
</div>
</div>
</div>
<div class="container main">
<h1>Open Earth View</h1>
<p>Welcome to the Open Earth View project.
<br> You will discover our mission.</p>
</div>
<script src="bower_components/jquery/dist/jquery.min.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
</body>
</html>
This diff is collapsed.
// world.addLayer(new OpenEarthView.Layer.OSM(
// "OpenStreetMap", [
// "http://a.tile.openstreetmap.org/${z}/${x}/${y}.png",
// "http://b.tile.openstreetmap.org/${z}/${x}/${y}.png",
// "http://c.tile.openstreetmap.org/${z}/${x}/${y}.png"
// ]));
OpenEarthView.Layer.Building = function(name, urls, options) {
this.name = (name !== undefined) ? name : 'OpenEarthView';
if (options !== undefined) {
this.minZoom = (options.minZoom !== undefined)?options.minZoom:18;
console.log('minZoom: ' + this.minZoom);
}
if (OpenEarthViewLayers.hasOwnProperty(name)) {
console.err('Cannot register this already existing layer !');
return;
}
OpenEarthViewLayers[name] = (urls !== undefined) ? urls : [
'http://localhost:8081/3dtile?format=geojson&xtile=${x}&ytile=${y}&zoom=${z}'
];
};
OpenEarthView.Layer.Building.prototype = {
constructor: OpenEarthView.Layer.Building,
type: 'building',
getName: function() {
return this.name
},
getUrl: function(zoom, xtile, ytile) {
var scope = this;
var urls = OpenEarthViewLayers[scope.name];
var urlRandom = urls[
Math.floor(Math.random() * urls.length)];
// console.log('urlRandom:', urlRandom);
// var url = urlRandom.replace(
// /(.*)\$\{z\}(.*)\$\{x\}(.*)\$\{y\}(.*)/,
// function replacer(match, p1, p2, p3, p4, offset, string) {
// // console.log("Match!");
// return p1 + zoom + p2 + xtile + p3 + ytile + p4;
// });
// var url = urlRandom.replace('${f}', factor);
var url = urlRandom.replace('${z}', zoom);
var url = url.replace('${x}', xtile);
return url.replace('${y}', ytile);
// return url;
}
}
var OpenEarthViewLayers = {};
OpenEarthView.Layer = {};
// world.addLayer(new OpenEarthView.Layer.OSM(
// "OpenStreetMap", [
// "http://a.tile.openstreetmap.org/${z}/${x}/${y}.png",
// "http://b.tile.openstreetmap.org/${z}/${x}/${y}.png",
// "http://c.tile.openstreetmap.org/${z}/${x}/${y}.png"
// ]));
OpenEarthView.Layer.OSM = function(name, urls) {
this.name = (name !== undefined) ? name : 'OpenStreetMap';
if (OpenEarthViewLayers.hasOwnProperty(name)) {
console.err('Cannot register this already existing layer !');
return;
}
OpenEarthViewLayers[name] = (urls !== undefined) ? urls : [
"http://a.tile.openstreetmap.org/${z}/${x}/${y}.png",
"http://b.tile.openstreetmap.org/${z}/${x}/${y}.png",
"http://c.tile.openstreetmap.org/${z}/${x}/${y}.png"
];
};
OpenEarthView.Layer.OSM.prototype = {
constructor: OpenEarthView.Layer.OSM,
type: 'tile',
opacity: 1,
getName: function() {
return this.name
},
getUrl: function(zoom, xtile, ytile) {
var scope = this;
var urls = OpenEarthViewLayers[scope.name];
var urlRandom = urls[
Math.floor(Math.random() * urls.length)];
// console.log('urlRandom:', urlRandom);
// var url = urlRandom.replace(
// /(.*)\$\{z\}(.*)\$\{x\}(.*)\$\{y\}(.*)/,
// function replacer(match, p1, p2, p3, p4, offset, string) {
// // console.log("Match!");
// return p1 + zoom + p2 + xtile + p3 + ytile + p4;
// });
var url = urlRandom.replace('${z}', zoom);
var url = url.replace('${x}', xtile);
return url.replace('${y}', ytile);
}
}
This diff is collapsed.
/**
Open Earth View - viewer-threejs
The MIT License (MIT)
Copyright (c) 2016 Clément Igonet
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.
* @author Clement Igonet
*/
THREE.TerrainLoader = function(manager) {
this.manager = (manager !== undefined) ? manager : THREE.DefaultLoadingManager;
};
// var R = 6378.137;
//
var terrains = {};
var terrainRequests = {};
var terrainAliveRequests = {};
var terrainAliveRequestsCount = 0;
var terrainRequestsCount = 0;
var MAX_ELEVATION_REQUEST = 10;
THREE.TerrainLoader.prototype = {
constructor: THREE.TerrainLoader,
crossOrigin: undefined,
load: function(url, onLoad, onProgress, onError) {
var scope = this;
var loader = new THREE.XHRLoader(scope.manager);
if (terrains.hasOwnProperty(url)) {
terrain = terrains[url];
try {
var myTerrain = JSON.parse(terrain);
onLoad(scope.parse(myTerrain));
} catch (e) {
console.error('Cannot parse terrain data (' + url + ')');
onLoad(scope.parse({}));
}
} else {
terrainRequestsCount = terrainRequestsCount +
(terrainRequests.hasOwnProperty(url) ? 0 : 1);
terrainRequests[url] = {
onLoad: onLoad,
onProgress: onProgress,
onError: onError
}
scope.loadNextTerrain();
}
},
loadNextTerrain: function() {
var scope = this;
var loader = new THREE.XHRLoader(scope.manager);
while (terrainAliveRequestsCount < MAX_ELEVATION_REQUEST && terrainRequestsCount > 0) {
var urls = Object.keys(terrainRequests);
var url = urls[urls.length - 1];
terrainAliveRequestsCount = terrainAliveRequestsCount +
(terrainAliveRequests.hasOwnProperty(url) ? 0 : 1);
console.log('terrainAliveRequestsCount:', terrainAliveRequestsCount);
terrainAliveRequests[url] = terrainRequests[url];
var onLoad = terrainAliveRequests[url].onLoad;
var onProgress = terrainAliveRequests[url].onProgress;
var onError = terrainAliveRequests[url].onError;
var lod = terrainAliveRequests[url].lod;
var defaultColor = terrainAliveRequests[url].defaultColor;
delete terrainRequests[url];
terrainRequestsCount--;
(function(url, onLoad, onProgress, onError) {
loader.load(
url,
function(terrain) {
if (terrainAliveRequests.hasOwnProperty(url)) {
delete terrainAliveRequests[url];
terrainAliveRequestsCount--;
console.log('terrainAliveRequestsCount:', terrainAliveRequestsCount);
try {
var myTerrain = JSON.parse(terrain);
terrains[url] = terrain;
onLoad(scope.parse(myTerrain));
} catch (e) {
console.error('Cannot parse terrain data (' + url + ')');
onLoad(scope.parse({}));
}
}
scope.loadNextTerrain();
}, onProgress,
function(geojson) {
if (terrainAliveRequests.hasOwnProperty(url)) {
delete terrainAliveRequests[url];
terrainAliveRequestsCount--;
console.log('terrainAliveRequestsCount:', terrainAliveRequestsCount);
}
scope.loadNextTerrain();
});
})(url, onLoad, onProgress, onError, lod, defaultColor);
}
},
setCrossOrigin: function(value) {
this.crossOrigin = value;
},
parse: function(json) {
// var zoom;
// var xtile;
// var ytile;
// var factor;
var tile = new THREE.Mesh();
// var tileGeometry = new THREE.Geometry();
// tileGeometry.vertices = [];
// for (int xIdx = 0; xIdx < Math.pow(2, factor), xIdx++) {
// for (int yIdx = 0; yIdx < Math.pow(2, factor), yIdx++) {
// var x = ((crd[0] - lonOri) / Math.abs(lonOri - crd[0])) * measure(latOri, lonOri, latOri, crd[0]);
// var y = ((crd[1] - latOri) / Math.abs(latOri - crd[1])) * measure(latOri, lonOri, crd[1], lonOri);
// }
// }
// for (var crdIdx = 0; crdIdx < coord.length; crdIdx++) {
// var crd = coord[crdIdx];
// var x = ((crd[0] - lonOri) / Math.abs(lonOri - crd[0])) * measure(latOri, lonOri, latOri, crd[0]);
// var y = ((crd[1] - latOri) / Math.abs(latOri - crd[1])) * measure(latOri, lonOri, crd[1], lonOri);
// tileGeometry.vertices.push(new THREE.Vector3(x, y, 0));
// }
//
// tile.geometry = tileGeometry;
// tile.material = tileMaterial;
return tile;
},
parseMaterials: function(json) {
var materials = {};
return materials;
},
parseGeometry: function(json) {
var geometry = new THREE.BufferGeometry();
return geometry;
},
parseObjects: function(json, materials) {
var scene = new THREE.Scene();
return scene;
},
};
/**
Open Earth View - viewer-threejs
The MIT License (MIT)
Copyright (c) 2016 Clément Igonet
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