public void saveState() { this.savedCollection = new FiguresCollectionImpl(); foreach (FigureOnBoard item in collection) { savedCollection.add(item); } }
public void Test_GetFiguresEqualToGivenFigure() { var sides = new List <double> { 4 }; var figuresCollection = new FiguresCollection(FileExtension.ReadData()); var result = figuresCollection.GetFiguresEqualToGivenFigure(new Square(sides)); var actualResult = new List <IFigure> { new Square(sides), new Square(sides), new Square(sides) }; CollectionAssert.AreEqual(result, actualResult); }
public Scenes(Control canvas, KdSdkApi kdApi) { this.canvas = canvas; this.kdApi = kdApi; bkgImages = new FiguresCollectionImpl(); facades = new FiguresCollectionImpl(); //Image newImage = Image.FromFile("C:\\Users\\gerasymiuk\\Documents\\Visual Studio 2017\\Projects\\FacadeCreator\\FacadeCreatorApi\\bin\\Debug\\1.png"); //addFigure(new BkgImage(newImage), 0, 0); //addFigure(new Facade(1,100, 150), 140, 5); //addFigure(new Facade(2,100,150),140,5); //addFigure(new Facade(3,100, 150), 340, 5); mnuBkgImage = createMenuBkgImage(); mnuFacade = createMenuFacade(); mnuCanvas = createMenuCanvas(); canvas.MouseDown += new MouseEventHandler(mouseDown); canvas.MouseMove += new MouseEventHandler(mouseMove); canvas.MouseUp += new MouseEventHandler(mouseUp); canvas.MouseWheel += startScale; canvas.KeyDown += new KeyEventHandler(keyDown); canvas.KeyUp += new KeyEventHandler(keyUp); canvas.Paint += new PaintEventHandler(paint); canvas.DoubleClick += new EventHandler(canvas_double_click); canvas.ClientSizeChanged += Canvas_ClientSizeChanged; addMenu(); //FiguresCollection col = new FiguresCollectionImpl(); //col.add(new FigureOnBoard(new Facade(1,10, 20), 12, 21)); //col.add(new FigureOnBoard(new Facade(2,10, 30), 12, 22)); //col.add(new FigureOnBoard(new Facade(3,10, 40), 12, 23)); //foreach (FigureOnBoard item in col.getReverseCollection()) //{ // MessageBox.Show(item.y.ToString()); //} }
public deletedManyImageState(FiguresCollection collection) { this.collection = collection; }
public static IDictionary <Facade, string> generateFacades(Rectangle areaSize, Bitmap image, FiguresCollection collection, string scenesName) { IDictionary <Facade, string> facades = new Dictionary <Facade, string>(); Image img; string pathToImage = ""; string alternativeName = ""; foreach (FigureOnBoard item in collection) { img = new Bitmap(item.figure.width, item.figure.height); using (Graphics gp = Graphics.FromImage(img)) { alternativeName = StringResources.getImageDirectoryName() + "\\" + scenesName + item.figure.ToString() + ".jpg"; pathToImage = StringResources.getResourcesPath() + "\\" + StringResources.getImageDirectoryName() + "\\" + scenesName + item.figure.ToString() + ".jpg"; //MessageBox.Show(pathToImage); try { gp.DrawImage(image, new Rectangle(0, 0, img.Width, img.Height), new Rectangle(item.x - areaSize.X, item.y - areaSize.Y, img.Width, img.Height), GraphicsUnit.Pixel); } catch (Exception e) { throw new Exception("Cannot Draw Image!!\n" + e.StackTrace); } try { //MessageBox.Show(pathToImage); img.Save(pathToImage, ImageFormat.Jpeg); } catch (Exception e) { throw new System.IO.FileNotFoundException("Cannot Save Image!!" + img + "\n" + e.StackTrace); } facades.Add((Facade)item.figure, alternativeName); } //img = new Bitmap(image.Clone(new Rectangle(item.x, item.y, item.figure.width, item.figure.height), image.PixelFormat } return(facades); }
public filledBkgImages(FiguresCollection collection) { deletedManyImagesState = new deletedManyImageState(collection); this.collection = collection; }
public DeletedImageState(FiguresCollection collection, FigureOnBoard figure) { this.figure = figure; this.collection = collection; }
public addedImageState(FiguresCollection collection, FigureOnBoard image) { this.collection = collection; this.image = image; }
public ReverseEnumerator(FiguresCollection collection) { this.collection = collection; this.index = collection.getCount(); }
public ReverseCollection(FiguresCollection col) { this.col = col; }
public Enumerator(FiguresCollection collection) { this.collection = collection; this.index = -1; }