ThinkGeo.com    |     Documentation    |     Premium Support

GetFeatures Core Overrides

I have an InMemoryFeatureLayer that I am overriding and using an InMemoryFeatureSource that I am overriding.


In my FeatureSource I override GetFeaturesForDrawingCore AND GetFeaturesInsideBoundingBoxCore


In my InMemoryLayer the DrawCore calls GetFeaturesForDrawing on my featureSource. Instead of ending up in my GetFeaturesForDrawingCore it goes into GetFeaturesInsideBoundingBoxCore, also I've noticed that the GetFeaturesForDrawing does something before or after it calls it's core function because sometimes in my core override it will return a feature but the GetFeaturesForDrawing returns none or vice versa.  It should just be returning whatever the core funtion returns.


 


Thanks



Travis, 
  
 Welcome to discussion forums, hope you enjoy the learning and sharing here. 
  
 This is a bug in GetFeaturesForDrawing method which calls GetFeaturesInsideBoundingBox method by mistake in some case. We will fix it in the next version. Sorry for the inconveniences.  
  
 Just wondering why you are overriding GetFeaturesForDrawingCore, as normally you can just override GetFeaturesInsideBoundingBoxCore, which will be called by GetFeaturesForDrawingCore internally by default. Here is a video about how to implement your own DataSource. 
 gis.thinkgeo.com/Support/DiscussionForums/tabid/143/aff/16/aft/4769/afv/topic/Default.aspx 
  
 In the concrete method we did some additional process before and after calling the Core method, take GetFeaturesForDrawing method as an example. 
  
 1. We do the parameter validation checking at entry point to make sure the parameters are not null or invalid. 
 2. If GeoCache.IsActive property is set to true and the required features can be found in cache, we will use the features from cache directly. Otherwise we will call GetFeaturesForDrawingCore to get features. 
 3. After get features from GetFeaturesForDrawingCore, we also loop through the TransactionBuffer to see whether need to add or remove some feaures based on the transaction status. 
 4. We will project all the records before return if this FeatureSource is using projection. 
  
 You can see that we did a lot before and after calling the GetFeatureForDrawingCore method, so that the user does not need to consider the cache, projection and transaction status when overriding the Core method. That made people focus on the logic what he wants. Otherwise it is very easy to make mistakes in the entire process. 
  
 Thanks, 
 ThinkGeo Support 


Thank you for your reply. 
  
 I am overriding GetFeaturesForDrawingCore to fix an issue where features were being clipped between tiles (using a point style the point is in one tile but because of it’s style it crosses into the one next to it), I was able to resolve the issue but found it frustrating when I was returning one thing but the main function was not.

Travis, 
  
 We are trying to recreate the feature being clipped issue and look into it. I will let you know if we have any result. Sorry for inconveniences for now 
  
 Thanks, 
 ThinkGeo Support 


Travis, 
  
 If you override the GetFeaturesForDrawingCore method just for avoid the feature being clipped issue, I think you can use the property DrawingMarginPercentage on layer.  That is the percentage by which we scale up the current extent when we want to find records to draw, as sometimes there are shapes right outside of the current extent; but if we were to give them a pen and brush and some thickness, they might have drawn in our visible extent.   
  
 Thanks, 
 ThinkGeo Support