Created
March 23, 2017 10:42
-
-
Save js2me/a35870fe7318041bd179d041808ac980 to your computer and use it in GitHub Desktop.
calculateHeightOfCartesian2.CesiumJS
This file contains hidden or 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
ye sure, | |
//adding first time model to viewer | |
------------------------------------------------------------ | |
var longitude,latitude,altitudeCode,timestamp,heading; | |
altitudeCode = (altitudeCode * 0.3048); | |
var start = Cesium.JulianDate.fromDate(new Date(timestamp * 1000)); | |
var time = Cesium.JulianDate.addSeconds(start, 0, new Cesium.JulianDate()); | |
var property = new Cesium.SampledPositionProperty(); | |
property.forwardExtrapolationType = Cesium.ExtrapolationType.HOLD; | |
var position = Cesium.Cartesian3.fromDegrees(longitude, latitude, altitudeCode); | |
property.addSample(time, position); | |
var orientationProperty = new Cesium.SampledProperty(Cesium.Quaternion); | |
orientationProperty.forwardExtrapolationType = Cesium.ExtrapolationType.HOLD; | |
orientationProperty.addSample(start, new Cesium.Transforms.headingPitchRollQuaternion(position, Cesium.Math.toRadians(heading), 0, 0)); | |
var entity = viewer.entities.add({ | |
name: flightName, | |
id: flightName, | |
position: property, | |
orientation: orientationProperty, | |
show: true, | |
path: { | |
resolution: 1, | |
material: Cesium.Color.ORANGE, | |
width: 2 | |
//leadTime: 5000, | |
//trailTime: 1000, | |
//show: true, | |
}, | |
model: { | |
uri: aircraftsModalURL, | |
minimumPixelSize: 45, | |
scale: scale | |
} | |
}); | |
entity.position.setInterpolationOptions({ | |
interpolationDegree: 2, | |
interpolationAlgorithm: Cesium.LinearApproximation | |
}); | |
//second time when the next new coords data | |
---------------------------------------------------------------- | |
var entityName, getEntity, | |
entitiesArr = viewer.entities.values; | |
var property = getEntity.position; | |
property.numberOfDerivatives = 0; | |
curralt = (curralt * 0.3048); | |
var position = Cesium.Cartesian3.fromDegrees(currlong, currlat, curralt); | |
property.addSample(time, position); | |
getEntity.position = property | |
var orientationEntity = getEntity.orientation; | |
orientationEntity.addSample(Cesium.JulianDate.fromDate( new Date(lasttimespan * 1000), new Cesium.JulianDate), | |
new Cesium.Transforms.headingPitchRollQuaternion(position, (Cesium.Math.toRadians(currheading)), 0, 0) | |
); | |
getEntity.orientation = orientationEntity; | |
this is it | |
i just give you the code where i add the next new coords and creating the model. | |
you can add the object variable a value. | |
Help me out.. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment