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"

From LibreCAD wiki
Jump to: navigation, search
Line 2: Line 2:
 
Interface for comunicate plugins.   
 
Interface for comunicate plugins.   
  
Class for comunicate plugins with document (drawing).
+
Class for communicate plugins with document (drawing).
  
 
<p><code>#include &lt;document_interface.h&gt;</code></p>
 
<p><code>#include &lt;document_interface.h&gt;</code></p>
Line 16: Line 16:
 
<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 &amp;mesage=&quot;&quot;)=0</td><td>''Select a entity.''</td></tr>
+
<tr><td>virtual [[Plug_Entity_class|Plug_Entity]]* '''getEnt''' (const QString &amp;mesage=&quot;&quot;)=0</td><td>''Select a entity.''</td></tr>
<tr><td>virtual QList< Plug_Entity* > '''getSelect''' (const QString &amp;mesage=&quot;&quot;)=0</td><td>''Gets a entities selection.''</td></tr>
+
<tr><td>virtual QList< [[Plug_Entity_class|Plug_Entity]]* > '''getSelect''' (const QString &amp;mesage=&quot;&quot;)=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::'''addLine'''(QPointF* ''start'', QPointF* ''end'') <code>[pure virtual]</code>
 
virtual void Document_Interface::'''addLine'''(QPointF* ''start'', QPointF* ''end'') <code>[pure virtual]</code>
Line 63: Line 63:
 
----
 
----
  
virtual QString Document_Interface::getCurrentLayer() <code>[pure virtual]</code>
+
virtual QString Document_Interface::'''getCurrentLayer'''() <code>[pure virtual]</code>
  
 
<p>Get the current layer in current document. </p>
 
<p>Get the current layer in current document. </p>
'''Returns:'''The name of the current layer.
+
'''Returns:'''
 +
The name of the current layer.
  
 
----
 
----
  
virtual <a  href="Plug_Entity-Class-Reference">Plug_Entity</a>* Document_Interface::getEnt </td>
+
virtual [[Plug_Entity_class|Plug_Entity]]* Document_Interface::'''getEnt'''(const QString& ''mesage'' = "") <code>[pure virtual]</code>
          <td>(</td>
+
          <td>const QString &amp;</td>
+
          <td><em>mesage</em> = <code>&quot;&quot;</code></td><td>)</td>
+
          <td><code> [pure virtual]</code></td>
+
        </tr>
+
      </table>
+
  
<p>Select a entity. </p>
+
<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>
<p>Prompt message or a default message to the user asking for a sigle selection. You can delete the <a href="Plug_Entity-Class-Reference" title="Wrapper for acces entities from plugins.">Plug_Entity</a> wen no more needed. </p>
+
'''Parameters:'''
<b>Parameters:</b>
+
   <table>
   <table class="params">
+
     <tr><td>''mesage''</td><td>an optional QString with prompt message.</td></tr>
     <tr><td class="paramname">mesage</td><td>an optional QString with prompt message. </td></tr>
+
 
   </table>
 
   </table>
  
<b>Returns:</b>a <a href="Plug_Entity-Class-Reference" title="Wrapper for acces entities from plugins.">Plug_Entity</a> handle the selected entity or NULL.
+
'''Returns:'''
 +
a [[Plug_Entity_class|Plug_Entity]] handle the selected entity or NULL.
  
<p>Implemented in Doc_plugin_interface</p>
+
----
 
+
 
+
<a name="accafc3c2812bbe033a6b8d073ad4e08e"></a>
+
 
+
      <table class="memname">
+
        <tr>
+
          <td class="memname">virtual bool Document_Interface::getPoint </td>
+
          <td>(</td>
+
          <td class="paramtype">QPointF *</td>
+
          <td class="paramname"><em>point</em>, </td>
+
        </tr>
+
        <tr>
+
          <td class="paramkey"></td>
+
          <td></td>
+
          <td class="paramtype">const QString &amp;&#160;</td>
+
          <td class="paramname"><em>mesage</em> = <code>&quot;&quot;</code>, </td>
+
        </tr>
+
        <tr>
+
          <td class="paramkey"></td>
+
          <td></td>
+
          <td class="paramtype">QPointF *&#160;</td>
+
          <td class="paramname"><em>base</em> = <code>0</code>&#160;</td>
+
        </tr>
+
        <tr>
+
          <td></td>
+
          <td>)</td>
+
          <td></td><td><code> [pure virtual]</code></td>
+
        </tr>
+
  
 +
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>
<b>Parameters:</b>
+
'''Parameters:'''
   <table class="params">
+
   <table>
     <tr><td class="paramname">point</td><td>a pointer to QPointF to store the obtained point. </td></tr>
+
     <tr><td>''point''</td><td>a pointer to QPointF to store the obtained point.</td></tr>
     <tr><td class="paramname">mesage</td><td>an optional QString with prompt message. </td></tr>
+
     <tr><td>''mesage''</td><td>an optional QString with prompt message.</td></tr>
     <tr><td class="paramname">base</td><td>visual helper point, if present. </td></tr>
+
     <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.
  
<p>Implemented in Doc_plugin_interface</p>
+
----
  
 
+
virtual QList<[[Plug_Entity_class|Plug_Entity]] *> Document_Interface::'''getSelect'''(const QString& ''mesage'' = "") <code>[pure virtual]</code>
<a name="a98f11873900dcf95f64dad6325d70a9b"></a>
+
 
+
      <table class="memname">
+
        <tr>
+
          <td>virtual QList&lt;<a href="Plug_Entity-Class-Reference">Plug_Entity</a> *&gt; Document_Interface::getSelect </td>
+
          <td>(</td>
+
          <td class="paramtype">const QString &amp;&#160;</td>
+
          <td class="paramname"><em>mesage</em> = <code>&quot;&quot;</code></td><td>)</td>
+
          <td><code> [pure virtual]</code></td>
+
        </tr>
+
      </table>
+
  
 
<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>
<b>Parameters:</b>
+
'''Parameters:'''
   <table class="params">
+
   <table>
     <tr><td>mesage</td><td>an optional QString with prompt message. </td></tr>
+
     <tr><td>''mesage''</td><td>an optional QString with prompt message.</td></tr>
 
   </table>
 
   </table>
  
<b>Returns:</b>a QList of poiters to <a href="Plug_Entity-Class-Reference" title="Wrapper for acces entities from plugins.">Plug_Entity</a> handled the selected entites or an empty QList.
+
'''Returns:'''
 +
a QList of poiters to [[Plug_Entity_class|Plug_Entity]] handled the selected entities or an empty QList.
  
<p>Implemented in Doc_plugin_interface</p>
+
----
  
 
+
virtual void Document_Interface::'''setLayer''' (QString& ''name'') <code>[pure virtual]</code>
<a name="a32cb7bf0798d060e3ed06dcfe470303c"></a>
+
<div class="memitem">
+
 
+
      <table class="memname">
+
        <tr>
+
          <td>virtual void Document_Interface::setLayer </td>
+
          <td>(</td>
+
          <td>QString&#160;</td>
+
          <td><em>name</em></td><td>)</td>
+
          <td><code> [pure virtual]</code></td>
+
        </tr>
+
      </table>
+
  
 
<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>
<b>Parameters:</b>
+
'''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>
 
 
<p>Implemented in Doc_plugin_interface</p>
 

Revision as of 08:57, 26 July 2012

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 addPoint (QPointF *start)=0Add point entity to current document.
virtual void addLine (QPointF *start, QPointF *end)=0Add 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 setLayer(QString name)=0Set the current layer in current document.
virtual QString getCurrentLayer()=0Get the current layer in current document.
virtual bool getPoint(QPointF *point, const QString &mesage="", QPointF *base=0)=0Gets a point.
virtual Plug_Entity* getEnt (const QString &mesage="")=0Select a entity.
virtual QList< Plug_Entity* > getSelect (const QString &mesage="")=0Gets a entities selection.


virtual Document_Interface::~Document_Interface () [inline, virtual]

Member Function Documentation

virtual void Document_Interface::addLine(QPointF* start, QPointF* end) <code>[pure virtual]

Add line entity to current document with current attributes.

Parameters:

startstart point coordinate.
endend point coordinate.

virtual void Document_Interface::addPoint(QPointF* start) [pure virtual]

Add point entity to current document with current attributes.

Parameters:

startstart 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:

txta QString with text content
stya QString with text style name
startinsertion point coordinate
heightheight of text
anglerotation angle of text
hahorizontal alignement of text
vavertical alignement of text

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:

mesagean 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:

pointa pointer to QPointF to store the obtained point.
mesagean optional QString with prompt message.
basevisual helper point, if present.


Returns: false if fail, i.e. user cancel.


virtual QList<Plug_Entity *> Document_Interface::getSelect(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:

mesagean optional QString with prompt message.

Returns: a QList of poiters to Plug_Entity handled the selected entities or an empty QList.


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:

namea QString with the name of the layer.