Drawing: SVG and Browser Views
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
Be nice to others! Read the FreeCAD code of conduct!
- wandererfan
- Veteran
- Posts: 6270
- Joined: Tue Nov 06, 2012 5:42 pm
- Contact:
Drawing: SVG and Browser Views
In the current Drawing module, what are
- Open SVG
- Open Page in Browser View
used for? Are they worth moving to the new (mrlukeparry) Drawing module? Or do they just duplicate function that is available in other apps?
wf
OS: Ubuntu 12.04.5 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.15.4263 (Git)
Branch: master
Hash: 7801fbef3a4442915c1897f9e8c3b9430373d0a0
Python version: 2.7.3
Qt version: 4.8.1
Coin version: 3.1.3
OCC version: 6.7.0
- Open SVG
- Open Page in Browser View
used for? Are they worth moving to the new (mrlukeparry) Drawing module? Or do they just duplicate function that is available in other apps?
wf
OS: Ubuntu 12.04.5 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.15.4263 (Git)
Branch: master
Hash: 7801fbef3a4442915c1897f9e8c3b9430373d0a0
Python version: 2.7.3
Qt version: 4.8.1
Coin version: 3.1.3
OCC version: 6.7.0
- microelly2
- Veteran
- Posts: 4688
- Joined: Tue Nov 12, 2013 4:06 pm
- Contact:
Re: Drawing: SVG and Browser Views
is needed to display hatch patternOpen Page in Browser View
viewtopic.php?f=9&t=4264&p=64366&hilit=hatch#p64366
Re: Drawing: SVG and Browser Views
Didn't Luke use a new Qt viewer? If so, the "Open page in browser view" may not be necessary anymore.
As for Open SVG, it may be useful to be able to open an SVG in the Drawing module. After all, you can export a Drawing page as SVG, it seems logical you should be able to open it back as a drawing, not in the 3D space.
As for Open SVG, it may be useful to be able to open an SVG in the Drawing module. After all, you can export a Drawing page as SVG, it seems logical you should be able to open it back as a drawing, not in the 3D space.
- wandererfan
- Veteran
- Posts: 6270
- Joined: Tue Nov 06, 2012 5:42 pm
- Contact:
Re: Drawing: SVG and Browser Views
Don't think you can import the svg as a "drawing" now. It is display only as far as I can tell.normandc wrote:After all, you can export a Drawing page as SVG, it seems logical you should be able to open it back as a drawing, not in the 3D space.
I'll look into the hatch pattern thing.
wf
Re: Drawing: SVG and Browser Views
IIRC hatch pattern is only one example where the Qt viewer is lacking. It cannot display stacked text either, and possibly other stuff.
Re: Drawing: SVG and Browser Views
Actually the "Open SVG" button dates from when the Drawing WB only had that button Indeed it could be removed now, I don't think anyone uses that... Or maybe go to the image WB? It makes more sense there...
The "open in Browser" is indeed there because of the limitations of the QtSVG library, that is currently used in the Drawing WB. It supports only a small subset of the SVG specs (called "tinySVG"). The Webkit browser, however, that is used in the Web WB, has one of the best supports to SVG available. As a result, many interesting features (multiline texts, hatches, gradients, etc...) won't render correctly in the Drawing WB, but perfectly in the web WB, that's why I added that button.
Of course, at some point, we should make the transition of the DrawingWB to webkit. But it's not that simple. Luke's work doesn't use webkit either, for that reason: The problem is that the QtSVG stuff is deeply integrated in Qt. The display and even the elements inside the SVG image can be hooked to the whole Qt structure, so you can manage them, link them to Qt events, etc. The Qt implementation of webkit, however (QWebkit) is very simple, it only gives a few tools to display web content (including SVG) inside a Qt window. There are only very minimalist controls on the contents of that window from Qt. So basically for all the cool stuff that luke and hamish have done (moving things graphically, etc) to work in QWebkit, we would need to code a lot of base funcionality ourselves, which is no small work.
So yeah, no easy way out of this...
The "open in Browser" is indeed there because of the limitations of the QtSVG library, that is currently used in the Drawing WB. It supports only a small subset of the SVG specs (called "tinySVG"). The Webkit browser, however, that is used in the Web WB, has one of the best supports to SVG available. As a result, many interesting features (multiline texts, hatches, gradients, etc...) won't render correctly in the Drawing WB, but perfectly in the web WB, that's why I added that button.
Of course, at some point, we should make the transition of the DrawingWB to webkit. But it's not that simple. Luke's work doesn't use webkit either, for that reason: The problem is that the QtSVG stuff is deeply integrated in Qt. The display and even the elements inside the SVG image can be hooked to the whole Qt structure, so you can manage them, link them to Qt events, etc. The Qt implementation of webkit, however (QWebkit) is very simple, it only gives a few tools to display web content (including SVG) inside a Qt window. There are only very minimalist controls on the contents of that window from Qt. So basically for all the cool stuff that luke and hamish have done (moving things graphically, etc) to work in QWebkit, we would need to code a lot of base funcionality ourselves, which is no small work.
So yeah, no easy way out of this...
Re: Drawing: SVG and Browser Views
If the QtSVG only renders a well-defined subset, then we probably need some kind of translator.
Like something that can convert hatches to basic paths.
Like something that can convert hatches to basic paths.
Re: Drawing: SVG and Browser Views
That's not a bad idea actually... The same can be made for ex. for multiline texts. It'll fall short for some things (gradients, etc) but most of the useful stuff could be converted.shoogen wrote:If the QtSVG only renders a well-defined subset, then we probably need some kind of translator.
Like something that can convert hatches to basic paths.
-
- Posts: 655
- Joined: Fri Jul 22, 2011 8:37 pm
- Contact:
Re: Drawing: SVG and Browser Views
My implementation used QGraphicsView which allows interactivity at a c++ level.
I wouldn't advise using QtSVG because it's an extra 'addon' module in Qt and I don't think it's being update / maintained in the long term, especially when it comes to Qt5.
Qt5.3 brings a new Qt Webkit engine that will be far more up to date but it apparently supports hooking in into c++.
It would actually be useful to add the Open SVG in my branch because it should natively export to SVG and also PDF.
I wouldn't advise using QtSVG because it's an extra 'addon' module in Qt and I don't think it's being update / maintained in the long term, especially when it comes to Qt5.
Qt5.3 brings a new Qt Webkit engine that will be far more up to date but it apparently supports hooking in into c++.
It would actually be useful to add the Open SVG in my branch because it should natively export to SVG and also PDF.
Development blog - http://freecadamusements.blogspot.co.uk/
Re: Drawing: SVG and Browser Views
Interesting, I wasn't aware that in your branch you were not using QtSVG anymore...mrlukeparry wrote:My implementation used QGraphicsView