private void initialize() {
try {
// WorkspaceConnectionInfo conInfo = new WorkspaceConnectionInfo("../../SampleData/OlympicGreenSCV/OlympicGreen.sxwu");
WorkspaceConnectionInfo conInfo = new WorkspaceConnectionInfo("E:\\test\\cloud_zb_1.smwu");
conInfo.setType(WorkspaceType.SMWU);
m_workspace.open(conInfo);
m_sceneControl.getScene().setWorkspace(m_workspace);
// m_sceneControl.getScene().open("OlympicGreen");
m_sceneControl.getScene().open("cloud_zb");
m_sceneControl.getScene().setCrossVisible(false);
// Layer3D olympicGreenLayer = m_sceneControl.getScene().getLayers().get("Ground@OlympicGreen");
Layer3D olympicGreenLayer = m_sceneControl.getScene().getLayers().get("cloud_zb");
m_sceneControl.getScene().ensureVisible(olympicGreenLayer.getBounds(), 1000);
for(int i= 0;i<m_sceneControl.getScene().getLayers().getCount();i++)
{
Layer3D layer = m_sceneControl.getScene().getLayers().get(i);
layer.setSelectable(false);
}
//============构造圆柱体start============
// 构造 GeoCylinder 对象
GeoCylinder geoBox = new GeoCylinder();
// 设置圆柱体的上下底面的半径
geoBox.setBottomRadius(5);
geoBox.setTopRadius(5);
// 设置圆柱体的高度
geoBox.setHeight(50);
// 设置圆柱体所在的位置
geoBox.setPosition(new Point3D(4.831761,36.217446,0));
//设置圆柱的颜色和透明度
GeoStyle3D style = new GeoStyle3D();
style.setFillForeColor(new Color(255, 255, 255, 100));
geoBox.setStyle3D(style);
// 返回按 GeoModel 的方式重新构建的模型对象
GeoModel geoModel = geoBox.getGeoModel(100, 100);
// 向跟踪图层上添加圆柱体
m_sceneControl.getScene().getTrackingLayer().add(geoModel, "geoBox");
// 飞行定位到该圆柱体对象
// m_sceneControl.getScene().fly(geoModel, FlyingMode.FLYINGTO);
//===========结束==================
//===========根据起始点,方位角,距离计算终止点
GlobalCoordinates startPoint = new GlobalCoordinates(36.217446, 4.831761);
GeodeticCalculator cal = new GeodeticCalculator();
GlobalCoordinates endPoint = cal.calculateEndingGlobalCoordinates(Ellipsoid.WGS84, startPoint, 0, 5);
System.out.println(endPoint);
//===========end========
//=======在终止点处画一个点
GeoPoint3D geoPoint3D = new GeoPoint3D(endPoint.getLongitude(), endPoint.getLatitude(), 5);
GeoStyle3D style2 = new GeoStyle3D();
style2.setAltitudeMode(AltitudeMode.ABSOLUTE);
style2.setMarkerColor(Color.BLUE);
style2.setMarkerSize(10);
geoPoint3D.setStyle3D(style2);
m_sceneControl.getScene().getTrackingLayer().set(0, geoPoint3D);
//========end=========
m_point3Ds = new Point3Ds();
m_point3DsAll = new Point3Ds();
m_geoLine3D = new GeoLine3D();
m_geoLine3D.setStyle3D(setLineGeoStyle3D());
m_pointName = "Point";
} catch (Exception ex) {
System.out.println(ex.getMessage());
}
}
如上,如果不画三维点,圆柱体能显示,可是加上画三维点的代码,运行以后就只能显示三维点了,圆柱看不见,这是什么原因呢。