<%@ Page Language="C#" AutoEventWireup="True" CodeBehind="get_hotspot_xyz.aspx.cs" Inherits="MYAPP.pano.Get_Hotspot_XYZ" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link href="/CSS/main.css" rel="stylesheet" type="text/css" />
</head>
<script language="JavaScript" type="text/javascript" src="/js/xml.js"></script>
<script language='JavaScript' type='text/javascript' src='/js/common.js'></script>
<script language="JavaScript" type="text/javascript" src="/js/odialog.js"></script>
<script language="JavaScript" type="text/javascript" src="/js/tdialog.js"></script>
<script type="text/javascript">
var oWindow=window.opener;
	function krpano() 
	{
			return document.getElementById("krpanoSWFObject");
	}
function set_last_hotspot()
{
	var num_hotspot=krpano().get("hotspot.count");
	var points="";
	if (num_hotspot>0)
	{
		num_hotspot=num_hotspot-1;
		var num_points=krpano().get("hotspot["+num_hotspot+"].point.count");
		for (var i=0;i<num_points;i++)
		{
			points=points+'<point ath="'+str_point(num_hotspot,i,'ath')+'" atv="'+str_point(num_hotspot,i,'atv')+'" />';
		}
		
		try
		{
			oWindow.SetGetPloygonal(points);
			window.close();
		}
		catch(exception){}
	}
	else
	{
		alert("Error!!!");
	}
}	
function str_point(num_hotspot,i,hv)
{
	return krpano().get('hotspot['+num_hotspot+'].point['+i+'].'+hv);
}
function add_hotspot()
{
	var xml=oWindow.GetHotspotXML();
	var name;
	var url;
	
		name = oWindow.GetValue("name");
		if (name=="")
		{
			name="temp_name";
		}
		url  = oWindow.GetValue("url");
		
		krpano().call("addhotspot("+name+");");
		

		if (url.indexOf("accessories")==0)
		{
			url="scene/<%=_Scene_ID%>/"+url;
		}
		krset(name,"url",url.replace("%FIRSTXML%","%SWFPATH%"));
		krset(name,"ath",oWindow.GetValue("ath"));
		krset(name,"atv",oWindow.GetValue("atv"));
		krset(name,"width",oWindow.GetValue("width"));
		krset(name,"height",oWindow.GetValue("height"));
		krset(name,"rx",Number(oWindow.GetValue("rx")).toFixed(4));
		krset(name,"ry",Number(oWindow.GetValue("ry")).toFixed(4));
		krset(name,"rz",Number(oWindow.GetValue("rz")).toFixed(4));		
		krset(name,"scale",Number(oWindow.GetValue("scale")).toFixed(4));	
		krset(name,"alpha",oWindow.GetValue("alpha"));	
		
		krset(name,"zoom",oWindow.GetValue("zoom"));	
		krset(name,"smoothing",oWindow.GetValue("smoothing"));	
		krset(name,"distorted",oWindow.GetValue("distorted"));	
		krset(name,"rotatewithview",oWindow.GetValue("rotatewithview"));	
		
		if (oWindow.GetValue("videourl")!="")
		{
			krset(name,"videourl",oWindow.GetValue("videourl").replace("%FIRSTXML%","%SWFPATH%"));	
		}
}

function Set_hotspot_xyz()
{
		var name=oWindow.GetValue("name");
		if (name=="")
		{
			name="temp_name";
		}
		
		//krget(name,"url",oWindow.GetValue("url"));
		krget(name,"ath",Number(oWindow.GetValue("ath")).toFixed(4));
		krget(name,"atv",Number(oWindow.GetValue("atv")).toFixed(4));
		krget(name,"width",oWindow.GetValue("height"));
		krget(name,"height",oWindow.GetValue("height"));
		krget(name,"rx",oWindow.GetValue("rx"));
		krget(name,"ry",oWindow.GetValue("ry"));
		krget(name,"rz",oWindow.GetValue("rz"));		
		krget(name,"scale",oWindow.GetValue("scale"));	
		krget(name,"alpha",oWindow.GetValue("alpha"));	
		
		krget(name,"zoom",oWindow.GetValue("zoom"));	
		krget(name,"smoothing",oWindow.GetValue("smoothing"));	
		krget(name,"distorted",oWindow.GetValue("distorted"));	
		krget(name,"rotatewithview",oWindow.GetValue("rotatewithview"));	
		
		window.close();
}

function krget(name,field,value)
{
	oWindow.SetValue(field,krpano().get("hotspot["+name+"]."+field));
}

function krset(name,field,value)
{
	
	if (value!="")
	{
		//alert(field+":"+value);
		try
		{
			parseFloat(value);
			krpano().call("set(hotspot["+name+"]."+field+","+value+");");
		}catch(excetion)
		{
			krpano().call("set(hotspot["+name+"]."+field+",'"+value+"');");
		}
		
	}
}
</script>
<style>
body {
	font-family:Arial, Helvetica, sans-serif;
	font-size:10px;
	color:#FFFFFF;
	margin:0;
	padding:0;
}
a {
	color:#AAAAAA;
	text-decoration:underline;
}
a:hover {
	color:#FFFFFF;
	text-decoration:underline;
}
</style>
<body scroll="no" onLoad="window.focus();">
<div style="color:#900; background-color:#FFF;position:absolute; font-size:12px; left:6px; top:36px; padding:2px; border:thick;">点击场景下方的 &quot;editor=&gt;hotspots&quot;进入热点编辑模式:<br>
  移动:鼠标按住热点拖动<br>
比例:鼠标按住热点并按 &quot;CTRL&quot;(缩小)L 或者 &quot;SHIFT&quot;(放大)键<br>
旋转:鼠标按住热点并按 &quot;R&quot; 键,移动鼠标<br>
倾斜扭曲 :鼠标按住热点并按 &quot;空格&quot; 键,移动鼠标</div>
  <table width="100%" cellspacing="2" border="1" cellpadding="0" bordercolor="#CCCCCC" height="100%"
            class="board_kong">
    <tr>
      <td height="100%" valign="top"><table cellspacing="1" cellpadding="0" width="100%" border="0" height="100%">
          <tr>
            <td align="right" style="border-bottom: #CCCCCC 1px solid; height: 24px"><table class="title_table">
                <tr>
                  <td align="right"><input type="button"  onclick="Set_hotspot_xyz();" value="设置空间坐标"  style="position:;top:10px;right:10px; z-index:100; cursor:pointer;"/></td>
                </tr>
              </table></td>
          </tr>
          <tr>
            <td height="100%"><div id="krpanoDIV"></div></td>
          </tr>
        </table></td>
    </tr>
  </table>
<script src="/pano/swfkrpano.js"></script>
<script>
	var viewer = createPanoViewer({swf:"/project/<%=_Tour_ID%>/epano.aspx", id:"krpanoSWFObject", target:"krpanoDIV"});
	viewer.addVariable("pano", '<%=String.Format("scene/{1}/get_ploygonal_xml.aspx", _Tour_ID, _Scene_ID)%>');
	viewer.addParam("wmode", "opaque");
	viewer.embed();
</script>
</body>
</html>