DiagramElementPolygon Class Reference

#include <diagramelementpolygon.h>

Inheritance diagram for DiagramElementPolygon:

AbstractDiagramElementAttribute AbstractElementAttribute DomAccessibleState List of all members.

Public Member Functions

 DiagramElementPolygon (AbstractElement *parent, const QPolygonF &polygon=QPolygonF())
 DECLARE_CLASS_TYPE (MvcDiagram::DEA_Polygon)
 DECLARE_CLASS_KEY ("polygon")
 DECLARE_CLASS_TITLE ("Polygon")
const QPolygonF & polygon () const
void setPolygon (const QPolygonF &polygon)

Protected Member Functions

QString worker_toString () const
bool worker_setData (const QString &data)
QVariant worker_toVariant () const
bool worker_setData (const QVariant &data)

Detailed Description

This is a position attribute that can be added to an AbstractDiagramElement.


Constructor & Destructor Documentation

DiagramElementPolygon::DiagramElementPolygon ( AbstractElement parent,
const QPolygonF &  polygon = QPolygonF() 
)


Member Function Documentation

DiagramElementPolygon::DECLARE_CLASS_TYPE ( MvcDiagram::DEA_Polygon   ) 

DiagramElementPolygon::DECLARE_CLASS_KEY ( "polygon"   ) 

DiagramElementPolygon::DECLARE_CLASS_TITLE ( "Polygon"   ) 

const QPolygonF& DiagramElementPolygon::polygon (  )  const [inline]

void DiagramElementPolygon::setPolygon ( const QPolygonF &  polygon  )  [inline]

QString DiagramElementPolygon::worker_toString (  )  const [protected, virtual]

Returns the polygon as a QString.

The format of the string allows for extensibility, as each field is explicitly stated as a "tag" (like XML element attributes). However, as compactness is important for storage, the fields values are not grouped by QPoint. Instead they are stored as a vector for each field type for each point. This format makes it easy to fetch data from specific fields without having to parse all of the data (e.g. parse only "x" and "y", not "z").

Also of note: field values and field vectors are separated using single characters, not brackets (they being ",", ";", respectively). The decision to not use bracketing wasn't driven by compactness (although that is a nice side-effect), but instead by the ease of parsing, given the availability of a "split-on" function.

Lastly, a textual string has been used instead of binary data, as this code is designed to be cross platform, where the database could reside on a machine of any architecture, communicating with a client of also any architecture. It also makes the data (mildly) human-readable.

Example:

   "x=0,1,2,1,2;y=3,1,2,4,5;"

Implements AbstractElementAttribute.

bool DiagramElementPolygon::worker_setData ( const QString &  data  )  [protected, virtual]

Sets the polygon using the co-ordinates in the given data string.

This method parses data that has been generated using toString().

Implements AbstractElementAttribute.

QVariant DiagramElementPolygon::worker_toVariant (  )  const [protected, virtual]

Called and made thread-safe by toVariant().

Implements AbstractElementAttribute.

bool DiagramElementPolygon::worker_setData ( const QVariant &  data  )  [protected, virtual]

Called and made thread-safe by setData(const QVariant&).

Implements AbstractElementAttribute.


The documentation for this class was generated from the following files:
Generated on Mon Jul 30 09:46:52 2007 for Digest by  doxygen 1.5.2