Issue 41343 - command a(elliptical arc) in svg:d should be supported
Summary: command a(elliptical arc) in svg:d should be supported
Status: CLOSED FIXED
Alias: None
Product: gsl
Classification: Code
Component: code (show other issues)
Version: OOo 1.0.0
Hardware: All All
: P5 (lowest) Trivial with 6 votes (vote)
Target Milestone: OOo 3.0
Assignee: Armin Le Grand
QA Contact: issues@gsl
URL:
Keywords: oooqa
Depends on:
Blocks: 2497
  Show dependency tree
 
Reported: 2005-01-26 10:11 UTC by wilson_guo
Modified: 2008-08-05 13:57 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description wilson_guo 2005-01-26 10:11:58 UTC
I am working for the importing of word xml to OOo and there is six commands
(ae, al, at, ar, wa and wr.) in wordml which are responsible for the drawing of
elliptical arc.
    I have to support these commands, 
    so I need svg:d parser to support an a-command, which means the parser
should have drawn a segment of elliptical arc on the screen if the parser meets
the following OOo xml string : svg:d="M600,350 a25,25 -30 0,1 50,-25 l 50,-25".
    No arc is shown now even if I legally use this svg command.
    So I want the parser to support an a-command but don't know how.
    I can do something to let the parser support the a-command,but need some hint.
    Somebody get the issue 
    orleave it to me and tell me which part of program I should check.
Comment 1 christof.pintaske 2005-01-26 17:51:00 UTC
cp->aw: I don't have the slightest clue about that so I just hope you are
smarter than me
Comment 2 Armin Le Grand 2005-01-31 19:54:17 UTC
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.
Comment 3 Armin Le Grand 2005-02-03 17:59:16 UTC
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).
Comment 4 wilson_guo 2005-02-23 08:07:41 UTC
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;
Comment 5 wilson_guo 2005-02-24 07:21:03 UTC
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!!??!!
Comment 6 Armin Le Grand 2005-02-24 16:45:17 UTC
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.
Comment 7 lohmaier 2005-07-31 22:42:46 UTC
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.
Comment 8 Armin Le Grand 2005-08-04 11:08:21 UTC
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.
Comment 9 lohmaier 2005-08-04 11:36:24 UTC
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.
Comment 10 Armin Le Grand 2005-08-05 10:25:17 UTC
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.
Comment 11 pagalmes.lists 2007-03-06 10:03:26 UTC
any news?
Comment 12 thb 2008-06-03 17:24:21 UTC
Grabbing this one
Comment 13 thb 2008-06-03 17:26:12 UTC
Fixed in CWS canvas05, as part of the svg import work (see
http://blog.thebehrens.net/2008/05/30/recent-progress-on-svg-import/)
Comment 14 thb 2008-06-03 17:34:16 UTC
@aw: please verify in CWS canvas05 that the b2dsvgpolypolgon.cxx importFromSvgD
parser now supports a/A commands.
Comment 15 Armin Le Grand 2008-06-04 14:22:43 UTC
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).
Comment 16 thb 2008-06-04 16:42:29 UTC
@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.
Comment 17 Armin Le Grand 2008-06-04 17:02:03 UTC
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.
Comment 18 Armin Le Grand 2008-08-05 13:57:24 UTC
AW: Closing