public void setComplexShape(string newShape) { // exiting a complex shape if (newShape != null && (newShape.Equals("") || newShape.ToLower().Equals("None"))) { if (shape is ComplexShape) { shape = ((ComplexShape)this.shape).getBaseShape(); return; } //else shape = new Circle(); } Shape bShape = ShapeHelper.getShape(newShape); if (bShape is ComplexShape) { ComplexShape complex = (ComplexShape)bShape; if (shape is ComplexShape) { Shape baseShape = ((ComplexShape)shape).getBaseShape(); complex.setBaseShape(baseShape); shape = complex; } else { /* if(shape.getName().Equals("Plus") || * shape.getName().Equals("PlusCorner") || * shape.getName().Equals("HCurve") || * shape.getName().Equals("HCurveFig8") || * shape.getName().Equals("HLine") || * shape.getName().Equals("HLineFig8") || * shape.getName().Equals("HCircle") || * shape.getName().Equals("HCircleFig8") || * shape.getName().Equals("PlusHalf") || * shape.getName().Equals("PlusHalfCap") ){ * // TODO refactor this to allow for correct selection behaviour * shape = new Circle(); * complex.setBaseShape(this.shape); * shape = complex; * } * else { /**/ complex.setBaseShape(this.shape); shape = complex; // } } } }