// // Apply the strengthening clause to the appropriate polygon. // private void StrengthenPolygon(Strengthened streng) { GeometryTutorLib.ConcreteAST.Polygon strengPoly = streng.strengthened as GeometryTutorLib.ConcreteAST.Polygon; int numVertices = (streng.strengthened as GeometryTutorLib.ConcreteAST.Polygon).points.Count; int polyIndex = GeometryTutorLib.ConcreteAST.Polygon.GetPolygonIndex(numVertices); for (int p = 0; p < polygons[polyIndex].Count; p++) { if (polygons[polyIndex][p].HasSamePoints(streng.original as GeometryTutorLib.ConcreteAST.Polygon)) { // Is this the strongest class for this particular shape? // For example, Quadrilateral -> Trapezoid -> Isosceles Trapezoid if (strengPoly.IsStrongerThan(polygons[polyIndex][p])) { polygons[polyIndex][p] = strengPoly; // // Update any shape atomic regions as well as owners // Find All instances of owners / update all figureAtoms as well (and their owners) // foreach (AtomicRegion atom in atomicRegions) { ShapeAtomicRegion shapeAtom = atom as ShapeAtomicRegion; if (shapeAtom != null) { if (shapeAtom.shape.StructurallyEquals(streng.original)) { shapeAtom.ReshapeForStrenghthening(streng.strengthened as Figure); } } } } return; } } }