Example #1
0
        /// <summary>
        /// 添加数据记录服务
        /// </summary>
        /// <param name="frMain"></param>
        /// <param name="irn"></param>
        private static void RegisterServices()
        {
            ISimContext isc = SimContext.GetInstance();

            IService isDataRecorder = new DataRecordService(isc);

            isDataRecorder.IsRunning = true;

            IService IPainter = PainterManager.GetService(PaintServiceType.Way, SimController.Canvas);

            IPainter.IsRunning = true;
            foreach (var way in SimController.ISimCtx.RoadNet.Ways)
            {
                foreach (var lane in way.Lanes)
                {
                    lane.AddService(isDataRecorder);
                }

                way.AddService(IPainter);
            }

            IPainter           = PainterManager.GetService(PaintServiceType.XNode, SimController.Canvas);
            IPainter.IsRunning = true;
            foreach (var xnode in SimController.ISimCtx.RoadNet.XNodes)
            {
                xnode.AddService(isDataRecorder);

                xnode.AddService(IPainter);
            }
        }
Example #2
0
 public static SimContext GetInstance()
 {
     if (_simContext == null)
     {
         Mutex mutext = new Mutex();
         mutext.WaitOne();
         _simContext = new SimContext();
         mutext.Close();
         mutext = null;
     }
     return(_simContext);
 }