Merge branch 'test' of https://git.code.tencent.com/lian-cbtc/jl-client into test
This commit is contained in:
commit
18fbae9114
@ -281,23 +281,28 @@ export default {
|
||||
},
|
||||
setLogicOffset() {
|
||||
const models = [];
|
||||
// 正常情况下logicSectionCodeList下逻辑区段为从左向右
|
||||
this.sectionList.forEach(section => {
|
||||
let startPoint = section.points[0];
|
||||
let startPoint = section.points[0].x + 's' + section.points[0].y;
|
||||
let startOffset = 0;
|
||||
if (section.logicSectionCodeList) {
|
||||
const sectionMap = {};
|
||||
if (section.logicSectionCodeList && section.logicSectionCodeList.length) {
|
||||
section.logicSectionCodeList.forEach(sectionCode => {
|
||||
const logicSection = this.$store.getters['map/getDeviceByCode'](sectionCode);
|
||||
if (logicSection.points[0].x === startPoint.x && logicSection.points[0].y === startPoint.y) {
|
||||
const model = deepAssign({}, logicSection);
|
||||
model.logicSectionStartOffset = startOffset;
|
||||
model.logicSectionEndOffset = section.lengthFact - startOffset;
|
||||
models.push(model);
|
||||
startOffset += logicSection.lengthFact;
|
||||
startPoint = logicSection.points[logicSection.points.length - 1];
|
||||
} else {
|
||||
console.log('error', logicSection, section );
|
||||
}
|
||||
sectionMap[logicSection.points[0].x + 's' + logicSection.points[0].y] = logicSection;
|
||||
});
|
||||
while (sectionMap[startPoint]) {
|
||||
const model = deepAssign({}, sectionMap[startPoint]);
|
||||
model.logicSectionStartOffset = startOffset;
|
||||
model.logicSectionEndOffset = (section.lengthFact * 1000 - startOffset * 1000) / 1000;
|
||||
models.push(model);
|
||||
if (!model.lengthFact) {
|
||||
const length = section.lengthFact / section.logicSectionCodeList.length;
|
||||
model.lengthFact = length.toFixed(3);
|
||||
}
|
||||
startOffset = (startOffset * 1000 + model.lengthFact * 1000) / 1000;
|
||||
startPoint = model.points[model.points.length - 1].x + 's' + model.points[model.points.length - 1].y;
|
||||
}
|
||||
}
|
||||
});
|
||||
this.$emit('updateMapModel', models, 'five');
|
||||
|
Loading…
Reference in New Issue
Block a user