zoukankan      html  css  js  c++  java
  • View and Data API Tips: Hide elements in viewer completely

    By Daniel Du

    With View and Data API, you can hide some elements in viewer by calling “viewer.hide(dbIds)”, when the elements are hided, it actually make it transparent with a shallow mark to it, or make it ghosted. It is a nice feature as user probably need to know the existence of these elements even they are hided.  But you may want to hide elements completely instead of ghosting some times. Here are a code snippet you can use if you want to hide some elements totally.

        Autodesk.Viewing.Viewer3D.prototype.turnOff = function(dbIds){
    
            var node ;
    
            if (Array.isArray(dbIds)) {
                for (var i = 0; i < dbIds.length; i++) {
                    var id = dbIds[i];
    
                    node = viewer.model.getData(). instanceTree.dbIdToNode[id];
                    //hide the node completedly
                    viewer.impl.visibilityManager.setNodeOff(node, true);
    
                }
                
            }
            else
            {
                node = viewer.model.getData(). instanceTree.dbIdToNode[dbIds];
                //hide the node completedly
                viewer.impl.visibilityManager.setNodeOff(node, true);
             
            }
    
            
            
          
        };
    
        Autodesk.Viewing.Viewer3D.prototype.turnOn = function(dbIds) {
    
            var node ;
    
           if (Array.isArray(dbIds)) {
                for (var i = 0; i < dbIds.length; i++) {
                    var id = dbIds[i];
    
                    node = viewer.model.getData(). instanceTree.dbIdToNode[id];
                    //show the node
                    viewer.impl.visibilityManager.setNodeOff(node, false);
                }
                
            }
            else
            {
                node = viewer.model.getData(). instanceTree.dbIdToNode[dbIds];
                //show the node
                viewer.impl.visibilityManager.setNodeOff(node, false);
    
            }
    
        };

     

    The usage is very simple, just call “viewer.turnOff(arrayOfDbIds)” or “viewer.turnOf(arrayOfDbIds)”. Hope it helps.

  • 相关阅读:
    “fatal error: hdf5.h: 没有那个文件或目录”解决方法
    算法狗的机器学习基础
    统计:假设检验 T检验
    各种排序和数据结构算法收藏
    知乎好书--入门神经网络和机器学习
    机器学习中的数学(1)-回归(regression)、梯度下降(gradient descent)
    第八天 T3S04
    第七天 T3S03
    第六天T3S02
    T3S01
  • 原文地址:https://www.cnblogs.com/junqilian/p/5149807.html
Copyright © 2011-2022 走看看