示例#1
0
    public void Clear()
    {
        Faces.Clear();
        Points.Clear();
        Edges.Clear();

        CachedPoints.Clear();
        CachedEdgePoints.Clear();

        m_CurrId = 0;
    }
示例#2
0
        public List <ISnapPoint> FindOrCachePoints(SceneObject so)
        {
            if (enable_snap_points == false)
            {
                return(null);
            }
            if (PointsCache.ContainsKey(so))
            {
                CachedPoints c = PointsCache[so];
                if (c.timestamp == so.Timestamp)
                {
                    return(c.points);
                }

                // un-cache
                if (c.points != null)
                {
                    foreach (ISnapPoint pt in c.points)
                    {
                        pt.Destroy();
                    }
                }
                PointsCache.Remove(so);
            }

            List <ISnapPoint> vPoints = null;

            if (so is PivotSO)
            {
                vPoints = new List <ISnapPoint>()
                {
                    new PivotSOSnapPoint(so as PivotSO)
                };
            }
            else if (so is GroupSO)
            {
                foreach (SceneObject childso in (so as GroupSO).GetChildren())
                {
                    List <ISnapPoint> pts = FindOrCachePoints(childso);
                    if (vPoints == null)
                    {
                        vPoints = pts;
                    }
                    else
                    {
                        vPoints.AddRange(pts);
                    }
                }
            }
            else
            {
                foreach (ISnapGenerator gen in Generators)
                {
                    if (gen.CanGenerate(so))
                    {
                        List <ISnapPoint> v = gen.GeneratePoints(so);
                        if (v != null && v.Count > 0)
                        {
                            if (vPoints == null)
                            {
                                vPoints = v;
                            }
                            else
                            {
                                vPoints.AddRange(v);
                            }
                        }
                    }
                }
            }

            PointsCache[so] = new CachedPoints()
            {
                points = vPoints, timestamp = so.Timestamp
            };
            return(vPoints);
        }