[Qgis-developer] Make QGIS interact with LibreCAD.

Diego Gnesi Bartolani diego.gnesi at gmail.com
Mon Apr 22 04:29:59 PDT 2013


Hi Bernhard,

I'll take your opinion into account. I'm still in a preliminary phase
and I'm still deciding. I verified that adding shapefile support to
LibreCAD is relatively simple, due to the good architecture of
LibreCAD's IO and geometry classes. Now I'll test how hard is adding
advanced cad tools to QGIS and how much time it can require to me.
Then I'll compare all the pros and cons of the two solutions and I'll
start to work. I need to finish the work before september, when I'll
have to use it in my job).
I'm not an expert of the QGIS API, and I need to study the source code
and the documentation in order to know precisely how can I interact
with QGIS while drawing:

- changing the snapping behavior and override the default one when required;
- having context menus with CTRL + right click (like on AutoCAD);
- drawing temporary entities (i.e. to trace extension lines);
- forcing the pointer to move along specific directions inside the map canvas;
- fast accessing to vertices, lines and angles of the existing shapes,
also for polygons.

I also need to understand if I can do all these things from a plugin
or do I need to make changes to the QGIS source code (I'll try to
avoid this).
I'll update this threads with all my progresses in the next days.

Diego

2013/4/22 Bernhard Ströbl <bernhard.stroebl at jena.de>:
> Hi Diego,
>
> some of my users with more complex editing tasks (and familiar with CAD
> software) are complaining about not having similar possibilities in QGIS and
> I admit that our CAD has much more to offer in that respect (snapping,
> construction), so thanks for the move.
> IMHO the best would be to have CAD-like functions in QGIS (strategy #1)
> because
> 1) many people missing these functions already might use some CAD or another
> to get their work done and are exchanging data between the two systems (with
> all problems), so strategy #2 would simply exchange their CAD software (if
> they are willing to change)
> 2) and more important: many things that work in CAD do not work in GIS and
> vice versa, e.g. CAD: line color, hatching, dimensioning...., GIS:
> attributes. Splines could be resolved into polylines, resembling the
> original spline, though. In short words: CAD is about drawing, GIS is about
> data modelling. So if you have the functions in QGIS you can more easily
> prevent users from doing silly things.
>
> my 2 ct
>
> Bernhard
>
> Am 21.04.2013 12:52, schrieb Diego Gnesi Bartolani:
>>
>> Hi,
>>
>> Yesterday I posted in a wrong thread, so I'm opening a new one. I'll
>> copy and paste the previous message and add some notes. Sorry for the
>> mess!
>>
>> Original post:
>>
>> I am an Italian archaeologist and an enthusiastic QGIS user. I do what
>> I can to spread the knowledge about QGIS and other open source
>> softwares to my university students (I am a contract professor at the
>> Basilicata University and some days ago I've become contract professor
>> at the Specialization School of Archeology of Udin, Venice and
>> Trieste). The main difficulty I have with open source GIS is the
>> advanced editing of vector layers. QGIS doesn't offer too much support
>> for digitizing, the CAD Tools plugin has some useful functions but is
>> far from being complete and the kind of interaction that it proposes
>> is not very productive and time-saving (it's not a critic: CAD Tools
>> saved my life a lot of time, and I want to thank the developers and
>> maintainers). Many times, I had to convert my vector layers to dxf and
>> back in order to perform some complex tasks (with all kind of
>> conversion problems, like the preservation of the attributes values,
>> etc.).
>> I have some experience in programming (about ten years of
>> developement, mainly in C# with the .NET Framework, before I switched
>> to Linux), and I would like to try (only try, without promising
>> anything!!) to implement complete CAD tools and functions (If there
>> isn't and analogous project already active; in that case, nevermind!).
>>
>> I think that developing a CAD plugin from scratch is very hard to me
>> and maybe not the better way to get good results, so I'm oriented to
>> try to augment the interaction between QGIS and an existing CAD
>> software (I'm thinking to LibreCAD). I thought to two possible
>> strategies:
>>
>> 1. Use the LibreCAD library and source code to develop a C++ QGIS plugin;
>> 2. Create a shapefile/spatialite/postgis driver for LibreCAD in order
>> to edit those formats inside LibreCAD.
>> 3. Convert some layers of the QGIS project in a dxf file and back
>> (each QGIS layer in a different layer of the final dxf file).
>>
>> I'm asking your opinion about which of those ways could be the faster
>> or the better to implement, or which one is impossible to undertake
>> according to your knowledge of the QGIS API.
>>
>> My doubts are:
>>
>> Strategy #1: Probably the ideal one, but does the implementation of
>> complex snaps or constraints against the features of other layers
>> (i.e. midpoint, parallels, etc.) require changes to the QGIS API, or
>> all these operations can be contained on a plugin? Is it better to
>> work directly on QGIS vector layers or to create a plugin layer, edit
>> it and then commit the changes to the vector layer? The conversion
>> could help me to manage geometries in the way LibreCAD wants. Is it
>> possible in your opinion to have an interactive shell (i.e. draw the
>> first point, and then inserting the coordinates of the second point)?
>>
>> Strategy #2: Probably the easier, but I should find a way to disable
>> some LibreCAD functions (i.e. the drawing of splines, or the drawing
>> of points on a line layer) without disseminating my changes all over
>> LibreCAD's source files. For this kind of solution I'll ask to the
>> developers of LibreCAD.
>>
>> Strategy #3: The problem is on committing the changes of the dxf file
>> to the original layer: how to specify that a line in the dxf file must
>> replace the geometry of and existing record of the original spatialite
>> layer? Maybe it's impossible, it doesn't seem to me that I can put on
>> a dxf file the necessary metadata to preserve a link to the original
>> features.
>>
>> What do you think? And what do you actually do when you have to draw
>> complex shapes on shapefiles or other vector layers?
>>
>> NEW COMMENTS:
>>
>> - Antonio Locandro is compiling a list of required CAD features. It
>> would be very useful, so please Antonio, get me a link to this list
>> when it's finished.
>> - The more I explore QGIS and LibreCAD source codes, the more I'm
>> convincing that integrating LibreCAD's tools on QGIS is very
>> difficult, and it would be easier to develop those tools from scratch.
>> To get the best results in a short amount of time, I think that I
>> could work to make shapefiles and other vector layers editable in
>> LibreCAD (using GDAL). This solution has the issue that it doesn't
>> allow to snap to other QGIS layers, nevertheless it could be of great
>> help and available in a reasonable amount of time. Then, when I have
>> more practice with QGIS and LibreCAD APIs, I'll try to do something
>> better (i.e. develop a "QGIS driver" for LibreCAD in order to open the
>> whole QGIS project in LibreCAD, organized by layers).
>> I'm waiting for the answers to an analogous thread in LibreCAD's mailing
>> list:
>>
>>
>> http://forum.librecad.org/Using-LibreCAD-s-tools-on-GIS-vector-layers-td5707930.html
>>
>> I think that I'm going to work on this project in a few weeks.
>>
>> Let me know what do you think and if you have suggestions.
>>
>> Diego Gnesi
>> _______________________________________________
>> Qgis-developer mailing list
>> Qgis-developer at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>
>>
>> __________ Information from ESET Mail Security, version of virus signature
>> database 8250 (20130421) __________
>>
>> The message was checked by ESET Mail Security.
>> http://www.eset.com
>>
>>
>
>
> __________ Information from ESET Mail Security, version of virus signature
> database 8252 (20130422) __________
>
> The message was checked by ESET Mail Security.
> http://www.eset.com
>
>
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer


More information about the Qgis-developer mailing list