public class RouteBase
extends java.lang.Object
限定符和类型 | 类和说明 |
---|---|
class |
RouteBase.TmcStyle
路线的TMC样式
|
class |
RouteBase.Type |
限定符和类型 | 字段和说明 |
---|---|
static int |
NO_USE_CURRENT_DISTANCE |
构造器和说明 |
---|
RouteBase(long p) |
限定符和类型 | 方法和说明 |
---|---|
int |
_getSegmentIndexByDistance(int distance)
根据到起点的距离获取路段下标
|
static void |
addReferenceInfo(int key,
java.lang.String referenceInfo)
添加RouteBase的引用者信息,内部调试用,外部使用者不要调用
|
boolean |
avoidSegmentsByDescription(int index)
设置指定路线详情里的路段,只针对离线算路
|
void |
enableTmcColors(boolean enable)
设置是否在绘制的道路上显示TMC信息
默认:false,不显示TMC信息。 |
boolean |
equals(java.lang.Object obj) |
java.lang.String[] |
getAvoidFailedRoadNames()
获取避让失败的道路名称,只针对离线算路
|
android.graphics.Rect |
getBoundingBox()
获取当前路线的包络盒
|
int |
getCurrentIndexInDescriptions(int curDistance)
返回当前车所在路线上的位置所对应的路线详情下标
|
java.lang.String |
getDescription()
获取该路线的简短描述,可直接使用,一般给出的时路线中经过的主要路段名称,如果没有,则返回空。
|
TmcSections |
getDescriptionItemTmcSection(int index)
获取路线上指定路段的路况信息
|
long |
getDSegmentIdByIndex(int index)
通过路段下标获取路段的DSegmentId,在线算路后,如果离在线数据的GUID不同,则不能使用在线数据中获取的路线id
|
int |
getEstimatedTime()
路线全程所需时间,单位:秒
|
android.graphics.Point |
getFirstShapePoint()
获取路线上的第一个形状点
|
android.graphics.Point |
getLastShapePoint()
获取路线上最后一个形状点
|
int |
getLength()
获取当前路线长度,单位:米
|
int |
getLengthByTmcState(int state)
获取道路中指定tmc状态的路段长度,单位:米
|
long[] |
getNaviInfoIds()
获取道路上所有路段的四维Id
|
long |
getNavInfoId(int index)
获取指定路段上的四维Id。
|
int |
getOnlineEta()
获取服务器算出来的路线时间,单位:秒
|
RoutePlan |
getPlan()
获取路线规划对象
|
RestrictionInfo |
getRestrictionInfo(int index)
获取某一路段的限行信息
|
int[] |
getRestrictionSegmentIndex(int creepDistance)
获取当前位置向前延伸creepDistance距离,其中有限行信息路段的路段下标index
|
android.graphics.Point[] |
getRestrictionSegmentPoint(int creepDistance)
获取当前位置向前延伸creepDistance距离,其中有限行信息路段的坐标数组,坐标为对应路段的首个形状点
|
long |
getRouteBase() |
java.lang.String |
getRouteTrait(int index)
获取路线标签
|
SegmentAttributes |
getSegmentAttributes(int index)
获取对应index下的segment的详细信息
|
int |
getSegmentEndDistance(int index)
获取指定路段终点到起点距离,单位:m
|
android.graphics.Point[] |
getSegmentFinePoints(int index)
获取Segment的形状点
配合 getSegmentNumber() 一起使用,可以通过形状点绘制路线但是不推荐使用,因为性能较低,如果使用图吧地图,可以通过 RouteOverlay.RouteOverlay(RouteBase) 构造路线 |
android.graphics.Point |
getSegmentFirstPoint(int index)
获取指定index路段的首个形状点坐标
|
android.graphics.Point |
getSegmentLastPoint(int index)
获取指定index路段的尾端形状点坐标
|
int |
getSegmentLength(int index)
获取路段长度
|
int |
getSegmentNumber()
获取当前路线共有多少个Segment
配合 getSegmentFinePoints(int) 一起使用,可以通过形状点绘制路线但是不推荐使用,因为性能较低,如果使用图吧地图,可以通过 RouteOverlay.RouteOverlay(RouteBase) 构造路线 |
int |
getSegmentStartDistance(int index)
获取指定路段起点到起点距离,单位:m
|
int |
getSegmentTmc(int index)
获取路线上指定路段的路况信息
|
int |
getStartDirection()
路线的开始方向,单位:度
|
TmcSections |
getTmcBar(int maxPixelNum)
获取路况条信息段
|
byte[] |
getTmcStates()
获取路段上的所有TMC信息
|
int |
getTmcStyle()
获取实时路况(TMC)模式样式
默认: RouteBase.TmcStyle.normal |
DateTime |
getTmcTime()
获取TMC信息更新时间字符串
|
TollStation[] |
getTollStations()
获取路线上所有的收费站信息
|
int |
getToolCharge()
路线全程收费信息
|
int |
getTrafficLightNumber()
获取道路上红绿灯数量
|
int |
getTraitNumber()
获取路线标签数量
|
int |
getType()
获取当前路线类型为在线还是离线
|
boolean |
hasBrokenRestrictions()
获取算出来的路,有没有到打破限行规则
|
int |
hashCode() |
boolean |
hasHighWay()
判断该路线是否有高速路或快速路
|
boolean |
hasSailingRoute()
判断该路线是否含有轮渡
|
boolean |
hasToll()
判断该路线是否有收费路段
|
boolean |
isTmcColorsEnabled()
返回当前是否开启了显示道路TMC的功能
|
static void |
printReferenceInfos()
输出引用者信息,检索词:routeBaseReferenceInfo
|
void |
release()
销毁RouteBase,一般用于打断对离线数据的引用,防止离线数据不能及时安装和删除
|
static void |
releaseAll()
释放所有创建过的RouteBase
|
static void |
removeReferenceInfo(int key)
删除RouteBase的引用者信息,内部调试用,外部使用者不要调用
|
void |
setTmcStyle(int style)
设置实时路况(TMC)模式下的路线样式
|
boolean |
testPoint(android.graphics.Point position,
int range)
测试指定的经纬度坐标是否在路线上
一个点是否在线上的判断一般需要一个阈值,所以需要给出一个合适的检测范围,也就是说,在如果测试点距离路线的距离在此范围内(包含范围边界), 则表示在路线上,反之则不再路线上。 |
byte[] |
toJson()
将路线保存成json格式[离线]
|
public static final int NO_USE_CURRENT_DISTANCE
public long getRouteBase()
public int hashCode()
hashCode
在类中 java.lang.Object
public boolean equals(java.lang.Object obj)
equals
在类中 java.lang.Object
public long getDSegmentIdByIndex(int index)
public int getType()
RouteBase.Type
类型的结果RouteBase.Type
public int getLength()
public int getEstimatedTime()
public int getToolCharge()
public RoutePlan getPlan()
public int getStartDirection()
public android.graphics.Rect getBoundingBox()
public android.graphics.Point getFirstShapePoint()
public android.graphics.Point getLastShapePoint()
public int getCurrentIndexInDescriptions(int curDistance)
curDistance
- 当前车所在路线上的位置public TmcSections getDescriptionItemTmcSection(int index)
index
- 路段索引,非负整数TmcSections.State
TmcSections.State
,
getSegmentNumber()
TmcSections
。 // 获取路段数 RouteBase rb = NaviSession.getInstance().getRoute(); int number = rb.getDescriptionNumber(); // 路段描述数组,用于保存路段描述信息 RouteDescriptionItem rdis = new ArrayList<RouteDescriptionItem>(); for (int i = 0; i < number; i++) { RouteDescriptionItem rd = rb.getDescriptionItem(i, RouteBase.NO_USE_CURRENT_DISTANCE); rdis.add(rd); } // 获取TMC信息 TmcSections sections = mRouteBase.getDescriptionItemTmcSection(position); if (sections != null) { Logger.d("[RouteDetail]", "sections.length = " + sections.length); }
public DateTime getTmcTime()
DateTime
的所有字段为0,可以利用此方法来判断路线上是否有TMC信息public TmcSections getTmcBar(int maxPixelNum)
maxPixelNum
- 路况条绘制时的大小,单位:像素TmcSections
public int getSegmentNumber()
getSegmentFinePoints(int)
一起使用,可以通过形状点绘制路线RouteOverlay.RouteOverlay(RouteBase)
构造路线getSegmentFinePoints(int)
public android.graphics.Point[] getSegmentFinePoints(int index)
getSegmentNumber()
一起使用,可以通过形状点绘制路线RouteOverlay.RouteOverlay(RouteBase)
构造路线index
- Segment索引getSegmentNumber()
public RestrictionInfo getRestrictionInfo(int index)
index
- 路段在当前routeBase中的index值public int getSegmentLength(int index)
index
- 路段segment索引public boolean hasSailingRoute()
public boolean hasToll()
public boolean hasHighWay()
public java.lang.String getDescription()
public void enableTmcColors(boolean enable)
enable
- true开启路线TMC显示,false关闭路线TMC显示RouteOverlay#enableTmcColors(boolean)
public boolean isTmcColorsEnabled()
public void setTmcStyle(int style)
style
- 样式 ,RouteBase.TmcStyle
public int getTmcStyle()
RouteBase.TmcStyle.normal
public int _getSegmentIndexByDistance(int distance)
distance
- 到起点的距离,单位:米public boolean testPoint(android.graphics.Point position, int range)
position
- 点的经纬度坐标range
- 指定的距离阈值范围,单位:米(近似)。public byte[] getTmcStates()
getSegmentNumber()
public byte[] toJson()
public long getNavInfoId(int index)
index
- 路段索引getNaviInfoIds()
NaviSession
的参数中 NaviSessionParams.needNavInfoId
public long[] getNaviInfoIds()
getSegmentNumber()
一致。RouteBase无效时返回null。getNavInfoId(int)
NaviSession
的参数中 NaviSessionParams.needNavInfoId
public int getTrafficLightNumber()
#getSegmentTrafficLight(int)
public int getLengthByTmcState(int state)
state
- tmc状态TmcSections.State
NaviSession.Event.routeTmcUpdated
回调中,路线上的tmc状态可能发生变化,需要重新获取长度public boolean avoidSegmentsByDescription(int index)
index
- 路线详情索引AvoidanceManager.clearAvoidedSegments()
清空之前设置的避让路段,否则之前设置的避让路段将一直有效public java.lang.String[] getAvoidFailedRoadNames()
public int getSegmentTmc(int index)
index
- 路线详情索引TmcSections.State.none
。
该路段上的路况信息。含义同TmcSections.State
public android.graphics.Point[] getRestrictionSegmentPoint(int creepDistance)
creepDistance
- 延伸距离,单位:mpublic int[] getRestrictionSegmentIndex(int creepDistance)
creepDistance
- 延伸距离,单位:mpublic android.graphics.Point getSegmentFirstPoint(int index)
index
- public android.graphics.Point getSegmentLastPoint(int index)
index
- public int getSegmentStartDistance(int index)
index
- public int getSegmentEndDistance(int index)
index
- public boolean hasBrokenRestrictions()
public SegmentAttributes getSegmentAttributes(int index)
index
- segment的index值SegmentAttributes
public TollStation[] getTollStations()
public int getOnlineEta()
public void release()
public static void releaseAll()
public static void addReferenceInfo(int key, java.lang.String referenceInfo)
key
- referenceInfo
- public static void removeReferenceInfo(int key)
key
- public static void printReferenceInfos()
public int getTraitNumber()
public java.lang.String getRouteTrait(int index)
index
- ©Mapbar Engine Team;All Rights Reserved