diff --git a/Doc/Sd1/objectsClasses.xml b/Doc/Sd1/objectsClasses.xml index e757317eb045c04b65bfd14d2baa664743dfa215..af4df630a5f77c5a7ae1dbeb50f14add17cff7b8 100644 --- a/Doc/Sd1/objectsClasses.xml +++ b/Doc/Sd1/objectsClasses.xml @@ -1314,6 +1314,44 @@ public class Circle { public void setY(double y) { // TODO }</programlisting> + + <para>You may as well extend the constructors of + <classname>Rectangle</classname> and + <classname>Circle</classname> to accept center coordinates + as well:</para> + + <programlisting language="java">public class Rectangle { + +... + /** + * Rectangle having center coordinates x, y, width and height. + * + * @param x The rectangle center's x-coordinate + * @param y The rectangle center's y-coordinate + * @param width The rectangle's width + * @param height The rectangle's height + */ + public Rectangle(double x, double y, double width, double height) { + ... + } + ... +}</programlisting> + + <programlisting language="java">public class Circle { + ... + + /** + * Circle having center coordinates x, y and radius r. + * + * @param x The circle center's x-coordinate + * @param y The circle center's y-coordinate + * @param The circle's radius + */ + public Circle(double x, double y, double radius) { + ... + } + ... +}</programlisting> </glossdef> </glossentry> @@ -1333,8 +1371,8 @@ public class Circle { 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 + may need <code>\"</code> to escape double quotes as in the + subsequent example or use single attribute quotes instead:</para> <programlisting language="java">System.out.println("<rect width=\"20\"" ...</programlisting> @@ -1359,7 +1397,7 @@ public class Circle { r.writeSvg(); // Draw a circle as SVG - final Circle c = new Circle(1, 1, 3); + final Circle c = new Circle(1, 3); c.setX(3); c.setY(1); c.writeSvg(); @@ -1378,7 +1416,7 @@ public class Circle { <html> <body> <svg width='300' height='200' > - <emphasis role="bold"><rect width='100.0' height='80.0' x='40.0' y='20.0'' + <emphasis role="bold"><rect width='100.0' height='80.0' x='40.0' y='20.0' style='fill:rgb(0,255,0);stroke-width:3;stroke:rgb(0,0,0)'/></emphasis> <emphasis role="bold"><circle r='60.0' cx='60.0' cy='20.0' style='fill:rgb(0,0,255);stroke-width:3;stroke:rgb(0,0,0)'/></emphasis>