0

I'm trying to build a small application for a specific problem in cartography. The workflow is like this:

  • in the field, use a compass and tape measure to obtain terrain data.
  • also in the field, sketch the plot being surveyed
  • using inkscape, create a vector drawing of that sketch
  • crunch the data to obtain the relevant information (implemented already)
  • put the vector and the data together (mostly warping and scaling the drawing - implemented already)

Now, I'd like to do the vectorizing, which I'm doing in inkscape now, directly in my custom application - this helps me characterize the sketch faster.

I had a look at the Inkscape and Karbon codebases, but the code responsible for the widgets that draw curves and paths, along with the whole user interaction parts, is quite involved. I'd like to stick to number crunching and make sure that works properly.

In short, I'm looking for something like Qwt (whichs provides plotting utilities), but directed to adding vector drawing/sketching functionality to an application. Then it'd be a matter of putting the GUI pieces together, and i'd be free to worry about the number crunching. So far I couldn't find anything like this - Inkscape, Karbon, Libreoffice, Printdesign, Gimp, they all implement their own path, curve widgets, using the graphics primitives of their frameworks and adding all the code that shows the curve moving with the mouse, the control points, etc.

Does anyone have an idea if such a pre-made framework for higher-level graphics - that lets me forget about the GUI code - exists? Thanks!

Renato
  • 11
  • 2

1 Answers1

1

QGraphicsScene and QGraphicsView provide enough for you to fairly simply implement the rest of it. Do note that Qt has a rather rich set of graphics primitives that you can trivially reuse, like bezier curves, paths, etc. You need to implement the application-specific bits, but the basics are done.

Kuba hasn't forgotten Monica
  • 95,931
  • 16
  • 151
  • 313
  • Thanks for your answer! I've read a number of your postings already, always very useful! Indeed, the Qt classes provide more than enough - that's what Karbon uses. But let's take an example: the bezier curve primitive is just that, all the code that actually draws what the user sees (the curve moving as you move the mouse, the control points, and all the repainting) has to be written on top of that. This is what I was trying to escape from by using pre-made code.. – Renato Oct 29 '13 at 12:19
  • The code you're talking about is, thankfully, rather trivial. It cannot be easily generalized, since every application has its own needs - what primitives it offers, how it lets you interact with them, etc. – Kuba hasn't forgotten Monica Oct 29 '13 at 15:18
  • Well, to resume it, then, there's no such widget set at the moment. It's a pity. Thanks anyway! – Renato Oct 31 '13 at 10:35
  • @Renato: If you'd think of the functionality of such a widget, and look around on software that provides similar user interfaces, you'd quickly realize that it is impossible to do much more than `QGraphicsScene` system already does. Everything else is application-specific. – Kuba hasn't forgotten Monica Oct 31 '13 at 12:14