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);
不换图法是服务器将高亮点的屏幕坐标传到客户端,在客户端采用定时器法绘制该点坐标。这么做的好处是通讯量小,但实现起来需要程序员的水平
以下代码供参考
// 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);
相关文章推荐
- ArcGIS API for Silverlight之Web Mapping开发:根据图层属性查询、定位、高亮显示并显示标注(2)
- arcgis for android 学习 - (6) 属性查询。检索图层上某个要素,并高亮显示它。
- ArcGIS API for Silverlight之Web Mapping开发:根据图层属性查询、定位、高亮显示
- arcgis for android 学习 - 属性查询。检索图层上某个要素,并高亮显示它。
- arcengine 经典代码(转) 空间查询 在一个图层上画一个polygon,根据该polygon查询出图层上与之相交的polygon并高亮显示出来
- ArcIMS根据查询结果定位并高亮显示(面图层的定位)(ADF+C#)
- 根据查询条件,搜索倒要找的feature,然后选中feature并高亮显示
- arcgis for android空间查询 点击某点,选中该点所在区域,高亮显示
- arcgis for android 学习 - (6) 属性查询。检索图层上某个要素,并高亮显示它。
- [转载] ArcIMS根据查询结果定位并高亮显示(面图层的定位)(ADF+C#)
- Android ListView item 选中高亮显示
- CListCtrl控件选中并高亮显示
- Eclipse 高亮显示选中的相同变量
- arcgis for Android 高亮显示选中要素
- 如何消掉ComboBox里面选中那项的高亮显示
- Eclipse 高亮显示选中的相同变量
- android listview选中某一行,成选中状态颜色高亮显示
- eclipse 选中变量 以指定颜色高亮显示
- 用IFEATURESELECTION选中FEATURE高亮显示样式的更改方法
- Myeclipse设置JAVA选中高亮显示