修改代码

master
bettleChen 1 year ago
parent 926d890fc5
commit b8a61ebfc1

@ -2,7 +2,7 @@
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="jdk" jdkName="Python 3.9 (NetworkAnalog)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (StuSystem)" project-jdk-type="Python SDK" />
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (NetworkAnalog)" project-jdk-type="Python SDK" />
</project>

@ -12,7 +12,13 @@ from SimObjs import SimPacket, SimHost, AllSimConnect, SimRouter, SimSwitch, Sim
from dbUtil import search, execute_sql, delete_obj, truncate_db
def round_rectangle(cv, x1, y1, x2, y2, radius=25, **kwargs):
def round_rectangle(cv, x1, y1, x2, y2, radius=30, **kwargs):
"""
绘制圆角矩形
:param cv: canvas对象
:param radius: 圆角值
:return:
"""
points = [x1 + radius, y1,
x1 + radius, y1,
x2 - radius, y1,

Binary file not shown.

@ -0,0 +1,63 @@
class AllSimConnect():
# todo: 连接类
def __init__(self, nodex, nodex_ifs, nodey, nodey_ifs, config=None):
"""
连接对象
:param nodex: 节点
:param nodex_ifs: 节点接口
:param nodey: 节点
:param nodey_ifs: 节点接口
"""
self.ConfigCorrect = 0 if config is None else config
self.NobjS = nodex
self.NobjE = nodey
self.IfsS = nodex_ifs
self.IfsE = nodey_ifs
class SimHost():
"""
主机类
"""
def __init__(self, x=0, y=0, id=None, config=None, label=None):
self.ObjID = id
self.ObjType = 1
self.ObjLabel = label
self.interface = []
self.connections = []
class SimRouter():
"""
路由类
"""
def __init__(self, x=0, y=0, id=None, config=None, label=None, *args):
self.ObjID = id
self.ObjType = 2
self.ObjLabel = label
self.router_table = {}
class SimSwitch():
"""
交换机类
"""
def __init__(self, x=0, y=0, id=None, config=None, label=None, *args):
self.ObjID = id
self.ObjType = 3
self.ObjLabel = label
self.mac_table = {}
class SimHub():
"""
集线器类
"""
def __init__(self, x=0, y=0, id=None, config=None, label=None, *args):
self.ObjID = str() if id is None else id
self.ObjType = 4
self.ObjLabel = label
if __name__ == '__main__':
AllSimObj = []
host1 = SimHost()
AllSimObj.append(host1)
router = SimRouter()
AllSimObj.append(router)
connect = AllSimConnect(host1, 1, router, 1)
Loading…
Cancel
Save