[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: [udig-devel] adding a feature to the current map
|
Hey Vitali,
Thanks for the help. Unfortunately, I'm still not getting it. Sorry.
I get that *DataStore is the cannonical thing. Indeed, making a memory
data store is trivial. In my case, I can create it by:
MemoryDataStore myMDS = new MemoryDataStore();
myMDS.addFeature(myFeature);
However, I don't see what comes next. I need to create both an
IGeoResource and an IService? How do I tie them together to this
DataStore I have just created? I'm not figuring out how to go about
doing this from the javadocs.
thanks,
adrian
On Mon, 2006-02-27 at 19:34 +0200, Vitali Diatchkov wrote:
> So. I'm describing my sequence of steps.
>
>
> First of all, the Layer contains IGeoResource that is coming from, let's
> take ShpServiceImpl (and ShapefileDataStore behind service).
>
> I get FeatureReader from the FeatureStore of the underlying Layer. Then I
> read all features one by one, extract a geometry from each feature and
> change it as I want. The open issue is where to store changed features.
>
> In my case I just writes them into the new ShapefileDataStore that I create
> in the beginning of the process. Actually it means I just create new
> shapefile. The feature type of this new ShapefileDataStore is the same as a
> feature type of the ShapefileDataStore from source layer, but the type of
> geometry is changes (it was a linear - became polygonal).
>
> So I read feature from source layer and just create new feature copying
> necessary attributes from old feature and set new geometry (that is being
> buffered by JTS stuff). new feature goes to the new ShapefileDataStore.
> That's it. When the process is done I just create manually ShpServiceImpl or
> using IServiceFactory - so I have a IService instance with IGeoResource
> members which I can use to create new layer using any of existing approaches
> (send command, whatever).
>
> Here the new shapefile is created. If you want to use MemoryDataStore
> (whatever), don't see a problem - just create a MemoryDataStore instead of
> ShapefileDataStore.
>
>
> The sense is that not the Layer is a recipient of features, but the
> DataStore. Layer works with IGeoResource's which are from IService that is
> in its own order a wrapper over DataStore (at least in case of shapefiles).
>
> FeatureStore comes from DataStore and you can use it for
> adding/modifying/removing features.
>
> Also FeatureStore/FeatureSource is usually cached inside of Layer and
> accessible through Layer.getResource(FeatureStore.class,..);
>
> DataStore is a primary thing, not the Layer.
>
>
> Regards, Vitali.
>
>
> > -----Original Message-----
> > From: udig-devel-bounces@xxxxxxxxxxxxxxxxxxxxx [mailto:udig-devel-
> > bounces@xxxxxxxxxxxxxxxxxxxxx] On Behalf Of Adrian Custer
> > Sent: Tuesday, February 28, 2006 1:10 AM
> > To: User-friendly Desktop Internet GIS
> > Subject: RE: [udig-devel] adding a feature to the current map
> >
> > Hello,
> >
> > Yes, your type of buffer is exactly what I'm trying to do.
> >
> > While I would love, eventually, to talk about the details/robustness of
> > the design, for now I simply want to get *any* result.
> >
> > I grab a point layer, extract the features, use their geometries to
> > buffer and union (JTS operations) then build a feature. Now I need to
> > make this feature into a "layer". I gather once I have a "layer" I can
> > create an AddLayerCommand and use IMap.sendCommand(A)Sync() to add the
> > layer to the map.
> >
> > How do we go from having a Geotools Feature to having a uDig Layer?
> >
> > thanks,
> > adrian
> >
> > On Mon, 2006-02-27 at 18:59 +0200, Vitali Diatchkov wrote:
> > > Hello, Adrian!
> > > What do you mean "buffer operation" ?
> > >
> > > I implemented the functionality (for my customers) of buffering the
> > whole
> > > layer with linear type of geometry (let's say - roads, represented
> > > as features with linear type of geometry and the width as a feature
> > > attribute). In this case the attribute value is used as a width for the
> > > buffering (linear geometry goes to the polygonal geometry). Buffering
> > > operation is performed using JTS stuff that is stable and good enough.
> > >
> > > Do you mean "buffering" in this sense?
> > >
> > > Or is the architectural problem with converting features from one layer
> > > while the new features should go to another layer?
> > >
> > > Could you describe the problem with more details... Probably I will give
> > > some hints...
> > >
> > > Vitali.
> > >
> >
> >
> > _______________________________________________
> > 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