Hi All
I need help\push again please.
I am trying to Plot the Horizontal Alignment on the screen and declare my variables as follows:
I need help\push again please.
I am trying to Plot the Horizontal Alignment on the screen and declare my variables as follows:
B4X:
[/
Dim ScreenX0, ScreenY0, ScreenW, ScreenH As Float
Dim SheetX0, SheetY0, SheetW, SheetH As Double
Dim ScaleX, ScaleY As Double
Dim PntMinX, PntMaxX, PntMinY, PntMaxY, PntMaxMinX, PntMaxMinY, PntMeanX, PntMeanY As Float
Dim Scaletype As Int : Scaletype = 1 ' 0 = top > down 1 = bottom > up
Dim X, Y As Double
Type Point (X As Double , Y As Double)
Dim PntNbMax As Int : PntNbMax = 500
Dim Pnt(PntNbMax) As Point
'Dim P As Point
Dim Panel2 As Panel
Dim cnvDrawing As Canvas
Dim Label61, Label60 As Label
]
When I want to add data to "Pnt", it tells me that it is Read Only:
[CODE=b4x][/
Sub InitScale
Dim i As Int
ScreenX0 = 5dip
ScreenY0 = 5dip
ScreenW = Panel2.Width - 2 * ScreenX0
ScreenH = Panel2.Height - 2 * ScreenY0
For i = 1 To CGlobals.NumbAlign
[B]Pnt(i-1).X = CGlobals.WK2(1, i + 3500)[/B]
[B]Pnt(i-1).Y = CGlobals.WK2(2, i + 3500)[/B]
Next
PntMinX = CGlobals.WK2(1, i + 3500)
PntMaxX = CGlobals.WK2(1, i + 3500)
PntMinY = CGlobals.WK2(2, i + 3500)
PntMaxY = CGlobals.WK2(2, i + 3500)
For i = 1 To CGlobals.NumbAlign
PntMinX = Min(PntMinX, CGlobals.WK2(1, i + 3500))
PntMaxX = Max(PntMaxX, CGlobals.WK2(1, i + 3500))
PntMinY = Min(PntMinY, CGlobals.WK2(2, i + 3500))
PntMaxY = Max(PntMaxY, CGlobals.WK2(2, i + 3500))
Next
PntMaxMinX = PntMaxX - PntMinX
PntMaxMinY = PntMaxY - PntMinY
PntMeanX = (PntMaxX + PntMinX) / 2
PntMeanY = (PntMaxY + PntMinY) / 2
ScaleX = ScreenW / PntMaxMinX
ScaleY = ScreenH / PntMaxMinY
If ScaleX > ScaleY Then
ScaleX = ScaleY
SheetW = PntMaxMinY * ScreenW / ScreenH
ScaleX = ScaleY
SheetX0 = PntMeanX - SheetW / 2
If Scaletype = 0 Then
SheetY0 = PntMinY
Else
SheetY0 = PntMaxY
ScaleY = -ScaleY
End If
Else
ScaleX = ScaleY
SheetX0 = PntMinX
SheetH = PntMaxMinX * ScreenH / ScreenW
ScaleY = ScaleX
If Scaletype = 0 Then
SheetY0 = PntMeanY - SheetH / 2
Else
ScaleY = -ScaleY
SheetY0 = PntMeanY + SheetH / 2
End If
End If
End Sub
]
Its there were the Code is Bold.
Thanks
Michael