本文整理汇总了C#中ShapeLink类的典型用法代码示例。如果您正苦于以下问题:C# ShapeLink类的具体用法?C# ShapeLink怎么用?C# ShapeLink使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ShapeLink类属于命名空间,在下文中一共展示了ShapeLink类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CanLink
public override bool CanLink(ShapeLink other)
{
if (!(other is AnchorLinkTarget))
return false;
// If we are already connected, accept the link (such calls may occur)
if (HasLinkTo(other))
return true;
// Do not allow more than two connections for a constraint link
// (a constraint accepts two anchors at maximum)
if (Links.Count >= 2)
return false;
return true;
}
示例2: CanLink
/// <summary>
/// Check whether src can be linked to target. Either src or target has this shape as owner
/// </summary>
/// <param name="src">the link source</param>
/// <param name="target">the link target</param>
/// <returns></returns>
public override bool CanLink(ShapeLink src, ShapeLink target)
{
if (base.CanLink(src,target))
return true;
if (target.OwnerShape==this)
{
if (src is LinkSourceVisiblity)
return true;
}
return false;
}
示例3: SetLinkStatus
void SetLinkStatus(ShapeLink src, ShapeLink target, bool bStatus)
{
if (_engineInstance==null)
return;
// see if we can (un-)link to the custom sources/targets provided by the native entity class
IEngineInstanceObject3D targetInst = null;
int iLinkIndex = -1;
string otherName = null;
if (src.OwnerShape==this)
{
if (src is LinkSourceObject3D)
iLinkIndex = ((LinkSourceObject3D)src).iIndex;
else if (src is LinkBiDirectionalObject3D)
iLinkIndex = ((LinkBiDirectionalObject3D)src).iIndex;
targetInst = target.OwnerShape._engineInstance as IEngineInstanceObject3D;
otherName = target.PrimaryStringId;
}
else if (target.OwnerShape==this)
{
if (target is LinkTargetObject3D)
iLinkIndex = ((LinkTargetObject3D)target).iIndex;
else if (target is LinkBiDirectionalObject3D)
iLinkIndex = ((LinkBiDirectionalObject3D)target).iIndex;
targetInst = src.OwnerShape._engineInstance as IEngineInstanceObject3D;
otherName = src.PrimaryStringId;
}
if (iLinkIndex >= 0 && targetInst != null)
EngineEntity.OnLink(iLinkIndex, targetInst, otherName, bStatus);
}
示例4: OnUnlink
/// <summary>
/// Overridden function
/// </summary>
/// <param name="src"></param>
/// <param name="target"></param>
public override void OnUnlink(ShapeLink src, ShapeLink target)
{
base.OnUnlink(src, target); // handles trigger linking
SetLinkStatus(src, target, false);
}
示例5: CanLink
/// <summary>
/// Overridden function
/// </summary>
/// <param name="src"></param>
/// <param name="target"></param>
/// <returns></returns>
public override bool CanLink(ShapeLink src, ShapeLink target)
{
if (base.CanLink (src, target))
return true;
// see if we can link to the custom sources/targets provided by the native entity class
if (_engineInstance!=null)
{
IEngineInstanceObject3D targetInst = null;
int iLinkIndex = -1;
string otherName = null;
if (src.OwnerShape == this)
{
if (src is LinkSourceObject3D)
iLinkIndex = ((LinkSourceObject3D)src).iIndex;
else if (src is LinkBiDirectionalObject3D)
iLinkIndex = ((LinkBiDirectionalObject3D)src).iIndex;
targetInst = target.OwnerShape._engineInstance as IEngineInstanceObject3D;
otherName = target.PrimaryStringId;
}
else if (target.OwnerShape==this)
{
if (target is LinkTargetObject3D)
iLinkIndex = ((LinkTargetObject3D)target).iIndex;
else if (target is LinkBiDirectionalObject3D)
iLinkIndex = ((LinkBiDirectionalObject3D)target).iIndex;
targetInst = src.OwnerShape._engineInstance as IEngineInstanceObject3D;
otherName = src.PrimaryStringId;
}
if (iLinkIndex >= 0 && targetInst != null)
if (EngineEntity.CanLink(iLinkIndex, targetInst, otherName))
return true;
}
return false;
}
示例6: CanLink
/// <summary>
/// Check whether src can be linked to target. Either src or target has this shape as owner
/// </summary>
/// <param name="src">the link source</param>
/// <param name="target">the link target</param>
/// <returns>true, if the two can be linked</returns>
public override bool CanLink(ShapeLink src, ShapeLink target)
{
if (base.CanLink(src,target))
return true;
if (target.OwnerShape==this)
if (src is LinkSourceConstraint) return true;
return false;
}
示例7: OnUnlink
/// <summary>
/// unlinks a target from a source. Either src or target has this shape as owner
/// </summary>
/// <param name="src">the link source</param>
/// <param name="target">the link target</param>
public override void OnUnlink(ShapeLink src, ShapeLink target)
{
base.OnUnlink(src, target);
// Ignore links which don't belong to us
if (src.OwnerShape != this)
return;
// Get the anchor the target link points to
AnchorShape anchorShape = GetAnchorFromLink(target);
if (anchorShape == null || !HasEngineInstance())
return;
bool bResult = EngineConstraintChainInstance.RemoveAnchor((long)anchorShape.UniqueID);
Debug.Assert(bResult == true);
}
示例8: OnUnlink
/// <summary>
/// Performs the unlinking
/// </summary>
/// <param name="src"></param>
/// <param name="target"></param>
public override void OnUnlink(ShapeLink src, ShapeLink target)
{
base.OnUnlink (src, target);
// forward the unlinking to the engine instance so that the native class can unlink from other native instances
if (src.OwnerShape==this && (target is BidirectionalNodeLink))
this.EngineNode.UnLinkNode((UIEngineInstanceDialog)target.OwnerShape._engineInstance);
if (target.OwnerShape==this && (src is BidirectionalNodeLink))
this.EngineNode.UnLinkNode((UIEngineInstanceDialog)src.OwnerShape._engineInstance);
}
示例9: CanLink
public override bool CanLink(ShapeLink src, ShapeLink target)
{
if (target.OwnerShape == this && (target is LinkTargetPath))
return true;
return base.CanLink(src, target);
}
示例10: CanLink
/// <summary>
/// Check whether src can be linked to target. Either src or target has this shape as owner
/// </summary>
/// <param name="src">the link source</param>
/// <param name="target">the link target</param>
/// <returns></returns>
public override bool CanLink(ShapeLink src, ShapeLink target)
{
if (base.CanLink(src,target))
return true;
if (src.OwnerShape==this)
{
if (target is LinkTargetVisiblity)
return true;
if (target is LinkTargetObject3D) // allow for linking with custom entity links
return target.OwnerShape is EntityShape;
}
return false;
}
示例11: CanLink
/// <summary>
/// Inidcates whether a shape can be linked to this shape
/// </summary>
/// <param name="child">Shape instance to test</param>
/// <returns>true, if the shape can be linked</returns>
public override bool CanLink(ShapeLink src, ShapeLink target)
{
if (base.CanLink (src, target))
return true;
// check whether we are linking two nodes. The node can be a target or source.
// we always link in both directions node1 <-> node2
return (src is BidirectionalNodeLink) && (target is BidirectionalNodeLink);
}
示例12: OnLink
public override void OnLink(ShapeLink src, ShapeLink target)
{
base.OnLink(src, target);
// additionally notify target...
if (src.OwnerShape == this)
{
target.OwnerShape.OnLink(src, target);
}
}
示例13: CanLink
/// <summary>
/// Check whether src can be linked to target
/// </summary>
/// <param name="src"></param>
/// <param name="target"></param>
/// <returns></returns>
public override bool CanLink(ShapeLink src, ShapeLink target)
{
if (base.CanLink(src,target))
return true;
if (src.OwnerShape==this)
{
if (target is LinkTargetConstraint) return true;
}
return false;
}
示例14: GetAnchorFromLink
/// <summary>
/// Gets the anchor which belongs to the passed link target
/// </summary>
/// <param name="linkTarget">link target</param>
/// <returns>anchor instance</returns>
private AnchorShape GetAnchorFromLink(ShapeLink linkTarget)
{
// Get the anchor shape which is connected to the passed link
AnchorShape anchorShape = linkTarget.OwnerShape as AnchorShape;
Debug.Assert(anchorShape != null);
return anchorShape;
}
示例15: OnUnlink
/// <summary>
/// unlinks a target from a source. Either src or target has this shape as owner
/// </summary>
/// <param name="src">the link source</param>
/// <param name="target">the link target</param>
public override void OnUnlink(ShapeLink src, ShapeLink target)
{
base.OnUnlink (src, target);
// perform the unlinking on the engine objects
if (target.OwnerShape==this)
{
VisibilityObjectShape visobjShape = src.OwnerShape as VisibilityObjectShape;
if (visobjShape!=null && visobjShape._engineInstance!=null) // at least the engine instance of the constraint can be null
EngineMirror.RemoveVisibilityObject(visobjShape._engineInstance as EngineInstanceVisibilityObject);
}
}