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

歡迎訪問 生活随笔!

生活随笔

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

编程问答

Skyline软件二次开发初级——6如何在WEB页面中的三维地图上进行坐标和方向计算...

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

1.距離和角度:

<html>
????<head>
????????<title>Coordinates?1</title>
????????<object?id="SGWorld"?classid="CLSID:3a4f91b1-65a8-11d5-85c1-0001023952c1"?style="visibility:hidden;height:0?"></object>
????????<script?type="text/javascript">
????????
????????
var?popup?=?null;
????????
????????
function?Init()
????????{
????????????
????????????
//?defining?two?coordinates
????????????var?coord1?=?SGWorld.Creator.CreatePosition(-71.07542,?42.34930,?232.0);?//?The?Hancock?building????????????
????????????var?coord2?=?SGWorld.Creator.CreatePosition(-71.05507,?42.35561,?105.0);?//?Target?building
????????????
????????????
//?Placing?some?annotation?on?the?terrain
????????????SGWorld.Creator.CreateTextLabel(coord1,?"Hancock?Building",SGWorld.Creator.CreateLabelStyle());
????????????SGWorld.Creator.CreateTextLabel(coord2,?
"Building?2",SGWorld.Creator.CreateLabelStyle());
????????????SGWorld.Creator.CreatePolyline(SGWorld.Creator.GeometryCreator.CreateLineStringGeometry([coord1,?coord2]),?SGWorld.Creator.CreateColor(
255,?255,?0),?0,?0,?"line");

????????????
//?Set?a?good?view?point?for?the?scene?
????????????SGWorld.Navigate.SetPosition(SGWorld.Creator.CreatePosition(-71.07802,?42.33974,?550.0,0,?34,?-13));???????????
????????????
????????????
//?Calculating?the?distance?and?angles?from?the?Hancock?building?to?building?#2
????????????var?distance?=?coord1.DistanceTo(coord2);

????????????
var?angles?=?coord1.AimTo(coord2);
????????????????????????
????????????
//?Display?a?message?to?the?user
????????????popup?=?SGWorld.Creator.CreatePopupMessage("Coordinate?sample","",0,0,450,120);????????????
????????????popup.InnerText?
=?"The?aerial?distance?between?the?roofs?of?the\r\nHancock?building?and?building?#2?is?"?+?Math.floor(distance)?+?"?Meters\r\n\r\n"?+
??????????????????????????????
"The?aiming?angles?from?the?Hancock?building?to?building?#2?are:\r\nyaw:?"?+?angles.Yaw.toFixed(5)?+?"??pitch:?"?+?angles.Pitch.toFixed(5);????????????????????????
????????????popup.Align?
=?"TopLeft";
????????????SGWorld.Window.ShowPopup(popup);????????????????????????
????????}
????????
????????
function?Uninit()
????????{
????????????
if(SGWorld.Project.Name?==?"")
????????????????
return;
????????????
if(popup)
????????????????SGWorld.Window.RemovePopup(popup);
????????}
????????
????????
</script>
????</head>
????<body?onload="Init();"?onunload="Uninit()">
????</body>
</html>

?

2.位置和方向:

<html>
????<head>
????????<title>Coordinates?1</title>
????????<object?id="SGWorld"?classid="CLSID:3a4f91b1-65a8-11d5-85c1-0001023952c1"?style="visibility:hidden;height:0?"></object>
????????<script?type="text/javascript">
????????
????????
var?popup?=?null;
????????
????????
function?Init()
????????{
????????????
//?defining?two?coordinates
????????????var?coord1?=?SGWorld.Creator.CreatePosition(-71.07542,?42.34930,?232.0);
????????????
var?coord2?=?SGWorld.Creator.CreatePosition(-71.05507,?42.35561,?105.0);
????????????
????????????
//?Placing?some?annotation?on?the?terrain
????????????SGWorld.Creator.CreateTextLabel(coord1,?"Hancock?Building",SGWorld.Creator.CreateLabelStyle());
????????????SGWorld.Creator.CreateTextLabel(coord2,?
"Building?2",SGWorld.Creator.CreateLabelStyle());

????????????
var?pos?=?coord1.AimTo(coord2);

????????????SGWorld.Navigate.SetPosition(pos);????????????
????????????
????????????
//?Display?a?message?to?the?user
????????????popup?=?SGWorld.Creator.CreatePopupMessage("Coordinate?sample");
????????????popup.innerText?
=?"This?sample?shows?how?to?place?the?camera?at?a?specific?position\r\nwhile?aiming?it?to?a?desired?point?of?interest";
????????????popup.align?
=?"TopLeft";
????????????SGWorld.Window.ShowPopup(popup);
????????}
????????
????????
function?Uninit()
????????{
????????????
if(SGWorld.Project.Name?==?"")
????????????????
return;
????????????
if(popup)
????????????????SGWorld.Window.RemovePopup(popup);
????????}
????????
????????
</script>
????</head>
????<body?onload="Init();"?onunload="Uninit()">
????</body>
</html>

3.移動指向位置:

<html>
????<head>
????????<title>Coordinates?1</title>
????????<object?id="SGWorld"?classid="CLSID:3a4f91b1-65a8-11d5-85c1-0001023952c1"?style="visibility:hidden;height:0?"></object>
????????<script?type="text/javascript">
????????
????????
var?popup?=?null;
????????
????????
var?coord1,?coord2,?pos,?distance;
????????
var?time;
????????
function?Init()
????????{
????????????
????????????SGWorld.AttachEvent(
"OnFrame",?onFrame);
????????????time?
=?new?Date().getTime();
????????????
//?defining?two?coordinates
????????????coord1?=?SGWorld.Creator.CreatePosition(-71.07542,?42.34930,?232.0);
????????????coord2?
=?SGWorld.Creator.CreatePosition(-71.05507,?42.35561,?105.0);
????????????
????????????
//?Placing?some?annotation?on?the?terrain
????????????SGWorld.Creator.CreateTextLabel(coord1,?"Hancock?Building",SGWorld.Creator.CreateLabelStyle());
????????????SGWorld.Creator.CreateTextLabel(coord2,?
"Building?2",SGWorld.Creator.CreateLabelStyle());

????????????distance?
=?coord1.DistanceTo(coord2);
????????????pos?
=?coord1.AimTo(coord2);

????????????
//?Set?the?start?position?at?the?top?of?the?Hancock?building
????????????SGWorld.Navigate.SetPosition(pos);????????????
????????????
????????????
//?Display?a?message?to?the?user
????????????popup?=?SGWorld.Creator.CreatePopupMessage("Coordinate?sample");
????????????popup.InnerText?
=?"This?sample?shows?how?to?move?a?coordinate?toward?another?coordinate";
????????????popup.Align?
=?"TopLeft";
????????????SGWorld.Window.ShowPopup(popup);?????????????????????????????
????????}
????????
????????
????????
????????
function?onFrame()
????????{
????????????
var?elapsedTime?=?(new?Date().getTime()?-?time)?/?1000?//?elapsed?time?in?seconds
????????????time?=?new?Date().getTime();
????????????pos?
=?pos.MoveToward(coord2,?200*elapsedTime);???//?200?meters/sec
????????????
????????????
var?newDist?=?pos.DistanceTo(coord2);
????????????
????????????
if?(newDist?>?distance)
????????????{
????????????????
//?Stop?condition.?if?we?are?here,?then?we?have?passed?building?2
????????????????SGWorld.DetachEvent("OnFrame",?onFrame);
????????????????
return;
????????????}

????????????SGWorld.Navigate.SetPosition(pos);?????????
????????????distance?
=?newDist;
????????}
????????
????????
????????
????????
????????
function?Uninit()
????????{
????????????
if(SGWorld.Project.Name?==?"")
????????????????
return;
????????????
if(popup)
????????????????SGWorld.Window.RemovePopup(popup);

????????}
????????
????????
</script>
????</head>
????<body?onload="Init();"?onunload="Uninit()">
????</body>
</html>

4.朝著某個對象移動:

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

????????????SGWorld.AttachEvent(
"OnFrame",?onFrame);

????????????setTimeout(
function?()?{?SGWorld.DetachEvent("OnFrame",?onFrame);?},?15000);

????????????time?
=?new?Date().getTime();

????????????coordHancock?
=?SGWorld.Creator.CreatePosition(-71.07542,?42.34930,?232.0);

????????????SGWorld.Creator.CreateTextLabel(coordHancock,?
"Hancock?Building",SGWorld.Creator.CreateLabelStyle());

????????????pos?
=?SGWorld.Creator.CreatePosition(-71.10055,?42.31624,?350.0,0,?15.0);?//?x,y,height,height_type,yaw

????????????SGWorld.Navigate.SetPosition(pos);???????
????????????
????????????
//?Display?a?message?to?the?user
????????????popup?=?SGWorld.Creator.CreatePopupMessage("Coordinate?sample");
????????????popup.InnerText?
=?"This?sample?shows?how?you?can?move?a?coordinate?in?one?direction?while?aiming?to?another";
????????????popup.Align?
=?"TopLeft";
????????????SGWorld.Window.ShowPopup(popup);????????????????????????????????
????????}
????????????????????????
????????
function?onFrame()
????????{
????????????
var?elapsedTime?=?(new?Date().getTime()?-?time)?/?1000?//?elapsed?time?in?seconds
????????????time?=?new?Date().getTime();
????????????pos?
=?pos.Move(400*elapsedTime,?15.0,?0.0).AimTo(coordHancock);???//?400?meters/sec

????????????SGWorld.Navigate.SetPosition(pos);
????????}????????????????????????
????????
????????
function?Uninit()
????????{
????????????
if(SGWorld.Project.Name?==?"")
????????????????
return;
????????????
if(popup)
????????????????SGWorld.Window.RemovePopup(popup);
????????}
????????
????????
</script>
????</head>
????<body?onload="Init();"?onunload="Uninit()">
????</body>
</html>

?

5.以上效果疊加:

<html>
????<head>
????????<title>Coordinates?5</title>
????????<object?id="SGWorld"?classid="CLSID:3a4f91b1-65a8-11d5-85c1-0001023952c1"?style="visibility:hidden;height:0?"></object>
????????<script?type="text/javascript"?src="abspath.js"></script>
????????<script?type="text/javascript">
????????
????????
var?popup?=?null;????????
????????
????????
var?model?????=?null;
????????
var?labelF16??=?null;
????????
????????
var?yaw?=?45.0;
????????
var?totalTime?=?0;
????????
function?Init()
????????{
????????????SGWorld.AttachEvent(
"OnFrame",?onFrame);
????????????setTimeout(
function?()?{?SGWorld.DetachEvent("OnFrame",?onFrame);?},?10000);?//?remove?event?handler?after?10?seconds
????????????time?=?new?Date().getTime();

????????????model?
=?SGWorld.Creator.CreateModel(SGWorld.Creator.CreatePosition(-71.10055,?42.31624,?125.0,0,?28),?toAbspath("data/f16.xpc"),?1);

????????????labelF16?
=?SGWorld.Creator.CreateTextLabel(SGWorld.Creator.CreatePosition(0,?0),?"F-16",SGWorld.Creator.CreateLabelStyle());????????????????????????
???????????
????????????
//?Display?a?message?to?the?user
????????????popup?=?SGWorld.Creator.CreatePopupMessage("Coordinate?sample");
????????????popup.InnerText?
=?"This?sample?shows?how,?by?manipulating?coordinates,?you?can?create?a?complex?scene\r\n"?+
??????????????????????????????
"In?this?sample?you?can?see?how?to:\r\n"?+
??????????????????????????????
"1.?Move?an?object?(F16)\r\n"?+
??????????????????????????????
"2.?Make?another?object,?a?label?in?this?case,?to?follow?the?first?object\r\n"?+
??????????????????????????????
"3.?Make?the?camera?follow?the?first?object?while?circling?it";
????????????popup.Align?
=?"TopLeft";
????????????SGWorld.Window.ShowPopup(popup);??????
????????}
???????
????????????????
????????
function?onFrame()???//?elapsedTime?is?the?time?in?seconds?elapsed?from?the?previous?frame
????????{
????????????
var?elapsedTime?=?(new?Date().getTime()?-?time)?/?1000?//?elapsedTime?is?the?time?in?seconds?elapsed?from?the?previous?frame
????????????time?=?new?Date().getTime();

????????????
var?modelPos?=?model.Position;
????????????
????????????modelPos.Roll?
=?modelPos.Roll?+?4.5;
????????????modelPos?
=?modelPos.Move(700?*?elapsedTime,?modelPos.Yaw,?modelPos.Pitch);?//?move?the?object?in?its?current?direction?at?a?speed?of?700?m/s??????????????????????????????????????????????????????????????

????????????
if?(totalTime?>?6)?
????????????????modelPos.Pitch?
+=?20*elapsedTime;?//?increase?pitch?by?20?degree?per?sec

????????????model.Position?
=?modelPos;
????????????
????????????
//?Make?the?label?object?to?be?positioned?40?meters?above?(pitch?=?90)?the?first?object????????????
????????????labelF16.Position?=?modelPos.Move(40.0,?0.0,?90.0);????????????
????????????
????????????
//?Move?the?camera?in?relation?to?the?first?object?while?looking?at?it.
????????????yaw?+=?40.0*elapsedTime;?//?increase?yaw?by?40?degree?per?sec
????????????var?cameraPos?=?modelPos.Move(700,?yaw,?5).AimTo(modelPos);
????????????cameraPos.Roll?
=?0;?//?plane?is?rolling,?but?we?do?not?want?the?camera?to?use?this?roll,?so?we?zero?it.
????????????SGWorld.Navigate.SetPosition(cameraPos);
????????????totalTime?
+=?elapsedTime;
????????}????????????????????????
????????
????????
function?Uninit()
????????{
????????????
if(SGWorld.Project.Name?==?"")
????????????????
return;
????????????
if(popup)
????????????????SGWorld.Window.RemovePopup(popup);
??
????????}
????????
????????
</script>
????</head>
????<body?onload="Init();"?onunload="Uninit()">
????</body>
</html>

?

轉載于:https://www.cnblogs.com/yitianhe/archive/2012/09/24/2699632.html

總結

以上是生活随笔為你收集整理的Skyline软件二次开发初级——6如何在WEB页面中的三维地图上进行坐标和方向计算...的全部內容,希望文章能夠幫你解決所遇到的問題。

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