Skip to content

Commit f44b33e

Browse files
No actual code change. Only moved methods/constructors within a file.
Moved the factory constructors up to just below the main constructor, and moved the deprecated factory methods to the bottom.
1 parent 797927c commit f44b33e

1 file changed

Lines changed: 41 additions & 32 deletions

File tree

lib/src/crs_coordinate.dart

Lines changed: 41 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -31,26 +31,16 @@ class CrsCoordinate {
3131
/// The coordinate value representing the latitude or Y or Northing.
3232
final double yLatitude;
3333

34+
// -----------------------------------------------
35+
// Three constructors (one private, and two public factory constructors):
36+
3437
/// Private constructor. Client code must instead use the factory constructors.
3538
const CrsCoordinate._privateConstructor(
3639
this.crsProjection,
3740
this.yLatitude,
3841
this.xLongitude
3942
);
4043

41-
/// Transforms the coordinate to another coordinate reference system.
42-
/// [targetCrsProjection] represents the coordinate reference system that you want to transform to.
43-
CrsCoordinate transform(CrsProjection targetCrsProjection) {
44-
return Transformer.transform(this, targetCrsProjection);
45-
}
46-
47-
/// Transforms the coordinate to another coordinate reference system.
48-
/// [targetEpsgNumber] represents the coordinate reference system that you want to transform to.
49-
CrsCoordinate transformByEpsgNumber(int targetEpsgNumber) {
50-
CrsProjection targetCrsProjection = CrsProjectionFactory.getCrsProjectionByEpsgNumber(targetEpsgNumber);
51-
return transform(targetCrsProjection);
52-
}
53-
5444
/// Factory constructor for creating an instance.
5545
/// [epsgNumber] represents the coordinate reference system that defines the location together with the other two parameters.
5646
/// [xLongitude] is the coordinate position value representing the longitude or X or Easting
@@ -64,16 +54,6 @@ class CrsCoordinate {
6454
return CrsCoordinate.createCoordinate(crsProjection, yLatitude, xLongitude);
6555
}
6656

67-
/// Deprecated: Use [createCoordinateByEpsgNumber] instead i.e. the same name but lowercased first letter
68-
@deprecated
69-
static CrsCoordinate CreateCoordinateByEpsgNumber(
70-
int epsgNumber,
71-
double yLatitude,
72-
double xLongitude
73-
) {
74-
return CrsCoordinate.createCoordinateByEpsgNumber(epsgNumber, yLatitude, xLongitude);
75-
}
76-
7757
/// Factory constructor for creating an instance.
7858
/// [crsProjection] represents the coordinate reference system that defines the location together with the other two parameters.
7959
/// [xLongitude] is the coordinate position value representing the longitude or X or Easting
@@ -86,15 +66,20 @@ class CrsCoordinate {
8666
) {
8767
return CrsCoordinate._privateConstructor(crsProjection, yLatitude, xLongitude);
8868
}
69+
// -----------------------------------------------
8970

90-
/// Deprecated: Use [createCoordinate] instead i.e. the same name but lowercased first letter
91-
@deprecated
92-
static CrsCoordinate CreateCoordinate(
93-
CrsProjection crsProjection,
94-
double yLatitude,
95-
double xLongitude
96-
) {
97-
return CrsCoordinate.createCoordinate(crsProjection, yLatitude, xLongitude);
71+
72+
/// Transforms the coordinate to another coordinate reference system.
73+
/// [targetCrsProjection] represents the coordinate reference system that you want to transform to.
74+
CrsCoordinate transform(CrsProjection targetCrsProjection) {
75+
return Transformer.transform(this, targetCrsProjection);
76+
}
77+
78+
/// Transforms the coordinate to another coordinate reference system.
79+
/// [targetEpsgNumber] represents the coordinate reference system that you want to transform to.
80+
CrsCoordinate transformByEpsgNumber(int targetEpsgNumber) {
81+
CrsProjection targetCrsProjection = CrsProjectionFactory.getCrsProjectionByEpsgNumber(targetEpsgNumber);
82+
return transform(targetCrsProjection);
9883
}
9984

10085
@override
@@ -126,7 +111,6 @@ class CrsCoordinate {
126111
return _toStringImplementation(this);
127112
}
128113

129-
130114
/// See also [CrsCoordinateToString]
131115
static CrsCoordinateToString _toStringImplementation = defaultToStringImplementation;
132116

@@ -150,4 +134,29 @@ class CrsCoordinate {
150134
_toStringImplementation = defaultToStringImplementation;
151135
}
152136

137+
138+
139+
// -----------------------------------------------
140+
// Deprecated methods:
141+
142+
/// Deprecated: Use [createCoordinateByEpsgNumber] instead i.e. the same name but lowercased first letter
143+
@deprecated
144+
static CrsCoordinate CreateCoordinateByEpsgNumber(
145+
int epsgNumber,
146+
double yLatitude,
147+
double xLongitude
148+
) {
149+
return CrsCoordinate.createCoordinateByEpsgNumber(epsgNumber, yLatitude, xLongitude);
150+
}
151+
152+
/// Deprecated: Use [createCoordinate] instead i.e. the same name but lowercased first letter
153+
@deprecated
154+
static CrsCoordinate CreateCoordinate(
155+
CrsProjection crsProjection,
156+
double yLatitude,
157+
double xLongitude
158+
) {
159+
return CrsCoordinate.createCoordinate(crsProjection, yLatitude, xLongitude);
160+
}
161+
// -----------------------------------------------
153162
}

0 commit comments

Comments
 (0)