b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

arcgis engine_mapxtreme最新版_mapxtreme

电脑杂谈  发布时间:2017-01-24 18:04:53  来源:网络整理

一:创建地图://创建MAPJ步骤:1,创建MapJ对象。2,加载地图数据。3,设置地图尺寸[边界]。mapxtreme4,生成地图[可以在创建mapJ对象的时候把2和3步骤合在一起设置。]

生成【渲染】地图的步骤:String mapXtremeUrl=":9080/mapxtreme47/servlet/mapxtreme";<1>创建ImageRequestComposer 对象 imageRC//表示图片是256色背景是白色的GIF图ImageRequestComposer imageRC=ImageRequest.create(mapj,256,Color.WHITE,"image/gif");

<2>创建MapXtremeImageRender对象MapXtremeImageRender render=new MapXtremeImageRender(mapXtremeUrl);

<3>使用MapXtremeImageRender对象进行渲染ImageRC和输出render.render(imageRC);render.toStream(response.getOutputStream());

最后,要把render给dispose()掉[finally{if(render!=null){render.dispose();render.cleanupConnection();render=null;}}

]

1,设置图象尺寸

输出地图图象的时候需要设置地图尺寸。mapxtreme设置方法:MapJ.setDeviceBounds(),单位是像素mapj.setDeviceBounds(new DoubleRect(0,0,defW,defH));

2,设置地图距离单位com.mapinfo.unit .LinearUnit disUnit=LinearUnit.kilometer;mapj.setDistanceUnits(disUnit);

3,设置地图视野Zoom是地图的横向跨度,单位由地图的距离单位决定。设置Zoom可以放大或者缩小地图MapJ.setZoom(500);

4,设置地图中心有时候会将地图中心定位到找到的目标上或者将中心定位到鼠标所点击的图象上的某一点,这个时候需要设置地图中心。

⑴将中心定位到鼠标所点击的图象上的某一点

//创建屏幕坐标的ponit对象DoublePoint screenPoint=new DoublePoint(event.getX(),event.getY());//将屏幕对象转化为地理坐标、DoublePoint worldPoint=mapj.transformScreenToNumeric()(screenPoint);//设置地图中心mapj.setCenter(worldPoint);

⑵将地图中心定位到找到的目标上/** * 定位居中 * @param mapj MapJ * @param cellId String */ public static void locateCenter(MapJ mapj, String cellId) throws Exception{ List searchColumns = new ArrayList(); searchColumns.add("SYS_ID"); FeatureLayer flyr = (FeatureLayer)mapj.getLayers().get(Constants.LAYER_CELL); if(flyr == null) throw new Exception("系统中不存在该图层!"); Attribute att = new Attribute(cellId); FeatureSet fs = null; try{ fs = flyr.searchByAttribute(searchColumns, "SYS_ID", att, null); Feature feat = fs.getNextFeature(); if(feat != null){ //居中 DoublePoint dp = feat.getGeometry().getBounds().center(); mapj.setCenter(dp); } } catch(Exception ex){ log.error("居中定位出错", ex); } finally{ if(fs != null){ try{ fs.dispose(); } catch(Exception ex){ } } } }

5,设置地图边界地图边界不是图象的边界,而是地图坐标系的边界。所有的地图操作都在这个边界里面进行设置地图边界的方法有两中:

1,给定边界的左下角和右上角来设置边界DoubleRect bounds=new DoubleRect(-180,-90,180,90);mapj.setBounds(bounds);

2,给定地图的中心,宽度和高度来设置边界DoubleRect bounds=new DoubleRect(new DoublePoint(0,0),180,90);mapj.setBounds(bounds);


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/tongxinshuyu/article-28550-1.html

    相关阅读
      发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

      • 龟井芳子
        龟井芳子

        1和之前的都不卡听卖手机的说个别更新了会卡

      • 姬已
        姬已

        死亡和无政府主义

      • 史达祖
        史达祖

      热点图片
      拼命载入中...