This commit is contained in:
joylink_cuiweidong 2020-10-22 16:39:55 +08:00
commit 3d3fc84041
36 changed files with 1954 additions and 2043 deletions

View File

@ -152,7 +152,7 @@ export function justTripNoStop(tripNo, data) {
/**
* 修改折返时间
*/
export function justTripTurnBack(tripNo, data) {
export function justTripTurnback(tripNo, data) {
return request({
url: `/api/rpTools/${tripNo}/turnBack`,
method: 'put',

View File

@ -161,7 +161,6 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
}
}
}
console.log(psdVoiceStationList);
});
document.addEventListener( "mousedown", onselect, false );
@ -176,8 +175,8 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
}
function callback(Response) {
let data = JSON.parse(Response.body);
// }else{
if(data.type == "DeviceCtrl_3D"){
if(data.body.code == scope.nowcode){
scope.updateaction(data.body);
@ -225,7 +224,6 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
scope.camera.updateProjectionMatrix();
scope.renderer.setSize(scope.dom.offsetWidth, scope.dom.offsetHeight);
console.log(scope.windowstatus);
if(scope.windowstatus == "0"){
let changeelement = document.getElementById('jl3d');
changeelement.style.width = '100%';
@ -274,7 +272,15 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
}
})
animate();
let checkobject = setInterval(function(){
if(scope.modelmanager.switchmodel.mesh){
clearInterval(checkobject);
animate();
}
},1000);
});
function setpsdstationmap(stationlist){
@ -318,7 +324,7 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
}
this.selectmodel = function (data) {
scope.modelmanager
// scope.modelmanager
if (scope.showmodel) {
if (scope.showmodel.code != data.code) {
@ -374,10 +380,15 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) {
}
} else {
scope.nowcode = data.code;
if (data._type == "Switch") {
scope.modelmanager.switchmodel.normalPosition = "0";
scope.showmodel = scope.modelmanager.switchmodel.mesh;
scope.scene.add(scope.showmodel);
scope.devicetext.initdevicetext(scope.modelmanager.switchmodel.mesh);
scope.nowobject = scope.modelmanager.switchmodel.mesh;
updatemenulist(scope.devicetext.devicelist);
scope.raycasterstatus = true;
// scope.scene.add(scope.showmodel);
if (data.normalPosition == "0") {
scope.modelmanager.switchmodel.normalPosition = "0";

View File

@ -141,7 +141,7 @@ export function ModelManager(){
function fbxpromise(asset,mixers,model){
return new Promise(function(resolve, reject){
var loader = new THREE.FBXLoader();
loader.load( asset.assetUrl, function ( object ) {
let mixer = new THREE.AnimationMixer( object );
// object.traverse( function ( child ) {

View File

@ -4,7 +4,7 @@ import { getToken } from '@/utils/auth';
import store from '@/store/index_APP_TARGET';
// 定于仿真socket接口
export function PassflowConnect(jl3dpass,deviceaction,toptrain,downtrain,routegroup) {
export function PassflowConnect(deviceaction,toptrain,downtrain,routegroup,passerStation,passerAi) {
const scope = this;
this.teststomp = new StompClient();
@ -32,7 +32,7 @@ export function PassflowConnect(jl3dpass,deviceaction,toptrain,downtrain,routegr
if(data.type == "DeviceCtrl_3D"){
if(data.body.type == "PSD"){
if(data.body.code == jl3dpass.nowstation.toppsd){
if(data.body.code == passerStation.nowStation.toppsd){
if(data.body.open == 0){
deviceaction.top.action.reset();
@ -40,21 +40,21 @@ export function PassflowConnect(jl3dpass,deviceaction,toptrain,downtrain,routegr
deviceaction.top.action.timeScale = -1;
deviceaction.top.action.play();
}else{
jl3dpass.passerout("top")
passerAi.passerout("top")
deviceaction.top.action.reset();
deviceaction.top.action.time = 0;
deviceaction.top.action.timeScale = 1;
deviceaction.top.action.play();
}
}
if(data.body.code == jl3dpass.nowstation.downpsd){
if(data.body.code == passerStation.nowStation.downpsd){
if(data.body.open == 0){
deviceaction.down.action.reset();
deviceaction.down.action.time = deviceaction.down.action._clip.duration;
deviceaction.down.action.timeScale = -1;
deviceaction.down.action.play();
}else{
jl3dpass.passerout("down");
passerAi.passerout("down");
deviceaction.down.action.reset();
deviceaction.down.action.time = 0;
deviceaction.down.action.timeScale = 1;
@ -92,7 +92,7 @@ export function PassflowConnect(jl3dpass,deviceaction,toptrain,downtrain,routegr
if(data.type == "TrainRun_3D"){
for(let i=0,leni = data.body.length;i<leni;i++){
if(data.body[i].section == jl3dpass.nowstation.topsection){
if(data.body[i].section == passerStation.nowStation.topsection){
if(toptrain.nowcode != data.body[i].code){
toptrain.nowcode = data.body[i].code;
}
@ -104,7 +104,7 @@ export function PassflowConnect(jl3dpass,deviceaction,toptrain,downtrain,routegr
}
}
if(data.body[i].section == jl3dpass.nowstation.downsection){
if(data.body[i].section == passerStation.nowStation.downsection){
if(downtrain.nowcode != data.body[i].code){
downtrain.nowcode = data.body[i].code;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,228 @@
export function PasserCheckDoor(data) {
var scope = this;
this.zhajiin = [];
this.zhajiout = [];
for(let i=0;i<5;i++){
let zhaji = {
id:"in0"+(i+1),
status:0,
waiting:0
}
scope.zhajiin.push(zhaji);
}
for(let i=0;i<5;i++){
let zhaji = {
id:"out0"+(i+1),
status:0,
waiting:0
}
scope.zhajiout.push(zhaji);
}
this.initCheckDoorInAnimation = function(object,mixers ,deviceaction ,scene){
let mixer = new THREE.AnimationMixer( object );
let newclip = object.animations[ 0 ];
let newzhaji = object;
for(let i=0;i<newzhaji.children.length;i++){
if(newzhaji.children[i].name == "in01"){
newzhaji.children[i].animations = [];
newzhaji.children[i].animations.push(newclip.clone());
let mixer = new THREE.AnimationMixer( newzhaji.children[i] );
let action =mixer.clipAction( newzhaji.children[i].animations[0]);
action.setLoop(THREE.LoopOnce);
action.clampWhenFinished = true;
mixers.push(mixer);
let device = {
action:action,
mixer:mixer,
};
deviceaction[object.children[i].name] = device;
}
if(newzhaji.children[i].name == "in02"){
newzhaji.children[i].animations = [];
newzhaji.children[i].animations.push(newclip.clone());
let mixer = new THREE.AnimationMixer( newzhaji.children[i] );
let action =mixer.clipAction( newzhaji.children[i].animations[0]);
action.setLoop(THREE.LoopOnce);
action.clampWhenFinished = true;
mixers.push(mixer);
let device = {
action:action,
mixer:mixer,
};
deviceaction[object.children[i].name] = device;
}
if(newzhaji.children[i].name == "in03"){
newzhaji.children[i].animations = [];
newzhaji.children[i].animations.push(newclip.clone());
let mixer = new THREE.AnimationMixer( newzhaji.children[i] );
let action =mixer.clipAction( newzhaji.children[i].animations[0]);
action.setLoop(THREE.LoopOnce);
action.clampWhenFinished = true;
mixers.push(mixer);
let device = {
action:action,
mixer:mixer,
};
deviceaction[object.children[i].name] = device;
}
if(newzhaji.children[i].name == "in04"){
newzhaji.children[i].animations = [];
newzhaji.children[i].animations.push(newclip.clone());
let mixer = new THREE.AnimationMixer( newzhaji.children[i] );
let action =mixer.clipAction( newzhaji.children[i].animations[0]);
action.setLoop(THREE.LoopOnce);
action.clampWhenFinished = true;
mixers.push(mixer);
let device = {
action:action,
mixer:mixer,
};
deviceaction[object.children[i].name] = device;
}
if(newzhaji.children[i].name == "in05"){
newzhaji.children[i].animations = [];
newzhaji.children[i].animations.push(newclip.clone());
let mixer = new THREE.AnimationMixer( newzhaji.children[i] );
let action =mixer.clipAction( newzhaji.children[i].animations[0]);
action.setLoop(THREE.LoopOnce);
action.clampWhenFinished = true;
mixers.push(mixer);
let device = {
action:action,
mixer:mixer,
};
deviceaction[object.children[i].name] = device;
}
}
scene.add(newzhaji);
}
this.initCheckDoorOutAnimation = function(object,mixers ,deviceaction ,scene){
let mixer = new THREE.AnimationMixer( object );
let newclip = object.animations[ 0 ];
let newzhaji = object;
for(let i=0;i<newzhaji.children.length;i++){
if(newzhaji.children[i].name == "out01"){
newzhaji.children[i].animations = [];
newzhaji.children[i].animations.push(newclip.clone());
let mixer = new THREE.AnimationMixer( newzhaji.children[i] );
let action =mixer.clipAction( newzhaji.children[i].animations[0]);
action.setLoop(THREE.LoopOnce);
action.clampWhenFinished = true;
mixers.push(mixer);
let device = {
action:action,
mixer:mixer,
};
deviceaction[object.children[i].name] = device;
}
if(newzhaji.children[i].name == "out02"){
newzhaji.children[i].animations = [];
newzhaji.children[i].animations.push(newclip.clone());
let mixer = new THREE.AnimationMixer( newzhaji.children[i] );
let action =mixer.clipAction( newzhaji.children[i].animations[0]);
action.setLoop(THREE.LoopOnce);
action.clampWhenFinished = true;
mixers.push(mixer);
let device = {
action:action,
mixer:mixer,
};
deviceaction[object.children[i].name] = device;
}
if(newzhaji.children[i].name == "out03"){
newzhaji.children[i].animations = [];
newzhaji.children[i].animations.push(newclip.clone());
let mixer = new THREE.AnimationMixer( newzhaji.children[i] );
let action =mixer.clipAction( newzhaji.children[i].animations[0]);
action.setLoop(THREE.LoopOnce);
action.clampWhenFinished = true;
mixers.push(mixer);
let device = {
action:action,
mixer:mixer,
};
deviceaction[object.children[i].name] = device;
}
if(newzhaji.children[i].name == "out04"){
newzhaji.children[i].animations = [];
newzhaji.children[i].animations.push(newclip.clone());
let mixer = new THREE.AnimationMixer( newzhaji.children[i] );
let action =mixer.clipAction( newzhaji.children[i].animations[0]);
action.setLoop(THREE.LoopOnce);
action.clampWhenFinished = true;
mixers.push(mixer);
let device = {
action:action,
mixer:mixer,
};
deviceaction[object.children[i].name] = device;
}
if(newzhaji.children[i].name == "out05"){
newzhaji.children[i].animations = [];
newzhaji.children[i].animations.push(newclip.clone());
let mixer = new THREE.AnimationMixer( newzhaji.children[i] );
let action =mixer.clipAction( newzhaji.children[i].animations[0]);
action.setLoop(THREE.LoopOnce);
action.clampWhenFinished = true;
mixers.push(mixer);
let device = {
action:action,
mixer:mixer,
};
deviceaction[object.children[i].name] = device;
}
}
scene.add(newzhaji);
}
this.checkDoorControl = function(type,door,deviceaction){
let devicenum = door;
if(type == "in"){
let checkDoorId = scope.zhajiin[devicenum].id;
deviceaction[checkDoorId].action.reset();
deviceaction[checkDoorId].action.time = 0;
deviceaction[checkDoorId].action.timeScale = 1;
deviceaction[checkDoorId].action.play();
}else if(type == "out"){
let checkDoorId = scope.zhajiout[devicenum].id;
deviceaction[checkDoorId].action.reset();
deviceaction[checkDoorId].action.time = 0;
deviceaction[checkDoorId].action.timeScale = 1;
deviceaction[checkDoorId].action.play();
}
}
}

View File

@ -0,0 +1,174 @@
export function PasserHuman() {
let scope = this;
let originhuman1 = null;
let originhuman2 = null;
let originanima1 = null;
let originanima2 = null;
this.initHumans = function(object1,object2,mixers,deviceaction,scene){
originhuman1 = object1;
originhuman1.progress = 1;
// scene.add(originhuman1);
originhuman2 = object2;
let mixer1 = new THREE.AnimationMixer( originhuman1 );
let mixer2 = new THREE.AnimationMixer( originhuman2 );
originanima1 = originhuman1.animations[ 0 ];
originanima2 = originhuman2.animations[ 0 ];
originhuman1.remove(originhuman1.children[2]);
}
this.newHumanCreate = function(humanlist,position,stage,direct,door){
let mantype = Math.floor(Math.random()*(3-1+1))+1;
let newhuman;
if(mantype == 1){
newhuman = THREE.SkeletonUtils.clone( originhuman1 );
newhuman.animations = [];
newhuman.animations.push(originanima1.clone());
}else{
newhuman = THREE.SkeletonUtils.clone( originhuman2 );
newhuman.animations = [];
newhuman.animations.push(originanima2.clone());
}
let mixer = new THREE.AnimationMixer( newhuman );
newhuman.position.copy(position);
newhuman.status = 0;
newhuman.stage = stage;
if(direct){
if(direct == "top"){
newhuman.rotation.y = Math.PI;
}
newhuman.direct = direct;
}else{
newhuman.direct = null;
}
newhuman.doorstatus = null;
if(door){
newhuman.door = door;
}else{
newhuman.door = null;
}
newhuman.action = mixer.clipAction( newhuman.animations[ 0 ] );
newhuman.mixer = mixer;
newhuman.runrail = null;
newhuman.speed = 0;
newhuman.mixer = mixer;
humanlist.add(newhuman);
// console.log(humanlist.children.length);
}
this.initMoveAnimate = function(model,name,points,index){
model.status = 1;
let curve = new THREE.CatmullRomCurve3(points);
curve.curvrtype = "catmullrom";
// curve.getLength();
// curve动画轨迹
// progress动画进度
// enable当前动画开关
// speed动画速度
// console.log(curve);
model.action.play();
model.progress = 0;
model.runrail = curve;
model.speed = 0.2/curve.getLength();
}
this.moveAnimateUpdate = function(humanlist,olddataai,passerHuman){
for(let i=0;i<humanlist.children.length;i++){
if(humanlist.children[i].status == 1){
if(humanlist.children[i].progress>=1){
//更新模型坐标
if(humanlist.children[i].status == 1){
humanlist.children[i].progress = 1;
humanlist.children[i].action.stop();
humanlist.children[i].status = 0;
if(humanlist.children[i].stage == 8){
passerHuman.uncache(humanlist.children[i]);
humanlist.remove(humanlist.children[i]);
i--;
}else if(humanlist.children[i].stage == 7){
humanlist.children[i].stage = 8;
}
// else if(humanlist.children[i].stage == 6){
//
// humanlist.children[i].stage = 7;
//
// }
else if(humanlist.children[i].stage == 5){
humanlist.children[i].stage = 7;
}else if(humanlist.children[i].stage == 4){
passerHuman.uncache(humanlist.children[i]);
humanlist.remove(humanlist.children[i]);
i--;
}else if(humanlist.children[i].stage == 3){
humanlist.children[i].stage = 4;
if(olddataai){
humanlist.children[i].stage = 5;
}
}else if(humanlist.children[i].stage == 2){
humanlist.children[i].stage = 3;
}else if(humanlist.children[i].stage == 1){
humanlist.children[i].stage = 2;
}else if(humanlist.children[i].stage == 0){
// // console.log(humans[i].doors);
// zhajiin[humanlist.children[i].doors].waiting = 0;
humanlist.children[i].stage = 1;
}
}
}else{
//根据动画进度获取动画轨迹上点
// console.log(i);
// console.log(humanlist.children[i].runrail);
// console.log(humanlist.children[i].progress);
let point = humanlist.children[i].runrail.getPointAt(humanlist.children[i].progress);
//更新模型坐标
humanlist.children[i].position.x = point.x;
humanlist.children[i].position.y = point.y;
humanlist.children[i].position.z = point.z;
if((humanlist.children[i].progress+0.001)<1){
let tangent = humanlist.children[i].runrail.getPointAt(humanlist.children[i].progress+0.001);
humanlist.children[i].lookAt(new THREE.Vector3(tangent.x,humanlist.children[i].position.y,tangent.z));
}
humanlist.children[i].progress += humanlist.children[i].speed;
point = null;
}
}
}
}
this.uncache = function(uncachemodel){
if(uncachemodel){
uncachemodel.mixer.uncacheAction();
uncachemodel.traverse( function ( child ) {
if ( child.isMesh ) {
child.geometry.dispose();
child.material.dispose();
}
} );
}
}
}

View File

@ -0,0 +1,175 @@
import {Materialload} from '@/jlmap3d/main/loaders/Materialload.js';
export function PasserStation() {
var scope = this;
this.stationMesh = null;
this.stationleft = [];
this.stationright = [];
//替换材质组(站台的)
this.stationtexture = [];
this.stationlist = [];
this.nowStation = null;
for(let i=0;i<22;i++){
let sl = {
id:"left"+i,
status:0,
waiting:0
}
scope.stationleft.push(sl);
}
for(let i=0;i<22;i++){
let sr = {
id:"right"+i,
status:0,
waiting:0
}
scope.stationright.push(sr);
}
this.initStationAnimation = function( object,mixers ,deviceaction ,scene){
let mixer = new THREE.AnimationMixer( object ,mixers ,deviceaction ,scene);
let newclip = object.animations[ 0 ];
for(let j=0;j<object.children.length;j++){
if(object.children[j].name == "top"){
// let geometry = new THREE.BoxBufferGeometry( 50, 50, 50 );
// let material = new THREE.MeshBasicMaterial( {color: 0x00ff00} );
// let cube = new THREE.Mesh( geometry, material );
// cube.position.copy(object.children[j].position);
// scene.add( cube );
object.children[j].animations = [];
object.children[j].animations.push(newclip.clone());
let mixer = new THREE.AnimationMixer( object.children[j] );
let action =mixer.clipAction( object.children[j].animations[0])
action.setLoop(THREE.LoopOnce);
action.clampWhenFinished = true;
// action.play();
mixers.push(mixer);
let device = {
action:action,
mixer:mixer,
};
deviceaction[object.children[j].name] = device;
}
if(object.children[j].name == "down"){
object.children[j].animations = [];
object.children[j].animations.push(newclip.clone());
let mixer = new THREE.AnimationMixer( object.children[j] );
let action =mixer.clipAction( object.children[j].animations[0])
// action.play();
action.setLoop(THREE.LoopOnce);
action.clampWhenFinished = true;
mixers.push(mixer);
let device = {
action:action,
mixer:mixer,
};
deviceaction[object.children[j].name] = device;
}
}
object.traverse( function ( child ) {
if ( child.isMesh ) {
child.renderOrder = 9;
}
} );
scope.stationMesh = object;
// console.log(deviceaction);
scene.add(object);
}
this.initStationList = function(stationdata,standdata,psddata){
let list = [];
if(psddata){
for(let i=0,leni = standdata.length;i<leni;i++){
for(let j=0,lenj = psddata.length;j<lenj;j++){
if(standdata[i].code == psddata[j].standCode){
standdata[i].name = psddata[j].code;
}
}
}
for(let i=0,leni = stationdata.length;i<leni;i++){
if(stationdata[i].depot == false){
list[stationdata[i].name] = [];
for(let j=0,lenj = standdata.length;j<lenj;j++){
if(standdata[j].stationCode == stationdata[i].code){
list[stationdata[i].name].push(standdata[j]);
}
}
}
}
for(let k in list){
if(list[k].length>0){
let stationobject = {
code : list[k][0].stationCode,
name : k,
toppsd:null,
downpsd:null,
topsection:null,
downsection:null,
};
if(list[k][0].position.y<list[k][1].position.y){
stationobject.toppsd = list[k][0].name;
stationobject.downpsd = list[k][1].name;
stationobject.topsection = list[k][0].standTrackCode;
stationobject.downsection = list[k][1].standTrackCode;
}else{
stationobject.toppsd = list[k][1].name;
stationobject.downpsd = list[k][0].name;
stationobject.topsection = list[k][1].standTrackCode;
stationobject.downsection = list[k][0].standTrackCode;
}
scope.stationlist.push(stationobject);
}
}
scope.nowStation = scope.stationlist[0];
if(scope.stationtexture["stationlist"]){
scope.stationMesh.getObjectByName("zhantailiebiao").material.map =scope.stationtexture["stationlist"];
scope.stationMesh.getObjectByName("zhantailiebiao").material.map.needsUpdate = true;
if(scope.stationMesh.getObjectByName("menkuangyanse")){
scope.stationMesh.getObjectByName("menkuangyanse").material.map =scope.stationtexture["pingbimen"];
scope.stationMesh.getObjectByName("menkuangyanse").material.map.needsUpdate = true;
}
scope.stationMesh.getObjectByName("zhantaiming").material.map = scope.stationtexture[scope.nowStation.code];
scope.stationMesh.getObjectByName("zhantaiming").material.map.needsUpdate = true;
}
updatestationlist(scope.stationlist);
}else{
olddataai = true;
}
}
this.loadMaterial = function(netdata3d){
Materialload(scope,JSON.parse(netdata3d.data.assets).stationTextureList[0]);
}
this.changestation = function(stationname){
for(let i=0,leni=scope.stationlist.length;i<leni;i++){
if(scope.stationlist[i].name == stationname){
scope.nowStation = scope.stationlist[i];
if(scope.stationtexture["stationlist"]){
scope.stationMesh.getObjectByName("zhantaiming").material.map = scope.stationtexture[scope.nowStation.code];
scope.stationMesh.getObjectByName("zhantaiming").material.map.needsUpdate = true;
}
i=leni;
}
}
}
}

View File

@ -0,0 +1,120 @@
export function PasserTrain() {
let scope = this;
this.toptrain = null;
this.downtrain = null;
this.initTrain = function(object,mixers,deviceaction,scene){
let ntracks1,ntracks2,tclip,fclip;
ntracks1 = object.animations.slice(16,27);
tclip = new THREE.AnimationClip("three",2,ntracks1);
ntracks2 = object.animations.slice(0,15);
fclip = new THREE.AnimationClip("four",2,ntracks2);
object.traverse( function ( child ) {
if ( child.isMesh ) {
child.renderOrder = 8;
}
} );
scope.toptrain = object.clone(true);
scope.toptrain.nowcode = null;
scope.toptrain.action = {
top:[],
down:[]
};
let points1 = [];
points1.push(new THREE.Vector3(-71,0.06,-6.3));
points1.push(new THREE.Vector3(60.73,0.06,-6.3));
scope.toptrain.curve = new THREE.CatmullRomCurve3(points1);
scope.downtrain = object.clone(true);
scope.downtrain.nowcode = null;
scope.downtrain.action = {
top:[],
down:[]
};
let points2 = [];
points2.push(new THREE.Vector3(-71,0.06,28.68));
points2.push(new THREE.Vector3(60.73,0.06,28.68));
scope.downtrain.curve = new THREE.CatmullRomCurve3(points2);
inittrainanimation(scope.toptrain,tclip,fclip,mixers);
inittrainanimation(scope.downtrain,tclip,fclip,mixers);
scope.toptrain.position.z = -20;
scope.toptrain.position.y = -20000;
scope.toptrain.rotation.y = Math.PI;
scope.downtrain.position.z = 40;
scope.downtrain.position.y = -20000;
scene.add(scope.toptrain);
scene.add(scope.downtrain);
}
function inittrainanimation(train,tclip,fclip,mixers){
for(let j=0;j<train.children.length;j++){
if(train.children[j].name == "c1" || train.children[j].name == "c6"){
for(let n=0,lenn = train.children[j].children.length;n<lenn;n++){
if(train.children[j].children[n].name == "top"){
train.children[j].children[n].animations = [];
train.children[j].children[n].animations.push(tclip.clone());
let mixer = new THREE.AnimationMixer( train.children[j].children[n] );
mixers.push(mixer);
let action = mixer.clipAction( train.children[j].children[n].animations[ 0 ] );
action.setLoop(THREE.LoopOnce);
action.clampWhenFinished = true;
train.action.top.push(action);
mixers.push(mixer);
}
if(train.children[j].children[n].name == "down"){
train.children[j].children[n].animations = [];
train.children[j].children[n].animations.push(tclip.clone());
let mixer = new THREE.AnimationMixer( train.children[j].children[n] );
mixers.push(mixer);
let action = mixer.clipAction( train.children[j].children[n].animations[ 0 ] );
action.setLoop(THREE.LoopOnce);
action.clampWhenFinished = true;
train.action.down.push(action);
mixers.push(mixer);
}
}
}else{
for(let n=0,lenn = train.children[j].children.length;n<lenn;n++){
if(train.children[j].children[n].name == "top"){
train.children[j].children[n].animations = [];
train.children[j].children[n].animations.push(fclip.clone());
let mixer = new THREE.AnimationMixer( train.children[j].children[n] );
mixers.push(mixer);
let action = mixer.clipAction( train.children[j].children[n].animations[ 0 ] );
action.setLoop(THREE.LoopOnce);
action.clampWhenFinished = true;
train.action.top.push(action);
mixers.push(mixer);
}
if(train.children[j].children[n].name == "down"){
train.children[j].children[n].animations = [];
train.children[j].children[n].animations.push(fclip.clone());
let mixer = new THREE.AnimationMixer( train.children[j].children[n] );
mixers.push(mixer);
let action = mixer.clipAction( train.children[j].children[n].animations[ 0 ] );
action.setLoop(THREE.LoopOnce);
action.clampWhenFinished = true;
train.action.down.push(action);
mixers.push(mixer);
}
}
}
}
}
}

View File

@ -0,0 +1,256 @@
export function PasserAi(zone,finder) {
let scope = this;
//下车控制开关
this.toppasseron = false;
this.downpasseron = false;
//上车控制开关
this.toppasserin = false;
this.downpasserin = false;
let passerZone = zone;
let pathFinder = finder;
let path;
let playerPosition = new THREE.Vector3( -3.5, 0.5, 5.5 );
let targetPosition = new THREE.Vector3();
this.passerout = function(direct){
// console.log(direct);
if(direct == "top"){
// console.log("toppasser");
scope.toppasseron = true;
setTimeout(function(){
scope.toppasseron = false
scope.toppasserin = true;
setTimeout(function(){
scope.toppasserin = false;
}, 20000);
}, 5000);
}
if(direct == "down"){
// console.log("downpasser");
scope.downpasseron = true;
setTimeout(function(){
scope.downpasseron = false;
scope.downpasserin = true;
setTimeout(function(){
scope.downpasserin = false;
}, 20000);
}, 5000);
}
}
this.initPasser = function(humanlist,passerHuman){
for(let i=0;i<3;i++){
passerHuman.newHumanCreate(humanlist,passerZone.getinitposition("enter1"),0);
}
for(let i=0;i<3;i++){
passerHuman.newHumanCreate(humanlist,passerZone.getinitposition("enter2"),0);
}
for(let i=0;i<3;i++){
passerHuman.newHumanCreate(humanlist,passerZone.getinitposition("security"),1);
}
// for(let i=0;i<2;i++){
// // passerHuman.newHumanCreate(humanlist,passerZone.getinitposition("entergate"),3);
// }
for(let i=0;i<6;i++){
let standdata = passerZone.getstandposition("standtop");
passerHuman.newHumanCreate(humanlist,standdata.point,4,"top",standdata.door);
}
for(let i=0;i<6;i++){
let standdata = passerZone.getstandposition("standdown");
passerHuman.newHumanCreate(humanlist,standdata.point,4,"down",standdata.door);
}
}
this.aiUpdate = function(humanlist,passerHuman,passerCheckDoor,deviceaction){
for(let i=0;i<humanlist.children.length;i++){
// console.log(humans[i]);
if(humanlist.children[i].status == 0){
//stage = 0 进入车站
if(humanlist.children[i].stage == 0){
let points = [];
points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z));
targetPosition = passerZone.getzoneposition("security");
path = pathFinder.find(points[0],targetPosition);
for(let i=0;i<path.length;i++){
points.push(new THREE.Vector3(path[i].x,path[i].y,path[i].z));
}
passerHuman.initMoveAnimate(humanlist.children[i],i,points,i);
// console.log(path);
}
//stage = 1 前往进站闸机
if(humanlist.children[i].stage == 1){
let points = [];
points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z));
targetPosition = passerZone.getgateposition("entergate");
path = pathFinder.find(points[0],targetPosition.point);
humanlist.children[i].door = targetPosition.door;
for(let i=0;i<path.length;i++){
points.push(new THREE.Vector3(path[i].x,path[i].y,path[i].z));
}
passerHuman.initMoveAnimate(humanlist.children[i],i,points,i);
}
//stage = 2 过闸机
if(humanlist.children[i].stage == 2){
let points = [];
points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z));
points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z-5));
passerCheckDoor.checkDoorControl("in",humanlist.children[i].door,deviceaction)
passerHuman.initMoveAnimate(humanlist.children[i],i,points,i);
}
//stage = 3 前往站台
if(humanlist.children[i].stage == 3){
let direct = Math.floor(Math.random()*(2))+1;
// console.log(direct);
let points = [];
points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z));
// points.push(new THREE.Vector3(11.81,9.8,13.11));
//1--top
//2-- down
if(direct == 1){
targetPosition = passerZone.getstandposition("standtop");
path = pathFinder.find(points[0],targetPosition.point);
humanlist.children[i].direct = "top";
}else{
targetPosition = passerZone.getstandposition("standdown");
path = pathFinder.find(points[0],targetPosition.point);
humanlist.children[i].direct = "down";
}
if(path[0].y<9.84){
points.push(new THREE.Vector3(11.81,9.8,13.11));
points.push(new THREE.Vector3(29.5,1.77,13.16));
}
for(let i=0;i<path.length;i++){
points.push(new THREE.Vector3(path[i].x,path[i].y,path[i].z));
}
humanlist.children[i].door = targetPosition.door;
passerHuman.initMoveAnimate(humanlist.children[i],i,points,i);
}
//stage = 4 上车
if(humanlist.children[i].stage == 4){
if(scope.toppasserin && humanlist.children[i].direct == "top"){
let points = [];
points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z));
points.push(passerZone.list["standtop"].doorpoints[humanlist.children[i].door]);
if(points[1] == undefined){
}else{
passerHuman.initMoveAnimate(humanlist.children[i],i,points,i);
}
}
if(scope.downpasserin && humanlist.children[i].direct == "down"){
let points = [];
points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z));
points.push(passerZone.list["standdown"].doorpoints[humanlist.children[i].door]);
if(points[1] == undefined){
}else{
passerHuman.initMoveAnimate(humanlist.children[i],i,points,i);
}
// console.log(points);
}
}
//stage = 5 下车
if(humanlist.children[i].stage == 5){
let points = [];
points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z));
if(humanlist.children[i].direct == "top"){
points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z+5));
}
if(humanlist.children[i].direct == "down"){
points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z-5));
}
targetPosition = passerZone.getgateposition("exitgate");
path = pathFinder.find(points[1],targetPosition.point);
humanlist.children[i].door = targetPosition.door;
for(let i=0;i<path.length;i++){
points.push(new THREE.Vector3(path[i].x,path[i].y,path[i].z));
}
passerHuman.initMoveAnimate(humanlist.children[i],i,points,i);
}
//stage = 6 前往出站闸机
// if(humanlist.children[i].stage == 6){
// let points = [];
// points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z));
//
// groupID = pathfinder.getGroup( ZONE, points[0] );
// targetPosition = passerZone.getgateposition("exitgate");
// path = pathfinder.findPath( points[0], targetPosition, ZONE, groupID );
//
// for(let i=0;i<path.length;i++){
// points.push(new THREE.Vector3(path[i].x,path[i].y,path[i].z));
// }
// passerHuman.initMoveAnimate(humanlist.children[i],i,points,i);
// }
//stage = 7 出闸机
if(humanlist.children[i].stage == 7){
let points = [];
points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z));
points.push(new THREE.Vector3(humanlist.children[i].position.x+5,humanlist.children[i].position.y,humanlist.children[i].position.z));
passerCheckDoor.checkDoorControl("out",humanlist.children[i].door,deviceaction)
passerHuman.initMoveAnimate(humanlist.children[i],i,points,i);
}
//stage = 8 出站
if(humanlist.children[i].stage == 8){
let direct = Math.floor(Math.random()*(3-1+1))+1;
let points = [];
points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z));
//1--top
//2-- down
if(direct == 1){
targetPosition = passerZone.getzoneposition("exit1");
path = pathFinder.find(points[0],targetPosition);
}else{
targetPosition = passerZone.getzoneposition("exit2");
path = pathFinder.find(points[0],targetPosition);
}
for(let i=0;i<path.length;i++){
points.push(new THREE.Vector3(path[i].x,path[i].y,path[i].z));
}
passerHuman.initMoveAnimate(humanlist.children[i],i,points,i);
}
}
}
}
}

View File

@ -0,0 +1,69 @@
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
import { Pathfinding } from '@/jlmap3d/utils/pathfinder/Pathfinding.js';
import { OBJLoader } from '@/jlmap3d/main/loaders/OBJLoader';
export function PathFinder(){
let scope = this;
this.navmesh = null;
const ZONE = 'level';
const SPEED = 10;
const OFFSET = 0.2;
THREE.Pathfinding = Pathfinding;
let groupID,path,level;
let playerPosition = new THREE.Vector3( -3.5, 0.5, 5.5 );
let pathFinder = new THREE.Pathfinding();
let loaderObj = new THREE.OBJLoader();
// load a resource
loaderObj.load(
// resource URL
JL3D_LOCAL_STATIC+'/jl3d/path/path.obj',
// called when resource is loaded
function ( object ) {
// console.time('createZone()');
const zone = THREE.Pathfinding.createZone(object.children[0].geometry);
// console.timeEnd('createZone()');
pathFinder.setZoneData( ZONE, zone );
const navWireframe = new THREE.Mesh(object.children[0].geometry, new THREE.MeshBasicMaterial({
color: 0x808080,
wireframe: true
}));
navWireframe.position.y = OFFSET / 2;
// scene.add(navWireframe);
scope.navmesh = object;
groupID = pathFinder.getGroup( ZONE, playerPosition );
},
// called when loading is in progresses
function ( xhr ) {
console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' );
},
// called when loading has errors
function ( error ) {
console.log( 'An error happened' );
}
);
this.find = function(startPoint,targetPosition){
groupID = pathFinder.getGroup( ZONE, startPoint );
let resultPath = pathFinder.findPath( startPoint, targetPosition, ZONE, groupID );
return resultPath;
}
}

View File

@ -0,0 +1,66 @@
import { FourViewRender } from '@/jlmap3d/jl3dpassflow/passerrender/renderstate/fourviewrender.js';
import { TwoViewRender } from '@/jlmap3d/jl3dpassflow/passerrender/renderstate/twoviewrender.js';
import { FreeViewRender } from '@/jlmap3d/jl3dpassflow/passerrender/renderstate/freeviewrender.js';
export function PasserRender(mapmode) {
let scope = this;
this.state = null;
this.nowrender = null;
this.windowWidth = null;
this.windowHeight = null;
let fourViewRender = new FourViewRender();
let twoViewRender = new TwoViewRender();
let freeViewRender = new FreeViewRender();
let renderer = null;
this.initView = function(dom,scene,camerass){
scope.windowWidth = dom.offsetWidth ;
scope.windowHeight = dom.offsetHeight;
renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setClearColor(new THREE.Color(0x000000));
renderer.setViewport( 0, 0, scope.windowWidth, scope.windowHeight);
renderer.setScissor( 0, 0, scope.windowWidth, scope.windowHeight);
renderer.setScissorTest( false );
renderer.setSize(scope.windowWidth, scope.windowHeight);
renderer.sortObjects = true;
dom.appendChild(renderer.domElement);
fourViewRender.initRender(renderer,dom,scene);
twoViewRender.initRender(renderer,dom,scene);
freeViewRender.initRender(renderer,dom,scene,camerass);
//
scope.state = "4views";
scope.nowrender = fourViewRender;
}
this.changeRenderMode = function(mode){
if(mode == "4views"){
scope.nowrender = fourViewRender;
}
if(mode == "2views"){
scope.nowrender = twoViewRender;
}
if(mode == "freeview"){
scope.nowrender = freeViewRender;
}
scope.nowrender.changeRender();
}
this.reSize = function(offsetWidth,offsetHeight){
scope.nowrender.reSize(offsetWidth,offsetHeight);
}
this.update = function(){
scope.nowrender.update();
}
}

View File

@ -0,0 +1,115 @@
export function FourViewRender() {
let scope = this;
let renderer = null;
let windowWidth = null;
let windowHeight = null;
let renderScene = null;
let specilView,
specilCamera,
specilLeft,
specilBottom,
specilWidth,
specilHeight;
let views4 = [
{
left: 0,
bottom: 0,
width: 0.5,
height: 0.5,
background: new THREE.Color( 0.5, 0.5, 0.7 ),
eye: [ 3.7, 16, 26 ],
up: [3.7, 10 ,16 ],
fov: 30
},
{
left: 0,
bottom: 0.5,
width: 0.5,
height: 0.5,
background: new THREE.Color( 0.5, 0.5, 0.7 ),
eye: [ 3.7,17,-4 ],
up: [ 3.7, 10 ,16],
fov: 30
},
{
left: 0.5,
bottom: 0,
width: 0.5,
height: 0.5,
background: new THREE.Color( 0.7, 0.5, 0.5 ),
eye: [ -60, 6,11],
up: [ -59, 5.9,11 ],
fov: 45
},
{
left: 0.5,
bottom: 0.5,
width: 0.5,
height: 0.5,
background: new THREE.Color( 0.5, 0.7, 0.7 ),
eye: [ -7,17,2],
up: [-7, 10, 8],
fov: 60
}
];
for ( let ii = 0; ii < views4.length; ++ ii ) {
let view = views4[ ii ];
let camera = new THREE.PerspectiveCamera( view.fov, window.innerWidth / window.innerHeight, 1, 200 );
camera.position.fromArray( view.eye );
camera.lookAt( view.up[0],view.up[1],view.up[2] );
view.camera = camera;
}
this.initRender = function(render,dom,scene){
windowWidth = dom.offsetWidth ;
windowHeight = dom.offsetHeight;
renderScene = scene;
renderer = render;
}
this.changeRender = function(){
renderer.setClearColor(new THREE.Color(0x000000));
renderer.setSize(windowWidth, windowHeight);
renderer.sortObjects = true;
}
this.reSize = function(offsetWidth,offsetHeight){
windowWidth = window.innerWidth;
windowHeight = window.innerHeight;
}
this.update = function(){
for ( let ii = 0; ii < 4; ii ++ ) {
specilView = views4[ ii ];
specilCamera = specilView.camera;
// view.updateCamera( camera, scene, mouseX, mouseY );
specilLeft = Math.floor( windowWidth * specilView.left );
specilBottom = Math.floor( windowHeight * specilView.bottom );
specilWidth = Math.floor( windowWidth * specilView.width );
specilHeight = Math.floor( windowHeight * specilView.height );
renderer.setViewport( specilLeft,specilBottom,specilWidth,specilHeight );
renderer.setScissor( specilLeft,specilBottom,specilWidth,specilHeight );
renderer.setScissorTest( true );
specilCamera.aspect = specilWidth / specilHeight;
specilCamera.updateProjectionMatrix();
renderer.render( renderScene, specilCamera );
}
}
}

View File

@ -0,0 +1,51 @@
export function FreeViewRender() {
let scope = this;
let renderer = null;
let camera = null;
let windowWidth = null;
let windowHeight = null;
let renderScene = null;
let specilView,
specilCamera,
specilLeft,
specilBottom,
specilWidth,
specilHeight;
this.initRender = function(render,dom,scene,camerass){
camera = camerass;
camera.aspect = windowWidth / windowHeight;
camera.updateProjectionMatrix();
windowWidth = dom.offsetWidth ;
windowHeight = dom.offsetHeight;
renderScene = scene;
renderer = render;
}
this.changeRender = function(){
camera.aspect = windowWidth / windowHeight;
camera.updateProjectionMatrix();
renderer.setClearColor(new THREE.Color(0x000000));
renderer.setViewport( 0, 0, windowWidth, windowHeight);
renderer.setScissor( 0, 0, windowWidth, windowHeight);
renderer.setSize(windowWidth, windowHeight);
renderer.sortObjects = true;
}
this.reSize = function(offsetWidth,offsetHeight){
windowWidth = window.innerWidth;
windowHeight = window.innerHeight;
camera.aspect = windowWidth / windowHeight;
camera.updateProjectionMatrix();
renderer.setSize(windowWidth, windowHeight);
}
this.update = function(){
renderer.render(renderScene, camera);
}
}

View File

@ -0,0 +1,93 @@
export function TwoViewRender(render) {
let scope = this;
let renderer = null;
let windowWidth = null;
let windowHeight = null;
let renderScene = null;
let specilView,
specilCamera,
specilLeft,
specilBottom,
specilWidth,
specilHeight;
let views2 = [
{
left: 0,
bottom: 0,
width: 0.5,
height: 1,
background: new THREE.Color( 0.5, 0.5, 0.7 ),
eye: [ 3.7, 16, 26 ],
up: [3.7, 10 ,16 ],
fov: 60
},
{
left: 0.5,
bottom: 0,
width: 0.5,
height: 1,
background: new THREE.Color( 0.7, 0.5, 0.5 ),
eye: [ -60, 6,11],
up: [ -59, 5.9,11 ],
fov: 60
},
];
for ( let ii = 0; ii < views2.length; ++ ii ) {
let view = views2[ ii ];
let camera = new THREE.PerspectiveCamera( view.fov, window.innerWidth / window.innerHeight, 1, 200 );
camera.position.fromArray( view.eye );
camera.lookAt( view.up[0],view.up[1],view.up[2] );
view.camera = camera;
}
this.initRender = function(render,dom,scene){
windowWidth = dom.offsetWidth ;
windowHeight = dom.offsetHeight;
renderScene = scene;
renderer = render;
}
this.changeRender = function(){
renderer.setClearColor(new THREE.Color(0x000000));
renderer.setSize(windowWidth, windowHeight);
renderer.sortObjects = true;
}
this.reSize = function(offsetWidth,offsetHeight){
windowWidth = window.innerWidth;
windowHeight = window.innerHeight;
}
this.update = function(){
for ( let ii = 0; ii < 2; ii ++ ) {
specilView = views2[ ii ];
specilCamera = specilView.camera;
// view.updateCamera( camera, scene, mouseX, mouseY );
specilLeft = Math.floor( windowWidth * specilView.left );
specilBottom = Math.floor( windowHeight * specilView.bottom );
specilWidth = Math.floor( windowWidth * specilView.width );
specilHeight = Math.floor( windowHeight * specilView.height );
renderer.setViewport( specilLeft,specilBottom,specilWidth,specilHeight );
renderer.setScissor( specilLeft,specilBottom,specilWidth,specilHeight );
renderer.setScissorTest( true );
specilCamera.aspect = specilWidth / specilHeight;
specilCamera.updateProjectionMatrix();
renderer.render( renderScene, specilCamera );
}
}
}

View File

@ -17,107 +17,7 @@ export function Materialload(jlmap3dedit,standTextureData){
setstationtexture(jlmap3dedit.stationtexture,standTextureData.urls[i].name,BASE_ASSET_API + standTextureData.urls[i].url);
}
}
//
// if(assettype){
// if(assettype.stationtexture == "xian3"){
// if(jlmap3dedit.stationtexture){
// setstationtexture(jlmap3dedit.stationtexture,"stationlist",JL3D_LOCAL_STATIC+'/texture/xian3/xian3list.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"pingbimen",JL3D_LOCAL_STATIC+'/texture/xian3/pingbimen.png');
// setstationtexture(jlmap3dedit.stationtexture,"Station18000",JL3D_LOCAL_STATIC+'/texture/xian3/Station18000.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station61238",JL3D_LOCAL_STATIC+'/texture/xian3/Station61238.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station41790",JL3D_LOCAL_STATIC+'/texture/xian3/Station41790.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station67945",JL3D_LOCAL_STATIC+'/texture/xian3/Station67945.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station85598",JL3D_LOCAL_STATIC+'/texture/xian3/Station85598.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station4324",JL3D_LOCAL_STATIC+'/texture/xian3/Station4324.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station55755",JL3D_LOCAL_STATIC+'/texture/xian3/Station55755.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station53597",JL3D_LOCAL_STATIC+'/texture/xian3/Station53597.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station68029",JL3D_LOCAL_STATIC+'/texture/xian3/Station68029.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station17596",JL3D_LOCAL_STATIC+'/texture/xian3/Station17596.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station66742",JL3D_LOCAL_STATIC+'/texture/xian3/Station66742.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station90701",JL3D_LOCAL_STATIC+'/texture/xian3/Station90701.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station90652",JL3D_LOCAL_STATIC+'/texture/xian3/Station90652.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station54200",JL3D_LOCAL_STATIC+'/texture/xian3/Station54200.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station19253",JL3D_LOCAL_STATIC+'/texture/xian3/Station19253.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station37821",JL3D_LOCAL_STATIC+'/texture/xian3/Station37821.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station47557",JL3D_LOCAL_STATIC+'/texture/xian3/Station47557.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station78551",JL3D_LOCAL_STATIC+'/texture/xian3/Station78551.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station64474",JL3D_LOCAL_STATIC+'/texture/xian3/Station64474.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station21203",JL3D_LOCAL_STATIC+'/texture/xian3/Station21203.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station34499",JL3D_LOCAL_STATIC+'/texture/xian3/Station34499.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station571",JL3D_LOCAL_STATIC+'/texture/xian3/Station571.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station99903",JL3D_LOCAL_STATIC+'/texture/xian3/Station99903.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station43447",JL3D_LOCAL_STATIC+'/texture/xian3/Station43447.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station67917",JL3D_LOCAL_STATIC+'/texture/xian3/Station67917.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station60649",JL3D_LOCAL_STATIC+'/texture/xian3/Station60649.jpg');
// }
// }
// if(assettype.stationtexture == "haerbin1"){
// if(jlmap3dedit.stationtexture){
// setstationtexture(jlmap3dedit.stationtexture,"stationlist",JL3D_LOCAL_STATIC+'/texture/heb/haerbinlist.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"pingbimen",JL3D_LOCAL_STATIC+'/texture/heb/pingbimen.png');
// setstationtexture(jlmap3dedit.stationtexture,"Station5361",JL3D_LOCAL_STATIC+'/texture/heb/Station5361.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station11094",JL3D_LOCAL_STATIC+'/texture/heb/Station11094.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station11136",JL3D_LOCAL_STATIC+'/texture/heb/Station11136.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station17293",JL3D_LOCAL_STATIC+'/texture/heb/Station17293.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station18398",JL3D_LOCAL_STATIC+'/texture/heb/Station18398.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station22163",JL3D_LOCAL_STATIC+'/texture/heb/Station22163.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station25464",JL3D_LOCAL_STATIC+'/texture/heb/Station25464.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station28090",JL3D_LOCAL_STATIC+'/texture/heb/Station28090.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station41999",JL3D_LOCAL_STATIC+'/texture/heb/Station41999.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station44338",JL3D_LOCAL_STATIC+'/texture/heb/Station44338.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station46464",JL3D_LOCAL_STATIC+'/texture/heb/Station46464.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station50565",JL3D_LOCAL_STATIC+'/texture/heb/Station50565.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station60068",JL3D_LOCAL_STATIC+'/texture/heb/Station60068.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station62429",JL3D_LOCAL_STATIC+'/texture/heb/Station62429.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station64444",JL3D_LOCAL_STATIC+'/texture/heb/Station64444.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station71700",JL3D_LOCAL_STATIC+'/texture/heb/Station71700.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station72132",JL3D_LOCAL_STATIC+'/texture/heb/Station72132.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station78164",JL3D_LOCAL_STATIC+'/texture/heb/Station78164.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station79537",JL3D_LOCAL_STATIC+'/texture/heb/Station79537.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station82618",JL3D_LOCAL_STATIC+'/texture/heb/Station82618.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station85520",JL3D_LOCAL_STATIC+'/texture/heb/Station85520.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station89483",JL3D_LOCAL_STATIC+'/texture/heb/Station89483.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station96090",JL3D_LOCAL_STATIC+'/texture/heb/Station96090.jpg');
// }
// }
// if(assettype.stationtexture == "nb1"){
// if(jlmap3dedit.stationtexture){
// setstationtexture(jlmap3dedit.stationtexture,"stationlist",JL3D_LOCAL_STATIC+'/texture/nb1/nb1list.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"pingbimen",JL3D_LOCAL_STATIC+'/texture/nb1/pingbimen.png');
// setstationtexture(jlmap3dedit.stationtexture,"Station1533",JL3D_LOCAL_STATIC+'/texture/nb1/Station1533.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station11231",JL3D_LOCAL_STATIC+'/texture/nb1/Station11231.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station12421",JL3D_LOCAL_STATIC+'/texture/nb1/Station12421.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station16356",JL3D_LOCAL_STATIC+'/texture/nb1/Station16356.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station18678",JL3D_LOCAL_STATIC+'/texture/nb1/Station18678.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station19817",JL3D_LOCAL_STATIC+'/texture/nb1/Station19817.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station23567",JL3D_LOCAL_STATIC+'/texture/nb1/Station23567.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station24903",JL3D_LOCAL_STATIC+'/texture/nb1/Station24903.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station26416",JL3D_LOCAL_STATIC+'/texture/nb1/Station26416.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station27207",JL3D_LOCAL_STATIC+'/texture/nb1/Station27207.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station28032",JL3D_LOCAL_STATIC+'/texture/nb1/Station28032.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station28958",JL3D_LOCAL_STATIC+'/texture/nb1/Station28958.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station30520",JL3D_LOCAL_STATIC+'/texture/nb1/Station30520.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station32955",JL3D_LOCAL_STATIC+'/texture/nb1/Station32955.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station38286",JL3D_LOCAL_STATIC+'/texture/nb1/Station38286.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station38674",JL3D_LOCAL_STATIC+'/texture/nb1/Station38674.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station44173",JL3D_LOCAL_STATIC+'/texture/nb1/Station44173.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station63100",JL3D_LOCAL_STATIC+'/texture/nb1/Station63100.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station69378",JL3D_LOCAL_STATIC+'/texture/nb1/Station69378.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station72310",JL3D_LOCAL_STATIC+'/texture/nb1/Station72310.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station72764",JL3D_LOCAL_STATIC+'/texture/nb1/Station72764.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station75414",JL3D_LOCAL_STATIC+'/texture/nb1/Station75414.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station75494",JL3D_LOCAL_STATIC+'/texture/nb1/Station75494.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station75703",JL3D_LOCAL_STATIC+'/texture/nb1/Station75703.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station78392",JL3D_LOCAL_STATIC+'/texture/nb1/Station78392.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station81700",JL3D_LOCAL_STATIC+'/texture/nb1/Station81700.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station84098",JL3D_LOCAL_STATIC+'/texture/nb1/Station84098.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station86112",JL3D_LOCAL_STATIC+'/texture/nb1/Station86112.jpg');
// setstationtexture(jlmap3dedit.stationtexture,"Station99584",JL3D_LOCAL_STATIC+'/texture/nb1/Station99584.jpg');
// }
// }
// }
//console.log(jlmap3dedit.materiallist);
}
function settexture(materiallist,name,textureurl){

View File

@ -177,7 +177,7 @@ export function SimulationLoadNew(data,scope,netdata,mapdata,camera,controls,sce
scope.jsonwebworknew.postMessage("connect");
updatemenulist(stationstandlist.list,trainlisttest.list);
// loadingInstance.close();
store.dispatch('app/animationsClose');
store.dispatch('app/animationsClose');
});
}

View File

@ -1,8 +1,8 @@
const mapDeviceStyle = {
'01': 'chengdu_01',
'02': 'fuzhou_01',
'03': 'bejing_01',
// '03': 'race_01',
// '03': 'bejing_01',
'03': 'race_01',
'04': 'chengdu_03',
'06': 'ningbo_01',
'07': 'haerbin_01',

View File

@ -107,6 +107,7 @@ class SkinCode extends defaultStyle {
},
speedLimitName: {
z: 10,
limitValueDistance: -15,
kilometerFontSize: 8, // 公里标大小
kilometerColor: '#fff', // 公里标颜色
nameNumberFontSize: 11, // 限速值大小

View File

@ -107,7 +107,8 @@ class SkinCode extends defaultStyle {
},
speedLimitName: {
z: 10,
kilometerFontSize: 8, // 公里标大小
limitValueDistance: -15,
kilometerFontSize: 8, // 公里标大小
kilometerColor: '#fff', // 公里标颜色
nameNumberFontSize: 11, // 限速值大小
nameNumberColor: '#C00808', // 限速值颜色

View File

@ -6,7 +6,7 @@ class SkinCode extends defaultStyle {
super();
this.fontFamily = '宋体';
this[deviceType.Section] = {
elemnetType:['name', 'standTrackText', 'reentryTrackText', 'transferTrackText', 'destinationText', 'line', 'separator', 'speedLimit'],
elemnetType:['name', 'standTrackText', 'reentryTrackText', 'transferTrackText', 'destinationText', 'line', 'separator', 'speedLimit', 'speedLimitName'],
active: {
routeColor: false // 进路触发颜色
},
@ -65,6 +65,17 @@ class SkinCode extends defaultStyle {
textPosition: 'inside', // 文字位置
textVerticalAlign: 'middle' // 文字垂直对齐方式
},
speedLimitName: {
z: 10,
limitValueDistance: 10, // 限速值距离
kilometerFontSize: 0, // 公里标大小
kilometerColor: '#000', // 公里标颜色
nameNumberFontSize: 11, // 限速值大小
nameNumberColor: '#C0C000', // 限速值颜色
nameBackground: 'rgba(0, 0, 0, 0)', // 限速名称背景颜色
drogueWidth: 19, // 浮标宽度
drogueHeight: 12 // 浮标高度
},
destinationText: { // 目的码名称
z: 10,
position: 1, // 区段名称位置 1 上面 -1 下面 0 对称

View File

@ -14,87 +14,118 @@ export default class ELimitName extends Group {
create() {
/** 创建区段*/
const model = this.model.modelData;
// 开头 起点位置
const speedLimitNameLeft = this.createName({
drict: -1,
x: model.points[0].x,
y: model.points[0].y - 15
});
// 终点位置
const speedLimitNameRight = this.createName({
drict: 1,
x: model.points[model.points.length - 1].x,
y: model.points[model.points.length - 1].y - 15
});
speedLimitNameLeft.forEach(item => {
this.add(item);
});
speedLimitNameRight.forEach(item => {
this.add(item);
});
}
createName(model) {
const dataList = [];
const style = this.model.style;
const rectW = style.Section.speedLimitName.drogueWidth;
const rectH = style.Section.speedLimitName.drogueHeight;
dataList.push(new Polygon({
const x1 = model.points[0].x;
const y1 = model.points[0].y + style.Section.speedLimitName.limitValueDistance;
const x2 = model.points[model.points.length - 1].x;
const y2 = model.points[model.points.length - 1].y + style.Section.speedLimitName.limitValueDistance;
this.leftPolygon = new Polygon({
zlevel: this.zlevel,
z: this.z + 9,
shape: {
points: [
[model.x, model.y],
[model.x - model.drict * rectW, model.y],
[model.x - model.drict * (rectW + rectH / 2), model.y - rectH / 2],
[model.x - model.drict * rectW, model.y - rectH],
[model.x, model.y - rectH]
[x1, y1],
[x1 + rectW, y1],
[x1 + (rectW + rectH / 2), y1 - rectH / 2],
[x1 + rectW, y1 - rectH],
[x1, y1 - rectH]
]
},
style: {
lineWidth: 0,
fill: style.Section.speedLimitName.nameBackground
}
}));
// 公里标内容
dataList.push(new Text({
});
this.rightPolygon = new Polygon({
zlevel: this.zlevel,
z: this.z + 9,
shape: {
points: [
[x2, y2],
[x2 - rectW, y2],
[x2 - (rectW + rectH / 2), y2 - rectH / 2],
[x2 - rectW, y2 - rectH],
[x2, y2 - rectH]
]
},
style: {
lineWidth: 0,
fill: style.Section.speedLimitName.nameBackground
}
});
this.leftLimitValue = new Text({
zlevel: this.zlevel,
z: this.z + 10,
style: {
x: model.x - model.drict * 2,
y: model.y,
x: x1 + 2,
y: y1,
fontWeight: 'normal',
fontSize: style.Section.speedLimitName.nameNumberFontSize,
fontFamily: style.fontFamily,
text: '15',
text: '',
textFill: style.Section.speedLimitName.nameNumberColor,
textAlign: model.drict == -1 ? 'left' : 'right',
textAlign: 'left',
textPosition: style.Section.name.textPosition || 'inside',
textVerticalAlign: 'bottom'
}
}));
// 公里值
dataList.push(new Text({
});
this.rightLimitValue = new Text({
zlevel: this.zlevel,
z: this.z + 10,
style: {
x: model.x,
y: model.y + 12,
x: x2 - 2,
y: y2,
fontWeight: 'normal',
fontSize: style.Section.speedLimitName.nameNumberFontSize,
fontFamily: style.fontFamily,
text: '',
textFill: style.Section.speedLimitName.nameNumberColor,
textAlign: 'right',
textPosition: style.Section.name.textPosition || 'inside',
textVerticalAlign: 'bottom'
}
});
this.leftKilometerValue = new Text({
zlevel: this.zlevel,
z: this.z + 10,
style: {
x: x1,
y: y1 + 12,
fontWeight: 'normal',
fontSize: style.Section.speedLimitName.kilometerFontSize,
fontFamily: style.fontFamily,
text: '17.981km',
textFill: style.Section.speedLimitName.kilometerColor,
textAlign: model.drict == -1 ? 'left' : 'right',
textAlign: 'left',
textPosition: style.Section.name.textPosition || 'inside',
textVerticalAlign: 'bottom'
}
}));
return dataList;
});
this.rightKilometerValue = new Text({
zlevel: this.zlevel,
z: this.z + 10,
style: {
x: x2,
y: y2 + 12,
fontWeight: 'normal',
fontSize: style.Section.speedLimitName.kilometerFontSize,
fontFamily: style.fontFamily,
text: '17.981km',
textFill: style.Section.speedLimitName.kilometerColor,
textAlign: 'right',
textPosition: style.Section.name.textPosition || 'inside',
textVerticalAlign: 'bottom'
}
});
this.add(this.leftPolygon);
this.add(this.rightPolygon);
this.add(this.leftLimitValue);
this.add(this.rightLimitValue);
this.add(this.leftKilometerValue);
this.add(this.rightKilometerValue);
}
hide() {
@ -102,9 +133,10 @@ export default class ELimitName extends Group {
child.hide();
});
}
show() {
show(speedUpLimit) {
this.eachChild((child) => {
child.show();
});
this.leftLimitValue && this.leftLimitValue.setStyle({text: speedUpLimit});
}
}

View File

@ -228,12 +228,12 @@ export default class Section extends Group {
}
/** 设置限速*/
setSpeedUpperLimit() {
setSpeedUpperLimit(speedUpLimit) {
if (this.style.Section.line.speedLimitColor) { // 宁波三号线 独有
this.line.setStyle({stroke: this.style.Section.line.speedLimitColor});
} else {
this.speedLimit && this.speedLimit.show();
this.speedLimitName && this.speedLimitName.show();
this.speedLimitName && this.speedLimitName.show(speedUpLimit);
}
}
@ -272,7 +272,7 @@ export default class Section extends Group {
/** 区段切除*/
model.cutOff && this.sectionCutOff();
/** 是否限速*/
model.speedUpLimit > 0 && this.setSpeedUpperLimit();
model.speedUpLimit > 0 && this.setSpeedUpperLimit(model.speedUpLimit);
// 区段计轴预复位状态 (未处理)
// 区段故障锁闭
model.fault && this.faultLock();

View File

@ -37,12 +37,12 @@ class EEarlyStart extends Group {
textVerticalAlign: deviceParam.textVerticalAlign || style.textStyle.textVerticalAlign
}
});
this.add(this.detain);
this.add(this.earlyStart);
}
}
setColor(color) {
this.detain.setStyle('textFill', color);
this.earlyStart.setStyle('textFill', color);
}
recover() {
@ -50,27 +50,27 @@ class EEarlyStart extends Group {
}
hideMode() {
this.detain && this.detain.hide();
this.earlyStart && this.earlyStart.hide();
}
showMode(deviceParam) {
this.create(deviceParam);
this.detain && this.detain.show();
this.earlyStart && this.earlyStart.show();
}
setState(model, deviceParam = this.model.style.StationStand.detainNormal) {
/** 设置扣车*/
if (model.stationHoldTrain && model.centerHoldTrain) {
this.showMode(deviceParam);
this.setColor(deviceParam.andCenterTrainColor);
} else if (model.stationHoldTrain) {
this.showMode(deviceParam);
this.setColor(deviceParam.detainTrainTextColor);
} else if (model.centerHoldTrain) {
this.showMode(deviceParam);
this.setColor(deviceParam.centerTrainColor);
}
// /** 设置扣车*/
// if (model.stationHoldTrain && model.centerHoldTrain) {
// this.showMode(deviceParam);
// this.setColor(deviceParam.andCenterTrainColor);
// } else if (model.stationHoldTrain) {
// this.showMode(deviceParam);
// this.setColor(deviceParam.detainTrainTextColor);
// } else if (model.centerHoldTrain) {
// this.showMode(deviceParam);
// this.setColor(deviceParam.centerTrainColor);
// }
}
}
export default EDetain;
export default EEarlyStart;

View File

@ -251,7 +251,7 @@ export default {
},
/** 通过y坐标获取站信息 */
getStationByCoordinate(stations, y) {
getStationByCoordinateY(stations, y) {
for(var i = stations.length-1; i >= 0; i--) {
const station = stations[i];
const edge = this.EdgeHeight

View File

@ -168,7 +168,7 @@ export default {
},
/** 通过y坐标获取站信息*/
getStationByCoordinate(stations, y) {
getStationByCoordinateY(stations, y) {
for(var i = stations.length-1; i >= 0; i--) {
const station = stations[i];
const edge = this.EdgeHeight;

View File

@ -11,34 +11,41 @@ export default {
/** 偏移时间*/
TranslationTime: 0,
/** 转换model为Rect数据*/
calcAreaArgsByModel(chart, model) {
const startTime = model.startTime;
const endTime = model.endTime;
const fartherKmRange = model.fartherKmRange;
const closerKmRange = model.closerKmRange;
const point1 = [ startTime, this.getCoordinateYByKmRange(fartherKmRange)];
const point2 = [ endTime, this.getCoordinateYByKmRange(closerKmRange)]
const position1 = chart.convertToPixel('grid', point1);
const position2 = chart.convertToPixel('grid', point2);
const position = position1;
const width = Math.abs(position1[0] - position2[0]);
const height = Math.abs(position1[1] - position2[1]);
return {
model,
position,
point1,
point2,
width,
height
}
},
/** 将后台数据解析成图形*/
parseDataToGraph(chart, planData, stations) {
parseDataToGraph(chart, planData) {
const graphs = [];
if (planData &&
planData.areaList &&
planData.areaList.length) {
planData.areaList.forEach(area => {
const startTime = toTimeStamp(area.startTime);
const endTime = toTimeStamp(area.endTime);
const fartherKm = this.getCoordinateYByStationCode(stations, area.fartherStationCode);
const closerKm = this.getCoordinateYByStationCode(stations, area.closerStationCode);
const point1 = [ startTime, fartherKm];
const point2 = [ endTime, closerKm]
const position = chart.convertToPixel('grid', point1);
const position2 = chart.convertToPixel('grid', point2)
const width = Math.abs(position[0] - position2[0]);
const height = Math.abs(position[1] - position2[1]);
graphs.push(createRectArea({
areaNo: area.areaNo,
model: area,
position,
point1,
point2,
width,
height
}));
planData.areaList.forEach(model => {
model.startTime = toTimeStamp(model.startTime);
model.endTime = toTimeStamp(model.endTime);
graphs.push(createRectArea(this.calcAreaArgsByModel(chart, model)));
})
}
@ -179,33 +186,41 @@ export default {
},
/** 根据方向计算y折返偏移量*/
getOffsetYByDirection(value, direction) {
if (direction === '1') {
value -= this.EdgeHeight / 2;
} else if (direction === '2') {
value += this.EdgeHeight / 2;
getOffsetY(isSpecial, direction) {
if (isSpecial) {
if (direction === '1') {
return -this.EdgeHeight / 2;
} else if (direction === '2') {
return +this.EdgeHeight / 2;
}
}
return value;
return 0;
},
/** 通过y坐标获取车站公里表*/
getKmRangeByCoordinateY(y) {
return parseInt((y-this.EdgeHeight)/this.CoordMultiple);
},
/** 通过公里表获取坐标值*/
getCoordinateYByKmRange(k) {
return this.EdgeHeight + k * this.CoordMultiple
},
/** 通过站信息获取y坐标*/
getCoordinateYByStationCode(stations, stationCode, isSpecial=false, direction='01') {
var value = 0;
var station = stations.find(it => { return it.code == stationCode; });
if (station) {
value = this.EdgeHeight + station.kmRange * this.CoordMultiple;
if (isSpecial) {
value = this.getOffsetYByDirection(value, direction);
}
value = this.getCoordinateYByKmRange(station.kmRange) + this.getOffsetY(isSpecial, direction);
}
return value;
},
/** 通过y坐标获取站信息 */
getStationByCoordinate(stations, y) {
getStationByCoordinateY(stations, y) {
for(var i = stations.length-1; i >= 0; i--) {
const station = stations[i];
const edge = this.EdgeHeight

View File

@ -48,7 +48,6 @@ export function createRectArea(opt, style={}) {
return {
type: 'rect',
subType: 'area',
areaNo: opt.model.areaNo,
position: opt.position,
point1: opt.point1,
point2: opt.point2,

View File

@ -2,11 +2,11 @@ export function getBaseUrl() {
let BASE_API;
if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud';
BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪
// BASE_API = 'http://192.168.3.169:9000'; // 旭强
// BASE_API = 'http://192.168.3.175:9000'; // 张赛
BASE_API = 'http://192.168.3.82:9008'; // 杜康
// BASE_API = 'http://192.168.3.82:9008'; // 杜康
// BASE_API = 'http://b29z135112.zicp.vip';
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康
// BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛

View File

@ -146,21 +146,21 @@ export default {
if (this.renderswitch == true) {
this.rendermode = '退出监控';
this.renderswitch = false;
this.jl3d.switchviews('auto');
this.jl3d.switchviews('freeview');
} else {
this.rendermode = '监控视角';
this.renderswitch = true;
this.jl3d.switchviews(4);
this.jl3d.switchviews('4views');
}
},
switch4view() {
this.jl3d.switchviews(4);
this.jl3d.switchviews('4views');
},
switch2view() {
this.jl3d.switchviews(2);
this.jl3d.switchviews('2views');
},
switchauto() {
this.jl3d.switchviews('auto');
this.jl3d.switchviews('freeview');
},
updatestationlist(list) {
// console.log(list);

View File

@ -1,5 +1,5 @@
<template>
<el-tabs v-model="activeName" class="card">
<el-tabs v-model="activeName" class="card" @tab-click="tabClick">
<el-tab-pane class="view-control" :label="$t('map.property')" name="first" :lazy="lazy">
<operate-property
ref="dataform"
@ -49,6 +49,7 @@ export default {
return {
activeName: 'first',
lazy: true,
field: '',
terminalList: [
{ label: '显示', value: true},
{ label: '隐藏', value: false }
@ -59,7 +60,11 @@ export default {
leftTerminal: true, //
rightTerminal: true,
showConditions: '01', //
points: []
points: [],
leftSectionCode: '',
leftOffset: 0,
rightSectionCode: '',
rightOffset: 0
},
addModel: {
width: 1,
@ -81,7 +86,8 @@ export default {
},
computed: {
...mapGetters('map', [
'powerLineList'
'powerLineList',
'sectionList'
]),
showConditionsList() {
const showConditionsList = ConstConfig.ConstSelect.showConditionsList;
@ -89,6 +95,12 @@ export default {
? showConditionsList.map(elem => { return { value: elem.value, label: elem.enlabel }; })
: showConditionsList.map(elem => { return { value: elem.value, label: elem.label }; });
},
isButtonTypeLeft() {
return this.field == 'leftSectionCode';
},
isButtonTypeRight() {
return this.field == 'rightSectionCode';
},
form() {
const form = {
labelWidth: '120px',
@ -105,7 +117,11 @@ export default {
{ prop: 'showConditions', label: this.$t('map.showConditions'), type: 'radio', optionLabel: 'label', optionValue:'value', radioList: this.showConditionsList},
{ prop: 'leftTerminal', label: '左侧端点:', type: 'select', optionLabel: 'label', optionValue:'value', options: this.terminalList},
{ prop: 'rightTerminal', label: '右侧端点:', type: 'select', optionLabel: 'label', optionValue:'value', options: this.terminalList},
{ prop: 'points', label: this.$t('map.segmentCoordinates'), type: 'points', width: '100px', isHidden: !this.isPointsShow, addPoint: this.addPoint, delPoint: this.delPoint }
{ prop: 'points', label: this.$t('map.segmentCoordinates'), type: 'points', width: '100px', isHidden: !this.isPointsShow, addPoint: this.addPoint, delPoint: this.delPoint },
{ prop: 'leftSectionCode', label: '左端点区段', type: 'selectHover', optionLabel: 'name', optionValue: 'code', options: this.sectionList, hover: this.hover, buttonType: 'leftSectionCode', buttonShowType: this.isButtonTypeLeft},
{ prop: 'leftOffset', label: '左端点区段偏移', type: 'number', min: 0},
{ prop: 'rightSectionCode', label: '右端点区段', type: 'selectHover', optionLabel: 'name', optionValue: 'code', options: this.sectionList, hover: this.hover, buttonType: 'rightSectionCode', buttonShowType: this.isButtonTypeRight},
{ prop: 'rightOffset', label: '右端点区段偏移', type: 'number', min: 0}
]
},
map: {
@ -129,7 +145,11 @@ export default {
item: [
{ prop: 'width', label: this.$t('map.lineWidth'), type: 'number', min:1, placeholder: 'px'},
{ prop: 'showConditions', label: this.$t('map.showConditions'), type: 'radio', optionLabel: 'label', optionValue:'value', radioList: this.showConditionsList},
{ prop: 'points', label: this.$t('map.linePoint'), type: 'points', width: '100px', hiddenSpan:true, addPoint: this.addPointAddModel, delPoint: this.delPointAddModel }
{ prop: 'points', label: this.$t('map.linePoint'), type: 'points', width: '100px', hiddenSpan:true, addPoint: this.addPointAddModel, delPoint: this.delPointAddModel },
{ prop: 'leftSectionCode', label: '左端点区段', type: 'selectHover', optionLabel: 'code', optionValue: 'code', options: this.sectionList, hover: this.hover, buttonType: 'leftSectionCode', buttonShowType: this.isButtonTypeLeft},
{ prop: 'leftOffset', label: '左端点区段偏移', type: 'number', min: 0},
{ prop: 'rightSectionCode', label: '右端点区段', type: 'selectHover', optionLabel: 'name', optionValue: 'code', options: this.sectionList, hover: this.hover, buttonType: 'rightSectionCode', buttonShowType: this.isButtonTypeRight},
{ prop: 'rightOffset', label: '右端区段偏移', type: 'number', min: 0}
]
}
}
@ -141,6 +161,15 @@ export default {
mounted() {
},
methods: {
hover(field) {
this.field = field == this.field ? '' : field;
if (this.field) {
this.$emit('deviceSelect', 'Power');
}
},
tabClick() {
this.field = '';
},
deviceChange(code) {
this.$emit('setCenter', code);
this.deviceSelect(this.$store.getters['map/getDeviceByCode'](code));
@ -151,6 +180,14 @@ export default {
this.$refs.make && this.$refs.make.resetFields();
this.activeName = 'first';
this.editModel = deepAssign(this.editModel, selected);
} else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field === 'leftSectionCode' && this.activeName === 'first') {
this.editModel.leftSectionCode = selected.code;
} else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field === 'leftSectionCode' && this.activeName === 'second') {
this.addModel.leftSectionCode = selected.code;
} else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field === 'rightSectionCode' && this.activeName === 'first') {
this.editModel.rightSectionCode = selected.code;
} else if (selected && selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field === 'rightSectionCode' && this.activeName === 'second') {
this.addModel.rightSectionCode = selected.code;
}
},
addPoint(index) {
@ -177,6 +214,10 @@ export default {
leftTerminal: true,
rightTerminal: true,
showConditions: this.addModel.showConditions,
leftSectionCode: this.addModel.leftSectionCode,
leftOffset: this.addModel.leftOffset,
rightSectionCode: this.addModel.rightSectionCode,
rightOffset: this.addModel.rightOffset,
points: JSON.parse(pointArr)
};
this.$emit('updateMapModel', model);

View File

@ -34,11 +34,9 @@
</schedule>
<plan-just-running :config="config" :selected="selected" :stations="stations" @justRunning="doJustRunning" />
<plan-just-stop :config="config" :selected="selected" :stations="stations" @justStop="doJustStop"/>
<plan-just-turn-back :config="config" :selected="selected" :stations="stations" @justTurnBack="doJustTurnBack"/>
<plan-just-turnback :config="config" :selected="selected" :stations="stations" @justTurnBack="doJustTurnback"/>
<plan-set-params :config="config" @setParams="doSetPlanParams" />
<plan-set-area-note :target="target" @setAreaNote="doSetAreaNote" />
<plan-modify-area :target="target" :stations="stations" @modifyArea="doModifyArea" />
</div>
</template>
@ -46,10 +44,10 @@
import Schedule from './schedule.vue';
import PlanJustRunning from './dialog/planJustRunning.vue';
import PlanJustStop from './dialog/planJustStop.vue';
import PlanJustTurnBack from './dialog/planJustTurnBack.vue';
import PlanJustTurnback from './dialog/planJustTurnback.vue';
import PlanSetParams from './dialog/planSetParams.vue';
import PlanModifyArea from './dialog/planModifyArea.vue';
import PlanSetAreaNote from './dialog/planSetAreaNote';
import Menus from './menus.vue';
import { MenuEnum } from './utils.js';
import { timeFormat } from '@/utils/date';
@ -57,7 +55,7 @@ import { mapGetters } from 'vuex';
import { getStationList } from '@/api/runplan';
import {
getRpTools, clearRpPlan, addRpTrip, delRpTrip,
justTripNoRunning, justTripNoStop, justTripTurnBack,
justTripNoRunning, justTripNoStop, justTripTurnback,
translateRpService, delRpService,
getRpConfig, modifyRpConfig,
createRpArea, modifyRpArea, modifyAreaNote, delRpArea
@ -68,9 +66,8 @@ export default {
Schedule,
PlanJustRunning,
PlanJustStop,
PlanJustTurnBack,
PlanJustTurnback,
PlanSetParams,
PlanModifyArea,
PlanSetAreaNote,
Menus
},
@ -161,19 +158,6 @@ export default {
this.$messageBox(error.message);
})
},
onClear() {
this.selected = null;
this.target = null;
this.$refs.schedule.setLineReset();
this.$refs.schedule.clearTrip();
if (this.model.action != 'Translate') {
this.$refs.schedule.clearDraggable();
}
if (this.model.action != 'Add') {
this.$refs.schedule.clearGraphic();
}
},
onDialog(menu) {
this.$store.dispatch('menuOperation/setPopMenu', { position: {x: 0, y: 0}, menu });
},
@ -203,7 +187,20 @@ export default {
break;
}
},
onRemove(){
onClear() {
this.selected = null;
this.target = null;
this.$refs.schedule.setLineReset();
this.$refs.schedule.clearTrip();
if (this.model.action != 'Translate') {
this.$refs.schedule.clearDraggable();
}
if (this.model.action != 'Add') {
this.$refs.schedule.clearGraphic();
}
},
onRemove(){
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
@ -227,15 +224,9 @@ export default {
},
doNewPlan() {
clearRpPlan().then(resp => {
getRpTools().then(rest => {
const planData = rest.data;
this.$store.commit('rpTools/setPlanData', planData);
this.$refs.schedule.loadChartData(planData);
}).catch(() => {
this.$messageBox(this.$t('error.obtainOperationGraphFailed'));
this.$store.dispatch('rpTools/setStations', []);
});
this.refresh();
}).catch(error => {
this.refresh();
this.$message.info(error.message);
})
},
@ -247,48 +238,16 @@ export default {
this.$message.info(error.message);
})
},
doModifyArea(data) {
const startTime = data.startTime;
const endTime = data.endTime;
const startCodeIndex = this.stations.findIndex(el => { return el.code == data.startStationCode; })
const endCodeIndex = this.stations.findIndex(el => { return el.code == data.endStationCode; })
const model = {
fartherStationCode: startCodeIndex < endCodeIndex? data.endStationCode: data.startStationCode,
closerStationCode: startCodeIndex < endCodeIndex? data.startStationCode: data.endStationCode,
startTime: data.startTime,
endTime: data.endTime
}
modifyRpArea(data.areaNo, model).then(resp => {
getRpTools().then(rest => {
const planData = rest.data;
this.$store.commit('rpTools/setPlanData', planData);
this.$refs.schedule.loadChartData(planData);
this.$message.success('Construction area modified successfully.');
}).catch(() => {
this.$messageBox('Failed to load the plan.');
});
}).catch(error => {
this.$message.info(error.message);
})
},
doSetAreaNote(data) {
const model = {
text: data.text
}
modifyAreaNote(data.areaNo, model).then(resp => {
getRpTools().then(rest => {
const planData = rest.data;
this.$store.commit('rpTools/setPlanData', planData);
this.$refs.schedule.loadChartData(planData);
this.$message.success('Construction area note modified successfully.');
}).catch(() => {
this.$messageBox('Failed to load the plan.');
});
this.refresh();
}).catch(error => {
this.$message.info(error.message);
this.refresh();
})
},
doJustRunning(time) {
@ -299,15 +258,10 @@ export default {
}
justTripNoRunning(this.selected.tripNo, model).then(resp => {
getRpTools().then(rest => {
const planData = rest.data;
this.$store.commit('rpTools/setPlanData', planData);
this.$refs.schedule.loadChartData(planData);
}).catch(() => {
this.$messageBox('Failed to load the plan.');
});
this.refresh();
}).catch(error => {
this.$message.info(error.message);
this.$message.info(error.message);
this.refresh();
})
}
},
@ -319,35 +273,25 @@ export default {
}
justTripNoStop(this.selected.tripNo, model).then(resp => {
getRpTools().then(rest => {
const planData = rest.data;
this.$store.commit('rpTools/setPlanData', planData);
this.$refs.schedule.loadChartData(planData);
}).catch(() => {
this.$messageBox('Failed to load the plan.');
});
}).catch(error => {
this.refresh();
}).catch(error => {
this.$message.info(error.message);
this.refresh();
})
}
},
doJustTurnBack(time) {
doJustTurnback(time) {
if (this.selected) {
const model = {
seconds: time,
stationCode: this.selected.stationCode
}
justTripTurnBack(this.selected.tripNo, model).then(resp => {
getRpTools().then(rest => {
const planData = rest.data;
this.$store.commit('rpTools/setPlanData', planData);
this.$refs.schedule.loadChartData(planData);
}).catch(() => {
this.$messageBox('Failed to load the plan.');
});
justTripTurnback(this.selected.tripNo, model).then(resp => {
this.refresh();
}).catch(error => {
this.$message.info(error.message);
this.refresh();
})
}
},
@ -360,23 +304,18 @@ export default {
}
addRpTrip(model).then(resp => {
getRpTools().then(rest => {
const planData = rest.data;
this.$store.commit('rpTools/setPlanData', planData);
this.$refs.schedule.loadChartData(planData);
}).catch(() => {
this.$messageBox('Failed to load the plan.');
});
this.refresh();
}).catch(error => {
this.$message.info(error.message);
this.refresh();
this.$refs.schedule.clearGraphic(['mark']);
})
},
doCreateArea(data) {
const startTime = data.startTime;
const endTime = data.endTime;
const startCodeIndex = this.stations.findIndex(el => { return el.code == data.startStationCode; })
const endCodeIndex = this.stations.findIndex(el => { return el.code == data.endStationCode; })
const startKmRange = data.startKmRange;
const endKmRange = data.endKmRange;
if (Math.abs(endTime - startTime) < 10*60) {
this.$refs.schedule.clearGraphic(['mark']);
@ -385,40 +324,30 @@ export default {
}
const model = {
fartherStationCode: startCodeIndex < endCodeIndex? data.endStationCode: data.startStationCode,
closerStationCode: startCodeIndex < endCodeIndex? data.startStationCode: data.endStationCode,
fartherKmRange: startKmRange < endKmRange? data.endKmRange: data.startKmRange,
closerKmRange: startKmRange < endKmRange? data.startKmRange: data.endKmRange,
startTime: endTime < startTime? timeFormat(data.endTime): timeFormat(data.startTime),
endTime: endTime < startTime? timeFormat(data.startTime): timeFormat(data.endTime)
}
createRpArea(model).then(resp => {
getRpTools().then(rest => {
const planData = rest.data;
this.$store.commit('rpTools/setPlanData', planData);
this.$refs.schedule.loadChartData(planData);
}).catch(() => {
this.$messageBox('Failed to load the plan.');
});
this.refresh();
}).catch(error => {
this.$message.info(error.message);
this.refresh();
this.$refs.schedule.clearGraphic(['mark']);
})
},
doTranslateService() {
if (this.selected) {
const model = {
seconds : this.selected.sx
seconds : this.selected.time
}
translateRpService(this.selected.serviceNo, model).then(resp => {
getRpTools().then(rest => {
const planData = rest.data;
this.$store.commit('rpTools/setPlanData', planData);
this.$refs.schedule.loadChartData(planData);
}).catch(() => {
this.$messageBox('Failed to load the plan.');
});
this.refresh();
}).catch(error => {
this.refresh();
this.$message.info(error.message);
});
}
@ -427,22 +356,17 @@ export default {
if (this.target) {
const data = this.target.model;
const model = {
fartherStationCode: data.fartherStationCode,
closerStationCode: data.closerStationCode,
startTime: data.startTime,
endTime: data.endTime,
fartherKmRange: parseInt(data.fartherKmRange),
closerKmRange: parseInt(data.closerKmRange),
startTime: timeFormat(data.startTime),
endTime: timeFormat(data.endTime),
text: data.text
}
modifyRpArea(data.areaNo, model).then(resp => {
getRpTools().then(rest => {
const planData = rest.data;
this.$store.commit('rpTools/setPlanData', planData);
this.$refs.schedule.loadChartData(planData);
}).catch(() => {
this.$messageBox('Failed to load the plan.');
});
this.refresh();
}).catch(error => {
this.refresh();
this.$message.info(error.message);
});
}
@ -450,15 +374,9 @@ export default {
doRemoveService() {
if (this.selected) {
delRpService(this.selected.serviceNo).then(resp => {
getRpTools().then(rest => {
const planData = rest.data;
this.$store.commit('rpTools/setPlanData', planData);
this.$refs.schedule.loadChartData(planData);
this.onClear();
}).catch(() => {
this.$messageBox('Failed to load the plan.');
});
this.refresh();
}).catch(error => {
this.refresh();
this.$message.info(error.message);
})
}
@ -466,35 +384,34 @@ export default {
doRemoveTrip() {
if (this.selected) {
delRpTrip(this.selected.tripNo).then(resp => {
getRpTools().then(rest => {
const planData = rest.data;
this.$store.commit('rpTools/setPlanData', planData);
this.$refs.schedule.loadChartData(planData);
this.onClear();
}).catch(() => {
this.$messageBox('Failed to load the plan.');
});
this.refresh();
}).catch(error => {
this.refresh();
this.$message.info(error.message);
})
}
},
doRemoveArea() {
if (this.target) {
delRpArea(this.target.areaNo).then(resp => {
getRpTools().then(rest => {
const planData = rest.data;
this.$store.commit('rpTools/setPlanData', planData);
this.$refs.schedule.loadChartData(planData);
this.onClear();
}).catch(() => {
this.$messageBox('Failed to load the plan.');
});
const data = this.target.model;
delRpArea(data.areaNo).then(resp => {
this.refresh();
}).catch(error => {
this.refresh();
this.$message.info(error.message);
})
}
}
},
refresh() {
getRpTools().then(rest => {
const planData = rest.data;
this.$store.commit('rpTools/setPlanData', planData);
this.$refs.schedule.loadChartData(planData);
this.onClear();
}).catch(() => {
this.$messageBox('Failed to load the plan.');
});
}
}
};
</script>

View File

@ -9,9 +9,11 @@ export default {
callRegister: [],
markList: [],
buildModel: {
endStationCode: '',
startStationCode: '',
startKmRange: 0,
startTime: 0,
endStationCode: '',
endKmRange: 0,
endTime: 0
},
selected: null,
@ -39,7 +41,7 @@ export default {
const option = this.myChart.getOption();
const minY = option.yAxis[0].min;
const xVal = option.xAxis[0].data[xIndex];
const yObj = this.planUtil.getStationByCoordinate(this.stations, yIndex-minY);
const yObj = this.planUtil.getStationByCoordinateY(this.stations, yIndex-minY);
if (yObj && cb) {
cb({yObj, xVal, pointInPixel, pointInGrid, e});
}
@ -83,13 +85,13 @@ export default {
const elements = option.graphic[0].elements
const graphic = echarts.util.map(elements, (el) => {
if (fixedList.includes(el.subType)) {
const position = this.myChart.convertToPixel('grid', el.point1);
const position1 = this.myChart.convertToPixel('grid', el.point1);
const position2 = this.myChart.convertToPixel('grid', el.point2);
const width = Math.abs(position[0] - position2[0]);
const height = Math.abs(position[1] - position2[1])
const width = Math.abs(position1[0] - position2[0]);
const height = Math.abs(position1[1] - position2[1])
return {
position,
position: position1,
shape: { width, height }
}
} else {
@ -104,14 +106,17 @@ export default {
},
onZrMouseOver(e) {
this.pixelExecCb(e, this.doSetTarget);
if (this.model.action == 'Translate') {
this.pixelExecCb(e, this.doSetAreaTranslate);
} else if (this.model.action == 'Edit') {
this.pixelExecCb(e, this.doSetAreaDrags);
if (this.model.choice == 'Construction') {
if (this.model.action == 'Translate') {
this.pixelExecCb(e, this.doSetAreaTranslate);
} else if (this.model.action == 'Edit') {
this.pixelExecCb(e, this.doSetAreaHorns);
}
}
},
onZrMouseDown(e) {
if (e.target && ['area'].includes(e.target.subType)) {
this.pixelExecCb(e, this.doSetTarget);
this.dragging = true;
if (this.model.choice == 'Construction') {
if (this.model.action == 'Note') {
@ -128,18 +133,18 @@ export default {
if (this.model.action == 'Add') {
this.pixelExecCb(e, this.doCreateArea);
}
// if (this.model.action == 'Translate') {
// this.pixelExecCb(e, this.doSetAreaTranslate);
// } else if (this.model.action == 'Edit') {
// this.pixelExecCb(e, this.doSetAreaDrags);
// }
}
},
onZrMouseUp(e) {
if (['Plan', 'Construction'].includes(this.model.choice)) {
if(this.model.action == 'Translate' && this.dragging) {
this.pixelExecCb(e, this.doTranslate)
if (this.dragging) {
if(this.model.choice == 'Plan') {
if (this.model.action == 'Translate') {
this.pixelExecCb(e, this.doTranslate)
}
} else if(this.model.choice == 'Construction') {
if(['Translate', 'Edit'].includes(this.model.action)) {
this.pixelExecCb(e, this.doTranslate)
}
}
}
@ -212,6 +217,8 @@ export default {
this.model.choice == 'Construction') {
if (this.model.action == 'Translate') {
this.pixelExecCb(e, this.doAreaDragging);
} else if (this.model.action == 'Edit') {
this.pixelExecCb(e, this.doAreaHornDragging);
}
}
},
@ -229,7 +236,7 @@ export default {
e.seriesName.includes('service')) {
const option = this.myChart.getOption();
const filters = option.graphic[0].elements.filter(el => { return el.subType != 'drag'});
filters.push(utils.buildDragDataObj(pointInPixel, pointInGrid, this))
filters.push(utils.buildDragDataObj(pointInPixel, pointInGrid, this, 'drag'))
option.graphic[0].elements = filters;
this.myChart.setOption(option, {notMerge: true});
@ -240,12 +247,12 @@ export default {
});
}
},
doCreateMark({e, pointInGrid, pointInPixel, yObj, xVal}) {
doCreateMark({e, pointInGrid, pointInPixel, yObj}) {
const option = this.myChart.getOption();
const graphic = option.graphic;
const elements = graphic[0].elements;
elements.push(utils.buildMarkPointObj(pointInPixel, pointInGrid, this))
elements.push(utils.buildMarkPointObj(pointInPixel, pointInGrid, this, 'mark'))
this.myChart.setOption(option, {notMerge: true});
@ -253,22 +260,22 @@ export default {
const elemList = elements.filter(el => { return el.subType != 'mark'});
if (markList.length == 1) {
this.buildModel.startTime = pointInGrid[0];
this.buildModel.startStationCode = yObj.code;
this.buildModel.startTime = xVal;
} else if (markList.length >= 2) {
this.buildModel.endTime = pointInGrid[0];
this.buildModel.endStationCode = yObj.code;
this.buildModel.endTime = xVal;
option.graphic[0].elements = elemList;
this.$emit('create', this.buildModel);
}
},
doCreateArea({e, pointInGrid, pointInPixel, yObj, xVal}) {
doCreateArea({e, pointInGrid, pointInPixel}) {
if (!e.target) {
const option = this.myChart.getOption();
const graphic = option.graphic;
const elements = graphic[0].elements;
elements.push(utils.buildMarkPointObj(pointInPixel, pointInGrid, this))
elements.push(utils.buildMarkPointObj(pointInPixel, pointInGrid, this, 'mark'))
this.myChart.setOption(option, {notMerge: true});
@ -276,11 +283,11 @@ export default {
const elemList = elements.filter(el => { return el.subType != 'mark'});
if (markList.length == 1) {
this.buildModel.startStationCode = yObj.code;
this.buildModel.startTime = xVal;
this.buildModel.startTime = pointInGrid[0];
this.buildModel.startKmRange = this.planUtil.getKmRangeByCoordinateY(pointInGrid[1]);
} else if (markList.length >= 2) {
this.buildModel.endStationCode = yObj.code;
this.buildModel.endTime = xVal;
this.buildModel.endTime = pointInGrid[0];
this.buildModel.endKmRange = this.planUtil.getKmRangeByCoordinateY(pointInGrid[1]);
option.graphic[0].elements = elemList;
this.$emit('create', this.buildModel);
}
@ -292,11 +299,7 @@ export default {
const model = target.model
Object.assign(model, {
_x: pointInGrid[0],
_y: pointInGrid[1],
dx: 0,
dy: 0,
sx: 0,
sy: 0
_y: pointInGrid[1]
})
this.target = target;
@ -353,8 +356,8 @@ export default {
_y: pointInGrid[1],
dx: 0,
dy: 0,
sx: 0,
sy: 0
time: 0,
kmRange: 0
}
this.$emit('select', this.selected);
@ -363,20 +366,39 @@ export default {
}
},
doSetAreaTranslate({e}) {
if (e.target && ['area'].includes(e.target.subType)) {
if (this.target && ['area'].includes(this.target.subType)) {
const option = this.myChart.getOption();
const shape = option.graphic[0].elements.find(el => { return ['area'].includes(el.subType) && el.areaNo == this.target.areaNo; });
const model = this.target.model;
const graph = option.graphic[0].elements.find(el => { return ['area'].includes(el.subType) && el.model.areaNo == model.areaNo; });
shape.draggable = true;
shape.ondrag = echarts.util.curry(this.onShapeDragging);
graph.draggable = true;
graph.ondrag = echarts.util.curry(this.onShapeDragging);
this.myChart.setOption(option, {notMerge: true});
console.log(shape);
}
},
doSetAreaDrags({e}) {
console.log('set drag')
doSetAreaHorns({e}) {
if (this.target && ['area'].includes(this.target.subType)) {
const option = this.myChart.getOption();
const model = this.target.model;
const elemList = option.graphic[0].elements.filter(el => { return !['drag'].includes(el.subType) });
const graph = option.graphic[0].elements.find(el => { return ['area'].includes(el.subType) && el.model.areaNo == model.areaNo; });
const p = graph.position;
const w = graph.shape.width;
const h = graph.shape.height;
const point1 = [p[0], p[1]];
const point2 = [p[0]+w, p[1]];
const point3 = [p[0]+w, p[1]+h];
const point4 = [p[0], p[1]+h];
elemList.push(utils.buildHornDataObj(point1, this.myChart.convertFromPixel('grid', point1), this, 'horn-1'));
elemList.push(utils.buildHornDataObj(point2, this.myChart.convertFromPixel('grid', point2), this, 'horn-2'));
elemList.push(utils.buildHornDataObj(point3, this.myChart.convertFromPixel('grid', point3), this, 'horn-3')),
elemList.push(utils.buildHornDataObj(point4, this.myChart.convertFromPixel('grid', point4), this, 'horn-4'))
option.graphic[0].elements = elemList;
this.myChart.setOption(option, {notMerge: true});
}
},
doPopDialog({e, pointInGrid, pointInPixel}) {
const point = {
@ -415,10 +437,10 @@ export default {
if (this.selected && this.dragging) {
this.selected.dx = pointInGrid[0] - this.selected._x;
this.selected.dy = pointInGrid[1] - this.selected._y;
this.selected.sx += this.selected.dx;
this.selected.sy += this.selected.dy;
this.selected._x = pointInGrid[0];
this.selected._y = pointInGrid[1];
this.selected.time += this.selected.dx;
this.selected.kmRange += this.selected.dy;
if (this.selected.dx || this.selected.dy) {
const option = this.myChart.getOption();
@ -448,33 +470,66 @@ export default {
},
doAreaDragging({e, pointInGrid}) {
if (this.target && ['area'].includes(this.target.subType) && this.dragging) {
const model = this.target.model;
if (model.sx != undefined && model.sy != undefined) {
model.dx = pointInGrid[0] - model._x;
model.dy = pointInGrid[1] - model._y;
model.sx += model.dx;
model.sy += model.dy;
model._x = pointInGrid[0];
model._y = pointInGrid[1];
const target = this.target;
const model = target.model;
const dx = pointInGrid[0] - model._x;
const dy = pointInGrid[1] - model._y;
model._x = pointInGrid[0];
model._y = pointInGrid[1];
model.startTime += dx;
model.endTime += dx;
model.fartherKmRange += dy;
model.closerKmRange += dy;
}
},
doAreaHornDragging({e, pointInGrid}) {
if (e.target && ['drag'].includes(e.target.subType) && this.dragging) {
const option = this.myChart.getOption();
const target = this.target;
const model = target.model;
const elemList = option.graphic[0].elements.filter(el => { return ['drag'].includes(el.subType) });
const index = elemList.findIndex(el => { return e.target.name == el.name; });
const dx = pointInGrid[0] - model._x;
const dy = pointInGrid[1] - model._y;
model._x = pointInGrid[0];
model._y = pointInGrid[1];
switch(index) {
case 0:
model.startTime += dx;
model.fartherKmRange += dy;
break;
case 1:
model.endTime += dx;
model.fartherKmRange += dy;
break;
case 2:
model.endTime += dx;
model.closerKmRange += dy;
break;
case 3:
model.startTime += dx;
model.closerKmRange += dy;
break;
}
const args = this.planUtil.calcAreaArgsByModel(this.myChart, model);
const graph = option.graphic[0].elements.find(el => { return ['area'].includes(el.subType) && el.model.areaNo == model.areaNo; });
graph.position = args.position;
graph.point1 = args.point1;
graph.point2 = args.point2;
graph.shape.width = args.width;
graph.shape.height = args.height;
this.myChart.setOption(option, {notMerge: true});
this.doSetAreaHorns({e});
}
},
doTranslate({e}) {
if (this.target && ['area'].includes(this.target.subType)) {
const model = this.target.model;
const sx = model.sx||0;
const sy = model.sy||0;
const fartherStationValue = this.planUtil.getCoordinateYByStationCode(this.stations, model.fartherStationCode) + sy;
const closerStationValue = this.planUtil.getCoordinateYByStationCode(this.stations, model.closerStationCode) + sy;
const fartherStation = this.planUtil.getStationByCoordinate(this.stations, fartherStationValue)||{code: model.fartherStationCode};
const closerStation = this.planUtil.getStationByCoordinate(this.stations, closerStationValue)||{code: model.closerStationCode};
model.startTime = timeFormat(toTimeStamp(model.startTime)+sx);
model.endTime = timeFormat(toTimeStamp(model.endTime)+sx);
model.fartherStationCode = fartherStation.code;
model.closerStationCode = closerStation.code;
}
this.$emit('translate');
}
}

View File

@ -262,8 +262,16 @@ export default {
this.pushModels(option.series, [this.planUtil.initializeYaxis(this.stations)]);
this.pushModels(option.series, this.planUtil.parseDataToSeries(this.myChart, planData, this.stations));
this.pushModels(option.graphic[0].elements, this.planUtil.parseDataToGraph(this.myChart, planData, this.stations));
if (this.model.choice == 'Construction') {
const elemList = option.graphic[0].elements.filter(el => { return el.subType == 'area'});
elemList.forEach(el => {
el.draggable = true;
el.ondrag = echarts.util.curry(this.onShapeDragging);
})
}
this.myChart.setOption(option, {notMerge: true});
this.myChart.setOption(option, {notMerge: true});
} catch (error) {
this.$messageBox(error.message);
}
@ -359,6 +367,18 @@ export default {
});
}
},
clearDraggable(labels=['area']) {
const option = this.myChart.getOption();
const elements = option.graphic[0].elements;
const elemList = elements.filter(el => { return labels.includes(el.subType)});
elemList.forEach(el => {
el.draggable = false;
el.ondrag = null;
})
this.myChart.setOption(option, {notMerge: true});
},
clearTrip() {
const option = this.myChart.getOption();
const index = option.series.findIndex(el => { return el.name.includes('service-trip') });
@ -371,19 +391,6 @@ export default {
const option = this.myChart.getOption();
const elements = option.graphic[0].elements;
option.graphic[0].elements = elements.filter(el => { return !labels.includes(el.subType)});
this.myChart.setOption(option, {notMerge: true});
},
clearDraggable(labels=['drag', 'area']) {
const option = this.myChart.getOption();
const elements = option.graphic[0].elements;
const elemList = elements.filter(el => { return labels.includes(el.subType)});
elemList.forEach(el => {
el.draggable = false;
el.ondrag = null;
el.onmousemove = null;
})
this.myChart.setOption(option, {notMerge: true});
}
}

View File

@ -9,16 +9,42 @@ export const MenuEnum = {
planJustTurnBack: '1005'
}
export function buildDragDataObj(position, point, that) {
export function buildHornDataObj(position, point, that, name='') {
return {
type: 'circle',
subType: 'drag',
position: [...position],
point: [...point],
model: {},
name,
shape: {
cx: 0,
cy: 0,
r: 10
r: 8
},
style: {
fill: 'rgba(0,0,0,0.3)'
},
draggable: 'true',
onmouseover: echarts.util.curry(that.onShapeMouseOver),
ondrag: echarts.util.curry(that.onShapeDragging),
onmouseout: echarts.util.curry(that.onShapeMouseOut),
z: 100
}
}
export function buildDragDataObj(position, point, that, name='') {
return {
type: 'circle',
subType: 'drag',
position: [...position],
point: [...point],
model: {},
name,
shape: {
cx: 0,
cy: 0,
r: 6
},
invisible: true,
draggable: 'horizontal',
@ -29,13 +55,15 @@ export function buildDragDataObj(position, point, that) {
}
}
export function buildMarkPointObj(position, point, that) {
export function buildMarkPointObj(position, point, that, name='') {
return {
type: 'circle',
subType: 'mark',
z: 100,
position: [...position],
point: [...point],
model: {},
name,
shape: {
cx: 0,
cy: 0,