private SectionQueryCache _create_sectionquerycache(ShapeIDPairs shapeidpairs) { // Prepare a cache object if (this.Count < 1) { return(new SectionQueryCache(0)); } var _cache = new SectionQueryCache(); // For each shape, for each section find the number of rows foreach (var shapeidpair in shapeidpairs) { // For that shape, fill in the section cache for each section that // needs to be queried var shapecache = new ShapeCache(this.Count); foreach (var sec_cols in this) { var shapecacheitem = SectionQuery._create_shapesectioncacheitem(shapeidpair, sec_cols.SectionIndex, sec_cols); shapecache.Add(shapecacheitem); } // For this shape, add the accumulated info into the cache _cache.Add(shapecache); } // Ensure that we have created a cache for eash shapes if (shapeidpairs.Count != _cache.Count) { string msg = string.Format("mismatch in number of shapes and information collected for shapes"); throw new Exceptions.InternalAssertionException(msg); } return(_cache); }
private Streams.StreamArray _build_src_stream(SectionQueryCache cache) { int dummy_shapeid = -1; int shapeindex = 0; int numcells = cache.CountCells(); var shapecache = cache[shapeindex]; var srcs = _sidsrcs_for_shape(dummy_shapeid, shapecache).Select(i => i.Src); var stream = Streams.StreamArray.FromSrc(numcells, srcs); return(stream); }
private static IEnumerable <SidSrc> _sidsrcs_for_shapes(ShapeIDPairs shapeidpairs, SectionQueryCache cache) { foreach (int shape_ord in Enumerable.Range(0, shapeidpairs.Count)) { // For each shape add the cells to query var pair = shapeidpairs[shape_ord]; var shapecache = cache[shape_ord]; var sidsrcs = _sidsrcs_for_shape(pair.ShapeID, shapecache); foreach (var sidsrc in sidsrcs) { yield return(sidsrc); } } }
private VASS.Streams.StreamArray _build_sidsrc_stream(ShapeIDPairs shapeidpairs, SectionQueryCache cache) { int numcells = cache.CountCells(); var sidsrcs = _sidsrcs_for_shapes(shapeidpairs, cache); var stream = VASS.Streams.StreamArray.FromSidSrc(numcells, sidsrcs); return(stream); }
private SectionQueryResults <T> _create_outputs_for_shapes <T>(ShapeIDPairs shapeidpairs, SectionQueryCache sectioncache, VASS.Internal.ArraySegmentReader <T> segreader) { var results = new SectionQueryResults <T>(); for (int pair_index = 0; pair_index < shapeidpairs.Count; pair_index++) { var pair = shapeidpairs[pair_index]; var shapecache = sectioncache[pair_index]; var output_for_shape = this._create_output_for_shape((short)pair.ShapeID, shapecache, segreader); results.Add(output_for_shape); } return(results); }