Skip to content

Commit

Permalink
add crosswalk
Browse files Browse the repository at this point in the history
  • Loading branch information
moelang committed Apr 16, 2020
1 parent 69a3f16 commit c3fae8b
Show file tree
Hide file tree
Showing 89 changed files with 673 additions and 182 deletions.
2 changes: 0 additions & 2 deletions .gitattributes

This file was deleted.

29 changes: 29 additions & 0 deletions Editor/Autoware/ADASGoAreaEditor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#region License
/******************************************************************************
* Copyright 2018-2020 The AutoCore Authors. All Rights Reserved.
*
* Licensed under the GNU Lesser General Public License, Version 3.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/lgpl-3.0.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#endregion


using AutoCore.MapToolbox.Autoware;
using UnityEditor;

namespace AutoCore.MapToolbox.Editor.Autoware
{
[CustomEditor(typeof(ADASGoArea))]
class ADASGoAreaEditor : BrokenLineRendererEditor<ADASGoLine>
{
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Editor/Autoware/AutowareADASMapEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ public override void OnInspectorGUI()
{
(target as AutowareADASMap).AddRoadEdge(SceneView.lastActiveSceneView.pivot);
}
else if (GUILayout.Button(Const.AddCrossWalk))
{
(target as AutowareADASMap).AddCrossWalk(SceneView.lastActiveSceneView.pivot);
}
else if (GUILayout.Button(Const.AddRoadMark))
{
(target as AutowareADASMap).AddRoadMark(SceneView.lastActiveSceneView.pivot);
}
GUI.color = Color.green;
if (GUILayout.Button(LoadFromFolder))
{
Expand Down
39 changes: 39 additions & 0 deletions Editor/Autoware/CollectionCrossWalkEditor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#region License
/******************************************************************************
* Copyright 2018-2020 The AutoCore Authors. All Rights Reserved.
*
* Licensed under the GNU Lesser General Public License, Version 3.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/lgpl-3.0.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#endregion


using AutoCore.MapToolbox.Autoware;
using UnityEditor;
using UnityEngine;

namespace AutoCore.MapToolbox.Editor.Autoware
{
[CustomEditor(typeof(CollectionCrossWalk))]
class CollectionCrossWalkEditor : UnityEditor.Editor
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
GUI.color = Color.yellow;
if (GUILayout.Button(Const.AddCrossWalk))
{
(target as CollectionCrossWalk).AddCrossWalk(SceneView.lastActiveSceneView.pivot);
}
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@

namespace AutoCore.MapToolbox.Editor.Autoware
{
[CustomEditor(typeof(CollectionADASLane))]
class CollectionADASGoLaneEditor : UnityEditor.Editor
[CustomEditor(typeof(CollectionLane))]
class CollectionLaneEditor : UnityEditor.Editor
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
GUI.color = Color.yellow;
if (GUILayout.Button(Const.AddLane))
{
(target as CollectionADASLane).AddLane(SceneView.lastActiveSceneView.pivot);
(target as CollectionLane).AddLane(SceneView.lastActiveSceneView.pivot);
}
GUI.color = Color.white;
if (GUILayout.Button("Find Ref"))
{
(target as CollectionADASLane).FindRef();
(target as CollectionLane).FindRef();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@

namespace AutoCore.MapToolbox.Editor.Autoware
{
[CustomEditor(typeof(CollectionADASRoadEdge))]
class CollectionADASGoRoadEdgeEditor : UnityEditor.Editor
[CustomEditor(typeof(CollectionRoadEdge))]
class CollectionRoadEdgeEditor : UnityEditor.Editor
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
GUI.color = Color.yellow;
if (GUILayout.Button(Const.AddRoadEdge))
{
(target as CollectionADASRoadEdge).AddRoadEdge(SceneView.lastActiveSceneView.pivot);
(target as CollectionRoadEdge).AddRoadEdge(SceneView.lastActiveSceneView.pivot);
}
}
}
Expand Down
39 changes: 39 additions & 0 deletions Editor/Autoware/CollectionRoadMarkEditor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#region License
/******************************************************************************
* Copyright 2018-2020 The AutoCore Authors. All Rights Reserved.
*
* Licensed under the GNU Lesser General Public License, Version 3.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/lgpl-3.0.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#endregion


using AutoCore.MapToolbox.Autoware;
using UnityEditor;
using UnityEngine;

namespace AutoCore.MapToolbox.Editor.Autoware
{
[CustomEditor(typeof(CollectionRoadMark))]
class CollectionRoadMarkEditor : UnityEditor.Editor
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
GUI.color = Color.yellow;
if (GUILayout.Button(Const.AddRoadMark))
{
(target as CollectionRoadMark).AddRoadMark(SceneView.lastActiveSceneView.pivot);
}
}
}
}
11 changes: 11 additions & 0 deletions Editor/Autoware/CollectionRoadMarkEditor.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@

namespace AutoCore.MapToolbox.Editor.Autoware
{
[CustomEditor(typeof(CollectionADASSignal))]
class CollectionADASGoSignalEditor : UnityEditor.Editor
[CustomEditor(typeof(CollectionSignal))]
class CollectionSignalEditor : UnityEditor.Editor
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
GUI.color = Color.yellow;
if (GUILayout.Button(Const.AddSignal))
{
(target as CollectionADASSignal).AddSignal(SceneView.lastActiveSceneView.pivot);
(target as CollectionSignal).AddSignal(SceneView.lastActiveSceneView.pivot);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@

namespace AutoCore.MapToolbox.Editor.Autoware
{
[CustomEditor(typeof(CollectionADASStopLine))]
class CollectionADASGoStopLineEditor : UnityEditor.Editor
[CustomEditor(typeof(CollectionStopLine))]
class CollectionStopLineEditor : UnityEditor.Editor
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
GUI.color = Color.yellow;
if (GUILayout.Button(Const.AddStopLine))
{
(target as CollectionADASStopLine).AddStopLine(SceneView.lastActiveSceneView.pivot);
(target as CollectionStopLine).AddStopLine(SceneView.lastActiveSceneView.pivot);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@

namespace AutoCore.MapToolbox.Editor.Autoware
{
[CustomEditor(typeof(CollectionADASWhiteLine))]
class CollectionADASGoWhiteLineEditor : UnityEditor.Editor
[CustomEditor(typeof(CollectionWhiteLine))]
class CollectionWhiteLineEditor : UnityEditor.Editor
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
GUI.color = Color.yellow;
if (GUILayout.Button(Const.AddWhiteLine))
{
(target as CollectionADASWhiteLine).AddWhiteLine(SceneView.lastActiveSceneView.pivot);
(target as CollectionWhiteLine).AddWhiteLine(SceneView.lastActiveSceneView.pivot);
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions Editor/Autoware/Const.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,7 @@ class Const
public const string AddStopLine = "Add Stop Line";
public const string AddWhiteLine = "Add White Line";
public const string AddRoadEdge = "Add Road Edge";
public const string AddCrossWalk = "Add Cross Walk";
public const string AddRoadMark = "Add Road Mark";
}
}
1 change: 1 addition & 0 deletions Runtime/Autoware/ADASCollection/CollectionADASMapGo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public T this[int index]
return default;
}
}
public bool TryGetValue(int key, out T value) => Dic.TryGetValue(key, out value);
public void Add(int id, T value)
{
if (Dic.ContainsKey(id))
Expand Down
65 changes: 65 additions & 0 deletions Runtime/Autoware/ADASCollection/CollectionCrossWalk.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#region License
/******************************************************************************
* Copyright 2018-2020 The AutoCore Authors. All Rights Reserved.
*
* Licensed under the GNU Lesser General Public License, Version 3.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/lgpl-3.0.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#endregion


using System.Linq;
using UnityEngine;

namespace AutoCore.MapToolbox.Autoware
{
class CollectionCrossWalk : CollectionADASMapGo<ADASGoCrossWalk>
{
public override void Csv2Go()
{
foreach (var item in ADASMapCrossWalk.List)
{
var slices = new GameObject().AddComponent<ADASGoCrossWalk>();
slices.transform.SetParent(transform);
slices.CrossWalk = item;
}
foreach (var item in GetComponentsInChildren<ADASGoCrossWalk>())
{
item.UpdateBorder();
item.UpdateRenderer();
}
}
public override void Go2Csv()
{
int id = 1;
Dic = GetComponentsInChildren<ADASGoCrossWalk>().ToDictionary(_ => id++);
foreach (var item in GetComponentsInChildren<ADASGoCrossWalk>())
{
item.BuildData();
}
foreach (var item in GetComponentsInChildren<ADASGoCrossWalk>())
{
item.BuildDataRef();
}
}
public void AddCrossWalk(Vector3 position)
{
position.y = 0;
var crosswalk = new GameObject(typeof(ADASGoCrossWalk).Name).AddComponent<ADASGoCrossWalk>();
crosswalk.transform.SetParent(transform);
crosswalk.transform.position = position;
#if UNITY_EDITOR
UnityEditor.Selection.activeGameObject = crosswalk.gameObject;
#endif
}
}
}
11 changes: 11 additions & 0 deletions Runtime/Autoware/ADASCollection/CollectionCrossWalk.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@
#endregion


using System;
using System.Linq;
using UnityEngine;

namespace AutoCore.MapToolbox.Autoware
{
class CollectionADASLane : CollectionADASMapGo<ADASGoLane>
class CollectionLane : CollectionADASMapGo<ADASGoLane>
{
public override void Csv2Go()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

namespace AutoCore.MapToolbox.Autoware
{
class CollectionADASPole : CollectionADASMapGo<ADASGoPole>
class CollectionPole : CollectionADASMapGo<ADASGoPole>
{
public override void Csv2Go()
{
Expand Down
Loading

0 comments on commit c3fae8b

Please sign in to comment.