コード例 #1
0
        public void addStation(Station s, Dictionary <ushort, MapTransportLine> lines)
        {
            bool   inverse = false;
            string name    = s.name;
            var    angle   = s.writeAngle;

            switch (CardinalPoint.getCardinalPoint(angle).Value)
            {
            case CardinalPoint.CardinalInternal.NW:
            case CardinalPoint.CardinalInternal.W:
            case CardinalPoint.CardinalInternal.SW:
                inverse = true;
                break;
            }

            foreach (var pos in s.getAllStationOffsetPoints())
            {
                var point = s.centralPos - offset;// + pos.Key;
                var line  = lines[pos];
                svgPart.AppendFormat(getStationPointTemplate(s.getLineIdx(pos), line.lineColor), point.x * multiplier, (point.y * multiplier));
            }
            var namePoint = s.writePoint - offset;

            htmlPart.AppendFormat(inverse ? getStationNameInverseTemplate(s.getAllStationOffsetPoints().Count) : getStationNameTemplate(s.getAllStationOffsetPoints().Count), (namePoint.x + 0.5) * multiplier, ((namePoint.y + 0.5) * multiplier), angle, s.name);
        }
コード例 #2
0
        public void addStation(Station s, Dictionary <ushort, MapTransportLine> lines)
        {
            bool   inverse  = false;
            bool   vertical = false;
            string name     = s.name;
            float  angle    = s.writeAngle;

            switch (CardinalPoint.GetCardinalPoint(angle).Value)
            {
            case CardinalPoint.CardinalInternal.SW:
            case CardinalPoint.CardinalInternal.S:
            case CardinalPoint.CardinalInternal.SE:
                inverse = true;
                break;

            case CardinalPoint.CardinalInternal.E:
            case CardinalPoint.CardinalInternal.W:
                vertical = true;
                break;
            }

            foreach (ushort pos in s.getAllStationOffsetPoints())
            {
                Vector2          point = s.centralPos - offset;// + pos.Key;
                MapTransportLine line  = lines[pos];
                svgPart.Append(getStationPointTemplate(s.getLineIdx(pos), line.lineColor, point.x * multiplier, point.y * multiplier, line.lineId, s.id));
            }
            Vector2 namePoint = s.writePoint - offset;

            htmlStationsPart.Append(vertical ?
                                    getStationNameVerticalTemplate(s.name, s.getAllStationOffsetPoints().Count, s.id, (namePoint.x + 0.5f) * multiplier, ((namePoint.y + 0.5f) * multiplier), angle, s.linesPassing) : inverse ?
                                    getStationNameInverseTemplate(s.name, s.getAllStationOffsetPoints().Count, s.id, (namePoint.x + 0.5f) * multiplier, ((namePoint.y + 0.5f) * multiplier), angle, s.linesPassing) :
                                    getStationNameTemplate(s.name, s.getAllStationOffsetPoints().Count, s.id, (namePoint.x + 0.5f) * multiplier, ((namePoint.y + 0.5f) * multiplier), angle, s.linesPassing));
        }