首页 / 浏览问题 / 移动GIS / 问题详情
Ar中点击查不出属性
121EXP 2023年12月14日
sceneControl.setOnTouchListener(new View.OnTouchListener() {

            @Override
            public boolean onTouch(View view, MotionEvent motionEvent) {
                Layer3Ds layer3ds = sceneControl.getScene().getLayers();
                // 返回给定的三维图层集合中三维图层对象的总数。
                int count = layer3ds.getCount();
                if (count > 0) {
                    for (int i = 0; i < count; i++) {
                        Layer3D layer = layer3ds.get(i);
                        // 遍历count之后,得到三维图层对象
                        // 返回三维图层的选择集。
                        if (layer == null) {
                            continue;
                        }
                        final Selection3D selection = layer.getSelection();
                        if (selection == null) {
                            continue;
                        }
                        if (layer.getName() == null) {
                            continue;
                        }
                        // 获取选择集中对象的总数
                        Log.i("strstr", selection.getCount() + "");
                        if (selection.getCount() > 0) {

                            // 返回选择集中指定几何对象的系统 ID
                            // 本地数据获取
                            runOnUiThread(new Runnable() {
                                @Override
                                public void run() {
                                    queryInfoBubblePopupWindow.m_QueryInfoData.clear();
                                    FieldInfos fieldInfos = layer.getFieldInfos();
                                    vect(selection, layer, fieldInfos, queryInfoBubblePopupWindow);
                                    queryInfoBubblePopupWindow.show(sceneControl, motionEvent.getX(), motionEvent.getY(),selection);
                                }
                            });
                        }


                    }

                }
                return false;
            }
        });

使用这个方法查询属性,很多时候看着点击到了管线,但是返回的selection.getCount() 是0,很难查询到属性。只有偶尔能查到属性 。这个是怎么回事?
 

1个回答

您好,建议那边在桌面打开数据查看属性,看下数据中是不是都存在数据,如果不存在需要应该在制作数据时加入属性
3,430EXP 2023年12月15日
属性都是存在的,touch事件也触发了,但是点击了 返回的selection.getCount() 是0
把这个事件arControl.setAnchorOnClickListener关闭后查询成功率会高一些。是有什么图层遮盖了吗?导致获取不到点击对象
如果对象之间间距很小,建议以对象所在位置构造一个标签并设置点击事件,点击到标签获取到对象ID,查询对象信息即可
发现了是设备兼容性有问题,换了一个设备没有这个问题。
...