Good observations, Sandro. My thoughts are below. On Fri, Jul 24, 2020 at 8:01 AM Sandro Santilli <s...@kbt.io> wrote:
> > The methods defined for a Noder are: > > virtual void computeNodes(std::vector<SegmentString*>* segStrings) = 0; > virtual std::vector<SegmentString*>* getNodedSubstrings() const = 0; > > What isn't clear is: > > - Who owns the SegmentString passed to computeNodes ? > - Who owns the SegmentString returned by getNodedSubstrings ? > - Can the same SegmentString be present in both input and output > containers ? > - Noders are a process, not a container. As such, they should not own anything. -- The caller owns the NodedSegmentStrings passed in to the Noder. -- The caller owns the SegmentStrings returned by getNodedSubstrings - getNodedSubstrings should always return new SegmentStrings, even if they are just a copy of an input SegmentString (i.e. no nodes were found and added to the original NodedSegmentString (This will make it easier to handle the lifecycle of the inputs and outputs I think?) I'm not sure if JTS/GEOS obeys these semantics. In JTS it doesn't matter much, but GEOS should be fixed to have this contract. Furthermore: The fact that getNodedSubstrings returns NodedSegmentStrings is an mistake caused by an unfortunate shortcut in JTS a long time ago. In fact, almost all usage of getNodedSubstrings only requires a BasicSegmentString to be returned (which is a much simpler/smaller object). Paul & I have discussed fixing this in JTS and GEOS, and will likely do so during or after the delivery of OverlayNG. Also, the name of the method is then confusing, and will be changed as well (perhaps to getSubstrings or splitSubstrings or some such)
_______________________________________________ geos-devel mailing list geos-devel@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/geos-devel