Worldwind的Point PlaceMark可渲染具有通过调用setLineEnabled从地标到地形的一条线,如下截图所示:
我正在尝试做的是添加一条这样的线,它也适用于可渲染的战术符号.我的第一个想法是从PointPlacemark可渲染中借用逻辑来执行此操作,并将其添加到AbstractTacticalSymbol可渲染.我试过了,到目前为止我还没有成功.
这是我到目前为止所做的:
将此添加到OrderedSymbol类:
public Vec4 terrainPoint;
Run Code Online (Sandbox Code Playgroud)更新了computeSymbolPoints以计算terrainPoint
protected void computeSymbolPoints(DrawContext dc, OrderedSymbol osym)
{
osym.placePoint = null;
osym.screenPoint = null;
osym.terrainPoint = null;
osym.eyeDistance = 0;
Position pos = this.getPosition();
if (pos == null)
return;
if (this.altitudeMode == WorldWind.CLAMP_TO_GROUND || dc.is2DGlobe())
{
osym.placePoint = dc.computeTerrainPoint(pos.getLatitude(), pos.getLongitude(), 0);
}
else if (this.altitudeMode == WorldWind.RELATIVE_TO_GROUND)
{
osym.placePoint = dc.computeTerrainPoint(pos.getLatitude(), pos.getLongitude(), pos.getAltitude());
}
else // Default to ABSOLUTE
{
double height = pos.getElevation() …
Run Code Online (Sandbox Code Playgroud)所有,
由于我正在使用的库中的错误,我需要覆盖扩展某个类的所有对象上的dispose()方法,并使其成为NO-OP.我知道如果我直接创建类的新实例,这很容易做到:
layerManager = new LayerManagerLayer(wwd) {
@Override
public void dispose() {}
};
Run Code Online (Sandbox Code Playgroud)
问题是我获得的很多对象实例不是由我的客户端代码直接构造的,而是通过静态库方法调用创建的.
// Here I want to override the dispose method, but I cannot.
Layer l = ShapefileLoader.makeShapefileLayer(this.getClass().getResource("polylines10.shp"));
Run Code Online (Sandbox Code Playgroud)
有没有办法可以将我的dispose方法注入到静态创建的对象中,而无需修改原始源代码?
我正在尝试使用World Wind,它非常好并且很容易编辑.
但在我的情况下,应用程序需要脱机运行.
那么我们可以离线运行WorlWind吗?
我想在地球上用高程表示画一条线,如下所示:
我知道我可以使用折线来表示一条线,但是如何填充线下方的空间?
当我点击地球时,我在获取位置(lat/lon)方面遇到了问题.
SO(和其他网站)上的任何地方都建议使用getCurrentPosition方法.
不幸的是,这会返回顶部可拾取对象的位置,该位置包含单击的点,因此如果不存在可选对象,则该方法只返回null
当您使用任何示例时,您可以在进入状态栏时看到它:即使鼠标出现在地球仪中,也会偶尔出现Off Globe标签(而不是lat/lon)!
有没有其他方法可以获得该位置而不依赖于可选对象?我正在考虑通过屏幕上的位置计算和使用几何,但这将非常困难,我不知道从哪里开始......
我看到了WorldWind的Sphere -Line 交叉逻辑中看似矛盾的行为.我创建了一个Sphere和Line并且它们相交但是然后交集返回null(扫描代码用于注释://***这是它变得糟糕的地方).
public class WWTest extends ApplicationTemplate {
public static class VisualizationFrame extends ApplicationTemplate.AppFrame {
public VisualizationFrame() {
super(new Dimension(1200, 1024));
final Globe globe = getWwd().getModel().getGlobe();
//Create a sphere at 0,0 on the surface of the Earth wtih a 60 NMi radius
final Vec4 sphereCenter = globe.computePointFromLocation(LatLon.ZERO);
final Sphere sphere = new Sphere(sphereCenter, 111120);
// Draw the sphere
final RenderableLayer sphereLayer = new RenderableLayer();
sphereLayer.addRenderable(sphere);
final RenderableLayer pathLayer = new RenderableLayer();
// Create a line at 10k …
Run Code Online (Sandbox Code Playgroud) 我试图弄清楚为什么PointPlacemarkAttributes中的setPitch似乎无法正常工作.
我相信PointPlacemark.java中的这个JOGL代码是出错的地方:
Double heading = getActiveAttributes().getHeading();
Double pitch = getActiveAttributes().getPitch();
// Adjust heading to be relative to globe or screen
if (heading != null)
{
if (AVKey.RELATIVE_TO_GLOBE.equals(this.getActiveAttributes().getHeadingReference()))
heading = dc.getView().getHeading().degrees - heading;
else
heading = -heading;
}
// Apply the heading and pitch if specified.
if (heading != null || pitch != null)
{
gl.glTranslated(xscale / 2, yscale / 2, 0);
if (pitch != null)
gl.glRotated(pitch, 1, 0, 0);
if (heading != null)
gl.glRotated(heading, 0, 0, …
Run Code Online (Sandbox Code Playgroud) Nasa Worldwind SDK有一些我希望运行的例子.我尝试运行SDK中提供的示例有两种方法:
当我做选项(1.)我成功编译/运行没有错误.
当我做选项(2.)我成功编译但得到运行时错误:
Apr 13, 2011 12:18:35 PM gov.nasa.worldwind.WorldWind createComponent
SEVERE: Exception while creating World Wind component gov.nasa.worldwind.cache.BasicDataFileStore
Apr 13, 2011 12:18:35 PM gov.nasa.worldwind.WorldWind createConfigurationComponent
SEVERE: Unable to create class for configuration key gov.nasa.worldwind.cache.BasicDataFileStore
Exception in thread "main" java.lang.ExceptionInInitializerError
at gov.nasa.worldwind.awt.WorldWindowGLCanvas.<init>(Unknown Source)
at Main2.main(Main2.java:15)
Caused by: java.lang.IllegalStateException: Unable to create class for configuration key gov.nasa.worldwind.cache.BasicDataFileStore
at gov.nasa.worldwind.WorldWind.createConfigurationComponent(Unknown Source)
at gov.nasa.worldwind.WorldWind.initialize(Unknown Source)
at gov.nasa.worldwind.WorldWind.<init>(Unknown Source)
at …
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用worldwind java设置图层,我想在地图上的特定地理位置渲染图标.我有那个工作,但我希望能够缩放到所有图标的位置.有一个简单的方法吗?我不确定从哪里开始..是否有现有的放大一组点的方法?
4台独立的笔记本电脑,全部运行Ubuntu 11.04.
一个带有ATI卡,运行GLX 1.4,OpenGl 3.3,GLSL 3.3,按预期运行.
GLXINFO:
name of display: :0.0
display: :0 screen: 0
direct rendering: Yes
server glx vendor string: ATI
server glx version string: 1.4
server glx extensions:
GLX_ARB_multisample, GLX_EXT_import_context, GLX_EXT_texture_from_pixmap,
GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_OML_swap_method,
GLX_SGI_make_current_read, GLX_SGI_swap_control, GLX_SGIS_multisample,
GLX_SGIX_fbconfig, GLX_SGIX_pbuffer, GLX_SGIX_visual_select_group
client glx vendor string: ATI
client glx version string: 1.4
GLX version: 1.4
OpenGL vendor string: ATI Technologies Inc.
OpenGL renderer string: ATI Mobility Radeon HD 3400 Series
OpenGL version string: 3.3.10665 Compatibility Profile Context
OpenGL shading …
Run Code Online (Sandbox Code Playgroud)