Hi, uDig developers,
congratulations for the last
release 1.0.0.
I’m developing one external plugin to edit geometry
and attributes value at the same time. The source data is Esri Shapefile. I’m
doing the follow action:
- Add a layer to a Map
(shapefile).
- Active my plugin to
change data.
- Select a point on
the map.
- Search the feature
close point.
- Show a dialog to
change attributes data.
When I confirm the changes, I’m using the method
FeatureStore.modifyFeatures as
follow:
public boolean updateHouseNumber(HouseNumberVO
houseNumber) {
FeatureType
fType = fSourcehouseNumber.getSchema();
FilterFactory
fFilter = FilterFactory.createFilterFactory();
try
{
CompareFilter
cFilter = fFilter.createCompareFilter(CompareFilter.COMPARE_EQUALS);
cFilter.addLeftValue(fFilter.createAttributeExpression(fType,
"COD_UTE"));
cFilter.addRightValue(fFilter.createLiteralExpression(houseNumber.getCodice_Utente()));
System.out.println("updateHouseNumber
-> '" + houseNumber.getCodice_Utente() + "' ** NUMERO:" +
houseNumber.getNumero() +
" SUBALT:" + houseNumber.getSubalterno() +
" ESPON:" + houseNumber.getEsponente());
AttributeType[]
myAtt = new AttributeType[3];
myAtt[0]
= fType.getAttributeType("NUMERO");
myAtt[1]
= fType.getAttributeType("SUBALT");
myAtt[2]
= fType.getAttributeType("ESPON");
Object[]
myVal = new Object[3];
myVal[0]
= houseNumber.getNumero();
myVal[1]
= houseNumber.getSubalterno();
myVal[2]
= houseNumber.getEsponente();
FeatureStore
fs;
fs
= (FeatureStore)(fSourcehouseNumber);
System.out.println("Modifico");
Transaction
myt = fs.getTransaction();
fs.modifyFeatures(myAtt, myVal, cFilter);
myt.commit();
myt.close();
System.out.println("Terminato");
}
catch
(Exception e)
{
System.out.println(e.toString());
return
false;
}
return
true;
}
the code work quite well, but when I accomplish that doesn’t
work correctly… and I must terminate UDig debug session by Windows task
manager…
Thanks,
Davide.