ThinkGeo.com    |     Documentation    |     Premium Support

API replacement for InternalFeature

Dear support,


the new version 3.1.299 raises tons of warning on lines like



 



Layer.InternalFeatures.Contains(featureKey)

What is the correct API to use?


Regards,


Patrick.




same for 
  Feature feature = Layer.InternalFeatures[featureKey]; 


and same for  
  
         Feature f = new Feature(p, columnValues); 
         Layer.InternalFeatures.Add(featureKey, f); 
  
 Thank you

Patrick, 
  
 There is another topic also dicuss with this things, you can look at it 
 gis.thinkgeo.com/Support/DiscussionForums/tabid/143/aff/21/aft/6645/afv/topic/Default.aspx 
  
 Thanks 
 James

James, 
  
 I read the other thread carefully, It contains lot of explanation on why we should use the dedicated API and I understand this. 
 But it does not anwer to these very simple question: what is the replacement api for: 
  
 1. Layer.InternalFeatures.Contains(featureKey)  
 2. Feature feature = Layer.InternalFeatures[featureKey];  
 3. Feature f = new Feature(p, columnValues);  
     Layer.InternalFeatures.Add(featureKey, f);  
  
 Thank you for your help 
  
 Patrick. 


 


Patrick,
 
Sorry that I don’t refresh this thread frequently so I don’t know you add two new replies.
 
The first three code don’t need replace even it has warnings or not. The last one that adds a feature you should use like this way:
 
            inMemoryLayer.Open();
            inMemoryLayer.EditTools.BeginTransaction();
            inMemoryLayer.EditTools.Add(feature);
            inMemoryLayer.EditTools.CommitTransaction();
            inMemoryLayer.Close();

 
Please let me know if you have more questions
 
Thanks
James

James, 
  
 For items 1 & 2 : How do I remove the warning, our policy is 0 warning … I cannot commit as long as there are remaining warning. 
 For item 3 : How do I provide the featurekey ? 
  
 Thank you for your help 
 Patrick.

Hi Patrick,


We have the same problem here, our build/run/deploy system does not allow us to have any warnings at compile time, so this incorrect use of the obsolete warning is a real pain.


You can turn this wanring off in VS by using the Suppress Warnings field on the Build page in the Project options.  This does turn it off globally and hides the real obsolete warnings which we are seriously interested in.


John


 



Guys, 
  
   I am going to have to agree with you on this, you make some good arguments.  We are going to remove all of the warnings that are not 100% real obsolete APIs.  
  
 The better thing would be to really obsolete the InternalFeatures method as it is now what we want people to do in the future and move people to using the edit tools.  This would be much cleaner and would allow us to build the index for the user.  We could also add a method to easily delete all the records from the layer which is what one person commented on is hard to do with the current EditTools.  Of course you could all continue to use it but it would be a warning but a valid one as it would really be obsolete.  Would anyone argue that this is not a fair use of obsolete and not a good idea?  I am not saying we would do it but I am looking for your opinions. 
  
 Patrick:  The FeatureKey is on the Feature itself as the Feature.Id I believe. 
  
 David