📄 diagramentity.cpp
字号:
{
m_left = left;
}
void CDiagramEntity::SetRight( double right )
/* ============================================================
Function : CDiagramEntity::SetRight
Description : Sets the right edge of the object
rectangle
Access : Public
Return : void
Parameters : double right - New right position
Usage : Call to set the right edge of the object.
The object coordinates are expressed as
double values to allow unlimited zoom.
============================================================*/
{
m_right = right;
}
void CDiagramEntity::SetTop( double top )
/* ============================================================
Function : CDiagramEntity::SetTop
Description : Sets the top edge of the object rectangle
Access : Public
Return : void
Parameters : double top - New top position
Usage : Call to set the top edge of the object.
The object coordinates are expressed as
double values to allow unlimited zoom.
============================================================*/
{
if( top == m_bottom )
top = top;
m_top = top;
}
void CDiagramEntity::SetBottom( double bottom )
/* ============================================================
Function : CDiagramEntity::SetBottom
Description : Sets the bottom edge of the object
rectangle
Access : Public
Return : void
Parameters : double bottom - New bottom position
Usage : Call to set the bottom edge of the object.
The object coordinates are expressed as
double values to allow unlimited zoom.
============================================================*/
{
m_bottom = bottom;
}
void CDiagramEntity::SetMarkerSize( CSize markerSize )
/* ============================================================
Function : CDiagramEntity::SetMarkerSize
Description : Gets the size of selection markers
Access : Protected
Access : Public
Return : void
Parameters : CSize markerSize - The new size of a
selection marker
Usage : Call to set a new selection marker size for
the object.
============================================================*/
{
m_markerSize = markerSize;
}
CSize CDiagramEntity::GetMarkerSize() const
/* ============================================================
Function : CDiagramEntity::GetMarkerSize
Description : Gets the size of selection marker
Access : Protected
Access : Public
Return : CSize - The current size of a
selection marker
Parameters : none
Usage : Call to get the selection marker size for
the object.
============================================================*/
{
return m_markerSize;
}
void CDiagramEntity::SetMinimumSize( CSize minimumSize )
/* ============================================================
Function : CDiagramEntity::SetMinimumSize
Description : Sets the minimum size for instances of
this object.
Access : Public
Return : void
Parameters : CSize minimumSize - The minimum allowed
size
Usage : Call to set the minimum size of the object.
It is not possible to resize an object to a
size smaller than the minimum allowed size.
============================================================*/
{
m_minimumSize = minimumSize;
}
CSize CDiagramEntity::GetMinimumSize() const
/* ============================================================
Function : CDiagramEntity::GetMinimumSize
Description : Gets the minimum size for instances of
this object.
Access : Public
Return : CSize - The minimum allowed size
Parameters : none
Usage : Call to get the minimum size of the object.
It is not possible to resize an object to a
size smaller than the minimum allowed size.
============================================================*/
{
return m_minimumSize;
}
void CDiagramEntity::SetMaximumSize( CSize maximumSize )
/* ============================================================
Function : CDiagramEntity::SetMaximumSize
Description : Sets the maximum size for instances of
this object.
Access : Public
Return : void
Parameters : CSize maximumSize - The maximum allowed
size.
Usage : Call to set the maximum size of the object.
It is not possible to resize an object to a
size larger than the maximum allowed size.
============================================================*/
{
m_maximumSize = maximumSize;
}
CSize CDiagramEntity::GetMaximumSize() const
/* ============================================================
Function : CDiagramEntity::GetMaximumSize
Description : Returns the maximum size for instances of
this object.
Access : Public
Return : CSize - The maximum allowed size.
Parameters : none
Usage : Call to get the maximum size of the object.
It is not possible to resize an object to a
size larger than the maximum allowed size.
============================================================*/
{
return m_maximumSize;
}
void CDiagramEntity::SetConstraints( CSize min, CSize max )
/* ============================================================
Function : CDiagramEntity::SetConstraints
Description : Sets the minimum and maximum sizes for
instances of this object. -1 means no
constraints.
Access : Public
Return : void
Parameters : CSize min - Minimum size
CSize max - Maximum size
Usage : Call to set the minimum and maximum sizes
of the object.
It is not possible to resize an object to
smaller or bigger than the min- and max
size.
============================================================*/
{
m_minimumSize = min;
m_maximumSize = max;
}
CDiagramEntityContainer* CDiagramEntity::GetParent() const
/* ============================================================
Function : CDiagramEntity::GetParent
Description : Returns a pointer to the parent container.
Access : Protected
Return : CDiagramEntityContainer* - Parent
container.
Parameters : none
Usage : Call to get the parent of the object.
============================================================*/
{
return m_parent;
}
void CDiagramEntity::SetPropertyDialog( CDiagramPropertyDlg* dlg, UINT dlgresid )
/* ============================================================
Function : CDiagramEntity::SetPropertyDialog
Description : Sets the property dialog pointer.
Access : Protected
Return : void
Parameters : CDiagramPropertyDlg* dlg - a pointer
to a dialog
instance.
UINT dlgresid - The resource
id of the
dialog template.
Usage : Call to set a property dialog for the object
(normally in the "ctor").
============================================================*/
{
m_propertydlg = dlg;
m_propertydlgresid = dlgresid;
if( dlg )
m_propertydlg->SetEntity( this );
}
CDiagramPropertyDlg* CDiagramEntity::GetPropertyDialog() const
/* ============================================================
Function : CDiagramEntity::GetPropertyDialog
Description : Returns a pointer to the class property
dialog.
Access : Protected
Return : CDiagramPropertyDlg* - The dialog
pointer. "NULL"
if none.
Parameters : none
Usage : Call to get a pointer to the object property
dialog.
============================================================*/
{
return m_propertydlg;
}
double CDiagramEntity::GetZoom() const
/* ============================================================
Function : CDiagramEntity::GetZoom
Description : Returns the zoom level for the object.
Access : Public
Return : double -
Parameters : none
Usage : Internal function. Can be called by derived
classes to get the zoom level. The zoom
level is set by the owning editor when
drawing the object, is read-only and this
function should only be called from "Draw".
============================================================*/
{
return m_zoom;
}
void CDiagramEntity::SetZoom( double zoom )
/* ============================================================
Function : CDiagramEntity::SetZoom
Description : Sets the zoom level
Access : Protected
Return : nothing
Parameters : double zoom - The new zoom level
Usage : Internal call.
============================================================*/
{
m_zoom = zoom;
}
int CDiagramEntity::GetGroup() const
/* ============================================================
Function : CDiagramEntity::GetGroup
Description : Gets the object group.
Access : Public
Return : int - Group of object
Parameters : none
Usage : Call to get the group for the object. All
objects in a group are selected together.
============================================================*/
{
return m_group;
}
void CDiagramEntity::SetGroup( int group )
/* ============================================================
Function : CDiagramEntity::SetGroup
Description : Sets the object group to "group".
Access : Public
Return : void
Parameters : int group - New group to set
Usage : Call to set a group for the object. All
objects in a group are selected together.
============================================================*/
{
m_group = group;
}
CString CDiagramEntity::Export( UINT /*format*/ ) const
/* ============================================================
Function : CDiagramEntity::Export
Description : Exports the object to format
Access : Public
Return : CString - The object representation
in format.
Parameters : UINT format - The format to export to.
Usage : Virtual function to allow easy exporting of
the objects to different text based formats.
============================================================*/
{
return _T( "" );
}
int CDiagramEntity::GetHitCode( const CPoint& point, const CRect& rect ) const
/* ============================================================
Function : CDiagramEntity::GetHitCode
Description : Returns the hit point constant for "point"
assuming the object rectangle "rect".
Access : Public
Return : int - The hit point,
"DEHT_NONE" if none.
Parameters : CPoint point - The point to check
CRect rect - The rect to check
Usage : Call to see in what part of the object point
lies. The hit point can be one of the following:
"DEHT_NONE" No hit-point
"DEHT_BODY" Inside object body
"DEHT_TOPLEFT" Top-left corner
"DEHT_TOPMIDDLE" Middle top-side
"DEHT_TOPRIGHT" Top-right corner
"DEHT_BOTTOMLEFT" Bottom-left corner
"DEHT_BOTTOMMIDDLE" Middle bottom-side
"DEHT_BOTTOMRIGHT" Bottom-right corner
"DEHT_LEFTMIDDLE" Middle left-side
"DEHT_RIGHTMIDDLE" Middle right-side
============================================================*/
{
int result = DEHT_NONE;
if( rect.PtInRect( point ) )
result = DEHT_BODY;
CRect rectTest;
rectTest = GetSelectionMarkerRect( DEHT_TOPLEFT, rect );
if( rectTest.PtInRect( point ) )
result = DEHT_TOPLEFT;
rectTest = GetSelectionMarkerRect( DEHT_TOPMIDDLE, rect );
if( rectTest.PtInRect( point ) )
result = DEHT_TOPMIDDLE;
rectTest = GetSelectionMarkerRect( DEHT_TOPRIGHT, rect );
if( rectTest.PtInRect( point ) )
result = DEHT_TOPRIGHT;
rectTest = GetSelectionMarkerRect( DEHT_BOTTOMLEFT, rect );
if( rectTest.PtInRect( point ) )
result = DEHT_BOTTOMLEFT;
rectTest = GetSelectionMarkerRect( DEHT_BOTTOMMIDDLE, rect );
if( rectTest.PtInRect( point ) )
result = DEHT_BOTTOMMIDDLE;
rectTest = GetSelectionMarkerRect( DEHT_BOTTOMRIGHT, rect );
if( rectTest.PtInRect( point ) )
result = DEHT_BOTTOMRIGHT;
rectTest = GetSelectionMarkerRect( DEHT_LEFTMIDDLE, rect );
if( rectTest.PtInRect( point ) )
result = DEHT_LEFTMIDDLE;
rectTest = GetSelectionMarkerRect( DEHT_RIGHTMIDDLE, rect );
if( rectTest.PtInRect( point ) )
result = DEHT_RIGHTMIDDLE;
return result;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -