📄 umlentity.cpp
字号:
============================================================*/
{
m_fontName = fontName;
}
CRect CUMLEntity::GetLinkMarkerRect( int type ) const
/* ============================================================
Function : CUMLEntity::GetLinkMarkerRect
Description : Returns the rectangle of the link marker
for this object.
Access : Public
Return : CRect - Resulting marker rectangle.
Parameters : int type - Type of link to get
rectangle for.
Usage : Call to get the rectangle of a specific
link marker.The possible link types are:
"LINK_TOP" Link at the top
"LINK_BOTTOM" Link at the bottom
"LINK_LEFT" Link at the left
"LINK_RIGHT" Link at the right
"LINK_START" Link at the start point of a line
"LINK_END" Link at the end point of a line.
============================================================*/
{
int halfside = this->GetMarkerSize().cx / 2;
CRect rect( -1,- 1, -1, -1 );
CPoint point = GetLinkPosition( type );
rect.left = point.x - halfside;
rect.right = point.x + halfside;
rect.top = point.y - halfside;
rect.bottom = point.y + halfside;
return rect;
}
void CUMLEntity::SetDefaultSize( CSize sz )
/* ============================================================
Function : CUMLEntity::SetDefaultSize
Description : Sets the default size of the object.
Access : Public
Return : void
Parameters : CSize sz - Default size
Usage : Call to set the default size of the object.
An object can never be smaller than the
default size.
============================================================*/
{
m_defaultSize = sz;
}
CSize CUMLEntity::GetDefaultSize() const
/* ============================================================
Function : CUMLEntity::GetDefaultSize
Description : Gets the default size of the object.
Access : Public
Return : CSize - Default size
Parameters : none
Usage : Call to get the default size of the object.
An object can never be smaller than the
default size.
============================================================*/
{
return m_defaultSize;
}
void CUMLEntity::SetRect( double left, double top, double right, double bottom )
/* ============================================================
Function : CUMLEntity::SetRect
Description : Sets the rectangle of the object.
Access : Public
Return : void
Parameters : double left - New left position
double top - New top position
double right - New right position
double bottom - New bottom position
Usage : Call to set the position of the object.
============================================================*/
{
SetLeft( left );
SetTop( top );
SetRight( right );
SetBottom( bottom );
if( GetMinimumSize().cx != -1 )
if( GetRect().Width() < GetMinimumSize().cx )
SetRight( GetLeft() + GetMinimumSize().cx );
if( GetMinimumSize().cy != -1 )
if( GetRect().Height() < GetMinimumSize().cy )
SetBottom( GetTop() + GetMinimumSize().cy );
if( GetMaximumSize().cx != -1 )
if( GetRect().Width() > GetMaximumSize().cx )
SetRight( GetLeft() + GetMaximumSize().cx );
if( GetMaximumSize().cy != -1 )
if( GetRect().Height() > GetMaximumSize().cy )
SetBottom( GetTop() + GetMaximumSize().cy );
}
void CUMLEntity::SetDisplayOptions( int displayOptions )
/* ============================================================
Function : CUMLEntity::SetDisplayOptions
Description : Sets the display options for the object.
Access : Public
Return : void
Parameters : int displayOptions - Options to set
Usage :
The display options can be a combination of the following:
"DISPLAY_ALL" Show everything
"DISPLAY_ONLY_PUBLIC" Show only public attributes and operations.
"DISPLAY_NO_MARKERS" Don't show access markers
"DISPLAY_NO_ATTRIBUTES" Don't show attributes
"DISPLAY_NO_OPERATIONS" Don't show operations.
"DISPLAY_NO_OPERATION_ATTRIBUTE_NAMES" Don't show names for operation parameters
============================================================*/
{
m_displayOptions = displayOptions;
CalcRestraints();
}
int CUMLEntity::GetDisplayOptions() const
/* ============================================================
Function : CUMLEntity::GetDisplayOptions
Description : Gets the display options of the object.
Access : Public
Return : int - Current options
Parameters : none
Usage :
The display options can be a combination of
the following:
"DISPLAY_ALL" Show everything
"DISPLAY_ONLY_PUBLIC" Show only public attributes and operations.
"DISPLAY_NO_MARKERS" Don't show access markers
"DISPLAY_NO_ATTRIBUTES" Don't show attributes
"DISPLAY_NO_OPERATIONS" Don't show operations.
"DISPLAY_NO_OPERATION_ATTRIBUTE_NAMES" Don't show names for operation parameters
============================================================*/
{
return m_displayOptions;
}
void CUMLEntity::SetOldId( const CString& oldid )
/* ============================================================
Function : CUMLEntity::SetOldId
Description : Sets the old id of the object.
Access : Public
Return : void
Parameters : const CString& oldid - New old id
Usage : Call to set the old id of the object. The
old id is the original id when an object
is copied, and used to fix links after -
for example - a copy-operation.
============================================================*/
{
m_oldid = oldid;
}
CString CUMLEntity::GetOldId() const
/* ============================================================
Function : CUMLEntity::GetOldId
Description : Gets the old id of the object.
Access : Public
Return : void
Parameters : const CString& oldid - Old id
Usage : Call to get the old id of the object. The
old id is the original id when an object
is copied, and used to fix links after -
for example - a copy-operation.
============================================================*/
{
return m_oldid;
}
void CUMLEntity::CalcRestraints()
/* ============================================================
Function : CUMLEntity::CalcRestraints
Description : Calculates, depending on the contents, the
minimum size for this object.
Access : Public
Return : void
Parameters : none
Usage : Call when the contents change.
============================================================*/
{
// No specific default implementation
}
CUMLEntityContainer* CUMLEntity::GetUMLContainer() const
/* ============================================================
Function : CUMLEntity::GetUMLContainer
Description : Gets a "CUMLEntityContainer"-pointer to
the parent of this object.
Access : Private
Return : CUMLEntityContainer* - Pointer to the
parent.
Parameters : none
Usage : Convenience function.
============================================================*/
{
return reinterpret_cast< CUMLEntityContainer* >( GetParent() );
}
void CUMLEntity::SetStereotype( const CString& value )
/* ============================================================
Function : CUMLEntity::SetStereotype
Description : Sets the stereotype of this object.
Access : Public
Return : void
Parameters : const CString& value - New stereotype
Usage : Call to set the stereotype.
============================================================*/
{
m_stereotype = value;
}
CString CUMLEntity::GetStereotype() const
/* ============================================================
Function : CUMLEntity::GetStereotype
Description : Gets the stereotype of this object.
Access : Public
Return : CString - The stereotype
Parameters : none
Usage : Call to get the stereotype for this object.
============================================================*/
{
return m_stereotype;
}
BOOL CUMLEntity::FromString( const CString& str )
/* ============================================================
Function : CUMLEntity::FromString
Description : Sets the data for this object from "str"
Access : Public
Return : BOOL - "TRUE" if "str" was a
valid representation of
this type.
Parameters : const CString& str - String representation
Usage : Use when loading from file.
============================================================*/
{
BOOL result = FALSE;
CString data( str );
if( LoadFromString( data ) )
{
CTokenizer tok( data );
CString package;
CString fontName;
int bkColor;
int count = 0;
tok.GetAt( count++, package );
tok.GetAt( count++, fontName );
tok.GetAt( count++, bkColor );
UnmakeSaveString( package );
SetPackage( package );
SetFont( fontName );
SetBkColor( static_cast< COLORREF >( bkColor ) );
CalcRestraints();
result = TRUE;
}
return result;
}
CString CUMLEntity::GetString() const
/* ============================================================
Function : CUMLEntity::GetString
Description : Gets a string representation of this object.
Access : Public
Return : CString - Resulting string
Parameters : none
Usage : Call to get a string representation for
saving.
============================================================*/
{
CString str;
CString package = GetPackage();
MakeSaveString( package );
str.Format( _T( ",%s,%s,%i;" ),
package,
GetFont(),
static_cast< int >( GetBkColor() )
);
str = GetDefaultGetString() + str;
return str;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -