完善建模交互与结果曲线功能
支持元件接口接触吸附、旋转后兼容连接及无连线逻辑边。 完善 AMESim 图标显示、参数双栏、结果曲线待定窗口及相关端到端测试。
This commit is contained in:
1 parent
410ef535e8
commit
503394f3ed
10 files changed
+2542
-389
No files matched your search
@@ -25,6 +25,7 @@ import { SymbolSvg } from "./componentSymbols/primitives";
|
||||
import { AmesimStep0Symbol, AmesimUd00Symbol } from "./componentSymbols/signals";
|
||||
import { AmesimPnch012Symbol, AmesimPnch023Symbol } from "./componentSymbols/storage";
|
||||
import type {
|
||||
ComponentSymbolPortAnchors,
|
||||
ComponentSymbolPresentation,
|
||||
SymbolDefinition,
|
||||
} from "./componentSymbols/types";
|
||||
@@ -60,7 +61,7 @@ function CylinderSymbol() {
|
||||
function TankSymbol() {
|
||||
return (
|
||||
<SymbolSvg>
|
||||
<path d="M32 2v5M32 41v5" stroke="currentColor" strokeWidth="2" />
|
||||
<path d="M2 24h14M32 2v5M32 41v5" stroke="currentColor" strokeWidth="2" />
|
||||
<path
|
||||
d="M16 13c0-4 7.2-7 16-7s16 3 16 7v22c0 4-7.2 7-16 7s-16-3-16-7V13Z"
|
||||
fill="#dcfce7"
|
||||
@@ -75,7 +76,7 @@ function TankSymbol() {
|
||||
function PipeSymbol() {
|
||||
return (
|
||||
<SymbolSvg>
|
||||
<path d="M2 19h60M2 29h60" stroke="currentColor" strokeWidth="2" />
|
||||
<path d="M2 24h7M55 24h7M9 19h46M9 29h46" stroke="currentColor" strokeWidth="2" />
|
||||
<path d="M9 17v14M55 17v14" stroke="currentColor" strokeWidth="2" />
|
||||
</SymbolSvg>
|
||||
);
|
||||
@@ -99,8 +100,18 @@ function OrificeSymbol() {
|
||||
function TeeSymbol() {
|
||||
return (
|
||||
<SymbolSvg>
|
||||
<path d="M2 27h60M32 27V3" stroke="currentColor" strokeWidth="8" />
|
||||
<path d="M2 27h60M32 27V3" stroke="#f8fafc" strokeWidth="4" />
|
||||
<path
|
||||
d="M2 24h28M30 24C42 24 44 12 62 12M30 24c12 0 14 12 32 12"
|
||||
stroke="currentColor"
|
||||
strokeLinecap="round"
|
||||
strokeWidth="7"
|
||||
/>
|
||||
<path
|
||||
d="M2 24h28M30 24C42 24 44 12 62 12M30 24c12 0 14 12 32 12"
|
||||
stroke="#f8fafc"
|
||||
strokeLinecap="round"
|
||||
strokeWidth="3"
|
||||
/>
|
||||
</SymbolSvg>
|
||||
);
|
||||
}
|
||||
@@ -195,6 +206,123 @@ const symbolRegistry = {
|
||||
|
||||
type RegisteredComponentSymbol = keyof typeof symbolRegistry;
|
||||
|
||||
const symbolPortAnchors: Partial<
|
||||
Record<RegisteredComponentSymbol, ComponentSymbolPortAnchors>
|
||||
> = {
|
||||
cylinder: {
|
||||
left: [{ x: 3, y: 24 }],
|
||||
right: [{ x: 61, y: 24 }],
|
||||
},
|
||||
tank: { left: [{ x: 2, y: 24 }] },
|
||||
pipe: {
|
||||
left: [{ x: 2, y: 24 }],
|
||||
right: [{ x: 62, y: 24 }],
|
||||
},
|
||||
orifice: {
|
||||
left: [{ x: 2, y: 24 }],
|
||||
right: [{ x: 62, y: 24 }],
|
||||
},
|
||||
tee: {
|
||||
left: [{ x: 2, y: 24 }],
|
||||
right: [
|
||||
{ x: 62, y: 12 },
|
||||
{ x: 62, y: 36 },
|
||||
],
|
||||
},
|
||||
generic: {
|
||||
left: [{ x: 2, y: 24 }],
|
||||
right: [{ x: 62, y: 24 }],
|
||||
},
|
||||
signal: {
|
||||
left: [{ x: 2, y: 24 }],
|
||||
right: [{ x: 62, y: 24 }],
|
||||
},
|
||||
junction: {
|
||||
left: [{ x: 2, y: 24 }],
|
||||
right: [{ x: 62, y: 24 }],
|
||||
},
|
||||
amesim_pnpl01: { left: [{ x: 2, y: 24 }] },
|
||||
amesim_pnch023: {
|
||||
left: [{ x: 2, y: 24 }],
|
||||
right: [{ x: 62, y: 24 }],
|
||||
},
|
||||
amesim_pnch012: {
|
||||
left: [
|
||||
{ x: 2, y: 16 },
|
||||
{ x: 2, y: 32 },
|
||||
],
|
||||
right: [
|
||||
{ x: 62, y: 16 },
|
||||
{ x: 62, y: 32 },
|
||||
],
|
||||
},
|
||||
amesim_pnor001: {
|
||||
left: [{ x: 2, y: 24 }],
|
||||
right: [{ x: 62, y: 24 }],
|
||||
},
|
||||
amesim_pnvo001_fixed: {
|
||||
left: [{ x: 2, y: 28 }],
|
||||
right: [{ x: 62, y: 28 }],
|
||||
},
|
||||
amesim_pnvo001: {
|
||||
left: [
|
||||
{ x: 2, y: 16 },
|
||||
{ x: 2, y: 32 },
|
||||
],
|
||||
right: [{ x: 62, y: 25 }],
|
||||
},
|
||||
amesim_pnl00r: {
|
||||
left: [{ x: 2, y: 24 }],
|
||||
right: [{ x: 62, y: 24 }],
|
||||
},
|
||||
amesim_pnl0001: {
|
||||
left: [{ x: 2, y: 24 }],
|
||||
right: [{ x: 62, y: 24 }],
|
||||
},
|
||||
amesim_pnl0002: {
|
||||
left: [{ x: 2, y: 24 }],
|
||||
right: [{ x: 62, y: 24 }],
|
||||
},
|
||||
amesim_pnl0003: {
|
||||
left: [{ x: 2, y: 24 }],
|
||||
right: [{ x: 62, y: 24 }],
|
||||
},
|
||||
amesim_pn3node2: {
|
||||
left: [{ x: 3, y: 24 }],
|
||||
right: [
|
||||
{ x: 61, y: 12 },
|
||||
{ x: 61, y: 36 },
|
||||
],
|
||||
},
|
||||
amesim_p4node2: {
|
||||
left: [{ x: 3, y: 24 }],
|
||||
right: [
|
||||
{ x: 61, y: 8 },
|
||||
{ x: 61, y: 24 },
|
||||
{ x: 61, y: 40 },
|
||||
],
|
||||
},
|
||||
amesim_step0: { right: [{ x: 60, y: 24 }] },
|
||||
amesim_ud00: { right: [{ x: 60, y: 24 }] },
|
||||
amesim_f000: { right: [{ x: 62, y: 24 }] },
|
||||
amesim_forc: {
|
||||
left: [{ x: 2, y: 24 }],
|
||||
right: [{ x: 62, y: 24 }],
|
||||
},
|
||||
amesim_mecmas21: {
|
||||
left: [{ x: 2, y: 24 }],
|
||||
right: [{ x: 62, y: 24 }],
|
||||
},
|
||||
amesim_lstp00a: {
|
||||
left: [{ x: 2, y: 24 }],
|
||||
right: [{ x: 62, y: 24 }],
|
||||
},
|
||||
amesim_lmechn1: {
|
||||
left: [7, 12, 17, 22, 27, 32, 37, 42].map((y) => ({ x: 5, y })),
|
||||
right: [{ x: 59, y: 24 }],
|
||||
},
|
||||
};
|
||||
|
||||
function isRegisteredComponentSymbol(symbol: string): symbol is RegisteredComponentSymbol {
|
||||
return Object.prototype.hasOwnProperty.call(symbolRegistry, symbol);
|
||||
}
|
||||
@@ -211,6 +339,14 @@ export function componentSymbolPresentation(
|
||||
: "framed";
|
||||
}
|
||||
|
||||
export function componentSymbolPortAnchors(
|
||||
symbol: string,
|
||||
): ComponentSymbolPortAnchors | undefined {
|
||||
return isRegisteredComponentSymbol(symbol)
|
||||
? symbolPortAnchors[symbol]
|
||||
: undefined;
|
||||
}
|
||||
|
||||
export function ComponentSymbol({
|
||||
symbol,
|
||||
surface,
|
||||
|
||||
Reference in new issue
Block a user