皮尔洛的花园  
开发小积累,生活小花絮的集合
GraphicElement element=new GraphicElement();
     WebGraphics graphics = context.getWebGraphics();
      
     WebSimplePolygonSymbol polygonSymbol= new WebSimplePolygonSymbol();
     polygonSymbol.setBoundaryColor("255,0,0");
     polygonSymbol.setBoundaryWidth(1);
     
     polygonSymbol.setAntialiasing(true);
     polygonSymbol.setColor("73,167,255");
     polygonSymbol.setWidth(7);
     polygonSymbol.setTransparency(0.80);
     polygonSymbol.setFillColor("73,167,255");
     polygonSymbol.setFillInterval(5);
     polygonSymbol.setFillTransparency(0.8);
     polygonSymbol.setFillType(WebSimplePolygonSymbol.HORIZONTAL);
     
       WebCircle wCircle = (WebCircle)webGeometry;
     AGSLocalMapResource mapResource = (AGSLocalMapResource)context.getResources().get("ags0");
     IServerContext serverContext = mapResource.getServerContext();
     IPoint iPoint=null;
    try {
     iPoint = (IPoint) serverContext.createObject(com.esri.arcgis.geometry.Point.getClsid());
     iPoint.setX(wCircle.getCenter().getX());
     iPoint.setY(wCircle.getCenter().getY());     
    } catch (AutomationException e) {
     e.printStackTrace();
    } catch (IOException e) {
     e.printStackTrace();
    }
     
     ITopologicalOperator topo = (ITopologicalOperator) iPoint;
     try {
     com.esri.arcgis.geometry.Polygon bufferedPolygon = (com.esri.arcgis.geometry.Polygon) topo.buffer(wCircle.getRadius());
     //加密
     bufferedPolygon.densify(0.1, 0.01);
     
     Geometry g = (Geometry)((IPolygon)bufferedPolygon);//为 "点" 时,无法完成转换
     WebPolygon wPolygon=(WebPolygon)AGSUtil.fromAGSGeometry(g);
     webGeometry=wPolygon;
     element.setSymbol(polygonSymbol);
     element.setGeometry(wPolygon);
     graphics.addGraphics(element);
    } catch (AutomationException e) {
     e.printStackTrace();
    } catch (IOException e) {
     e.printStackTrace();
    }
posted on 2010-01-06 13:53  皮尔洛的花园  阅读(477)  评论(1)    收藏  举报