首次提交:本地项目同步到Gitea

This commit is contained in:
zhusenlin
2026-01-24 08:45:54 +08:00
commit 4a6b23db69
256 changed files with 25311 additions and 0 deletions

View File

@@ -0,0 +1,309 @@
@startuml class
class ShapeEle{
.. 属性 ..
+int Id
+float X
+float Y
+float Width
+float Height
+float Angle
+ string VarName
+ string VarValue
- float XAdd
- float YAdd
- float WidthAdd
- float HeightAdd
.. 公开方法 ..
+ Draw(Graphics g)
+ GraphicsPath getGraphicsPath(Matrix matrix)
+ GraphicsPath getGraphicsPathNoOffsetRoute()
+ RectangleF GetBounds()
+ bool isContains(PointF mousePointF)
+ bool isBeContains(RectangleF ract)
+ move()
+ resize()
}
class PointTransform{
.. 属性 ..
float OffsetX
float OffsetY
float Zoom
.. 公开方法 ..
+ PointF TransfromToVirtualPoint(PointF)
+ Matrix GetMatrix()
}
note left of PointTransform
这个是虚拟世界的坐标
跟屏幕上的坐标转换的
end note
class PaperSize{
float PaperWidth
float PaperHeight
float Top
flaot Left
float Right
float Bottom
int Cols
int Rows
float HorizontalIntervalDistance
float VerticalIntervalDistance
ShapeEle Shape
}
PaperSize o-- ShapeEle
note right of PaperSize::Top
模板距离纸张顶部的距离
end note
note right of PaperSize::Left
模板距离纸张左边的距离
end note
note right of PaperSize::Cols
列数
end note
note right of PaperSize::Rows
行数
end note
note right of PaperSize::HorizontalIntervalDistance
模板之间的水平间隔
end note
note right of PaperSize::VerticalIntervalDistance
模板之间的垂直间隔
end note
class Shapes{
.. 属性 ..
+ List<ShapeEle> lstShapes
+ PointTransform PointTransform
+ PaperSize PaperSize
+ Dictionary<string,string> keyvalue
.. 方法 ..
+ShapeEle getSelectShape()
+List<ShapeEle> getSelectShapes()
+Draw(Graphics g, Matrix matrix, bool isShowPaperBack=true)
+int getNextId()
+getShape(int Id)
+ forward(ShapeEle shape)
+ forwardToFront(ShapeEle shape)
+ backward(ShapeEle shape)
+ backwardToEnd(ShapeEle shape)
+ void addGroup(List<ShapeEle> shapes)
- initGraphics(Graphics g)
}
Shapes o-- ShapeEle
Shapes o-- PointTransform
Shapes o-- PaperSize
note right of Shapes::getSelectShape
鼠标点击下取得一个选择的图形,
end note
note right of Shapes::getSelectShapes
鼠标画矩形框下选择的图形。
end note
note right of Shapes::DrawWithPaperBack
绘图,连带纸张的背景。
end note
note right of Shapes::Draw
绘图,不带纸张
end note
note right of Shapes::getNextId
取得下一个可用的id
end note
class ShapeGroup{
-- 属性 --
List<ShapeEle>group
-- 方法 --
+Draw(Graphics g)
+bool isContains(PointF mousePointF)
+bool isBeContains(RactangleF ract)
+move()
+resize()
}
ShapeEle <|-- ShapeGroup
class ShapeLine{
-- 方法 --
+ getGraphicsPath getGraphicsPathNoOffsetRoute()
}
ShapeEle <|-- ShapeLine
class ShapeRectangle{
-- 方法 --
+ getGraphicsPath getGraphicsPathNoOffsetRoute()
}
ShapeEle <|-- ShapeRectangle
class ShapeSelected{
}
ShapeRectangle <|-- ShapeSelected
class ShapeText{
+ string PreText
+ string SuffixText
+ string MidText
}
class UserControlCanvas{
-- 属性 --
+ Shapes Shapes
+ bool isDrawDridding
+ int GriddingInterval
+ bool isAlignGridding
+ ICommandRecorder commandRecorder
+ Dictionary<string,string> Vals
+ ShapeEle SelectShapes
+ State state
+ isShift
-- 方法
- keyDown()
- keyUp()
- MouseDown()
- MouseUp()
- print()
+ Undo()
+ Redo()
}
UserControlCanvas o-- Shapes
UserControlCanvas o-- ShapeGroup
UserControlCanvas o-- ICommandRecorder
UserControlCanvas o-- State
note right of UserControlCanvas::isDrawDridding
显示网格
end note
note right of UserControlCanvas::GriddingInterval
网格间隔
end note
note right of UserControlCanvas::isAlignGridding
对齐网格
end note
note right of UserControlCanvas::print
这里会用到双缓冲BufferedGraphics
首先建立双缓冲,然后提高精度
首先绘制所有的图形
然后绘制虚拟选择框
然后绘制刻度表
最后刷新双缓冲
end note
interface IInvoke{
ExecuteCommand(Command command)
}
interface ICommandRecorder{
addCommand(Command command)
Undo()
Redo()
}
class CommandRecorder{
-- 属性 --
- List<Command>commands
-- 方法 --
addCommand(Command command)
Undo()
Redo()
}
ICommandRecorder <|-- CommandRecorder
abstract class Command {
+ string ID
+Undo()
+Redo()
}
class MoveCommand{
+float oldX
+float oldY
+float newX
+flaot newY
}
Command <|-- MoveCommand
class ResizeCommand{
float oldX
float oldY
float oldWidth
float oldHeight
float newX
flaot newY
float newWidth
float newHeight
}
Command <|-- ResizeCommand
class PropertyChangedCommand{
ShapeEle oldShape
ShapeEle newShape
}
Command <|-- PropertyChangedCommand
abstract class CommandEx{
Shapes Shapes
}
Command <|-- CommandEx
class AddCommand{
float X
float Y
}
CommandEx <|-- AddCommand
class DeleteCommand{
}
CommandEx <|-- DeleteCommand
class ResizeStrategy{
}
abstract class State{
-- 属性 --
- UserControlCanvas canvas
- PointF startPoint
-- 构造函数 --
State(UserControlCanvas canvas, PointF startPoint)
-- 方法 --
+ keyDown()
+ keyup()
+ LeftMouseDown()
+ LeftMouseMove()
+ LeftMouseUp()
+ rightMouse()
}
class StateStandby{
}
State <|-- StateStandby
class StateCreate{
}
State <|-- StateCreate
class StateSelected{
}
State <|-- StateSelected
class StateRectSelected{
}
State <|-- StateRectSelected
@enduml

View File

@@ -0,0 +1,23 @@
@startuml MouseDown
'' MouseDown
start
: 保存鼠标在虚拟空间的坐标;
if (鼠标左键) then (yes)
if (是否在已经选择框内) then (yes)
if (是否在四周的点上) then (yes)
: 四周方向改变大小;
elseif (是否在四周的线上) then (yes)
: 向8方改变大小;
else (nothing)
: 移动图形模式;
endif
else (no)
if (是否在某个图形内) then (yes)
: 将这个设置成已选择形状;
else (no)
: 画矩阵多选模式;
endif
endif
endif
stop
@enduml

View File

@@ -0,0 +1,16 @@
@startuml MouseMove
'' MouseMove
start
: 取得这个点在虚拟世界的坐标;
: 计算现在坐标跟原先坐标的偏移;
if (状态是移动) then (yes)
: 发送移动事件;
elseif (状态是四面扩展) then (yes)
: 发送四面扩展事件;
elseif (状态是8方扩展) then (yes)
: 发送8方扩展事件;
elseif (状态是矩形选择) then (yes)
: 矩形选择绘图;
endif
stop
@enduml

View File

@@ -0,0 +1,17 @@
@startuml MouseUp
start
: 取得这个点在虚拟世界的坐标;
: 计算现在坐标跟原先坐标的偏移;
if (状态是移动) then (yes)
: 记录移动事件;
elseif (状态是四面扩展) then (yes)
: 记录四面扩展事件;
elseif (状态是8方扩展) then (yes)
: 记录8方扩展事件;
elseif (状态是矩形选择) then (yes)
: 记录选择绘图;
endif
stop
@enduml

304
LibShapes/UML/class.puml Normal file
View File

@@ -0,0 +1,304 @@
@startuml class
class ShapeEle{
.. 属性 ..
+int Id
+float X
+float Y
+float XAdd
+float YAdd
+float Width
+float Height
+float Angle
+ string VarName
+ string VarValue
.. 公开方法 ..
+ Draw(Graphics g)
+ GraphicsPath getGraphicsPath()
+ getGraphicsPath getGraphicsPathNoOffsetRoute()
+ RectangleF GetBounds()
+ bool isContains(PointF mousePointF)
+ bool isContains(RactangleF ract)
+ move()
+ resize()
}
class PointTransform{
.. 属性 ..
float OffsetX
float OffsetY
float Zoom
.. 公开方法 ..
+PointF TransfromToVirtualPoint(PointF)
}
note left of PointTransform
这个是虚拟世界的坐标
跟屏幕上的坐标转换的
end note
class PaperSize{
float PaperWidth
float PaperHeight
float Top
flaot Left
float Right
float Bottom
int Cols
int Rows
float HorizontalIntervalDistance
float VerticalIntervalDistance
ShapeEle Shape
}
PaperSize o-- ShapeEle
note right of PaperSize::Top
模板距离纸张顶部的距离
end note
note right of PaperSize::Left
模板距离纸张左边的距离
end note
note right of PaperSize::Cols
列数
end note
note right of PaperSize::Rows
行数
end note
note right of PaperSize::HorizontalIntervalDistance
模板之间的水平间隔
end note
note right of PaperSize::VerticalIntervalDistance
模板之间的垂直间隔
end note
class Shapes{
.. 属性 ..
+ List<ShapeEle> lstShapes
+ PointTransform PointTransform
+ PaperSize PaperSize
+ Dictionary<string,string> keyvalue
.. 方法 ..
+ShapeEle getSelectShape()
+List<ShapeEle> getSelectShapes()
+DrawWithPaperBack(Graphics g, Transfrom trans)
+Draw(Graphics g, Transfrom trans)
+int getNextId()
+ forward(ShapeEle shape)
+ forwardToFront(ShapeEle shape)
+ backward(ShapeEle shape)
+ backwardToEnd(ShapeEle shape)
+ ShapeGroup addGroup(List<ShapeEle> shapes)
}
Shapes o-- ShapeEle
Shapes o-- PointTransform
Shapes o-- PaperSize
note right of Shapes::getSelectShape
鼠标点击下取得一个选择的图形,
end note
note right of Shapes::getSelectShapes
鼠标画矩形框下选择的图形。
end note
note right of Shapes::DrawWithPaperBack
绘图,连带纸张的背景。
end note
note right of Shapes::Draw
绘图,不带纸张
end note
note right of Shapes::getNextId
取得下一个可用的id
end note
class ShapeGroup{
-- 属性 --
List<ShapeEle>group
-- 方法 --
+Draw(Graphics g, Transfrom trans)
+bool isContains(PointF mousePointF)
+bool isContains(RactangleF ract)
+move()
+resize()
}
ShapeEle <|-- ShapeGroup
class ShapeLine{
-- 属性 --
List<ShapeEle>group
-- 方法 --
+ Draw(Graphics g, Transfrom trans)
+ getGraphicsPath getGraphicsPathNoOffsetRoute()
+bool isContains(PointF mousePointF)
+bool isContains(RactangleF ract)
}
ShapeEle <|-- ShapeLine
class ShapeSelected{
+ Draw(Graphics g, Transfrom trans)
}
ShapeEle <|-- ShapeSelected
class ShapeText{
+ string PreText
+ string SuffixText
+ string MidText
}
class UserControlCanvas{
-- 属性 --
+ Shapes Shapes
+ bool isDrawDridding
+ int GriddingInterval
+ bool isAlignGridding
- ICommandRecorder commandRecorder
- Dictionary<string,string> keyvalue
- ShapeGroup SelectShapes
- State state
-- 方法
- keyDown()
- keyUp()
- MouseDown()
- MouseUp()
- print()
+ Undo()
+ Redo()
+ setVals(Dictionary<string,string> vals)
}
UserControlCanvas o-- Shapes
UserControlCanvas o-- ShapeGroup
UserControlCanvas o-- ICommandRecorder
UserControlCanvas o-- State
note right of UserControlCanvas::isDrawDridding
显示网格
end note
note right of UserControlCanvas::GriddingInterval
网格间隔
end note
note right of UserControlCanvas::isAlignGridding
对齐网格
end note
note right of UserControlCanvas::print
这里会用到双缓冲BufferedGraphics
首先建立双缓冲,然后提高精度
首先绘制所有的图形
然后绘制虚拟选择框
然后绘制刻度表
最后刷新双缓冲
end note
interface IInvoke{
ExecuteCommand(Command command)
}
interface ICommandRecorder{
addCommand(Command command)
Undo()
Redo()
}
class CommandRecorder{
-- 属性 --
- List<Command>commands
-- 方法 --
addCommand(Command command)
Undo()
Redo()
}
ICommandRecorder <|-- CommandRecorder
abstract class Command {
ShapeEle Shape
+Undo()
+Redo()
}
class MoveCommand{
float oldX
float oldY
float newX
flaot newY
}
Command <|-- MoveCommand
class ResizeCommand{
float oldX
float oldY
float oldWidth
float oldHeight
float newX
flaot newY
float newWidth
float newHeight
}
Command <|-- ResizeCommand
class PropertyChangedCommand{
ShapeEle oldShape
ShapeEle newShape
}
Command <|-- PropertyChangedCommand
abstract class CommandEx{
Shapes Shapes
}
Command <|-- CommandEx
class AddCommand{
float X
float Y
}
CommandEx <|-- AddCommand
class DeleteCommand{
}
CommandEx <|-- DeleteCommand
class ResizeStrategy{
}
abstract class State{
-- 属性 --
- UserControlCanvas canvas
- PointF startPoint
-- 构造函数 --
State(UserControlCanvas canvas, PointF startPoint)
-- 方法 --
+ keyDown()
+ keyup()
+ LeftMouseDown()
+ LeftMouseMove()
+ LeftMouseUp()
+ rightMouse()
}
class StateStandby{
}
State <|-- StateStandby
class StateCreate{
}
State <|-- StateCreate
class StateSelected{
}
State <|-- StateSelected
class StateRectSelected{
}
State <|-- StateRectSelected
@enduml

44
LibShapes/UML/state.puml Normal file
View File

@@ -0,0 +1,44 @@
@startuml state
[*] --> 鼠标左键按下
鼠标左键按下 --> 创建模式 : 在工具栏选择了一个图形
state 创建模式{
创建图形中鼠标移动 --> 创建图形中鼠标弹起
创建图形中鼠标弹起 --> [*]
创建图形中鼠标弹起 : 记录操作命令
}
state 矩形选择模式{
鼠标左键按下 : 记录鼠标位置
鼠标左键按下 --> 矩形选择起始 : 原先没有选择图形,这次也没有
矩形选择起始 --> 矩形选择中鼠标移动
矩形选择中鼠标移动 --> 矩形选择中鼠标弹起
矩形选择中鼠标弹起 : 记录操作命令
矩形选择中鼠标弹起 --> [*]
}
鼠标左键按下 --> 修改模式 : 原先选择了一个图形,且这次在这个图形上
state 修改模式{
移动状态 --> 鼠标移动
更改大小状态 --> 鼠标移动
鼠标移动 --> 鼠标弹起
}
鼠标左键按下 --> 选择模式 : 原先没有选择,现在选择一个
state 选择模式{
选择图形后鼠标弹起 --> [*]
}
鼠标弹起 --> [*]
鼠标弹起 : 这个要保存命令记录
state 放大缩小模式{
放大2倍 --> [*]
}
鼠标左键按下 --> 放大缩小模式
@enduml

14
LibShapes/UML/state2.puml Normal file
View File

@@ -0,0 +1,14 @@
@startuml 状态图
[待机状态] --> [选择状态] : 原先没有选择图形,现在选择了一个
[选择状态] --> [更改状态] : 在这个选择的内部
[更改状态] --> [更改状态] : 可以多次更改
[更改状态] --> [待机状态] : 单机和矩形都没选择
[待机状态] --> [矩形选择状态] :当前没有选择
[矩形选择状态] --> [选择状态] : 这个矩形框内有形状
[创建形态] --> [选择状态]
@enduml

View File

@@ -0,0 +1,42 @@
@startuml UseCase
left to right direction
actor User
rectangle 编辑图形 {
usecase "鼠标左键选择某个图形" as edit1
usecase "鼠标左键更改某个图形的大小" as edit2
usecase "鼠标左键更改某个图形的位置" as edit3
usecase "手动更改某个图形的某个属性" as edit4
}
User --> edit1
User --> edit2
User --> edit3
User --> edit4
rectangle 创建图形{
usecase "选择要创建的是什么图形" as create1
usecase "自定义创建的图形的大小" as create2
}
User --> create1
User --> create2
rectangle 整体操作{
usecase "读取文件" as total1
usecase "保存文件" as total2
usecase "放大屏幕" as total3
usecase "移动屏幕" as total4
usecase "Undo" as total5
usecase "Redo" as total6
}
total1 <-- User
total2 <-- User
total3 <-- User
total4 <-- User
total5 <-- User
total6 <-- User
@enduml