ThinkGeo.com    |     Documentation    |     Premium Support

When does QueryTools get instantiated?

Hi there,


I have a workflow where the QueryTools object isn't being instantied in my InMemoryFeatureLayer.


Problematic workflow:



        
  1. Create a WpfMap

  2.     
  3. Add features to map

  4.     
  5. Display the map

  6.     
  7. Access QueryTools -> null


Good workflow



        
  1. Create a WpfMap

  2.     
  3. Display the map

  4.     
  5. Add features to map

  6.     
  7. Access QueryTools -> not null... everything's ok


Like I said, the layer where the QueryTools isn't being initialized is an InMemoryFeatureLayer.  My other layers, which derive from FeatureLayer are just fine.


So, a question is this: for an InMemoryFeatureLayer, when does QueryTools get instantied?


Also, is there something I need to do to make QueryTools become instantied?


Both workflows exist due to the architecture of our application.


Thanks,


Greg



Greg, 
  
 The QueryTools for the InmemoryFeatureLayer should be instantiated when  you call the Open API for the InmemoryFeatureLayer. 
  
 So no matter which workflow you are trying to apply, just call the Open before you want to do query on it. 
  
 Any more questions just feel free to let me know. 
  
 Thanks. 
  
 Yale 


Greg, 
  
   Yale is correct in that there is a Protected method called SetupTools that gets called in the Open method of the FeatureLayer base class.  I think what we need to do to improve things is to raise a better exception when you try to get to the QueryTools or EditTools before you have opened the Layer.  In this way you would have known you needed to open the Layer first.  I will have the guys add this exception. 
  
 David