예제 #1
0
        public SignalInterpreterData(SignalInterpreterData source)
        {
            _aspects   = source._aspects;
            _onClick   = source._onClick;
            _onCleared = source._onCleared;
            _onShunt   = source._onShunt;
            _onUpdate  = source._onUpdate;
            _onInit    = source._onInit;
            _onCross   = source._onCross;
            _onAuto    = source._onAuto;

            _mustBeClearPath = false;
        }
예제 #2
0
        object FindIcon()
        {
            SignalInterpreterData interp = (SignalInterpreterData)_interpreterData;
            SignalAspect          asp    = interp._aspects;

            string[] p = null;
            int      ix;
            string   curState = "";

            if (string.IsNullOrEmpty(this._currentState) == false)
            {
                curState = this._currentState;
            }
            else if (this.status == trkstat.ST_GREEN)
            {
                curState = wxPorting.T("green");
            }
            else
            {
                curState = wxPorting.T("red");
            }

            while (asp != null)
            {
                if (curState.Equals(asp._name))
                {
                    break;
                }
                asp = asp._next;
            }
            if (asp == null)
            {
                return(null);
            }
            switch (this.direction)
            {
            case trkdir.W_E:
                p = asp._iconE;
                break;

            case trkdir.E_W:
                p = asp._iconW;
                break;

            case trkdir.N_S:
                p = asp._iconS;
                break;

            case trkdir.S_N:
                p = asp._iconN;
                break;
            }
            if (p == null || p.Length == 0)
            {
                return(null);
            }
            if (_isFlashing)
            {
                if (p[_nextFlashingIcon] == null)
                {
                    _nextFlashingIcon = 0;
                }

                string[] tmp = new string[p.Length - _nextFlashingIcon];
                Array.Copy(p, _nextFlashingIcon, tmp, 0, tmp.Length);
                p = tmp; // p = &p[_nextFlashingIcon];
            }
            if ((ix = GlobalFunctions.get_pixmap_index(p[0])) < 0)
            {
                return(0);
            }
            return(GlobalVariables.pixmaps[ix].pixels);
        }