我正在尝试使用 argon.js 服务器端,以便可以将 lla 坐标转换为预定义的参考系。我当然不会渲染任何图形,我只是用它来转换值。有关详细信息,请参阅 SO question Using Geo-coordintes 而不是 Cartesian to Draw in Argon and A-Frame 。
根据该线程,我正在尝试为固定坐标创建一个铯实体,稍后我将使用它来创建相对于它的其他实体。var gtrefEntityPose = app.context.getEntityPose(gtrefEntity);
当我这样做时,一切都会运行,直到我收到程序的最后一行Error: A frame state has not yet been received
。
起初我认为这可能是由于将默认引用实体设置为,app.context.setDefaultReferenceFrame(app.context.localOriginEastUpSouth);
因为我还没有本地用户,因为它是服务器端。我查看了setDefaultReferenceFrame的文档以及我可能需要使用convertEntityReferenceFrame以及每个源代码的可能性,但鉴于我对程序的了解,我无法理解它。
我已将错误以及我的应用程序代码放在下面。
谢谢你的帮助!
/home/path/to/folder/node_modules/@argonjs/argon/dist/argon.js:4323
if (!cesium_imports_1.defined(this.serializedFrameState)) throw new Error(
^
Error: A frame state has not yet been received
at ContextService.Object.defineProperty.get [as frame] (/home/path/to/folder/node_modules/@argonjs/argon/dist/argon.js:4323:89)
at ContextService.getTime (/home/path/to/folder/node_modules/@argonjs/argon/dist/argon.js:4343:32)
at ContextService.getEntityPose (/home/path/to/folder/node_modules/@argonjs/argon/dist/argon.js:4381:37)
at Object.<anonymous> (/home/path/to/folder/test.js:27:35)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
这是我的代码:
var Argon = require('@argonjs/argon');
var Cesium = Argon.Cesium;
var Cartesian3 = Cesium.Cartesian3;
var ConstantPositionProperty = Cesium.ConstantPositionProperty;
var ReferenceFrame = Cesium.ReferenceFrame;
var ReferenceEntity = Cesium.ReferenceEntity;
//var degToRad = THREE.Math.degToRad;
const app = Argon.init();
app.context.setDefaultReferenceFrame(app.context.localOriginEastUpSouth);
var data = { lla : { x : -84.398881, y : 33.778463, z : 276 }};
var gtref = Cartesian3.fromDegrees(data.lla.x, data.lla.y, data.lla.z);
var options = { position: new ConstantPositionProperty(gtref, ReferenceFrame.FIXED),
orientation: Cesium.Quaternion.IDENTITY
};
var gtrefEntity = new Cesium.Entity(options);
var gtrefEntityPose = app.context.getEntityPose(gtrefEntity);