public static List <TerrorismDataPoint> LoadDataPointsFromPreprocess(string preprocessedDataPath) { List <TerrorismDataPoint> ret = new List <TerrorismDataPoint>(); XmlDocument doc = new XmlDocument(); doc.Load(preprocessedDataPath); foreach (XmlElement node in doc.DocumentElement.ChildNodes) { TerrorismDataPoint point = TerrorismDataPoint.FromXml(node); ret.Add(point); } return(ret); }
private static BufferPoint ToBufferPoint(TerrorismDataPoint dataPoint, long start, long end) { float normalizedLat = (dataPoint.Lat + 90f) / 180f; float normalizedLong = (dataPoint.Long + 180f) / 360f; float attackSource = ToAttackSourceWeight(dataPoint.AttackSource); float normalizedTime = (float)((double)(dataPoint.Time.Ticks - start) / (end - start)); Vector2 pos = new Vector2(normalizedLat, normalizedLong); int foreignKills = (int)((double)dataPoint.Deaths * attackSource); int domesticKills = (int)((double)dataPoint.Deaths * (1 - attackSource)); return(new BufferPoint() { Pos = pos, ForeignKills = foreignKills, DomesticKills = domesticKills, Time = normalizedTime }); }
public static List <TerrorismDataPoint> LoadDataPointsFromSource(string dataSourcePath) { System.IO.StreamReader file = new System.IO.StreamReader(dataSourcePath); string line; List <TerrorismDataPoint> ret = new List <TerrorismDataPoint>(); file.ReadLine(); // Skipping the header line while ((line = file.ReadLine()) != null) { TerrorismDataPoint dataPoint = TerrorismDataPoint.LoadFromSource(line); if (dataPoint.Deaths > 0) { ret.Add(dataPoint); } } file.Close(); return(ret); }