/*
* GNU AFFERO GENERAL PUBLIC LICENSE
* Version 3, 19 November 2007
* Copyright (C) 2007 Free Software Foundation, Inc.
* Everyone is permitted to copy and distribute verbatim copies
* of this license document, but changing it is not allowed.
*/
using System;
using System.Drawing;
using System.Text;
using Emgu.CV;
using UVtools.Core.Operations;
namespace UVtools.Core.FileFormats
{
///
/// Slicer file format representation interface
///
public interface IFileFormat
{
#region Properties
///
/// Gets the file format type
///
FileFormat.FileFormatType FileType { get; }
///
/// Gets the valid file extensions for this
///
FileExtension[] FileExtensions { get; }
///
/// Gets the implemented file formats able to convert to
///
Type[] ConvertToFormats { get; }
///
/// Gets the available
///
FileFormat.PrintParameterModifier[] PrintParameterModifiers { get; }
///
/// Gets the file filter for open and save dialogs
///
string FileFilter { get; }
///
/// Gets all valid file extensions in "*.extension1;*.extension2" format
///
string FileFilterExtensionsOnly { get; }
///
/// Gets the input file path loaded into this
///
string FileFullPath { get; set; }
///
/// Gets the thumbnails count present in this file format
///
byte ThumbnailsCount { get; }
///
/// Gets the number of created thumbnails
///
byte CreatedThumbnailsCount { get; }
///
/// Gets the original thumbnail sizes
///
System.Drawing.Size[] ThumbnailsOriginalSize { get; }
///
/// Gets the thumbnails for this
///
Mat[] Thumbnails { get; set; }
///
/// Gets the cached layers into compressed bytes
///
LayerManager LayerManager { get; set; }
Size Resolution { get; }
///
/// Gets the image width resolution
///
uint ResolutionX { get; set; }
///
/// Gets the image height resolution
///
uint ResolutionY { get; set; }
///
/// Gets the size of display in millimeters
///
SizeF Display { get; set; }
///
/// Gets or sets the display width in millimeters
///
float DisplayWidth { get; set; }
///
/// Gets or sets the display height in millimeters
///
float DisplayHeight { get; set; }
bool HaveAntiAliasing { get; }
///
/// Gets the AntiAliasing level
///
byte AntiAliasing { get; }
///
/// Gets Layer Height in mm
///
float LayerHeight { get; set; }
///
/// Gets Total Height in mm
///
float TotalHeight { get; }
#region Universal Properties
///
/// Gets the last layer index
///
uint LastLayerIndex { get; }
///
/// Gets the number of layers present in this file
///
uint LayerCount { get; set; }
///
/// Gets or sets the number of initial layer count
///
ushort BottomLayerCount { get; set; }
///
/// Gets or sets the initial exposure time for in seconds
///
float BottomExposureTime { get; set; }
///
/// Gets or sets the normal layer exposure time in seconds
///
float ExposureTime { get; set; }
///
/// Gets or sets the bottom layer off time in seconds
///
float BottomLayerOffTime { get; set; }
///
/// Gets or sets the layer off time in seconds
///
float LayerOffTime { get; set; }
///
/// Gets or sets the bottom lift height in mm
///
float BottomLiftHeight { get; set; }
///
/// Gets or sets the lift height in mm
///
float LiftHeight { get; set; }
///
/// Gets or sets the bottom lift speed in mm/min
///
float BottomLiftSpeed { get; set; }
///
/// Gets or sets the speed in mm/min
///
float LiftSpeed { get; set; }
///
/// Gets the speed in mm/min for the retracts
///
float RetractSpeed { get; set; }
///
/// Gets or sets the bottom pwm value from 0 to 255
///
byte BottomLightPWM { get; set; }
///
/// Gets or sets the pwm value from 0 to 255
///
byte LightPWM { get; set; }
#endregion
///
/// Gets the estimate print time in seconds
///
float PrintTime { get; }
///
/// Gets the estimate print time in hours
///
float PrintTimeHours { get; }
///
/// Gets the estimate used material in ml
///
float UsedMaterial { get; }
///
/// Gets the estimate material cost
///
float MaterialCost { get; }
///
/// Gets the material name
///
string MaterialName { get; }
///
/// Gets the machine name
///
string MachineName { get; }
///
/// Gets the GCode, returns null if not supported
///
StringBuilder GCode { get; set; }
string GCodeStr { get; }
///
/// Gets if this file have available gcode
///
bool HaveGCode { get; }
///
/// Get all configuration objects with properties and values
///
object[] Configs { get; }
///
/// Gets if this file is valid to read
///
bool IsValid { get; }
#endregion
#region Methods
///
/// Clears all definitions and properties, it also dispose valid candidates
///
void Clear();
///
/// Validate if a file is a valid
///
/// Full file path
void FileValidation(string fileFullPath);
///
/// Checks if a extension is valid under the
///
/// Extension to check
/// True if is a full file path, otherwise false for extension only
/// True if valid, otherwise false
bool IsExtensionValid(string extension, bool isFilePath = false);
///
/// Gets all valid file extensions in a specified format
///
string GetFileExtensions(string prepend = ".", string separator = ", ");
///
/// Gets a thumbnail by it height or lower
///
/// Max height allowed
///
Mat GetThumbnail(uint maxHeight = 400);
///
/// Gets a thumbnail by the largest or smallest
///
/// True to get the largest, otherwise false
///
Mat GetThumbnail(bool largest);
///
/// Sets thumbnails from a list of thumbnails and clone them
///
///
void SetThumbnails(Mat[] images);
///
/// Sets all thumbnails the same image
///
/// Image to set
void SetThumbnails(Mat images);
///
/// Sets a thumbnail from a disk file
///
/// Thumbnail index
///
void SetThumbnail(int index, string filePath);
///
/// Encode to an output file
///
/// Output file
///
void Encode(string fileFullPath, OperationProgress progress = null);
void AfterEncode();
/*
///
/// Begin encode to an output file
///
/// Output file
//void BeginEncode(string fileFullPath);
///
/// Insert a layer image to be encoded
///
///
///
//void InsertLayerImageEncode(Image image, uint layerIndex);
///
/// Finish the encoding procedure
///
//void EndEncode();*/
///
/// Decode a slicer file
///
///
///
void Decode(string fileFullPath, OperationProgress progress = null);
///
/// Extract contents to a folder
///
/// Path to folder where content will be extracted
///
///
///
void Extract(string path, bool genericConfigExtract = true, bool genericLayersExtract = true,
OperationProgress progress = null);
///
/// Get height in mm from layer height
///
///
///
/// The height in mm
float GetHeightFromLayer(uint layerIndex, bool realHeight = true);
///
/// Gets the value for initial layer or normal layers based on layer index
///
/// Type of value
/// Layer index
/// Initial value
/// Normal value
///
T GetInitialLayerValueOrNormal(uint layerIndex, T initialLayerValue, T normalLayerValue);
void RefreshPrintParametersModifiersValues();
///
/// Gets the value attributed to
///
/// Modifier to use
/// A value
object GetValueFromPrintParameterModifier(FileFormat.PrintParameterModifier modifier);
///
/// Sets a property value attributed to
///
/// Modifier to use
/// Value to set
/// True if set, otherwise false = not found
bool SetValueFromPrintParameterModifier(FileFormat.PrintParameterModifier modifier, decimal value);
byte SetValuesFromPrintParametersModifiers();
///
/// Rebuilds GCode based on current settings
///
void RebuildGCode();
///
/// Saves current configuration on input file
///
///
void Save(OperationProgress progress = null);
///
/// Saves current configuration on a copy
///
/// File path to save copy as, use null to overwrite active file (Same as )
///
void SaveAs(string filePath = null, OperationProgress progress = null);
///
/// Converts this file type to another file type
///
/// Target file format
/// Output path file
///
/// True if convert succeed, otherwise false
bool Convert(Type to, string fileFullPath, OperationProgress progress = null);
///
/// Converts this file type to another file type
///
/// Target file format
/// Output path file
///
/// True if convert succeed, otherwise false
bool Convert(FileFormat to, string fileFullPath, OperationProgress progress = null);
///
/// Validate AntiAlias Level
///
byte ValidateAntiAliasingLevel();
#endregion
}
}