-1

我正在尝试正确显示PolygonNutieq 下的内容,Bounding Box但我得到了这样的结果。 视野错界

我想要的是

该领域的视线正确界定

我的代码如下

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!!!");   
    }

}

谁能告诉我,我做错了什么?

提前致谢。

4

1 回答 1

1

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

于 2014-11-07T11:50:06.533 回答