<< Chapter < Page Chapter >> Page >

The width of the rectangle is to be 987 SVG units (width="987") , and the height of the rectangle is to be 762 SVG units (height="762") .

If you were to run the program at this point, open the output SVG file in Firefox 5, and print the result, you would have a blank sheet of paper with a blackoutline barely inside the edges of the paper. (Note, however, that on my system, there is a margin of approximately one-half inch at the bottom of thepaper.)

Draw the floor and the wall

In the image shown in Figure 2 , the floor consists of a line parallel to the horizontal axis near the bottom of the drawing. The wall consists of a lineparallel to the vertical axis near the left side of the drawing. The Java code in Listing 7 causes those two lines to be drawn.

(All coordinate values and dimensions given in this and the following Java code are in inches, so I will stop mentioning that at this point.)

Listing 7 . Draw the floor and the wall.
//Draw the floor. Element floor = SvgLib21.makeLine(svg,ns, "line",//title0.5, //x-coordinate of one end of line 0.5, //y-coordinate of one end of line10.5,//x-coordinate of other end of line 0.5 //y-coordinate of other end of line); //Draw the wall.Element wall = SvgLib21.makeLine(svg, ns,"line", 1.0,0.5, 1.0,7.5 );

Two SVG elements of type line

Each of the Java statements in Listing 7 causes a new SVG element of type line to be created. The first element is named floor in the Java code. ( I will have more to say about element names later .) The second element is named wall . (See Listing 8 later.)

What can you change?

As before, there are only six things that you are allowed to change in each of the Java statements in Listing 7 :

  • The names of the line elements (floor and wall in Listing 7 .)
  • The values of the titles ("line" in Listing 7 .)
  • The x and y coordinate values for one end of each line.
  • The x and y coordinate values for the other end of each line.

If you examine the x and y coordinate values for one end of the line named floor in Listing 7 (0.5, 0.5) , you will see that one end of the line is near the origin at the lower-left corner of the drawing.

If you examine the x and y coordinate values for the other end of the line named floor (10.5, 0.5) , you will see that the other end of the line is near the lower-right corner of the drawing. Furthermore, both y-coordinate values are0.5, meaning that the line is parallel to the horizontal axis as desired.

A similar analysis of the line named wall will reveal that it intersects the floor near the left end at (1.0, 0.5) and is parallel to the vertical axis.

SVG code to draw a line

Listing 8 shows the two line elements created by the Java code shown in Listing 7 .

Listing 8 . SVG code to draw a line.
<line stroke="black" stroke-width="1" x1="45" y1="720" x2="945" y2="720"><title>line</title></line><line stroke="black" stroke-width="1" x1="90" y1="720" x2="90" y2="90"><title>line</title></line>

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Accessible physics concepts for blind students. OpenStax CNX. Oct 02, 2015 Download for free at https://legacy.cnx.org/content/col11294/1.36
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Accessible physics concepts for blind students' conversation and receive update notifications?

Ask