#1 2020-03-12 13:00:54

juwo
Member
Registered: 2014-09-05
Posts: 21

Rtree and ExecuteList

Hi,
Since i can't find better way to use rtree index with simple max, min bound, i'm trying this way:

Model:

  TSQLObj = class(TSQLRecord)
  private
    fTyp: RawUTF8; 
    fVisible : Boolean;
    fX: TDoubleDynArray;
    fY: TDoubleDynArray;
  published
    property Typ: RawUTF8 read fTyp write fTyp;
    property Visible : Boolean read fVisible write fVisible;
    property X: TDoubleDynArray index 1 read fX write fX;
    property Y: TDoubleDynArray index 2 read fY write fY;
  end;
  TSQLObj_box = class(TSQLRecordRTree)
  private
    FminX: Double;
    FmaxX: Double;
    FminY: Double;
    FmaxY: Double;
  published
    property minX: Double read FminX write FminX;
    property maxX: Double read FmaxX write FmaxX;
    property minY: Double read FminY write FminY;
    property maxY: Double read FmaxY write FmaxY;
  end;

Query:

table := mainfrm.database.ExecuteList ([TSQLObj, TSQLObj_box],
       'select obj.id,obj.x,obj.y from obj, obj_box where (obj.rowid=obj_box.rowid) and '+
       '(minx<='+f2str(maxx)+') and (maxx>='+f2str(minx)+') and (miny<='+f2str(maxy)+') and (maxy>='+f2str(miny)+') and '+
       '(typ='+quotedstr(typ)+') and (visible=1)');

But i stuck with probably very simply problem. X and Y column are defined as TDoubleDynArray. How to access to them from table:TSQLTable. Simple table.getbytes not work. I can't figure it out sad

Offline

#2 2020-03-12 16:57:21

juwo
Member
Registered: 2014-09-05
Posts: 21

Re: Rtree and ExecuteList

Sorry for bothering - solution: o.FillFrom(table, i)

Thanks for this great framework

Offline

Board footer

Powered by FluxBB