/// <summary> /// Determines whether the torque text ("20 Nm (177 lb-in)" exists nearby the figure item) /// </summary> /// <param name="torqueText">The torque text.</param> /// <param name="figureItemNumber">The figure item number.</param> /// <returns> /// <c>true</c> if [contains torque text to fig item] [the specified torque text]; otherwise, <c>false</c>. /// </returns> public bool ContainsTorqueTextToFigItem(string torqueText, string figureItemNumber) { torqueText = torqueText.ReplaceIgnoreCase("lb-in", "Ibf.in"); torqueText = torqueText.Replace(" and ", "-"); torqueText = torqueText.Replace(" to ", "-"); var figureItems = GetAllFigureItems(true).Where(c => c.Text == figureItemNumber); if (figureItems.Any()) { var firstText = torqueText.Substring(0, torqueText.IndexOf('(')).Trim(); var secondText = torqueText.Substring(torqueText.IndexOf('(')).Trim(); var torqueTexts = GetTorqueTextCandiates(); var firstLineCommands = torqueTexts.Where(c => c.Text.EqualsIgnoreCase(firstText)); foreach (var textCommand in firstLineCommands) { var secondLineCommand = torqueTexts.FirstOrDefault(c => c.Text.EqualsIgnoreCase(secondText) && GeometryRecognitionEngine.IsNearBy(textCommand.Position, c.Position, 15) ); if (secondLineCommand != null && figureItems.Any(f => GeometryRecognitionEngine.IsNearBy(textCommand.Position, f.Position, 40))) { return(true); } } } return(false); }
/// <summary> /// Gets all found rectangles. /// </summary> /// <returns></returns> public List <CgmRectangle> GetRectangles() { if (_rectangles == null) { _rectangles = GeometryRecognitionEngine.GetRectangles(this); } return(_rectangles); }