View Javadoc
1   /*
2    * Copyright (C) 2018 Alberto Irurueta Carro (alberto@irurueta.com)
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    *
8    *         http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package com.irurueta.navigation.geodesic;
17  
18  /**
19   * A container for the results from PolygonArea.
20   */
21  public class PolygonResult {
22  
23      /**
24       * The number of vertices in the polygon.
25       */
26      private int num;
27  
28      /**
29       * The perimeter of the polygon or the length of the polyline (meters).
30       */
31      private double perimeter;
32  
33      /**
34       * The area of the polygon (meters<sup>2</sup>).
35       */
36      private double area;
37  
38      /**
39       * Constructor.
40       *
41       * @param num       the number of vertices in the polygon.
42       * @param perimeter the perimeter of the polygon or the length of the polyline (meters).
43       * @param area      the area of the polygon (meters<sup>2</sup>).
44       */
45      public PolygonResult(final int num, final double perimeter, final double area) {
46          this.num = num;
47          this.perimeter = perimeter;
48          this.area = area;
49      }
50  
51      /**
52       * Gets the number of vertices in the polygon.
53       *
54       * @return number of vertices in the polygon.
55       */
56      public int getNum() {
57          return num;
58      }
59  
60      /**
61       * Sets the number of vertices in the polygon.
62       *
63       * @param num number of vertices in the polygon.
64       */
65      public void setNum(final int num) {
66          this.num = num;
67      }
68  
69      /**
70       * Gets the perimeter of the polygon or the length of the polyline (meters).
71       *
72       * @return the perimeter of the polygon or the length of the polyline.
73       */
74      public double getPerimeter() {
75          return perimeter;
76      }
77  
78      /**
79       * Sets the perimeter of the polygon or the length of the polyline (meters).
80       *
81       * @param perimeter the perimeter of the polygon or the length of the polyline.
82       */
83      public void setPerimeter(final double perimeter) {
84          this.perimeter = perimeter;
85      }
86  
87      /**
88       * Gets the area of the polygon (meters<sup>2</sup>).
89       *
90       * @return area of the polygon.
91       */
92      public double getArea() {
93          return area;
94      }
95  
96      /**
97       * Sets the area of the polygon (meters<sup>2</sup>).
98       *
99       * @param area area of the polygon.
100      */
101     public void setArea(double area) {
102         this.area = area;
103     }
104 }