Skyline软件二次开发初级——5如何在WEB页面中的三维地图上使用事件函数
1.onFrame事件 - 移动摄像机:
<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事件 - 移动对象:
<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事件:
<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.屏蔽右键弹出菜单:
<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事件:
<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页面中的三维地图上使用事件函数相关推荐
- c# 无法加载oraops.dll_Robotstudio软件二次开发:基于C#语言的Smart组件开发基础
Robotstudio软件除了支持Add-Ins插件的二次开发以外,还支持Smart组件的二次开发.开发语言同样是基于.NET框架的C#语言或VB语言.Smart组件是Robotstudio软件中实现 ...
- 欢迎光临CAX软件二次开发开源社区!
欢迎光临CAX软件二次开发开源社区! http://uucax.uueasy.com 转载于:https://www.cnblogs.com/uucax/archive/2011/02/20/1959 ...
- vb杨辉三角代码编写_「二次开发」——基于VB.NET的NX UG软件二次开发基础
前几期中为大家介绍了CATIA软件.AutoCAD软件基于VB.NET的二次开发,本期再来为大家介绍一下NX UG软件基于VB.NET的二次开发. NX UG软件版本:NX 12.0.0.27 开发软 ...
- 金蝶erp系统服务器端,金蝶ERP软件二次开发.doc
金蝶ERP软件二次开发 摘要 企业要提升快速反应的能力,必须建立以信息集中.流程整合.实施控制为核心特点的快速反应体系,有效整合资源,强化基础管理.ERP软件可以帮助企业实现这些目标,但要成功地实施E ...
- Python--中控门禁软件二次开发--引导
Python--中控门禁软件二次开发--引导 说明 : 公司门禁型号是:中控门禁 F7plus ,因为没有安装带遥控开门的,也没有什么感应,当有访客过来时,走过去开门有点麻烦,而门禁软件需要每次进 ...
- pythoncad二次开发视频_revit二次开发|bim软件二次开发|revit二次开发教程|Revit二次开发技术文档...
二次开发 revit二次开发|bim软件二次开发|revit二次开发教程|Revit二次开发技术文档2019-07-08赞( 0 ) 记录一下CAD二次开发的一些简单实例. 1.helloworld ...
- 速达软件二次开发-销售开单结算单位和账期报表需求
接到某公司的二次开发需求如下: 1.销售开单中客户名称和结算单位做好匹配,提前在客户资料中录入结算单位资料,如下选择客户名称为"深圳瑞电"的时候结算单位自动跳出"义巍实业 ...
- 基于VB.NET的NX UG软件二次开发基础
本文已经首发在个人微信公众号:工业机器人仿真与编程(微信号:IndRobSim),欢迎关注! 前几期中为大家介绍了CATIA软件.AutoCAD软件基于VB.NET的二次开发,本期再来为大家介绍一下N ...
- c#获取autocad安装位置_Robotstudio软件二次开发:基于C#语言的Smart组件开发基础
Robotstudio软件除了支持Add-Ins插件的二次开发以外,还支持Smart组件的二次开发. 开发语言同样是基于 .NET框架的C#语言或VB语言. Smart组件是Robotstudio软件 ...
- ArcGIS二次开发基础教程(03):保存文档和导出地图
ArcGIS二次开发基础教程(03):保存文档和导出地图 保存文档 保存: //这里的path为全局变量 在打开文件获添加数据时赋值原路径 //判断打开文件是否为mxd文件 是则保存 不是则另存为 i ...
最新文章
- Windows Phone的网络连接策略
- LeetCode【9-- 回文数】LeetCode【10 --正则表达式的匹配】
- 利用ORB/AKAZE特征点进行图像配准
- 【Elasticsearch】Elasticsearch-Hadoop打通Elasticsearch和Hadoop
- 一大波PyTorch图像分割模型来袭,俄罗斯程序员出品新model zoo
- # C语言程序设计第二次作业——顺序结构
- nicelabel java_EditPlus
- 专门查英语单词的软件_查英语单词的工具
- Kmeans算法提升
- Python数据分析将数组的多行元素首尾相连为一行numpy.ravel()
- 调用微信公众号现金红包接口给用户发送红包
- 论文笔记:Auto-Encoding Scene Graphs for Image Captioning
- yarn安装依赖时出现错误(2种解决方法)Integrity check failed for “antd“ computed integrity doesn‘t match our records)
- 欠债还钱,天经地义(一)
- Camera.cullingMask 常用操作
- 计算 1! + 2! + 3! + 4! +... + 10! 说明:4! 表示4的阶乘。4的阶乘是:1 * 2 * 3 * 4
- Python收取163邮箱--Star.hou
- html导航凹凸效果,纯CSS实现底部弧度效果(凹凸圆弧)
- yuyv_to_yv12
- python开发跟淘宝有联系没_python每日获取淘宝首页关键字推荐词
热门文章
- 游戏必备组件有哪些_抖音直播互动游戏有哪些?直播间热场互动必备的5个小游戏...
- “华为杯”中国研究生数学建模竞赛 记录
- uniapp阿里云图标库如何本地引入
- 【正点原子STM32连载】第三十七章 触摸屏实验 摘自【正点原子】MiniPro STM32H750 开发指南_V1.1
- Fences中关于Explorer非正常关闭问题
- linux远程原来显示器,【LINUX】(Ubuntu)无显示器接入,使用虚拟显示器且远程控制...
- 世界计算机组装最快记录,国产世界最快超级计算机开机1分钟 地球人算32年
- 软件工程 -- 开发模型
- Linux部署东方通TongWeb7
- docker阿里云镜像加速