2

I'm using IFeatureSelection.SelectFeatures() to select parcel polygons in my parcel layer.

It works fine until I create a ClassBreaksRenderer to apply a color ramp based on a field in the feature.

The selection proceeds without error but does not draw on top of the renderer.

Is there a way to ensure that the feature selection draws on top?

2 Answers 2

1

Try calling IActiveView.PartialRefresh, passing in the esriViewGeoSelection draw phase -- once before, and once after selecting the features.

1
  • I can select an area correctly and then apply the renderer and the area remains selected. In addition I have discovered that the only the UniqueRenderer completely prevents the selection. The ClassBreaksRenderer works correctly (with the PartialRefresh) for some of the selection - but not all! For example: in one case the SelectionSet said that the SelectFeatures() query returned 11 and the map only selected 8!
    – Chaz
    Nov 9, 2011 at 17:15
1

One way to do it is to is with IScreenDisplay.Invalidate, see code here.

5
  • Tried this also and it failed. Could this be a real bug? The fact that it works randomly is disturbing? Does anyone know how to track the ArcGIS bugs - is there a site where they are listed?
    – Chaz
    Nov 10, 2011 at 15:34
  • @chaz I've seen random draw bugs in situations where there's an exception after IDisplay.StartDrawing but before IDisplay.FinishDrawing is called. In this situation the screen caches get into an unstable state I wonder if somehow the renderer has an unhandled exception internally. Are you using a custom renderer anywhere? Nov 10, 2011 at 16:46
  • No custom renderer, just classbreaks and unique but I have been curious about the "NullReferenceExceptions" I see in the output window while I'm running the program - but this happens with no renderers defined. (And I have tried to track down everything that needed to be released.)
    – Chaz
    Nov 10, 2011 at 19:26
  • Have you run in debug mode after setting Debug>Exceptions> and check CLR and C++ for thrown exceptions? Nov 10, 2011 at 19:52
  • Thanks! Found out was was causing the null reference exception (Enabled is called without class instantiation?) But I still can't do a select on top of a classified layer.
    – Chaz
    Nov 10, 2011 at 21:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.