How to edit DataSource?

Feb 1, 2007 at 12:59 PM
Here is what I did.
public static SharpMap.Data.Providers.IProvider InitLabelLayer(SharpMap.Data.Providers.IProvider provider)
{
provider.Open();
int length = provider.GetFeatureCount();
for (uint i = 0; i < length; i++)
{
SharpMap.Data.FeatureDataRow row = provider.GetFeature(i);
row.BeginEdit();
if (row != null)
{
object angle = row"TEXT_ANGLE";
if (angle != null)
{
row"TEXT_ANGLE" = Convert.ToInt32(angle);
}
}
row.EndEdit();
}

return provider;
}

But changes are not applied to my datasource. It's like I'm working with a copy of it. If I add line "row.AcceptChanges();" before row.EndEdit() i receice an exception "Cannot perform this operation on a row not in the table". So how can I edit datasource then?
Feb 2, 2007 at 1:00 AM
I am trying to do something similar as well. Please let me know the proper way to modify the datasource. I am specifically trying to add a new column and populate it so I can later use it to control a custom style.

Thanks,
EE
Coordinator
Feb 2, 2007 at 11:33 AM
Hi,

The attribute data of any data provider is readonly at the moment. An with each rendering of a map, the data
are read from the data source. So i think, you can't change any attribute information.

Btw.
What do you try to implement?
Label rotation? Take a look at the RotationColumn property of the LabelLayer.

regards
Christian
Feb 2, 2007 at 1:00 PM
I have some business logic that controls the coloring of my maps that I am trying to integrate. I created my own vector style and need a color column added to the SharpMap.Data.FeatureDataRow. So I am trying to extract the datasource and apply my business rules to it so when my style is used I have what I need to color things correctly.

Thanks,
EE
Coordinator
Feb 2, 2007 at 1:20 PM
Hi,

Please look here for Styling based on feature data

regards
Christian