On Tue, Oct 28, 2008 at 2:50 AM, Klaas Holwerda wrote: >> Bionic Badger wrote: >> >> I have a few new problems. I'm using the WriteSVG() function of the >> a2dCanvas with some canvas objects that use pins and visible >> properties. > > > I will add: > if( object->IsTemporary_DontSave()) > return; > > Pins and handles have this property, and will not be saved anymore.
Cool, thanks! > I've also made my curves use splines instead of straight >> >> lines, and these are also not rendered in the SVG. > > What curves? Polygon? > > Maybe there is a bug. > > > I see at least some lpoints->ConvertSplinedPolygon(10) in there. Here is the application: http://img100.imageshack.us/my.php?image=20081028030002rq4.png And here is the rendering (in Firefox): http://img100.imageshack.us/my.php?image=20081028030641ot3.png This also shows what happens to the text. Those circles are about 6 units wide, and the font should be 3.0 and 2.0pts for the top and bottom text respectively. I did check the source code for the SVGIO, and it does know that the a2dWirePolylineL is a spline. Is the aberration value too high or low (it's set to 10), or does it need to be scaled to the SVG "device" coordinates? I didn't manage to test it (I'm really tired at the moment and even this email is keeping me up too late), but that's the only thing I can see that would be different since the a2dDrawer2D version changes the value according to the view. The drawing above only uses four points to define the spline. I did notice in the a2dDrawer2D, there is a minimum THRESHOLD variable set to five (5) in a2dDrawer2D::ConvertSplinedPolygon2 a2dDrawer2D::ConvertSplinedPolyline2 They also seem to not make complete of the THRESHOLD constant in the conditional, which they should (to avoid those magic numbers). Also, it might be good to use the aberration value the user has set on the drawer in rendering the spline. I'll also look into how the native SVG curve drawing facilities might be usable for drawing mathematically perfect splines. >> >> Is there any setting to have the SVG renderer scale the graphics >> correctly (especially the text), > > I don't understand, text should not be a problem. > Maybe send be a screen shot to understand your problem? Okay, I think I've found a solution for the text: The font-size for text needs to have "pt" units in order to render at the correct size. However, after using the "pt" units, the text was still mis-positioned. This was because the text's alignment was not taken into consideration. The default horizontal text alignment for the text-properties in wxArt2d is centered, whereas the default alignment for SVG is "left". We can render this in SVG by using the "text-anchor" style attribute which can take on "start", "middle", "end" for left, center, and right respectively (wxLEFT, wxCENTER, wxRIGHT). Likewise, the vertical alignment needs to be specified. The default vertical alignment in SVG aligns text from its baseline. When text is aligned with wxTOP (i.e. "property->SetAlignment(wxTOP)" ), there is no need to add anything. However, with with wxBOTTOM there needs to be a "baseline-shift:-100%", and with wxMIDDLE, I assume it would be "baseline-shift:-50%". So, for example, the right A and G2 in the image would be represented as: <g id="5000984" transform="matrix( 1.000000 0.000000 0.000000 1.000000 0.000000 3.500000 )" style = " stroke:#000000; stroke-width:0.000000; fill:none; " > <text x="0" y="0" style="font-family:Verdana; font-size:2.000000pt; fill:#000000; stroke:#000000; text-anchor:middle; baseline-shift:-100%;" >G2 </text> </g> <g id="5012493" transform="matrix( 1.000000 0.000000 0.000000 1.000000 0.000000 -4.000000 )" style = " stroke:#800000; stroke-width:0.000000; fill:none; " > <text style="font-family:Verdana; font-size:3.000000pt; fill:#800000; stroke:#800000; text-anchor:middle">A </text> </g> The above almost exactly replicates the graphics on the wxArt2D canvas. I don't have the facilities at the moment to add a patch myself, but I think I'll get myself set up to do that so I can submit patches like the above if needed in the future. > a2dPin pin not. it has no size in world, only a m_pixelExtend. > See a2dPin::DoUpdate() > > But you might be able to derived, and develop your own pin. > > Still i wonder what you are using the pins for. Normally no one wants them > to zoom. Actually I'm using the pins more as a convenience for now, not so much for interactive connecting, though that's planned for the future. Rather than have me render static "pins" I thought to use the real ones, but I might switch to static ones so that the image looks the same all the time. ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Wxart2d-users_dev mailing list Wxart2d-users_dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wxart2d-users_dev