阅读:1843回复:3
+---》ArcEngine坐标转换的问题《---+(page to map)
<P>ArcEngine坐标转换的问题(page to map)<br>最近用java写程序需要把用在pagelayout上画的grid定位一些要素,<br>应此需要把pagelayout上的坐标转到map上,可是死活不成功,请大家帮忙想想办法~<br>先谢谢啦~</P>
<P><FONT color=#09f738>IDisplayTransformation pageTransformation = getPageLayout().getActiveView().getScreenDisplay().getDisplayTransformation();<br>IDisplayTransformation mapTransformation =getMapCtrl().getActiveView().getScreenDisplay().getDisplayTransformation();</FONT></P> <P><FONT color=#09f738> // IGeometry tempGeo=null;<br> IEnvelope tempEnv = new Envelope();<br> <br> <br> tagRECT tempRECT = new tagRECT();<br></FONT></P> <P><FONT color=#09f738> pageTransformation.transformRect(<br> tempEnv,<br> tempRECT,<br> <br> esriDisplayTransformationEnum.esriTransformToDevice+<br> esriDisplayTransformationEnum.esriTransformPosition<br> );<br> <br> mapTransformation<br> .transformRect(<br> tempEnv,<br> tempRECT,<br> esriDisplayTransformationEnum.esriTransformToMap+<br> esriDisplayTransformationEnum.esriTransformPosition<br> );<br></FONT> <br>转换失败的表现:tempEnv最后被转成map坐标上的一个 点 (应该是一个矩形啊)<br>tempRECT始终没有用(top=0,bottom=0,left=0,right=0).<br>我的java也不熟,感觉是tempRECT没有被返回,在C++中可以传地址(;tempRECT),java<br>中因为tempRECT是class应该直觉就是传引用啊?想不通,会不会像c#一样有ref和out之类的keyword?<br>请gis高手和各位java达人帮忙想想~再次感谢~!</P> [此贴子已经被作者于2005-8-5 21:39:50编辑过]
|
|
|
1楼#
发布于:2005-08-05 21:38
<P><FONT color=#000000><STRONG>上面的代码颜色太亮,各位大侠可以看下面的:</STRONG></FONT></P>
<P><STRONG>我是看VB的例子写的java代码,下面蓝色的部分会不会有什么问题呢?</STRONG></P> <P><FONT color=#000000><STRONG></STRONG></FONT> </P> <P><STRONG><FONT color=#3300ff>IDisplayTransformation pageTransformation = getPageLayout().getActiveView().getScreenDisplay().getDisplayTransformation();<BR>IDisplayTransformation mapTransformation =getMapCtrl().getActiveView().getScreenDisplay().getDisplayTransformation();</FONT></STRONG></P> <P><FONT color=#000000><STRONG> // IGeometry tempGeo=null;<BR> IEnvelope tempEnv = new Envelope();<BR> <BR> <BR> tagRECT tempRECT = new tagRECT();<BR></STRONG></FONT></P> <P><FONT color=#000000><STRONG> pageTransformation.transformRect(<BR> tempEnv,<BR> <FONT color=#b34d61><EM>tempRECT</EM></FONT>,<BR> <BR> esriDisplayTransformationEnum.esriTransformToDevice+<BR> esriDisplayTransformationEnum.esriTransformPosition<BR> );<BR> <BR> mapTransformation<BR> .transformRect(<BR> tempEnv,<BR> <FONT color=#c43c57><EM>tempRECT</EM></FONT>,<BR> esriDisplayTransformationEnum.esriTransformToMap+<BR> esriDisplayTransformationEnum.esriTransformPosition<BR> );</STRONG></FONT></P> <P><STRONG></STRONG> </P> <P><STRONG></STRONG> </P> |
|
|
2楼#
发布于:2005-08-12 22:08
<P>还没有人回答吗~看来我只有想其他办法啦~</P>
|
|
|
3楼#
发布于:2005-08-16 09:57
<P>你直接转换点坐标,再组成envelop,查询地图就可以</P>
<P>JH_ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y)</P> |
|
|