当前位置: 首页>>代码示例>>C#>>正文


C# EventDB.ReplaceControlPoint方法代码示例

本文整理汇总了C#中PurplePen.EventDB.ReplaceControlPoint方法的典型用法代码示例。如果您正苦于以下问题:C# EventDB.ReplaceControlPoint方法的具体用法?C# EventDB.ReplaceControlPoint怎么用?C# EventDB.ReplaceControlPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PurplePen.EventDB的用法示例。


在下文中一共展示了EventDB.ReplaceControlPoint方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ChangeControlOrientation

        // Change the orientation of a control. Must be a crossing point.
        public static void ChangeControlOrientation(EventDB eventDB, Id<ControlPoint> controlId, float newOrientation)
        {
            ControlPoint control = eventDB.GetControl(controlId);

            Debug.Assert(control.kind == ControlPointKind.CrossingPoint);

            control = (ControlPoint) control.Clone();
            control.orientation = newOrientation;

            eventDB.ReplaceControlPoint(controlId, control);
        }
开发者ID:petergolde,项目名称:PurplePen,代码行数:12,代码来源:ChangeEvent.cs

示例2: ChangeDescriptionSymbol

        // Change one of the symbols associated with a control. symbolNumber is a column numnber, 0=C, 1=D, etc.
        // newSymbol is the string id of the new symbol to put there. Use null as the newSymbol to indicate
        // no symbol there.
        public static void ChangeDescriptionSymbol(EventDB eventDB, Id<ControlPoint> controlId, int symbolNumber, string newSymbol)
        {
            ControlPoint controlPoint = eventDB.GetControl(controlId);

            controlPoint = (ControlPoint)controlPoint.Clone();
            controlPoint.symbolIds[symbolNumber] = newSymbol;
            if (symbolNumber == 3)
                controlPoint.columnFText = null;        // if a symbol is put in column F, then no text can be there.

            eventDB.ReplaceControlPoint(controlId, controlPoint);
        }
开发者ID:petergolde,项目名称:PurplePen,代码行数:14,代码来源:ChangeEvent.cs

示例3: ChangeControlGaps

        // Change the gaps of a control for a given scale.
        public static void ChangeControlGaps(EventDB eventDB, Id<ControlPoint> controlId, float scale, CircleGap[] newGaps)
        {
            ControlPoint control = eventDB.GetControl(controlId);

            control = (ControlPoint) control.Clone();

            int scaleInt = (int) Math.Round(scale);     // scale is stored as int in the gaps to prevent rounding problems.

            if (newGaps == null || newGaps.Length == 0) {
                if (control.gaps != null)
                    control.gaps.Remove(scaleInt);
            }
            else {
                if (control.gaps == null)
                    control.gaps = new Dictionary<int, CircleGap[]>();
                control.gaps[scaleInt] = newGaps;
            }

            eventDB.ReplaceControlPoint(controlId, control);
        }
开发者ID:petergolde,项目名称:PurplePen,代码行数:21,代码来源:ChangeEvent.cs

示例4: ChangeControlLocation

        // Change the location of a control. Used when dragging a control to a new location, for example.
        public static void ChangeControlLocation(EventDB eventDB, Id<ControlPoint> controlId, PointF newLocation)
        {
            // Check to see if any legs exist that include this control, and if any of those legs have gaps.
            List<LegGapChange> legGapChangeList = new List<LegGapChange>();

            foreach (Id<Leg> legId in eventDB.AllLegIds) {
                Leg leg = eventDB.GetLeg(legId);
                if ((leg.controlId1 == controlId || leg.controlId2 == controlId) && leg.gaps != null)
                    legGapChangeList.Add(new LegGapChange(leg.controlId1, leg.controlId2, QueryEvent.GetLegPath(eventDB, leg.controlId1, leg.controlId2, legId)));
            }

            // Move the control.
            ControlPoint control = eventDB.GetControl(controlId);

            control = (ControlPoint) control.Clone();
            control.location = newLocation;

            eventDB.ReplaceControlPoint(controlId, control);

            // If there are any leg gaps that need to be repositioned, do that.
            if (legGapChangeList.Count > 0) {
                foreach (LegGapChange legGapChange in legGapChangeList) {
                    Id<Leg> legId = QueryEvent.FindLeg(eventDB, legGapChange.controlId1, legGapChange.controlId2);
                    if (legId.IsNotNone) {
                        Leg leg = (Leg) eventDB.GetLeg(legId).Clone();
                        SymPath newPath = QueryEvent.GetLegPath(eventDB, legGapChange.controlId1, legGapChange.controlId2, legId);
                        LegGap[] newGaps = LegGap.MoveGapsToNewPath(leg.gaps, legGapChange.legPath, newPath);
                        ChangeEvent.ChangeLegGaps(eventDB, legGapChange.controlId1, legGapChange.controlId2, newGaps);
                    }
                }
            }
        }
开发者ID:petergolde,项目名称:PurplePen,代码行数:33,代码来源:ChangeEvent.cs

示例5: ChangeColumnFText

        // Change the text in colum F for a control. If a symbol is there, it is removed.Null means no text or symbol.
        public static void ChangeColumnFText(EventDB eventDB, Id<ControlPoint> controlId, string newText)
        {
            ControlPoint controlPoint = eventDB.GetControl(controlId);

            if (newText == "")
                newText = null;         // empty string is equivalent to null.

            controlPoint = (ControlPoint) controlPoint.Clone();
            controlPoint.symbolIds[3] = null;
            controlPoint.columnFText = newText;

            eventDB.ReplaceControlPoint(controlId, controlPoint);
        }
开发者ID:petergolde,项目名称:PurplePen,代码行数:14,代码来源:ChangeEvent.cs

示例6: ChangeCode

        // Change the code for a control. Does not attempt to validate the code -- it may even be a duplicate,
        // which is useful if renaming multiple codes in a single go. The control must be a normal control.
        public static void ChangeCode(EventDB eventDB, Id<ControlPoint> controlId, string newCode)
        {
            Debug.Assert(newCode != null);

            ControlPoint controlPoint = eventDB.GetControl(controlId);
            Debug.Assert(controlPoint.kind == ControlPointKind.Normal);

            controlPoint = (ControlPoint) controlPoint.Clone();
            controlPoint.code = newCode;

            eventDB.ReplaceControlPoint(controlId, controlPoint);
        }
开发者ID:petergolde,项目名称:PurplePen,代码行数:14,代码来源:ChangeEvent.cs

示例7: ChangeAllControlsCodeLocation

        // Change the number location for a control in the all controls collection. If customLocation is false, puts the number location at the angle specified.
        public static void ChangeAllControlsCodeLocation(EventDB eventDB, Id<ControlPoint> controlId, bool customLocation, float newAngle)
        {
            ControlPoint controlPoint = eventDB.GetControl(controlId);

            controlPoint = (ControlPoint) controlPoint.Clone();
            controlPoint.customCodeLocation = customLocation;
            controlPoint.codeLocationAngle = newAngle;

            eventDB.ReplaceControlPoint(controlId, controlPoint);
        }
开发者ID:petergolde,项目名称:PurplePen,代码行数:11,代码来源:ChangeEvent.cs

示例8: SetAllPunchPatterns

        // Set all punch patterns, by code, for the event.
        public static void SetAllPunchPatterns(EventDB eventDB, Dictionary<string, PunchPattern> allPatterns)
        {
            foreach (KeyValuePair<string, PunchPattern> pair in allPatterns) {
                Id<ControlPoint> controlId = QueryEvent.FindCode(eventDB, pair.Key);
                if (controlId.IsNotNone) {
                    ControlPoint controlPoint = (ControlPoint) eventDB.GetControl(controlId).Clone();
                    if (pair.Value == null)
                        controlPoint.punches = null;
                    else
                        controlPoint.punches = (PunchPattern) pair.Value.Clone();

                    eventDB.ReplaceControlPoint(controlId, controlPoint);
                }
            }
        }
开发者ID:petergolde,项目名称:PurplePen,代码行数:16,代码来源:ChangeEvent.cs

示例9: ChangeTextLine

        // Change a text line associated with a control
        public static void ChangeTextLine(EventDB eventDB, Id<ControlPoint> controlId, string textLine, bool above)
        {
            ControlPoint control = eventDB.GetControl(controlId);

            control = (ControlPoint) control.Clone();
            if (textLine == "")
                textLine = null;
            if (above)
                control.descTextBefore = textLine;
            else
                control.descTextAfter = textLine;

            eventDB.ReplaceControlPoint(controlId, control);
        }
开发者ID:petergolde,项目名称:PurplePen,代码行数:15,代码来源:ChangeEvent.cs


注:本文中的PurplePen.EventDB.ReplaceControlPoint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。