The geopoly virtual table seems to be working. But only thinly tested so far.

FossilOrigin-Name: 4288f1ad5966701eac4cfe3061e8ce98e34e0d6c112307668729642a06458d5f
This commit is contained in:
drh 2018-05-28 23:59:03 +00:00
parent 48e4ef56c3
commit b0af3d1f97
5 changed files with 421 additions and 28 deletions

View File

@ -406,7 +406,7 @@ static void geopolySvgFunc(
**
** Rotate by R around the point (0,0):
**
** geopoly_xform(poly, cos(R), sin(R), sin(R), cos(R), 0, 0)
** geopoly_xform(poly, cos(R), sin(R), -sin(R), cos(R), 0, 0)
*/
static void geopolyXformFunc(
sqlite3_context *context,
@ -419,7 +419,7 @@ static void geopolyXformFunc(
double C = sqlite3_value_double(argv[3]);
double D = sqlite3_value_double(argv[4]);
double E = sqlite3_value_double(argv[5]);
double F = sqlite3_value_double(argv[7]);
double F = sqlite3_value_double(argv[6]);
GeoCoord x1, y1, x0, y0;
int ii;
if( p ){
@ -1017,7 +1017,7 @@ static int geopolyInit(
pRtree->nAux = 1; /* Add one for _shape */
for(ii=3; ii<argc; ii++){
pRtree->nAux++;
sqlite3_str_appendf(pSql, ",%s", argv[ii]+1);
sqlite3_str_appendf(pSql, ",%s", argv[ii]);
}
sqlite3_str_appendf(pSql, ",_bbox HIDDEN);");
zSql = sqlite3_str_finish(pSql);
@ -1149,23 +1149,23 @@ static int geopolyFilter(
if( p==0 ){
rc = SQLITE_NOMEM;
}else{
memset(pCsr->aConstraint, 0, sizeof(RtreeConstraint)*argc);
memset(pCsr->aConstraint, 0, sizeof(RtreeConstraint)*4);
memset(pCsr->anQueue, 0, sizeof(u32)*(pRtree->iDepth + 1));
p->op = 'B';
p->iCoord = 'a';
p->u.rValue = bbox[0].f;
p++;
p->op = 'D';
p->iCoord = 'b';
p->iCoord = 0;
p->u.rValue = bbox[1].f;
p++;
p->op = 'D';
p->iCoord = 1;
p->u.rValue = bbox[0].f;
p++;
p->op = 'B';
p->iCoord = 'c';
p->u.rValue = bbox[2].f;
p->iCoord = 2;
p->u.rValue = bbox[3].f;
p++;
p->op = 'D';
p->iCoord = 'd';
p->u.rValue = bbox[3].f;
p->iCoord = 3;
p->u.rValue = bbox[2].f;
}
}
if( rc==SQLITE_OK ){
@ -1228,7 +1228,8 @@ static int geopolyBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){
}
if( iFuncTerm>=0 ){
pIdxInfo->idxNum = 2;
pIdxInfo->aConstraintUsage[iRowidTerm].argvIndex = 1;
pIdxInfo->aConstraintUsage[iFuncTerm].argvIndex = 1;
pIdxInfo->aConstraintUsage[iFuncTerm].omit = 0;
pIdxInfo->estimatedCost = 300.0;
pIdxInfo->estimatedRows = 10;
return SQLITE_OK;
@ -1270,8 +1271,7 @@ static int geopolyColumn(sqlite3_vtab_cursor *cur, sqlite3_context *ctx, int i){
return rc;
}
}
sqlite3_result_value(ctx,
sqlite3_column_value(pCsr->pReadAux, i - pRtree->nDim2 + 1));
sqlite3_result_value(ctx, sqlite3_column_value(pCsr->pReadAux, i+2));
}else{
/* Must be the _bbox column */
}
@ -1367,7 +1367,7 @@ static int geopolyUpdate(
** record to delete from the r-tree table. The following block does
** just that.
*/
if( rc==SQLITE_OK && (nData==1 || coordChange) ){
if( rc==SQLITE_OK && (nData==1 || (coordChange && oldRowidValid)) ){
rc = rtreeDeleteRowid(pRtree, oldRowid);
}
@ -1378,6 +1378,9 @@ static int geopolyUpdate(
if( rc==SQLITE_OK && nData>1 && coordChange ){
/* Insert the new record into the r-tree */
RtreeNode *pLeaf = 0;
if( !newRowidValid ){
rc = rtreeNewRowid(pRtree, &cell.iRowid);
}
*pRowid = cell.iRowid;
if( rc==SQLITE_OK ){
rc = ChooseLeaf(pRtree, &cell, 0, &pLeaf);
@ -1398,7 +1401,7 @@ static int geopolyUpdate(
sqlite3_stmt *pUp = pRtree->pWriteAux;
int jj;
int nChange = 0;
sqlite3_bind_int64(pUp, 1, newRowid);
sqlite3_bind_int64(pUp, 1, cell.iRowid);
for(jj=0; jj<pRtree->nAux; jj++){
if( !sqlite3_value_nochange(aData[jj+2]) ) nChange++;
sqlite3_bind_value(pUp, jj+2, aData[jj+2]);

View File

@ -2893,7 +2893,7 @@ static int reinsertNodeContent(Rtree *pRtree, RtreeNode *pNode){
/*
** Select a currently unused rowid for a new r-tree record.
*/
static int newRowid(Rtree *pRtree, i64 *piRowid){
static int rtreeNewRowid(Rtree *pRtree, i64 *piRowid){
int rc;
sqlite3_bind_null(pRtree->pWriteRowid, 1);
sqlite3_bind_null(pRtree->pWriteRowid, 2);
@ -3180,7 +3180,7 @@ static int rtreeUpdate(
/* Figure out the rowid of the new row. */
if( bHaveRowid==0 ){
rc = newRowid(pRtree, &cell.iRowid);
rc = rtreeNewRowid(pRtree, &cell.iRowid);
}
*pRowid = cell.iRowid;

389
ext/rtree/visual01.txt Normal file
View File

@ -0,0 +1,389 @@
#!sqlite3
#
# This is a visual test case for the geopoly virtual table.
#
# Run this script in the sqlite3 CLI, and redirect output into an
# HTML file. This display the HTML in a webbrowser.
#
/* Test data.
** Lots of shapes to be displayed over a 1000x800 canvas.
*/
CREATE TEMP TABLE basis(name TEXT, jshape TEXT);
INSERT INTO basis(name,jshape) VALUES
('box-20','[[0,0],[20,0],[20,20],[0,20],[0,0]]'),
('house-70','[[0,0],[50,0],[50,50],[25,70],[0,50],[0,0]]'),
('line-40','[[0,0],[40,0],[40,5],[0,5],[0,0]]'),
('line-80','[[0,0],[80,0],[80,7],[0,7],[0,0]]'),
('arrow-50','[[0,0],[25,25],[0,50],[15,25],[0,0]]'),
('triangle-30','[[0,0],[30,0],[15,30],[0,0]]'),
('angle-30','[[0,0],[30,0],[30,30],[26,30],[26,4],[0,4],[0,0]]'),
('star-10','[[1,0],[5,2],[9,0],[7,4],[10,8],[7,7],[5,10],[3,7],[0,8],[3,4],[1,0]]');
CREATE TEMP TABLE xform(A,B,C,D,clr);
INSERT INTO xform(A,B,clr) VALUES
(1,0,'black'),
(0.707,0.707,'blue'),
(0.5,0.866,'red'),
(-0.866,0.5,'green');
CREATE TEMP TABLE xyoff(id1,id2,xoff,yoff,PRIMARY KEY(id1,id2,xoff,yoff))
WITHOUT ROWID;
INSERT INTO xyoff VALUES(1,1,811,659);
INSERT INTO xyoff VALUES(1,1,235,550);
INSERT INTO xyoff VALUES(1,1,481,620);
INSERT INTO xyoff VALUES(1,1,106,494);
INSERT INTO xyoff VALUES(1,1,487,106);
INSERT INTO xyoff VALUES(1,1,817,595);
INSERT INTO xyoff VALUES(1,1,240,504);
INSERT INTO xyoff VALUES(1,1,806,457);
INSERT INTO xyoff VALUES(1,1,608,107);
INSERT INTO xyoff VALUES(1,1,768,662);
INSERT INTO xyoff VALUES(1,2,808,528);
INSERT INTO xyoff VALUES(1,2,768,528);
INSERT INTO xyoff VALUES(1,2,771,171);
INSERT INTO xyoff VALUES(1,2,275,671);
INSERT INTO xyoff VALUES(1,2,326,336);
INSERT INTO xyoff VALUES(1,2,690,688);
INSERT INTO xyoff VALUES(1,2,597,239);
INSERT INTO xyoff VALUES(1,2,317,528);
INSERT INTO xyoff VALUES(1,2,366,223);
INSERT INTO xyoff VALUES(1,2,621,154);
INSERT INTO xyoff VALUES(1,3,829,469);
INSERT INTO xyoff VALUES(1,3,794,322);
INSERT INTO xyoff VALUES(1,3,358,387);
INSERT INTO xyoff VALUES(1,3,184,444);
INSERT INTO xyoff VALUES(1,3,729,500);
INSERT INTO xyoff VALUES(1,3,333,523);
INSERT INTO xyoff VALUES(1,3,117,595);
INSERT INTO xyoff VALUES(1,3,496,201);
INSERT INTO xyoff VALUES(1,3,818,601);
INSERT INTO xyoff VALUES(1,3,541,343);
INSERT INTO xyoff VALUES(1,4,603,248);
INSERT INTO xyoff VALUES(1,4,761,649);
INSERT INTO xyoff VALUES(1,4,611,181);
INSERT INTO xyoff VALUES(1,4,607,233);
INSERT INTO xyoff VALUES(1,4,860,206);
INSERT INTO xyoff VALUES(1,4,310,231);
INSERT INTO xyoff VALUES(1,4,727,539);
INSERT INTO xyoff VALUES(1,4,660,661);
INSERT INTO xyoff VALUES(1,4,403,133);
INSERT INTO xyoff VALUES(1,4,619,331);
INSERT INTO xyoff VALUES(2,1,712,578);
INSERT INTO xyoff VALUES(2,1,567,313);
INSERT INTO xyoff VALUES(2,1,231,423);
INSERT INTO xyoff VALUES(2,1,490,175);
INSERT INTO xyoff VALUES(2,1,898,353);
INSERT INTO xyoff VALUES(2,1,589,483);
INSERT INTO xyoff VALUES(2,1,188,462);
INSERT INTO xyoff VALUES(2,1,720,106);
INSERT INTO xyoff VALUES(2,1,793,380);
INSERT INTO xyoff VALUES(2,1,154,396);
INSERT INTO xyoff VALUES(2,2,324,218);
INSERT INTO xyoff VALUES(2,2,120,327);
INSERT INTO xyoff VALUES(2,2,655,133);
INSERT INTO xyoff VALUES(2,2,516,603);
INSERT INTO xyoff VALUES(2,2,529,572);
INSERT INTO xyoff VALUES(2,2,481,212);
INSERT INTO xyoff VALUES(2,2,802,107);
INSERT INTO xyoff VALUES(2,2,234,509);
INSERT INTO xyoff VALUES(2,2,501,269);
INSERT INTO xyoff VALUES(2,2,349,553);
INSERT INTO xyoff VALUES(2,3,495,685);
INSERT INTO xyoff VALUES(2,3,897,372);
INSERT INTO xyoff VALUES(2,3,350,681);
INSERT INTO xyoff VALUES(2,3,832,257);
INSERT INTO xyoff VALUES(2,3,778,149);
INSERT INTO xyoff VALUES(2,3,683,426);
INSERT INTO xyoff VALUES(2,3,693,217);
INSERT INTO xyoff VALUES(2,3,746,317);
INSERT INTO xyoff VALUES(2,3,805,369);
INSERT INTO xyoff VALUES(2,3,336,585);
INSERT INTO xyoff VALUES(2,4,890,255);
INSERT INTO xyoff VALUES(2,4,556,565);
INSERT INTO xyoff VALUES(2,4,865,555);
INSERT INTO xyoff VALUES(2,4,230,293);
INSERT INTO xyoff VALUES(2,4,247,251);
INSERT INTO xyoff VALUES(2,4,730,563);
INSERT INTO xyoff VALUES(2,4,318,282);
INSERT INTO xyoff VALUES(2,4,220,431);
INSERT INTO xyoff VALUES(2,4,828,336);
INSERT INTO xyoff VALUES(2,4,278,525);
INSERT INTO xyoff VALUES(3,1,324,656);
INSERT INTO xyoff VALUES(3,1,625,362);
INSERT INTO xyoff VALUES(3,1,155,570);
INSERT INTO xyoff VALUES(3,1,267,433);
INSERT INTO xyoff VALUES(3,1,599,121);
INSERT INTO xyoff VALUES(3,1,873,498);
INSERT INTO xyoff VALUES(3,1,789,520);
INSERT INTO xyoff VALUES(3,1,656,378);
INSERT INTO xyoff VALUES(3,1,831,601);
INSERT INTO xyoff VALUES(3,1,256,471);
INSERT INTO xyoff VALUES(3,2,332,258);
INSERT INTO xyoff VALUES(3,2,305,463);
INSERT INTO xyoff VALUES(3,2,796,341);
INSERT INTO xyoff VALUES(3,2,830,229);
INSERT INTO xyoff VALUES(3,2,413,271);
INSERT INTO xyoff VALUES(3,2,269,140);
INSERT INTO xyoff VALUES(3,2,628,441);
INSERT INTO xyoff VALUES(3,2,747,643);
INSERT INTO xyoff VALUES(3,2,584,435);
INSERT INTO xyoff VALUES(3,2,784,314);
INSERT INTO xyoff VALUES(3,3,722,233);
INSERT INTO xyoff VALUES(3,3,815,421);
INSERT INTO xyoff VALUES(3,3,401,267);
INSERT INTO xyoff VALUES(3,3,451,650);
INSERT INTO xyoff VALUES(3,3,329,485);
INSERT INTO xyoff VALUES(3,3,878,370);
INSERT INTO xyoff VALUES(3,3,162,616);
INSERT INTO xyoff VALUES(3,3,844,183);
INSERT INTO xyoff VALUES(3,3,161,216);
INSERT INTO xyoff VALUES(3,3,176,676);
INSERT INTO xyoff VALUES(3,4,780,128);
INSERT INTO xyoff VALUES(3,4,566,121);
INSERT INTO xyoff VALUES(3,4,646,120);
INSERT INTO xyoff VALUES(3,4,223,557);
INSERT INTO xyoff VALUES(3,4,251,117);
INSERT INTO xyoff VALUES(3,4,139,209);
INSERT INTO xyoff VALUES(3,4,813,597);
INSERT INTO xyoff VALUES(3,4,454,538);
INSERT INTO xyoff VALUES(3,4,616,198);
INSERT INTO xyoff VALUES(3,4,210,159);
INSERT INTO xyoff VALUES(4,1,208,415);
INSERT INTO xyoff VALUES(4,1,326,665);
INSERT INTO xyoff VALUES(4,1,612,133);
INSERT INTO xyoff VALUES(4,1,537,513);
INSERT INTO xyoff VALUES(4,1,638,438);
INSERT INTO xyoff VALUES(4,1,808,269);
INSERT INTO xyoff VALUES(4,1,552,121);
INSERT INTO xyoff VALUES(4,1,100,189);
INSERT INTO xyoff VALUES(4,1,643,664);
INSERT INTO xyoff VALUES(4,1,726,378);
INSERT INTO xyoff VALUES(4,2,478,409);
INSERT INTO xyoff VALUES(4,2,497,507);
INSERT INTO xyoff VALUES(4,2,233,148);
INSERT INTO xyoff VALUES(4,2,587,237);
INSERT INTO xyoff VALUES(4,2,604,166);
INSERT INTO xyoff VALUES(4,2,165,455);
INSERT INTO xyoff VALUES(4,2,320,258);
INSERT INTO xyoff VALUES(4,2,353,496);
INSERT INTO xyoff VALUES(4,2,347,495);
INSERT INTO xyoff VALUES(4,2,166,622);
INSERT INTO xyoff VALUES(4,3,461,332);
INSERT INTO xyoff VALUES(4,3,685,278);
INSERT INTO xyoff VALUES(4,3,427,594);
INSERT INTO xyoff VALUES(4,3,467,346);
INSERT INTO xyoff VALUES(4,3,125,548);
INSERT INTO xyoff VALUES(4,3,597,680);
INSERT INTO xyoff VALUES(4,3,820,445);
INSERT INTO xyoff VALUES(4,3,144,330);
INSERT INTO xyoff VALUES(4,3,557,434);
INSERT INTO xyoff VALUES(4,3,254,315);
INSERT INTO xyoff VALUES(4,4,157,339);
INSERT INTO xyoff VALUES(4,4,249,220);
INSERT INTO xyoff VALUES(4,4,391,323);
INSERT INTO xyoff VALUES(4,4,589,429);
INSERT INTO xyoff VALUES(4,4,859,592);
INSERT INTO xyoff VALUES(4,4,337,680);
INSERT INTO xyoff VALUES(4,4,410,288);
INSERT INTO xyoff VALUES(4,4,636,596);
INSERT INTO xyoff VALUES(4,4,734,433);
INSERT INTO xyoff VALUES(4,4,559,549);
INSERT INTO xyoff VALUES(5,1,549,607);
INSERT INTO xyoff VALUES(5,1,584,498);
INSERT INTO xyoff VALUES(5,1,699,116);
INSERT INTO xyoff VALUES(5,1,525,524);
INSERT INTO xyoff VALUES(5,1,304,667);
INSERT INTO xyoff VALUES(5,1,302,232);
INSERT INTO xyoff VALUES(5,1,403,149);
INSERT INTO xyoff VALUES(5,1,824,403);
INSERT INTO xyoff VALUES(5,1,697,203);
INSERT INTO xyoff VALUES(5,1,293,689);
INSERT INTO xyoff VALUES(5,2,199,275);
INSERT INTO xyoff VALUES(5,2,395,393);
INSERT INTO xyoff VALUES(5,2,657,642);
INSERT INTO xyoff VALUES(5,2,200,655);
INSERT INTO xyoff VALUES(5,2,882,234);
INSERT INTO xyoff VALUES(5,2,483,565);
INSERT INTO xyoff VALUES(5,2,755,640);
INSERT INTO xyoff VALUES(5,2,810,305);
INSERT INTO xyoff VALUES(5,2,731,655);
INSERT INTO xyoff VALUES(5,2,466,690);
INSERT INTO xyoff VALUES(5,3,563,584);
INSERT INTO xyoff VALUES(5,3,491,117);
INSERT INTO xyoff VALUES(5,3,779,292);
INSERT INTO xyoff VALUES(5,3,375,637);
INSERT INTO xyoff VALUES(5,3,253,553);
INSERT INTO xyoff VALUES(5,3,797,514);
INSERT INTO xyoff VALUES(5,3,229,480);
INSERT INTO xyoff VALUES(5,3,257,194);
INSERT INTO xyoff VALUES(5,3,449,555);
INSERT INTO xyoff VALUES(5,3,849,630);
INSERT INTO xyoff VALUES(5,4,329,286);
INSERT INTO xyoff VALUES(5,4,640,197);
INSERT INTO xyoff VALUES(5,4,104,150);
INSERT INTO xyoff VALUES(5,4,438,272);
INSERT INTO xyoff VALUES(5,4,773,226);
INSERT INTO xyoff VALUES(5,4,441,650);
INSERT INTO xyoff VALUES(5,4,242,340);
INSERT INTO xyoff VALUES(5,4,301,435);
INSERT INTO xyoff VALUES(5,4,171,397);
INSERT INTO xyoff VALUES(5,4,541,619);
INSERT INTO xyoff VALUES(6,1,651,301);
INSERT INTO xyoff VALUES(6,1,637,137);
INSERT INTO xyoff VALUES(6,1,765,643);
INSERT INTO xyoff VALUES(6,1,173,296);
INSERT INTO xyoff VALUES(6,1,263,192);
INSERT INTO xyoff VALUES(6,1,791,302);
INSERT INTO xyoff VALUES(6,1,860,601);
INSERT INTO xyoff VALUES(6,1,780,445);
INSERT INTO xyoff VALUES(6,1,462,214);
INSERT INTO xyoff VALUES(6,1,802,207);
INSERT INTO xyoff VALUES(6,2,811,685);
INSERT INTO xyoff VALUES(6,2,533,531);
INSERT INTO xyoff VALUES(6,2,390,614);
INSERT INTO xyoff VALUES(6,2,260,580);
INSERT INTO xyoff VALUES(6,2,116,377);
INSERT INTO xyoff VALUES(6,2,860,458);
INSERT INTO xyoff VALUES(6,2,438,590);
INSERT INTO xyoff VALUES(6,2,604,562);
INSERT INTO xyoff VALUES(6,2,241,242);
INSERT INTO xyoff VALUES(6,2,667,298);
INSERT INTO xyoff VALUES(6,3,787,698);
INSERT INTO xyoff VALUES(6,3,868,521);
INSERT INTO xyoff VALUES(6,3,412,587);
INSERT INTO xyoff VALUES(6,3,640,131);
INSERT INTO xyoff VALUES(6,3,748,410);
INSERT INTO xyoff VALUES(6,3,257,244);
INSERT INTO xyoff VALUES(6,3,411,195);
INSERT INTO xyoff VALUES(6,3,464,356);
INSERT INTO xyoff VALUES(6,3,157,339);
INSERT INTO xyoff VALUES(6,3,434,505);
INSERT INTO xyoff VALUES(6,4,480,671);
INSERT INTO xyoff VALUES(6,4,519,228);
INSERT INTO xyoff VALUES(6,4,404,513);
INSERT INTO xyoff VALUES(6,4,120,538);
INSERT INTO xyoff VALUES(6,4,403,663);
INSERT INTO xyoff VALUES(6,4,477,677);
INSERT INTO xyoff VALUES(6,4,690,154);
INSERT INTO xyoff VALUES(6,4,606,498);
INSERT INTO xyoff VALUES(6,4,430,665);
INSERT INTO xyoff VALUES(6,4,499,273);
INSERT INTO xyoff VALUES(7,1,118,526);
INSERT INTO xyoff VALUES(7,1,817,522);
INSERT INTO xyoff VALUES(7,1,388,638);
INSERT INTO xyoff VALUES(7,1,181,265);
INSERT INTO xyoff VALUES(7,1,442,332);
INSERT INTO xyoff VALUES(7,1,475,282);
INSERT INTO xyoff VALUES(7,1,722,633);
INSERT INTO xyoff VALUES(7,1,104,394);
INSERT INTO xyoff VALUES(7,1,631,262);
INSERT INTO xyoff VALUES(7,1,372,392);
INSERT INTO xyoff VALUES(7,2,600,413);
INSERT INTO xyoff VALUES(7,2,386,223);
INSERT INTO xyoff VALUES(7,2,839,174);
INSERT INTO xyoff VALUES(7,2,293,410);
INSERT INTO xyoff VALUES(7,2,281,391);
INSERT INTO xyoff VALUES(7,2,859,387);
INSERT INTO xyoff VALUES(7,2,478,347);
INSERT INTO xyoff VALUES(7,2,646,690);
INSERT INTO xyoff VALUES(7,2,713,234);
INSERT INTO xyoff VALUES(7,2,199,588);
INSERT INTO xyoff VALUES(7,3,389,256);
INSERT INTO xyoff VALUES(7,3,349,542);
INSERT INTO xyoff VALUES(7,3,363,345);
INSERT INTO xyoff VALUES(7,3,751,302);
INSERT INTO xyoff VALUES(7,3,423,386);
INSERT INTO xyoff VALUES(7,3,267,444);
INSERT INTO xyoff VALUES(7,3,243,182);
INSERT INTO xyoff VALUES(7,3,453,658);
INSERT INTO xyoff VALUES(7,3,126,345);
INSERT INTO xyoff VALUES(7,3,120,472);
INSERT INTO xyoff VALUES(7,4,359,654);
INSERT INTO xyoff VALUES(7,4,339,516);
INSERT INTO xyoff VALUES(7,4,710,452);
INSERT INTO xyoff VALUES(7,4,810,560);
INSERT INTO xyoff VALUES(7,4,644,692);
INSERT INTO xyoff VALUES(7,4,826,327);
INSERT INTO xyoff VALUES(7,4,465,462);
INSERT INTO xyoff VALUES(7,4,310,456);
INSERT INTO xyoff VALUES(7,4,577,613);
INSERT INTO xyoff VALUES(7,4,502,555);
INSERT INTO xyoff VALUES(8,1,601,620);
INSERT INTO xyoff VALUES(8,1,372,683);
INSERT INTO xyoff VALUES(8,1,758,399);
INSERT INTO xyoff VALUES(8,1,485,552);
INSERT INTO xyoff VALUES(8,1,159,563);
INSERT INTO xyoff VALUES(8,1,536,303);
INSERT INTO xyoff VALUES(8,1,122,263);
INSERT INTO xyoff VALUES(8,1,836,435);
INSERT INTO xyoff VALUES(8,1,544,146);
INSERT INTO xyoff VALUES(8,1,270,277);
INSERT INTO xyoff VALUES(8,2,849,281);
INSERT INTO xyoff VALUES(8,2,563,242);
INSERT INTO xyoff VALUES(8,2,704,463);
INSERT INTO xyoff VALUES(8,2,102,165);
INSERT INTO xyoff VALUES(8,2,797,524);
INSERT INTO xyoff VALUES(8,2,612,426);
INSERT INTO xyoff VALUES(8,2,345,372);
INSERT INTO xyoff VALUES(8,2,820,376);
INSERT INTO xyoff VALUES(8,2,789,156);
INSERT INTO xyoff VALUES(8,2,321,466);
INSERT INTO xyoff VALUES(8,3,150,332);
INSERT INTO xyoff VALUES(8,3,136,152);
INSERT INTO xyoff VALUES(8,3,468,528);
INSERT INTO xyoff VALUES(8,3,409,192);
INSERT INTO xyoff VALUES(8,3,820,216);
INSERT INTO xyoff VALUES(8,3,847,249);
INSERT INTO xyoff VALUES(8,3,801,267);
INSERT INTO xyoff VALUES(8,3,181,670);
INSERT INTO xyoff VALUES(8,3,398,563);
INSERT INTO xyoff VALUES(8,3,439,576);
INSERT INTO xyoff VALUES(8,4,123,309);
INSERT INTO xyoff VALUES(8,4,190,496);
INSERT INTO xyoff VALUES(8,4,571,531);
INSERT INTO xyoff VALUES(8,4,290,255);
INSERT INTO xyoff VALUES(8,4,244,412);
INSERT INTO xyoff VALUES(8,4,264,596);
INSERT INTO xyoff VALUES(8,4,253,420);
INSERT INTO xyoff VALUES(8,4,847,536);
INSERT INTO xyoff VALUES(8,4,120,288);
INSERT INTO xyoff VALUES(8,4,331,639);
/* Create the geopoly object from test data above */
CREATE VIRTUAL TABLE geo1 USING geopoly(type,clr);
INSERT INTO geo1(_shape,type,clr)
SELECT geopoly_xform(jshape,A,B,-B,A,xoff,yoff), basis.name, xform.clr
FROM basis, xform, xyoff
WHERE xyoff.id1=basis.rowid AND xyoff.id2=xform.rowid;
/* Query polygon */
CREATE TEMP TABLE querypoly(poly JSON, clr TEXT);
INSERT INTO querypoly(clr, poly) VALUES
('orange', '[[300,300],[400,350],[500,250],[480,500],[400,480],[300,550],[280,450],[320,400],[280,350],[300,300]]');
/* Generate the HTML */
.print '<html>'
.print '<h1>Everything</h1>'
.print '<svg width="1000" height="800" style="border:1px solid black">'
SELECT geopoly_svg(_shape,
printf('style="fill:none;stroke:%s;stroke-width:1"',clr)
)
FROM geo1;
SELECT geopoly_svg(poly,
printf('style="fill:%s;fill-opacity:0.5;"',clr)
)
FROM querypoly;
.print '</svg>'
.print '<h1>Query</h1>'
.print '<svg width="1000" height="800" style="border:1px solid black">'
SELECT geopoly_svg(_shape,
printf('style="fill:none;stroke:%s;stroke-width:1"',geo1.clr)
)
FROM geo1, querypoly
WHERE geopoly_overlap(_shape, poly);
SELECT geopoly_svg(poly,
printf('style="fill:%s;fill-opacity:0.5;"',clr)
)
FROM querypoly;
.print '</svg>'
.print '</html>'

View File

@ -1,5 +1,5 @@
C Untested\sincremental\scheck-in.\s\sAdd\sthe\sgeopoly_xform()\sfunction.\s\sComplete\nbasic\slogic\sfor\sthe\sgeopoly\svirtual\stable.
D 2018-05-28T13:23:23.983
C The\sgeopoly\svirtual\stable\sseems\sto\sbe\sworking.\s\sBut\sonly\sthinly\stested\sso\sfar.
D 2018-05-28T23:59:03.555
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F Makefile.in 51407f0e371dcb9e65d368bd4f1a08fc17ef8361ff11aac9356f0f63693b38dd
@ -355,8 +355,8 @@ F ext/repair/test/checkfreelist01.test 3e8aa6aeb4007680c94a8d07b41c339aa635cc782
F ext/repair/test/checkindex01.test 6945d0ffc0c1dc993b2ce88036b26e0f5d6fcc65da70fc9df27c2647bb358b0f
F ext/repair/test/test.tcl 686d76d888dffd021f64260abf29a55c57b2cedfa7fc69150b42b1d6119aac3c
F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
F ext/rtree/geopoly.c 8c175a1c1e9c8659533a28c9aabf5ec1315e598b56129707ffe87567fcc475b8
F ext/rtree/rtree.c 2fd3c149c6fc4d3fdf602dc610b34ad9abdf75cca26d0c362f903aa02ea2ef47
F ext/rtree/geopoly.c 95626633e615db611c6a61a7cc2c060d7dedea8338a92a4345e4ecce045fe0e8
F ext/rtree/rtree.c f3c2f1b5eea75b98d4d3dcdec2ebf2a69c036b53f2f3d196e61bf5016298255f
F ext/rtree/rtree.h 4a690463901cb5e6127cf05eb8e642f127012fd5003830dbc974eca5802d9412
F ext/rtree/rtree1.test 309afc04d4287542b2cd74f933296832cc681c7b014d9405cb329b62053a5349
F ext/rtree/rtree2.test 5f25b01acd03470067a2d52783b2eb0a50bf836803d4342d20ca39e541220fe2
@ -382,6 +382,7 @@ F ext/rtree/rtreeconnect.test 225ad3fcb483d36cbee423a25052a6bbae762c9576ae926833
F ext/rtree/sqlite3rtree.h 9c5777af3d2921c7b4ae4954e8e5697502289d28
F ext/rtree/tkt3363.test 142ab96eded44a3615ec79fba98c7bde7d0f96de
F ext/rtree/viewrtree.tcl eea6224b3553599ae665b239bd827e182b466024
F ext/rtree/visual01.txt ce5473774986a7fde188de9cbfc554f9c0f07109c61a5169019bd0c514776c11
F ext/session/changeset.c 4ccbaa4531944c24584bf6a61ba3a39c62b6267a
F ext/session/session1.test 4532116484f525110eb4cfff7030c59354c0cde9def4d109466b0df2b35ad5cc
F ext/session/session2.test 284de45abae4cc1082bc52012ee81521d5ac58e0
@ -1730,7 +1731,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 2c2a202c14fa8803fb1e4b7356cbc9cd49e65a27e19bf6e3fd0e9dff9d5c67f9
R f4a9697324257dda7a5826181dabdab6
P ed06cc32568a3abaa0535b379e0ee3b04ffb7582dcda6405670620d1fbe8996c
R 81c5a462839f4fc8f38c54f9f8566edf
U drh
Z 2d47301bf215e61d246a3f2a2f3aad00
Z 985d2eedc536b0a7cccf298a1cefc057

View File

@ -1 +1 @@
ed06cc32568a3abaa0535b379e0ee3b04ffb7582dcda6405670620d1fbe8996c
4288f1ad5966701eac4cfe3061e8ce98e34e0d6c112307668729642a06458d5f