Esempio n. 1
0
        public void UpdateInfo(
            SlamPackage package,
            ICloudObjectsContainer <SlamPoint> pointsMap,
            ICloudObjectsContainer <SlamObservation> graph)
        {
            listBoxWithSpecializedObjects.Clear();
            if (package == null)
            {
                commonIformation.text = "";
                return;
            }

            commonIformation.text = package.ToString();

            SlamPoint[] specialPts          = package.Points.Where(p => p.id != -1).Where(p => p.message != null).ToArray();
            Vector3[]   ptsPositionsFromMap = specialPts.Select(p => pointsMap[p].position).ToArray();

            SlamObservation[] specialObs = package.Observations
                                           .Where(o => o.Point.id != -1)
                                           .Where(o => o.Point.message != null)
                                           .ToArray();
            Vector3[] obsPositionsFromMap = specialObs.Select(o => graph[o].Point.position).ToArray();

            for (int i = 0; i < specialPts.Length; ++i)
            {
                var item = listBoxWithSpecializedObjects.Add() as SpecialInfoListBoxItem;
                item.SetObject(specialPts[i].id, specialPts[i].ToString(), ptsPositionsFromMap[i], specialPts[i].message);
            }
            for (int i = 0; i < specialObs.Length; ++i)
            {
                var item = listBoxWithSpecializedObjects.Add() as SpecialInfoListBoxItem;
                item.SetObject(specialObs[i].Point.id, specialObs[i].ToString(), obsPositionsFromMap[i], specialObs[i].Point.message);
            }
        }
        public static void Test(
            SlamPackage package,
            IEnumerable <SlamPoint> objects,
            string messageTemplate)
        {
            var objArray = objects.ToArray();

            if (objArray.Length != 0)
            {
                ElektronikLogger.Log(package.ToString(), "", LogType.Error);
                foreach (var obj in objArray)
                {
                    string msg = String.Format(messageTemplate, obj.id, obj.isNew, obj.isRemoved);
                    ElektronikLogger.Log(msg, "", LogType.Error);
                }
            }
        }