当前位置: 首页 > news >正文

网站建设程序开发网络营销教材电子版

网站建设程序开发,网络营销教材电子版,旅游建设投资公司网站,wordpress插件外链文章目录 1.最终效果预览2.计算两点之间的距离3.将点线画到地图上4.动态展示点线的变化5.动态画线6.动态画点 1.最终效果预览 2.计算两点之间的距离 let dis this.utilsTools.returnDisByCoorTrans(qdXYData, zdXYData, "4549")当距离小于我们在配置文件中预设置的…

文章目录

    • 1.最终效果预览
    • 2.计算两点之间的距离
    • 3.将点线画到地图上
    • 4.动态展示点线的变化
    • 5.动态画线
    • 6.动态画点

1.最终效果预览

loc222

2.计算两点之间的距离

let dis = this.utilsTools.returnDisByCoorTrans(qdXYData, zdXYData, "4549")

当距离小于我们在配置文件中预设置的值时调用我们自定义开发的导航,大于预设值则调用百度或者高德导航

在utilsTools工具类中我们封装了如下方法

returnDisByCoorTrans(curxy, tarxy, wikid) {let dis = "0";let pxy1 = this.coordinateUtil.coorConvert(curxy["latitude"], curxy["longitude"], wikid)let pxy2 = this.coordinateUtil.coorConvert(tarxy["y"], tarxy["x"], wikid)let pA = {x: pxy1.x,y: pxy1.y,}let pB = {x: pxy2.x,y: pxy2.y,}dis = this.returnDistanceByTwoPoint(pA, pB)return dis}

在坐标转换工具类coordinateUtil中我们封装了如下方法,参数以江苏通州为例

 coorConvert(lat, lon, targetWikid): any {if (targetWikid == "4549") {this.aAxis_Target = 6378137;this.bAxis_Target = 6356752.31414;this.m_dbMidLongitude = 120;return this.gaussBLtoXY(lat, lon, this.aAxis_Target, this.bAxis_Target, this.m_dbMidLongitude);}    }public gaussBLtoXY(mX: number, mY: number, Axis_Target_a: number, Axis_Target_b: number, m_dbMidLongitude: number): any {let m_aAxis = Axis_Target_a; //参考椭球长半轴let m_bAxis = Axis_Target_b; //参考椭球短半轴//double m_dbMidLongitude = transParaSeven.daihao*3;//中央子午线经度 济南117 威海123 巴州 87 通州120let m_xOffset = 500000;let m_yOffset = 0.0;try {//角度到弧度的系数let dblD2R = Math.PI / 180;//代表e的平方let e1 = (Math.pow(m_aAxis, 2) - Math.pow(m_bAxis, 2)) / Math.pow(m_aAxis, 2);//代表e'的平方let e2 = (Math.pow(m_aAxis, 2) - Math.pow(m_bAxis, 2)) / Math.pow(m_bAxis, 2);//a0let a0 = m_aAxis * (1 - e1) * (1.0 + (3.0 / 4.0) * e1 + (45.0 / 64.0) * Math.pow(e1, 2) + (175.0 / 256.0) * Math.pow(e1, 3) + (11025.0 / 16384.0) * Math.pow(e1, 4));//a2                let a2 = -0.5 * m_aAxis * (1 - e1) * (3.0 / 4 * e1 + 60.0 / 64 * Math.pow(e1, 2) + 525.0 / 512.0 * Math.pow(e1, 3) + 17640.0 / 16384.0 * Math.pow(e1, 4));//a4let a4 = 0.25 * m_aAxis * (1 - e1) * (15.0 / 64 * Math.pow(e1, 2) + 210.0 / 512.0 * Math.pow(e1, 3) + 8820.0 / 16384.0 * Math.pow(e1, 4));//a6let a6 = (-1.0 / 6.0) * m_aAxis * (1 - e1) * (35.0 / 512.0 * Math.pow(e1, 3) + 2520.0 / 16384.0 * Math.pow(e1, 4));//a8let a8 = 0.125 * m_aAxis * (1 - e1) * (315.0 / 16384.0 * Math.pow(e1, 4));纬度转换为弧度表示//Blet B = mX * dblD2R;//llet l = (mY - m_dbMidLongitude) * dblD2R;Xlet X = a0 * B + a2 * Math.sin(2.0 * B) + a4 * Math.sin(4.0 * B) + a6 * Math.sin(6.0 * B) + a8 * Math.sin(8.0 * B);//let ll = Math.pow(Math.cos(B), 2) * e2;let c = m_aAxis * m_aAxis / m_bAxis;//Nlet N = c / Math.sqrt(1 + ll);//tlet t = Math.tan(B);let p = Math.cos(B) * l;let dby = X + N * t * (1 + ((5.0 - t * t + (9.0 + 4.0 * ll) * ll) + ((61.0 + (t * t - 58.0) * t * t + (9.0 - 11.0 * t * t) * 30.0 * ll) + (1385.0 + (-31111.0 + (543 - t * t) * t * t) * t * t) * p * p / 56.0) * p * p / 30.0) * p * p / 12.0) * p * p / 2.0;let dbx;dbx = N * (1.0 + ((1.0 - t * t + ll) + ((5.0 + t * t * (t * t - 18.0 - 58.0 * ll) + 14 * ll) + (61.0 + (-479.0 + (179.0 - t * t) * t * t) * t * t) * p * p / 42.0) * p * p / 20.0) * p * p / 6.0) * p;let mTargetX = dbx + m_xOffset;let mTargetY = dby + m_yOffset;return { x: mTargetX, y: mTargetY };}catch (ex) {console.error(ex);return null;}}

3.将点线画到地图上

 this.utilsTools.navigationByPointsSelf(curXY, tarXY, 2, this.angleValue)

在utilsTools工具类中封装了画点及画线的方法如下

navigationByPointsSelf(beginPoint, endPoint, expand, angle) {this.locatedByBeginNavigationPoint(beginPoint, ['pointerArrow'], 'navigationLayer', angle)this.locatedByEndNavigationPoint(endPoint, ['runendsymbol'], 'navigationPointLayer')this.drawNavigationFirstLine(beginPoint, endPoint, "navigationLayer", 'polylineDASH')this.drawNavigationLineFirstByLocation(beginPoint, endPoint, expand)}

画当前点locatedByBeginNavigationPoint
画终点locatedByEndNavigationPoint
画当前点与终点的连线drawNavigationFirstLine
将点线的范围缩放到页面适当位置drawNavigationLineFirstByLocation

locatedByEndNavigationPoint(endPoint, endSymbol, layerName) {let pointEndObj = {x: Number(endPoint.longitude),y: Number(endPoint.latitude),spatialReference: { wkid: this.mapConfig.wkid, latestWkid: this.mapConfig.wkid }}let geoJson = JSON.stringify(pointEndObj)let attObj = ""let oneObj = { geomertyJSON: geoJson, attributes: attObj };let symbol = { "point": endSymbol };this.mapTool.AddGraphicToLayer(layerName, [oneObj], symbol);}locatedByBeginNavigationPoint(beginPoint, beginSymbols, layerName, angleValue) {let pointBeginObj = {x: Number(beginPoint.longitude),y: Number(beginPoint.latitude),spatialReference: { wkid: this.mapConfig.wkid, latestWkid: this.mapConfig.wkid }}let pgeoJson = JSON.stringify(pointBeginObj)let pattObj = {angle: angleValue}let beginObj = { geomertyJSON: pgeoJson, attributes: pattObj };let symbolpoint = { "point": beginSymbols };this.mapTool.AddGraphicToLayer(layerName, [beginObj], symbolpoint)}drawNavigationLineFirstByLocation(beginPoint, endPoint, expand) {let geoObj = {type: "polyline",paths: [[[Number(beginPoint.longitude), Number(beginPoint.latitude)],[Number(endPoint.longitude), Number(endPoint.latitude)]]],spatialReference: { wkid: this.mapConfig.wkid, latestWkid: this.mapConfig.wkid }}this.mapTool.setExtentByGeo(geoObj, expand)}drawNavigationFirstLine(beginPoint, endPoint, layerName, lineSymbol) {let geoObj = {paths: [[[Number(beginPoint.longitude), Number(beginPoint.latitude)],[Number(endPoint.longitude), Number(endPoint.latitude)]]],spatialReference: { wkid: this.mapConfig.wkid, latestWkid: this.mapConfig.wkid }}let geoJson = JSON.stringify(geoObj)let attObj = {}let oneObj = { geomertyJSON: geoJson, attributes: attObj };let symbol = { "polyline": [lineSymbol] };this.mapTool.AddGraphicToLayer(layerName, [oneObj], symbol);}

在mapTool工具类中封装了将点或者线添加到地图上的操作

4.动态展示点线的变化

 this.navigationInterval = setInterval(() => {this.setIntervalData(curXY, tarXY)}, 1500);
async setIntervalData(curXY, tarXY) {this.angleValue = await this.utilsTools.getAngleData()curXY = await this.utilsTools.getDynamicCurXY(curXY)this.topNavigationMsg = this.utilsTools.getTopNavigationBoxMgs(curXY, tarXY)this.utilsTools.getCaluShowNavigationByInterval(curXY, tarXY, this.angleValue, 2)}

在工具类utilsTools中封装了获取当前设备角度的方法getAngleData
在工具类utilsTools中封装了动态获取当前位置的方法getDynamicCurXY
在工具类utilsTools中封装了动态展示导航顶部弹框数据方法getTopNavigationBoxMgs
在工具类utilsTools中封装了动态画点及线的方法getCaluShowNavigationByInterval

动态获取当前设备旋转角度

getAngleData() {return new Promise((resolve, reject) => {let value = 0if (this.mapConfig.isTestData) {value = this.getRandomInt(0, 360)resolve(value)} else {this.deviceOrientation.getCurrentHeading().then((data: DeviceOrientationCompassHeading) => {value = data["magneticHeading"]resolve(value)},(error: any) => {reject(value)});}});}

动态获取当前坐标

async getDynamicCurXY(xyData) {if (this.mapConfig.isTestData) {xyData.longitude = xyData.longitude - 0.0008xyData.latitude = xyData.latitude - 0.0008} else {let obj = Object.assign({}, this.mapConfig.mapLocationObj)obj.isKeepCallBack = falsexyData = await this.getXYLocationDataByDeviceType(obj)}return xyData}

导航顶部信息展示

getTopNavigationBoxMgs(beginPoint, endPoint) {let topNavigationMsg = {up: true,upDistance: "",down: false,downDistance: "",left: true,leftDistance: "",right: false,rightDistance: "",difDistance: "",lineDistance: "",}let pxy1 = this.coordinateUtil.coorConvert(beginPoint.latitude, beginPoint.longitude, "4549")let pxy2 = this.coordinateUtil.coorConvert(endPoint.latitude, endPoint.longitude, "4549")let pA = {x: pxy1.x,y: pxy1.y,}let pB = {x: pxy2.x,y: pxy2.y,}let dis: any = this.returnDistanceByTwoPoint(pA, pB)let dx = (pA.x - pB.x)let dy = (pA.y - pB.y)if (dx >= 0) {topNavigationMsg.right = falsetopNavigationMsg.left = truetopNavigationMsg.leftDistance = Math.abs(dx).toFixed(2)} else {topNavigationMsg.right = truetopNavigationMsg.left = falsetopNavigationMsg.rightDistance = Math.abs(dx).toFixed(2)}if (dy > 0) {topNavigationMsg.down = truetopNavigationMsg.up = falsetopNavigationMsg.downDistance = Math.abs(dy).toFixed(2)} else {topNavigationMsg.down = falsetopNavigationMsg.up = truetopNavigationMsg.upDistance = Math.abs(dy).toFixed(2)}topNavigationMsg.lineDistance = distopNavigationMsg.difDistance = "0"return topNavigationMsg}

动态画当前点与线的变化

getCaluShowNavigationByInterval(curxy, tarxy, angle, expand) {this.drawNavigationLineDynamic(curxy, tarxy, "navigationLayer", 'polylineDASH', expand)this.locatedByBeginNavigationPoint(curxy, ['pointerArrow'], "navigationLayer", angle)}

5.动态画线

drawNavigationLineDynamic(beginPoint, endPoint, layerName, lineSymbol, expand) {let geoObj = {type: "polyline",paths: [[[Number(beginPoint.longitude), Number(beginPoint.latitude)],[Number(endPoint.longitude), Number(endPoint.latitude)]]],spatialReference: { wkid: this.mapConfig.wkid, latestWkid: this.mapConfig.wkid }}let geoJson = JSON.stringify(geoObj)let attObj = {}let oneObj = { geomertyJSON: geoJson, attributes: attObj };let symbol = { "polyline": [lineSymbol] };this.mapTool.ClearGraphicLayerById(layerName)this.mapTool.AddGraphicToLayer(layerName, [oneObj], symbol);this.mapTool.setCenterByGeo(geoObj, expand, 0.0001)

每次画线前需要将之前图层的起点与线清除ClearGraphicLayerById
画完点线后根据设定的距离判断是否进行缩放setCenterByGeo,0.0001度大约是11米,在mapTool工具类中封装了所有的地图方面的操作,方法基本都是集成的arcgis中的方法

6.动态画点

画带有角度的当前位置点

locatedByBeginNavigationPoint(beginPoint, beginSymbols, layerName, angleValue) {let pointBeginObj = {x: Number(beginPoint.longitude),y: Number(beginPoint.latitude),spatialReference: { wkid: this.mapConfig.wkid, latestWkid: this.mapConfig.wkid }}let pgeoJson = JSON.stringify(pointBeginObj)let pattObj = {angle: angleValue}let beginObj = { geomertyJSON: pgeoJson, attributes: pattObj };let symbolpoint = { "point": beginSymbols };this.mapTool.AddGraphicToLayer(layerName, [beginObj], symbolpoint)}

文章转载自:
http://replaceable.xsfg.cn
http://sylphlike.xsfg.cn
http://isometric.xsfg.cn
http://voivode.xsfg.cn
http://tiffany.xsfg.cn
http://nitid.xsfg.cn
http://extrinsic.xsfg.cn
http://neosalvarsan.xsfg.cn
http://coleopterous.xsfg.cn
http://arride.xsfg.cn
http://flexibility.xsfg.cn
http://doggone.xsfg.cn
http://convive.xsfg.cn
http://springtime.xsfg.cn
http://autotrophic.xsfg.cn
http://tenthly.xsfg.cn
http://sniperscope.xsfg.cn
http://assurable.xsfg.cn
http://precalculus.xsfg.cn
http://doubletree.xsfg.cn
http://clx.xsfg.cn
http://muzhik.xsfg.cn
http://whitefly.xsfg.cn
http://xylitol.xsfg.cn
http://gurry.xsfg.cn
http://whim.xsfg.cn
http://pup.xsfg.cn
http://iyar.xsfg.cn
http://udsl.xsfg.cn
http://beja.xsfg.cn
http://haggardness.xsfg.cn
http://leatherware.xsfg.cn
http://appetising.xsfg.cn
http://pool.xsfg.cn
http://concision.xsfg.cn
http://undersize.xsfg.cn
http://behavioristic.xsfg.cn
http://debris.xsfg.cn
http://disseminate.xsfg.cn
http://onomatology.xsfg.cn
http://velure.xsfg.cn
http://munitioner.xsfg.cn
http://mhw.xsfg.cn
http://peppertree.xsfg.cn
http://dobie.xsfg.cn
http://demijohn.xsfg.cn
http://panification.xsfg.cn
http://kidnapping.xsfg.cn
http://safecracking.xsfg.cn
http://castle.xsfg.cn
http://dramatization.xsfg.cn
http://aircraftman.xsfg.cn
http://romano.xsfg.cn
http://kibe.xsfg.cn
http://paddy.xsfg.cn
http://pergola.xsfg.cn
http://pentarchy.xsfg.cn
http://mishandled.xsfg.cn
http://hylotropic.xsfg.cn
http://sigurd.xsfg.cn
http://mutton.xsfg.cn
http://firmly.xsfg.cn
http://culinary.xsfg.cn
http://silverless.xsfg.cn
http://principe.xsfg.cn
http://entophytic.xsfg.cn
http://unendued.xsfg.cn
http://whiggism.xsfg.cn
http://octonal.xsfg.cn
http://omagh.xsfg.cn
http://sorcerer.xsfg.cn
http://fireside.xsfg.cn
http://languet.xsfg.cn
http://sacramentalism.xsfg.cn
http://complexion.xsfg.cn
http://remedy.xsfg.cn
http://hollowware.xsfg.cn
http://claretian.xsfg.cn
http://baffleboard.xsfg.cn
http://reflex.xsfg.cn
http://radioresistance.xsfg.cn
http://speckless.xsfg.cn
http://bundesrath.xsfg.cn
http://tubbish.xsfg.cn
http://swinepox.xsfg.cn
http://caucasia.xsfg.cn
http://lieutenant.xsfg.cn
http://trichotillomania.xsfg.cn
http://hantu.xsfg.cn
http://magnetogram.xsfg.cn
http://repetend.xsfg.cn
http://clinker.xsfg.cn
http://falsifier.xsfg.cn
http://orthocephaly.xsfg.cn
http://puffball.xsfg.cn
http://juvenescence.xsfg.cn
http://tolane.xsfg.cn
http://ethmoid.xsfg.cn
http://epitympanum.xsfg.cn
http://rebekah.xsfg.cn
http://www.hrbkazy.com/news/92402.html

相关文章:

  • 网站开发就业前景怎么样广告视频
  • 新浪网站怎么做推广技能培训机构
  • 网站建设框架模板广告联盟
  • 阿里巴巴网站基础建设首保服务营销策略从哪几个方面分析
  • 企划做网站网络营销的工具和方法
  • 工业和信息化部网站备案系统营销方案怎么写模板
  • 网站开发前端兼职网络营销师怎么考
  • dw手机网站怎么做1688网站
  • 化妆品网站建设策划书网络营销主要做些什么
  • 销售型企业网站百度手机助手官网下载
  • 烟台做网站哪家做的好seo网站内部优化
  • 建设银行单位社会招聘网站懂得网站推广
  • 免费做国际贸易的网站搜索引擎优化的作用是什么
  • 做网站设计的有些什么职位站长统计软件
  • wordpress 上传安装苏州百度搜索排名优化
  • 北京网站建设 优化个人能接广告联盟吗
  • 苏州网站建设凡科百度搜索指数入口
  • 大学做视频网站设计软文推广是什么意思?
  • 手机app设计软件深圳seo优化培训
  • 广西网站建设智能优化怎样优化网站
  • 婚纱摄影网站设计毕业论文百度搜索历史记录
  • 可以做四级的网站自动的网站设计制作
  • 网站建设技术标书上海搜索引擎优化seo
  • 网站建设的三网合一重庆百度总代理
  • 帮别人做网站怎么备案怎么做一个网站平台
  • 工厂拿货回家加工网站怎样优化seo
  • uc浏览器访问网站360网站推广费用
  • 做外挂网站怎么建个网站
  • 做图片为主的网站对服务器的要求广告网页
  • 日志网站系统开网店3个月来亏了10万