日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Skyline软件二次开发初级——5如何在WEB页面中的三维地图上使用事件函数

發布時間:2023/12/14 编程问答 23 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Skyline软件二次开发初级——5如何在WEB页面中的三维地图上使用事件函数 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1.onFrame事件 - 移動攝像機:

?

<html>
????<head>
????????<title>onFrame?-?Move?camera</title>
????????<object?id="SGWorld"?classid="CLSID:3a4f91b1-65a8-11d5-85c1-0001023952c1"?style="visibility:hidden;height:0?"></object>
????????<script?type="text/javascript">
????????
????????
var?time?=?5?*?1000;?//?move?for?5?sec.

????????
function?Init()
????????{
????????????SGWorld.AttachEvent(
"onFrame",?onFrame);

????????????SGWorld.Navigate.JumpTo(SGWorld.Creator.CreatePosition(
-100.0,?40.0,?13000000,?3,?0,?-85));
????????????setTimeout(
function?()?{?SGWorld.DetachEvent("onFrame",?onFrame);?},?time);
????????}
????????
????????
function?onFrame()
????????{

????????????
var?pos?=?SGWorld.Navigate.GetPosition();
????????????
????????????pos.X?
+=?0.5;
????????????pos.Y?
-=?0.2;

????????????SGWorld.Navigate.SetPosition(pos);???????????????????????
????????????
????????}
????????
????????
</script>
????</head>
????<body?onload="Init();">
????</body>
</html>

?

2.onFrame事件 - 移動對象:

?

<html>
????<head>
????????<title>onFrame?-?Move?objects</title>
????????<object?id="SGWorld"?classid="CLSID:3a4f91b1-65a8-11d5-85c1-0001023952c1"?style="visibility:hidden;height:0?"></object>
????????<script?src="abspath.js"?type="text/javascript"></script>
????????<script?type="text/javascript">

????????
????????
var?model?=?null;
????????
var?time;
?????????
????????
function?Init()
????????{
????????????time?
=?new?Date();
????????????SGWorld.AttachEvent(
"onFrame",?onFrame);
????????????
????????????
var?pos?=?SGWorld.Creator.CreatePosition(-122.38050,?//?x
??????????????????????????????????????????????????37.62331,??//?y
??????????????????????????????????????????????????40.0,??????//?height
??????????????????????????????????????????????????3,?????????//?height?type
??????????????????????????????????????????????????297.0,?????//?yaw
??????????????????????????????????????????????????15.0,??????//?pitch
??????????????????????????????????????????????????0,?????????//?roll
??????????????????????????????????????????????????0??????????//?dist
??????????????????????????????????????????????????);
????????????????????????????????????????????????????????????????????????????????????????????
????????????model?
=?SGWorld.Creator.CreateModel(pos,?toAbspath("data/747.xpc"),?0.2);

????????????model.Attachment.AutoDetach?
=?false;
???????????????????????????????????
????????????SGWorld.Navigate.FlyTo(model);????????????
????????}
????????
????????
function?onFrame(elapsedTime)
????????{
????????????
//?move?object?with?speed?of?400km/h
????????????var?distToMove?=?(400?*?1000?/?3600)?*?(new?Date().getTime()?-?time.getTime())?/?1000;

????????????model.Position?
=?model.Position.Move(distToMove,?model.Position.Yaw?+?0.1,?model.Position.Pitch);
????????????time?
=?new?Date();
????????}
????????
????????
</script>
????</head>
????<body?onload="Init();">
????</body>
</html>

?

3.onLButtonDown事件:

?

<html>
????<head>
????????<object?id="SGWorld"?classid="CLSID:3a4f91b1-65a8-11d5-85c1-0001023952c1"?style="visibility:hidden;height:0?"></object>
????????<script?type="text/javascript">
????????
????????
var?globe?=?null;
????????
var?pos???=?null;
????????
var?popup,?popup2;
????????????????
????????
function?Init()
????????{

????????????SGWorld.AttachEvent(
"onLButtonDown",?onLButtonDown);
????????????SGWorld.AttachEvent(
"onRButtonDown",?onRButtonDown);
????????????popup2?
=?SGWorld.Creator.CreatePopupMessage()
????????????popup2.InnerText?
=?"Left?click?on?the?terrain?to?get?the?coordinates?at?cursor?position.?Right?click?to?finish.";
????????????SGWorld.Window.ShowPopup(popup2);
????????}
????????
????????
function?onLButtonDown(flags,?x,y)
????????{
????????????
var?ret?=?SGWorld.Window.PixelToWorld(x,?y);
????????????????????
????????????popup?
=?SGWorld.Creator.CreatePopupMessage("onLButtonDown?event",?"",?x,?y);
????????????
????????????popup.InnerText?
=?(ret?==?null)???"Screen?coordinate?hit?the?sky"?:?"Screen?coordinates?("+x+","+y+"):\nTerrain?coordinate:\nX:?"?+?ret.Position.X?+?"\nY:?"?+?ret.Position.Y;

????????????SGWorld.Window.ShowPopup(popup);??????

????????????
return?true;?//?event?was?processed?by?the?client.?return?false?to?allow?additional?processing?of?the?event.
????????}
????????
????????
function?onRButtonDown(flags,?x,y)
????????{

????????????SGWorld.DetachEvent(
"onLButtonDown",?onLButtonDown);
????????????SGWorld.DetachEvent(
"onRButtonDown",?onRButtonDown);

????????????
if(popup)
????????????????SGWorld.Window.RemovePopup(popup);
????????????
if(popup2)
????????????????SGWorld.Window.RemovePopup(popup2);
????????????
????????????
return?true;?//?event?was?processed?by?the?client.?return?false?to?allow?additional?processing?of?the?event.
????????}
????????
????????
</script>
????</head>
????<body?onload="Init();">
????</body>
</html>

?

4.屏蔽右鍵彈出菜單:

?

<html>
????<head>
????????<title>Preventing?right?popup</title>
????????<object?id="SGWorld"?classid="CLSID:3a4f91b1-65a8-11d5-85c1-0001023952c1"?style="visibility:hidden;height:0?"></object>
????????<script?type="text/javascript">
????????
????????
function?Init()
????????{
????????????SGWorld.AttachEvent(
"onRButtonDown",?onRButtonDown);
????????????SGWorld.AttachEvent(
"onRButtonDblClk",?onRButtonDblClk);

????????????SGWorld.Window.ShowMessageBarText(
"This?sample?shows?how?to?disable?the?default?right?context?menu.?Double?right-click?to?re-enable",?3);???
????????}????????
????????
????????
function?onRButtonDown(flags,?x,y)
????????{

????????????
return?true;?//?Tell?TE?that?the?OnRButtonDown?event?was?processed?by?the?client
????????}
????????
????????
function?onRButtonDblClk(flags,?x,y)
????????{
????????????SGWorld.DetachEvent(
"onRButtonDown",?onRButtonDown);
????????????SGWorld.DetachEvent(
"onRButtonDblClk",?onRButtonDblClk);
????????????SGWorld.Window.HideMessageBarText();

????????????alert(
"Right?click?is?now?enabled");
????????????
????????????
return?false;
????????}
???????
????????
</script>
????</head>
????<body?onload="Init();">
????</body>
</html>

?

5.onTerraExplorerMessage事件:

?

<html>
????<head>
????????<title>onTerraExplorerMessage?event</title>
????????<object?id="SGWorld"?classid="CLSID:3a4f91b1-65a8-11d5-85c1-0001023952c1"?style="visibility:hidden;height:0?"></object>
????????<script?type="text/javascript">
????????
????????
function?Init()
????????{
????????????SGWorld.AttachEvent(
"onTerraExplorerMessage",?onTerraExplorerMessage);

????????????
var?label?=?SGWorld.Creator.CreateTextLabel(SGWorld.Creator.CreatePosition(-71.00425,?42.36081,?100),?
??????????????????????????????????????????????????????
"Click?here?to?get?the?name?of?the?airport",SGWorld.Creator.CreateLabelStyle());

????????????
var?msg?=?SGWorld.Creator.CreateMessage(0,?"Logan?International",0);
????????????label.Message.MessageID?
=?msg.ID;

????????????SGWorld.Navigate.JumpTo(label);????????????????????????????????????????????????????????????????????????
????????}
????????????????
????????
function?onTerraExplorerMessage(messageId,?senderNodeId)
????????{
????????????
var?message?=?SGWorld.Creator.GetObject(messageId);
????????????
var?senderNode?=?SGWorld.Creator.GetObject(senderNodeId);
????????????senderNode.Text?
=?message.Text;
????????}
????????
????????
</script>
????</head>
????<body?onload="Init();">
????</body>
</html>

?

轉載于:https://www.cnblogs.com/yitianhe/archive/2012/09/22/2697857.html

總結

以上是生活随笔為你收集整理的Skyline软件二次开发初级——5如何在WEB页面中的三维地图上使用事件函数的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。