易景地球web版开发说明

易景地球web版开发说明

易景地球web版运行环境

操作系统上已经安装了eviaearth(易景地球)相关服务(”易景地球x86”或者”易景地球x64”);

浏览器 目前支持firefox,ie浏览器和老版本(39.20之前的版本)的chrome浏览器。

1 易景地球三维地图的加载

网页中应声明引入”eviamap3d.js”代码包

<script type=”text/javascript” src=”eviamap3d.js”></script>

网页加载时应执行初始化函数:

  • 在<body>标签加载时运行初始化方法:

<body onload=”onload()”> 在onload()方法中执行;

onload(

evia3d = new EviaMap3D(null,’evia3d’);

)

  • ready()函数中运行初始化方法:

$(document).ready(

evia3d = new EviaMap3D(null,’evia3d’);

)

 

2 在易景地球三维地图上添加一个图层

var layer = evia3d.eviacontrol.Scene.CreateObject(“EviaEarthObject.ImageLayer.1”);

 

3 在易景地球三维地图上添加一个点

var point = evia3d.eviacontrol.Scene.CreateObject(“EviaEarthVector.Point”);

 

样式:

var style = evia3d.eviacontrol.Scene.CreateObject(“EviaEarthVector.Style.1”);

 

style.LabelStyle.Color.R = 255;

style.LabelStyle.Color.G = 0;

style.LabelStyle.Color.B = 0;

style.LabelStyle.Color.A = 100;

style.LabelStyle.Scale = 0.7;

style.LabelStyle.Order = 100;

图标:

var pic =evia3d.eviacontrol.Scene.CreateObject(“EviaEarthVector.EvPicture.1”);

style.IconStyle.Texture = pic;

style.IconStyle.Scale = 1;

style.IconStyle.Color.R = 0;

style.IconStyle.Color.G = 255;

style.IconStyle.Color.B = 0;

style.IconStyle.Color.A = 128;

style.IconStyle.Heading = 45;

style.IconStyle.HeadingMode = 2;

4 在易景地球三维地图上添加一条线

var line = evia3d.eviacontrol.Scene.CreateObject(“EviaEarthVector.LineString.1”);

样式:

var style =evia3d.eviacontrol.Scene.CreateObject(“EviaEarthVector.Style”);

pm.StyleSelector = style;

style.LabelStyle.Color.R = 255;

style.LabelStyle.Color.G = 0;

style.LabelStyle.Color.B = 0;

style.LabelStyle.Color.A = 100;

style.LabelStyle.Scale = 0.7;

style.LabelStyle.Order = 100;

5 在易景地球三维地图上添加一个多边形

var polygon = evia3d.eviacontrol.Scene.CreateObject(“EviaEarthVector.EVPolygon.1”);

6 在易景地球三维地图上添加一个场景

evia3d.loadScene(“http://127.0.0.1:8080/earth/scene=yunnan”);

7 在易景地球三维地图上添加一个模型

var model = evia3d.eviacontrol.Scene.CreateObject(“EviaEarthVector.Model.1”);

属性:

model.Location.Longitude = 116.2429;

model.Location.Latitude = 40;

model.Location.Altitude = 0;

model.Orientation.Heading = 90;

model.Orientation.Tile = 30;

8 在易景地球三维地图上添加一个执行脚本

evia3d.eviacontrol.RunScript(“evmsg(1)”);

9 在易景地球三维地图上添加一个监听事件

evia3d.eviacontrol.Object2Lua(“onObjClick”,onObjClick);