|
@@ -1,38 +1,37 @@
|
|
|
-import { coordinate } from '../Coordinate.js';
|
|
|
-import LayerEvents from '../enum/LayerEvents.js';
|
|
|
-import UIEvents from '../enum/UIEvents.js';
|
|
|
-import RoadTemplate from '../enum/RoadTemplate.js';
|
|
|
-import RoadStructure from '../enum/RoadStructure.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 { 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 RoadStructure from "../enum/RoadStructure.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 { 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 Message from '@/components/base/components/message/message.vue';
|
|
|
-import { pointService } from '../Service/PointService.js';
|
|
|
-import Settings from '../Settings.js';
|
|
|
-import { addPoint } from './AddPoint.js';
|
|
|
-import { ellipticService } from '../Service/EllipticService.js';
|
|
|
-import { curveRoadPointService } from '../Service/CurveRoadPointService.js';
|
|
|
-import { roadService } from '../Service/RoadService.js';
|
|
|
-import { curveRoadService } from '../Service/CurveRoadService.js';
|
|
|
+import Message from "@/components/base/components/message/message.vue";
|
|
|
+import { pointService } from "../Service/PointService.js";
|
|
|
+import Settings from "../Settings.js";
|
|
|
+import { addPoint } from "./AddPoint.js";
|
|
|
+import { curveRoadPointService } from "../Service/CurveRoadPointService.js";
|
|
|
+import { roadService } from "../Service/RoadService.js";
|
|
|
+import { curveRoadService } from "../Service/CurveRoadService.js";
|
|
|
|
|
|
export default class UIControl {
|
|
|
constructor(layer, newsletter, graphicStateUI) {
|
|
@@ -88,7 +87,7 @@ export default class UIControl {
|
|
|
}
|
|
|
|
|
|
//执行新的事件
|
|
|
- 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);
|
|
@@ -100,8 +99,6 @@ export default class UIControl {
|
|
|
stateService.setEventName(LayerEvents.AddPoint);
|
|
|
} else if (selectUI == UIEvents.Circle) {
|
|
|
stateService.setEventName(LayerEvents.AddCircle);
|
|
|
- } else if (selectUI == UIEvents.Elliptic) {
|
|
|
- stateService.setEventName(LayerEvents.AddElliptic);
|
|
|
} else if (selectUI == UIEvents.Text) {
|
|
|
stateService.setEventName(LayerEvents.AddText);
|
|
|
} else if (selectUI == UIEvents.Magnifier) {
|
|
@@ -121,7 +118,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) {
|
|
@@ -144,9 +141,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";
|
|
|
}
|
|
|
console.log(key);
|
|
|
|
|
@@ -343,9 +340,6 @@ export default class UIControl {
|
|
|
case VectorType.Circle:
|
|
|
dataService.deleteCircle(vectorId);
|
|
|
break;
|
|
|
- case VectorType.Elliptic:
|
|
|
- dataService.deleteElliptic(vectorId);
|
|
|
- break;
|
|
|
case VectorType.Text:
|
|
|
dataService.deleteText(vectorId);
|
|
|
break;
|
|
@@ -377,9 +371,6 @@ export default class UIControl {
|
|
|
case VectorType.Circle:
|
|
|
circleService.copy(vectorId);
|
|
|
break;
|
|
|
- case VectorType.Elliptic:
|
|
|
- ellipticService.copy(vectorId);
|
|
|
- break;
|
|
|
case VectorType.Text:
|
|
|
textService.copy(vectorId);
|
|
|
break;
|
|
@@ -416,18 +407,18 @@ export default class UIControl {
|
|
|
}
|
|
|
|
|
|
getCadBlob(canvas) {
|
|
|
- var type = 'jpg';
|
|
|
+ var type = "jpg";
|
|
|
return new Promise((resolve) => canvas.toBlob(resolve, `${type}/image`));
|
|
|
}
|
|
|
|
|
|
downloadCadImg(canvas, filename) {
|
|
|
// 图片导出为 jpg 格式
|
|
|
- var type = 'jpg';
|
|
|
+ var type = "jpg";
|
|
|
var imgData = canvas.toDataURL(type, 3);
|
|
|
canvas.toBlob(`${type}/image`);
|
|
|
|
|
|
// 加工image data,替换mime type
|
|
|
- imgData = imgData.replace(this._fixType(type), 'image/octet-stream');
|
|
|
+ imgData = imgData.replace(this._fixType(type), "image/octet-stream");
|
|
|
// 下载后的图片名
|
|
|
//var filename = 'cad_' + new Date().getTime() + '.' + type
|
|
|
// download
|
|
@@ -435,19 +426,38 @@ 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;
|
|
|
}
|
|
|
/****************************************************************************针对菜单*******************************************************************************/
|
|
|
|
|
@@ -506,7 +516,9 @@ export default class UIControl {
|
|
|
/******************************************************************************************************************************************************************/
|
|
|
|
|
|
prompt(msg) {
|
|
|
- this._prompts.push(Message.success(typeof msg === 'string' ? { msg } : msg));
|
|
|
+ this._prompts.push(
|
|
|
+ Message.success(typeof msg === "string" ? { msg } : msg)
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
// 进入持续添加出确认与取消框
|
|
@@ -514,7 +526,7 @@ export default class UIControl {
|
|
|
this.graphicStateUI.continuedMode = true;
|
|
|
}
|
|
|
confirmEntry() {
|
|
|
- console.log('确认');
|
|
|
+ console.log("确认");
|
|
|
this.graphicStateUI.continuedMode = false;
|
|
|
this.layer.exit();
|
|
|
uiService.setSelectLineCategory(VectorCategory.Line.NormalLine);
|
|
@@ -523,7 +535,7 @@ export default class UIControl {
|
|
|
this.layer.renderer.autoRedraw();
|
|
|
}
|
|
|
confirmCancel() {
|
|
|
- console.log('取消');
|
|
|
+ console.log("取消");
|
|
|
this.graphicStateUI.continuedMode = false;
|
|
|
addPoint.deleteTestPoints();
|
|
|
this.layer.exit();
|
|
@@ -535,11 +547,17 @@ export default class UIControl {
|
|
|
|
|
|
// 设置默认设置
|
|
|
setDefaultSetting(setting) {
|
|
|
- console.log('获得设置', setting);
|
|
|
-
|
|
|
- uiService.setRoadMidDivideWidth(setting.roadQuarantineWidth / coordinate.res * coordinate.ratio);
|
|
|
- uiService.setCurveRoadMidDivideWidth(setting.roadQuarantineWidth / coordinate.res * coordinate.ratio);
|
|
|
- uiService.setSingleLaneWidth(setting.singleRoadWidth / coordinate.res * coordinate.ratio);
|
|
|
+ console.log("获得设置", setting);
|
|
|
+
|
|
|
+ uiService.setRoadMidDivideWidth(
|
|
|
+ (setting.roadQuarantineWidth / coordinate.res) * coordinate.ratio
|
|
|
+ );
|
|
|
+ uiService.setCurveRoadMidDivideWidth(
|
|
|
+ (setting.roadQuarantineWidth / coordinate.res) * coordinate.ratio
|
|
|
+ );
|
|
|
+ uiService.setSingleLaneWidth(
|
|
|
+ (setting.singleRoadWidth / coordinate.res) * coordinate.ratio
|
|
|
+ );
|
|
|
// uiService.setLineWidth(setting.lineWidth / 1000 / coordinate.res);
|
|
|
uiService.setLineWidth(setting.lineWidth);
|
|
|
this.layer.renderer.autoRedraw();
|