﻿//========================================================================== 
//
// 本程序只能在有效的授权许可下使用。未经许可，不得以任何手段擅自使用或传播。 
// 作者：			QX.blio
// 修改：	 
// 文件名：			SuperMap.IS.OverviewControl.js 
// 功能：			Ajax OverviewControl 类 
// 最后修改时间：	2007-10-11
//========================================================================== 

indexBox=null;
QXOverviewControl=function(container,mapScales,x,y,mapName,mapServer,zoomLevel,mapC){
var _mapOverview = null;//定义地图变量
var _map=mapC;
var _mapF=false;
this.Init=_Init;
var _indexBox=null;
function _Init(){
        var params = new Object();
        params.mapHandler=mapServer;
        params.mapName =mapName;
        params.mapScales =mapScales;
        params.zoomLevel=1;
        params.x = x;
	    params.y = y;
        params.imageFormat = "png";
        params.fixedView = false;
        params.buffer = 256; // 预先进行下载的视图范围。
      
        _mapOverview = new SuperMap.IS.MapControl($(container), params);
        _mapOverview.AttachEvent("onchangeview", onOverviewchangeviewAction);
        _mapOverview.AttachEvent("onendzoom",OverviewstartzoomAction);
	    
        _mapOverview.Init();

        _viewBounds=mapC.GetViewBounds();
        _indexBounds=mapC.GetViewBounds();
        _GG();
}
function OverviewstartzoomAction()
{
    if(_mapOverview.GetZoomLevel()!=1)
    {
        _mapOverview.SetZoomLevel(1);
    }
}
this.OverviewPanToMapCoord=_OverviewPanToMapCoord;
    function _OverviewPanToMapCoord(PX,PY)
    {
        _mapOverview.PanToMapCoord(PX,PY);
    }
this.setmapF=_setmapF;

function _setmapF()
{
    _mapF=false;
}

function onOverviewchangeviewAction()
{     
    if(_mapF==true)
    {   
        _map.PanToMapCoord(_mapOverview.GetMapParam().mapCenter.x,_mapOverview.GetMapParam().mapCenter.y);
    }else
    {
       _mapF==true 
    }
}
this.GG=_GG;
 function _GG()
 {
   var _width=$(container).clientWidth;
   var _height=$(container).clientHeight;
   _indexBox=document.createElement("div");
	_indexBox.id= $(container).id+"_IndexBox";
	//计算IndexBox的大小和位置
	with(_indexBox.style)
	{
		border= 2+"px solid Red";
		width = 60+"px";
		height =44+"px";
		position= "absolute";
		visibility= "visible";
		left=61+"px";
		top=42+"px";
		zIndex=9999;
		
    }
    //_indexBox.innerHTML="<img src='images/GG.gif' id=\""+$(container).id+"_GG"+"\"   ondragstart=\"startDrag1(this)\" ondrag=\"endDrag1(this)\" onmousedown=\"a1(this)\" onmousemove=\"a1(this)\">"
    $(container).parentNode.appendChild(_indexBox);   
    $(container).onmousedown=_a1;
 }	
//ondragstart=\"startDrag1()\" ondrag=\"endDrag1()\"

//移动GG
function _a1(e){
    _mapF=true
 };

}
