[delphi]代码库
procedure TFormGY.Rectangle33MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; x, y: Single);
var
astrlist: tstringlist;
aURL, urlQianZhui: string;
begin
if Sqrt(Sqr(abs(x - X1)) + Sqr(abs(y - Y1))) > 5 then // 防止鼠标单击时与滑动冲突
exit;
// info.plist.TemplateiOS.xml添加,否则ios下无法判断是否安装了该地图
// <key>LSApplicationQueriesSchemes</key>
// <array>
// <string>iosamap</string>
// <string>baidumap</string>
// <string>comgooglemaps</string>
// <string>qqmap</string>
// </array>
{$IF DEFINED(IOS) or DEFINED(ANDROID)}
// 百度地图测试
if SJGY.IsInstallThisMap('百度地图') = false then
begin
SJGY.ToastConfirm('请您先在手机上安装百度地图APP', self, 2);
exit;
end;
// 百度地图url调用全集参考网址:http://lbsyun.baidu.com/index.php?title=uri/api/android
// 展示地图
// aURL := 'baidumap://map/show?center=40.057406655722,116.29644071728&zoom=11&traffic=on&bounds=37.8608310000,112.5963090000,42.1942670000,118.9491260000';
// 显示一个快捷菜单 // 加入单元mysjgy即可
astrlist := tstringlist.Create;
astrlist.CommaText := '自定义打点,展示地图图区,地址解析,反向地址解析,POI搜索,公交路线规划,骑行路线规划,公交、地铁线路查询,驾车路线规划,' + '步行路线规划,附近搜索,驾车导航,骑行导航,步行导航,导航到家,POI详情显示:POI的ID可以通过百度地图开放平台或者百度地图SDK获取,' +
'调起离线导航包下载页面,路线(出行)页面调起:跳转到二级常用地址设置页面,路线(出行)页面调起:跳转到二级常用地址设置页面,' + '调起出行早知道页面,调起行程助手主页或者编辑页,调起行程助手主页或者编辑页,打开实时公交页面,离线地图下载页面';
SJGY.ShowSelectListDialog(self, astrlist, '',
procedure(aResult: string) // aResult返回选择的字符串
begin
if aResult = '自定义打点' then
// aURL := 'baidumap://map/marker?location=40.057406655722,116.2964407172&title=Marker&content=makeamarker&traffic=on';
aURL := 'baidumap://map/marker?location=40.047669,116.313082&title=我的位置&content=百度奎科大厦&src=webapp.marker.yourCompanyName.yourAppName';
if aResult = '展示地图图区' then
aURL := 'baidumap://map?';
if aResult = '地址解析' then
aURL := 'baidumap://map/geocoder?src=openApiDemo&address=北京市海淀区上地信息路9号奎科科技大厦';
if aResult = '反向地址解析' then
aURL := 'baidumap://map/geocoder?location=39.98871,116.43234';
if aResult = 'POI搜索' then
aURL := 'baidumap://map/place/search?query=美食®ion=beijing&location=39.915168,116.403875&radius=1000&bounds=37.8608310000,112.5963090000,42.1942670000,118.9491260000';
if aResult = '公交路线规划' then
aURL := 'baidumap://map/direction?origin=name:对外经贸大学|latlng:39.98871,116.43234&destination=name:西直门&mode=transit&sy=3&index=0&target=1';
if aResult = '骑行路线规划' then
aURL := 'baidumap://map/direction?region=beijing&origin=39.98871,116.43234&destination=40.057406655722,116.2964407172&mode=riding';
if aResult = '公交、地铁线路查询' then
aURL := 'baidumap://map/line?region=北京&name=112';
if aResult = '驾车路线规划' then
aURL := 'baidumap://map/direction?region=beijing&origin=39.98871,116.43234&destination=name:西直门&mode=driving';
if aResult = '步行路线规划' then
aURL := 'baidumap://map/direction?region=beijing&origin=39.98871,116.43234&destination=40.057406655722,116.2964407172&mode=walking';
if aResult = '附近搜索' then
aURL := 'baidumap://map/place/nearby?query=团购';
if aResult = '驾车导航' then
aURL := 'baidumap://map/navi?query=故宫';
if aResult = '骑行导航' then
aURL := 'baidumap://map/bikenavi?origin=39.98871,116.43234&destination=39.91441,116.40405';
if aResult = '步行导航' then
aURL := 'baidumap://map/walknavi?origin=40.057406655722,116.2964407172&destination=39.91441,116.40405';
if aResult = '导航到家' then
aURL := 'baidumap://map/navi/common?addr=home';
if aResult = 'POI详情显示:POI的ID可以通过百度地图开放平台或者百度地图SDK获取' then
aURL := 'baidumap://map/place/detail?uid=09185c56d24f7e44f1193763&show_type=detail_page';
if aResult = '调起离线导航包下载页面' then
aURL := 'baidumap://map/navi/offlinemap';
if aResult = '路线(出行)页面调起:跳转到二级常用地址设置页面' then
aURL := 'baidumap://map/routepage?type=car&action=set_home_action';
if aResult = '路线(出行)页面调起:跳转到二级常用地址设置页面' then
aURL := 'baidumap://map/routepage?type=car';
if aResult = '调起出行早知道页面' then
aURL := 'baidumap://map/newsassistant';
if aResult = '调起行程助手主页或者编辑页' then
aURL := 'baidumap://map/trip?action=edit&tripId=去西站';
if aResult = '调起行程助手主页或者编辑页' then
aURL := 'baidumap://map/trip?action=home';
if aResult = '打开实时公交页面' then
aURL := 'baidumap://map/page/realtimebus?mode= NORMAL_MAP_MODE';
if aResult = '离线地图下载页面' then
aURL := 'baidumap://map/page/offlinemap?mode= NORMAL_MAP_MODE';
SJGY.OpenURL(aURL);
end); // , $FF9E8042, $FFFCFCFC, $FFBDBDBD //颜色属性可以用不设置
astrlist.Free;
{$ENDIF}
end;