Class TimeShift
- Namespace
- Hi.Numerical.StepSelectionUtils
- Assembly
- HiMech.dll
Represents a time-based shift operation for machining steps. This class provides functionality to shift step indices based on time offsets.
public class TimeShift : IStepShift, IMakeXmlSource
- Inheritance
-
TimeShift
- Implements
- Inherited Members
- Extension Methods
Constructors
TimeShift(TimeSpan, bool)
Initializes a new instance of the TimeShift class with the specified parameters.
public TimeShift(TimeSpan timeShift, bool isBackward)
Parameters
timeShift
TimeSpanThe amount of time to shift.
isBackward
boolTrue to shift backward in time, false to shift forward.
TimeShift(XElement)
Initializes a new instance of the TimeShift class from XML.
public TimeShift(XElement src)
Parameters
src
XElementThe XML element containing the time shift configuration.
Properties
IsBackward
Gets or sets a value indicating whether the shift is backward in time. When true, shifts steps earlier in time; when false, shifts steps later in time.
public bool IsBackward { get; set; }
Property Value
ShiftTimeSpan
Gets or sets the amount of time to shift.
public TimeSpan ShiftTimeSpan { get; set; }
Property Value
XName
Gets the XML element name used for serialization.
public static string XName { get; }
Property Value
Remarks
This name is used as the XML tag when serializing/deserializing TimeShift instances. The value is the unqualified name of the class (TimeShift).
Methods
GetShiftedStepIndex(ClStrip, int)
Gets the shifted step index based on the original index and the time shift configuration.
public int GetShiftedStepIndex(ClStrip host, int originalStepIndex)
Parameters
host
ClStripThe cutter location strip containing the steps.
originalStepIndex
intThe original step index to shift.
Returns
- int
The shifted step index, or -1 if the shift results in an invalid index.
MakeXmlSource(string, string, bool)
Creates an XML representation of the object. This method may also generate additional resources such as related files.
public XElement MakeXmlSource(string baseDirectory, string relFile, bool exhibitionOnly)
Parameters
baseDirectory
stringThe base directory for resolving relative paths
relFile
stringThe relative file path for the XML source
exhibitionOnly
boolif true, the extended file creation is suppressed.
Returns
- XElement
An XML element representing the object's state
Remarks
For the demand of easy moving source folder (especially project folder) without configuration file path corruption, the relative file path is applied.
The baseDirectory
is typically the folder at the nearest configuration file folder.
Since the folder can be moving with the configuration file.