コード例 #1
0
        private static MapPoint ToMapPoint(this MapLinePoint linePoint, int index)
        {
            var mapPoint = new MapPoint(linePoint.ToPoint(),
                                        index, linePoint.Name, linePoint.PointType, linePoint.SpeedLimit);

            ParseProperties(mapPoint, linePoint.Settings);

            return(mapPoint);
        }
コード例 #2
0
 private void MGridView_ItemClick(object sender, AdapterView.ItemClickEventArgs e)
 {
     try
     {
         var mapLinePoint = new MapLinePoint();
         var Point        = lstExamItem[e.Position];
         speaker.PlayAudioAsync(Point.Value.Name);
         mapLinePoint.Name           = Point.Value.Name;
         mapLinePoint.Latitude       = carSignal.Gps.LatitudeDegrees;
         mapLinePoint.Longitude      = carSignal.Gps.LongitudeDegrees;
         mapLinePoint.Angle          = carSignal.Gps.AngleDegrees;
         mapLinePoint.Altitude       = carSignal.Gps.AltitudeMeters;
         mapLinePoint.PointType      = Point.Value.PointType;
         mapLinePoint.SequenceNumber = lstRoadMapExamItem.Count > 0 ? lstRoadMapExamItem.Max(x => x.Value.SequenceNumber) + 1 : 1;
         mapKeyValue = new KeyValuePair <int, MapLinePoint>(Point.Key, mapLinePoint);
         lstRoadMapExamItem.Add(mapKeyValue);
         InitRoadMap();
     }
     catch (Exception ex)
     {
         Logger.Error("MapItemClick", ex.Message);
     }
 }
コード例 #3
0
ファイル: NpcEditHelper.cs プロジェクト: dongpeng1988/xlj
    public void addLine(MapLine node)
    {
        addMapLine(node, OPERATE_ADD);
        Vector3 npcPos = new Vector3(0, 0, 0);

        GameObject obj = npcHelper.AddLine(node);

        if (obj == null)
        {
            return;
        }
        //EditorTool.CenterObj(obj);
        for (int i = 0; i < node.linepts.Count; i++)
        {
            if (EditorData.terrainMan != null)
            {
                Transform trans = obj.transform.FindChild("points" + (i + 1));
                if (trans == null)
                {
                    continue;
                }
                EditorTool.CenterObj(trans.gameObject);
                Vector3 pos = trans.localPosition;
                pos.y = EditorData.terrainMan.GetHeight(pos.x, pos.z);
                obj.transform.localPosition = pos;
                IntPoint     pt      = PathUtilEdit.Real2Logic(pos);
                MapLinePoint tempPos = node.linepts[i];
                //node.linepts[i].x= pt.x;
                //node.linepts[i].y = pt.y;

                //EditorTool.LookObj(obj);
            }
        }

        node.target = obj;
    }
コード例 #4
0
 public static Coordinate ToPoint(this MapLinePoint linePoint)
 {
     return(new Coordinate(linePoint.Longitude, linePoint.Latitude, linePoint.Altitude.GetValueOrDefault(), linePoint.Angle));
 }
コード例 #5
0
        //初始化考试项目地图
        public void InitExamItemMap()
        {
            //一共19个考试项目

            try
            {
                mapLinePoint = new MapLinePoint()
                {
                    Name = "公交汽车", PointType = MapPointType.BusArea, SequenceNumber = 1
                };
                mapKeyValue = new KeyValuePair <int, MapLinePoint>(Resource.Drawable.bus_station, mapLinePoint);
                lstExamItem.Add(mapKeyValue);

                mapLinePoint = new MapLinePoint()
                {
                    Name = "学校区域", PointType = MapPointType.SchoolArea, SequenceNumber = 2
                };
                mapKeyValue = new KeyValuePair <int, MapLinePoint>(Resource.Drawable.school, mapLinePoint);
                lstExamItem.Add(mapKeyValue);

                mapLinePoint = new MapLinePoint()
                {
                    Name = "人行横道", PointType = MapPointType.PedestrianCrossing, SequenceNumber = 3
                };
                mapKeyValue = new KeyValuePair <int, MapLinePoint>(Resource.Drawable.zebra, mapLinePoint);
                lstExamItem.Add(mapKeyValue);

                mapLinePoint = new MapLinePoint()
                {
                    Name = "减速慢行", PointType = MapPointType.SlowSpeed, SequenceNumber = 4
                };
                mapKeyValue = new KeyValuePair <int, MapLinePoint>(Resource.Drawable.slowspeed, mapLinePoint);
                lstExamItem.Add(mapKeyValue);

                mapLinePoint = new MapLinePoint()
                {
                    Name = "路口左转", PointType = MapPointType.TurnLeft, SequenceNumber = 5
                };
                mapKeyValue = new KeyValuePair <int, MapLinePoint>(Resource.Drawable.turn_left, mapLinePoint);
                lstExamItem.Add(mapKeyValue);

                mapLinePoint = new MapLinePoint()
                {
                    Name = "路口右转", PointType = MapPointType.TurnRight, SequenceNumber = 6
                };
                mapKeyValue = new KeyValuePair <int, MapLinePoint>(Resource.Drawable.turn_right, mapLinePoint);
                lstExamItem.Add(mapKeyValue);

                mapLinePoint = new MapLinePoint()
                {
                    Name = "路口直行", PointType = MapPointType.StraightThrough, SequenceNumber = 7
                };
                mapKeyValue = new KeyValuePair <int, MapLinePoint>(Resource.Drawable.straight_driving, mapLinePoint);
                lstExamItem.Add(mapKeyValue);

                mapLinePoint = new MapLinePoint()
                {
                    Name = "直线行驶", PointType = MapPointType.StraightDriving, SequenceNumber = 8
                };
                mapKeyValue = new KeyValuePair <int, MapLinePoint>(Resource.Drawable.straight_driving, mapLinePoint);
                lstExamItem.Add(mapKeyValue);

                mapLinePoint = new MapLinePoint()
                {
                    Name = "加减档", PointType = MapPointType.ModifiedGear, SequenceNumber = 9
                };
                mapKeyValue = new KeyValuePair <int, MapLinePoint>(Resource.Drawable.modified_gear, mapLinePoint);
                lstExamItem.Add(mapKeyValue);

                mapLinePoint = new MapLinePoint()
                {
                    Name = "掉头", PointType = MapPointType.TurnRound, SequenceNumber = 10
                };
                mapKeyValue = new KeyValuePair <int, MapLinePoint>(Resource.Drawable.turn_round, mapLinePoint);
                lstExamItem.Add(mapKeyValue);



                mapLinePoint = new MapLinePoint()
                {
                    Name = "靠边停车", PointType = MapPointType.PullOver, SequenceNumber = 11
                };
                mapKeyValue = new KeyValuePair <int, MapLinePoint>(Resource.Drawable.stop, mapLinePoint);
                lstExamItem.Add(mapKeyValue);

                mapLinePoint = new MapLinePoint()
                {
                    Name = "会车", PointType = MapPointType.Meeting, SequenceNumber = 12
                };
                mapKeyValue = new KeyValuePair <int, MapLinePoint>(Resource.Drawable.meeting, mapLinePoint);
                lstExamItem.Add(mapKeyValue);

                mapLinePoint = new MapLinePoint()
                {
                    Name = "超车", PointType = MapPointType.Overtaking, SequenceNumber = 13
                };
                mapKeyValue = new KeyValuePair <int, MapLinePoint>(Resource.Drawable.overtaking, mapLinePoint);
                lstExamItem.Add(mapKeyValue);

                mapLinePoint = new MapLinePoint()
                {
                    Name = "变更车道", PointType = MapPointType.ChangeLines, SequenceNumber = 14
                };
                mapKeyValue = new KeyValuePair <int, MapLinePoint>(Resource.Drawable.change_lines, mapLinePoint);
                lstExamItem.Add(mapKeyValue);

                //mapLinePoint = new MapLinePoint() { Name = "下一个项", PointType = MapPointType.NextItem,SequenceNumber=15 };
                //mapKeyValue = new KeyValuePair<int, MapLinePoint>(Resource.Drawable.next, mapLinePoint);
                //lstExamItem.Add(mapKeyValue);

                mapLinePoint = new MapLinePoint()
                {
                    Name = "环岛", PointType = MapPointType.Roundabout, SequenceNumber = 16
                };
                mapKeyValue = new KeyValuePair <int, MapLinePoint>(Resource.Drawable.roundabout, mapLinePoint);
                lstExamItem.Add(mapKeyValue);

                mapLinePoint = new MapLinePoint()
                {
                    Name = "限速", PointType = MapPointType.StartSpeedLimit, SequenceNumber = 17
                };
                mapKeyValue = new KeyValuePair <int, MapLinePoint>(Resource.Drawable.speed_limit_30, mapLinePoint);
                lstExamItem.Add(mapKeyValue);

                mapLinePoint = new MapLinePoint()
                {
                    Name = "急弯泼路", PointType = MapPointType.SharpTurn, SequenceNumber = 18
                };
                mapKeyValue = new KeyValuePair <int, MapLinePoint>(Resource.Drawable.sharp_turn, mapLinePoint);
                lstExamItem.Add(mapKeyValue);

                mapLinePoint = new MapLinePoint()
                {
                    Name = "掉头点", PointType = MapPointType.TurnRoundPlease, SequenceNumber = 19
                };
                mapKeyValue = new KeyValuePair <int, MapLinePoint>(Resource.Drawable.turn_round, mapLinePoint);
                lstExamItem.Add(mapKeyValue);

                mapLinePoint = new MapLinePoint()
                {
                    Name = "通过拱桥", PointType = MapPointType.ArchBridge, SequenceNumber = 20
                };
                mapKeyValue = new KeyValuePair <int, MapLinePoint>(Resource.Drawable.location, mapLinePoint);
                lstExamItem.Add(mapKeyValue);

                mapLinePoint = new MapLinePoint()
                {
                    Name = "临时停车", PointType = MapPointType.TempPark, SequenceNumber = 21
                };
                mapKeyValue = new KeyValuePair <int, MapLinePoint>(Resource.Drawable.location, mapLinePoint);
                lstExamItem.Add(mapKeyValue);

                //mapLinePoint = new MapLinePoint() { Name = "起伏弯道", PointType = MapPointType.WavedCurve, SequenceNumber = 22 };
                //mapKeyValue = new KeyValuePair<int, MapLinePoint>(Resource.Drawable.location, mapLinePoint);
                //lstExamItem.Add(mapKeyValue);

                mapLinePoint = new MapLinePoint()
                {
                    Name = "考试结束", PointType = MapPointType.ExamEnd, SequenceNumber = 22
                };
                mapKeyValue = new KeyValuePair <int, MapLinePoint>(Resource.Drawable.location, mapLinePoint);
                lstExamItem.Add(mapKeyValue);

                var data = new List <IDictionary <string, object> >();
                IDictionary <string, object> dataItem;

                foreach (var item in lstExamItem)
                {
                    dataItem = new JavaDictionary <string, object>();
                    dataItem["itemImage"] = item.Key;
                    dataItem["itemName"]  = item.Value.Name;
                    data.Add(dataItem);
                }

                SimpleAdapter simpleAdapter = new SimpleAdapter(this, data, Resource.Layout.MapGridView, new String[] { "itemImage", "itemName" }, new int[] { Resource.Id.itemImage, Resource.Id.itemName });
                mGridView.SetAdapter(simpleAdapter);
            }
            catch (Exception ex)
            {
                Logger.Error("Map", ex.Message);
            }
        }