Identify function

May 31, 2011 at 10:27 AM
Edited May 31, 2011 at 12:26 PM

Hi Jiri!

1. have two groups with one layer each in the map (file path is for each layer the same 'C:\SHP\VENT.dbf')
2. save as map dspx file and then reopen it        >>  Identify function works OK!
3. add new group with one layer                              >> Identify function returns the Exception Text bellow.
    It finds somehow a doubled file path 'C:\SHP\SHP\VENT.dbf'     >> doubled SHP\SHP !!!!!

Working with layers in groups is very important for me. All other functions seems to be OK!  Only zoom prev/next seems to me suspiciuos despite of your last correction.

Please for help, regards Vojko

************** Exception Text **************
System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\SHP\SHP\VENT.dbf'.

   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
   at DotSpatial.Data.AttributeTable.SupplyPageOfData(Int32 lowerPageBoundary, Int32 rowsPerPage) in C:\DotSpatial_29eb17f63168\DotSpatial.Data\DotSpatial.Data\AttributeTable.cs:line 1140
   at DotSpatial.Data.PointShapefile.GetFeature(Int32 index) in C:\DotSpatial_29eb17f63168\DotSpatial.Data\DotSpatial.Data\PointShapefile.cs:line 209
   at DotSpatial.Data.FeatureSet.Select(Extent region, Extent& affectedRegion) in C:\DotSpatial_29eb17f63168\DotSpatial.Data\DotSpatial.Data\FeatureSet.cs:line 1031
   at DotSpatial.Data.FeatureSet.Select(Extent region) in C:\DotSpatial_29eb17f63168\DotSpatial.Data\DotSpatial.Data\FeatureSet.cs:line 1008
   at DotSpatial.Controls.FeatureIdentifier.Add(IFeatureLayer layer, Extent bounds) in C:\DotSpatial_29eb17f63168\DotSpatial.Controls\DotSpatial.Controls\FeatureIdentifier.cs:line 252
   at DotSpatial.Controls.MapFunctionIdentify.Identify(IEnumerable`1 layers, Extent strict, Extent tolerant) in C:\DotSpatial_29eb17f63168\DotSpatial.Controls\DotSpatial.Controls\MapFunctionIdentify.cs:line 102
   at DotSpatial.Controls.MapFunctionIdentify.Identify(IEnumerable`1 layers, Extent strict, Extent tolerant) in C:\DotSpatial_29eb17f63168\DotSpatial.Controls\DotSpatial.Controls\MapFunctionIdentify.cs:line 89
   at DotSpatial.Controls.MapFunctionIdentify.OnMouseUp(GeoMouseArgs e) in C:\DotSpatial_29eb17f63168\DotSpatial.Controls\DotSpatial.Controls\MapFunctionIdentify.cs:line 75
   at DotSpatial.Controls.MapFunction.DoMouseUp(GeoMouseArgs e) in C:\DotSpatial_29eb17f63168\DotSpatial.Controls\DotSpatial.Controls\MapFunction.cs:line 157
   at DotSpatial.Controls.Map.OnMouseUp(MouseEventArgs e) in C:\DotSpatial_29eb17f63168\DotSpatial.Controls\DotSpatial.Controls\Map.cs:line 1693
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.UserControl.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Jun 3, 2011 at 1:47 PM
Edited Jun 4, 2011 at 4:43 PM

If I save the map after step 3 above with "appManager1.SerializationManager.SaveProject(@"C:\mapgis\temp.dspx");" it seems that problem has disappeared.

I can not find the reason for the message above.  Who can help me with going on with the DemoRibbon project?

Thanks, Vojko

Jun 5, 2011 at 10:04 AM
Edited Jun 6, 2011 at 3:50 PM

Below is my code inside "map.cs" file for adding new layer into the group.

1. save and reopen dspx  map file

2. add or remove new layer 

3. try for example with identify function   >>> program throw above message!

But if I save dspx file every time soon after I add or remove layer program works OK.   I really need help on this.

Thanks, Vojko

        protected virtual void OnLayerAdded(object sender, LayerEventArgs e)
            if (LayerAdded != null) LayerAdded(sender, e);

// >>>  my code
// after adding the new layer to the map, I removed it and inserted into one existing group

            foreach (IMapGroup mgrp in MapFrame.GetAllGroups())
                    foreach (IMapLayer layer in MapFrame.GetAllLayers())

 // found new layer in the map

                        if (layer.LegendText == e.Layer.LegendText)
                            mgrp.Insert(0, layer);