数据存储::图表B
数据存储=(strokepath$b.difference winding combined block1)translatex(-0.3)
其中block1=(圆0.5)scalex 0.5 translatex(-1)
块2=矩形2 1
块3=(圈0.5)translatex(1)
组合=B.联合绕组$block2<>block3
< /代码>
![](“https://i.stack.imgur.com/jm5bx.png”alt=“enter)
我已经试了好几个小时了,但是不能在之前的估计和信号分解(SSA)之间画一个箭头。目标是从符号外的中心开始绘制箭头。欢迎任何帮助。非常感谢。
编辑1:添加想要的结果。
![](“https://i.stack.imgur.com/xfpfm.png”alt=“enter)
这是完整的代码。
-language nomonomorismsrestriction-
-语言灵活上下文-
-语言类型系列-
模块流程图
导入系统.过程
--导入graphics.svgfonts
导入diagrams.backend.svg.cmdline
导入图表。序曲
导入图表.twod.箭头
将限定的diagrams.twod.path.boolean导入为b
OneLineText TXT=文本TXT
twolinetext txt1 txt2=中心$(文本txt1)===struty 0.2===(文本txt2)
threelineText txt1 txt2 txt3=中心$
(文本txt1)===struty 0.2==(文本txt2)===struty 0.2===(文本txt3)
终端WRITEXT W H R=(WRITETEXT<gt;RoundedRect W H R)LWL 0.02 FontSize(本地0.2)
--terminalinput=(文本“输入数据”<>roundedrect 1 0.3 0.3)lwl 0.02 fontsize(本地0.2)
--进程txt w h=(文本txt<>rect w h)lwl 0.02 fontsize(本地0.2)
process writetext w h=(writetext<gt;rect w h)lwl 0.02 fontsize(本地0.2)
数据存储::图B
数据存储=(strokepath$b.difference winding combined block1)translatex(-0.3)
其中block1=(圆0.5)scalex 0.5 translatex(-1)
块2=矩形2 1
块3=(圈0.5)translatex(1)
组合=B.联合绕组$block2<>block3
--决策::图B
--decision=(文本“bpm”<>rect 0.4 0.3)lwl 0.02 fontsize(本地0.2)
input=(终端(onelinetext“input data”)1.2 0.3 0.3)命名为“terminal input”
bandpass=(进程(twolinetext“bandpass”“filtering”)1.5 0.5)命名为“bandpass”
SSA=(进程(三行文本“信号”“分解”(SSA))1.5 1)translatey(-0.3)命名为“SSA”ShowOrigin
td=(进程(twolinetext“temporal”“difference”)1 0.5)命名为“td”
focuss=(进程(threelinetext“稀疏信号”“重建(focuss)”)1.5 0.8)命名为“focuss”
outputpm=(终端(onelinetext“output bpm”)1.2 0.3 0.3)命名为“terminalOutput”
spt=(进程(threelinetext“光谱峰”“跟踪”“选择和验证”)1.5 0.8)命名为“spt”
prior=(onelinetext“上一个估计”<gt;数据存储)fontsize(本地0.2)命名为“prior”showorigin translatey 1
arrowstyle=(带箭头。~镖&头长。~大&尾长。~verylarge)
ushaft=trailfromvertices(地图p2[(0,0),(0.5,0),(0.5,1),(1,1)])
arrowstyleu=(带箭头。~镖&头长。~大&尾长。~verylarge&arrowshaft。~ushaft)
决策::图B
decision=square 5 rotate(45@@度)scaley 0.5
PlaceBlocks::图表B
PlaceBlocks=Atpoints[P(V2 0 0),--输入
P(V2 4 0),--带通
P(V2 8 0),--SSA
P(V2 8(-2)),--td
P(V2 8(-4)),--Focuss
P(V2 4(-4)),--SPT
P(V2 0(-4)),--输出bpm
P(V2 4(-2))--之前
[输入,带通,SSA,TD,Focuss,SPT,输出bpm,之前]
流程图::图B
流程图=放置块连接外部箭头样式“terminalinput”“bandpass”
#连接外部“arrowstyle”bandpass“ssa”
#连接外部'arrowstyle“ssa”“td”
#连接外部“arrowstyle”td“focuss”
#连接外部“arrowstyle”focuss“spt”
#“连接外部”arrowstyle“spt”“terminalOutput”
#连接外部“arrowstyle”之前的“spt”
#连接外部“arrowstyleu”之前的“ssa”
β垫1.1
流程图:IO()
Flowcharttr=MainWith流程图
< /代码> <dataStorage :: Diagram B
dataStorage = (strokePath $ B.difference Winding combined block1) # translateX (-0.3)
where block1 = (circle 0.5) # scaleX 0.5 # translateX (-1)
block2 = rect 2 1
block3 = (circle 0.5) # translateX (1)
combined = B.union Winding $ block2 <> block3
![enter image description here](https://i.stack.imgur.com/jm5bx.png)
我已经试了好几个小时了,但还是不能在Previous Estimate
写在那个符号里面Signal Decomposition (SSA)
. 目标是从符号外的中心开始绘制箭头。欢迎任何帮助。非常感谢你。
编辑1:添加想要的结果。
![enter image description here](https://i.stack.imgur.com/xfPFM.png)
这是完整的代码。
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeFamilies #-}
module FlowChartTR where
import System.Process
--import Graphics.SVGFonts
import Diagrams.Backend.SVG.CmdLine
import Diagrams.Prelude
import Diagrams.TwoD.Arrow
import qualified Diagrams.TwoD.Path.Boolean as B
oneLineText txt = text txt
twoLineText txt1 txt2 = center $ (text txt1) === strutY 0.2 === (text txt2)
threeLineText txt1 txt2 txt3 = center $
(text txt1) === strutY 0.2 === (text txt2) === strutY 0.2 === (text txt3)
terminal writeText w h r = (writeText <> roundedRect w h r) # lwL 0.02 # fontSize (local 0.2)
--terminalInput = (text "Input Data" <> roundedRect 1 0.3 0.3) # lwL 0.02 # fontSize (local 0.2)
--process txt w h = (text txt <> rect w h) # lwL 0.02 # fontSize (local 0.2)
process writeText w h = (writeText <> rect w h) # lwL 0.02 # fontSize (local 0.2)
dataStorage :: Diagram B
dataStorage = (strokePath $ B.difference Winding combined block1) # translateX (-0.3)
where block1 = (circle 0.5) # scaleX 0.5 # translateX (-1)
block2 = rect 2 1
block3 = (circle 0.5) # translateX (1)
combined = B.union Winding $ block2 <> block3
--decision :: Diagram B
--decision = (text "BPM" <> rect 0.4 0.3) # lwL 0.02 # fontSize (local 0.2)
input = (terminal (oneLineText "Input Data") 1.2 0.3 0.3) # named "terminalInput"
bandpass = (process (twoLineText "Bandpass" "Filtering") 1.5 0.5) # named "bandpass"
ssa = (process (threeLineText "Signal" "Decomposition" "(SSA)") 1.5 1) # translateY (-0.3) # named "ssa" # showOrigin
td = (process (twoLineText "Temporal" "Difference") 1 0.5) # named "td"
focuss = (process (threeLineText "Sparse Signal" "Reconstruction" "(FOCUSS)") 1.5 0.8) # named "focuss"
outputBPM = (terminal (oneLineText "Output BPM") 1.2 0.3 0.3) # named "terminalOutput"
spt = (process (threeLineText "Spectral Peak" "Tracking" "Select & Verif") 1.5 0.8) # named "spt"
prior = (oneLineText "Previous Estimate" <> dataStorage) # fontSize (local 0.2) # named "prior" #showOrigin # translateY 1
arrowStyle = (with & arrowHead .~ dart & headLength .~ large & tailLength .~ veryLarge)
ushaft = trailFromVertices (map p2 [(0, 0), (0.5, 0), (0.5, 1), (1, 1)])
arrowStyleU = (with & arrowHead .~ dart & headLength .~ large & tailLength .~ veryLarge & arrowShaft .~ ushaft)
decision :: Diagram B
decision = square 5 # rotate (45 @@ deg) # scaleY 0.5
placeBlocks :: Diagram B
placeBlocks = atPoints [ P (V2 0 0), -- input
P (V2 4 0), -- bandpass
P (V2 8 0), -- ssa
P (V2 8 (-2)), -- td
P (V2 8 (-4)), -- focuss
P (V2 4 (-4)), -- spt
P (V2 0 (-4)), -- outputBPM
P (V2 4 (-2)) -- prior
] [input, bandpass,ssa, td, focuss, spt, outputBPM, prior]
flowChart :: Diagram B
flowChart = placeBlocks # connectOutside' arrowStyle "terminalInput" "bandpass"
# connectOutside' arrowStyle "bandpass" "ssa"
# connectOutside' arrowStyle "ssa" "td"
# connectOutside' arrowStyle "td" "focuss"
# connectOutside' arrowStyle "focuss" "spt"
# connectOutside' arrowStyle "spt" "terminalOutput"
# connectOutside' arrowStyle "prior" "spt"
# connectOutside' arrowStyleU "prior" "ssa"
# pad 1.1
flowChartTR :: IO ()
flowChartTR = mainWith flowChart