World Wind Java开发之九——阶段小结(转)

http://blog.csdn.net/giser_whu/article/details/42785875

将近一个月没有更新了,一是因为项目的事情,二是期末考试复习,三是玩啦。上一篇博客搭建起了三维框架,这段时间没有研究新的东西,把之前用C#写的代码移植到现在的平台下,中间也遇到了不少问题,但还好都解决掉了,大都是写基本的小问题,就没有写博记录了。看下效果:

1、三维地形构建

数据都是自己下载的,DEM在地理空间数据云上下载的,影像用BIGE MAP地图下载器下载,经过投影变换以及GlobalMapper切片处理。

2、洪涝模拟

之前在VS平台下写了一个洪涝模拟的算法(见 http://blog.csdn.net/giser_whu/article/details/41288761http://blog.csdn.net/giser_whu/article/details/41308771),但是没有可视化的平台,所以才有了后来琢磨WW的念头。目前做的效果不好,下一步准备采用粒子系统或者jogl渲染的方式实现洪涝的动态模拟,估计这个要花点时间了。

3、新安江模型参数率定

这个主要是博主的研究方向。。。水文方面的。主要采用自适应遗传模拟退火算法实现新安江模型参数的率定,不能忍受的是效率太低了,java不适合做计算啊。

4、新安江模型参数不确定性分析

采用GLUE方法对新安江模型参数进行不确定性分析,博主的研究内容,不展开了就。主要推荐JFreeChart这个开源的绘图控件非常好用!

5、下一步计划

考试基本完结,还有几个作业比较棘手啊,这几天先把作业搞定。下一步主要有几个点:
1)在WW中引入粒子系统,模拟洪涝。
2)学习jogl,打算学习博客达人,好好写一下jogl的学习笔记,这方面的博客还是比较少的。
3)加载三维模型

转载于:https://www.cnblogs.com/telwanggs/p/6774664.html

本文将介绍如何使用World Wind Java SDK解析shape文件,并在地球上绘制出来。 第一步,需要下载Shapefile插件。Shapefile插件是World Wind Java SDK的一个扩展,它提供了对shape文件的支持。下载地址为:http://builds.worldwind.arc.nasa.gov/worldwind-releases/2.1.0/worldwind-shapefile-2.1.0.zip 第二步,将下载的压缩包解压到你的工程目录下,并将其中的worldwind-shapefile.jar文件添加到你的工程中。 第三步,创建一个ShapefileLayer对象,并指定shape文件的路径。例如: ShapefileLayer layer = new ShapefileLayer(); layer.setPath("path/to/your/shapefile.shp"); 第四步,将该layer添加到WorldWindow对象中。例如: worldWindow.getModel().getLayers().add(layer); 现在,你已经成功地在地球上绘制出了shape文件中的几何图形。 完整代码示例: ``` import gov.nasa.worldwind.BasicModel; import gov.nasa.worldwind.awt.WorldWindowGLCanvas; import gov.nasa.worldwind.geom.Position; import gov.nasa.worldwind.layers.RenderableLayer; import gov.nasa.worldwind.layers.ShapefileLayer; import gov.nasa.worldwind.render.*; import gov.nasa.worldwind.util.*; import javax.swing.*; import java.awt.*; import java.io.File; import java.util.*; public class ShapefileExample extends JFrame { public ShapefileExample() { WorldWindowGLCanvas wwd = new WorldWindowGLCanvas(); wwd.setPreferredSize(new Dimension(1000, 800)); this.getContentPane().add(wwd, BorderLayout.CENTER); this.pack(); WWUtil.alignComponent(null, this, AVKey.CENTER); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setVisible(true); // Set up a basic layer containing the shapefile ShapefileLayer layer = new ShapefileLayer(); layer.setPath("path/to/your/shapefile.shp"); // Set up a renderable layer to hold our labels RenderableLayer labelLayer = new RenderableLayer(); // Create a label for each shape in the shapefile for (ShapefileRecord record : layer.getRecords()) { // Get the shape's attributes Iterable<? extends Map.Entry<? extends String, ? extends Object>> attrs = record.getAttributes(); Iterator<? extends Map.Entry<? extends String, ? extends Object>> iterator = attrs.iterator(); String name = ""; while (iterator.hasNext()) { Map.Entry<? extends String, ? extends Object> attr = iterator.next(); if ("name".equalsIgnoreCase(attr.getKey())) { name = attr.getValue().toString(); break; } } // Create a label for the shape Shapefile shape = record.getShape(); if (shape instanceof Polyline) { Polyline polyline = (Polyline) shape; Position position = polyline.getStartPosition(); Polygon polygon = new Polygon(polyline.getPositions()); labelLayer.addRenderable(new SurfacePolyline(polygon, 5)); labelLayer.addRenderable(new SurfaceText(name, position)); } else if (shape instanceof Polygon) { Polygon polygon = (Polygon) shape; Position position = polygon.getCentroid(); labelLayer.addRenderable(new SurfacePolygon(polygon)); labelLayer.addRenderable(new SurfaceText(name, position)); } } // Add the layers to the WorldWindow wwd.getModel().getLayers().add(layer); wwd.getModel().getLayers().add(labelLayer); wwd.getModel().setGlobe(new Earth()); wwd.getModel().setView(new BasicOrbitView()); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { new ShapefileExample(); } }); } } ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值