rn_supermap
Version:
rn_supermap 一款基于React-Native框架的移动应用开发工具。基于该开发工具,用户可以使用JavaScript开发语言,开发出在Android和IOS操作系统下运行的原生移动GIS应用,入门门槛低,一次开发,处处运行。
219 lines (189 loc) • 8.02 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: Scene.js</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Source: Scene.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>/*********************************************************************************
Copyright © SuperMap. All rights reserved.
Author: Will
E-mail: pridehao@gmail.com
**********************************************************************************/
import {NativeModules} from 'react-native';
let S = NativeModules.JSScene;
import Workspace from './Workspace';
/**
* @class Scene
* @description 三维场景类。
*/
export default class Scene {
/**
* 设置工作空间
* @memberOf Scene
* @param {object} workspace - 工作空间对象
* @returns {Promise.<void>}
*/
async setWorkspace(workspace){
try{
await S.setWorkspace(this._SMSceneId,workspace._SMWorkspaceId);
}catch (e){
console.error(e);
}
}
/**
* 返回三维场景所关联的工作空间。
* @memberOf Scene
* @returns {Promise.<Workspace>}
*/
async getWorkspace(){
try{
var {workspaceId} = await S.setWorkspace(this._SMSceneId);
var workspace = new Workspace();
workspace._SMWorkspaceId = workspaceId;
return workspace;
}catch (e){
console.error(e);
}
}
/**
* 根据提供的场景名称打开三维地图
* @memberOf Scene
* @param {string} [iserverUrl,] sceneName [,password] - 只有一个参数时: 场景名称。
* 两个参数时:(iserverUrl,sceneName) iserverUrl - 三维服务URL地址;sceneName - 场景名称。
* 三个参数时:(iserverUrl,sceneName,passWord ) iserverUrl - 三维服务URL地址;sceneName - 场景名称; passWord - 场景密码,默认密码是“supermap”。
* @returns {Promise.<boolean>}
*/
async open(){
try{
if(arguments.length == 1){
var {opened} = await S.open(this._SMSceneId,arguments[0]);
return opened;
}else if(arguments.length == 2){
var {opened} = await S.open2(this._SMSceneId,arguments[0],arguments[1]);
return opened;
}else if(arguments.length == 3){
var {opened} = await S.open3(this._SMSceneId,arguments[0],arguments[1],arguments[2]);
return opened;
}else{
throw new Error("Scene opened Error: Please input 1-3 arguments.read the specification please")
}
}catch (e){
console.error(e);
}
}
/**
* 根据经纬度范围显示场景。
* @memberOf Scene
* @param {object} visibleBounds - rectangle2D对象,包含如下属性:{top:--,left:--,right:--,bottom:--}
* @returns {Promise.<void>}
*/
async ensureVisible(visibleBounds){
try{
await S.ensureVisible(this._SMSceneId,visibleBounds);
}catch (e){
console.error(e);
}
}
/**
* 刷新三维场景
* @memberOf Scene
* @returns {Promise.<void>}
*/
async refresh(){
try{
await S.refresh(this._SMSceneId);
}catch (e){
console.error(e);
}
}
/**
* 平移三维场景。
* @memberOf Scene
* @param offsetLongitude - 指定的经向平移距离。
* @param offsetLatitude - 指定的纬向平移距离。
* @returns {Promise.<void>}
*/
async pan(offsetLongitude,offsetLatitude){
try{
await S.pan(this._SMSceneId,offsetLongitude,offsetLatitude);
}catch (e){
console.error(e);
}
}
/**
* 全幅显示此场景。
* @memberOf Scene
* @returns {Promise.<void>}
*/
async viewEntire(){
try{
await S.viewEntire(this._SMSceneId);
}catch (e){
console.error(e);
}
}
/**
* 根据给定的缩放比例,对三维地图场景进行缩放操作
* @memberOf Scene
* @param {double} ratio - 指定的缩放比例数值。
* @returns {Promise.<void>}
*/
async zoom(ratio){
try{
await S.zoom(this._SMSceneId,ratio);
}catch (e){
console.error(e);
}
}
/**
* 关闭当前场景
* @memberOf Scene
* @returns {Promise.<void>}
*/
async close(){
try{
await S.close(this._SMSceneId);
}catch (e){
console.error(e);
}
}
/**
* 释放该对象所占用的资源
* @memberOf Scene
* @returns {Promise.<void>}
*/
async dispose(){
try{
await S.dispose(this._SMSceneId);
}catch (e){
console.error(e);
}
}
}
</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="BufferAnalyst.html">BufferAnalyst</a></li><li><a href="BufferAnalystParameter.html">BufferAnalystParameter</a></li><li><a href="DataDownloadService.html">DataDownloadService</a></li><li><a href="Dataset.html">Dataset</a></li><li><a href="DatasetVector.html">DatasetVector</a></li><li><a href="DatasetVectorInfo.html">DatasetVectorInfo</a></li><li><a href="Datasource.html">Datasource</a></li><li><a href="DatasourceConnectionInfo.html">DatasourceConnectionInfo</a></li><li><a href="DataUploadService.html">DataUploadService</a></li><li><a href="Feature.html">Feature</a></li><li><a href="FeatureSet.html">FeatureSet</a></li><li><a href="GeoLine.html">GeoLine</a></li><li><a href="Geometry.html">Geometry</a></li><li><a href="GeoPoint.html">GeoPoint</a></li><li><a href="GeoRegion.html">GeoRegion</a></li><li><a href="GeoStyle.html">GeoStyle</a></li><li><a href="Layer.html">Layer</a></li><li><a href="LayerSetting.html">LayerSetting</a></li><li><a href="LayerSettingVector.html">LayerSettingVector</a></li><li><a href="LocationManager.html">LocationManager</a></li><li><a href="Map.html">Map</a></li><li><a href="MapControl.html">MapControl</a></li><li><a href="MapView.html">MapView</a></li><li><a href="Navigation2.html">Navigation2</a></li><li><a href="OverlayAnalyst.html">OverlayAnalyst</a></li><li><a href="OverlayAnalystParameter.html">OverlayAnalystParameter</a></li><li><a href="Point.html">Point</a></li><li><a href="Point2D.html">Point2D</a></li><li><a href="QueryParameter.html">QueryParameter</a></li><li><a href="QueryService.html">QueryService</a></li><li><a href="Rectangle2D.html">Rectangle2D</a></li><li><a href="Scene.html">Scene</a></li><li><a href="Selection.html">Selection</a></li><li><a href="ServiceBase.html">ServiceBase</a></li><li><a href="ServiceQueryParameter.html">ServiceQueryParameter</a></li><li><a href="Size2D.html">Size2D</a></li><li><a href="Theme.html">Theme</a></li><li><a href="Track.html">Track</a></li><li><a href="TrackingLayer.html">TrackingLayer</a></li><li><a href="TraditionalNavi.html">TraditionalNavi</a></li><li><a href="Workspace.html">Workspace</a></li><li><a href="WorkspaceConnectionInfo.html">WorkspaceConnectionInfo</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Tue Aug 01 2017 16:16:49 GMT+0800 (CST)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>