/// <summary>
        /// Populate the (all) roadList and the roadTypeList.
        /// </summary>
        private void GetRoadList()
        {
            // Reset
            numAllRoads     = 0;
            numAllRoadTypes = 0;

            if (roadList == null)
            {
                roadList = new List <LBRoad>(50);
            }
            else
            {
                roadList.Clear();
            }

            if (roadTypeList == null)
            {
                roadTypeList = new List <LBRoadType>(20);
            }
            else
            {
                roadTypeList.Clear();
            }

            // Populate the list of roads
            LBIntegration.GetERRoadList(roadList, true);

            numAllRoads = roadList == null ? 0 : roadList.Count;

            // Populate the list of road types
            string     roadTypeDesc = string.Empty;
            LBRoadType lbRoadType   = null;

            for (int r = 0; r < numAllRoads; r++)
            {
                roadTypeDesc = roadList[r].roadTypeDesc;

                if (!roadTypeList.Exists(typ => typ.roadTypeDesc == roadTypeDesc && !string.IsNullOrEmpty(roadTypeDesc)))
                {
                    lbRoadType = new LBRoadType();
                    if (lbRoadType != null)
                    {
                        lbRoadType.roadTypeDesc = roadTypeDesc;
                        roadTypeList.Add(lbRoadType);
                    }
                }
            }

            numAllRoadTypes = roadTypeList == null ? 0 : roadTypeList.Count;

            //Debug.Log("[DEBUG] roads: " + roadList.Count);
        }
        private void OnGUI()
        {
            #region Initialise

            defaultEditorLabelWidth = EditorGUIUtility.labelWidth;
            defaultEditorFieldWidth = EditorGUIUtility.fieldWidth;

            //if (labelFieldRichText == null)
            {
                labelFieldRichText          = new GUIStyle("Label");
                labelFieldRichText.richText = true;
            }

            // Overide default styles
            EditorStyles.foldout.fontStyle = FontStyle.Bold;

            // When using a no-label foldout, don't forget to set the global
            // EditorGUIUtility.fieldWidth to a small value like 15, then back
            // to the original afterward.
            foldoutStyleNoLabel            = new GUIStyle(EditorStyles.foldout);
            foldoutStyleNoLabel.fixedWidth = 0.01f;
            #endregion

            GUILayout.BeginVertical("HelpBox");

            EditorGUILayout.HelpBox("The LB Path Importer will help you import Group Object Paths from an external source (e.g. EasyRoads3D) [EXPERIMENTAL]", MessageType.Info, true);
            EditorGUIUtility.labelWidth = 100f;
            landscape = (LBLandscape)EditorGUILayout.ObjectField(landscapeContent, landscape, typeof(LBLandscape), true);
            EditorGUIUtility.labelWidth = defaultEditorLabelWidth;

            EditorGUILayout.Space();

            #region Import - EasyRoads

            currentBgndColor    = GUI.backgroundColor;
            GUI.backgroundColor = GUI.backgroundColor * (EditorGUIUtility.isProSkin ? 0.7f : 1.3f);
            GUILayout.BeginVertical(EditorStyles.helpBox);
            GUI.backgroundColor = currentBgndColor;
            EditorGUILayout.LabelField("<color=" + txtColourName + "><b>Import from EasyRoads3D</b></color>", labelFieldRichText);

            #if LB_EDITOR_ER3
            GUILayout.BeginHorizontal();
            if (GUILayout.Button(erGetRoadsBtnContent, GUILayout.MaxWidth(100f)))
            {
                GetRoadList();
                GetFilteredRoadList();
            }
            if (GUILayout.Button(erClearRoadsBtnContent, GUILayout.MaxWidth(100f)))
            {
                if (roadList != null)
                {
                    roadList.Clear();
                }
                if (filteredRoadList != null)
                {
                    filteredRoadList.Clear();
                }
                if (roadTypeList != null)
                {
                    roadTypeList.Clear();
                }
                numAllRoads      = 0;
                numFilteredRoads = 0;
                numAllRoadTypes  = 0;
            }
            GUILayout.EndHorizontal();
            #else
            EditorGUILayout.HelpBox("EasyRoads3D v3.x does not appear to be installed", MessageType.Info, true);
            #endif
            #endregion

            EditorGUILayout.LabelField("Roads (all): " + numAllRoads.ToString("###0"));
            EditorGUILayout.LabelField("Roads (filtered): " + numFilteredRoads.ToString("###0"));
            EditorGUILayout.Space();

            EditorGUILayout.LabelField("<color=" + txtColourName + "><b>Copy Filtered Roads to LB Group</b></color>", labelFieldRichText);
            if (landscape == null)
            {
                EditorGUILayout.HelpBox("Select a landscape to export roads to Group Object Paths", MessageType.Info, true);
            }
            else
            {
                List <LBGroup> groupList = landscape.lbGroupList.FindAll(grp => grp.lbGroupType == LBGroup.LBGroupType.Uniform);

                int numUniformGroups = groupList == null ? 0 : groupList.Count;

                GetGroupNameList();

                if (numUniformGroups == 0)
                {
                    EditorGUILayout.HelpBox("There are no Uniform Groups in the landscape", MessageType.Info, true);
                }
                else
                {
                    EditorGUI.BeginChangeCheck();
                    GUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("Target Group", GUILayout.Width(90f));
                    if (groupLookupIndex > numGroupNames - 1)
                    {
                        groupLookupIndex = -1; lbGroupTarget = null;
                    }
                    ;
                    groupLookupIndex = EditorGUILayout.Popup(groupLookupIndex, groupNameList.ToArray());
                    GUILayout.EndHorizontal();
                    if (EditorGUI.EndChangeCheck())
                    {
                        // Attempt to get the actual LBGroup instance
                        if (groupLookupIndex < 0 || groupLookupIndex > numGroupNames - 1)
                        {
                            lbGroupTarget = null;
                        }
                        else
                        {
                            string groupName = groupNameList[groupLookupIndex];
                            if (string.IsNullOrEmpty(groupName))
                            {
                                lbGroupTarget = null;
                            }
                            else if (groupName.Length < 7)
                            {
                                lbGroupTarget = null;
                            }
                            else
                            {
                                // Extract the group number out of the group name string
                                int nextSpace = groupName.IndexOf(" ", 6);
                                if (nextSpace < 7)
                                {
                                    lbGroupTarget = null;
                                }
                                else
                                {
                                    int grpNumber = -1;
                                    int.TryParse(groupName.Substring(6, nextSpace - 6), out grpNumber);
                                    if (grpNumber >= 0)
                                    {
                                        lbGroupTarget = landscape.lbGroupList[grpNumber - 1];
                                        //Debug.Log("[DEBUG: group " + lbGroupTarget == null ? "uknown" : lbGroupTarget.groupName);
                                    }
                                }
                            }
                        }
                    }

                    // If user has deleted a Group which was previously selected in the Path Importer, remove this as the target
                    if (groupLookupIndex < 0 && lbGroupTarget != null)
                    {
                        lbGroupTarget = null;
                    }

                    #if LB_EDITOR_ER3
                    splinePointFilterSize = EditorGUILayout.IntSlider(erSplinePointSizeContent, splinePointFilterSize, 1, 50);
                    #endif

                    GUILayout.BeginHorizontal();
                    if (GUILayout.Button(copyRoadsBtnContent, GUILayout.MaxWidth(100f)))
                    {
                        if (lbGroupTarget != null)
                        {
                            #if LB_EDITOR_ER3
                            GetERSplineForRoads();
                            #endif
                            CopyRoads(false);
                        }
                        else
                        {
                            EditorUtility.DisplayDialog("Copy Roads to Group", "You need to select a Target (Uniform) Group first", "Got it!");
                        }
                    }
                    if (GUILayout.Button(updateRoadsBtnContent, GUILayout.MaxWidth(100f)))
                    {
                        if (lbGroupTarget != null)
                        {
                            #if LB_EDITOR_ER3
                            GetERSplineForRoads();
                            #endif
                            CopyRoads(true);
                        }
                        else
                        {
                            EditorUtility.DisplayDialog("Update Roads in Group", "You need to select a Target (Uniform) Group first", "Got it!");
                        }
                    }
                    GUILayout.EndHorizontal();
                }
                //landscape.lbGroupList.Exists(grp => grp.showGroupsInScene == true);
            }

            EditorGUILayout.Space();

            scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition);

            #region Filtering

            GUILayout.BeginHorizontal();
            // A Foldout with no label must have a style fixedWidth of low non-zero value, and have a small (global) fieldWidth.
            EditorGUIUtility.fieldWidth = 17f;
            isShowFilterList            = EditorGUILayout.Foldout(isShowFilterList, "", foldoutStyleNoLabel);
            EditorGUIUtility.fieldWidth = defaultEditorFieldWidth;
            EditorGUI.BeginChangeCheck();
            isFilterByRoadType = EditorGUILayout.Toggle(filterByRoadTypeContent, isFilterByRoadType);
            GUILayout.EndHorizontal();
            if (EditorGUI.EndChangeCheck())
            {
                GetFilteredRoadList();
            }

            if (isFilterByRoadType)
            {
                if (roadTypeList == null)
                {
                    roadTypeList = new List <LBRoadType>(20);
                }
                if (isShowFilterList)
                {
                    for (int rt = 0; rt < numAllRoadTypes; rt++)
                    {
                        lbRoadType = roadTypeList[rt];
                        if (lbRoadType != null)
                        {
                            GUILayout.BeginHorizontal();
                            EditorGUI.BeginChangeCheck();
                            lbRoadType.isSelected = EditorGUILayout.Toggle(lbRoadType.isSelected, GUILayout.Width(colSelectorWidth));
                            GUILayout.Label(lbRoadType.roadTypeDesc);
                            GUILayout.EndHorizontal();
                            if (EditorGUI.EndChangeCheck())
                            {
                                GetFilteredRoadList();
                            }
                        }
                    }
                }
            }

            EditorGUILayout.Space();

            #endregion

            #region Display Filtered Road List

            // Header
            GUILayout.BeginHorizontal();
            EditorGUI.BeginChangeCheck();
            isSelectAllFilteredRoads = EditorGUILayout.Toggle(isSelectAllFilteredRoads, GUILayout.Width(colSelectorWidth));
            if (EditorGUI.EndChangeCheck())
            {
                SelectFilteredRoads(isSelectAllFilteredRoads);
            }
            EditorGUILayout.LabelField("<color=" + txtColourName + "><b>Road Type</b></color>", labelFieldRichText, GUILayout.Width(colRoadTypeWidth));
            EditorGUILayout.LabelField("<color=" + txtColourName + "><b>Road Name</b></color>", labelFieldRichText, GUILayout.Width(colRoadNameWidth));
            GUILayout.EndHorizontal();

            for (int i = 0; i < numFilteredRoads; i++)
            {
                if (i > 200)
                {
                    if (i != numFilteredRoads - 1)
                    {
                        continue;
                    }
                    else
                    {
                        GUILayout.Label("..");
                    }
                }

                lbRoad = filteredRoadList[i];

                if (lbRoad != null)
                {
                    // Display the selectable road
                    GUILayout.BeginHorizontal();
                    //if (GUILayout.Button(new GUIContent("v", "Move road down in the list"), buttonCompact, GUILayout.MaxWidth(20f)))
                    //{
                    //    lbRoadMoveDown = new LBRoad(lbRoad);
                    //    lbRoadMovePos = i;
                    //}
                    lbRoad.isSelected = EditorGUILayout.Toggle(lbRoad.isSelected, GUILayout.Width(colSelectorWidth));
                    //GUILayout.Label(new GUIContent("R", "Reverse direction of path for this road"), GUILayout.Width(12f));
                    //lbRoad.isReversed = EditorGUILayout.Toggle(lbRoad.isReversed, GUILayout.Width(20f));
                    GUILayout.Label(lbRoad.roadTypeDesc, GUILayout.Width(colRoadTypeWidth));
                    GUILayout.Label(lbRoad.roadName, GUILayout.Width(colRoadNameWidth));
                    GUILayout.EndHorizontal();
                }
            }

            #endregion

            GUILayout.EndVertical();

            EditorGUILayout.EndScrollView();
            GUILayout.EndVertical();
        }