/// <summary> /// Constructs a new Guillotine algorithm based on the passed parameters and ImageSorter /// </summary> /// <param name="freeRectExtractor">Free rectangle extractor (<seealso cref="IFreeRectangleExtractor"/>) used by the Guillotine algorithm</param> /// <param name="freeRectangleSplitter">Free rectangle splitter (<seealso cref="IFreeRectangleSplitter"/>) used by the Guillotine algorithm</param> /// <param name="freeRectangleMerger">Free rectangle extractor (<seealso cref="IFreeRectangleMerger"/>) used by the Guillotine algorithm</param> /// <param name="rectOrientationSelector">Rectangle orientation selector (<seealso cref="IRectOrientationSelector"/>) used by the Guillotine algorithm</param> /// <param name="freeRectanglePostProcessor">Free post processor (<seealso cref="IFreeRectanglePostProcessor"/>) used by the Guillotine algorithm</param> /// <param name="sorter">The image sorter</param> public GuillotinePlacementAlgorithm(IFreeRectangleExtractor freeRectExtractor, IFreeRectangleSplitter freeRectangleSplitter, IFreeRectangleMerger freeRectangleMerger, IRectOrientationSelector rectOrientationSelector, IFreeRectanglePostProcessor freeRectanglePostProcessor, IImageSorter sorter) { this.freeRectExtractor = freeRectExtractor ?? new BestAreaFitFreeRectangleExtractor(); this.freeRectangleSplitter = freeRectangleSplitter ?? new LongerAxisGuillotineFreeRectangleSplitter(); this.rectOrientationSelector = rectOrientationSelector ?? new DummyRectOrientationSelector(); this.freeRectangleMerger = freeRectangleMerger ?? new GuillotineFreeRectangleSortedMerger(); this.freeRectanglePostProcessor = freeRectanglePostProcessor; this.imageSorter = sorter ?? new ByHeightAndWidthImageSorterDesc(); freeRectanglesList = new List <PPRect>(); }
/// <summary> /// Constructs a new Guillotine algorithm based on the passed parameters /// </summary> /// <param name="freeRectExtractor">Free rectangle extractor (<seealso cref="IFreeRectangleExtractor"/>) used by the Guillotine algorithm</param> /// <param name="freeRectangleSplitter">Free rectangle splitter (<seealso cref="IFreeRectangleSplitter"/>) used by the Guillotine algorithm</param> /// <param name="freeRectangleMerger">Free rectangle extractor (<seealso cref="IFreeRectangleMerger"/>) used by the Guillotine algorithm</param> /// <param name="rectOrientationSelector">Rectangle orientation selector (<seealso cref="IRectOrientationSelector"/>) used by the Guillotine algorithm</param> /// <param name="freeRectanglePostProcessor">Free post processor (<seealso cref="IFreeRectanglePostProcessor"/>) used by the Guillotine algorithm</param> public GuillotinePlacementAlgorithm(IFreeRectangleExtractor freeRectExtractor, IFreeRectangleSplitter freeRectangleSplitter, IFreeRectangleMerger freeRectangleMerger = null, IRectOrientationSelector rectOrientationSelector = null, IFreeRectanglePostProcessor freeRectanglePostProcessor = null) : this(freeRectExtractor, freeRectangleSplitter, freeRectangleMerger, rectOrientationSelector, freeRectanglePostProcessor, null) { }