Exemplo n.º 1
0
 public SnapMatcher(SnapContext snapCtx)
 {
     Debug.Assert(snapCtx != null);
     m_SnapContext = snapCtx;
 }
Exemplo n.º 2
0
 public GeometryVisitor(SnapContext ctx, GePoint point)
 {
     m_SnapContext = ctx;
     m_ReferencePoint = (GePoint)point.Clone();
 }
Exemplo n.º 3
0
 public GePointVisitor(SnapContext ctx, GePoint point)
     : base(ctx, point)
 {
 }
Exemplo n.º 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;
        }