View Javadoc
1   /*
2    * Copyright (c) 2002-2026 Gargoyle Software Inc.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * https://www.apache.org/licenses/LICENSE-2.0
8    *
9    * Unless required by applicable law or agreed to in writing, software
10   * distributed under the License is distributed on an "AS IS" BASIS,
11   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12   * See the License for the specific language governing permissions and
13   * limitations under the License.
14   */
15  package org.htmlunit.javascript.host.svg;
16  
17  import org.htmlunit.javascript.HtmlUnitScriptable;
18  import org.htmlunit.javascript.configuration.JsxClass;
19  import org.htmlunit.javascript.configuration.JsxConstructor;
20  import org.htmlunit.javascript.configuration.JsxGetter;
21  import org.htmlunit.javascript.configuration.JsxSetter;
22  
23  /**
24   * JavaScript host object for {@code SVGRect}.
25   *
26   * @author Ahmed Ashour
27   * @author Ronald Brill
28   *
29   * @see <a href="https://developer.mozilla.org/en-US/docs/Web/API/SVGRect">MDN Documentation</a>
30   */
31  @JsxClass
32  public class SVGRect extends HtmlUnitScriptable {
33  
34      private double xValue_;
35      private double yValue_;
36      private double width_;
37      private double height_;
38  
39      /**
40       * Creates an instance of this object.
41       */
42      @JsxConstructor
43      public void jsConstructor() {
44          // nothing to do
45      }
46  
47      /**
48       * Returns the {@code x} coordinate of the rectangle.
49       *
50       * @return the {@code x} coordinate
51       */
52      @JsxGetter
53      public double getX() {
54          return xValue_;
55      }
56  
57      /**
58       * Sets the {@code x} coordinate of the rectangle.
59       *
60       * @param x the {@code x} coordinate
61       */
62      @JsxSetter
63      public void setX(final double x) {
64          xValue_ = x;
65      }
66  
67      /**
68       * Returns the {@code y} coordinate of the rectangle.
69       *
70       * @return the {@code y} coordinate
71       */
72      @JsxGetter
73      public double getY() {
74          return yValue_;
75      }
76  
77      /**
78       * Sets the {@code y} coordinate of the rectangle.
79       *
80       * @param y the {@code y} coordinate
81       */
82      @JsxSetter
83      public void setY(final double y) {
84          yValue_ = y;
85      }
86  
87      /**
88       * Returns the width of the rectangle.
89       *
90       * @return the width
91       */
92      @JsxGetter
93      public double getWidth() {
94          return width_;
95      }
96  
97      /**
98       * Sets the width of the rectangle.
99       *
100      * @param width the width
101      */
102     @JsxSetter
103     public void setWidth(final double width) {
104         width_ = width;
105     }
106 
107     /**
108      * Returns the height of the rectangle.
109      *
110      * @return the height
111      */
112     @JsxGetter
113     public double getHeight() {
114         return height_;
115     }
116 
117     /**
118      * Sets the height of the rectangle.
119      *
120      * @param height the height
121      */
122     @JsxSetter
123     public void setHeight(final double height) {
124         height_ = height;
125     }
126 }