对象属性信息查询报错

0 投票

报错原因:

 java.lang.ClassCastException: com.supermap.realspace.Layer3DKML cannot be cast to com.supermap.realspace.Layer3DVectorFile

Feature3D feature = selection.toFeature3D();  这句话报错

                    switch (event.getAction() & MotionEvent.ACTION_MASK) {
                        case (MotionEvent.ACTION_UP): {
                            Layer3D layer3d = m_sceneControl.getScene().getLayers().get("NodeAnimation");
                            Selection3D selection = layer3d.getSelection();
                            if (selection.getCount() > 0) {
                                // 自定义气泡控件
                                QueryInfoBubblePopupWindow queryInfoBubble = new QueryInfoBubblePopupWindow(ZCTaishiActivity.this);
                                Feature3D feature = selection.toFeature3D();
                                FieldInfos FieldInfos = layer3d.getFieldInfos();
                                Logger.e("zahuishia1", FieldInfos.getCount() + "");
                                for (int j = 0; j < FieldInfos.getCount(); j++) {
                                    String name = FieldInfos.get(j).getName();
                                    Logger.e("zahuishia12", name + "");
                                    String strValue;
                                    Object value = feature.getFieldValue(name);
                                    if (value == null) {
                                        strValue = "";
                                    } else {
                                        strValue = value.toString();
                                    }
                                    queryInfoBubble.additem(name, strValue);
                                    Logger.e("zahuishia", name + strValue);
                                }
// 在气泡中展示查询内容
                                queryInfoBubble.show(m_sceneControl, event.getX(), event.getY());
                            }
                        }
                        break;

8月 21 分类:  24次浏览 | 用户: lixiaochuan 初出茅庐 (24 分)

1个回答

0 投票
您好,不支持将选择集转换为要素集。获取属性信息是使用数据集缓存,然后通过Layer3DOSGBFile.getAllFieldValueOfLastSelectedObject()如果您要做一些查询操作建议使用模型缓存图层 ,不使用KML图层
8月 21 用户: 董懿鑫 登峰造极 (5,884 分)
...