Click here to Skip to main content
15,891,529 members
Articles / Desktop Programming / MFC

UMLEditor - revisiting the vector editor

Rate me:
Please Sign up or sign in to vote.
4.99/5 (156 votes)
5 Jul 2006Public Domain8 min read 377.3K   37.1K   326  
An UML editor with code-generation capabilities derived from CDiagramEditor.
<html>
<head>
<style>
body{font-size: 10pt;color: black;font-family: Verdana, Helvetica, Arial, sans-serif;background-color: #ffffff}
p{font-size: 10pt;color: black;font-family: Verdana, Helvetica, Arial, sans-serif;}
h2{font-size: 13pt;color: #ff9900;font-family: Verdana, Helvetica, Arial, sans-serif;font-weight: bold;}
h3{color: #ff9900;font-weight: bold;font-size: 11pt;font-family: Arial, sans-serif;}
table{background-color:#f0f0ff;}
td{font-size: 10pt;color: black;font-family: Verdana, Helvetica, Arial, sans-serif;padding:4px;}
pre{padding-right: 7pt;padding-left: 7pt;padding-bottom: 7pt;font: 9pt 'Courier New', Courier, mono;width: 100%;padding-top: 7pt;white-space: pre;background-color: #fbedbb}
code{color: #990000;font-family: 'Courier New', Courier, mono;}
A:link{text-decoration: none}
A:visited{text-decoration: none}
A:active{text-decoration: underline}
A:hover{text-decoration: underline}
A.top:link{font-size:8pt;color:red;font-family:Verdana,Helvetica,Arial,sans-serif;}
A.top:visited{font-size:8pt;color:red;font-family:Verdana,Helvetica,Arial,sans-serif;}
A.top:active{font-size:8pt;color:red;font-family:Verdana,Helvetica,Arial,sans-serif;}
A.top:hoover{font-size:8pt;color:red;font-family:Verdana,Helvetica,Arial,sans-serif;}
</style>
</head>
<body>
<h2>CUMLEntityNote</h2><h3>Overview</h3>
<blockquote>
<b>Purpose</b><br>
<code>CUMLEntityNote</code> is derived from <code>CUMLEntity</code> and represents an UML note object.<br>
<p><b>Description</b><br>
The <code>CUMLEntity</code>-derived objects are the drawing objects of the UML-editor. The class represents an UNL note entity, and can be linked to other objects from all sides. The links will automatically be set as a weak dependency (dashed line) by the editor.<br>
<p><b>Usage</b><br>
When loading, create with <code>CUMLControlFactory::CreateFromString</code>. Otherwise, create instances in the application view or dialog and add them to the editor with <code>StartDrawingObject</code>. The editor takes responsibility for the object.
<p><a class='top' href='index.html'>[back to the index page]</a>
</blockquote>
<a name='contents'></a><h3>Contents</h3>
<b>- C -</b><br>
<a href='#CUMLEntityNote'>CUMLEntityNote()</a><br>
<a href='#CalcRestraints'>CalcRestraints()</a><br>
<a href='#Clone'>Clone()</a><br>
<a href='#CreateFromStringconstCStringstr'>CreateFromString( const CString& str )</a><br>
<p>
<b>- D -</b><br>
<a href='#DrawCDCdcCRectrect'>Draw( CDC* dc, CRect rect )</a><br>
<p>
<b>- E -</b><br>
<a href='#ExportUINTformatconst'>Export( UINT format ) const</a><br>
<a href='#ExportHTMLconst'>ExportHTML() const</a><br>
<p>
<b>- G -</b><br>
<a href='#GetTextRectconstCRectinrectconst'>GetTextRect(  const CRect& inrect ) const</a><br>
<p>
<b>- S -</b><br>
<a href='#SetRectCRectrect'>SetRect( CRect rect )</a><br>
<a href='#SetRectdoubleleftdoubletopdoublerightdoublebottom'>SetRect( double left, double top, double right, double bottom )</a><br>
<a href='#SetTitleCStringtitle'>SetTitle( CString title )</a><br>
<p>
<b>- ~ -</b><br>
<a href='#~CUMLEntityNote'>~CUMLEntityNote()</a><br>
<p><h3>Functions</h3><hr>
<code><b><a name='CUMLEntityNote'></a>CUMLEntityNote()</b></code>
<blockquote>
<b>Description</b><br>
Constructor
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
none<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Create either through <code>CUMLControlFactory</code> or by calling <code>new</code> and adding the pointer to the editor via <code>StartDrawingObject</code><p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='CalcRestraints'></a>void CalcRestraints()</b></code>
<blockquote>
<b>Description</b><br>
Calculates, depending on the contents, the minimum size for this object.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
none<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call when the contents change.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='Clone'></a>CDiagramEntity* Clone()</b></code>
<blockquote>
<b>Description</b><br>
Creates a new object of this type, copies the data from this object, and returns the new one.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
none<br>
<b>Returns</b><br>
<code>CDiagramEntity* </code> -  New object
<br><br><b>Usage</b><br>
Call to clone this object<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='CreateFromStringconstCStringstr'></a>CDiagramEntity* CreateFromString( const CString& str )</b></code>
<blockquote>
<b>Description</b><br>
Static factory function that creates and returns an instance of this class if <code>str</code> is a valid representation.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
<code>const CString& str </code> -  The string to create from.<br>
<b>Returns</b><br>
<code>CDiagramEntity*  </code> -  The object, or <code>NULL</code> if <code>str</code> is not a representation of this type.
<br><br><b>Usage</b><br>
Can be used as a factory for text file loads.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='DrawCDCdcCRectrect'></a>void Draw( CDC* dc, CRect rect )</b></code>
<blockquote>
<b>Description</b><br>
Draws this object.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
<code>CDC* dc  </code> -  <code>CDC</code> to draw to<br><code>CRect rect </code> -  Rectangle to draw to<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call to draw the object.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='ExportUINTformatconst'></a>CString Export( UINT format ) const</b></code>
<blockquote>
<b>Description</b><br>
Exports the obect to <code>format</code>.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
<code>UINT format </code> -  Format to export to<br>
<b>Returns</b><br>
<code>CString  </code> -  Result
<br><br><b>Usage</b><br>
<code>format</code> can be one of the following: <p><table width='100%'><tr><td><code>EXPORT_CPP</code></td><td>Export to cpp-files </td></tr><tr><td><code>EXPORT_H</code></td><td>Export to header files </td></tr><tr><td><code>EXPORT_HTML</code></td><td>Export to HTML-files</td></tr></table><p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='ExportHTMLconst'></a>CString ExportHTML() const</b></code>
<blockquote>
<b>Description</b><br>
Exports the current object to HTML
<br><b>Access</b><br>
Private
<br><br><b>Parameters</b><br>
none<br>
<b>Returns</b><br>
<code>CString </code> -  Resulting HTML
<br><br><b>Usage</b><br>
Call to export this object to HTML<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='GetTextRectconstCRectinrectconst'></a>CRect GetTextRect(  const CRect& inrect ) const</b></code>
<blockquote>
<b>Description</b><br>
Gets a rectangle deflated for text input.
<br><b>Access</b><br>
Private
<br><br><b>Parameters</b><br>
<code>const CRect& inrect </code> -  Rectangle to put text in<br>
<b>Returns</b><br>
<code>CRect    </code> -  Resulting rectangle
<br><br><b>Usage</b><br>
Call to get a properly deflated text rectangle.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='SetRectCRectrect'></a>void SetRect( CRect rect )</b></code>
<blockquote>
<b>Description</b><br>
Sets the object rectangle
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
<code>CRect rect </code> -  New rectangle<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Overridden to calculate restraints<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='SetRectdoubleleftdoubletopdoublerightdoublebottom'></a>void SetRect( double left, double top, double right, double bottom )</b></code>
<blockquote>
<b>Description</b><br>
Sets the object rectangle
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
<code>double left  </code> -  New left position<br><code>double top  </code> -  New top position<br><code>double right </code> -  New right position<br><code>double bottom </code> -  New bottom position<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Overridden to calculate restraints<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='SetTitleCStringtitle'></a>void SetTitle( CString title )</b></code>
<blockquote>
<b>Description</b><br>
Sets the title of the object
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
<code>CString title </code> -  New title<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
The function also recalculates the minimum restraints based on the note contents.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='~CUMLEntityNote'></a>~CUMLEntityNote()</b></code>
<blockquote>
<b>Description</b><br>
Destructor
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
none<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Note that objects will normally be deleted by the container.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<b><small>Copyright 2004 Johan Rosengren Abstrakt Mekanik AB</small></b>
</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under A Public Domain dedication


Written By
Software Developer (Senior) Abstrakt Mekanik AB
Sweden Sweden
45 years old, married, three kids.

Started with computers more than 20 years ago on a CBM-64.

Read Theoretical Philosophy at the University of Lund.

Working as a C++ consultant developer.

Science-fiction freak. Enjoy vintage punkrock.

Comments and Discussions