replace google maps with tianditu

This commit is contained in:
wlx 2014-06-15 08:25:55 +00:00
parent 2172eb65e9
commit 15358450de
2 changed files with 45 additions and 25 deletions

View File

@ -7,7 +7,7 @@
$this->breadcrumb('<a href="/data">'.$this->config->title->data.'</a>'); $this->breadcrumb('<a href="/data">'.$this->config->title->data.'</a>');
$this->breadcrumb('查看元数据'); $this->breadcrumb('查看元数据');
$this->breadcrumb()->setSeparator(' > '); $this->breadcrumb()->setSeparator(' > ');
//$this->theme->AppendPlus($this,'google_map_v3'); $this->theme->AppendPlus($this,'tianditu');
$this->theme->AppendPlus($this,'colorbox'); $this->theme->AppendPlus($this,'colorbox');
if(!empty($this->dataService)) { if(!empty($this->dataService)) {
$this->theme->AppendModel($this,"dataservice"); $this->theme->AppendModel($this,"dataservice");
@ -18,6 +18,7 @@ h3.gs_rt{font-size:110%;}
#file-list li:hover {background-color: #f5f5f5;} #file-list li:hover {background-color: #f5f5f5;}
#file-list li li:hover {background-color: #dedede;} #file-list li li:hover {background-color: #dedede;}
#file-list li li li:hover {background-color: #eeeeee;} #file-list li li li:hover {background-color: #eeeeee;}
#watermap img {max-width:none;}
</style> </style>
<?= $this->render('breadcrumbs.phtml'); ?> <?= $this->render('breadcrumbs.phtml'); ?>
<?php $md=$this->metadata;if ($md):?> <?php $md=$this->metadata;if ($md):?>
@ -497,15 +498,7 @@ endforeach;
</div> </div>
<script src="/js/metadata-view.js"></script> <script src="/js/metadata-view.js"></script>
<script type="text/javascript" charset="utf-8"> <script type="text/javascript" charset="utf-8">
function loadScript() {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "http://maps.google.com/maps/api/js?sensor=false&callback=initialize";
document.body.appendChild(script);
}
window.onload = loadScript;
$(function() { $(function() {
//google.maps.event.addDomListener(window, 'load', initialize);
$(".colorbox").colorbox({photo:"true"}); $(".colorbox").colorbox({photo:"true"});
$('.googlesearch').click(function(){googleSearch('<?php echo $ev;?>');}); $('.googlesearch').click(function(){googleSearch('<?php echo $ev;?>');});
$('.bingsearch').click(function(){bingSearch('<?php echo $ev;?>');}); $('.bingsearch').click(function(){bingSearch('<?php echo $ev;?>');});
@ -554,21 +547,43 @@ function ajaxpage(page){
ajaxpage_get(page,'<?= $md->uuid; ?>'); ajaxpage_get(page,'<?= $md->uuid; ?>');
} }
var map = null; var config = { projection: "EPSG:4326"}
var mapElementID = "watermap"; var map=new TMap("watermap",config);
var bounds = null; var lat=<?= ($md->south+$md->north)/2; ?>;
var rectangle = null; var lng=<?= ($md->east+$md->west)/2; ?>;
var zoomlevel = 1; map.centerAndZoom(new TLngLat(lng,lat),12);
var bound = { map.setMapType(TMAP_HYBRID_MAP);
lat:<?= ($md->south+$md->north)/2; ?>, <?php if ($md->north==$md->south && $md->east==$md->west) :?>
lng:<?= ($md->east+$md->west)/2; ?>, var marker=new TMarker(new TLngLat(lng,lat));
zoom:<?php if ($md->north==$md->south) { ?> 10 <?php }else {?> 6 <?php }?>, map.addOverLay(marker);
east:<?= $md->east; ?>, <?php else :?>
west:<?= $md->west; ?>, var p1=new TLngLat(<?= $md->west ?>,<?= $md->south ?>);
south:<?= $md->south; ?>, var p2=new TLngLat(<?= $md->west ?>,<?= $md->north ?>);
north:<?= $md->north; ?> var p3=new TLngLat(<?= $md->east ?>,<?= $md->north ?>);
} var p4=new TLngLat(<?= $md->east ?>,<?= $md->south ?>);
map.setViewport(new Array(p1,p2,p3,p4));
var bounds = new TBounds(<?= $md->west; ?>,<?= $md->south; ?>,<?= $md->east; ?>,<?= $md->north; ?>);
var config = {
strokeColor:"blue", //折线颜色
fillColor:"#FFFFFF", //填充颜色。当参数为空时,折线覆盖物将没有填充效果
strokeWeight:"3px", //折线的宽度,以像素为单位
opacity:0.3, //折线的透明度取值范围0 - 1
strokeStyle:"dashed" //折线的样式solid或dashed
};
var rect = new TRect(bounds,config);
map.addOverLay(rect);
//map.zoomOut();
<?php endif; ?>
var config = {
type:"TMAP_NAVIGATION_CONTROL_SMALL", //缩放平移的显示类型
anchor:"TMAP_ANCHOR_TOP_LEFT", //缩放平移控件显示的位置
offset:[0,0], //缩放平移控件的偏移值 showZoomInfo:true //是否显示级别提示信息true表示显示false表示隐藏。
};
//创建缩放平移控件对象
control=new TNavigationControl(config);
//添加缩放平移控件
map.addControl(control);
function addfavorite(url,title){ function addfavorite(url,title){
var fav_url = url; var fav_url = url;
var fav_title = title; var fav_title = title;

View File

@ -158,7 +158,12 @@ class Theme
'/js/lib/google-map/keydragzoom.js' '/js/lib/google-map/keydragzoom.js'
) )
), ),
//Tianditu API
'tianditu'=>array(
$this->ScriptKey => array(
'http://api.tianditu.com/js/maps.js'
)
),
);//插件列表 );//插件列表
}// _init_plus() }// _init_plus()