Apache OpenOffice (AOO) Bugzilla – Full Text Issue Listing |
Summary: | command a(elliptical arc) in svg:d should be supported | ||
---|---|---|---|
Product: | gsl | Reporter: | wilson_guo <wilson.guo> |
Component: | code | Assignee: | Armin Le Grand <Armin.Le.Grand> |
Status: | CLOSED FIXED | QA Contact: | issues@gsl <issues> |
Severity: | Trivial | ||
Priority: | P5 (lowest) | CC: | Armin.Le.Grand, issues, lohmaier, pagalmes.lists |
Version: | OOo 1.0.0 | Keywords: | oooqa |
Target Milestone: | OOo 3.0 | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | DEFECT | Latest Confirmation in: | --- |
Developer Difficulty: | --- | ||
Issue Depends on: | |||
Issue Blocks: | 2497 |
Description
wilson_guo
2005-01-26 10:11:58 UTC
cp->aw: I don't have the slightest clue about that so I just hope you are smarter than me AW: The code for svg:d import and export is in xmloff as a helper class. The helper class converts between PolyPolygons and svg:d, so the exchange format is a PolyPolygon where edges may be cubic beziers. This means that a 'a' command is at the moment converted just to a straight edge, but could be changed to something like 4 edges of cubic beziers to represent the arc. This also means that there is no way to get back the 'a' command when exporting (saving) again. You may add extended import code to do the 4Edge cubic bezier representation in the polygon, though. There should be a switch...case where the 'c' (and 'C') case just adds one edge to the end point of the arc. AW->wilson_guo: Code is in xmloff/source/core/xexptran.cxx. You may add code to better represent imported 'a' commands if it's urgent. Else it's on our list for OOo3 anyways (but this may take some time). I checked the source code of the file xexptran.cxx and have got some ideas about how to let the OOo support the command a. And I also noticed that there are 3 cycles in the method SdXMLImExSvgDElement::SdXMLImExSvgDElement(const OUString& rNew,.. The 1st one is for count the poly and get the flags. The 2nd one is for counting the point count and then the pointcount is used to allot the memory. The 3rd one is for the insert of the symbol polygons (I think), which inserts the combination of points and flags(represent the drawing elements). All these are guessed by me, after I read the source code, because I couldn’t find the documents of this part. I also don’t know which kind of symbol polygons I should insert, I mean the combination of points and flags that represents the arc elements. Could someone give me the documents? Just like the following codes, a 'Q' command is supported by adding the points and PolygonFlags like this: Imp_AddExportPoints(nX1, nY1, pInnerSequence, pInnerFlags, nInnerIndex++, drawing::PolygonFlags_CONTROL); I need the flags of an a command but no documents!!??!! __Code of Command ‘Q’ is as following:… case 'Q' : { nPos++; Imp_SkipSpaces(aStr, nPos, nLen); while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos)) { …… if(bRelative)…… // calc transform for new points Imp_PrepareCoorImport(nXX, nYY, rObjectPos, rObjectSize… Imp_PrepareCoorImport(nX, nY, rObjectPos, rObjectSize, mrViewBox, …); // calculate X1,X2 awt::Point aPPrev1 = (nInnerIndex) ? pInnerSequence[nInnerIndex-1] : pInnerSequence[0]; sal_Int32 nX1 = FRound((double)((nXX * 2) + aPPrev1.X) / 3.0); sal_Int32 nY1 = FRound((double)((nYY * 2) + aPPrev1.Y) / 3.0); sal_Int32 nX2 = FRound((double)((nXX * 2) + nX) / 3.0); sal_Int32 nY2 = FRound((double)((nYY * 2) + nY) / 3.0); // correct polygon flag for previous point Imp_CorrectPolygonFlag(nInnerIndex, pInnerSequence, pInnerFlags, nX1, nY1); // add new points and set flags Imp_AddExportPoints(nX1, nY1, pInnerSequence, pInnerFlags, nInnerIndex++, drawing::PolygonFlags_CONTROL); Imp_AddExportPoints(nX2, nY2, pInnerSequence, pInnerFlags, nInnerIndex++, drawing::PolygonFlags_CONTROL); Imp_AddExportPoints(nX, nY, pInnerSequence, pInnerFlags, nInnerIndex++, drawing::PolygonFlags_SMOOTH); } break; Could someone give me the documents? Just like the following codes, a 'Q' command is supported by adding the points and PolygonFlags like this: Imp_AddExportPoints(nX1, nY1, pInnerSequence, pInnerFlags, nInnerIndex++, drawing::PolygonFlags_CONTROL); I need the flags of an a command but no documents!!??!! AW: You are at the right code. Three loops are needed since the vcl-class Polygon and PolyPolygon needs the pint number at construction time. Please take a look at VCL-class Polygon in project VCL, it's data types and flag values. The VCL polygon supports integer point pairs and each point can have a flag value if it's a control point or how the continuity in this Point is. So the rule PCCP (Point, ControlPoint) has to be followed by hand, the polygon data structure does not force You to correct data. So it's somewhat dangerous, because You may create invalid VCL Polygons... We have a better polygon in class basegfx and it's on our list to convert svg:d import/export to use that (it's safe and doble precision), but due to bug fixing it will not be in SO8, but in SO9. HTH. as this issue is being worked on, it should not be in "unconfirmed" state. Please accept the issue (set it to started) if you intend to further look into this. AW->cloph: No, i do not intend doing this at the moment. As i said, this will
probably be obsolete when we go to OOo3.0 and use another polygon class
completely with better svg im/export.
This issue is about adding it to the current code, that's why i gave You help
where/how to add and explained why i will not do it at the moment.
So, taking a snippet of the initial text from wilson_guo:
>Somebody get the issue
>orleave it to me and tell me which part of program I should check.
Feel free to send this to wilson_guo for implementing. If You need more
explanations, feel free to ask again.
no reason to assign this to me. My comment was adressed to wilson_guo as the issue has been assigned to him. My main interest was to correct the status from "unconfirmed" to the actual status. At least it is "New". If someone is actively working on it, it should be set to started. AW: OOps. Maybe i went wrong, but i did take the action, because it was assigned to me ?! Maybe i got that wrong, sorry for re-assigning then. any news? Grabbing this one Fixed in CWS canvas05, as part of the svg import work (see http://blog.thebehrens.net/2008/05/30/recent-progress-on-svg-import/) @aw: please verify in CWS canvas05 that the b2dsvgpolypolgon.cxx importFromSvgD parser now supports a/A commands. AW->THB: I think in lcl_importNumberAndSpaces the lcl_skipSpacesAndCommas at the end should be triggered without condition, please compare with lcl_importDoubleAndSpaces. ATM in Your code spaces are only consumed when a number was imported. The calls for number import get called assuming read head is on a number char and is forwarded to the next. If the method gets called on a space it will block since it will not proceed to the next potential number (like lcl_importDoubleAndSpaces does). @aw: yep, and that's the correct behaviour. Check the call sites of lcl_importNumberAndSpaces(), it's guaranteed that all whitespace has been consumed before. The parser will fail, anyway, if the mentioned condition is not satisfied. AW->THB: With the start condition this is true. I just thought it expresses the need to consume trailing blanks up to the next data better when doing it without condition, but it's not necessary. Setting to verified. AW: Closing |