ThinkGeo.com    |     Documentation    |     Premium Support

Issue Moving Track Shape

I'm having an issue trying to update a point with a point style bitmap. I've followed your sample code in efficiently move an image that represents a plane. I'm also rotating the image based on vehicle rotation.


The transactions is failing. The transaction results are as follows:


[0] = {[vehicleShape, The update transaction failed for an unknown reason.]}


 


System.Collections.Generic.ICollection<tvalue></tvalue>.IsReadOnly = true


System.Collections.ICollection.IsSynchronized = false


 


 


There are not other errors and the vehicleshape is successfully returned prior to trying to update.


Attached is my code.


 


string vehicleLayerName = VEHICLE_BASE_LAYER_NAME + vin;
                map.Overlays[vehicleLayerName].Lock.EnterWriteLock();
                try
                {
                    InMemoryFeatureLayer vehicleLayer = (InMemoryFeatureLayer) map.FindFeatureLayer(vehicleLayerName);
                    
                    PointShape vehicleShape = vehicleLayer.InternalFeatures[0].GetShape() as PointShape;
                    vehicleShape.X = x;
                    vehicleShape.Y = y;
                    vehicleShape.Id = "vehicleShape";
                    
                    vehicleLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.Image =
                        new GeoImage(rotateImage((float)ConvertRadiansToDegrees(heading), vehicleMapStatus._implementEngaged ? _tractorImageOn : _tractorImageOFF));

                    vehicleLayer.Open();
                    vehicleLayer.EditTools.BeginTransaction();
                    vehicleLayer.EditTools.Update(vehicleShape);
                    TransactionResult t = vehicleLayer.EditTools.CommitTransaction();
                    
                    vehicleLayer.Close();
                }
                catch(Exception ex)
                {
                    string exc = ex.Message;
                }
                finally
                {
                    map.Overlays[vehicleLayerName].Lock.ExitWriteLock();
                }

                map.Refresh();


Dan,


Thanks for your post and question!
 
I DID not see all of your codes for this problem, but I guess the reason for this problem is probably because you missed to set the key when you adding the “vehicleShape” to the inmemoryLayer.
 

vehicleLayer.InternalFeatures.Add("vehicleShape", feature);

 

If you still have problem, please send me a quick demo and let me know your version of MapSuite Desktop Edition.
 
Any more questions feel free to let me know.
 
Thanks.
 
Yale