本文整理汇总了C#中ControlPointCapabilities类的典型用法代码示例。如果您正苦于以下问题:C# ControlPointCapabilities类的具体用法?C# ControlPointCapabilities怎么用?C# ControlPointCapabilities使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ControlPointCapabilities类属于命名空间,在下文中一共展示了ControlPointCapabilities类的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: FindNearestControlPoint
/// <override></override>
public override ControlPointId FindNearestControlPoint(int x, int y, int distance,
ControlPointCapabilities controlPointCapability)
{
if ((controlPointCapability & ControlPointCapabilities.Reference) > 0) {
if (Geometry.DistancePointPoint(x, y, X, Y) <= distance)
return ControlPointId.Reference;
}
else if ((controlPointCapability & ControlPointCapabilities.Rotate) > 0) {
if (Geometry.DistancePointPoint(x, y, RotatePoint.X, RotatePoint.Y) <= distance)
return RotatePointId;
}
return ControlPointId.None;
}
示例5: HitTest
/// <override></override>
public override ControlPointId HitTest(int x, int y, ControlPointCapabilities controlPointCapability, int range)
{
//if ((controlPointCapability & ControlPointCapabilities.Reference) > 0)
// if (Geometry.DistancePointPoint(X, Y, x, y) <= distance)
// return true;
if ((controlPointCapability & ControlPointCapabilities.Rotate) > 0) {
if (Geometry.DistancePointPoint(RotatePoint.X, RotatePoint.Y, x, y) <= range)
return RotatePointId;
controlPointCapability ^= ControlPointCapabilities.Rotate;
}
foreach (Shape shape in children) {
ControlPointId pointId = shape.HitTest(x, y, controlPointCapability, range);
//if (pointId != ControlPointId.None) return pointId;
// All control points but the rotate point are deactivated
if (pointId != ControlPointId.None) return ControlPointId.Reference;
}
return ControlPointId.None;
}
示例6: HasControlPointCapability
/// <override></override>
public override bool HasControlPointCapability(ControlPointId controlPointId, ControlPointCapabilities controlPointCapability)
{
switch (controlPointId) {
case TopLeftConnectionPoint:
case TopRightConnectionPoint:
case BottomLeftConnectionPoint:
case BottomRightConnectionPoint:
return ((controlPointCapability & ControlPointCapabilities.Connect) != 0 && IsConnectionPointEnabled(controlPointId));
default:
return base.HasControlPointCapability(controlPointId, controlPointCapability);
}
}
示例7: HasControlPointCapability
/// <override></override>
public override bool HasControlPointCapability(ControlPointId controlPointId, ControlPointCapabilities controlPointCapability)
{
if (controlPointId == ControlPointId.Reference)
return (controlPointCapability & ControlPointCapabilities.Connect) != 0;
else return base.HasControlPointCapability(controlPointId, controlPointCapability);
}
示例8: 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);
}
示例9: HasControlPointCapability
/// <override></override>
public override bool HasControlPointCapability(ControlPointId controlPointId, ControlPointCapabilities controlPointCapability)
{
switch (controlPointId) {
case TopLeftControlPoint:
case TopCenterControlPoint:
case TopRightControlPoint:
case MiddleLeftControlPoint:
case MiddleRightControlPoint:
case BottomLeftControlPoint:
case BottomCenterControlPoint:
case BottomRightControlPoint:
return (controlPointCapability & ControlPointCapabilities.Resize) != 0;
case MiddleCenterControlPoint:
case ControlPointId.Reference:
return ((controlPointCapability & ControlPointCapabilities.Rotate) != 0
|| (controlPointCapability & ControlPointCapabilities.Reference) != 0
|| ((controlPointCapability & ControlPointCapabilities.Connect) != 0
&& IsConnectionPointEnabled(controlPointId)));
default:
return false;
}
}
示例10: HitTest
///// <summary>Overriden method. Check base class for documentation.</summary>
//public override Point CalculateConnectionFoot(int x1, int y1, int x2, int y2) {
// return CalculateConnectionFoot(x1, y1);
//}
/// <summary>Overriden method. Check base class for documentation.</summary>
public override ControlPointId HitTest(int x, int y, ControlPointCapabilities controlPointCapability, int range)
{
ControlPointId result = ControlPointId.None;
//
// We first search for a hit control point
for (int cpIdx = 0; cpIdx < ControlPointCount; ++cpIdx) {
// Get positions of the current control points and test on hit.
LineControlPoint ctrlPoint = GetControlPoint(cpIdx);
Point currPos = ctrlPoint.GetPosition();
if (Geometry.DistancePointPoint(x, y, currPos.X, currPos.Y) <= range) {
if (HasControlPointCapability(ctrlPoint.Id, controlPointCapability))
result = GetControlPointId(cpIdx);
break;
}
}
if (result == ControlPointId.None) {
int lineRange = (int)Math.Ceiling(LineStyle.LineWidth / 2f) + 1;
Point lastKnee;
int cpIdx = -1;
FindNextKnee(ref cpIdx, out lastKnee);
Point knee;
while (FindNextKnee(ref cpIdx, out knee)) {
if (Geometry.DistancePointLine(x, y, lastKnee.X, lastKnee.Y, knee.X, knee.Y, true) <= lineRange) {
result = ControlPointId.Reference;
break;
}
lastKnee = knee;
}
}
return result;
}
示例11: ReferenceControlPointHasCapability
protected override bool ReferenceControlPointHasCapability(ControlPointCapabilities controlPointCapability)
{
return (controlPointCapability & ControlPointCapabilities.Reference) > 0 ||
(controlPointCapability & ControlPointCapabilities.Connect) > 0;
}
示例12: HasControlPointCapability
public override bool HasControlPointCapability(ControlPointId controlPointId,
ControlPointCapabilities controlPointCapability)
{
if (controlPointId == ControlPointId.None || controlPointId == ControlPointId.Any)
return false;
// all control points have at least the 'none' capability. Hopefully, they might even have more...
if (controlPointCapability == ControlPointCapabilities.None)
return true;
int index = GetControlPointIndex(controlPointId);
if (index > 0 && index <= InputCount + OutputCount) {
return ((controlPointCapability & ControlPointCapabilities.Connect) > 0 ||
(controlPointCapability & ControlPointCapabilities.Resize) > 0);
}
if (controlPointId == ControlPointId.Reference || index == 0) {
return ReferenceControlPointHasCapability(controlPointCapability);
}
// default to any other control points not having any capabilities (shouldn't be any left, really)
return false;
}
示例13: FindShapesSortedByZOrder
public IEnumerable<Shape> FindShapesSortedByZOrder(IDiagramPresenter diagramPresenter, int x, int y,
ControlPointCapabilities pointCapabilities, int distance)
{
return FindVisibleShapes(diagramPresenter, x, y, pointCapabilities, distance).OrderByDescending(s => s.ZOrder);
}
示例14: HasControlPointCapability
/// <override></override>
public override bool HasControlPointCapability(ControlPointId controlPointId,
ControlPointCapabilities controlPointCapability)
{
switch (controlPointId) {
case ControlPointId.Reference:
case RotatePointControlPoint:
return ((controlPointCapability & ControlPointCapabilities.Reference) != 0
|| (controlPointCapability & ControlPointCapabilities.Rotate) != 0
|| ((controlPointCapability & ControlPointCapabilities.Connect) != 0
&& IsConnectionPointEnabled(controlPointId)));
default:
if (controlPointId > 0 && controlPointId < RotatePointControlPoint)
return ((controlPointCapability & ControlPointCapabilities.Resize) != 0
|| ((controlPointCapability & ControlPointCapabilities.Connect) != 0
&& IsConnectionPointEnabled(controlPointId)));
else
return base.HasControlPointCapability(controlPointId, controlPointCapability);
}
}
示例15: HitTest
/// <override></override>
public override ControlPointId HitTest(int x, int y, ControlPointCapabilities controlPointCapability, int range)
{
return base.HitTest(x, y, controlPointCapability, range);
}