Android Nutiteq下的立桩基础不';我不能正常工作

Android Nutiteq下的立桩基础不';我不能正常工作,android,bounding-box,boundary,nutiteq,Android,Bounding Box,Boundary,Nutiteq,我试图在一个适当的边界框中的Nutiteq下显示一个多边形,但我得到了类似的结果。 我想要的是 我的代码如下 private void setClipBounds(Intent intent, MapView mapView) { ArrayList<ArrayList<String>> limits = null; if (intent.hasExtra(Constants._LIMITS)) { limits = (ArrayLis

我试图在一个适当的
边界框中的Nutiteq下显示一个
多边形
,但我得到了类似的结果。

我想要的是

我的代码如下

private void setClipBounds(Intent intent, MapView mapView) {
    ArrayList<ArrayList<String>> limits = null;
    if (intent.hasExtra(Constants._LIMITS)) {
        limits = (ArrayList<ArrayList<String>>) intent.getSerializableExtra(Constants._LIMITS);


        ArrayList<String> downLeft = limits.get(0);
        ArrayList<String> upRight  = limits.get(1);

        double left                = Double.parseDouble((String)(downLeft.get(0)));
        double top                 = Double.parseDouble((String)(upRight.get(1))); 
        double right               = Double.parseDouble((String)(upRight.get(0))); 
        double bottom              = Double.parseDouble((String)(downLeft.get(1))); 

        MapPos downLeftPos         =  mapView.worldToScreen(left, bottom, 0);
        MapPos rightUpPos          =  mapView.worldToScreen(right, top, 0);             

        Rect rect                  = new Rect(Math.round((float)downLeftPos.x), Math.round((float)rightUpPos.y), Math.round((float)rightUpPos.x), Math.round((float)downLeftPos.y));


        Bounds bounds              = new Bounds(left, top, right, bottom);

        mapView.setBoundingBox(bounds, rect, false, false, false, 1000);
        //mapView.setBoundingBox(bounds, false);

    } else {
        Log.i("TAG", "WmsMapActivity::setClipBounds:: NO limits!!!");   
    }

}
private void setClipBounds(Intent Intent,MapView-MapView){
ArrayList限制=空;
if(意图.额外(常数限制)){
限制=(ArrayList)intent.getSerializableExtra(常量._限制);
ArrayList downLeft=限制。获取(0);
ArrayList直立=限制。获取(1);
double left=double.parseDouble((字符串)(downlight.get(0));
double-top=double.parseDouble((String)(right.get(1));
double right=double.parseDouble((String)(right.get(0));
double-bottom=double.parseDouble((String)(downlight.get(1));
MapPos downLeftPos=mapView.worldToScreen(左,下,0);
MapPos rightUpPos=mapView.worldToScreen(右,上,0);
Rect Rect=new Rect(Math.round((float)downLeftPos.x)、Math.round((float)righuppos.y)、Math.round((float)righuppos.x)、Math.round((float)downLeftPos.y));
边界边界=新边界(左、上、右、下);
setBoundingBox(边界、矩形、假、假、假、1000);
//mapView.setBoundingBox(边界,false);
}否则{
Log.i(“TAG”,“WmsMapActivity::setClipBounds::NO limits!!!”;
}
}
有人能告诉我,我做错了什么吗?


提前感谢。

您使用了错误的rect参数-在您的情况下,它可能包含您的视图尺寸(您不需要调用worldToScreen,worldToScreen会根据当前相机参数计算屏幕坐标)

您好@MarkT,我的愿望是使视线适应这个界限(我得到的参数名为
Limits
)。我认为,最好的策略是将
垂直
固定在屏幕的右上角,将
左下
固定在屏幕的左下角,并且
Nutiteq
已经有了这两种方法将地图坐标转换为屏幕坐标,将屏幕坐标转换为地图坐标。如果没有这两种方法,你会建议我怎么做?Thx.虽然我不理解您的解释,但我认为您应该简单地将代码中的两行替换为以下几行:MapPos downLeftPos=newmappos(左,下,0);MapPos righuppos=新的MapPos(右,上,0);downLeftPos和upRightPos都是屏幕位置,如果我想做的话,你的建议是,我应该怎么做?Rect继承自图形,在我的例子中指的是设备屏幕,这就是调用setBoundingBox所需要的,一个地图坐标框和一个屏幕坐标框。屏幕坐标的范围是[0,0]-[15351789]您是否尝试过我的建议,简单地用固定坐标替换rect,如(0,0)-(15361789)?这应该行得通。嗨,马克,你的建议是downLeftPos=new MapPos(左,下,0)。。。左侧和底部是Wgs84中的坐标。我尝试了你现在用(0,0)和(100100)说的话,我得到了整个地球。也许@JaakL可以更好地解释
screenToWorld(…)
的工作原理,因为我用
MapPos(…)
[11.396879,48.264547]和[11.400575,48.268546]调用
screenToWorld(…)
,我得到[x=-80971.5827182289300.71649931633,z=0[x=-80971.58252842074,y=289300.71632176096,z=0.0]作为关联的屏幕坐标。我正在Nexus 9中测试我的应用程序,因此,我应该获得[0x01535x2047]范围内的坐标因为此设备的屏幕暗度为1536*2048。当然,如果我没有操作栏或下控制栏,则有效的地图视图坐标为1536*1790。假设您使用的是EPSG3857投影,这是预期结果-您正在将屏幕坐标转换为地图坐标。在EPSG3857的情况下,这些坐标在范围内[-20037508.3420037508.34]@MarkT请看一下worldToScreen,不,我正在将地图坐标转换为屏幕坐标。