public interface Renderer
核心渲染接口,定义所有渲染器必须实现的方法。
setStyle(String stroke, String fill, int width)
: 设置绘制样式drawCircle(int x, int y, int radius)
: 绘制圆形drawRectangle(int x, int y, int width, int height)
: 绘制矩形drawTriangle(int x1, int y1, int x2, int y2, int x3, int y3)
: 绘制三角形drawEllipse(int x, int y, int width, int height)
: 绘制椭圆getContext()
: 获取渲染上下文public class SwingRenderer implements Renderer
基于Swing的渲染器实现。
setGraphics()
设置绘图上下文public class SVGRenderer implements Renderer
SVG格式输出渲染器。
public interface Shape
图形对象基础接口。
render(Renderer renderer)
: 使用指定渲染器绘制move(int dx, int dy)
: 移动图形accept(ExportVisitor visitor)
: 访问者模式支持public class GlobalConfig
全局配置管理单例,使用双重检查锁定保证线程安全。
getInstance()
: 获取单例实例getRenderMode()
: 获取当前渲染模式(“swing”/“svg”/“legacy”)setRenderMode(String mode)
: 设置渲染模式loadConfig()
: 从文件/系统属性加载配置public class UndoManager
撤销/重做管理器,使用栈结构保存命令历史。
executeCommand(Command cmd)
: 执行并记录命令undo()
: 撤销上一步操作redo()
: 重做上一步撤销setMaxHistorySize(int)
: 设置最大历史记录数public class PersistenceManager
图形持久化管理单例,使用Gson处理JSON序列化。
saveShapesToFile(List<Shape>, String)
: 保存图形列表到文件loadShapesFromFile(String)
: 从文件加载图形列表public class LegacyRendererAdapter implements Renderer
旧版渲染器适配器。
public class RemoteRendererProxy implements Renderer
远程渲染代理。