Added found object data in findby per feature request by Lustan
This commit is contained in:
parent
abd78b0269
commit
b7f2bbcae9
@ -7,10 +7,21 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Reset view
|
// Reset view
|
||||||
$('.reset-container').click(function(){ reset_view(); });
|
$('.reset-container').click(function(){ reset_view();});
|
||||||
$('#submitfindbyname').click(function() {
|
$('#submitfindbyname').click(function() {
|
||||||
var selected = $('#findbyselect option:selected').text();
|
var selected = $('#findbyselect option:selected').text();
|
||||||
zoomfocus(selected);
|
var object = findObjectInfo(selected);
|
||||||
|
zoomfocus(selected);
|
||||||
|
// Populate information area about target
|
||||||
|
console.log(object)
|
||||||
|
var objdata = "<b>Name: </b>" + object.name + "<br />";
|
||||||
|
objdata += "<br /><b>Location (Galactic Ref.)</b><br /><b>X</b>: " + object.x + "<br/><b>Y</b>: " + object.y + "<br /><b>Z</b>: " + object.z;
|
||||||
|
objdata += "<br /><br /><b>Classification</b><br />" + object.type;
|
||||||
|
objdata += "<br /><br /><b>Owning Faction</b><br />" + object.parent.name;
|
||||||
|
$('#findbydata').html(objdata)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
$('#route_output').change(function() {
|
$('#route_output').change(function() {
|
||||||
var stop=$('#route_output :selected').parent().attr('label');
|
var stop=$('#route_output :selected').parent().attr('label');
|
||||||
|
@ -192,14 +192,14 @@ function animate() {
|
|||||||
|
|
||||||
function render () {
|
function render () {
|
||||||
//requestAnimationFrame( render );
|
//requestAnimationFrame( render );
|
||||||
|
|
||||||
var objectlist = Object.keys(listobjects("stations"));
|
var objectlist = Object.keys(listobjects("stations"));
|
||||||
objectlist.forEach (function(station) { var obj = scene.getObjectByName(escapeHTML(station + "_label")); obj.lookAt(camera.position) }) ;
|
objectlist.forEach (function(station) { var obj = scene.getObjectByName(escapeHTML(station + "_label")); obj.lookAt(camera.position) }) ;
|
||||||
objectlist = Object.keys(listobjects("planets"));
|
objectlist = Object.keys(listobjects("planets"));
|
||||||
objectlist.forEach (function(planet) { var obj = scene.getObjectByName(escapeHTML(planet + "_label")); obj.lookAt(camera.position) }) ;
|
objectlist.forEach (function(planet) { var obj = scene.getObjectByName(escapeHTML(planet + "_label")); obj.lookAt(camera.position) }) ;
|
||||||
objectlist = Object.keys(listobjects("borders"));
|
objectlist = Object.keys(listobjects("borders"));
|
||||||
objectlist.forEach (function(border) { var obj = scene.getObjectByName(border + "_label"); if (obj != undefined) { obj.lookAt(camera.position)} }) ;
|
objectlist.forEach (function(border) { var obj = scene.getObjectByName(border + "_label"); if (obj != undefined) { obj.lookAt(camera.position)} }) ;
|
||||||
|
|
||||||
renderer.render( scene, camera );
|
renderer.render( scene, camera );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -371,7 +371,7 @@ function calcBestRoute(pointa,pointb) {
|
|||||||
|
|
||||||
} // End gate work...
|
} // End gate work...
|
||||||
|
|
||||||
|
|
||||||
// Calculate wormhole route
|
// Calculate wormhole route
|
||||||
// Qon does this by quadrant. Frey does this by brute force. The following may be really scary.
|
// Qon does this by quadrant. Frey does this by brute force. The following may be really scary.
|
||||||
jsonWormhole.forEach(function(wh) { distance_wb[wh.enda.location] = calcDist(pointb,wh.enda.location); distance_wb[wh.endb.location] = calcDist(pointb,wh.endb.location); });
|
jsonWormhole.forEach(function(wh) { distance_wb[wh.enda.location] = calcDist(pointb,wh.enda.location); distance_wb[wh.endb.location] = calcDist(pointb,wh.endb.location); });
|
||||||
@ -449,3 +449,35 @@ function predictDestination(loc,heading,frame) {
|
|||||||
function boundingSphereGrab(name){
|
function boundingSphereGrab(name){
|
||||||
return scene.getObjectByName(name)
|
return scene.getObjectByName(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function findObjectInfo(name) {
|
||||||
|
var object = {};
|
||||||
|
var types = ["stations","planets","borders"];
|
||||||
|
types.forEach(function(type) {
|
||||||
|
for (var key in jsonEmpire) {
|
||||||
|
area=jsonEmpire[key];
|
||||||
|
for (var key2 in area[type]) {
|
||||||
|
|
||||||
|
if(escapeHTML(area[type][key2].name) == name) {
|
||||||
|
object = area[type][key2];
|
||||||
|
object.parent = jsonEmpire[key];
|
||||||
|
switch(type) {
|
||||||
|
case 'planets':
|
||||||
|
object.type = "Planet";
|
||||||
|
break;
|
||||||
|
case 'borders':
|
||||||
|
object.type = "Territory";
|
||||||
|
break;
|
||||||
|
case 'stations':
|
||||||
|
object.type = "Starbase/Base/Station";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
object.type = "Currently Unknown"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}});
|
||||||
|
return object;
|
||||||
|
}
|
||||||
|
@ -128,8 +128,14 @@
|
|||||||
</select> <br />
|
</select> <br />
|
||||||
<input type="checkbox" name="objtype" id="cbp" value="planets" checked><label for="cbp"> Planets</label> <input type="checkbox" name="objtype" id="cbs" value="stations" > <label for="cbs">Stations</label>
|
<input type="checkbox" name="objtype" id="cbp" value="planets" checked><label for="cbp"> Planets</label> <input type="checkbox" name="objtype" id="cbs" value="stations" > <label for="cbs">Stations</label>
|
||||||
<button id="submitfindbyname" class="btn">Find</button>
|
<button id="submitfindbyname" class="btn">Find</button>
|
||||||
|
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
<span class="toolsep"></span>
|
<span class="toolsep"></span>
|
||||||
|
<span>
|
||||||
|
<label>Target Data</label>
|
||||||
|
<p id="findbydata"> </p>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="wvg-tools" id="Plan">
|
<div class="wvg-tools" id="Plan">
|
||||||
<span class="tool-header"> Route Planner </span>
|
<span class="tool-header"> Route Planner </span>
|
||||||
|
Loading…
Reference in New Issue
Block a user