2D and 3D switch

 

 

  2D

//2D
function init() {
dataModel = new ht.DataModel();
g2d = new ht.graph.GraphView(dataModel);

view = g2d.getView();
view.className = 'main';
document.body.appendChild(view);
window.addEventListener('resize', function (e) {
g2d.invalidate();
}, false);

  3D

        3D // 
        function the init () { 
            the dataModel new new ht.DataModel = (); G3D = new new ht.graph3d.Graph3dView (the dataModel); 
            View = G3D .getView (); 
            view.className = 'main'; 
            document.body.appendChild (View); 
            window.addEventListener ( 'a resize', function (E) { G3D .invalidate (); 
            }, to false); 
            // 3D others 
            g3d.setEye ([0, 300, 1000 ]); // determined eye (or Camera) location, the default value 
            g3d.getCenter ([0, 0, 0 ]); // getCenter () | setCenter ([x, y, z]), determines the location of the center point of the target (or target) The default value is [0, 0, 0]
           
            
                
             
            g3d.setUp ([0,. 1, 0]); // GetUp () | the setUp ([X, Y, Z]), determines the direction the camera is in the general parameter less change, the default value is [0, 1, 0]
            g3d.setNear (10) // getNear () | setNear (near), determines the position of the proximal cross section, the default value is 10
            g3d.setFar (10000) // getFar () | setFar (far), determines the position of the distal end-section, the default value is 10000 
            g3d.setFovy (Math.PI /. 4) // getFovy () | setFovy (fovy), determined fovy radians visual field angle in the vertical direction, the default value Math.PI / 4

  

  Below the top 2D 3D

        //上面2D 下面3D
        function init() {
            dataModel = new ht.DataModel();
            g2d = new ht.graph.GraphView(dataModel);
            g3d = new ht.graph3d.Graph3dView(dataModel);

            //2d 和 3d 切割
            mainSplit = new ht.widget.SplitView(g2d, g3d, 'v', 0.5);

            view = mainSplit.getView();
            view.className = 'main';
            document.body.appendChild(view);
            window.addEventListener('resize', function (e) {
                mainSplit.invalidate();
            }, false);

  

Guess you like

Origin www.cnblogs.com/ynhk/p/10937361.html