@mapgis/webclient-common
Version:
mapgis ES6 format for igserver
3,042 lines (1,246 loc) • 86.8 kB
HTML
<header id="page-title" class="page-title">
<span class="page-title-main">类名</span>
<span class="page-title-sub">GeometryServer</span>
</header>
<section>
<article>
<div class="container-overview">
<div class='vertical-section'>
<div class="members">
<div class="member">
<h4 class="name" id="GeometryServer">
<a class="href-link" href="#GeometryServer">#</a>
<span class="code-name" id="GeometryServer" style="font-size:30px">
new GeometryServer<span class="signature">(options)</span>
</span>
</h4>
<div class="description">
<p>地理几何服务</p>
</div>
<h4>参数</h4>
<div class="table-container">
<table class="params table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th style="min-width: 100px;">默认值</th>
<th class="last">描述</th>
</tr>
</thead>
<tbody>
<tr class="deep-level-0">
<td class="name" id="options"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="default">
</td>
<td class="description last"><p>构造参数</p></td>
</tr>
<tr class="deep-level-1">
<td class="name" id="url"><code>url</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="default">
无
</td>
<td class="description last"><p>服务基地址</p></td>
</tr>
</tbody>
</table>
</div>
<dl class="details">
</dl>
<h5>示例</h5>
<pre class="prettyprint"><code>// ES5引入方式
const { GeometryServer } = Zondy.Service
// ES6引入方式
import { GeometryServer } from "@mapgis/webclient-common"
const geometryServer = new GeometryServer({
url: 'http://localhost:8089/igs/rest/services/system/GeometryServer',
requestInterceptor: {
before: function (config) {
return config;
},
failure: function (error) {
console.log("请求发送失败(拦截器):", error)
}
},
responseInterceptor: {
success: function (result) {
console.log("请求成功拦截响应")
return result;
},
failure: function (result) {
console.log("请求失败拦截响应")
return result;
}
}
});</code></pre>
</div>
</div>
</div>
</div>
<h3 class="subsection-title">继承关系</h3>
<ul>
<li><a link="BaseServer.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="BaseServer" BaseServer.html>BaseServer</a></li>
</ul>
<div class='vertical-section'>
<h3 id='member'>成员变量</h3>
<h4 style="margin-top: 20px;margin-bottom: 20px;">成员变量概述</h4>
<div class="table-container">
<table class="params table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr class="deep-level-0">
<td class="name"><code><a href="#clientId">clientId</a></code></td>
<td class="name">
<code>
<span class="param-type">Boolean</span>
</code>
</td>
<td class="name"><code><p>客户端id</p></code></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code><a href="#enableGlobeFetch">enableGlobeFetch</a></code></td>
<td class="name">
<code>
<span class="param-type">Boolean</span>
</code>
</td>
<td class="name"><code><p>是否使用确据唯一的fetch对象,默认为true,当设为false时,会使用自己私有的fetch对象,所有的请求设置不会影响全局</p></code></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code><a href="#headers">headers</a></code></td>
<td class="name">
<code>
<span class="param-type">String</span>
</code>
</td>
<td class="name"><code><p>请求头参数</p></code></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code><a href="#requestInterceptor">requestInterceptor</a></code></td>
<td class="name">
<code>
<span class="param-type">function</span>
</code>
</td>
<td class="name"><code><p>请求发送拦截器</p></code></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code><a href="#requestTimeout">requestTimeout</a></code></td>
<td class="name">
<code>
<span class="param-type">String</span>
</code>
</td>
<td class="name"><code><p>请求超时时间,默认45000ms,即45s</p></code></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code><a href="#responseInterceptor">responseInterceptor</a></code></td>
<td class="name">
<code>
<span class="param-type">function</span>
</code>
</td>
<td class="name"><code><p>请求响应拦截器</p></code></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code><a href="#tokenAttachType">tokenAttachType</a></code></td>
<td class="name">
<code>
<span class="param-type"><a link="TokenAttachType.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="TokenAttachType" global.html#TokenAttachType>TokenAttachType</a></span>
</code>
</td>
<td class="name"><code><p>指定token附加到何处</p></code></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code><a href="#tokenKey">tokenKey</a></code></td>
<td class="name">
<code>
<span class="param-type">String</span>
</code>
</td>
<td class="name"><code><p>token名</p></code></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code><a href="#tokenValue">tokenValue</a></code></td>
<td class="name">
<code>
<span class="param-type">String</span>
</code>
</td>
<td class="name"><code><p>token值</p></code></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code><a href="#url">url</a></code></td>
<td class="name">
<code>
<span class="param-type">String</span>
</code>
</td>
<td class="name"><code><p>服务基地址</p></code></td>
</tr>
</tbody>
</table>
</div>
<h4 style="margin-top: 20px;margin-bottom: 20px;">成员变量详情</h4>
<div class="members">
<div class="member">
<span class="method-parameter is-pulled-right">
<label>类型:</label>
<span class="param-type">Boolean</span>
</span>
<h4 class="name" id="clientId">
<a class="href-link" href="#clientId">#</a>
<span class="code-name">
clientId
</span>
</h4>
<div class="description">
<p>客户端id</p>
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a goto="clientId" link="BaseServer.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="BaseServer#clientId" BaseServer.html#clientId>BaseServer#clientId</a>
</li></ul></dd>
</dl>
</div>
<div class="member">
<span class="method-parameter is-pulled-right">
<label>类型:</label>
<span class="param-type">Boolean</span>
</span>
<h4 class="name" id="enableGlobeFetch">
<a class="href-link" href="#enableGlobeFetch">#</a>
<span class="code-name">
enableGlobeFetch
</span>
</h4>
<div class="description">
<p>是否使用确据唯一的fetch对象,默认为true,当设为false时,会使用自己私有的fetch对象,所有的请求设置不会影响全局</p>
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a goto="enableGlobeFetch" link="BaseServer.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="BaseServer#enableGlobeFetch" BaseServer.html#enableGlobeFetch>BaseServer#enableGlobeFetch</a>
</li></ul></dd>
</dl>
<h5>示例</h5>
<pre class="prettyprint"><code>//设置请求基地址
// ES5引入方式
const { BaseServer } = Zondy.Service
// ES6引入方式
import { BaseServer } from "@mapgis/webclient-common"
let BaseServer = new BaseServer({
//请求基地址
url: '你的URL',
//使用私有的fetch对象
enableGlobeFetch: false,
//此时设置token等属性,不会影响全局的fetch对象
tokenValue: '你的token'
});
//继续使用全局fetch
BaseServer.enableGlobeFetch = true;</code></pre>
</div>
<div class="member">
<span class="method-parameter is-pulled-right">
<label>类型:</label>
<span class="param-type">String</span>
</span>
<h4 class="name" id="headers">
<a class="href-link" href="#headers">#</a>
<span class="code-name">
headers
</span>
</h4>
<div class="description">
<p>请求头参数</p>
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a goto="headers" link="BaseServer.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="BaseServer#headers" BaseServer.html#headers>BaseServer#headers</a>
</li></ul></dd>
</dl>
<h5>示例</h5>
<pre class="prettyprint"><code>//设置请求头参数
// ES5引入方式
const { BaseServer } = Zondy.Service
// ES6引入方式
import { BaseServer } from "@mapgis/webclient-common"
let BaseServer = new BaseServer({
//请求头
headers: {
//设置Content-Type为multipart/form-data
'Content-Type': 'multipart/form-data',
//设置token
'token': '你的token'
}
});
//动态修改
BaseServer.headers.token = '新token';</code></pre>
</div>
<div class="member">
<span class="method-parameter is-pulled-right">
<label>类型:</label>
<span class="param-type">function</span>
</span>
<h4 class="name" id="requestInterceptor">
<a class="href-link" href="#requestInterceptor">#</a>
<span class="code-name">
requestInterceptor
</span>
</h4>
<div class="description">
<p>请求发送拦截器</p>
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a goto="requestInterceptor" link="BaseServer.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="BaseServer#requestInterceptor" BaseServer.html#requestInterceptor>BaseServer#requestInterceptor</a>
</li></ul></dd>
</dl>
<h5>示例</h5>
<pre class="prettyprint"><code>//设置拦截器,任何一个继承自BaseServer的对象都可以设置,全局唯一
// ES5引入方式
const { BaseServer,RequestInterceptor } = Zondy.Service
// ES6引入方式
import { BaseServer,RequestInterceptor } from "@mapgis/webclient-common"
let BaseServer = new BaseServer({
//设置请求发送拦截器
requestInterceptor: new RequestInterceptor({
//请求发送前进行统一处理
before: function(config) {
//执行你的业务逻辑
//注意必须显示返回config对象,如果返回为空,则不发送请求
return config;
},
//请求发送失败时进行统一处理
failure: function(error) {
//执行你的业务逻辑
}
})
});
//动态修改
BaseServer.requestInterceptor.before = function() {};</code></pre>
</div>
<div class="member">
<span class="method-parameter is-pulled-right">
<label>类型:</label>
<span class="param-type">String</span>
</span>
<h4 class="name" id="requestTimeout">
<a class="href-link" href="#requestTimeout">#</a>
<span class="code-name">
requestTimeout
</span>
</h4>
<div class="description">
<p>请求超时时间,默认45000ms,即45s</p>
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a goto="requestTimeout" link="BaseServer.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="BaseServer#requestTimeout" BaseServer.html#requestTimeout>BaseServer#requestTimeout</a>
</li></ul></dd>
</dl>
<h5>示例</h5>
<pre class="prettyprint"><code>//设置超时时间
//初始化AddressServer服务对象
// ES5引入方式
const { BaseServer } = Zondy.Service
// ES6引入方式
import { BaseServer } from "@mapgis/webclient-common"
let BaseServer = new BaseServer({
//超时时间
requestTimeout: 2000
});
//动态修改
BaseServer.requestTimeout = 3000;</code></pre>
</div>
<div class="member">
<span class="method-parameter is-pulled-right">
<label>类型:</label>
<span class="param-type">function</span>
</span>
<h4 class="name" id="responseInterceptor">
<a class="href-link" href="#responseInterceptor">#</a>
<span class="code-name">
responseInterceptor
</span>
</h4>
<div class="description">
<p>请求响应拦截器</p>
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a goto="responseInterceptor" link="BaseServer.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="BaseServer#responseInterceptor" BaseServer.html#responseInterceptor>BaseServer#responseInterceptor</a>
</li></ul></dd>
</dl>
<h5>示例</h5>
<pre class="prettyprint"><code>//设置拦截器,任何一个继承自BaseServer的对象都可以设置,全局唯一
// ES5引入方式
const { BaseServer,ResponseInterceptor } = Zondy.Service
// ES6引入方式
import { BaseServer,ResponseInterceptor } from "@mapgis/webclient-common"
let BaseServer = new BaseServer({
//设置请求响应拦截器
responseInterceptor: new ResponseInterceptor({
//执行请求响应,接口调用成功时会执行的回调
success: function(result) {
//执行你的业务逻辑
//注意必须显示返回result对象,如果返回为空,则不执行请求响应成功回调
return result;
},
//请求响应成功,接口调用失败时会执行的函数
failure: function(result) {
//执行你的业务逻辑
//注意必须显示返回result对象,如果返回为空,则不执行回调韩式
return result;
}
})
});
//动态修改
BaseServer.responseInterceptor.success = function() {};</code></pre>
</div>
<div class="member">
<span class="method-parameter is-pulled-right">
<label>类型:</label>
<span class="param-type"><a link="TokenAttachType.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="TokenAttachType" global.html#TokenAttachType>TokenAttachType</a></span>
</span>
<h4 class="name" id="tokenAttachType">
<a class="href-link" href="#tokenAttachType">#</a>
<span class="code-name">
tokenAttachType
</span>
</h4>
<div class="description">
<p>指定token附加到何处</p>
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a goto="tokenAttachType" link="BaseServer.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="BaseServer#tokenAttachType" BaseServer.html#tokenAttachType>BaseServer#tokenAttachType</a>
</li></ul></dd>
</dl>
<h5>示例</h5>
<pre class="prettyprint"><code>//设置token值
// ES5引入方式
const { BaseServer } = Zondy.Service
const { TokenAttachType } = Zondy.Enum
// ES6引入方式
import { BaseServer,TokenAttachType } from "@mapgis/webclient-common"
let BaseServer = new BaseServer({
//token名
tokenValue: '你的token值',
//token值
tokenValue: '你的token值',
//指定token附加到url后面
tokenAttachType: TokenAttachType.url
});
//动态修改
BaseServer.tokenAttachType = TokenAttachType.header;</code></pre>
</div>
<div class="member">
<span class="method-parameter is-pulled-right">
<label>类型:</label>
<span class="param-type">String</span>
</span>
<h4 class="name" id="tokenKey">
<a class="href-link" href="#tokenKey">#</a>
<span class="code-name">
tokenKey
</span>
</h4>
<div class="description">
<p>token名</p>
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a goto="tokenKey" link="BaseServer.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="BaseServer#tokenKey" BaseServer.html#tokenKey>BaseServer#tokenKey</a>
</li></ul></dd>
</dl>
<h5>示例</h5>
<pre class="prettyprint"><code>//设置token名
// ES5引入方式
const { BaseServer } = Zondy.Service
// ES6引入方式
import { BaseServer } from "@mapgis/webclient-common"
let BaseServer = new BaseServer({
//token名
tokenKey: '你的tokenKey'
});
//动态修改
BaseServer.tokenKey = '新tokenKey';</code></pre>
</div>
<div class="member">
<span class="method-parameter is-pulled-right">
<label>类型:</label>
<span class="param-type">String</span>
</span>
<h4 class="name" id="tokenValue">
<a class="href-link" href="#tokenValue">#</a>
<span class="code-name">
tokenValue
</span>
</h4>
<div class="description">
<p>token值</p>
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a goto="tokenValue" link="BaseServer.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="BaseServer#tokenValue" BaseServer.html#tokenValue>BaseServer#tokenValue</a>
</li></ul></dd>
</dl>
<h5>示例</h5>
<pre class="prettyprint"><code>//设置token值
// ES5引入方式
const { BaseServer } = Zondy.Service
// ES6引入方式
import { BaseServer } from "@mapgis/webclient-common"
let BaseServer = new BaseServer({
//token值
tokenValue: '你的token值'
});
//动态修改
BaseServer.tokenValue = '新token值';</code></pre>
</div>
<div class="member">
<span class="method-parameter is-pulled-right">
<label>类型:</label>
<span class="param-type">String</span>
</span>
<h4 class="name" id="url">
<a class="href-link" href="#url">#</a>
<span class="code-name">
url
</span>
</h4>
<div class="description">
<p>服务基地址</p>
</div>
<dl class="details">
<dt class="inherited-from">Inherited From:</dt>
<dd class="inherited-from"><ul class="dummy"><li>
<a goto="url" link="BaseServer.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="BaseServer#url" BaseServer.html#url>BaseServer#url</a>
</li></ul></dd>
</dl>
<h5>示例</h5>
<pre class="prettyprint"><code>//设置请求基地址
// ES5引入方式
const { BaseServer } = Zondy.Service
// ES6引入方式
import { BaseServer } from "@mapgis/webclient-common"
let BaseServer = new BaseServer({
//请求基地址
url: '你的URL'
});
//动态修改
BaseServer.url = '新URL';</code></pre>
</div>
</div>
</div>
<div class='vertical-section'>
<h3 id='function'>方法</h3>
<h4 style="margin-top: 20px;margin-bottom: 20px;">方法概述</h4>
<div class="members">
<div class="table-container">
<table class="params table">
<thead>
<tr>
<th>名称</th>
<th>返回值类型</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr class="deep-level-0">
<td class="name"><code><a href="#bufferAnalyse">bufferAnalyse</a></code></td>
<td class="name">
<code>
</code>
</td>
<td class="name"><code><p>缓冲分析</p></code></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code><a href="#calculateArea">calculateArea</a></code></td>
<td class="name">
<code>
</code>
</td>
<td class="name"><code><p>计算面积</p></code></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code><a href="#calculateAreasAndLengths">calculateAreasAndLengths</a></code></td>
<td class="name">
<code>
</code>
</td>
<td class="name"><code><p>计算面积和周长</p></code></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code><a href="#calculateDifference">calculateDifference</a></code></td>
<td class="name">
<code>
</code>
</td>
<td class="name"><code><p>求差计算</p></code></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code><a href="#calculateDistance">calculateDistance</a></code></td>
<td class="name">
<code>
</code>
</td>
<td class="name"><code><p>求距离</p></code></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code><a href="#calculateIntersect">calculateIntersect</a></code></td>
<td class="name">
<code>
</code>
</td>
<td class="name"><code><p>求交计算</p></code></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code><a href="#calculateLabelPoints">calculateLabelPoints</a></code></td>
<td class="name">
<code>
</code>
</td>
<td class="name"><code><p>求label点</p></code></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code><a href="#calculateLength">calculateLength</a></code></td>
<td class="name">
<code>
</code>
</td>
<td class="name"><code><p>计算长度</p></code></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code><a href="#calculateLengths">calculateLengths</a></code></td>
<td class="name">
<code>
</code>
</td>
<td class="name"><code><p>求长度</p></code></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code><a href="#calculateTopologyRelation">calculateTopologyRelation</a></code></td>
<td class="name">
<code>
</code>
</td>
<td class="name"><code><p>计算拓扑关系</p></code></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code><a href="#calculateUnion">calculateUnion</a></code></td>
<td class="name">
<code>
</code>
</td>
<td class="name"><code><p>求并</p></code></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code><a href="#geometryProject">geometryProject</a></code></td>
<td class="name">
<code>
</code>
</td>
<td class="name"><code><p>几何投影</p></code></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code><a href="#projectInExtent">projectInExtent</a></code></td>
<td class="name">
<code>
</code>
</td>
<td class="name"><code><p>对矩形范围坐标点进行投影转换</p></code></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code><a href="#queryServerInfo">queryServerInfo</a></code></td>
<td class="name">
<code>
</code>
</td>
<td class="name"><code><p>获取服务信息,IGS2.0新增服务</p></code></td>
</tr>
<tr class="deep-level-0">
<td class="name"><code><a href="#smoothLineString">smoothLineString</a></code></td>
<td class="name">
<code>
</code>
</td>
<td class="name"><code><p>计算光滑曲线,igs1.0服务</p></code></td>
</tr>
</tbody>
</table>
</div>
<h4 style="margin-top: 20px;margin-bottom: 20px;">方法详情</h4>
<div class="member">
<h4 class="name" id="bufferAnalyse">
<a class="href-link" href="#bufferAnalyse">#</a>
<span class="code-name" id="bufferAnalyse" style="font-size:30px">
bufferAnalyse<span class="signature">(options)</span>
</span>
</h4>
<div class="description">
<p>缓冲分析</p>
</div>
<h4>参数</h4>
<div class="table-container">
<table class="params table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th class="last">描述</th>
</tr>
</thead>
<tbody>
<tr class="deep-level-0">
<td class="name" id="options"><code>options</code></td>
<td class="type">
</td>
<td class="description last"><p>查询参数</p></td>
</tr>
<tr class="deep-level-1">
<td class="name" id="polygon"><code>polygon</code></td>
<td class="type">
<span class="param-type"><a link="Polygon.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Polygon" Polygon.html>Polygon</a></span>
</td>
<td class="description last"><p>要计算的多边形</p></td>
</tr>
<tr class="deep-level-1">
<td class="name" id="distance"><code>distance</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last"><p>缓冲半径</p></td>
</tr>
<tr class="deep-level-1">
<td class="name" id="success"><code>success</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last"><p>查询成功回调函数,若使用Promise方式则不必填写</p></td>
</tr>
<tr class="deep-level-1">
<td class="name" id="failure"><code>failure</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last"><p>查询失败回调函数,若使用Promise方式则不必填写</p></td>
</tr>
</tbody>
</table>
</div>
<dl class="details">
</dl>
<h5>示例</h5>
<pre class="prettyprint"><code>// 回调方式
// ES5引入方式
const { Polygon } = Zondy.Geometry
const { FetchMethod } = Zondy.Enum
// ES6引入方式
import { Polygon, FetchMethod } from "@mapgis/webclient-common"
geometryServer.bufferAnalyse({
geometries: new Polygon({
spatialReference: "EPSG:4326",
coordinates: [
[
[108.9587, 34.2206],
[112.9607, 31.2196],
[110.9598, 30.2181],
[110.9587, 32.2191],
[108.9587, 34.2206]
]
]
}),
method: FetchMethod.post,
distance: 1,
success: function (result) {
console.log('请求成功:', result);
},
failure: function (result) {
console.log('请求失败:', result);
}
});
// promise方式
geometryServer.bufferAnalyse({
geometries: new Polygon({
spatialReference: "EPSG:4326",
coordinates: [
[
[108.9587, 34.2206],
[112.9607, 31.2196],
[110.9598, 30.2181],
[110.9587, 32.2191],
[108.9587, 34.2206]
]
]
}),
distance: 100,
}).then(function (result) {
console.log('请求成功:', result);
}).catch(function (result) {
console.log('请求失败:', result);
})</code></pre>
</div>
<div class="member">
<h4 class="name" id="calculateArea">
<a class="href-link" href="#calculateArea">#</a>
<span class="code-name" id="calculateArea" style="font-size:30px">
calculateArea<span class="signature">(options)</span>
</span>
</h4>
<div class="description">
<p>计算面积</p>
</div>
<h4>参数</h4>
<div class="table-container">
<table class="params table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th class="last">描述</th>
</tr>
</thead>
<tbody>
<tr class="deep-level-0">
<td class="name" id="options"><code>options</code></td>
<td class="type">
</td>
<td class="description last"><p>查询参数</p></td>
</tr>
<tr class="deep-level-1">
<td class="name" id="polygon"><code>polygon</code></td>
<td class="type">
<span class="param-type"><a link="Polygon.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Polygon" Polygon.html>Polygon</a></span>
</td>
<td class="description last"><p>要计算的多边形,必填</p></td>
</tr>
<tr class="deep-level-1">
<td class="name" id="success"><code>success</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last"><p>查询成功回调函数,若使用Promise方式则不必填写</p></td>
</tr>
<tr class="deep-level-1">
<td class="name" id="failure"><code>failure</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last"><p>查询失败回调函数,若使用Promise方式则不必填写</p></td>
</tr>
<tr class="deep-level-1">
<td class="name" id="projectInfo"><code>projectInfo</code></td>
<td class="type">
<span class="param-type"><a link="ProjectInfo.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="ProjectInfo" ProjectInfo.html>ProjectInfo</a></span>
</td>
<td class="description last"><p>投影参考信息,projectInfo或projectInfoBySrsID二选一</p></td>
</tr>
<tr class="deep-level-1">
<td class="name" id="projectInfoBySrsID"><code>projectInfoBySrsID</code></td>
<td class="type">
<span class="param-type"><a link="ProjectInfoBySrsID.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="ProjectInfoBySrsID" ProjectInfoBySrsID.html>ProjectInfoBySrsID</a></span>
</td>
<td class="description last"><p>源投影参考系ID,projectInfo或projectInfoBySrsID二选一</p></td>
</tr>
</tbody>
</table>
</div>
<dl class="details">
</dl>
</div>
<div class="member">
<h4 class="name" id="calculateAreasAndLengths">
<a class="href-link" href="#calculateAreasAndLengths">#</a>
<span class="code-name" id="calculateAreasAndLengths" style="font-size:30px">
calculateAreasAndLengths<span class="signature">(options)</span>
</span>
</h4>
<div class="description">
<p>计算面积和周长</p>
</div>
<h4>参数</h4>
<div class="table-container">
<table class="params table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th class="last">描述</th>
</tr>
</thead>
<tbody>
<tr class="deep-level-0">
<td class="name" id="options"><code>options</code></td>
<td class="type">
</td>
<td class="description last"><p>查询参数</p></td>
</tr>
<tr class="deep-level-1">
<td class="name" id="polygons"><code>polygons</code></td>
<td class="type">
<span class="param-type"><a link="Polygon.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Polygon" Polygon.html>Polygon</a></span>
</td>
<td class="description last"><p>要计算的多边形,必填</p></td>
</tr>
<tr class="deep-level-1">
<td class="name" id="success"><code>success</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last"><p>查询成功回调函数,若使用Promise方式则不必填写</p></td>
</tr>
<tr class="deep-level-1">
<td class="name" id="failure"><code>failure</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last"><p>查询失败回调函数,若使用Promise方式则不必填写</p></td>
</tr>
</tbody>
</table>
</div>
<dl class="details">
</dl>
<h5>示例</h5>
<pre class="prettyprint"><code>// 回调方式
// ES5引入方式
const { Polygon } = Zondy.Geometry
// ES6引入方式
import { Polygon } from "@mapgis/webclient-common"
geometryServer.calculateAreasAndLengths({
polygons: new Polygon({
spatialReference: "EPSG:4326",
coordinates: [
[
[108.9587, 34.2206],
[112.9607, 31.2196],
[110.9598, 30.2181],
[110.9587, 32.2191],
[108.9587, 34.2206]
]
]
}),
success: function (result) {
console.log('请求成功:', result);
},
failure: function (result) {
console.log('请求失败:', result);
}
});
// promise方式
geometryServer.calculateAreasAndLengths({
polygons: new Polygon({
spatialReference: "EPSG:4326",
coordinates: [
[
[108.9587, 34.2206],
[112.9607, 31.2196],
[110.9598, 30.2181],
[110.9587, 32.2191],
[108.9587, 34.2206]
]
]
})
}).then(function (result) {
console.log('请求成功:', result);
}).catch(function (result) {
console.log('请求失败:', result);
})</code></pre>
</div>
<div class="member">
<h4 class="name" id="calculateDifference">
<a class="href-link" href="#calculateDifference">#</a>
<span class="code-name" id="calculateDifference" style="font-size:30px">
calculateDifference<span class="signature">(options)</span>
</span>
</h4>
<div class="description">
<p>求差计算</p>
</div>
<h4>参数</h4>
<div class="table-container">
<table class="params table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th class="last">描述</th>
</tr>
</thead>
<tbody>
<tr class="deep-level-0">
<td class="name" id="options"><code>options</code></td>
<td class="type">
</td>
<td class="description last"><p>查询参数</p></td>
</tr>
<tr class="deep-level-1">
<td class="name" id="geometry1"><code>geometry1</code></td>
<td class="type">
<span class="param-type"><a link="Geometry.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Geometry" Geometry.html>Geometry</a></span>
</td>
<td class="description last"><p>要计算的多边形1,必填</p></td>
</tr>
<tr class="deep-level-1">
<td class="name" id="geometry2"><code>geometry2</code></td>
<td class="type">
<span class="param-type"><a link="Geometry.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Geometry" Geometry.html>Geometry</a></span>
</td>
<td class="description last"><p>要计算的多边形2,必填</p></td>
</tr>
<tr class="deep-level-1">
<td class="name" id="tolerance"><code>tolerance</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last"><p>容差,必填</p></td>
</tr>
<tr class="deep-level-1">
<td class="name" id="success"><code>success</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last"><p>查询成功回调函数,若使用Promise方式则不必填写</p></td>
</tr>
<tr class="deep-level-1">
<td class="name" id="failure"><code>failure</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last"><p>查询失败回调函数,若使用Promise方式则不必填写</p></td>
</tr>
</tbody>
</table>
</div>
<dl class="details">
</dl>
<h5>示例</h5>
<pre class="prettyprint"><code>// 回调方式
// ES5引入方式
const { Polygon } = Zondy.Geometry
// ES6引入方式
import { Polygon } from "@mapgis/webclient-common"
geometryServer.calculateDifference({
geometry1: new Polygon({
coordinates: [
[
[105.0, 0.0],
[164.0, 0.0],
[164.0, 10.0],
[105.0, 10.0],
[105.0, 0.0]
]
]
}),
geometry2: new Polygon({
coordinates: [
[
[110.0, 5.0],
[170.0, 5.0],
[170.0, 20.0],
[110.0, 20.0],
[110.0, 5.0]
]
]
}),
tolerance: 1,
success: function (result) {
console.log('请求成功:', result);
},
failure: function (result) {
console.log('请求失败:', result);
}
});
// promise方式
geometryServer.calculateDifference({
geometry1: new Polygon({
coordinates: [
[
[105.0, 0.0],
[164.0, 0.0],
[164.0, 10.0],
[105.0, 10.0],
[105.0, 0.0]
]
]
}),
geometry2: new Polygon({
coordinates: [
[
[110.0, 5.0],
[170.0, 5.0],
[170.0, 20.0],
[110.0, 20.0],
[110.0, 5.0]
]
]
}),
tolerance: 1
}).then(function (result) {
console.log('请求成功:', result);
}).catch(function (result) {
console.log('请求失败:', result);
})</code></pre>
</div>
<div class="member">
<h4 class="name" id="calculateDistance">
<a class="href-link" href="#calculateDistance">#</a>
<span class="code-name" id="calculateDistance" style="font-size:30px">
calculateDistance<span class="signature">(options)</span>
</span>
</h4>
<div class="description">
<p>求距离</p>
</div>
<h4>参数</h4>
<div class="table-container">
<table class="params table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th class="last">描述</th>
</tr>
</thead>
<tbody>
<tr class="deep-level-0">
<td class="name" id="options"><code>options</code></td>
<td class="type">
</td>
<td class="description last"><p>查询参数</p></td>
</tr>
<tr class="deep-level-1">
<td class="name" id="geometry1"><code>geometry1</code></td>
<td class="type">
<span class="param-type"><a link="Geometry.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Geometry" Geometry.html>Geometry</a></span>
</td>
<td class="description last"><p>要计算的多边形1,必填</p></td>
</tr>
<tr class="deep-level-1">
<td class="name" id="geometry2"><code>geometry2</code></td>
<td class="type">
<span class="param-type"><a link="Geometry.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Geometry" Geometry.html>Geometry</a></span>
</td>
<td class="description last"><p>要计算的多边形2,必填</p></td>
</tr>
<tr class="deep-level-1">
<td class="name" id="srs"><code>srs</code></td>
<td class="type">
<span class="param-type"><a link="Geometry.html" onclick="getTypeHTML(event)" class="mapgis-link-name" title="Geometry" Geometry.html>Geometry</a></span>
</td>
<td class="description last"><p>参考系,必填</p></td>
</tr>
<tr class="deep-level-1">
<td class="name" id="success"><code>success</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last"><p>查询成功回调函数,若使用Promise方式则不必填写</p></td>
</tr>
<tr class="deep-level-1">
<td class="name" id="failure"><code>failure</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last"><p>查询失败回调函数,若使用Promise方式则不必填写</p></td>
</tr>
</tbody>
</table>
</div>
<dl class="details">
</dl>
<h5>示例</h5>
<pre class="prettyprint"><code>// 回调方式
// ES5引入方式
const { Point,LineString } = Zondy.Geometry
const { FetchMethod } = Zondy.Enum
// ES6引入方式
import { Point,LineString,FetchMethod } from "@mapgis/webclient-common"
geometryServer.calculateDistance({
geometry1: new Zondy.Geometry.Point({
coordinates: [
105.380859375, 31.57853542647338
]
}),
geometry2: new LineString({
coordinates: [[-117,34],[-116,34],[-117,33]]
}),
srs: "EPSG:4326",
method: FetchMethod.post,
success: function (result) {
console.log('请求成功:', result);
},
failure: function (result) {
console.log('请求失败:', result);
}
});
// promise方式
geometryServer.calculateDistance({
geometry1: new Point({
coordinates: [
105.380859375, 31.57853542647338
]
}),
geometry2: new LineString({
coordinates: [[-117,34],[-116,34],[-117,33]]
}),
srs: "EPSG:4326"
}).then(function (result) {
console.log('请求成功:', result);
}).catch(function (result) {
console.log('请求失败:', result);
})</code></pre>
</div>
<div class="member">
<h4 class="name" id="calculateIntersect">
<a class="href-link" href="#calculateIntersect">#</a>
<span class="code-name" id="calculateIntersect" style="font-size:30px">
calculateIntersect<span class="signature">(options)</span>
</span>
</h4>
<div class="description">
<p>求交计算</p>
</div>
<h4>参数</h4>
<div class="table-container">
<table class="params table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th class="last">描述</th>
</tr>
</thead>
<tbody>
<tr class="deep-level-0">
<td class="name" id="options"><code>options</code></td>
<td class="type">
</td>
<td class="description last"><p>查询参数</p></td>
</tr>
<tr class="deep-level-1">
<td class="name" id="geometry1"><code>geometry1</code></td>
<td class="type">
<span class="param-type"><a link="Geometry.html" onclick="getTypeHTML(event)"