diff --git a/src/UI/Components/EntityModal/EntityModal.tsx b/src/UI/Components/EntityModal/EntityModal.tsx index 9f14fe613..3dba105e3 100644 --- a/src/UI/Components/EntityModal/EntityModal.tsx +++ b/src/UI/Components/EntityModal/EntityModal.tsx @@ -7,6 +7,7 @@ import { KeyBoard } from '../../../Common/KeyEnum'; import { Curve } from '../../../DatabaseServices/Entity/Curve'; import { EntityStore } from '../../Store/EntityStore'; import { ColorModal } from './EntityColorList'; +import { GetEntityProperty } from './GetEntityProperty'; @observer export class EntityModal extends React.Component<{}, {}> { @@ -52,6 +53,8 @@ export class EntityModal extends React.Component<{}, {}> { options.unshift({ label: "全部" + count.toString(), value: "all" }); } let ents = store.GetEntitys() as Curve[]; + let pers = GetEntityProperty(ents[0]); + return (
@@ -71,22 +74,7 @@ export class EntityModal extends React.Component<{}, {}> {
  • - {(ents[0] instanceof Curve) && - <> -
  • - 长度: {ents[0].Length.toFixed(2)} -
  • -
  • - 面积: {ents[0].Area.toFixed(2)} -
  • -
  • - 时针: {ents[0].IsClockWise ? "顺时针" : "逆时针"} -
  • -
  • - 闭合: {ents[0].IsClose ? "闭合" : "不闭合"} -
  • - - } + {pers.map(p =>
  • {p}
  • )} } diff --git a/src/UI/Components/EntityModal/GetEntityProperty.tsx b/src/UI/Components/EntityModal/GetEntityProperty.tsx new file mode 100644 index 000000000..f1d3cc068 --- /dev/null +++ b/src/UI/Components/EntityModal/GetEntityProperty.tsx @@ -0,0 +1,35 @@ +import { FixedNotZero } from '../../../Common/Utils'; +import { Arc } from '../../../DatabaseServices/Entity/Arc'; +import { Circle } from '../../../DatabaseServices/Entity/Circle'; +import { Curve } from '../../../DatabaseServices/Entity/Curve'; +import { Entity } from '../../../DatabaseServices/Entity/Entity'; +import { Line } from '../../../DatabaseServices/Entity/Line'; +import { Polyline } from '../../../DatabaseServices/Entity/Polyline'; +import { Spline } from '../../../DatabaseServices/Spline'; +import { PointToString } from '../../Store/PointToString'; + + +export function GetEntityProperty(en: Entity) +{ + let pers: string[] = []; //属性表 + if (en instanceof Curve) + { + pers.push(`长度: ${FixedNotZero(en.Length, 3)}`); + if (!(en instanceof Line)) + { + pers.push(`面积: ${FixedNotZero(en.Area, 3)}`); + if (en instanceof Polyline || en instanceof Spline) + pers.push(`参数: ${en.EndParam}`); + pers.push(`时针: ${en.IsClockWise ? "顺时针" : "逆时针"}`); + + if (en instanceof Polyline || en instanceof Spline) + pers.push(`闭合: ${en.IsClose ? "闭合" : "不闭合"}`); + } + if (en instanceof Arc || en instanceof Circle) + pers.push(`半径: ${FixedNotZero(en.Radius, 3)}`); + + pers.push(`起点: ${PointToString(en.StartPoint)}`); + pers.push(`终点: ${PointToString(en.StartPoint)}`); + } + return pers; +} diff --git a/src/UI/Components/ToolBar/PropertiesPanel.tsx b/src/UI/Components/ToolBar/PropertiesPanel.tsx index 9f24d2122..e88ae0f42 100644 --- a/src/UI/Components/ToolBar/PropertiesPanel.tsx +++ b/src/UI/Components/ToolBar/PropertiesPanel.tsx @@ -2,15 +2,15 @@ import { Button, Card, Classes, HTMLSelect } from "@blueprintjs/core"; import { observer } from "mobx-react"; import React from "react"; import { app } from "../../../ApplicationServices/Application"; +import { DimStyleRecord } from "../../../DatabaseServices/DimStyle/DimStyleRecord"; import { AlignedDimension } from "../../../DatabaseServices/Dimension/AlignedDimension"; import { Dimension } from "../../../DatabaseServices/Dimension/Dimension"; -import { DimStyleRecord } from "../../../DatabaseServices/DimStyle/DimStyleRecord"; -import { Curve } from "../../../DatabaseServices/Entity/Curve"; import { Entity } from "../../../DatabaseServices/Entity/Entity"; import { Text } from "../../../DatabaseServices/Text/Text"; import { CommandWrap } from "../../../Editor/CommandMachine"; import { DownPanelStore } from "../../Store/DownPanelStore"; import { ColorModal } from "../EntityModal/EntityColorList"; +import { GetEntityProperty } from "../EntityModal/GetEntityProperty"; import { PropertiesStore } from "./PropertiesStore"; import { Properties_AlignedDimPanel } from "./Properties_AlignedDim"; import { Properties_DimPanel } from "./Properties_Dim"; @@ -110,6 +110,7 @@ export class PropertiesPanel extends React.Component<{}, {}> else if (count === 0) options.unshift({ label: "无选择", value: "none" }); let ents = store.GetEntitys(); + let pers = GetEntityProperty(ents[0]); return (
    @@ -138,27 +139,7 @@ export class PropertiesPanel extends React.Component<{}, {}>
  • - { - ents[0] instanceof Curve && - <> - 其他 -
  • - 长度: {ents[0]['Length'].toFixed(2)} -
  • -
  • - 面积: {ents[0]['Area'].toFixed(2)} -
  • -
  • - 参数:{(ents[0] as Curve).EndParam} -
  • -
  • - 时针: {(ents[0] as Curve).IsClockWise ? "顺时针" : "逆时针"} -
  • -
  • - 闭合: {ents[0].IsClose ? "闭合" : "不闭合"} -
  • - - } + {pers.map(p =>
  • {p}
  • )} { ents[0] instanceof AlignedDimension && <> diff --git a/src/UI/Store/DownPanelStore.ts b/src/UI/Store/DownPanelStore.ts index 48f347a5c..8097ab856 100644 --- a/src/UI/Store/DownPanelStore.ts +++ b/src/UI/Store/DownPanelStore.ts @@ -1,26 +1,17 @@ import { action, autorun, observable, reaction } from 'mobx'; -import { Vector3 } from 'three'; import * as xaop from 'xaop'; import { Command_ToggleUI } from '../../Add-on/ToggleUI'; import { app } from '../../ApplicationServices/Application'; import { appCache } from '../../Common/AppCache'; import { ConfigUrls } from '../../Common/HostUrl'; import { PostJson, RequestStatus } from '../../Common/Request'; -import { FixedNotZero, GetIndexDBID } from '../../Common/Utils'; +import { GetIndexDBID } from '../../Common/Utils'; import { ObjectSnapMode } from '../../Editor/ObjectSnapMode'; import { SNAPMODE } from '../../Editor/ShowSnapMenu'; import { AxisSnapMode } from '../../Editor/SnapServices'; import { userConfig } from '../../Editor/UserConfig'; import { IndexedDbStore, StoreName } from '../../IndexedDb/IndexedDbStore'; - -//点转换为字符串. -function PointToString(pt: Vector3): string -{ - return pt.toArray().map(o => - { - return FixedNotZero(o, 3); - }).join(" , "); -} +import { PointToString } from './PointToString'; export enum ToolBarType { diff --git a/src/UI/Store/PointToString.ts b/src/UI/Store/PointToString.ts new file mode 100644 index 000000000..e3bb7b2e0 --- /dev/null +++ b/src/UI/Store/PointToString.ts @@ -0,0 +1,11 @@ +import { Vector3 } from 'three'; +import { FixedNotZero } from '../../Common/Utils'; + +//点转换为字符串. +export function PointToString(pt: Vector3): string +{ + return pt.toArray().map(o => + { + return FixedNotZero(o, 3); + }).join(" , "); +}