private IEnumerable<IAction> Convert( JunctionEdge control )
        {
            yield return CreateNewCommand( control );
            yield return Actions.Call<JunctionEdge>(
                control.Id,
                () => control.Connector.ConnectWithJunction( ( RoadJunctionBlock ) Is.Control( control.Connector.JunctionEdge.Parent ), Is.Const( control.Connector.JunctionEdge.EdgeIndex ) ) );

            // TODO Rewrite this
            if ( control.Connector.Edge != null )
            {
                if ( control.Connector.Edge.Parent is RoadLaneBlock )
                {
                    yield return Actions.Call<JunctionEdge>(
                        control.Id,
                        () => control.Connector.ConnectBeginFrom( ( RoadLaneBlock ) Is.Control( control.Connector.Edge.Parent ) ) );
                }
                else if ( control.Connector.Edge.Parent is JunctionEdge )
                {
                    yield return Actions.Call<JunctionEdge>(
                        control.Id,
                        () => control.Connector.ConnectBeginFrom( ( JunctionEdge ) Is.Control( control.Connector.Edge.Parent ) ) );
                }
            }

            if( control.Connector.Light != null)
            {
                yield return Actions.Call<JunctionEdge>( control.Id, () => control.Connector.ConnectWithLight( Is.Control( control.Connector.Light ) ) );
            }

//            yield return base.BuildRoutes( control );
        }
 public void ConnectEndsOn( JunctionEdge roadLaneEdge )
 {
     this.Edge = roadLaneEdge.Edge;
     this.Edge.StartPoint.Translated.Subscribe( s => this._owner.Edge.EndPoint.SetLocation( s.Control.Location ) );
     this.Edge.EndPoint.Translated.Subscribe( s => this._owner.Edge.StartPoint.SetLocation( s.Control.Location ) );
     this._owner.Edge.EndPoint.SetLocation( this.Edge.StartPoint.Location );
     this._owner.Edge.StartPoint.SetLocation( this.Edge.EndPoint.Location );
 }
        public void ConnectStartOn( JunctionEdge junctionEdge, int side )
        {
            this._edges[ side ] = junctionEdge;

            var edge = this._owner.JunctionEdges[ side ];
            junctionEdge.Edge.StartPoint.Translated.Subscribe( s => edge.EndPoint.SetLocation( s.Control.Location ) );
            junctionEdge.Edge.EndPoint.Translated.Subscribe( s => edge.StartPoint.SetLocation( s.Control.Location ) );
        }
 public JunctionEdgeConnector( JunctionEdge owner )
 {
     this._owner = owner;
 }
 public void ConnectWith( JunctionEdge edge )
 {
     this.Owner = edge;
     edge.Edge.StartPoint.Translated.Subscribe( e => this._owner.SetLocation( edge.Location ) );
     edge.Edge.EndPoint.Translated.Subscribe( e => this._owner.SetLocation( edge.Location ) );
 }
 private bool AreConnected( JunctionEdge first, JunctionEdge second )
 {
     if ( first.Connector.Edge != null && first.Connector.Edge.Parent == second ) { return true; }
     if ( second.Connector.Edge != null && second.Connector.Edge == first ) { return true; }
     return false;
 }
 public JunctionEdgeVertexContainer( JunctionEdge edge, Style style )
     : base( edge.Edge, style.NormalColor )
 {
     this._junctionEdge = edge;
 }
 private static UseCtorToCreateControl<JunctionEdge> CreateNewCommand( JunctionEdge control )
 {
     return Actions.CreateControl( control.Id,
                                   () =>
                                   new JunctionEdge( Is.Ioc<Factories.Factories>(), Is.Const( control.Location ) ) );
 }