mapxtreme for java关于GPS移动目标刷新的问题
添加了一个动态图层,从数据库定时读取目标经纬度数据,将目标添加到动态图层上。请问怎样实现动态图层的刷新来显示动态的目标呢??
困扰很久的问题了, 显示目标的代码段:
try {
// ASSUMPTIONS:
// The variable mapj is of type MapJ and has loaded a map
// The variable req is of type HttpServletRequest
// The variable res is of type HttpServletResponse
// The variable dp is of type DoublePoint
// Add annotation layer - this layer will consist of one image symbol to "animate"
//注解表格提供帮助类
AnnotationTableDescHelper atdh = new AnnotationTableDescHelper("Animation_Layer");
//注解数据服务帮助类
AnnotationDataProviderHelper adph = new AnnotationDataProviderHelper();
//本地数据服务引用
LocalDataProviderRef ldpr = new LocalDataProviderRef(adph);
//创建注解图层
Layer animate_layer = mapj.getLayers().insert(ldpr, atdh,0, "Animation_Layer");
//定义注点
Rendition r = RenditionImpl.getDefaultRendition();
r.setvalue(Rendition.SYMBOL_MODE,Rendition.SymbolMode.IMAGE);
r.setvalue(Rendition.SYMBOL_URL, "file:///C:/images/car.gif");
//创建这个点-----
//先创建特征工厂
FeatureFactory ff = mapj.getFeatureFactory();
//包含单个属性的数组
Attribute[] aAIntAttribute = {new Attribute(33)};
//创建Integer
PrimaryKey pkey = new PrimaryKey(aAIntAttribute);
Feature f = ff.createPoint(dp, r, aAIntAttribute, pkey);
PrimaryKey pk = animate_layer.addFeature(f);
// Create the ImageRequestComposer
ImageRequestComposer imageRC =ImageRequestComposer.create(mapj, 256, Color.blue,"image/gif");
/*
Create the composite renderer
Render the image
Stream the image back to the client
*/
CompositeRenderer compositeRenderer = new CompositeRenderer(" http://localhost:8080/mapxtreme40/servlet/mapxtreme";, 0);
compositeRenderer.render(imageRC);
ServletOutputStream sos = res.getOutputStream();
compositeRenderer.toStream(sos);
//Set this attribute to false so that the bottom image is not rendered next time
compositeRenderer.setRedrawBottom(false);
} catch(Exception e) {
//Take appropriate error handling steps --------------------编程问答-------------------- 哥们,你找到解决方法没,怎么解决的呀 --------------------编程问答-------------------- 同问啊!!!!
补充:企业软件 , 地理信息系统