24小时热门版块排行榜    

北京石油化工学院2026年研究生招生接收调剂公告
查看: 843  |  回复: 2
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖

Shine.Z

铁虫 (小有名气)

[求助] ArcGlobe二次开发,鼠标拾取点转换成地理坐标错误

第一次发帖,不知道有什么要注意的,有什么不足请大家多多指教。
    C#+ArcEngine Globe二次开发,通过鼠标拾取点转换得到地理坐标。看帮助文档和别人基本都是这么做的,直接利用WindowToGeographic函数就能从二维屏幕坐标转换到三维空间大地坐标,我的代码如下:   
    IGlobeViewUtil globeViewUtil = axGlobeControl1.GlobeCamera as IGlobeViewUtil;
    IGlobeDisplay pGlobeDisplay = axGlobeControl1.GlobeDisplay;
    double dLon = 0;
    double dLat = 0;
    double dAlt = 0;
    globeViewUtil.WindowToGeographic(pGlobeDisplay, pGlobeDisplay.ActiveViewer, e.x, e.y,
        true, out dLon, out dLat, out dAlt);//由屏幕获取经纬度和高程
    这里我有点儿疑问。鼠标在屏幕上点击可获取一个二维坐标,映射到三维场景中其实就从观察点到屏幕坐标的一条射线,转换到三维空间不可能是一个特定的点,除非给定深度值或者说能严格限定视线长度的条件。我不知道这个函数是怎么确定的,猜想可能是得到视线和三维地形的交点,也就是说拾取的这个点在地面上。
    但是我现在做这一步的时候,周围的地形高度都在100米左右,鼠标拾取的点地理坐标的高度有七百多米,使得相应的经纬度也成了错误的。如下图所示:

    e是鼠标点取的位置(跟踪了下应该没问题),转换出来的应该是P的位置,但是实际上得到了P'的位置,由于高度不对,使得经纬度也有很大的偏差。直观的感受就是视线长度不对,还没有延伸到和地面的交点上。中间只用了一个函数,一直不知道为什么会出现这个问题。是不是有什么地方需要设置?菜鸟求指导,先谢谢了。
回复此楼
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

huohe2009

铜虫 (小有名气)

【答案】应助回帖

(1) WindowToGeographic() function was introduced for a fast and rough estimate of a geographic location that can then be used, for example, for accumulating the geographic extent of the 3D view as defined by a window; or as a faster (and rougher) substitute for standard Locate() when doing picking.
(2) It appears that a safe mode from within an AfterDraw() handler, is 'useZBufferValue = true' -- because otherwise Locate() is used and will draw the whole frame again in our 'internal' transformation and scaling for precision.
(3) Regarding precision:
(a) when useZBufferValue is true, we directly read from the Z-Buffer the depth component and then use gluUnProject() to get x, y, z coordinates. The precision of Z-Buffer depth values varies with "how far you zoom in or out" and is not that precise anyway.
(b) when useZBufferValue is false, we use Locate() which uses a 'Pick-Render' pass to calculate the intersection with the mesh at the current LOD as defined by the view -- so again the precision varies with the current view parameters.
- Note that the precision of the altitude (i.e. elevation) component can be improved by additionally calling IGlobeDisplay::GetSurfaceElevation(); with bGetMaxResolution argument set to true.
(4) Currently we are not using a "mesh-ray intersection algorithm " which would work for us only when no elevation data is present -- the case that can probably be easily calculated on the client side anyway.
3楼2013-11-12 22:02:11
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 3 个回答

huohe2009

铜虫 (小有名气)

【答案】应助回帖

感谢参与,应助指数 +1
没错。在三维空间上拾取坐标本来就不准确
2楼2013-11-12 21:58:55
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 070305高分子化学与物理 304分求调剂 +7 c297914 2026-03-28 7/350 2026-03-29 01:17 by 544594351
[考研] 2026年华南师范大学欢迎化学,化工,生物,生医工等专业优秀学子加入! +3 llss0711 2026-03-28 5/250 2026-03-29 00:23 by MRMFYTL
[考研] 一志愿郑州大学,080500学硕,总分317分求调剂 +5 举个栗子oi 2026-03-24 6/300 2026-03-28 23:03 by lizhi8172
[考研] 085405 考的11408求各位老师带走 +3 Qiu学ing 2026-03-28 3/150 2026-03-28 09:19 by 乐呵呵的追梦人
[考研] 086502化学工程342求调剂 +6 阿姨复古不过 2026-03-27 6/300 2026-03-28 07:06 by wangy0907
[考研] 086000调剂 +3 7901117076 2026-03-26 3/150 2026-03-27 21:34 by Jianing_Mi
[考研] 求调剂 +4 零八# 2026-03-27 4/200 2026-03-27 18:07 by yu221
[考研] 266分求材料化工冶金矿业等专业的调剂 +4 哇呼哼呼哼 2026-03-26 4/200 2026-03-27 17:02 by zhyzzh
[考研] 305求调剂 +5 哇卢卡库 2026-03-26 5/250 2026-03-27 14:01 by laoshidan
[考研] 314求调剂 +3 溪云珂 2026-03-26 3/150 2026-03-27 11:20 by sanrepian
[考研] 一志愿陕师大生物学071000,298分,求调剂 +5 SYA! 2026-03-23 5/250 2026-03-27 09:29 by 不吃魚的貓
[考研] 359求调剂 +4 王了个楠 2026-03-25 4/200 2026-03-27 08:43 by 不吃魚的貓
[考研] 材料调剂 5+4 想要一壶桃花水 2026-03-25 10/500 2026-03-26 19:56 by 不吃魚的貓
[考研] 中国科学院深圳先进技术研究院-光纤传感课题组招生-中国科学院大学、深圳理工大学联培 +5 YangTyu1 2026-03-26 5/250 2026-03-26 18:27 by 猫咪猫咪呀
[考研] 085602 289分求调剂 +8 WWW西西弗斯 2026-03-24 8/400 2026-03-26 16:33 by 不吃魚的貓
[考研] 材料与化工328分调剂 +6 。,。,。,。i 2026-03-23 6/300 2026-03-25 22:30 by 418490947
[考研] 材料专硕 335 分求调剂 +4 拒绝冷暴力 2026-03-25 4/200 2026-03-25 18:45 by haxia
[考研] 考研一志愿苏州大学初始315(英一)求调剂 +3 sbdksD 2026-03-24 4/200 2026-03-25 18:16 by xcjcqu
[考研] 生物学学硕求调剂 +7 小羊睡着了? 2026-03-23 10/500 2026-03-25 02:24 by 清风拂扬。 m
[考研] 材料专硕找调剂 +5 哈哈哈吼吼吼哈 2026-03-23 5/250 2026-03-24 19:07 by 了了了了。。
信息提示
请填处理意见