Ejemplo n.º 1
0
        /// <summary>
        /// Gets the nested entity inside the BlockReference under mouse cursor and computes its transformation
        /// </summary>
        private Entity GetNestedEntity(System.Drawing.Point mousePos, IList <Entity> entList, ref Transformation accumulatedParentTransform)
        {
            int[]  index;
            Entity ent;

            index = GetCrossingEntities(new Rectangle(mousePos.X - 5, mousePos.Y - 5, 10, 10), entList, true, true, accumulatedParentTransform);
            if ((index != null && index.Length > 0))
            {
                if (entList[index[0]] is BlockReference)
                {
                    BlockReference br = (BlockReference)entList[index[0]];
                    accumulatedParentTransform = accumulatedParentTransform * br.GetFullTransformation(Blocks);
                    ent = GetNestedEntity(mousePos, Blocks[br.BlockName].Entities, ref accumulatedParentTransform);
                    return(ent);
                }
                else
                {
                    return(entList[index[0]]);
                }
            }

            return(null);
        }