该问题与我之前的问题(How to implement a Forge Autodesk model-aggregating viewer?)有关。我当前的查看器基于http://learnforge.autodesk.io/#/教程,其中有一部分我不理解的代码:
var options = {
env: 'AutodeskProduction',
getAccessToken: getForgeToken
};
var documentId = 'urn:' + urn;
console.log(documentId)
Autodesk.Viewing.Initializer(options, function onInitialized() {
viewerApp = new Autodesk.Viewing.ViewingApplication('forgeViewer');
viewerApp.registerViewer(viewerApp.k3D, Autodesk.Viewing.Private.GuiViewer3D);
viewerApp.loadDocument(documentId, onDocumentLoadSuccess, onDocumentLoadFailure);
});
据我所知,先前的代码初始化了查看器。但是我不知道viewerApp
是什么类型的对象。确实:
Autodesk.Viewing.ViewingApplication
,因此根据文档,它不应具有任何特定方法(https://autodeskviewer.com/viewers/latest/docs/Autodesk.Viewing.ViewingApplication.html)。Autodesk.Viewing.Private.GuiViewer3D
,因此如果它调用loadDocumentNode
方法(https://autodeskviewer.com/viewers/latest/docs/Autodesk.Viewing.Viewer3D.html#loadDocumentNode)应该很有意义,但是它仅调用loadDocument
,而我找不到文档中使用此方法,此外我无法调用其他Autodesk.Viewing.Private.GuiViewer3D
方法。