本文整理汇总了C#中ControlPointId类的典型用法代码示例。如果您正苦于以下问题:C# ControlPointId类的具体用法?C# ControlPointId怎么用?C# ControlPointId使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ControlPointId类属于命名空间,在下文中一共展示了ControlPointId类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HasControlPointCapability
/// <override></override>
public override bool HasControlPointCapability(ControlPointId controlPointId, ControlPointCapabilities controlPointCapability) {
switch (controlPointId) {
case TopCenterControlPoint:
case MiddleLeftControlPoint:
case MiddleRightControlPoint:
case BottomCenterControlPoint:
return ((controlPointCapability & ControlPointCapabilities.Resize) != 0 || ((controlPointCapability & ControlPointCapabilities.Connect) != 0 && IsConnectionPointEnabled(controlPointId)));
default:
return base.HasControlPointCapability(controlPointId, controlPointCapability);
}
}
示例2: HasControlPointCapability
/// <override></override>
public override bool HasControlPointCapability(ControlPointId controlPointId,
ControlPointCapabilities controlPointCapability)
{
if (controlPointId == controlPoints.Length) {
return ((controlPointCapability & ControlPointCapabilities.Rotate) > 0
|| (controlPointCapability & ControlPointCapabilities.Reference) > 0
||
((controlPointCapability & ControlPointCapabilities.Connect) > 0 && IsConnectionPointEnabled(controlPointId)));
}
else if (controlPointId >= 1) {
return ((controlPointCapability & ControlPointCapabilities.Resize) > 0
||
((controlPointCapability & ControlPointCapabilities.Connect) > 0 && IsConnectionPointEnabled(controlPointId)));
}
else
return base.HasControlPointCapability(controlPointId, controlPointCapability);
}
示例3: HasControlPointCapability
/// <override></override>
public override bool HasControlPointCapability(ControlPointId controlPointId,
ControlPointCapabilities controlPointCapability)
{
switch (controlPointId) {
case ControlPoint1:
case ControlPoint2:
case ControlPoint3:
return ((controlPointCapability & ControlPointCapabilities.Resize) > 0
||
((controlPointCapability & ControlPointCapabilities.Connect) > 0 &&
IsConnectionPointEnabled(controlPointId)));
case RotateControlPoint:
return ((controlPointCapability & ControlPointCapabilities.Rotate) > 0
|| (controlPointCapability & ControlPointCapabilities.Reference) > 0
||
((controlPointCapability & ControlPointCapabilities.Connect) > 0 &&
IsConnectionPointEnabled(controlPointId)));
default:
return base.HasControlPointCapability(controlPointId, controlPointCapability);
}
}
示例4: CalcLineCapAngle
/// <summary>
/// Calculates the angle of the line cap (this is usually the angle between the line's end vertex the its predecessor).
/// If the predecessor of the line's end vertex is inside the line cap, the intersection point between the line cap and
/// the rest of the line is calculated, like GDI+ does.
/// </summary>
public static float CalcLineCapAngle(Point[] points, ControlPointId pointId, Pen pen)
{
if (points == null) throw new ArgumentNullException("points");
if (points.Length < 2) throw new ArgumentException("Parameter points must have at least 2 elements.");
if (pointId != ControlPointId.FirstVertex && pointId != ControlPointId.LastVertex) throw new ArgumentException("pointId");
float result = float.NaN;
// Get required infos: Size of the cap, start point and point processing direction
int startIdx = -1, step = 0;
float capInset = 0;
if (pointId == ControlPointId.FirstVertex) {
startIdx = 0;
step = 1;
if (pen.StartCap == LineCap.Custom)
capInset = pen.CustomStartCap.BaseInset * pen.Width;
} else if (pointId == ControlPointId.LastVertex) {
startIdx = points.Length - 1;
step = -1;
if (pen.EndCap == LineCap.Custom)
capInset = pen.CustomEndCap.BaseInset * pen.Width;
} else throw new NotSupportedException();
// Store point where the line cap is located
Point capPoint = points[startIdx];
int maxIdx = points.Length - 1;
int destIdx = startIdx + step;
// Find first point *outside* the cap's area
while (Geometry.DistancePointPoint(capPoint, points[destIdx]) < capInset && (destIdx > 0 && destIdx < maxIdx)) {
startIdx = destIdx;
destIdx += step;
}
// Calculate cap angle
PointF p = Geometry.IntersectCircleWithLine(capPoint, capInset, points[startIdx], points[destIdx], true);
if (Geometry.IsValid(p) && Geometry.LineContainsPoint(points[startIdx], points[destIdx], false, p.X, p.Y, 1))
result = Geometry.RadiansToDegrees(Geometry.Angle(capPoint, p));
if (float.IsNaN(result))
result = Geometry.RadiansToDegrees(Geometry.Angle(points[startIdx], points[destIdx]));
Debug.Assert(!float.IsNaN(result));
return result;
}
示例5: 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();
}
示例6: GetControlPointPosition
/// <override></override>
public override Point GetControlPointPosition(ControlPointId controlPointId)
{
if (controlPointId == ControlPointId.Reference)
//return location;
return children.Center;
else if (controlPointId == RotatePointId)
return RotatePoint;
else if (controlPointId == ControlPointId.None)
throw new ArgumentException(string.Format("{0} is not a valid {1} for this operation.", controlPointId,
typeof (ControlPointId).Name));
return Point.Empty;
}
示例7: FollowConnectionPointWithGluePoint
/// <override></override>
public override void FollowConnectionPointWithGluePoint(ControlPointId gluePointId, Shape connectedShape,
ControlPointId movedPointId)
{
// nothing to do
}
示例8: GetConnectionInfo
/// <override></override>
public override ShapeConnectionInfo GetConnectionInfo(ControlPointId gluePointId, Shape otherShape)
{
return ShapeConnectionInfo.Empty;
}
示例9: Disconnect
/// <override></override>
public override void Disconnect(ControlPointId gluePointId)
{
// nothing to do
}
示例10: HasControlPointCapability
/// <override></override>
public override bool HasControlPointCapability(ControlPointId controlPointId, ControlPointCapabilities controlPointCapability)
{
if (controlPointId == BottomCenterControlPoint && (controlPointCapability == ControlPointCapabilities.Connect))
return false;
else return base.HasControlPointCapability(controlPointId, controlPointCapability);
}
示例11: GetControlPointPosition
/// <override></override>
public override Point GetControlPointPosition(ControlPointId controlPointId)
{
if (controlPointId == ControlPointId.Reference) {
Point center = Point.Empty;
center.X = X;
center.Y = Y;
return center;
} else if (controlPointId == ControlPointId.None)
throw new NShapeException("NotSupported PointId.");
if (drawCacheIsInvalid) UpdateDrawCache();
int index = GetControlPointIndex(controlPointId);
return controlPoints[index];
}
示例12: HasControlPointCapability
/// <override></override>
public override bool HasControlPointCapability(ControlPointId controlPointId, ControlPointCapabilities controlPointCapability)
{
//if (ImageLayout == ImageLayoutMode.Original) {
// if ((controlPointCapability & ControlPointCapabilities.Glue) != 0)
// return false;
// if ((controlPointCapability & ControlPointCapabilities.Connect) != 0 ) {
// return (controlPointId != RotateControlPointId && IsConnectionPointEnabled(controlPointId));
// }
// if ((controlPointCapability & ControlPointCapabilities.Reference) != 0) {
// if (controlPointId == RotateControlPointId || controlPointId == ControlPointId.Reference)
// return true;
// }
// if ((controlPointCapability & ControlPointCapabilities.Rotate) != 0) {
// if (controlPointId == RotateControlPointId)
// return true;
// }
return base.HasControlPointCapability(controlPointId, controlPointCapability);
//} else return base.HasControlPointCapability(controlPointId, controlPointCapability);
}
示例13: FakeShapeConnection
public void FakeShapeConnection(FilterSetupShapeBase shape, ControlPointId controlPoint, bool shapeIsSource)
{
DataFlowConnectionLine line = (DataFlowConnectionLine)project.ShapeTypes["DataFlowConnectionLine"].CreateInstance();
diagramDisplay.InsertShape(line);
diagramDisplay.Diagram.Shapes.SetZOrder(line, 100);
line.SecurityDomainName = SECURITY_DOMAIN_FIXED_SHAPE_NO_CONNECTIONS_DELETABLE;
line.EndCapStyle = new CapStyle("fakecapstyle", CapShape.Flat, project.Design.ColorStyles.Blue);
//line.LineStyle = new LineStyle("fakelinestyle", 1, project.Design.ColorStyles.Gray);
line.LineStyle = project.Design.LineStyles.Dashed;
if (shapeIsSource) {
line.SourceDataFlowComponentReference = new DataFlowComponentReference(shape.DataFlowComponent, shape.GetOutputNumberForControlPoint(controlPoint));
line.Connect(ControlPointId.FirstVertex, shape, controlPoint);
line.MoveControlPointTo(ControlPointId.LastVertex,
shape.GetControlPointPosition(controlPoint).X + 40,
shape.GetControlPointPosition(controlPoint).Y,
ResizeModifiers.None);
} else {
line.DestinationDataComponent = shape.DataFlowComponent;
line.Connect(ControlPointId.LastVertex, shape, controlPoint);
line.MoveControlPointTo(ControlPointId.FirstVertex,
shape.GetControlPointPosition(controlPoint).X - 40,
shape.GetControlPointPosition(controlPoint).Y,
ResizeModifiers.None);
}
}
示例14: _RemoveDataFlowLinksFromShapePoint
private void _RemoveDataFlowLinksFromShapePoint(FilterSetupShapeBase shape, ControlPointId controlPoint, bool removePatching)
{
foreach (ShapeConnectionInfo ci in shape.GetConnectionInfos(controlPoint, null)) {
if (ci.OtherShape == null)
continue;
DataFlowConnectionLine line = ci.OtherShape as DataFlowConnectionLine;
if (line == null)
throw new Exception("a shape was connected to something other than a DataFlowLine!");
// only try and unpatch if we're supposed to; this function can also be used to hide/remove lines from the display
if (removePatching) {
// if the line is connected with the given shape as the SOURCE, remove the unknown DESTINATION's
// source (on the other end of the line). Otherwise, it (should) be that the given shape is the
// destination; so reset it's source. If neither of these are true, freak out.
if (line.GetConnectionInfo(ControlPointId.FirstVertex, null).OtherShape == shape) {
if (line.DestinationDataComponent != null)
VixenSystem.DataFlow.ResetComponentSource(line.DestinationDataComponent);
}
else if (line.GetConnectionInfo(ControlPointId.LastVertex, null).OtherShape == shape) {
VixenSystem.DataFlow.ResetComponentSource(shape.DataFlowComponent);
}
else {
throw new Exception("Can't reset a link that has neither the source or destination for the given shape!");
}
OnPatchingUpdated();
}
_RemoveShapeFromDiagram(line, false);
}
}
示例15: TemplateControllerPointMappingChangedEventArgs
/// <ToBeCompleted></ToBeCompleted>
public TemplateControllerPointMappingChangedEventArgs(Template template, ControlPointId controlPointId,
TerminalId oldTerminalId, TerminalId newTerminalId)
: base(template)
{
this.controlPointId = controlPointId;
this.oldTerminalId = oldTerminalId;
this.newTerminalId = newTerminalId;
}