예제 #1
0
        public void ConstrainBounds(IEnumerable <uint> sourceIds, ref Vex.Rectangle bounds, ChainType chainType)
        {
            HashSet <uint> tested            = new HashSet <uint>();
            HashSet <uint> alreadyDiscovered = new HashSet <uint>();
            List <Bond>    guideBonds        = new List <Bond>();

            AppendJoinedRelations(sourceIds, tested, alreadyDiscovered, guideBonds);
            foreach (Bond b in guideBonds)
            {
                if (!chainType.IsHorizontal() && b.Next.SourceAttachment.IsVGuide())
                {
                    bounds = bounds.Intersect(MainForm.CurrentInstanceManager[b.SourceInstanceId].StrokeBounds);
                }
                else if (chainType.IsHorizontal() && b.Next.SourceAttachment.IsHGuide())
                {
                    bounds = bounds.Intersect(MainForm.CurrentInstanceManager[b.SourceInstanceId].StrokeBounds);
                }
            }
        }
예제 #2
0
 //public UsageIdentifier[] FindAllUsagesOfDefinition(uint definitionId)
 //{
 //    List<UsageIdentifier> result = new List<UsageIdentifier>();
 //    foreach (uint key in items.Keys)
 //    {
 //        if (items[key] is DesignTimeline)
 //        {
 //            DesignTimeline dt = (DesignTimeline)items[key];
 //            foreach (uint instId in dt.InstanceIds)
 //            {
 //                if (items[instId].DefinitionId == definitionId)
 //                {
 //                    result.Add(new UsageIdentifier(dt.InstanceHash, instId));
 //                }
 //            }
 //        }
 //    }
 //    return result.ToArray();
 //}
 public void SortIndexesByLocation(List<uint> ids, ChainType chainType)
 {
     if (chainType.IsHorizontal())
     {
         ids.Sort((a, b) => this[a].StrokeBounds.Left.CompareTo(this[b].StrokeBounds.Left));
     }
     else
     {
         ids.Sort((a, b) => this[a].StrokeBounds.Top.CompareTo(this[b].StrokeBounds.Top));
     }
 }
예제 #3
0
파일: Bond.cs 프로젝트: yzqlwt/Swf2XNA
        public int CompareTo(object obj)
        {
            int result = -1;

            if (obj is Bond)
            {
                if (ChainType.IsHorizontal())
                {
                    result = this.TargetLocation.X.CompareTo(((Bond)obj).TargetLocation.X);
                }
                else
                {
                    result = this.TargetLocation.Y.CompareTo(((Bond)obj).TargetLocation.Y);
                }
            }
            return(result);
        }