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

博客介绍了服务器高亮点显示的两种方法。换图法在服务器端生成高亮点图片传给客户端,优点是简单,缺点是服务器负载大;不换图法是服务器传坐标到客户端,客户端用定时器绘制,好处是通讯量小,但对程序员水平要求高,还给出了相关代码示例。

有两种方法,一种是换图的一种是不换图的。

换图就是在服务器端生成高亮点的图片,传给客户端。这么做的优点在于简单。缺点在于服务器负载量大。

不换图法是服务器将高亮点的屏幕坐标传到客户端,在客户端采用定时器法绘制该点坐标。这么做的好处是通讯量小,但实现起来需要程序员的水平

以下代码供参考

 

// 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);

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值