threejs 管子_使用webgl(three.js)搭建一个3D智慧园区、3D建筑,3D消防模拟,web版3D,bim管理系统——第四课...

functionWTBS() { }

WTBS.prototype.init= function() {var _this = this;

_this.currentShow= "parkModel";

}//双击事件推进后执行

WTBS.prototype.dbclickBackFunc = function(_obj, _face) {var _this = this;if (_obj && _obj.name && (w3DShowObj.camera.name != "firstPersonCamera")) {if (_obj.name.indexOf("model1build3_") >= 0) {

_this.showBuilding3(_obj);

}else if (_obj.name.indexOf("model1xfj_building") >= 0) {

_this.showXFBuilding(_obj);

}else if (_obj.name.indexOf("model1build2_") >= 0) {

_this.showBuildFloor(_obj);

}

}

}

WTBS.prototype.ParkModels= null;

WTBS.prototype.getParkModels= function() {var _this = this;var objs =[];if(_this.ParkModels) {

objs=_this.ParkModels;

}else{

$.each(w3DShowObj.scene.children,function(_index, _obj) {if (_obj.name.indexOf("model1") >= 0) {

objs.push(_obj);

}

});

}returnobjs;

}

WTBS.prototype.loadParkModels= function() {this.loadData(getParkModelData(),"parkModels");

}

WTBS.prototype.backToParkModels=function(sucFunc){var _this = this;var hidemodels = null;//隐藏当前模型

switch(_this.currentShow) {case "profileModel":

hidemodels=_this.getBuildProfileModels();break;case "buildFloorModel":

hidemodels=_this.getBuildFloorModels();break;case "monitoringRoomModels":

hidemodels=_this.getMonitoringRoomModels();break;

}if(hidemodels) {

_this.vModels(hidemodels,function() {

_this.hideModels(hidemodels,function() {var parkModels =_this.getParkModels();

_this.eModels(parkModels,function() {

_this.showModels(parkModels,function() {if(sucFunc) {

sucFunc();

}

})

});

});

});

}else{if(sucFunc) {

sucFunc();

}

}

}

WTBS.prototype.BuildProfileModels= null;

WTBS.prototype.getBuildProfileModels= function() {var _this = this;var objs =[];if(_this.BuildProfileModels) {

objs=_this.BuildProfileModels;

}else{

$.each(w3DShowObj.scene.children,function(_index, _obj) {if (_obj.name.indexOf("m2_") >= 0) {

objs.push(_obj);

}

});

}returnobjs;

}

WTBS.prototype.loadBuildProfileModels= function(afterLoadedShow) {this.loadData(getbuildProfileData(), "buildProfileModels", null, null, afterLoadedShow);

}//显示小区大楼切面

WTBS.prototype.showBuilding3 = function(_selectobj,sucFunc,showFire) {var _this = this;//隐藏园区模型

_this.currentShow = "profileModel";var parkModels =_this.getParkModels();

_this.vModels(parkModels,function() {

_this.hideModels(parkModels,function() {//移动摄像机

w3DShowObj.commonFunc.changeCameraPosition({ x: 1890.4986417114203, y: 925.7272476626204, z: -2.7744218508244103 }, { x: -71.32439584972124, y: 362.41224258427457, z: -199.41027763874382 }, 100, function() {//_this.loadBuildProfileModels(true);

///m2_fire_1 m2_smoke_1 m2_pl_water

var models =_this.getBuildProfileModels();var showmodels =[];

$.each(models,function(_index, _obj) {if(showFire) {

showmodels.push(_obj);

}else{if ("|m2_fire_1|m2_smoke_1|m2_pl_water|".indexOf(_obj.name) < 0) {

showmodels.push(_obj);

}

}

});

_this.eModels(showmodels, sucFunc);

});

});

});

}

WTBS.prototype.BuildFloorModels= null;

WTBS.prototype.getBuildFloorModels= function() {var _this = this;var objs =[];if(_this.BuildFloorModels) {

objs=_this.BuildFloorModels;

}else{

$.each(w3DShowObj.scene.children,function(_index, _obj) {if (_obj.name.indexOf("m4_") >= 0) {

objs.push(_obj);

}

});

}returnobjs;

}

WTBS.prototype.loadBuildFloorModels= function(afterLoadedShow) {this.loadData(getBuildFloorData(), "buildFloorData", null, null, afterLoadedShow);

}

WTBS.prototype.showBuildFloor= function(_obj,sucFunc) {var _this = this;

_this.currentShow= "buildFloorModel";//隐藏园区模型

var parkModels =_this.getParkModels();

_this.vModels(parkModels,function() {

_this.hideModels(parkModels,function() {//移动摄像机

w3DShowObj.commonFunc.changeCameraPosition({ x: 5951.4764511885005, y: 6206.7741894325345, z: 1521.5680109845248 }, { x: 886.9791391436224, y: 299.4744098643677, z: 1587.278714176637 }, 100, function() {//_this.loadBuildFloorModels(true);

var models =_this.getBuildFloorModels();

_this.eModels(models, sucFunc);

});

});

});

}

WTBS.prototype.MonitoringRoomModels= null;

WTBS.prototype.getMonitoringRoomModels= function() {var _this = this;var objs =[];if(_this.MonitoringRoomModels) {

objs=_this.MonitoringRoomModels;

}else{

$.each(w3DShowObj.scene.children,function(_index, _obj) {if (_obj.name.indexOf("m3_") >= 0) {

objs.push(_obj);

}

});

}returnobjs;

}

WTBS.prototype.loadMonitoringRoomModels= function(afterLoadedShow) {this.loadData(getMoniRoomData(), "monitoringRoomModels",null,null, afterLoadedShow);

}//双击消防大楼 显示监控室

WTBS.prototype.showXFBuilding = function(_obj) {var _this = this;

_this.currentShow= "monitoringRoomModels";//隐藏园区模型

var parkModels =_this.getParkModels();

_this.vModels(parkModels,function() {

_this.hideModels(parkModels,function() {//移动摄像机

w3DShowObj.commonFunc.changeCameraPosition({ x: -6987, y: 3127, z: -3740 }, { x: 1439, y: 1159, z: 1271 }, 10, function() {//_this.loadMonitoringRoomModels(true);

var models =_this.getMonitoringRoomModels();

_this.eModels(models);

});

});

});

}

WTBS.prototype.changeCamera= function(toCamera) {if (w3DShowObj.camera.name == "firstPersonCamera") {if (toCamera && toCamera == "firstPersonCamera") {

}else{

w3DShowObj.changeCamera("mainCamera");

w3DShowObj.commonFunc.changeCameraPosition({ x:-3651.9999999999995, y: 3193, z: -4190.999999999999 }, { x: -174, y: 129, z: -663 }, 1000, function() {

w3DShowObj.commonFunc.changeCameraPosition({ x:-3651.9999999999995, y: 3193, z: -4190.999999999999 }, { x: -174, y: 129, z: -663 }, 1, function() { });

$("#btn_camera").attr("title", "切换为第一人称摄像机");

$("#btn_camera").attr("src", "firstCamera.png");

});

}

}else{if (toCamera && toCamera == "mainCamera") {

}else{

w3DShowObj.commonFunc.changeCameraPosition({ x:-23.99693371859561, y: 74.21989687790614, z: 1436.5002934512606 }, { x: -17.041795003996086, y: 92.48205391598694, z: 1338.4282807984291 }, 1000, function() {

w3DShowObj.changeCamera("firstPersonCamera");

w3DShowObj.camera.position.x= -23.99693371859561;

w3DShowObj.camera.position.y= 74.21989687790614;

w3DShowObj.camera.position.z= 1436.5002934512606;

w3DShowObj.controls.target.x= -17.041795003996086;

w3DShowObj.controls.target.y=92.48205391598694;

w3DShowObj.controls.target.z= 1338.4282807984291;

w3DShowObj.camera.rotation.x= 0.1301414611156121;

w3DShowObj.camera.rotation.y= 0.19002711797053154;

w3DShowObj.camera.rotation.z= -0.024716526388785742;

$("#btn_camera").attr("title", "切换为第三人称摄像机");

$("#btn_camera").attr("src", "thirdCamera.png");

});

}

}

}//消防演练

WTBS.prototype.roadPathData ={

publicPath:[{ x:3580.7721020065833, y: 17.92388626935505, z: -3156.5926198992825},

{x:3047.384634807978, y: 17.92388626935505, z: -3483.621376400016},

{x:2576.395361698657, y: 17.92388626935505, z: -3666.2181322308456},

{x:-107.48800358032258, y: 17.92388626935505, z: -3666.2181322308456},

{ x:-107.48800358032258, y: 17.92388626935505, z: 590.5114163569147}],

buildPath_1: [

{ x:-413.2702197772283, y: 17.92388626935505, z: 590.5114163569147},

{ x:-575.6154601766582, y: 17.92388626935505, z: 472.4975088431494}],

buildPathPeoples_1: [

{ x:-354.92920316027744, y: -24.873, z: 686.551662500611},

{ x:-275.625821271076, y: -24.873, z: 686.551662500611},

{ x:-500.81870825864485, y: 72.68768761606009, z: 475.80824428017644},

{ x:-500.81870825864485, y: 72.68768761606009, z: 207.61178352238835}

],

buildPath_2: [{ x:-413.2702197772283, y: 17.92388626935505, z: 590.5114163569147},

{ x:-575.6154601766582, y: 17.92388626935505, z: 472.4975088431494},

{ x:-858.6645825831624, y: 17.92388626935505, z: 29.098512979733073}],

buildPathPeoples_2: [

{ x:-923.1392900646454, y: -24.873, z: 325.8521239022001},

{ x:-872.557339554651, y: -24.873, z: 325.8521239022001},

{ x:-1170.9461298809692, y: 72.688, z: 271.47352637164516},

{ x:-1170.9461298809692, y: 72.688, z: -77.31615737474004}

],

buildPath_3: [{ x:-1705.279061825236, y: 17.92388626935505, z: 614.229079721032},

{ x:-2510.694014101294, y: 17.92388626935505, z: 1080.947443610195},

{ x:-2949.5899989962563, y: 17.92388626935505, z: 1186.2022691608045}],

buildPathPeoples_3: [

{ x:-2760.3943614260756, y: -24.873, z: 1625.7583460432772},

{ x:-2760.3943614260756, y: -24.873, z: 1530.0955849485265},

{ x:-2807.2546245191566, y: 72.688, z: 1177.442473684558},

{ x:-3121.0743823647076, y: 72.688, z: 1177.442473684558},

{ x:-3121.0743823647076, y: 72.688, z: 1432.3379374625736}

],

buildPath_4: [{ x:-1983.869601462901, y: 17.92388626935505, z: 614.2373907022447},

{ x:-1983.869601462901, y: 17.92388626935505, z: -111.35122052838256}],

buildPathPeoples_4: [

{ x:-1833.7535270750486, y: -24.873, z: 140.2049525114066},

{ x:-1833.7535270750486, y: -24.873, z: 220.7331081380675},

{ x:-2057.476, y: 72.688, z: 535.95537248100595},

{ x:-2350.4365290959154, y: 72.688, z: 363.95537248100595}

],

buildPath_5: [{ x:-1983.869601462901, y: 17.92388626935505, z: 614.2373907022447},

{ x:-1983.869601462901, y: 17.92388626935505, z: -111.35122052838256},

{ x:-2726.0653885266493, y: 17.92388626935505, z: -111.35122052838256}],

buildPathPeoples_5: [ {x:-2589.0271473668204, y: -24.873, z: 311.0526178457409},

{ x:-2589.0271473668204, y: -24.873, z: 382.4404722154801},

{ x:-3064.450, y: 72.688, z: 475.225},

{ x:-3064.4365290959154, y: 72.688, z: 179.939}

],

buildPath_6: [{ x:-1983.869601462901, y: 17.92388626935505, z: 614.2373907022447},

{ x:-1983.869601462901, y: 17.92388626935505, z: -111.35122052838256},

{ x:-2405.1932638255066, y: 17.92388626935505, z: -618.6924653066992}],

buildPathPeoples_6: [{ x:-2166.608, y: -24.873, z: -909.161612666987},

{ x:-2204.038, y: -24.873, z: -965},

{ x:-2648.608, y: 72.688, z: -926.638},

{ x:-2881.774, y: 72.688, z: -601.982}

],

buildPath_7: [{ x:-694.0867159986417, y: 17.92388626935505, z: 595.8553302083877},

{ x:-694.0867159986417, y: 17.92388626935505, z: -1107.591840054678}],

buildPathPeoples_7: [{ x:-858.3942967523726, y: -24.873, z: -954.7470265747439},

{ x:-858.3942967523726, y: -24.873, z: -1046.4046275285905},

{ x:-364.377, y: 72.688, z: -1046.4046275285905},

{ x:-364.4365290959154, y: 72.688, z: -699.307}

],

buildPath_8: [{ x:-694.0867159986417, y: 17.92388626935505, z: 595.8553302083877},

{ x:-694.0867159986417, y: 17.92388626935505, z: -1107.591840054678}],

buildPathPeoples_8: [{ x:-1014.8893156392728, y: -24.873, z: -1613.6386170342057},

{ x:-1014.8893156392728, y: -24.873, z: -1483.3266514034665},

{ x:-587.140, y: 72.688, z: -1216.539},

{ x:-493.897, y: 72.688, z: -1619.992}

],

buildPath_9: [{ x:-694.0867159986417, y: 17.92388626935505, z: 595.8553302083877},

{ x:-694.0867159986417, y: 17.92388626935505, z: -1107.591840054678},

{ x:-1410.5332835962133, y: 17.92388626935505, z: -1107.591840054678}],

buildPathPeoples_9: [{ x:-1436.8064286552606, y: -24.873, z: -1071.5170589907527},

{ x:-1497.5840839697357, y: -24.873, z: -1071.5170589907527},

{ x:-1308.352, y: 72.688, z: -1402.888},

{ x:-1597.963, y: 72.688, z: -1473.342}

],

buildPath_10: [{ x:-1410.5332835962133, y: 17.92388626935505, z: 605.9075715693755},

{ x:-1601.1451398610843, y: 17.92388626935505, z: 1106.333646529646}],

buildPathPeoples_10: [{ x:-1497.5840839697357, y: -24.873, z: 1071.1933216650134},

{ x:-1612.8938677568567, y: -24.873, z: 1071.1933216650134},

{ x:-1683.113, y: 72.688, z: 1082.002},

{ x:-1750.712, y: 72.688, z: 1384.185}

],

buildPath_11: [{ x:-569.7525865574022, y: -924.431706161469, z: 639.2826850417543},

{ x:-569.7525865574022, y: -924.431706161469, z: 1326.2298098226368}],

buildPathPeoples_11: [{ x:-407.5318857636871, y: -24.873, z: 959.9896943204546},

{ x:-365.45995025102496, y: -24.873, z: 959.9896943204546},

{ x:-597.188, y: 72.688, z: 1067.458},

{ x:-597.188, y: 72.688, z: 1348.137}],

buildCameraPosition_1: [{ x:-24.163199142985434, y: 446.94150251372656, z: 1226.4985674399672 }, { x: -389.93700345529624, y: 343.82717937105735, z: 457.58538193335727}],

buildCameraPosition_2: [{"x": -328.45969510549253, "y": 182.67290523217872, "z": 843.2096066819893 }, { "x": -1222.360151876304, "y": 301.2292885252543, "z": 10.007274175505602}],

buildCameraPosition_3: [{"x": -2102.316022563398, "y": 76.30870033159925, "z": 820.2711623529518 }, { "x": -3282.845826885127, "y": 358.6158021902579, "z": 1564.788990686582}],

buildCameraPosition_4: [{"x": -1144.8058794023336, "y": 462.26480387290064, "z": 1127.3972509719656 }, { "x": -2428.797829618296, "y": 313.9372721319275, "z": 222.52616787385563}],

buildCameraPosition_5: [{"x": -1902.558697076418, "y": 272.2154972028064, "z": -498.5563571007863 }, { "x": -2654.1869242155026, "y": 321.9908933436772, "z": 71.53340175608369}],

buildCameraPosition_6: [{"x": -872.267316305848, "y": 735.9151916423075, "z": -1243.0960115772687 }, { "x": -2777.5411868476754, "y": 309.3737056775955, "z": -106.134839266717}],

buildCameraPosition_7: [{"x": -795.7414141456069, "y": 234.31891461641843, "z": 484.89291238688975 }, { "x": -762.5649106525581, "y": 324.98923235263777, "z": -670.9036868752492}],

buildCameraPosition_8: [{"x": -1446.2741250545457, "y": 651.3353956133313, "z": -287.8323650787228 }, { "x": -824.3187000543771, "y": 349.9177448476733, "z": -1073.9510131595132}],

buildCameraPosition_9: [{"x": -597.174138639469, "y": 314.86823345842805, "z": -478.7134844047999 }, { "x": -1081.5624695303904, "y": 302.69943840236584, "z": -976.1576226259127}],

buildCameraPosition_10: [{"x": -1301.3216149121115, "y": 422.32391588930665, "z": -121.97931197560251 }, { "x": -1448.1782309945058, "y": 415.89337468191627, "z": 1222.7697958744425}],

buildCameraPosition_11: [{"x": 144.45739205620396, "y": 428.80813026440933, "z": 19.23321129187684 }, { "x": -586.0816357186471, "y": 402.54215701931815, "z": 1327.7941206228331}],

}

WTBS.prototype.doFireAnimation= function() {var _this = this;var html = "";

layer.msg(html, {

title:"消防参数配置",

shade:0.4,

time:0 //不自动关闭

, btn: ['开始演习', '取消演习']

, yes:function(index) {var build = parseInt($("#iframe_fireSelect").contents().find("#select_build").val());var select_floor = parseInt($("#iframe_fireSelect").contents().find("#select_floor").val());var select_fireType = parseInt($("#iframe_fireSelect").contents().find("#select_fireType").val());var select_fireSize = parseInt($("#iframe_fireSelect").contents().find("#select_fireSize").val());var select_V = parseInt($("#iframe_fireSelect").contents().find("#select_V").val());

console.log(build);

console.log(select_floor);

console.log(select_fireType);

console.log(select_fireSize);

console.log(select_V);

_this.animationParam.build=build;

_this.animationParam.select_floor=select_floor;

_this.animationParam.select_fireType=select_fireType;

_this.animationParam.select_fireTypeStr= $("#iframe_fireSelect").contents().find("#select_fireType option:selected").text();

_this.animationParam.select_fireSize=select_fireSize;

_this.animationParam.select_V=select_V;

layer.closeAll();

layer.msg("开始演习...");

_this.xfylAmination(build, select_floor);

}

});

setTimeout(function() {

$("#select_build").focus();

$("#select_build").click(function(event,obj) {

console.log(obj);return false;

event.stopPropagation();

});

},200);

}//火

WTBS.prototype.showbuildfire1 = function(position) {var smk = w3DShowObj.commonFunc.findObject("model1smoke_1");var fball =w3DShowObj.commonFunc.findObject("model1fireball_1");if(fball) {

smk.position.x=position.x;

smk.position.y=position.y;

smk.position.z=position.z;

fball.position.x=position.x;

fball.position.y= position.y+80;

fball.position.z=position.z;

smk.visible= true;

fball.visible= true;

}else{var fires = [{ "show": true, "uuid": "", "name": "model1smoke_1", "objType": "Smoke", "positionRadius": 80, "sizeTween": [[0, 1], [32, 128]], "velocityBase": [0, 150, 0], "velocitySpread": [80, 50, 80], "accelerationBase": [0, -10, 0], "img": "smokeparticle.png", "colorBase": 1508096, "opacityTween": [[0.8, 2], [0.5, 0]], "particlesPerSecond": 1000, "particleDeathAge": 5, "emitterDeathAge": 10000, "x": position.x, "y": position.y, "z": position.z, "scale": { "x": 3, "y": 1, "z": 5 }, "rotation": { "x": 0, "y": 0, "z": 0 }, "angleBase": 0, "angleSpread": 720, "angleVelocityBase": 0, "angleVelocitySpread": 720, "showSortNub": 1584, "customType1": "", "customType2": "", "animation": null, "dbclickEvents": null, "BindDevId": null, "BindDevName": null, "devInfo": null, "BindMeteId": "10001", "BindMeteName": "" }, { "show": true, "uuid": "", "name": "model1fireball_1", "objType": "Fireball", "positionRadius": 2, "speedBase": 40, "speedSpread": 8, "sizeTween": [[0.7, 1.5], [100, 150]], "opacityTween": [[0.7, 1], [1, 0.5]], "colorBase": 16719360, "particlesPerSecond": 800, "particleDeathAge": 1.5, "emitterDeathAge": 10000, "x": position.x, "y": position.y + 80, "z": position.z, "scale": { "x": 3, "y": 1, "z": 5 }, "rotation": { "x": 0, "y": 0, "z": 0 }, "img": "smokeparticle.png", "showSortNub": 1583, "customType1": "", "customType2": "", "animation": null, "dbclickEvents": null, "BindDevId": null, "BindDevName": null, "devInfo": null, "BindMeteId": "10001", "BindMeteName": ""}];

w3DShowObj.commonFunc.loadModelsByJsons(fires, {x:0,y:0,z:0});

}

}

WTBS.prototype.showXFYXAmination= false;

WTBS.prototype.animationParam={};

WTBS.prototype.xfylAmination= function(buildNub, floornub) {var _this = this;

_this.fireBuildNub=buildNub;this.showXFYXAmination = true;//起火

var fireBuilld = w3DShowObj.commonFunc.findObject("model1build3_" +buildNub);var firepx =fireBuilld.position.x;var firepy = 52.35 * floornub - 110;var firepz =fireBuilld.position.z;this.showbuildfire1({ x: firepx, y: firepy, z: firepz });

setTimeout(function() {//推进摄像头

_this.closeCameraToObj("model1smoke_1", function() {

setTimeout(function() {//切换摄像机角度

w3DShowObj.commonFunc.changeCameraPosition( { x: 5835.58183804604, y: 7710.995531709141, z: 2846.4241385728137 }, { x: -375.8524784787147, y: 342.05706117206597, z: 178.68548028235932 }, 1000, function() {//两秒后转向消防局

setTimeout(function() {

w3DShowObj.commonFunc.changeCameraPosition( { x:4001.25435551022, y: 1566.042612976526, z: -2504.792592069797 }, { x: 3957.7646687979313, y: 223.709476832619, z: -4054.3052522933913 }, 1000, function() {//两秒后显示监控室

setTimeout(function() {

_this.showXFBuilding();//5秒后继续

setTimeout(function() {

_this.doAnimationAfterShowXFBuilding();

},5000);

},100);

});

},100);

});

},2000);

});

},2000);

}//5秒后继续

WTBS.prototype.doAnimationAfterShowXFBuilding = function() {var _this = this;

w3DShowObj.commonFunc.changeCameraPosition({ x:-622.3323457533243, y: 3053.6905115505274, z: -989.1041533374627 }, { x: 2151.561157560692, y: 3053.228407750961, z: -992.5893224316319 }, 1000, function() {//此处显示内容

layer.msg("紧急火警!");

setTimeout(function() {/** _this.animationParam.build = build;

_this.animationParam.select_floor = select_floor;

_this.animationParam.select_fireType = select_fireType;

_this.animationParam.select_fireSize = select_fireSize;

_this.animationParam.select_V = select_V;*/layer.msg("林海雪原小区" + _this.animationParam.build + "号楼," + _this.animationParam.select_floor + "楼发生" + _this.animationParam.select_fireTypeStr+"火警,紧急出警!");

setTimeout(function() {var parkModes =_this.getParkModels();var jksmodels =_this.getMonitoringRoomModels();

_this.vModels(jksmodels,function() {

w3DShowObj.commonFunc.changeCameraPosition( { x:3752.934307274166, y: 881.6086014022482, z: -3160.233871730027 }, { x: 3808.6320544878613, y: 426.8928876990193, z: -3992.478655833047 }, 10, function() {

_this.hideModels(jksmodels,function() {//显示园区

_this.eModels(parkModes, function() {//切换视角

w3DShowObj.commonFunc.changeCameraPosition({ x: 4221.393684930859, y: 8234.528743805164, z: -5349.244775971515 }, { x: 1526.3954588977656, y: 536.4464964435064, z: -1485.6791592731984 }, 1000, function() {//画路线

var path = _this.roadPathData.publicPath.concat(_this.roadPathData["buildPath_" +_this.fireBuildNub]);

_this.addLine(path);

setTimeout(function() {

_this.lineobj.position.y-= 50;//切换角度

w3DShowObj.commonFunc.changeCameraPosition({ x: 3867.8066756852063, y: 310.5273809443584, z: -3901.7067131720823 }, { x: 4165.602024181351, y: 234.46056432909302, z: -3901.8248733036608 }, 1000, function() {var p1 = w3DShowObj.commonFunc.findObject("model1xfy2_8");var p2 = w3DShowObj.commonFunc.findObject("model1xfy2_9");var car = w3DShowObj.commonFunc.findObject("model1car_xfc_4");

p1.oldPosition={ x: p1.position.x, y: p1.position.y, z: p1.position.z };

p1.oldRotation={ x: p1.rotation.x, y: p1.rotation.y, z: p1.rotation.z };

p2.oldPosition={ x: p2.position.x, y: p2.position.y, z: p2.position.z };

p2.oldRotation={ x: p2.rotation.x, y: p2.rotation.y, z: p2.rotation.z };

car.oldPosition={ x: car.position.x, y: car.position.y, z: car.position.z };

car.oldRotation={ x: car.rotation.x, y: car.rotation.y, z: car.rotation.z };

_this.MovePerson(p1, car.position,3000, "run", function () { p1.visible = false; });

setTimeout(function() {

_this.MovePerson(p2, car.position,3000, "run", function() {

p2.visible= false;

w3DShowObj.commonFunc.changeCameraPosition({ x:4216.770891759393, y: 102.86643744339146, z: -3789.1276193286826 }, { x: 4048.41618755251, y: 84.0944641453113, z: -3587.2683941811956 }, 500, function() {

_this.moveDoors();

});

});

},1000);

});

},3000);

});

});

});

});

});

},4000);

},2000);

});

}//移动门

WTBS.prototype.moveDoors = function() {var _this = this;var leftDoor = w3DShowObj.commonFunc.findObject("model1xf_wall_door_left");var rightDoor = w3DShowObj.commonFunc.findObject("model1xf_wall_door_right");newTWEEN.Tween(leftDoor.position).to({

x:3325.934, y: 83.774, z: -3439.526},1000).onComplete(function() {

}).start();newTWEEN.Tween(rightDoor.position).to({

x:4006.172, y: 83.774, z: -2968.208},1000).onComplete(function() {

_this.moveCars();

}).start();

}

WTBS.prototype.fireBuildNub= 1;//移动车

WTBS.prototype.moveCars = function() {var _this = this;var car = w3DShowObj.commonFunc.findObject("model1car_xfc_4");var pathRoad = this.roadPathData.publicPath;var path = _this.roadPathData.publicPath.concat(_this.roadPathData["buildPath_" +_this.fireBuildNub]);

console.log(path);var newpath =[];

$.each(path,function(_index,_obj) {if (_index == 0) {

newpath.push({

start: {

x: car.position.x,

y: car.position.y,

z: car.position.z

},

end: {

x: _obj.x,

y: car.position.y,

z: _obj.z

}

});

}else{

newpath.push({

start: {

x: path[_index-1].x,

y: path[_index- 1].y,

z: path[_index- 1].z

},

end: {

x: _obj.x,

y: car.position.y,

z: _obj.z

}

});

}

});

_this.moveCar(car, newpath,1000, function() {

_this.removeLine();

_this.MovePersonFromCar();

});

}//移动汽车

WTBS.prototype.moveCar = function(carObj,pointpath,moveTime, callBack) {var _this = this;functionmove(index) {

carObj.lookAt(pointpath[index].end);var unittime = Math.sqrt((pointpath[index].end.x - carObj.position.x) * (pointpath[index].end.x - carObj.position.x) + (pointpath[index].end.z - carObj.position.z) * (pointpath[index].end.z - carObj.position.z)) * 2 /_this.animationParam.select_V;var _startx =carObj.position.x;newTWEEN.Tween(carObj.position).to({

x: pointpath[index].end.x ,

z: pointpath[index].end.z

}, (unittime)).onUpdate(function() {var _x = this.x +343;var _z = this.z- 170;

w3DShowObj.camera.position.x=_x;

w3DShowObj.camera.position.y= 1355;

w3DShowObj.camera.position.z=_z;

w3DShowObj.controls.target.x=carObj.position.x;

w3DShowObj.controls.target.y=carObj.position.y ;

w3DShowObj.controls.target.z=carObj.position.z;

}).onComplete(function() {if (index < pointpath.length - 1) {

console.log(index);

move(index+ 1);

}else{if(callBack)

callBack(carObj);

}

}).start();

}

move(0);

}//人从车上下来

WTBS.prototype.MovePersonFromCar = function() {var _this = this;var p1 = w3DShowObj.commonFunc.findObject("model1xfy2_8");var p2 = w3DShowObj.commonFunc.findObject("model1xfy2_9");var car = w3DShowObj.commonFunc.findObject("model1car_xfc_4");

p1.position.x=car.position.x;

p1.position.z=car.position.z;

p2.position.x=car.position.x;

p2.position.z=car.position.z;var pathobj = _this.roadPathData["buildPathPeoples_" +_this.fireBuildNub];

p1.visible= true;

p2.visible= true;

p1.renderOrder= 1;

p2.renderOrder= 1;var fball = w3DShowObj.commonFunc.findObject("model1fireball_1");

_this.addXfyShebei(p1);

_this.addXfyShebei(p2);//调整摄像机位置

w3DShowObj.commonFunc.changeCameraPosition(_this.roadPathData["buildCameraPosition_" + _this.fireBuildNub][0], _this.roadPathData["buildCameraPosition_" + _this.fireBuildNub][1], 1000, function() {

_this.MovePerson(p1, pathobj[0], 3000 * 2 / _this.animationParam.select_V, "run", function() {

p1.lookAt(car.position);

p1.rotation.y+=Math.PI;

_this.changeShebeiPR(p1);

});

setTimeout(function() {

_this.MovePerson(p2, pathobj[1], 3000 * 2 / _this.animationParam.select_V, "run", function() {

p2.lookAt(car.position);

p2.rotation.y+=Math.PI;

_this.changeShebeiPR(p2);

setTimeout(function() {

_this.psAnimation();

},500);

});

},500);

});

}//运动的人

WTBS.prototype.MovePerson = function(person, toPosition, timeLong, action, callBackFunc) {var _this = this;

person.lookAt({ x: toPosition.x, y: person.position.y, z: toPosition.z });

person.rotation.y+=Math.PI;

_this.changeShebeiPR(person);if (action == "run") {

person.animationActions[0].play();

}else{

person.animationActions[1].play();

}var tt = 0;var _forePosition ={ x: person.position.x, y: person.position.y, z: person.position.z};newTWEEN.Tween(_forePosition).to({

x: toPosition.x,

z: toPosition.z

}, (timeLong)).onUpdate(function(time,pobj) {

console.log(_forePosition);//person.position.x = person.position.x + tt * (_forePosition.x - person.position.x);

//person.position.z = person.position.z + tt * (_forePosition.z- person.position.z);

_this.changeShebeiPR(person);

person.position.x=_forePosition.x;

person.position.z=_forePosition.z;

_this.changeShebeiPR(person);

}).onComplete(function() {

_this.changeShebeiPR(person);if (action == "run") {

person.animationActions[0].stop();

}else{

person.animationActions[1].stop();

}if(callBackFunc) {

callBackFunc();

}

}).start();

}//喷水

WTBS.prototype.psAnimation = function() {var _this = this;var car = w3DShowObj.commonFunc.findObject("model1car_xfc_4");var fball = w3DShowObj.commonFunc.findObject("model1fireball_1");var psModels = [{ "show": true, "uuid": "", "name": "model1ps_1", "objType": "Startunnel", "sizeBase": 10, "sizeSpread": 10, "velocityBase": [fball.position.x - car.position.x, fball.position.y - car.position.y + 100, fball.position.z - car.position.z], "velocitySpread": [20, 20, 20], "angleBase": 0, "angleSpread": 180, "angleVelocityBase": 5, "angleVelocitySpread": 0, "img": "spikey.png", "colorBase": 16774553, "opacityBase": 1, "particlesPerSecond": 1000, "particleDeathAge": 4, "emitterDeathAge": 10000, "x": car.position.x, "y": car.position.y + 50, "z": car.position.z, "scale": { "x": 1, "y": 1, "z": 1 }, "rotation": { "x": 0, "y": 0, "z": 0 }, "positionSpread": [5, 5, 5], "showSortNub": 1580, "customType1": "", "customType2": "", "animation": null, "dbclickEvents": null, "BindDevId": null, "BindDevName": null, "devInfo": null, "BindMeteId": "10001", "BindMeteName": "" }, { "show": true, "uuid": "", "name": "model1ps_2", "objType": "Startunnel", "sizeBase": 10, "sizeSpread": 10, "velocityBase": [fball.position.x - car.position.x + 10, fball.position.y - car.position.y + 100, fball.position.z - car.position.z + 20], "velocitySpread": [20, 20, 20], "angleBase": 0, "angleSpread": 180, "angleVelocityBase": 5, "angleVelocitySpread": 0, "img": "spikey.png", "colorBase": 16774553, "opacityBase": 1, "particlesPerSecond": 1000, "particleDeathAge": 4, "emitterDeathAge": 10000, "x": car.position.x + 10, "y": car.position.y + 50, "z": car.position.z+20, "scale": { "x": 1, "y": 1, "z": 1 }, "rotation": { "x": 0, "y": 0, "z": 0 }, "positionSpread": [5, 5, 5], "showSortNub": 1580, "customType1": "", "customType2": "", "animation": null, "dbclickEvents": null, "BindDevId": null, "BindDevName": null, "devInfo": null, "BindMeteId": "10001", "BindMeteName": ""}];

w3DShowObj.commonFunc.loadModelsByJsons(psModels, { x:0, y: 0, z: 0});//5秒后继续

setTimeout(function() {

_this.jxFire();

},3000 * 2 /_this.animationParam.select_V);

}//减小火势

WTBS.prototype.jxFire = function() {var _this = this;var smk = w3DShowObj.commonFunc.findObject("model1smoke_1");var fball = w3DShowObj.commonFunc.findObject("model1fireball_1");var model1ps_1 = w3DShowObj.commonFunc.findObject("model1ps_1");var model1ps_2 = w3DShowObj.commonFunc.findObject("model1ps_2");

smk.oldScale={

x: smk.scale.x,

y: smk.scale.y,

z: smk.scale.z,

};

fball.oldScale={

x: fball.scale.x,

y: fball.scale.y,

z: fball.scale.z,

};newTWEEN.Tween(fball.scale).to({

x:0.5,

y:0.5,

z:0.5}, (2000 * 2 / _this.animationParam.select_V)).onUpdate(function() {

smk.scale.x=fball.scale.x;

smk.scale.y=fball.scale.y;

smk.scale.z=fball.scale.z;

}).onComplete(function() {

setTimeout(function() {

_this.showBuilding3(null, function() {

smk.visible= false;

fball.visible= false;

model1ps_1.visible= false;

model1ps_2.visible= false;

w3DShowObj.destoryObjByName("model1fireball_1");

w3DShowObj.destoryObjByName("model1smoke_1");

w3DShowObj.destoryObjByName("model1ps_1");

w3DShowObj.destoryObjByName("model1ps_2");//smk.scale.x = smk.oldScale.x;

//smk.scale.y = smk.oldScale.y;

//smk.scale.z = smk.oldScale.z;

//fball.scale.x = fball.oldScale.x;

//fball.scale.y = fball.oldScale.y;

//fball.scale.z = fball.oldScale.z;

setTimeout(function() {

getWTBSInstance().backToParkModels(function() {//调整摄像机位置

w3DShowObj.commonFunc.changeCameraPosition(_this.roadPathData["buildCameraPosition_" + _this.fireBuildNub][0], _this.roadPathData["buildCameraPosition_" + _this.fireBuildNub][1], 1000 * 2 / _this.animationParam.select_V, function() {var fireBuilld = w3DShowObj.commonFunc.findObject("model1build3_" +_this.animationParam.build);var p1 = w3DShowObj.commonFunc.findObject("model1xfy2_8");var p2 = w3DShowObj.commonFunc.findObject("model1xfy2_9");var pathobj = _this.roadPathData["buildPathPeoples_" +_this.fireBuildNub];

_this.MovePerson(p1, pathobj[2], 2000 * 2 / _this.animationParam.select_V, "run", function() {

p1.rotation.y+=Math.PI;

_this.changeShebeiPR(p1);

_this.MovePerson(p1, pathobj[3], 2000 * 2 / _this.animationParam.select_V, "run", function() {

p1.rotation.y+=Math.PI;

_this.changeShebeiPR(p1);if (pathobj[4]) {

_this.MovePerson(p1, pathobj[4], 2000 * 2 / _this.animationParam.select_V, "run", function() {

p1.rotation.y+=Math.PI;

_this.changeShebeiPR(p1);

_this.MovePerson(p1, fireBuilld.position,2000 * 2 / _this.animationParam.select_V, "run", function() {

p1.rotation.y+=Math.PI;

_this.changeShebeiPR(p1);

});

});

}else{

_this.MovePerson(p1, fireBuilld.position,2000 * 2 / _this.animationParam.select_V, "run", function() {

p1.rotation.y+=Math.PI;

_this.changeShebeiPR(p1);

});

}

});

});

setTimeout(function() {

_this.MovePerson(p2, pathobj[2], 2000 * 2 / _this.animationParam.select_V, "run", function() {

p2.rotation.y+=Math.PI;

_this.changeShebeiPR(p2);

_this.MovePerson(p2, pathobj[3], 2000 * 2 / _this.animationParam.select_V, "run", function() {

p2.rotation.y+=Math.PI;

_this.changeShebeiPR(p2);if (pathobj[4]) {

_this.MovePerson(p2, pathobj[4], 2000 * 2 / _this.animationParam.select_V, "run", function() {

p2.rotation.y+=Math.PI;

_this.changeShebeiPR(p2);

_this.MovePerson(p2, fireBuilld.position,2000 * 2 / _this.animationParam.select_V, "run", function() {

p2.rotation.y+=Math.PI;

_this.changeShebeiPR(p2);

setTimeout(function() {

_this.showBuildFloor(null, function() {

_this.roomfire();

});

},500 * 2 /_this.animationParam.select_V);

});

});

}else{

_this.MovePerson(p2, fireBuilld.position,2000 * 2 / _this.animationParam.select_V, "run", function() {

p2.rotation.y+=Math.PI;

_this.changeShebeiPR(p2);

setTimeout(function() {

_this.showBuildFloor(null, function() {

_this.roomfire();

});

},500 * 2 /_this.animationParam.select_V);

});

}

});

});

},500 * 2 /_this.animationParam.select_V);

});

});

},2000 * 2 /_this.animationParam.select_V);

},true);

},2000 * 2 /_this.animationParam.select_V);

}).start();

}//内部灭火

WTBS.prototype.roomfire = function() {var _this = this;var roomfires = [{ "show": true, "uuid": "", "name": "m4_smoke", "objType": "Smoke", "positionRadius": 2, "sizeTween": [[0, 1], [32, 128]], "velocityBase": [0, 150, 0], "velocitySpread": [80, 50, 80], "accelerationBase": [0, -10, 0], "img": "smokeparticle.png", "colorBase": 16777215, "opacityTween": [[0.8, 2], [0.5, 0]], "particlesPerSecond": 200, "particleDeathAge": 2, "emitterDeathAge": 10000, "x": 266.189, "y": 60.73, "z": 2394.563, "scale": { "x": 2, "y": 1, "z": 2 }, "rotation": { "x": 0, "y": 0, "z": 0 }, "angleBase": 0, "angleSpread": 720, "angleVelocityBase": 0, "angleVelocitySpread": 720, "showSortNub": 601, "customType1": "", "customType2": "", "animation": null, "dbclickEvents": null, "BindDevId": null, "BindDevName": null, "devInfo": null, "BindMeteId": "10001", "BindMeteName": "" }, { "show": true, "uuid": "", "name": "m4_fire", "objType": "Candle", "positionRadius": 2, "sizeTween": [[0, 0.3, 1.2], [20, 150, 1]], "velocityBase": [0, 100, 0], "velocitySpread": [20, 0, 20], "img": "smokeparticle.png", "opacityTween": [[0.9, 1.5], [1, 0]], "colorBase": 16719616, "particlesPerSecond": 60, "particleDeathAge": 1.5, "emitterDeathAge": 10000, "x": 289.047, "y": 7.754, "z": 2398.477, "scale": { "x": 10, "y": 1, "z": 10 }, "rotation": { "x": 0, "y": 0, "z": 0 }, "showSortNub": 600, "customType1": "", "customType2": "", "animation": null, "dbclickEvents": null, "BindDevId": null, "BindDevName": null, "devInfo": null, "BindMeteId": "10001", "BindMeteName": ""}];

_this.addnames=[];if (_this.animationParam.select_fireType ==2) {

_this.addnames= ["m4_mqgd","m4_markFire"];

roomfires=roomfires.concat([{ "show": true, "uuid": "", "name": "m4_mqgd", "objType": "tube", "points": [{ "x": 0, "y": 0, "z": 0 }, { "x": 10, "y": 0, "z": 0 }, { "x": 200, "y": 0, "z": -10 }, { "x": 200, "y": null, "z": 30 }], "position": { "x": 55.805, "y": 18.706, "z": 2332.504 }, "scale": { "x": 1, "y": 1, "z": 1 }, "rotation": [{ "direction": "x", "degree": 0 }, { "direction": "y", "degree": 0 }, { "direction": "z", "degree": 0 }], "style": { "skinColor": 12772607, "side": 2, "opacity": 1 }, "segments": 64, "radialSegments": 8, "closed": false, "radius": 2, "showSortNub": 606, "customType1": "", "customType2": "", "animation": null, "dbclickEvents": null, "BindDevId": null, "BindDevName": null, "devInfo": null, "BindMeteId": "10001", "BindMeteName": "" }, { "name": "m4_markFire", "objType": "makeTextSprite", "textColor": { "r": 255, "g": 0, "b": 0, "a": 1 }, "message": "煤气泄漏", "fontsize": 200, "canvasWidth": 1000, "canvasHeight": 300, "position": { "x": 123.121, "y": 32.428, "z": 2344.31 }, "showSortNub": 626, "show": true, "customType1": "", "customType2": "", "animation": null, "dbclickEvents": null, "BindDevId": null, "BindDevName": null, "devInfo": null, "BindMeteId": "10001", "BindMeteName": ""}]);

}else if (_this.animationParam.select_fireType == 1){

_this.addnames= ["m4_markFire", "m4_dlFire_1", "m4_dlFire_2", "m4_dlFire"];

roomfires= roomfires.concat([{ "name": "m4_markFire", "objType": "makeTextSprite", "textColor": { "r": 255, "g": 0, "b": 0, "a": 1 }, "message": "电力火灾", "fontsize": 200, "canvasWidth": 1000, "canvasHeight": 300, "position": { "x": 123.121, "y": 32.428, "z": 2344.31 }, "showSortNub": 626, "show": true, "customType1": "", "customType2": "", "animation": null, "dbclickEvents": null, "BindDevId": null, "BindDevName": null, "devInfo": null, "BindMeteId": "10001", "BindMeteName": "" }, { "show": true, "uuid": "", "name": "m4_dlFire_1", "objType": "tube", "points": [{ "x": 0, "y": 0, "z": 0 }, { "x": 10, "y": 0, "z": 0 }, { "x": 120, "y": -30, "z": -10 }, { "x": 145, "y": -55, "z": 35 }], "position": { "x": 49.031, "y": 101.45, "z": 2349.877 }, "scale": { "x": 1, "y": 1, "z": 1 }, "rotation": [{ "direction": "x", "degree": 0 }, { "direction": "y", "degree": 0 }, { "direction": "z", "degree": 0 }], "style": { "skinColor": 3649469, "side": 2, "opacity": 1 }, "segments": 64, "radialSegments": 8, "closed": false, "radius": 1, "showSortNub": 606, "customType1": "", "customType2": "", "animation": null, "dbclickEvents": null, "BindDevId": null, "BindDevName": null, "devInfo": null, "BindMeteId": "10001", "BindMeteName": "" }, { "show": true, "uuid": "", "name": "m4_dlFire_2", "objType": "tube", "points": [{ "x": 0, "y": 0, "z": 0 }, { "x": 10, "y": 0, "z": 0 }, { "x": 120, "y": -30, "z": -10 }, { "x": 135, "y": -55, "z": 35 }], "position": { "x": 49.031, "y": 101.45, "z": 2349.877 }, "scale": { "x": 1, "y": 1, "z": 1 }, "rotation": [{ "direction": "x", "degree": 0 }, { "direction": "y", "degree": 0 }, { "direction": "z", "degree": 0 }], "style": { "skinColor": 12411179, "side": 2, "opacity": 1 }, "segments": 64, "radialSegments": 8, "closed": false, "radius": 1, "showSortNub": 606, "customType1": "", "customType2": "", "animation": null, "dbclickEvents": null, "BindDevId": null, "BindDevName": null, "devInfo": null, "BindMeteId": "10001", "BindMeteName": "" }, { "show": true, "uuid": "", "name": "m4_dlFire", "objType": "tube", "points": [{ "x": 0, "y": 0, "z": 0 }, { "x": 10, "y": 0, "z": 0 }, { "x": 120, "y": -30, "z": -10 }, { "x": 140, "y": -50, "z": 30 }], "position": { "x": 49.031, "y": 101.45, "z": 2349.877 }, "scale": { "x": 1, "y": 1, "z": 1 }, "rotation": [{ "direction": "x", "degree": 0 }, { "direction": "y", "degree": 0 }, { "direction": "z", "degree": 0 }], "style": { "skinColor": 1382684, "side": 2, "opacity": 1 }, "segments": 64, "radialSegments": 8, "closed": false, "radius": 2, "showSortNub": 606, "customType1": "", "customType2": "", "animation": null, "dbclickEvents": null, "BindDevId": null, "BindDevName": null, "devInfo": null, "BindMeteId": "10001", "BindMeteName": ""}]);

}else if (_this.animationParam.select_fireType == 3) {

_this.addnames= ["m4_markFire", "m4_fireylw"];

roomfires= roomfires.concat([{ "name": "m4_markFire", "objType": "makeTextSprite", "textColor": { "r": 255, "g": 0, "b": 0, "a": 1 }, "message": "固体易燃物", "fontsize": 200, "canvasWidth": 1000, "canvasHeight": 300, "position": { "x": 123.121, "y": 32.428, "z": 2344.31 }, "showSortNub": 626, "show": true, "customType1": "", "customType2": "", "animation": null, "dbclickEvents": null, "BindDevId": null, "BindDevName": null, "devInfo": null, "BindMeteId": "10001", "BindMeteName": "" }, { "show": true, "uuid": "", "name": "m4_fireylw", "objType": "cube2", "length": 30, "width": 30, "height": 30, "x": 265.974, "y": 24.061, "z": 2444.899, "style": { "skinColor": 16777215, "skin": { "skin_up": { "skinColor": 16741450, "side": 1, "opacity": 1 }, "skin_down": { "skinColor": 16757854, "side": 1, "opacity": 1 }, "skin_fore": { "skinColor": 16745037, "side": 1, "opacity": 1 }, "skin_behind": { "skinColor": 16745037, "side": 1, "opacity": 1 }, "skin_left": { "skinColor": 16757854, "side": 1, "opacity": 1 }, "skin_right": { "skinColor": 16757854, "side": 1, "opacity": 1 } } }, "showSortNub": 626, "customType1": "", "customType2": "", "animation": null, "dbclickEvents": null, "rotation": [{ "direction": "x", "degree": 0 }, { "direction": "y", "degree": 0 }, { "direction": "z", "degree": 0 }], "thick": null, "scale": { "x": 1, "y": 1, "z": 1 }, "BindDevId": null, "BindDevName": null, "devInfo": null, "BindMeteId": "10001", "BindMeteName": ""}]);

}var smk = w3DShowObj.commonFunc.findObject("m4_smoke");var fball = w3DShowObj.commonFunc.findObject("m4_fire");if(fball) {

smk.visible= true;

fball.visible= true;

}else{

w3DShowObj.commonFunc.loadModelsByJsons(roomfires, { x:0, y: 0, z: 0 }, { x: 0, y: 0, z: 0 },true);

}//移动摄像头

setTimeout(function() {var hourse = w3DShowObj.commonFunc.findObject("m4_house_2");

hourse.children[28].visible = false;

hourse.children[30].visible = false;

w3DShowObj.commonFunc.changeCameraPosition({ x:1490.4858406089347, y: 809.5210489898475, z: 887.5572584428154 }, { x: 983.6185943448631, y: 103.74892211783629, z: 1390.9033551573477 }, 1000 * 2 / _this.animationParam.select_V, function() {var p1 = w3DShowObj.commonFunc.findObject("model1xfy2_8");var p2 = w3DShowObj.commonFunc.findObject("model1xfy2_9");

p1.material.opacity= 1;

p2.material.opacity= 1;

p1.visible= true;

p2.visible= true;

p1.position.x= 1205.18;

p1.position.y= 18.098;

p1.position.z= 1077.435;

p2.position.x= 1205.18;

p2.position.y= 18.098;

p2.position.z= 955.435;

_this.addXfyShebei(p1);

_this.addXfyShebei(p2);

_this.MovePerson(p1, { x:812.571, y: 18.098, z: 1463.143 }, 2000 * 2 / _this.animationParam.select_V, "run", function() {

p1.rotation.y+=Math.PI;

_this.changeShebeiPR(p1);

_this.MovePerson(p2, { x:812.571, y: 18.098, z: 1463.143 }, 2000 * 2 / _this.animationParam.select_V, "run", function() {

p2.rotation.y+=Math.PI;

_this.changeShebeiPR(p2);

w3DShowObj.commonFunc.changeCameraPosition({ x:1538.944163580977, y: 1513.0672411139547, z: 2354.001214331798 }, { x: 617.8079964045636, y: 229.71941718943594, z: 2146.224539225422 }, 2000 * 2 / _this.animationParam.select_V, function() { });//打开门一

_this.MovePerson(p2, { x:593.801, y: 18.098, z: 2779.143 }, 5000 * 2 / _this.animationParam.select_V, "run", function() {

p2.rotation.y+=Math.PI;

_this.changeShebeiPR(p2);

_this.MovePerson(p2, { x:147.801, y: 18.098, z: 2779.143 }, 3000 * 2 / _this.animationParam.select_V, "run", function() {

p2.rotation.y+=Math.PI;

_this.changeShebeiPR(p2);

_this.MovePerson(p2, { x:- 35.801, y: 18.098, z: 2835.143 }, 2000 * 2 / _this.animationParam.select_V, "run", function() {

p2.rotation.y+=Math.PI;

_this.changeShebeiPR(p2);

w3DShowObj.commonFunc.changeCameraPosition({ x:180.12344356607497, y: 219.4641870178687, z: 2722.482289974749 }, { x: 198.0736517991623, y: 93.12566866374983, z: 2483.689636602677 }, 2000 * 2 / _this.animationParam.select_V, function() { });

_this.changeShebeiPR(p2);

_this.MovePerson(p2, { x:- 35.801, y: 18.098, z: 2634.143 }, 2000 * 2 / _this.animationParam.select_V, "run", function() {

p2.rotation.y+=Math.PI;

_this.changeShebeiPR(p2);

_this.MovePerson(p2, { x:205.801, y: 18.098, z: 2534.143 }, 2000 * 2 / _this.animationParam.select_V, "run", function() {

p2.rotation.y+=Math.PI;

_this.changeShebeiPR(p2);

setTimeout(function() {

p2.rotation.y+= Math.PI / 2;

_this.changeShebeiPR(p2);

_this.over();

},10);

});

});

});

});

});

});var door1 = w3DShowObj.commonFunc.findObject("m4_door_1");

door1.visible= true;

_this.MovePerson(p1, { x:593.801, y: 18.098, z: 2779.143 }, 5000 * 2 / _this.animationParam.select_V, "run", function() {

p1.rotation.y+=Math.PI;

_this.changeShebeiPR(p1);

openDoor1(door1,function() {

_this.MovePerson(p1, { x:147.801, y: 18.098, z: 2779.143 }, 3000 * 2 / _this.animationParam.select_V, "run", function() {var door2 = w3DShowObj.commonFunc.findObject("m4_door_2");

door2.visible= true;

_this.changeShebeiPR(p1);

openDoor2(door2,function() {

p1.rotation.y+=Math.PI;

_this.changeShebeiPR(p1);

_this.MovePerson(p1, { x:- 35.801, y: 18.098, z: 2835.143 }, 2000 * 2 / _this.animationParam.select_V, "run", function() {

p1.rotation.y+=Math.PI;

_this.changeShebeiPR(p1);

_this.MovePerson(p1, { x:- 35.801, y: 18.098, z: 2634.143 }, 2000 * 2 / _this.animationParam.select_V, "run", function() {

p1.rotation.y+=Math.PI;

_this.changeShebeiPR(p1);

_this.MovePerson(p1, { x:280.801, y: 18.098, z: 2534.143 }, 2000 * 2 / _this.animationParam.select_V, "run", function() {

p1.rotation.y+=Math.PI;

_this.changeShebeiPR(p1);

setTimeout(function() {

p1.rotation.y+= Math.PI/2;

_this.changeShebeiPR(p1);

},10);

});

});

});

},"open");

});

},"open");

});

});

});

},1000 * 2 /_this.animationParam.select_V);

}//完成

WTBS.prototype.over = function() {var _this=this;var mhqjson = [{ "show": true, "uuid": "", "name": "m4_mhq_611", "objType": "GroupObj", "scale": { "x": 1, "y": 1, "z": 1 }, "position": { "x": 124.52233773683379, "y": -1.6143632860718924, "z": 2503.875818066437 }, "rotation": [{ "direction": "x", "degree": 0 }, { "direction": "y", "degree": 0 }, { "direction": "z", "degree": 0 }], "childrens": [{ "name": "mhq_611OBJCREN0", "objType": "cylinder", "radiusTop": 5, "radiusBottom": 5, "height": 30, "segmentsX": 24, "segmentsY": 0, "openEnded": false, "position": { "x": 0, "y": 162.02, "z": 0 }, "scale": { "x": 1, "y": 1, "z": 1 }, "rotation": [{ "direction": "x", "degree": 0 }, { "direction": "y", "degree": 0 }, { "direction": "z", "degree": 0 }], "style": { "skinColor": 16776960, "skin": { "skin_up": { "skinColor": 14895433, "side": 1, "opacity": 1, "imgurl": "rack_inside.jpg" }, "skin_down": { "skinColor": 2034186, "side": 1, "opacity": 1 }, "skin_side": { "skinColor": 16722217, "opacity": 1, "imgurl": "outside_lightmap.jpg" } } }, "showSortNub": 604, "show": true, "customType1": "", "customType2": "", "animation": null, "dbclickEvents": null, "BindDevId": null, "BindDevName": null, "devInfo": null, "BindMeteId": "10001", "BindMeteName": "" }, { "name": "mhq_611OBJCREN1", "objType": "cylinder", "radiusTop": 2, "radiusBottom": 5, "height": 5, "segmentsX": 24, "segmentsY": 0, "openEnded": false, "position": { "x": 0, "y": 179.503, "z": 0 }, "scale": { "x": 1, "y": 1, "z": 1 }, "rotation": [{ "direction": "x", "degree": 0 }, { "direction": "y", "degree": 0 }, { "direction": "z", "degree": 0 }], "style": { "skinColor": 16776960, "skin": { "skin_up": { "skinColor": 14895433, "side": 1, "opacity": 1, "imgurl": "rack_inside.jpg" }, "skin_down": { "skinColor": 16777215, "side": 1, "opacity": 1 }, "skin_side": { "skinColor": 16722217, "opacity": 1, "imgurl": "outside_lightmap.jpg" } } }, "showSortNub": 604, "show": true, "customType1": "", "customType2": "", "animation": null, "dbclickEvents": null, "BindDevId": null, "BindDevName": null, "devInfo": null, "BindMeteId": "10001", "BindMeteName": "" }, { "show": true, "uuid": "", "name": "mhq_611OBJCREN2", "objType": "tube", "points": [{ "x": 0, "y": 0, "z": 0 }, { "x": 10, "y": 0, "z": 0 }, { "x": 30, "y": -11, "z": -10 }], "position": { "x": 0, "y": 182.971, "z": 0 }, "scale": { "x": 1, "y": 1, "z": 1 }, "rotation": [{ "direction": "x", "degree": 0 }, { "direction": "y", "degree": 0 }, { "direction": "z", "degree": 0 }], "style": { "skinColor": 2032901, "opacity": 1 }, "segments": 64, "radialSegments": 8, "closed": false, "radius": 1, "showSortNub": 606, "customType1": "", "customType2": "", "animation": null, "dbclickEvents": null, "BindDevId": null, "BindDevName": null, "devInfo": null, "BindMeteId": "10001", "BindMeteName": "" }, { "show": true, "uuid": "", "name": "mhq_611OBJCREN3", "objType": "tube", "points": [{ "x": 0, "y": 0, "z": 0 }, { "x": 10, "y": 0, "z": 0 }, { "x": 30, "y": -11, "z": -10 }], "position": { "x": 0, "y": 182.971, "z": 0 }, "scale": { "x": 1, "y": 1, "z": 1 }, "rotation": [{ "direction": "x", "degree": 0 }, { "direction": "y", "degree": 0 }, { "direction": "z", "degree": 0 }], "style": { "skinColor": 2039583, "opacity": 1 }, "segments": 64, "radialSegments": 8, "closed": false, "radius": 1, "showSortNub": 606, "customType1": "", "customType2": "", "animation": null, "dbclickEvents": null, "BindDevId": null, "BindDevName": null, "devInfo": null, "BindMeteId": "10001", "BindMeteName": "" }, { "name": "mhq_611OBJCREN4", "objType": "cylinder", "radiusTop": 1, "radiusBottom": 1, "height": 10, "segmentsX": 3, "segmentsY": 0, "openEnded": false, "position": { "x": -4.797, "y": 183.476, "z": 0 }, "scale": { "x": 1, "y": 1, "z": 1 }, "rotation": [{ "direction": "x", "degree": 0 }, { "direction": "y", "degree": 0 }, { "direction": "z", "degree": 1.5707963267948966 }], "style": { "skinColor": 16776960, "skin": { "skin_up": { "skinColor": 2039583, "side": 1, "opacity": 1 }, "skin_down": { "skinColor": 2039583, "side": 1, "opacity": 1 }, "skin_side": { "skinColor": 855309, "opacity": 1 } } }, "showSortNub": 607, "show": true, "customType1": "", "customType2": "", "animation": null, "dbclickEvents": null, "BindDevId": null, "BindDevName": null, "devInfo": null, "BindMeteId": "10001", "BindMeteName": "" }, { "name": "mhq_611OBJCREN5", "objType": "cylinder", "radiusTop": 1, "radiusBottom": 1, "height": 10, "segmentsX": 3, "segmentsY": 0, "openEnded": false, "position": { "x": -4.407, "y": 181.316, "z": 0 }, "scale": { "x": 1, "y": 1, "z": 1 }, "rotation": [{ "direction": "x", "degree": -0.0019198621771937625 }, { "direction": "y", "degree": 0.08082619765985741 }, { "direction": "z", "degree": 1.8407813087858995 }], "style": { "skinColor": 16776960, "skin": { "skin_up": { "skinColor": 2039583, "side": 1, "opacity": 1 }, "skin_down": { "skinColor": 2039583, "side": 1, "opacity": 1 }, "skin_side": { "skinColor": 855309, "opacity": 1 } } }, "showSortNub": 607, "show": true, "customType1": "", "customType2": "", "animation": null, "dbclickEvents": null, "BindDevId": null, "BindDevName": null, "devInfo": null, "BindMeteId": "10001", "BindMeteName": "" }, { "show": true, "uuid": "", "name": "mhq_611OBJCREN6", "objType": "Startunnel", "sizeBase": 4, "sizeSpread": 2, "velocityBase": [200, -150, -50], "velocitySpread": [40, 40, 80], "angleBase": 0, "angleSpread": 720, "angleVelocityBase": 10, "angleVelocitySpread": 0, "img": "spikey.png", "colorBase": 16774553, "opacityBase": 1, "particlesPerSecond": 500, "particleDeathAge": 0.8, "emitterDeathAge": 10000, "x": 26.388, "y": 175.023, "z": -8.431, "scale": { "x": 1, "y": 1, "z": 1 }, "rotation": { "x": 0, "y": 0, "z": 0 }, "positionSpread": [1, 1, 1], "showSortNub": 700, "customType1": "", "customType2": "", "animation": null, "dbclickEvents": null, "BindDevId": null, "BindDevName": null, "devInfo": null, "BindMeteId": "10001", "BindMeteName": "" }], "showSortNub": 611, "customType1": "", "customType2": "", "animation": null, "dbclickEvents": null, "BindDevId": null, "BindDevName": null, "devInfo": null, "BindMeteId": "10001", "BindMeteName": ""}];var mhq = w3DShowObj.commonFunc.findObject("m4_mhq_611");if(mhq) {

mhq.visible= true;

}else{

w3DShowObj.commonFunc.loadModelsByJsons(mhqjson, { x:0, y: 0, z: 0 }, { x: 0, y: 0, z: 0 },true);

}var smk = w3DShowObj.commonFunc.findObject("m4_smoke");var fball = w3DShowObj.commonFunc.findObject("m4_fire");

smk.oldScale={ x: smk.scale.x, y: smk.scale.y, z: smk.scale.z};

fball.oldScale={ x: fball.scale.x, y: fball.scale.y, z: fball.scale.z};newTWEEN.Tween(fball.scale).to({

x:0.1,

y:0.1,

z:0.1}, (3000 * 2 / _this.animationParam.select_V)).onUpdate(function() {

smk.scale.x=fball.scale.x;

smk.scale.y=fball.scale.y;

smk.scale.z=fball.scale.z;

}).onComplete(function() {

smk.visible= false;

fball.visible= false;

smk.scale.x=smk.oldScale.x;

smk.scale.y=smk.oldScale.y;

smk.scale.z=smk.oldScale.z;

fball.scale.x=fball.oldScale.x;

fball.scale.y=fball.oldScale.y;

fball.scale.z=fball.oldScale.z;

setTimeout(function() {var _mhq = w3DShowObj.commonFunc.findObject("m4_mhq_611");

_mhq.visible= false;

w3DShowObj.destoryObjByName("m4_mhq_611");

w3DShowObj.destoryObjByName("m4_smoke");

w3DShowObj.destoryObjByName("m4_fire");

$.each(_this.addnames,function(_index, _obj) {

w3DShowObj.destoryObjByName(_obj);

});

_this.resetPosition();var door1 = w3DShowObj.commonFunc.findObject("m4_door_1");var door2 = w3DShowObj.commonFunc.findObject("m4_door_2");

door1.visible= false;

door2.visible= false;

openDoor1(door1,function () { }, "close");

openDoor2(door2,function () { }, "close");

},1000 * 2 /_this.animationParam.select_V);

}).start();

}//复位

WTBS.prototype.resetPosition = function() {

layer.msg("演习结束");var p1 = w3DShowObj.commonFunc.findObject("model1xfy2_8");var p2 = w3DShowObj.commonFunc.findObject("model1xfy2_9");var car = w3DShowObj.commonFunc.findObject("model1car_xfc_4");

p1.position.x=p1.oldPosition.x;

p1.position.y=p1.oldPosition.y;

p1.position.z=p1.oldPosition.z;

p2.position.x=p2.oldPosition.x;

p2.position.y=p2.oldPosition.y;

p2.position.z=p2.oldPosition.z;

car.position.x=car.oldPosition.x;

car.position.y=car.oldPosition.y;

car.position.z=car.oldPosition.z;

p1.rotation.x=p1.oldRotation.x;

p1.rotation.y=p1.oldRotation.y;

p1.rotation.z=p1.oldRotation.z;

p2.rotation.x=p2.oldRotation.x;

p2.rotation.y=p2.oldRotation.y;

p2.rotation.z=p2.oldRotation.z;

car.rotation.x=car.oldRotation.x;

car.rotation.y=car.oldRotation.y;

car.rotation.z=car.oldRotation.z;this.changeShebeiPR(p1);this.changeShebeiPR(p2);this.backToParkModels();this.showXFYXAmination = false;

}//推进摄像头

WTBS.prototype.closeCameraToObj = function(name,callBackFunc) {var _obj =w3DShowObj.commonFunc.findObject(name);var mainCamera = w3dshowstation.camera;//主场景

var objpositionx =_obj.position.x;var objpositiony =_obj.position.y;var objpositionz =_obj.position.z;if (typeof (_obj.parent) != 'undefined' && _obj.parent != null && typeof (_obj.parent.position) != 'undefined' && _obj.parent.position != null) {

objpositionx+=_obj.parent.position.x;

objpositiony+=_obj.parent.position.y;

objpositionz+=_obj.parent.position.z;

}if (typeof (_obj.oldPosition) != 'undefined' && _obj.oldPosition != null) {

objpositionx=_obj.oldPosition.x;

objpositiony=_obj.oldPosition.y;

objpositionz=_obj.oldPosition.z;

}newTWEEN.Tween(w3dshowstation.controls.target).to({

x: objpositionx, y: objpositiony, z: objpositionz

},600).onComplete(function() {var x_distance = mainCamera.position.x -objpositionx;var y_distance = mainCamera.position.y -objpositiony;var z_distance = mainCamera.position.z -objpositionz;var lv = 1000 / Math.sqrt(x_distance * x_distance + y_distance * y_distance + z_distance *z_distance);var runtweenTime = 1000;if (lv > 0.6) {

runtweenTime= 400;

}else if (lv > 0.3) {

runtweenTime= 1000;

}else if (lv > 0.1) {

runtweenTime= 1200;

}else if (lv > 0.05) {

runtweenTime= 1600;

}else if (lv > 0.01) {

runtweenTime= 2000;

}else{

runtweenTime= 2500;

}if (x_distance * x_distance + y_distance * y_distance + z_distance * z_distance > 300 * 300 && lv < 0.9999) {newTWEEN.Tween(mainCamera.position).to({

x: objpositionx+ (mainCamera.position.x - objpositionx) * lv, y: objpositiony + (mainCamera.position.y - objpositiony) * lv, z: objpositionz + (mainCamera.position.z - objpositionz) *lv

}, runtweenTime).onComplete(function() {if(callBackFunc) {

callBackFunc(_obj);

}

}).start();

}else{if(callBackFunc) {

callBackFunc(_obj);

}

}

}).start();

}/*=======================================================================

===================通用部分===================

=======================================================================*/

//消防员设备

WTBS.prototype.addXfyShebei= function(sfyobj) {var _this = this;if(sfyobj.shebei) {var shebeiobj = w3DShowObj.commonFunc.findObject(sfyobj.name+"_xfyshebei");

shebeiobj.visible= true;

w3DShowObj.commonFunc.changeObjsOpacity(shebeiobj.children,0.05, 1, 10, function() {

$.each(shebeiobj.children,function(_index, _obj) {

_obj.visible= true;

});

});

_this.changeShebeiPR(sfyobj);

}else{var xfySheBeiJson = { "show": true, "uuid": "", "name": "xfyshebei", "objType": "GroupObj", "scale": { "x": 1, "y": 1, "z": 1 }, "position": { "x": 0, "y": 0, "z": 0 }, "rotation": [{ "direction": "x", "degree": 0 }, { "direction": "y", "degree": 0 }, { "direction": "z", "degree": 0 }], "childrens": [{ "name": "xfyshebei_6OBJCREN0", "objType": "sphere", "radius": 7, "widthSegments": 12, "heightSegments": 12, "phiStart": 0, "phiLength": 6.283185307179586, "thetaStart": 0, "thetaLength": 1.5707963267948966, "position": { "x": 2.086, "y": 142.6, "z": 0 }, "scale": { "x": 1.4, "y": 1.5, "z": 1.2 }, "rotation": [{ "direction": "x", "degree": 0 }, { "direction": "y", "degree": 0 }, { "direction": "z", "degree": 0 }], "style": { "skinColor": 14040864, "imgurl": "alternator-top.jpg", "side": 2, "opacity": 1 }, "showSortNub": 5, "show": true, "customType1": "", "customType2": "", "animation": null, "dbclickEvents": null, "BindDevId": null, "BindDevName": null, "devInfo": null, "BindMeteId": null, "BindMeteName": null }, { "name": "xfyshebei_6OBJCREN1", "objType": "cylinder", "radiusTop": 8, "radiusBottom": 0, "height": 1, "segmentsX": 12, "segmentsY": 0, "openEnded": false, "position": { "x": 8.163, "y": 142.306, "z": 0 }, "scale": { "x": 1, "y": 1, "z": 1 }, "rotation": [{ "direction": "x", "degree": 0 }, { "direction": "y", "degree": 0 }, { "direction": "z", "degree": 0 }], "style": { "skinColor": 16776960, "skin": { "skin_up": { "skinColor": 11354400, "side": 2, "opacity": 1, "imgurl": "alternator-top.jpg" }, "skin_down": { "skinColor": 9868950, "side": 0, "opacity": 1 }, "skin_side": { "skinColor": 9868950, "side": 0, "opacity": 1 } } }, "showSortNub": 6, "show": true, "customType1": "", "customType2": "", "animation": null, "dbclickEvents": null, "BindDevId": null, "BindDevName": null, "devInfo": null, "BindMeteId": null, "BindMeteName": null }, { "name": "xfyshebei_6OBJCREN2", "objType": "cylinder", "radiusTop": 6, "radiusBottom": 6, "height": 50, "segmentsX": 8, "segmentsY": 0, "openEnded": false, "position": { "x": -12.753, "y": 102.993, "z": -5.934 }, "scale": { "x": 1, "y": 1, "z": 1 }, "rotation": [{ "direction": "x", "degree": 0 }, { "direction": "y", "degree": -1.5707963267948966 }, { "direction": "z", "degree": 0 }], "style": { "skinColor": 16776960, "skin": { "skin_up": { "skinColor": 12072223, "side": 1, "opacity": 1 }, "skin_down": { "skinColor": 12072223, "side": 1, "opacity": 1 }, "skin_side": { "skinColor": 12105912, "opacity": 1, "imgurl": "fire_extinguisher_side.jpg" } } }, "showSortNub": 15, "show": true, "customType1": "", "customType2": "", "animation": null, "dbclickEvents": null, "BindDevId": null, "BindDevName": null, "devInfo": null, "BindMeteId": null, "BindMeteName": null }, { "name": "xfyshebei_6OBJCREN3", "objType": "cylinder", "radiusTop": 6, "radiusBottom": 6, "height": 50, "segmentsX": 8, "segmentsY": 0, "openEnded": false, "position": { "x": -12.847, "y": 103.254, "z": 5.589 }, "scale": { "x": 1, "y": 1, "z": 1 }, "rotation": [{ "direction": "x", "degree": 0 }, { "direction": "y", "degree": 0 }, { "direction": "z", "degree": 0 }], "style": { "skinColor": 16776960, "skin": { "skin_up": { "skinColor": 12072223, "side": 1, "opacity": 1 }, "skin_down": { "skinColor": 12072223, "side": 1, "opacity": 1 }, "skin_side": { "skinColor": 12105912, "opacity": 1, "imgurl": "fire_extinguisher_side.jpg" } } }, "showSortNub": 15, "show": true, "customType1": "", "customType2": "", "animation": null, "dbclickEvents": null, "BindDevId": null, "BindDevName": null, "devInfo": null, "BindMeteId": null, "BindMeteName": null }, { "show": true, "uuid": "", "name": "xfyshebei_6OBJCREN4", "objType": "Lathe", "position": { "x": 0, "y": 125.204, "z": 0 }, "points": [{ "x": 17, "y": 0, "z": 0 }, { "x": 15, "y": 8, "z": 0 }, { "x": 11, "y": 18, "z": 0 }], "style": { "skinColor": 14040864, "imgurl": "alternator-top.jpg", "repeatx": true, "width": 0.1, "repeaty": true, "height": 0.1, "side": 2, "opacity": 1 }, "segments": 6, "radialSegments": 6, "closed": true, "phiStart": 0, "phiLength": 6.283185307179586, "showSortNub": 14, "customType1": "", "customType2": "", "animation": null, "dbclickEvents": null, "rotation": [{ "direction": "x", "degree": 0 }, { "direction": "y", "degree": 0 }, { "direction": "z", "degree": 0 }], "radius": null, "scale": { "x": 0.7, "y": 1, "z": 0.7 }, "BindDevId": null, "BindDevName": null, "devInfo": null, "BindMeteId": null, "BindMeteName": null }], "showSortNub": 6, "customType1": "", "customType2": "", "animation": null, "dbclickEvents": null, "BindDevId": null, "BindDevName": null, "devInfo": null, "BindMeteId": null, "BindMeteName": null};var shebeiobj =w3DShowObj.createObjByJson(xfySheBeiJson);

shebeiobj.visible= true;

shebeiobj.name= sfyobj.name + "_xfyshebei";

w3DShowObj.addObject(shebeiobj);

sfyobj.shebei=shebeiobj;

_this.changeShebeiPR(sfyobj);

}

}

WTBS.prototype.changeShebeiPR= function(sfyobj) {if(sfyobj.shebei) {

sfyobj.shebei.visible= true;

sfyobj.shebei.scale.x= sfyobj.scale.x / 0.8;

sfyobj.shebei.scale.y= sfyobj.scale.y / 0.8;

sfyobj.shebei.scale.z= sfyobj.scale.z / 0.8;

sfyobj.shebei.position.x=sfyobj.position.x ;

sfyobj.shebei.position.y=sfyobj.position.y;

sfyobj.shebei.position.z=sfyobj.position.z ;

sfyobj.shebei.rotation.y= sfyobj.rotation.y -Math.PI / 2;

sfyobj.shebei.rotation.x=sfyobj.rotation.x;

sfyobj.shebei.rotation.z=sfyobj.rotation.z;

}

}

WTBS.prototype.lineobj= null;//画路线

WTBS.prototype.addLine = function(points) {this.removeLine();var lineName = "mAuto_drawLine" + Math.floor(Math.random() * 100000);var _linejsonobj = { "show": true, "uuid": "", "name": lineName, "objType": "tube", "points": points, "position": { "x": 0, "y":0, "z": 0 }, "scale": { "x":1, "y":1, "z": 1 }, "rotation": [{ "direction": "x", "degree": 0 }, { "direction": "y", "degree": 0 }, { "direction": "z", "degree": 0 }], "style": { "skinColor": 1048357, "side": 2, "opacity": 1 }, "segments": (points.length - 1), "radialSegments":6, "closed": false, "radius": 40, "showSortNub": 1, "animation": null, "dbclickEvents": null, "BindDevId": null, "BindDevName": null, "devInfo": null, "BindMeteId": "10001", "BindMeteName": ""};var _lineobj =w3DShowObj.createObjByJson(_linejsonobj);this.lineobj =_lineobj;

w3DShowObj.commonFunc.flashObjs([_lineobj], lineName+ "_animation", 0xffff00, 10, 400, 0);

w3DShowObj.addObject(_lineobj);

}

WTBS.prototype.removeLine= function() {if (this.lineobj) {this.lineobj.visible = false;

w3DShowObj.destoryObj(this.lineobj);this.lineobj = null;

}

}//加载模型

WTBS.prototype.loadData = function(models, modelname, position, rotation, afterLoadedShow) {var _this = this;if (!_this[modelname + "HasLoaded"]) {if (position ==undefined) {

position= { x: 0, y: 0, z: 0};

}if (rotation ==undefined) {

rotation= { x: 0, y: 0, z: 0};

}var show = false;if(afterLoadedShow) {

show= true;

}if(models) {

w3DShowObj.commonFunc.loadModelsByJsons(models, position, rotation, show);

_this[modelname+ "HasLoaded"] = true;

}

}

}//虚化场景

WTBS.prototype.vModels = function(models,sucFunc) {var _this = this;if(models) {

w3DShowObj.commonFunc.changeObjsOpacity(models,1, 0.05, 1000, function() {if(sucFunc) {

sucFunc();

}

});

}

}//实体场景

WTBS.prototype.eModels = function(models, sucFunc) {var _this = this;if(models) {

$.each(models,function(_index, _obj) {

_obj.visible= true;

});

w3DShowObj.commonFunc.changeObjsOpacity(models,0.05, 1, 1000, function() {if(sucFunc) {

sucFunc();

}

});

}

}//隐藏模型

WTBS.prototype.hideModels = function(models, sucFunc) {

setTimeout(function() {

$.each(models,function(_index, _obj) {

_obj.visible= false;

});if(sucFunc) {

sucFunc();

}

},50);

}//显示模型

WTBS.prototype.showModels = function(models, sucFunc) {

setTimeout(function() {

$.each(models,function(_index, _obj) {

_obj.visible= true;

});if(sucFunc) {

sucFunc();

}

},50);

}var WTBS = null;functiongetWTBSInstance() {if (WTBS == null) {

WTBS= newWTBS();

WTBS.init();

}returnWTBS;

}//两秒后自动创建对象

setTimeout(function () { getWTBSInstance() }, 2000);

你可能感兴趣的:(threejs,管子)