We have moved to https://dokuwiki.librecad.org/
Lots of content was already moved to the new wiki, but there is still work to do. If you want to contribute, please register a new account at https://dokuwiki.librecad.org/
This wiki will be kept for a while to keep search engine results valid. Moved sites may be deleted here in future.
Difference between revisions of "Document Interface class"
(Put in Category:Developers) |
|||
(4 intermediate revisions by one user not shown) | |||
Line 2: | Line 2: | ||
Interface for comunicate plugins. | Interface for comunicate plugins. | ||
− | Class for | + | Class for communicate plugins with document (drawing). |
− | <p><code>#include | + | <p><code>#include <document_interface.h></code></p> |
<table> | <table> | ||
<tr><td colspan="2"><h2>Public Member Functions</h2></td></tr> | <tr><td colspan="2"><h2>Public Member Functions</h2></td></tr> | ||
<tr><td>virtual '''~Document_Interface'''()</td></tr> | <tr><td>virtual '''~Document_Interface'''()</td></tr> | ||
+ | <tr><td>virtual void '''updateView''' ()=0</td><td>''Force to update the graphic view.''</td></tr> | ||
<tr><td>virtual void '''addPoint''' (QPointF *start)=0</td><td>''Add point entity to current document.''</td></tr> | <tr><td>virtual void '''addPoint''' (QPointF *start)=0</td><td>''Add point entity to current document.''</td></tr> | ||
<tr><td>virtual void '''addLine''' (QPointF *start, QPointF *end)=0</td><td>''Add line entity to current document.''</td></tr> | <tr><td>virtual void '''addLine''' (QPointF *start, QPointF *end)=0</td><td>''Add line entity to current document.''</td></tr> | ||
<tr><td>virtual void '''addText'''(QString txt, QString sty, QPointF *start, double height, double angle, DPI::HAlign ha, DPI::VAlign va)=0</td> | <tr><td>virtual void '''addText'''(QString txt, QString sty, QPointF *start, double height, double angle, DPI::HAlign ha, DPI::VAlign va)=0</td> | ||
<td>''Add text entity to current document.''</td></tr> | <td>''Add text entity to current document.''</td></tr> | ||
+ | <tr><td>virtual void '''addCircle''' (QPointF *start, qreal radius)=0</td><td>''Add line entity to current document.''</td></tr> | ||
+ | <tr><td>virtual void '''addArc''' (QPointF *start, qreal radius, qreal a1, qreal a2)=0</td><td>''Add arc entity to current document.''</td></tr> | ||
+ | <tr><td>virtual void '''addEllipse''' (QPointF *start, QPointF *end, qreal ratio, qreal a1, qreal a2)=0</td><td>''Add ellipse entity to current document.''</td></tr> | ||
+ | <tr><td>virtual void '''addImage''' (int handle, QPointF *start, QPointF *uvr, QPointF *vvr, int w, int h, QString name, int br, int con, int fade)=0</td> | ||
+ | <td>''Add image entity to current document.''</td></tr> | ||
<tr><td>virtual void '''setLayer'''(QString name)=0</td><td>''Set the current layer in current document.''</td></tr> | <tr><td>virtual void '''setLayer'''(QString name)=0</td><td>''Set the current layer in current document.''</td></tr> | ||
<tr><td>virtual QString '''getCurrentLayer'''()=0</td><td>''Get the current layer in current document.''</td></tr> | <tr><td>virtual QString '''getCurrentLayer'''()=0</td><td>''Get the current layer in current document.''</td></tr> | ||
<tr><td>virtual bool '''getPoint'''(QPointF *point, const QString &mesage="", QPointF *base=0)=0</td><td>''Gets a point.''</td></tr> | <tr><td>virtual bool '''getPoint'''(QPointF *point, const QString &mesage="", QPointF *base=0)=0</td><td>''Gets a point.''</td></tr> | ||
− | <tr><td>virtual Plug_Entity* '''getEnt''' (const QString &mesage="")=0</td><td>''Select a entity.''</td></tr> | + | <tr><td>virtual [[Plug_Entity_class|Plug_Entity]]* '''getEnt''' (const QString &mesage="")=0</td><td>''Select a entity.''</td></tr> |
− | <tr><td>virtual | + | <tr><td>virtual bool '''getSelect''' (QList< [[Plug_Entity_class|Plug_Entity]] *> *sel, const QString &mesage="")=0</td><td>''Gets a entities selection.''</td></tr> |
</table> | </table> | ||
---- | ---- | ||
+ | |||
virtual Document_Interface::~Document_Interface ()<code> [inline, virtual] | virtual Document_Interface::~Document_Interface ()<code> [inline, virtual] | ||
==Member Function Documentation== | ==Member Function Documentation== | ||
+ | |||
+ | virtual void Document_Interface::'''updateView'''() <code>[pure virtual]</code> | ||
+ | |||
+ | <p>Force to update the graphic view redrawing the document.</p> | ||
+ | |||
---- | ---- | ||
− | virtual void Document_Interface::''' | + | virtual void Document_Interface::'''addPoint'''(QPointF* ''start'')<code> [pure virtual]</code> |
− | <p>Add | + | <p>Add point entity to current document with current attributes. </p> |
'''Parameters:''' | '''Parameters:''' | ||
<table> | <table> | ||
− | <tr><td>''start''</td><td>start | + | <tr><td>''start''</td><td>start point coordinate.</td></tr> |
− | + | ||
</table> | </table> | ||
---- | ---- | ||
− | virtual void Document_Interface::''' | + | virtual void Document_Interface::'''addLine'''(QPointF* ''start'', QPointF* ''end'') <code>[pure virtual]</code> |
− | <p>Add | + | <p>Add line entity to current document with current attributes. </p> |
'''Parameters:''' | '''Parameters:''' | ||
<table> | <table> | ||
− | <tr><td>''start''</td><td>start point coordinate.</td></tr> | + | <tr><td>''start''</td><td>start point coordinate. </td></tr> |
+ | <tr><td>''end''</td><td>end point coordinate. </td></tr> | ||
</table> | </table> | ||
Line 63: | Line 75: | ||
---- | ---- | ||
− | virtual | + | virtual void Document_Interface::'''addCircle'''(QPointF* ''start'', qreal ''radius'') <code>[pure virtual]</code> |
− | <p> | + | <p>Add circle entity to current document with current attributes.</p> |
− | ''' | + | '''Parameters:''' |
+ | <table> | ||
+ | <tr><td>''start''</td><td>center point coordinate.</td></tr> | ||
+ | <tr><td>''radius''</td><td>radius for circle.</td></tr> | ||
+ | </table> | ||
---- | ---- | ||
− | virtual | + | virtual QString Document_Interface::'''getCurrentLayer'''() <code>[pure virtual]</code> |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | <p> | + | <p>Get the current layer in current document. </p> |
− | + | '''Returns:''' | |
− | + | The name of the current layer. | |
− | + | ||
− | + | ||
− | + | ||
− | + | ---- | |
− | < | + | virtual [[Plug_Entity_class|Plug_Entity]]* Document_Interface::'''getEnt'''(const QString& ''mesage'' = "") <code>[pure virtual]</code> |
+ | <p>Prompt message or a default message to the user asking for a single selection. You can delete the [[Plug_Entity_class|Plug_Entity]] wen no more needed. </p> | ||
+ | '''Parameters:''' | ||
+ | <table> | ||
+ | <tr><td>''mesage''</td><td>an optional QString with prompt message.</td></tr> | ||
+ | </table> | ||
− | + | '''Returns:''' | |
+ | a [[Plug_Entity_class|Plug_Entity]] handle the selected entity or NULL. | ||
− | + | ---- | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
+ | virtual bool Document_Interface::'''getPoint'''( QPointF* ''point'', const QString& ''mesage'' = "", QPointF* ''base'' = 0) <code>[pure virtual]</code> | ||
<p>Gets a point. </p> | <p>Gets a point. </p> | ||
<p>Prompt message or an default message to the user asking for a point. If base is present draw a line from base to cursor position. </p> | <p>Prompt message or an default message to the user asking for a point. If base is present draw a line from base to cursor position. </p> | ||
− | + | '''Parameters:''' | |
− | <table | + | <table> |
− | <tr><td | + | <tr><td>''point''</td><td>a pointer to QPointF to store the obtained point.</td></tr> |
− | <tr><td | + | <tr><td>''mesage''</td><td>an optional QString with prompt message.</td></tr> |
− | <tr><td | + | <tr><td>''base''</td><td>visual helper point, if present.</td></tr> |
</table> | </table> | ||
+ | '''Returns:''' | ||
false if fail, i.e. user cancel. | false if fail, i.e. user cancel. | ||
− | + | ---- | |
− | + | virtual bool Document_Interface::'''getSelect'''(QList<[[Plug_Entity_class|Plug_Entity]] *> *sel, const QString& ''mesage'' = "") <code>[pure virtual]</code> | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
<p>Gets a entities selection. </p> | <p>Gets a entities selection. </p> | ||
<p>Prompt message or an default message to the user asking for a selection. You can delete all, the <a href="Plug_Entity-Class-Reference" title="Wrapper for acces entities from plugins.">Plug_Entity</a> and the returned QList wen no more needed. </p> | <p>Prompt message or an default message to the user asking for a selection. You can delete all, the <a href="Plug_Entity-Class-Reference" title="Wrapper for acces entities from plugins.">Plug_Entity</a> and the returned QList wen no more needed. </p> | ||
− | + | '''Parameters:''' | |
− | <table | + | <table> |
− | <tr><td>mesage</td><td>an optional QString with prompt message. </td></tr> | + | <tr><td>''sel''</td><td>a QList of poiters to [[Plug_Entity_class|Plug_Entity]] handled the selected entities.</td></tr> |
+ | <tr><td>''mesage''</td><td>an optional QString with prompt message.</td></tr> | ||
</table> | </table> | ||
− | + | '''Returns:''' | |
+ | true if succes, false if fail, i.e. user cancel. | ||
− | + | ---- | |
− | + | virtual void Document_Interface::'''setLayer''' (QString& ''name'') <code>[pure virtual]</code> | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
<p>Set the current layer in current document. </p> | <p>Set the current layer in current document. </p> | ||
<p>Set the current layer in current document, if not exist create it. </p> | <p>Set the current layer in current document, if not exist create it. </p> | ||
− | + | '''Parameters:''' | |
<table> | <table> | ||
− | <tr><td>name</td><td>a QString with the name of the layer. </td></tr> | + | <tr><td>''name''</td><td>a QString with the name of the layer. </td></tr> |
</table> | </table> | ||
− | + | [[Category:Developers]] | |
− | + |
Latest revision as of 18:27, 25 April 2015
Document_Interface Class Reference
Interface for comunicate plugins.
Class for communicate plugins with document (drawing).
#include <document_interface.h>
Public Member Functions | |
virtual ~Document_Interface() | |
virtual void updateView ()=0 | Force to update the graphic view. |
virtual void addPoint (QPointF *start)=0 | Add point entity to current document. |
virtual void addLine (QPointF *start, QPointF *end)=0 | Add line entity to current document. |
virtual void addText(QString txt, QString sty, QPointF *start, double height, double angle, DPI::HAlign ha, DPI::VAlign va)=0 | Add text entity to current document. |
virtual void addCircle (QPointF *start, qreal radius)=0 | Add line entity to current document. |
virtual void addArc (QPointF *start, qreal radius, qreal a1, qreal a2)=0 | Add arc entity to current document. |
virtual void addEllipse (QPointF *start, QPointF *end, qreal ratio, qreal a1, qreal a2)=0 | Add ellipse entity to current document. |
virtual void addImage (int handle, QPointF *start, QPointF *uvr, QPointF *vvr, int w, int h, QString name, int br, int con, int fade)=0 | Add image entity to current document. |
virtual void setLayer(QString name)=0 | Set the current layer in current document. |
virtual QString getCurrentLayer()=0 | Get the current layer in current document. |
virtual bool getPoint(QPointF *point, const QString &mesage="", QPointF *base=0)=0 | Gets a point. |
virtual Plug_Entity* getEnt (const QString &mesage="")=0 | Select a entity. |
virtual bool getSelect (QList< Plug_Entity *> *sel, const QString &mesage="")=0 | Gets a entities selection. |
virtual Document_Interface::~Document_Interface () [inline, virtual]
Member Function Documentation
virtual void Document_Interface::updateView() <code>[pure virtual]
Force to update the graphic view redrawing the document.
virtual void Document_Interface::addPoint(QPointF* start) [pure virtual]
Add point entity to current document with current attributes.
Parameters:
start | start point coordinate. |
virtual void Document_Interface::addLine(QPointF* start, QPointF* end) [pure virtual]
Add line entity to current document with current attributes.
Parameters:
start | start point coordinate. |
end | end point coordinate. |
virtual void Document_Interface::addText (QString txt, QString sty, QPointF * start, double height, double angle, DPI::HAlign ha, DPI::VAlign va) [pure virtual]
Add text entity to current document with current attributes
Parameters:
txt | a QString with text content |
sty | a QString with text style name |
start | insertion point coordinate |
height | height of text |
angle | rotation angle of text |
ha | horizontal alignement of text |
va | vertical alignement of text |
virtual void Document_Interface::addCircle(QPointF* start, qreal radius) [pure virtual]
Add circle entity to current document with current attributes.
Parameters:
start | center point coordinate. |
radius | radius for circle. |
virtual QString Document_Interface::getCurrentLayer() [pure virtual]
Get the current layer in current document.
Returns: The name of the current layer.
virtual Plug_Entity* Document_Interface::getEnt(const QString& mesage = "") [pure virtual]
Prompt message or a default message to the user asking for a single selection. You can delete the Plug_Entity wen no more needed.
Parameters:
mesage | an optional QString with prompt message. |
Returns: a Plug_Entity handle the selected entity or NULL.
virtual bool Document_Interface::getPoint( QPointF* point, const QString& mesage = "", QPointF* base = 0) [pure virtual]
Gets a point.
Prompt message or an default message to the user asking for a point. If base is present draw a line from base to cursor position.
Parameters:
point | a pointer to QPointF to store the obtained point. |
mesage | an optional QString with prompt message. |
base | visual helper point, if present. |
Returns:
false if fail, i.e. user cancel.
virtual bool Document_Interface::getSelect(QList<Plug_Entity *> *sel, const QString& mesage = "") [pure virtual]
Gets a entities selection.
Prompt message or an default message to the user asking for a selection. You can delete all, the <a href="Plug_Entity-Class-Reference" title="Wrapper for acces entities from plugins.">Plug_Entity</a> and the returned QList wen no more needed.
Parameters:
sel | a QList of poiters to Plug_Entity handled the selected entities. |
mesage | an optional QString with prompt message. |
Returns: true if succes, false if fail, i.e. user cancel.
virtual void Document_Interface::setLayer (QString& name) [pure virtual]
Set the current layer in current document.
Set the current layer in current document, if not exist create it.
Parameters:
name | a QString with the name of the layer. |