将高度设置为形状的任何方式
Any way to set an altitude to a Shape
我正在研究世界风,有一个表面椭圆,但我想为这个椭圆设置一个高度。
我尝试使用方法moveTo
,或者直接在构造函数中实例化一个elevation
,但是没有用,我的形状仍然固定在星球上。
这是我创建形状的方法:
final SurfaceEllipse shape = new SurfaceEllipse();
shape.setRadii(100000, 100000);
shape.moveTo(Position.fromDegrees(50.0, 0.0, 50*20000)); // just a test
layer.addRenderable(shape);
Position does indeed take an elevation, which is simply a double
and means the same thing as altitude(至少根据 Position
的吸气剂)。
但是,SurfaceEllipse implements the SurfaceObject 接口被记录为:
Common interface for renderables that are drawn on the Globe's surface terrain, such as SurfaceShape. SurfaceObject implements the Renderable and PreRenderable interfaces, so a surface object may be aggregated within any layer or within some arbitrary rendering code.
需要注意的关键词是"drawn on the Globe's surface terrain"。您无法设置高度。它必须是该位置的地球表面的高度。所以你可以读取它,但不能设置它。
我建议使用另一个 class 来塑造你的形状。在 class 继承结构中跳来跳去,您可能会找到适合您的东西。
AbstractGeneralShape documents it's modelPosition 为:
This shape's geographic location. The altitude is relative to this shapes altitude mode.
所以AbstractGeneralShape
下的任何class都有高度模式的概念。
AbstractShape also has altitudeMode
and under it is path,最终记录高度模式的 class。
Path 将高度模式记录为:
Altitudes within the path's positions are interpreted according to the path's altitude mode. If the altitude mode is WorldWind.ABSOLUTE, the altitudes are considered as height above the ellipsoid. If the altitude mode is WorldWind.RELATIVE_TO_GROUND, the altitudes are added to the elevation of the terrain at the position. If the altitude mode is WorldWind.CLAMP_TO_GROUND the altitudes are ignored.
因此,要执行您想要的操作,您需要确保您未处于 WorldWind.CLAMP_TO_GROUND
高度模式。
考虑到这一点,请查看 Ellipsoid。
A general ellipsoid volume defined by a center position and the three ellipsoid axis radii. If A is the radius in the north-south direction, and b is the radius in the east-west direction, and c is the radius in the vertical direction (increasing altitude), then A == B == C defines a sphere, A == B > C defines a vertically flattened spheroid (disk-shaped), A == B < C defines a vertically stretched spheroid.
说它是这样构造的,这是一个冗长的方式:
使 C 足够小,它可以很好地近似于二维椭圆。
不过,其实还是三维的。我发现具有 altitudeMode
的大部分内容都是 3D,但 Path 除外。 Path 有一些有趣的地形属性。
可能是您希望椭圆在内部打开。在三个维度中,这称为环面。它们看起来像这样:
很遗憾我在世界风中找不到这个形状API。但是,您可以从头开始创建自己的形状。 http://goworldwind.org/developers-guide/how-to-build-a-custom-renderable/
我在 API 中找到的最接近的是 ExtrudedPolygon,它采用多边形并允许您添加高度。由您来定义多边形的形状。挤出形状如下所示:
而且它们总是让我想起橡皮泥:
希望对您有所帮助。
我正在研究世界风,有一个表面椭圆,但我想为这个椭圆设置一个高度。
我尝试使用方法moveTo
,或者直接在构造函数中实例化一个elevation
,但是没有用,我的形状仍然固定在星球上。
这是我创建形状的方法:
final SurfaceEllipse shape = new SurfaceEllipse();
shape.setRadii(100000, 100000);
shape.moveTo(Position.fromDegrees(50.0, 0.0, 50*20000)); // just a test
layer.addRenderable(shape);
Position does indeed take an elevation, which is simply a double
and means the same thing as altitude(至少根据 Position
的吸气剂)。
但是,SurfaceEllipse implements the SurfaceObject 接口被记录为:
Common interface for renderables that are drawn on the Globe's surface terrain, such as SurfaceShape. SurfaceObject implements the Renderable and PreRenderable interfaces, so a surface object may be aggregated within any layer or within some arbitrary rendering code.
需要注意的关键词是"drawn on the Globe's surface terrain"。您无法设置高度。它必须是该位置的地球表面的高度。所以你可以读取它,但不能设置它。
我建议使用另一个 class 来塑造你的形状。在 class 继承结构中跳来跳去,您可能会找到适合您的东西。
AbstractGeneralShape documents it's modelPosition 为:
This shape's geographic location. The altitude is relative to this shapes altitude mode.
所以AbstractGeneralShape
下的任何class都有高度模式的概念。
AbstractShape also has altitudeMode
and under it is path,最终记录高度模式的 class。
Path 将高度模式记录为:
Altitudes within the path's positions are interpreted according to the path's altitude mode. If the altitude mode is WorldWind.ABSOLUTE, the altitudes are considered as height above the ellipsoid. If the altitude mode is WorldWind.RELATIVE_TO_GROUND, the altitudes are added to the elevation of the terrain at the position. If the altitude mode is WorldWind.CLAMP_TO_GROUND the altitudes are ignored.
因此,要执行您想要的操作,您需要确保您未处于 WorldWind.CLAMP_TO_GROUND
高度模式。
考虑到这一点,请查看 Ellipsoid。
A general ellipsoid volume defined by a center position and the three ellipsoid axis radii. If A is the radius in the north-south direction, and b is the radius in the east-west direction, and c is the radius in the vertical direction (increasing altitude), then A == B == C defines a sphere, A == B > C defines a vertically flattened spheroid (disk-shaped), A == B < C defines a vertically stretched spheroid.
说它是这样构造的,这是一个冗长的方式:
使 C 足够小,它可以很好地近似于二维椭圆。
不过,其实还是三维的。我发现具有 altitudeMode
的大部分内容都是 3D,但 Path 除外。 Path 有一些有趣的地形属性。
可能是您希望椭圆在内部打开。在三个维度中,这称为环面。它们看起来像这样:
很遗憾我在世界风中找不到这个形状API。但是,您可以从头开始创建自己的形状。 http://goworldwind.org/developers-guide/how-to-build-a-custom-renderable/
我在 API 中找到的最接近的是 ExtrudedPolygon,它采用多边形并允许您添加高度。由您来定义多边形的形状。挤出形状如下所示:
而且它们总是让我想起橡皮泥:
希望对您有所帮助。