private void radioButtonTruncate_CheckedChanged(object sender, EventArgs e) { var newTr = radioButtonTruncateByValue.Checked ? TruncateMode.byValue : TruncateMode.byNumberOfConnections; if (newTr != _truncateMode) { _truncateMode = newTr; if (checkBoxLiveRefresh.Checked) { FillGraph(); } } }
private static void IVA_FFT_Truncate(VisionImage image, TruncateMode truncateMode, double ratio) { // Creates the complex image for the FFT. using (VisionImage fftImage = new VisionImage(ImageType.Complex, 7)) { // Computes the Fourier transform of the image. Algorithms.Fft(image, fftImage); // Truncates the frequencies of the complex image. Algorithms.ComplexTruncate(fftImage, fftImage, truncateMode, ratio); // Takes the inverse Fourier transform of the complex image. Algorithms.InverseFft(fftImage, image); } }
public Text(string name, Vector3 dimensions, QGuiMetricsMode positionMode, QGuiMetricsMode sizeMode, OverlayContainer overlayContainer, Widget ParentWidget) : base(name, new Vector4(dimensions.x, dimensions.y, 0, dimensions.z), positionMode, sizeMode, "", overlayContainer, ParentWidget) { mTextCursorHidden = true; mCursorIndex = 0; mCursorOffset = -3; mWidgetType = Widget.WidgetType.QGUI_TYPE_TEXT; mTruncateMode = TruncateMode.RIGHT; mFeedbackString = "..."; mCursorPositions.Add(-5); mTextAreaOverlayElement = createTextAreaOverlayElement(mInstanceName + ".Caption", mPixelDimensions, ""); mOverlayElement = mTextAreaOverlayElement; mOverlayContainer.AddChild(mOverlayElement); mTextAreaOverlayElement.Show(); mTextAreaOverlayElement.FontName = mFont; mTextAreaOverlayElement.CharHeight = mPixelDimensions.w; string tcMaterial = getSheet().getDefaultSkin() + ".textcursor"; mTextCursor = new TextCursor(mInstanceName + ".TextCursor", new Vector4(0, 0, 0, 1), QGuiMetricsMode.QGUI_GMM_RELATIVE, QGuiMetricsMode.QGUI_GMM_RELATIVE, tcMaterial, mChildrenContainer, this); mTextCursor.setZOrderOffset(1, false); mTextCursor.hide(); }
internal void setTruncateMode(TruncateMode MODE) { mTruncateMode = MODE; setText(mText); }
public static string Truncate(this string original, float maxOriginalLengthPercent, TruncateMode mode) => Truncate(original: original, maxOriginalLengthPercent: maxOriginalLengthPercent, ellipsis: FormatStringUtilities.TruncateEllipsis, mode: mode);
public static string Truncate(this string original, float maxOriginalLengthPercent, string ellipsis, TruncateMode mode) { maxOriginalLengthPercent .EnsureNumber(nameof(maxOriginalLengthPercent)) .EnsureNotLessThan(.0F) .EnsureNotGreaterThan(1.0F); ellipsis.EnsureNotNull(nameof(ellipsis)); // if (string.IsNullOrEmpty(original) || maxOriginalLengthPercent == 1.0F) { return(original); } else { int maxOriginalLength; checked { maxOriginalLength = (int)Math.Ceiling(original.Length * maxOriginalLengthPercent); } if (maxOriginalLength < original.Length) { checked { return(Truncate(original, maxOriginalLength + ellipsis.Length, ellipsis, mode)); } } else { return(original); } } }
public static string Truncate(this string original, int maxTruncatedLength, TruncateMode mode) => Truncate(original: original, maxTruncatedLength: maxTruncatedLength, ellipsis: FormatStringUtilities.TruncateEllipsis, mode: mode);
// TODO: Put strings into the resources. // public static string Truncate(this string original, int maxTruncatedLength, string ellipsis, TruncateMode mode) { maxTruncatedLength.EnsureNotLessThanZero(nameof(maxTruncatedLength)); ellipsis.EnsureNotNull(nameof(ellipsis)); if (maxTruncatedLength < ellipsis.Length) { throw new ArgumentException( message: $"{FormatXResource(typeof(string), "TooLong")} Длина строки не может быть больше значения параметра '{nameof(maxTruncatedLength)}'.", paramName: nameof(ellipsis)); } if (!(mode == TruncateMode.End || mode == TruncateMode.Middle || mode == TruncateMode.Start)) { throw new ArgumentOutOfRangeException( paramName: nameof(mode), message: $"Значение '{mode}' не поддерживается."); } // if (string.IsNullOrEmpty(original)) { return(original); } else if (maxTruncatedLength == 0) { return(string.Empty); } else if (original.Length <= maxTruncatedLength) { return(original); } else if (maxTruncatedLength == ellipsis.Length) { return(original.Length > ellipsis.Length ? ellipsis : original); } else if (mode == TruncateMode.Middle) { var stringValueBeginLength = (maxTruncatedLength - ellipsis.Length) / 2; var stringValueEndLength = (maxTruncatedLength - ellipsis.Length) - stringValueBeginLength; return (original.Substring(0, stringValueBeginLength) + ellipsis + original.Substring(original.Length - stringValueEndLength, stringValueEndLength)); } else if (mode == TruncateMode.Start) { return(ellipsis + original.Right(maxTruncatedLength - ellipsis.Length)); } else { return(original.Left(maxTruncatedLength - ellipsis.Length) + ellipsis); } }
public static extern int imaqTruncate(IntPtr dest, IntPtr source, TruncateMode highlow, float ratioToKeep);