Sequence Chart Studio  svn HEAD revision
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Static Public Member Functions | Static Private Member Functions | List of all members
CMessageSnapping Class Reference

#include <messageSnapping.h>

Collaboration diagram for CMessageSnapping:
Collaboration graph

Static Public Member Functions

static bool isEnabled ()
 
static void setEnabled (bool bEnable=true)
 
static bool isArrowKeysEnabled ()
 
static MsgSnapType getSnapType ()
 
static void setSnapType (MsgSnapType snapType)
 
static std::vector
< Visio::IVShapePtr > 
getIntersectInstances (Visio::IVShapePtr msgShape, double msgPosY, MsgSnapType snapType)
 
static std::pair
< Visio::IVShapePtr,
Visio::IVShapePtr > 
getClosestInstancePair (Visio::IVShapePtr msgShape, double msgSnapPointX, double msgSnapPointY, const std::vector< Visio::IVShapePtr > &instances, MsgSnapType snapType)
 
static MsgConnectedEndpoints glueMsgToInstancesPair (Visio::IVShapePtr msgShape, Visio::IVShapePtr leftInstance, Visio::IVShapePtr rightInstance, double yPos, MsgSnapType snapType, bool dontGlueIfConnected=true)
 
static bool glueMsgToInstance (Visio::IVShapePtr msgShape, Visio::IVShapePtr instanceShape, const _bstr_t &msgCell, double yPos, VisUnitCodes units=visPageUnits)
 
static bool glueMsgToInstance (Visio::IVShapePtr msgShape, Visio::IVShapePtr instanceShape, const _bstr_t &msgCell, double yPos, MsgDirection msgDirection, bool dontGlueIfConnected=true, VisUnitCodes units=visPageUnits)
 
static MscPointgetIntersectionWithInstance (Visio::IVShapePtr msgShape, Visio::IVShapePtr instanceShape, VisUnitCodes units=visPageUnits)
 
static MscPointgetIntersectionWithInstance (const MscPoint &beginPoint, const MscPoint &endPoint, Visio::IVShapePtr instanceShape, VisUnitCodes units=visPageUnits)
 
static bool getMsgVector (Visio::IVShapePtr msgShape, MscPoint *resultVector, VisUnitCodes units=visMillimeters)
 
static void snap (Visio::IVShapePtr msgShape, double posX, double posY, MsgSnapType snapType)
 
static bool resnap (Visio::IVShapePtr msgShape, Visio::IVShapesPtr shapes, double precision=0.0000001)
 
static std::vector
< Visio::IVShapePtr > 
getConnectedInstances (Visio::IVShapePtr msgShape)
 
static bool pointsEqual (const MscPoint &point1, const MscPoint &point2, double precision=0.0000001)
 
static Visio::IVShapePtr getCoregionAt (Visio::IVShapePtr instShape, double yPos, VisUnitCodes units=visPageUnits)
 
static Visio::IVShapePtr snapEndPointToClosestInstance (Visio::IVShapePtr msgShape, _bstr_t endPointX, MsgDirection direction)
 
static void setMsgLength (Visio::IVShapePtr msgShape, MscPoint msgVector, VisCellIndices fixedColumnX)
 
static MscPointgetIntersectionWithCoregion (MscPoint beginPoint, MscPoint endPoint, Visio::IVShapePtr coregionShape, VisUnitCodes units=visPageUnits)
 
static int unglueWrongConnectedMessage (Visio::IVShapePtr msgShape, Visio::IVShapePtr instanceShape)
 
static bool unglueWrongConnectedMsgCell (Visio::IVShapePtr msgShape, const _bstr_t &msgCell, Visio::IVShapePtr instanceShape)
 

Static Private Member Functions

static bool coregionTreatment (Visio::IVShapePtr &instanceShape, MscPoint &instBegin, MscPoint &instEnd, MsgDirection posToCoregion, bool &xPos, const double &yPos, VisUnitCodes units=visPageUnits)
 
static bool jumpShape (Visio::IVShapePtr &instanceShape, MscPoint &instBegin, MscPoint &instEnd, double &yPos, TShapeType type, VisUnitCodes units=visPageUnits)
 

Detailed Description

Definition at line 28 of file messageSnapping.h.

Member Function Documentation

bool CMessageSnapping::coregionTreatment ( Visio::IVShapePtr &  instanceShape,
MscPoint instBegin,
MscPoint instEnd,
MsgDirection  posToCoregion,
bool &  xPos,
const double &  yPos,
VisUnitCodes  units = visPageUnits 
)
staticprivate

Function used to determine, whether message should be connected to coregion at given yPos, because oblique coregions have some "dead zones", where message can't be glued

Parameters
instanceShapeinstance shape, which can contains coregion(s)
xPossets xPos on the coregion to snap to (zero (left side) or one (right side))
yPosgets yPos where messsage should be snapped

Definition at line 687 of file messageSnapping.cpp.

References get_shape_type(), MscPoint::get_x(), MscPoint::get_y(), CShapeUtils::getConnectedShapes(), CShapeUtils::getCoregionHeight(), CPageUtils::getNormalVec(), CShapeUtils::getShapeCell(), MSG_LEFT, MSG_RIGHT, ST_BMSC_COREGION, ST_BMSC_INSTANCE, and swap().

Referenced by glueMsgToInstance().

std::pair< Visio::IVShapePtr, Visio::IVShapePtr > CMessageSnapping::getClosestInstancePair ( Visio::IVShapePtr  msgShape,
double  msgSnapPointX,
double  msgSnapPointY,
const std::vector< Visio::IVShapePtr > &  instances,
MsgSnapType  snapType 
)
static

returns two closest instances for given message (first of the pair is instance on the left from the message, second is ono the right)

Definition at line 107 of file messageSnapping.cpp.

References _ip, get_shape_type(), MscPoint::get_x(), MscPoint::get_y(), getIntersectionWithInstance(), CShapeUtils::isPointInCoregionArea(), CShapeUtils::isPointOnCoregion(), CShapeUtils::isPointOnInstancesLine(), MSSNAP_PRESERVE_SLOPE, MSSNAP_STRAIGHTEN, MscPoint::set_x(), MscPoint::set_y(), ST_BMSC_MESSAGE_FOUND, ST_BMSC_MESSAGE_LOST, and swap().

Referenced by snap().

std::vector< Visio::IVShapePtr > CMessageSnapping::getConnectedInstances ( Visio::IVShapePtr  msgShape)
static

Get all instances the given message is connected to

Definition at line 448 of file messageSnapping.cpp.

References get_shape_type(), and ST_BMSC_COREGION.

Referenced by CStudioAddon::HandleKeyDown(), CStudioAddon::HandleNonePending(), and CDocumentMonitor::OnMenuMessageJump().

Visio::IVShapePtr CMessageSnapping::getCoregionAt ( Visio::IVShapePtr  instShape,
double  yPos,
VisUnitCodes  units = visPageUnits 
)
static
std::vector< Visio::IVShapePtr > CMessageSnapping::getIntersectInstances ( Visio::IVShapePtr  msgShape,
double  msgPosY,
MsgSnapType  snapType 
)
static

Get All instances that intersect current msg, 3 types of intersecting - STRAIGHTEN, PRESERVE VERTICAL, PREVERSE SLOPE returns vector of pointers to instances, if zero, there are no intersecting instances

Definition at line 53 of file messageSnapping.cpp.

References get_shape_type(), getIntersectionWithInstance(), CShapeUtils::getShapeCell(), MSSNAP_PRESERVE_SLOPE, MSSNAP_PRESERVE_VERTICAL, MSSNAP_STRAIGHTEN, result, ST_BMSC_INSTANCE, and swap().

Referenced by CMessageJump::jump(), snap(), and snapEndPointToClosestInstance().

MscPoint * CMessageSnapping::getIntersectionWithCoregion ( MscPoint  beginPoint,
MscPoint  endPoint,
Visio::IVShapePtr  coregionShape,
VisUnitCodes  units = visPageUnits 
)
static
MscPoint * CMessageSnapping::getIntersectionWithInstance ( Visio::IVShapePtr  msgShape,
Visio::IVShapePtr  instanceShape,
VisUnitCodes  units = visPageUnits 
)
static
MscPoint * CMessageSnapping::getIntersectionWithInstance ( const MscPoint beginPoint,
const MscPoint endPoint,
Visio::IVShapePtr  instanceShape,
VisUnitCodes  units = visPageUnits 
)
static
bool CMessageSnapping::getMsgVector ( Visio::IVShapePtr  msgShape,
MscPoint resultVector,
VisUnitCodes  units = visMillimeters 
)
static

Get Directional vector of given message shape

Definition at line 349 of file messageSnapping.cpp.

References isMessageShape(), MscPoint::set_x(), and MscPoint::set_y().

Referenced by CStudioAddon::HandleNonePending(), CMessageJump::jump(), and snap().

MsgSnapType CMessageSnapping::getSnapType ( )
static
bool CMessageSnapping::glueMsgToInstance ( Visio::IVShapePtr  msgShape,
Visio::IVShapePtr  instanceShape,
const _bstr_t &  msgCell,
double  yPos,
VisUnitCodes  units = visPageUnits 
)
static

Glue given message to instance, but only to "line" of instance, rectangles at the bottom and top are ignored

Parameters
msgCellmessage cell which should be glued (e.g. BeginX, EndX)
yPosvertical position where to glue message to instance (in page units - visPageUnits)

Definition at line 239 of file messageSnapping.cpp.

References CShapeUtils::getMsgDirection(), and unglueWrongConnectedMessage().

Referenced by glueMsgToInstancesPair(), resnap(), and snapEndPointToClosestInstance().

bool CMessageSnapping::glueMsgToInstance ( Visio::IVShapePtr  msgShape,
Visio::IVShapePtr  instanceShape,
const _bstr_t &  msgCell,
double  yPos,
MsgDirection  msgDirection,
bool  dontGlueIfConnected = true,
VisUnitCodes  units = visPageUnits 
)
static
MsgConnectedEndpoints CMessageSnapping::glueMsgToInstancesPair ( Visio::IVShapePtr  msgShape,
Visio::IVShapePtr  leftInstance,
Visio::IVShapePtr  rightInstance,
double  yPos,
MsgSnapType  snapType,
bool  dontGlueIfConnected = true 
)
static

Glue given message on the given instances If leftInstance or rightInstance is NULL, message will be connected only to not null one designed only for horizontal messages (diagonal messages will be snapped according their PinX point and reformed to horizontal messages)

Parameters
onlyOnInstanceLineif true avoid connection message on instace's "rectangles" on the top and the bottom

Definition at line 196 of file messageSnapping.cpp.

References MscPoint::get_y(), getIntersectionWithInstance(), CShapeUtils::getMsgDirection(), CShapeUtils::getShapeCell(), glueMsgToInstance(), MSSNAP_PRESERVE_SLOPE, MSSNAP_PRESERVE_VERTICAL, MSSNAP_STRAIGHTEN, result, and unglueWrongConnectedMessage().

Referenced by CMessageJump::jump(), and snap().

bool CMessageSnapping::isArrowKeysEnabled ( )
static
bool CMessageSnapping::isEnabled ( )
static
bool CMessageSnapping::jumpShape ( Visio::IVShapePtr &  instanceShape,
MscPoint instBegin,
MscPoint instEnd,
double &  yPos,
TShapeType  type,
VisUnitCodes  units = visPageUnits 
)
staticprivate

Function to avoid connecting message behind shapes

Definition at line 737 of file messageSnapping.cpp.

References MscPoint::get_y(), CShapeUtils::getConnectedShapes(), CShapeUtils::getShapeCell(), and swap().

Referenced by glueMsgToInstance().

bool CMessageSnapping::pointsEqual ( const MscPoint point1,
const MscPoint point2,
double  precision = 0.0000001 
)
static

Definition at line 498 of file messageSnapping.cpp.

References MscPoint::get_x(), and MscPoint::get_y().

Referenced by CMessageJump::getClosestInstanceFromShape(), and resnap().

bool CMessageSnapping::resnap ( Visio::IVShapePtr  msgShape,
Visio::IVShapesPtr  shapes,
double  precision = 0.0000001 
)
static
void CMessageSnapping::setEnabled ( bool  bEnable = true)
static
void CMessageSnapping::setMsgLength ( Visio::IVShapePtr  msgShape,
MscPoint  msgVector,
VisCellIndices  fixedColumnX 
)
static

Set length of message given by direction and length of msgVector

Parameters
msgVectorVector must be in milimeters!!!
fixedColumnXFixed column (vis1DBeginX, vis1DEndX) stays fixed and other side of message will be prolonged

Definition at line 554 of file messageSnapping.cpp.

References MscPoint::get_x(), MscPoint::get_y(), and isMessageShape().

Referenced by CStudioAddon::HandleNonePending(), and CMessageJump::jump().

void CMessageSnapping::setSnapType ( MsgSnapType  snapType)
static

Definition at line 48 of file messageSnapping.cpp.

References Registry::get(), Registry::setRegistry(), and SNAP_REG_PATH.

void CMessageSnapping::snap ( Visio::IVShapePtr  msgShape,
double  posX,
double  posY,
MsgSnapType  snapType 
)
static

automatically snaps current message to nearest instances

Parameters
msgShapea shape to snap
posXMouseX position for closest instances computing
posYMouseY position for closest instances computing

Definition at line 364 of file messageSnapping.cpp.

References _sp, MscPoint::get_x(), MscPoint::get_y(), getClosestInstancePair(), getIntersectInstances(), CShapeUtils::getMsgDirection(), getMsgVector(), glueMsgToInstancesPair(), MSG_LEFT, MSSNAP_PRESERVE_VERTICAL, MSSNAP_STRAIGHTEN, and CShapeUtils::swapShape().

Referenced by CStudioAddon::HandleNonePending(), CDocumentMonitor::OnDropShape(), and CDocumentMonitor::OnMenuMessageJump().

Visio::IVShapePtr CMessageSnapping::snapEndPointToClosestInstance ( Visio::IVShapePtr  msgShape,
_bstr_t  endPointX,
MsgDirection  direction 
)
static
int CMessageSnapping::unglueWrongConnectedMessage ( Visio::IVShapePtr  msgShape,
Visio::IVShapePtr  instanceShape 
)
static

Return number of unglued endpoints

Definition at line 622 of file messageSnapping.cpp.

References unglueWrongConnectedMsgCell().

Referenced by glueMsgToInstance(), and glueMsgToInstancesPair().

bool CMessageSnapping::unglueWrongConnectedMsgCell ( Visio::IVShapePtr  msgShape,
const _bstr_t &  msgCell,
Visio::IVShapePtr  instanceShape 
)
static

Remove all connection points, which are wrong - message is glued to instance behind coregion or wrong to coregion (bottom) | |<-—|-— | | and right message <----—| |

Definition at line 635 of file messageSnapping.cpp.

References COR_LEFT, COR_NONE, COR_RIGHT, CShapeUtils::getMsgDirection(), CShapeUtils::isPointBehindShape(), CShapeUtils::isPointInCoregionArea(), MSG_LEFT, result, MscPoint::set_x(), MscPoint::set_y(), CShapeUtils::unglueShape(), and CShapeUtils::wherePointOnCoregion().

Referenced by unglueWrongConnectedMessage().


The documentation for this class was generated from the following files:

SourceForge.net Logo
Generated on Fri Jan 15 2016 16:26:57 for Sequence Chart Studio by  doxygen