| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,12 +1,6 @@ | |||
| 1 | - import { | ||
| 2 | - Zondy | ||
| 3 | - } from '../../common/Base'; | ||
| 4 | - import { | ||
| 5 | - GeometryAnalysisBase | ||
| 6 | - } from "./GeometryAnalysisBase"; | ||
| 7 | - import { | ||
| 8 | - IgsServiceBase | ||
| 9 | - } from "../../baseserver/IServiceBase"; | ||
| 1 | + import { Zondy } from '../../common/Base'; | ||
| 2 | + import { GeometryAnalysisBase } from './GeometryAnalysisBase'; | ||
| 3 | + import { IgsServiceBase } from '../../baseserver/IServiceBase'; | ||
| 10 | 4 | ||
| 11 | 5 | /** | |
| 12 | 6 | * 对矩形范围坐标点进行投影转换 | |
@@ -18,7 +12,9 @@ import { | |||
| 18 | 12 | * @param {String} [option.gdbsvrName = "MapGISLocal"] 数据源名称 | |
| 19 | 13 | * @param {String} [option.gdbName = null] 数据库名称 | |
| 20 | 14 | * @param {Number} [option.srefID = 0] 源投影参考系ID | |
| 15 | + * @param {Number} [option.srefName = null] 源投影参考系名 | ||
| 21 | 16 | * @param {Number} [option.desfID = 0] 目的投影参考系ID | |
| 17 | + * @param {Number} [option.desfName = null] 目的投影参考系名 | ||
| 22 | 18 | * @param {String} [option.userName = null] 地理数据源/地理数据库账户名 | |
| 23 | 19 | * @param {String} [option.password = null] 地理数据源/地理数据库密码 | |
| 24 | 20 | * @example | |
@@ -30,10 +26,10 @@ import { | |||
| 30 | 26 | gdbsvrName: "MapGISLocal", | |
| 31 | 27 | //数据库名称 | |
| 32 | 28 | gdbName: "OpenLayerVecterMap", | |
| 33 | - //源投影参考系ID | ||
| 34 | - srefID: 10, | ||
| 35 | - //目的投影参考系ID | ||
| 36 | - desfID: 601, | ||
| 29 | + //源投影参考系名 | ||
| 30 | + srefName: "地理坐标系(北京)_度", | ||
| 31 | + //目的投影参考系名 | ||
| 32 | + desfName: "地理坐标系(西安)_度", | ||
| 37 | 33 | //服务器地址 | |
| 38 | 34 | ip: "develop.smaryun.com", | |
| 39 | 35 | //服务器端口 | |
@@ -57,7 +53,7 @@ class ProjectRang extends GeometryAnalysisBase { | |||
| 57 | 53 | * @description 数据源名称 | |
| 58 | 54 | * @default MapGISLocal | |
| 59 | 55 | */ | |
| 60 | - this.gdbsvrName = options.gdbsvrName !== undefined ? options.gdbsvrName : "MapGISLocal"; | ||
| 56 | + this.gdbsvrName = options.gdbsvrName !== undefined ? options.gdbsvrName : 'MapGISLocal'; | ||
| 61 | 57 | ||
| 62 | 58 | /** | |
| 63 | 59 | * @private | |
@@ -77,6 +73,15 @@ class ProjectRang extends GeometryAnalysisBase { | |||
| 77 | 73 | */ | |
| 78 | 74 | this.srefID = options.srefID !== undefined ? options.srefID : 0; | |
| 79 | 75 | ||
| 76 | + /** | ||
| 77 | + * @private | ||
| 78 | + * @member Zondy.Service.ProjectRang.prototype.srefName | ||
| 79 | + * @type {Number} | ||
| 80 | + * @description 源投影参考系名 | ||
| 81 | + * @default null | ||
| 82 | + */ | ||
| 83 | + this.srefName = options.srefName !== undefined ? options.srefName : null; | ||
| 84 | + | ||
| 80 | 85 | /** | |
| 81 | 86 | * @private | |
| 82 | 87 | * @member Zondy.Service.ProjectRang.prototype.desfID | |
@@ -86,6 +91,15 @@ class ProjectRang extends GeometryAnalysisBase { | |||
| 86 | 91 | */ | |
| 87 | 92 | this.desfID = options.desfID !== undefined ? options.desfID : 0; | |
| 88 | 93 | ||
| 94 | + /** | ||
| 95 | + * @private | ||
| 96 | + * @member Zondy.Service.ProjectRang.prototype.desfName | ||
| 97 | + * @type {Number} | ||
| 98 | + * @description 目的投影参考系名 | ||
| 99 | + * @default null | ||
| 100 | + */ | ||
| 101 | + this.desfName = options.desfName !== undefined ? options.desfName : null; | ||
| 102 | + | ||
| 89 | 103 | /** | |
| 90 | 104 | * @private | |
| 91 | 105 | * @member Zondy.Service.ProjectRang.prototype.userName | |
@@ -113,14 +127,20 @@ class ProjectRang extends GeometryAnalysisBase { | |||
| 113 | 127 | * @param {callback} onError 执行失败后的回调函数 | |
| 114 | 128 | */ | |
| 115 | 129 | execute(rectangle, onSuccess, onError) { | |
| 116 | - var rang = ""; | ||
| 130 | + var rang = ''; | ||
| 117 | 131 | if (rectangle) { | |
| 118 | - rang = rectangle.xmin + "$" + rectangle.ymin + "$" + rectangle.xmax + "$" + rectangle.ymax; | ||
| 132 | + rang = rectangle.xmin + '$' + rectangle.ymin + '$' + rectangle.xmax + '$' + rectangle.ymax; | ||
| 133 | + } | ||
| 134 | + this.partUrl = `geomservice/${this.gdbsvrName}/${this.gdbName}`; | ||
| 135 | + if (this.desfName && this.srefName) { | ||
| 136 | + this.partUrl += `?f=json&rang=${rang}`; | ||
| 137 | + this.partUrl += `&srefName=${this.srefName}&desfName=${this.desfName}`; | ||
| 138 | + } else if (this.desfID && this.srefID) { | ||
| 139 | + this.partUrl += `/${this.srefID}/${this.desfID}`; | ||
| 140 | + this.partUrl += `?f=json&rang=${rang}`; | ||
| 119 | 141 | } | |
| 120 | - if (this.userName === null || this.password === null) { | ||
| 121 | - this.partUrl = "geomservice/" + this.gdbsvrName + "/" + this.gdbName + "/" + this.srefID + "/" + this.desfID + "?f=json&rang=" + rang; | ||
| 122 | - } else { | ||
| 123 | - this.partUrl = "geomservice/" + this.gdbsvrName + "/" + this.gdbName + "/" + this.srefID + "/" + this.desfID + "?f=json&rang=" + rang + "&userName=" + this.userName + "&password=" + this.password; | ||
| 142 | + if (this.userName && this.password) { | ||
| 143 | + this.partUrl += `&userName=${this.userName}&password=${this.password}`; | ||
| 124 | 144 | } | |
| 125 | 145 | var url = this.getFullUrl(); | |
| 126 | 146 | var me = this; | |
@@ -133,9 +153,6 @@ class ProjectRang extends GeometryAnalysisBase { | |||
| 133 | 153 | }); | |
| 134 | 154 | service.processAsync(); | |
| 135 | 155 | } | |
| 136 | - | ||
| 137 | 156 | } | |
| 138 | - export { | ||
| 139 | - ProjectRang | ||
| 140 | - }; | ||
| 141 | - Zondy.Service.ProjectRang = ProjectRang; | ||
| 157 | + export { ProjectRang }; | ||
| 158 | + Zondy.Service.ProjectRang = ProjectRang; | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,97 +1,106 @@ | |||
| 1 | - <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
| 1 | + <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
| 2 | 2 | <html xmlns="http://www.w3.org/1999/xhtml"> | |
| 3 | - | ||
| 4 | - <head> | ||
| 5 | - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
| 6 | - <title></title> | ||
| 7 | - <!--当前示例页面样式表引用--> | ||
| 8 | - <link rel="stylesheet" href="./static/demo/openlayers/example/style.css" /> | ||
| 9 | - <script include="jquery" src="./static/libs/include-lib-local.js"></script> | ||
| 10 | - <script src="./static/libs/include-openlayers-local.js"></script> | ||
| 11 | - <style> | ||
| 12 | - .tableTxt | ||
| 13 | - { | ||
| 14 | - width: 40%; | ||
| 15 | - float: left; | ||
| 16 | - font-size: small; | ||
| 17 | - } | ||
| 18 | - input{ | ||
| 19 | - height: 12px; | ||
| 20 | - display: block; | ||
| 21 | - width: 50%; | ||
| 22 | - font-size: 10px; | ||
| 23 | - } | ||
| 24 | - br{ | ||
| 25 | - display:inline; | ||
| 26 | - line-height:2px; | ||
| 27 | - } | ||
| 28 | - </style> | ||
| 29 | - <script type="text/javascript"> | ||
| 30 | - | ||
| 31 | - function RectProject() | ||
| 32 | - { | ||
| 33 | - | ||
| 34 | - var srcPosStr = document.getElementById("srcPositions").value; | ||
| 35 | - var posArrStr = srcPosStr.split(','); | ||
| 36 | - | ||
| 37 | - //需要投影转换的矩形 | ||
| 38 | - var rectangle = new Zondy.Object.Rectangle(parseFloat(posArrStr[0]), parseFloat(posArrStr[1]), parseFloat(posArrStr[2]), parseFloat(posArrStr[3])); | ||
| 39 | - //对矩形范围坐标点进行投影转换 | ||
| 40 | - var ProjectRang = new Zondy.Service.ProjectRang({ | ||
| 41 | - //数据源名称,默认值为"MapGISLocal" | ||
| 42 | - gdbsvrName: document.getElementById("dataSourceName").value, | ||
| 43 | - //数据库名称 | ||
| 44 | - gdbName: document.getElementById("dataBaseName").value, | ||
| 45 | - //源投影参考系ID | ||
| 46 | - srefID: parseInt(document.getElementById("srRefID").value), | ||
| 47 | - //目的投影参考系ID | ||
| 48 | - desfID: parseInt(document.getElementById("desRefID").value), | ||
| 49 | - //服务器地址 | ||
| 50 | - ip: document.getElementById("IP").value, | ||
| 51 | - //服务器端口 | ||
| 52 | - port: document.getElementById("Port").value //访问IGServer的端口号,.net版为6163,Java版为8089 | ||
| 53 | - }); | ||
| 54 | - //调用execute方法,执行矩形投影投影转换功能服务,并返回结果信息,onSuccess为回调函数 | ||
| 55 | - ProjectRang.execute(rectangle, projSuccess); | ||
| 56 | - } | ||
| 57 | - //投影转换成功后的回调 | ||
| 58 | - function projSuccess(data) { | ||
| 59 | - //显示结果 | ||
| 60 | - if(data.DesDots.length>=2) | ||
| 61 | - { | ||
| 62 | - var resultStr = (data.DesDots)[0].x+","+(data.DesDots)[0].y+","+ (data.DesDots)[1].x+","+(data.DesDots)[1].y; | ||
| 63 | - document.getElementById("resultDiv").value = resultStr; | ||
| 3 | + <head> | ||
| 4 | + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
| 5 | + <title></title> | ||
| 6 | + <!--当前示例页面样式表引用--> | ||
| 7 | + <link rel="stylesheet" href="./static/demo/openlayers/example/style.css" /> | ||
| 8 | + <script include="jquery" src="./static/libs/include-lib-local.js"></script> | ||
| 9 | + <script src="./static/libs/include-openlayers-local.js"></script> | ||
| 10 | + <style> | ||
| 11 | + .tableTxt { | ||
| 12 | + width: 40%; | ||
| 13 | + float: left; | ||
| 14 | + font-size: small; | ||
| 15 | + } | ||
| 16 | + input { | ||
| 17 | + height: 12px; | ||
| 18 | + display: block; | ||
| 19 | + width: 50%; | ||
| 20 | + font-size: 10px; | ||
| 64 | 21 | } | |
| 65 | - } | ||
| 66 | - </script> | ||
| 67 | - </head> | ||
| 22 | + br { | ||
| 23 | + display: inline; | ||
| 24 | + line-height: 2px; | ||
| 25 | + } | ||
| 26 | + </style> | ||
| 27 | + <script type="text/javascript"> | ||
| 28 | + function RectProject() { | ||
| 29 | + var srcPosStr = document.getElementById('srcPositions').value; | ||
| 30 | + var posArrStr = srcPosStr.split(','); | ||
| 68 | 31 | ||
| 69 | - <body> | ||
| 70 | - <form action="" style="width: 60%;height: 160px; position: absolute; left: 50%; transform: translateX(-50%)"> | ||
| 71 | - <fieldset> | ||
| 72 | - <legend>投影参数信息:</legend> | ||
| 73 | - <div class="tableTxt">数据源名称:</div><input id="dataSourceName" type="text" value="MapGISLocal"><br> | ||
| 74 | - <div class="tableTxt">数据库名称: </div><input id="dataBaseName" type="text" value="OpenLayerVecterMap"><br> | ||
| 75 | - <div class="tableTxt">源投影参照系ID:</div> <input id="srRefID" type="text" value="10"><br> | ||
| 76 | - <div class="tableTxt">目的投影参照系ID:</div> <input id="desRefID" type="text" value="601"><br> | ||
| 77 | - <div class="tableTxt">服务器地址:</div> <input id="IP" type="text" value="develop.smaryun.com"><br> | ||
| 78 | - <div class="tableTxt">服务器端口: </div><input id="Port" type="text" value="6163"><br> | ||
| 79 | - </fieldset> | ||
| 80 | - </form> | ||
| 32 | + //需要投影转换的矩形 | ||
| 33 | + var rectangle = new Zondy.Object.Rectangle( | ||
| 34 | + parseFloat(posArrStr[0]), | ||
| 35 | + parseFloat(posArrStr[1]), | ||
| 36 | + parseFloat(posArrStr[2]), | ||
| 37 | + parseFloat(posArrStr[3]) | ||
| 38 | + ); | ||
| 39 | + //对矩形范围坐标点进行投影转换 | ||
| 40 | + var ProjectRang = new Zondy.Service.ProjectRang({ | ||
| 41 | + //数据源名称,默认值为"MapGISLocal" | ||
| 42 | + gdbsvrName: document.getElementById('dataSourceName').value, | ||
| 43 | + //数据库名称 | ||
| 44 | + gdbName: document.getElementById('dataBaseName').value, | ||
| 45 | + //源投影参考系名 | ||
| 46 | + srefName: document.getElementById('srefName').value, | ||
| 47 | + //目的投影参考系名 | ||
| 48 | + desfName: document.getElementById('desfName').value, | ||
| 49 | + //服务器地址 | ||
| 50 | + ip: document.getElementById('IP').value, | ||
| 51 | + //服务器端口 | ||
| 52 | + port: document.getElementById('Port').value //访问IGServer的端口号,.net版为6163,Java版为8089 | ||
| 53 | + }); | ||
| 54 | + //调用execute方法,执行矩形投影投影转换功能服务,并返回结果信息,onSuccess为回调函数 | ||
| 55 | + ProjectRang.execute(rectangle, projSuccess); | ||
| 56 | + } | ||
| 57 | + //投影转换成功后的回调 | ||
| 58 | + function projSuccess(data) { | ||
| 59 | + //显示结果 | ||
| 60 | + if (data.DesDots.length >= 2) { | ||
| 61 | + var resultStr = data.DesDots[0].x + ',' + data.DesDots[0].y + ',' + data.DesDots[1].x + ',' + data.DesDots[1].y; | ||
| 62 | + document.getElementById('resultDiv').value = resultStr; | ||
| 63 | + } | ||
| 64 | + } | ||
| 65 | + </script> | ||
| 66 | + </head> | ||
| 81 | 67 | ||
| 82 | - <form action="" style="width: 25%;height: 100px;position: absolute;top: 170px;left: 20%;float: left;"> | ||
| 83 | - <fieldset> | ||
| 84 | - <legend>源矩形坐标:</legend> | ||
| 85 | - <textarea id="srcPositions" style="width: 98%;height: 80px;">2119075.5815982167,-8944857.387927618,-1350086.1660772718,3477202.6583427647</textarea> | ||
| 86 | - </fieldset> | ||
| 87 | - </form> | ||
| 88 | - <input type="button" value="投影=>" style="height: 20px;width: 8%;float: left;position: relative;top: 200px;left: 45%;margin: 6px 6px;" onclick="RectProject()"> | ||
| 89 | - <form action="" style="width: 25%;height: 100px;position: absolute;top: 170px;left: 55%;float: left;"> | ||
| 90 | - <fieldset> | ||
| 91 | - <legend>目的矩形坐标:</legend> | ||
| 92 | - <textarea id="resultDiv" style="width: 98%;height: 80px;"></textarea> | ||
| 93 | - </fieldset> | ||
| 94 | - </form> | ||
| 95 | - </body> | ||
| 68 | + <body> | ||
| 69 | + <form action="" style="width: 60%; height: 160px; position: absolute; left: 50%; transform: translateX(-50%)"> | ||
| 70 | + <fieldset> | ||
| 71 | + <legend>投影参数信息:</legend> | ||
| 72 | + <div class="tableTxt">数据源名称:</div> | ||
| 73 | + <input id="dataSourceName" type="text" value="MapGISLocal" /><br /> | ||
| 74 | + <div class="tableTxt">数据库名称:</div> | ||
| 75 | + <input id="dataBaseName" type="text" value="OpenLayerVecterMap" /><br /> | ||
| 76 | + <div class="tableTxt">源投影参照系名:</div> | ||
| 77 | + <input id="srefName" type="text" value="地理坐标系(北京)_度" /><br /> | ||
| 78 | + <div class="tableTxt">目的投影参照系名:</div> | ||
| 79 | + <input id="desfName" type="text" value="地理坐标系(西安)_度" /><br /> | ||
| 80 | + <div class="tableTxt">服务器地址:</div> | ||
| 81 | + <input id="IP" type="text" value="develop.smaryun.com" /><br /> | ||
| 82 | + <div class="tableTxt">服务器端口:</div> | ||
| 83 | + <input id="Port" type="text" value="6163" /><br /> | ||
| 84 | + </fieldset> | ||
| 85 | + </form> | ||
| 96 | 86 | ||
| 97 | - </html> | ||
| 87 | + <form action="" style="width: 25%; height: 100px; position: absolute; top: 170px; left: 20%; float: left"> | ||
| 88 | + <fieldset> | ||
| 89 | + <legend>源矩形坐标:</legend> | ||
| 90 | + <textarea id="srcPositions" style="width: 98%; height: 80px">114.12,30.12,114.67,30.87</textarea> | ||
| 91 | + </fieldset> | ||
| 92 | + </form> | ||
| 93 | + <input | ||
| 94 | + type="button" | ||
| 95 | + value="投影=>" | ||
| 96 | + style="height: 20px; width: 8%; float: left; position: relative; top: 200px; left: 45%; margin: 6px 6px" | ||
| 97 | + onclick="RectProject()" | ||
| 98 | + /> | ||
| 99 | + <form action="" style="width: 25%; height: 100px; position: absolute; top: 170px; left: 55%; float: left"> | ||
| 100 | + <fieldset> | ||
| 101 | + <legend>目的矩形坐标:</legend> | ||
| 102 | + <textarea id="resultDiv" style="width: 98%; height: 80px"></textarea> | ||
| 103 | + </fieldset> | ||
| 104 | + </form> | ||
| 105 | + </body> | ||
| 106 | + </html> | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments