- 积分
- 5041
- 明经币
- 个
- 注册时间
- 2006-11-9
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2024-5-7 17:11:32
|
显示全部楼层
- ''' <summary>
- ''' Gets the WCS points of the mtext bounding box.
- ''' </summary>
- ''' <param name="mtext">Instance of MText the method applies to.</param>
- ''' <returns>The bounding box points in counterclockwise sense.</returns>
- Public Shared Function GetMTextBoxCorners(mtext As MText) As Point3d()
- Dim width As Double = mtext.ActualWidth
- Dim height As Double = mtext.ActualHeight
- Dim point1 As Point3d, point2 As Point3d
- Select Case mtext.Attachment
- Case AttachmentPoint.TopLeft
- point1 = New Point3d(0.0, -height, 0.0)
- point2 = New Point3d(width, 0.0, 0.0)
- Exit Select
- Case AttachmentPoint.TopCenter
- point1 = New Point3d(-width * 0.5, -height, 0.0)
- point2 = New Point3d(width * 0.5, 0.0, 0.0)
- Exit Select
- Case AttachmentPoint.TopRight
- point1 = New Point3d(-width, -height, 0.0)
- point2 = New Point3d(0.0, 0.0, 0.0)
- Exit Select
- Case AttachmentPoint.MiddleLeft
- point1 = New Point3d(0.0, -height * 0.5, 0.0)
- point2 = New Point3d(width, height * 0.5, 0.0)
- Exit Select
- Case AttachmentPoint.MiddleCenter
- point1 = New Point3d(-width * 0.5, -height * 0.5, 0.0)
- point2 = New Point3d(width * 0.5, height * 0.5, 0.0)
- Exit Select
- Case AttachmentPoint.MiddleRight
- point1 = New Point3d(-width, -height * 0.5, 0.0)
- point2 = New Point3d(0.0, height * 0.5, 0.0)
- Exit Select
- Case AttachmentPoint.BottomLeft
- point1 = New Point3d(0.0, 0.0, 0.0)
- point2 = New Point3d(width, height, 0.0)
- Exit Select
- Case AttachmentPoint.BottomCenter
- point1 = New Point3d(-width * 0.5, 0.0, 0.0)
- point2 = New Point3d(width * 0.5, height, 0.0)
- Exit Select
- Case AttachmentPoint.BottomRight
- point1 = New Point3d(-width, 0.0, 0.0)
- point2 = New Point3d(0.0, height, 0.0)
- Exit Select
- End Select
- Dim xform As Matrix3d = Matrix3d.Displacement(mtext.Location.GetAsVector()) * Matrix3d.Rotation(mtext.Rotation, mtext.Normal, Point3d.Origin) * Matrix3d.PlaneToWorld(New Plane(Point3d.Origin, mtext.Normal))
- Return New Point3d() {point1.TransformBy(xform), New Point3d(point2.X, point1.Y, 0.0).TransformBy(xform), point2.TransformBy(xform), New Point3d(point1.X, point2.Y, 0.0).TransformBy(xform)}
- End Function
|
|