0

clipboard.png

clipboard.png

陆剑伟 175
2017-10-31 提问
1 个回答
0

//导入标签
function addpic(){

for(i=0;i<positions.length;i++)
    {
        var imageConfig = new Glodon.Bimface.Plugins.Drawable.ImageConfig();
        //设置image的路径
        imageConfig.src="fire.gif";
        positions[i].x=positions[i].x+100;
        imageConfig.worldPosition =positions[i];
        var image = new Glodon.Bimface.Plugins.Drawable.Image(imageConfig);
        //设置image的id
        image.id="image"+i;
        tagArr.push(image);
        //设置image的click事件
        image.onClick(function() {
        //获取点击图片的postion
        var m=this.worldPosition;
        //自己设置一个boundingbox的对象
        var num=1.1; 
        var max=m.x*num;
        var may=m.y*num;
        var maz=m.z*num;
        var mix=m.x/num;
        var miy=m.y/num;
        var miz=m.z/num;
        var maxp=new Object();
        maxp={x:max,y:may,z:maz};
        var minp=new Object();
        minp={x:mix,y:miy,z:miz};
        var boundingbox=new Object();
        boundingbox={max:maxp,min:minp};
        //缩放到该boundingbox
        viewer.zoomToBoundingBox(boundingbox);
        });
    }
    // 添加image
    drawableContainer.addItems(tagArr);
    viewer.render();

}

撰写答案

推广链接