skyline移动端处理客户数据

例子演示如何将客户端数据存储在地形对象中。例子使用了 ICreator701 (CreateHoleOnTerrain), IGeometryCreator (CreateGeometryFromWKT), ITerrainHole701 (Position, set_ClientData, get_ClientData), INavigate701 (FlyTo) 的属性和方法。

private void ClientData() {
        UI.runOnRenderThread(new Runnable() {
            @Override
            public void run() {
                try {
                    // create hole on terrain
                    ITerrainHole hole = ISGWorld.getInstance().getCreator().CreateHoleOnTerrain(ISGWorld.getInstance().getCreator().getGeometryCreator().CreateGeometryFromWKT("POLYGON((6 6,11 6,11 11,6 11,6 6))"), "", "Hole on terrain");
                    hole.getPosition().setDistance(8000000);                // store client data with key "My Data" in the hole
                    hole.set_ClientData("MyData", "Big hole");                // fly to the hole
                    ISGWorld.getInstance().getNavigate().FlyTo(hole);
                    Log.e("Tag", "Created hole on terrain and saved client data(Big Hole) in it. Click ok to read client data from it");
                    // read client data with key "My Data" from the hole
                    final String data = hole.get_ClientData("MyData");

                    Log.e("Tag","data is:"+data);

                } catch (Exception e) {

                }
            }
        });
    }

tip : ITerraExplorerMessage调用set_ClientData会报错

你可能感兴趣的:(skyline移动端处理客户数据)