Yup, you are right, well done Jeff. Any chance you would be willing to submit your work as a patch?
-Justin Hyink, Jeffrey (LCDR) wrote: > Justin, > > That's pretty slick...with one issue.... > > I think you need to override the getGraph() method from > BasicGraphGenerator to get the graph from the decorated generator. (And > possibly override the getBuilder() as well, but I don't have use for that.) > > If you ask FeatureGraphGenerator.getGraph() you get null. You need to > ask the DecoratedGenerator.getGraph() to get the underlying graph. > > I've added the trivial mod and it works fine. > > -J > > > > > -----Original Message----- > From: Justin Deoliveira [mailto:[EMAIL PROTECTED] > Sent: Tue 8/8/2006 11:28 PM > To: Hyink, Jeffrey (LCDR) > Cc: [email protected] > Subject: Re: Linking Graph and Features and Optimized Edges > > Hi Jeff, > > Glad to hear things are going well. > > Hyink, Jeffrey (LCDR) wrote: >> Justin, >> >> Thanks to your previous advice, I've got some sample code up and cooking >> which takes my shapefile, converts to a graph, weights by length of >> underlying geometry and does Dijkstra...so I'm partway down the road to >> success. I was wondering if you had any advice on my next phase/set of >> issues: >> >> 1. For my simulation side to run, I need to have fairly immediate >> access to the underlying Features in the graph (names, other attributes) >> and I was considering what you said earlier about subclassing the >> LineStringGraphGenerator. I did this as an experiment and ended up with >> a bastardized generator that HashMaps the incoming feature by the >> underlying geometry so that I can get the feature back when I get an >> Edge out of some of the Graph class output. Seems a bit inefficient, >> and unsexy to say the least...so I'm considering sublcassing all the way >> into the Graph interface so that I can interrogate the graph directly to >> get the underlying Feature. Thoughts? > I actually just committed an alternative that doesn't involve > subclassing. Its called FeatureGraphGenerator. What it does is takes > features and passes the underlying geometry off to an underlying graph > generator ( for example a linestring graph generator ). The edge that is > created gets its model object to be set to the feature. > > I think this should do the trick for you. For every edge you will have > direct access to the line feature it was created from with a call to > edge#getObject(), casting to Feature of course. > > Check out FeatureGraphGeneratorTest for an example of usage. >> >> 2. I'm also going to be interested in implementing directed arcs in the >> next go-around, so I'm looking at the DirectedLineStringGraphGenerator >> and figuring out a way to add the bi-directional Features into it twice >> (once with the geometry reversed somehow.) Any thoughts here? > How about cloning bi-diredctional features, and on the clone reversing > its geometry. The function GeometryUtil#reverseGeometry in the > org.geotools.graph.util.geom. package should help. Then just add both > features to the generator. This should give you the desired result. >> >> 3. Lastly, I'm intrigued by the OptDirectedEdge and the "optimized" >> graph features. Is this worth pursuing? I'm not sure what the >> "optimized" classes would buy me, not to mention there doesn't seem to >> be a LineString builder of optimized items. >> > Not really, this is more of an experiment I worked on. The plan was to > build Node and Edge implementations that were memory efficient. I was > working on a project in which huge graphs had to be built so every byte > counted. :) But they turned out to be not so useful. >> Thanks again for the advice, >> > Glad I could help. Let me know if you have any more questions. > > -Justin > >> Jeff >> >> > > > -- > Justin Deoliveira > The Open Planning Project > [EMAIL PROTECTED] > > !DSPAM:1004,44dd6ae321232081064789! -- Justin Deoliveira The Open Planning Project [EMAIL PROTECTED] ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
