Good morning Giovanni.
Here it's an code example of it:
Layer layer = (Layer) selectedLayers[i];
FeatureIterator itFeats = null;
try
{
// Create the feature iterator, you can use another methods if you
want to add a filter or/and an envelope
itFeats = layer.getFeatureCollectionWrapper().iterator();
while(itFeats.hasNext())
{
// Recover the feature
Feature element = itFeats.next();
// Set the value
element.setAttribute(attrName, newAttributeValue);
// Update the feature - Take into account that you can't update
the layer while you are iterating over it, add the feature
// to a list and then update the layer afterwards
}
}
finally
{
// Don't forget to close the feature iterator after using it
if(itFeats != null)
{
itFeats.close();
}
}
// Update the layer here with the modified features
........
You can get an example of this at:
org.saig.jump.plugin.utils.AssignValueToFieldPlugIn
Regards,
PD: Giovanni, this is the spanish mailing list. Please use the
international one that you can find at
http://lists.saig.es/mailman/listinfo/kosmo_int to communicate in
English if you don't mind.
Giovanni Virdis escribió:
Hi,
How i can get all rows in layer?
I have
//Get all selected layers
Layerable[] selectedLayers = (Layerable[])
(context.getLayerNamePanel()).selectedNodes(Layerable. * class *
).toArray( * new * Layerable[]{});
//Loop the selected layers
* for * ( * int * i = 0; i < selectedLayers. length ; i++ )
{
//Get a single layer
Layer layer = (Layer) selectedLayers[i];
//****Here I must loop all rows in layer and set a value for a
specific field*/
}
Can someone help me?
Thankes
------------------------------------------------------------------------
_______________________________________________
Kosmo mailing list
[email protected]
http://lists.saig.es/mailman/listinfo/kosmo
--
Sergio Baños Calvo
Jefe de desarrollos
Sistemas Abiertos de Información Geográfica, S.L. (SAIG S.L.)
Tlfno. móvil: 685005960
Tlfno. fijo: (+34) 954788876
E-mail: [EMAIL PROTECTED]
_______________________________________________
Kosmo mailing list
[email protected]
http://lists.saig.es/mailman/listinfo/kosmo