c# - Order list of Rectangles -


I would like to put a list of those words, how they appear on the page they found. (If so, with many lines)

  Quick brown fox jumped   

I have a list of custom Word Objects that contain the text of the word, and it leaves the left, right, top, and bottom values ​​of the top left corner of the page (0, 0).

  words.Add (new word () {text = "the", box = new rectangle () {left = 10, right = 30, top = 10, bottom = 21}); word. Add (new word () {text = "brown", box = new rectangle () {left = 65, right = 95, top = 11, bottom = 20}); word. Add (new word () {text = "jumped", box = new rectangle () {left = 36, true = 64, top = 26, bottom = 38}); word. Add (new word () {text = "quick", box = new rectangle () {left = 35, right = 60, top = 11, bottom = 24}); word. Add (new word () {text = "fox", box = new rectangle () {left = 10, right = 30, top = 25, bottom = 35}); Internal square word (inner rectangle box {internal}} {get; set;} internal string text {get} set;}}   

I can easily order a line sorted by left bound, but 2 lines are hurting my mind (it's Friday). Any thoughts ???

Use OrderBy and then from in , which will order it from the X position, and then sort it by the Y position.

 < Code> list & Lt; Word & gt; Sorted words = words .orderbie (w = & gt; w.box.Left). Then (w = & gt; w.box.Top) .Olist ();    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -