增加了相关文档说明
This commit is contained in:
65
docs/绘图/工厂模式.drawio
Normal file
65
docs/绘图/工厂模式.drawio
Normal file
@@ -0,0 +1,65 @@
|
||||
<mxfile host="Electron" agent="AI-Drawio-Replicator">
|
||||
<diagram id="page-1" name="传感器工厂模式">
|
||||
<mxGraphModel dx="2204" dy="2155" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1400" pageHeight="900" background="#f0f8ff" math="0" shadow="0">
|
||||
<root>
|
||||
<mxCell id="0" />
|
||||
<mxCell id="1" parent="0" />
|
||||
<mxCell id="2" parent="1" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#e6f2ff;strokeColor=#6699cc;strokeWidth=2;shadow=1;fontSize=14;fontFamily=Times New Roman;" value="<div style="display:flex;align-items:center;justify-content:center;gap:15px;font-size:20px;font-weight:bold;"><div style="font-size:40px;">📱</div><div>应用层<br><span style="font-size:16px;font-weight:normal;">(调用者)</span></div></div>" vertex="1">
|
||||
<mxGeometry height="100" width="220" x="20" y="120" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="3" parent="1" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontFamily=Times New Roman;" value="<div style="font-size: 18px; line-height: 1.6;">sensor = <span style="color:#0066cc;font-weight:bold;">sensor_create</span>(SENSOR_DS18B20);<br>sensor-&gt;read(); <span style="color:#666666;">// 不关心具体实现</span></div>" vertex="1">
|
||||
<mxGeometry height="100" width="350" x="250" y="120" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="4" parent="1" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#e6f9f2;strokeColor=#33cc99;strokeWidth=3;shadow=1;fontSize=14;fontFamily=Times New Roman;" value="<div style="display:flex;align-items:center;justify-content:center;gap:15px;font-size:24px;font-weight:bold;"><div style="font-size:40px;">🏭</div><div>工厂函数</div></div>" vertex="1">
|
||||
<mxGeometry height="100" width="280" x="230" y="320" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="5" parent="1" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontFamily=Times New Roman;" value="<div style="font-size:16px;">根据类型参数,选择并返回对应的操作集合</div>" vertex="1">
|
||||
<mxGeometry height="30" width="350" x="380" y="280" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="6" parent="1" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#e6f2ff;strokeColor=#6699cc;strokeWidth=3;shadow=1;fontSize=14;fontFamily=Times New Roman;" value="" vertex="1">
|
||||
<mxGeometry height="280" width="700" x="20" y="540" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="7" parent="6" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f0f7ff;strokeColor=#6699cc;strokeWidth=2;fontSize=14;fontFamily=Times New Roman;" value="<div style="font-size:24px;font-weight:bold;text-align:center;">传感器操作接口</div>" vertex="1">
|
||||
<mxGeometry height="50" width="600" x="50" y="20" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="8" parent="6" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f0f7ff;strokeColor=#6699cc;strokeWidth=2;fontSize=14;fontFamily=Times New Roman;" value="<div style="display:flex;align-items:center;justify-content:center;gap:10px;font-size:20px;font-weight:bold;"><div style="font-size:36px;">🌡️</div><div>DS18B20<br><span style="font-size: 16px; font-weight: normal;">.init<br>.read<br>.deinit</span></div></div>" vertex="1">
|
||||
<mxGeometry height="160" width="180" x="50" y="100" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="9" parent="6" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#e6f9f2;strokeColor=#33cc99;strokeWidth=2;fontSize=14;fontFamily=Times New Roman;" value="<div style="display:flex;align-items:center;justify-content:center;gap:10px;font-size:20px;font-weight:bold;"><div style="font-size:36px;">🌡️</div><div>NTC<br><span style="font-size: 16px; font-weight: normal;">.init<br>.read<br>.deinit</span></div></div>" vertex="1">
|
||||
<mxGeometry height="160" width="180" x="260" y="100" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="10" parent="6" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f0f7ff;strokeColor=#6699cc;strokeWidth=2;fontSize=14;fontFamily=Times New Roman;" value="<div style="display:flex;align-items:center;justify-content:center;gap:10px;font-size:20px;font-weight:bold;"><div style="font-size:36px;">🌡️</div><div>PT100<br><span style="font-size: 16px; font-weight: normal;">.init<br>.read<br>.deinit</span></div></div>" vertex="1">
|
||||
<mxGeometry height="160" width="180" x="470" y="100" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="11" edge="1" parent="1" source="2" style="endArrow=classic;html=1;strokeColor=#336699;strokeWidth=2;labelPosition=top;verticalAlign=bottom;labelBackgroundColor=#ffffff;edgeStyle=orthogonalEdgeStyle;fontFamily=Times New Roman;" target="4" value="<div style="font-size:16px;">调用工厂函数</div>">
|
||||
<mxGeometry height="50" relative="1" width="50" as="geometry">
|
||||
<Array as="points">
|
||||
<mxPoint x="130" y="370" />
|
||||
</Array>
|
||||
<mxPoint x="130" y="220" as="sourcePoint" />
|
||||
<mxPoint x="320" y="320" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="12" edge="1" parent="1" source="4" style="endArrow=classic;html=1;strokeColor=#33cc99;strokeWidth=3;labelPosition=right;verticalAlign=middle;labelBackgroundColor=#ffffff;fontFamily=Times New Roman;" target="6" value="<div style="font-size:16px;">返回具体实例</div>">
|
||||
<mxGeometry height="50" relative="1" width="50" as="geometry">
|
||||
<mxPoint x="460" y="420" as="sourcePoint" />
|
||||
<mxPoint x="460" y="540" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3jtoW8cGR1RTCXEpEOqW-14" edge="1" parent="1" style="endArrow=classic;html=1;strokeColor=#336699;strokeWidth=2;labelPosition=top;verticalAlign=bottom;labelBackgroundColor=#ffffff;edgeStyle=orthogonalEdgeStyle;entryX=0.5;entryY=0;entryDx=0;entryDy=0;fontFamily=Times New Roman;" target="4" value="<div style="font-size:16px;"><br></div>">
|
||||
<mxGeometry height="50" relative="1" width="50" as="geometry">
|
||||
<mxPoint as="offset" />
|
||||
<Array as="points">
|
||||
<mxPoint x="370" y="270" />
|
||||
</Array>
|
||||
<mxPoint x="130" y="270" as="sourcePoint" />
|
||||
<mxPoint x="320" y="420" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="13" parent="1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=32;fontFamily=Times New Roman;" value="📄" vertex="1">
|
||||
<mxGeometry height="40" width="40" x="260" y="251" as="geometry" />
|
||||
</mxCell>
|
||||
</root>
|
||||
</mxGraphModel>
|
||||
</diagram>
|
||||
</mxfile>
|
||||
Reference in New Issue
Block a user