List of rectangles of type Rect.

You will find a general example for the use of rectlist here.

List of rectangles of type Rect.

static RectList alloc()

Create a new empty list of type RectList. The list must again be deleted using RectList::release.

Name Type Default Description
Return RectList   New empty RectList
int wrect (Rect r, char * trailer)
{
    if (strlen (trailer))	wlog ("", "%s	", trailer);
wlog ("", "%f, %f, %f, %f\n",   rect::left (r),   rect::top (r),   rect::right (r),   rect::bottom (r));
return 0; }
int wrectlist (RectList rl, char * trailer) { Rect r;
if (strlen (trailer)) wlog ("", "%s\n", trailer);
for (r = rectlist::first (rl); r; r = rectlist::next (rl)) { wrect (r, " "); }
return 0; }
int main () { Rect r1 = rect::alloc (0.0, 0.0, 100.0, 200.0); Rect r2 = rect::alloc (80.0, 90.0, 110.0, 210.0); Rect r3 = rect::alloc (80.0, 90.0, 400.0, 500.0); Rect intersect = rect::alloc (); RectList rl = rectlist::alloc ();
rectlist::append (rl, r1); rectlist::append (rl, r2); rectlist::append (rl, r3); wrectlist (rl, "RectList");
rectlist::bbox (rl, intersect); wrect (intersect, "BBox of rectlist");
return 0; }

Version 3.1 R2210, 29.11.2010

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static int release(RectList li)

Delete a list again that was created with RectList::alloc.

Name Type Default Description
li RectList - List to be deleted

Version 3.1 R2210, 29.11.2010

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static int length(RectList li)

Ascertain the number of elements of a list.

Name Type Default Description
Return int   Number of entries in the list
li RectList - List

Version 3.1 R2210, 29.11.2010

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static Rect first(RectList li)

Get the first non-empty entry record of a given RectList. If nor more etries can found, the function returns the value 0.

Name Type Default Description
Return Rect   First value of the list.
li RectList - List with at least one element
The current list pointer is located at the start of the list. Further values can be fetched using next or last.
int wrect (Rect r, char * trailer)
{
    if (strlen (trailer))	wlog ("", "%s	", trailer);
wlog ("", "%f, %f, %f, %f\n",   rect::left (r),   rect::top (r),   rect::right (r),   rect::bottom (r));
return 0; }
int wrectlist (RectList rl, char * trailer) { Rect r;
if (strlen (trailer)) wlog ("", "%s\n", trailer);
for (r = rectlist::first (rl); r; r = rectlist::next (rl)) { wrect (r, " "); }
return 0; }
int main () { Rect r1 = rect::alloc (0.0, 0.0, 100.0, 200.0); Rect r2 = rect::alloc (80.0, 90.0, 110.0, 210.0); Rect r3 = rect::alloc (80.0, 90.0, 400.0, 500.0); Rect intersect = rect::alloc (); RectList rl = rectlist::alloc ();
rectlist::append (rl, r1); rectlist::append (rl, r2); rectlist::append (rl, r3); wrectlist (rl, "RectList");
rectlist::bbox (rl, intersect); wrect (intersect, "BBox of rectlist");
return 0; }

Version 3.1 R2210, 29.11.2010

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static Rect next(RectList li)

Get the next record of a given list. If nor more etries can found, the function returns the value 0.

Name Type Default Description
Return Rect   Next value of the list.
li RectList - List with at least one element after the current list pointer
Current list pointer with first, get_pos or get set and not the last element of the list
Current list pointer is relocated one position onwards
int wrect (Rect r, char * trailer)
{
    if (strlen (trailer))	wlog ("", "%s	", trailer);
wlog ("", "%f, %f, %f, %f\n",   rect::left (r),   rect::top (r),   rect::right (r),   rect::bottom (r));
return 0; }
int wrectlist (RectList rl, char * trailer) { Rect r;
if (strlen (trailer)) wlog ("", "%s\n", trailer);
for (r = rectlist::first (rl); r; r = rectlist::next (rl)) { wrect (r, " "); }
return 0; }
int main () { Rect r1 = rect::alloc (0.0, 0.0, 100.0, 200.0); Rect r2 = rect::alloc (80.0, 90.0, 110.0, 210.0); Rect r3 = rect::alloc (80.0, 90.0, 400.0, 500.0); Rect intersect = rect::alloc (); RectList rl = rectlist::alloc ();
rectlist::append (rl, r1); rectlist::append (rl, r2); rectlist::append (rl, r3); wrectlist (rl, "RectList");
rectlist::bbox (rl, intersect); wrect (intersect, "BBox of rectlist");
return 0; }

Version 3.1 R2210, 29.11.2010

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static Rect prev(RectList li)

Get the previous record of a given list. If nor more etries can found, the function returns the value 0.

Name Type Default Description
Return Rect   Preceding value in the list.
li RectList - List with at least one element after the current list pointer
Current list pointer with first, get_pos or get set and not the last element of the list
Current list pointer is relocated one position backwards

Version 3.1 R2210, 29.11.2010

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static Rect last(RectList li)

Get the last non-empty record of a given list. If nor more etries can found, the function returns the value 0.

Name Type Default Description
Return Rect   Last value of the list.
li RectList - List with at least one element
The current list pointer is located at the end of the list. Further values can be fetched using prev or first.

Version 3.1 R2210, 29.11.2010

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static int get_pos(
  RectList li,
  Rect val,
  int setPos = 0)

Search for the first position of a value in the list. If the value is not found, the function returns -1. List positions are 0-based, the first element has the position 0, the final the position length-1.

Name Type Default Description
Return int   >= 0 : First occurrence of a value in the list
-1 : Value not found
li RectList - List in which the value is to be search for
val Rect - This value is searched for
setPos int 0 0 : Leave list positions unchanged
1 : Set current list position at the point of finding
If the value was found in the list and setPos is > 0, the current list position is located at the point of finding.

Version 3.1 R2210, 29.11.2010

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static int get_pos_by_value(
  RectList li,
  float l,
  float t,
  float r,
  float b,
  int setPos = 0)

Search for the first position of a value in the list. If the value is not found, the function returns -1. List positions are 0-based, the first element has the position 0, the final the position length-1.

Name Type Default Description
Return int   >= 0 : First occurrence of a value in the list
-1 : Value not found
li RectList - List in which the value is to be search for
l, t, r, b float, float, float, float - left, top, right, bottom components of the rectangle
setPos int 0 0 : Leave list positions unchanged
1 : Set current list position at the point of finding
If the value was found in the list and setPos is > 0, the current list position is located at the point of finding.

Version 3.1 R2210, 29.11.2010

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static Rect get(
  RectList li,
  int pos,
  int setPos= 0)

Get the i-th element of the list. Wird kein Eintrag in der Liste gefunden, gibt die Funktion den Wert 0 zurück. List positions are 0-based, the first element has the position 0, the final the position length-1.

Name Type Default Description
Return Rect   Value of the list at the position i or 0.
li RectList - List from which the element is to be fetched
pos int - 0-based list position
setPos int 0 0 : Leave list positions unchanged
1 : Set current list position to pos
If setPos > 0, the current list position is located at pos.

Version 3.1 R2210, 29.11.2010

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static Rect append(RectList li, Rect f)

Append a value to the list.

Name Type Default Description
Return Rect   appended value or 0
li RectList - List to which the append is to be made
f Rect - value to append

Version 3.1 R2210, 29.11.2010

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

append_by_value
insert
insert_by_value

static Rect append_by_value(
  RectList li,
  float l,
  float t,
  float r,
  float b)

Append a rectangle given by its components to the list.

Name Type Default Description
Return Rect   appended value or 0
li RectList - List to which the append is to be made
l, t, r, b float, float, float, float - left, top, right, bottom components of the rectangle

Version 3.1 R2210, 29.11.2010

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

append
insert
insert_by_value

static Rect insert(
  RectList li,
  int pos,
  Rect f)

Insert a value into the list.

Name Type Default Description
Return Rect   inserted value or 0
li RectList - List to which the insertion is to be made
pos int - 0-based position of inserted value
f Rect - value to insert

Version 3.1 R2210, 29.11.2010

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

append
append_by_value
insert_by_value

static Rect insert_by_value(
  RectList li,
  int pos,
  float l,
  float t,
  float r,
  float b)

Insert a rectangle given by its components into the list.

Name Type Default Description
Return Rect   appended value or 0
li RectList - List to which the append is to be made
pos int - 0-based position of inserted value
l, t, r, b float, float, float, float - left, top, right, bottom components of the rectangle

Version 3.1 R2210, 29.11.2010

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

append
append_by_value
insert

static Rect remove(RectList li, Rect val)

Remove the first occurence of an given value from the list.

Name Type Default Description
Return int   removed value or 0
li RectList - List from which the remove is to be made
val Rect - Value to be removed from the list

Version 3.1 R2210, 29.11.2010

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

remove_by_value

static Rect remove_by_value(
  RectList li,
  float l,
  float t,
  float r,
  float b)

Remove the first occurence of a rectangle givem by its components from the list.

Name Type Default Description
Return int   removed value or 0
li RectList - List from which the remove is to be made
l, t, r, b float, float, float, float - left, top, right, bottom components of the rectangle

Version 3.1 R2210, 29.11.2010

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

remove

static Rect remove_pos(RectList li, int pos)

Remove a position from the list. List positions are 0-based, the first element has the position 0, the final the position length-1.

Name Type Default Description
Return Rect   removed value or 0
li RectList - List
pos int - 0-based delete position
id	= RectList::remove_pos (0);
if (id) rect::release (id);

Version 3.1 R2210, 29.11.2010

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static int clear(RectList li)

Remove all elements of the list

Name Type Default Description
Return int   1 : Action successful
0 : otherwise
li RectList - List

Version 3.1 R2210, 29.11.2010

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static int bbox(RectList li, Rect res)

Get the rectangles bounding box.

Name Type Default Description
Return int   0 or ErrorCode
li RectList - list to sort
res Rect - allocated Rect for the result
int wrect (Rect r, char * trailer)
{
    if (strlen (trailer))	wlog ("", "%s	", trailer);
wlog ("", "%f, %f, %f, %f\n",   rect::left (r),   rect::top (r),   rect::right (r),   rect::bottom (r));
return 0; }
int wrectlist (RectList rl, char * trailer) { Rect r;
if (strlen (trailer)) wlog ("", "%s\n", trailer);
for (r = rectlist::first (rl); r; r = rectlist::next (rl)) { wrect (r, " "); }
return 0; }
int main () { Rect r1 = rect::alloc (0.0, 0.0, 100.0, 200.0); Rect r2 = rect::alloc (80.0, 90.0, 110.0, 210.0); Rect r3 = rect::alloc (80.0, 90.0, 400.0, 500.0); Rect intersect = rect::alloc (); RectList rl = rectlist::alloc ();
rectlist::append (rl, r1); rectlist::append (rl, r2); rectlist::append (rl, r3); wrectlist (rl, "RectList");
rectlist::bbox (rl, intersect); wrect (intersect, "BBox of rectlist");
return 0; }

Version 3.1 R2210, 29.11.2010

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

int wrect (Rect r, char * trailer)
{
    if (strlen (trailer))	wlog ("", "%s	", trailer);
wlog ("", "%f, %f, %f, %f\n",   rect::left (r),   rect::top (r),   rect::right (r),   rect::bottom (r));
return 0; }
int wrectlist (RectList rl, char * trailer) { Rect r;
if (strlen (trailer)) wlog ("", "%s\n", trailer);
for (r = rectlist::first (rl); r; r = rectlist::next (rl)) { wrect (r, " "); }
return 0; }
int main () { Rect r1 = rect::alloc (0.0, 0.0, 100.0, 200.0); Rect r2 = rect::alloc (80.0, 90.0, 110.0, 210.0); Rect r3 = rect::alloc (80.0, 90.0, 400.0, 500.0); Rect intersect = rect::alloc (); RectList rl = rectlist::alloc ();
rectlist::append (rl, r1); rectlist::append (rl, r2); rectlist::append (rl, r3); wrectlist (rl, "RectList");
rectlist::bbox (rl, intersect); wrect (intersect, "BBox of rectlist");
return 0; }

Since
Version 3.1 R2210, 29.11.2010
See Also
rect

Alphabetic index HTML hierarchy of classes or Java