ThinkGeo.com    |     Documentation    |     Premium Support

WpfMapControl TrackShapeLayer issue

Can you use the FeatureSource to add objects to this layer? I get a bunch of warnings when I use the InternalFeatures property to add/remove features from the layer so I decided to use the FeatureSource. Now anytime there is 1 feature or more already in the source the track shape does not show up while interactively tracking using the TrackMode.Rectangle/Circle but does show up when using TrackMode.Polygon. Is this a bug? Am I not doing something correctly? Should I just go back to using the InternalFeatures and ignore the errors?


I am doing these steps to add:


1. BeginTransaction


2. AddFeature method


3. CommitTransaction



Doug,


Thanks for your post and questions and welcome you to ThinkGeo MapSuite Discussion forum.
 
We have removed the warnings for the InternalFeatures because it will have any effects for your resulting when showing maps.
 
When you doing the transaction, could you have a check on the transaction result to see if it is successful operation.

TransactionResult result =layer.EditTools.CommitTransaction();

 
Any more questions just feel free to let me  know.
 
Thanks.
 
Yale

I am actually calling the layer.FeatureSource.CommitTransaction() and not doing anything with the layer.EditTools. Could this be my problem? 


The commit I am using shows success every time though.



Doug, 
  
 I don’t think there would be any difference if you call the CommitTransaction on the layer or on the feature source or on the layer.  
  
 Showing no failures on the CommitTransaction should be the expected case. I am a bit comfused with the problem you are encountering, could you send me a small sample application to recreate your problem? 
   
 Any more questions just feel free to let me know. 
  
 Thanks. 
  
 Yale 


Attached is a very simple VS 2008 solution that shows what I am seeing.



Doug,


Thanks for your sample. Now I can recreate the problem you are talking at first. I have some places cannot agree with you.
 
1) In the sample attached, every time the Transaction will fail instead of success, it will indicate some problem.

 

void TrackOverlay_TrackEnded(object sender, TrackEndedTrackInteractiveOverlayEventArgs e)
{
     wpfMap1.TrackOverlay.TrackShapeLayer.Open();
     wpfMap1.TrackOverlay.TrackShapeLayer.FeatureSource.BeginTransaction();
     wpfMap1.TrackOverlay.TrackShapeLayer.FeatureSource.AddFeature(new Feature(e.TrackShape));
     TransactionResult result = wpfMap1.TrackOverlay.TrackShapeLayer.FeatureSource.CommitTransaction();
     wpfMap1.TrackOverlay.TrackShapeLayer.Close();
     System.Diagnostics.Debug.WriteLine(result.TotalFailureCount.ToString());
}


2) I am not sure why you want to add the tracked shape in the TrackEnded event? We will do this automatically. You can try to remove this event by commenting it out. Do you have any special reason?
 
3) If you really want to do this operation, try to use Update instead of Add Feature, because the feature is already added automatically.

wpfMap1.TrackOverlay.TrackShapeLayer.FeatureSource.UpdateFeature(e.TrackShape);

 
Any more questions just feel free to let me know.
 
Thanks.
 
Yale