From 1a29ae579f614303d73ca01aa40dd94d3cca3eac Mon Sep 17 00:00:00 2001
From: Martin Goik <goik@hdm-stuttgart.de>
Date: Sat, 6 Jun 2015 07:59:17 +0200
Subject: [PATCH] Revamping the rectangle/circle example

---
 Doc/Sd1/objectsClasses.xml | 83 ++++++++++++++++++++++++--------------
 1 file changed, 52 insertions(+), 31 deletions(-)

diff --git a/Doc/Sd1/objectsClasses.xml b/Doc/Sd1/objectsClasses.xml
index 581f57928..1b47cebe2 100644
--- a/Doc/Sd1/objectsClasses.xml
+++ b/Doc/Sd1/objectsClasses.xml
@@ -726,21 +726,33 @@ public class Circle {
 }</programlisting>
               </answer>
             </qandaentry>
+          </qandadiv>
+        </qandaset>
+      </section>
 
+      <section xml:id="sd1SectSvgAndTranslation">
+        <title>Adding translations and <xref linkend="glo_SVG"/>
+        export.</title>
+
+        <qandaset defaultlabel="qanda" xml:id="sdQandaSvgAndTranslation">
+          <qandadiv>
             <qandaentry>
               <question>
-                <para>Our current Circle and Rectangle class only models shape
-                parameters and does not allow for translation in a coordinate
-                system:</para>
+                <para>We want to add more features to tour
+                <classname>Circle</classname> and
+                <classname>Rectangle</classname> classes:</para>
 
-                <itemizedlist>
-                  <listitem>
-                    <para>Add two more instance variables x and y and
-                    corresponding setter methods to account for a shape's
-                    translation vector with respect to the origin (0,0). The
-                    following hint may be helpful:</para>
+                <glosslist>
+                  <glossentry>
+                    <glossterm>Translations</glossterm>
 
-                    <programlisting language="java">  /**
+                    <glossdef>
+                      <para>Add two more instance variables x and y and
+                      corresponding setter methods to account for a shape's
+                      translation vector with respect to the origin (0,0). The
+                      following hint may be helpful:</para>
+
+                      <programlisting language="java">  /**
    * @param x The circle's x center coordinate value
    */
   public void setX(double x) {
@@ -752,26 +764,34 @@ public class Circle {
   public void setY(double y) {
     // TODO
   }</programlisting>
-                  </listitem>
+                    </glossdef>
+                  </glossentry>
 
-                  <listitem>
-                    <para>We would like Rectangle and Circle instances to be
-                    visualized as <acronym>SVG</acronym> graphics. Add a
-                    method <methodname>void writeSvg()</methodname> to both
-                    classes which allows for <acronym>SVG</acronym> code
-                    export to standard output. You may want to read the
-                    w3schools <link
-                    xlink:href="http://www.w3schools.com/svg/svg_rect.asp">rectangle</link>
-                    and <link
-                    xlink:href="http://www.w3schools.com/svg/svg_circle.asp">circle</link>
-                    examples. Use System.out.println(...) calls to create the
-                    desired <acronym>SVG</acronym> output. You may need
-                    <code>\"</code> to represent double quotes as in the
-                    subsequent example:</para>
-
-                    <programlisting language="java">System.out.println("&lt;rect width=\"20\"" ...</programlisting>
-                  </listitem>
-                </itemizedlist>
+                  <glossentry>
+                    <glossterm><xref linkend="glo_SVG"/> export</glossterm>
+
+                    <glossdef>
+                      <para>We would like Rectangle and Circle instances to be
+                      visualized as <xref linkend="glo_SVG"/> graphics. <link
+                      xlink:href="http://www.w3schools.com/svg/svg_examples.asp">SVG
+                      Examples</link> provides editor samples both for <link
+                      xlink:href="http://www.w3schools.com/svg/tryit.asp?filename=trysvg_circle">circles</link>
+                      and <link
+                      xlink:href="http://www.w3schools.com/svg/tryit.asp?filename=trysvg_rect">rectangles</link>.
+                      Add a method <methodname>void writeSvg()</methodname> to
+                      both of your classes which allows for <xref
+                      linkend="glo_SVG"/> code being written to standard
+                      output. Use
+                      <methodname>System.out.println(...)</methodname> calls
+                      to create the desired <xref linkend="glo_SVG"/> output.
+                      You may need <code>\"</code> to represent double quotes
+                      as in the subsequent example or use single attribute
+                      quotes instead:</para>
+
+                      <programlisting language="java">System.out.println("&lt;rect width=\"20\"" ...</programlisting>
+                    </glossdef>
+                  </glossentry>
+                </glosslist>
 
                 <para>The following code snippet may serve to illustrate the
                 intended use of <methodname>void
@@ -816,8 +836,9 @@ public class Circle {
   &lt;/body&gt;
 &lt;/html&gt;</programlisting>
 
-                <para>You may enter this output into a file sfg.html. A web
-                browser should visualize this output as:</para>
+                <para>You may copy this output into a file
+                <filename>svg.html</filename>. A web browser should visualize
+                this output as:</para>
 
                 <informalfigure>
                   <mediaobject>
-- 
GitLab