MapWindow / MapWindow5

MW5 is a desktop GIS which is extendable using the plug-in architecture. It is using the MapWinGIS mapping control and is created from scratch in 2015 using new technologies like MEF and Dependency Injection making it small in size, robust and fast.
288 stars 100 forks source link

Access Shapefile Attributes #4

Closed dhuantes closed 7 years ago

dhuantes commented 7 years ago

I'm currently porting a MapWindow4 Plugin that had code that would look for a specific field name in the shapefile. The general code flow is shown below

MapWinGIS.Shapefile l_sfi = null;
.....
l_sfi = m_mapWin.Layers[i].GetObject() as MapWingGIS.Shapefile;
....
if (l_sfi.get_Field(0).Name.CompareTo("Name I'm Looking for") == 0)
{
   //Do something
}

How is this supposed to be done with MW5? I ask because the I'm now using the IAppContext to gain access to the Layers but ILayer does not have a GetObject method and also not sure whether Shapefile is still part of MapWinGIS or not. I'm sure I'll find it but figured I'd ask now just in case I don't. My reference is the plugin example codes that include the PluginTemplate. Thanks!

dhuantes commented 7 years ago

Ok... I figured out that each Layer has a FeatureSet property this the Shapefile. I used the MW5.Plugins.TableEditor as my guide. Was able to update quite a bit of code with that knowledge and now am trying to figure out the replacement for the Shapefile.get_CellValue(int,int). So if you know that answer that would be helpful too... But I'll run it down eventually too...:-D...

dhuantes commented 7 years ago

OK.. Figured that one out too.... The FeatureSet has a Table Property and the Table object provides access to the CellValue. Getting there...