<!--
Class Gauge
Private msID' As String
Private msNodeQuery' As String
Private mnValueTo 'to get to
Private msPropertyName' As String
Private moValueObject' As Object
Private moAnimateObject' As Object
Private mvarConversion
Private mfIsCompass' As Boolean ' to use degree  diff or not

Property Let IsCompass(f) ' As Boolean
mfIsCompass = f
End Property
Property Set AnimateObject(o)' As Object
Set moAnimateObject = o
End Property
Property Set ValueObject(o)' As Object
Set moValueObject = o
End Property
Property Let Conversion(varConversion)
mvarConversion = varConversion
End Property
Property Let ID(sID)' As String
msID = sID
if mvarConversion=0 then 'just a place to initialise this
	mvarConversion = 1
end if
End Property
Property Get ID()' As String
ID = msID
End Property
Property Let NodeQuery(sNodeQuery)'  As String
msNodeQuery = sNodeQuery
End Property
Property Let PropertyName(sPropertyName) ' As String
msPropertyName = sPropertyName
End Property


Sub SetInterval(nInterval)
If not isnumeric(nInterval) Then Exit Sub
If Not moAnimateObject Is Nothing Then
    'if 1 second, duration = 1,otherwise slow down
    If nInterval = 1 Then
        AnimateValue("dur") = "1"
    Else
        AnimateValue("dur") = "5"
    End If
End If
End Sub

Sub NewData(oDom)  'As DOMDocument
Dim oNode' As IXMLDOMNode
Set oNode = oDom.selectSingleNode(msNodeQuery)
If Not oNode Is Nothing Then
    NewDataValue (oNode.Text)
End If

End Sub

Sub NewDataValue(varValue) ' As DOMDocument
Dim varTempDiff
''On Error Resume Next
if not isempty(mvarConversion) then
	mnValueTo = (varValue) * mvarConversion
Else
	mnValueTo=(varValue)
end if
If moAnimateObject Is Nothing Then
	Value = mnValueTo
Else 'animate:        
	If mfIsCompass Then 'make it go the shortest way
		moAnimateObject.endElement
        'nb Value not available directly (0)
        varTempDiff = DegreesDiff(AnimateValue("to"), mnValueTo)        
        AnimateValue("from") = AnimateValue("to")
        AnimateValue("to") = AnimateValue("from") + varTempDiff
        moAnimateObject.beginElement
    Else
        moAnimateObject.endElement
        AnimateValue("from") = AnimateValue("to")
        AnimateValue("to") = mnValueTo
        moAnimateObject.beginElement
    End If
End If
End Sub
Property Get AnimateValue(strProperty)' As String
Select Case strProperty
	Case "from"
	AnimateValue=moAnimateObject.from
	Case "to"
		AnimateValue=moAnimateObject.to
	Case else
		Execute "AnimateValue=moAnimateObject" & "." & strProperty
end select
End Property
Property Let AnimateValue(strProperty, varValue)
Select Case strProperty
	Case "from"
		moAnimateObject.from=varValue
	Case "to"
		moAnimateObject.to=varValue
	Case else
		Execute "moAnimateObject" & "." & strProperty & "=CStr(varValue)"
end select


End Property

Property Get Value()
'Value = CallByName(moValueObject, msPropertyName, VbGet)
Select Case msPropertyName
	Case "rotation"
		Value=moValueObject.rotation
	Case else
		Execute "Value=moValueObject" & "." & msPropertyName
end select


End Property
Property Let Value(varValue)
'CallByName moValueObject, msPropertyName, VbLet, CStr(varValue)
Select Case msPropertyName
	Case "rotation"
		moValueObject.rotation=varValue	
	case "innerHTML"
		moValueObject.innerHTML=varValue	
	Case else
		'nqr
		if isnumeric(varValue) then
			Execute "moValueObject" & "." & msPropertyName & "=" & varValue
		else
			Execute "moValueObject" & "." & msPropertyName & "='" & varValue & "'"
		end if
		
end select
End Property

'Sub Update()
'Dim varCurr
'varCurr = Value
'If Not moAnimateObject Is Nothing Then
'    'animate
'    'end element?
'End If

'Value = mnValueTo

'End Sub


	Function HelloWorld()
		HelloWorld="HelloWorld"
	end function
end Class
-->