谷歌地图二次开发,java实现获取数据库信息,地图生成标注

谷歌地图二次开发,java实现获取数据库信息,地图生成标注,第1张

给你一个java文件的调用代码,是我测试过的,好用:
var centerLatitude = 3373518;
var centerLongitude = 11331073 ;
var startZoom = 14;
var map;
var markerHash={};
var currentFocus=false;
function focusPoint(id){
if (currentFocus) {
ElementremoveClassName("sidebar-item-"+currentFocus,"current");
}
ElementaddClassName("sidebar-item-"+id,"current");
markerHash[id]markeropenInfoWindowHtml(markerHash[id]address);
currentFocus=id;
}
function filter(type){
for(i=0;i<markerslength;i++) {
var current=markers[i];
if (currentstructure_type == type || 'All' == type) {
Elementshow("sidebar-item-"+markers[i]id)
if (!markerHash[currentid]visible) {
mapaddOverlay(markerHash[currentid]marker);
markerHash[currentid]visible=true;
}
} else {
if (markerHash[currentid]visible) {
mapremoveOverlay(markerHash[currentid]marker);
markerHash[currentid]visible=false;
}
Elementhide("sidebar-item-"+markers[i]id)
}
}
}
function windowHeight() {
// Standard browsers (Mozilla, Safari, etc)
if (selfinnerHeight)
return selfinnerHeight;
// IE 6
if (documentdocumentElement && documentdocumentElementclientHeight)
return documentdocumentElementclientHeight;
// IE 5
if (documentbody)
return documentbodyclientHeight;
// Just in case
return 0;
}
function handleResize() {
var height = windowHeight() - $('toolbar')offsetHeight - 30;
$('map')styleheight = height + 'px';
$('sidebar')styleheight = height + 'px';
}
function addMarker(latitude, longitude, id) {
var marker = new GMarker(new GLatLng(latitude, longitude));
GEventaddListener(marker, 'click',
function() {
focusPoint(id);
}
);
mapaddOverlay(marker);
return marker;
}
function init() {
handleResize();
map = new GMap($("map"));
mapaddControl(new GSmallMapControl());
mapsetCenter(new GLatLng(centerLatitude, centerLongitude), startZoom);
for(i=0;i<markerslength; i++) {
var current =markers[i];
marker=addMarker(currentlatitude, currentlongitude,currentid);
markerHash[currentid]={marker:marker,address:currentaddress,visible:true};
}
Elementhide('loading');
}
Eventobserve(window, 'load', init, false);
Eventobserve(window, 'resize', handleResize, false);

通过正则表达式,从页面将偷下来,保存到本地即可。给你个例子
public class RegexDemo1 {
public static void main(String[] args) throws Exception{
//创建URL
URL url=new URL(">gson,先按 那格式,定义一个类BaiduGeo
Gson gson = new Gson();
result = gsonfromJson(sTotalString, BaiduGeoclass);

一、申请密钥
1、先用eclipse创建一个Android工程
2、在百度api官网上申请一个密钥,链接:>

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/10337800.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-07
下一篇 2023-05-07

发表评论

登录后才能评论

评论列表(0条)

保存