Polygon or Polyline ??

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
nav17kapur
Posts: 6
Joined: Thu Jul 10, 2008 4:31 pm

Polygon or Polyline ??

Post by nav17kapur »

I noticed that in some cases Draw treats some polylines as polygons (when viewed in the content.xml file of the draw file) . Could someone help me out on what test it uses for a polyline to qualify as a polygon.
OOo 2.3.X on openSuse other + Microsoft Vista
User avatar
Hagar Delest
Moderator
Posts: 32658
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: Polygon or Polyline ??

Post by Hagar Delest »

Are you sure it's a Macro question?
What have you in mind exactly?
LibreOffice 7.6.2.1 on Xubuntu 23.10 and 7.6.4.1 portable on Windows 10
nav17kapur
Posts: 6
Joined: Thu Jul 10, 2008 4:31 pm

Re: Polygon or Polyline ??

Post by nav17kapur »

I am working on something that involves interpreting the content.xml file that Draw constructs. I was having a few problems in this regard. I tried to use the method I use to draw polylines for polygons but I was not able to make the first and the last points the same and still, reading the aforementioned XML file, I found that Draw interprets it as a polygon rather than a polyline even though the first and last points were not the same....

So, I just wanted to know how Draw interprets a particular polyline(with end-points close but not the same) as a polygon.
OOo 2.3.X on openSuse other + Microsoft Vista
B Marcelly
Volunteer
Posts: 1160
Joined: Mon Oct 08, 2007 1:26 am
Location: France, Paris area

Re: Polygon or Polyline ??

Post by B Marcelly »

Hi,
From the programming point of view, a broken line is created as an instance of the service com.sun.star.drawing.PolyLineShape.
The same broken line (with distinct start point and end point) becomes a closed polygon if it is created as an instance of the service com.sun.star.drawing.PolyPolygonShape.

______
Bernard
Post Reply