Log4Classicning

好读书 不求甚解 每有会意 便欣然忘食

WorldWind Java with markers from shapefile
2008年2月27日


昨天用WorldWind.NET试图添加KML Marker,试了很多次都没有成功,火了,索性自己实现。不过自己实现就不用KML了,直接用GeoTools读Shapefile,把坐标读出来,做成一个UserFacingIcon,添加到IconLayer。

    protected void makeIcons(){
        final Font font = new Font("Verdana", Font.PLAIN, 9);
        FeatureIterator i = features.features();
        while(i.hasNext()){
            Feature f = i.next();
            double lon = f.getDefaultGeometry().getCoordinate().x;
            double lat = f.getDefaultGeometry().getCoordinate().y;
            LatLon lonlat = new LatLon(
                    Angle.fromDegreesLatitude(lat), Angle.fromDegreesLongitude(lon));
            Position p = new Position(lonlat, 0);
            final String iconPath = "3.png";
            UserFacingIcon icon = new UserFacingIcon(iconPath ,p);
            icon.setAlwaysOnTop(false);
            icon.setShowToolTip(true);
            icon.setToolTipText((String)f.getAttribute("PINYIN"));
            icon.setToolTipFont(font);
            iconLayer.addIcon(icon);
        }
        i.close();
    }


再贴一些图吧:

这是垂直方向夸张设置为40倍的效果,看起来有点搞笑

这是10倍的效果:


江浙地区地形平台,没有什么震撼力,太原周边的情况就不同了,如果下面的图片效果不好可以点进又拍看原始图片,很震撼。

« DailyLog PuzzleIE中的c00ce56e »
  • quote 3.vincent
  • 厉害。
    有段时间我对这个也很感兴趣,自从断网后小火苗也被灭了。
  • 2008-2-28 16:50:12 回复该留言

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

Search

站点统计

  • 文章总数:745
  • 评论总数:2630
  • 引用总数:4
  • 浏览总数:5693
  • 留言总数:42
  • 当前主题:ClassicningDailyLog Style
  • 当前样式:footoo

网站收藏

图标汇集

  • Creative Commons License
  • Widgetize!
  • visitor stats

Powered By Z-Blog 1.8 Spirit Build 80722

2004 - 2007 Classicning.com. 苏ICP备06039259号.