Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] Upgrade uDig 1.1.1 with GeoTools 2.5

Thanks for the answer.
It's just fine to me.
For the question C, I found out the answer by myself ^^
For those who will read this, here is my code:

		public void modifyFeatures() throws IOException {
			
                        DefaultTransaction transaction = new
DefaultTransaction("test");
			String featureTypeName = feature.getFeatureType().getTypeName();
			try {
			FeatureStore store = (FeatureStore)
dataStore.getFeatureSource(featureTypeName);
			
			store.setTransaction( transaction );
						
			FilterFactory ff = FilterFactoryFinder.createFilterFactory();
			FidFilter filter2 = ff.createFidFilter();
			filter2.addFid(feature.getID());
			
			FeatureType featureType = store.getSchema();
			AttributeType att = featureType.getAttributeType("Type");
			
				store.modifyFeatures(att, "WebCam", filter2);
				transaction.commit();
				System.out.println("Transaction done");
			} catch (Exception e) {
				transaction.rollback();
				System.out.println("Rollback done");
				
			} finally {
				transaction.close();
			}

		}
// This code works fine.... for changing a String like attribute

Thanks a lot for the answer.

2009/4/8 andrea antonello <andrea.antonello@xxxxxxxxx>:
>> I'm working with uDig 1.1.1 and I got some troubles to find
>> documentation and code exemples for earlier geotools versions so...
>>
>> My questions are :
>> A- Is there a way to udpate udig 1.1.1 (stable) with Geotools 2.5 ?
>>
>> Actually, I'm facing some difficulties with Geotools 2.2 with filters
>> as most of the documentation is based on 2.5 version especially with
>> the use of Filter class.
>>
>> To update uDig to GeoTools 2.5 I thought to :
>> - remove all the gt*.zip files from udig-sdk files from
>> udig-sdk\plugins\net.refractions.udig.libs.source_1.1.0\src\net.refractions.udig.libs_1.1.0\lib
>> - then to import Geotools library in my Eclipse project.
>
> Very quickly on A, since I am on the run: it is for sure NOT possible,
> even if I wish it was. Many things changed since 2.2, so you would
> find yourself with a million of syntax errors and not able to build.
>
> Ciao,
> Andrea
>
>
>> B- Can this process work or will I have an unstable uDig ?
>>
>> C- If I have to forget about the idea upgrading geotools, can someone
>> explain me how to adapt this 2.5 code to 2.2 compliant one :
>>
>> FilterFactory ff = CommonFactoryFinder.getFilterFactory(
>> GeoTools.getDefaultHints() );
>> Filter filter = ff.id( Collections.singleton( ff.featureId("fred")));
>>
>> in order to apply filter to :
>>    store.modifyFeatures( attributeType, new Integer(24), filter );
>>
>> I guess I have to create filter like:
>> Filterfactory ff = FilterFactoryFinder.createFilterFactory();
>> but then what about creating the Filter ?
>>
>> Once again, I would appreciate so much if someone could help me.
>> Thanks.
>> _______________________________________________
>> 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