Ejemplo n.º 1
0
        // Add a shape to the list which contains this region.
        public virtual void AddOwner(Figure f)
        {
            if (!Utilities.AddStructurallyUnique<Figure>(owners, f)) return;

            // Check if this new atomic region is the outermost owner.
            if (topOwner == null || f.Contains(topOwner)) topOwner = f;
        }
Ejemplo n.º 2
0
        //
        // Used by Square and Rectangle
        //
        public static FigSynthProblem MakeAdditionProblem(Figure outerShape, Figure appended)
        {
            if (outerShape.Contains(appended) || appended.Contains(outerShape) || outerShape.Overlaps(appended))
            {
                return(null);
            }

            AdditionSynth addSynth = new AdditionSynth(outerShape, appended);

            List <AtomicRegion> atoms = new List <AtomicRegion>();

            atoms.Add(outerShape.GetFigureAsAtomicRegion());
            atoms.Add(appended.GetFigureAsAtomicRegion());

            addSynth.SetOpenRegions(atoms);

            return(addSynth);
        }
        public List<AtomicRegion> GetAtomicRegionsByFigure(Figure fig)
        {
            List<AtomicRegion> atoms = new List<AtomicRegion>();

            foreach (AtomicRegion atom in atomicRegions)
            {
                ShapeAtomicRegion shapeAtom = atom as ShapeAtomicRegion;
                if (shapeAtom != null)
                {
                    if (fig.Contains(shapeAtom.shape)) atoms.Add(atom);
                }
                else
                {
                    if (fig.Contains(this.allFigurePoints, atom)) atoms.Add(atom);
                }
            }

            return atoms;
        }
        private List<int> GetAtomicRegionIndicesByFigure(Figure fig)
        {
            List<int> atomIndices = new List<int>();

            for (int a = 0; a < atomicRegions.Count; a++)
            {
                ShapeAtomicRegion shapeAtom = atomicRegions[a] as ShapeAtomicRegion;
                if (shapeAtom != null)
                {
                    if (fig.Contains(shapeAtom.shape)) atomIndices.Add(a);
                }
                else
                {
                    if (fig.Contains(this.allFigurePoints, atomicRegions[a])) atomIndices.Add(a);
                }
            }

            return atomIndices;
        }
Ejemplo n.º 5
0
        //
        // Used by Square and Rectangle
        //
        public static FigSynthProblem MakeAdditionProblem(Figure outerShape, Figure appended)
        {
            if (outerShape.Contains(appended) || appended.Contains(outerShape) || outerShape.Overlaps(appended)) return null;

            AdditionSynth addSynth = new AdditionSynth(outerShape, appended);

            List<AtomicRegion> atoms = new List<AtomicRegion>();
            atoms.Add(outerShape.GetFigureAsAtomicRegion());
            atoms.Add(appended.GetFigureAsAtomicRegion());

            addSynth.SetOpenRegions(atoms);

            return addSynth;
        }