<%@ Page Language="C#" AutoEventWireup="True" CodeBehind="get_ploygonal.aspx.cs" Inherits="MYAPP.pano.get_ploygonal" %>
<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 (xml!="")
	{
		var doc = XMLJS.parseXML(xml);
		var root = XMLJS.getXMLRootNode(doc);
		var nodes=  XMLJS.getXMLChildNodes(root);
		//var name= XMLJS.getAttributeNodeValue(root,"name");
		for(var i = 0; i < nodes.length; i++)
		{
			krpano().call("set(hotspot["+name+"].point["+i+"].ath,"+XMLJS.getAttributeNodeValue(nodes[i],"ath")+");");
			krpano().call("set(hotspot["+name+"].point["+i+"].atv,"+XMLJS.getAttributeNodeValue(nodes[i],"atv")+");");
		}
	}
}
</script>
<style>
body {
	font-family:Arial, Helvetica, sans-serif;
	font-size:10px;
	color:#FFFFFF;
	padding:0;
	margin:0px; overflow-y:hidden; overflow-x:hidden;
}
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=&gt;add polygonal hotspot&quot;进入区域热点添加模式:<br>
双击鼠标:开始创建区域热点<br>
点击鼠标:创建新的区域标注点<br>
双击鼠标:完成区域热点添加<br>
<br>
编辑区域热点:<br>
移动区域标注点:点击区域标注点然后拖动位置<br>
<br>
删除区域:双击区域热点中间位置</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" class="width80px" onClick="set_last_hotspot();" value="获取区域"/></td>
                </tr>
              </table></td>
          </tr>
          <tr>
            <td height="100%"><div id="krpanoDIV" style="height:100%"></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>