本文整理汇总了C#中Shape.HasControlPointCapability方法的典型用法代码示例。如果您正苦于以下问题:C# Shape.HasControlPointCapability方法的具体用法?C# Shape.HasControlPointCapability怎么用?C# Shape.HasControlPointCapability使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shape
的用法示例。
在下文中一共展示了Shape.HasControlPointCapability方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AttachGluePointToConnectionPoint
/// <override></override>
protected internal override void AttachGluePointToConnectionPoint(ControlPointId ownPointId, Shape otherShape,
ControlPointId gluePointId)
{
if (ownPointId != ControlPointId.Reference &&
!HasControlPointCapability(ownPointId, ControlPointCapabilities.Connect))
throw new NShapeException(string.Format("{0}'s point {1} has to be a connection point.", Type.Name, ownPointId));
if (!otherShape.HasControlPointCapability(gluePointId, ControlPointCapabilities.Glue))
throw new NShapeException(string.Format("{0}'s point {1} has to be a glue point.", otherShape.Type.Name, gluePointId));
throw new NotSupportedException();
}
示例2: ConnectPreviewOfShape
/// <summary>
/// Create previews of shapes connected to the given shape (and it's children) and connect them to the
/// shape's preview (or the preview of it's child)
/// </summary>
private void ConnectPreviewOfShape(IDiagramPresenter diagramPresenter, Shape shape)
{
// process shape's children
if (shape.Children != null && shape.Children.Count > 0) {
foreach (Shape childShape in shape.Children)
ConnectPreviewOfShape(diagramPresenter, childShape);
}
Shape preview = FindPreviewOfShape(shape);
foreach (ShapeConnectionInfo connectionInfo in shape.GetConnectionInfos(ControlPointId.Any, null)) {
if (!diagramPresenter.IsLayerVisible(connectionInfo.OtherShape.Layers)) continue;
if (diagramPresenter.SelectedShapes.Contains(connectionInfo.OtherShape)) {
// Do not connect previews if BOTH of the connected shapes are part of the selection because
// this would restrict movement of the connector shapes and decreases performance (many
// unnecessary FollowConnectionPointWithGluePoint() calls)
if (shape.HasControlPointCapability(connectionInfo.OwnPointId, ControlPointCapabilities.Glue)) {
if (IsConnectedToNonSelectedShape(diagramPresenter, shape)) {
Shape targetPreview = FindPreviewOfShape(connectionInfo.OtherShape);
preview.Connect(connectionInfo.OwnPointId, targetPreview, connectionInfo.OtherPointId);
}
}
}
else {
// Connect preview of shape to a non-selected shape if it is a single shape
// that has a glue point (e.g. a Label)
if (preview.HasControlPointCapability(connectionInfo.OwnPointId, ControlPointCapabilities.Glue)) {
// Only connect if the control point to be connected is not the control point to be moved
if (shape == selectedShapeAtCursorInfo.Shape &&
connectionInfo.OwnPointId != selectedShapeAtCursorInfo.ControlPointId)
preview.Connect(connectionInfo.OwnPointId, connectionInfo.OtherShape, connectionInfo.OtherPointId);
}
else
// Create a preview of the shape that is connected to the preview (recursive call)
CreateConnectedTargetPreviewShape(diagramPresenter, preview, connectionInfo);
}
}
}
示例3: RepositoryShapeConnectionEventArgs
/// <ToBeCompleted></ToBeCompleted>
public RepositoryShapeConnectionEventArgs(Shape connectorShape, ControlPointId gluePointId, Shape targetShape, ControlPointId targetPointId)
: this()
{
if (connectorShape == null) throw new ArgumentNullException("connectorShape");
if (targetShape == null) throw new ArgumentNullException("targetShape");
if (gluePointId == ControlPointId.Any || gluePointId == ControlPointId.None)
throw new ArgumentException("gluePointId");
if (!connectorShape.HasControlPointCapability(gluePointId, ControlPointCapabilities.Glue))
throw new ArgumentException(string.Format("{0} is not a glue point of {1}.", gluePointId, connectorShape.Type.FullName));
if (targetPointId == ControlPointId.Any || targetPointId == ControlPointId.None)
throw new ArgumentException("targetPointId");
if (!targetShape.HasControlPointCapability(targetPointId, ControlPointCapabilities.Connect))
throw new ArgumentException(string.Format("{0} is not a connection point of {1}.", targetPointId, targetShape.Type.FullName));
this.connection.ConnectorShape = connectorShape;
this.connection.GluePointId = gluePointId;
this.connection.TargetShape = targetShape;
this.connection.TargetPointId = targetPointId;
}
示例4: CanConnectTo
/// <summary>
/// Indicates wether the given shape can connect to the given targetShape with the specified glue point.
/// </summary>
protected bool CanConnectTo(Shape shape, ControlPointId gluePointId, Shape targetShape) {
if (shape == null) throw new ArgumentNullException("shape");
if (targetShape == null) throw new ArgumentNullException("targetShape");
// Connecting to a shape via Pointpto-shape connection is not allowed for both ends
ControlPointId connectedPoint = ControlPointId.None;
foreach (ShapeConnectionInfo sci in shape.GetConnectionInfos(ControlPointId.Any, targetShape)) {
if ((sci.OtherPointId == ControlPointId.Reference && sci.OwnPointId != gluePointId)
|| (sci.OwnPointId == ControlPointId.Reference && targetShape.HasControlPointCapability(sci.OtherPointId, ControlPointCapabilities.Glue)))
return false;
}
return true;
}
示例5: IsConnectingFeasible
private bool IsConnectingFeasible(Action action, Shape shape, ControlPointId pointId) {
if (shape != null && pointId != ControlPointId.None
&& Template.Shape.HasControlPointCapability(ControlPointId.LastVertex, ControlPointCapabilities.Glue)) {
if (shape.HasControlPointCapability(ControlPointId.Reference, ControlPointCapabilities.Connect))
return true;
else if (!shape.HasControlPointCapability(pointId, ControlPointCapabilities.Glue)
&& shape.HasControlPointCapability(pointId, ControlPointCapabilities.Connect))
return true;
}
return false;
}
示例6: IsExtendLineFeasible
private bool IsExtendLineFeasible(Action action, Shape shape, ControlPointId pointId) {
if (action != Action.None && action != Action.ExtendLine) return false;
if ((shape as ILinearShape) == null) return false;
if (pointId == ControlPointId.None) return false;
if (shape.Type != Template.Shape.Type) return false;
if (((ILinearShape)shape).VertexCount >= ((ILinearShape)shape).MaxVertexCount) return false;
if (!shape.HasControlPointCapability(pointId, ControlPointCapabilities.Glue)) return false;
if (shape.IsConnected(pointId, null) != ControlPointId.None) return false;
return true;
}