Android使用GeoModel加载本地模型闪退

0 投票

使用产品:iMobile v1010 for android

问题:

GeoModel model = new GeoModel();
boolean fromState = model.fromFile(path, new Point3D(116.473162, 39.76853, 0));

当我使用以上代码从本地路径加载三维模型时,程序直接闪退了,而且只有一行红色日志:

A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x2c in tid 13411 (com.tdzc.qs), pid 13411 (com.tdzc.qs)

return GeoModelNative.jni_FromFile(this.getHandle(), var1);

之后,我Debug跟踪到了以上代码,发现是这行引起的闪退。

所以请问下,是我本地缺少了什么.so文件吗?

---补充问题-------------------------------------------------------------------------------

GeoModel3D model = new GeoModel3D();
model.setFilePath(path);

当我尝试使用以上代码进行修改时,还是出现了闪退,不过这次有详细的异常日志:

java.lang.UnsatisfiedLinkError: No implementation found for long com.supermap.data.GeoModel3DNative.jni_New() (tried Java_com_supermap_data_GeoModel3DNative_jni_1New and Java_com_supermap_data_GeoModel3DNative_jni_1New__)
        at com.supermap.data.GeoModel3DNative.jni_New(Native Method)
        at com.supermap.data.GeoModel3D.<init>(GeoModel3D.java:9)

另外:我已经将Demo中libs目录完整的拷贝至工程中,理论上是不会缺少什么.so文件的。

11月 27, 2020 分类:  101次浏览 | 用户: Hiboboo 才疏学浅 (15 分)
修改于 11月 27, 2020 用户:Hiboboo

1个回答

0 投票

您好,我想请问一下您的模型是什么格式的文件呢?如果需要修改模型建议重新fromFile。添加本地的sgm模型到三维场景中,您可以参考以下代码:

layer3DKML = m_sceneControl.getScene().getLayers().addLayerWith(sdcard+"/SuperMap/DYX/NodeAnimation.kml",Layer3DType.KML,true,"kml");
  GeoModel geoModel = new GeoModel();
  Point3D position = new Point3D(116.471928672833, 39.9147239405117, 5);
  //将SGM模型添加到模型对象中
  geoModel.fromFile(sdcard + "/SuperMap/data/qiche2.SGM", position);
  geoModel.setRotationZ(90.0);
  GeoPoint3D geoPoint3D = new GeoPoint3D(new Point3D(116.471928672833, 39.9147239405117, 5));
  GeoStyle3D geostyle3d = new GeoStyle3D();
//  geostyle3d.setMarkerFile(sdcard + "/SuperMap/data/test.png");
  //设置高度模式
  geostyle3d.setAltitudeMode(AltitudeMode.ABSOLUTE);
  geostyle3d.setMarkerScale(0.5);
  geoPoint3D.setStyle3D(geostyle3d);
  GeoPlacemark geoPlacemark = new GeoPlacemark("UntitledFeature3D", geoModel);
  geoPlacemark.setStyle3D(geostyle3d);
  Feature3D feature3D = new Feature3D();
  feature3D.setGeometry(geoPlacemark);
  Feature3Ds feature3Ds = layer3DKML.getFeatures();
  feature3Ds.add(feature3D);
  m_sceneControl.getScene().ensureVisible(layer3DKML);
11月 27, 2020 用户: 董懿鑫 登峰造极 (7,347 分)
...