从python库生成uml对象

plantuml-creator的Python项目详细描述


从python对象生成plantuml代码的库

示例

diagram1=Diagram(name="Example 1",opts={DiagramOptName.AUTO_NUMBER:True,DiagramOptName.AUTO_NUMBER_START:1,DiagramOptName.ADD_SEPARATORS:True,DiagramOptName.TITLE:"Example 1",},type_=DiagramType.COMPONENT,objs=[Container(name="c1",objs=[Class(name="i1",type_=ClassType.INTERFACE_LOLLIPOP,shape_attrs={ShapeAttributeName.COLOR:Color.RED.value,}),Component(name="A",shape_attrs={ShapeAttributeName.COLOR:Color.LIGHT_BLUE.value,})]),Container(name="c3",objs=[Container(name=" ",objs=[Component(name="F",shape_attrs={ShapeAttributeName.COLOR:Color.LIGHT_GREEN.value,}),],container_type=ContainerShapeType.CLOUD),],),Container(name="c2",objs=[Class(name="i2",type_=ClassType.INTERFACE_LOLLIPOP),Component(name="B",shape_attrs={ShapeAttributeName.COLOR:Color.LIGHT_CORAL.value,}),Component(name="C",shape_attrs={ShapeAttributeName.COLOR:Color.LIGHT_CORAL.value,}),]),Container(name="c4",objs=[Component(name="D",shape_attrs={ShapeAttributeName.COLOR:Color.LIGHT_CYAN.value,}),Component(name="E",),]),Component(name="BD",shape_attrs={ShapeAttributeName.COLOR:Color.SALMON.value,ShapeAttributeName.CONTAINER_SHAPE_TYPE:ContainerShapeType.DATABASE.value},),Component(name="G",shape_attrs={ShapeAttributeName.COLOR:Color.LIGHT_BLUE.value,},),],relations=[# i1Relation(obj1="i1",rel_type=RelationType.Association,obj2="A",orientation=Orientation.DOWN),# ARelation(obj1="A",rel_type=RelationType.Call,obj2="F",orientation=Orientation.DOWN),Relation(obj1="A",rel_type=RelationType.Association,obj2="i2",orientation=Orientation.RIGHT),# i2Relation(obj1="i2",rel_type=RelationType.Call,obj2="B",orientation=Orientation.RIGHT),# BRelation(obj1="B",rel_type=RelationType.Call,obj2="D",orientation=Orientation.DOWN),Relation(obj1="B",rel_type=RelationType.Call,obj2="C",orientation=Orientation.RIGHT),# CRelation(obj1="C",rel_type=RelationType.Call,obj2="E",orientation=Orientation.DOWN),Relation(obj1="C",rel_type=RelationType.Dependency,obj2="BD",orientation=Orientation.DOWN),# DRelation(obj1="D",rel_type=RelationType.Call,obj2="E",orientation=Orientation.RIGHT),# E# EMPTY# FRelation(obj1="F",rel_type=RelationType.Call,obj2="B",orientation=Orientation.UP),# GRelation(obj1="G",rel_type=RelationType.Dependency,obj2="BD",orientation=Orientation.DOWN),],)plantuml_code,got_errors=diagram.gen_code(CodeGenerator.Context(code_style=style))

生成代码:
^{pr2}$
渲染图像

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java未能实例化[org.springframework.web.servlet.HandlerMapping]:工厂方法“resourceHandlerMapping”引发异常;没有ServletContext集   date Java 8–使用时区从LocalDateTime创建即时   带有BigInteger的Java hmacSHA256与C不同#   java线在未最大化时绘制在错误的位置   java错误:数据源拒绝建立连接,来自服务器的消息:“连接太多”   java Beanio:如何根据另一个字段值验证字段?   java SonarQube无法连接到>本地主机/0:0:0:0:0:0:0:1:9000   JavaLucene实现对相关性的自定义评分   排序java。lang.IllegalArgumentException:比较方法违反了它的通用合同java。base/java。util。蒂姆索特。合并崩溃   java处理来自另一个类的按钮按下   java未检测到短电源按钮按下   java需要在另一个具有RecyclerView的活动中使用复选框放置所选(多个)RecyclerView项行   java捆绑包的激活器无效