Sep 20, 2012 at 10:27 AM
Edited Sep 20, 2012 at 10:29 AM
Found another way to achieve highlighting; it was born after reading the reply of
I do a query on the layer's data table with Linq - it gives me a list of fid's, loop that list and get the Geometries with ShapeFile.GetGeometryByID(fid), and put them in a List<Geometry> - to calculate the BoundingBox to zoom to.
I create a new VectorLayer "selection", with an empty DataSource (program will
not work if you forget it) and a nice colored VectorStyle:
private VectorLayer _selectionLayer;
// add selection layer
_selectionLayer = new VectorLayer("selection");
// datasource needs to be there
List<Geometry> tempList = new List<Geometry>();
_selectionLayer.DataSource = new GeometryProvider(tempList);
VectorStyle lineStyle = new VectorStyle();
lineStyle.Line = new Pen(Color.Cyan, 2);
_selectionLayer.Style = lineStyle;
// coordinate transformations (if you need it)
_selectionLayer.CoordinateTransformation = .....;
_selectionLayer.ReverseCoordinateTransformation = .....;
Later on, when I want to highlight my selection, I zoom into the selection's BoundingBox, bind the "selection" layer's DataSource to my List<Geometry>, and do a Refresh:
List<Geometry> geometryList = new List<Geometry>();
... fill list with Geometries ...
_selectionLayer.DataSource = new GeometryProvider(geometryList);
Not tested on big layers or selections, but it doesn't use ExecuteIntersectionQuery.
Have a nice day,