1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package org.hipparchus.geometry;
23
24 import java.util.Locale;
25 import java.util.MissingResourceException;
26 import java.util.ResourceBundle;
27
28 import org.hipparchus.exception.Localizable;
29 import org.hipparchus.exception.UTF8Control;
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45 public enum LocalizedGeometryFormats implements Localizable {
46
47
48 CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR("cannot normalize a zero norm vector"),
49
50
51 CLOSE_VERTICES("too close vertices near point ({0}, {1}, {2})"),
52
53
54 CLOSEST_ORTHOGONAL_MATRIX_HAS_NEGATIVE_DETERMINANT("the closest orthogonal matrix has a negative determinant {0}"),
55
56
57 CROSSING_BOUNDARY_LOOPS("some outline boundary loops cross each other"),
58
59
60 EDGE_CONNECTED_TO_ONE_FACET("edge joining points ({0}, {1}, {2}) and ({3}, {4}, {5}) is connected to one facet only"),
61
62
63 FACET_ORIENTATION_MISMATCH("facets orientation mismatch around edge joining points ({0}, {1}, {2}) and ({3}, {4}, {5})"),
64
65
66 INCONSISTENT_STATE_AT_2_PI_WRAPPING("inconsistent state at 2\u03c0 wrapping"),
67
68
69 NON_INVERTIBLE_TRANSFORM("non-invertible affine transform collapses some lines into single points"),
70
71
72 NOT_CONVEX("vertices do not form a convex hull in CCW winding"),
73
74
75 NOT_CONVEX_HYPERPLANES("hyperplanes do not define a convex region"),
76
77
78 NOT_SUPPORTED_IN_DIMENSION_N("method not supported in dimension {0}"),
79
80
81 OUTLINE_BOUNDARY_LOOP_OPEN("an outline boundary loop is open"),
82
83
84 FACET_WITH_SEVERAL_BOUNDARY_LOOPS("a facet has several boundary loops"),
85
86
87 OUT_OF_PLANE("point ({0}, {1}, {2}) is out of plane"),
88
89
90 ROTATION_MATRIX_DIMENSIONS("a {0}x{1} matrix cannot be a rotation matrix"),
91
92
93 UNABLE_TO_ORTHOGONOLIZE_MATRIX("unable to orthogonalize matrix in {0} iterations"),
94
95
96 ZERO_NORM_FOR_ROTATION_AXIS("zero norm for rotation axis"),
97
98
99 ZERO_NORM_FOR_ROTATION_DEFINING_VECTOR("zero norm for rotation defining vector"),
100
101
102 TOO_SMALL_TOLERANCE("tolerance {0,number,0.00000E00} is not computationally feasible, it is smaller than {1} ({2,number,0.00000E00})"),
103
104
105 INVALID_ROTATION_ORDER_NAME("the value {0} does not correspond to a rotation order");
106
107
108 private final String sourceFormat;
109
110
111
112
113
114 LocalizedGeometryFormats(final String sourceFormat) {
115 this.sourceFormat = sourceFormat;
116 }
117
118
119 @Override
120 public String getSourceString() {
121 return sourceFormat;
122 }
123
124
125 @Override
126 public String getLocalizedString(final Locale locale) {
127 try {
128 final String path = LocalizedGeometryFormats.class.getName().replaceAll("\\.", "/");
129 ResourceBundle bundle =
130 ResourceBundle.getBundle("assets/" + path, locale, new UTF8Control());
131 if (bundle.getLocale().getLanguage().equals(locale.getLanguage())) {
132 final String translated = bundle.getString(name());
133 if ((translated != null) &&
134 (translated.length() > 0) &&
135 (!translated.toLowerCase(locale).contains("missing translation"))) {
136
137 return translated;
138 }
139 }
140
141 } catch (MissingResourceException mre) {
142
143 }
144
145
146
147 return sourceFormat;
148
149 }
150
151 }