tessng 0.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. tessng-0.0.1/LICENSE +19 -0
  2. tessng-0.0.1/MANIFEST.in +3 -0
  3. tessng-0.0.1/PKG-INFO +59 -0
  4. tessng-0.0.1/README.md +39 -0
  5. tessng-0.0.1/setup.cfg +4 -0
  6. tessng-0.0.1/setup.py +63 -0
  7. tessng-0.0.1/tessng/TESSNG.exe +0 -0
  8. tessng-0.0.1/tessng/TESS_DB.dll +0 -0
  9. tessng-0.0.1/tessng/TESS_MODEL.dll +0 -0
  10. tessng-0.0.1/tessng/TESS_NET.dll +0 -0
  11. tessng-0.0.1/tessng/TESS_PythonAPI_EXAMPLE/MyNet.py +206 -0
  12. tessng-0.0.1/tessng/TESS_PythonAPI_EXAMPLE/MyPlugin.py +51 -0
  13. tessng-0.0.1/tessng/TESS_PythonAPI_EXAMPLE/MySimulator.py +462 -0
  14. tessng-0.0.1/tessng/TESS_PythonAPI_EXAMPLE/main.py +15 -0
  15. tessng-0.0.1/tessng/TESS_SIMU.dll +0 -0
  16. tessng-0.0.1/tessng/TESS_WIN.dll +0 -0
  17. tessng-0.0.1/tessng/TessInterfaces.dll +0 -0
  18. tessng-0.0.1/tessng/TessSupport.dll +0 -0
  19. tessng-0.0.1/tessng/Tessng.pyd +0 -0
  20. tessng-0.0.1/tessng/Tessng.pyi +3353 -0
  21. tessng-0.0.1/tessng/__init__.py +60 -0
  22. tessng-0.0.1/tessng/assimp-vc143-mt.dll +0 -0
  23. tessng-0.0.1/tessng/fmt.dll +0 -0
  24. tessng-0.0.1/tessng/freetype.dll +0 -0
  25. tessng-0.0.1/tessng/jpeg62.dll +0 -0
  26. tessng-0.0.1/tessng/libEGL.dll +0 -0
  27. tessng-0.0.1/tessng/libEGLd.dll +0 -0
  28. tessng-0.0.1/tessng/libGLESv2.dll +0 -0
  29. tessng-0.0.1/tessng/libGLESv2d.dll +0 -0
  30. tessng-0.0.1/tessng/libPythonPanel.dll +0 -0
  31. tessng-0.0.1/tessng/libcrypto-3-x64.dll +0 -0
  32. tessng-0.0.1/tessng/libcurl.dll +0 -0
  33. tessng-0.0.1/tessng/liblzma.dll +0 -0
  34. tessng-0.0.1/tessng/libprotobuf.dll +0 -0
  35. tessng-0.0.1/tessng/libssl-3-x64.dll +0 -0
  36. tessng-0.0.1/tessng/lz4.dll +0 -0
  37. tessng-0.0.1/tessng/metis.dll +0 -0
  38. tessng-0.0.1/tessng/msvcp140.dll +0 -0
  39. tessng-0.0.1/tessng/opengl32sw.dll +0 -0
  40. tessng-0.0.1/tessng/openglrenderer.dll +0 -0
  41. tessng-0.0.1/tessng/proj.dll +0 -0
  42. tessng-0.0.1/tessng/shiboken2.abi3.dll +0 -0
  43. tessng-0.0.1/tessng/spdlog.dll +0 -0
  44. tessng-0.0.1/tessng/sqlite3.dll +0 -0
  45. tessng-0.0.1/tessng/tiff.dll +0 -0
  46. tessng-0.0.1/tessng/zlib1.dll +0 -0
  47. tessng-0.0.1/tessng.egg-info/PKG-INFO +59 -0
  48. tessng-0.0.1/tessng.egg-info/SOURCES.txt +50 -0
  49. tessng-0.0.1/tessng.egg-info/dependency_links.txt +1 -0
  50. tessng-0.0.1/tessng.egg-info/not-zip-safe +1 -0
  51. tessng-0.0.1/tessng.egg-info/requires.txt +2 -0
  52. tessng-0.0.1/tessng.egg-info/top_level.txt +1 -0
tessng-0.0.1/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) Jida Transportation
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
@@ -0,0 +1,3 @@
1
+ include LICENSE
2
+ recursive-include tessng *
3
+ exclude */__pycache__
tessng-0.0.1/PKG-INFO ADDED
@@ -0,0 +1,59 @@
1
+ Metadata-Version: 2.1
2
+ Name: tessng
3
+ Version: 0.0.1
4
+ Summary: TESS NG V4.0 Secondary Development (Python version)
5
+ Home-page: http://jidatraffic.com:82/
6
+ Author: Jida Transportation
7
+ Author-email: 17315487709@163.com
8
+ License: MIT
9
+ Platform: UNKNOWN
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.6
12
+ Classifier: Programming Language :: Python :: 3.8
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Operating System :: OS Independent
15
+ Requires-Python: >=3.6, !=3.7.*, <3.9
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+
19
+ ## 功能 Function
20
+ TessNg使用户可以通过编写 Python 代码来与微观交通仿真软件TESS NG 进行交互,从而实现仿真软件的能力扩张与功能定制。
21
+
22
+ TessNg enables users to interact with the micro traffic simulation software TESS NG by writing Python code, thereby expanding the capabilities and customizing the functions of the simulation software.
23
+
24
+ ## 版本 Version
25
+ Python的版本要求为**3.6或3.8**,运行环境为Windows,TESS NG 的版本为**V4**。
26
+
27
+ The version requirement for Python is **3.6 or 3.8**, the running environment is Windows, and the version for TESS NG is **V4**.
28
+
29
+ ## 安装 Install
30
+ 请使用以下命令安装 tessng 包:
31
+
32
+ You can use the following command to install the tessng package
33
+
34
+ ```bash
35
+ pip install tessng
36
+ ```
37
+
38
+ ## 使用 Usage
39
+ 可以使用以下代码生成TESS NG 基础案例的代码文件:
40
+
41
+ You can generate a code file for a TESS NG basic case using the following code:
42
+
43
+ ```python
44
+ import tessng
45
+ tessng.get_demo_files(path=None)
46
+ ```
47
+ 其中,参数path为保存代码文件的路径,默认为当前目录。
48
+
49
+ Among them, the parameter path is the path to save the code file, which defaults to the current directory.
50
+
51
+ 执行该代码将生成4个文件:main.py、MyPlugin.py、MyNet.py 和 MySimulator.py,运行main.py,并使用 key 激活软件,即可启动TESS NG。
52
+
53
+ Executing this code will generate four files: main.exe, MyPlugin. py, MyNet. py, and MySimulator. py. Run main. py and activate the software with the key to start TESS NG.
54
+
55
+ 更多使用说明请参考济达交通官方网站:http://jidatraffic.com:82/
56
+
57
+ For more usage instructions, please refer to the official website of Jida Transportation: http://jidatraffic.com:82/
58
+
59
+
tessng-0.0.1/README.md ADDED
@@ -0,0 +1,39 @@
1
+ ## 功能 Function
2
+ TessNg使用户可以通过编写 Python 代码来与微观交通仿真软件TESS NG 进行交互,从而实现仿真软件的能力扩张与功能定制。
3
+
4
+ TessNg enables users to interact with the micro traffic simulation software TESS NG by writing Python code, thereby expanding the capabilities and customizing the functions of the simulation software.
5
+
6
+ ## 版本 Version
7
+ Python的版本要求为**3.6或3.8**,运行环境为Windows,TESS NG 的版本为**V4**。
8
+
9
+ The version requirement for Python is **3.6 or 3.8**, the running environment is Windows, and the version for TESS NG is **V4**.
10
+
11
+ ## 安装 Install
12
+ 请使用以下命令安装 tessng 包:
13
+
14
+ You can use the following command to install the tessng package
15
+
16
+ ```bash
17
+ pip install tessng
18
+ ```
19
+
20
+ ## 使用 Usage
21
+ 可以使用以下代码生成TESS NG 基础案例的代码文件:
22
+
23
+ You can generate a code file for a TESS NG basic case using the following code:
24
+
25
+ ```python
26
+ import tessng
27
+ tessng.get_demo_files(path=None)
28
+ ```
29
+ 其中,参数path为保存代码文件的路径,默认为当前目录。
30
+
31
+ Among them, the parameter path is the path to save the code file, which defaults to the current directory.
32
+
33
+ 执行该代码将生成4个文件:main.py、MyPlugin.py、MyNet.py 和 MySimulator.py,运行main.py,并使用 key 激活软件,即可启动TESS NG。
34
+
35
+ Executing this code will generate four files: main.exe, MyPlugin. py, MyNet. py, and MySimulator. py. Run main. py and activate the software with the key to start TESS NG.
36
+
37
+ 更多使用说明请参考济达交通官方网站:http://jidatraffic.com:82/
38
+
39
+ For more usage instructions, please refer to the official website of Jida Transportation: http://jidatraffic.com:82/
tessng-0.0.1/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
tessng-0.0.1/setup.py ADDED
@@ -0,0 +1,63 @@
1
+ import sys
2
+ import setuptools
3
+ from wheel.bdist_wheel import bdist_wheel as bdist_wheel_orig
4
+
5
+
6
+ # 获取当前Python版本
7
+ current_python_version: str = ".".join(map(str, [sys.version_info.major, sys.version_info.minor]))
8
+ print(f"当前Python版本为:{current_python_version}")
9
+
10
+ # 如果Python版本是3.6
11
+ if current_python_version == "3.6":
12
+ python_tag = "cp36"
13
+ abi_tag = "cp36m"
14
+ # 如果Python版本是3.8
15
+ elif current_python_version == "3.8":
16
+ python_tag = "cp38"
17
+ abi_tag = "cp38"
18
+ # 如果Python版本是其他
19
+ else:
20
+ raise RuntimeError("Unsupported Python version")
21
+
22
+ with open("README.md", "r", encoding="utf-8") as fh:
23
+ long_description = fh.read()
24
+
25
+ class bdist_wheel(bdist_wheel_orig):
26
+ def get_tag(self):
27
+ # 返回 python tag, abi tag, platform tag
28
+ return python_tag, abi_tag, "win_amd64"
29
+
30
+
31
+ setuptools.setup(
32
+ name="tessng",
33
+ version="0.0.1",
34
+ author="Jida Transportation",
35
+ author_email="17315487709@163.com",
36
+ description="TESS NG V4.0 Secondary Development (Python version)",
37
+ long_description=long_description,
38
+ long_description_content_type="text/markdown",
39
+ url="http://jidatraffic.com:82/",
40
+ python_requires=">=3.6, !=3.7.*, <3.9",
41
+ packages=setuptools.find_packages(),
42
+ package_data={
43
+ "tessng": ["*.dll", "*.pyd", "*.pyi", "*.exe", "TESS_PythonAPI_EXAMPLE"]
44
+ },
45
+ install_requires=[
46
+ "PySide2",
47
+ "shiboken2",
48
+ ],
49
+ license='MIT',
50
+ license_files=('LICENSE',),
51
+ classifiers=[
52
+ "Programming Language :: Python :: 3",
53
+ "Programming Language :: Python :: 3.6",
54
+ "Programming Language :: Python :: 3.8",
55
+ "License :: OSI Approved :: MIT License",
56
+ "Operating System :: OS Independent",
57
+ ],
58
+ cmdclass={
59
+ "bdist_wheel": bdist_wheel
60
+ },
61
+ zip_safe=False,
62
+ include_package_data=True,
63
+ )
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,206 @@
1
+ from PySide2.QtCore import QPointF
2
+ from tessng import PyCustomerNet, tessngIFace, m2p, p2m, NetItemType, GraphicsItemPropName
3
+
4
+
5
+ # 用户插件子类,代表用户自定义与路网相关的实现逻辑,继承自MyCustomerNet
6
+ class MyNet(PyCustomerNet):
7
+ def __init__(self):
8
+ super().__init__()
9
+ # 代表TESS NG的接口
10
+ self.iface = tessngIFace()
11
+ # 代表TESS NG的路网子接口
12
+ self.netiface = self.iface.netInterface()
13
+ # 代表TESS NG仿真子接口
14
+ self.simuiface = self.iface.simuInterface()
15
+
16
+ # 自定义方法:创建路网上的路段和连接段
17
+ def create_network(self) -> None:
18
+ # 创建第一条路段
19
+ start_point = QPointF(m2p(-300), 0)
20
+ end_point = QPointF(m2p(300), 0)
21
+ link_points = [start_point, end_point]
22
+ link1 = self.netiface.createLink(link_points, 7, "曹安公路")
23
+ if link1 is not None:
24
+ # 车道列表
25
+ lanes = link1.lanes()
26
+ # 打印该路段所有车道ID列表
27
+ print("曹安公路车道ID列表:", [lane.id() for lane in lanes])
28
+ # 在当前路段创建发车点
29
+ dp = self.netiface.createDispatchPoint(link1)
30
+ if dp is not None:
31
+ # 设置发车间隔,含车型组成、时间间隔、发车数
32
+ dp.addDispatchInterval(1, 2, 28)
33
+
34
+ # 创建第二条路段
35
+ start_point = QPointF(m2p(-300), m2p(-25))
36
+ end_point = QPointF(m2p(300), m2p(-25))
37
+ link_points = [start_point, end_point]
38
+ link2 = self.netiface.createLink(link_points, 7, "次干道")
39
+ if link2 is not None:
40
+ # 在当前路段创建发车点
41
+ dp = self.netiface.createDispatchPoint(link2)
42
+ if dp is not None:
43
+ # 设置发车间隔,含车型组成、时间间隔、发车数
44
+ dp.addDispatchInterval(1, 3600, 3600)
45
+ # 将外侧车道设为公交专用道
46
+ lanes = link2.lanes()
47
+ lane = lanes[0]
48
+ lane.setLaneType("公交专用道")
49
+
50
+ # 创建第三条路段
51
+ start_point = QPointF(m2p(-300), m2p(25))
52
+ end_point = QPointF(m2p(-150), m2p(25))
53
+ link_points = [start_point, end_point]
54
+ link3 = self.netiface.createLink(link_points, 3)
55
+ if link3 is not None:
56
+ # 在当前路段创建发车点
57
+ dp = self.netiface.createDispatchPoint(link3)
58
+ if dp is not None:
59
+ # 设置发车间隔,含车型组成、时间间隔、发车数
60
+ dp.addDispatchInterval(1, 3600, 3600)
61
+
62
+ # 创建第四条路段
63
+ start_point = QPointF(m2p(-50), m2p(25))
64
+ end_point = QPointF(m2p(50), m2p(25))
65
+ link_points = [start_point, end_point]
66
+ link4 = self.netiface.createLink(link_points, 3)
67
+
68
+ # 创建第五条路段
69
+ start_point = QPointF(m2p(150), m2p(25))
70
+ end_point = QPointF(m2p(300), m2p(25))
71
+ link_points = [start_point, end_point]
72
+ link5 = self.netiface.createLink(link_points, 3, "自定义限速路段")
73
+ if link5 is not None:
74
+ # 设置路段限速 km/h
75
+ link5.setLimitSpeed(30)
76
+
77
+ # 创建第六条路段
78
+ start_point = QPointF(m2p(-300), m2p(50))
79
+ end_point = QPointF(m2p(300), m2p(50))
80
+ link_points = [start_point, end_point]
81
+ link6 = self.netiface.createLink(link_points, 3, "动态发车路段")
82
+ if link6 is not None:
83
+ # 设置路段限速 km/h
84
+ link6.setLimitSpeed(80)
85
+
86
+ # 创建第七条路段
87
+ start_point = QPointF(m2p(-300), m2p(75))
88
+ end_point = QPointF(m2p(-250), m2p(75))
89
+ link_points = [start_point, end_point]
90
+ link7 = self.netiface.createLink(link_points, 3)
91
+ if link7 is not None:
92
+ # 设置路段限速 km/h
93
+ link7.setLimitSpeed(80)
94
+
95
+ # 创建第八条路段
96
+ start_point = QPointF(m2p(-50), m2p(75))
97
+ end_point = QPointF(m2p(300), m2p(75))
98
+ link_points = [start_point, end_point]
99
+ link8 = self.netiface.createLink(link_points, 3)
100
+ if link8 is not None:
101
+ # 设置路段限速 km/h
102
+ link8.setLimitSpeed(80)
103
+
104
+ # 创建第一条连接段
105
+ if link3 is not None and link4 is not None:
106
+ from_lane_numbers = [1, 2, 3]
107
+ to_lane_numbers = [1, 2, 3]
108
+ connector1 = self.netiface.createConnector(link3.id(), link4.id(), from_lane_numbers, to_lane_numbers, "连接段1", True)
109
+
110
+ # 创建第二条连接段
111
+ if link4 is not None and link5 is not None:
112
+ from_lane_numbers = [1, 2, 3]
113
+ to_lane_numbers = [1, 2, 3]
114
+ connector2 = self.netiface.createConnector(link4.id(), link5.id(), from_lane_numbers, to_lane_numbers, "连接段2", True)
115
+
116
+ # 创建第三条连接段
117
+ if link7 is not None and link8 is not None:
118
+ from_lane_numbers = [1, 2, 3]
119
+ to_lane_numbers = [1, 2, 3]
120
+ connector3 = self.netiface.createConnector(link7.id(), link8.id(), from_lane_numbers, to_lane_numbers, "动态发车连接段", True)
121
+
122
+ # 重写父类方法:当打开网后TESS NG调用此方法
123
+ def afterLoadNet(self) -> None:
124
+ # 获取路段数
125
+ count = self.netiface.linkCount()
126
+ # 如果路网上没有路段,则调用自定义的创建路网的方法
127
+ if count == 0:
128
+ self.create_network()
129
+
130
+ if self.netiface.linkCount() > 0:
131
+ # 所有路段对象列表
132
+ links = self.netiface.links()
133
+ # ID等于1的路段
134
+ link = self.netiface.findLink(1)
135
+ if link is not None:
136
+ # 路段中心线断点集
137
+ link_points = link.centerBreakPoints()
138
+ print("一条路段中心线断点:", [(p.x(), p.y()) for p in link_points])
139
+ # 路段的车道对象列表
140
+ lanes = link.lanes()
141
+ if lanes is not None and len(lanes) > 0:
142
+ # 第一条车道中心线断点
143
+ lane_points = lanes[0].centerBreakPoints()
144
+ print("一条车道中心线断点:", [(p.x(), p.y()) for p in lane_points])
145
+ # 所有连接段对象列表
146
+ connectors = self.netiface.connectors()
147
+ if len(connectors) > 0:
148
+ # 第一条连接段的所有“车道连接”
149
+ lane_connectors = connectors[0].laneConnectors()
150
+ # 其中第一条“车道连接”
151
+ lane_connector = lane_connectors[0]
152
+ # "车道连接“断点集
153
+ lane_connector_points = lane_connector.centerBreakPoints()
154
+ print("一条'车道连接'中心线断点:", [(p.x(), p.y()) for p in lane_connector_points])
155
+
156
+ # 重写父类方法:是否允许用户对路网元素的绘制进行干预,如选择路段标签类型、确定绘制颜色等,本方法目的在于减少不必要的对python方法调用频次
157
+ def isPermitForCustDraw(self) -> bool:
158
+ """
159
+ :return: 返回值,True表示允许用户对路网元素的绘制进行干预,False表示不允许用户对路网元素的绘制进行干预
160
+ """
161
+ # 获取当前路网文件名
162
+ net_file_name = self.netiface.netFilePath()
163
+ if "Temp" in net_file_name:
164
+ return True
165
+ else:
166
+ return False
167
+
168
+ # 重写父类方法:在绘制路网元素时被调用,确定用ID或名称,以及字体大小绘制标签,也可确定不绘制标签
169
+ def ref_labelNameAndFont(self, itemType, itemId, ref_outPropName, ref_outFontSize) -> None:
170
+ """
171
+ :param itemType: NetItemType常量,代表不同类型路网元素
172
+ :param itemId: 路网元素的ID
173
+ :param ref_outPropName: GraphicsItemPropName枚举类型,None_表示不绘制,ID表示绘制ID,NAME表示绘制名称,影响路段和连接段的标签是否被绘制
174
+ :param ref_outFontSize: 标签大小,单位:米。假设车道宽度是3.5米,如果ref_outFontSize.value等于7,绘制的标签大小占两个车道宽度
175
+ """
176
+ # 如果仿真正在进行,设置ref_outPropName.value等于GraphicsItemPropName.None_,路段和车道都不绘制标签
177
+ if self.simuiface.isRunning():
178
+ ref_outPropName.value = GraphicsItemPropName.None_
179
+ return
180
+ # 默认绘制ID
181
+ ref_outPropName.value = GraphicsItemPropName.Id
182
+ # 标签大小为6米
183
+ ref_outFontSize.value = 6
184
+ # 如果是连接段一律绘制名称
185
+ if itemType == NetItemType.GConnectorType:
186
+ ref_outPropName.value = GraphicsItemPropName.Name
187
+ # 如果是路段,则根据ID判断是否绘制名称
188
+ elif itemType == NetItemType.GLinkType:
189
+ if itemId == 1 or itemId == 5 or itemId == 6:
190
+ ref_outPropName.value = GraphicsItemPropName.Name
191
+
192
+ # 重写父类方法:是否绘制车道中心线
193
+ def isDrawLaneCenterLine(self, lane_id: int) -> bool:
194
+ """
195
+ :param lane_id: 车道ID
196
+ :return: 是否绘制车道中心线,True表示绘制,False表示不绘制
197
+ """
198
+ return True
199
+
200
+ # 重写父类方法:是否绘制路段中心线
201
+ def isDrawLinkCenterLine(self, link_id: int) -> bool:
202
+ """
203
+ :param link_id: 路段ID
204
+ :return: 是否绘制路段中心线,True表示绘制,False表示不绘制
205
+ """
206
+ return link_id != 1
@@ -0,0 +1,51 @@
1
+ import os
2
+ import sys
3
+ from PySide2.QtWidgets import QApplication
4
+ from PySide2.QtGui import Qt
5
+ from tessng import TessPlugin, TessngFactory, tessngIFace
6
+ from MyNet import MyNet
7
+ from MySimulator import MySimulator
8
+
9
+
10
+ # 用户插件,继承自TessPlugin
11
+ class MyPlugin(TessPlugin):
12
+ def __init__(self):
13
+ super().__init__()
14
+ self.my_net = None
15
+ self.my_simulator = None
16
+
17
+ def start(self, config: dict) -> None:
18
+ # 工作空间目录路径
19
+ workspace = os.path.join(os.getcwd(), "WorkSpace")
20
+ config["__workspace"] = workspace
21
+ # 创建文件夹
22
+ os.makedirs(workspace, exist_ok=True)
23
+
24
+ # 创建TESS NG对象
25
+ app = QApplication()
26
+ factory = TessngFactory()
27
+ tessng = factory.build(self, config)
28
+ if tessng is None:
29
+ sys.exit(0)
30
+ else:
31
+ sys.exit(app.exec_())
32
+
33
+ # 过载父类方法:在 TESS NG工厂类创建TESS NG对象时调用
34
+ def init(self) -> None:
35
+ self.my_net = MyNet()
36
+ self.my_simulator = MySimulator()
37
+ # 关联信号和槽函数
38
+ iface = tessngIFace()
39
+ win = iface.guiInterface().mainWindow()
40
+ # 将信号mSimuInf.forReStopSimu关联到主窗体的槽函数doStopSimu,可以安全地停止仿真
41
+ self.my_simulator.forStopSimu.connect(win.doStopSimu, Qt.QueuedConnection)
42
+ # 将信号mSimuInf.forReStartSimu关联到主窗体的槽函数doStartSimu,可以安全地启动仿真
43
+ self.my_simulator.forReStartSimu.connect(win.doStartSimu, Qt.QueuedConnection)
44
+
45
+ # 过载父类方法:返回插件路网子接口,此方法由TESS NG调用
46
+ def customerNet(self):
47
+ return self.my_net
48
+
49
+ # 过载父类方法:返回插件仿真子接口,此方法由TESS NG调用
50
+ def customerSimulator(self):
51
+ return self.my_simulator