示例#1
0
 public SnapMatcher(SnapContext snapCtx)
 {
     Debug.Assert(snapCtx != null);
     m_SnapContext = snapCtx;
 }
示例#2
0
 public GeometryVisitor(SnapContext ctx, GePoint point)
 {
     m_SnapContext = ctx;
     m_ReferencePoint = (GePoint)point.Clone();
 }
示例#3
0
 public GePointVisitor(SnapContext ctx, GePoint point)
     : base(ctx, point)
 {
 }
示例#4
0
        public static SnapContext InitalizeSnapContextFromPreSelection(GePoint mousePoint)
        {
            Debug.Assert(mousePoint != null);

            SnapContext snapCtx = new SnapContext(PtApp.ActiveDocument.Database);

            PtSelectContext sltCtx = new PtSelectContext();
            sltCtx.WorldPoint = mousePoint;

            SelectionSet tempSet =
                PtApp.ActiveView.SelectionMgr.CreateSelectionSet("SnapTemporarySet");
            tempSet.Clear();
            sltCtx.CurrentSelectionSet = tempSet;

            PtApp.ActiveView.Select(sltCtx);

            // Set selection set.
            SelectionSet PreSet = PtApp.ActiveView.SelectionMgr.GetPreviewSelectionSet();
            PreSet.Clear();

            if (!tempSet.Empty())
            {
                foreach (Selection selection in tempSet.Selections)
                {
                    SymbolConstraint instance = selection.GetInstance();
                    Debug.Assert(instance != null);

                    SymbolGeometryConstraint constr = instance.GetGeometryConstraint(
                        mousePoint, snapCtx.SnapTolerance);
                    if (constr != null)
                    {
                        // We just highlight the snapped nodes.
                        snapCtx.CandidateProxies.Add(constr);
                        PreSet.AddSelection(selection);
                    }
                }
            }

            PtApp.ActiveView.UpdateView();

            return snapCtx;
        }