Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] Modify Attributes and geometry

Sorry hit ctrl-enter instead of just enter.

Anyway here's the link to the guide to commands:

http://udig.refractions.net/confluence/display/DEV/Commands

Jesse

On Thu, 2005-23-06 at 07:51 -0700, Jesse Eichar wrote:
> It might not solve your problem but one thing you are doing wrong is
> committing and closing the transaction.  Transactions are handled by the
> framework and only the user should commit.  You shouldn't commit for the
> user because the user might have done some other commits that he/she
> isn't sure about committing.  And I have not idea what might happen if
> the transaction is closed one the system.  Maybe something terrible like
> what you see.  
> 
> Another thing you might want to consider is creating an edit command
> that modifies the feature, that way the edit can be undone without
> rolling back the entire transaction.
> 
> I'll make up a little editing tutorial in the developers guide right
> now.
> 
> Jesse
> 
> On Thu, 2005-23-06 at 11:29 +0200, Davide Venturini wrote:
> > 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:
> > 
> > 1. Add a layer to a Map (shapefile).
> > 2. Active my plugin to change data.
> > 3. Select a point on the map.
> > 4. Search the feature close point.
> > 5. 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.
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > _______________________________________________
> > User-friendly Desktop Internet GIS (uDig)
> > http://udig.refractions.net
> > http://lists.refractions.net/mailman/listinfo/udig-devel
> 
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel



Back to the top