Exemple #1
0
        // Get the controls the define where to insert the new control point.
        private void GetControlInsertionPoint(PointF pt, out CourseDesignator courseDesignator,
                                              out Id <CourseControl> courseControlId1, out Id <CourseControl> courseControlId2,
                                              out LegInsertionLoc legInsertionLoc)
        {
            SelectionMgr.SelectionInfo selection = selectionMgr.Selection;
            courseDesignator = selection.ActiveCourseDesignator;
            courseControlId1 = Id <CourseControl> .None;
            courseControlId2 = Id <CourseControl> .None;
            legInsertionLoc  = LegInsertionLoc.Normal;

            if (selection.SelectionKind == SelectionMgr.SelectionKind.Control &&
                (courseDesignator.IsAllControls || QueryEvent.IsCourseControlInPart(eventDB, courseDesignator, selection.SelectedCourseControl)))
            {
                courseControlId1 = selection.SelectedCourseControl;
            }
            else if (selection.SelectionKind == SelectionMgr.SelectionKind.Leg)
            {
                courseControlId1 = selection.SelectedCourseControl;
                courseControlId2 = selection.SelectedCourseControl2;
                legInsertionLoc  = selection.LegInsertionLoc;
            }
            else if (courseDesignator.IsNotAllControls)
            {
                // Not all control, and neight control or leg is selected. Use the closest leg.
                QueryEvent.LegInfo leg = QueryEvent.FindClosestLeg(eventDB, courseDesignator, pt);
                courseControlId1 = leg.courseControlId1;
                courseControlId2 = leg.courseControlId2;
            }

            if (courseDesignator.IsNotAllControls)
            {
                QueryEvent.FindControlInsertionPoint(eventDB, courseDesignator, ref courseControlId1, ref courseControlId2, ref legInsertionLoc);
            }
        }
 // Describe the selection, and return an array of TextParts for display in the UI.
 public static TextPart[] DescribeSelection(SymbolDB symbolDB, EventDB eventDB, CourseView activeCourseView, SelectionMgr.SelectionInfo selection)
 {
     if (selection.SelectionKind == SelectionMgr.SelectionKind.Key)
     {
         return(DescribeKey(eventDB));
     }
     else if (selection.SelectionKind == SelectionMgr.SelectionKind.TextLine)
     {
         return(DescribeTextLine(eventDB, selection.SelectedControl, selection.SelectedTextLineKind));
     }
     else if (selection.SelectionKind == SelectionMgr.SelectionKind.Control)
     {
         return(DescribeControlPoint(symbolDB, eventDB, selection.SelectedControl, DescKind.DescPane));
     }
     else if (selection.SelectionKind == SelectionMgr.SelectionKind.Leg)
     {
         return(DescribeLeg(eventDB, selection.SelectedCourseControl, selection.SelectedCourseControl2, DescKind.DescPane));
     }
     else if (selection.SelectionKind == SelectionMgr.SelectionKind.Special)
     {
         return(DescribeSpecial(eventDB, selection.SelectedSpecial, activeCourseView.ScaleRatio, DescKind.DescPane));
     }
     else if (selection.SelectionKind == SelectionMgr.SelectionKind.MapExchangeAtControl)
     {
         return(DescribeMapExchangeAtControl(eventDB, selection.SelectedControl));
     }
     else if (selection.ActiveCourseDesignator.IsNotAllControls)
     {
         return(DescribeCourse(eventDB, activeCourseView));
     }
     else
     {
         return(DescribeAllControls(eventDB, activeCourseView));
     }
 }