How to use the tar.name function in tar

To help you get started, we’ve selected a few tar examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TheTacoScott / GoAtThrottleUp / ServerRelay / static / js / main.js View on Github external
var $datafound = false;
	var $incdelta = -1;
	var $eccdelta = -1;
  
  
	if ('tar.distance' in $globaldata && 'o.ApA' in $globaldata)
	{

    $(".tar-distance-readout").text($globaldata['tar.distance'].toFixed(0).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","));
    $(".tar-distance-apa-delta-readout").text(($globaldata['o.ApA'] - $globaldata['tar.distance']).toFixed(0).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","));
        
	}
  //console.log($targetid);
  if ('tar.phaseAngle' in $globaldata && 'tar.eccentricity' in $globaldata && 'tar.inclination' in $globaldata && 'tar.name' in $globaldata)
  {
    if ($globaldata['tar.name'] != "No Target")
    {
      //console.log("Heat?" + $globaldata["v.overheatRatio"]);
      //console.log($globaldata["v.geeForce"]);
      $(".tar-phase-readout").text($globaldata['tar.phaseAngle'].toFixed(3));
      $("#gauge-phaseangle").val($globaldata['tar.phaseAngle']);
      $(".tar-sphere-readout").text(SPHERES[$globaldata['tar.name']].toFixed(0).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","));
      $(".tar-distance2sphere-readout").text(($globaldata['tar.distance']-SPHERES[$globaldata['tar.name']]).toFixed(0).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","));
      $(".tar-eccentricity-readout").text($globaldata['tar.eccentricity'].toFixed(4));
      $("#gauge-target-eccentricity").val($globaldata['tar.eccentricity']);
      $(".tar-inclination-readout").text($globaldata['tar.inclination'].toFixed(4));
      $("#gauge-target-inclination").val($globaldata['tar.inclination']);
    }
  }
  if ('o.inclination' in $globaldata && 'tar.inclination' in $globaldata && 'o.eccentricity' in $globaldata && 'tar.eccentricity' in $globaldata)
  {
    $incdelta = $globaldata['o.inclination'] - $globaldata['tar.inclination'];
github TheTacoScott / GoAtThrottleUp / ServerRelay / static / js / main.js View on Github external
{

    $(".tar-distance-readout").text($globaldata['tar.distance'].toFixed(0).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","));
    $(".tar-distance-apa-delta-readout").text(($globaldata['o.ApA'] - $globaldata['tar.distance']).toFixed(0).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","));
        
	}
  //console.log($targetid);
  if ('tar.phaseAngle' in $globaldata && 'tar.eccentricity' in $globaldata && 'tar.inclination' in $globaldata && 'tar.name' in $globaldata)
  {
    if ($globaldata['tar.name'] != "No Target")
    {
      //console.log("Heat?" + $globaldata["v.overheatRatio"]);
      //console.log($globaldata["v.geeForce"]);
      $(".tar-phase-readout").text($globaldata['tar.phaseAngle'].toFixed(3));
      $("#gauge-phaseangle").val($globaldata['tar.phaseAngle']);
      $(".tar-sphere-readout").text(SPHERES[$globaldata['tar.name']].toFixed(0).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","));
      $(".tar-distance2sphere-readout").text(($globaldata['tar.distance']-SPHERES[$globaldata['tar.name']]).toFixed(0).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","));
      $(".tar-eccentricity-readout").text($globaldata['tar.eccentricity'].toFixed(4));
      $("#gauge-target-eccentricity").val($globaldata['tar.eccentricity']);
      $(".tar-inclination-readout").text($globaldata['tar.inclination'].toFixed(4));
      $("#gauge-target-inclination").val($globaldata['tar.inclination']);
    }
  }
  if ('o.inclination' in $globaldata && 'tar.inclination' in $globaldata && 'o.eccentricity' in $globaldata && 'tar.eccentricity' in $globaldata)
  {
    $incdelta = $globaldata['o.inclination'] - $globaldata['tar.inclination'];
    $("#gauge-inclination-delta").val($incdelta);
    $(".inclination-delta-readout").text($incdelta.toFixed(4));
    
    $eccdelta = $globaldata['o.eccentricity'] - $globaldata['tar.eccentricity'];
    $("#gauge-eccentricity-delta").val($eccdelta);
    $(".eccentricity-delta-readout").text($eccdelta.toFixed(4));
github tcannonfodder / houston / public / assets / js / hohmann-intercept.js View on Github external
isnoTarget:function(data){
    return data['tar.name'].toLowerCase() == "no target selected."
  },
github tcannonfodder / houston / static / js / docking_position_data.js View on Github external
var requestParams = {};

    var vesselBody = this.datalink.getOrbitalBodyInfo(positionData["vesselBody"])
    requestParams["vesselBodyTruePosition"] = 'b.o.truePositionAtUT[' + vesselBody.id + ',' + positionData["currentUniversalTime"] + ']'

    requestParams["vesselRelativePosition"] = "o.relativePositionAtUTForOrbitPatch[" + 0 +","+ positionData["currentUniversalTime"] + "]"


    if(positionData['tar.type']){
      if(positionData['tar.o.orbitPatches'] && positionData['tar.o.orbitPatches'].length > 0){
        var targetBody = this.datalink.getOrbitalBodyInfo(positionData["targetBody"])
        requestParams["targetBodyTruePosition"] = 'b.o.truePositionAtUT[' + targetBody.id + ',' + positionData["currentUniversalTime"] + ']'

        requestParams["targetRelativePosition"] = "tar.o.relativePositionAtUTForOrbitPatch[" + 0 +","+ positionData["currentUniversalTime"] + "]"
      } else{
        var body = this.datalink.getOrbitalBodyInfo(positionData['tar.name'])
        requestParams["targetTruePosition"] = 'b.o.truePositionAtUT[' + body.id + ',' + positionData["currentUniversalTime"] + ']'
      }
    }

    this.datalink.sendMessage(requestParams, function(data){
      positionData["vesselCurrentPosition"]["truePosition"] = this.truePositionForRelativePosition(
        data["vesselRelativePosition"], data["vesselBodyTruePosition"]
      )

      if(positionData['tar.type']){
        if(positionData['tar.o.orbitPatches']){
          positionData["targetCurrentPosition"]["truePosition"] = this.truePositionForRelativePosition(
            data["targetRelativePosition"], data["targetBodyTruePosition"]
          )
        } else{
          positionData["targetCurrentPosition"]["truePosition"] = data["targetTruePosition"]
github tcannonfodder / houston / static / js / orbital_position_data.js View on Github external
var referenceBody = this.datalink.getOrbitalBodyInfo(positionData["vesselBody"])
    this.rootReferenceBody = referenceBody
    requestParams["currentReferenceBodyRadius"] = 'b.radius[' + referenceBody.id + ']'
    requestParams["currentReferenceBodyTruePosition"] = 'b.o.truePositionAtUT[' + referenceBody.id + ',' + positionData["currentUniversalTime"] + ']'
    //ask for the relative position of the vessel in the current orbit patch at the current time
    requestParams["vesselCurrentPositionRelativePosition"] = "o.relativePositionAtUTForOrbitPatch[" + 0 +","+ positionData["currentUniversalTime"] + "]"

    this.buildRelativePositionRequestsForOrbitPatches(requestParams, "vesselCurrentOrbit", positionData['o.orbitPatches'], positionData["currentUniversalTime"])
    this.buildRelativePositionRequestsForManeuverNodeOrbitPatches(requestParams, "vesselManeuverNodes", positionData['o.maneuverNodes'], positionData["currentUniversalTime"])

    if(positionData['tar.type']){
      if(positionData['tar.o.orbitPatches'] && positionData['tar.o.orbitPatches'].length > 0){
        this.buildRelativePositionRequestsForOrbitPatches(requestParams, "targetCurrentOrbit", positionData['tar.o.orbitPatches'], positionData["currentUniversalTime"], 'tar.o')
        requestParams["targetCurrentPositionRelativePosition"] = "tar.o.relativePositionAtUTForOrbitPatch[" + 0 +","+ positionData["currentUniversalTime"] + "]"
      } else{
        var body = this.datalink.getOrbitalBodyInfo(positionData['tar.name'])
        requestParams[body.name + "[metadata]radius"] = 'b.radius[' + body.id + ']'
        requestParams[body.name + "["+ positionData["currentUniversalTime"] +"]TruePosition"] = 'b.o.truePositionAtUT[' + body.id + ',' + positionData["currentUniversalTime"] + ']'
        requestParams[body.name + "[metadata]currentTruePosition"] = 'b.o.truePositionAtUT[' + body.id + ',' + positionData["currentUniversalTime"] + ']'
      }
    }

    this.datalink.sendMessage(requestParams, function(data){
      positionData["currentReferenceBodyRadius"] = data["currentReferenceBodyRadius"]
      positionData["currentReferenceBodyTruePosition"] = data["currentReferenceBodyTruePosition"]

      this.buildReferenceBodyPositionData(data, positionData)
      this.buildReferenceBodyMetadata(data, positionData)

      positionData["vesselCurrentPosition"]["relativePosition"] = data["vesselCurrentPositionRelativePosition"]
      this.buildRelativePositionPositionDataForOrbitPatches(data, positionData, "vesselCurrentOrbit", 'o.orbitPatches')
github TheTacoScott / GoAtThrottleUp / ServerRelay / static / js / main.js View on Github external
}
  if ('o.n.body' in $globaldata)
  {
    $(".n-orbiting-type-readout").text($globaldata['o.n.type']);
    $(".n-orbiting-body-readout").text($globaldata['o.n.body']);
    $(".orbiting-type-readout").text($globaldata['o.type']);
    $(".n-o-apa-readout").text($globaldata['o.n.ApA'].toFixed(0).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","));
    $(".n-o-per-readout").text($globaldata['o.n.PeA'].toFixed(0).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","));
    $(".n-o-apa-time-readout").text(dayhourMinSec($globaldata['o.n.timeToAp']));
    $(".n-o-per-time-readout").text(dayhourMinSec($globaldata['o.n.timeToPe']));    
  }
	
	//encounter
	if ('v.body' in $globaldata) { $(".orbiting-body-readout").text($globaldata['v.body']); }
	if ('v.orbitalVelocity' in $globaldata) {	$(".o-velocity-readout").text($globaldata['v.orbitalVelocity'].toFixed(0).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")); }
	if ('tar.name' in $globaldata) { $(".tar-name-readout").text($globaldata['tar.name']); }
	if ('v.angleToPrograde' in $globaldata)
	{
		$(".angle-to-prograde-readout").text($globaldata['v.angleToPrograde'].toFixed(2));
		$("#gauge-angle2prograde").val($globaldata['v.angleToPrograde']);
	}
	if ('o.eccentricity' in $globaldata && 'o.inclination' in $globaldata)
	{
		$(".eccentricity-readout").text($globaldata['o.eccentricity'].toFixed(4));
		$("#gauge-eccentricity").val($globaldata['o.eccentricity']);
		$(".inclination-readout").text($globaldata['o.inclination'].toFixed(4));
		$("#gauge-inclination").val($globaldata['o.inclination']);
	}
	
	var $datafound = false;
	var $incdelta = -1;
	var $eccdelta = -1;
github tcannonfodder / houston / static / js / position_data_formatter.js View on Github external
formatTargetOrbitPatches: function(positionData, formattedData){
    if(!positionData['tar.type']){ return }
    if(positionData["tar.o.orbitPatches"].length > 0){
      formattedData.orbitPatches = formattedData.orbitPatches.concat(this.formatOrbitPatches(
        formattedData, positionData, positionData["tar.o.orbitPatches"], {
          type: "orbitPatch",
          parentType: "targetVessel",
          parentName: positionData["tar.name"]
        },{ linkedPatchType: "orbitPatch" }
      ))
    }
  },
github TheTacoScott / GoAtThrottleUp / ServerRelay / static / js / main.js View on Github external
}
  }
  if ('o.inclination' in $globaldata && 'tar.inclination' in $globaldata && 'o.eccentricity' in $globaldata && 'tar.eccentricity' in $globaldata)
  {
    $incdelta = $globaldata['o.inclination'] - $globaldata['tar.inclination'];
    $("#gauge-inclination-delta").val($incdelta);
    $(".inclination-delta-readout").text($incdelta.toFixed(4));
    
    $eccdelta = $globaldata['o.eccentricity'] - $globaldata['tar.eccentricity'];
    $("#gauge-eccentricity-delta").val($eccdelta);
    $(".eccentricity-delta-readout").text($eccdelta.toFixed(4));
  }
  
	if ('tar.name' in $globaldata)
	{
    if ($globaldata['tar.name']=="No Target")
    {
      $(".tar-distance-readout").text("ERR");
      $(".tar-distance-apa-delta-readout").text("ERR");
      $(".tar-phase-readout").text("ERR");
      $("#gauge-phaseangle").val(0);
      $(".tar-sphere-readout").text("ERR");
      $(".tar-distance2sphere-readout").text("ERR");
      $(".tar-eccentricity-readout").text("ERR");
      $("#gauge-target-eccentricity").val(0);
      $(".tar-inclination-readout").text("ERR");
      $("#gauge-target-inclination").val(0);            
      $("#gauge-inclination-delta").val(0);
      $(".inclination-delta-readout").text("ERR");
      $("#gauge-eccentricity-delta").val(0);
      $(".eccentricity-delta-readout").text("ERR");
    }