public void ResizeFrom(ILockData otherData) { TexturesData src = (TexturesData)otherData; if (src.lockSplats == null || lockSplats == null) { return; } int numLayers = Mathf.Min(src.lockSplats.GetLength(2), lockSplats.GetLength(2)); if (numLayers == 0) { return; } Matrix srcMatrix = new Matrix(src.circle.rect); Matrix dstMatrix = new Matrix(circle.rect); for (int i = 0; i < numLayers; i++) { srcMatrix.ImportSplats(src.lockSplats, i); MatrixOps.Resize(srcMatrix, dstMatrix); dstMatrix.ExportSplats(lockSplats, i); } }
/// <summary> /// Readings test. /// </summary> /// <param name="readings">Readings.</param> public void ReadingsTest(ILockData readings) { if (UpperLevelTester.ValueOutsideLimits (readings.UpperLevel)) { if (UpperLevelAlarm != null) UpperLevelAlarm (this, null); } if (LowerLevelTester.ValueOutsideLimits (readings.LowerLevel)) { if (LowerLevelAlarm != null) LowerLevelAlarm (this, null); } if (FlowRateTester.ValueOutsideLimits (readings.FlowRate)) { if (FlowRateAlarm != null) FlowRateAlarm (this, null); } }
void setupComponents() { _lockData = (LockData)_lockFactory.CreateandReturnObj (LockClassesEnumeration.LockData); _dataReader = (LockDataReader)_lockFactory.CreateandReturnObj (LockClassesEnumeration.LockDataReader); _alarmer = (LockAlarmer)_lockFactory.CreateandReturnObj (LockClassesEnumeration.LockAlarmer); _alarmer.UpperLevelAlarm += new EventHandler(soundMutableAlarm); _alarmer.LowerLevelAlarm += new EventHandler(soundMutableAlarm); _alarmer.FlowRateAlarm += new EventHandler(soundMutableAlarm); _tickTimer.Stop (); _tickTimer.Interval = TimeSpan.FromMilliseconds (1000); _tickTimer.Tick += new EventHandler (updateReadings); }
public void ResizeFrom(ILockData otherData) { HeightData other = (HeightData)otherData; Matrix otherMatrix = new Matrix(other.circle.rect); otherMatrix.ImportHeights(other.heightsArr); Matrix matrix = new Matrix(circle.rect); MatrixOps.Resize(otherMatrix, matrix); matrix.ExportHeights(heightsArr); }
public void ResizeFrom(ILockData otherData) { GrassData src = (GrassData)otherData; if (src.lockLayers == null || lockLayers == null) { return; } int numLayers = Mathf.Min(src.lockLayers.Length, lockLayers.Length); if (numLayers == 0) { return; } for (int i = 0; i < numLayers; i++) { int[,] srcLayer = src.lockLayers[i]; int[,] dstLayer = lockLayers[i]; int srcResX = dstLayer.GetLength(0); int srcResZ = dstLayer.GetLength(1); int dstResX = srcLayer.GetLength(0); int dstResZ = srcLayer.GetLength(1); float resFactorX = 1f * dstResX / srcResX; float resFactorZ = 1f * dstResZ / srcResZ; for (int dstX = 0; dstX < dstResX; dstX++) { for (int dstZ = 0; dstZ < dstResZ; dstZ++) { int srcX = (int)(dstX / resFactorX); int srcZ = (int)(dstZ / resFactorZ); dstLayer[dstX, dstZ] = srcLayer[srcX, srcZ]; } } } }
// unit testing purposes internal LockDAL(ILockData lockData) { this.lockDataLayer = lockData; }
public LockDAL() { this.lockDataLayer = new LockData(); }