This commit is contained in:
tengge1 2019-12-23 21:41:36 +08:00
parent 9db2f239ad
commit 021a1fbb3e
3 changed files with 20 additions and 3 deletions

View File

@ -963,5 +963,6 @@
"Backup Database": "备份数据库",
"Backup database successfully!": "备份数据库成功!",
"mongodump.exe is not existed.": "mongodump.exe不存在。",
"Backing up, please wait.": "正在备份,请稍后。"
"Backing up, please wait.": "正在备份,请稍后。",
"Start area measurement.": "开始面积测量。"
}

View File

@ -1,5 +1,6 @@
import { ToolbarSeparator, IconButton } from '../../third_party';
import DistanceTool from '../tools/DistanceTool';
import AreaTool from '../tools/AreaTool';
/**
* 测量工具
@ -18,6 +19,7 @@ class MeasureTools extends React.Component {
this.handleMeasureDistance = this.handleMeasureDistance.bind(this);
this.handleEndMeasureDistance = this.handleEndMeasureDistance.bind(this);
this.handleMeasureArea = this.handleMeasureArea.bind(this);
this.handleEndMeasureArea = this.handleEndMeasureArea.bind(this);
this.handleMeasureAngle = this.handleMeasureAngle.bind(this);
}
@ -70,7 +72,21 @@ class MeasureTools extends React.Component {
// --------------------------- -------------------------------------
handleMeasureArea() {
if (this.areaTool === undefined) {
this.areaTool = new AreaTool();
this.areaTool.on(`end.${this.id}`, this.handleEndMeasureArea);
}
this.areaTool.start();
this.setState({
areaToolEnabled: true
});
app.toast(_t('Start area measurement.'));
}
handleEndMeasureArea() {
this.setState({
areaToolEnabled: false
});
}
// --------------------------- ---------------------------------------

View File

@ -2,7 +2,7 @@ import BaseTool from './BaseTool';
import UnscaledText from '../../object/text/UnscaledText';
/**
* 距离测量工具
* 面积测量工具
*/
class AreaTool extends BaseTool {
constructor() {
@ -105,7 +105,7 @@ class AreaTool extends BaseTool {
dist += Math.sqrt(
(this.positions[i] - this.positions[i - 3]) ** 2,
(this.positions[i + 1] - this.positions[i - 2]) ** 2,
(this.positions[i + 2] - this.positions[i - 1]) ** 2,
(this.positions[i + 2] - this.positions[i - 1]) ** 2
);
}