Beispiel #1
0
        public void redrawLine()
        {
            ushort        lineID       = lineInfoPanel.lineIdSelecionado.TransportLine;
            TransportLine t            = lineInfoPanel.controller.tm.m_lines.m_buffer[(int)lineID];
            int           stopsCount   = t.CountStops(lineID);
            int           vehicleCount = t.CountVehicles(lineID);
            Color         lineColor    = lineInfoPanel.controller.tm.GetLineColor(lineID);

            setLinearMapColor(lineColor);
            clearStations();
            String bgSprite;

            ItemClass.SubService ss = TLMLineUtils.getLineNamingParameters(lineID, out prefix, out sep, out suffix, out nonPrefix, out zerosEsquerda, out invertPrefixSuffix, out bgSprite).subService;
            linearMapLineNumberFormat.backgroundSprite = bgSprite;


            bool day, night, zeroed;

            TLMLineUtils.getLineActive(ref t, out day, out night, out zeroed);
            if (zeroed)
            {
                linearMapLineTime.backgroundSprite = "NoBudgetIcon";
            }
            else
            {
                if (!day || !night)
                {
                    linearMapLineTime.backgroundSprite = day ? "DayIcon" : night ? "NightIcon" : "DisabledIcon";
                }
                else
                {
                    linearMapLineTime.backgroundSprite = "";
                }
            }

            setLineNumberCircle(t.m_lineNumber, prefix, sep, suffix, nonPrefix, zerosEsquerda, invertPrefixSuffix);

            m_autoName = TLMUtils.calculateAutoName(lineID);
            string  stationName = null;
            Vector3 local;
            string  airport, taxi, harbor, regionalStation;
            int     middle;
            string  namePrefix;
            bool    simmetric = TLMUtils.CalculateSimmetry(ss, stopsCount, t, out middle);

            if (t.Info.m_transportType != TransportInfo.TransportType.Bus && t.Info.m_transportType != TransportInfo.TransportType.Tram && simmetric && !showExtraStopInfo)
            {
                lineStationsPanel.width = 5;
                for (int j = middle; j <= middle + stopsCount / 2; j++)
                {
                    List <ushort> intersections;
                    ushort        stationId = t.GetStop(j);
                    local = getStation(lineID, stationId, ss, out stationName, out intersections, out airport, out harbor, out taxi, out regionalStation, out namePrefix);
                    lineStationsPanel.width += addStationToLinearMap(namePrefix, stationName, local, lineStationsPanel.width, intersections, airport, harbor, taxi, regionalStation, stationId, ss) + (j == middle + stopsCount / 2 ? 5 : 0);
                }
            }
            else
            {
                lineStationsPanel.width = 5;
                int minI = 0, maxI = stopsCount;
                if (simmetric)
                {
                    minI = middle + 1;
                    maxI = stopsCount + middle + 1;
                }
                if (showExtraStopInfo)
                {
                    int           j         = (minI - 1 + stopsCount) % stopsCount;
                    ushort        stationId = t.GetStop(j);
                    List <ushort> intersections;
                    local = getStation(lineID, stationId, ss, out stationName, out intersections, out airport, out harbor, out taxi, out regionalStation, out namePrefix);
                    lineStationsPanel.width += addStationToLinearMap(namePrefix, stationName, local, lineStationsPanel.width, intersections, airport, harbor, taxi, regionalStation, stationId, ss, true);
                }
                for (int i = minI; i < maxI; i++)
                {
                    int           j = i % stopsCount;
                    List <ushort> intersections;
                    ushort        stationId = t.GetStop(j);
                    local = getStation(lineID, stationId, ss, out stationName, out intersections, out airport, out harbor, out taxi, out regionalStation, out namePrefix);
                    lineStationsPanel.width += addStationToLinearMap(namePrefix, stationName, local, lineStationsPanel.width, intersections, airport, harbor, taxi, regionalStation, stationId, ss) + (j == stopsCount - (showExtraStopInfo ? 0 : 1) ? 5 : 0);
                }
            }
            if (showExtraStopInfo)
            {
                vehiclesOnStation.Clear();
                for (int v = 0; v < vehicleCount; v++)
                {
                    ushort vehicleId = t.GetVehicle(v);

                    AddVehicleToLinearMap(lineColor, vehicleId);
                }
            }
        }