| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
package footleg.cavesurvey.data.model; |
| 20 |
|
| 21 |
import static org.junit.Assert.*; |
| 22 |
|
| 23 |
import java.text.ParseException; |
| 24 |
import java.util.Date; |
| 25 |
|
| 26 |
import org.junit.Test; |
| 27 |
|
| 28 |
import footleg.cavesurvey.converter.CaveConverter.BearingUnit; |
| 29 |
import footleg.cavesurvey.converter.CaveConverter.GradientUnit; |
| 30 |
import footleg.cavesurvey.converter.CaveConverter.LengthUnit; |
| 31 |
import footleg.cavesurvey.data.model.SeriesLink; |
| 32 |
import footleg.cavesurvey.data.model.SurveySeries; |
| 33 |
import footleg.cavesurvey.data.model.SurveyStation; |
| 34 |
import footleg.cavesurvey.tools.TestHelper; |
| 35 |
import footleg.cavesurvey.tools.UtilityFunctions; |
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
public class SurveySeriesTest { |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
@Test |
| 52 |
public void testSurveySeriesName() { |
| 53 |
String seriesName1 = "Test Series"; |
| 54 |
String seriesName2 = "Renamed Series"; |
| 55 |
|
| 56 |
|
| 57 |
SurveySeries series = new SurveySeries( seriesName1 ); |
| 58 |
|
| 59 |
|
| 60 |
assertTrue("Series name matches name given in contructor.", series.getSeriesName() == seriesName1 ); |
| 61 |
|
| 62 |
|
| 63 |
series.setSeriesName( seriesName2 ); |
| 64 |
|
| 65 |
|
| 66 |
assertTrue("Series name matches the updated name.", series.getSeriesName() == seriesName2 ); |
| 67 |
} |
| 68 |
|
| 69 |
@Test |
| 70 |
public void testSeriesDateGetSet() { |
| 71 |
SurveySeries series = new SurveySeries( "Test" ); |
| 72 |
String dateString = "12/02/1982 01:15:53"; |
| 73 |
String dateFormat = "dd/MM/yyyy HH:mm:ss"; |
| 74 |
try { |
| 75 |
Date date = UtilityFunctions.stringToDate(dateString, dateFormat); |
| 76 |
series.setSurveyDate(date); |
| 77 |
} catch (ParseException e) { |
| 78 |
|
| 79 |
e.printStackTrace(); |
| 80 |
} |
| 81 |
|
| 82 |
assertEquals("Date returned should match date set.", |
| 83 |
dateString, UtilityFunctions.dateToString(series.getSurveyDate(), dateFormat) ); |
| 84 |
|
| 85 |
} |
| 86 |
|
| 87 |
@Test |
| 88 |
public void testSeriesCommentSetSet() { |
| 89 |
SurveySeries series = new SurveySeries( "Test" ); |
| 90 |
String comment = "My surveying is perfect."; |
| 91 |
|
| 92 |
series.setComment(comment); |
| 93 |
|
| 94 |
assertEquals("Comment returned should match comment set.", comment, series.getComment() ); |
| 95 |
} |
| 96 |
|
| 97 |
@Test |
| 98 |
public void testSetStationIdFromName() { |
| 99 |
SurveySeries series = new SurveySeries( "Test" ); |
| 100 |
SurveyStation stn = new SurveyStation(0); |
| 101 |
|
| 102 |
|
| 103 |
stn.setName("42"); |
| 104 |
series.setStationIdFromName( stn ); |
| 105 |
assertTrue("Station id matches name string as number 42.", stn.getId() == 42 ); |
| 106 |
|
| 107 |
stn.setName("text"); |
| 108 |
series.setStationIdFromName( stn ); |
| 109 |
assertTrue("Station id from non-numeric name should be negative.", stn.getId() == -1 ); |
| 110 |
} |
| 111 |
|
| 112 |
@Test |
| 113 |
public void testAddLegSurveyLeg() { |
| 114 |
SurveySeries series = new SurveySeries( "Test" ); |
| 115 |
double leg1Length = 1.0; |
| 116 |
double leg2Length = 2.0; |
| 117 |
double leg3Length = 3.0; |
| 118 |
|
| 119 |
assertEquals("Series leg count is zero when first created.", 0, series.legCount() ); |
| 120 |
|
| 121 |
series.addLeg( TestHelper.createTestLeg(1,2,leg1Length,58,-14) ); |
| 122 |
assertEquals("Series leg count is one when one leg added.", 1, series.legCount() ); |
| 123 |
|
| 124 |
|
| 125 |
series.addLeg( TestHelper.createTestLeg(3,4,leg3Length,0,0) ); |
| 126 |
assertEquals("Series leg count is 2 when 2 legs added.", 2, series.legCount() ); |
| 127 |
assertEquals("First leg added is at the start.", series.getLegRaw(0).getLength( LengthUnit.Metres ), leg1Length, 1e-9 ); |
| 128 |
assertEquals("Last leg added is at the end.", series.getLegRaw(series.legCount() - 1).getLength( LengthUnit.Metres ), leg3Length, 1e-9 ); |
| 129 |
|
| 130 |
|
| 131 |
series.addLeg( TestHelper.createTestLeg(2,3,leg2Length,12,34), 1 ); |
| 132 |
assertEquals("Series leg count is 3 when 3 legs added.", 3, series.legCount() ); |
| 133 |
assertEquals("First leg added is at the start.", series.getLegRaw(0).getLength( LengthUnit.Metres ), leg1Length, 1e-9 ); |
| 134 |
assertEquals("Leg 3 is at the end.", series.getLegRaw(series.legCount() - 1).getLength( LengthUnit.Metres ), leg3Length, 1e-9 ); |
| 135 |
assertEquals("Leg 2 is in the middle.", series.getLegRaw(1).getLength( LengthUnit.Metres ), leg2Length, 1e-9 ); |
| 136 |
} |
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
@Test |
| 142 |
public void testGetNumberToRepresentStnName() { |
| 143 |
SurveySeries series = new SurveySeries( "Test" ); |
| 144 |
|
| 145 |
|
| 146 |
String stn1A = "1A"; |
| 147 |
int stn1 = series.getNumberToRepresentStnName(stn1A); |
| 148 |
|
| 149 |
|
| 150 |
assertTrue("Mapped station number should be negative.", stn1 < 0 ); |
| 151 |
|
| 152 |
|
| 153 |
String stn2A = "2A"; |
| 154 |
int stn2 = series.getNumberToRepresentStnName(stn2A); |
| 155 |
|
| 156 |
|
| 157 |
assertTrue("Mapped station number should be negative.", stn2 < 0 ); |
| 158 |
|
| 159 |
|
| 160 |
assertFalse("Mapped station numbers should be unique.", stn1 == stn2 ); |
| 161 |
|
| 162 |
|
| 163 |
int stn1b = series.getNumberToRepresentStnName(stn1A); |
| 164 |
|
| 165 |
|
| 166 |
assertTrue("Mapped station number should be the same when the same string is passed in a second time.", stn1 == stn1b ); |
| 167 |
|
| 168 |
} |
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
|
| 173 |
@Test |
| 174 |
public void testGetMappedStnName() { |
| 175 |
SurveySeries series = new SurveySeries( "Test" ); |
| 176 |
|
| 177 |
|
| 178 |
String stn1A = "1A"; |
| 179 |
int stn1 = series.getNumberToRepresentStnName(stn1A); |
| 180 |
assertTrue("Station number should be negative for a numeric name.", stn1 < 0); |
| 181 |
|
| 182 |
|
| 183 |
String stn2A = "2A"; |
| 184 |
int stn2 = series.getNumberToRepresentStnName(stn2A); |
| 185 |
assertTrue("Station number should be negative for a numeric name.", stn2 < 0); |
| 186 |
|
| 187 |
|
| 188 |
String stn3N = stn2A; |
| 189 |
int stn3 = series.getNumberToRepresentStnName(stn3N); |
| 190 |
assertEquals("Station number should be same as last time this name was used.", stn2, stn3); |
| 191 |
|
| 192 |
|
| 193 |
assertEquals("Returned station name should match name specified for number.", stn1A, series.getMappedStnName( stn1 ) ); |
| 194 |
|
| 195 |
|
| 196 |
assertEquals("Returned station name should match name specified for number.", stn2A, series.getMappedStnName( stn2 ) ); |
| 197 |
|
| 198 |
|
| 199 |
assertEquals("Returned station name should match name specified for number.", stn3N, series.getMappedStnName( stn3 ) ); |
| 200 |
|
| 201 |
|
| 202 |
assertEquals("Station name should match number for positive ids", "123", series.getMappedStnName( 123 )); |
| 203 |
|
| 204 |
} |
| 205 |
|
| 206 |
@Test |
| 207 |
public void testCalibrationGettersSetters() { |
| 208 |
SurveySeries series = new SurveySeries( "Test" ); |
| 209 |
|
| 210 |
assertEquals("Tape calibration should be zero by default.", 0.0, series.getTapeCalibration( LengthUnit.Metres ), 1e-9); |
| 211 |
assertEquals("Compass calibration should be zero by default.", 0.0, series.getCompassCalibration( BearingUnit.Degrees ), 1e-9); |
| 212 |
assertEquals("Clino calibration should be zero by default.", 0.0, series.getClinoCalibration( GradientUnit.Degrees ), 1e-9); |
| 213 |
assertEquals("Declination should be zero by default.", 0.0, series.getDeclination(), 1e-9); |
| 214 |
|
| 215 |
double tapeCal = 1.45; |
| 216 |
double compassCal = 0.52; |
| 217 |
double clinoCal = -3.74; |
| 218 |
double decl = 2.56; |
| 219 |
|
| 220 |
series.setTapeCalibration( tapeCal, LengthUnit.Metres ); |
| 221 |
series.setCompassCalibration(compassCal, BearingUnit.Degrees); |
| 222 |
series.setClinoCalibration(clinoCal, GradientUnit.Degrees ); |
| 223 |
series.setDeclination(decl); |
| 224 |
|
| 225 |
assertEquals("Tape calibration should match value that was set.", tapeCal, series.getTapeCalibration( LengthUnit.Metres ), 1e-9); |
| 226 |
assertEquals("Compass calibration should match value that was set.", compassCal, series.getCompassCalibration( BearingUnit.Degrees ), 1e-9); |
| 227 |
assertEquals("Clino calibration should match value that was set.", clinoCal, series.getClinoCalibration( GradientUnit.Degrees ), 1e-9); |
| 228 |
assertEquals("Declination should match value that was set.", decl, series.getDeclination(), 1e-9); |
| 229 |
} |
| 230 |
|
| 231 |
@Test |
| 232 |
public void testAddLink() { |
| 233 |
SurveySeries series = new SurveySeries( "Test" ); |
| 234 |
String series1 = "ser1"; |
| 235 |
SurveyStation stn1 = new SurveyStation(1); |
| 236 |
String series2 = "ser2"; |
| 237 |
SurveyStation stn2 = new SurveyStation(2); |
| 238 |
|
| 239 |
|
| 240 |
assertEquals("Series link count is zero when first created.", 0, series.getLinks().size() ); |
| 241 |
series.addLink(series1, stn1, series2, stn2); |
| 242 |
assertEquals("Series link count is one when first link has been added.", 1, series.getLinks().size() ); |
| 243 |
SeriesLink link = series.getLinks().get(0); |
| 244 |
assertEquals("Link series 1 matches series set when adding link.", series1, link.getSeries1() ); |
| 245 |
assertEquals("Link station 1 matches station set when adding link.", stn1, link.getStn1() ); |
| 246 |
assertEquals("Link series 2 matches series set when adding link.", series2, link.getSeries2() ); |
| 247 |
assertEquals("Link station 2 matches station set when adding link.", stn2, link.getStn2() ); |
| 248 |
} |
| 249 |
|
| 250 |
@Test |
| 251 |
public void testAddSeries() { |
| 252 |
SurveySeries series = new SurveySeries( "Parent" ); |
| 253 |
|
| 254 |
assertEquals("Inner series count is zero when first created.", 0, series.innerSeriesCount() ); |
| 255 |
|
| 256 |
String innerSeries1 = "inner1"; |
| 257 |
SurveySeries inner1 = new SurveySeries( innerSeries1 ); |
| 258 |
series.addSeries(inner1); |
| 259 |
assertEquals("Inner series count is one when first inner series is added.", 1, series.innerSeriesCount() ); |
| 260 |
|
| 261 |
String innerSeries2 = "inner2"; |
| 262 |
SurveySeries inner2 = new SurveySeries( innerSeries2 ); |
| 263 |
series.addSeries(inner2); |
| 264 |
assertEquals("Inner series count is two when 2nd inner series is added.", 2, series.innerSeriesCount() ); |
| 265 |
|
| 266 |
String innerSeries3 = "inner3"; |
| 267 |
SurveySeries inner3 = new SurveySeries( innerSeries3 ); |
| 268 |
series.addSeries(inner3); |
| 269 |
assertEquals("Inner series count is 3 when 3rd inner series is added.", 3, series.innerSeriesCount() ); |
| 270 |
|
| 271 |
SurveySeries inner3rd = series.getInnerSeries(2); |
| 272 |
assertEquals("Inner series at index 2 is 3rd inner series added.", innerSeries3, inner3rd.getSeriesName() ); |
| 273 |
|
| 274 |
SurveySeries innerSearchMatch = series.findInnerSeriesByName(innerSeries2); |
| 275 |
assertEquals("Inner series matching name used to fin by name.", innerSeries2, innerSearchMatch.getSeriesName() ); |
| 276 |
|
| 277 |
} |
| 278 |
|
| 279 |
|
| 280 |
|
| 281 |
|
| 282 |
|
| 283 |
|
| 284 |
|
| 285 |
|
| 286 |
@Test |
| 287 |
public void testGetLegCorrectedWithCalibrations() { |
| 288 |
SurveySeries series = new SurveySeries( "Test" ); |
| 289 |
double leg1Length = 1.0; |
| 290 |
double leg1Compass = 83.0; |
| 291 |
double leg1Clino = -2.0; |
| 292 |
|
| 293 |
double leg2Length = 2.0; |
| 294 |
double leg2Compass = 359.9; |
| 295 |
double leg2Clino = -90.0; |
| 296 |
|
| 297 |
double leg3Length = 3.0; |
| 298 |
double leg3Compass = 260.5; |
| 299 |
double leg3Clino = 0.0; |
| 300 |
|
| 301 |
|
| 302 |
series.addLeg( TestHelper.createTestLeg(1,2,leg1Length,leg1Compass,leg1Clino) ); |
| 303 |
series.addLeg( TestHelper.createTestLeg(2,3,leg2Length,leg2Compass,leg2Clino) ); |
| 304 |
series.addLeg( TestHelper.createTestLeg(3,4,leg3Length,leg3Compass,leg3Clino) ); |
| 305 |
|
| 306 |
|
| 307 |
assertEquals("First leg length with no calibration set.", leg1Length, series.getLegCorrected(0).getLength( LengthUnit.Metres ), 1e-9 ); |
| 308 |
assertEquals("Second leg length with no calibration set.", leg2Length, series.getLegCorrected(1).getLength( LengthUnit.Metres ), 1e-9 ); |
| 309 |
assertEquals("Third leg length with no calibration set.", leg3Length, series.getLegCorrected(2).getLength( LengthUnit.Metres ), 1e-9 ); |
| 310 |
|
| 311 |
|
| 312 |
assertEquals("First leg bearing with no calibration set.", leg1Compass, series.getLegCorrected(0).getCompass(BearingUnit.Degrees), 1e-9 ); |
| 313 |
assertEquals("Second leg bearing with no calibration set.", leg2Compass, series.getLegCorrected(1).getCompass(BearingUnit.Degrees), 1e-9 ); |
| 314 |
assertEquals("Third leg bearing with no calibration set.", leg3Compass, series.getLegCorrected(2).getCompass(BearingUnit.Degrees), 1e-9 ); |
| 315 |
|
| 316 |
|
| 317 |
assertEquals("First leg clino with no calibration set.", leg1Clino, series.getLegCorrected(0).getClino(GradientUnit.Degrees), 1e-9 ); |
| 318 |
assertEquals("Second leg clino with no calibration set.", leg2Clino, series.getLegCorrected(1).getClino(GradientUnit.Degrees), 1e-9 ); |
| 319 |
assertEquals("Third leg clino with no calibration set.", leg3Clino, series.getLegCorrected(2).getClino(GradientUnit.Degrees), 1e-9 ); |
| 320 |
|
| 321 |
|
| 322 |
double tapeCal = 0.1; |
| 323 |
series.setTapeCalibration( tapeCal, LengthUnit.Metres ); |
| 324 |
|
| 325 |
leg1Length -= tapeCal; |
| 326 |
leg2Length -= tapeCal; |
| 327 |
leg3Length -= tapeCal; |
| 328 |
|
| 329 |
|
| 330 |
assertEquals("First leg length with tape calibration set.", leg1Length, series.getLegCorrected(0).getLength( LengthUnit.Metres ), 1e-9 ); |
| 331 |
assertEquals("Second leg length with tape calibration set.", leg2Length, series.getLegCorrected(1).getLength( LengthUnit.Metres ), 1e-9 ); |
| 332 |
assertEquals("Third leg length with tape calibration set.", leg3Length, series.getLegCorrected(2).getLength( LengthUnit.Metres ), 1e-9 ); |
| 333 |
|
| 334 |
|
| 335 |
assertEquals("First leg bearing with tape calibration set.", leg1Compass, series.getLegCorrected(0).getCompass(BearingUnit.Degrees), 1e-9 ); |
| 336 |
assertEquals("Second leg bearing with tape calibration set.", leg2Compass, series.getLegCorrected(1).getCompass(BearingUnit.Degrees), 1e-9 ); |
| 337 |
assertEquals("Third leg bearing with tape calibration set.", leg3Compass, series.getLegCorrected(2).getCompass(BearingUnit.Degrees), 1e-9 ); |
| 338 |
|
| 339 |
|
| 340 |
assertEquals("First leg clino with tape calibration set.", leg1Clino, series.getLegCorrected(0).getClino(GradientUnit.Degrees), 1e-9 ); |
| 341 |
assertEquals("Second leg clino with tape calibration set.", leg2Clino, series.getLegCorrected(1).getClino(GradientUnit.Degrees), 1e-9 ); |
| 342 |
assertEquals("Third leg clino with tape calibration set.", leg3Clino, series.getLegCorrected(2).getClino(GradientUnit.Degrees), 1e-9 ); |
| 343 |
|
| 344 |
|
| 345 |
double compassCal = 0.5; |
| 346 |
series.setCompassCalibration(compassCal, BearingUnit.Degrees); |
| 347 |
|
| 348 |
leg1Compass -= compassCal; |
| 349 |
leg2Compass -= compassCal; |
| 350 |
leg3Compass -= compassCal; |
| 351 |
|
| 352 |
|
| 353 |
assertEquals("First leg length with tape and compass calibration set.", leg1Length, series.getLegCorrected(0).getLength( LengthUnit.Metres ), 1e-9 ); |
| 354 |
assertEquals("Second leg length with tape and compass calibration set.", leg2Length, series.getLegCorrected(1).getLength( LengthUnit.Metres ), 1e-9 ); |
| 355 |
assertEquals("Third leg length with tape and compass calibration set.", leg3Length, series.getLegCorrected(2).getLength( LengthUnit.Metres ), 1e-9 ); |
| 356 |
|
| 357 |
|
| 358 |
assertEquals("First leg bearing with tape and compass calibration set.", leg1Compass, series.getLegCorrected(0).getCompass(BearingUnit.Degrees), 1e-9 ); |
| 359 |
assertEquals("Second leg bearing with tape and compass calibration set.", leg2Compass, series.getLegCorrected(1).getCompass(BearingUnit.Degrees), 1e-9 ); |
| 360 |
assertEquals("Third leg bearing with tape and compass calibration set.", leg3Compass, series.getLegCorrected(2).getCompass(BearingUnit.Degrees), 1e-9 ); |
| 361 |
|
| 362 |
|
| 363 |
assertEquals("First leg clino with tape and compass calibration set.", leg1Clino, series.getLegCorrected(0).getClino(GradientUnit.Degrees), 1e-9 ); |
| 364 |
assertEquals("Second leg clino with tape and compass calibration set.", leg2Clino, series.getLegCorrected(1).getClino(GradientUnit.Degrees), 1e-9 ); |
| 365 |
assertEquals("Third leg clino with tape and compass calibration set.", leg3Clino, series.getLegCorrected(2).getClino(GradientUnit.Degrees), 1e-9 ); |
| 366 |
|
| 367 |
|
| 368 |
double clinoCal = -1.2; |
| 369 |
series.setClinoCalibration(clinoCal, GradientUnit.Degrees); |
| 370 |
|
| 371 |
leg1Clino -= clinoCal; |
| 372 |
leg2Clino -= clinoCal; |
| 373 |
leg3Clino -= clinoCal; |
| 374 |
|
| 375 |
|
| 376 |
assertEquals("First leg length with tape, compass and clino calibration set.", leg1Length, series.getLegCorrected(0).getLength( LengthUnit.Metres ), 1e-9 ); |
| 377 |
assertEquals("Second leg length with tape, compass and clino calibration set.", leg2Length, series.getLegCorrected(1).getLength( LengthUnit.Metres ), 1e-9 ); |
| 378 |
assertEquals("Third leg length with tape, compass and clino calibration set.", leg3Length, series.getLegCorrected(2).getLength( LengthUnit.Metres ), 1e-9 ); |
| 379 |
|
| 380 |
|
| 381 |
assertEquals("First leg bearing with tape, compass and clino calibration set.", leg1Compass, series.getLegCorrected(0).getCompass(BearingUnit.Degrees), 1e-9 ); |
| 382 |
assertEquals("Second leg bearing with tape, compass and clino calibration set.", leg2Compass, series.getLegCorrected(1).getCompass(BearingUnit.Degrees), 1e-9 ); |
| 383 |
assertEquals("Third leg bearing with tape, compass and clino calibration set.", leg3Compass, series.getLegCorrected(2).getCompass(BearingUnit.Degrees), 1e-9 ); |
| 384 |
|
| 385 |
|
| 386 |
assertEquals("First leg clino with tape, compass and clino calibration set.", leg1Clino, series.getLegCorrected(0).getClino(GradientUnit.Degrees), 1e-9 ); |
| 387 |
assertEquals("Second leg clino with tape, compass and clino calibration set.", leg2Clino, series.getLegCorrected(1).getClino(GradientUnit.Degrees), 1e-9 ); |
| 388 |
assertEquals("Third leg clino with tape, compass and clino calibration set.", leg3Clino, series.getLegCorrected(2).getClino(GradientUnit.Degrees), 1e-9 ); |
| 389 |
|
| 390 |
|
| 391 |
double declination = 2.36; |
| 392 |
series.setDeclination(declination); |
| 393 |
|
| 394 |
leg1Compass -= declination; |
| 395 |
leg2Compass -= declination; |
| 396 |
leg3Compass -= declination; |
| 397 |
|
| 398 |
|
| 399 |
assertEquals("First leg length with all calibrations set plus declination.", leg1Length, series.getLegCorrected(0).getLength( LengthUnit.Metres ), 1e-9 ); |
| 400 |
assertEquals("Second leg length with all calibrations set plus declination.", leg2Length, series.getLegCorrected(1).getLength( LengthUnit.Metres ), 1e-9 ); |
| 401 |
assertEquals("Third leg length with all calibrations set plus declination.", leg3Length, series.getLegCorrected(2).getLength( LengthUnit.Metres ), 1e-9 ); |
| 402 |
|
| 403 |
|
| 404 |
assertEquals("First leg bearing with all calibrations set plus declination.", leg1Compass, series.getLegCorrected(0).getCompass(BearingUnit.Degrees), 1e-9 ); |
| 405 |
assertEquals("Second leg bearing with all calibrations set plus declination.", leg2Compass, series.getLegCorrected(1).getCompass(BearingUnit.Degrees), 1e-9 ); |
| 406 |
assertEquals("Third leg bearing with all calibrations set plus declination.", leg3Compass, series.getLegCorrected(2).getCompass(BearingUnit.Degrees), 1e-9 ); |
| 407 |
|
| 408 |
|
| 409 |
assertEquals("First leg clino with all calibrations set plus declination.", leg1Clino, series.getLegCorrected(0).getClino(GradientUnit.Degrees), 1e-9 ); |
| 410 |
assertEquals("Second leg clino with all calibrations set plus declination.", leg2Clino, series.getLegCorrected(1).getClino(GradientUnit.Degrees), 1e-9 ); |
| 411 |
assertEquals("Third leg clino with all calibrations set plus declination.", leg3Clino, series.getLegCorrected(2).getClino(GradientUnit.Degrees), 1e-9 ); |
| 412 |
} |
| 413 |
|
| 414 |
|
| 415 |
|
| 416 |
|
| 417 |
|
| 418 |
|
| 419 |
|
| 420 |
|
| 421 |
|
| 422 |
|
| 423 |
|
| 424 |
@Test |
| 425 |
public void testClinoCalibrationsForTopofil() { |
| 426 |
SurveySeries series = new SurveySeries( "Test" ); |
| 427 |
|
| 428 |
|
| 429 |
series.setClinoCalibration(90.0, GradientUnit.Degrees, -1); |
| 430 |
|
| 431 |
|
| 432 |
double clinoReading = 0.0; |
| 433 |
double clinoCorrected = 90.0; |
| 434 |
|
| 435 |
series.addLeg( TestHelper.createTestLeg(1,2,1.1,158.0,clinoReading) ); |
| 436 |
assertEquals("Clino corrected for topofil data.", clinoCorrected, series.getLegCorrected(0).getClino(GradientUnit.Degrees), 1e-9 ); |
| 437 |
|
| 438 |
|
| 439 |
clinoReading = 90.0; |
| 440 |
clinoCorrected = 0.0; |
| 441 |
|
| 442 |
series.addLeg( TestHelper.createTestLeg(2,3,2.2,274.0,clinoReading) ); |
| 443 |
assertEquals("Clino corrected for topofil data.", clinoCorrected, series.getLegCorrected(1).getClino(GradientUnit.Degrees), 1e-9 ); |
| 444 |
|
| 445 |
|
| 446 |
clinoReading = 180.0; |
| 447 |
clinoCorrected = -90.0; |
| 448 |
|
| 449 |
series.addLeg( TestHelper.createTestLeg(3,4,3.3,64.0,clinoReading) ); |
| 450 |
assertEquals("Clino corrected for topofil data.", clinoCorrected, series.getLegCorrected(2).getClino(GradientUnit.Degrees), 1e-9 ); |
| 451 |
} |
| 452 |
|
| 453 |
|
| 454 |
|
| 455 |
|
| 456 |
|
| 457 |
|
| 458 |
|
| 459 |
|
| 460 |
|
| 461 |
|
| 462 |
|
| 463 |
|
| 464 |
|
| 465 |
|
| 466 |
|
| 467 |
|
| 468 |
|
| 469 |
|
| 470 |
|
| 471 |
|
| 472 |
|
| 473 |
|
| 474 |
|
| 475 |
|
| 476 |
|
| 477 |
|
| 478 |
|
| 479 |
|
| 480 |
|
| 481 |
|
| 482 |
|
| 483 |
|
| 484 |
|
| 485 |
|
| 486 |
|
| 487 |
|
| 488 |
|
| 489 |
|
| 490 |
|
| 491 |
|
| 492 |
|
| 493 |
|
| 494 |
|
| 495 |
|
| 496 |
|
| 497 |
|
| 498 |
|
| 499 |
|
| 500 |
} |