1 /*
2 * Copyright (C) 2016 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.ar.sfm;
17
18 import java.io.Serializable;
19
20 /**
21 * Contains color information for a given point.
22 */
23 public abstract class PointColorData implements Serializable {
24 /**
25 * Default quality score value.
26 */
27 public static final double DEFAULT_QUALITY_SCORE = 1.0;
28
29 /**
30 * ID to identify this instance. This is useful in case that this data is
31 * stored in some sort of database and must be set externally.
32 */
33 private String id;
34
35 /**
36 * Quality score of color data. The larger the value the higher the
37 * quality of color data.
38 */
39 private double qualityScore = DEFAULT_QUALITY_SCORE;
40
41 /**
42 * Constructor.
43 */
44 protected PointColorData() {
45 }
46
47 /**
48 * Gets id to identify this instance. This is useful in case that this data
49 * is stored in some sort of database and must be set externally.
50 *
51 * @return id to identify this instance.
52 */
53 public String getId() {
54 return id;
55 }
56
57 /**
58 * Sets id to identify this instance. This is useful in case that this data
59 * is stored in some sort of database and must be set externally.
60 *
61 * @param id id to identify this instance.
62 */
63 public void setId(final String id) {
64 this.id = id;
65 }
66
67 /**
68 * Quality score of color data. The larger the value the higher the quality
69 * of color data.
70 *
71 * @return quality score.
72 */
73 public double getQualityScore() {
74 return qualityScore;
75 }
76
77 /**
78 * Sets quality score of color data. The larger the value the higher the
79 * quality of color data.
80 *
81 * @param qualityScore quality score to be set.
82 */
83 public void setQualityScore(final double qualityScore) {
84 this.qualityScore = qualityScore;
85 }
86
87 /**
88 * Averages this color data with provided one and stores the result into
89 * provided instance.
90 *
91 * @param other other instance to average color data with.
92 * @param result instance where result of average will be stored.
93 */
94 public abstract void average(final PointColorData other, final PointColorData result);
95 }