-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed inverted z coordinate in systemvis.html.
Added sectorvis.html which shows the distribution of system names. Added coordinates to sysinfo.html. TGC interface now ignores duplicate distances.
- Loading branch information
1 parent
301b44f
commit e735c82
Showing
5 changed files
with
303 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,210 @@ | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml"> | ||
<head> | ||
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> | ||
<title>Systems Visualisation</title> | ||
<script src="external/jquery-2.1.1.js" type="text/javascript"></script> | ||
<script src="external/three.js" type="text/javascript"></script> | ||
<script src="external/TrackballControls.js" type="text/javascript"></script> | ||
<script src="tgc.js" type="text/javascript"></script> | ||
<style> | ||
body { | ||
color: #ffffff; | ||
font-family:Monospace; | ||
font-size:13px; | ||
text-align:center; | ||
font-weight: bold; | ||
|
||
background-color: #000000; | ||
margin: 0px; | ||
overflow: hidden; | ||
} | ||
td { | ||
text-align:left; | ||
} | ||
</style> | ||
<script> | ||
var renderer, scene, camera, pointCloud; | ||
var axes; | ||
|
||
var systems = []; | ||
var validSectors = []; | ||
|
||
var sectorColors = ['white', 'gray', 'aqua', 'teal', 'red', 'maroon', 'blue', 'navy', 'lime', 'green', 'fuchsia', 'purple', 'orange', 'yellow', 'olive','white']; | ||
var sectorColorMap = {}; | ||
|
||
$(document).ready(function () { | ||
getTGCData(function() { | ||
$.getJSON('validsectors.json', function(data) { | ||
validSectors = data; | ||
|
||
var sectorMap = {}; | ||
|
||
$.each(systemsMap, function(k, s) { | ||
if (!('x' in s) || s.x == null) return; | ||
|
||
var matches; | ||
if (matches = s.name.match(/^(.*)\s+([a-z][a-z]-[a-z])\s+([a-g]\d+)(-\d+)?$/i)) { | ||
var sector; | ||
// find the sector, if any: | ||
$.each(validSectors, function(i, sect) { | ||
if (sect.toLowerCase() === matches[1].toLowerCase()) { | ||
sector = sect; | ||
return false; | ||
} | ||
}); | ||
if (!sector) return; | ||
|
||
s.sector = sector; | ||
systems.push(s); | ||
if (sector in sectorMap) { | ||
sectorMap[sector]++; | ||
} else { | ||
sectorMap[sector] = 1; | ||
} | ||
} | ||
}); | ||
|
||
var sectorCount = []; | ||
$.each(sectorMap, function(sect, count) { | ||
sectorCount.push({sector: sect, count: count}); | ||
}); | ||
sectorCount.sort(function(a,b) { | ||
if (b.count !== a.count) return b.count-a.count; | ||
if (a.sector) return a.sector.localeCompare(b.sector); | ||
return b.sector ? -1 : 0; | ||
}); | ||
|
||
var i = 0; | ||
var rest = 0, restNames = 0; | ||
$.each(sectorCount, function() { | ||
if (i < sectorColors.length-1 && this.sector !== '(unknown)') { | ||
$('<tr>') | ||
.append($('<td>').width('1.5em').css('background',sectorColors[i])) | ||
.append($('<td>').text(this.sector+': '+this.count)) | ||
.appendTo('#legend tbody'); | ||
sectorColorMap[this.sector] = sectorColors[i]; | ||
i++; | ||
} | ||
}); | ||
|
||
init(); | ||
}); | ||
}); | ||
}); | ||
|
||
function init() { | ||
var container = document.getElementById('container'); | ||
|
||
renderer = new THREE.WebGLRenderer({ clearColor: 0x000000, clearAlpha: 1 }); | ||
renderer.setSize(window.innerWidth, window.innerHeight); | ||
container.appendChild(renderer.domElement); | ||
|
||
scene = new THREE.Scene(); | ||
|
||
camera = new THREE.PerspectiveCamera( | ||
45, | ||
window.innerWidth / window.innerHeight, | ||
1, | ||
20000); | ||
camera.position.z = 2500; | ||
|
||
controls = new THREE.TrackballControls( camera ); | ||
controls.rotateSpeed = 1.0; | ||
controls.zoomSpeed = 1.2; | ||
controls.panSpeed = 0.8; | ||
controls.noZoom = false; | ||
controls.noPan = false; | ||
controls.staticMoving = true; | ||
controls.dynamicDampingFactor = 0.3; | ||
controls.keys = [ 65, 83, 68 ]; | ||
controls.addEventListener( 'change', render ); | ||
|
||
var refMaterial = new THREE.PointCloudMaterial({ | ||
color: sectorColors[0], | ||
// vertexColors: THREE.VertexColors, | ||
size: 4, | ||
sizeAttenuation: false, | ||
opacity: 1, | ||
map: THREE.ImageUtils.loadTexture("external/images/ball.png"), | ||
transparent: true | ||
}); | ||
var refGeometry = new THREE.Geometry(); | ||
|
||
var material = new THREE.PointCloudMaterial({ | ||
color: 0xffffff, | ||
vertexColors: THREE.VertexColors, | ||
size: 4, | ||
sizeAttenuation: false, | ||
opacity: 1, | ||
map: THREE.ImageUtils.loadTexture("external/images/ball.png"), | ||
transparent: true | ||
}); | ||
var geometry = new THREE.Geometry(); | ||
|
||
$.each(systems, function(i,s){ | ||
if (s.sector in sectorColorMap) { | ||
geometry.vertices.push(new THREE.Vector3( s.x, s.y, -s.z )); | ||
geometry.colors.push(new THREE.Color(sectorColorMap[s.sector])); | ||
} | ||
}); | ||
|
||
pointCloud = new THREE.PointCloud(geometry, material); | ||
pointCloud.sortParticles = true; | ||
scene.add(pointCloud); | ||
|
||
material = new THREE.LineBasicMaterial({ | ||
color: 0x0000ff | ||
}); | ||
|
||
geometry = new THREE.Geometry(); | ||
geometry.vertices.push( | ||
new THREE.Vector3(-100, 0, 0), | ||
new THREE.Vector3(100, 0, 0), | ||
new THREE.Vector3(0, 0, 0), | ||
new THREE.Vector3(0, -100, 0), | ||
new THREE.Vector3(0, 100, 0), | ||
new THREE.Vector3(0, 0, 0), | ||
new THREE.Vector3(0, 0, -100), | ||
new THREE.Vector3(0, 0, 100) | ||
); | ||
|
||
axes = new THREE.Line(geometry, material); | ||
scene.add(axes); | ||
|
||
animate(); | ||
} | ||
|
||
function animate() { | ||
requestAnimationFrame(animate); | ||
controls.update(); | ||
render(); | ||
} | ||
|
||
function render() { | ||
if ($('#autorotate').prop('checked')){ | ||
pointCloud.rotation.x += 0.005; | ||
pointCloud.rotation.y += 0.005; | ||
|
||
axes.rotation.x += 0.005; | ||
axes.rotation.y += 0.005; | ||
} | ||
|
||
renderer.render(scene, camera); | ||
} | ||
|
||
</script> | ||
</head> | ||
<body> | ||
<div id="info">ED Known Sectors<br>Left mouse: rotate - Right mouse: pan - Mouse wheel: zoom<br> | ||
<input type="checkbox" id="autorotate">Animate | ||
<!--<input type="button" value="Switch" id="switch-button">--> | ||
</div> | ||
<div id="legend" style="position: absolute"> | ||
<table><tbody> | ||
</tbody></table> | ||
</div> | ||
<div id="container"></div> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.