ONE源代码分析——movement3之MapRouteMovement
来源:互联网 发布:appstore没法下载软件 编辑:程序博客网 时间:2024/04/28 05:39
在分析MapRouteMovement之前,我们先来看一下MapRoute类。
MapRoute类
MapRoute类表示一条由地图节点组成的路径,可以是多种类型,类型是由类型参数所定义的。
数据域:
static final int CIRCULAR:routeID类型——circular(到达路径最后一个点后,下一个点为第一个点)
static final int PINGPONG:routeID类型——pingpong(到达路径最后一个点,反向)
LIst<MapNode> stops:所有要停靠的点
int type:route类型
int index:前一返回地图节点的序号
boolean comingBack:是否应该回程
函数域:
构造函数MapRoute(int type, List<MapNode> stops)指定route类型和停靠点。
void setNextIndex(int index)设定该route的下一个index。
MapNode nextStop()返回下一个停靠点(根据route类型)。
static List<MapRoute> readRoutes(String fileName, int type, SimMap map)从配置中定义的文件中读取route。WTK文件以LINESTRING开头的每一行,表示地图中的一条路线上的每个点,WTKReader类中函数readLines(File)将每条路线上的每个点读取到List<List<Coord>>中,然后用List<List<Coord>>中的数据创建List<MapRoute>。
MapRouteMovement类
该移动模型类是MapBasedMovement的子类,使用预先地图区域决定的路径。节点在这个移动模型中,可以停在每个路径的waypoint上,利用DijkstraPathFinder寻找到下一waypoint的最短路径。
数据域:
static final String ROUTE_FILE_S:每个节点组配置使用的route文件
static final String ROUTE_TYPE_S:每个节点组配置使用的route类型
static final String ROUTE_FIRST_STOP_S:每个节点组配置选择的第一个停靠点,默认值或给出负值,随机给出
DijkstraPathFinder pathFinder:Dijkstra最短路径算法finder
List<MapRoute> allRoutes:移动模型的所有MapRoute
int nextRouteIndex:下一个MapRoute的序号
int firstStopIndex:一组节点第一个要停靠的点的序号(-1表示随机)
MapRoute route:移动模型的当前route
函数域:
构造函数MapRouteMovement(Settings settings)基于配置创建对象。
Path getPath()获取一条路径。从当前route的nextStop确定目的地,通过使用DijkstraFinder来确定到达目的地的路径。
- ONE源代码分析——movement3之MapRouteMovement
- ONE源代码分析——core2之World类
- ONE源代码分析——core3之DTNHost类
- ONE源代码分析——movement2之MapBasedMovement
- ONE源代码分析——movement4之BusMovement
- ONE源代码分析——movement5之RandomWaypoint
- ONE源代码分析——movement6之ShortestPathMapBasedMovement
- ONE源代码分析——movement7之PointsOfInterest
- ONE源代码分析——movement8之EveningActivityMovement
- ONE源代码分析——router1之MessageRouter
- ONE源代码分析——core4之Message
- ONE源代码分析——router2之ActiveRouter
- ONE源代码分析——core5之Connection
- ONE源代码分析——core6之ModuleCommunicationBus
- ONE源代码分析——Report2之MessageDelayReport
- ONE源代码分析——core7之SimScenario
- ONE源代码分析——router之Prophetrouter
- ONE源代码分析——core1
- UVaOJ_10003 - Cutting Sticks
- Android 来电话弹出自己的Activity
- dataguard 主备切换(无损切换switchover)
- Python引用多层目录结构的包里的Module
- 汉诺塔问题——递归
- ONE源代码分析——movement3之MapRouteMovement
- 一个生成指定大小文件的东东
- 相关博客
- SharedPreferences的用法
- 7.Cocos2d-x中convertToWorldSpace方法的理解及坐标转换的一些方法。
- hdu 1558 判断线段相交 + 并查集
- UIKit 05、iPhone屏幕旋转、改变视图尺寸 和 布局控制
- 微软面试100题之11题:求二叉树中节点的最大距离
- linux下global,static,const,local变量存放区域