public QuadCell(QuadPrefixTree _enclosing, string token, SpatialRelation shapeRel ) : base(token) { this._enclosing = _enclosing; this.shapeRel = shapeRel; }
protected internal override ICollection <Cell> GetSubCells() { QuadPrefixTree outerInstance = (QuadPrefixTree)this.m_outerInstance; IList <Cell> cells = new List <Cell>(4); cells.Add(new QuadCell(outerInstance, TokenString + "A")); cells.Add(new QuadCell(outerInstance, TokenString + "B")); cells.Add(new QuadCell(outerInstance, TokenString + "C")); cells.Add(new QuadCell(outerInstance, TokenString + "D")); return(cells); }
protected internal override ICollection <Cell> GetSubCells() { QuadPrefixTree outerInstance = (QuadPrefixTree)this.m_outerInstance; return(new List <Cell>(4) { new QuadCell(outerInstance, TokenString + "A"), new QuadCell(outerInstance, TokenString + "B"), new QuadCell(outerInstance, TokenString + "C"), new QuadCell(outerInstance, TokenString + "D") }); }
private IRectangle MakeShape() { QuadPrefixTree outerInstance = (QuadPrefixTree)this.m_outerInstance; string token = TokenString; double xmin = outerInstance.xmin; double ymin = outerInstance.ymin; for (int i = 0; i < token.Length; i++) { char c = token[i]; if ('A' == c || 'a' == c) { ymin += outerInstance.levelH[i]; } else if ('B' == c || 'b' == c) { xmin += outerInstance.levelW[i]; ymin += outerInstance.levelH[i]; } else if ('C' == c || 'c' == c) { // nothing really } else if ('D' == c || 'd' == c) { xmin += outerInstance.levelW[i]; } else { throw new Exception("unexpected char: " + c); } } int len = token.Length; double width; double height; if (len > 0) { width = outerInstance.levelW[len - 1]; height = outerInstance.levelH[len - 1]; } else { width = outerInstance.gridW; height = outerInstance.gridH; } return(outerInstance.m_ctx.MakeRectangle(xmin, xmin + width, ymin, ymin + height)); }
public IEnumerable<Param> ParamsProvider() { var ctorArgs = new List<Param>(); SpatialContext ctx = SpatialContext.GEO; SpatialPrefixTree grid = new GeohashPrefixTree(ctx, 12); SpatialStrategy strategy = new RecursivePrefixTreeStrategy(grid, "recursive_geohash"); ctorArgs.Add(new Param(strategy)); grid = new QuadPrefixTree(ctx, 25); strategy = new RecursivePrefixTreeStrategy(grid, "recursive_quad"); ctorArgs.Add(new Param(strategy)); grid = new GeohashPrefixTree(ctx, 12); strategy = new TermQueryPrefixTreeStrategy(grid, "termquery_geohash"); ctorArgs.Add(new Param(strategy)); strategy = new PointVectorStrategy(ctx, "pointvector"); ctorArgs.Add(new Param(strategy)); return ctorArgs; }
//@ParametersFactory public static IList<Object[]> Parameters() { List<Object[]> ctorArgs = new List<object[]>(); SpatialContext ctx = SpatialContext.GEO; SpatialPrefixTree grid; SpatialStrategy strategy; grid = new QuadPrefixTree(ctx, 25); strategy = new RecursivePrefixTreeStrategy(grid, "recursive_quad"); ctorArgs.Add(new Object[] { new Param(strategy) }); grid = new GeohashPrefixTree(ctx, 12); strategy = new TermQueryPrefixTreeStrategy(grid, "termquery_geohash"); ctorArgs.Add(new Object[] { new Param(strategy) }); strategy = new PointVectorStrategy(ctx, "pointvector"); ctorArgs.Add(new Object[] { new Param(strategy) }); strategy = new SerializedDVStrategy(ctx, "serialized"); ctorArgs.Add(new Object[] { new Param(strategy) }); return ctorArgs; }
public QuadCell(QuadPrefixTree outerInstance, string token) : base(outerInstance, token) { }
public QuadCell(QuadPrefixTree _enclosing, string token) : base(token) { this._enclosing = _enclosing; }
internal QuadCell(QuadPrefixTree _enclosing, byte[] bytes, int off, int len) : base(bytes, off, len) { this._enclosing = _enclosing; }
protected internal override int GetLevelForDistance(double degrees) { var grid = new QuadPrefixTree(m_ctx, MAX_LEVELS_POSSIBLE); return(grid.GetLevelForDistance(degrees)); }
protected internal override int GetLevelForDistance(double degrees) { var grid = new QuadPrefixTree(ctx, MaxLevelsPossible); return(grid.GetLevelForDistance(degrees)); }
protected internal override int GetLevelForDistance(double degrees) { var grid = new QuadPrefixTree(ctx, MAX_LEVELS_POSSIBLE); return grid.GetLevelForDistance(degrees); }
public QuadCell(String token, QuadPrefixTree enclosingInstance) : base(enclosingInstance, token) { }
internal QuadCell(QuadPrefixTree outerInstance, byte[] bytes, int off, int len) : base(outerInstance, bytes, off, len) { }
public QuadCell(QuadPrefixTree outerInstance, string token, SpatialRelation shapeRel) : base(outerInstance, token) { this.shapeRel = shapeRel; }
public QuadCell(QuadPrefixTree outerInstance, string token, SpatialRelation shapeRel) : base(outerInstance, token) { this.m_shapeRel = shapeRel; }
public QuadCell(String token, SpatialRelation shapeRel, QuadPrefixTree enclosingInstance) : base(enclosingInstance, token) { this.shapeRel = shapeRel; }
protected internal override int GetLevelForDistance(double degrees) { var grid = new QuadPrefixTree(ctx, MaxLevelsPossible); return grid.GetLevelForDistance(degrees); }
public virtual void TestBadPrefixTreePrune() { IShape area = ctx.ReadShapeFromWkt("POLYGON((-122.83 48.57, -122.77 48.56, -122.79 48.53, -122.83 48.57))"); SpatialPrefixTree trie = new QuadPrefixTree(ctx, 12); TermQueryPrefixTreeStrategy strategy = new TermQueryPrefixTreeStrategy(trie, "geo"); Document doc = new Document(); doc.Add(new TextField("id", "1", Field.Store.YES)); // LUCENENET TODO: Change API to Store.Yes Field[] fields = strategy.CreateIndexableFields(area, 0.025); foreach (Field field in fields) { doc.Add(field); } AddDocument(doc); IPoint upperleft = ctx.MakePoint(-122.88, 48.54); IPoint lowerright = ctx.MakePoint(-122.82, 48.62); Query query = strategy.MakeQuery(new SpatialArgs(SpatialOperation.Intersects, ctx.MakeRectangle(upperleft, lowerright))); Commit(); TopDocs search = indexSearcher.Search(query, 10); ScoreDoc[] scoreDocs = search.ScoreDocs; foreach (ScoreDoc scoreDoc in scoreDocs) { Console.WriteLine(indexSearcher.Doc(scoreDoc.Doc)); } assertEquals(1, search.TotalHits); }