libSBML C API  5.18.0
Polygon_t Class Reference

Detailed Description

render Representation of a Polygon_t

The Polygon_t is very similar to the RenderCurve_t class. The only difference is that in the polygon the end point of the last element in the curve segment list is automatically connected to the start point of the first element.

Since a polygon is a closed shape and doesn't really have a start or an end, it does not get decorations as the RenderCurve_t does. So, a polygon is always closed and can therefore have a fill style and fill style related attributes. Those attributes are inherited from the Polygon_t base class GraphicalPrimitive2D_t.

Public Member Functions

int Polygon_addElement (Polygon_t *p, const RenderPoint_t *rp)
 Adds a copy of the given RenderPoint_t to this Polygon_t. More...
 
Polygon_tPolygon_clone (const Polygon_t *p)
 Creates and returns a deep copy of this Polygon_t object. More...
 
Polygon_tPolygon_create (unsigned int level, unsigned int version, unsigned int pkgVersion)
 Creates a new Polygon_t using the given SBML Level, Version and “render” package version. More...
 
RenderCubicBezier_tPolygon_createCubicBezier (Polygon_t *p)
 Creates a new RenderCubicBezier_t object, adds it to this Polygon_t object and returns the RenderCubicBezier_t object created. More...
 
RenderPoint_tPolygon_createPoint (Polygon_t *p)
 Creates a new RenderPoint_t object, adds it to this Polygon_t object and returns the RenderPoint_t object created. More...
 
void Polygon_free (Polygon_t *p)
 Frees this Polygon_t object. More...
 
RenderPoint_tPolygon_getElement (Polygon_t *p, unsigned int n)
 Get a RenderPoint_t from the Polygon_t. More...
 
ListOf_tPolygon_getListOfElements (Polygon_t *p)
 Returns a ListOf_t * containing RenderPoint_t objects from this Polygon_t. More...
 
unsigned int Polygon_getNumElements (Polygon_t *p)
 Get the number of RenderPoint_t objects in this Polygon_t. More...
 
int Polygon_hasRequiredAttributes (const Polygon_t *p)
 Predicate returning 1 (true) if all the required attributes for this Polygon_t object have been set. More...
 
int Polygon_hasRequiredElements (const Polygon_t *p)
 Predicate returning 1 (true) if all the required elements for this Polygon_t object have been set. More...
 
RenderPoint_tPolygon_removeElement (Polygon_t *p, unsigned int n)
 Removes the nth RenderPoint_t from this Polygon_t and returns a pointer to it. More...
 

Member Function Documentation

int Polygon_addElement ( Polygon_t p,
const RenderPoint_t rp 
)

Adds a copy of the given RenderPoint_t to this Polygon_t.

Parameters
pthe Polygon_t structure to which the RenderPoint_t should be added.
rpthe RenderPoint_t object to add.
Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. The possible values returned by this function are:
Polygon_t * Polygon_clone ( const Polygon_t p)

Creates and returns a deep copy of this Polygon_t object.

Parameters
pthe Polygon_t structure.
Returns
a (deep) copy of this Polygon_t object.
Warning
The pointer that is returned by this function is owned by the caller, who is responsible for deleting it. Any changes made to the element will not be reflected in any resulting SBML document unless the element is added to an SBML Document. Even in this case, the element's deletion is still the responsibility of the caller with two exceptions: if it is used as the "disownedItem" in the ListOf_appendAndOwn() or ListOf_insertAndOwn() functions. All other functions in libsbml add a copy of the element, and do not transfer ownership of the pointer.
Polygon_t * Polygon_create ( unsigned int  level,
unsigned int  version,
unsigned int  pkgVersion 
)

Creates a new Polygon_t using the given SBML Level, Version and “render” package version.

Parameters
levelan unsigned int, the SBML Level to assign to this Polygon_t.
versionan unsigned int, the SBML Version to assign to this Polygon_t.
pkgVersionan unsigned int, the SBML Render Version to assign to this Polygon_t.
Note
Attempting to add an object to an SBMLDocument_t having a different combination of SBML Level, Version and XML namespaces than the object itself will result in an error at the time a caller attempts to make the addition. A parent object must have compatible Level, Version and XML namespaces. (Strictly speaking, a parent may also have more XML namespaces than a child, but the reverse is not permitted.) The restriction is necessary to ensure that an SBML model has a consistent overall structure. This requires callers to manage their objects carefully, but the benefit is increased flexibility in how models can be created by permitting callers to create objects bottom-up if desired. In situations where objects are not yet attached to parents (e.g., SBMLDocument_t), knowledge of the intented SBML Level and Version help libSBML determine such things as whether it is valid to assign a particular value to an attribute. For packages, this means that the parent object to which this package element is being added must have been created with the package namespace, or that the package namespace was added to it, even if that parent is not a package object itself.
Warning
The pointer that is returned by this function is owned by the caller, who is responsible for deleting it. Any changes made to the element will not be reflected in any resulting SBML document unless the element is added to an SBML Document. Even in this case, the element's deletion is still the responsibility of the caller with two exceptions: if it is used as the "disownedItem" in the ListOf_appendAndOwn() or ListOf_insertAndOwn() functions. All other functions in libsbml add a copy of the element, and do not transfer ownership of the pointer.
RenderCubicBezier_t * Polygon_createCubicBezier ( Polygon_t p)

Creates a new RenderCubicBezier_t object, adds it to this Polygon_t object and returns the RenderCubicBezier_t object created.

Parameters
pthe Polygon_t structure to which the RenderCubicBezier_t should be added.
Returns
a new RenderCubicBezier_t object instance.
Note
The pointer that is returned by this function is not owned by the caller, but may be queried and modified. Any changes made will be reflected in any resulting SBML document containing the pointer's parent.
RenderPoint_t * Polygon_createPoint ( Polygon_t p)

Creates a new RenderPoint_t object, adds it to this Polygon_t object and returns the RenderPoint_t object created.

Parameters
pthe Polygon_t structure to which the RenderPoint_t should be added.
Returns
a new RenderPoint_t object instance.
Note
The pointer that is returned by this function is not owned by the caller, but may be queried and modified. Any changes made will be reflected in any resulting SBML document containing the pointer's parent.
void Polygon_free ( Polygon_t p)

Frees this Polygon_t object.

Parameters
pthe Polygon_t structure.
RenderPoint_t * Polygon_getElement ( Polygon_t p,
unsigned int  n 
)

Get a RenderPoint_t from the Polygon_t.

Parameters
pthe Polygon_t structure to search.
nan unsigned int representing the index of the RenderPoint_t to retrieve.
Returns
the nth RenderPoint_t in the ListOfCurveElements_t within this Polygon_t or NULL if no such object exists.
Note
The pointer that is returned by this function is not owned by the caller, but may be queried and modified. Any changes made will be reflected in any resulting SBML document containing the pointer's parent.
ListOf_t * Polygon_getListOfElements ( Polygon_t p)

Returns a ListOf_t * containing RenderPoint_t objects from this Polygon_t.

Parameters
pthe Polygon_t structure whose ListOfCurveElements_t is sought.
Returns
the ListOfCurveElements_t from this Polygon_t as a ListOf_t *.
Note
The pointer that is returned by this function is not owned by the caller, but may be queried and modified. Any changes made will be reflected in any resulting SBML document containing the pointer's parent.
See also
Polygon_addElement()
Polygon_createElement()
Polygon_getElementById()
Polygon_getElement()
Polygon_getNumElements()
Polygon_removeElementById()
Polygon_removeElement()
unsigned int Polygon_getNumElements ( Polygon_t p)

Get the number of RenderPoint_t objects in this Polygon_t.

Parameters
pthe Polygon_t structure to query.
Returns
the number of RenderPoint_t objects in this Polygon_t.
int Polygon_hasRequiredAttributes ( const Polygon_t p)

Predicate returning 1 (true) if all the required attributes for this Polygon_t object have been set.

Parameters
pthe Polygon_t structure.
Returns
1 (true) to indicate that all the required attributes of this Polygon_t have been set, otherwise 0 (false) is returned.
int Polygon_hasRequiredElements ( const Polygon_t p)

Predicate returning 1 (true) if all the required elements for this Polygon_t object have been set.

Parameters
pthe Polygon_t structure.
Returns
1 (true) to indicate that all the required elements of this Polygon_t have been set, otherwise 0 (false) is returned.
Note
The required elements for the Polygon_t object are:
RenderPoint_t * Polygon_removeElement ( Polygon_t p,
unsigned int  n 
)

Removes the nth RenderPoint_t from this Polygon_t and returns a pointer to it.

Parameters
pthe Polygon_t structure to search.
nan unsigned int representing the index of the RenderPoint_t to remove.
Returns
a pointer to the nth RenderPoint_t in this Polygon_t.
Warning
The pointer that is returned by this function is owned by the caller, who is responsible for deleting it. Any changes made to the element will not be reflected in any resulting SBML document unless the element is added to an SBML Document. Even in this case, the element's deletion is still the responsibility of the caller with two exceptions: if it is used as the "disownedItem" in the ListOf_appendAndOwn() or ListOf_insertAndOwn() functions. All other functions in libsbml add a copy of the element, and do not transfer ownership of the pointer.