This commit is contained in:
ival 2021-04-14 13:55:30 +08:00
commit 86ad53cfe9
9 changed files with 181 additions and 77 deletions

View File

@ -86,7 +86,7 @@ export function AssetModelManager(scene) {
} }
console.log(scope.loadAsset);
return new Promise(function(resolve, reject){ return new Promise(function(resolve, reject){
Promise.all(initlist).then((result) => { Promise.all(initlist).then((result) => {

View File

@ -12,7 +12,7 @@ import { SkeletonUtils } from '@/jlmap3d/main/utils/SkeletonUtils.js';
import { AssetModelManager } from '@/jlmap3d/lesson3dedit/assetmodelmanager/assetmodelmanager.js'; import { AssetModelManager } from '@/jlmap3d/lesson3dedit/assetmodelmanager/assetmodelmanager.js';
import { TransformControls } from '@/jlmap3d/jl3dstationmanager/controls/TransformControls';
//动画播放相关 //动画播放相关
let clock = new THREE.Clock(); let clock = new THREE.Clock();
@ -64,26 +64,48 @@ export function Lesson3dEditor(dom,lessonData) {
lesson3dUpdateControl(scope.controls); lesson3dUpdateControl(scope.controls);
let transcontrol = new THREE.TransformControls( scope.camerass, scope.renderer.domElement );
//
transcontrol.addEventListener( 'change', render );
//
transcontrol.addEventListener( 'dragging-changed', function ( event ) {
scope.controls.enabled = ! event.value;
} );
//
scene.add(transcontrol);
let assetModelManager = new AssetModelManager(scene); let assetModelManager = new AssetModelManager(scene);
if(lessonData.assetList.length>0 || lessonData.modelList.length>0){ console.log(lessonData);
assetModelManager.lessonAssetsLoader(lessonData.assetList,lessonData.modelList); if(lessonData){
if(lessonData.assetList.length>0 || lessonData.modelList.length>0){
assetModelManager.lessonAssetsLoader(lessonData.assetList,lessonData.modelList);
}else{
assetModelManager.lessonAssetsLoader();
}
}else{ }else{
assetModelManager.lessonAssetsLoader(); assetModelManager.lessonAssetsLoader();
} }
animate(); animate();
//循环渲染函数 //循环渲染函数
function animate() { function animate() {
scope.renderer.render( scene, scope.camerass ); render();
scope.controls.update(); scope.controls.update();
// delta = clock.getDelta(); // delta = clock.getDelta();
requestAnimationFrame(animate); requestAnimationFrame(animate);
} }
function render(){
scope.renderer.render( scene, scope.camerass );
}
window.onresize = function () { window.onresize = function () {
scope.renderer.setSize(dom.offsetWidth,dom.offsetHeight); scope.renderer.setSize(dom.offsetWidth,dom.offsetHeight);
} }
@ -111,4 +133,8 @@ export function Lesson3dEditor(dom,lessonData) {
this.saveAssetModel = function(){ this.saveAssetModel = function(){
return assetModelManager.saveModelList(); return assetModelManager.saveModelList();
} }
this.attachModel = function(selectModel){
transcontrol.attach(selectModel);
}
} }

View File

@ -258,71 +258,19 @@ class SkinCode extends defaultStyle {
}; };
this[deviceType.StationStand] = { this[deviceType.StationStand] = {
// 成都三号线站台元素 站台 站台紧急关闭 扣车元素 停站时间 运行等级 跳停 // 站台元素 站台
elemnetType:['solidStand', 'emergentRhombus', 'detainNormal', 'stopTime', 'level', 'jumpCircle'], elemnetType:['lineStand'],
// 站台 // 站台
solidStand:{ lineStand:{
// 层级 // 层级
z:0, z:0,
spareColor: '#ffffff', // 站台空闲颜色 spareColor: '#00ff00', // 站台空闲颜色
jumpStopColor: '#808080', // 站台跳停颜色 lineWidth:2 // 线宽
designatedJumpStopColor: '#808080', // 站台指定列车跳停颜色 // jumpStopColor: '#808080', // 站台跳停颜色
headFontSize: 10, // 站台首端字体大小 // designatedJumpStopColor: '#808080', // 站台指定列车跳停颜色
stopColor: '#FFF000' // 站台列车停站颜色 // headFontSize: 10, // 站台首端字体大小
// stopColor: '#FFF000' // 站台列车停站颜色
}, },
// 站台紧急关闭
emergentRhombus:{
z:1,
flicker: true, // 闪烁
mergentR: 5, // 站台紧急关闭半径
mergentN: 4, // 站台紧急关闭边数
insideOffset: { x: 0, y: -30 }, // 内站台紧急关闭偏移量
outsideOffset: { x: 0, y: 30}, // 外站台紧急关闭偏移量
closeColor: '#F61107' // 站台紧急关闭颜色
},
// 扣车元素 普通扣车
detainNormal:{
z:0,
position: -1, // 扣车标识在站台上显示方向
text: '扣', // 扣车显示内容
insideOffset: {x: -8, y: 20}, // 内站台扣车偏移量
outsideOffset: {x: -8, y: 20}, // 外站台扣车偏移量
centerTrainColor: '#C0C0C0', // 中心扣车颜色
andCenterTrainColor: '#C0C0C0', // 车站+中心扣车颜色
detainTrainTextColor: '#E4EF50', // 车站扣除文字颜色
fontSize: 10, // 字体大小
fontWeight: 'normal'
},
// 停站时间
stopTime:{
z:1,
textFontSize: 10, // 停站时间字体大小
textColor: '#FFFFFF', // 停站时间字体颜色
position: -1, // 停站时间方向
offset: {x: -8, y: 10} // 停站时间偏移量
},
// 运行等级
level:{
z:1,
textFontSize: 10, // 运行等级字体大小
position: 1, // 运行等级方向
offset: {x: -8, y: 15}, // 运行等级偏移量
textColor: '#FFF000' // 停站等级字体颜色
},
// 跳停
jumpCircle: {
z:1,
position: 1, // 停跳方向
text: '跳', // 停跳显示内容
offset: {x: -8, y: 10},
textColor: '#00ffcc', // 停跳文字颜色
arcColor: '#00ffcc', // 停跳圆圈颜色
fillColor: 'rgba(0,0,0,0)', // 透明填充颜色
r: 8, // 圆半径大小
fontWeight: 'normal', // 文字居中
fontSize: 11 // 文字大小
},
common: { // 通用属性 common: { // 通用属性
textFontSize: 10, // 站台默认字体大小 textFontSize: 10, // 站台默认字体大小
functionButtonShow: '03' // 功能灯按钮显示条件prdType functionButtonShow: '03' // 功能灯按钮显示条件prdType
@ -479,13 +427,13 @@ class SkinCode extends defaultStyle {
}, },
core: { core: {
length: 6, // 道岔单边长度 length: 6, // 道岔单边长度
graphShow: true, // 图形显示 graphShow: true, // 图形显示
graphInversionColor: '#FFFF00', // 反位颜色 graphInversionColor: '#FFFF00', // 反位颜色
graphLocalColor: '#00FF00' // 定位颜色 graphLocalColor: '#00FF00' // 定位颜色
}, },
jointImg: { // 道岔 A B C D四元素属性配置 jointImg: { // 道岔 A B C D四元素属性配置
trapezoidLength: 8, // 直角梯形元素默认长度 trapezoidLength: 8, // 直角梯形元素默认长度
faultStatus: true, // 挤岔表示 faultStatus: true, // 挤岔表示
fork: true, // 挤岔专用(如有挤岔操作 变为true fork: true, // 挤岔专用(如有挤岔操作 变为true
forKColor: 'red' // 挤岔颜色 配合挤岔专用 forKColor: 'red' // 挤岔颜色 配合挤岔专用
}, },
@ -500,15 +448,15 @@ class SkinCode extends defaultStyle {
rectBorderColor: '#fff', // 矩形边框颜色 rectBorderColor: '#fff', // 矩形边框颜色
block: true, // 封锁显示 block: true, // 封锁显示
blockColor: 'red', // 封锁颜色 blockColor: 'red', // 封锁颜色
followName: true, // 位置跟随名称确定 followName: true // 位置跟随名称确定
}, },
arcBlcok: { // 圆形封锁图形 arcBlcok: { // 圆形封锁图形
show: true, // 显示 show: true, // 显示
shapeR: 10, shapeR: 10,
arcBorderColor: 'red', // 默认边框颜色 arcBorderColor: 'red', // 默认边框颜色
locationColor: 'red', // 定位封锁颜色 locationColor: 'red', // 定位封锁颜色
inversionColor: 'red' // 反位封锁颜色 inversionColor: 'red' // 反位封锁颜色
}, }
}; };
this[deviceType.LcControl] = { this[deviceType.LcControl] = {

View File

@ -3,6 +3,7 @@ import Group from 'zrender/src/container/Group';
import ESolidStand from './safeStand/ESolidStand'; import ESolidStand from './safeStand/ESolidStand';
import EHollowStand from './safeStand/EHollowStand'; import EHollowStand from './safeStand/EHollowStand';
import EGapStand from './safeStand/EGapStand'; import EGapStand from './safeStand/EGapStand';
import ELineStand from './safeStand/ELineStand';
// 扣车元素 // 扣车元素
import EDetain from './detain/EDetain'; import EDetain from './detain/EDetain';
import EDetainHollow from './detain/EDetainHollow'; import EDetainHollow from './detain/EDetainHollow';
@ -65,6 +66,7 @@ class StationStand extends Group {
'solidStand':ESolidStand, // 矩形实心站台 (普通站台样式) 'solidStand':ESolidStand, // 矩形实心站台 (普通站台样式)
'hollowStand':EHollowStand, // 矩形空心站台 (西安二号线站台样式) 'hollowStand':EHollowStand, // 矩形空心站台 (西安二号线站台样式)
'gapStand':EGapStand, // 分割站台(哈尔滨站台特有) 'gapStand':EGapStand, // 分割站台(哈尔滨站台特有)
'lineStand':ELineStand, // 大铁折线站台
'emergentCross':EEmergentCross, // 站台紧急关闭 西安二号线 正八边形 'emergentCross':EEmergentCross, // 站台紧急关闭 西安二号线 正八边形
'emergentArrow':EEmergentArrow, // 站台紧急关闭 哈尔滨 箭头型 'emergentArrow':EEmergentArrow, // 站台紧急关闭 哈尔滨 箭头型

View File

@ -0,0 +1,70 @@
import Group from 'zrender/src/container/Group';
import Polyline from 'zrender/src/graphic/shape/Polyline';
// import Rect from 'zrender/src/graphic/shape/Rect';
// import Text from 'zrender/src/graphic/Text';
class ESolidStand extends Group {
constructor(model) {
super();
this.model = model;
this.create();
}
create() {
const model = this.model.modelData;
const style = this.model.style;
const standX = model.position.x - model.width / 2;
const standY = model.position.y - model.height / 2;
const direction = model.right ? 1 : -1;
this.stand = new Polyline({
zlevel: this.model.zlevel,
z: this.model.z + 2,
shape: {
points:[
[standX, standY + direction * model.height],
[standX, standY],
[standX + model.width, standY],
[standX + model.width, standY + direction * model.height]
]
},
style: {
stroke:style.StationStand.lineStand.spareColor,
lineWidth: style.StationStand.lineStand.lineWidth
}
});
this.add(this.stand);
// if (style.StationStand.solidStand.stationHoldTrainColor) {
// const direction = model.right ? 1 : -1;
// this.holdTrain = new Rect({
// zlevel: this.model.zlevel,
// z: this.model.z + 2,
// shape: {
// x: standX,
// y: standY + (1 - direction) / 2 * model.height / 2,
// width: model.width,
// height: model.height / 2
// },
// style: {
// fill:style.StationStand.solidStand.spareColor,
// lineWidth: 0
// }
// });
// this.add(this.holdTrain);
// this.holdTrain.hide();
// }
}
setStroke(color) {
this.stand.setStyle('stroke', color);
}
recover() {
// const style = this.model.style;
}
setState(model) {
}
}
export default ESolidStand;

View File

@ -205,7 +205,7 @@ export default {
lineCode: elem.lineCode, lineCode: elem.lineCode,
cityCode: elem.cityCode cityCode: elem.cityCode
}); });
// this.isAdministrator() ? elem.children.push({id: '8', name: this.$t('designPlatform.lesson3dDesign'), type: 'lesson3dDesign'}) : ''; this.isAdministrator() ? elem.children.push({id: '8', name: this.$t('designPlatform.lesson3dDesign'), type: 'lesson3dDesign'}) : '';
}); });

View File

@ -15,7 +15,9 @@
<el-tab-pane label="课程三维资源列表" name="assetlist" > <el-tab-pane label="课程三维资源列表" name="assetlist" >
<div class="progressdiv" v-for="(elementtrigger,indextrigger) in triggerList"> <div class="progressdiv" v-for="(elementtrigger,indextrigger) in triggerList">
{{elementtrigger.label}} <div class="changeprogressdiv" @click="selectModel(elementtrigger)">{{elementtrigger.label}}</div>
<div class="delprogressdiv" v-if="(elementtrigger.showType == 'loadModel')" @click="deleteModel(elementtrigger)" >X</div>
</div> </div>
</el-tab-pane> </el-tab-pane>
@ -84,6 +86,13 @@
console.log(viewIndex); console.log(viewIndex);
this.$emit('removeProgress',viewIndex); this.$emit('removeProgress',viewIndex);
}, },
selectModel(selectedModel){
this.$emit('selectModel',selectedModel);
},
deleteModel(selectedModel){
this.$emit('deleteModel',selectedModel);
},
updateTriggerList(newTriggerList){ updateTriggerList(newTriggerList){
this.triggerList = newTriggerList; this.triggerList = newTriggerList;
console.log(this.triggerList); console.log(this.triggerList);

View File

@ -83,8 +83,36 @@
<el-input v-model="selected.sceneIndex" ></el-input> <el-input v-model="selected.sceneIndex" ></el-input>
</el-form-item> </el-form-item>
<el-button @click="updateData">保存修改</el-button> <el-button @click="updateData">保存修改</el-button>
</el-form> </el-form>
<el-form ref="form" class="camerapropertydiv" label-width="130px" size="mini" v-if="selectType == 'modelproperty'">
<el-form-item label="模型名称:" v-if="selected.label">
<el-input v-model="selected.label" ></el-input>
</el-form-item>
<!-- <el-form-item label="初始显示:" v-if="selected.visible">
<el-select v-model="selected.visible" >
<el-option label="显示" value=true></el-option>
<el-option label="隐藏" value=false></el-option>
</el-select>
</el-form-item> -->
<el-form-item label="模型坐标:" v-if="selected.position" disabled="true">
<el-input v-model="selected.position.x" ></el-input>
<el-input v-model="selected.position.y" ></el-input>
<el-input v-model="selected.position.z" ></el-input>
</el-form-item>
<!-- <el-form-item label="模型角度:" v-if="selected.rotation" disabled="true">
<el-input v-model="selected.rotation.x" ></el-input>
<el-input v-model="selected.rotation.y" ></el-input>
<el-input v-model="selected.rotation.z" ></el-input>
</el-form-item> -->
</el-form>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="场景中事件" name="modelaction" v-if="lessonData.lessonData.lessonProgress[lessonEditIndex]"> <el-tab-pane label="场景中事件" name="modelaction" v-if="lessonData.lessonData.lessonProgress[lessonEditIndex]">
@ -130,6 +158,7 @@
selected:"", selected:"",
editSelectTool:"", editSelectTool:"",
editSelectModel:"", editSelectModel:"",
selectType:"",
selectedAction:{ selectedAction:{
actionType:"事件操作类型", actionType:"事件操作类型",
actionMode:"触发事件类型", actionMode:"触发事件类型",
@ -177,6 +206,7 @@
}, },
lesson3dSelect(mode,type,obj){ lesson3dSelect(mode,type,obj){
this.activeName = mode; this.activeName = mode;
this.selectType = type;
// console.log(this.lessonData.lessonData.lessonProgress[this.lessonEditIndex].stepTipsData); // console.log(this.lessonData.lessonData.lessonProgress[this.lessonEditIndex].stepTipsData);
// this.activeName = 'toolproperty'; // this.activeName = 'toolproperty';
// this.activeName = 'modelproperty'; // this.activeName = 'modelproperty';
@ -192,6 +222,11 @@
this.selected = obj; this.selected = obj;
} }
if(type == "modelproperty"){
this.selected = obj;
console.log(this.selected);
}
}, },
updateData(){ updateData(){
// this.lessonData.lessonData.lessonProgress[this.lessonEditIndex].stepTipsData; // this.lessonData.lessonData.lessonProgress[this.lessonEditIndex].stepTipsData;

View File

@ -43,6 +43,8 @@
@addProgress="addProgress" @addProgress="addProgress"
@changeProgressView="changeProgressView" @changeProgressView="changeProgressView"
@removeProgress="removeProgress" @removeProgress="removeProgress"
@selectModel="selectModel"
@deleteModel="deleteModel"
> >
</Lesson-Progress> </Lesson-Progress>
@ -62,7 +64,11 @@
</el-row> </el-row>
</div> </div>
<Pro-Perty ref="lessonProPerty" :lessonData='lessonData' :lessonEditIndex='lessonEditIndex' ></Pro-Perty> <Pro-Perty
ref="lessonProPerty"
:lessonData='lessonData'
:lessonEditIndex='lessonEditIndex'
></Pro-Perty>
<canvas id="canvastexture" width="128px" height="64px"></canvas> <canvas id="canvastexture" width="128px" height="64px"></canvas>
@ -221,6 +227,14 @@
}, },
removeProgress(removeIndex){ removeProgress(removeIndex){
this.lessonData.removeLessonProgress(removeIndex); this.lessonData.removeLessonProgress(removeIndex);
},
selectModel(selectedModel){
console.log(selectedModel);
lesson3dSelect('toolproperty','modelproperty',selectedModel);
this.jl3d.attachModel(selectedModel);
},
deleteModel(selectedModel){
}, },
setupclick(){ setupclick(){