//该函数不再用于显示图像内容 public void Refresh(string path, int SubGridInedex, WinFunc setWinFunc) { SubGrid[SubGridInedex].Children.Clear(); WinFunc[SubGridInedex] = setWinFunc; switch (setWinFunc) { case Spectra.WinFunc.Curve: UserControls[SubGridInedex] = new Ctrl_SpecCurv(); break; case Spectra.WinFunc.Cube: UserControls[SubGridInedex] = new Ctrl_3DView(); ((Ctrl_3DView)UserControls[SubGridInedex]).Refresh(path); break; case Spectra.WinFunc.Map: UserControls[SubGridInedex] = new Ctrl_Map(); ((Ctrl_Map)UserControls[SubGridInedex]).Refresh(); break; default: break; } SubGrid[SubGridInedex].Children.Add(UserControls[SubGridInedex]); }
private void HandleWindow(Process process) { IntPtr handler = process.MainWindowHandle; if (WinFunc.IsIconic(handler)) { WinFunc.ShowWindow(handler, 9); } IntPtr topWindow = WinFunc.GetWindow(handler, WinFunc.GetWindow_Cmd.GW_ENABLEDPOPUP); if (topWindow == IntPtr.Zero) { topWindow = handler; } /*if (!WinFunc.IsWindowEnabled(topWindow)) * { * foreach (var winHandler in WinFunc.EnumWindowsByProcess(process.Id)) * { * if (WinFunc.IsWindowEnabled(winHandler)) * { * topWindow = winHandler; * MessageBox.Show(string.Join(",", WinFunc.EnumChildWindowsList(topWindow))); * //break; * } * } * }*/ WinFunc.SetForegroundWindow(topWindow); return; }
//该函数仅用于显示图像内容 public void RefreshImage(string path, int SubGridInedex, WinFunc setWinFunc, UInt16[] band, ColorRenderMode mode) { SubGrid[SubGridInedex].Children.Clear(); WinFunc[SubGridInedex] = setWinFunc; UserControls[SubGridInedex] = new Ctrl_ImageView(); ((Ctrl_ImageView)(UserControls[SubGridInedex])).RefreshPseudoColor(SubGridInedex, path, 1, band, mode); SubGrid[SubGridInedex].Children.Add(UserControls[SubGridInedex]); }
public bool Run(WinFunc windowFunc, float sampleRate, int windowSize, long dataLen, float[] data) { mWindowFunc = windowFunc; mRate = sampleRate; mWindowSize = windowSize; mDataLen = dataLen; mData = data; //TODO do we need to copy? if (!(mWindowSize >= 32 && mWindowSize <= 65536)) { Console.WriteLine("check windowSize"); return(false); } if (mDataLen < mWindowSize) { Console.WriteLine("datalen < windowSize\n"); return(false); } int half = mWindowSize / 2; mProcessed = new float[mWindowSize]; float[] _in = new float[mWindowSize]; float[] _out = new float[mWindowSize]; double[] win = new double[mWindowSize]; for (int i = 0; i < mWindowSize; i++) { mProcessed[i] = 0.0f; win[i] = 1.0f; } WindowFunc(mWindowSize, win); // Scale window such that an amplitude of 1.0 in the time domain // shows an amplitude of 0dB in the frequency domain double wss = 0; for (int i = 0; i < mWindowSize; i++) { wss += win[i]; } if (wss > 0) { wss = 4.0 / (wss * wss); } else { wss = 1.0; } int start = 0; int windows = 0; while (start + mWindowSize <= mDataLen) { for (int i = 0; i < mWindowSize; i++) { _in[i] = (float)win[i] * mData[start + i]; } PowerSpectrum(mWindowSize, _in, _out); for (int i = 0; i < half; i++) { mProcessed[i] += _out[i]; } start += half; windows++; } double scale; // Convert to decibels mYMin = 1000000.0f; mYMax = -1000000.0f; scale = wss / (double)windows; for (int i = 0; i < half; i++) { mProcessed[i] = 10.0f * (float)Math.Log10(mProcessed[i] * scale); if (mProcessed[i] > mYMax) { mYMax = mProcessed[i]; } else if (mProcessed[i] < mYMin) { mYMin = mProcessed[i]; } } if (mYMin < -dBRange) { mYMin = -dBRange; } if (mYMax <= -dBRange) { Console.WriteLine("out of range\n"); return(false); } mYMax += .5f; return(true); }
private static extern bool set_win_handler(IntPtr pp9k, WinFunc func);