|
@@ -1,39 +1,39 @@
|
|
|
-import { coordinate } from "../Coordinate.js";
|
|
|
-import LayerEvents from "../enum/LayerEvents.js";
|
|
|
-import UIEvents from "../enum/UIEvents.js";
|
|
|
-import RoadTemplate from "../enum/RoadTemplate.js";
|
|
|
-import VectorType from "../enum/VectorType.js";
|
|
|
-import VectorStyle from "../enum/VectorStyle.js";
|
|
|
-import VectorWeight from "../enum/VectorWeight.js";
|
|
|
-import GeoActions from "../enum/GeoActions.js";
|
|
|
-import VectorEvents from "../enum/VectorEvents.js";
|
|
|
-import SVGType from "../enum/SVGType.js";
|
|
|
-import { stateService } from "../Service/StateService.js";
|
|
|
-import { uiService } from "../Service/UIService.js";
|
|
|
-import { dataService } from "../Service/DataService.js";
|
|
|
-import { historyService } from "../Service/HistoryService.js";
|
|
|
-import { elementService } from "../Service/ElementService";
|
|
|
-import { lineService } from "../Service/LineService.js";
|
|
|
-import { circleService } from "../Service/CircleService.js";
|
|
|
-import { textService } from "../Service/TextService.js";
|
|
|
-import { svgService } from "../Service/SVGService.js";
|
|
|
-import { magnifierService } from "../Service/MagnifierService.js";
|
|
|
-import { mathUtil } from "../Util/MathUtil";
|
|
|
-import Constant from "../Constant";
|
|
|
+import { coordinate } from '../Coordinate.js';
|
|
|
+import LayerEvents from '../enum/LayerEvents.js';
|
|
|
+import UIEvents from '../enum/UIEvents.js';
|
|
|
+import RoadTemplate from '../enum/RoadTemplate.js';
|
|
|
+import VectorType from '../enum/VectorType.js';
|
|
|
+import VectorStyle from '../enum/VectorStyle.js';
|
|
|
+import VectorWeight from '../enum/VectorWeight.js';
|
|
|
+import GeoActions from '../enum/GeoActions.js';
|
|
|
+import VectorEvents from '../enum/VectorEvents.js';
|
|
|
+import SVGType from '../enum/SVGType.js';
|
|
|
+import { stateService } from '../Service/StateService.js';
|
|
|
+import { uiService } from '../Service/UIService.js';
|
|
|
+import { dataService } from '../Service/DataService.js';
|
|
|
+import { historyService } from '../Service/HistoryService.js';
|
|
|
+import { elementService } from '../Service/ElementService';
|
|
|
+import { lineService } from '../Service/LineService.js';
|
|
|
+import { circleService } from '../Service/CircleService.js';
|
|
|
+import { textService } from '../Service/TextService.js';
|
|
|
+import { svgService } from '../Service/SVGService.js';
|
|
|
+import { magnifierService } from '../Service/MagnifierService.js';
|
|
|
+import { mathUtil } from '../Util/MathUtil';
|
|
|
+import Constant from '../Constant';
|
|
|
// import { roomsUtil } from "../Room/RoomsUtil.js";
|
|
|
-import { addRoad } from "../Controls/AddRoad";
|
|
|
-import { addLine } from "./AddLine.js";
|
|
|
-import VectorCategory from "../enum/VectorCategory.js";
|
|
|
+import { addRoad } from '../Controls/AddRoad';
|
|
|
+import { addLine } from './AddLine.js';
|
|
|
+import VectorCategory from '../enum/VectorCategory.js';
|
|
|
// import { floorplanData } from "../VectorData.js";
|
|
|
|
|
|
-import { pointService } from "../Service/PointService.js";
|
|
|
-import Settings from "../Settings.js";
|
|
|
-import { addPoint } from "./AddPoint.js";
|
|
|
-import { locationModeControl } from "./LocationModeControl.js";
|
|
|
-import { curveRoadPointService } from "../Service/CurveRoadPointService.js";
|
|
|
-import { roadService } from "../Service/RoadService.js";
|
|
|
-import { curveRoadService } from "../Service/CurveRoadService.js";
|
|
|
-import Msg from "../enum/Msg.js";
|
|
|
+import { pointService } from '../Service/PointService.js';
|
|
|
+import Settings from '../Settings.js';
|
|
|
+import { addPoint } from './AddPoint.js';
|
|
|
+import { locationModeControl } from './LocationModeControl.js';
|
|
|
+import { curveRoadPointService } from '../Service/CurveRoadPointService.js';
|
|
|
+import { roadService } from '../Service/RoadService.js';
|
|
|
+import { curveRoadService } from '../Service/CurveRoadService.js';
|
|
|
+import Msg from '../enum/Msg.js';
|
|
|
|
|
|
export default class UIControl {
|
|
|
constructor(layer, newsletter, graphicStateUI) {
|
|
@@ -104,7 +104,7 @@ export default class UIControl {
|
|
|
uiService.setSelectPointCategory(VectorCategory.Point.NormalPoint);
|
|
|
uiService.setSelectLineCategory(VectorCategory.Line.NormalLine);
|
|
|
//执行新的事件
|
|
|
- if (uiService.isBelongRoad(selectUI) || selectUI == "road") {
|
|
|
+ if (uiService.isBelongRoad(selectUI) || selectUI == 'road') {
|
|
|
stateService.setEventName(LayerEvents.AddRoad);
|
|
|
} else if (selectUI == UIEvents.CurveRoad) {
|
|
|
stateService.setEventName(LayerEvents.AddCurveRoad);
|
|
@@ -145,7 +145,7 @@ export default class UIControl {
|
|
|
}
|
|
|
|
|
|
updateVectorForSelectUI(selectUI) {
|
|
|
- console.log("selectUI", selectUI);
|
|
|
+ console.log('selectUI', selectUI);
|
|
|
const focusItem = stateService.getFocusItem();
|
|
|
|
|
|
// if (selectUI == VectorStyle.Bold || selectUI == VectorStyle.Thinning) {
|
|
@@ -168,9 +168,9 @@ export default class UIControl {
|
|
|
if (uiService.isBelongRoadEdgeStyle(selectUI)) {
|
|
|
let key = null;
|
|
|
if (VectorStyle[selectUI]) {
|
|
|
- key = "setStyle";
|
|
|
+ key = 'setStyle';
|
|
|
} else if (VectorWeight[selectUI]) {
|
|
|
- key = "setWeight";
|
|
|
+ key = 'setWeight';
|
|
|
}
|
|
|
if (focusItem.type == VectorType.Line) {
|
|
|
let Line = dataService.getLine(focusItem.vectorId);
|
|
@@ -182,29 +182,33 @@ export default class UIControl {
|
|
|
Line[key](selectUI);
|
|
|
} else {
|
|
|
let roadEdge = dataService.getRoadEdge(focusItem.vectorId);
|
|
|
- if(selectUI == VectorStyle.RoadSide){//修改路缘线
|
|
|
- if (!roadEdge) {
|
|
|
- roadEdge = dataService.getCurveRoadEdge(focusItem.vectorId);
|
|
|
- }
|
|
|
- roadEdge.setRoadSide()
|
|
|
- }else{
|
|
|
- if(roadEdge.roadSide){
|
|
|
- roadEdge.removeRoadSide()
|
|
|
- }
|
|
|
- if (roadEdge) {
|
|
|
- // roadEdge.setStyle(selectUI);
|
|
|
+
|
|
|
+ if (roadEdge) {
|
|
|
+ if (selectUI == VectorStyle.RoadSide) {
|
|
|
+ //修改路缘线
|
|
|
+ roadEdge.initRoadSide();
|
|
|
+ } else {
|
|
|
roadEdge[key](selectUI);
|
|
|
let crossPoint = dataService.getCrossPoint4(focusItem.vectorId);
|
|
|
if (crossPoint) {
|
|
|
crossPoint[key](selectUI);
|
|
|
}
|
|
|
+ if (roadEdge.roadSide) {
|
|
|
+ roadEdge.removeRoadSide();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ roadEdge = dataService.getCurveRoadEdge(focusItem.vectorId);
|
|
|
+ if (selectUI == VectorStyle.RoadSide) {
|
|
|
+ //修改路缘线
|
|
|
+ // roadEdge.initRoadSide();
|
|
|
} else {
|
|
|
- roadEdge = dataService.getCurveRoadEdge(focusItem.vectorId);
|
|
|
- // roadEdge.setStyle(selectUI);
|
|
|
roadEdge[key](selectUI);
|
|
|
+ if (roadEdge.roadSide) {
|
|
|
+ // roadEdge.removeRoadSide();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
this.layer.history.save();
|
|
@@ -372,9 +376,9 @@ export default class UIControl {
|
|
|
case VectorType.Point:
|
|
|
let point = dataService.getPoint(vectorId);
|
|
|
let parent = point.getParent();
|
|
|
- for(let key in parent){
|
|
|
- if(Settings.baseLineId == key){
|
|
|
- this.layer.initLocation();
|
|
|
+ for (let key in parent) {
|
|
|
+ if (Settings.baseLineId == key) {
|
|
|
+ this.layer.initLocation();
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
@@ -398,52 +402,27 @@ export default class UIControl {
|
|
|
if (endPoint.getCategory() != VectorCategory.Point.BasePoint) {
|
|
|
pointService.deletePoint(line.endId);
|
|
|
}
|
|
|
- } else if (
|
|
|
- line.getCategory() == VectorCategory.Line.LocationLineByFixPoint
|
|
|
- ) {
|
|
|
+ } else if (line.getCategory() == VectorCategory.Line.LocationLineByFixPoint) {
|
|
|
let lines = dataService.getLines();
|
|
|
for (let key in lines) {
|
|
|
let _line = dataService.getLine(key);
|
|
|
- if (
|
|
|
- _line.getCategory() == VectorCategory.Line.ExtendedPositionLine
|
|
|
- ) {
|
|
|
- if (
|
|
|
- line.startId == _line.startId ||
|
|
|
- line.startId == _line.endId ||
|
|
|
- line.endId == _line.startId ||
|
|
|
- line.endId == _line.endId
|
|
|
- ) {
|
|
|
+ if (_line.getCategory() == VectorCategory.Line.ExtendedPositionLine) {
|
|
|
+ if (line.startId == _line.startId || line.startId == _line.endId || line.endId == _line.startId || line.endId == _line.endId) {
|
|
|
dataService.deleteLine(key);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- } else if (
|
|
|
- line.getCategory() == VectorCategory.Line.LocationLineByBasePoint
|
|
|
- ) {
|
|
|
+ } else if (line.getCategory() == VectorCategory.Line.LocationLineByBasePoint) {
|
|
|
let lines = dataService.getLines();
|
|
|
for (let key in lines) {
|
|
|
let _line = dataService.getLine(key);
|
|
|
- if (
|
|
|
- _line.getCategory() == VectorCategory.Line.ExtendedPositionLine
|
|
|
- ) {
|
|
|
- if (
|
|
|
- line.startId == _line.startId ||
|
|
|
- line.startId == _line.endId ||
|
|
|
- line.endId == _line.startId ||
|
|
|
- line.endId == _line.endId
|
|
|
- ) {
|
|
|
+ if (_line.getCategory() == VectorCategory.Line.ExtendedPositionLine) {
|
|
|
+ if (line.startId == _line.startId || line.startId == _line.endId || line.endId == _line.startId || line.endId == _line.endId) {
|
|
|
dataService.deleteLine(key);
|
|
|
}
|
|
|
- } else if (
|
|
|
- _line.getCategory() == VectorCategory.Line.GuideLocationLine
|
|
|
- ) {
|
|
|
- if (
|
|
|
- line.startId == _line.startId ||
|
|
|
- line.startId == _line.endId ||
|
|
|
- line.endId == _line.startId ||
|
|
|
- line.endId == _line.endId
|
|
|
- ) {
|
|
|
+ } else if (_line.getCategory() == VectorCategory.Line.GuideLocationLine) {
|
|
|
+ if (line.startId == _line.startId || line.startId == _line.endId || line.endId == _line.startId || line.endId == _line.endId) {
|
|
|
dataService.deleteLine(key);
|
|
|
}
|
|
|
}
|
|
@@ -456,10 +435,7 @@ export default class UIControl {
|
|
|
break;
|
|
|
case VectorType.CurvePoint:
|
|
|
const curvePoint = dataService.getCurvePoint(vectorId);
|
|
|
- lineService.deleteCrossPointForCurveLine(
|
|
|
- vectorId,
|
|
|
- curvePoint.getParent()
|
|
|
- );
|
|
|
+ lineService.deleteCrossPointForCurveLine(vectorId, curvePoint.getParent());
|
|
|
break;
|
|
|
case VectorType.Circle:
|
|
|
dataService.deleteCircle(vectorId);
|
|
@@ -566,7 +542,7 @@ export default class UIControl {
|
|
|
}
|
|
|
|
|
|
getCadBlob(canvas) {
|
|
|
- var type = "jpg";
|
|
|
+ var type = 'jpg';
|
|
|
return new Promise((resolve) => canvas.toBlob(resolve, `${type}/image`));
|
|
|
}
|
|
|
|
|
@@ -585,38 +561,19 @@ export default class UIControl {
|
|
|
// }
|
|
|
|
|
|
saveFile(data, filename) {
|
|
|
- var save_link = document.createElementNS(
|
|
|
- "http://www.w3.org/1999/xhtml",
|
|
|
- "a"
|
|
|
- );
|
|
|
+ var save_link = document.createElementNS('http://www.w3.org/1999/xhtml', 'a');
|
|
|
save_link.href = data;
|
|
|
save_link.download = filename;
|
|
|
|
|
|
- var event = document.createEvent("MouseEvents");
|
|
|
- event.initMouseEvent(
|
|
|
- "click",
|
|
|
- true,
|
|
|
- false,
|
|
|
- window,
|
|
|
- 0,
|
|
|
- 0,
|
|
|
- 0,
|
|
|
- 0,
|
|
|
- 0,
|
|
|
- false,
|
|
|
- false,
|
|
|
- false,
|
|
|
- false,
|
|
|
- 0,
|
|
|
- null
|
|
|
- );
|
|
|
+ var event = document.createEvent('MouseEvents');
|
|
|
+ event.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
|
|
|
save_link.dispatchEvent(event);
|
|
|
}
|
|
|
|
|
|
_fixType(type) {
|
|
|
- type = type.toLowerCase().replace(/jpg/i, "jpeg");
|
|
|
+ type = type.toLowerCase().replace(/jpg/i, 'jpeg');
|
|
|
var r = type.match(/png|jpeg|bmp|gif/)[0];
|
|
|
- return "image/" + r;
|
|
|
+ return 'image/' + r;
|
|
|
}
|
|
|
/****************************************************************************针对菜单*******************************************************************************/
|
|
|
|
|
@@ -684,7 +641,7 @@ export default class UIControl {
|
|
|
this.graphicStateUI.continuedMode = true;
|
|
|
}
|
|
|
confirmEntry() {
|
|
|
- console.log("确认");
|
|
|
+ console.log('确认');
|
|
|
this.graphicStateUI.continuedMode = false;
|
|
|
this.layer.exit();
|
|
|
this.layer.history.save();
|
|
@@ -693,7 +650,7 @@ export default class UIControl {
|
|
|
uiService.setSelectLineCategory(VectorCategory.Line.NormalLine);
|
|
|
}
|
|
|
confirmCancel() {
|
|
|
- console.log("取消");
|
|
|
+ console.log('取消');
|
|
|
this.graphicStateUI.continuedMode = false;
|
|
|
this.layer.exit();
|
|
|
this.layer.history.save();
|
|
@@ -705,13 +662,9 @@ export default class UIControl {
|
|
|
|
|
|
// 设置默认设置
|
|
|
setDefaultSetting(setting) {
|
|
|
- console.log("获得设置", setting);
|
|
|
- uiService.setRoadMidDivideWidth(
|
|
|
- setting.roadQuarantineWidth / coordinate.res
|
|
|
- );
|
|
|
- uiService.setCurveRoadMidDivideWidth(
|
|
|
- setting.roadQuarantineWidth / coordinate.res
|
|
|
- );
|
|
|
+ console.log('获得设置', setting);
|
|
|
+ uiService.setRoadMidDivideWidth(setting.roadQuarantineWidth / coordinate.res);
|
|
|
+ uiService.setCurveRoadMidDivideWidth(setting.roadQuarantineWidth / coordinate.res);
|
|
|
Constant.defaultMidDivideWidth = setting.roadQuarantineWidth;
|
|
|
uiService.setSingleLaneWidth(setting.singleRoadWidth / coordinate.res);
|
|
|
Constant.defaultSingleLaneWidth = setting.singleRoadWidth;
|