Exemple #1
0
        public void Start(int where)
        {
            mViewedIndicies = new List <uint>();
            EntryNode n = mFlows.GetNode(where) as EntryNode;

            ProcessNextNode(n.mNextNode);
        }
Exemple #2
0
        public void Load()
        {
            Artist = _xmlWrapper.GetAttribute(EntryNode.Attributes["ARTIST"]);
            Title  = _xmlWrapper.GetAttribute(EntryNode.Attributes["TITLE"]);
            var locationNode = EntryNode.SelectSingleNode("LOCATION");

            Playlist = GetPlayList(locationNode);
            Path     = GetPath(locationNode);
            var infoNode = EntryNode.SelectSingleNode("INFO");

            PlayTime             = GetPlayTime(_xmlWrapper.GetAttribute(infoNode.Attributes["PLAYTIME"]));
            LeadingTempo         = GetTempo(EntryNode.SelectSingleNode("TEMPO"), Path);
            TrailingTempo        = GetTempo(EntryNode.SelectSingleNode("TEMPO"), Path, false);
            TempoText            = GetTempoText(LeadingTempo, TrailingTempo);
            RoundedTrailingTempo = GetRoundedTrailingTempo(TrailingTempo);
            var comment = _xmlWrapper.GetAttribute(infoNode.Attributes["COMMENT"]).Trim();

            Intensity           = GetIntensity(comment);
            LeadingHarmonicKey  = GetLeadingHarmonicKey(comment);
            TrailingHarmonicKey = GetTrailingHarmonicKey(comment, LeadingHarmonicKey);
            HarmonicKeyText     = GetHarmonicKeyText(LeadingHarmonicKey, TrailingHarmonicKey);
            IsCharting          = GetIsCharting();
            IsChartingText      = GetIsChartingText(IsCharting);
            FullNameText        = GetFullNameText(Artist, Title, TempoText, HarmonicKeyText, Intensity, Playlist);
            TempoRange.Load(TrailingTempo, 3); // menu item control the range value to be added later
            HarmonicKeyRange.Load(LeadingHarmonicKey);
            IntensityRange.Load(Intensity);
        }
 internal override void RecoverFromStateDescriptor(string stateDescriptor)
 {
     try
     {
         int    indexOfDot = stateDescriptor.IndexOf('.');
         string substr     = indexOfDot >= 0 ? stateDescriptor.Substring(0, indexOfDot) : stateDescriptor;
         ActiveStateId = Convert.ToInt32(substr);
         if (ActiveStateId == EntryStateId)
         {
             EntryNode.RecoveryEnter();
         }
         else if (ActiveStateId == ExitStateId)
         {
             ExitNode.RecoveryEnter();
         }
         else
         {
             states[ActiveStateId].RecoverFromStateDescriptor(stateDescriptor.Substring(indexOfDot + 1));
         }
     }
     catch
     {
         throw new ArgumentException("Infra.Algorithm.StateMachine.StateMachine: stateDescriptor is invalid");
     }
 }
 /// <summary>
 /// Create json string from EntryNode.
 /// </summary>
 /// <param name="node"></param>
 /// <returns></returns>
 public static string ToJson(this EntryNode node)
 {
     return(Object(null, true,
                   Field("type", node.NodeName),
                   Field("ID", node.Id),
                   node.Rect.ToJson()));
 }
        /// <summary>
        /// Cache the nodes by looping though them and sorting them based on type
        /// </summary>
        private void CacheGraphData()
        {
            entryNode         = new EntryNode();
            dialogueNodes     = new List <DialogueNode>();
            conditionNodes    = new List <ConditionNode>();
            exposedProperties = new List <ExposedProperty>();

            if (targetGraphView == null)
            {
                return;
            }
            foreach (Node node in targetGraphView.nodes.ToList())
            {
                Type nodeType = node.GetType();

                // Sort the nodes into their respective objects.
                if (nodeType == typeof(EntryNode))
                {
                    entryNode = node as EntryNode;
                }
                else if (nodeType == typeof(DialogueNode))
                {
                    dialogueNodes.Add(node as DialogueNode);
                }
                else if (nodeType == typeof(ConditionNode))
                {
                    conditionNodes.Add(node as ConditionNode);
                }
            }

            exposedProperties = targetGraphView.exposedProperties;
        }
    private void OnEnable()
    {
        titleStyle = GUIStyle.none;
        titleStyle.normal.background = null;
        titleStyle.active.background = null;
        titleStyle.alignment         = TextAnchor.UpperCenter;
        titleStyle.fontSize          = 32;
        titleStyle.fontStyle         = FontStyle.Bold;

        nodeStyle = new GUIStyle();
        nodeStyle.normal.background = EditorGUIUtility.Load("builtin skins/darkskin/images/node1.png") as Texture2D;
        nodeStyle.border            = new RectOffset(12, 12, 12, 12);

        selectedNodeStyle = new GUIStyle();
        selectedNodeStyle.normal.background = EditorGUIUtility.Load("builtin skins/darkskin/images/node1 on.png") as Texture2D;
        selectedNodeStyle.border            = new RectOffset(12, 12, 12, 12);

        GUIStyle tempStyle = new GUIStyle();

        tempStyle.normal.background = EditorGUIUtility.Load("builtin skins/darkskin/images/node3.png") as Texture2D;

        GUIStyle tempSelectedStyle = new GUIStyle();

        tempSelectedStyle.normal.background = EditorGUIUtility.Load("builtin skins/darkskin/images/node3 on.png") as Texture2D;

        entryNode = new EntryNode(new Vector2(10, 70), 50, 50, tempStyle, tempSelectedStyle, null, OnClickConnectionPoint);
    }
Exemple #7
0
        public void SetChapter(IChapter chapter)
        {
            if (chapter != GlobalEditorHandler.GetCurrentChapter())
            {
                GlobalEditorHandler.SetCurrentChapter(chapter);
            }

            CurrentChapter = chapter;

            Graphics.Reset();

            Grid = new WorkflowEditorGrid(Graphics, gridCellSize);

            Graphics.Canvas.ContextClick += HandleCanvasContextClick;

            EntryNode entryNode = CreateEntryNode(chapter);
            IDictionary <IStep, StepNode> stepNodes = SetupSteps(chapter);

            SetupTransitions(chapter, entryNode, stepNodes);

            Graphics.CalculateBoundingBox();

            if (EditorConfigurator.Instance.Validation.IsAllowedToValidate())
            {
                EditorConfigurator.Instance.Validation.Validate(CurrentChapter.Data, GlobalEditorHandler.GetCurrentCourse(), null);
            }
        }
Exemple #8
0
        internal static List <Dictionary <string, string> > GetOverviewEntriesFromXml(string OverviewXml)
        {
            List <Dictionary <string, string> > OverviewEntries = new List <Dictionary <string, string> >();
            XmlDocument XDoc = new XmlDocument();

            XDoc.XmlResolver = null;
            try
            {
                XDoc.LoadXml(OverviewXml);
                foreach (XmlNode EntryNode in XDoc.SelectNodes("//entry"))
                {
                    try
                    {
                        Dictionary <string, string> Entry = new Dictionary <string, string>()
                        {
                            { "id", EntryNode.SelectNodes("id")[0].InnerText },
                            { "payload", Tools.EncodeForTrace(Tools.Base64Decode(EntryNode.SelectNodes("payload")[0].InnerText)) },
                            { "log_id", EntryNode.SelectNodes("log_id")[0].InnerText },
                            { "code", EntryNode.SelectNodes("code")[0].InnerText },
                            { "length", EntryNode.SelectNodes("length")[0].InnerText },
                            { "mime", EntryNode.SelectNodes("mime")[0].InnerText },
                            { "time", EntryNode.SelectNodes("time")[0].InnerText },
                            { "signature", EntryNode.SelectNodes("signature")[0].InnerText }
                        };
                        OverviewEntries.Add(Entry);
                    }
                    catch { }
                }
            }
            catch { }
            return(OverviewEntries);
        }
Exemple #9
0
 public void SetData(StateElement state, EntryNode destination, ITransition transition)
 {
     m_state = state;
     transform.SetParent(state.transform);
     transform.localPosition = Vector3.zero;
     m_transition            = transition;
     m_destination           = destination;
 }
 public void TranslateMethodEntry(EntryNode node)
 {
     /*// Go to the next state.
      * // Only write if it's not the initial state (id==0) anyway.
      * if (node.OutputExecPins[0].OutgoingPin != null && GetExecPinStateId(node.OutputExecPins[0].OutgoingPin) != 0)
      * {
      *  WriteGotoOutputPin(node.OutputExecPins[0]);
      * }*/
 }
 public void ReloadModel()
 {
     Clear();
     ImportJSON(serializedJSON);
     if (GetNodes <EntryNode>().Count() == 0)
     {
         EntryNode entry = new EntryNode(this);
         AddNode(entry);
     }
 }
    public override Node AddNode(Type type)
    {
        var node = base.AddNode(type);

        if (node is EntryNode)
        {
            _entryNode = node as EntryNode;
        }
        return(node);
    }
Exemple #13
0
        public static XzaarExpression CompileExpression(this EntryNode node)
        {
            var compiler   = new ExpressionCompiler();
            var expression = compiler.Compile(node);

            if (compiler.Errors.Count > 0)
            {
                throw new Exception(string.Join(Environment.NewLine, compiler.Errors.ToArray()));
            }
            return(expression);
        }
        /// <summary>
        /// Create EntryNode from json string.
        /// </summary>
        /// <param name="node"></param>
        /// <param name="jObj"></param>
        /// <returns></returns>
        private static Node Serialize(this EntryNode node, JsonObject jObj)
        {
            node.NodeName = jObj["type"].String;
            node.Id       = jObj["ID"].String;
            var x = jObj["rect"]["posX"].Float;
            var y = jObj["rect"]["posY"].Float;
            var w = jObj["rect"]["width"].Float;
            var h = jObj["rect"]["height"].Float;

            node.Rect = new Rect(x, y, w, h);

            return(node);
        }
        public VisualEntryNode(EntryNode node, VisualFloor floor) : base(node, floor)
        {
            points = new List <VisualPoint>();
            var dx = 60;
            var dy = 30;

            topLeft     = new VisualPoint(node.Position + new Vector(-dx, -dy)); AddPoint(topLeft);
            topRight    = new VisualPoint(node.Position + new Vector(dx, -dy)); AddPoint(topRight);
            bottomRight = new VisualPoint(node.Position + new Vector(dx, dy)); AddPoint(bottomRight);
            bottomLeft  = new VisualPoint(node.Position + new Vector(-dx, dy)); AddPoint(bottomLeft);
            Dimensions  = new Rect(bottomLeft.Position, topRight.Position);
            Draw();
        }
 private EntryNodeSavedFile SaveEntryNode(EntryNode node)
 {
     return(new EntryNodeSavedFile()
     {
         FileType = node.GetType(),
         HashCode = node.GetHashCode(),
         AutoSize = node.AutoSize,
         Position = node.Position,
         Title = node.Title,
         ParentHashCode = node.Parent.GetHashCode(),
         Width = node.Width
     });
 }
Exemple #17
0
        public void SetChapter(IChapter chapter)
        {
            this.chapter = chapter;

            Graphics.Reset();

            Graphics.Canvas.ContextClick += HandleCanvasContextClick;

            EntryNode entryNode = CreateEntryNode(chapter);
            IDictionary <IStep, StepNode> stepNodes = SetupSteps(chapter);

            SetupTransitions(chapter, entryNode, stepNodes);

            Graphics.CalculateBoundingBox();
        }
    public override void OnBodyGUI()
    {
        base.OnBodyGUI();

        if (node == null)
        {
            node = target as EntryNode;
        }

        serializedObject.Update();

        // Show the text, making sure to word wrap where necessary
        bool oldWordWrap = EditorStyles.label.wordWrap;

        EditorStyles.label.wordWrap = true;
        GUILayout.Label(AuroraEngine.Resources.GetString(node.entry.Text));
        EditorStyles.label.wordWrap = oldWordWrap;
    }
Exemple #19
0
        public List <MovementDirectionCode> GetPath(EntryNode _Origin, ExitNode _Destination)
        {
            NetworkData     network = new NetworkData();
            List <NodeData> nodes   = new List <NodeData>();
            List <LinkData> links   = new List <LinkData>();

            //NetworkTopologyParking.CreateNetworkTopology(network, node, link);

            //Path p = new Path(link, node);
            Path p = new Path();

            p.CalcUEassignment(links, nodes);

            List <ushort> _nodesIndex = new List <ushort>();
            float         _dis        = 0;
            List <ushort> _pathNodes  = new List <ushort>();
            List <uint>   _pathLinks  = new List <uint>();
            List <MovementDirectionCode> TurningMovementList = new List <MovementDirectionCode>();

            p.PathGeneration(_Origin, _Destination, 1, ref _nodesIndex, ref _pathLinks, ref _dis);
            foreach (ushort index_i in _nodesIndex)
            {
                _pathNodes.Add(nodes[index_i].Id);
            }

            for (int i = 1; i < _pathLinks.Count; i++)
            {
                if (links[i - 1].DownstreamLinkIds[0] == links[i].Id)
                {
                    TurningMovementList.Add(MovementDirectionCode.Left);
                }
                else
                if (links[i - 1].DownstreamLinkIds[1] == links[i].Id)
                {
                    TurningMovementList.Add(MovementDirectionCode.Through);
                }
                else
                {
                    TurningMovementList.Add(MovementDirectionCode.Right);
                }
            }

            return(TurningMovementList);
        }
Exemple #20
0
        internal static TreeNode[] GetChildren(DirectoryNode node, object innerDoc)
        {
            var children = new List <AbstractTreeNode>();

            var entries = node.Entries;

            while (entries.MoveNext())
            {
                EntryNode        entry = entries.Current as EntryNode;
                AbstractTreeNode treeNode;
                if (entry is DirectoryNode)
                {
                    treeNode = new DirectoryTreeNode(entry as DirectoryNode);

                    var o = entry as DirectoryNode;
                }
                else
                {
                    var o = entry as DocumentNode;

                    treeNode = new DocumentTreeNode(entry as DocumentNode);

                    #region handle Excel BIFF records

                    if (treeNode.Text.ToLower() == "workbook")
                    {
                        HandleWorkbook(treeNode, (HSSFWorkbook)innerDoc);
                    }
                    //else if(treeNode.Text.ToLower() == "worddocument")
                    //{
                    //    HandleWord(treeNode, (HWPFDocument)innerDoc);
                    //}

                    #endregion
                }

                children.Add(treeNode);
            }

            children.Sort();

            return(children.ToArray());
        }
        /// <summary>
        /// Creates a basic node to serve as an entry point.
        /// </summary>
        /// <returns>Returns a node with a single output port.</returns>
        private static EntryNode GenerateEntryPointNode()
        {
            EntryNode node = new EntryNode {
                title = "Start"
            };

            // Remove the entry port
            node.inputContainer.RemoveAt(0);

            // Create the output port.
            node.GeneratePort(node, "Next", Direction.Output);

            // Prevent the deletion of the node.
            node.capabilities &= ~Capabilities.Deletable;

            // Set the default position of the node.
            node.SetPosition(new Rect(100, 200, 100, 150));

            return(node);
        }
Exemple #22
0
 public Catalogue(BattleScribeXml.Catalogue xml)
     : base(xml)
 {
     _gameSystemLink = new IdLink <IGameSystem>(
         XmlBackend.GameSystemGuid,
         newGuid => { XmlBackend.GameSystemGuid = newGuid; },
         () => XmlBackend.GameSystemId);
     _entries = new RootEntryNode(() => XmlBackend.Entries, this)
     {
         Controller = XmlBackend.Controller
     };
     _entryLinks = new RootLinkNode(() => XmlBackend.Links.EntryLinks, this)
     {
         Controller = XmlBackend.Controller
     };
     _ruleLinks = new RuleLinkNode(() => XmlBackend.Links.RuleLinks, this)
     {
         Controller = XmlBackend.Controller
     };
     _rules = new RuleNode(() => XmlBackend.Rules, this)
     {
         Controller = XmlBackend.Controller
     };
     _sharedEntries = new EntryNode(() => XmlBackend.SharedEntries, this)
     {
         Controller = XmlBackend.Controller
     };
     _sharedGroups = new GroupNode(() => XmlBackend.SharedEntryGroups, this)
     {
         Controller = XmlBackend.Controller
     };
     _sharedProfiles = new ProfileNode(() => XmlBackend.SharedProfiles, this)
     {
         Controller = XmlBackend.Controller
     };
     _sharedRules = new RuleNode(() => XmlBackend.SharedRules, this)
     {
         Controller = XmlBackend.Controller
     };
 }
Exemple #23
0
 public void PathGeneration(EntryNode _Origin, ExitNode _Destination, UInt16 _Type, ref List <ushort> _NodesIndex, ref List <uint> _LinksID, ref float _Dis)
 {
     if (_Type == 1)       //Shortest Path
     {
         graph.FindShortestPath(_Origin.ListIndex, _Destination.ListIndex);
         _NodesIndex = graph.Result;
         _Dis        = graph.Dist[_Origin.ListIndex, _Destination.ListIndex];
         for (ushort i = 0; i < _NodesIndex.Count - 1; i++)
         {
             _LinksID.Add(linkId[_NodesIndex[i], _NodesIndex[i + 1]]);
         }
     }
     else                //Other Path Schemes
     {
         graph.FindShortestPath(_Origin.ListIndex, _Destination.ListIndex);
         _NodesIndex = graph.Result;
         _Dis        = graph.Dist[_Origin.ListIndex, _Destination.ListIndex];
         for (ushort i = 0; i < _NodesIndex.Count - 1; i++)
         {
             _LinksID.Add(linkId[_NodesIndex[i], _NodesIndex[i + 1]]);
         }
     }
 }
Exemple #24
0
        protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
        {
            if (CurrentFloor == null)
            {
                return;
            }

            e.Handled = true;
            var position = GetAbsolutePosition(e.GetPosition(this));

            try
            {
                switch (SelectedActionMode)
                {
                case ActionMode.AddStart:
                {
                    var start = new StartNode(CurrentFloor.Model, position);
                    AddVisualEntity(new VisualStartNode(start, CurrentFloor)); break;
                }

                case ActionMode.AddExit:
                {
                    var exit = new ExitNode(CurrentFloor.Model, position);
                    AddVisualEntity(new VisualExitNode(exit, CurrentFloor)); break;
                }

                case ActionMode.AddEntry:
                {
                    var entry = new EntryNode(CurrentFloor.Model, position);
                    AddVisualEntity(new VisualEntryNode(entry, CurrentFloor)); break;
                }

                case ActionMode.AddStairs:
                case ActionMode.AddRoad:
                {
                    CreatingSection(position);
                    break;
                }

                case ActionMode.Move:
                {
                    var entity = CurrentFloor.GetVisualEntity(position);
                    if (entity != null)
                    {
                        moveInformation         = new MoveInformation(entity.GetUnit(position), position);
                        entity.Model.IsSelected = true;
                    }
                    else if (Shell != null)
                    {
                        moveInformation = new MoveInformation(Shell, e.GetPosition(this), true);
                        e.Handled       = false;
                    }
                    e.Handled = true;
                    break;
                }

                case ActionMode.Remove:
                {
                    var entity = CurrentFloor.GetVisualEntity(position);
                    CurrentFloor.RemoveVisualEntity(entity);
                    break;
                }

                case ActionMode.SetScale:
                {
                    if (IsCreatingLine)
                    {
                        CreatingLineInf.LastPosition = position;
                        SetScale();
                    }
                    else
                    {
                        CreatingLineInf = new CreatingLineInformation(new VisualThumb(position));
                    }
                    break;
                }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
 public EntryNodeGUIContent(EntryNode node, NodeMachineEditor editor) : base(node, editor)
 {
     text = "Entry";
 }
Exemple #26
0
 public virtual XzaarExpression Visit(EntryNode node)
 {
     return(null);
 }
        /*
         *
         * 701-->(19)==(1)===(2)==========================================(3)===(4)====================================(5)
         *             \\                                                 \\                                           \\
         *              \\                                                 \\                                           \\
         *              (6)                                                 (7)                                          (8)
         *              ||                                                  ||                                           ||
         *              ||                                                  ||                                           ||
         *              ||                                                  ||                                           ||
         *              ||                                                  ||                                           ||
         *              ||                                                  ||                                           ||
         *             (9)                                                 (10)                                         (11)
         *              \\                                                  //                                           //
         *               \\                                                //                                           //
         *               (12)================(13)    (14)================(15)===(16)=================================(17)
         *                                     \\    //
         *                                      \\  //
         *                                       (18)
         *                                        ||
         *                                        ||
         *                                        801
         */



        public static void CreateNetworkTopology(NetworkData network, List <NodeData> nodes, List <LinkData> links)
        {
            network.NumLinks = 0;
            const int    XcoordStart        = 5;
            const int    YcoordStart        = 5;
            const int    EntryLinkLength    = 250;
            const int    ExitLinkLength     = 500;
            const int    IntersectionX      = 6;
            const int    IntersectionY      = 6;
            const int    LongLinkLength     = 1000;
            const int    ShortLinkLength    = LongLinkLength / 2 - 2 * IntersectionX;
            const float  GradePct_Left      = 0;
            const float  GradePct_Right     = 0;
            const float  GradePct_Down      = 0;
            const float  GradePct_DownLeft  = 0;
            const float  GradePct_DownRight = 0;
            const float  FlowSpeed          = 51.3f; //35 mi/h * 1.467
            List <float> EnteringPctTrucks  = new List <float> {
                100, 0, 0, 0, 0
            };
            List <float> EnteringDriverTypePcts = new List <float> {
                5, 8, 10, 12, 15, 15, 12, 10, 8, 5
            };

            float[] MinEntryHeadway    = new float[] { 2.0f, 2.5f, 3.0f, 3.5f };
            bool    UsePctTurnsByFleet = true;

            float[]        TurningPcts       = new float[3];
            List <float[]> PctTurnsAtLinkEnd = new List <float[]>();


            // connector node
            network.NumNodes++;
            LinkConnectorNode NewConnectorNode = new LinkConnectorNode(1, NodeType.LinkConnector, 0, XcoordStart + EntryLinkLength, YcoordStart);

            nodes.Add(NewConnectorNode);
            network.NodeIdList.Add(NewConnectorNode.Id);

            // connector node
            network.NumNodes++;
            NewConnectorNode = new LinkConnectorNode(2, NodeType.LinkConnector, 1, XcoordStart + EntryLinkLength + 2 * IntersectionX, YcoordStart);
            nodes.Add(NewConnectorNode);
            network.NodeIdList.Add(NewConnectorNode.Id);

            // connector node
            network.NumNodes++;
            NewConnectorNode = new LinkConnectorNode(3, NodeType.LinkConnector, 2, XcoordStart + EntryLinkLength + 2 * IntersectionX + LongLinkLength, YcoordStart);
            nodes.Add(NewConnectorNode);
            network.NodeIdList.Add(NewConnectorNode.Id);

            // connector node
            network.NumNodes++;
            NewConnectorNode = new LinkConnectorNode(4, NodeType.LinkConnector, 3, XcoordStart + EntryLinkLength + 2 * IntersectionX + LongLinkLength + 2 * IntersectionX, YcoordStart - IntersectionY);
            nodes.Add(NewConnectorNode);
            network.NodeIdList.Add(NewConnectorNode.Id);

            // connector node
            network.NumNodes++;
            NewConnectorNode = new LinkConnectorNode(5, NodeType.LinkConnector, 4, XcoordStart + EntryLinkLength + 2 * IntersectionX + LongLinkLength + 2 * IntersectionX + LongLinkLength, YcoordStart - IntersectionY);
            nodes.Add(NewConnectorNode);
            network.NodeIdList.Add(NewConnectorNode.Id);

            // connector node
            network.NumNodes++;
            NewConnectorNode = new LinkConnectorNode(6, NodeType.LinkConnector, 5, XcoordStart + EntryLinkLength + IntersectionX, YcoordStart + 2 * IntersectionY);
            nodes.Add(NewConnectorNode);
            network.NodeIdList.Add(NewConnectorNode.Id);

            // connector node
            network.NumNodes++;
            NewConnectorNode = new LinkConnectorNode(7, NodeType.LinkConnector, 6, XcoordStart + EntryLinkLength + IntersectionX + LongLinkLength + 2 * IntersectionX, YcoordStart + 2 * IntersectionY);
            nodes.Add(NewConnectorNode);
            network.NodeIdList.Add(NewConnectorNode.Id);

            // connector node
            network.NumNodes++;
            NewConnectorNode = new LinkConnectorNode(8, NodeType.LinkConnector, 7, XcoordStart + EntryLinkLength + IntersectionX + LongLinkLength + 2 * IntersectionX + LongLinkLength + 2 * IntersectionX, YcoordStart + 2 * IntersectionY);
            nodes.Add(NewConnectorNode);
            network.NodeIdList.Add(NewConnectorNode.Id);

            // connector node
            network.NumNodes++;
            NewConnectorNode = new LinkConnectorNode(9, NodeType.LinkConnector, 8, XcoordStart + EntryLinkLength + IntersectionX, YcoordStart + 2 * IntersectionY + LongLinkLength);
            nodes.Add(NewConnectorNode);
            network.NodeIdList.Add(NewConnectorNode.Id);

            // connector node
            network.NumNodes++;
            NewConnectorNode = new LinkConnectorNode(10, NodeType.LinkConnector, 9, XcoordStart + EntryLinkLength + IntersectionX + LongLinkLength + 2 * IntersectionX, YcoordStart + 2 * IntersectionY + LongLinkLength);
            nodes.Add(NewConnectorNode);
            network.NodeIdList.Add(NewConnectorNode.Id);

            // connector node
            network.NumNodes++;
            NewConnectorNode = new LinkConnectorNode(11, NodeType.LinkConnector, 10, XcoordStart + EntryLinkLength + IntersectionX + LongLinkLength + 2 * IntersectionX + LongLinkLength + 2 * IntersectionX, YcoordStart + 2 * IntersectionY + LongLinkLength);
            nodes.Add(NewConnectorNode);
            network.NodeIdList.Add(NewConnectorNode.Id);

            // connector node
            network.NumNodes++;
            NewConnectorNode = new LinkConnectorNode(12, NodeType.LinkConnector, 11, XcoordStart + EntryLinkLength + 2 * IntersectionX, YcoordStart + 2 * IntersectionY + LongLinkLength + IntersectionY);
            nodes.Add(NewConnectorNode);
            network.NodeIdList.Add(NewConnectorNode.Id);

            // connector node
            network.NumNodes++;
            NewConnectorNode = new LinkConnectorNode(13, NodeType.LinkConnector, 12, XcoordStart + EntryLinkLength + 2 * IntersectionX + ShortLinkLength, YcoordStart + 2 * IntersectionY + LongLinkLength + IntersectionY);
            nodes.Add(NewConnectorNode);
            network.NodeIdList.Add(NewConnectorNode.Id);

            // connector node
            network.NumNodes++;
            NewConnectorNode = new LinkConnectorNode(14, NodeType.LinkConnector, 13, XcoordStart + EntryLinkLength + 2 * IntersectionX + ShortLinkLength + 4 * IntersectionX, YcoordStart + 2 * IntersectionY + LongLinkLength + IntersectionY);
            nodes.Add(NewConnectorNode);
            network.NodeIdList.Add(NewConnectorNode.Id);

            // connector node
            network.NumNodes++;
            NewConnectorNode = new LinkConnectorNode(15, NodeType.LinkConnector, 14, XcoordStart + EntryLinkLength + 2 * IntersectionX + ShortLinkLength + 4 * IntersectionX + ShortLinkLength, YcoordStart + 2 * IntersectionY + LongLinkLength + IntersectionY);
            nodes.Add(NewConnectorNode);
            network.NodeIdList.Add(NewConnectorNode.Id);

            // connector node
            network.NumNodes++;
            NewConnectorNode = new LinkConnectorNode(16, NodeType.LinkConnector, 15, XcoordStart + EntryLinkLength + 2 * IntersectionX + ShortLinkLength + 4 * IntersectionX + ShortLinkLength + 2 * IntersectionX, YcoordStart + 2 * IntersectionY + LongLinkLength + IntersectionY);
            nodes.Add(NewConnectorNode);
            network.NodeIdList.Add(NewConnectorNode.Id);

            // connector node
            network.NumNodes++;
            NewConnectorNode = new LinkConnectorNode(17, NodeType.LinkConnector, 16, XcoordStart + EntryLinkLength + 2 * IntersectionX + ShortLinkLength + 4 * IntersectionX + ShortLinkLength + 2 * IntersectionX + LongLinkLength, YcoordStart + 2 * IntersectionY + LongLinkLength + IntersectionY);
            nodes.Add(NewConnectorNode);
            network.NodeIdList.Add(NewConnectorNode.Id);

            // connector node
            network.NumNodes++;
            NewConnectorNode = new LinkConnectorNode(18, NodeType.LinkConnector, 17, XcoordStart + EntryLinkLength + 2 * IntersectionX + ShortLinkLength + 2 * IntersectionX, YcoordStart + 2 * IntersectionY + LongLinkLength + IntersectionY + IntersectionY);
            nodes.Add(NewConnectorNode);
            network.NodeIdList.Add(NewConnectorNode.Id);

            // connector node
            network.NumNodes++;
            NewConnectorNode = new LinkConnectorNode(19, NodeType.LinkConnector, 18, XcoordStart + EntryLinkLength / 2, YcoordStart);
            nodes.Add(NewConnectorNode);
            network.NodeIdList.Add(NewConnectorNode.Id);

            // entry node
            network.NumNodes++;
            EntryNode NewEntryNode = new EntryNode(701, NodeType.Entry, 19, XcoordStart, YcoordStart, 70119, 1, MinEntryHeadway, 400, 400, EnteringPctTrucks, EnteringDriverTypePcts, false, 100, FlowSpeed);

            nodes.Add(NewEntryNode);
            network.NodeIdList.Add(NewEntryNode.Id);

            // exit node
            network.NumNodes++;
            ExitNode NewExitNode = new ExitNode(801, NodeType.Exit, 20, XcoordStart + EntryLinkLength + 2 * IntersectionX + ShortLinkLength + 2 * IntersectionX, YcoordStart + 2 * IntersectionY + LongLinkLength + IntersectionY + IntersectionY + ExitLinkLength);

            nodes.Add(NewExitNode);
            network.NodeIdList.Add(NewExitNode.Id);


            // link 1->2
            PctTurnsAtLinkEnd = new List <float[]>();
            for (int k = 0; k <= 4; k++)
            {
                TurningPcts = new float[] { 0, 100, 0 };
                PctTurnsAtLinkEnd.Add(TurningPcts);
            }

            network.NumLinks++;
            LinkData NewLink = new LinkData(0, nodes[0], nodes[1], LinkType.ArterialConnector, LinkCurveType.Linear, GradePct_Right, FlowSpeed, 2, UsePctTurnsByFleet, PctTurnsAtLinkEnd, 0, 191, 0, 0, 23, 0, TravelDirection.Straight);

            NewLink.Lanes[0].AllowedTurnMovements.Add(MovementDirectionCode.Through);
            NewLink.Lanes[1].AllowedTurnMovements.Add(MovementDirectionCode.Through);

            NewLink.Lanes[0].ConnectingLaneIdsUpstream = LaneData.SetConnectingLaneIds(0, 1, 0);
            NewLink.Lanes[1].ConnectingLaneIdsUpstream = LaneData.SetConnectingLaneIds(0, 2, 0);

            NewLink.Lanes[0].ConnectingLaneIdsDownstream = LaneData.SetConnectingLaneIds(0, 1, 0);
            NewLink.Lanes[1].ConnectingLaneIdsDownstream = LaneData.SetConnectingLaneIds(0, 2, 0);

            links.Add(NewLink);
            network.LinkIdList.Add(NewLink.Id);

            // link 2->3
            PctTurnsAtLinkEnd = new List <float[]>();
            for (int k = 0; k <= 4; k++)
            {
                TurningPcts = new float[] { 0, 67, 33 };
                PctTurnsAtLinkEnd.Add(TurningPcts);
            }

            network.NumLinks++;
            NewLink = new LinkData(1, nodes[1], nodes[2], LinkType.ArterialConnector, LinkCurveType.Linear, GradePct_Right, FlowSpeed, 2, UsePctTurnsByFleet, PctTurnsAtLinkEnd, 0, 12, 0, 0, 34, 37, TravelDirection.Straight);

            NewLink.Lanes[0].AllowedTurnMovements.Add(MovementDirectionCode.Right);
            NewLink.Lanes[1].AllowedTurnMovements.Add(MovementDirectionCode.Through);

            NewLink.Lanes[0].ConnectingLaneIdsUpstream = LaneData.SetConnectingLaneIds(0, 1, 0);
            NewLink.Lanes[1].ConnectingLaneIdsUpstream = LaneData.SetConnectingLaneIds(0, 2, 0);

            NewLink.Lanes[0].ConnectingLaneIdsDownstream = LaneData.SetConnectingLaneIds(0, 0, 1);
            NewLink.Lanes[1].ConnectingLaneIdsDownstream = LaneData.SetConnectingLaneIds(0, 1, 0);

            NewLink.Lanes[0].Type = LaneType.AuxFull;

            links.Add(NewLink);
            network.LinkIdList.Add(NewLink.Id);

            // link 3->4
            PctTurnsAtLinkEnd = new List <float[]>();
            for (int k = 0; k <= 4; k++)
            {
                TurningPcts = new float[] { 0, 100, 0 };
                PctTurnsAtLinkEnd.Add(TurningPcts);
            }

            network.NumLinks++;
            NewLink = new LinkData(2, nodes[2], nodes[3], LinkType.ArterialConnector, LinkCurveType.Linear, GradePct_Right, FlowSpeed, 1, UsePctTurnsByFleet, PctTurnsAtLinkEnd, 0, 23, 0, 0, 45, 0, TravelDirection.Straight);

            NewLink.Lanes[0].AllowedTurnMovements.Add(MovementDirectionCode.Through);

            NewLink.Lanes[0].ConnectingLaneIdsUpstream = LaneData.SetConnectingLaneIds(0, 1, 0);

            NewLink.Lanes[0].ConnectingLaneIdsDownstream = LaneData.SetConnectingLaneIds(0, 1, 0);

            links.Add(NewLink);
            network.LinkIdList.Add(NewLink.Id);

            // link 4->5
            PctTurnsAtLinkEnd = new List <float[]>();
            for (int k = 0; k <= 4; k++)
            {
                TurningPcts = new float[] { 0, 0, 100 };
                PctTurnsAtLinkEnd.Add(TurningPcts);
            }
            network.NumLinks++;
            NewLink = new LinkData(3, nodes[3], nodes[4], LinkType.ArterialConnector, LinkCurveType.Linear, GradePct_Right, FlowSpeed, 1, UsePctTurnsByFleet, PctTurnsAtLinkEnd, 0, 34, 0, 0, 0, 58, TravelDirection.Straight);

            NewLink.Lanes[0].AllowedTurnMovements.Add(MovementDirectionCode.Right);

            NewLink.Lanes[0].ConnectingLaneIdsUpstream = LaneData.SetConnectingLaneIds(0, 1, 0);

            NewLink.Lanes[0].ConnectingLaneIdsDownstream = LaneData.SetConnectingLaneIds(0, 0, 1);

            links.Add(NewLink);
            network.LinkIdList.Add(NewLink.Id);

            // link 1->6
            PctTurnsAtLinkEnd = new List <float[]>();
            for (int k = 0; k <= 4; k++)
            {
                TurningPcts = new float[] { 0, 100, 0 };
                PctTurnsAtLinkEnd.Add(TurningPcts);
            }
            network.NumLinks++;
            NewLink = new LinkData(4, nodes[0], nodes[5], LinkType.ArterialConnector, LinkCurveType.Bezier, GradePct_DownRight, FlowSpeed, 1, UsePctTurnsByFleet, PctTurnsAtLinkEnd, 0, 0, 191, 0, 69, 0, TravelDirection.RightTurn, FreeFlowSpeedMethod.Measured, TwoLaneLinkPassingDesignation.NotAllowed, TwoLaneLinkPassingRule.None, nodes[0].PositionX, nodes[0].PositionY + 6, nodes[0].PositionX + 6, nodes[0].PositionY + 6, nodes[0].PositionX + 6, nodes[0].PositionY + 12);

            NewLink.Lanes[0].AllowedTurnMovements.Add(MovementDirectionCode.Through);

            NewLink.Lanes[0].ConnectingLaneIdsUpstream = LaneData.SetConnectingLaneIds(0, 0, 1);

            NewLink.Lanes[0].ConnectingLaneIdsDownstream = LaneData.SetConnectingLaneIds(0, 1, 0);

            links.Add(NewLink);
            network.LinkIdList.Add(NewLink.Id);

            // link 3->7
            network.NumLinks++;
            NewLink = new LinkData(5, nodes[2], nodes[6], LinkType.ArterialConnector, LinkCurveType.Bezier, GradePct_DownRight, FlowSpeed, 1, UsePctTurnsByFleet, PctTurnsAtLinkEnd, 0, 0, 23, 0, 710, 0, TravelDirection.RightTurn, FreeFlowSpeedMethod.Measured, TwoLaneLinkPassingDesignation.NotAllowed, TwoLaneLinkPassingRule.None, nodes[2].PositionX, nodes[2].PositionY + 6, nodes[2].PositionX + 6, nodes[2].PositionY + 6, nodes[2].PositionX + 6, nodes[2].PositionY + 12);

            NewLink.Lanes[0].AllowedTurnMovements.Add(MovementDirectionCode.Through);

            NewLink.Lanes[0].ConnectingLaneIdsUpstream = LaneData.SetConnectingLaneIds(0, 0, 1);

            NewLink.Lanes[0].ConnectingLaneIdsDownstream = LaneData.SetConnectingLaneIds(0, 1, 0);

            links.Add(NewLink);
            network.LinkIdList.Add(NewLink.Id);

            // link 5->8
            network.NumLinks++;
            NewLink = new LinkData(6, nodes[4], nodes[7], LinkType.ArterialConnector, LinkCurveType.Bezier, GradePct_DownRight, FlowSpeed, 1, UsePctTurnsByFleet, PctTurnsAtLinkEnd, 0, 0, 45, 0, 811, 0, TravelDirection.RightTurn, FreeFlowSpeedMethod.Measured, TwoLaneLinkPassingDesignation.NotAllowed, TwoLaneLinkPassingRule.None, nodes[4].PositionX, nodes[4].PositionY, nodes[4].PositionX + 6, nodes[4].PositionY, nodes[4].PositionX + 6, nodes[4].PositionY + 6);

            NewLink.Lanes[0].AllowedTurnMovements.Add(MovementDirectionCode.Through);

            NewLink.Lanes[0].ConnectingLaneIdsUpstream = LaneData.SetConnectingLaneIds(0, 0, 1);

            NewLink.Lanes[0].ConnectingLaneIdsDownstream = LaneData.SetConnectingLaneIds(0, 1, 0);

            links.Add(NewLink);
            network.LinkIdList.Add(NewLink.Id);

            // link 6->9
            PctTurnsAtLinkEnd = new List <float[]>();
            for (int k = 0; k <= 4; k++)
            {
                TurningPcts = new float[] { 100, 0, 0 };
                PctTurnsAtLinkEnd.Add(TurningPcts);
            }
            network.NumLinks++;
            NewLink = new LinkData(7, nodes[5], nodes[8], LinkType.ArterialConnector, LinkCurveType.Linear, GradePct_Down, FlowSpeed, 1, UsePctTurnsByFleet, PctTurnsAtLinkEnd, 0, 16, 0, 912, 0, 0, TravelDirection.Straight);

            NewLink.Lanes[0].AllowedTurnMovements.Add(MovementDirectionCode.Left);

            NewLink.Lanes[0].ConnectingLaneIdsUpstream = LaneData.SetConnectingLaneIds(1, 0, 0);

            NewLink.Lanes[0].ConnectingLaneIdsDownstream = LaneData.SetConnectingLaneIds(1, 0, 0);

            links.Add(NewLink);
            network.LinkIdList.Add(NewLink.Id);

            // link 7->10
            PctTurnsAtLinkEnd = new List <float[]>();
            for (int k = 0; k <= 4; k++)
            {
                TurningPcts = new float[] { 0, 0, 100 };
                PctTurnsAtLinkEnd.Add(TurningPcts);
            }
            network.NumLinks++;
            NewLink = new LinkData(8, nodes[6], nodes[9], LinkType.ArterialConnector, LinkCurveType.Linear, GradePct_Down, FlowSpeed, 1, UsePctTurnsByFleet, PctTurnsAtLinkEnd, 0, 37, 0, 0, 0, 1015, TravelDirection.Straight);

            NewLink.Lanes[0].AllowedTurnMovements.Add(MovementDirectionCode.Right);

            NewLink.Lanes[0].ConnectingLaneIdsUpstream = LaneData.SetConnectingLaneIds(1, 0, 0);

            NewLink.Lanes[0].ConnectingLaneIdsDownstream = LaneData.SetConnectingLaneIds(0, 0, 1);

            links.Add(NewLink);
            network.LinkIdList.Add(NewLink.Id);

            // link 8->11
            PctTurnsAtLinkEnd = new List <float[]>();
            for (int k = 0; k <= 4; k++)
            {
                TurningPcts = new float[] { 0, 0, 100 };
                PctTurnsAtLinkEnd.Add(TurningPcts);
            }
            network.NumLinks++;
            NewLink = new LinkData(9, nodes[7], nodes[10], LinkType.ArterialConnector, LinkCurveType.Linear, GradePct_Down, FlowSpeed, 1, UsePctTurnsByFleet, PctTurnsAtLinkEnd, 0, 58, 0, 0, 0, 1117, TravelDirection.Straight);

            NewLink.Lanes[0].AllowedTurnMovements.Add(MovementDirectionCode.Right);

            NewLink.Lanes[0].ConnectingLaneIdsUpstream = LaneData.SetConnectingLaneIds(1, 0, 0);

            NewLink.Lanes[0].ConnectingLaneIdsDownstream = LaneData.SetConnectingLaneIds(0, 0, 1);

            links.Add(NewLink);
            network.LinkIdList.Add(NewLink.Id);

            // link 9->12
            PctTurnsAtLinkEnd = new List <float[]>();
            for (int k = 0; k <= 4; k++)
            {
                TurningPcts = new float[] { 100, 0, 0 };
                PctTurnsAtLinkEnd.Add(TurningPcts);
            }
            network.NumLinks++;
            NewLink = new LinkData(10, nodes[8], nodes[11], LinkType.ArterialConnector, LinkCurveType.Bezier, GradePct_DownRight, FlowSpeed, 1, UsePctTurnsByFleet, PctTurnsAtLinkEnd, 69, 0, 0, 0, 1213, 0, TravelDirection.LeftTurn, FreeFlowSpeedMethod.Measured, TwoLaneLinkPassingDesignation.NotAllowed, TwoLaneLinkPassingRule.None, nodes[8].PositionX, nodes[8].PositionY, nodes[8].PositionX, nodes[8].PositionY + 6, nodes[8].PositionX + 6, nodes[8].PositionY + 6);

            NewLink.Lanes[0].AllowedTurnMovements.Add(MovementDirectionCode.Through);

            NewLink.Lanes[0].ConnectingLaneIdsUpstream = LaneData.SetConnectingLaneIds(1, 0, 0);

            NewLink.Lanes[0].ConnectingLaneIdsDownstream = LaneData.SetConnectingLaneIds(0, 1, 0);

            links.Add(NewLink);
            network.LinkIdList.Add(NewLink.Id);

            // link 10->15
            PctTurnsAtLinkEnd = new List <float[]>();
            for (int k = 0; k <= 4; k++)
            {
                TurningPcts = new float[] { 0, 100, 0 };
                PctTurnsAtLinkEnd.Add(TurningPcts);
            }
            network.NumLinks++;
            NewLink = new LinkData(11, nodes[9], nodes[14], LinkType.ArterialConnector, LinkCurveType.Bezier, GradePct_DownLeft, FlowSpeed, 1, UsePctTurnsByFleet, PctTurnsAtLinkEnd, 0, 0, 710, 0, 1514, 0, TravelDirection.RightTurn, FreeFlowSpeedMethod.Measured, TwoLaneLinkPassingDesignation.NotAllowed, TwoLaneLinkPassingRule.None, nodes[9].PositionX, nodes[9].PositionY, nodes[9].PositionX, nodes[9].PositionY + 6, nodes[9].PositionX - 6, nodes[9].PositionY + 6);

            NewLink.Lanes[0].AllowedTurnMovements.Add(MovementDirectionCode.Through);

            NewLink.Lanes[0].ConnectingLaneIdsUpstream = LaneData.SetConnectingLaneIds(0, 0, 1);

            NewLink.Lanes[0].ConnectingLaneIdsDownstream = LaneData.SetConnectingLaneIds(0, 1, 0);

            links.Add(NewLink);
            network.LinkIdList.Add(NewLink.Id);

            // link 11->17
            network.NumLinks++;
            NewLink = new LinkData(12, nodes[10], nodes[16], LinkType.ArterialConnector, LinkCurveType.Bezier, GradePct_DownLeft, FlowSpeed, 1, UsePctTurnsByFleet, PctTurnsAtLinkEnd, 811, 0, 0, 0, 1716, 0, TravelDirection.RightTurn, FreeFlowSpeedMethod.Measured, TwoLaneLinkPassingDesignation.NotAllowed, TwoLaneLinkPassingRule.None, nodes[10].PositionX, nodes[10].PositionY, nodes[10].PositionX, nodes[10].PositionY + 6, nodes[10].PositionX - 6, nodes[10].PositionY + 6);

            NewLink.Lanes[0].AllowedTurnMovements.Add(MovementDirectionCode.Through);

            NewLink.Lanes[0].ConnectingLaneIdsUpstream = LaneData.SetConnectingLaneIds(0, 0, 1);

            NewLink.Lanes[0].ConnectingLaneIdsDownstream = LaneData.SetConnectingLaneIds(0, 1, 0);

            links.Add(NewLink);
            network.LinkIdList.Add(NewLink.Id);

            // link 12->13
            PctTurnsAtLinkEnd = new List <float[]>();
            for (int k = 0; k <= 4; k++)
            {
                TurningPcts = new float[] { 0, 0, 100 };
                PctTurnsAtLinkEnd.Add(TurningPcts);
            }
            network.NumLinks++;
            NewLink = new LinkData(13, nodes[11], nodes[12], LinkType.ArterialConnector, LinkCurveType.Linear, GradePct_Right, FlowSpeed, 1, UsePctTurnsByFleet, PctTurnsAtLinkEnd, 912, 0, 0, 0, 0, 1318, TravelDirection.Straight);

            NewLink.Lanes[0].AllowedTurnMovements.Add(MovementDirectionCode.Right);

            NewLink.Lanes[0].ConnectingLaneIdsUpstream = LaneData.SetConnectingLaneIds(1, 0, 0);

            NewLink.Lanes[0].ConnectingLaneIdsDownstream = LaneData.SetConnectingLaneIds(0, 0, 1);

            links.Add(NewLink);
            network.LinkIdList.Add(NewLink.Id);

            // link 15->14
            PctTurnsAtLinkEnd = new List <float[]>();
            for (int k = 0; k <= 4; k++)
            {
                TurningPcts = new float[] { 100, 0, 0 };
                PctTurnsAtLinkEnd.Add(TurningPcts);
            }
            network.NumLinks++;
            NewLink = new LinkData(14, nodes[14], nodes[13], LinkType.ArterialConnector, LinkCurveType.Linear, GradePct_Left, FlowSpeed, 1, UsePctTurnsByFleet, PctTurnsAtLinkEnd, 0, 1615, 1015, 1418, 0, 0, TravelDirection.Straight);

            NewLink.Lanes[0].AllowedTurnMovements.Add(MovementDirectionCode.Left);

            NewLink.Lanes[0].ConnectingLaneIdsUpstream = LaneData.SetConnectingLaneIds(0, 1, 1);

            NewLink.Lanes[0].ConnectingLaneIdsDownstream = LaneData.SetConnectingLaneIds(1, 0, 0);

            links.Add(NewLink);
            network.LinkIdList.Add(NewLink.Id);

            // link 16->15
            PctTurnsAtLinkEnd = new List <float[]>();
            for (int k = 0; k <= 4; k++)
            {
                TurningPcts = new float[] { 0, 100, 0 };
                PctTurnsAtLinkEnd.Add(TurningPcts);
            }
            network.NumLinks++;
            NewLink = new LinkData(15, nodes[15], nodes[14], LinkType.ArterialConnector, LinkCurveType.Linear, GradePct_Left, FlowSpeed, 1, UsePctTurnsByFleet, PctTurnsAtLinkEnd, 0, 1716, 0, 0, 1514, 0, TravelDirection.Straight);

            NewLink.Lanes[0].AllowedTurnMovements.Add(MovementDirectionCode.Through);

            NewLink.Lanes[0].ConnectingLaneIdsUpstream = LaneData.SetConnectingLaneIds(0, 1, 0);

            NewLink.Lanes[0].ConnectingLaneIdsDownstream = LaneData.SetConnectingLaneIds(0, 1, 0);

            links.Add(NewLink);
            network.LinkIdList.Add(NewLink.Id);

            // link 17->16
            network.NumLinks++;
            NewLink = new LinkData(16, nodes[16], nodes[15], LinkType.ArterialConnector, LinkCurveType.Linear, GradePct_Left, FlowSpeed, 1, UsePctTurnsByFleet, PctTurnsAtLinkEnd, 0, 0, 1117, 0, 1615, 0, TravelDirection.Straight);

            NewLink.Lanes[0].AllowedTurnMovements.Add(MovementDirectionCode.Through);

            NewLink.Lanes[0].ConnectingLaneIdsUpstream = LaneData.SetConnectingLaneIds(0, 1, 0);

            NewLink.Lanes[0].ConnectingLaneIdsDownstream = LaneData.SetConnectingLaneIds(0, 1, 0);

            links.Add(NewLink);
            network.LinkIdList.Add(NewLink.Id);

            // link 13->18
            PctTurnsAtLinkEnd = new List <float[]>();
            for (int k = 0; k <= 4; k++)
            {
                TurningPcts = new float[] { 0, 0, 100 };
                PctTurnsAtLinkEnd.Add(TurningPcts);
            }
            network.NumLinks++;
            NewLink = new LinkData(17, nodes[12], nodes[17], LinkType.ArterialConnector, LinkCurveType.Bezier, GradePct_DownRight, FlowSpeed, 1, UsePctTurnsByFleet, PctTurnsAtLinkEnd, 0, 0, 1213, 0, 18801, 0, TravelDirection.RightTurn, FreeFlowSpeedMethod.Measured, TwoLaneLinkPassingDesignation.NotAllowed, TwoLaneLinkPassingRule.None, nodes[12].PositionX, nodes[12].PositionY, nodes[12].PositionX + 6, nodes[12].PositionY, nodes[12].PositionX + 6, nodes[12].PositionY + 6);

            NewLink.Lanes[0].AllowedTurnMovements.Add(MovementDirectionCode.Through);

            NewLink.Lanes[0].ConnectingLaneIdsUpstream = LaneData.SetConnectingLaneIds(0, 0, 1);

            NewLink.Lanes[0].ConnectingLaneIdsDownstream = LaneData.SetConnectingLaneIds(0, 1, 0);

            links.Add(NewLink);
            network.LinkIdList.Add(NewLink.Id);

            // link 14->18
            PctTurnsAtLinkEnd = new List <float[]>();
            for (int k = 0; k <= 4; k++)
            {
                TurningPcts = new float[] { 100, 0, 0 };
                PctTurnsAtLinkEnd.Add(TurningPcts);
            }
            network.NumLinks++;
            NewLink = new LinkData(18, nodes[13], nodes[17], LinkType.ArterialConnector, LinkCurveType.Bezier, GradePct_Left, FlowSpeed, 1, UsePctTurnsByFleet, PctTurnsAtLinkEnd, 1514, 0, 0, 0, 18801, 0, TravelDirection.LeftTurn, FreeFlowSpeedMethod.Measured, TwoLaneLinkPassingDesignation.NotAllowed, TwoLaneLinkPassingRule.None, nodes[13].PositionX, nodes[13].PositionY, nodes[13].PositionX - 6, nodes[13].PositionY, nodes[13].PositionX - 6, nodes[13].PositionY + 6);

            NewLink.Lanes[0].AllowedTurnMovements.Add(MovementDirectionCode.Through);

            NewLink.Lanes[0].ConnectingLaneIdsUpstream = LaneData.SetConnectingLaneIds(1, 0, 0);

            NewLink.Lanes[0].ConnectingLaneIdsDownstream = LaneData.SetConnectingLaneIds(0, 2, 0);

            links.Add(NewLink);
            network.LinkIdList.Add(NewLink.Id);

            // link 19->1
            PctTurnsAtLinkEnd = new List <float[]>();
            for (int k = 0; k <= 4; k++)
            {
                TurningPcts = new float[] { 0, 50, 50 };
                PctTurnsAtLinkEnd.Add(TurningPcts);
            }
            network.NumLinks++;
            NewLink = new LinkData(19, nodes[18], nodes[0], LinkType.ArterialConnector, LinkCurveType.Linear, GradePct_Right, FlowSpeed, 2, UsePctTurnsByFleet, PctTurnsAtLinkEnd, 0, 70119, 0, 0, 12, 16, TravelDirection.Straight);

            NewLink.Lanes[0].AllowedTurnMovements.Add(MovementDirectionCode.Through);
            NewLink.Lanes[0].AllowedTurnMovements.Add(MovementDirectionCode.Right);
            NewLink.Lanes[1].AllowedTurnMovements.Add(MovementDirectionCode.Through);

            NewLink.Lanes[0].ConnectingLaneIdsUpstream = LaneData.SetConnectingLaneIds(0, 1, 0);
            NewLink.Lanes[1].ConnectingLaneIdsUpstream = LaneData.SetConnectingLaneIds(0, 2, 0);

            NewLink.Lanes[0].ConnectingLaneIdsDownstream = LaneData.SetConnectingLaneIds(0, 1, 1);
            NewLink.Lanes[1].ConnectingLaneIdsDownstream = LaneData.SetConnectingLaneIds(0, 2, 0);

            links.Add(NewLink);
            network.LinkIdList.Add(NewLink.Id);


            // entry link
            PctTurnsAtLinkEnd = new List <float[]>();
            for (int k = 0; k <= 4; k++)
            {
                TurningPcts = new float[] { 0, 100, 0 };
                PctTurnsAtLinkEnd.Add(TurningPcts);
            }
            network.NumLinks++;
            NewLink = new LinkData(20, nodes[19], nodes[18], LinkType.ArterialEntry, LinkCurveType.Linear, GradePct_Right, FlowSpeed, 2, UsePctTurnsByFleet, PctTurnsAtLinkEnd, 0, 0, 0, 0, 191, 0, TravelDirection.Straight);

            NewLink.Lanes[0].AllowedTurnMovements.Add(MovementDirectionCode.Through);
            NewLink.Lanes[1].AllowedTurnMovements.Add(MovementDirectionCode.Through);

            NewLink.Lanes[0].ConnectingLaneIdsDownstream = LaneData.SetConnectingLaneIds(0, 1, 0);
            NewLink.Lanes[1].ConnectingLaneIdsDownstream = LaneData.SetConnectingLaneIds(0, 2, 0);

            links.Add(NewLink);
            network.LinkIdList.Add(NewLink.Id);

            // exit link
            network.NumLinks++;
            NewLink = new LinkData(21, nodes[17], nodes[20], LinkType.ArterialExit, LinkCurveType.Linear, 0, FlowSpeed, 2, UsePctTurnsByFleet, PctTurnsAtLinkEnd, 1318, 0, 1418, 0, 0, 0, TravelDirection.Straight);

            NewLink.Lanes[0].AllowedTurnMovements.Add(MovementDirectionCode.Through);
            NewLink.Lanes[1].AllowedTurnMovements.Add(MovementDirectionCode.Through);

            NewLink.Lanes[0].ConnectingLaneIdsUpstream = LaneData.SetConnectingLaneIds(0, 0, 1);
            NewLink.Lanes[1].ConnectingLaneIdsUpstream = LaneData.SetConnectingLaneIds(1, 0, 0);

            links.Add(NewLink);
            network.LinkIdList.Add(NewLink.Id);
        }
Exemple #28
0
		protected override void InitBehaviourTree()
		{
			const string SUBJECT = "S_SUBJECT";
			const string TARGET = "UNIT_TARGET";
			const string TARGETS_STACK = "UNIT_TARGETS_STACK";

			const string POTENTIAL_TARGET = "UNIT_POTENTIAL_TARGET";

			const string RANGE_VAR = "F_RANGE";

			_behaviorContext = new BehaviorContext();
			_behaviorContext[SUBJECT] = this;
			_behaviorContext[RANGE_VAR] = 5f;


			if (BehaviorTreeGlobals.behaviorTrees.ContainsKey(SimpleUnitBehaviorTreeKey)
			    && BehaviorTreeGlobals.behaviorTrees[SimpleUnitBehaviorTreeKey].IsAlive)
			{
				behaviourTree = BehaviorTreeGlobals.behaviorTrees[SimpleUnitBehaviorTreeKey].Target;

			}
			else
			{
				behaviourTree = new EntryNode( 
				new SelectorCompositeNode(
					new SequenceCompositeNode(
						// Get a target
						new SelectorCompositeNode(
							// Do we already have a VALID target
							new SequenceCompositeNode(
								new ContainsUnit(TARGET),
								new CanTargetUnit(SUBJECT, TARGET),
								new IsUnitInRange(SUBJECT, TARGET)
								//new PrintNode("Has preexisting target")

								),
							// if not, empty the TARGET var
							new FailerDecoratorNode(
								new SetToNullNode(TARGET)
							),

							// If not, find a new target, this returns true if it found a target
							new SequenceCompositeNode(
								new ClearStack(TARGETS_STACK),
								new FindTargets(SUBJECT, TARGETS_STACK, RANGE_VAR),

								//new PrintNode("Starting Search"),

								new EditorRegionDecoratorNode(
								new RepeatUntilFailDecoratorNode(
									new SequenceCompositeNode(

										new PopFromStack(TARGETS_STACK, POTENTIAL_TARGET),

										new InverterDecoratorNode(
											new SequenceCompositeNode(
												new ShouldTargetUnit(SUBJECT, POTENTIAL_TARGET),

												new CanTargetUnit(SUBJECT, POTENTIAL_TARGET),

												// Passed all the checks, it's promoted to target now
												new SetVarTo<ContextIndex>(TARGET, POTENTIAL_TARGET)
											)
										),

										new SetToNullNode(POTENTIAL_TARGET)

									)
								), Color.yellow, "Find a target", treeIndex: CheckTargetTreeKey
								),
								//new PrintNode("At the end of the road:"),
								//new PrintVarNode(TARGET),


								new InverterDecoratorNode(
									new IsNullNode(TARGET)
									)
								)
							// Couldn't find any target

							),
						// We could find a target
						// Now move in for the kill


						new SequenceCompositeNode(
							new InverterDecoratorNode(
								new SequenceCompositeNode(
									new IsUnitInRange(SUBJECT, TARGET),
									new CanTargetUnit(SUBJECT, TARGET),
									new AttackUnit(SUBJECT, TARGET)

								)
							),
							new MoveToUnit(SUBJECT, TARGET)
						)

					// 


					),
					new SequenceCompositeNode(
						new MoveNode(SUBJECT)
					)
				),
				SimpleUnitBehaviorTreeKey);


			}

		
			BehaviorTreeGlobals.behaviorContexts.Add(new WeakReferenceT<BehaviorContext>(_behaviorContext));

		}
Exemple #29
0
        private void SetupTransitions(IChapter chapter, EntryNode entryNode, IDictionary <IStep, StepNode> stepNodes)
        {
            if (chapter.Data.FirstStep != null)
            {
                CreateNewTransition(entryNode.ExitJoints.First(), stepNodes[chapter.Data.FirstStep].EntryJoints.First());
            }

            foreach (IStep step in stepNodes.Keys)
            {
                foreach (ITransition transition in step.Data.Transitions.Data.Transitions)
                {
                    ExitJoint joint = stepNodes[step].AddExitJoint();
                    if (transition.Data.TargetStep != null)
                    {
                        StepNode target = stepNodes[transition.Data.TargetStep];
                        CreateNewTransition(joint, target.EntryJoints.First());
                    }

                    IStep       closuredStep       = step;
                    ITransition closuredTransition = transition;
                    int         transitionIndex    = step.Data.Transitions.Data.Transitions.IndexOf(closuredTransition);

                    joint.GraphicalEventHandler.PointerDrag += (sender, args) =>
                    {
                        joint.DragDelta = args.PointerPosition - joint.Position;
                    };

                    joint.GraphicalEventHandler.PointerUp += (sender, args) =>
                    {
                        GraphicalElement elementUnderCursor = Graphics.GetGraphicalElementWithHandlerAtPoint(args.PointerPosition).FirstOrDefault();

                        EntryJoint endJoint = elementUnderCursor as EntryJoint;

                        if (endJoint == null)
                        {
                            joint.DragDelta = Vector2.zero;

                            if (elementUnderCursor != null)
                            {
                                return;
                            }
                        }

                        StepNode endJointStepNode = endJoint == null ? null : endJoint.Parent as StepNode;

                        IStep targetStep = null;
                        IStep oldStep    = closuredTransition.Data.TargetStep;

                        if (endJointStepNode != null)
                        {
                            targetStep = endJointStepNode.Step;
                        }

                        RevertableChangesHandler.Do(new TrainingCommand(() =>
                        {
                            closuredTransition.Data.TargetStep = targetStep;
                            SelectStepNode(stepNodes[closuredStep]);
                            MarkToRefresh();
                        },
                                                                        () =>
                        {
                            closuredTransition.Data.TargetStep = oldStep;
                            SelectStepNode(stepNodes[closuredStep]);
                            MarkToRefresh();
                        }
                                                                        ));

                        joint.DragDelta = Vector2.zero;
                    };

                    joint.GraphicalEventHandler.ContextClick += (sender, args) =>
                    {
                        TestableEditorElements.DisplayContextMenu(new List <TestableEditorElements.MenuOption>
                        {
                            new TestableEditorElements.MenuItem(new GUIContent("Delete transition"), false, () =>
                            {
                                RevertableChangesHandler.Do(new TrainingCommand(() =>
                                {
                                    closuredStep.Data.Transitions.Data.Transitions.Remove(closuredTransition);
                                    MarkToRefresh();
                                },
                                                                                () =>
                                {
                                    closuredStep.Data.Transitions.Data.Transitions.Insert(transitionIndex, closuredTransition);
                                    MarkToRefresh();
                                }
                                                                                ));
                            })
                        });
                    };
                }
            }
        }
 public void TranslateMethodEntry(EntryNode node)
 {
     // Go to the next state
     WriteGotoOutputPin(node.OutputExecPins[0]);
 }
Exemple #31
0
 public static XzaarAnalyzedTree AnalyzeExpression(this EntryNode node)
 {
     return(new XzaarExpressionAnalyzer().AnalyzeExpression(node));
 }