//ASSUMPTIONS:
//ThevariablemapjisoftypeMapJandhasloadedamap
//ThevariablereqisoftypeHttpServletRequest
//ThevariableresisoftypeHttpServletResponse
//ThevariabledpisoftypeDoublePoint
//Addannotationlayer-thislayerwillconsistofoneimagesymbolto"animate"
//注解表格提供帮助类
AnnotationTableDescHelperatdh=newAnnotationTableDescHelper("Animation_Layer");
//注解数据服务帮助类
AnnotationDataProviderHelperadph=newAnnotationDataProviderHelper();
//本地数据服务引用
LocalDataProviderRefldpr=newLocalDataProviderRef(adph);
//创建注解图层
Layeranimate_layer=mapj.getLayers().insert(ldpr,atdh,0,"Animation_Layer");
//定义注点
Renditionr=RenditionImpl.getDefaultRendition();
r.setvalue(Rendition.SYMBOL_MODE,Rendition.SymbolMode.IMAGE);
r.setvalue(Rendition.SYMBOL_URL,"file:///C:/images/car.gif");
//创建这个点-----
//先创建特征工厂
FeatureFactoryff=mapj.getFeatureFactory();
//包含单个属性的数组
Attribute[]aAIntAttribute={newAttribute(33)};
//创建Integer
PrimaryKeypkey=newPrimaryKey(aAIntAttribute);
Featuref=ff.createPoint(dp,r,aAIntAttribute,pkey);
PrimaryKeypk=animate_layer.addFeature(f);
//CreatetheImageRequestComposer
ImageRequestComposerimageRC=ImageRequestComposer.create(mapj,256,Color.blue,"image/gif");
/*
Createthecompositerenderer
Rendertheimage
Streamtheimagebacktotheclient
*/
CompositeRenderercompositeRenderer=newCompositeRenderer("http://localhost:8080/mapxtreme40/servlet/mapxtreme";,0);
compositeRenderer.render(imageRC);
ServletOutputStreamsos=res.getOutputStream();
compositeRenderer.toStream(sos);
//Setthisattributetofalsesothatthebottomimageisnotrenderednexttime
compositeRenderer.setRedrawBottom(false);
}catch(Exceptione){
//Takeappropriateerrorhandlingsteps
}相关部分有示例代码。mapxtreme
这段代码我有,但是不知道怎么用,能不能说明下如何使用
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/tongxinshuyu/article-28469-1.html
雷不丝