您的位置:首页 > 移动开发 > Objective-C

WebGIS小结之七(高亮显示查询选中的图层)

2005-07-09 20:43 405 查看
有两种方法,一种是换图的一种是不换图的。换图就是在服务器端生成高亮点的图片,传给客户端。这么做的优点在于简单。缺点在于服务器负载量大。
不换图法是服务器将高亮点的屏幕坐标传到客户端,在客户端采用定时器法绘制该点坐标。这么做的好处是通讯量小,但实现起来需要程序员的水平
以下代码供参考
 
// Given a Layer object and x- and y-coordinates, this method selects the layer's feature(s) at the specified location, and creates a SelectionTheme to display the selected features in red.
// Assume layer as a Layer object
    Vector v = new Vector();
    DoublePoint dp = new DoublePoint(x, y);
    FeatureSet fs = null;
    // Select a feature at the specified location
    fs = layer.searchAtPoint(v, dp, null);
    // Create a SelectionTheme
    SelectionTheme selTheme = new SelectionTheme("PointSelection");
    // Create a Selection object, and add the selected features
    Selection sel = new Selection();
    sel.add(fs);
    // Assign the Selection object to the SelectionTheme
    selTheme.setSelection(sel);
    // Assign the display style of the SelectionTheme
    Rendition rend =RenditionImpl.getDefaultRendition();
    rend.setValue(Rendition.FILL, Color.red);
    selTheme.setRendition(rend);
    // Add the SelectionTheme to the layer's list of themes
    layer.getThemeList().add(selTheme);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐