7.注解、装饰、与标记-图像文件

World Wind Java球体增加一些内容,使它在展示数据时方式更丰富,应用更灵活。

图像文件

World Wind Java中图像文件是指图像数据文件,包括jpg、png、tif、bmp、gif等,可以按照用户指定的经纬度范围将图像文件贴到球体表面。注意,这种贴图方式不支持地形跟随。
World Wind Java使用SurfaceImageLayer图层类表现图像文件,通过SurfaceImageLayer上增加多个Image实例显示图像文件。

代码如下

import gov.nasa.worldwind.geom.Angle; 
import gov.nasa.worldwind.geom.Sector; 
import gov.nasa.worldwind.layers.SurfaceImageLayer;

public class wwjImage extends wwjBasics{

    private static final long serialVersionUID = 1L;
    protected SurfaceImageLayer surfaceImageLayer;

    public boolean AddImageData(String filePath, String layerName,double minLon,double minLat,double maxLon, double maxLat){
        boolean rtnResult = false;
        try{
            Sector sector = new Sector(Angle.fromDegrees(minLat),
                    Angle.fromDegrees(minLon),Angle.fromDegrees(maxLat),Angle.fromDegrees(maxLon));
            surfaceImageLayer = new SurfaceImageLayer();
            surfaceImageLayer.setName(layerName);
            surfaceImageLayer.addImage(filePath,sector);
            this.worldWindowGLCanvas.getModel().getLayers().add(surfaceImageLayer);

            rtnResult = true;
        }
        catch(Exception ex){
            System.out.println(ex.getMessage());
        }
        return rtnResult;
    }

    public wwjImage(){
        //增加Shape数据
         AddImageData("src/images/400x230-splash-nww.png","附加图像",25.0,50.0,80.0,124.0);
        this.layerPanel.update(this.worldWindowGLCanvas);
    }

    public static void main(String[] args) {
        String strTitle = "显示Image文件";
        wwjImage wwjRun = new wwjImage();
        wwjRun.setTitle(strTitle);
    }
}

结果如下所示:
这里写图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值