Re: [Pythoncad-developer] Spatiol coords on sqlite
CAD Application entire developed in Python
Status: Beta
Brought to you by:
matteoboscolo
From: <ger...@gm...> - 2010-03-10 22:27:12
|
Hi All, I added a custom build pysqlite to the repository. This custom build pysqlite enables the R*Tree module. The R*tree module replaces the in memory quad tree's used in R37 (if tests succeed). I changed the test_kernel.py script to make use of this custom build. Also I moved the test_kernel.py and pythoncad.pdr to the PythonCAD directory. At this moment I have only build a linux amd64 version. Other platforms and architectures follow. The idea is that no additional installation is needed. Just pull the latest version from git and run the test_kernel.py script. It should just work as before. Next thing to do is to populate the R*Tree index when inserting entities in the database. And do some queries to retrieve entities using the R*Tree. Regards, Gertwin nb Building a custom pysqlite is quite easy. Download the "pysqlite-2.6.0.tar.gz" from "http://code.google.com/p/pysqlite/downloads/list". Unpack the archive. Alter the "setup.cfg": [build_ext] # -DSQLITE_ENABLE_RTREE=1 builds the R*Tree module define=-DSQLITE_ENABLE_RTREE=1 #include_dirs=/usr/local/include #library_dirs=/usr/local/lib libraries=sqlite3 define=SQLITE_OMIT_LOAD_EXTENSION run: python setup.py build_static This will download the sqlite sources and build a single pysqlite shared library. Copy the build to the corresponding "PythonCAD\<platform>\<architecture>" directory. Op schreef "mat...@bo..." <mat...@bo...>: > Hi Gertwin, > For me it's ok to use this sqllite extention, > but to chose this option we need to be sure that the > performance are at the top. > So for my point of view you can recompile sqlite .. and try > to understand how difficuoult is to do such a think.. > Make some test to se if we have good performance. > at the and with all this data in hands we can decide what to > do .. > Regaeds, > Matteo > > Hi Matteo, > > > > I didn't know this, thank you. > > In this thread he (or she) wants to make use of the rtree > > module (http://www.sqlite.org/rtree.html). > > > > The rtree module is not standard supported, you must > > recompile sqlite with rtree support. > > If I try to execute this query in sqlite > > > > CREATE VIRTUAL TABLE cad_index USING > > rtree > > (Id INTEGER, minX INTEGER, maxX > > INTEGER, minY INTEGER, maxY INTEGER); > > > > I get an error: "no such module rtree", so we need to > > provide a custom build sqlite along with PythonCad. > > > > I like to use this rtree module in sqlite, we don't have > > to write and maintain our own code. > > My approach until now it creating quad trees in memory > > when opening the database. > > This will take some time and will cost memory, using the > > rtree module of sqlite is a better approach. > > > > We can store the bounding boxes of our entities in this > > table. The Id column is the relation to the entity table. > > > > So what is your opinion about using a custom build sqlite? > > > > Regards, > > Gertwin > > > > > > > > Op schreef Matteo Boscolo mat...@bo...>: > > > > > Hi Gerwin, > > > > > I found this article . > > > > > . > > > > > > > > http://www.mail-archive.com/sql...@sq.../msg47403.html > > > > > may be this can help us to retrieve the entity from db > > > > > > > > > Regards, > > > > > Matteo > > > > > > > > > > > > > > > > > > |