private void FillTrackingDataUserChoice(ITracking data, TrackingData history, bool updateCache = true)
{
bool fixMovementValue = false;
foreach (string field in _fieldsUse)
{
/* Fix Movement before to update data cache */
if (field == MD.CloudConnect.FieldDefinition.MVT_STATE.Key && _fixMoving)
{
fixMovementValue = IsInMovement(data, history);
if (data.ContainsField(MD.CloudConnect.FieldDefinition.MVT_STATE.Key))
data.IsMoving = fixMovementValue;
else if (history.ContainsField(MD.CloudConnect.FieldDefinition.MVT_STATE.Key))
history.IsMoving = fixMovementValue;
}
/* End Fix Movement*/
if (data.ContainsField(field))
{
if (updateCache)
{
UpdateCache(history, field, data);
}
}
else
{
if (history.fields.ContainsKey(field))
((TrackingData)data).fields.Add(field, history.fields[field]);
else
((TrackingData)data).fields.Add(field, new Field());
}
}
if (((TrackingData)data).location == null)
{
((TrackingData)data).location = (double[])history.location.Clone();
}
else
{
history.location[0] = data.Longitude;
history.location[1] = data.Latitude;
}
}