报错原因:
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;