File "pin.cls"
Full Path: /home/analogde/www/DEV3/pin.cls
File size: 3.98 KB
MIME-type: text/plain
Charset: 8 bit
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "Broche"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
' la classe broche
Private BROCHE_ID As Long
Private BROCHE_Etat As Long
Private BROCHE_Type As String
Private BROCHE_Orientation As String
Private BROCHE_Position(1) As Integer
Private BROCHE_Gravite(1) As Integer
Public Function SetPosition_BROCHE(ByVal X As Integer, ByVal Y As Integer, Optional ByVal Gravite_Pos_X As Integer, Optional ByVal Gravite_Pos_Y As Integer)
' dfini la position
BROCHE_Position(0) = X
BROCHE_Position(1) = Y
' dfini la position du point de gravite
If IsNumeric(Gravite_Pos_X) Then BROCHE_Gravite(0) = Gravite_Pos_X
If IsNumeric(Gravite_Pos_Y) Then BROCHE_Gravite(1) = Gravite_Pos_Y
End Function
Public Function GetID_BROCHE() As Long
' recupere l'ID
GetID_BROCHE = BROCHE_ID
End Function
Public Function GetOrientation_BROCHE() As String
' recupere l'orientation
GetOrientation_BROCHE = BROCHE_Orientation
End Function
Public Function GetPosition_BROCHE(ByRef PosX As Integer, ByRef PosY As Integer, Optional ByRef Gravite_Pos_X As Integer, Optional ByRef Gravite_Pos_Y As Integer)
' recupere la position
If IsNumeric(PosX) Then PosX = BROCHE_Position(0)
If IsNumeric(PosY) Then PosY = BROCHE_Position(1)
' recupere la position du point de gravite
If IsNumeric(Gravite_Pos_X) Then Gravite_Pos_X = BROCHE_Gravite(0)
If IsNumeric(Gravite_Pos_Y) Then Gravite_Pos_Y = BROCHE_Gravite(1)
End Function
Public Function GetNbEntree(Optional ByRef EtatEntrees As Variant) As Long
' recupere le nombre d'entrees et leurs etats
If IsArray(EtatEntrees) Then
' ReDim EtatEntrees(m_NbEntree - 1)
For i = 0 To m_NbEntree - 1
EtatEntrees(i) = m_Entrees(i).Etat
Next i
End If
GetNbEntree = m_NbEntree
End Function
Public Function SetEntreeParPin(pin As Long, Etat As Long)
' defini l'etat
If m_Entrees(pin).Parent = -1 Then
m_Entrees(pin).Etat = Etat
tmp = CalculEtat()
For i = 0 To NBGates - 1
If GatesStatus(i) = 1 Then tmp = Gates(i).SetEntree(m_ID, m_Etat)
Next i
Else
MsgBox "Impossible de modifier l'etat d'entree, un parent existe!"
End If
End Function
Public Function SetParent(NumPin As Long, Parent As Long)
' on defini un nouveau parent
m_Entrees(NumPin).Parent = Parent
End Function
Public Function GetParent(ByVal NumPin As Long)
' on renvoi le parent
GetParent = m_Entrees(NumPin).Parent
End Function
Public Function GetEtat_BROCHE() As Long
' on renvoie l'etat
GetEtat_BROCHE = BROCHE_Etat
End Function
Public Function GetType_BROCHE() As String
' on renvoie le type
GetType_BROCHE = BROCHE_Type
End Function
Public Function SetParametres_BROCHE(Type_BROCHE As String, ID As Long, PosX, PosY, Type_Orientation As String)
' on defini les parametres (initialisation)
BROCHE_Type = Type_BROCHE
BROCHE_Orientation = Type_Orientation
' etat par defaut
BROCHE_Etat = 0 '
If BROCHE_Type = "BROCHE" Or Type_BROCHE = "BROCHE2" Or Type_BROCHE = "BROCHE2" Or Type_BROCHE = "BROCHE2" Then m_Etat = 1
BROCHE_ID = ID
BROCHE_Position(0) = PosX
BROCHE_Position(1) = PosY
End Function
Public Function Charge_BROCHE(ID As Long, PorteType As String, NbEntrees As Long, PinParents() As Long, PinEtat() As Long, PosX As Integer, PosY As Integer, PinPos() As Integer, SortiePosX As Integer, SortiePosY As Integer)
' fonction globale pour charger une porte a partir d'une sauvegarde
Dim i As Long
tmp = Me.SetParametres(PorteType, NbEntrees, ID, PosX, PosY)
For i = 0 To NbEntrees - 1
tmp = Me.SetParent(i, PinParents(i))
tmp = Me.SetPinEtat(i, PinEtat(i))
Next i
tmp = Me.SetPosition(PosX, PosY, SortiePosX, SortiePosY)
End Function