了解 Viewer 和 ViewingApplication 之间的区别

Understanding the difference between a Viewer and a ViewingApplication

这个问题和我之前的问题有关( ). My current viewer is based on the 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 是什么类型的对象。确实 :

我建议不要使用 ViewingApplication,因为它在即将推出的 Viewer v7.*(下周 GTA)中已被弃用(尽管 ployfill 可用于遗留支持)。

使用 Autodesk.Viewing.Private.GuiViewer3DAutodesk.Viewing.Private.Viewer3D 并查看 here 如何初始化和加载模型。

并在 AAutodesk.Viewing.Document.load 上查看 doc(相当于 loadDocument)。