예제 #1
0
    /* Benchmark */
    public void OnFloatTest()
    {
        string serialized = BUtils.SerializeObject(new BEHandle <int>(counter));

        LogConsole(serialized);
        //BUtils.DeserializeObject<BAnchorInformation>(serialized);

        BEventsCollection.TEST_FloatTest.Invoke(new BEHandle <float>(BUtils.GetTimeAsInt()), BEventReplicationType.TO_ALL, true);
    }
예제 #2
0
 private void initUI()
 {
     listRouter.Items.Clear();
     foreach (var value in Routers)
     {
         if (BUtils.isNotNull(value.Value.Stations1) && value.Value.Stations1.Count != 0)
         {
             listRouter.Items.Add(value.Value.RouterId + "_0");
         }
         if (BUtils.isNotNull(value.Value.Stations2) && value.Value.Stations2.Count != 0)
         {
             listRouter.Items.Add(value.Value.RouterId + "_1");
         }
     }
 }
예제 #3
0
        public bool addPath(int stationA, int stationB)
        {
            if (!_busData.Stations.ContainsKey(stationA) || !_busData.Stations.ContainsKey(stationB))
            {
                return(false);
            }
            Vertex vertA = checkAndAddVertex(stationA);
            Vertex vertB = checkAndAddVertex(stationB);

            string      pathId = BUtils.generatePathId(stationA, stationB);
            Edge        edge   = checkAndAddEdge(pathId);
            StationPath path   = _busData.getStationPath(pathId);

            edge.Target = vertB;
            edge.Weight = path.Distance;
            addEdgeToVertex(edge, vertA);

            return(true);
        }
예제 #4
0
        public bool addRouterAtStation(int routerId, int stationId, int turn)
        {
            if (!_busData.Routers.ContainsKey(routerId) ||
                !_busData.Stations.ContainsKey(stationId) ||
                !BUtils.isValidTurn(turn))
            {
                return(false);
            }

            List <int> stations = _busData.Routers[routerId].getStations(turn);
            bool       check    = false;

            for (int i = 0; i < stations.Count - 1; i++)
            {
                if (check || stations[i] == stationId)
                {
                    addPath(stations[i], stations[i + 1]);
                    check = true;
                }
            }
            return(true);
        }
예제 #5
0
 private void showTreePathAtStation(List <int> stationIds, int deep, List <int> visitedRouters)
 {
     if (deep <= 0)
     {
         return;
     }
     for (int j = 0; j < stationIds.Count; j++)
     {
         int     stationId = stationIds[j];
         Station station   = Stations[stationId];
         for (int i = 0; i < station.Routers.Count; i++)
         {
             int routerId = station.Routers[i];
             //if (visitedRouters.Contains(routerId))
             //    continue;
             visitedRouters.Add(routerId);
             Color color = BUtils.randomColor();
             drawRouterAtStation(routerId, stationId, color);
         }
         showTreePathAtStation(stationIds, --deep, visitedRouters);
     }
 }
예제 #6
0
        private void drawStationPath(List <int> stationIds, Color color, GMapOverlay overlay)
        {
            List <PointLatLng> list = new List <PointLatLng>();
            int preStation          = 0;

            for (int i = 0; i < stationIds.Count; i++)
            {
                int station = stationIds[i];
                if (preStation == 0)
                {
                    preStation = station;
                }
                else
                {
                    string key = BUtils.generatePathId(preStation, station);
                    if (!StationPaths.ContainsKey(key))
                    {
                        preStation = station;
                        continue;
                    }
                    StationPath    path   = StationPaths[key];
                    List <LatLong> points = path.Path;
                    for (int j = 0; j < points.Count; j++)
                    {
                        LatLong     point = points[j];
                        PointLatLng pont1 = new PointLatLng(point.Latitude, point.Longitude);
                        list.Add(pont1);
                    }
                    preStation = station;
                }
            }

            GMapRoute routers = new GMapRoute(list, "polygon");

            routers.Stroke       = new Pen(color);
            routers.Stroke.Width = 5;
            overlay.Routes.Add(routers);
        }
예제 #7
0
 public void OnIncrementToAll()
 {
     LogConsole("OnIncrementToAll : <color=red>[" + BUtils.GetTimeAsString() + "] </color>");
     BEventsCollection.TEST_CounterIncrement.Invoke(new BEHandle <int>(counter), BEventReplicationType.TO_ALL, true);
 }
예제 #8
0
 private void On_TEST_ObjectTest(BEHandle <BallDroneBAnchor> handle)
 {
     LogConsole("On_TEST_ObjectTest : " + BUtils.GetTimeAsString());
 }
예제 #9
0
 private void On_TEST_Vector3Test(BEHandle <Vector3> handle)
 {
     LogConsole("On_TEST_Vector3Test : " + BUtils.GetTimeAsString());
 }
예제 #10
0
 private void On_TEST_FloatTest(BEHandle <float> handle)
 {
     LogConsole("On_TEST_FloatTest : " + BUtils.GetTimeAsString());
 }