diff --git a/dynadjust/CMakeLists.txt b/dynadjust/CMakeLists.txt index 44be6e08..25603d70 100644 --- a/dynadjust/CMakeLists.txt +++ b/dynadjust/CMakeLists.txt @@ -94,7 +94,7 @@ endif () message (" ") message (STATUS "Looking for intel math kernel library (mkl)...") -find_package(MKL CONFIG REQUIRED) +find_package(MKL CONFIG REQUIRED PATHS $ENV{MKLROOT}) if (CMAKE_SYSTEM_NAME MATCHES "Darwin") find_library(IOMP5_LIB iomp5 PATHS /opt/intel/lib) @@ -154,21 +154,23 @@ if (DNA_BUILD_ERROR) message (" ") message (STATUS "**********************************************") message (STATUS "Cannot build DynaAjust ${DYNADJUST_VERSION}. Missing components:") -if (XERCES_FIND_ERROR) - message (STATUS " xerces-c") -endif () -if (XSD_FIND_ERROR) - message (STATUS " xsd headers") -endif () -if (BOOST_FIND_ERROR) - message (STATUS " boost") -endif () -if (MKL_FIND_ERROR) - message (STATUS " mkl") -endif () -if (IOMP5_FIND_ERROR) - message (STATUS " iomp5") -endif () + + if (XERCES_FIND_ERROR) + message (STATUS " xerces-c") + endif () + if (XSD_FIND_ERROR) + message (STATUS " xsd headers") + endif () + if (BOOST_FIND_ERROR) + message (STATUS " boost") + endif () + if (MKL_FIND_ERROR) + message (STATUS " mkl") + endif () + if (IOMP5_FIND_ERROR) + message (STATUS " iomp5") + endif () + message (" ") message (FATAL_ERROR "Build terminating.") endif () @@ -197,10 +199,17 @@ add_subdirectory (dynadjust/dynadjust) if (BUILD_TESTING) message (" ") message (STATUS "Configuring tests") + + # Create symbolic links + add_custom_target(import_link_target COMMAND ${CMAKE_COMMAND} -E create_symlink $ dnaimport) + add_custom_target(geoid_link_target COMMAND ${CMAKE_COMMAND} -E create_symlink $ dnageoid) + add_custom_target(reftran_link_target COMMAND ${CMAKE_COMMAND} -E create_symlink $ dnareftran) + add_custom_target(segment_link_target COMMAND ${CMAKE_COMMAND} -E create_symlink $ dnasegment) + add_custom_target(adjust_link_target COMMAND ${CMAKE_COMMAND} -E create_symlink $ dnaadjust) # test execution of dynadjust binaries # 1. gnss network (simultaneous, phased-block 1, phased, staged) - add_test (NAME import-gnss-network COMMAND $ -n gnss ${CMAKE_SOURCE_DIR}/../sampleData/gnss-network.stn ${CMAKE_SOURCE_DIR}/../sampleData/gnss-network.msr --export-dna --export-xml --export-asl --export-aml --export-map --output-msr-to-stn --test-integrity -r GDA94) + add_test (NAME import-gnss-network COMMAND $ -n gnss ${CMAKE_SOURCE_DIR}/../sampleData/gnss-network.stn ${CMAKE_SOURCE_DIR}/../sampleData/gnss-network.msr --export-dna --export-xml --export-asl --export-aml --export-map --output-msr-to-stn --test-integrity -r GDA94 --flag-unused-stations) add_test (NAME geoid-gnss-network COMMAND $ gnss -g ${CMAKE_SOURCE_DIR}/../sampleData/gnss-network-geoid.gsb --convert-stn-hts --export-dna-geo) add_test (NAME reftran-gnss-network COMMAND $ gnss -r gda2020 --export-dna --export-xml) add_test (NAME adjust-gnss-network COMMAND $ gnss --output-adj-msr --export-dna-msr --export-xml-msr) @@ -212,7 +221,7 @@ if (BUILD_TESTING) add_test (NAME import-gnss-network-similar COMMAND $ -n gnss_similar ${CMAKE_SOURCE_DIR}/../sampleData/gnss-network.stn ${CMAKE_SOURCE_DIR}/../sampleData/gnss-network.msr -r itrf2008 --override-input-ref-frame --search-similar-gnss-msr --quiet) add_test (NAME import-gnss-network-exclude COMMAND $ -n gnss_excl ${CMAKE_SOURCE_DIR}/../sampleData/gnss-network.stn ${CMAKE_SOURCE_DIR}/../sampleData/gnss-network.msr --exclude-stns-assoc-msrs "BEEC,261000380,356000780,349800490" --split) add_test (NAME import-gnss-network-scaled COMMAND $ -n gnss_scaled ${CMAKE_SOURCE_DIR}/../sampleData/gnss-network.stn ${CMAKE_SOURCE_DIR}/../sampleData/gnss-network.msr --baseline-scalar-file ${CMAKE_SOURCE_DIR}/../sampleData/gnss-network.scalars -r GDA94) - add_test (NAME import-gnss-network-block1 COMMAND $ -n gnss_b1 ${CMAKE_SOURCE_DIR}/../sampleData/gnss-network.stn ${CMAKE_SOURCE_DIR}/../sampleData/gnss-network.msr --export-dna --export-xml --single-xml-file --export-asl --export-aml --export-map --output-msr-to-stn --test-integrity -r GDA94) + add_test (NAME import-gnss-network-block1 COMMAND $ -n gnss_b1 ${CMAKE_SOURCE_DIR}/../sampleData/gnss-network.stn ${CMAKE_SOURCE_DIR}/../sampleData/gnss-network.msr --export-dna --export-xml --single-xml-file --export-asl --export-aml --export-map --output-msr-to-stn --test-integrity -r GDA94 --flag-unused-stations) add_test (NAME segment-gnss-network-block1-a COMMAND $ gnss_b1 --min 90 --max 90 --starting-stns 220700210) add_test (NAME segment-gnss-network-block1-b COMMAND $ gnss_b1 --min 110 --max 110 --net-file) add_test (NAME segment-gnss-network-block1-c COMMAND $ gnss_b1 --min 80 --max 200 --net-file --starting-stns 211300940 --verbose 3) @@ -223,7 +232,7 @@ if (BUILD_TESTING) add_test (NAME adjust-gnss-network-staged-b COMMAND $ gnss_b1 --staged-adjustment --purge-stage-files --output-adj-msr --output-adj-gnss-units 3 --output-stn-blocks --output-msr-blocks --sort-adj-msr-field 5) # 2. urban network (phased-sequential) - add_test (NAME import-urban-network COMMAND $ -n urban ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.stn ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.msr) + add_test (NAME import-urban-network COMMAND $ -n urban ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.stn ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.msr --flag-unused-stations) add_test (NAME geoid-urban-network COMMAND $ urban -g ${CMAKE_SOURCE_DIR}/../sampleData/urban-network-geoid.gsb --convert-stn-hts --export-dna-geo) add_test (NAME segment-urban-network COMMAND $ urban --min 50 --max 150 --test-integrity) add_test (NAME adjust-urban-network-verbose COMMAND $ urban --verbose 3) @@ -243,17 +252,62 @@ if (BUILD_TESTING) add_test (NAME adjust-urban-network-thread-02 COMMAND $ urban_mt --output-adj-msr --multi --verb 5) # 4. urban network (phased-staged) - add_test (NAME import-urban-network-stage COMMAND $ -n urban_st ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.stn ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.msr) + add_test (NAME import-urban-network-stage COMMAND $ -n urban_st ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.stn ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.msr --flag-unused-stations) add_test (NAME geoid-urban-network-stage COMMAND $ urban_st -g ${CMAKE_SOURCE_DIR}/../sampleData/urban-network-geoid.gsb --convert-stn-hts --export-dna-geo) add_test (NAME segment-urban-network-stage COMMAND $ urban_st --min 90 --max 90) add_test (NAME adjust-urban-network-stage COMMAND $ urban_st --phased --staged-adjustment --create-stage-files --output-adj-msr --export-sinex-file --output-pos-uncertainty --export-xml-stn-file --export-xml-msr-file --export-dna-stn-file --export-dna-msr --output-iter-adj-stn --output-iter-adj-stat --output-iter-adj-msr --output-iter-cmp-msr --stn-corrections --output-corrections-file) + + # test all frame labels + add_test (NAME imp-frame-misc-01 COMMAND $ -n impframe-01 ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.stn ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.msr -r itrf1988 -e 03.12.1988) + add_test (NAME ref-frame-misc-01 COMMAND $ impframe-01 --verb 6 --plate-model-option 1 -b ${CMAKE_SOURCE_DIR}/../sampleData/PB2002_plates.dig -m ${CMAKE_SOURCE_DIR}/../sampleData/PB2002_poles.dat) + add_test (NAME imp-frame-misc-02 COMMAND $ -n impframe-02 ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.stn ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.msr -r itrf1988 -e 03.12.1988) + add_test (NAME ref-frame-misc-02 COMMAND $ impframe-02 --verb 6 --plate-model-option 1 -b ${CMAKE_SOURCE_DIR}/../sampleData/PB2002_plates.dig -m ${CMAKE_SOURCE_DIR}/../sampleData/PB2002_poles.dat) + add_test (NAME imp-frame-misc-03 COMMAND $ -n impframe-03 ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.stn ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.msr -r itrf1989 -e 01.09.1989) + add_test (NAME ref-frame-misc-03 COMMAND $ impframe-03 --verb 6 --plate-model-option 1 -b ${CMAKE_SOURCE_DIR}/../sampleData/PB2002_plates.dig -m ${CMAKE_SOURCE_DIR}/../sampleData/PB2002_poles.dat) + add_test (NAME imp-frame-misc-04 COMMAND $ -n impframe-04 ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.stn ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.msr -r itrf1990 -e 01.10.1990) + add_test (NAME ref-frame-misc-04 COMMAND $ impframe-04 --verb 6 --plate-model-option 1 -b ${CMAKE_SOURCE_DIR}/../sampleData/PB2002_plates.dig -m ${CMAKE_SOURCE_DIR}/../sampleData/PB2002_poles.dat) + add_test (NAME imp-frame-misc-05 COMMAND $ -n impframe-05 ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.stn ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.msr -r itrf1991 -e 01.01.1991) + add_test (NAME ref-frame-misc-05 COMMAND $ impframe-05 --verb 6 --plate-model-option 1 -b ${CMAKE_SOURCE_DIR}/../sampleData/PB2002_plates.dig -m ${CMAKE_SOURCE_DIR}/../sampleData/PB2002_poles.dat) + add_test (NAME imp-frame-misc-06 COMMAND $ -n impframe-06 ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.stn ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.msr -r itrf1992 -e 01.02.1992) + add_test (NAME ref-frame-misc-06 COMMAND $ impframe-06 --verb 6 --plate-model-option 1 -b ${CMAKE_SOURCE_DIR}/../sampleData/PB2002_plates.dig -m ${CMAKE_SOURCE_DIR}/../sampleData/PB2002_poles.dat) + add_test (NAME imp-frame-misc-07 COMMAND $ -n impframe-07 ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.stn ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.msr -r itrf1993 -e 01.03.1993) + add_test (NAME ref-frame-misc-07 COMMAND $ impframe-07 --verb 6 --plate-model-option 1 -b ${CMAKE_SOURCE_DIR}/../sampleData/PB2002_plates.dig -m ${CMAKE_SOURCE_DIR}/../sampleData/PB2002_poles.dat) + add_test (NAME imp-frame-misc-08 COMMAND $ -n impframe-08 ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.stn ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.msr -r itrf1994 -e 01.04.1994) + add_test (NAME ref-frame-misc-08 COMMAND $ impframe-08 --verb 6 --plate-model-option 1 -b ${CMAKE_SOURCE_DIR}/../sampleData/PB2002_plates.dig -m ${CMAKE_SOURCE_DIR}/../sampleData/PB2002_poles.dat) + add_test (NAME imp-frame-misc-09 COMMAND $ -n impframe-09 ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.stn ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.msr -r itrf1996 -e 01.06.1996) + add_test (NAME ref-frame-misc-09 COMMAND $ impframe-09 --verb 6 --plate-model-option 1 -b ${CMAKE_SOURCE_DIR}/../sampleData/PB2002_plates.dig -m ${CMAKE_SOURCE_DIR}/../sampleData/PB2002_poles.dat) + add_test (NAME imp-frame-misc-10 COMMAND $ -n impframe-10 ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.stn ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.msr -r itrf1997 -e 01.07.1997) + add_test (NAME ref-frame-misc-10 COMMAND $ impframe-10 --verb 6 --plate-model-option 1 -b ${CMAKE_SOURCE_DIR}/../sampleData/PB2002_plates.dig -m ${CMAKE_SOURCE_DIR}/../sampleData/PB2002_poles.dat) + add_test (NAME imp-frame-misc-11 COMMAND $ -n impframe-11 ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.stn ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.msr -r itrf2000 -e 22.2.2000) + add_test (NAME ref-frame-misc-11 COMMAND $ impframe-11 --verb 6 --plate-model-option 1 -b ${CMAKE_SOURCE_DIR}/../sampleData/PB2002_plates.dig -m ${CMAKE_SOURCE_DIR}/../sampleData/PB2002_poles.dat) + add_test (NAME imp-frame-misc-12 COMMAND $ -n impframe-12 ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.stn ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.msr -r itrf2005 -e 5.5.2005) + add_test (NAME ref-frame-misc-12 COMMAND $ impframe-12 --verb 6 --plate-model-option 1 -b ${CMAKE_SOURCE_DIR}/../sampleData/PB2002_plates.dig -m ${CMAKE_SOURCE_DIR}/../sampleData/PB2002_poles.dat) + add_test (NAME imp-frame-misc-13 COMMAND $ -n impframe-13 ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.stn ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.msr -r itrf2008 -e 8.8.2008) + add_test (NAME ref-frame-misc-13 COMMAND $ impframe-13 --verb 6 --plate-model-option 1 -b ${CMAKE_SOURCE_DIR}/../sampleData/PB2002_plates.dig -m ${CMAKE_SOURCE_DIR}/../sampleData/PB2002_poles.dat) + add_test (NAME imp-frame-misc-14 COMMAND $ -n impframe-14 ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.stn ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.msr -r itrf2014 -e 2020) + add_test (NAME ref-frame-misc-14 COMMAND $ impframe-14 --verb 6 --plate-model-option 1 -b ${CMAKE_SOURCE_DIR}/../sampleData/PB2002_plates.dig -m ${CMAKE_SOURCE_DIR}/../sampleData/PB2002_poles.dat) + add_test (NAME imp-frame-misc-15 COMMAND $ -n impframe-15 ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.stn ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.msr -r itrf2020 -e today) + add_test (NAME ref-frame-misc-15 COMMAND $ impframe-15 --verb 6 --plate-model-option 1 -b ${CMAKE_SOURCE_DIR}/../sampleData/PB2002_plates.dig -m ${CMAKE_SOURCE_DIR}/../sampleData/PB2002_poles.dat) + add_test (NAME imp-frame-misc-16 COMMAND $ -n impframe-16 ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.stn ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.msr -r gda94) + add_test (NAME ref-frame-misc-16 COMMAND $ impframe-16 --verb 6 --plate-model-option 1 -b ${CMAKE_SOURCE_DIR}/../sampleData/PB2002_plates.dig -m ${CMAKE_SOURCE_DIR}/../sampleData/PB2002_poles.dat) + add_test (NAME imp-frame-misc-17 COMMAND $ -n impframe-17 ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.stn ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.msr -r gda2020) + add_test (NAME ref-frame-misc-17 COMMAND $ impframe-17 --verb 6 --plate-model-option 1 -b ${CMAKE_SOURCE_DIR}/../sampleData/PB2002_plates.dig -m ${CMAKE_SOURCE_DIR}/../sampleData/PB2002_poles.dat) + add_test (NAME imp-frame-misc-18 COMMAND $ -n impframe ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.stn ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.msr -r wgs84) + add_test (NAME imp-frame-misc-19 COMMAND $ -n impframe ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.stn ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.msr -r "wgs 84") + add_test (NAME imp-frame-misc-20 COMMAND $ -n impframe ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.stn ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.msr -r "wgs84 (ensemble)") + add_test (NAME imp-frame-misc-21 COMMAND $ -n impframe ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.stn ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.msr -r "wgs84 (G730)") + add_test (NAME imp-frame-misc-22 COMMAND $ -n impframe ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.stn ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.msr -r "wgs84 (G873)") + add_test (NAME imp-frame-misc-23 COMMAND $ -n impframe ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.stn ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.msr -r "wgs84 (G1150)") + add_test (NAME imp-frame-misc-24 COMMAND $ -n impframe ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.stn ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.msr -r "wgs84 (G1674)") + add_test (NAME imp-frame-misc-25 COMMAND $ -n impframe ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.stn ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.msr -r "wgs84 (G1762)") + add_test (NAME imp-frame-misc-26 COMMAND $ -n impframe ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.stn ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.msr -r "wgs84 (G2139)") + add_test (NAME imp-frame-misc-27 COMMAND $ -n impframe ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.stn ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.msr -r "wgs84 (transit)") # 5. dynadjust project mode file (COPY ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.stn DESTINATION ./) file (COPY ${CMAKE_SOURCE_DIR}/../sampleData/urban-network.msr DESTINATION ./) file (COPY ${CMAKE_SOURCE_DIR}/../sampleData/sample.dnaproj DESTINATION ./) - #add_test (NAME dynadjust-proj-01 COMMAND $ -p ${CMAKE_SOURCE_DIR}/../sampleData/sample.dnaproj --import --geoid --reftran --segment --adjust) - #add_test (NAME dynadjust-proj-02 COMMAND $ -p ${CMAKE_SOURCE_DIR}/../sampleData/sample.dnaproj --import --geoid --reftran --segment --adjust --quiet) + file (COPY ${CMAKE_SOURCE_DIR}/../sampleData/urban-network-geoid.gsb DESTINATION ./) add_test (NAME dynadjust-name-01 COMMAND $ -n sample --import --geoid --reftran --segment --adjust) # 6. urban data manipulation @@ -264,16 +318,16 @@ if (BUILD_TESTING) add_test (NAME imp-urb03-xml-data COMMAND $ -n urban_xml ./urban_dnastn.xml ./urban_dnamsr.xml --search-similar-msr --ignore-similar-msr --flag-unused-stations) add_test (NAME imp-urb04-xml-data COMMAND $ -n urban_xml ./urban_dnastn.xml ./urban_dnamsr.xml --v-scale 2.5 --p-scale 5.0 --l-scale 5.0 --h-scale 10.0) add_test (NAME imp-urb05-xml-data COMMAND $ -n urban_xml ./urban_dnastn.xml ./urban_dnamsr.xml --include-stns-assoc-msrs "4000,1,1004,1042,1046,2,2215,4000,5,9004,1002,1003,1034,1039,1050,13,2101,2102,2105,2106,2109,2118,2119,2122,2123,2124,2125,2206,2214") - add_test (NAME imp-urb06-xml-data COMMAND $ -n urban_xml ./urban_dnastn.xml ./urban_dnamsr.xml --export-dna --export-asl --export-aml --export-map --output-msr-to-stn) + add_test (NAME imp-urb06-xml-data COMMAND $ -n urban_xml ./urban_dnastn.xml ./urban_dnamsr.xml --export-dna --export-asl --export-aml --export-map --output-msr-to-stn --flag-unused-stations) add_test (NAME seg-urb00-xml-data COMMAND $ urban_xml --min 50 --max 50) - add_test (NAME imp-urb07-xml-data COMMAND $ -n urban_xml ./urban_dnastn.xml ./urban_dnamsr.xml --import-block-stn-msr 2) + add_test (NAME imp-urb07-xml-data COMMAND $ -n urban_xml --import-block-stn-msr 2) add_test (NAME imp-urb08-xml-data COMMAND $ -n urban_xml ./urban_dnastn.xml ./urban_dnamsr.xml --geo-file urban.geo) add_test (NAME plt-urb01-xml-data COMMAND $ urban_xml --centre-station 1004 --area-radius 5000 --plot-msr-types gxyasvz --msr-line-width 0.5) add_test (NAME plt-urb02-xml-data COMMAND $ urban_xml --centre-latitude -37.480489013 --centre-longitude 144.573579814 --area-radius 3000 --omit-measurements) - add_test (NAME imp-psu01-dna-data COMMAND $ -n pseudo ${CMAKE_SOURCE_DIR}/../sampleData/pseudo.stn) + add_test (NAME imp-psu01-dna-data COMMAND $ -n pseudo ${CMAKE_SOURCE_DIR}/../sampleData/pseudo.stn --flag-unused-stations) add_test (NAME geo-psu00-dna-data COMMAND $ pseudo -g ${CMAKE_SOURCE_DIR}/../sampleData/gnss-network-geoid.gsb --export-dna-geo-file) add_test (NAME imp-psu02-dna-data COMMAND $ -n pseudo ${CMAKE_SOURCE_DIR}/../sampleData/pseudo.stn ${CMAKE_SOURCE_DIR}/../sampleData/pseudo-driver-file.msr --simulate --geo-file pseudo.geo --export-xml) - add_test (NAME imp-psu03-xml-data COMMAND $ -n pseudo pseudostn.xml pseudomsr.xml) + add_test (NAME imp-psu03-xml-data COMMAND $ -n pseudo pseudostn.xml pseudomsr.xml --export-asl --export-aml --export-map) add_test (NAME geo-psu01-xml-data COMMAND $ pseudo -g ${CMAKE_SOURCE_DIR}/../sampleData/gnss-network-geoid.gsb --convert --interpolation-method 0) add_test (NAME adj-psu00-xml-data COMMAND $ pseudo --output-adj-msr --free-stn-sd 5.0 --fixed-stn-sd 0.000005 --max-iterations 15 --output-tstat-adj-msr --sort-adj-msr-field 7 --sort-stn-orig-order --stn-coord-types XYZPLHhENz --angular-stn-type 1 --angular-msr-type 1 --precision-stn-linear 3 --precision-msr-linear 3 --precision-stn-angular 4 --precision-msr-angular 4 --output-pos-uncertainty --output-all-covariances --output-corrections-file) add_test (NAME imp-gnss0-xml-data COMMAND $ -n gnss_xml ./gnssstn.xml ./gnssmsr.xml --bounding-box "-36.3000,145.4500,-36.4500,146.4500" --get-msrs-transcending-box --split-gnss-cluster-msrs --prefer-single-x-as-g) @@ -311,7 +365,7 @@ if (BUILD_TESTING) add_test (NAME ref-gnss03-network COMMAND $ gnss -r itrf1989) add_test (NAME ref-gnss04-network COMMAND $ gnss -r itrf1990) add_test (NAME ref-gnss05-network COMMAND $ gnss -r itrf1991) - add_test (NAME ref-gnss06-network COMMAND $ gnss -r itrf2005 -e 05.05.2005 --export-xml --single-xml-file --verb 3) + add_test (NAME ref-gnss06-network COMMAND $ gnss -r itrf2005 -e 5.5.2005 --export-xml --single-xml-file --verb 3) add_test (NAME ref-gnss07-network COMMAND $ gnss -r itrf1992 --verb 3) add_test (NAME ref-gnss08-network COMMAND $ gnss -r gda94 --export-xml --single-xml-file --verb 3) add_test (NAME ref-gnss09-network COMMAND $ gnss -r itrf1988) @@ -320,19 +374,454 @@ if (BUILD_TESTING) add_test (NAME ref-gnss12-network COMMAND $ gnss -r itrf1996) add_test (NAME ref-gnss13-network COMMAND $ gnss -r itrf1997) add_test (NAME ref-gnss14-network COMMAND $ gnss -r itrf2020) + + # gda2020 + add_test (NAME gda2020-param-01 COMMAND $ gnss -r gda2020) + add_test (NAME gda2020-param-02 COMMAND $ gnss -r gda94) + add_test (NAME gda2020-param-03 COMMAND $ gnss -r gda2020) + add_test (NAME gda2020-param-04 COMMAND $ gnss -r itrf1988) + add_test (NAME gda2020-param-05 COMMAND $ gnss -r gda2020) + add_test (NAME gda2020-param-06 COMMAND $ gnss -r itrf1989) + add_test (NAME gda2020-param-07 COMMAND $ gnss -r gda2020) + add_test (NAME gda2020-param-08 COMMAND $ gnss -r itrf1990) + add_test (NAME gda2020-param-09 COMMAND $ gnss -r gda2020) + add_test (NAME gda2020-param-10 COMMAND $ gnss -r itrf1991) + add_test (NAME gda2020-param-11 COMMAND $ gnss -r gda2020) + add_test (NAME gda2020-param-12 COMMAND $ gnss -r itrf1992) + add_test (NAME gda2020-param-13 COMMAND $ gnss -r gda2020) + add_test (NAME gda2020-param-14 COMMAND $ gnss -r itrf1993) + add_test (NAME gda2020-param-15 COMMAND $ gnss -r gda2020) + add_test (NAME gda2020-param-16 COMMAND $ gnss -r itrf1994) + add_test (NAME gda2020-param-17 COMMAND $ gnss -r gda2020) + add_test (NAME gda2020-param-18 COMMAND $ gnss -r itrf1996) + add_test (NAME gda2020-param-19 COMMAND $ gnss -r gda2020) + add_test (NAME gda2020-param-20 COMMAND $ gnss -r itrf1997) + add_test (NAME gda2020-param-21 COMMAND $ gnss -r gda2020) + add_test (NAME gda2020-param-22 COMMAND $ gnss -r itrf2000) + add_test (NAME gda2020-param-23 COMMAND $ gnss -r gda2020) + add_test (NAME gda2020-param-24 COMMAND $ gnss -r itrf2005) + add_test (NAME gda2020-param-25 COMMAND $ gnss -r gda2020) + add_test (NAME gda2020-param-26 COMMAND $ gnss -r itrf2008) + add_test (NAME gda2020-param-27 COMMAND $ gnss -r gda2020) + add_test (NAME gda2020-param-28 COMMAND $ gnss -r itrf2020) + # gda94 + add_test (NAME gda94-param-01 COMMAND $ gnss -r gda94) + add_test (NAME gda94-param-02 COMMAND $ gnss -r gda2020) + add_test (NAME gda94-param-03 COMMAND $ gnss -r gda94) + add_test (NAME gda94-param-04 COMMAND $ gnss -r itrf1988) + add_test (NAME gda94-param-05 COMMAND $ gnss -r gda94) + add_test (NAME gda94-param-06 COMMAND $ gnss -r itrf1989) + add_test (NAME gda94-param-07 COMMAND $ gnss -r gda94) + add_test (NAME gda94-param-08 COMMAND $ gnss -r itrf1990) + add_test (NAME gda94-param-09 COMMAND $ gnss -r gda94) + add_test (NAME gda94-param-10 COMMAND $ gnss -r itrf1991) + add_test (NAME gda94-param-11 COMMAND $ gnss -r gda94) + add_test (NAME gda94-param-12 COMMAND $ gnss -r itrf1992) + add_test (NAME gda94-param-13 COMMAND $ gnss -r gda94) + add_test (NAME gda94-param-14 COMMAND $ gnss -r itrf1993) + add_test (NAME gda94-param-15 COMMAND $ gnss -r gda94) + add_test (NAME gda94-param-16 COMMAND $ gnss -r itrf1994) + add_test (NAME gda94-param-17 COMMAND $ gnss -r gda94) + add_test (NAME gda94-param-18 COMMAND $ gnss -r itrf1996) + add_test (NAME gda94-param-19 COMMAND $ gnss -r gda94) + add_test (NAME gda94-param-20 COMMAND $ gnss -r itrf1997) + add_test (NAME gda94-param-21 COMMAND $ gnss -r gda94) + add_test (NAME gda94-param-22 COMMAND $ gnss -r itrf2000) + add_test (NAME gda94-param-23 COMMAND $ gnss -r gda94) + add_test (NAME gda94-param-24 COMMAND $ gnss -r itrf2005) + add_test (NAME gda94-param-25 COMMAND $ gnss -r gda94) + add_test (NAME gda94-param-26 COMMAND $ gnss -r itrf2008) + add_test (NAME gda94-param-27 COMMAND $ gnss -r gda94) + add_test (NAME gda94-param-28 COMMAND $ gnss -r itrf2020) + # itrf1988 + add_test (NAME itrf1988-param-01 COMMAND $ gnss -r itrf1988) + add_test (NAME itrf1988-param-02 COMMAND $ gnss -r gda94) + add_test (NAME itrf1988-param-03 COMMAND $ gnss -r itrf1988) + add_test (NAME itrf1988-param-04 COMMAND $ gnss -r gda2020) + add_test (NAME itrf1988-param-05 COMMAND $ gnss -r itrf1988) + add_test (NAME itrf1988-param-06 COMMAND $ gnss -r itrf1989) + add_test (NAME itrf1988-param-07 COMMAND $ gnss -r itrf1988) + add_test (NAME itrf1988-param-08 COMMAND $ gnss -r itrf1990) + add_test (NAME itrf1988-param-09 COMMAND $ gnss -r itrf1988) + add_test (NAME itrf1988-param-10 COMMAND $ gnss -r itrf1991) + add_test (NAME itrf1988-param-11 COMMAND $ gnss -r itrf1988) + add_test (NAME itrf1988-param-12 COMMAND $ gnss -r itrf1992) + add_test (NAME itrf1988-param-13 COMMAND $ gnss -r itrf1988) + add_test (NAME itrf1988-param-14 COMMAND $ gnss -r itrf1993) + add_test (NAME itrf1988-param-15 COMMAND $ gnss -r itrf1988) + add_test (NAME itrf1988-param-16 COMMAND $ gnss -r itrf1994) + add_test (NAME itrf1988-param-17 COMMAND $ gnss -r itrf1988) + add_test (NAME itrf1988-param-18 COMMAND $ gnss -r itrf1996) + add_test (NAME itrf1988-param-19 COMMAND $ gnss -r itrf1988) + add_test (NAME itrf1988-param-20 COMMAND $ gnss -r itrf1997) + add_test (NAME itrf1988-param-21 COMMAND $ gnss -r itrf1988) + add_test (NAME itrf1988-param-22 COMMAND $ gnss -r itrf2000) + add_test (NAME itrf1988-param-23 COMMAND $ gnss -r itrf1988) + add_test (NAME itrf1988-param-24 COMMAND $ gnss -r itrf2005) + add_test (NAME itrf1988-param-25 COMMAND $ gnss -r itrf1988) + add_test (NAME itrf1988-param-26 COMMAND $ gnss -r itrf2008) + add_test (NAME itrf1988-param-27 COMMAND $ gnss -r itrf1988) + add_test (NAME itrf1988-param-28 COMMAND $ gnss -r itrf2020) + # itrf1989 + add_test (NAME itrf1989-param-01 COMMAND $ gnss -r itrf1989) + add_test (NAME itrf1989-param-02 COMMAND $ gnss -r gda94) + add_test (NAME itrf1989-param-03 COMMAND $ gnss -r itrf1989) + add_test (NAME itrf1989-param-04 COMMAND $ gnss -r gda2020) + add_test (NAME itrf1989-param-05 COMMAND $ gnss -r itrf1989) + add_test (NAME itrf1989-param-06 COMMAND $ gnss -r itrf1988) + add_test (NAME itrf1989-param-07 COMMAND $ gnss -r itrf1989) + add_test (NAME itrf1989-param-08 COMMAND $ gnss -r itrf1990) + add_test (NAME itrf1989-param-09 COMMAND $ gnss -r itrf1989) + add_test (NAME itrf1989-param-10 COMMAND $ gnss -r itrf1991) + add_test (NAME itrf1989-param-11 COMMAND $ gnss -r itrf1989) + add_test (NAME itrf1989-param-12 COMMAND $ gnss -r itrf1992) + add_test (NAME itrf1989-param-13 COMMAND $ gnss -r itrf1989) + add_test (NAME itrf1989-param-14 COMMAND $ gnss -r itrf1993) + add_test (NAME itrf1989-param-15 COMMAND $ gnss -r itrf1989) + add_test (NAME itrf1989-param-16 COMMAND $ gnss -r itrf1994) + add_test (NAME itrf1989-param-17 COMMAND $ gnss -r itrf1989) + add_test (NAME itrf1989-param-18 COMMAND $ gnss -r itrf1996) + add_test (NAME itrf1989-param-19 COMMAND $ gnss -r itrf1989) + add_test (NAME itrf1989-param-20 COMMAND $ gnss -r itrf1997) + add_test (NAME itrf1989-param-21 COMMAND $ gnss -r itrf1989) + add_test (NAME itrf1989-param-22 COMMAND $ gnss -r itrf2000) + add_test (NAME itrf1989-param-23 COMMAND $ gnss -r itrf1989) + add_test (NAME itrf1989-param-24 COMMAND $ gnss -r itrf2005) + add_test (NAME itrf1989-param-25 COMMAND $ gnss -r itrf1989) + add_test (NAME itrf1989-param-26 COMMAND $ gnss -r itrf2008) + add_test (NAME itrf1989-param-27 COMMAND $ gnss -r itrf1989) + add_test (NAME itrf1989-param-28 COMMAND $ gnss -r itrf2020) + # itrf1990 + add_test (NAME itrf1990-param-01 COMMAND $ gnss -r itrf1990) + add_test (NAME itrf1990-param-02 COMMAND $ gnss -r gda94) + add_test (NAME itrf1990-param-03 COMMAND $ gnss -r itrf1990) + add_test (NAME itrf1990-param-04 COMMAND $ gnss -r gda2020) + add_test (NAME itrf1990-param-05 COMMAND $ gnss -r itrf1990) + add_test (NAME itrf1990-param-06 COMMAND $ gnss -r itrf1988) + add_test (NAME itrf1990-param-07 COMMAND $ gnss -r itrf1990) + add_test (NAME itrf1990-param-08 COMMAND $ gnss -r itrf1989) + add_test (NAME itrf1990-param-09 COMMAND $ gnss -r itrf1990) + add_test (NAME itrf1990-param-10 COMMAND $ gnss -r itrf1991) + add_test (NAME itrf1990-param-11 COMMAND $ gnss -r itrf1990) + add_test (NAME itrf1990-param-12 COMMAND $ gnss -r itrf1992) + add_test (NAME itrf1990-param-13 COMMAND $ gnss -r itrf1990) + add_test (NAME itrf1990-param-14 COMMAND $ gnss -r itrf1993) + add_test (NAME itrf1990-param-15 COMMAND $ gnss -r itrf1990) + add_test (NAME itrf1990-param-16 COMMAND $ gnss -r itrf1994) + add_test (NAME itrf1990-param-17 COMMAND $ gnss -r itrf1990) + add_test (NAME itrf1990-param-18 COMMAND $ gnss -r itrf1996) + add_test (NAME itrf1990-param-19 COMMAND $ gnss -r itrf1990) + add_test (NAME itrf1990-param-20 COMMAND $ gnss -r itrf1997) + add_test (NAME itrf1990-param-21 COMMAND $ gnss -r itrf1990) + add_test (NAME itrf1990-param-22 COMMAND $ gnss -r itrf2000) + add_test (NAME itrf1990-param-23 COMMAND $ gnss -r itrf1990) + add_test (NAME itrf1990-param-24 COMMAND $ gnss -r itrf2005) + add_test (NAME itrf1990-param-25 COMMAND $ gnss -r itrf1990) + add_test (NAME itrf1990-param-26 COMMAND $ gnss -r itrf2008) + add_test (NAME itrf1990-param-27 COMMAND $ gnss -r itrf1990) + add_test (NAME itrf1990-param-28 COMMAND $ gnss -r itrf2020) + # itrf1991 + add_test (NAME itrf1991-param-01 COMMAND $ gnss -r itrf1991) + add_test (NAME itrf1991-param-02 COMMAND $ gnss -r gda94) + add_test (NAME itrf1991-param-03 COMMAND $ gnss -r itrf1991) + add_test (NAME itrf1991-param-04 COMMAND $ gnss -r gda2020) + add_test (NAME itrf1991-param-05 COMMAND $ gnss -r itrf1991) + add_test (NAME itrf1991-param-06 COMMAND $ gnss -r itrf1988) + add_test (NAME itrf1991-param-07 COMMAND $ gnss -r itrf1991) + add_test (NAME itrf1991-param-08 COMMAND $ gnss -r itrf1989) + add_test (NAME itrf1991-param-09 COMMAND $ gnss -r itrf1991) + add_test (NAME itrf1991-param-10 COMMAND $ gnss -r itrf1990) + add_test (NAME itrf1991-param-11 COMMAND $ gnss -r itrf1991) + add_test (NAME itrf1991-param-12 COMMAND $ gnss -r itrf1992) + add_test (NAME itrf1991-param-13 COMMAND $ gnss -r itrf1991) + add_test (NAME itrf1991-param-14 COMMAND $ gnss -r itrf1993) + add_test (NAME itrf1991-param-15 COMMAND $ gnss -r itrf1991) + add_test (NAME itrf1991-param-16 COMMAND $ gnss -r itrf1994) + add_test (NAME itrf1991-param-17 COMMAND $ gnss -r itrf1991) + add_test (NAME itrf1991-param-18 COMMAND $ gnss -r itrf1996) + add_test (NAME itrf1991-param-19 COMMAND $ gnss -r itrf1991) + add_test (NAME itrf1991-param-20 COMMAND $ gnss -r itrf1997) + add_test (NAME itrf1991-param-21 COMMAND $ gnss -r itrf1991) + add_test (NAME itrf1991-param-22 COMMAND $ gnss -r itrf2000) + add_test (NAME itrf1991-param-23 COMMAND $ gnss -r itrf1991) + add_test (NAME itrf1991-param-24 COMMAND $ gnss -r itrf2005) + add_test (NAME itrf1991-param-25 COMMAND $ gnss -r itrf1991) + add_test (NAME itrf1991-param-26 COMMAND $ gnss -r itrf2008) + add_test (NAME itrf1991-param-27 COMMAND $ gnss -r itrf1991) + add_test (NAME itrf1991-param-28 COMMAND $ gnss -r itrf2020) + # itrf1992 + add_test (NAME itrf1992-param-01 COMMAND $ gnss -r itrf1992) + add_test (NAME itrf1992-param-02 COMMAND $ gnss -r gda94) + add_test (NAME itrf1992-param-03 COMMAND $ gnss -r itrf1992) + add_test (NAME itrf1992-param-04 COMMAND $ gnss -r gda2020) + add_test (NAME itrf1992-param-05 COMMAND $ gnss -r itrf1992) + add_test (NAME itrf1992-param-06 COMMAND $ gnss -r itrf1988) + add_test (NAME itrf1992-param-07 COMMAND $ gnss -r itrf1992) + add_test (NAME itrf1992-param-08 COMMAND $ gnss -r itrf1989) + add_test (NAME itrf1992-param-09 COMMAND $ gnss -r itrf1992) + add_test (NAME itrf1992-param-10 COMMAND $ gnss -r itrf1990) + add_test (NAME itrf1992-param-11 COMMAND $ gnss -r itrf1992) + add_test (NAME itrf1992-param-12 COMMAND $ gnss -r itrf1991) + add_test (NAME itrf1992-param-13 COMMAND $ gnss -r itrf1992) + add_test (NAME itrf1992-param-14 COMMAND $ gnss -r itrf1993) + add_test (NAME itrf1992-param-15 COMMAND $ gnss -r itrf1992) + add_test (NAME itrf1992-param-16 COMMAND $ gnss -r itrf1994) + add_test (NAME itrf1992-param-17 COMMAND $ gnss -r itrf1992) + add_test (NAME itrf1992-param-18 COMMAND $ gnss -r itrf1996) + add_test (NAME itrf1992-param-19 COMMAND $ gnss -r itrf1992) + add_test (NAME itrf1992-param-20 COMMAND $ gnss -r itrf1997) + add_test (NAME itrf1992-param-21 COMMAND $ gnss -r itrf1992) + add_test (NAME itrf1992-param-22 COMMAND $ gnss -r itrf2000) + add_test (NAME itrf1992-param-23 COMMAND $ gnss -r itrf1992) + add_test (NAME itrf1992-param-24 COMMAND $ gnss -r itrf2005) + add_test (NAME itrf1992-param-25 COMMAND $ gnss -r itrf1992) + add_test (NAME itrf1992-param-26 COMMAND $ gnss -r itrf2008) + add_test (NAME itrf1992-param-27 COMMAND $ gnss -r itrf1992) + add_test (NAME itrf1992-param-28 COMMAND $ gnss -r itrf2020) + # itrf1993 + add_test (NAME itrf1993-param-01 COMMAND $ gnss -r itrf1993) + add_test (NAME itrf1993-param-02 COMMAND $ gnss -r gda94) + add_test (NAME itrf1993-param-03 COMMAND $ gnss -r itrf1993) + add_test (NAME itrf1993-param-04 COMMAND $ gnss -r gda2020) + add_test (NAME itrf1993-param-05 COMMAND $ gnss -r itrf1993) + add_test (NAME itrf1993-param-06 COMMAND $ gnss -r itrf1988) + add_test (NAME itrf1993-param-07 COMMAND $ gnss -r itrf1993) + add_test (NAME itrf1993-param-08 COMMAND $ gnss -r itrf1989) + add_test (NAME itrf1993-param-09 COMMAND $ gnss -r itrf1993) + add_test (NAME itrf1993-param-10 COMMAND $ gnss -r itrf1990) + add_test (NAME itrf1993-param-11 COMMAND $ gnss -r itrf1993) + add_test (NAME itrf1993-param-12 COMMAND $ gnss -r itrf1991) + add_test (NAME itrf1993-param-13 COMMAND $ gnss -r itrf1993) + add_test (NAME itrf1993-param-14 COMMAND $ gnss -r itrf1992) + add_test (NAME itrf1993-param-15 COMMAND $ gnss -r itrf1993) + add_test (NAME itrf1993-param-16 COMMAND $ gnss -r itrf1994) + add_test (NAME itrf1993-param-17 COMMAND $ gnss -r itrf1993) + add_test (NAME itrf1993-param-18 COMMAND $ gnss -r itrf1996) + add_test (NAME itrf1993-param-19 COMMAND $ gnss -r itrf1993) + add_test (NAME itrf1993-param-20 COMMAND $ gnss -r itrf1997) + add_test (NAME itrf1993-param-21 COMMAND $ gnss -r itrf1993) + add_test (NAME itrf1993-param-22 COMMAND $ gnss -r itrf2000) + add_test (NAME itrf1993-param-23 COMMAND $ gnss -r itrf1993) + add_test (NAME itrf1993-param-24 COMMAND $ gnss -r itrf2005) + add_test (NAME itrf1993-param-25 COMMAND $ gnss -r itrf1993) + add_test (NAME itrf1993-param-26 COMMAND $ gnss -r itrf2008) + add_test (NAME itrf1993-param-27 COMMAND $ gnss -r itrf1993) + add_test (NAME itrf1993-param-28 COMMAND $ gnss -r itrf2020) + # itrf1994 + add_test (NAME itrf1994-param-01 COMMAND $ gnss -r itrf1994) + add_test (NAME itrf1994-param-02 COMMAND $ gnss -r gda94) + add_test (NAME itrf1994-param-03 COMMAND $ gnss -r itrf1994) + add_test (NAME itrf1994-param-04 COMMAND $ gnss -r gda2020) + add_test (NAME itrf1994-param-05 COMMAND $ gnss -r itrf1994) + add_test (NAME itrf1994-param-06 COMMAND $ gnss -r itrf1988) + add_test (NAME itrf1994-param-07 COMMAND $ gnss -r itrf1994) + add_test (NAME itrf1994-param-08 COMMAND $ gnss -r itrf1989) + add_test (NAME itrf1994-param-09 COMMAND $ gnss -r itrf1994) + add_test (NAME itrf1994-param-10 COMMAND $ gnss -r itrf1990) + add_test (NAME itrf1994-param-11 COMMAND $ gnss -r itrf1994) + add_test (NAME itrf1994-param-12 COMMAND $ gnss -r itrf1991) + add_test (NAME itrf1994-param-13 COMMAND $ gnss -r itrf1994) + add_test (NAME itrf1994-param-14 COMMAND $ gnss -r itrf1992) + add_test (NAME itrf1994-param-15 COMMAND $ gnss -r itrf1994) + add_test (NAME itrf1994-param-16 COMMAND $ gnss -r itrf1993) + add_test (NAME itrf1994-param-17 COMMAND $ gnss -r itrf1994) + add_test (NAME itrf1994-param-18 COMMAND $ gnss -r itrf1996) + add_test (NAME itrf1994-param-19 COMMAND $ gnss -r itrf1994) + add_test (NAME itrf1994-param-20 COMMAND $ gnss -r itrf1997) + add_test (NAME itrf1994-param-21 COMMAND $ gnss -r itrf1994) + add_test (NAME itrf1994-param-22 COMMAND $ gnss -r itrf2000) + add_test (NAME itrf1994-param-23 COMMAND $ gnss -r itrf1994) + add_test (NAME itrf1994-param-24 COMMAND $ gnss -r itrf2005) + add_test (NAME itrf1994-param-25 COMMAND $ gnss -r itrf1994) + add_test (NAME itrf1994-param-26 COMMAND $ gnss -r itrf2008) + add_test (NAME itrf1994-param-27 COMMAND $ gnss -r itrf1994) + add_test (NAME itrf1994-param-28 COMMAND $ gnss -r itrf2020) + # itrf1996 + add_test (NAME itrf1996-param-01 COMMAND $ gnss -r itrf1996) + add_test (NAME itrf1996-param-02 COMMAND $ gnss -r gda94) + add_test (NAME itrf1996-param-03 COMMAND $ gnss -r itrf1996) + add_test (NAME itrf1996-param-04 COMMAND $ gnss -r gda2020) + add_test (NAME itrf1996-param-05 COMMAND $ gnss -r itrf1996) + add_test (NAME itrf1996-param-06 COMMAND $ gnss -r itrf1988) + add_test (NAME itrf1996-param-07 COMMAND $ gnss -r itrf1996) + add_test (NAME itrf1996-param-08 COMMAND $ gnss -r itrf1989) + add_test (NAME itrf1996-param-09 COMMAND $ gnss -r itrf1996) + add_test (NAME itrf1996-param-10 COMMAND $ gnss -r itrf1990) + add_test (NAME itrf1996-param-11 COMMAND $ gnss -r itrf1996) + add_test (NAME itrf1996-param-12 COMMAND $ gnss -r itrf1991) + add_test (NAME itrf1996-param-13 COMMAND $ gnss -r itrf1996) + add_test (NAME itrf1996-param-14 COMMAND $ gnss -r itrf1992) + add_test (NAME itrf1996-param-15 COMMAND $ gnss -r itrf1996) + add_test (NAME itrf1996-param-16 COMMAND $ gnss -r itrf1993) + add_test (NAME itrf1996-param-17 COMMAND $ gnss -r itrf1996) + add_test (NAME itrf1996-param-18 COMMAND $ gnss -r itrf1994) + add_test (NAME itrf1996-param-19 COMMAND $ gnss -r itrf1996) + add_test (NAME itrf1996-param-20 COMMAND $ gnss -r itrf1997) + add_test (NAME itrf1996-param-21 COMMAND $ gnss -r itrf1996) + add_test (NAME itrf1996-param-22 COMMAND $ gnss -r itrf2000) + add_test (NAME itrf1996-param-23 COMMAND $ gnss -r itrf1996) + add_test (NAME itrf1996-param-24 COMMAND $ gnss -r itrf2005) + add_test (NAME itrf1996-param-25 COMMAND $ gnss -r itrf1996) + add_test (NAME itrf1996-param-26 COMMAND $ gnss -r itrf2008) + add_test (NAME itrf1996-param-27 COMMAND $ gnss -r itrf1996) + add_test (NAME itrf1996-param-28 COMMAND $ gnss -r itrf2020) + # itrf1997 + add_test (NAME itrf1997-param-01 COMMAND $ gnss -r itrf1997) + add_test (NAME itrf1997-param-02 COMMAND $ gnss -r gda94) + add_test (NAME itrf1997-param-03 COMMAND $ gnss -r itrf1997) + add_test (NAME itrf1997-param-04 COMMAND $ gnss -r gda2020) + add_test (NAME itrf1997-param-05 COMMAND $ gnss -r itrf1997) + add_test (NAME itrf1997-param-06 COMMAND $ gnss -r itrf1988) + add_test (NAME itrf1997-param-07 COMMAND $ gnss -r itrf1997) + add_test (NAME itrf1997-param-08 COMMAND $ gnss -r itrf1989) + add_test (NAME itrf1997-param-09 COMMAND $ gnss -r itrf1997) + add_test (NAME itrf1997-param-10 COMMAND $ gnss -r itrf1990) + add_test (NAME itrf1997-param-11 COMMAND $ gnss -r itrf1997) + add_test (NAME itrf1997-param-12 COMMAND $ gnss -r itrf1991) + add_test (NAME itrf1997-param-13 COMMAND $ gnss -r itrf1997) + add_test (NAME itrf1997-param-14 COMMAND $ gnss -r itrf1992) + add_test (NAME itrf1997-param-15 COMMAND $ gnss -r itrf1997) + add_test (NAME itrf1997-param-16 COMMAND $ gnss -r itrf1993) + add_test (NAME itrf1997-param-17 COMMAND $ gnss -r itrf1997) + add_test (NAME itrf1997-param-18 COMMAND $ gnss -r itrf1994) + add_test (NAME itrf1997-param-19 COMMAND $ gnss -r itrf1997) + add_test (NAME itrf1997-param-20 COMMAND $ gnss -r itrf1996) + add_test (NAME itrf1997-param-21 COMMAND $ gnss -r itrf1997) + add_test (NAME itrf1997-param-22 COMMAND $ gnss -r itrf2000) + add_test (NAME itrf1997-param-23 COMMAND $ gnss -r itrf1997) + add_test (NAME itrf1997-param-24 COMMAND $ gnss -r itrf2005) + add_test (NAME itrf1997-param-25 COMMAND $ gnss -r itrf1997) + add_test (NAME itrf1997-param-26 COMMAND $ gnss -r itrf2008) + add_test (NAME itrf1997-param-27 COMMAND $ gnss -r itrf1997) + add_test (NAME itrf1997-param-28 COMMAND $ gnss -r itrf2020) + # itrf2000 + add_test (NAME itrf2000-param-01 COMMAND $ gnss -r itrf2000) + add_test (NAME itrf2000-param-02 COMMAND $ gnss -r gda94) + add_test (NAME itrf2000-param-03 COMMAND $ gnss -r itrf2000) + add_test (NAME itrf2000-param-04 COMMAND $ gnss -r gda2020) + add_test (NAME itrf2000-param-05 COMMAND $ gnss -r itrf2000) + add_test (NAME itrf2000-param-06 COMMAND $ gnss -r itrf1988) + add_test (NAME itrf2000-param-07 COMMAND $ gnss -r itrf2000) + add_test (NAME itrf2000-param-08 COMMAND $ gnss -r itrf1989) + add_test (NAME itrf2000-param-09 COMMAND $ gnss -r itrf2000) + add_test (NAME itrf2000-param-10 COMMAND $ gnss -r itrf1990) + add_test (NAME itrf2000-param-11 COMMAND $ gnss -r itrf2000) + add_test (NAME itrf2000-param-12 COMMAND $ gnss -r itrf1991) + add_test (NAME itrf2000-param-13 COMMAND $ gnss -r itrf2000) + add_test (NAME itrf2000-param-14 COMMAND $ gnss -r itrf1992) + add_test (NAME itrf2000-param-15 COMMAND $ gnss -r itrf2000) + add_test (NAME itrf2000-param-16 COMMAND $ gnss -r itrf1993) + add_test (NAME itrf2000-param-17 COMMAND $ gnss -r itrf2000) + add_test (NAME itrf2000-param-18 COMMAND $ gnss -r itrf1994) + add_test (NAME itrf2000-param-19 COMMAND $ gnss -r itrf2000) + add_test (NAME itrf2000-param-20 COMMAND $ gnss -r itrf1996) + add_test (NAME itrf2000-param-21 COMMAND $ gnss -r itrf2000) + add_test (NAME itrf2000-param-22 COMMAND $ gnss -r itrf1997) + add_test (NAME itrf2000-param-23 COMMAND $ gnss -r itrf2000) + add_test (NAME itrf2000-param-24 COMMAND $ gnss -r itrf2005) + add_test (NAME itrf2000-param-25 COMMAND $ gnss -r itrf2000) + add_test (NAME itrf2000-param-26 COMMAND $ gnss -r itrf2008) + add_test (NAME itrf2000-param-27 COMMAND $ gnss -r itrf2000) + add_test (NAME itrf2000-param-28 COMMAND $ gnss -r itrf2020) + # itrf2005 + add_test (NAME itrf2005-param-01 COMMAND $ gnss -r itrf2005) + add_test (NAME itrf2005-param-02 COMMAND $ gnss -r gda94) + add_test (NAME itrf2005-param-03 COMMAND $ gnss -r itrf2005) + add_test (NAME itrf2005-param-04 COMMAND $ gnss -r gda2020) + add_test (NAME itrf2005-param-05 COMMAND $ gnss -r itrf2005) + add_test (NAME itrf2005-param-06 COMMAND $ gnss -r itrf1988) + add_test (NAME itrf2005-param-07 COMMAND $ gnss -r itrf2005) + add_test (NAME itrf2005-param-08 COMMAND $ gnss -r itrf1989) + add_test (NAME itrf2005-param-09 COMMAND $ gnss -r itrf2005) + add_test (NAME itrf2005-param-10 COMMAND $ gnss -r itrf1990) + add_test (NAME itrf2005-param-11 COMMAND $ gnss -r itrf2005) + add_test (NAME itrf2005-param-12 COMMAND $ gnss -r itrf1991) + add_test (NAME itrf2005-param-13 COMMAND $ gnss -r itrf2005) + add_test (NAME itrf2005-param-14 COMMAND $ gnss -r itrf1992) + add_test (NAME itrf2005-param-15 COMMAND $ gnss -r itrf2005) + add_test (NAME itrf2005-param-16 COMMAND $ gnss -r itrf1993) + add_test (NAME itrf2005-param-17 COMMAND $ gnss -r itrf2005) + add_test (NAME itrf2005-param-18 COMMAND $ gnss -r itrf1994) + add_test (NAME itrf2005-param-19 COMMAND $ gnss -r itrf2005) + add_test (NAME itrf2005-param-20 COMMAND $ gnss -r itrf1996) + add_test (NAME itrf2005-param-21 COMMAND $ gnss -r itrf2005) + add_test (NAME itrf2005-param-22 COMMAND $ gnss -r itrf1997) + add_test (NAME itrf2005-param-23 COMMAND $ gnss -r itrf2005) + add_test (NAME itrf2005-param-24 COMMAND $ gnss -r itrf2000) + add_test (NAME itrf2005-param-25 COMMAND $ gnss -r itrf2005) + add_test (NAME itrf2005-param-26 COMMAND $ gnss -r itrf2008) + add_test (NAME itrf2005-param-27 COMMAND $ gnss -r itrf2005) + add_test (NAME itrf2005-param-28 COMMAND $ gnss -r itrf2020) + # itrf2008 + add_test (NAME itrf2008-param-01 COMMAND $ gnss -r itrf2008) + add_test (NAME itrf2008-param-02 COMMAND $ gnss -r gda94) + add_test (NAME itrf2008-param-03 COMMAND $ gnss -r itrf2008) + add_test (NAME itrf2008-param-04 COMMAND $ gnss -r gda2020) + add_test (NAME itrf2008-param-05 COMMAND $ gnss -r itrf2008) + add_test (NAME itrf2008-param-06 COMMAND $ gnss -r itrf1988) + add_test (NAME itrf2008-param-07 COMMAND $ gnss -r itrf2008) + add_test (NAME itrf2008-param-08 COMMAND $ gnss -r itrf1989) + add_test (NAME itrf2008-param-09 COMMAND $ gnss -r itrf2008) + add_test (NAME itrf2008-param-10 COMMAND $ gnss -r itrf1990) + add_test (NAME itrf2008-param-11 COMMAND $ gnss -r itrf2008) + add_test (NAME itrf2008-param-12 COMMAND $ gnss -r itrf1991) + add_test (NAME itrf2008-param-13 COMMAND $ gnss -r itrf2008) + add_test (NAME itrf2008-param-14 COMMAND $ gnss -r itrf1992) + add_test (NAME itrf2008-param-15 COMMAND $ gnss -r itrf2008) + add_test (NAME itrf2008-param-16 COMMAND $ gnss -r itrf1993) + add_test (NAME itrf2008-param-17 COMMAND $ gnss -r itrf2008) + add_test (NAME itrf2008-param-18 COMMAND $ gnss -r itrf1994) + add_test (NAME itrf2008-param-19 COMMAND $ gnss -r itrf2008) + add_test (NAME itrf2008-param-20 COMMAND $ gnss -r itrf1996) + add_test (NAME itrf2008-param-21 COMMAND $ gnss -r itrf2008) + add_test (NAME itrf2008-param-22 COMMAND $ gnss -r itrf1997) + add_test (NAME itrf2008-param-23 COMMAND $ gnss -r itrf2008) + add_test (NAME itrf2008-param-24 COMMAND $ gnss -r itrf2000) + add_test (NAME itrf2008-param-25 COMMAND $ gnss -r itrf2008) + add_test (NAME itrf2008-param-26 COMMAND $ gnss -r itrf2005) + add_test (NAME itrf2008-param-27 COMMAND $ gnss -r itrf2008) + add_test (NAME itrf2008-param-28 COMMAND $ gnss -r itrf2020) + # itrf2020 + add_test (NAME itrf2020-param-01 COMMAND $ gnss -r gda94) + add_test (NAME itrf2020-param-02 COMMAND $ gnss -r itrf2020) + add_test (NAME itrf2020-param-03 COMMAND $ gnss -r gda2020) + add_test (NAME itrf2020-param-04 COMMAND $ gnss -r itrf2020) + add_test (NAME itrf2020-param-05 COMMAND $ gnss -r itrf1988) + add_test (NAME itrf2020-param-06 COMMAND $ gnss -r itrf2020) + add_test (NAME itrf2020-param-07 COMMAND $ gnss -r itrf1989) + add_test (NAME itrf2020-param-08 COMMAND $ gnss -r itrf2020) + add_test (NAME itrf2020-param-09 COMMAND $ gnss -r itrf1990) + add_test (NAME itrf2020-param-10 COMMAND $ gnss -r itrf2020) + add_test (NAME itrf2020-param-11 COMMAND $ gnss -r itrf1991) + add_test (NAME itrf2020-param-12 COMMAND $ gnss -r itrf2020) + add_test (NAME itrf2020-param-13 COMMAND $ gnss -r itrf1992) + add_test (NAME itrf2020-param-14 COMMAND $ gnss -r itrf2020) + add_test (NAME itrf2020-param-15 COMMAND $ gnss -r itrf1993) + add_test (NAME itrf2020-param-16 COMMAND $ gnss -r itrf2020) + add_test (NAME itrf2020-param-17 COMMAND $ gnss -r itrf1994) + add_test (NAME itrf2020-param-18 COMMAND $ gnss -r itrf2020) + add_test (NAME itrf2020-param-19 COMMAND $ gnss -r itrf1996) + add_test (NAME itrf2020-param-20 COMMAND $ gnss -r itrf2020) + add_test (NAME itrf2020-param-21 COMMAND $ gnss -r itrf1997) + add_test (NAME itrf2020-param-22 COMMAND $ gnss -r itrf2020) + add_test (NAME itrf2020-param-23 COMMAND $ gnss -r itrf2000) + add_test (NAME itrf2020-param-24 COMMAND $ gnss -r itrf2020) + add_test (NAME itrf2020-param-25 COMMAND $ gnss -r itrf2005) + add_test (NAME itrf2020-param-26 COMMAND $ gnss -r itrf2020) + add_test (NAME itrf2020-param-27 COMMAND $ gnss -r itrf2008) # 9. gnss reference frame transformations with plate motion model - add_test (NAME ref-itrf-pmm-01 COMMAND $ -n itrf05_itrf1997_a -r itrf2005 ${CMAKE_SOURCE_DIR}/../sampleData/TEST_ITRF05.SNX) + add_test (NAME ref-itrf-pmm-01 COMMAND $ -n itrf05_itrf1997_a -r itrf2005 ${CMAKE_SOURCE_DIR}/../sampleData/TEST_ITRF05.SNX --flag-unused-stations) add_test (NAME ref-itrf-pmm-02 COMMAND $ itrf05_itrf1997_a -r itrf1997 -e 25.10.2017 --export-dna --verb 2 --plate-model-option 1 -b ${CMAKE_SOURCE_DIR}/../sampleData/PB2002_plates.dig -m ${CMAKE_SOURCE_DIR}/../sampleData/PB2002_poles.dat) - add_test (NAME ref-itrf-pmm-03 COMMAND $ -n itrf05_itrf1997_b -r itrf2005 ${CMAKE_SOURCE_DIR}/../sampleData/TEST_ITRF05.SNX) + add_test (NAME ref-itrf-pmm-03 COMMAND $ -n itrf05_itrf1997_b -r itrf2005 ${CMAKE_SOURCE_DIR}/../sampleData/TEST_ITRF05.SNX --flag-unused-stations) add_test (NAME ref-itrf-pmm-04 COMMAND $ itrf05_itrf1997_b -r itrf1997 -e 01.01.2020 --export-dna --verb 3 --plate-model-option 1 -b ${CMAKE_SOURCE_DIR}/../sampleData/PB2002_plates.dig -m ${CMAKE_SOURCE_DIR}/../sampleData/PB2002_poles.dat) - add_test (NAME ref-itrf-pmm-05 COMMAND $ -n apr -r itrf2008 ${CMAKE_SOURCE_DIR}/../sampleData/apr.ITRF2008.04.06.2020.stn ${CMAKE_SOURCE_DIR}/../sampleData/apr.ITRF2008.04.06.2020.msr) + add_test (NAME ref-itrf-pmm-05 COMMAND $ -n apr -r itrf2008 ${CMAKE_SOURCE_DIR}/../sampleData/apr.ITRF2008.04.06.2020.stn ${CMAKE_SOURCE_DIR}/../sampleData/apr.ITRF2008.04.06.2020.msr --flag-unused-stations) add_test (NAME ref-itrf-pmm-06 COMMAND $ apr -r itrf2008 -e 01.01.2021 --export-dna --verb 2 --plate-model-option 1 -b ${CMAKE_SOURCE_DIR}/../sampleData/MORVEL56_plates.dig -m ${CMAKE_SOURCE_DIR}/../sampleData/NNR-MORVEL56_poles.dat) #add_test (NAME ref-itrf-pmm-07 COMMAND bash -c "diff <(tail -n +6 apr.ITRF2008.01.01.2021.stn) <(tail -n +4 ${CMAKE_SOURCE_DIR}/../sampleData/apr.ITRF2008.01.01.2021.stn.expected)") # 10. station discontinuities - add_test (NAME imp-discont-01 COMMAND $ -n discont -r itrf2005 ${CMAKE_SOURCE_DIR}/../sampleData/TEST_ITRF05.SNX --discontinuity-file ${CMAKE_SOURCE_DIR}/../sampleData/disconts20201205.snx --export-discont-file) - add_test (NAME imp-discont-02 COMMAND $ -n discont -r itrf2005 ${CMAKE_SOURCE_DIR}/../sampleData/TEST_ITRF05.SNX --discontinuity-file ${CMAKE_SOURCE_DIR}/../sampleData/disconts20201205.snx --split-gnss --include-stn "ALIC" --export-dna) + add_test (NAME imp-discont-01 COMMAND $ -n discont -r itrf2005 ${CMAKE_SOURCE_DIR}/../sampleData/TEST_ITRF05.SNX --discontinuity-file ${CMAKE_SOURCE_DIR}/../sampleData/disconts20201205.snx --export-discont-file --flag-unused-stations) + add_test (NAME imp-discont-02 COMMAND $ -n discont -r itrf2005 ${CMAKE_SOURCE_DIR}/../sampleData/TEST_ITRF05.SNX --discontinuity-file ${CMAKE_SOURCE_DIR}/../sampleData/disconts20201205.snx --split-gnss --include-stn "ALIC" --export-dna --flag-unused-stations) add_test (NAME imp-discont-03 COMMAND $ -n discont -r itrf2014 --override-input-ref-frame ${CMAKE_SOURCE_DIR}/../sampleData/TEST_ITRF05.SNX ${CMAKE_SOURCE_DIR}/../sampleData/sa-gnss-stn.xml ${CMAKE_SOURCE_DIR}/../sampleData/sa-gnss-msr.xml --prefer-single-x-as-g --flag-unused --discontinuity-file ${CMAKE_SOURCE_DIR}/../sampleData/disconts20201205.snx --remove-ignored-msr --split-gnss --include-stns-assoc-msrs "ALIC" --export-dna --export-xml) add_test (NAME adj-discont-01 COMMAND $ discont --constraint "ALIC,CCC") add_test (NAME imp-discont-04 COMMAND $ -n discont -r itrf2005 ${CMAKE_SOURCE_DIR}/../sampleData/TEST_ITRF05.SNX --export-xml) @@ -424,7 +913,7 @@ if (BUILD_TESTING) add_test (NAME reftran-misc-02 COMMAND $ -p misc.dnaproj) add_test (NAME segment-misc-01 COMMAND $ misc --min 500 --max 500 --starting-stns 230900140) add_test (NAME segment-misc-02 COMMAND $ misc --min 50 --max 100 --starting-stns 230900140 --seg-file ./misc.seg) - add_test (NAME import-misc-06 COMMAND $ -n misc ./miscstn.xml ./miscmsr.xml --import-block-stn-msr 2) + add_test (NAME import-misc-06 COMMAND $ -n misc --import-block-stn-msr 2) add_test (NAME import-misc-07 COMMAND $ -p misc.dnaproj) add_test (NAME import-noname-01 COMMAND $ ${CMAKE_SOURCE_DIR}/../sampleData/dsg.stn ${CMAKE_SOURCE_DIR}/../sampleData/dsg.msr) add_test (NAME import-noname-02 COMMAND $ ${CMAKE_SOURCE_DIR}/../sampleData/dsg.stn ${CMAKE_SOURCE_DIR}/../sampleData/dsg.msr) @@ -513,7 +1002,7 @@ if (BUILD_TESTING) set_tests_properties(import-no-option import-invalid-option import-invalid-file import-nearby import-no-files import-no-frame import-no-data import-no-xsd-file import-no-geoid import-no-project import-no-stns import-no-help - import-misc-block-size import-misc-network-size + import-misc-block-size import-misc-network-size import-misc-07 PROPERTIES WILL_FAIL TRUE) ### REFTRAN ### @@ -525,8 +1014,6 @@ if (BUILD_TESTING) add_test (NAME reftran-no-project COMMAND $ -p ./nofile.dnaproj) # no name add_test (NAME reftran-no-name COMMAND $ -r "gda94") - # no reference frame - add_test (NAME reftran-no-frame COMMAND $ all) # no binary files add_test (NAME reftran-no-bst-bms COMMAND $ extremelylargenetwork -r "itrf1990") # reference frame doesn't exist @@ -544,7 +1031,7 @@ if (BUILD_TESTING) set_tests_properties( - reftran-no-option reftran-invalid-option reftran-no-project reftran-no-name reftran-no-frame reftran-no-bst-bms + reftran-no-option reftran-invalid-option reftran-no-project reftran-no-name reftran-no-bst-bms reftran-bad-frame reftran-bad-epoch reftran-no-discont-file reftran-no-euler-file reftran-no-model-option reftran-no-help PROPERTIES WILL_FAIL TRUE) diff --git a/dynadjust/dynadjust.props b/dynadjust/dynadjust.props index fe4a6675..9942d4c0 100644 --- a/dynadjust/dynadjust.props +++ b/dynadjust/dynadjust.props @@ -2,8 +2,8 @@ - C:\Data\boost\boost_1_78_0\include - C:\Data\boost\boost_1_78_0\lib\$(Platform) + C:\Data\boost\boost_1_87_0\include + C:\Data\boost\boost_1_87_0\lib\$(Platform) C:\Program Files (x86)\CodeSynthesis XSD 4.0\include C:\Program Files (x86)\CodeSynthesis XSD 4.0\lib64\vc-12.0 C:\Program Files (x86)\CodeSynthesis XSD 4.0\lib\vc-12.0 diff --git a/dynadjust/dynadjust.rc b/dynadjust/dynadjust.rc index c36a1d81..737c7f16 100644 --- a/dynadjust/dynadjust.rc +++ b/dynadjust/dynadjust.rc @@ -44,7 +44,7 @@ BEGIN VALUE "FileDescription", "DynAdjust is a rigorous, high performance least squares adjustment application." VALUE "FileVersion", "1.2.8.0" VALUE "InternalName", "DynAdjust" - VALUE "LegalCopyright", "Copyright 2022 Geoscience Australia" + VALUE "LegalCopyright", "Copyright 2025 Geoscience Australia" VALUE "OriginalFilename", "DynAdjust" VALUE "ProductName", "DynAdjust" VALUE "ProductVersion", "1.2.8.0" diff --git a/dynadjust/dynadjust/dnaadjust/dnaadjust-multi.cpp b/dynadjust/dynadjust/dnaadjust/dnaadjust-multi.cpp index b0aaec4a..aad0b4dd 100644 --- a/dynadjust/dynadjust/dnaadjust/dnaadjust-multi.cpp +++ b/dynadjust/dynadjust/dnaadjust/dnaadjust-multi.cpp @@ -34,7 +34,7 @@ extern boost::exception_ptr rev_error; extern boost::exception_ptr cmb_error; extern boost::exception_ptr prep_error; -bool combineAdjustmentExceptionThrown(const vector& cmb_errors_) +bool combineAdjustmentExceptionThrown(const std::vector& cmb_errors_) { // got a forward or reverse exception, or // have any of the other combination adjustments failed? @@ -58,7 +58,7 @@ bool combineAdjustmentExceptionThrown(const vector& cmb_er return false; } -bool prepareAdjustmentExceptionThrown(const vector& prep_errors_) +bool prepareAdjustmentExceptionThrown(const std::vector& prep_errors_) { // have any of the other combination adjustments failed? UINT32 err_size(static_cast(prep_errors_.size())); @@ -94,19 +94,19 @@ void dna_adjust::AdjustPhasedMultiThread() { initialiseIteration(); - string corr_msg; - ostringstream ss; + std::string corr_msg; + std::ostringstream ss; UINT32 i; bool iterate(true); - milliseconds iteration_time(milliseconds(0)); - cpu_timer it_time, tot_time; + boost::posix_time::milliseconds iteration_time(boost::posix_time::milliseconds(0)); + boost::timer::cpu_timer it_time, tot_time; #if defined(__ICC) || defined(__INTEL_COMPILER) // Intel compiler boost::shared_ptr f, r, c; - vector< boost::shared_ptr > mt_adjust_threads_sp; + std::vector< boost::shared_ptr > mt_adjust_threads_sp; #else - vector mt_adjust_threads; + std::vector mt_adjust_threads; #endif concurrentAdjustments.resize_runs(blockCount_); @@ -170,7 +170,7 @@ void dna_adjust::AdjustPhasedMultiThread() for_each(mt_adjust_threads.begin(), mt_adjust_threads.end(), boost::mem_fn(&boost::thread::join)); #endif // This point is reached when the threads have finished - iteration_time = milliseconds(it_time.elapsed().wall/MILLI_TO_NANO); + iteration_time = boost::posix_time::milliseconds(it_time.elapsed().wall/MILLI_TO_NANO); //delete mt_adjust_threads; #if defined(__ICC) || defined(__INTEL_COMPILER) // Intel compiler @@ -197,15 +197,15 @@ void dna_adjust::AdjustPhasedMultiThread() break; ss.str(""); - if (iteration_time > seconds(1)) - ss << seconds(static_cast(iteration_time.total_seconds())); + if (iteration_time > boost::posix_time::seconds(1)) + ss << boost::posix_time::seconds(static_cast(iteration_time.total_seconds())); else ss << iteration_time; /////////////////////////////////// // protected write to adj file (not needed here since write to // adj file at this stage is via single thread - adj_file << setw(PRINT_VAR_PAD) << left << "Elapsed time" << ss.str() << endl; + adj_file << std::setw(PRINT_VAR_PAD) << std::left << "Elapsed time" << ss.str() << std::endl; OutputLargestCorrection(corr_msg); /////////////////////////////////// @@ -277,7 +277,7 @@ void dna_adjust::SolveMTTry(bool COMPUTE_INVERSE, const UINT32& block) try { SolveMT(COMPUTE_INVERSE, block); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { // could not invert matrix. throw error @@ -286,12 +286,12 @@ void dna_adjust::SolveMTTry(bool COMPUTE_INVERSE, const UINT32& block) #endif if (projectSettings_.g.verbose) { - debug_file << "Block " << block + 1 << " (reverse, multi-thread)" << endl; - debug_file << "Pre-adjustment Estimates" << fixed << setprecision(16) << v_estimatedStationsR_.at(block); - debug_file << "Design" << fixed << setprecision(16) << v_designR_.at(block); - debug_file << "Measurements" << fixed << setprecision(16) << v_measMinusCompR_.at(block); - debug_file << "At * V-inv" << fixed << setprecision(16) << v_AtVinvR_.at(block); - debug_file << "Normals " << fixed << setprecision(16) << v_normalsR_.at(block) << endl; + debug_file << "Block " << block + 1 << " (reverse, multi-thread)" << std::endl; + debug_file << "Pre-adjustment Estimates" << std::fixed << std::setprecision(16) << v_estimatedStationsR_.at(block); + debug_file << "Design" << std::fixed << std::setprecision(16) << v_designR_.at(block); + debug_file << "Measurements" << std::fixed << std::setprecision(16) << v_measMinusCompR_.at(block); + debug_file << "At * V-inv" << std::fixed << std::setprecision(16) << v_AtVinvR_.at(block); + debug_file << "Normals " << std::fixed << std::setprecision(16) << v_normalsR_.at(block) << std::endl; debug_file.flush(); } #ifdef _MS_COMPILER_ @@ -344,29 +344,29 @@ void dna_adjust::SolveMT(bool COMPUTE_INVERSE, const UINT32& block) break; } - debug_file << endl; + debug_file << std::endl; debug_file << "Block " << block + 1 << " (Reverse)"; - debug_file << endl; - debug_file << "Pre-adjustment Estimates" << fixed << setprecision(16) << v_estimatedStationsR_.at(block); + debug_file << std::endl; + debug_file << "Pre-adjustment Estimates" << std::fixed << std::setprecision(16) << v_estimatedStationsR_.at(block); debug_file << "Block " << block + 1 << " (Reverse)"; - debug_file << endl; - debug_file << "Design" << fixed << setprecision(16) << v_designR_.at(block); + debug_file << std::endl; + debug_file << "Design" << std::fixed << std::setprecision(16) << v_designR_.at(block); debug_file << "Block " << block + 1 << " (Reverse)"; - debug_file << endl; - debug_file << "Measurements" << fixed << setprecision(16) << v_measMinusCompR_.at(block); + debug_file << std::endl; + debug_file << "Measurements" << std::fixed << std::setprecision(16) << v_measMinusCompR_.at(block); debug_file << "Block " << block + 1 << " (Reverse)"; - debug_file << endl; - debug_file << "At * V-inv" << fixed << setprecision(16) << v_AtVinvR_.at(block) << endl; + debug_file << std::endl; + debug_file << "At * V-inv" << std::fixed << std::setprecision(16) << v_AtVinvR_.at(block) << std::endl; debug_file << "Block " << block + 1 << " (Reverse)"; - debug_file << endl; - debug_file << "Normals " << fixed << setprecision(16) << v_normalsR_.at(block) << endl; + debug_file << std::endl; + debug_file << "Normals " << std::fixed << std::setprecision(16) << v_normalsR_.at(block) << std::endl; debug_file << "Block " << block + 1 << " (Reverse)"; - debug_file << endl; - debug_file << "Precisions" << fixed << setprecision(16) << v_normalsR_.at(block) << endl; + debug_file << std::endl; + debug_file << "Precisions" << std::fixed << std::setprecision(16) << v_normalsR_.at(block) << std::endl; debug_file << "Block " << block + 1 << " (Reverse)"; - debug_file << endl; - debug_file << "Corrections" << fixed << setprecision(16) << v_correctionsR_.at(block) << endl; + debug_file << std::endl; + debug_file << "Corrections" << std::fixed << std::setprecision(16) << v_correctionsR_.at(block) << std::endl; debug_file.flush(); dbg_file_mutex.unlock(); @@ -381,7 +381,7 @@ void dna_adjust::SolveMT(bool COMPUTE_INVERSE, const UINT32& block) void adjust_forward_thread::operator()() { - stringstream ss; + std::stringstream ss; UINT32 currentBlock; concurrentAdjustments.forward_run_started(); @@ -396,7 +396,7 @@ void adjust_forward_thread::operator()() return; //ss.str(""); - //ss << "1> Adjusted block " << currentBlock + 1 << " (forward, in isolation)... " << endl; + //ss << "1> Adjusted block " << currentBlock + 1 << " (forward, in isolation)... " << std::endl; //main_adj_->ThreadSafeWritetoAdjFile(ss.str()); // Check if an exception was thrown in the reverse or combine threads @@ -422,7 +422,7 @@ void adjust_forward_thread::operator()() ///////////////////////////////////// //// protected write to adj file //ss.str(""); - //ss << "1> Forward adjustment (in isolation) of block " << currentBlock + 1 << " complete." << endl; + //ss << "1> Forward adjustment (in isolation) of block " << currentBlock + 1 << " complete." << std::endl; //adj_file_mutex.lock(); //main_adj_->ThreadSafeWritetoAdjFile(ss.str()); @@ -453,7 +453,7 @@ void adjust_forward_thread::operator()() /////////////////////////////////// // protected write to adj file //ss.str(""); - //ss << "1> Forward adjustment of block " << currentBlock << " complete." << endl; + //ss << "1> Forward adjustment of block " << currentBlock << " complete." << std::endl; //main_adj_->ThreadSafeWritetoAdjFile(ss.str()); /////////////////////////////////// @@ -482,7 +482,7 @@ void adjust_forward_thread::operator()() // notify all threads waiting on combineAdjustmentQueue //combineAdjustmentQueue.notify_all(); - //this_thread::sleep(milliseconds(10)); + //this_thread::sleep(boost::posix_time::milliseconds(10)); // notify all threads waiting on combineAdjustmentQueue //combineAdjustmentQueue.notify_all(); @@ -491,7 +491,7 @@ void adjust_forward_thread::operator()() void adjust_reverse_thread::operator()() { - stringstream ss; + std::stringstream ss; UINT32 currentBlock(main_adj_->blockCount_-1), block; concurrentAdjustments.reverse_run_started(); @@ -516,7 +516,7 @@ void adjust_reverse_thread::operator()() ///////////////////////////////////// //// protected write to adj file //ss.str(""); - //ss << "2> Adjusted block " << currentBlock + 1 << " (reverse, in isolation)... " << endl; + //ss << "2> Adjusted block " << currentBlock + 1 << " (reverse, in isolation)... " << std::endl; //main_adj_->ThreadSafeWritetoAdjFile(ss.str()); ///////////////////////////////////// @@ -543,7 +543,7 @@ void adjust_reverse_thread::operator()() ///////////////////////////////////// //// protected write to adj file //ss.str(""); - //ss << "2> Reverse adjustment (in isolation) of block " << currentBlock + 1 << " complete." << endl; + //ss << "2> Reverse adjustment (in isolation) of block " << currentBlock + 1 << " complete." << std::endl; //adj_file_mutex.lock(); //main_adj_->ThreadSafeWritetoAdjFile(ss.str()); @@ -583,7 +583,7 @@ void adjust_reverse_thread::operator()() /////////////////////////////////// // protected write to adj file //ss.str(""); - //ss << "2> Reverse adjustment of block " << currentBlock << " complete." << endl; + //ss << "2> Reverse adjustment of block " << currentBlock << " complete." << std::endl; //main_adj_->ThreadSafeWritetoAdjFile(ss.str()); /////////////////////////////////// @@ -609,7 +609,7 @@ void adjust_reverse_thread::operator()() void adjust_process_combine_thread::operator()() { - stringstream ss; + std::stringstream ss; UINT32 pseudomsrJSLCount; UINT32 currentBlock; @@ -629,7 +629,7 @@ void adjust_process_combine_thread::operator()() // Wait here until blocks have been placed on the queue if (!combineAdjustmentQueue.front_and_pop(currentBlock)) { - boost::this_thread::sleep(milliseconds(2)); + boost::this_thread::sleep(boost::posix_time::milliseconds(2)); continue; } @@ -675,15 +675,15 @@ void adjust_combine_thread::operator()() UINT32 thread_id, cores(boost::thread::hardware_concurrency()); // Set up exception pointers - vector cmb_errors; + std::vector cmb_errors; cmb_errors.resize(cores); // Create the thread pool #if defined(__ICC) || defined(__INTEL_COMPILER) // Intel compiler boost::shared_ptr c; - vector< boost::shared_ptr > mt_combine_threads_sp; + std::vector< boost::shared_ptr > mt_combine_threads_sp; #else - vector mt_combine_threads; + std::vector mt_combine_threads; #endif for (thread_id=0; thread_id prep_errors; + std::vector prep_errors; prep_errors.resize(cores); // Create the thread pool #if defined(__ICC) || defined(__INTEL_COMPILER) // Intel compiler boost::shared_ptr p; - vector< boost::shared_ptr > mt_prepare_threads_sp; + std::vector< boost::shared_ptr > mt_prepare_threads_sp; #else - vector mt_prepare_threads; + std::vector mt_prepare_threads; #endif diff --git a/dynadjust/dynadjust/dnaadjust/dnaadjust-stage.cpp b/dynadjust/dynadjust/dnaadjust/dnaadjust-stage.cpp index d950f4f2..f0cf79d7 100644 --- a/dynadjust/dynadjust/dnaadjust/dnaadjust-stage.cpp +++ b/dynadjust/dynadjust/dnaadjust/dnaadjust-stage.cpp @@ -46,15 +46,15 @@ void dna_adjust::PrepareMappedRegions(const UINT32& block) try { PrepareMemoryMapRegions(block); } - catch (interprocess_exception& e){ - stringstream ss; - ss << "PrepareMappedRegions() terminated while creating memory map" << endl; - ss << " regions from .mtx stage files. Details:\n " << e.what() << endl << endl; - ss << " Please ensure the .mtx stage files from a previous staged" << endl; - ss << " adjustment exist, or re-run the adjustment using the" << endl; - ss << " --" << RECREATE_STAGE_FILES << " option." << endl; - adj_file << endl << "- Error: " << ss.str() << endl; - throw boost::enable_current_exception(runtime_error(ss.str())); + catch (boost::interprocess::interprocess_exception& e){ + std::stringstream ss; + ss << "PrepareMappedRegions() terminated while creating memory map" << std::endl; + ss << " regions from .mtx stage files. Details:\n " << e.what() << std::endl << std::endl; + ss << " Please ensure the .mtx stage files from a previous staged" << std::endl; + ss << " adjustment exist, or re-run the adjustment using the" << std::endl; + ss << " --" << RECREATE_STAGE_FILES << " option." << std::endl; + adj_file << std::endl << "- Error: " << ss.str() << std::endl; + throw boost::enable_current_exception(std::runtime_error(ss.str())); } } @@ -397,12 +397,12 @@ void dna_adjust::OpenStageFileStreams(const UINT16 file_count, ...) return; } - stringstream ss; + std::stringstream ss; ss << projectSettings_.g.output_folder << FOLDER_SLASH << projectSettings_.g.network_name << "-"; - string filePath(ss.str()); + std::string filePath(ss.str()); v_stageFileStreams_.clear(); - string fullfilePath; + std::string fullfilePath; va_list vlist; va_start(vlist, file_count); @@ -419,7 +419,7 @@ void dna_adjust::OpenStageFileStreams(const UINT16 file_count, ...) fullfilePath = filePath + "neqr.mtx"; v_stageFileStreams_.push_back(fullfilePath); if (projectSettings_.a.recreate_stage_files) - file_opener(f_normalsR_, fullfilePath, ios::out | ios::binary, binary); + file_opener(f_normalsR_, fullfilePath, std::ios::out | std::ios::binary, binary); normalsR_map_.setnewFilePath(fullfilePath, projectSettings_.a.purge_stage_files); break; @@ -429,7 +429,7 @@ void dna_adjust::OpenStageFileStreams(const UINT16 file_count, ...) fullfilePath = filePath + "mmc.mtx"; v_stageFileStreams_.push_back(fullfilePath); if (projectSettings_.a.recreate_stage_files) - file_opener(f_measMinusComp_, fullfilePath, ios::out | ios::binary, binary); + file_opener(f_measMinusComp_, fullfilePath, std::ios::out | std::ios::binary, binary); measMinusComp_map_.setnewFilePath(fullfilePath, projectSettings_.a.purge_stage_files); break; @@ -439,7 +439,7 @@ void dna_adjust::OpenStageFileStreams(const UINT16 file_count, ...) fullfilePath = filePath + "est.mtx"; v_stageFileStreams_.push_back(fullfilePath); if (projectSettings_.a.recreate_stage_files) - file_opener(f_estimatedStations_, fullfilePath, ios::out | ios::binary, binary); + file_opener(f_estimatedStations_, fullfilePath, std::ios::out | std::ios::binary, binary); estimatedStations_map_.setnewFilePath(fullfilePath, projectSettings_.a.purge_stage_files); break; @@ -449,7 +449,7 @@ void dna_adjust::OpenStageFileStreams(const UINT16 file_count, ...) fullfilePath = filePath + "ost.mtx"; v_stageFileStreams_.push_back(fullfilePath); if (projectSettings_.a.recreate_stage_files) - file_opener(f_originalStations_, fullfilePath, ios::out | ios::binary, binary); + file_opener(f_originalStations_, fullfilePath, std::ios::out | std::ios::binary, binary); originalStations_map_.setnewFilePath(fullfilePath, projectSettings_.a.purge_stage_files); break; @@ -459,7 +459,7 @@ void dna_adjust::OpenStageFileStreams(const UINT16 file_count, ...) fullfilePath = filePath + "rst.mtx"; v_stageFileStreams_.push_back(fullfilePath); if (projectSettings_.a.recreate_stage_files) - file_opener(f_rigorousStations_, fullfilePath, ios::out | ios::binary, binary); + file_opener(f_rigorousStations_, fullfilePath, std::ios::out | std::ios::binary, binary); rigorousStations_map_.setnewFilePath(fullfilePath, projectSettings_.a.purge_stage_files); break; @@ -469,7 +469,7 @@ void dna_adjust::OpenStageFileStreams(const UINT16 file_count, ...) fullfilePath = filePath + "jva.mtx"; v_stageFileStreams_.push_back(fullfilePath); if (projectSettings_.a.recreate_stage_files) - file_opener(f_junctionVariances_, fullfilePath, ios::out | ios::binary, binary); + file_opener(f_junctionVariances_, fullfilePath, std::ios::out | std::ios::binary, binary); junctionVariances_map_.setnewFilePath(fullfilePath, projectSettings_.a.purge_stage_files); break; @@ -479,7 +479,7 @@ void dna_adjust::OpenStageFileStreams(const UINT16 file_count, ...) fullfilePath = filePath + "jvf.mtx"; v_stageFileStreams_.push_back(fullfilePath); if (projectSettings_.a.recreate_stage_files) - file_opener(f_junctionVariancesFwd_, fullfilePath, ios::out | ios::binary, binary); + file_opener(f_junctionVariancesFwd_, fullfilePath, std::ios::out | std::ios::binary, binary); junctionVariancesFwd_map_.setnewFilePath(fullfilePath, projectSettings_.a.purge_stage_files); break; @@ -489,7 +489,7 @@ void dna_adjust::OpenStageFileStreams(const UINT16 file_count, ...) fullfilePath = filePath + "jef.mtx"; v_stageFileStreams_.push_back(fullfilePath); if (projectSettings_.a.recreate_stage_files) - file_opener(f_junctionEstimatesFwd_, fullfilePath, ios::out | ios::binary, binary); + file_opener(f_junctionEstimatesFwd_, fullfilePath, std::ios::out | std::ios::binary, binary); junctionEstimatesFwd_map_.setnewFilePath(fullfilePath, projectSettings_.a.purge_stage_files); break; @@ -499,7 +499,7 @@ void dna_adjust::OpenStageFileStreams(const UINT16 file_count, ...) fullfilePath = filePath + "jer.mtx"; v_stageFileStreams_.push_back(fullfilePath); if (projectSettings_.a.recreate_stage_files) - file_opener(f_junctionEstimatesRev_, fullfilePath, ios::out | ios::binary, binary); + file_opener(f_junctionEstimatesRev_, fullfilePath, std::ios::out | std::ios::binary, binary); junctionEstimatesRev_map_.setnewFilePath(fullfilePath, projectSettings_.a.purge_stage_files); break; @@ -509,7 +509,7 @@ void dna_adjust::OpenStageFileStreams(const UINT16 file_count, ...) fullfilePath = filePath + "rva.mtx"; v_stageFileStreams_.push_back(fullfilePath); if (projectSettings_.a.recreate_stage_files) - file_opener(f_rigorousVariances_, fullfilePath, ios::out | ios::binary, binary); + file_opener(f_rigorousVariances_, fullfilePath, std::ios::out | std::ios::binary, binary); rigorousVariances_map_.setnewFilePath(fullfilePath, projectSettings_.a.purge_stage_files); break; @@ -519,7 +519,7 @@ void dna_adjust::OpenStageFileStreams(const UINT16 file_count, ...) fullfilePath = filePath + "pam.mtx"; v_stageFileStreams_.push_back(fullfilePath); if (projectSettings_.a.recreate_stage_files) - file_opener(f_precAdjMsrs_, fullfilePath, ios::out | ios::binary, binary); + file_opener(f_precAdjMsrs_, fullfilePath, std::ios::out | std::ios::binary, binary); precAdjMsrs_map_.setnewFilePath(fullfilePath, projectSettings_.a.purge_stage_files); break; @@ -529,7 +529,7 @@ void dna_adjust::OpenStageFileStreams(const UINT16 file_count, ...) fullfilePath = filePath + "cor.mtx"; v_stageFileStreams_.push_back(fullfilePath); if (projectSettings_.a.recreate_stage_files) - file_opener(f_corrections_, fullfilePath, ios::out | ios::binary, binary); + file_opener(f_corrections_, fullfilePath, std::ios::out | std::ios::binary, binary); corrections_map_.setnewFilePath(fullfilePath, projectSettings_.a.purge_stage_files); break; @@ -537,7 +537,7 @@ void dna_adjust::OpenStageFileStreams(const UINT16 file_count, ...) } va_end(vlist); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { va_end(vlist); SignalExceptionAdjustment(e.what(), 0); } @@ -887,8 +887,8 @@ void dna_adjust::SerialiseBlockToDisk(const UINT32& block) f_corrections_ << v_corrections_.at(block); // ...cor.mtx } catch (...) { - stringstream ss; - ss << "SerialiseBlockToDisk(): An error was encountered when writing matrix data to disk." << endl; + std::stringstream ss; + ss << "SerialiseBlockToDisk(): An error was encountered when writing matrix data to disk." << std::endl; SignalExceptionAdjustment(ss.str(), 0); } } diff --git a/dynadjust/dynadjust/dnaadjust/dnaadjust.cpp b/dynadjust/dynadjust/dnaadjust/dnaadjust.cpp index c47f68a9..9173d398 100644 --- a/dynadjust/dynadjust/dnaadjust/dnaadjust.cpp +++ b/dynadjust/dynadjust/dnaadjust/dnaadjust.cpp @@ -204,13 +204,13 @@ void dna_adjust::initialiseIteration(const UINT32& iteration) void dna_adjust::InitialiseAdjustment() { - adj_file << endl << "+ Initialising adjustment" << endl; + adj_file << std::endl << "+ Initialising adjustment" << std::endl; // Confidence interval double conf(projectSettings_.a.confidence_interval * 0.01); - normal dist(0.0, 1.0); + boost::math::normal dist(0.0, 1.0); conf += (1.0 - conf) / 2.0; - criticalValue_ = quantile(dist, conf); + criticalValue_ = boost::math::quantile(dist, conf); potentialOutlierCount_ = 0; @@ -297,22 +297,22 @@ void dna_adjust::PrepareAdjustment(const project_settings& projectSettings) if (!projectSettings_.a.report_mode) { - string block_str(" block"); + std::string block_str(" block"); if (blockCount_ > 1) block_str.append("s"); block_str.append(")... "); - adj_file << endl << "+ Preparing for adjustment"; + adj_file << std::endl << "+ Preparing for adjustment"; switch (projectSettings_.a.adjust_mode) { case Phased_Block_1Mode: case PhasedMode: - adj_file << left << " (" << blockCount_<< block_str; + adj_file << std::left << " (" << blockCount_<< block_str; if (projectSettings_.a.multi_thread && projectSettings_.g.verbose > 2) - adj_file << endl; + adj_file << std::endl; break; case SimultaneousMode: - adj_file << left << "... "; + adj_file << std::left << "... "; } adj_file.flush(); } @@ -346,29 +346,29 @@ void dna_adjust::PrepareAdjustment(const project_settings& projectSettings) } } catch (const NetMemoryException& e) { - stringstream ss; + std::stringstream ss; double memory; try { GetMemoryFootprint(memory, GIGABYTE_SIZE); } catch (...) { /*do nothing*/ } - ss << "PrepareAdjustment(): Process terminated while allocating memory for the " << endl << " adjustment matrices. " << - "Details: " << endl << " " << e.what() << endl; + ss << "PrepareAdjustment(): Process terminated while allocating memory for the " << std::endl << " adjustment matrices. " << + "Details: " << std::endl << " " << e.what() << std::endl; ss << " The memory footprint consumed by " << __BINARY_NAME__ << " is " << - fixed << setprecision(2) << memory << " GB" << endl; - adj_file << "- Error" << endl << " " << ss.str(); + std::fixed << std::setprecision(2) << memory << " GB" << std::endl; + adj_file << "- Error" << std::endl << " " << ss.str(); SignalExceptionAdjustment(ss.str(), currentBlock_); } - catch (const runtime_error& e) { - stringstream ss; - ss << "PrepareAdjustment(): Process terminated while preparing the " << endl << " adjustment matrices. " << - "Details: " << endl << " " << e.what() << endl; - adj_file << "- Error" << endl << " " << ss.str(); + catch (const std::runtime_error& e) { + std::stringstream ss; + ss << "PrepareAdjustment(): Process terminated while preparing the " << std::endl << " adjustment matrices. " << + "Details: " << std::endl << " " << e.what() << std::endl; + adj_file << "- Error" << std::endl << " " << ss.str(); SignalExceptionAdjustment(ss.str(), currentBlock_); } catch (...) { - stringstream ss; - ss << "PrepareAdjustment(): Process terminated while preparing the " << endl << " adjustment matrices. " << endl; - adj_file << "- Error" << endl << " " << ss.str(); + std::stringstream ss; + ss << "PrepareAdjustment(): Process terminated while preparing the " << std::endl << " adjustment matrices. " << std::endl; + adj_file << "- Error" << std::endl << " " << ss.str(); SignalExceptionAdjustment(ss.str(), 0); } @@ -386,14 +386,14 @@ void dna_adjust::PrepareAdjustment(const project_settings& projectSettings) try { SetMapRegions(); } - catch (interprocess_exception& e){ - stringstream ss; - ss << "PrepareMappedRegions() terminated while creating memory map" << endl; - ss << " regions from .mtx stage files. Details:\n " << e.what() << endl << endl; - ss << " Please ensure the .mtx stage files from a previous staged" << endl; - ss << " adjustment exist, or re-run the adjustment using the" << endl; - ss << " --" << RECREATE_STAGE_FILES << " option." << endl; - adj_file << endl << "- Error: " << ss.str() << endl; + catch (boost::interprocess::interprocess_exception& e){ + std::stringstream ss; + ss << "PrepareMappedRegions() terminated while creating memory map" << std::endl; + ss << " regions from .mtx stage files. Details:\n " << e.what() << std::endl << std::endl; + ss << " Please ensure the .mtx stage files from a previous staged" << std::endl; + ss << " adjustment exist, or re-run the adjustment using the" << std::endl; + ss << " --" << RECREATE_STAGE_FILES << " option." << std::endl; + adj_file << std::endl << "- Error: " << ss.str() << std::endl; SignalExceptionAdjustment(ss.str(), 0); } } @@ -414,8 +414,8 @@ void dna_adjust::PrepareAdjustment(const project_settings& projectSettings) } catch (...) { - stringstream ss; - ss << "Failed to assign matrices for multi-thread adjustment." << endl; + std::stringstream ss; + ss << "Failed to assign matrices for multi-thread adjustment." << std::endl; SignalExceptionAdjustment(ss.str(), 0); } } @@ -433,7 +433,7 @@ void dna_adjust::PrepareAdjustment(const project_settings& projectSettings) FormUniqueMsrList(); if (projectSettings_.g.verbose > 3) - debug_file << endl << endl; + debug_file << std::endl << std::endl; if (!projectSettings_.a.report_mode) { @@ -445,11 +445,11 @@ void dna_adjust::PrepareAdjustment(const project_settings& projectSettings) if (projectSettings_.g.verbose > 0) { double memory; - stringstream ss; + std::stringstream ss; try { GetMemoryFootprint(memory, GIGABYTE_SIZE); - ss << endl << "+ The memory footprint consumed by " << __BINARY_NAME__ << " is " << - fixed << setprecision(2) << memory << " GB" << endl; + ss << std::endl << "+ The memory footprint consumed by " << __BINARY_NAME__ << " is " << + std::fixed << std::setprecision(2) << memory << " GB" << std::endl; adj_file << ss.str(); } catch (...) { /*do nothing*/ } @@ -468,7 +468,7 @@ void dna_adjust::UpdateBinaryFiles() dna_io_bst bst; bst.write_bst_file(projectSettings_.a.bst_file, &bstBinaryRecords_, bst_meta_); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionAdjustment(e.what(), 0); } @@ -480,7 +480,7 @@ void dna_adjust::UpdateBinaryFiles() dna_io_bms bms; bms.write_bms_file(projectSettings_.a.bms_file, &bmsBinaryRecords_, bms_meta_); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionAdjustment(e.what(), 0); } } @@ -610,23 +610,23 @@ void dna_adjust::UpdateAdjustment(bool iterate) } } catch (const NetMemoryException& e) { - stringstream ss; + std::stringstream ss; double memory; try { GetMemoryFootprint(memory, GIGABYTE_SIZE); } catch (...) {} - ss << "UpdateAdjustment(): Process terminated while allocating memory for the " << endl << " adjustment matrices. " << - "Details: " << endl << " " << e.what() << endl; + ss << "UpdateAdjustment(): Process terminated while allocating memory for the " << std::endl << " adjustment matrices. " << + "Details: " << std::endl << " " << e.what() << std::endl; ss << " The memory footprint consumed by " << __BINARY_NAME__ << " is " << - fixed << setprecision(2) << memory << " GB" << endl; - adj_file << "- Error:" << endl << " " << ss.str(); + std::fixed << std::setprecision(2) << memory << " GB" << std::endl; + adj_file << "- Error:" << std::endl << " " << ss.str(); SignalExceptionAdjustment(ss.str(), block); } - catch (const runtime_error& e) { - stringstream ss; - ss << "UpdateAdjustment(): Process terminated while updating the " << endl << " adjustment matrices. " << - "Details: " << endl << " " << e.what() << endl; - adj_file << "- Error:" << endl << " " << ss.str(); + catch (const std::runtime_error& e) { + std::stringstream ss; + ss << "UpdateAdjustment(): Process terminated while updating the " << std::endl << " adjustment matrices. " << + "Details: " << std::endl << " " << e.what() << std::endl; + adj_file << "- Error:" << std::endl << " " << ss.str(); SignalExceptionAdjustment(ss.str(), block); } @@ -640,11 +640,11 @@ void dna_adjust::GetMemoryFootprint(double& memory, const _MEM_UNIT_ unit) UINT32 precision(2); size_t size(0); - stringstream ss, st; + std::stringstream ss, st; if (projectSettings_.g.verbose > 0) { // Print title - ss << endl << left << setw(PRINT_VAR_PAD) << "+ Memory footprint:"; + ss << std::endl << std::left << std::setw(PRINT_VAR_PAD) << "+ Memory footprint:"; st << "Size"; switch (unit) { @@ -663,13 +663,13 @@ void dna_adjust::GetMemoryFootprint(double& memory, const _MEM_UNIT_ unit) break; } - ss << right << setw(NUMERIC_WIDTH) << st.str() << endl; + ss << std::right << std::setw(NUMERIC_WIDTH) << st.str() << std::endl; // Print line ss << " "; for (i=0; i(bstBinaryRecords_.size()) / unit * sizeof(station_t)); if (projectSettings_.g.verbose > 0) - ss << left << setw(PRINT_VAR_PAD) << " Binary station file" << - right << setw(NUMERIC_WIDTH) << fixed << setprecision(precision) << tmp << endl; + ss << std::left << std::setw(PRINT_VAR_PAD) << " Binary station file" << + std::right << std::setw(NUMERIC_WIDTH) << std::fixed << std::setprecision(precision) << tmp << std::endl; ////////////// ////////////// // binary measurements memory += (tmp = static_cast(bmsBinaryRecords_.size()) / unit * sizeof(measurement_t)); if (projectSettings_.g.verbose > 0) - ss << left << setw(PRINT_VAR_PAD) << " Binary measurement file" << - right << setw(NUMERIC_WIDTH) << fixed << setprecision(precision) << tmp << endl; + ss << std::left << std::setw(PRINT_VAR_PAD) << " Binary measurement file" << + std::right << std::setw(NUMERIC_WIDTH) << std::fixed << std::setprecision(precision) << tmp << std::endl; ////////////// ////////////// // Associated Station List memory += (tmp = static_cast(vAssocStnList_.size()) / unit * sizeof(CAStationList)); if (projectSettings_.g.verbose > 0) - ss << left << setw(PRINT_VAR_PAD) << " Associated station list" << - right << setw(NUMERIC_WIDTH) << fixed << setprecision(precision) << tmp << endl; + ss << std::left << std::setw(PRINT_VAR_PAD) << " Associated station list" << + std::right << std::setw(NUMERIC_WIDTH) << std::fixed << std::setprecision(precision) << tmp << std::endl; ////////////// ////////////// // Associated Measurement List memory += (tmp = static_cast(vAssocMsrList_.size()) / unit * sizeof(UINT32)); if (projectSettings_.g.verbose > 0) - ss << left << setw(PRINT_VAR_PAD) << " Associated measurement list" << - right << setw(NUMERIC_WIDTH) << fixed << setprecision(precision) << tmp << endl; + ss << std::left << std::setw(PRINT_VAR_PAD) << " Associated measurement list" << + std::right << std::setw(NUMERIC_WIDTH) << std::fixed << std::setprecision(precision) << tmp << std::endl; ////////////// ////////////// @@ -715,8 +715,8 @@ void dna_adjust::GetMemoryFootprint(double& memory, const _MEM_UNIT_ unit) size += v_chiSquaredLowerLimit_.size(); memory += (tmp = static_cast(size) / unit * sizeof(double)); if (projectSettings_.g.verbose > 0) - ss << left << setw(PRINT_VAR_PAD) << " Statistical variables" << - right << setw(NUMERIC_WIDTH) << fixed << setprecision(precision) << tmp << endl; + ss << std::left << std::setw(PRINT_VAR_PAD) << " Statistical variables" << + std::right << std::setw(NUMERIC_WIDTH) << std::fixed << std::setprecision(precision) << tmp << std::endl; ////////////// ////////////// @@ -749,8 +749,8 @@ void dna_adjust::GetMemoryFootprint(double& memory, const _MEM_UNIT_ unit) memory += tmp; if (projectSettings_.g.verbose > 0) - ss << left << setw(PRINT_VAR_PAD) << " Matrix variables" << - right << setw(NUMERIC_WIDTH) << fixed << setprecision(precision) << tmp << endl; + ss << std::left << std::setw(PRINT_VAR_PAD) << " Matrix variables" << + std::right << std::setw(NUMERIC_WIDTH) << std::fixed << std::setprecision(precision) << tmp << std::endl; #ifdef MULTI_THREAD_ADJUST if (projectSettings_.a.multi_thread) @@ -781,8 +781,8 @@ void dna_adjust::GetMemoryFootprint(double& memory, const _MEM_UNIT_ unit) memory += tmp; if (projectSettings_.g.verbose > 0) - ss << left << setw(PRINT_VAR_PAD) << " MT matrix variables" << - right << setw(NUMERIC_WIDTH) << fixed << setprecision(precision) << tmp << endl; + ss << std::left << std::setw(PRINT_VAR_PAD) << " MT matrix variables" << + std::right << std::setw(NUMERIC_WIDTH) << std::fixed << std::setprecision(precision) << tmp << std::endl; } #endif @@ -816,8 +816,8 @@ void dna_adjust::GetMemoryFootprint(double& memory, const _MEM_UNIT_ unit) memory += tmp; if (projectSettings_.g.verbose > 0) - ss << left << setw(PRINT_VAR_PAD) << " Arrays, counters and indices" << - right << setw(NUMERIC_WIDTH) << fixed << setprecision(precision) << tmp << endl; + ss << std::left << std::setw(PRINT_VAR_PAD) << " Arrays, counters and indices" << + std::right << std::setw(NUMERIC_WIDTH) << std::fixed << std::setprecision(precision) << tmp << std::endl; ////////////// @@ -826,8 +826,8 @@ void dna_adjust::GetMemoryFootprint(double& memory, const _MEM_UNIT_ unit) ss << " "; for (i=0; i 5) debug_file << "V" << (*_it_msr)->measType << " " << - fixed << setprecision(16) << setw(26) << variance << endl; + std::fixed << std::setprecision(16) << std::setw(26) << variance << std::endl; // Build At * V-1 AtVinv->put(stn1, design_row, variance * design->get(design_row, stn1)); @@ -1623,9 +1623,9 @@ void dna_adjust::UpdateNormals(const UINT32& block, bool MT_ReverseOrCombine) break; default: - stringstream ss; - ss << "UpdateNormals(): Unknown measurement type - '" << static_cast(&(_it_msr->measType)) << - "'." << endl; + std::stringstream ss; + ss << "UpdateNormals(): Unknown measurement type - '" << static_cast(&(_it_msr->measType)) << + "'." << std::endl; SignalExceptionAdjustment(ss.str(), block); } } @@ -1717,8 +1717,10 @@ void dna_adjust::UpdateNormals_A(const UINT32& stn1, const UINT32& stn2, const U void dna_adjust::UpdateNormals_D(const UINT32& block, it_vmsr_t& _it_msr, UINT32& design_row, matrix_2d* normals, matrix_2d* design, matrix_2d* AtVinv) { - UINT32 row, col, a, angle_count(_it_msr->vectorCount1 - 1); - vector stations; + UINT32 row, col, a, angle_count(_it_msr->vectorCount2 - 1); + UINT32 skip(0), ignored(_it_msr->vectorCount1 - _it_msr->vectorCount2); + + std::vector stations; UINT32 stn1, stn2, stn3; vmsr_t angleRec; @@ -1731,6 +1733,18 @@ void dna_adjust::UpdateNormals_D(const UINT32& block, it_vmsr_t& _it_msr, UINT32 // stations to assist formulation of covariances for (a=0; aignore) + { + while (skip < ignored) + { + skip++; + _it_msr++; + if (!_it_msr->ignore) + break; + } + } + it_angle->station3 = _it_msr->station2; stn1 = (v_blockStationsMap_.at(block)[it_angle->station1] * 3); @@ -1740,17 +1754,17 @@ void dna_adjust::UpdateNormals_D(const UINT32& block, it_vmsr_t& _it_msr, UINT32 if (!binary_search(stations.begin(), stations.end(), it_angle->station1)) { stations.push_back(it_angle->station1); - sort(stations.begin(), stations.end()); + std::sort(stations.begin(), stations.end()); } if (!binary_search(stations.begin(), stations.end(), it_angle->station2)) { stations.push_back(it_angle->station2); - sort(stations.begin(), stations.end()); + std::sort(stations.begin(), stations.end()); } if (!binary_search(stations.begin(), stations.end(), it_angle->station3)) { stations.push_back(it_angle->station3); - sort(stations.begin(), stations.end()); + std::sort(stations.begin(), stations.end()); } // station 1 @@ -1777,6 +1791,7 @@ void dna_adjust::UpdateNormals_D(const UINT32& block, it_vmsr_t& _it_msr, UINT32 // prepare for next angle angleRec.push_back(*_it_msr); it_angle = angleRec.end() - 1; + _it_msr++; } @@ -1788,7 +1803,7 @@ void dna_adjust::UpdateNormals_D(const UINT32& block, it_vmsr_t& _it_msr, UINT32 { // // covariance terms (station 1, station 2, station 3) - // requires vector stations which was built during formation of v_AtVinv_ + // requires std::vector stations which was built during formation of v_AtVinv_ for (it_stn=stations.begin(); it_stn!=stations.end(); ++it_stn) { stn1 = (v_blockStationsMap_.at(block)[*it_stn] * 3); @@ -1895,7 +1910,7 @@ void dna_adjust::UpdateNormals_X(const UINT32& block, it_vmsr_t& _it_msr, UINT32 baseline_stations.push_back(GetBlkMatrixElemStn1(block, &_it_msr)); baseline_stations.push_back(GetBlkMatrixElemStn2(block, &_it_msr)); - sort(baseline_stations.begin(), baseline_stations.end()); + std::sort(baseline_stations.begin(), baseline_stations.end()); matrix_2d tmp(3, 3); @@ -1909,13 +1924,13 @@ void dna_adjust::UpdateNormals_X(const UINT32& block, it_vmsr_t& _it_msr, UINT32 if (!binary_search(baseline_stations.begin(), baseline_stations.end(), stn1)) { baseline_stations.push_back(stn1); - sort(baseline_stations.begin(), baseline_stations.end()); + std::sort(baseline_stations.begin(), baseline_stations.end()); } if (!binary_search(baseline_stations.begin(), baseline_stations.end(), stn2)) { baseline_stations.push_back(stn2); - sort(baseline_stations.begin(), baseline_stations.end()); + std::sort(baseline_stations.begin(), baseline_stations.end()); } covr = cluster_bsl * 3; @@ -2005,7 +2020,7 @@ void dna_adjust::UpdateNormals_Y(const UINT32& block, it_vmsr_t& _it_msr, UINT32 if (projectSettings_.g.verbose > 4) debug_file << "- Adding variances for " << bstBinaryRecords_.at(_it_msr->station1).stationName << " to v_normals_ (block " << block+1 << "), (" << stn1 << ", " << stn1 << "): " << - fixed << setprecision(16) << AtVinv->submatrix(stn1, design_row, 3, 3); + std::fixed << std::setprecision(16) << AtVinv->submatrix(stn1, design_row, 3, 3); if (covariance_count < 1) { @@ -2107,7 +2122,7 @@ void dna_adjust::AddConstraintStationstoNormalsForward(const UINT32& block) #pragma region debug_output #endif if (projectSettings_.g.verbose > 6) - debug_file << "parameter station " << bstBinaryRecords_.at((*_it_const)).stationName << scientific << setprecision(16) << var_cart << endl; + debug_file << "parameter station " << bstBinaryRecords_.at((*_it_const)).stationName << std::scientific << std::setprecision(16) << var_cart << std::endl; #ifdef _MS_COMPILER_ #pragma endregion debug_output #endif @@ -2234,7 +2249,7 @@ void dna_adjust::AddConstraintStationstoNormalsSimultaneous(const UINT32& block) #pragma region debug_output #endif if (projectSettings_.g.verbose > 6) - debug_file << "parameter station " << bstBinaryRecords_.at((*_it_const)).stationName << scientific << setprecision(16) << var_cart << endl; + debug_file << "parameter station " << bstBinaryRecords_.at((*_it_const)).stationName << std::scientific << std::setprecision(16) << var_cart << std::endl; #ifdef _MS_COMPILER_ #pragma endregion debug_output #endif @@ -2356,22 +2371,22 @@ _ADJUST_STATUS_ dna_adjust::AdjustNetwork() { case SimultaneousMode: if (!projectSettings_.a.report_mode) - adj_file << endl << "+ Commencing simultaneous adjustment" << endl << endl; + adj_file << std::endl << "+ Commencing simultaneous adjustment" << std::endl << std::endl; AdjustSimultaneous(); return adjustStatus_; case PhasedMode: if (!projectSettings_.a.report_mode) - adj_file << endl << "+ Commencing sequential phased adjustment"; + adj_file << std::endl << "+ Commencing sequential phased adjustment"; #ifdef MULTI_THREAD_ADJUST if (projectSettings_.a.multi_thread) { if (!projectSettings_.a.report_mode) { - adj_file << endl << " Optimised for concurrent processing via multi-threading." << endl; - adj_file << " The active CPU supports the execution of " << boost::thread::hardware_concurrency() << " concurrent threads." << endl; - adj_file << endl; + adj_file << std::endl << " Optimised for concurrent processing via multi-threading." << std::endl; + adj_file << " The active CPU supports the execution of " << boost::thread::hardware_concurrency() << " concurrent threads." << std::endl; + adj_file << std::endl; } AdjustPhasedMultiThread(); return adjustStatus_; @@ -2379,7 +2394,7 @@ _ADJUST_STATUS_ dna_adjust::AdjustNetwork() #endif if (!projectSettings_.a.report_mode) - adj_file << endl << endl; + adj_file << std::endl << std::endl; AdjustPhased(); return adjustStatus_; @@ -2387,20 +2402,20 @@ _ADJUST_STATUS_ dna_adjust::AdjustNetwork() case Phased_Block_1Mode: if (!projectSettings_.a.report_mode) { - adj_file << endl << "+ Commencing sequential phased adjustment, producing rigorous estimates" << endl; - adj_file << " for block 1 only" << endl << endl; + adj_file << std::endl << "+ Commencing sequential phased adjustment, producing rigorous estimates" << std::endl; + adj_file << " for block 1 only" << std::endl << std::endl; adj_file << - "- Warning: Depending on the quality of the apriori station estimates, further" << endl << - " iterations may be needed. --block1-phased mode should only be used once" << endl << - " rigorous estimates have been produced for the entire network."<< endl << endl; + "- Warning: Depending on the quality of the apriori station estimates, further" << std::endl << + " iterations may be needed. --block1-phased mode should only be used once" << std::endl << + " rigorous estimates have been produced for the entire network."<< std::endl << std::endl; } AdjustPhasedBlock1(); return adjustStatus_; default: - stringstream ss; - ss << "AdjustNetwork(): Unknown adjustment type" << endl; + std::stringstream ss; + ss << "AdjustNetwork(): Unknown adjustment type" << std::endl; SignalExceptionAdjustment(ss.str(), 0); } @@ -2491,7 +2506,7 @@ void dna_adjust::LoadDatabaseId() if (databaseIDsLoaded_) return; - string dbid_filename = formPath(projectSettings_.g.output_folder, + std::string dbid_filename = formPath(projectSettings_.g.output_folder, projectSettings_.g.network_name, "dbid"); // When printing database ids, force printing adjusted measurements @@ -2509,9 +2524,9 @@ void dna_adjust::LoadDatabaseId() try { // Create geoid file. Throws runtime_error on failure. file_opener(dbid_file, dbid_filename, - ios::in | ios::binary, binary); + std::ios::in | std::ios::binary, binary); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionAdjustment(e.what(), 0); } @@ -2559,79 +2574,79 @@ void dna_adjust::PrintPositionalUncertainty() // Create apu file. Throws runtime_error on failure. file_opener(apu_file, projectSettings_.o._apu_file); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionAdjustment(e.what(), 0); } // Print formatted header print_file_header(apu_file, "DYNADJUST POSITIONAL UNCERTAINTY OUTPUT FILE"); - apu_file << setw(PRINT_VAR_PAD) << left << "File name:" << system_complete(projectSettings_.o._apu_file).string() << endl << endl; + apu_file << std::setw(PRINT_VAR_PAD) << std::left << "File name:" << boost::filesystem::system_complete(projectSettings_.o._apu_file).string() << std::endl << std::endl; - apu_file << setw(PRINT_VAR_PAD) << left << "PU confidence interval:" << setprecision(1) << fixed << - // projectSettings_.a.confidence_interval << "%" << endl; + apu_file << std::setw(PRINT_VAR_PAD) << std::left << "PU confidence interval:" << std::setprecision(1) << std::fixed << + // projectSettings_.a.confidence_interval << "%" << std::endl; // the SP1 standard for PU is 95% and the formula is designed to achieve that end, // irrespective of the adjustment confidence interval - 95.0 << "%" << endl; + 95.0 << "%" << std::endl; - apu_file << setw(PRINT_VAR_PAD) << left << "Error ellipse axes:" << setprecision(1) << fixed << - 68.3 << "% (1 sigma)" << endl; + apu_file << std::setw(PRINT_VAR_PAD) << std::left << "Error ellipse axes:" << std::setprecision(1) << std::fixed << + 68.3 << "% (1 sigma)" << std::endl; - apu_file << setw(PRINT_VAR_PAD) << left << "Variances:" << setprecision(1) << fixed << - 68.3 << "% (1 sigma)" << endl; + apu_file << std::setw(PRINT_VAR_PAD) << std::left << "Variances:" << std::setprecision(1) << std::fixed << + 68.3 << "% (1 sigma)" << std::endl; - apu_file << setw(PRINT_VAR_PAD) << left << "Stations printed in blocks:"; + apu_file << std::setw(PRINT_VAR_PAD) << std::left << "Stations printed in blocks:"; if (projectSettings_.a.adjust_mode != SimultaneousMode) { if (projectSettings_.o._output_stn_blocks) - apu_file << "Yes" << endl; + apu_file << "Yes" << std::endl; else { if (projectSettings_.o._output_pu_covariances) - apu_file << left << "Yes (enforced with output-all-covariances)" << endl; + apu_file << std::left << "Yes (enforced with output-all-covariances)" << std::endl; else - apu_file << left << "No" << endl; + apu_file << std::left << "No" << std::endl; } } else - apu_file << left << "No" << endl; + apu_file << std::left << "No" << std::endl; - apu_file << setw(PRINT_VAR_PAD) << left << "Variance matrix units:"; + apu_file << std::setw(PRINT_VAR_PAD) << std::left << "Variance matrix units:"; switch (projectSettings_.o._apu_vcv_units) { case ENU_apu_ui: - apu_file << left << "ENU" << endl; + apu_file << std::left << "ENU" << std::endl; break; default: case XYZ_apu_ui: - apu_file << left << "XYZ" << endl; + apu_file << std::left << "XYZ" << std::endl; break; } apu_file << - setw(PRINT_VAR_PAD) << left << "Full covariance matrix:"; + std::setw(PRINT_VAR_PAD) << std::left << "Full covariance matrix:"; if (projectSettings_.o._output_pu_covariances) - apu_file << left << "Yes" << endl; + apu_file << std::left << "Yes" << std::endl; else - apu_file << left << "No" << endl; + apu_file << std::left << "No" << std::endl; if (projectSettings_.o._apply_type_b_file || projectSettings_.o._apply_type_b_global) { if (projectSettings_.o._apply_type_b_global) - apu_file << setw(PRINT_VAR_PAD) << left << "Type B uncertainties:" << - projectSettings_.a.type_b_global << endl; + apu_file << std::setw(PRINT_VAR_PAD) << std::left << "Type B uncertainties:" << + projectSettings_.a.type_b_global << std::endl; if (projectSettings_.o._apply_type_b_file) - apu_file << setw(PRINT_VAR_PAD) << left << "Type B uncertainty file:" << - system_complete(projectSettings_.a.type_b_file).string() << endl; + apu_file << std::setw(PRINT_VAR_PAD) << std::left << "Type B uncertainty file:" << + boost::filesystem::system_complete(projectSettings_.a.type_b_file).string() << std::endl; } - apu_file << OUTPUTLINE << endl << endl; + apu_file << OUTPUTLINE << std::endl << std::endl; - apu_file << "Positional uncertainty of adjusted station coordinates" << endl; - apu_file << "------------------------------------------------------" << endl; + apu_file << "Positional uncertainty of adjusted station coordinates" << std::endl; + apu_file << "------------------------------------------------------" << std::endl; - apu_file << endl; + apu_file << std::endl; switch (projectSettings_.a.adjust_mode) { @@ -2685,24 +2700,24 @@ void dna_adjust::PrintNetworkStationCorrections() // Create cor file. Throws runtime_error on failure. file_opener(cor_file, projectSettings_.o._cor_file); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionAdjustment(e.what(), 0); } // Print formatted header print_file_header(cor_file, "DYNADJUST CORRECTIONS OUTPUT FILE"); - cor_file << setw(PRINT_VAR_PAD) << left << "File name:" << system_complete(projectSettings_.o._cor_file).string() << endl << endl; + cor_file << std::setw(PRINT_VAR_PAD) << std::left << "File name:" << boost::filesystem::system_complete(projectSettings_.o._cor_file).string() << std::endl << std::endl; - cor_file << setw(PRINT_VAR_PAD) << left << "Stations printed in blocks:"; + cor_file << std::setw(PRINT_VAR_PAD) << std::left << "Stations printed in blocks:"; if (projectSettings_.a.adjust_mode != SimultaneousMode && projectSettings_.o._output_stn_blocks) - cor_file << "Yes" << endl << endl; + cor_file << "Yes" << std::endl << std::endl; else - cor_file << "No" << endl; - cor_file << OUTPUTLINE << endl << endl; + cor_file << "No" << std::endl; + cor_file << OUTPUTLINE << std::endl << std::endl; - cor_file << "Corrections to stations" << endl; - cor_file << "------------------------------------------" << endl << endl; + cor_file << "Corrections to stations" << std::endl; + cor_file << "------------------------------------------" << std::endl << std::endl; switch (projectSettings_.a.adjust_mode) { @@ -2740,12 +2755,12 @@ void dna_adjust::PrintNetworkStationCorrections() cor_file.close(); } -bool dna_adjust::PrintEstimatedStationCoordinatestoSNX(string& sinex_filename) +bool dna_adjust::PrintEstimatedStationCoordinatestoSNX(std::string& sinex_filename) { std::ofstream sinex_file; - string sinexFilename; - string sinexBasename = projectSettings_.g.output_folder + FOLDER_SLASH + projectSettings_.g.network_name; - stringstream ssBlock; + std::string sinexFilename; + std::string sinexBasename = projectSettings_.g.output_folder + FOLDER_SLASH + projectSettings_.g.network_name; + std::stringstream ssBlock; matrix_2d *estimates = nullptr, *variances = nullptr; @@ -2797,7 +2812,7 @@ bool dna_adjust::PrintEstimatedStationCoordinatestoSNX(string& sinex_filename) // Open output file stream. Throws runtime_error on failure. file_opener(sinex_file, sinexFilename); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionAdjustment(e.what(), 0); } @@ -2813,7 +2828,7 @@ bool dna_adjust::PrintEstimatedStationCoordinatestoSNX(string& sinex_filename) blockCount_, block, &datum_); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionAdjustment(e.what(), 0); } @@ -2835,7 +2850,7 @@ bool dna_adjust::PrintEstimatedStationCoordinatestoSNX(string& sinex_filename) // Open output file stream. Throws runtime_error on failure. file_opener(sinex_file, sinexFilename); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionAdjustment(e.what(), 0); } @@ -2846,7 +2861,7 @@ bool dna_adjust::PrintEstimatedStationCoordinatestoSNX(string& sinex_filename) return success; } -void dna_adjust::PrintEstimatedStationCoordinatestoDNAXML_Y(const string& msrFile, INPUT_FILE_TYPE t) +void dna_adjust::PrintEstimatedStationCoordinatestoDNAXML_Y(const std::string& msrFile, INPUT_FILE_TYPE t) { // Measurements std::ofstream msr_file; @@ -2854,13 +2869,13 @@ void dna_adjust::PrintEstimatedStationCoordinatestoDNAXML_Y(const string& msrFil // Create STN/XML file. file_opener(msr_file, msrFile); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionAdjustment(e.what(), 0); } dna_msr_fields dml, dmw; - stringstream ss; + std::stringstream ss; try { @@ -2868,7 +2883,7 @@ void dna_adjust::PrintEstimatedStationCoordinatestoDNAXML_Y(const string& msrFil ss << "Source data: Coordinates and uncertainties for " << count << " unique stations in " << blockCount_ << " blocks " << "estimated from least squares adjustment."; - string headerComment(ss.str()); + std::string headerComment(ss.str()); // print header switch (t) @@ -2905,7 +2920,7 @@ void dna_adjust::PrintEstimatedStationCoordinatestoDNAXML_Y(const string& msrFil catch (const XMLInteropException& e) { SignalExceptionAdjustment(e.what(), 0); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionAdjustment(e.what(), 0); } @@ -2913,7 +2928,7 @@ void dna_adjust::PrintEstimatedStationCoordinatestoDNAXML_Y(const string& msrFil { matrix_2d *estimates = nullptr, *variances = nullptr; dnaMsrPtr msr_ptr; - string comment; + std::string comment; // Create a Y cluster for each block for (UINT32 block(0); block 1) ss << " for block " << (block + 1); - ss << endl << + ss << std::endl << " - Type (Y) GPS point cluster (set of " << v_blockStationsMap_.at(block).size() << " stations)"; if (blockCount_ > 1) { - ss << ":" << endl << + ss << ":" << std::endl << " - " << v_ISL_.at(block).size() << " inner station"; if (v_ISL_.at(block).size() != 1) ss << "s"; - ss << endl << + ss << std::endl << " - " << v_JSL_.at(block).size() << " junction station"; if (v_JSL_.at(block).size() != 1) ss << "s"; - ss << endl; + ss << std::endl; } else - ss << endl; + ss << std::endl; ss << " "; comment = ss.str(); @@ -2998,7 +3013,7 @@ void dna_adjust::PrintEstimatedStationCoordinatestoDNAXML_Y(const string& msrFil switch (t) { case dynaml: - msr_file << "" << endl; + msr_file << "" << std::endl; break; case dna: default: @@ -3017,7 +3032,7 @@ void dna_adjust::PrintEstimatedStationCoordinatestoDNAXML_Y(const string& msrFil // This should be put into a class separate to dnaadjust -void dna_adjust::PrintEstimatedStationCoordinatestoDNAXML(const string& stnFile, INPUT_FILE_TYPE t, bool flagUnused) +void dna_adjust::PrintEstimatedStationCoordinatestoDNAXML(const std::string& stnFile, INPUT_FILE_TYPE t, bool flagUnused) { // Stations std::ofstream stn_file; @@ -3025,7 +3040,7 @@ void dna_adjust::PrintEstimatedStationCoordinatestoDNAXML(const string& stnFile, // Create STN/XML file. file_opener(stn_file, stnFile); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionAdjustment(e.what(), 0); } @@ -3034,7 +3049,7 @@ void dna_adjust::PrintEstimatedStationCoordinatestoDNAXML(const string& stnFile, UINT32 count(static_cast(bstBinaryRecords_.size())); dna_stn_fields dsl, dsw; - string headerComment("Source data: Coordinates estimated from least squares adjustment."); + std::string headerComment("Source data: Coordinates estimated from least squares adjustment."); // print header switch (t) @@ -3084,7 +3099,7 @@ void dna_adjust::PrintEstimatedStationCoordinatestoDNAXML(const string& stnFile, // Sort on original file order CompareStnFileOrder stnorderCompareFunc(&bstBinaryRecords_); - sort(vStationList.begin(), vStationList.end(), stnorderCompareFunc); + std::sort(vStationList.begin(), vStationList.end(), stnorderCompareFunc); // print station coordinates switch (t) @@ -3109,7 +3124,7 @@ void dna_adjust::PrintEstimatedStationCoordinatestoDNAXML(const string& stnFile, datum_.GetEllipsoidRef(), &projection_, dynaml); }); - stn_file << "" << endl; + stn_file << "" << std::endl; break; case dna: @@ -3219,7 +3234,7 @@ void dna_adjust::FormUniqueMsrList() break; // Single row per subtended angle (# directions less 1) case 'D': // Direction set - precadjmsr_row += (_it_msr->vectorCount1 - 1); + precadjmsr_row += (_it_msr->vectorCount2 - 1); break; // Three rows (6 elements for upper triangular) case 'G': // GPS Baseline @@ -3304,7 +3319,7 @@ void dna_adjust::CreateMsrToStnTally() dna_io_aml aml; aml.load_aml_file(projectSettings_.s.aml_file, &vAssocMsrList_, &bmsBinaryRecords_); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionAdjustment(e.what(), 0); } @@ -3339,7 +3354,7 @@ void dna_adjust::PrintMeasurementsToStation() CreateMsrToStnTally(); // Print measurement to station summary header - string header("Measurements to Station "); + std::string header("Measurements to Station "); MsrToStnSummaryHeader(adj_file, header); _it_vmsrtally it_vstnmsrs; @@ -3357,7 +3372,7 @@ void dna_adjust::PrintMeasurementsToStation() { // sort summary according to measurement to station count CompareMeasCount msrcountCompareFunc(&vAssocStnList_); - sort(vStationList.begin(), vStationList.end(), msrcountCompareFunc); + std::sort(vStationList.begin(), vStationList.end(), msrcountCompareFunc); } break; case orig_stn_sort_ui: @@ -3365,7 +3380,7 @@ void dna_adjust::PrintMeasurementsToStation() { // sort summary according to original station file order CompareStnFileOrder stnorderCompareFunc(&bstBinaryRecords_); - sort(vStationList.begin(), vStationList.end(), stnorderCompareFunc); + std::sort(vStationList.begin(), vStationList.end(), stnorderCompareFunc); } break; } @@ -3384,7 +3399,7 @@ void dna_adjust::PrintMeasurementsToStation() msrTally.coutSummaryMsrToStn(adj_file, "Totals"); - adj_file << endl << endl; + adj_file << std::endl << std::endl; } @@ -3403,10 +3418,10 @@ void dna_adjust::AdjustSimultaneous() adjustStatus_ = ADJUST_SUCCESS; initialiseIteration(); - ostringstream ss; - string corr_msg; - milliseconds elapsed_time(milliseconds(0)); - cpu_timer it_time, tot_time; + std::ostringstream ss; + std::string corr_msg; + boost::posix_time::milliseconds elapsed_time(boost::posix_time::milliseconds(0)); + boost::timer::cpu_timer it_time, tot_time; bool iterate; @@ -3488,7 +3503,7 @@ void dna_adjust::AdjustSimultaneous() ValidateandFinaliseAdjustment(tot_time); } -void dna_adjust::ValidateandFinaliseAdjustment(cpu_timer& tot_time) +void dna_adjust::ValidateandFinaliseAdjustment(boost::timer::cpu_timer& tot_time) { isAdjusting_ = false; @@ -3529,12 +3544,12 @@ void dna_adjust::ValidateandFinaliseAdjustment(cpu_timer& tot_time) void dna_adjust::PrintAdjustmentStatus() { // print adjustment status - adj_file << endl << OUTPUTLINE << endl; - adj_file << setw(PRINT_VAR_PAD) << left << "SOLUTION"; + adj_file << std::endl << OUTPUTLINE << std::endl; + adj_file << std::setw(PRINT_VAR_PAD) << std::left << "SOLUTION"; if (projectSettings_.a.report_mode) { - adj_file << "Printing results of last adjustment only" << endl; + adj_file << "Printing results of last adjustment only" << std::endl; return; } @@ -3542,49 +3557,49 @@ void dna_adjust::PrintAdjustmentStatus() { case Phased_Block_1Mode: if (adjustStatus_ == ADJUST_SUCCESS) - adj_file << "Estimates solved for Block 1 only" << endl; + adj_file << "Estimates solved for Block 1 only" << std::endl; else - adj_file << "Failed to solve Block 1 estimates" << endl; + adj_file << "Failed to solve Block 1 estimates" << std::endl; break; default: if (adjustStatus_ == ADJUST_SUCCESS && CurrentIteration() <= projectSettings_.a.max_iterations && fabs(maxCorr_) <= projectSettings_.a.iteration_threshold) - adj_file << "Converged" << endl; + adj_file << "Converged" << std::endl; else - adj_file << "Failed to converge" << endl; + adj_file << "Failed to converge" << std::endl; } } -void dna_adjust::PrintAdjustmentTime(cpu_timer& time, _TIMER_TYPE_ timerType) +void dna_adjust::PrintAdjustmentTime(boost::timer::cpu_timer& time, _TIMER_TYPE_ timerType) { // calculate and print total time - milliseconds ms(milliseconds(time.elapsed().wall/MILLI_TO_NANO)); - time_duration t(ms); + boost::posix_time::milliseconds ms(boost::posix_time::milliseconds(time.elapsed().wall/MILLI_TO_NANO)); + boost::posix_time::time_duration t(ms); - stringstream ss; - if (t > seconds(1)) - ss << seconds(static_cast(t.total_seconds())); + std::stringstream ss; + if (t > boost::posix_time::seconds(1)) + ss << boost::posix_time::seconds(static_cast(t.total_seconds())); else ss << t; if (timerType == iteration_time) - adj_file << setw(PRINT_VAR_PAD) << left << "Elapsed time" << ss.str() << endl; + adj_file << std::setw(PRINT_VAR_PAD) << std::left << "Elapsed time" << ss.str() << std::endl; else { total_time_ = ms; - adj_file << setw(PRINT_VAR_PAD) << left << "Total time" << ss.str() << endl << endl; + adj_file << std::setw(PRINT_VAR_PAD) << std::left << "Total time" << ss.str() << std::endl << std::endl; } } void dna_adjust::PrintIteration(const UINT32& iteration) { - stringstream iterationMessage; + std::stringstream iterationMessage; - iterationMessage << endl << OUTPUTLINE << endl << - setw(PRINT_VAR_PAD) << left << "ITERATION" << iteration << endl << endl; + iterationMessage << std::endl << OUTPUTLINE << std::endl << + std::setw(PRINT_VAR_PAD) << std::left << "ITERATION" << iteration << std::endl << std::endl; adj_file << iterationMessage.str(); @@ -3597,12 +3612,12 @@ void dna_adjust::AdjustPhased() { initialiseIteration(); - string corr_msg; - ostringstream ss; + std::string corr_msg; + std::ostringstream ss; UINT32 i; bool iterate(true); - cpu_timer it_time, tot_time; + boost::timer::cpu_timer it_time, tot_time; // do until convergence criteria is met for (i=0; i 2) { adj_file_mutex.lock(); - adj_file << thread_id << "> Preparing block " << block + 1 << "..." << endl; + adj_file << thread_id << "> Preparing block " << block + 1 << "..." << std::endl; adj_file_mutex.unlock(); } #endif @@ -3893,7 +3908,7 @@ void dna_adjust::PrepareAdjustmentBlock(const UINT32 block, const UINT32 thread_ if (projectSettings_.g.verbose > 3) { - debug_file << "BLOCK " << block + 1 << " Station summary -------------------------------------------------" << endl; + debug_file << "BLOCK " << block + 1 << " Station summary -------------------------------------------------" << std::endl; debug_file << "Stations: "; for (i=0; i 2) { adj_file_mutex.lock(); - adj_file << thread_id << "> Done." << endl; + adj_file << thread_id << "> Done." << std::endl; adj_file_mutex.unlock(); } #endif @@ -4011,10 +4028,10 @@ void dna_adjust::PrepareAdjustmentBlock(const UINT32 block, const UINT32 thread_ #endif if (projectSettings_.g.verbose > 3) { - debug_file << endl; - debug_file << "Design " << scientific << setprecision(16) << v_design_.at(block) << endl; - debug_file << "AtVinv " << scientific << setprecision(16) << v_AtVinv_.at(block) << endl; - debug_file << "Normals " << scientific << setprecision(16) << v_normals_.at(block) << endl; + debug_file << std::endl; + debug_file << "Design " << std::scientific << std::setprecision(16) << v_design_.at(block) << std::endl; + debug_file << "AtVinv " << std::scientific << std::setprecision(16) << v_AtVinv_.at(block) << std::endl; + debug_file << "Normals " << std::scientific << std::setprecision(16) << v_normals_.at(block) << std::endl; } #ifdef _MS_COMPILER_ #pragma endregion debug_output @@ -4090,11 +4107,11 @@ void dna_adjust::CarryForwardJunctions(const UINT32 thisBlock, const UINT32 next #ifdef MULTI_THREAD_ADJUST if (projectSettings_.a.multi_thread) { - adj_file << endl << "1> Adjusted block " << thisBlock + 1; + adj_file << std::endl << "1> Adjusted block " << thisBlock + 1; if (v_blockMeta_.at(thisBlock)._blockLast || v_blockMeta_.at(thisBlock)._blockIsolated) - adj_file << " (forward, rigorous) " << endl; + adj_file << " (forward, rigorous) " << std::endl; else - adj_file << " (forward, in isolation) " << endl; + adj_file << " (forward, in isolation) " << std::endl; } #endif @@ -4135,7 +4152,7 @@ bool dna_adjust::PrepareAdjustmentReverse(const UINT32 currentBlock, bool MT_Rev if (projectSettings_.o._adj_stn_iteration) { adj_file_mutex.lock(); - adj_file << "Skipping reverse adjustment of (isolated) block " << currentBlock+1 << ". Rigorous coordinates produced in forward pass. " << endl << endl; + adj_file << "Skipping reverse adjustment of (isolated) block " << currentBlock+1 << ". Rigorous coordinates produced in forward pass. " << std::endl << std::endl; adj_file_mutex.unlock(); } @@ -4340,15 +4357,15 @@ void dna_adjust::CarryStnEstimatesandVariancesCombine( if (projectSettings_.g.verbose > 0) { - adj_file << endl << "Reverse block " << thisBlock; + adj_file << std::endl << "Reverse block " << thisBlock; if (projectSettings_.a.stage) - adj_file << " phased " << endl; + adj_file << " phased " << std::endl; else - adj_file << " staged " << endl; - adj_file << scientific << setprecision(16) << - "Design " << v_design_.at(thisBlock) << endl << - "AtVinv " << v_AtVinv_.at(thisBlock) << endl << - "Normals " << v_normals_.at(thisBlock) << endl; + adj_file << " staged " << std::endl; + adj_file << std::scientific << std::setprecision(16) << + "Design " << v_design_.at(thisBlock) << std::endl << + "AtVinv " << v_AtVinv_.at(thisBlock) << std::endl << + "Normals " << v_normals_.at(thisBlock) << std::endl; } } @@ -4428,32 +4445,32 @@ void dna_adjust::debug_SolutionInformation(const UINT32& currentBlock) debug_file << "Block " << currentBlock + 1; if (projectSettings_.a.adjust_mode != SimultaneousMode) debug_file << (forward_ ? " (Forward)" : " (Reverse)"); - debug_file << endl; - debug_file << "Pre-adjustment Estimates " << fixed << setprecision(16) << v_estimatedStations_.at(currentBlock); + debug_file << std::endl; + debug_file << "Pre-adjustment Estimates " << std::fixed << std::setprecision(16) << v_estimatedStations_.at(currentBlock); debug_file << "Block " << currentBlock + 1; if (projectSettings_.a.adjust_mode != SimultaneousMode) debug_file << (forward_ ? " (Forward)" : " (Reverse)"); - debug_file << endl; - debug_file << "Design " << fixed << setprecision(16) << v_design_.at(currentBlock); + debug_file << std::endl; + debug_file << "Design " << std::fixed << std::setprecision(16) << v_design_.at(currentBlock); debug_file << "Block " << currentBlock + 1; if (projectSettings_.a.adjust_mode != SimultaneousMode) debug_file << (forward_ ? " (Forward)" : " (Reverse)"); - debug_file << endl; - debug_file << "Measurements " << fixed << setprecision(16) << v_measMinusComp_.at(currentBlock); + debug_file << std::endl; + debug_file << "Measurements " << std::fixed << std::setprecision(16) << v_measMinusComp_.at(currentBlock); debug_file << "Block " << currentBlock + 1; if (projectSettings_.a.adjust_mode != SimultaneousMode) debug_file << (forward_ ? " (Forward)" : " (Reverse)"); - debug_file << endl; - debug_file << "At * V-inv " << fixed << setprecision(16) << v_AtVinv_.at(currentBlock) << endl; + debug_file << std::endl; + debug_file << "At * V-inv " << std::fixed << std::setprecision(16) << v_AtVinv_.at(currentBlock) << std::endl; debug_file << "Block " << currentBlock + 1; if (projectSettings_.a.adjust_mode != SimultaneousMode) debug_file << (forward_ ? " (Forward)" : " (Reverse)"); - debug_file << endl; - debug_file << "Normals " << fixed << setprecision(16) << v_normals_.at(currentBlock) << endl; + debug_file << std::endl; + debug_file << "Normals " << std::fixed << std::setprecision(16) << v_normals_.at(currentBlock) << std::endl; debug_file.flush(); } #ifdef _MS_COMPILER_ @@ -4462,7 +4479,7 @@ void dna_adjust::debug_SolutionInformation(const UINT32& currentBlock) } -void dna_adjust::debug_BlockInformation(const UINT32& currentBlock, const string& adjustment_method) +void dna_adjust::debug_BlockInformation(const UINT32& currentBlock, const std::string& adjustment_method) { #ifdef _MS_COMPILER_ #pragma region debug_output @@ -4480,10 +4497,10 @@ void dna_adjust::debug_BlockInformation(const UINT32& currentBlock, const string else debug_file << " "; } - debug_file << endl; + debug_file << std::endl; - debug_file << "Block " << currentBlock + 1 << " " << adjustment_method << endl; - debug_file << "Adjustment Estimates " << fixed << setprecision(16) << v_estimatedStations_.at(currentBlock); + debug_file << "Block " << currentBlock + 1 << " " << adjustment_method << std::endl; + debug_file << "Adjustment Estimates " << std::fixed << std::setprecision(16) << v_estimatedStations_.at(currentBlock); } #ifdef _MS_COMPILER_ #pragma endregion debug_output @@ -4516,7 +4533,7 @@ void dna_adjust::AdjustPhasedReverseCombine() if (projectSettings_.o._adj_stn_iteration) { - adj_file << endl << left << "Adjusting block " << currentBlock+1; + adj_file << std::endl << std::left << "Adjusting block " << currentBlock+1; if (!v_blockMeta_.at(currentBlock)._blockFirst) adj_file << " (reverse, in isolation)... "; else @@ -4531,7 +4548,7 @@ void dna_adjust::AdjustPhasedReverseCombine() // variances are carried in the reverse direction below if (projectSettings_.g.verbose > 3) - debug_file << "In isolation" << endl; + debug_file << "In isolation" << std::endl; // Backup normals prior to inversion for re-use in combination // adjustment... only if a combination is required @@ -4541,7 +4558,7 @@ void dna_adjust::AdjustPhasedReverseCombine() SolveTry(true, currentBlock); if (projectSettings_.o._adj_stn_iteration) - adj_file << " done." << endl; + adj_file << " done." << std::endl; // Add corrections to estimates. // If --output-adj-iter-stat argument is supplied or currentBlock @@ -4575,17 +4592,17 @@ void dna_adjust::AdjustPhasedReverseCombine() { isCombining_ = true; if (projectSettings_.g.verbose > 3) - debug_file << "Rigorous" << endl; + debug_file << "Rigorous" << std::endl; if (projectSettings_.o._adj_stn_iteration) if (!v_blockMeta_.at(currentBlock)._blockFirst) - adj_file << endl << left << "Adjusting block " << currentBlock+1 << " (reverse, rigorous)... "; + adj_file << std::endl << std::left << "Adjusting block " << currentBlock+1 << " (reverse, rigorous)... "; // Least Squares Solution SolveTry(true, currentBlock); if (projectSettings_.o._adj_stn_iteration) - adj_file << " done." << endl; + adj_file << " done." << std::endl; // shrink msr-comp and AtVinv by pseudomsrJSLCount from forward pass UpdateEstimatesCombine(currentBlock, pseudomsrJSLCount); @@ -4647,7 +4664,7 @@ void dna_adjust::AdjustPhasedReverse() if (projectSettings_.o._adj_stn_iteration) { - adj_file << endl << left << "Adjusting block " << currentBlock+1; + adj_file << std::endl << std::left << "Adjusting block " << currentBlock+1; if (!v_blockMeta_.at(currentBlock)._blockFirst) adj_file << " (reverse, in isolation)... "; else @@ -4662,13 +4679,13 @@ void dna_adjust::AdjustPhasedReverse() // variances are carried in the reverse direction below if (projectSettings_.g.verbose > 3) - debug_file << "In isolation" << endl; + debug_file << "In isolation" << std::endl; // Least Squares Solution SolveTry(true, currentBlock); if (projectSettings_.o._adj_stn_iteration) - adj_file << " done." << endl; + adj_file << " done." << std::endl; // Add corrections to estimates. // If --output-adj-iter-stat argument is supplied or currentBlock @@ -4728,11 +4745,11 @@ void dna_adjust::UpdateEstimatesReverse(const UINT32 currentBlock, bool MT_Rever #ifdef MULTI_THREAD_ADJUST if (projectSettings_.a.multi_thread) { - adj_file << endl << "2> Adjusted block " << currentBlock + 1; + adj_file << std::endl << "2> Adjusted block " << currentBlock + 1; if (v_blockMeta_.at(currentBlock)._blockFirst) - adj_file << " (reverse, rigorous) " << endl; + adj_file << " (reverse, rigorous) " << std::endl; else - adj_file << " (reverse, in isolation) " << endl; + adj_file << " (reverse, in isolation) " << std::endl; } #endif @@ -4851,7 +4868,7 @@ void dna_adjust::UpdateEstimatesFinal(const UINT32 currentBlock) #ifdef MULTI_THREAD_ADJUST adj_file_mutex.lock(); if (projectSettings_.a.multi_thread) - adj_file << endl << "3> Adjusted block " << currentBlock + 1 << " (rigorous)" << endl; + adj_file << std::endl << "3> Adjusted block " << currentBlock + 1 << " (rigorous)" << std::endl; #endif PrintAdjStations(adj_file, currentBlock, @@ -4938,7 +4955,7 @@ void dna_adjust::FillDesignNormalMeasurementsMatrices(bool buildnewMatrices, con // When a target direction is found, continue to next element. if (_it_msr->measType == 'D') - if (_it_msr->vectorCount1 < 1) + if (_it_msr->vectorCount2 < 1) continue; // Build AtVinv, Normals and Meas minus Comp vectors @@ -4973,7 +4990,7 @@ bool dna_adjust::InitialiseMeasurement(pit_vmsr_t _it_msr, bool buildnewMatrices void dna_adjust::UpdateDesignNormalMeasMatrices(pit_vmsr_t _it_msr, UINT32& design_row, bool buildnewMatrices, const UINT32& block, bool MT_ReverseOrCombine) { - stringstream ss; + std::stringstream ss; matrix_2d* estimatedStations(&v_estimatedStations_.at(block)); matrix_2d* design(&v_design_.at(block)); @@ -5087,80 +5104,80 @@ void dna_adjust::UpdateDesignNormalMeasMatrices(pit_vmsr_t _it_msr, UINT32& desi break; default: ss << "UpdateDesignNormalMeasMatrices(): Unknown measurement type - '" << - (*_it_msr)->measType << "'." << endl; + (*_it_msr)->measType << "'." << std::endl; SignalExceptionAdjustment(ss.str(), block); } } -void dna_adjust::PrintMsrVarianceMatrixException(const it_vmsr_t& _it_msr, const runtime_error& e, stringstream& ss, - const string& calling_function, const UINT32 msr_count) +void dna_adjust::PrintMsrVarianceMatrixException(const it_vmsr_t& _it_msr, const std::runtime_error& e, std::stringstream& ss, + const std::string& calling_function, const UINT32 msr_count) { it_vmsr_t _it_msr_temp(_it_msr); switch (_it_msr->measType) { case 'D': - ss << calling_function << "(): Cannot compute the" << endl << - " variance matrix for a round of " << msr_count << " directions commencing" << endl << + ss << calling_function << "(): Cannot compute the" << std::endl << + " variance matrix for a round of " << msr_count << " directions commencing" << std::endl << " with stations " << bstBinaryRecords_.at(_it_msr->station1).stationName << " and " << - bstBinaryRecords_.at(_it_msr->station2).stationName << ":" << endl; + bstBinaryRecords_.at(_it_msr->station2).stationName << ":" << std::endl; - ss << " ..." << endl << - " " << FormatDmsString(RadtoDms(_it_msr->term1), PRECISION_SEC_MSR, true, false) << "" << endl << - " ..." << endl << endl; + ss << " ..." << std::endl << + " " << FormatDmsString(RadtoDms(_it_msr->term1), PRECISION_SEC_MSR, true, false) << "" << std::endl << + " ..." << std::endl << std::endl; break; case 'G': - ss << calling_function << "(): Cannot invert the" << endl << + ss << calling_function << "(): Cannot invert the" << std::endl << " variance matrix for a GPS baseline between stations " << bstBinaryRecords_.at(_it_msr->station1).stationName << " and " << - bstBinaryRecords_.at(_it_msr->station2).stationName << ":" << endl; + bstBinaryRecords_.at(_it_msr->station2).stationName << ":" << std::endl; - ss << " ..." << endl << - " " << fixed << setprecision(PRECISION_MTR_MSR) << _it_msr_temp->term1 << "" << endl; + ss << " ..." << std::endl << + " " << std::fixed << std::setprecision(PRECISION_MTR_MSR) << _it_msr_temp->term1 << "" << std::endl; _it_msr_temp++; - ss << " " << fixed << setprecision(PRECISION_MTR_MSR) << _it_msr_temp->term1 << "" << endl; + ss << " " << std::fixed << std::setprecision(PRECISION_MTR_MSR) << _it_msr_temp->term1 << "" << std::endl; _it_msr_temp++; - ss << " " << fixed << setprecision(PRECISION_MTR_MSR) << _it_msr_temp->term1 << "" << endl << - " ..." << endl << endl; + ss << " " << std::fixed << std::setprecision(PRECISION_MTR_MSR) << _it_msr_temp->term1 << "" << std::endl << + " ..." << std::endl << std::endl; break; case 'X': - ss << calling_function << "(): Cannot invert the" << endl << - " variance matrix for a " << msr_count << "-baseline GPS baseline cluster commencing" << endl << + ss << calling_function << "(): Cannot invert the" << std::endl << + " variance matrix for a " << msr_count << "-baseline GPS baseline cluster commencing" << std::endl << " with stations " << bstBinaryRecords_.at(_it_msr->station1).stationName << " and " << - bstBinaryRecords_.at(_it_msr->station2).stationName << ":" << endl; + bstBinaryRecords_.at(_it_msr->station2).stationName << ":" << std::endl; - ss << " ..." << endl << - " " << fixed << setprecision(PRECISION_MTR_MSR) << _it_msr_temp->term1 << "" << endl; + ss << " ..." << std::endl << + " " << std::fixed << std::setprecision(PRECISION_MTR_MSR) << _it_msr_temp->term1 << "" << std::endl; _it_msr_temp++; - ss << " " << fixed << setprecision(PRECISION_MTR_MSR) << _it_msr_temp->term1 << "" << endl; + ss << " " << std::fixed << std::setprecision(PRECISION_MTR_MSR) << _it_msr_temp->term1 << "" << std::endl; _it_msr_temp++; - ss << " " << fixed << setprecision(PRECISION_MTR_MSR) << _it_msr_temp->term1 << "" << endl << - " ..." << endl << endl; + ss << " " << std::fixed << std::setprecision(PRECISION_MTR_MSR) << _it_msr_temp->term1 << "" << std::endl << + " ..." << std::endl << std::endl; break; case 'Y': - ss << calling_function << "(): Cannot invert the" << endl << - " variance matrix for a " << msr_count << "-station GPS point cluster commencing" << endl << - " with station " << bstBinaryRecords_.at(_it_msr->station1).stationName << ":" << endl; + ss << calling_function << "(): Cannot invert the" << std::endl << + " variance matrix for a " << msr_count << "-station GPS point cluster commencing" << std::endl << + " with station " << bstBinaryRecords_.at(_it_msr->station1).stationName << ":" << std::endl; - ss << " ..." << endl << - " " << fixed << setprecision(PRECISION_MTR_MSR) << _it_msr_temp->term1 << "" << endl; + ss << " ..." << std::endl << + " " << std::fixed << std::setprecision(PRECISION_MTR_MSR) << _it_msr_temp->term1 << "" << std::endl; _it_msr_temp++; - ss << " " << fixed << setprecision(PRECISION_MTR_MSR) << _it_msr_temp->term1 << "" << endl; + ss << " " << std::fixed << std::setprecision(PRECISION_MTR_MSR) << _it_msr_temp->term1 << "" << std::endl; _it_msr_temp++; - ss << " " << fixed << setprecision(PRECISION_MTR_MSR) << _it_msr_temp->term1 << "" << endl << - " ..." << endl << endl; + ss << " " << std::fixed << std::setprecision(PRECISION_MTR_MSR) << _it_msr_temp->term1 << "" << std::endl << + " ..." << std::endl << std::endl; break; } ss << - " Detailed description: " << e.what() << endl << - " Options: " << endl << - " - Check the validity of the variance matrix and any relevant " << endl << - " scalars and re-attempt the adjustment." << endl << - " - If this fails, set the ignore flag in the measurement file and re-import " << endl << - " the station and measurement files." << endl; - - adj_file << " " << ss.str() << endl; + " Detailed description: " << e.what() << std::endl << + " Options: " << std::endl << + " - Check the validity of the variance matrix and any relevant " << std::endl << + " scalars and re-attempt the adjustment." << std::endl << + " - If this fails, set the ignore flag in the measurement file and re-import " << std::endl << + " the station and measurement files." << std::endl; + + adj_file << " " << ss.str() << std::endl; adj_file.flush(); } @@ -5179,10 +5196,10 @@ void dna_adjust::LoadVarianceMatrix_D(it_vmsr_t _it_msr, matrix_2d* var_dirn, bo FormInverseVarianceMatrix(var_dirn, true); return; } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { // Print error message to adj file and throw exception - stringstream ss; + std::stringstream ss; PrintMsrVarianceMatrixException(_it_msr, e, ss, "LoadVarianceMatrix_D"); SignalExceptionAdjustment(ss.str(), 0); } @@ -5201,20 +5218,22 @@ void dna_adjust::LoadVarianceMatrix_D(it_vmsr_t _it_msr, matrix_2d* var_dirn, bo // scale1 = derived angle corrected for deflection of the vertical // scale2 = variance (angle) // scale3 = covariance (angle) + // vectorCount2 = number of non-ignored directions // preAdjMeas = original derived angle - UINT32 a, angle_count(_it_msr->vectorCount1 - 1); // number of directions excluding the RO + UINT32 a, angle_count(_it_msr->vectorCount2 - 1); // number of directions excluding the RO - matrix_2d A(angle_count, _it_msr->vectorCount1); - matrix_2d AV(angle_count, _it_msr->vectorCount1); + matrix_2d A(angle_count, _it_msr->vectorCount2); + matrix_2d AV(angle_count, _it_msr->vectorCount2); var_dirn->redim(angle_count, angle_count); var_dirn->zero(); double previousVariance(_it_msr->term2); + UINT32 skip(0), ignored(_it_msr->vectorCount1 - _it_msr->vectorCount2); if (projectSettings_.g.verbose > 5) - debug_file << endl << "Std dev " << scientific << setprecision(16) << _it_msr->term2 << " (" << fixed << setprecision(2) << Seconds(sqrt(_it_msr->term2)) << " seconds)" << endl; + debug_file << std::endl << "Std dev " << std::scientific << std::setprecision(16) << _it_msr->term2 << " (" << std::fixed << std::setprecision(2) << Seconds(sqrt(_it_msr->term2)) << " boost::posix_time::seconds)" << std::endl; _it_msr++; @@ -5222,6 +5241,18 @@ void dna_adjust::LoadVarianceMatrix_D(it_vmsr_t _it_msr, matrix_2d* var_dirn, bo try { for (a=0; aignore) + { + while (skip < ignored) + { + skip++; + _it_msr++; + if (!_it_msr->ignore) + break; + } + } + // Fill design & variance matrices to propagate variances from directions to angles A.put(a, a, -1); A.put(a, a+1, 1); @@ -5229,7 +5260,7 @@ void dna_adjust::LoadVarianceMatrix_D(it_vmsr_t _it_msr, matrix_2d* var_dirn, bo AV.put(a, a+1, _it_msr->term2); if (projectSettings_.g.verbose > 5) - debug_file << "Std dev " << scientific << setprecision(16) << _it_msr->term2 << " (" << fixed << setprecision(2) << Seconds(sqrt(_it_msr->term2)) << " seconds)" << endl; + debug_file << "Std dev " << std::scientific << std::setprecision(16) << _it_msr->term2 << " (" << std::fixed << std::setprecision(2) << Seconds(sqrt(_it_msr->term2)) << " boost::posix_time::seconds)" << std::endl; if (a+1 == angle_count) break; @@ -5240,9 +5271,9 @@ void dna_adjust::LoadVarianceMatrix_D(it_vmsr_t _it_msr, matrix_2d* var_dirn, bo if (projectSettings_.g.verbose > 6) { - debug_file << endl << "Directions variance matrix:" << endl; - debug_file << "A" << A << endl; - debug_file << "AV" << scientific << setprecision(16) << AV << endl; + debug_file << std::endl << "Directions variance matrix:" << std::endl; + debug_file << "A" << A << std::endl; + debug_file << "AV" << std::scientific << std::setprecision(16) << AV << std::endl; } // AVAT for correlated angles will not be a fully populated matrix, but a @@ -5266,26 +5297,26 @@ void dna_adjust::LoadVarianceMatrix_D(it_vmsr_t _it_msr, matrix_2d* var_dirn, bo SetDirectionsVarianceMatrix(_it_msr_first, *var_dirn); if (projectSettings_.g.verbose > 5) - debug_file << "V.dxyz " << scientific << setprecision(16) << setw(26) << var_dirn; + debug_file << "V.dxyz " << std::scientific << std::setprecision(16) << std::setw(26) << var_dirn; // Form inverse FormInverseVarianceMatrix(var_dirn); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { // Print error message to adj file and throw exception - stringstream ss; + std::stringstream ss; PrintMsrVarianceMatrixException(_it_msr_first, e, ss, "LoadVarianceMatrix_D"); SignalExceptionAdjustment(ss.str(), 0); } if (projectSettings_.g.verbose > 5) - debug_file << "Inv V.dxyz " << scientific << setprecision(16) << setw(26) << var_dirn; + debug_file << "Inv V.dxyz " << std::scientific << std::setprecision(16) << std::setw(26) << var_dirn; } bool dna_adjust::FormInverseVarianceMatrixReduced(it_vmsr_t _it_msr, matrix_2d* var_cart, - const string& method_name) + const std::string& method_name) { // Has the variance matrix already been reduced (i.e. propagated and scaled) if (bms_meta_.reduced) @@ -5296,10 +5327,10 @@ bool dna_adjust::FormInverseVarianceMatrixReduced(it_vmsr_t _it_msr, matrix_2d* FormInverseGPSVarianceMatrix(_it_msr, var_cart); return true; } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { // Print error message to adj file and throw exception - stringstream ss; + std::stringstream ss; PrintMsrVarianceMatrixException(_it_msr, e, ss, method_name); SignalExceptionAdjustment(ss.str(), 0); } @@ -5386,22 +5417,22 @@ void dna_adjust::LoadVarianceMatrix_G(it_vmsr_t _it_msr, matrix_2d* var_cart) if (boost::math::isnan(var_cart->get(0, 0)) || boost::math::isinf(var_cart->get(0, 0))) { - stringstream ss; - ss << "Invalid variance matrix:" << endl; - ss << setprecision(6) << fixed << *var_cart; + std::stringstream ss; + ss << "Invalid variance matrix:" << std::endl; + ss << std::setprecision(6) << std::fixed << *var_cart; SignalExceptionAdjustment(ss.str(), 0); } } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { // Print error message to adj file and throw exception - stringstream ss; + std::stringstream ss; PrintMsrVarianceMatrixException(_it_msr_first, e, ss, "LoadVarianceMatrix_G"); SignalExceptionAdjustment(ss.str(), 0); } if (projectSettings_.g.verbose > 5) - debug_file << endl << "Inv V.dxyz " << fixed << setprecision(16) << setw(26) << var_cart; + debug_file << std::endl << "Inv V.dxyz " << std::fixed << std::setprecision(16) << std::setw(26) << var_cart; } @@ -5527,22 +5558,22 @@ void dna_adjust::LoadVarianceMatrix_X(it_vmsr_t _it_msr, matrix_2d* var_cart) if (boost::math::isnan(var_cart->get(0, 0)) || boost::math::isinf(var_cart->get(0, 0))) { - stringstream ss; - ss << "Invalid variance matrix:" << endl; - ss << setprecision(6) << fixed << *var_cart; + std::stringstream ss; + ss << "Invalid variance matrix:" << std::endl; + ss << std::setprecision(6) << std::fixed << *var_cart; SignalExceptionAdjustment(ss.str(), 0); } } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { // Print error message to adj file and throw exception - stringstream ss; + std::stringstream ss; PrintMsrVarianceMatrixException(_it_msr_first, e, ss, "LoadVarianceMatrix_X", baseline_count); SignalExceptionAdjustment(ss.str(), 0); } if (projectSettings_.g.verbose > 5) - debug_file << endl << "Inv V.dxyz " << fixed << setprecision(16) << setw(26) << var_cart; + debug_file << std::endl << "Inv V.dxyz " << std::fixed << std::setprecision(16) << std::setw(26) << var_cart; } @@ -5755,22 +5786,22 @@ void dna_adjust::LoadVarianceMatrix_Y(it_vmsr_t _it_msr, matrix_2d* var_cart, co if (boost::math::isnan(var_cart->get(0, 0)) || boost::math::isinf(var_cart->get(0, 0))) { - stringstream ss; - ss << "Invalid variance matrix:" << endl; - ss << setprecision(6) << fixed << *var_cart; + std::stringstream ss; + ss << "Invalid variance matrix:" << std::endl; + ss << std::setprecision(6) << std::fixed << *var_cart; SignalExceptionAdjustment(ss.str(), 0); } } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { // Print error message to adj file and throw exception - stringstream ss; + std::stringstream ss; PrintMsrVarianceMatrixException(_it_msr_first, e, ss, "LoadVarianceMatrix_Y", point_count); SignalExceptionAdjustment(ss.str(), 0); } if (projectSettings_.g.verbose > 5) - debug_file << endl << "Inv V.dxyz " << fixed << setprecision(16) << setw(26) << var_cart; + debug_file << std::endl << "Inv V.dxyz " << std::fixed << std::setprecision(16) << std::setw(26) << var_cart; } @@ -5838,11 +5869,11 @@ void dna_adjust::AddMsrtoMeasMinusComp(pit_vmsr_t _it_msr, const UINT32& design_ if (printBlock) debug_file << bstBinaryRecords_.at((*_it_msr)->station1).stationName << " - " << bstBinaryRecords_.at((*_it_msr)->station2).stationName; - debug_file << endl; - debug_file << "d" << (*_it_msr)->measType << " " << fixed << setprecision(16) << setw(26) << + debug_file << std::endl; + debug_file << "d" << (*_it_msr)->measType << " " << std::fixed << std::setprecision(16) << std::setw(26) << mmc << - " = " << setw(26) << (*_it_msr)->term1 << - " - " << setw(26) << comp_msr << " "; + " = " << std::setw(26) << (*_it_msr)->term1 << + " - " << std::setw(26) << comp_msr << " "; } } @@ -6182,7 +6213,8 @@ void dna_adjust::UpdateDesignNormalMeasMatrices_D(pit_vmsr_t _it_msr, UINT32& de it_vmsr_t _it_msr_first(*_it_msr); UINT32 design_row_begin(design_row); - UINT32 a, angle_count((*_it_msr)->vectorCount1 - 1); // number of directions excluding the RO + UINT32 a, angle_count((*_it_msr)->vectorCount2 - 1); // number of directions excluding the RO + UINT32 skip(0), ignored((*_it_msr)->vectorCount1 - (*_it_msr)->vectorCount2); vmsr_t angleRec; angleRec.push_back(*(*_it_msr)); @@ -6201,6 +6233,7 @@ void dna_adjust::UpdateDesignNormalMeasMatrices_D(pit_vmsr_t _it_msr, UINT32& de // scale2 = variance (angle) // scale3 = covariance (angle) - for the context of vmsr_t angleRec only, so as to // properly form the normals from covariances formed from directions SDs + // vectorCount2 = number of non-ignored directions // preAdjMeas = original derived angle if (projectSettings_.g.verbose > 6) @@ -6210,6 +6243,18 @@ void dna_adjust::UpdateDesignNormalMeasMatrices_D(pit_vmsr_t _it_msr, UINT32& de { for (a=0; aignore) + { + while (skip < ignored) + { + skip++; + (*_it_msr)++; + if (!(*_it_msr)->ignore) + break; + } + } + it_angle->station3 = (*_it_msr)->station2; if (buildnewMatrices) @@ -6230,10 +6275,10 @@ void dna_adjust::UpdateDesignNormalMeasMatrices_D(pit_vmsr_t _it_msr, UINT32& de if (projectSettings_.g.verbose > 6) { - debug_file << endl << "angle " << + debug_file << std::endl << "angle " << StringFromT(RadtoDms(it_angle->term1), 6) << " = " << StringFromT(RadtoDms((*_it_msr)->term1), 6) << " - " << - StringFromT(RadtoDms(previousDirection), 6) << endl; + StringFromT(RadtoDms(previousDirection), 6) << std::endl; } } } @@ -6255,8 +6300,13 @@ void dna_adjust::UpdateDesignNormalMeasMatrices_D(pit_vmsr_t _it_msr, UINT32& de (*_it_msr)->preAdjCorr = it_angle->preAdjCorr; } - if (a+1 == angle_count) + if (a + 1 == angle_count) + { + // check for any ignored directions + if (_it_msr_first->vectorCount1 != _it_msr_first->vectorCount2) + (*_it_msr) = _it_msr_first + _it_msr_first->vectorCount1; break; + } if (buildnewMatrices) previousDirection = (*_it_msr)->term1; @@ -6272,9 +6322,9 @@ void dna_adjust::UpdateDesignNormalMeasMatrices_D(pit_vmsr_t _it_msr, UINT32& de catch (...) { // Print error message to adj file and throw exception - stringstream ss; - ss << "UpdateDesignNormalMeasMatrices_D(): An error was encountered whilst" << endl << - " updating the normal matrices" << endl; + std::stringstream ss; + ss << "UpdateDesignNormalMeasMatrices_D(): An error was encountered whilst" << std::endl << + " updating the normal matrices" << std::endl; SignalExceptionAdjustment(ss.str(), block); } @@ -6293,7 +6343,7 @@ void dna_adjust::UpdateDesignNormalMeasMatrices_D(pit_vmsr_t _it_msr, UINT32& de AtVinv->zero(0, design_row, AtVinv->rows(), angle_count); if (!buildnewMatrices) - debug_file << "block " << block + 1 << ", design_row " << design_row + 1 << ", directions var" << var_dirn << endl; + debug_file << "block " << block + 1 << ", design_row " << design_row + 1 << ", directions var" << var_dirn << std::endl; // Update AtVinv based on new design matrix elements for (a=0; a 5) - debug_file << endl; + debug_file << std::endl; } matrix_2d var_cart(baseline_count * 3, baseline_count * 3); @@ -7188,7 +7238,7 @@ void dna_adjust::UpdateDesignNormalMeasMatrices_X(pit_vmsr_t _it_msr, UINT32& de baseline_stations.push_back(GetBlkMatrixElemStn1(block, &_it_msr_temp)); baseline_stations.push_back(GetBlkMatrixElemStn2(block, &_it_msr_temp)); - sort(baseline_stations.begin(), baseline_stations.end()); + std::sort(baseline_stations.begin(), baseline_stations.end()); covc = baseline_count * 3; matrix_2d tmp(3, covc); @@ -7203,13 +7253,13 @@ void dna_adjust::UpdateDesignNormalMeasMatrices_X(pit_vmsr_t _it_msr, UINT32& de if (!binary_search(baseline_stations.begin(), baseline_stations.end(), stn1)) { baseline_stations.push_back(stn1); - sort(baseline_stations.begin(), baseline_stations.end()); + std::sort(baseline_stations.begin(), baseline_stations.end()); } if (!binary_search(baseline_stations.begin(), baseline_stations.end(), stn2)) { baseline_stations.push_back(stn2); - sort(baseline_stations.begin(), baseline_stations.end()); + std::sort(baseline_stations.begin(), baseline_stations.end()); } covr = cluster_bsl * 3; @@ -7718,7 +7768,7 @@ void dna_adjust::SolveTry(bool COMPUTE_INVERSE, const UINT32& block) try { Solve(COMPUTE_INVERSE, block); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { // debug matrices if required debug_SolutionInformation(block); @@ -7775,9 +7825,9 @@ void dna_adjust::Solve(bool COMPUTE_INVERSE, const UINT32& block) if (boost::math::isnan(v_normals_.at(block).get(0, 0)) || boost::math::isinf(v_normals_.at(block).get(0, 0))) { - stringstream ss; - ss << "Solve(): Invalid variance matrix:" << endl; - ss << setprecision(6) << fixed << v_normals_.at(block); + std::stringstream ss; + ss << "Solve(): Invalid variance matrix:" << std::endl; + ss << std::setprecision(6) << std::fixed << v_normals_.at(block); SignalExceptionAdjustment(ss.str(), 0); } @@ -7802,8 +7852,8 @@ void dna_adjust::Solve(bool COMPUTE_INVERSE, const UINT32& block) debug_file << "Block " << block + 1; if (projectSettings_.a.adjust_mode != SimultaneousMode) debug_file << (forward_ ? " (Forward)" : " (Reverse)"); - debug_file << endl; - debug_file << "Precisions" << fixed << setprecision(16) << v_normals_.at(block) << endl; + debug_file << std::endl; + debug_file << "Precisions" << std::fixed << std::setprecision(16) << v_normals_.at(block) << std::endl; } // compute weighted "measured minus computed" @@ -7849,18 +7899,18 @@ void dna_adjust::Solve(bool COMPUTE_INVERSE, const UINT32& block) break; } - debug_file << endl; + debug_file << std::endl; debug_file << "Block " << block + 1; if (projectSettings_.a.adjust_mode != SimultaneousMode) debug_file << (forward_ ? " (Forward)" : " (Reverse)"); - debug_file << endl; - debug_file << "Weighted measurements" << fixed << setprecision(16) << At_Vinv_m << endl; + debug_file << std::endl; + debug_file << "Weighted measurements" << std::fixed << std::setprecision(16) << At_Vinv_m << std::endl; debug_file << "Block " << block + 1; if (projectSettings_.a.adjust_mode != SimultaneousMode) debug_file << (forward_ ? " (Forward)" : " (Reverse)"); - debug_file << endl; - debug_file << "Corrections" << fixed << setprecision(16) << v_corrections_.at(block) << endl; + debug_file << std::endl; + debug_file << "Corrections" << std::fixed << std::setprecision(16) << v_corrections_.at(block) << std::endl; debug_file.flush(); #ifdef MULTI_THREAD_ADJUST @@ -7904,11 +7954,11 @@ void dna_adjust::DeSerialiseAdjustedVarianceMatrices() SetMapRegions(2, sf_rigorous_vars, sf_prec_adj_msrs); } - catch (interprocess_exception& e){ - stringstream ss; - ss << "DeSerialiseAdjustedVarianceMatrices() terminated while creating memory map" << endl; - ss << " regions from mtx file. Details:\n " << e.what() << endl; - adj_file << endl << "- Error: " << ss.str() << endl; + catch (boost::interprocess::interprocess_exception& e){ + std::stringstream ss; + ss << "DeSerialiseAdjustedVarianceMatrices() terminated while creating memory map" << std::endl; + ss << " regions from mtx file. Details:\n " << e.what() << std::endl; + adj_file << std::endl << "- Error: " << ss.str() << std::endl; SignalExceptionAdjustment(ss.str(), 0); } @@ -8021,10 +8071,10 @@ void dna_adjust::ComputeTestStat(const double& dof, double& chiUpper, double& ch try { // chi_squared throws when dof == 0 - chi_squared dist(dof); + boost::math::chi_squared dist(dof); - chiUpper = quantile(complement(dist, conf)) / degreesofFreedom_; - chiLower = quantile(dist, conf) / degreesofFreedom_; + chiUpper = boost::math::quantile(boost::math::complement(dist, conf)) / degreesofFreedom_; + chiLower = boost::math::quantile(dist, conf) / degreesofFreedom_; switch (projectSettings_.a.adjust_mode) { @@ -8049,11 +8099,11 @@ void dna_adjust::ComputeTestStat(const double& dof, double& chiUpper, double& ch // just print message to output files if (projectSettings_.g.verbose > 0) - debug_file << endl << "ComputeTestStat():\n " << e.what() << endl; + debug_file << std::endl << "ComputeTestStat():\n " << e.what() << std::endl; if (projectSettings_.g.verbose > 0) if (dof == 0) - adj_file << endl << "Cannot perform chi-square test with zero degrees of freedom." << endl << endl; + adj_file << std::endl << "Cannot perform chi-square test with zero degrees of freedom." << std::endl << std::endl; passFail = test_stat_fail; } @@ -8078,7 +8128,7 @@ void dna_adjust::ComputeBlockTestStat(const UINT32& block) v_sigmaZero_.at(block), passFail); - // vector is a specialisation, and as such the value + // std::vector is a specialisation, and as such the value // returned from at() is not a bool, but a wrapper around a value v_passFail_.at(block) = passFail; } @@ -8131,13 +8181,26 @@ void dna_adjust::ComputeAdjustedMsrPrecisions() void dna_adjust::UpdateMsrTstatistic_D(it_vmsr_t& _it_msr) { - UINT32 a, angle_count(_it_msr->vectorCount1 - 1); + UINT32 a, angle_count(_it_msr->vectorCount2 - 1); + UINT32 skip(0), ignored(_it_msr->vectorCount1 - _it_msr->vectorCount2); // move to first direction record which contains the derived angles _it_msr++; for (a=0; aignore) + { + while (skip < ignored) + { + skip++; + _it_msr++; + if (!_it_msr->ignore) + break; + } + } + if (fabs(sigmaZeroSqRt_ - 0.0) < PRECISION_1E10) _it_msr->TStat = 0.0; else @@ -8477,7 +8540,7 @@ void dna_adjust::ComputeChiSquarePhased(const UINT32& block) } -void dna_adjust::OutputLargestCorrection(string& formatted_msg) +void dna_adjust::OutputLargestCorrection(std::string& formatted_msg) { UINT32 stnIndex(0), x_coordElement(0); @@ -8487,7 +8550,7 @@ void dna_adjust::OutputLargestCorrection(string& formatted_msg) sf_corrections); // print maximum correction - adj_file << setw(PRINT_VAR_PAD) << left << "Maximum station correction"; + adj_file << std::setw(PRINT_VAR_PAD) << std::left << "Maximum station correction"; // which station? stnIndex = (UINT32)floor(v_corrections_.at(blockLargeCorr_).maxvalueRow() / 3.); @@ -8507,7 +8570,7 @@ void dna_adjust::OutputLargestCorrection(string& formatted_msg) break; } - adj_file << endl << setw(PRINT_VAR_PAD) << " "; + adj_file << std::endl << std::setw(PRINT_VAR_PAD) << " "; // calculate error vector in local reference frame matrix_2d cart(3, 1), local(3, 1); @@ -8539,31 +8602,31 @@ void dna_adjust::OutputLargestCorrection(string& formatted_msg) double largestCorr = local.compute_maximum_value(); if (fabs(largestCorr) > 0.000999) - adj_file << fixed << setprecision(3) << + adj_file << std::fixed << std::setprecision(3) << local.get(0, 0) << ", " << local.get(1, 0) << ", " << local.get(2, 0); else if (fabs(largestCorr) > 0.00009) - adj_file << fixed << setprecision(4) << + adj_file << std::fixed << std::setprecision(4) << local.get(0, 0) << ", " << local.get(1, 0) << ", " << local.get(2, 0); else - adj_file << scientific << setprecision(1) << + adj_file << std::scientific << std::setprecision(1) << local.get(0, 0) << ", " << local.get(1, 0) << ", " << local.get(2, 0); - adj_file << " (e, n, up)" << endl << endl; + adj_file << " (e, n, up)" << std::endl << std::endl; - stringstream ss; - ss << fixed << setprecision(PRECISION_MTR_STN) << local.get(local.maxvalueRow(), 0) << " "; + std::stringstream ss; + ss << std::fixed << std::setprecision(PRECISION_MTR_STN) << local.get(local.maxvalueRow(), 0) << " "; switch (local.maxvalueRow()) { case 0: - ss << setw(2) << left << "e"; + ss << std::setw(2) << std::left << "e"; break; case 1: - ss << setw(2) << left << "n"; + ss << std::setw(2) << std::left << "n"; break; case 2: - ss << setw(2) << left << "up"; + ss << std::setw(2) << std::left << "up"; break; } @@ -8574,12 +8637,12 @@ void dna_adjust::OutputLargestCorrection(string& formatted_msg) void dna_adjust::PrintStatistics(bool printPelzer) { // print statistics - adj_file << setw(PRINT_VAR_PAD) << left << "Number of unknown parameters" << fixed << setprecision(0) << unknownParams_; + adj_file << std::setw(PRINT_VAR_PAD) << std::left << "Number of unknown parameters" << std::fixed << std::setprecision(0) << unknownParams_; if (allStationsFixed_) adj_file << " (All stations held constrained)"; - adj_file << endl; + adj_file << std::endl; - adj_file << setw(PRINT_VAR_PAD) << left << "Number of measurements" << fixed << setprecision(0) << measurementParams_; + adj_file << std::setw(PRINT_VAR_PAD) << std::left << "Number of measurements" << std::fixed << std::setprecision(0) << measurementParams_; if (potentialOutlierCount_ > 0) { adj_file << " (" << potentialOutlierCount_ << " potential outlier"; @@ -8587,25 +8650,25 @@ void dna_adjust::PrintStatistics(bool printPelzer) adj_file << "s"; adj_file << ")"; } - adj_file << endl; - adj_file << setw(PRINT_VAR_PAD) << left << "Degrees of freedom" << fixed << setprecision(0) << degreesofFreedom_ << endl; - adj_file << setw(PRINT_VAR_PAD) << left << "Chi squared" << fixed << setprecision(2) << chiSquared_ << endl; - adj_file << setw(PRINT_VAR_PAD) << left << "Rigorous Sigma Zero" << fixed << setprecision(3) << sigmaZero_ << endl; + adj_file << std::endl; + adj_file << std::setw(PRINT_VAR_PAD) << std::left << "Degrees of freedom" << std::fixed << std::setprecision(0) << degreesofFreedom_ << std::endl; + adj_file << std::setw(PRINT_VAR_PAD) << std::left << "Chi squared" << std::fixed << std::setprecision(2) << chiSquared_ << std::endl; + adj_file << std::setw(PRINT_VAR_PAD) << std::left << "Rigorous Sigma Zero" << std::fixed << std::setprecision(3) << sigmaZero_ << std::endl; if (printPelzer) - adj_file << setw(PRINT_VAR_PAD) << left << "Global (Pelzer) Reliability" << fixed << setw(8) << setprecision(3) << globalPelzerReliability_ << - "(excludes non redundant measurements)" << endl; + adj_file << std::setw(PRINT_VAR_PAD) << std::left << "Global (Pelzer) Reliability" << std::fixed << std::setw(8) << std::setprecision(3) << globalPelzerReliability_ << + "(excludes non redundant measurements)" << std::endl; - adj_file << endl; + adj_file << std::endl; - stringstream ss(""); - ss << "Chi-Square test (" << setprecision (1) << fixed << projectSettings_.a.confidence_interval << "%)"; - adj_file << setw(PRINT_VAR_PAD) << left << ss.str(); + std::stringstream ss(""); + ss << "Chi-Square test (" << std::setprecision(1) << std::fixed << projectSettings_.a.confidence_interval << "%)"; + adj_file << std::setw(PRINT_VAR_PAD) << std::left << ss.str(); ss.str(""); - ss << fixed << setprecision(3) << + ss << std::fixed << std::setprecision(3) << chiSquaredLowerLimit_ << " < " << sigmaZero_ << " < " << chiSquaredUpperLimit_; - adj_file << setw(CHISQRLIMITS) << left << ss.str(); + adj_file << std::setw(CHISQRLIMITS) << std::left << ss.str(); ss.str(""); if (degreesofFreedom_ < 1) @@ -8627,7 +8690,7 @@ void dna_adjust::PrintStatistics(bool printPelzer) } ss << " ***"; } - adj_file << setw(PASS_FAIL) << right << ss.str() << endl << endl; + adj_file << std::setw(PASS_FAIL) << std::right << ss.str() << std::endl << std::endl; } @@ -8714,9 +8777,9 @@ void dna_adjust::ComputePrecisionAdjMsrs(const UINT32& block /*= 0*/) aposterioriVariances, design_row, precadjmsr_row); break; default: - stringstream ss; - ss << "ComputePrecisionAdjMsrs(): Unknown measurement type - '" << static_cast(&(_it_msr->measType)) << - "'." << endl; + std::stringstream ss; + ss << "ComputePrecisionAdjMsrs(): Unknown measurement type - '" << static_cast(&(_it_msr->measType)) << + "'." << std::endl; SignalExceptionAdjustment(ss.str(), block); } } @@ -8764,8 +8827,9 @@ void dna_adjust::ComputePrecisionAdjMsrs_D(const UINT32& block, it_vmsr_t& _it_m UINT32& design_row, UINT32& precadjmsr_row) { UINT32 stn1, stn2, stn3; - UINT32 a, angle_count(_it_msr->vectorCount1 - 1); // number of directions excluding the RO - + UINT32 a, angle_count(_it_msr->vectorCount2 - 1); // number of directions excluding the RO + UINT32 skip(0), ignored(_it_msr->vectorCount1 - _it_msr->vectorCount2); + for (a=0; aignore) + { + while (skip < ignored) + { + skip++; + _it_msr++; + if (!_it_msr->ignore) + break; + } + } + stn3 = GetBlkMatrixElemStn2(block, &_it_msr); ComputePrecisionAdjMsrs_A(block, stn1, stn2, stn3, @@ -8955,13 +9032,26 @@ void dna_adjust::UpdateMsrRecords(const UINT32& block) // store adjusted measurements and corrections void dna_adjust::UpdateMsrRecords_D(const UINT32& block, it_vmsr_t& _it_msr, UINT32& msr_row, UINT32& precadjmsr_row) { - UINT32 a, angle_count(_it_msr->vectorCount1 - 1); - + UINT32 a, angle_count(_it_msr->vectorCount2 - 1); + UINT32 skip(0), ignored(_it_msr->vectorCount1 - _it_msr->vectorCount2); + // move to first direction record which contains the derived angles _it_msr++; for (a=0; aignore) + { + while (skip < ignored) + { + skip++; + _it_msr++; + if (!_it_msr->ignore) + break; + } + } + UpdateMsrRecord(block, _it_msr, msr_row, precadjmsr_row, _it_msr->scale2); _it_msr++; msr_row++; @@ -9182,13 +9272,26 @@ void dna_adjust::ComputeGlobalPelzer() // Compute Pelzer's global reliability void dna_adjust::ComputeGlobalPelzer_D(it_vmsr_t& _it_msr, UINT32& numMsr, double& sum) { - UINT32 a, angle_count(_it_msr->vectorCount1 - 1); + UINT32 a, angle_count(_it_msr->vectorCount2 - 1); + UINT32 skip(0), ignored(_it_msr->vectorCount1 - _it_msr->vectorCount2); // move to first direction record which contains the derived angles _it_msr++; for (a=0; aignore) + { + while (skip < ignored) + { + skip++; + _it_msr++; + if (!_it_msr->ignore) + break; + } + } + if (_it_msr->PelzerRel > 0. && _it_msr->PelzerRel < UNRELIABLE) { sum += (_it_msr->PelzerRel * _it_msr->PelzerRel - 1.); @@ -9248,13 +9351,26 @@ void dna_adjust::ComputeChiSquare_ABCEHIJKLMPQRSVZ(const it_vmsr_t& _it_msr, UIN void dna_adjust::ComputeChiSquare_D(it_vmsr_t& _it_msr, UINT32& measurement_index, matrix_2d* measMinusComp) { - UINT32 a, angle_count(_it_msr->vectorCount1 - 1); + UINT32 a, angle_count(_it_msr->vectorCount2 - 1); + UINT32 skip(0), ignored(_it_msr->vectorCount1 - _it_msr->vectorCount2); // move to first direction record which contains the derived angles _it_msr++; for (a=0; aignore) + { + while (skip < ignored) + { + skip++; + _it_msr++; + if (!_it_msr->ignore) + break; + } + } + chiSquared_ += measMinusComp->get(measurement_index, 0) * measMinusComp->get(measurement_index, 0) / _it_msr->scale2; //variance (angle) @@ -9380,7 +9496,7 @@ void dna_adjust::OpenOutputFileStreams() // Create adj file. Throws runtime_error on failure. file_opener(adj_file, projectSettings_.o._adj_file); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionAdjustment(e.what(), 0); } @@ -9388,7 +9504,7 @@ void dna_adjust::OpenOutputFileStreams() // Create xyz file. Throws runtime_error on failure. file_opener(xyz_file, projectSettings_.o._xyz_file); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionAdjustment(e.what(), 0); } @@ -9397,7 +9513,7 @@ void dna_adjust::OpenOutputFileStreams() #endif if (projectSettings_.g.verbose > 0) { - string debug_output_file = + std::string debug_output_file = projectSettings_.g.output_folder + FOLDER_SLASH + projectSettings_.g.network_name; switch (projectSettings_.a.adjust_mode) @@ -9427,7 +9543,7 @@ void dna_adjust::OpenOutputFileStreams() // Create debug file. Throws runtime_error on failure. file_opener(debug_file, debug_output_file); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionAdjustment(e.what(), 0); } } @@ -9449,103 +9565,103 @@ void dna_adjust::PrintOutputFileHeaderInfo() // Print formatted header print_file_header(xyz_file, "DYNADJUST COORDINATE OUTPUT FILE"); - adj_file << setw(PRINT_VAR_PAD) << left << "File name:" << system_complete(projectSettings_.o._adj_file).string() << endl << endl; - xyz_file << setw(PRINT_VAR_PAD) << left << "File name:" << system_complete(projectSettings_.o._xyz_file).string() << endl << endl; + adj_file << std::setw(PRINT_VAR_PAD) << std::left << "File name:" << boost::filesystem::system_complete(projectSettings_.o._adj_file).string() << std::endl << std::endl; + xyz_file << std::setw(PRINT_VAR_PAD) << std::left << "File name:" << boost::filesystem::system_complete(projectSettings_.o._xyz_file).string() << std::endl << std::endl; - adj_file << setw(PRINT_VAR_PAD) << left << "Command line arguments: "; - adj_file << projectSettings_.a.command_line_arguments << endl << endl; + adj_file << std::setw(PRINT_VAR_PAD) << std::left << "Command line arguments: "; + adj_file << projectSettings_.a.command_line_arguments << std::endl << std::endl; if (projectSettings_.i.input_files.empty()) { - adj_file << setw(PRINT_VAR_PAD) << left << "Stations file:" << system_complete(projectSettings_.a.bst_file).string() << endl; - adj_file << setw(PRINT_VAR_PAD) << left << "Measurements file:" << system_complete(projectSettings_.a.bms_file).string() << endl; + adj_file << std::setw(PRINT_VAR_PAD) << std::left << "Stations file:" << boost::filesystem::system_complete(projectSettings_.a.bst_file).string() << std::endl; + adj_file << std::setw(PRINT_VAR_PAD) << std::left << "Measurements file:" << boost::filesystem::system_complete(projectSettings_.a.bms_file).string() << std::endl; } else { _it_vstr _it_files(projectSettings_.i.input_files.begin()); - string s("Input files:"); + std::string s("Input files:"); while (_it_files!=projectSettings_.i.input_files.end()) { - adj_file << setw(PRINT_VAR_PAD) << left << s << *_it_files++ << endl; + adj_file << std::setw(PRINT_VAR_PAD) << std::left << s << *_it_files++ << std::endl; s = " "; } } // Reference frame - adj_file << setw(PRINT_VAR_PAD) << left << "Reference frame: " << datum_.GetName() << endl; - xyz_file << setw(PRINT_VAR_PAD) << left << "Reference frame: " << datum_.GetName() << endl; - adj_file << setw(PRINT_VAR_PAD) << left << "Epoch: " << datum_.GetEpoch_s() << endl; - xyz_file << setw(PRINT_VAR_PAD) << left << "Epoch: " << datum_.GetEpoch_s() << endl; + adj_file << std::setw(PRINT_VAR_PAD) << std::left << "Reference frame: " << datum_.GetName() << std::endl; + xyz_file << std::setw(PRINT_VAR_PAD) << std::left << "Reference frame: " << datum_.GetName() << std::endl; + adj_file << std::setw(PRINT_VAR_PAD) << std::left << "Epoch: " << datum_.GetEpoch_s() << std::endl; + xyz_file << std::setw(PRINT_VAR_PAD) << std::left << "Epoch: " << datum_.GetEpoch_s() << std::endl; // Geoid model - adj_file << setw(PRINT_VAR_PAD) << left << "Geoid model: " << system_complete(projectSettings_.n.ntv2_geoid_file).string() << endl; - xyz_file << setw(PRINT_VAR_PAD) << left << "Geoid model: " << system_complete(projectSettings_.n.ntv2_geoid_file).string() << endl; + adj_file << std::setw(PRINT_VAR_PAD) << std::left << "Geoid model: " << boost::filesystem::system_complete(projectSettings_.n.ntv2_geoid_file).string() << std::endl; + xyz_file << std::setw(PRINT_VAR_PAD) << std::left << "Geoid model: " << boost::filesystem::system_complete(projectSettings_.n.ntv2_geoid_file).string() << std::endl; switch (projectSettings_.a.adjust_mode) { case PhasedMode: case Phased_Block_1Mode: - adj_file << setw(PRINT_VAR_PAD) << left << "Segmentation file:" << projectSettings_.a.seg_file << endl; + adj_file << std::setw(PRINT_VAR_PAD) << std::left << "Segmentation file:" << projectSettings_.a.seg_file << std::endl; } - adj_file << setw(PRINT_VAR_PAD) << left << "Constrained Station S.D. (m):" << projectSettings_.a.fixed_std_dev << endl; - adj_file << setw(PRINT_VAR_PAD) << left << "Free Station S.D. (m):" << projectSettings_.a.free_std_dev << endl; - adj_file << setw(PRINT_VAR_PAD) << left << "Iteration threshold:" << projectSettings_.a.iteration_threshold << endl; - adj_file << setw(PRINT_VAR_PAD) << left << "Maximum iterations:" << setprecision(0) << fixed << projectSettings_.a.max_iterations << endl; - adj_file << setw(PRINT_VAR_PAD) << left << "Test confidence interval:" << setprecision(1) << fixed << projectSettings_.a.confidence_interval << "%" << endl; - adj_file << setw(PRINT_VAR_PAD) << left << "Uncertainties SD(e,n,up):" << setprecision(1) << "68.3% (1 sigma)" << endl; + adj_file << std::setw(PRINT_VAR_PAD) << std::left << "Constrained Station S.D. (m):" << projectSettings_.a.fixed_std_dev << std::endl; + adj_file << std::setw(PRINT_VAR_PAD) << std::left << "Free Station S.D. (m):" << projectSettings_.a.free_std_dev << std::endl; + adj_file << std::setw(PRINT_VAR_PAD) << std::left << "Iteration threshold:" << projectSettings_.a.iteration_threshold << std::endl; + adj_file << std::setw(PRINT_VAR_PAD) << std::left << "Maximum iterations:" << std::setprecision(0) << std::fixed << projectSettings_.a.max_iterations << std::endl; + adj_file << std::setw(PRINT_VAR_PAD) << std::left << "Test confidence interval:" << std::setprecision(1) << std::fixed << projectSettings_.a.confidence_interval << "%" << std::endl; + adj_file << std::setw(PRINT_VAR_PAD) << std::left << "Uncertainties SD(e,n,up):" << std::setprecision(1) << "68.3% (1 sigma)" << std::endl; if (!projectSettings_.a.station_constraints.empty()) - adj_file << setw(PRINT_VAR_PAD) << left << "Station constraints:" << projectSettings_.a.station_constraints << endl; + adj_file << std::setw(PRINT_VAR_PAD) << std::left << "Station constraints:" << projectSettings_.a.station_constraints << std::endl; trimstr(projectSettings_.a.comments); - adj_file << setw(PRINT_VAR_PAD) << left << "Station coordinate types:"; - xyz_file << setw(PRINT_VAR_PAD) << left << "Station coordinate types:"; + adj_file << std::setw(PRINT_VAR_PAD) << std::left << "Station coordinate types:"; + xyz_file << std::setw(PRINT_VAR_PAD) << std::left << "Station coordinate types:"; - adj_file << projectSettings_.o._stn_coord_types << endl; - xyz_file << projectSettings_.o._stn_coord_types << endl; + adj_file << projectSettings_.o._stn_coord_types << std::endl; + xyz_file << projectSettings_.o._stn_coord_types << std::endl; - adj_file << setw(PRINT_VAR_PAD) << left << "Stations printed in blocks:"; - xyz_file << setw(PRINT_VAR_PAD) << left << "Stations printed in blocks:"; + adj_file << std::setw(PRINT_VAR_PAD) << std::left << "Stations printed in blocks:"; + xyz_file << std::setw(PRINT_VAR_PAD) << std::left << "Stations printed in blocks:"; if (projectSettings_.a.adjust_mode != SimultaneousMode && projectSettings_.o._output_stn_blocks) { - adj_file << "Yes" << endl; - xyz_file << "Yes" << endl; + adj_file << "Yes" << std::endl; + xyz_file << "Yes" << std::endl; } else { - adj_file << "No" << endl; - xyz_file << "No" << endl; + adj_file << "No" << std::endl; + xyz_file << "No" << std::endl; } if (projectSettings_.o._stn_corr) { - adj_file << setw(PRINT_VAR_PAD) << left << "Station coordinate corrections:" << - "Yes" << endl; - xyz_file << setw(PRINT_VAR_PAD) << left << "Station coordinate corrections:" << - "Yes" << endl; + adj_file << std::setw(PRINT_VAR_PAD) << std::left << "Station coordinate corrections:" << + "Yes" << std::endl; + xyz_file << std::setw(PRINT_VAR_PAD) << std::left << "Station coordinate corrections:" << + "Yes" << std::endl; } if (projectSettings_.o._apply_type_b_file || projectSettings_.o._apply_type_b_global) { if (projectSettings_.o._apply_type_b_global) { - adj_file << setw(PRINT_VAR_PAD) << left << "Type B uncertainties:" << - projectSettings_.a.type_b_global << endl; - xyz_file << setw(PRINT_VAR_PAD) << left << "Type B uncertainties:" << - projectSettings_.a.type_b_global << endl; + adj_file << std::setw(PRINT_VAR_PAD) << std::left << "Type B uncertainties:" << + projectSettings_.a.type_b_global << std::endl; + xyz_file << std::setw(PRINT_VAR_PAD) << std::left << "Type B uncertainties:" << + projectSettings_.a.type_b_global << std::endl; } if (projectSettings_.o._apply_type_b_file) { - adj_file << setw(PRINT_VAR_PAD) << left << "Type B uncertainty file:" << - system_complete(projectSettings_.a.type_b_file).string() << endl; - xyz_file << setw(PRINT_VAR_PAD) << left << "Type B uncertainty file:" << - system_complete(projectSettings_.a.type_b_file).string() << endl; + adj_file << std::setw(PRINT_VAR_PAD) << std::left << "Type B uncertainty file:" << + boost::filesystem::system_complete(projectSettings_.a.type_b_file).string() << std::endl; + xyz_file << std::setw(PRINT_VAR_PAD) << std::left << "Type B uncertainty file:" << + boost::filesystem::system_complete(projectSettings_.a.type_b_file).string() << std::endl; } } @@ -9559,23 +9675,23 @@ void dna_adjust::PrintOutputFileHeaderInfo() if (!projectSettings_.a.comments.empty()) { size_t s(0), t(0); - string var("Comments: "), comments(projectSettings_.a.comments); + std::string var("Comments: "), comments(projectSettings_.a.comments); size_t pos = 0; while (s < comments.length()) { if (s + PRINT_VAL_PAD >= comments.length()) { - adj_file << setw(PRINT_VAR_PAD) << left << var << comments.substr(s) << endl; + adj_file << std::setw(PRINT_VAR_PAD) << std::left << var << comments.substr(s) << std::endl; break; } else { - if ((pos = comments.substr(s, PRINT_VAL_PAD-1).find('\\')) != string::npos) + if ((pos = comments.substr(s, PRINT_VAL_PAD-1).find('\\')) != std::string::npos) { if (comments.at(s+pos+1) == 'n') { - adj_file << setw(PRINT_VAR_PAD) << left << var << comments.substr(s, pos) << endl; + adj_file << std::setw(PRINT_VAR_PAD) << std::left << var << comments.substr(s, pos) << std::endl; s += pos+2; if (comments.at(s) == ' ') ++s; @@ -9588,7 +9704,7 @@ void dna_adjust::PrintOutputFileHeaderInfo() while (comments.at(s+PRINT_VAL_PAD - t) != ' ') ++t; - adj_file << setw(PRINT_VAR_PAD) << left << var << comments.substr(s, PRINT_VAL_PAD - t); + adj_file << std::setw(PRINT_VAR_PAD) << std::left << var << comments.substr(s, PRINT_VAL_PAD - t); s += PRINT_VAL_PAD - t; if (comments.at(s-1) != ' ' && @@ -9597,18 +9713,18 @@ void dna_adjust::PrintOutputFileHeaderInfo() adj_file << "-"; else if (comments.at(s) == ' ') ++s; - adj_file << endl; + adj_file << std::endl; } var = " "; } } - adj_file << OUTPUTLINE << endl; - xyz_file << OUTPUTLINE << endl; + adj_file << OUTPUTLINE << std::endl; + xyz_file << OUTPUTLINE << std::endl; } -void dna_adjust::PrintCorStation(ostream& os, +void dna_adjust::PrintCorStation(std::ostream& os, const UINT32& block, const UINT32& stn, const UINT32& mat_index, const matrix_2d* stationEstimates) { @@ -9673,27 +9789,27 @@ void dna_adjust::PrintCorStation(ostream& os, // print... // station and constraint - os << setw(STATION) << left << bstBinaryRecords_.at(stn).stationName << setw(PAD2) << " "; + os << std::setw(STATION) << std::left << bstBinaryRecords_.at(stn).stationName << std::setw(PAD2) << " "; // data - os << setw(MSR) << right << FormatDmsString(RadtoDms(azimuth), 4, true, false) << - setw(MSR) << right << FormatDmsString(RadtoDms(vertical_angle), 4, true, false) << - setw(MSR) << setprecision(PRECISION_MTR_STN) << fixed << right << slope_distance << - setw(MSR) << setprecision(PRECISION_MTR_STN) << fixed << right << horiz_distance; + os << std::setw(MSR) << std::right << FormatDmsString(RadtoDms(azimuth), 4, true, false) << + std::setw(MSR) << std::right << FormatDmsString(RadtoDms(vertical_angle), 4, true, false) << + std::setw(MSR) << std::setprecision(PRECISION_MTR_STN) << std::fixed << std::right << slope_distance << + std::setw(MSR) << std::setprecision(PRECISION_MTR_STN) << std::fixed << std::right << horiz_distance; if (isAdjustmentQuestionable_) os << StringFromTW(local_12e, HEIGHT, PRECISION_MTR_STN) << StringFromTW(local_12n, HEIGHT, PRECISION_MTR_STN) << - StringFromTW(local_12up, HEIGHT, PRECISION_MTR_STN) << endl; + StringFromTW(local_12up, HEIGHT, PRECISION_MTR_STN) << std::endl; else os << - setw(HEIGHT) << setprecision(PRECISION_MTR_STN) << fixed << right << local_12e << - setw(HEIGHT) << setprecision(PRECISION_MTR_STN) << fixed << right << local_12n << - setw(HEIGHT) << setprecision(PRECISION_MTR_STN) << fixed << right << local_12up << endl; + std::setw(HEIGHT) << std::setprecision(PRECISION_MTR_STN) << std::fixed << std::right << local_12e << + std::setw(HEIGHT) << std::setprecision(PRECISION_MTR_STN) << std::fixed << std::right << local_12n << + std::setw(HEIGHT) << std::setprecision(PRECISION_MTR_STN) << std::fixed << std::right << local_12up << std::endl; } -void dna_adjust::PrintAdjStation(ostream& os, +void dna_adjust::PrintAdjStation(std::ostream& os, const UINT32& block, const UINT32& stn, const UINT32& mat_idx, const matrix_2d* stationEstimates, matrix_2d* stationVariances, bool recomputeGeographicCoords, bool updateGeographicCoords, @@ -9705,8 +9821,8 @@ void dna_adjust::PrintAdjStation(ostream& os, stn_it += stn; // station and constraint - os << setw(STATION) << left << stn_it->stationName; - os << setw(CONSTRAINT) << left << stn_it->stationConst; + os << std::setw(STATION) << std::left << stn_it->stationName; + os << std::setw(CONSTRAINT) << std::left << stn_it->stationConst; // Are station corrections required? // If so, update the original stations matrix @@ -9729,12 +9845,12 @@ void dna_adjust::PrintAdjStation(ostream& os, // Are geographic coordinates required? if (recomputeGeographicCoords || - projectSettings_.o._stn_coord_types.find("P") != string::npos || - projectSettings_.o._stn_coord_types.find("L") != string::npos || - projectSettings_.o._stn_coord_types.find("H") != string::npos || - projectSettings_.o._stn_coord_types.find("h") != string::npos || - projectSettings_.o._stn_coord_types.find("N") != string::npos || - projectSettings_.o._stn_coord_types.find("z") != string::npos) + projectSettings_.o._stn_coord_types.find("P") != std::string::npos || + projectSettings_.o._stn_coord_types.find("L") != std::string::npos || + projectSettings_.o._stn_coord_types.find("H") != std::string::npos || + projectSettings_.o._stn_coord_types.find("h") != std::string::npos || + projectSettings_.o._stn_coord_types.find("N") != std::string::npos || + projectSettings_.o._stn_coord_types.find("z") != std::string::npos) { CartToGeo( stationEstimates->get(mat_idx, 0), // X @@ -9754,9 +9870,9 @@ void dna_adjust::PrintAdjStation(ostream& os, } // Are projection coordinates required? - if (projectSettings_.o._stn_coord_types.find("E") != string::npos || - projectSettings_.o._stn_coord_types.find("N") != string::npos || - projectSettings_.o._stn_coord_types.find("z") != string::npos) + if (projectSettings_.o._stn_coord_types.find("E") != std::string::npos || + projectSettings_.o._stn_coord_types.find("N") != std::string::npos || + projectSettings_.o._stn_coord_types.find("z") != std::string::npos) { GeoToGrid(estLatitude, estLongitude, &E, &N, &Zo, datum_.GetEllipsoidRef(), @@ -9773,69 +9889,69 @@ void dna_adjust::PrintAdjStation(ostream& os, // latitude // Which angular format? if (projectSettings_.o._angular_type_stn == DMS) - os << setprecision(4 + PRECISION_SEC_STN) << fixed << right << setw(LAT_EAST) << + os << std::setprecision(4 + PRECISION_SEC_STN) << std::fixed << std::right << std::setw(LAT_EAST) << RadtoDms(estLatitude); else - os << setprecision(4 + PRECISION_SEC_STN) << fixed << right << setw(LAT_EAST) << + os << std::setprecision(4 + PRECISION_SEC_STN) << std::fixed << std::right << std::setw(LAT_EAST) << Degrees(estLatitude); break; case 'L': // longitude // Which angular format? if (projectSettings_.o._angular_type_stn == DMS) - os << setprecision(4+PRECISION_SEC_STN) << fixed << right << setw(LON_NORTH) << + os << std::setprecision(4+PRECISION_SEC_STN) << std::fixed << std::right << std::setw(LON_NORTH) << RadtoDmsL(estLongitude); else - os << setprecision(4 + PRECISION_SEC_STN) << fixed << right << setw(LON_NORTH) << + os << std::setprecision(4 + PRECISION_SEC_STN) << std::fixed << std::right << std::setw(LON_NORTH) << DegreesL(estLongitude); break; case 'E': // Easting - os << setprecision(PRECISION_MTR_STN) << fixed << right << setw(LAT_EAST) << E; + os << std::setprecision(PRECISION_MTR_STN) << std::fixed << std::right << std::setw(LAT_EAST) << E; break; case 'N': // Northing - os << setprecision(PRECISION_MTR_STN) << fixed << right << setw(LON_NORTH) << N; + os << std::setprecision(PRECISION_MTR_STN) << std::fixed << std::right << std::setw(LON_NORTH) << N; break; case 'z': // Zone - os << setprecision(0) << fixed << right << setw(ZONE) << Zo; + os << std::setprecision(0) << std::fixed << std::right << std::setw(ZONE) << Zo; break; case 'H': // Orthometric height if (isAdjustmentQuestionable_) - os << right << StringFromTW((estHeight - stn_it->geoidSep), HEIGHT, PRECISION_MTR_STN); + os << std::right << StringFromTW((estHeight - stn_it->geoidSep), HEIGHT, PRECISION_MTR_STN); else - os << setprecision(PRECISION_MTR_STN) << fixed << right << setw(HEIGHT) << + os << std::setprecision(PRECISION_MTR_STN) << std::fixed << std::right << std::setw(HEIGHT) << estHeight - stn_it->geoidSep; break; case 'h': // Ellipsoidal height if (isAdjustmentQuestionable_) - os << right << StringFromTW(estHeight, HEIGHT, PRECISION_MTR_STN); + os << std::right << StringFromTW(estHeight, HEIGHT, PRECISION_MTR_STN); else - os << setprecision(PRECISION_MTR_STN) << fixed << right << setw(HEIGHT) << + os << std::setprecision(PRECISION_MTR_STN) << std::fixed << std::right << std::setw(HEIGHT) << estHeight; break; case 'X': // Cartesian X - os << setprecision(PRECISION_MTR_STN) << fixed << right << setw(XYZ) << + os << std::setprecision(PRECISION_MTR_STN) << std::fixed << std::right << std::setw(XYZ) << stationEstimates->get(mat_idx, 0); break; case 'Y': // Cartesian Y - os << setprecision(PRECISION_MTR_STN) << fixed << right << setw(XYZ) << + os << std::setprecision(PRECISION_MTR_STN) << std::fixed << std::right << std::setw(XYZ) << stationEstimates->get(mat_idx+1, 0); break; case 'Z': // Cartesian Z - os << setprecision(PRECISION_MTR_STN) << fixed << right << setw(XYZ) << + os << std::setprecision(PRECISION_MTR_STN) << std::fixed << std::right << std::setw(XYZ) << stationEstimates->get(mat_idx+2, 0); break; } } - os << setw(PAD2) << " "; + os << std::setw(PAD2) << " "; // Standard deviation in local reference frame matrix_2d var_local(3, 3), var_cart(3, 3); @@ -9890,9 +10006,9 @@ void dna_adjust::PrintAdjStation(ostream& os, StringFromTW(sqrt(var_local.get(2, 2)), STDDEV, PRECISION_MTR_STN); else os << - setw(STDDEV) << right << StringFromT(sqrt(var_local.get(0, 0)), PRECISION_MTR_STN) << - setw(STDDEV) << right << StringFromT(sqrt(var_local.get(1, 1)), PRECISION_MTR_STN) << - setw(STDDEV) << right << StringFromT(sqrt(var_local.get(2, 2)), PRECISION_MTR_STN); + std::setw(STDDEV) << std::right << StringFromT(sqrt(var_local.get(0, 0)), PRECISION_MTR_STN) << + std::setw(STDDEV) << std::right << StringFromT(sqrt(var_local.get(1, 1)), PRECISION_MTR_STN) << + std::setw(STDDEV) << std::right << StringFromT(sqrt(var_local.get(2, 2)), PRECISION_MTR_STN); if (projectSettings_.o._stn_corr) { @@ -9908,19 +10024,19 @@ void dna_adjust::PrintAdjStation(ostream& os, stn_it->currentLongitude, &cor_e, &cor_n, &cor_up); // corrections in the local reference frame - os << setw(PAD2) << " " << - setprecision(PRECISION_MTR_STN) << fixed << right << setw(HEIGHT) << cor_e << - setprecision(PRECISION_MTR_STN) << fixed << right << setw(HEIGHT) << cor_n << - setprecision(PRECISION_MTR_STN) << fixed << right << setw(HEIGHT) << cor_up; + os << std::setw(PAD2) << " " << + std::setprecision(PRECISION_MTR_STN) << std::fixed << std::right << std::setw(HEIGHT) << cor_e << + std::setprecision(PRECISION_MTR_STN) << std::fixed << std::right << std::setw(HEIGHT) << cor_n << + std::setprecision(PRECISION_MTR_STN) << std::fixed << std::right << std::setw(HEIGHT) << cor_up; } // description - os << setw(PAD2) << " " << left << stn_it->description; - os << endl; + os << std::setw(PAD2) << " " << std::left << stn_it->description; + os << std::endl; } -void dna_adjust::PrintAdjStations(ostream& os, const UINT32& block, +void dna_adjust::PrintAdjStations(std::ostream& os, const UINT32& block, const matrix_2d* stationEstimates, matrix_2d* stationVariances, bool printBlockID, bool recomputeGeographicCoords, bool updateGeographicCoords, bool printHeader, bool reapplyTypeBUncertainties) @@ -9929,9 +10045,9 @@ void dna_adjust::PrintAdjStations(ostream& os, const UINT32& block, if (v_blockStations.size() * 3 != stationEstimates->rows()) { - stringstream ss; + std::stringstream ss; ss << "PrintAdjStations(): Number of estimated stations in block " << block << - " does not match the block station count." << endl; + " does not match the block station count." << std::endl; SignalExceptionAdjustment(ss.str(), 0); } @@ -9958,7 +10074,7 @@ void dna_adjust::PrintAdjStations(ostream& os, const UINT32& block, if (projectSettings_.o._output_stn_blocks) { if (printBlockID) - os << "Block " << block + 1 << endl; + os << "Block " << block + 1 << std::endl; else if (projectSettings_.o._adj_stn_iteration) adj.print_adj_stn_block_header(os, block); @@ -9975,7 +10091,7 @@ void dna_adjust::PrintAdjStations(ostream& os, const UINT32& block, } } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionAdjustment(e.what(), 0); } @@ -9993,14 +10109,14 @@ void dna_adjust::PrintAdjStations(ostream& os, const UINT32& block, reapplyTypeBUncertainties); } - os << endl; + os << std::endl; // return sort order to alpha-numeric if (projectSettings_.o._sort_stn_file_order) SortStationsbyID(v_blockStations); } -void dna_adjust::PrintAdjStationsUniqueList(ostream& os, +void dna_adjust::PrintAdjStationsUniqueList(std::ostream& os, const v_mat_2d* stationEstimates, v_mat_2d* stationVariances, bool recomputeGeographicCoords, bool updateGeographicCoords, bool reapplyTypeBUncertainties) @@ -10012,7 +10128,7 @@ void dna_adjust::PrintAdjStationsUniqueList(ostream& os, adj.print_stn_info_col_header(os, projectSettings_.o._stn_coord_types, projectSettings_.o._stn_corr); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionAdjustment(e.what(), 0); } @@ -10023,22 +10139,22 @@ void dna_adjust::PrintAdjStationsUniqueList(ostream& os, if (projectSettings_.a.stage || projectSettings_.a.adjust_mode == Phased_Block_1Mode) { // sort by blocks to create efficiency when deserialising matrix info - sort(v_blockStationsMapUnique_.begin(), v_blockStationsMapUnique_.end(), + std::sort(v_blockStationsMapUnique_.begin(), v_blockStationsMapUnique_.end(), CompareBlockStationMapUnique_byBlock()); } else if (projectSettings_.o._sort_stn_file_order) { CompareBlockStationMapUnique_byFileOrder stnorderCompareFunc(&bstBinaryRecords_); - sort(v_blockStationsMapUnique_.begin(), v_blockStationsMapUnique_.end(), stnorderCompareFunc); + std::sort(v_blockStationsMapUnique_.begin(), v_blockStationsMapUnique_.end(), stnorderCompareFunc); } else - sort(v_blockStationsMapUnique_.begin(), v_blockStationsMapUnique_.end()); + std::sort(v_blockStationsMapUnique_.begin(), v_blockStationsMapUnique_.end()); - stringstream stationRecord; + std::stringstream stationRecord; v_uint32_string_pair stationsOutput; stationsOutput.reserve(v_blockStationsMapUnique_.size()); - ostream* outstream(&os); + std::ostream* outstream(&os); if (projectSettings_.a.stage) outstream = &stationRecord; @@ -10106,60 +10222,60 @@ void dna_adjust::PrintAdjStationsUniqueList(ostream& os, // if required, sort stations according to original station file order if (projectSettings_.o._sort_stn_file_order) { - CompareOddPairFirst_FileOrder stnorderCompareFunc(&bstBinaryRecords_); - sort(stationsOutput.begin(), stationsOutput.end(), stnorderCompareFunc); + CompareOddPairFirst_FileOrder stnorderCompareFunc(&bstBinaryRecords_); + std::sort(stationsOutput.begin(), stationsOutput.end(), stnorderCompareFunc); } else - sort(stationsOutput.begin(), stationsOutput.end(), CompareOddPairFirst()); + std::sort(stationsOutput.begin(), stationsOutput.end(), CompareOddPairFirst()); for_each(stationsOutput.begin(), stationsOutput.end(), - [&stationsOutput, &os] (pair& adjRecord) { + [&stationsOutput, &os] (std::pair& adjRecord) { os << adjRecord.second; } ); } - os << endl; + os << std::endl; } void dna_adjust::SortStationsbyFileOrder(vUINT32& v_blockStations) { CompareStnFileOrder stnorderCompareFunc(&bstBinaryRecords_); - sort(v_blockStations.begin(), v_blockStations.end(), stnorderCompareFunc); + std::sort(v_blockStations.begin(), v_blockStations.end(), stnorderCompareFunc); } void dna_adjust::SortStationsbyID(vUINT32& v_blockStations) { - sort(v_blockStations.begin(), v_blockStations.end()); + std::sort(v_blockStations.begin(), v_blockStations.end()); } -void dna_adjust::PrintPosUncertaintiesHeader(ostream& os) +void dna_adjust::PrintPosUncertaintiesHeader(std::ostream& os) { - os << setw(STATION) << left << "Station" << - setw(PAD2) << " " << - right << setw(LAT_EAST) << CDnaStation::CoordinateName('P') << - right << setw(LON_NORTH) << CDnaStation::CoordinateName('L') << - right << setw(STAT) << "Hz PosU" << - right << setw(STAT) << "Vt PosU" << - right << setw(PREC) << "Semi-major" << - right << setw(PREC) << "Semi-minor" << - right << setw(PREC) << "Orientation"; + os << std::setw(STATION) << std::left << "Station" << + std::setw(PAD2) << " " << + std::right << std::setw(LAT_EAST) << CDnaStation::CoordinateName('P') << + std::right << std::setw(LON_NORTH) << CDnaStation::CoordinateName('L') << + std::right << std::setw(STAT) << "Hz PosU" << + std::right << std::setw(STAT) << "Vt PosU" << + std::right << std::setw(PREC) << "Semi-major" << + std::right << std::setw(PREC) << "Semi-minor" << + std::right << std::setw(PREC) << "Orientation"; switch (projectSettings_.o._apu_vcv_units) { case ENU_apu_ui: os << - right << setw(MSR) << "Variance(e)" << - right << setw(MSR) << "Variance(n)" << - right << setw(MSR) << "Variance(up)" << endl; + std::right << std::setw(MSR) << "Variance(e)" << + std::right << std::setw(MSR) << "Variance(n)" << + std::right << std::setw(MSR) << "Variance(up)" << std::endl; break; case XYZ_apu_ui: default: os << - right << setw(MSR) << "Variance(X)" << - right << setw(MSR) << "Variance(Y)" << - right << setw(MSR) << "Variance(Z)" << endl; + std::right << std::setw(MSR) << "Variance(X)" << + std::right << std::setw(MSR) << "Variance(Y)" << + std::right << std::setw(MSR) << "Variance(Z)" << std::endl; break; } @@ -10167,11 +10283,11 @@ void dna_adjust::PrintPosUncertaintiesHeader(ostream& os) for (i=0; i()); } else if (projectSettings_.o._sort_stn_file_order) { CompareBlockStationMapUnique_byFileOrder stnorderCompareFunc(&bstBinaryRecords_); - sort(v_blockStationsMapUnique_.begin(), v_blockStationsMapUnique_.end(), stnorderCompareFunc); + std::sort(v_blockStationsMapUnique_.begin(), v_blockStationsMapUnique_.end(), stnorderCompareFunc); } else - sort(v_blockStationsMapUnique_.begin(), v_blockStationsMapUnique_.end()); + std::sort(v_blockStationsMapUnique_.begin(), v_blockStationsMapUnique_.end()); - stringstream stationRecord; + std::stringstream stationRecord; v_uint32_string_pair stationsOutput; stationsOutput.reserve(v_blockStationsMapUnique_.size()); - ostream* outstream(&os); + std::ostream* outstream(&os); if (projectSettings_.a.stage) outstream = &stationRecord; @@ -10248,21 +10364,21 @@ void dna_adjust::PrintPosUncertaintiesUniqueList(ostream& os, const v_mat_2d* st // if required, sort stations according to original station file order if (projectSettings_.o._sort_stn_file_order) { - CompareOddPairFirst_FileOrder stnorderCompareFunc(&bstBinaryRecords_); - sort(stationsOutput.begin(), stationsOutput.end(), stnorderCompareFunc); + CompareOddPairFirst_FileOrder stnorderCompareFunc(&bstBinaryRecords_); + std::sort(stationsOutput.begin(), stationsOutput.end(), stnorderCompareFunc); } else - sort(stationsOutput.begin(), stationsOutput.end(), CompareOddPairFirst()); + std::sort(stationsOutput.begin(), stationsOutput.end(), CompareOddPairFirst()); for_each(stationsOutput.begin(), stationsOutput.end(), - [&stationsOutput, &os] (pair& posRecord) { + [&stationsOutput, &os] (std::pair& posRecord) { os << posRecord.second; } ); } } -void dna_adjust::PrintPosUncertainty(ostream& os, /*ostream* csv,*/ const UINT32& block, const UINT32& stn, +void dna_adjust::PrintPosUncertainty(std::ostream& os, /*ostream* csv,*/ const UINT32& block, const UINT32& stn, const UINT32& mat_idx, const matrix_2d* stationVariances, const UINT32& map_idx, const vUINT32* blockStations) { double semimajor, semiminor, azimuth, hzPosU, vtPosU; @@ -10295,23 +10411,23 @@ void dna_adjust::PrintPosUncertainty(ostream& os, /*ostream* csv,*/ const UINT32 // print... // station and padding - os << setw(STATION) << left << bstBinaryRecords_.at(stn).stationName << setw(PAD2) << " "; + os << std::setw(STATION) << std::left << bstBinaryRecords_.at(stn).stationName << std::setw(PAD2) << " "; - os.flags(ios::fixed | ios::right); + os.flags(std::ios::fixed | std::ios::right); // latitude if (projectSettings_.o._angular_type_stn == DMS) - os << setprecision(4+PRECISION_SEC_STN) << setw(LAT_EAST) << + os << std::setprecision(4+PRECISION_SEC_STN) << std::setw(LAT_EAST) << RadtoDms(bstBinaryRecords_.at(stn).currentLatitude); else - os << setprecision(4 + PRECISION_SEC_STN) << setw(LAT_EAST) << + os << std::setprecision(4 + PRECISION_SEC_STN) << std::setw(LAT_EAST) << Degrees(bstBinaryRecords_.at(stn).currentLatitude); // longitude if (projectSettings_.o._angular_type_stn == DMS) - os << setprecision(4+PRECISION_SEC_STN) << setw(LON_NORTH) << + os << std::setprecision(4+PRECISION_SEC_STN) << std::setw(LON_NORTH) << RadtoDmsL(bstBinaryRecords_.at(stn).currentLongitude); else - os << setprecision(4 + PRECISION_SEC_STN) << setw(LON_NORTH) << + os << std::setprecision(4 + PRECISION_SEC_STN) << std::setw(LON_NORTH) << DegreesL(bstBinaryRecords_.at(stn).currentLongitude); // positional uncertainty @@ -10320,15 +10436,15 @@ void dna_adjust::PrintPosUncertainty(ostream& os, /*ostream* csv,*/ const UINT32 StringFromTW(hzPosU, STAT, PRECISION_MTR_STN) << StringFromTW(vtPosU, STAT, PRECISION_MTR_STN); else - os << setprecision(PRECISION_MTR_STN) << setw(STAT) << hzPosU << - setprecision(PRECISION_MTR_STN) << fixed << right << setw(STAT) << vtPosU; + os << std::setprecision(PRECISION_MTR_STN) << std::setw(STAT) << hzPosU << + std::setprecision(PRECISION_MTR_STN) << std::fixed << std::right << std::setw(STAT) << vtPosU; // error ellipse semi-major, semi-minor, orientation - os << setprecision(PRECISION_MTR_STN) << setw(PREC) << semimajor << - setprecision(PRECISION_MTR_STN) << setw(PREC) << semiminor << - setprecision(4) << setw(PREC) << RadtoDms(azimuth); + os << std::setprecision(PRECISION_MTR_STN) << std::setw(PREC) << semimajor << + std::setprecision(PRECISION_MTR_STN) << std::setw(PREC) << semiminor << + std::setprecision(4) << std::setw(PREC) << RadtoDms(azimuth); - os.flags(ios::scientific | ios::right); + os.flags(std::ios::scientific | std::ios::right); UINT16 PRECISION_UNCERTAINTY(9); @@ -10337,32 +10453,32 @@ void dna_adjust::PrintPosUncertainty(ostream& os, /*ostream* csv,*/ const UINT32 os << StringFromTW(variances->get(0, 0), MSR, PRECISION_UNCERTAINTY) << // e StringFromTW(variances->get(0, 1), MSR, PRECISION_UNCERTAINTY) << // n - StringFromTW(variances->get(0, 2), MSR, PRECISION_UNCERTAINTY) << endl; // up + StringFromTW(variances->get(0, 2), MSR, PRECISION_UNCERTAINTY) << std::endl; // up else os << - setprecision(PRECISION_UNCERTAINTY) << setw(MSR) << variances->get(0, 0) << // e - setprecision(PRECISION_UNCERTAINTY) << setw(MSR) << variances->get(0, 1) << // n - setprecision(PRECISION_UNCERTAINTY) << setw(MSR) << variances->get(0, 2) << endl; // up + std::setprecision(PRECISION_UNCERTAINTY) << std::setw(MSR) << variances->get(0, 0) << // e + std::setprecision(PRECISION_UNCERTAINTY) << std::setw(MSR) << variances->get(0, 1) << // n + std::setprecision(PRECISION_UNCERTAINTY) << std::setw(MSR) << variances->get(0, 2) << std::endl; // up // Next line: yy, yz - os << setw(STATION+PAD2+LAT_EAST+LON_NORTH+STAT+STAT+PREC+PREC+PREC+MSR) << " "; // padding + os << std::setw(STATION+PAD2+LAT_EAST+LON_NORTH+STAT+STAT+PREC+PREC+PREC+MSR) << " "; // padding if (isAdjustmentQuestionable_) os << StringFromTW(variances->get(1, 1), MSR, PRECISION_UNCERTAINTY) << // n - StringFromTW(variances->get(1, 2), MSR, PRECISION_UNCERTAINTY) << endl; // up + StringFromTW(variances->get(1, 2), MSR, PRECISION_UNCERTAINTY) << std::endl; // up else os << - setprecision(PRECISION_UNCERTAINTY) << setw(MSR) << variances->get(1, 1) << // n - setprecision(PRECISION_UNCERTAINTY) << setw(MSR) << variances->get(1, 2) << endl; // up + std::setprecision(PRECISION_UNCERTAINTY) << std::setw(MSR) << variances->get(1, 1) << // n + std::setprecision(PRECISION_UNCERTAINTY) << std::setw(MSR) << variances->get(1, 2) << std::endl; // up // Next line: zz - os << setw(STATION+PAD2+LAT_EAST+LON_NORTH+STAT+STAT+PREC+PREC+PREC+MSR+MSR) << " "; // padding + os << std::setw(STATION+PAD2+LAT_EAST+LON_NORTH+STAT+STAT+PREC+PREC+PREC+MSR+MSR) << " "; // padding if (isAdjustmentQuestionable_) os << - StringFromTW(variances->get(2, 2), MSR, PRECISION_UNCERTAINTY) << endl; // up + StringFromTW(variances->get(2, 2), MSR, PRECISION_UNCERTAINTY) << std::endl; // up else os << - setprecision(PRECISION_UNCERTAINTY) << setw(MSR) << variances->get(2, 2) << endl; // up + std::setprecision(PRECISION_UNCERTAINTY) << std::setw(MSR) << variances->get(2, 2) << std::endl; // up if (!projectSettings_.o._output_pu_covariances) return; @@ -10386,30 +10502,30 @@ void dna_adjust::PrintPosUncertainty(ostream& os, /*ostream* csv,*/ const UINT32 break; } - os << setw(STATION) << left << bstBinaryRecords_.at(blockStations->at(ic)).stationName; + os << std::setw(STATION) << std::left << bstBinaryRecords_.at(blockStations->at(ic)).stationName; - os.flags(ios::scientific | ios::right); + os.flags(std::ios::scientific | std::ios::right); os << - setw(PAD2+LAT_EAST+LON_NORTH+STAT+STAT+PREC+PREC+PREC) << " " << // padding - setprecision(PRECISION_UNCERTAINTY) << setw(MSR) << variances->get(0, 0) << // 11 - setprecision(PRECISION_UNCERTAINTY) << setw(MSR) << variances->get(0, 1) << // 12 - setprecision(PRECISION_UNCERTAINTY) << setw(MSR) << variances->get(0, 2) << endl; // 13 + std::setw(PAD2+LAT_EAST+LON_NORTH+STAT+STAT+PREC+PREC+PREC) << " " << // padding + std::setprecision(PRECISION_UNCERTAINTY) << std::setw(MSR) << variances->get(0, 0) << // 11 + std::setprecision(PRECISION_UNCERTAINTY) << std::setw(MSR) << variances->get(0, 1) << // 12 + std::setprecision(PRECISION_UNCERTAINTY) << std::setw(MSR) << variances->get(0, 2) << std::endl; // 13 os << - setw(STATION+PAD2+LAT_EAST+LON_NORTH+STAT+STAT+PREC+PREC+PREC) << " " << // padding - setprecision(PRECISION_UNCERTAINTY) << setw(MSR) << variances->get(1, 0) << // 21 - setprecision(PRECISION_UNCERTAINTY) << setw(MSR) << variances->get(1, 1) << // 22 - setprecision(PRECISION_UNCERTAINTY) << setw(MSR) << variances->get(1, 2) << endl; // 23 + std::setw(STATION+PAD2+LAT_EAST+LON_NORTH+STAT+STAT+PREC+PREC+PREC) << " " << // padding + std::setprecision(PRECISION_UNCERTAINTY) << std::setw(MSR) << variances->get(1, 0) << // 21 + std::setprecision(PRECISION_UNCERTAINTY) << std::setw(MSR) << variances->get(1, 1) << // 22 + std::setprecision(PRECISION_UNCERTAINTY) << std::setw(MSR) << variances->get(1, 2) << std::endl; // 23 os << - setw(STATION+PAD2+LAT_EAST+LON_NORTH+STAT+STAT+PREC+PREC+PREC) << " " << // padding - setprecision(PRECISION_UNCERTAINTY) << setw(MSR) << variances->get(2, 0) << // 31 - setprecision(PRECISION_UNCERTAINTY) << setw(MSR) << variances->get(2, 1) << // 32 - setprecision(PRECISION_UNCERTAINTY) << setw(MSR) << variances->get(2, 2) << endl; // 33 + std::setw(STATION+PAD2+LAT_EAST+LON_NORTH+STAT+STAT+PREC+PREC+PREC) << " " << // padding + std::setprecision(PRECISION_UNCERTAINTY) << std::setw(MSR) << variances->get(2, 0) << // 31 + std::setprecision(PRECISION_UNCERTAINTY) << std::setw(MSR) << variances->get(2, 1) << // 32 + std::setprecision(PRECISION_UNCERTAINTY) << std::setw(MSR) << variances->get(2, 2) << std::endl; // 33 } } -void dna_adjust::PrintPosUncertainties(ostream &os, const UINT32& block, const matrix_2d* stationVariances) +void dna_adjust::PrintPosUncertainties(std::ostream &os, const UINT32& block, const matrix_2d* stationVariances) { vUINT32 v_blockStations(v_parameterStationList_.at(block)); @@ -10421,7 +10537,7 @@ void dna_adjust::PrintPosUncertainties(ostream &os, const UINT32& block, const m { case PhasedMode: case Phased_Block_1Mode: // only the first block is rigorous - os << "Block " << block + 1 << endl; + os << "Block " << block + 1 << std::endl; break; } @@ -10441,7 +10557,7 @@ void dna_adjust::PrintPosUncertainties(ostream &os, const UINT32& block, const m stationVariances, i, &v_blockStations); } - os << endl; + os << std::endl; // return sort order to alpha-numeric if (projectSettings_.o._sort_stn_file_order) @@ -10449,7 +10565,7 @@ void dna_adjust::PrintPosUncertainties(ostream &os, const UINT32& block, const m } -void dna_adjust::PrintCorStations(ostream &cor_file, const UINT32& block) +void dna_adjust::PrintCorStations(std::ostream &cor_file, const UINT32& block) { vUINT32 v_blockStations(v_parameterStationList_.at(block)); @@ -10461,25 +10577,25 @@ void dna_adjust::PrintCorStations(ostream &cor_file, const UINT32& block) { case PhasedMode: case Phased_Block_1Mode: // only the first block is rigorous - cor_file << "Block " << block + 1 << endl; + cor_file << "Block " << block + 1 << std::endl; break; } - cor_file << setw(STATION) << left << "Station" << - setw(PAD2) << " " << - right << setw(MSR) << "Azimuth" << - right << setw(MSR) << "V. Angle" << - right << setw(MSR) << "S. Distance" << - right << setw(MSR) << "H. Distance" << - right << setw(HEIGHT) << "east" << - right << setw(HEIGHT) << "north" << - right << setw(HEIGHT) << "up" << endl; + cor_file << std::setw(STATION) << std::left << "Station" << + std::setw(PAD2) << " " << + std::right << std::setw(MSR) << "Azimuth" << + std::right << std::setw(MSR) << "V. Angle" << + std::right << std::setw(MSR) << "S. Distance" << + std::right << std::setw(MSR) << "H. Distance" << + std::right << std::setw(HEIGHT) << "east" << + std::right << std::setw(HEIGHT) << "north" << + std::right << std::setw(HEIGHT) << "up" << std::endl; UINT32 i, j = STATION+PAD2+MSR+MSR+MSR+MSR+HEIGHT+HEIGHT+HEIGHT; for (i=0; iat(block)); } - cor_file << endl; + cor_file << std::endl; // return sort order to alpha-numeric if (projectSettings_.o._sort_stn_file_order) @@ -10505,31 +10621,31 @@ void dna_adjust::PrintCorStations(ostream &cor_file, const UINT32& block) } -void dna_adjust::PrintCorStationsUniqueList(ostream &cor_file) +void dna_adjust::PrintCorStationsUniqueList(std::ostream &cor_file) { vUINT32 v_blockStations; vstring stn_corr_records(bstBinaryRecords_.size()); - cor_file << setw(STATION) << left << "Station" << - setw(PAD2) << " " << - right << setw(MSR) << "Azimuth" << - right << setw(MSR) << "V. Angle" << - right << setw(MSR) << "S. Distance" << - right << setw(MSR) << "H. Distance" << - right << setw(HEIGHT) << "east" << - right << setw(HEIGHT) << "north" << - right << setw(HEIGHT) << "up" << endl; + cor_file << std::setw(STATION) << std::left << "Station" << + std::setw(PAD2) << " " << + std::right << std::setw(MSR) << "Azimuth" << + std::right << std::setw(MSR) << "V. Angle" << + std::right << std::setw(MSR) << "S. Distance" << + std::right << std::setw(MSR) << "H. Distance" << + std::right << std::setw(HEIGHT) << "east" << + std::right << std::setw(HEIGHT) << "north" << + std::right << std::setw(HEIGHT) << "up" << std::endl; UINT32 i, j = STATION+PAD2+MSR+MSR+MSR+MSR+HEIGHT+HEIGHT+HEIGHT; for (i=0; i stnorderCompareFunc(&bstBinaryRecords_); - sort(correctionsOutput.begin(), correctionsOutput.end(), stnorderCompareFunc); + CompareOddPairFirst_FileOrder stnorderCompareFunc(&bstBinaryRecords_); + std::sort(correctionsOutput.begin(), correctionsOutput.end(), stnorderCompareFunc); } else - sort(correctionsOutput.begin(), correctionsOutput.end(), CompareOddPairFirst()); + std::sort(correctionsOutput.begin(), correctionsOutput.end(), CompareOddPairFirst()); for_each(correctionsOutput.begin(), correctionsOutput.end(), - [&correctionsOutput, &cor_file] (pair& corrRecord) { + [&correctionsOutput, &cor_file] (std::pair& corrRecord) { cor_file << corrRecord.second; } ); @@ -10642,15 +10758,15 @@ void dna_adjust::UpdateGeographicCoords() } } -void dna_adjust::PrintCompMeasurements(const UINT32& block, const string& type) +void dna_adjust::PrintCompMeasurements(const UINT32& block, const std::string& type) { // Print header - string table_heading("Computed Measurements"); - string col_heading("Computed"); + std::string table_heading("Computed Measurements"); + std::string col_heading("Computed"); if (projectSettings_.a.adjust_mode == PhasedMode || !type.empty()) { - stringstream ss; + std::stringstream ss; ss << " ("; if (projectSettings_.a.adjust_mode == PhasedMode) { @@ -10675,10 +10791,6 @@ void dna_adjust::PrintCompMeasurements(const UINT32& block, const string& type) UINT32 design_row(0); - // Initialise database id iterator - if (projectSettings_.o._database_ids) - _it_dbid = v_msr_db_map_.begin(); - for (_it_block_msr=v_CML_.at(block).begin(); _it_block_msr!=v_CML_.at(block).end(); ++_it_block_msr) { if (InitialiseandValidateMsrPointer(_it_block_msr, _it_msr)) @@ -10689,7 +10801,7 @@ void dna_adjust::PrintCompMeasurements(const UINT32& block, const string& type) if (_it_msr->vectorCount1 < 1) continue; - adj_file << left << setw(PAD2) << _it_msr->measType; + adj_file << std::left << std::setw(PAD2) << _it_msr->measType; // normal format switch (_it_msr->measType) @@ -10732,16 +10844,16 @@ void dna_adjust::PrintCompMeasurements(const UINT32& block, const string& type) } - adj_file << endl << endl; + adj_file << std::endl << std::endl; } -void dna_adjust::PrintAdjMeasurementsHeader(bool printHeader, const string& table_heading, +void dna_adjust::PrintAdjMeasurementsHeader(bool printHeader, const std::string& table_heading, printMeasurementsMode printMode, UINT32 block, bool printBlocks) { if (printHeader) - adj_file << endl << table_heading << endl << - "------------------------------------------" << endl << endl; + adj_file << std::endl << table_heading << std::endl << + "------------------------------------------" << std::endl << std::endl; if (printBlocks) { @@ -10750,12 +10862,12 @@ void dna_adjust::PrintAdjMeasurementsHeader(bool printHeader, const string& tabl case PhasedMode: case Phased_Block_1Mode: if (projectSettings_.o._output_msr_blocks) - adj_file << "Block " << block << endl; + adj_file << "Block " << block << std::endl; break; } } - string col1_heading, col2_heading; + std::string col1_heading, col2_heading; // determine headings switch (printMode) @@ -10776,20 +10888,20 @@ void dna_adjust::PrintAdjMeasurementsHeader(bool printHeader, const string& tabl // Adjusted, computed and ignored measurements UINT32 j(PAD2 + STATION + STATION + STATION); adj_file << - setw(PAD2) << left << "M" << - setw(STATION) << left << "Station 1" << - setw(STATION) << left << "Station 2" << - setw(STATION) << left << "Station 3"; + std::setw(PAD2) << std::left << "M" << + std::setw(STATION) << std::left << "Station 1" << + std::setw(STATION) << std::left << "Station 2" << + std::setw(STATION) << std::left << "Station 3"; // Adjusted, computed and ignored measurements j += PAD3 + PAD3 + MSR + MSR + CORR + PREC; adj_file << - setw(PAD3) << left << "*" << - setw(PAD2) << left << "C" << - setw(MSR) << right << "Measured" << - setw(MSR) << right << col1_heading << // Computed or Adjusted - setw(CORR) << right << col2_heading << // Difference or Correction - setw(PREC) << right << "Meas. SD"; + std::setw(PAD3) << std::left << "*" << + std::setw(PAD2) << std::left << "C" << + std::setw(MSR) << std::right << "Measured" << + std::setw(MSR) << std::right << col1_heading << // Computed or Adjusted + std::setw(CORR) << std::right << col2_heading << // Difference or Correction + std::setw(PREC) << std::right << "Meas. SD"; // Adjusted measurements only switch (printMode) @@ -10797,20 +10909,20 @@ void dna_adjust::PrintAdjMeasurementsHeader(bool printHeader, const string& tabl case adjustedMsrs: j += PREC + PREC + STAT; adj_file << - setw(PREC) << right << "Adj. SD" << - setw(PREC) << right << "Corr. SD" << - setw(STAT) << right << "N-stat"; + std::setw(PREC) << std::right << "Adj. SD" << + std::setw(PREC) << std::right << "Corr. SD" << + std::setw(STAT) << std::right << "N-stat"; // print t-statistics? if (projectSettings_.o._adj_msr_tstat) { j += STAT; - adj_file << setw(STAT) << right << "T-stat"; + adj_file << std::setw(STAT) << std::right << "T-stat"; } j += REL; adj_file << - setw(REL) << right << "Pelzer Rel"; + std::setw(REL) << std::right << "Pelzer Rel"; break; default: break; @@ -10819,7 +10931,7 @@ void dna_adjust::PrintAdjMeasurementsHeader(bool printHeader, const string& tabl // Adjusted, computed and ignored measurements j += PACORR; adj_file << - setw(PACORR) << right << "Pre Adj Corr"; + std::setw(PACORR) << std::right << "Pre Adj Corr"; // Adjusted measurements only switch (printMode) @@ -10827,7 +10939,7 @@ void dna_adjust::PrintAdjMeasurementsHeader(bool printHeader, const string& tabl case adjustedMsrs: j += OUTLIER; adj_file << - setw(OUTLIER) << right << "Outlier?"; + std::setw(OUTLIER) << std::right << "Outlier?"; break; default: break; @@ -10839,17 +10951,17 @@ void dna_adjust::PrintAdjMeasurementsHeader(bool printHeader, const string& tabl { j += STDDEV + STDDEV; adj_file << - setw(STDDEV) << right << "Meas. ID" << - setw(STDDEV) << right << "Clust. ID"; + std::setw(STDDEV) << std::right << "Meas. ID" << + std::setw(STDDEV) << std::right << "Clust. ID"; } - adj_file << endl; + adj_file << std::endl; UINT32 i; for (i=0; istation1; + it_stnmap_range = equal_range(v_blockStationsMapUnique_.begin(), v_blockStationsMapUnique_.end(), + (*_it_msr)->station1, CompareBlockStationMapUnique_Station()); + if (it_stnmap_range.first == it_stnmap_range.second) + { + //TRACE("%d not found\n", (*_it_msr)->station1); + std::stringstream ss; + ss << "UpdateIgnoredMeasurements(): Station " << (*_it_msr)->station1 << + " was not found in the station map." << std::endl; + SignalExceptionAdjustment(ss.str(), 0); + } + + // Get the index of the station in the map + _it_bsmu = it_stnmap_range.first; + matrix_2d* estimatedStations_stn1(&v_estimatedStations_.at(_it_bsmu->second)); UINT32 stn1(GetBlkMatrixElemStn1(_it_bsmu->second, _it_msr)); // Get estimated station coordinates matrix and index of the // station within the matrix for station 2 - _it_bsmu = v_blockStationsMapUnique_.begin() + (*_it_msr)->station2; + it_stnmap_range = equal_range(v_blockStationsMapUnique_.begin(), v_blockStationsMapUnique_.end(), + (*_it_msr)->station2, CompareBlockStationMapUnique_Station()); + if (it_stnmap_range.first == it_stnmap_range.second) + { + //TRACE("%d not found\n", (*_it_msr)->station2); + std::stringstream ss; + ss << "UpdateIgnoredMeasurements(): Station " << (*_it_msr)->station1 << + " was not found in the station map." << std::endl; + SignalExceptionAdjustment(ss.str(), 0); + } + // Get the index of the station in the map + _it_bsmu = it_stnmap_range.first; + matrix_2d* estimatedStations_stn2(&v_estimatedStations_.at(_it_bsmu->second)); UINT32 stn2(GetBlkMatrixElemStn2(_it_bsmu->second, _it_msr)); // Get estimated station coordinates matrix and index of the // station within the matrix for station 3 - _it_bsmu = v_blockStationsMapUnique_.begin() + (*_it_msr)->station3; + it_stnmap_range = equal_range(v_blockStationsMapUnique_.begin(), v_blockStationsMapUnique_.end(), + (*_it_msr)->station3, CompareBlockStationMapUnique_Station()); + if (it_stnmap_range.first == it_stnmap_range.second) + { + //TRACE("%d not found\n", (*_it_msr)->station3); + std::stringstream ss; + ss << "UpdateIgnoredMeasurements(): Station " << (*_it_msr)->station3 << + " was not found in the station map." << std::endl; + SignalExceptionAdjustment(ss.str(), 0); + } + + // Get the index of the station in the map + _it_bsmu = it_stnmap_range.first; + matrix_2d* estimatedStations_stn3(&v_estimatedStations_.at(_it_bsmu->second)); UINT32 stn3(GetBlkMatrixElemStn3(_it_bsmu->second, _it_msr)); @@ -11148,9 +11299,9 @@ void dna_adjust::UpdateIgnoredMeasurements_D(pit_vmsr_t _it_msr, bool storeOrigi catch (...) { // Print error message to adj file and throw exception - stringstream ss; - ss << "UpdateIgnoredMeasurements_D(): An error was encountered whilst" << endl << - " calculating ignored measurement details" << endl; + std::stringstream ss; + ss << "UpdateIgnoredMeasurements_D(): An error was encountered whilst" << std::endl << + " calculating ignored measurement details" << std::endl; SignalExceptionAdjustment(ss.str(), 0); } @@ -11627,17 +11778,44 @@ void dna_adjust::UpdateIgnoredMeasurements_S(pit_vmsr_t _it_msr, bool storeOrigi // Use v_blockStationsMapUnique_ to get the correct block for each // station in the measurement + _it_pair_u32u32_uint32 it_stnmap_range; _it_u32u32_uint32_pair _it_bsmu; // Get estimated station coordinates matrix and index of the // station within the matrix for station 1 - _it_bsmu = v_blockStationsMapUnique_.begin() + (*_it_msr)->station1; + it_stnmap_range = equal_range(v_blockStationsMapUnique_.begin(), v_blockStationsMapUnique_.end(), + (*_it_msr)->station1, CompareBlockStationMapUnique_Station()); + if (it_stnmap_range.first == it_stnmap_range.second) + { + //TRACE("%d not found\n", (*_it_msr)->station1); + std::stringstream ss; + ss << "UpdateIgnoredMeasurements(): Station " << (*_it_msr)->station1 << + " was not found in the station map." << std::endl; + SignalExceptionAdjustment(ss.str(), 0); + } + + // Get the index of the station in the map + _it_bsmu = it_stnmap_range.first; + matrix_2d* estimatedStations_stn1(&v_estimatedStations_.at(_it_bsmu->second)); UINT32 stn1(GetBlkMatrixElemStn1(_it_bsmu->second, _it_msr)); // Get estimated station coordinates matrix and index of the // station within the matrix for station 2 - _it_bsmu = v_blockStationsMapUnique_.begin() + (*_it_msr)->station2; + it_stnmap_range = equal_range(v_blockStationsMapUnique_.begin(), v_blockStationsMapUnique_.end(), + (*_it_msr)->station2, CompareBlockStationMapUnique_Station()); + if (it_stnmap_range.first == it_stnmap_range.second) + { + //TRACE("%d not found\n", (*_it_msr)->station2); + std::stringstream ss; + ss << "UpdateIgnoredMeasurements(): Station " << (*_it_msr)->station2 << + " was not found in the station map." << std::endl; + SignalExceptionAdjustment(ss.str(), 0); + } + + // Get the index of the station in the map + _it_bsmu = it_stnmap_range.first; + matrix_2d* estimatedStations_stn2(&v_estimatedStations_.at(_it_bsmu->second)); UINT32 stn2(GetBlkMatrixElemStn2(_it_bsmu->second, _it_msr)); @@ -11940,13 +12118,13 @@ void dna_adjust::UpdateIgnoredMeasurements_Z(pit_vmsr_t _it_msr, bool storeOrigi void dna_adjust::UpdateIgnoredMeasurements(pit_vmsr_t _it_msr, bool storeOriginalMeasurement) { - stringstream ss; + std::stringstream ss; // Since the stations connected by an ignored measurement may appear // in different blocks, it is essential to get the correct block // number for each station. For this, use v_blockStationsMapUnique_ which // is sorted on station id. - sort(v_blockStationsMapUnique_.begin(), v_blockStationsMapUnique_.end()); + std::sort(v_blockStationsMapUnique_.begin(), v_blockStationsMapUnique_.end()); switch ((*_it_msr)->measType) { @@ -12012,7 +12190,7 @@ void dna_adjust::UpdateIgnoredMeasurements(pit_vmsr_t _it_msr, bool storeOrigina break; default: ss << "UpdateIgnoredMeasurements(): Unknown measurement type - '" << - (*_it_msr)->measType << "'." << endl; + (*_it_msr)->measType << "'." << std::endl; SignalExceptionAdjustment(ss.str(), 0); } } @@ -12021,8 +12199,8 @@ void dna_adjust::UpdateIgnoredMeasurements(pit_vmsr_t _it_msr, bool storeOrigina void dna_adjust::PrintIgnoredAdjMeasurements(bool printHeader) { // Print heading - adj_file << endl; - string table_heading("Ignored Measurements (a-posteriori)"); + adj_file << std::endl; + std::string table_heading("Ignored Measurements (a-posteriori)"); PrintAdjMeasurementsHeader(printHeader, table_heading, ignoredMsrs, 0, false); @@ -12069,7 +12247,7 @@ void dna_adjust::PrintIgnoredAdjMeasurements(bool printHeader) if (ignored_msrs.empty()) { - adj_file << endl << endl; + adj_file << std::endl << std::endl; return; } @@ -12087,6 +12265,8 @@ void dna_adjust::PrintIgnoredAdjMeasurements(bool printHeader) if (_it_msr->measAdj == 0. && _it_msr->measCorr == 0. && _it_msr->preAdjCorr == 0. && _it_msr->preAdjMeas == 0.) storeOriginalMeasurement = true; + std::sort(v_blockStationsMapUnique_.begin(), v_blockStationsMapUnique_.end()); + // Reduce measurements and compute stats for (_it_ign = ignored_msrs.begin(); _it_ign != ignored_msrs.end(); ++_it_ign) { @@ -12096,10 +12276,6 @@ void dna_adjust::PrintIgnoredAdjMeasurements(bool printHeader) UpdateIgnoredMeasurements(&_it_msr, storeOriginalMeasurement); } - // Initialise database id iterator - if (projectSettings_.o._database_ids) - _it_dbid = v_msr_db_map_.begin(); - // Print measurements for (_it_ign = ignored_msrs.begin(); _it_ign != ignored_msrs.end(); ++_it_ign) { @@ -12122,14 +12298,14 @@ void dna_adjust::PrintIgnoredAdjMeasurements(bool printHeader) case 'Y': // GPS Point cluster if (_it_msr->clusterID != clusterID) { - adj_file << left << setw(PAD2) << _it_msr->measType; + adj_file << std::left << std::setw(PAD2) << _it_msr->measType; clusterID = _it_msr->clusterID; } else adj_file << " "; break; default: - adj_file << left << setw(PAD2) << _it_msr->measType; + adj_file << std::left << std::setw(PAD2) << _it_msr->measType; } #ifdef _MSDEBUG @@ -12162,7 +12338,7 @@ void dna_adjust::PrintIgnoredAdjMeasurements(bool printHeader) PrintCompMeasurements_CELMS(_it_msr, design_row, ignoredMsrs); break; case 'D': // Direction set - PrintCompMeasurements_D(_it_msr, design_row); + PrintCompMeasurements_D(_it_msr, design_row, true); break; case 'H': // Orthometric height case 'R': // Ellipsoidal height @@ -12183,7 +12359,7 @@ void dna_adjust::PrintIgnoredAdjMeasurements(bool printHeader) } - adj_file << endl << endl; + adj_file << std::endl << std::endl; } @@ -12272,11 +12448,11 @@ bool dna_adjust::IgnoredMeasurementContainsInvalidStation(pit_vmsr_t _it_msr) void dna_adjust::PrintAdjMeasurements(v_uint32_u32u32_pair msr_block, bool printHeader) { // Print heading - string table_heading("Adjusted Measurements"); + std::string table_heading("Adjusted Measurements"); if (projectSettings_.o._adj_msr_iteration) { - stringstream ss; + std::stringstream ss; if (projectSettings_.a.adjust_mode == PhasedMode && forward_) { UINT32 block = msr_block.at(0).second.first; @@ -12304,9 +12480,6 @@ void dna_adjust::PrintAdjMeasurements(v_uint32_u32u32_pair msr_block, bool print // Should the adjusted measurements be sorted? switch (projectSettings_.o._sort_adj_msr) { - case orig_adj_msr_sort_ui: - sort(msr_block.begin(), msr_block.end()); - break; case type_adj_msr_sort_ui: SortMeasurementsbyType(msr_block); break; @@ -12328,13 +12501,14 @@ void dna_adjust::PrintAdjMeasurements(v_uint32_u32u32_pair msr_block, bool print case n_st_adj_msr_sort_ui: SortMeasurementsbyNstat(msr_block); break; - case outl_adj_msr_sort_ui: - SortMeasurementsbyOutlier(msr_block); + case orig_adj_msr_sort_ui: + default: + std::sort(msr_block.begin(), msr_block.end()); break; } } catch (...) { - stringstream ss; + std::stringstream ss; ss << "Failed to sort measurements according to the "; switch (projectSettings_.o._sort_adj_msr) @@ -12363,22 +12537,15 @@ void dna_adjust::PrintAdjMeasurements(v_uint32_u32u32_pair msr_block, bool print case n_st_adj_msr_sort_ui: ss << "measurement n-statistic"; break; - case outl_adj_msr_sort_ui: - ss << "measurement outlier"; - break; } - ss << endl; + ss << std::endl; SignalExceptionAdjustment(ss.str(), 0); } UINT32 clusterID(MAX_UINT32_VALUE); - // Initialise database id iterator - if (projectSettings_.o._database_ids) - _it_dbid = v_msr_db_map_.begin(); - for (_it_block_msr=msr_block.begin(); _it_block_msr!=msr_block.end(); ++_it_block_msr) { _it_msr = bmsBinaryRecords_.begin() + (_it_block_msr->first); @@ -12403,14 +12570,14 @@ void dna_adjust::PrintAdjMeasurements(v_uint32_u32u32_pair msr_block, bool print case 'Y': // GPS Point cluster if (_it_msr->clusterID != clusterID) { - adj_file << left << setw(PAD2) << _it_msr->measType; + adj_file << std::left << std::setw(PAD2) << _it_msr->measType; clusterID = _it_msr->clusterID; } else adj_file << " "; break; default: - adj_file << left << setw(PAD2) << _it_msr->measType; + adj_file << std::left << std::setw(PAD2) << _it_msr->measType; } // normal format @@ -12454,7 +12621,7 @@ void dna_adjust::PrintAdjMeasurements(v_uint32_u32u32_pair msr_block, bool print } - adj_file << endl; + adj_file << std::endl; } @@ -12467,9 +12634,10 @@ void dna_adjust::PrintCompMeasurementsAngular(const char cardinal, const double& PrintMeasurementCorrection(cardinal, _it_msr); // Print measurement database ids - PrintMeasurementDatabaseID(_it_msr); + if (projectSettings_.o._database_ids) + PrintMeasurementDatabaseID(_it_msr); - adj_file << endl; + adj_file << std::endl; } @@ -12490,18 +12658,19 @@ void dna_adjust::PrintCompMeasurementsLinear(const char cardinal, const double& PrintMeasurementCorrection(cardinal, _it_msr); // Print measurement database ids - PrintMeasurementDatabaseID(_it_msr); + if (projectSettings_.o._database_ids) + PrintMeasurementDatabaseID(_it_msr); - adj_file << endl; + adj_file << std::endl; } void dna_adjust::PrintCompMeasurements_A(const UINT32& block, it_vmsr_t& _it_msr, UINT32& design_row, printMeasurementsMode printMode) { // normal format - adj_file << left << setw(STATION) << bstBinaryRecords_.at(_it_msr->station1).stationName; - adj_file << left << setw(STATION) << bstBinaryRecords_.at(_it_msr->station2).stationName; - adj_file << left << setw(STATION) << bstBinaryRecords_.at(_it_msr->station3).stationName; + adj_file << std::left << std::setw(STATION) << bstBinaryRecords_.at(_it_msr->station1).stationName; + adj_file << std::left << std::setw(STATION) << bstBinaryRecords_.at(_it_msr->station2).stationName; + adj_file << std::left << std::setw(STATION) << bstBinaryRecords_.at(_it_msr->station3).stationName; double computed, correction; switch (printMode) @@ -12528,9 +12697,9 @@ void dna_adjust::PrintCompMeasurements_A(const UINT32& block, it_vmsr_t& _it_msr void dna_adjust::PrintCompMeasurements_BKVZ(const UINT32& block, it_vmsr_t& _it_msr, UINT32& design_row, printMeasurementsMode printMode) { // normal format - adj_file << left << setw(STATION) << bstBinaryRecords_.at(_it_msr->station1).stationName; - adj_file << left << setw(STATION) << bstBinaryRecords_.at(_it_msr->station2).stationName; - adj_file << left << setw(STATION) << " "; + adj_file << std::left << std::setw(STATION) << bstBinaryRecords_.at(_it_msr->station1).stationName; + adj_file << std::left << std::setw(STATION) << bstBinaryRecords_.at(_it_msr->station2).stationName; + adj_file << std::left << std::setw(STATION) << " "; double computed, correction; switch (printMode) @@ -12557,9 +12726,9 @@ void dna_adjust::PrintCompMeasurements_BKVZ(const UINT32& block, it_vmsr_t& _it_ void dna_adjust::PrintCompMeasurements_CELMS(it_vmsr_t& _it_msr, UINT32& design_row, printMeasurementsMode printMode) { // normal format - adj_file << left << setw(STATION) << bstBinaryRecords_.at(_it_msr->station1).stationName; - adj_file << left << setw(STATION) << bstBinaryRecords_.at(_it_msr->station2).stationName; - adj_file << left << setw(STATION) << " "; + adj_file << std::left << std::setw(STATION) << bstBinaryRecords_.at(_it_msr->station1).stationName; + adj_file << std::left << std::setw(STATION) << bstBinaryRecords_.at(_it_msr->station2).stationName; + adj_file << std::left << std::setw(STATION) << " "; double computed; switch (printMode) @@ -12583,43 +12752,64 @@ void dna_adjust::PrintCompMeasurements_CELMS(it_vmsr_t& _it_msr, UINT32& design_ // The estimation of parameters from direction clusters is handled by reducing the // respective directions to angles. Therefore, the "adjusted measurements" are // the adjusted angles. -void dna_adjust::PrintCompMeasurements_D(it_vmsr_t& _it_msr, UINT32& design_row) +void dna_adjust::PrintCompMeasurements_D(it_vmsr_t& _it_msr, UINT32& design_row, bool printIgnored) { + UINT32 skip(0), ignored(_it_msr->vectorCount1 - _it_msr->vectorCount2); + // normal format - adj_file << left << setw(STATION) << bstBinaryRecords_.at(_it_msr->station1).stationName; - adj_file << left << setw(STATION) << bstBinaryRecords_.at(_it_msr->station2).stationName; - adj_file << left << setw(STATION) << " "; + adj_file << std::left << std::setw(STATION) << bstBinaryRecords_.at(_it_msr->station1).stationName; + adj_file << std::left << std::setw(STATION) << bstBinaryRecords_.at(_it_msr->station2).stationName; + adj_file << std::left << std::setw(STATION) << " "; double computed; - string ignoreFlag(" "); + std::string ignoreFlag(" "); if (_it_msr->ignore) ignoreFlag = "*"; - UINT32 angle_count(_it_msr->vectorCount1 - 1); + UINT32 angle_count; + if (printIgnored) + angle_count = _it_msr->vectorCount1 - 1; + else + angle_count = _it_msr->vectorCount2 - 1; - adj_file << setw(PAD3) << left << ignoreFlag << setw(PAD2) << left << angle_count; + adj_file << std::setw(PAD3) << std::left << ignoreFlag << std::setw(PAD2) << std::left << angle_count; + // Print measurement database ids if (projectSettings_.o._database_ids) { // Measured + Computed + Correction + Meas SD + Pre Adj Corr UINT32 b(MSR + MSR + CORR + PREC + PACORR); - adj_file << setw(b) << " "; + adj_file << std::setw(b) << " "; PrintMeasurementDatabaseID(_it_msr); } - adj_file << endl; + adj_file << std::endl; _it_msr++; for (UINT32 a(0); aignore && !printIgnored) + { + while (skip < ignored) + { + skip++; + _it_msr++; + if (!_it_msr->ignore) + break; + } + } + computed = _it_msr->term1 + _it_msr->measCorr; - adj_file << left << setw(PAD2) << " "; // measurement type - adj_file << left << setw(STATION) << " "; // station1 (Instrument) - adj_file << left << setw(STATION) << " "; // station2 (RO) - adj_file << left << setw(STATION) << + adj_file << std::left << std::setw(PAD2) << " "; // measurement type + adj_file << std::left << std::setw(STATION) << " "; // station1 (Instrument) + adj_file << std::left << std::setw(STATION) << " "; // station2 (RO) + adj_file << std::left << std::setw(STATION) << bstBinaryRecords_.at(_it_msr->station2).stationName; // target // Print angular measurement, taking care of user requirements for @@ -12680,17 +12870,17 @@ void dna_adjust::PrintCompMeasurements_YLLH(it_vmsr_t& _it_msr, UINT32& design_r stn1_it = bstBinaryRecords_.begin() + _it_y_msr->station1; if (nextElement) - adj_file << left << setw(PAD2) << _it_y_msr->measType; + adj_file << std::left << std::setw(PAD2) << _it_y_msr->measType; else nextElement = true; covariance_count = _it_y_msr->vectorCount2; // first, second, third stations - adj_file << left << setw(STATION) << + adj_file << std::left << std::setw(STATION) << stn1_it->stationName << - left << setw(STATION) << " " << // second station - left << setw(STATION) << " "; // third station + std::left << std::setw(STATION) << " " << // second station + std::left << std::setw(STATION) << " "; // third station // Print latitude PrintCompMeasurementsAngular('P', _it_y_msr->measAdj, _it_y_msr->measCorr, _it_y_msr); @@ -12734,28 +12924,28 @@ void dna_adjust::PrintCompMeasurements_GXY(const UINT32& block, it_vmsr_t& _it_m for (cluster_msr=0; cluster_msrmeasType; + adj_file << std::left << std::setw(PAD2) << _it_msr->measType; else nextElement = true; covariance_count = _it_msr->vectorCount2; // first station - adj_file << left << setw(STATION) << bstBinaryRecords_.at(_it_msr->station1).stationName; + adj_file << std::left << std::setw(STATION) << bstBinaryRecords_.at(_it_msr->station1).stationName; // Print second station? switch (_it_msr->measType) { case 'G': case 'X': - adj_file << left << setw(STATION) << bstBinaryRecords_.at(_it_msr->station2).stationName; + adj_file << std::left << std::setw(STATION) << bstBinaryRecords_.at(_it_msr->station2).stationName; break; default: - adj_file << left << setw(STATION) << " "; + adj_file << std::left << std::setw(STATION) << " "; } // third station - adj_file << left << setw(STATION) << " "; + adj_file << std::left << std::setw(STATION) << " "; switch (printMode) { @@ -12825,9 +13015,9 @@ void dna_adjust::PrintCompMeasurements_GXY(const UINT32& block, it_vmsr_t& _it_m void dna_adjust::PrintCompMeasurements_HR(const UINT32& block, it_vmsr_t& _it_msr, UINT32& design_row, printMeasurementsMode printMode) { // normal format - adj_file << left << setw(STATION) << bstBinaryRecords_.at(_it_msr->station1).stationName; - adj_file << left << setw(STATION) << " "; - adj_file << left << setw(STATION) << " "; + adj_file << std::left << std::setw(STATION) << bstBinaryRecords_.at(_it_msr->station1).stationName; + adj_file << std::left << std::setw(STATION) << " "; + adj_file << std::left << std::setw(STATION) << " "; double computed, correction; @@ -12854,9 +13044,9 @@ void dna_adjust::PrintCompMeasurements_HR(const UINT32& block, it_vmsr_t& _it_ms void dna_adjust::PrintCompMeasurements_IJPQ(const UINT32& block, it_vmsr_t& _it_msr, UINT32& design_row, printMeasurementsMode printMode) { // normal format - adj_file << left << setw(STATION) << bstBinaryRecords_.at(_it_msr->station1).stationName; - adj_file << left << setw(STATION) << " "; - adj_file << left << setw(STATION) << " "; + adj_file << std::left << std::setw(STATION) << bstBinaryRecords_.at(_it_msr->station1).stationName; + adj_file << std::left << std::setw(STATION) << " "; + adj_file << std::left << std::setw(STATION) << " "; double computed, correction; @@ -12882,7 +13072,7 @@ void dna_adjust::PrintCompMeasurements_IJPQ(const UINT32& block, it_vmsr_t& _it_ void dna_adjust::PrintMeasurementsAngular(const char cardinal, const double& measurement, const double& correction, const it_vmsr_t& _it_msr, bool printAdjMsr) { - string ignoreFlag(" "); + std::string ignoreFlag(" "); double preAdjMeas(_it_msr->preAdjMeas); double adjMeas(measurement); @@ -12913,27 +13103,27 @@ void dna_adjust::PrintMeasurementsAngular(const char cardinal, const double& mea case 'v': // GNSS (alt units) Elevation // Change from printing whitespace for 2nd/3rd baseline station components, to // printing all station information - //adj_file << setw(PAD2+STATION+STATION+STATION) << " "; + //adj_file << std::setw(PAD2+STATION+STATION+STATION) << " "; // Measurement type - adj_file << left << setw(PAD2) << _it_msr->measType; + adj_file << std::left << std::setw(PAD2) << _it_msr->measType; // first station - adj_file << left << setw(STATION) << bstBinaryRecords_.at(_it_msr->station1).stationName; + adj_file << std::left << std::setw(STATION) << bstBinaryRecords_.at(_it_msr->station1).stationName; // second station switch (_it_msr->measType) { case 'G': case 'X': - adj_file << left << setw(STATION) << bstBinaryRecords_.at(_it_msr->station2).stationName; + adj_file << std::left << std::setw(STATION) << bstBinaryRecords_.at(_it_msr->station2).stationName; break; case 'Y': - adj_file << left << setw(STATION) << " "; + adj_file << std::left << std::setw(STATION) << " "; } // third station - adj_file << left << setw(STATION) << " "; + adj_file << std::left << std::setw(STATION) << " "; } - adj_file << setw(PAD3) << left << ignoreFlag << setw(PAD2) << left << cardinal; + adj_file << std::setw(PAD3) << std::left << ignoreFlag << std::setw(PAD2) << std::left << cardinal; double precision(0.0); @@ -12972,96 +13162,96 @@ void dna_adjust::PrintMeasurementsAngular(const char cardinal, const double& mea case SEPARATED_WITH_SYMBOLS: // ddd\B0 mm' ss.sss" adj_file << - setw(MSR) << right << FormatDmsString(RadtoDms(preAdjMeas), 4+PRECISION_SEC_MSR, // Measured (less correction + std::setw(MSR) << std::right << FormatDmsString(RadtoDms(preAdjMeas), 4+PRECISION_SEC_MSR, // Measured (less correction true, true) << // for deflections if applied) - setw(MSR) << right << FormatDmsString(RadtoDms(adjMeas), 4+PRECISION_SEC_MSR, // Adjusted + std::setw(MSR) << std::right << FormatDmsString(RadtoDms(adjMeas), 4+PRECISION_SEC_MSR, // Adjusted true, true); break; case HP_NOTATION: // ddd.mmssssss - adj_file << setw(MSR) << right << StringFromT(RadtoDms(preAdjMeas), 4+PRECISION_SEC_MSR) << // Measured (less correction for deflections) - setw(MSR) << right << StringFromT(RadtoDms(adjMeas), 4+PRECISION_SEC_MSR); // Adjusted + adj_file << std::setw(MSR) << std::right << StringFromT(RadtoDms(preAdjMeas), 4+PRECISION_SEC_MSR) << // Measured (less correction for deflections) + std::setw(MSR) << std::right << StringFromT(RadtoDms(adjMeas), 4+PRECISION_SEC_MSR); // Adjusted break; case SEPARATED: default: // ddd mm ss.ssss adj_file << - setw(MSR) << right << FormatDmsString(RadtoDms(preAdjMeas), 4+PRECISION_SEC_MSR, // Measured (less correction + std::setw(MSR) << std::right << FormatDmsString(RadtoDms(preAdjMeas), 4+PRECISION_SEC_MSR, // Measured (less correction true, false) << // for deflections if applied) - setw(MSR) << right << FormatDmsString(RadtoDms(adjMeas), 4+PRECISION_SEC_MSR, // Computed + std::setw(MSR) << std::right << FormatDmsString(RadtoDms(adjMeas), 4+PRECISION_SEC_MSR, // Computed true, false); break; } if (isAdjustmentQuestionable_ || (fabs(_it_msr->NStat) > criticalValue_ * 4.0)) adj_file << - right << StringFromTW(removeNegativeZero(Seconds(correction), PRECISION_SEC_MSR), CORR, PRECISION_SEC_MSR) << // correction - right << StringFromTW(Seconds(sqrt(precision)), PREC, PRECISION_SEC_MSR); // Precision (Meas) + std::right << StringFromTW(removeNegativeZero(Seconds(correction), PRECISION_SEC_MSR), CORR, PRECISION_SEC_MSR) << // correction + std::right << StringFromTW(Seconds(sqrt(precision)), PREC, PRECISION_SEC_MSR); // Precision (Meas) else adj_file << - setw(CORR) << right << StringFromT(removeNegativeZero(Seconds(correction), PRECISION_SEC_MSR), PRECISION_SEC_MSR) << // correction - setw(PREC) << right << StringFromT(Seconds(sqrt(precision)), PRECISION_SEC_MSR); // Precision (Meas) + std::setw(CORR) << std::right << StringFromT(removeNegativeZero(Seconds(correction), PRECISION_SEC_MSR), PRECISION_SEC_MSR) << // correction + std::setw(PREC) << std::right << StringFromT(Seconds(sqrt(precision)), PRECISION_SEC_MSR); // Precision (Meas) if (printAdjMsr) { if (isAdjustmentQuestionable_ || (fabs(_it_msr->NStat) > criticalValue_ * 4.0)) adj_file << - right << StringFromTW(Seconds(sqrt(_it_msr->measAdjPrec)), PREC, PRECISION_SEC_MSR) << // Precision (Adjusted) - right << StringFromTW(Seconds(sqrt(_it_msr->residualPrec)), PREC, PRECISION_SEC_MSR); // Precision (Residual) + std::right << StringFromTW(Seconds(sqrt(_it_msr->measAdjPrec)), PREC, PRECISION_SEC_MSR) << // Precision (Adjusted) + std::right << StringFromTW(Seconds(sqrt(_it_msr->residualPrec)), PREC, PRECISION_SEC_MSR); // Precision (Residual) else adj_file << - setw(PREC) << right << StringFromT(Seconds(sqrt(_it_msr->measAdjPrec)), PRECISION_SEC_MSR) << // Precision (Adjusted) - setw(PREC) << right << StringFromT(Seconds(sqrt(_it_msr->residualPrec)), PRECISION_SEC_MSR); // Precision (Residual) + std::setw(PREC) << std::right << StringFromT(Seconds(sqrt(_it_msr->measAdjPrec)), PRECISION_SEC_MSR) << // Precision (Adjusted) + std::setw(PREC) << std::right << StringFromT(Seconds(sqrt(_it_msr->residualPrec)), PRECISION_SEC_MSR); // Precision (Residual) } } else // DDEG { // ddd.dddddddd //TODO - is longitude being printed? If so, use DegreesL - adj_file << setw(MSR) << right << StringFromT(Degrees(preAdjMeas), 4+PRECISION_SEC_MSR) << // Measured (less correction for deflections) - setw(MSR) << right << StringFromT(Degrees(adjMeas), 4+PRECISION_SEC_MSR); // Adjusted + adj_file << std::setw(MSR) << std::right << StringFromT(Degrees(preAdjMeas), 4+PRECISION_SEC_MSR) << // Measured (less correction for deflections) + std::setw(MSR) << std::right << StringFromT(Degrees(adjMeas), 4+PRECISION_SEC_MSR); // Adjusted if (isAdjustmentQuestionable_ || (fabs(_it_msr->NStat) > criticalValue_ * 4.0)) adj_file << - right << StringFromTW(removeNegativeZero(Degrees(correction), PRECISION_SEC_MSR), CORR, PRECISION_SEC_MSR) << // Correction - right << StringFromTW(Degrees(sqrt(precision)), PREC, PRECISION_SEC_MSR); // Precision (Meas) + std::right << StringFromTW(removeNegativeZero(Degrees(correction), PRECISION_SEC_MSR), CORR, PRECISION_SEC_MSR) << // Correction + std::right << StringFromTW(Degrees(sqrt(precision)), PREC, PRECISION_SEC_MSR); // Precision (Meas) else adj_file << - setw(CORR) << right << StringFromT(removeNegativeZero(Degrees(correction), PRECISION_SEC_MSR), PRECISION_SEC_MSR) << // Correction - setw(PREC) << right << StringFromT(Degrees(sqrt(precision)), PRECISION_SEC_MSR); // Precision (Meas) + std::setw(CORR) << std::right << StringFromT(removeNegativeZero(Degrees(correction), PRECISION_SEC_MSR), PRECISION_SEC_MSR) << // Correction + std::setw(PREC) << std::right << StringFromT(Degrees(sqrt(precision)), PRECISION_SEC_MSR); // Precision (Meas) if (printAdjMsr) { if (isAdjustmentQuestionable_ || (fabs(_it_msr->NStat) > criticalValue_ * 4.0)) adj_file << - right << StringFromTW(Degrees(sqrt(_it_msr->measAdjPrec)), PREC, PRECISION_SEC_MSR) << // Precision (Adjusted) - right << StringFromTW(Degrees(sqrt(_it_msr->residualPrec)), PREC, PRECISION_SEC_MSR); // Precision (Residual) + std::right << StringFromTW(Degrees(sqrt(_it_msr->measAdjPrec)), PREC, PRECISION_SEC_MSR) << // Precision (Adjusted) + std::right << StringFromTW(Degrees(sqrt(_it_msr->residualPrec)), PREC, PRECISION_SEC_MSR); // Precision (Residual) else adj_file << - setw(PREC) << right << StringFromT(Degrees(sqrt(_it_msr->measAdjPrec)), PRECISION_SEC_MSR) << // Precision (Adjusted) - setw(PREC) << right << StringFromT(Degrees(sqrt(_it_msr->residualPrec)), PRECISION_SEC_MSR); // Precision (Residual) + std::setw(PREC) << std::right << StringFromT(Degrees(sqrt(_it_msr->measAdjPrec)), PRECISION_SEC_MSR) << // Precision (Adjusted) + std::setw(PREC) << std::right << StringFromT(Degrees(sqrt(_it_msr->residualPrec)), PRECISION_SEC_MSR); // Precision (Residual) } } } -void dna_adjust::PrintAdjMeasurementsAngular(const char cardinal, const it_vmsr_t& _it_msr) +void dna_adjust::PrintAdjMeasurementsAngular(const char cardinal, const it_vmsr_t& _it_msr, bool initialise_dbindex) { // Print adjusted angular measurements PrintMeasurementsAngular(cardinal, _it_msr->measAdj, _it_msr->measCorr, _it_msr); // Print adjusted statistics - PrintAdjMeasurementStatistics(cardinal, _it_msr); + PrintAdjMeasurementStatistics(cardinal, _it_msr, initialise_dbindex); } -void dna_adjust::PrintAdjMeasurementsLinear(const char cardinal, const it_vmsr_t& _it_msr) +void dna_adjust::PrintAdjMeasurementsLinear(const char cardinal, const it_vmsr_t& _it_msr, bool initialise_dbindex) { // Print adjusted linear measurements PrintMeasurementsLinear(cardinal, _it_msr->measAdj, _it_msr->measCorr, _it_msr); // Print adjusted statistics - PrintAdjMeasurementStatistics(cardinal, _it_msr); + PrintAdjMeasurementStatistics(cardinal, _it_msr, initialise_dbindex); } @@ -13072,7 +13262,7 @@ void dna_adjust::PrintMeasurementsLinear( const it_vmsr_t& _it_msr, bool printAdjMsr) { - string ignoreFlag(" "); + std::string ignoreFlag(" "); if (_it_msr->ignore) ignoreFlag = "*"; @@ -13086,36 +13276,36 @@ void dna_adjust::PrintMeasurementsLinear( case 's': // Change from printing whitespace for 2nd/3rd baseline station components, to // printing all station information - //adj_file << setw(PAD2+STATION+STATION+STATION) << " "; + //adj_file << std::setw(PAD2+STATION+STATION+STATION) << " "; // Measurement type - adj_file << left << setw(PAD2) << _it_msr->measType; + adj_file << std::left << std::setw(PAD2) << _it_msr->measType; // first station - adj_file << left << setw(STATION) << bstBinaryRecords_.at(_it_msr->station1).stationName; + adj_file << std::left << std::setw(STATION) << bstBinaryRecords_.at(_it_msr->station1).stationName; // second station switch (_it_msr->measType) { case 'G': case 'X': - adj_file << left << setw(STATION) << bstBinaryRecords_.at(_it_msr->station2).stationName; + adj_file << std::left << std::setw(STATION) << bstBinaryRecords_.at(_it_msr->station2).stationName; break; case 'Y': - adj_file << left << setw(STATION) << " "; + adj_file << std::left << std::setw(STATION) << " "; } // third station - adj_file << left << setw(STATION) << " "; + adj_file << std::left << std::setw(STATION) << " "; } - adj_file << setw(PAD3) << left << ignoreFlag << setw(PAD2) << left << cardinal << // If GPS, then 'X', 'Y' or 'Z', else ' ' - setw(MSR) << setprecision(PRECISION_MTR_MSR) << fixed << right << _it_msr->preAdjMeas << // Measured (less correction for geoid) - setw(MSR) << setprecision(PRECISION_MTR_MSR) << fixed << right << measurement; // Adjusted + adj_file << std::setw(PAD3) << std::left << ignoreFlag << std::setw(PAD2) << std::left << cardinal << // If GPS, then 'X', 'Y' or 'Z', else ' ' + std::setw(MSR) << std::setprecision(PRECISION_MTR_MSR) << std::fixed << std::right << _it_msr->preAdjMeas << // Measured (less correction for geoid) + std::setw(MSR) << std::setprecision(PRECISION_MTR_MSR) << std::fixed << std::right << measurement; // Adjusted if (isAdjustmentQuestionable_ || (fabs(_it_msr->NStat) > criticalValue_ * 4.0)) adj_file << - right << StringFromTW(removeNegativeZero(correction, PRECISION_MTR_MSR), CORR, PRECISION_MTR_MSR); // Correction + std::right << StringFromTW(removeNegativeZero(correction, PRECISION_MTR_MSR), CORR, PRECISION_MTR_MSR); // Correction else adj_file << - setw(CORR) << setprecision(PRECISION_MTR_MSR) << fixed << right << + std::setw(CORR) << std::setprecision(PRECISION_MTR_MSR) << std::fixed << std::right << removeNegativeZero(correction, PRECISION_MTR_MSR); // Correction // print the correct precision term @@ -13128,25 +13318,25 @@ void dna_adjust::PrintMeasurementsLinear( { case 'X': // XYZ case 'e': // ENU - adj_file << setw(PREC) << setprecision(PRECISION_MTR_MSR) << fixed << right << sqrt(_it_msr->term2); // Precision (Meas) + adj_file << std::setw(PREC) << std::setprecision(PRECISION_MTR_MSR) << std::fixed << std::right << sqrt(_it_msr->term2); // Precision (Meas) break; case 'Y': // XYZ case 'n': // ENU - adj_file << setw(PREC) << setprecision(PRECISION_MTR_MSR) << fixed << right << sqrt(_it_msr->term3); // Precision (Meas) + adj_file << std::setw(PREC) << std::setprecision(PRECISION_MTR_MSR) << std::fixed << std::right << sqrt(_it_msr->term3); // Precision (Meas) break; case 'Z': // XYZ case 'u': // ENU case 'H': // LLH (Lat and Lon cardinals are printed in PrintMeasurementsAngular) - adj_file << setw(PREC) << setprecision(PRECISION_MTR_MSR) << fixed << right << sqrt(_it_msr->term4); // Precision (Meas) + adj_file << std::setw(PREC) << std::setprecision(PRECISION_MTR_MSR) << std::fixed << std::right << sqrt(_it_msr->term4); // Precision (Meas) break; case 's': // AED (Azimuth and vertical angle cardinals are printed in PrintMeasurementsAngular) switch (projectSettings_.o._adj_gnss_units) { case AED_adj_gnss_ui: - adj_file << setw(PREC) << setprecision(PRECISION_MTR_MSR) << fixed << right << sqrt(_it_msr->term4); // Precision (Meas) + adj_file << std::setw(PREC) << std::setprecision(PRECISION_MTR_MSR) << std::fixed << std::right << sqrt(_it_msr->term4); // Precision (Meas) break; case ADU_adj_gnss_ui: - adj_file << setw(PREC) << setprecision(PRECISION_MTR_MSR) << fixed << right << sqrt(_it_msr->term3); // Precision (Meas) + adj_file << std::setw(PREC) << std::setprecision(PRECISION_MTR_MSR) << std::fixed << std::right << sqrt(_it_msr->term3); // Precision (Meas) break; } break; @@ -13156,18 +13346,18 @@ void dna_adjust::PrintMeasurementsLinear( if (isAdjustmentQuestionable_ || (fabs(_it_msr->NStat) > criticalValue_ * 4.0)) adj_file << StringFromTW(sqrt(_it_msr->term2), PREC, PRECISION_MTR_MSR); // Precision (Meas) else - adj_file << setw(PREC) << setprecision(PRECISION_MTR_MSR) << fixed << right << sqrt(_it_msr->term2); // Precision (Meas) + adj_file << std::setw(PREC) << std::setprecision(PRECISION_MTR_MSR) << std::fixed << std::right << sqrt(_it_msr->term2); // Precision (Meas) } if (printAdjMsr) { if (isAdjustmentQuestionable_ || (fabs(_it_msr->NStat) > criticalValue_ * 4.0)) adj_file << - right << StringFromTW(sqrt(_it_msr->measAdjPrec), PREC, PRECISION_MTR_MSR) << // Precision (Adjusted) - right << StringFromTW(sqrt(_it_msr->residualPrec), PREC, PRECISION_MTR_MSR); // Precision (Residual) + std::right << StringFromTW(sqrt(_it_msr->measAdjPrec), PREC, PRECISION_MTR_MSR) << // Precision (Adjusted) + std::right << StringFromTW(sqrt(_it_msr->residualPrec), PREC, PRECISION_MTR_MSR); // Precision (Residual) else - adj_file << setw(PREC) << setprecision(PRECISION_MTR_MSR) << fixed << right << sqrt(_it_msr->measAdjPrec) << // Precision (Adjusted) - setw(PREC) << setprecision(PRECISION_MTR_MSR) << fixed << right << sqrt(_it_msr->residualPrec); // Precision (Residual) + adj_file << std::setw(PREC) << std::setprecision(PRECISION_MTR_MSR) << std::fixed << std::right << sqrt(_it_msr->measAdjPrec) << // Precision (Adjusted) + std::setw(PREC) << std::setprecision(PRECISION_MTR_MSR) << std::fixed << std::right << sqrt(_it_msr->residualPrec); // Precision (Residual) } } @@ -13186,7 +13376,7 @@ void dna_adjust::PrintMeasurementCorrection(const char cardinal, const it_vmsr_t case 'V': case 'Z': // Pre adjustment correction for deflections - adj_file << setw(PACORR) << setprecision(PRECISION_SEC_MSR) << fixed << right << + adj_file << std::setw(PACORR) << std::setprecision(PRECISION_SEC_MSR) << std::fixed << std::right << removeNegativeZero(Seconds(_it_msr->preAdjCorr), PRECISION_SEC_MSR); break; case 'Y': @@ -13195,15 +13385,15 @@ void dna_adjust::PrintMeasurementCorrection(const char cardinal, const it_vmsr_t switch (cardinal) { case 'H': - adj_file << setw(PACORR) << setprecision(PRECISION_MTR_MSR) << fixed << right << + adj_file << std::setw(PACORR) << std::setprecision(PRECISION_MTR_MSR) << std::fixed << std::right << removeNegativeZero(_it_msr->preAdjCorr, PRECISION_MTR_MSR); break; case 'P': case 'L': - adj_file << setw(PACORR) << setprecision(PRECISION_SEC_MSR) << fixed << right << 0.0; + adj_file << std::setw(PACORR) << std::setprecision(PRECISION_SEC_MSR) << std::fixed << std::right << 0.0; break; default: // X, Y, Z - adj_file << setw(PACORR) << setprecision(PRECISION_MTR_MSR) << fixed << right << 0.0; + adj_file << std::setw(PACORR) << std::setprecision(PRECISION_MTR_MSR) << std::fixed << std::right << 0.0; break; } break; @@ -13217,7 +13407,7 @@ void dna_adjust::PrintMeasurementCorrection(const char cardinal, const it_vmsr_t case 'X': default: // Pre adjustment correction for N-value or reductions from MSL/ellipsoid arcs - adj_file << setw(PACORR) << setprecision(PRECISION_SEC_MSR) << fixed << right << + adj_file << std::setw(PACORR) << std::setprecision(PRECISION_SEC_MSR) << std::fixed << std::right << removeNegativeZero(_it_msr->preAdjCorr, PRECISION_SEC_MSR); break; } @@ -13225,43 +13415,44 @@ void dna_adjust::PrintMeasurementCorrection(const char cardinal, const it_vmsr_t } -void dna_adjust::PrintMeasurementDatabaseID(const it_vmsr_t& _it_msr) +void dna_adjust::PrintMeasurementDatabaseID(const it_vmsr_t& _it_msr, bool initialise_dbindex) { - if (projectSettings_.o._database_ids) + // set iterator to the database index + if (initialise_dbindex) { - size_t dbindex = std::distance(bmsBinaryRecords_.begin(), _it_msr); - _it_dbid = v_msr_db_map_.begin() + dbindex; + size_t dbindx = std::distance(bmsBinaryRecords_.begin(), _it_msr); + _it_dbid = v_msr_db_map_.begin() + dbindx; + } - // Print measurement id - if (_it_dbid->is_msr_id_set) - adj_file << setw(STDDEV) << right << _it_dbid->msr_id; - else - adj_file << setw(STDDEV) << " "; + // Print measurement id + if (_it_dbid->is_msr_id_set) + adj_file << std::setw(STDDEV) << std::right << _it_dbid->msr_id; + else + adj_file << std::setw(STDDEV) << " "; - // Print cluster id? - switch (_it_msr->measType) - { - case 'D': - case 'G': - case 'X': - case 'Y': - if (_it_dbid->is_cls_id_set) - adj_file << setw(STDDEV) << right << _it_dbid->cluster_id; - else - adj_file << setw(STDDEV) << " "; - } + // Print cluster id? + switch (_it_msr->measType) + { + case 'D': + case 'G': + case 'X': + case 'Y': + if (_it_dbid->is_cls_id_set) + adj_file << std::setw(STDDEV) << std::right << _it_dbid->cluster_id; + else + adj_file << std::setw(STDDEV) << " "; } } -void dna_adjust::PrintAdjMeasurementStatistics(const char cardinal, const it_vmsr_t& _it_msr) +void dna_adjust::PrintAdjMeasurementStatistics(const char cardinal, const it_vmsr_t& _it_msr, bool initialise_dbindex) { UINT16 PRECISION_STAT(2); if (isAdjustmentQuestionable_ || (fabs(_it_msr->NStat) > criticalValue_ * 4.0)) adj_file << StringFromTW(removeNegativeZero(_it_msr->NStat, 2), STAT, PRECISION_STAT); // N Stat else - adj_file << setw(STAT) << setprecision(2) << fixed << right << + adj_file << std::setw(STAT) << std::setprecision(2) << std::fixed << std::right << removeNegativeZero(_it_msr->NStat, 2); // N Stat if (projectSettings_.o._adj_msr_tstat) @@ -13269,33 +13460,34 @@ void dna_adjust::PrintAdjMeasurementStatistics(const char cardinal, const it_vms if (isAdjustmentQuestionable_ || (fabs(_it_msr->NStat) > criticalValue_ * 4.0)) adj_file << StringFromTW(removeNegativeZero(_it_msr->TStat, 2), STAT, PRECISION_STAT); // T Stat else - adj_file << setw(STAT) << setprecision(2) << fixed << right << + adj_file << std::setw(STAT) << std::setprecision(2) << std::fixed << std::right << removeNegativeZero(_it_msr->TStat, 2); // T Stat } - adj_file << setw(REL) << setprecision(2) << fixed << right << _it_msr->PelzerRel; // Pelzer's reliability + adj_file << std::setw(REL) << std::setprecision(2) << std::fixed << std::right << _it_msr->PelzerRel; // Pelzer's reliability // Print measurement correction PrintMeasurementCorrection(cardinal, _it_msr); // Print asterisk for values which exceed the critical value if (fabs(_it_msr->NStat) > criticalValue_) - adj_file << setw(OUTLIER) << right << "*"; + adj_file << std::setw(OUTLIER) << std::right << "*"; else - adj_file << setw(OUTLIER) << right << " "; + adj_file << std::setw(OUTLIER) << std::right << " "; // Print measurement database ids - PrintMeasurementDatabaseID(_it_msr); + if (projectSettings_.o._database_ids) + PrintMeasurementDatabaseID(_it_msr, initialise_dbindex); - adj_file << endl; + adj_file << std::endl; } void dna_adjust::PrintAdjMeasurements_A(it_vmsr_t& _it_msr) { // normal format - adj_file << left << setw(STATION) << bstBinaryRecords_.at(_it_msr->station1).stationName; - adj_file << left << setw(STATION) << bstBinaryRecords_.at(_it_msr->station2).stationName; - adj_file << left << setw(STATION) << bstBinaryRecords_.at(_it_msr->station3).stationName; + adj_file << std::left << std::setw(STATION) << bstBinaryRecords_.at(_it_msr->station1).stationName; + adj_file << std::left << std::setw(STATION) << bstBinaryRecords_.at(_it_msr->station2).stationName; + adj_file << std::left << std::setw(STATION) << bstBinaryRecords_.at(_it_msr->station3).stationName; // Print angular measurement, taking care of user requirements for // type, format and precision @@ -13306,9 +13498,9 @@ void dna_adjust::PrintAdjMeasurements_A(it_vmsr_t& _it_msr) void dna_adjust::PrintAdjMeasurements_BKVZ(it_vmsr_t& _it_msr) { // normal format - adj_file << left << setw(STATION) << bstBinaryRecords_.at(_it_msr->station1).stationName; - adj_file << left << setw(STATION) << bstBinaryRecords_.at(_it_msr->station2).stationName; - adj_file << left << setw(STATION) << " "; + adj_file << std::left << std::setw(STATION) << bstBinaryRecords_.at(_it_msr->station1).stationName; + adj_file << std::left << std::setw(STATION) << bstBinaryRecords_.at(_it_msr->station2).stationName; + adj_file << std::left << std::setw(STATION) << " "; // Print angular measurement, taking care of user requirements for // type, format and precision @@ -13319,9 +13511,9 @@ void dna_adjust::PrintAdjMeasurements_BKVZ(it_vmsr_t& _it_msr) void dna_adjust::PrintAdjMeasurements_CELMS(it_vmsr_t& _it_msr) { // normal format - adj_file << left << setw(STATION) << bstBinaryRecords_.at(_it_msr->station1).stationName; - adj_file << left << setw(STATION) << bstBinaryRecords_.at(_it_msr->station2).stationName; - adj_file << left << setw(STATION) << " "; + adj_file << std::left << std::setw(STATION) << bstBinaryRecords_.at(_it_msr->station1).stationName; + adj_file << std::left << std::setw(STATION) << bstBinaryRecords_.at(_it_msr->station2).stationName; + adj_file << std::left << std::setw(STATION) << " "; PrintAdjMeasurementsLinear(' ', _it_msr); } @@ -13333,17 +13525,18 @@ void dna_adjust::PrintAdjMeasurements_CELMS(it_vmsr_t& _it_msr) void dna_adjust::PrintAdjMeasurements_D(it_vmsr_t& _it_msr) { // normal format - adj_file << left << setw(STATION) << bstBinaryRecords_.at(_it_msr->station1).stationName; - adj_file << left << setw(STATION) << bstBinaryRecords_.at(_it_msr->station2).stationName; - adj_file << left << setw(STATION) << " "; + adj_file << std::left << std::setw(STATION) << bstBinaryRecords_.at(_it_msr->station1).stationName; + adj_file << std::left << std::setw(STATION) << bstBinaryRecords_.at(_it_msr->station2).stationName; + adj_file << std::left << std::setw(STATION) << " "; - string ignoreFlag(" "); + std::string ignoreFlag(" "); if (_it_msr->ignore) ignoreFlag = "*"; - UINT32 a, angle_count(_it_msr->vectorCount1 - 1); + UINT32 a, angle_count(_it_msr->vectorCount2 - 1); + UINT32 skip(0), ignored(_it_msr->vectorCount1 - _it_msr->vectorCount2); - adj_file << setw(PAD3) << left << ignoreFlag << setw(PAD2) << left << angle_count; + adj_file << std::setw(PAD3) << std::left << ignoreFlag << std::setw(PAD2) << std::left << angle_count; if (projectSettings_.o._database_ids) { @@ -13351,20 +13544,32 @@ void dna_adjust::PrintAdjMeasurements_D(it_vmsr_t& _it_msr) UINT32 b(MSR + MSR + CORR + PREC + PREC + PREC + STAT + REL + PACORR + OUTLIER); if (projectSettings_.o._adj_msr_tstat) b += STAT; - adj_file << setw(b) << " "; + adj_file << std::setw(b) << " "; PrintMeasurementDatabaseID(_it_msr); } - adj_file << endl; + adj_file << std::endl; _it_msr++; for (a=0; aignore) + { + while (skip < ignored) + { + skip++; + _it_msr++; + if (!_it_msr->ignore) + break; + } + } + + adj_file << std::left << std::setw(PAD2) << " "; // measurement type + adj_file << std::left << std::setw(STATION) << " "; // station1 (Instrument) + adj_file << std::left << std::setw(STATION) << " "; // station2 (RO) + adj_file << std::left << std::setw(STATION) << bstBinaryRecords_.at(_it_msr->station2).stationName; // target // Print angular measurement, taking care of user requirements for @@ -13538,7 +13743,7 @@ void dna_adjust::PrintAdjMeasurements_YLLH(it_vmsr_t& _it_msr) stn1_it = bstBinaryRecords_.begin() + _it_y_msr->station1; if (nextElement) - adj_file << left << setw(PAD2) << _it_y_msr->measType; + adj_file << std::left << std::setw(PAD2) << _it_y_msr->measType; else nextElement = true; @@ -13577,10 +13782,10 @@ void dna_adjust::PrintAdjMeasurements_YLLH(it_vmsr_t& _it_msr) _it_y_msr-=2; // first, second, third stations - adj_file << left << setw(STATION) << + adj_file << std::left << std::setw(STATION) << stn1_it->stationName << - left << setw(STATION) << " " << // second station - left << setw(STATION) << " "; // third station + std::left << std::setw(STATION) << " " << // second station + std::left << std::setw(STATION) << " "; // third station // Print X PrintAdjMeasurementsAngular('P', _it_y_msr); @@ -13621,28 +13826,28 @@ void dna_adjust::PrintAdjMeasurements_GXY(it_vmsr_t& _it_msr, const uint32_uint3 for (cluster_msr=0; cluster_msrmeasType; + adj_file << std::left << std::setw(PAD2) << _it_msr->measType; else nextElement = true; covariance_count = _it_msr->vectorCount2; // first station - adj_file << left << setw(STATION) << bstBinaryRecords_.at(_it_msr->station1).stationName; + adj_file << std::left << std::setw(STATION) << bstBinaryRecords_.at(_it_msr->station1).stationName; // Print second station? switch (_it_msr->measType) { case 'G': case 'X': - adj_file << left << setw(STATION) << bstBinaryRecords_.at(_it_msr->station2).stationName; + adj_file << std::left << std::setw(STATION) << bstBinaryRecords_.at(_it_msr->station2).stationName; break; default: - adj_file << left << setw(STATION) << " "; + adj_file << std::left << std::setw(STATION) << " "; } // third station - adj_file << left << setw(STATION) << " "; + adj_file << std::left << std::setw(STATION) << " "; // Print adjusted GNSS baseline measurements in alternate units? if (projectSettings_.o._adj_gnss_units != XYZ_adj_gnss_ui && @@ -13743,6 +13948,7 @@ void dna_adjust::PrintAdjGNSSAlternateUnits(it_vmsr_t& _it_msr, const uint32_uin bstBinaryRecords_.at(_it_msr->station1).currentLatitude, bstBinaryRecords_.at(_it_msr->station1).currentLongitude); + // return iterator to the X component of the GNSS measurement _it_msr -= 2; switch (projectSettings_.o._adj_gnss_units) @@ -13773,7 +13979,11 @@ void dna_adjust::PrintAdjGNSSAlternateUnits(it_vmsr_t& _it_msr, const uint32_uin // Update Pelzer reliability, N-Stat, T-Stat UpdateMsrRecordStats(_it_gnss_msr, _it_gnss_msr->term2); - PrintAdjMeasurementsLinear('e', _it_gnss_msr); + // Initialise database id iterator + if (projectSettings_.o._database_ids) + _it_dbid = v_msr_db_map_.begin() + std::distance(bmsBinaryRecords_.begin(), _it_msr); + + PrintAdjMeasurementsLinear('e', _it_gnss_msr, false); // N _it_msr++; @@ -13789,7 +13999,11 @@ void dna_adjust::PrintAdjGNSSAlternateUnits(it_vmsr_t& _it_msr, const uint32_uin // Update Pelzer reliability, N-Stat, T-Stat UpdateMsrRecordStats(_it_gnss_msr, _it_gnss_msr->term3); - PrintAdjMeasurementsLinear('n', _it_gnss_msr); + // Initialise database id iterator + if (projectSettings_.o._database_ids) + _it_dbid = v_msr_db_map_.begin() + std::distance(bmsBinaryRecords_.begin(), _it_msr); + + PrintAdjMeasurementsLinear('n', _it_gnss_msr, false); // U _it_msr++; @@ -13805,7 +14019,11 @@ void dna_adjust::PrintAdjGNSSAlternateUnits(it_vmsr_t& _it_msr, const uint32_uin // Update Pelzer reliability, N-Stat, T-Stat UpdateMsrRecordStats(_it_gnss_msr, _it_gnss_msr->term4); - PrintAdjMeasurementsLinear('u', _it_gnss_msr); + // Initialise database id iterator + if (projectSettings_.o._database_ids) + _it_dbid = v_msr_db_map_.begin() + std::distance(bmsBinaryRecords_.begin(), _it_msr); + + PrintAdjMeasurementsLinear('u', _it_gnss_msr, false); break; case AED_adj_gnss_ui: @@ -13850,7 +14068,11 @@ void dna_adjust::PrintAdjGNSSAlternateUnits(it_vmsr_t& _it_msr, const uint32_uin // Update Pelzer reliability, N-Stat, T-Stat UpdateMsrRecordStats(_it_gnss_msr, _it_gnss_msr->term2); - PrintAdjMeasurementsAngular('a', _it_gnss_msr); + // Initialise database id iterator + if (projectSettings_.o._database_ids) + _it_dbid = v_msr_db_map_.begin() + std::distance(bmsBinaryRecords_.begin(), _it_msr); + + PrintAdjMeasurementsAngular('a', _it_gnss_msr, false); // Print vertical angle _it_msr++; @@ -13866,7 +14088,11 @@ void dna_adjust::PrintAdjGNSSAlternateUnits(it_vmsr_t& _it_msr, const uint32_uin // Update Pelzer reliability, N-Stat, T-Stat UpdateMsrRecordStats(_it_gnss_msr, _it_gnss_msr->term3); - PrintAdjMeasurementsAngular('v', _it_gnss_msr); + // Initialise database id iterator + if (projectSettings_.o._database_ids) + _it_dbid = v_msr_db_map_.begin() + std::distance(bmsBinaryRecords_.begin(), _it_msr); + + PrintAdjMeasurementsAngular('v', _it_gnss_msr, false); // Print slope distance _it_msr++; @@ -13884,7 +14110,11 @@ void dna_adjust::PrintAdjGNSSAlternateUnits(it_vmsr_t& _it_msr, const uint32_uin // Update Pelzer reliability, N-Stat, T-Stat UpdateMsrRecordStats(_it_gnss_msr, _it_gnss_msr->term4); - PrintAdjMeasurementsLinear('s', _it_gnss_msr); + // Initialise database id iterator + if (projectSettings_.o._database_ids) + _it_dbid = v_msr_db_map_.begin() + std::distance(bmsBinaryRecords_.begin(), _it_msr); + + PrintAdjMeasurementsLinear('s', _it_gnss_msr, false); break; case ADU_adj_gnss_ui: @@ -13928,7 +14158,11 @@ void dna_adjust::PrintAdjGNSSAlternateUnits(it_vmsr_t& _it_msr, const uint32_uin // Update Pelzer reliability, N-Stat, T-Stat UpdateMsrRecordStats(_it_gnss_msr, _it_gnss_msr->term2); - PrintAdjMeasurementsAngular('a', _it_gnss_msr); + // Initialise database id iterator + if (projectSettings_.o._database_ids) + _it_dbid = v_msr_db_map_.begin() + std::distance(bmsBinaryRecords_.begin(), _it_msr); + + PrintAdjMeasurementsAngular('a', _it_gnss_msr, false); // Print slope distance _it_msr++; @@ -13946,7 +14180,11 @@ void dna_adjust::PrintAdjGNSSAlternateUnits(it_vmsr_t& _it_msr, const uint32_uin // Update Pelzer reliability, N-Stat, T-Stat UpdateMsrRecordStats(_it_gnss_msr, _it_gnss_msr->term3); - PrintAdjMeasurementsLinear('s', _it_gnss_msr); + // Initialise database id iterator + if (projectSettings_.o._database_ids) + _it_dbid = v_msr_db_map_.begin() + std::distance(bmsBinaryRecords_.begin(), _it_msr); + + PrintAdjMeasurementsLinear('s', _it_gnss_msr, false); // Print up _it_msr++; @@ -13962,7 +14200,11 @@ void dna_adjust::PrintAdjGNSSAlternateUnits(it_vmsr_t& _it_msr, const uint32_uin // Update Pelzer reliability, N-Stat, T-Stat UpdateMsrRecordStats(_it_gnss_msr, _it_gnss_msr->term4); - PrintAdjMeasurementsLinear('u', _it_gnss_msr); + // Initialise database id iterator + if (projectSettings_.o._database_ids) + _it_dbid = v_msr_db_map_.begin() + std::distance(bmsBinaryRecords_.begin(), _it_msr); + + PrintAdjMeasurementsLinear('u', _it_gnss_msr, false); break; } } @@ -13970,9 +14212,9 @@ void dna_adjust::PrintAdjGNSSAlternateUnits(it_vmsr_t& _it_msr, const uint32_uin void dna_adjust::PrintAdjMeasurements_HR(it_vmsr_t& _it_msr) { // normal format - adj_file << left << setw(STATION) << bstBinaryRecords_.at(_it_msr->station1).stationName; - adj_file << left << setw(STATION) << " "; - adj_file << left << setw(STATION) << " "; + adj_file << std::left << std::setw(STATION) << bstBinaryRecords_.at(_it_msr->station1).stationName; + adj_file << std::left << std::setw(STATION) << " "; + adj_file << std::left << std::setw(STATION) << " "; PrintAdjMeasurementsLinear(' ', _it_msr); } @@ -13981,9 +14223,9 @@ void dna_adjust::PrintAdjMeasurements_HR(it_vmsr_t& _it_msr) void dna_adjust::PrintAdjMeasurements_IJPQ(it_vmsr_t& _it_msr) { // normal format - adj_file << left << setw(STATION) << bstBinaryRecords_.at(_it_msr->station1).stationName; - adj_file << left << setw(STATION) << " "; - adj_file << left << setw(STATION) << " "; + adj_file << std::left << std::setw(STATION) << bstBinaryRecords_.at(_it_msr->station1).stationName; + adj_file << std::left << std::setw(STATION) << " "; + adj_file << std::left << std::setw(STATION) << " "; // Print angular measurement, taking care of user requirements for // type, format and precision @@ -13995,7 +14237,7 @@ void dna_adjust::PrintAdjMeasurements_IJPQ(it_vmsr_t& _it_msr) // Purpose: Closes all files (if file pointers are passed in) and throws NetAdjustException // Called by: Any // Calls: NetAdjustException() -void dna_adjust::SignalExceptionAdjustment(const string& msg, const UINT32 block_no) +void dna_adjust::SignalExceptionAdjustment(const std::string& msg, const UINT32 block_no) { adjustStatus_ = ADJUST_EXCEPTION_RAISED; @@ -14003,18 +14245,18 @@ void dna_adjust::SignalExceptionAdjustment(const string& msg, const UINT32 block isCombining_ = false; isAdjusting_ = false; - string error_msg(msg); + std::string error_msg(msg); switch (projectSettings_.a.adjust_mode) { case Phased_Block_1Mode: case PhasedMode: - stringstream ss; - ss << msg << endl << " Phased adjustment terminated whilst processing block " << block_no + 1 << endl; + std::stringstream ss; + ss << msg << std::endl << " Phased adjustment terminated whilst processing block " << block_no + 1 << std::endl; error_msg = ss.str(); } - throw boost::enable_current_exception(runtime_error(error_msg)); + throw boost::enable_current_exception(std::runtime_error(error_msg)); } void dna_adjust::SetDefaultReferenceFrame() @@ -14048,21 +14290,21 @@ void dna_adjust::SetDefaultReferenceFrame() bst.load_bst_file_meta(projectSettings_.a.bst_file, bst_meta_); datum_.SetDatumFromEpsg(bst_meta_.epsgCode, bst_meta_.epoch); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionAdjustment(e.what(), 0); } } void dna_adjust::LoadNetworkFiles() { - adj_file << "+ Loading network files" << endl; + adj_file << "+ Loading network files" << std::endl; try { // Load binary stations data. Throws runtime_error on failure. dna_io_bst bst; bstn_count_ = bst.load_bst_file(projectSettings_.a.bst_file, &bstBinaryRecords_, bst_meta_); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionAdjustment(e.what(), 0); } @@ -14097,7 +14339,7 @@ void dna_adjust::LoadNetworkFiles() dna_io_asl asl; asl_count_ = asl.load_asl_file(projectSettings_.s.asl_file, &vAssocStnList_, &v_ISLTemp); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionAdjustment(e.what(), 0); } @@ -14120,8 +14362,8 @@ void dna_adjust::LoadNetworkFiles() // check memory availability for block station map if (v_blockStationsMap_.at(0).max_size() <= v_ISL_.at(0).size()) { - stringstream ss; - ss << "LoadNetworkFiles(): Could not allocate sufficient memory for blockStationsMap." << endl; + std::stringstream ss; + ss << "LoadNetworkFiles(): Could not allocate sufficient memory for blockStationsMap." << std::endl; SignalExceptionAdjustment(ss.str(), 0); } @@ -14135,7 +14377,7 @@ void dna_adjust::LoadNetworkFiles() dna_io_bms bms; bmsr_count_ = bms.load_bms_file(projectSettings_.a.bms_file, &bmsBinaryRecords_, bms_meta_); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionAdjustment(e.what(), 0); } @@ -14219,16 +14461,18 @@ void dna_adjust::LoadNetworkFiles() if (_it_msr->measType == 'D') { - // first direction holds number of target directions plus RO. Since directions - // are reduced to angles, subtract one. + // The first direction holds number of target directions plus RO. But + // since it is possible for target directions to be ignored, take + // the number of non-ignored measurements (vectorCount2) + // Since directions are reduced to angles, subtract one. // Target directions are assigned zero vectorCount1 - if (_it_msr->vectorCount1 > 0) + if (_it_msr->vectorCount2 > 0) { - v_measurementCount_.at(0) += _it_msr->vectorCount1 - 1; + v_measurementCount_.at(0) += _it_msr->vectorCount2 - 1; // The following is needed if the upper triangular variance matrix - // for each GNSS measurement (as required for propagating) - v_measurementVarianceCount_.at(0) += _it_msr->vectorCount1 - 1; + // for each direction set measurement (as required for propagating) + v_measurementVarianceCount_.at(0) += _it_msr->vectorCount2 - 1; } continue; } @@ -14261,9 +14505,9 @@ void dna_adjust::LoadNetworkFiles() if (m == 0) { - stringstream ss; - ss << "No measurements were found." << endl << - " If measurements were successfully loaded on import, ensure that\n all measurements have not been ignored." << endl; + std::stringstream ss; + ss << "No measurements were found." << std::endl << + " If measurements were successfully loaded on import, ensure that\n all measurements have not been ignored." << std::endl; SignalExceptionAdjustment(ss.str(), 0); } @@ -14283,10 +14527,10 @@ void dna_adjust::LoadNetworkFiles() void dna_adjust::AddDiscontinuitySites(vstring& constraintStns) { // sort on original name - sort(bstBinaryRecords_.begin(), bstBinaryRecords_.end(), CompareStnOriginalName()); + std::sort(bstBinaryRecords_.begin(), bstBinaryRecords_.end(), CompareStnOriginalName()); - pair it_stn_range; - string constraint; + std::pair it_stn_range; + std::string constraint; _it_vstr const_it; @@ -14296,7 +14540,7 @@ void dna_adjust::AddDiscontinuitySites(vstring& constraintStns) for (const_it=constraintStns.begin(); const_it!=constraintStns.end(); ++const_it) { // find this constraint station in the station map - it_stn_range = equal_range(bstBinaryRecords_.begin(), bstBinaryRecords_.end(), (*const_it), CompareStnOriginalName()); + it_stn_range = equal_range(bstBinaryRecords_.begin(), bstBinaryRecords_.end(), (*const_it), CompareStnOriginalName()); if (it_stn_range.first == it_stn_range.second) { // Not in the map. Get the next one @@ -14316,7 +14560,7 @@ void dna_adjust::AddDiscontinuitySites(vstring& constraintStns) constraintStns.insert(constraintStns.end(), constraintDiscontStns.begin(), constraintDiscontStns.end()); // restore original sort order - sort(bstBinaryRecords_.begin(), bstBinaryRecords_.end(), CompareStnName()); + std::sort(bstBinaryRecords_.begin(), bstBinaryRecords_.end(), CompareStnName()); } // Take user-supplied type B uncertainties and compute relevant elements for @@ -14337,7 +14581,7 @@ void dna_adjust::InitialiseTypeBUncertainties() tbu.load_tbu_argument(projectSettings_.a.type_b_global, typeBUncertaintyGlobal_); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionAdjustment(e.what(), 0); } catch (...) { @@ -14358,7 +14602,7 @@ void dna_adjust::InitialiseTypeBUncertainties() try { tbu.load_tbu_file(projectSettings_.a.type_b_file, v_typeBUncertaintiesLocal_, vStnsMap); - sort(v_typeBUncertaintiesLocal_.begin(), v_typeBUncertaintiesLocal_.end()); + std::sort(v_typeBUncertaintiesLocal_.begin(), v_typeBUncertaintiesLocal_.end()); // reduce to the cartesian reference frame tbu.reduce_uncertainties_local(v_typeBUncertaintiesLocal_, bstBinaryRecords_); @@ -14366,7 +14610,7 @@ void dna_adjust::InitialiseTypeBUncertainties() catch (const std::ifstream::failure& f) { SignalExceptionAdjustment(f.what(), 0); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionAdjustment(e.what(), 0); } } @@ -14425,15 +14669,15 @@ void dna_adjust::ApplyAdditionalConstraints() projectSettings_.a.map_file = projectSettings_.g.input_folder + FOLDER_SLASH + projectSettings_.g.network_name + ".map"; LoadStationMap(&vStnsMap, projectSettings_.a.map_file); - string constraint; + std::string constraint; vstring constraintStns; _it_vstr const_it; try { // Extract constraints from comma delimited string - SplitDelimitedString( + SplitDelimitedString( projectSettings_.a.station_constraints, // the comma delimited string - string(","), // the delimiter + std::string(","), // the delimiter &constraintStns); // the respective values } catch (...) { @@ -14464,9 +14708,9 @@ void dna_adjust::ApplyAdditionalConstraints() continue; } - stringstream ss; + std::stringstream ss; ss << "The supplied constraint station " << (*const_it) << " is not in the stations map. Please ensure that " << - (*const_it) << " is included in the list of stations." << endl; + (*const_it) << " is included in the list of stations." << std::endl; SignalExceptionAdjustment(ss.str(), 0); } @@ -14481,8 +14725,8 @@ void dna_adjust::ApplyAdditionalConstraints() if (!CDnaStation::IsValidConstraint(constraint)) { - stringstream ss; - ss << "The supplied station constraint " << constraint << " is not a valid constraint." << endl; + std::stringstream ss; + ss << "The supplied station constraint " << constraint << " is not a valid constraint." << std::endl; SignalExceptionAdjustment(ss.str(), 0); } @@ -14492,14 +14736,14 @@ void dna_adjust::ApplyAdditionalConstraints() } -void dna_adjust::LoadStationMap(pv_string_uint32_pair stnsMap, const string& stnmap_file) +void dna_adjust::LoadStationMap(pv_string_uint32_pair stnsMap, const std::string& stnmap_file) { try { // Load station map. Throws runtime_error on failure. dna_io_map map; map.load_map_file(stnmap_file, stnsMap); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionAdjustment(e.what(), 0); } } @@ -14507,7 +14751,7 @@ void dna_adjust::LoadStationMap(pv_string_uint32_pair stnsMap, const string& stn void dna_adjust::ResizeMatrixVectors() { - adj_file << "+ Allocating memory" << endl; + adj_file << "+ Allocating memory" << std::endl; switch (projectSettings_.a.adjust_mode) { @@ -14552,8 +14796,10 @@ void dna_adjust::ResizeMatrixVectors() v_originalStations_.resize(blockCount_); v_corrections_.resize(blockCount_); +#ifdef MULTI_THREAD_ADJUST if (projectSettings_.a.multi_thread) v_normalsRC_.resize(blockCount_); +#endif for (UINT32 block(0); block 1) { - debug_file << endl << "Station appearance list" << endl; + debug_file << std::endl << "Station appearance list" << std::endl; it_vUINT32_const _it_const; it_vstn_appear _it_appear; for (UINT32 block(0); block!=blockCount_; ++block) { - debug_file << "Block " << block << endl; - debug_file << setw(HEADER_20) << "Station" << setw(HEADER_20) << "Forward" << setw(HEADER_20) << "Reverse" << setw(HEADER_20) << " " << endl; + debug_file << "Block " << block << std::endl; + debug_file << std::setw(HEADER_20) << "Station" << std::setw(HEADER_20) << "Forward" << std::setw(HEADER_20) << "Reverse" << std::setw(HEADER_20) << " " << std::endl; for (_it_const=v_parameterStationList_.at(block).begin(), _it_appear=v_paramStnAppearance_.at(block).begin(); @@ -14776,27 +15022,27 @@ void dna_adjust::LoadSegmentationMetrics() ++_it_const, ++_it_appear) { // station id - debug_file << setw(HEADER_20) << *_it_const; + debug_file << std::setw(HEADER_20) << *_it_const; // forward if (_it_appear->first_appearance_fwd) - debug_file << setw(HEADER_20) << "true"; + debug_file << std::setw(HEADER_20) << "true"; else - debug_file << setw(HEADER_20) << "false"; + debug_file << std::setw(HEADER_20) << "false"; // reverse if (_it_appear->first_appearance_rev) - debug_file << setw(HEADER_20) << "true" << endl; + debug_file << std::setw(HEADER_20) << "true" << std::endl; else - debug_file << setw(HEADER_20) << "false" << endl; + debug_file << std::setw(HEADER_20) << "false" << std::endl; } - debug_file << endl; + debug_file << std::endl; } - debug_file << endl; + debug_file << std::endl; } } -void dna_adjust::LoadSegmentationFileParameters(const string& seg_filename) +void dna_adjust::LoadSegmentationFileParameters(const std::string& seg_filename) { UINT32 blockThreshold, minInnerStns; @@ -14806,7 +15052,7 @@ void dna_adjust::LoadSegmentationFileParameters(const string& seg_filename) seg.load_seg_file_header_f(seg_filename, blockCount_, blockThreshold, minInnerStns); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionAdjustment(e.what(), 0); } } @@ -14826,7 +15072,7 @@ void dna_adjust::LoadSegmentationFile() &v_measurementCount_, &v_unknownsCount_, &v_ContiguousNetList_, &v_parameterStationCount_); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionAdjustment(e.what(), 0); } @@ -14851,9 +15097,9 @@ void dna_adjust::RemoveDuplicateStations(vUINT32& vStations) void dna_adjust::RemoveInvalidISLStations(vUINT32& v_ISLTemp) { CompareValidity aslValidityCompareFunc(&vAssocStnList_, FALSE); - sort(v_ISLTemp.begin(), v_ISLTemp.end(), aslValidityCompareFunc); + std::sort(v_ISLTemp.begin(), v_ISLTemp.end(), aslValidityCompareFunc); erase_if(v_ISLTemp, aslValidityCompareFunc); - sort(v_ISLTemp.begin(), v_ISLTemp.end()); + std::sort(v_ISLTemp.begin(), v_ISLTemp.end()); } @@ -14864,12 +15110,12 @@ void dna_adjust::RemoveNonMeasurements(const UINT32& block) return; // Strip anything that is not xMeas CompareNonMeasStart measstartCompareFunc(&bmsBinaryRecords_, xMeas); - sort(v_CML_.at(block).begin(), v_CML_.at(block).end(), measstartCompareFunc); + std::sort(v_CML_.at(block).begin(), v_CML_.at(block).end(), measstartCompareFunc); erase_if(v_CML_.at(block), measstartCompareFunc); // Sort CML on file order (default option) CompareMsrFileOrder fileorderCompareFunc(&bmsBinaryRecords_); - sort(v_CML_.at(block).begin(), v_CML_.at(block).end(), fileorderCompareFunc); + std::sort(v_CML_.at(block).begin(), v_CML_.at(block).end(), fileorderCompareFunc); } @@ -14879,7 +15125,7 @@ void dna_adjust::SortMeasurementsbyType(v_uint32_u32u32_pair& msr_block) if (msr_block.size() < 2) return; CompareMeasType_PairFirst meastypeCompareFunc(&bmsBinaryRecords_); - sort(msr_block.begin(), msr_block.end(), meastypeCompareFunc); + std::sort(msr_block.begin(), msr_block.end(), meastypeCompareFunc); } @@ -14888,7 +15134,7 @@ void dna_adjust::SortMeasurementsbyFromStn(v_uint32_u32u32_pair& msr_block) if (msr_block.size() < 2) return; CompareMeasFromStn_PairFirst measfromstnCompareFunc(&bmsBinaryRecords_); - sort(msr_block.begin(), msr_block.end(), measfromstnCompareFunc); + std::sort(msr_block.begin(), msr_block.end(), measfromstnCompareFunc); } @@ -14897,7 +15143,7 @@ void dna_adjust::SortMeasurementsbyToStn(v_uint32_u32u32_pair& msr_block) if (msr_block.size() < 2) return; CompareMeasToStn_PairFirst meastostnCompareFunc(&bmsBinaryRecords_); - sort(msr_block.begin(), msr_block.end(), meastostnCompareFunc); + std::sort(msr_block.begin(), msr_block.end(), meastostnCompareFunc); } @@ -14906,7 +15152,7 @@ void dna_adjust::SortMeasurementsbyValue(v_uint32_u32u32_pair& msr_block) if (msr_block.size() < 2) return; CompareMeasValue_PairFirst measvalueCompareFunc(&bmsBinaryRecords_); - sort(msr_block.begin(), msr_block.end(), measvalueCompareFunc); + std::sort(msr_block.begin(), msr_block.end(), measvalueCompareFunc); } @@ -14915,7 +15161,7 @@ void dna_adjust::SortMeasurementsbyResidual(v_uint32_u32u32_pair& msr_block) if (msr_block.size() < 2) return; CompareMeasResidual_PairFirst measresidualCompareFunc(&bmsBinaryRecords_); - sort(msr_block.begin(), msr_block.end(), measresidualCompareFunc); + std::sort(msr_block.begin(), msr_block.end(), measresidualCompareFunc); } @@ -14924,7 +15170,7 @@ void dna_adjust::SortMeasurementsbyAdjSD(v_uint32_u32u32_pair& msr_block) if (msr_block.size() < 2) return; CompareMeasAdjSD_PairFirst measadjsdCompareFunc(&bmsBinaryRecords_); - sort(msr_block.begin(), msr_block.end(), measadjsdCompareFunc); + std::sort(msr_block.begin(), msr_block.end(), measadjsdCompareFunc); } @@ -14933,18 +15179,10 @@ void dna_adjust::SortMeasurementsbyNstat(v_uint32_u32u32_pair& msr_block) if (msr_block.size() < 2) return; CompareMeasNstat_PairFirst measnstatCompareFunc(&bmsBinaryRecords_); - sort(msr_block.begin(), msr_block.end(), measnstatCompareFunc); + std::sort(msr_block.begin(), msr_block.end(), measnstatCompareFunc); } -void dna_adjust::SortMeasurementsbyOutlier(v_uint32_u32u32_pair& msr_block) -{ - if (msr_block.size() < 2) - return; - CompareMeasOutlier_PairFirst measoutlierCompareFunc(&bmsBinaryRecords_, criticalValue_); - sort(msr_block.begin(), msr_block.end(), measoutlierCompareFunc); -} - } // namespace networkadjust } // namespace dynadjust diff --git a/dynadjust/dynadjust/dnaadjust/dnaadjust.hpp b/dynadjust/dynadjust/dnaadjust/dnaadjust.hpp index 4c6c3034..6b538534 100644 --- a/dynadjust/dynadjust/dnaadjust/dnaadjust.hpp +++ b/dynadjust/dynadjust/dnaadjust/dnaadjust.hpp @@ -91,12 +91,6 @@ #include -using namespace std; -using namespace boost; -using namespace boost::posix_time; -using namespace boost::filesystem; -using namespace boost::math; - using namespace dynadjust::datum_parameters; using namespace dynadjust::measurements; using namespace dynadjust::math; @@ -133,7 +127,7 @@ class adjust_process_prepare_thread { public: adjust_process_prepare_thread( dna_adjust* dnaAdj, const UINT32& id, - boost::exception_ptr& error, vector& prep_errors) + boost::exception_ptr& error, std::vector& prep_errors) : main_adj_(dnaAdj) , thread_id_(id) , error_(error) @@ -145,7 +139,7 @@ class adjust_process_prepare_thread { dna_adjust* main_adj_; UINT32 thread_id_; boost::exception_ptr& error_; - vector& prep_errors_; + std::vector& prep_errors_; // Prevent assignment operator adjust_process_prepare_thread& operator=(const adjust_process_prepare_thread& rhs); @@ -207,7 +201,7 @@ class adjust_process_combine_thread { public: adjust_process_combine_thread( dna_adjust* dnaAdj, const UINT32& id, - boost::exception_ptr& error, vector& cmb_errors) + boost::exception_ptr& error, std::vector& cmb_errors) : main_adj_(dnaAdj) , thread_id_(id) , error_(error) @@ -219,7 +213,7 @@ class adjust_process_combine_thread { dna_adjust* main_adj_; UINT32 thread_id_; boost::exception_ptr& error_; - vector& cmb_errors_; + std::vector& cmb_errors_; // Prevent assignment operator adjust_process_combine_thread& operator=(const adjust_process_combine_thread& rhs); @@ -286,9 +280,9 @@ class dna_adjust { void PrintAdjustedNetworkMeasurements(); void PrintMeasurementsToStation(); - bool PrintEstimatedStationCoordinatestoSNX(string& sinex_file); - void PrintEstimatedStationCoordinatestoDNAXML(const string& stnFile, INPUT_FILE_TYPE t, bool flagUnused = false); - void PrintEstimatedStationCoordinatestoDNAXML_Y(const string& msrFile, INPUT_FILE_TYPE t); + bool PrintEstimatedStationCoordinatestoSNX(std::string& sinex_file); + void PrintEstimatedStationCoordinatestoDNAXML(const std::string& stnFile, INPUT_FILE_TYPE t, bool flagUnused = false); + void PrintEstimatedStationCoordinatestoDNAXML_Y(const std::string& msrFile, INPUT_FILE_TYPE t); void CloseOutputFiles(); void UpdateBinaryFiles(); @@ -314,7 +308,7 @@ class dna_adjust { }; inline UINT32 blockCount() const { return blockCount_; } - inline milliseconds adjustTime() const { return total_time_; } + inline boost::posix_time::milliseconds adjustTime() const { return total_time_; } inline bool processingForward() { return forward_; } inline bool processingCombine() { return isCombining_; } inline int GetDegreesOfFreedom() const { return degreesofFreedom_; } @@ -331,7 +325,7 @@ class dna_adjust { void GetMemoryFootprint(double& memory, const _MEM_UNIT_ unit); - void LoadSegmentationFileParameters(const string& seg_filename); + void LoadSegmentationFileParameters(const std::string& seg_filename); void SerialiseAdjustedVarianceMatrices(); void DeSerialiseAdjustedVarianceMatrices(); @@ -342,7 +336,7 @@ class dna_adjust { inline bool GetMessageIteration(UINT32& iteration) { return iterationQueue_.front_and_pop(iteration); } // iteration is indexed from 1. That is, not zero-indexed. - inline string GetMaxCorrection(const UINT32& iteration) const { + inline std::string GetMaxCorrection(const UINT32& iteration) const { if (iteration == 0) return iterationCorrections_.get_message(iteration); // safe guard return iterationCorrections_.get_message(iteration-1); @@ -351,25 +345,25 @@ class dna_adjust { #ifdef MULTI_THREAD_ADJUST - concurrent_ofstream concurrent_adj_ofstream; + concurrent_ofstream concurrent_adj_ofstream; - inline void ThreadSafeWritetoAdjFile(const string& s) { + inline void ThreadSafeWritetoAdjFile(const std::string& s) { concurrent_adj_ofstream.wrtie(adj_file, s); } - inline void WriteStatstoAdjFile(const string& s) { + inline void WriteStatstoAdjFile(const std::string& s) { if (projectSettings_.o._adj_stat_iteration) ThreadSafeWritetoAdjFile(s); } - inline void WriteStntoAdjFile(const string& s) { + inline void WriteStntoAdjFile(const std::string& s) { if (projectSettings_.o._adj_stn_iteration) ThreadSafeWritetoAdjFile(s); } - inline void WriteMsrtoAdjFile(const string& s) { + inline void WriteMsrtoAdjFile(const std::string& s) { if (projectSettings_.o._adj_msr_iteration) ThreadSafeWritetoAdjFile(s); } - inline void ThreadSafeWritetoDbgFile(const string& s) { concurrent_adj_ofstream.wrtie(debug_file, s); } + inline void ThreadSafeWritetoDbgFile(const std::string& s) { concurrent_adj_ofstream.wrtie(debug_file, s); } #endif _ADJUST_STATUS_ AdjustNetwork(); @@ -385,11 +379,11 @@ class dna_adjust { UINT32 blockCount_; UINT32 currentBlock_; - milliseconds total_time_; + boost::posix_time::milliseconds total_time_; _ADJUST_STATUS_ adjustStatus_; vstring statusMessages_; UINT32 currentIteration_; - vector v_blockMeta_; + std::vector v_blockMeta_; inline bool FirstBlock(const UINT32& block) const { @@ -400,7 +394,7 @@ class dna_adjust { return v_blockMeta_.at(block)._blockLast; } - void SignalExceptionAdjustment(const string& msg, const UINT32 block_no); + void SignalExceptionAdjustment(const std::string& msg, const UINT32 block_no); void CreateMeasurementTally(const UINT32& block = 0); @@ -431,16 +425,16 @@ class dna_adjust { void RebuildNormals(const UINT32 block, adjustOperation direction, bool AddConstraintStationstoNormals, bool BackupNormals); void UpdateAdjustment(bool iterate); - void ValidateandFinaliseAdjustment(cpu_timer& tot_time); + void ValidateandFinaliseAdjustment(boost::timer::cpu_timer& tot_time); void PrintAdjustmentStatus(); - void PrintAdjustmentTime(cpu_timer& time, _TIMER_TYPE_); + void PrintAdjustmentTime(boost::timer::cpu_timer& time, _TIMER_TYPE_); void PrintIteration(const UINT32& iteration); void InitialiseAdjustment(); void SetDefaultReferenceFrame(); void LoadNetworkFiles(); void CreateMsrToStnTally(); - void CreateStationAppearanceList(const vUINT32& parameterStations); + //void CreateStationAppearanceList(const vUINT32& parameterStations); // Simultaneous adjustment void AdjustSimultaneous(); @@ -462,7 +456,7 @@ class dna_adjust { // Adjustment helps void ApplyAdditionalConstraints(); void AddDiscontinuitySites(vstring& constraintStns); - void LoadStationMap(pv_string_uint32_pair stnsMap, const string& stnmap_file); + void LoadStationMap(pv_string_uint32_pair stnsMap, const std::string& stnmap_file); void ResizeMatrixVectors(); void LoadPhasedBlocks(); void LoadSegmentationFile(); @@ -480,7 +474,6 @@ class dna_adjust { void SortMeasurementsbyResidual(v_uint32_u32u32_pair& msr_block); void SortMeasurementsbyAdjSD(v_uint32_u32u32_pair& msr_block); void SortMeasurementsbyNstat(v_uint32_u32u32_pair& msr_block); - void SortMeasurementsbyOutlier(v_uint32_u32u32_pair& msr_block); // Adjustment station sorting void SortStationsbyFileOrder(vUINT32& v_blockStations); @@ -630,8 +623,8 @@ class dna_adjust { void LoadVarianceMatrix_X(it_vmsr_t _it_msr, matrix_2d* var_cart); void LoadVarianceMatrix_Y(it_vmsr_t _it_msr, matrix_2d* var_cart, const _COORD_TYPE_ coordType); - void PrintMsrVarianceMatrixException(const it_vmsr_t& _it_msr, const runtime_error& e, stringstream& ss, - const string& calling_function, const UINT32 msr_count = 0); + void PrintMsrVarianceMatrixException(const it_vmsr_t& _it_msr, const std::runtime_error& e, std::stringstream& ss, + const std::string& calling_function, const UINT32 msr_count = 0); // Estimated stations matrix void PrepareStationandVarianceMatrices(const UINT32& block); @@ -673,7 +666,7 @@ class dna_adjust { void UpdateNormals_Y(const UINT32& block, it_vmsr_t& _it_msr, UINT32& design_row, matrix_2d* normals, matrix_2d* AtVinv); - void OutputLargestCorrection(string& formatted_msg); + void OutputLargestCorrection(std::string& formatted_msg); // Design/Normals matrix void PrepareDesignAndMsrMnsCmpMatrices(const UINT32& block); @@ -751,19 +744,19 @@ class dna_adjust { void FormInverseVarianceMatrix(matrix_2d* vmat, bool LOWER_IS_CLEARED = false); void FormInverseGPSVarianceMatrix(const it_vmsr_t& _it_msr, matrix_2d* vmat); - bool FormInverseVarianceMatrixReduced(it_vmsr_t _it_msr, matrix_2d* var_cart, const string& method_name); + bool FormInverseVarianceMatrixReduced(it_vmsr_t _it_msr, matrix_2d* var_cart, const std::string& method_name); void PrintStatistics(bool printPelzer=true); // Output files void OpenOutputFileStreams(); void PrintOutputFileHeaderInfo(); - void PrintCompMeasurements(const UINT32& block, const string& msg = ""); + void PrintCompMeasurements(const UINT32& block, const std::string& msg = ""); void PrintCompMeasurementsAngular(const char cardinal, const double& computed, const double& correction, const it_vmsr_t& _it_msr); void PrintCompMeasurementsLinear(const char cardinal, const double& computed, const double& correction, const it_vmsr_t& _it_msr); void PrintCompMeasurements_A(const UINT32& block, it_vmsr_t& _it_msr, UINT32& design_row, printMeasurementsMode printMode); void PrintCompMeasurements_CELMS(it_vmsr_t& _it_msr, UINT32& design_row, printMeasurementsMode printMode); - void PrintCompMeasurements_D(it_vmsr_t& _it_msr, UINT32& design_row); + void PrintCompMeasurements_D(it_vmsr_t& _it_msr, UINT32& design_row, bool printIgnored=false); void PrintCompMeasurements_HR(const UINT32& block, it_vmsr_t& _it_msr, UINT32& design_row, printMeasurementsMode printMode); void PrintCompMeasurements_IJPQ(const UINT32& block, it_vmsr_t& _it_msr, UINT32& design_row, printMeasurementsMode printMode); void PrintCompMeasurements_BKVZ(const UINT32& block, it_vmsr_t& _it_msr, UINT32& design_row, printMeasurementsMode printMode); @@ -773,16 +766,16 @@ class dna_adjust { void PrintMeasurementsAngular(const char cardinal, const double& measurement, const double& correction, const it_vmsr_t& _it_msr, bool printAdjMsr = true); void PrintMeasurementsLinear(const char cardinal, const double& measurement, const double& correction, const it_vmsr_t& _it_msr, bool printAdjMsr = true); void PrintMeasurementCorrection(const char cardinal, const it_vmsr_t& _it_msr); - void PrintMeasurementDatabaseID(const it_vmsr_t& _it_msr); + void PrintMeasurementDatabaseID(const it_vmsr_t& _it_msr, bool initialise_dbindex=true); void FormUniqueMsrList(); - void PrintAdjMeasurementsHeader(bool printHeader, const string& table_heading, + void PrintAdjMeasurementsHeader(bool printHeader, const std::string& table_heading, printMeasurementsMode printMode, UINT32 block, bool printBlocks = false); void PrintAdjMeasurements(v_uint32_u32u32_pair msr_block, bool printHeader); - void PrintAdjMeasurementsAngular(const char cardinal, const it_vmsr_t& _it_msr); - void PrintAdjMeasurementsLinear(const char cardinal, const it_vmsr_t& _it_msr); + void PrintAdjMeasurementsAngular(const char cardinal, const it_vmsr_t& _it_msr, bool initialise_dbindex = true); + void PrintAdjMeasurementsLinear(const char cardinal, const it_vmsr_t& _it_msr, bool initialise_dbindex=true); void PrintAdjGNSSAlternateUnits(it_vmsr_t& _it_msr, const uint32_uint32_pair& b_pam); - void PrintAdjMeasurementStatistics(const char cardinal, const it_vmsr_t& _it_msr); + void PrintAdjMeasurementStatistics(const char cardinal, const it_vmsr_t& _it_msr, bool initialise_dbindex = true); void PrintIgnoredAdjMeasurements(bool printHeader); @@ -796,19 +789,19 @@ class dna_adjust { void PrintAdjMeasurements_YLLH(it_vmsr_t& _it_msr); void ReduceYLLHMeasurementsforPrinting(vmsr_t& y_msr, matrix_2d& mpositions, printMeasurementsMode print_mode); - void PrintAdjStation(ostream& os, const UINT32& block, const UINT32& stn, const UINT32& mat_idx, const matrix_2d* stationEstimates, matrix_2d* stationVariances, bool recomputeGeographicCoords, bool updateGeographicCoords, bool reapplyTypeBUncertainties); - void PrintAdjStations(ostream& os, const UINT32& block, const matrix_2d* stationEstimates, matrix_2d* stationVariances, + void PrintAdjStation(std::ostream& os, const UINT32& block, const UINT32& stn, const UINT32& mat_idx, const matrix_2d* stationEstimates, matrix_2d* stationVariances, bool recomputeGeographicCoords, bool updateGeographicCoords, bool reapplyTypeBUncertainties); + void PrintAdjStations(std::ostream& os, const UINT32& block, const matrix_2d* stationEstimates, matrix_2d* stationVariances, bool printBlockID, bool recomputeGeographicCoords, bool updateGeographicCoords, bool printHeader, bool reapplyTypeBUncertainties); - void PrintAdjStationsUniqueList(ostream& os, const v_mat_2d* stationEstimates, v_mat_2d* stationVariances, bool recomputeGeographicCoords, bool updateGeographicCoords, bool reapplyTypeBUncertainties); + void PrintAdjStationsUniqueList(std::ostream& os, const v_mat_2d* stationEstimates, v_mat_2d* stationVariances, bool recomputeGeographicCoords, bool updateGeographicCoords, bool reapplyTypeBUncertainties); - void PrintCorStations(ostream &cor_file, const UINT32& block); - void PrintCorStationsUniqueList(ostream& cor_file); - void PrintCorStation(ostream& os, const UINT32& block, const UINT32& stn, const UINT32& mat_idx, const matrix_2d* stationEstimates); + void PrintCorStations(std::ostream &cor_file, const UINT32& block); + void PrintCorStationsUniqueList(std::ostream& cor_file); + void PrintCorStation(std::ostream& os, const UINT32& block, const UINT32& stn, const UINT32& mat_idx, const matrix_2d* stationEstimates); - void PrintPosUncertainty(ostream& os, /*ostream* csv,*/ const UINT32& block, const UINT32& stn, const UINT32& mat_idx, const matrix_2d* stationVariances, const UINT32& map_idx=0, const vUINT32* blockStations=NULL); - void PrintPosUncertainties(ostream& os, const UINT32& block, const matrix_2d* stationVariances); - void PrintPosUncertaintiesUniqueList(ostream& os, const v_mat_2d* stationVariances); - void PrintPosUncertaintiesHeader(ostream& os); + void PrintPosUncertainty(std::ostream& os, /*ostream* csv,*/ const UINT32& block, const UINT32& stn, const UINT32& mat_idx, const matrix_2d* stationVariances, const UINT32& map_idx=0, const vUINT32* blockStations=NULL); + void PrintPosUncertainties(std::ostream& os, const UINT32& block, const matrix_2d* stationVariances); + void PrintPosUncertaintiesUniqueList(std::ostream& os, const v_mat_2d* stationVariances); + void PrintPosUncertaintiesHeader(std::ostream& os); void UpdateGeographicCoordsPhased(const UINT32& block, matrix_2d* estimatedStations); void UpdateGeographicCoords(); @@ -823,7 +816,7 @@ class dna_adjust { return v_blockStationsMap_.at(block)[(*_it_msr)->station3] * 3; } - void debug_BlockInformation(const UINT32& currentBlock, const string& adjustment_method); + void debug_BlockInformation(const UINT32& currentBlock, const std::string& adjustment_method); void debug_SolutionInformation(const UINT32& currentBlock); CDnaDatum datum_; @@ -876,7 +869,7 @@ class dna_adjust { UINT32 potentialOutlierCount_; bool allStationsFixed_; - message_bank iterationCorrections_; + message_bank iterationCorrections_; // For each block vUINT32 v_ContiguousNetList_; // vector of contiguous network IDs (corresponding to each block) diff --git a/dynadjust/dynadjust/dnaadjustwrapper/dnaadjustprogress.cpp b/dynadjust/dynadjust/dnaadjustwrapper/dnaadjustprogress.cpp index 797b2622..58348f19 100644 --- a/dynadjust/dynadjust/dnaadjustwrapper/dnaadjustprogress.cpp +++ b/dynadjust/dynadjust/dnaadjustwrapper/dnaadjustprogress.cpp @@ -65,11 +65,11 @@ bool dna_adjust_thread::prepareAdjustment() catch (const NetMemoryException& e) { handlePrepareAdjustError(e.what()); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { handlePrepareAdjustError(e.what()); } catch (...) { - string err("Undefined error.\n This could be the result of insufficient memory or poorly configured data."); + std::string err("Undefined error.\n This could be the result of insufficient memory or poorly configured data."); handlePrepareAdjustError(err); } *_adjustStatus = ADJUST_EXCEPTION_RAISED; @@ -89,36 +89,36 @@ bool dna_adjust_thread::processAdjustment() catch (const NetMemoryException& e) { handleProcessAdjustError(e.what()); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { handleProcessAdjustError(e.what()); } catch (...) { - string err("- Error: Undefined error.\n This could be the result of insufficient memory or poorly configured data."); + std::string err("- Error: Undefined error.\n This could be the result of insufficient memory or poorly configured data."); handleProcessAdjustError(err); } *_adjustStatus = ADJUST_EXCEPTION_RAISED; return false; } -void dna_adjust_thread::handlePrepareAdjustError(const string& error_msg) +void dna_adjust_thread::handlePrepareAdjustError(const std::string& error_msg) { running = false; - stringstream ss; - ss << /*PROGRESS_BACKSPACE_12 << */setw(PROGRESS_ADJ_BLOCK_12) << " " << endl - << "- Error: " << endl << " " << error_msg << endl; + std::stringstream ss; + ss << /*PROGRESS_BACKSPACE_12 << */setw(PROGRESS_ADJ_BLOCK_12) << " " << std::endl + << "- Error: " << std::endl << " " << error_msg << std::endl; coutMessage(ss.str()); } -void dna_adjust_thread::handleProcessAdjustError(const string& error_msg) +void dna_adjust_thread::handleProcessAdjustError(const std::string& error_msg) { running = false; - boost::this_thread::sleep(milliseconds(50)); + boost::this_thread::sleep(boost::posix_time::milliseconds(50)); printErrorMsg(error_msg); } -void dna_adjust_thread::printErrorMsg(const string& error_msg) +void dna_adjust_thread::printErrorMsg(const std::string& error_msg) { - stringstream ss, sst; + std::stringstream ss, sst; switch (_p->a.adjust_mode) { @@ -127,8 +127,8 @@ void dna_adjust_thread::printErrorMsg(const string& error_msg) // setw(2) = 2 // ------------------- // 14 - sst << " Iteration " << right << setw(2) << fixed << setprecision(0) << _dnaAdj->CurrentIteration(); - ss << PROGRESS_BACKSPACE_14 << setw(PROGRESS_ADJ_BLOCK_14) << right << sst.str(); + sst << " Iteration " << std::right << std::setw(2) << std::fixed << std::setprecision(0) << _dnaAdj->CurrentIteration(); + ss << PROGRESS_BACKSPACE_14 << std::setw(PROGRESS_ADJ_BLOCK_14) << std::right << sst.str(); break; case Phased_Block_1Mode: case PhasedMode: @@ -140,26 +140,26 @@ void dna_adjust_thread::printErrorMsg(const string& error_msg) // ------------------- // 37 sst << " Iteration " << - right << setw(2) << fixed << setprecision(0) << _dnaAdj->CurrentIteration() << ", block" << right << setw(6) << fixed << setprecision(0) << + std::right << std::setw(2) << std::fixed << std::setprecision(0) << _dnaAdj->CurrentIteration() << ", block" << std::right << std::setw(6) << std::fixed << std::setprecision(0) << _dnaAdj->CurrentBlock() + 1 << (_dnaAdj->processingForward() ? " (forward)" : " (reverse)"); - ss << PROGRESS_BACKSPACE_37 << setw(37) << right << sst.str(); + ss << PROGRESS_BACKSPACE_37 << std::setw(37) << std::right << sst.str(); } - ss << endl << "- Error: Cannot compute the least squares estimates. Reason:\n " << error_msg << endl; + ss << std::endl << "- Error: Cannot compute the least squares estimates. Reason:\n " << error_msg << std::endl; coutMessage(ss); } -void dna_adjust_thread::coutMessage(stringstream& message) +void dna_adjust_thread::coutMessage(std::stringstream& message) { coutMessage(message.str()); } -void dna_adjust_thread::coutMessage(const string& message) +void dna_adjust_thread::coutMessage(const std::string& message) { cout_mutex.lock(); - cout.flush(); - cout << message; - cout.flush(); + std::cout.flush(); + std::cout << message; + std::cout.flush(); cout_mutex.unlock(); } @@ -183,7 +183,7 @@ void dna_adjust_progress_thread::prepareAdjustment() // Nothing to be displayed return; - stringstream ss; + std::stringstream ss; ss << "+ Preparing for "; switch (_p->a.adjust_mode) @@ -199,7 +199,7 @@ void dna_adjust_progress_thread::prepareAdjustment() ss.str(""); UINT32 block, currentBlock(0); - stringstream sst; + std::stringstream sst; bool first_time(true); switch (_p->a.adjust_mode) @@ -207,13 +207,13 @@ void dna_adjust_progress_thread::prepareAdjustment() case SimultaneousMode: while (running && _dnaAdj->IsPreparing()) { - boost::this_thread::sleep(milliseconds(40)); + boost::this_thread::sleep(boost::posix_time::milliseconds(40)); } if (_dnaAdj->ExceptionRaised()) return; - ss << " done." << endl; + ss << " done." << std::endl; coutMessage(ss.str()); break; @@ -226,19 +226,19 @@ void dna_adjust_progress_thread::prepareAdjustment() if (block != currentBlock) { ss.str(""); - ss << " block " << left << setw(5) << fixed << setprecision(0) << _dnaAdj->CurrentBlock() + 1; + ss << " block " << std::left << std::setw(5) << std::fixed << std::setprecision(0) << _dnaAdj->CurrentBlock() + 1; sst.str(""); if (first_time) { - sst << setw(PROGRESS_ADJ_BLOCK_12) << left << " "; + sst << std::setw(PROGRESS_ADJ_BLOCK_12) << std::left << " "; first_time = false; } - sst << PROGRESS_BACKSPACE_12 << setw(PROGRESS_ADJ_BLOCK_12) << left << ss.str(); + sst << PROGRESS_BACKSPACE_12 << std::setw(PROGRESS_ADJ_BLOCK_12) << std::left << ss.str(); coutMessage(sst.str()); currentBlock = block; } - boost::this_thread::sleep(milliseconds(40)); + boost::this_thread::sleep(boost::posix_time::milliseconds(40)); } if (_dnaAdj->ExceptionRaised()) @@ -249,7 +249,7 @@ void dna_adjust_progress_thread::prepareAdjustment() sst.str(""); if (!first_time) sst << PROGRESS_BACKSPACE_12; - sst << setw(PROGRESS_ADJ_BLOCK_12) << left << ss.str() << endl; + sst << std::setw(PROGRESS_ADJ_BLOCK_12) << std::left << ss.str() << std::endl; coutMessage(sst.str()); } @@ -262,11 +262,11 @@ void dna_adjust_progress_thread::processAdjustment() return; if (_p->a.max_iterations > 0) - coutMessage(string("+ Adjusting network...\n")); + coutMessage(std::string("+ Adjusting network...\n")); UINT32 block, currentBlock(0); UINT32 currentIteration(0); - stringstream ss, sst; + std::stringstream ss, sst; bool first_time(true); switch (_p->a.adjust_mode) @@ -281,13 +281,13 @@ void dna_adjust_progress_thread::processAdjustment() if (!_dnaAdj->GetMessageIteration(currentIteration)) break; ss.str(""); - ss << " Iteration " << right << setw(2) << fixed << setprecision(0) << currentIteration; - ss << ", max station corr: " << right << setw(PROGRESS_ADJ_BLOCK_12) << - _dnaAdj->GetMaxCorrection(currentIteration) << endl; + ss << " Iteration " << std::right << std::setw(2) << std::fixed << std::setprecision(0) << currentIteration; + ss << ", max station corr: " << std::right << std::setw(PROGRESS_ADJ_BLOCK_12) << + _dnaAdj->GetMaxCorrection(currentIteration) << std::endl; coutMessage(ss.str()); } - boost::this_thread::sleep(milliseconds(80)); + boost::this_thread::sleep(boost::posix_time::milliseconds(80)); } break; @@ -305,40 +305,40 @@ void dna_adjust_progress_thread::processAdjustment() break; ss.str(""); - ss << " Iteration " << right << setw(2) << fixed << setprecision(0) << currentIteration; - ss << ", max station corr: " << right << setw(PROGRESS_ADJ_BLOCK_12) << _dnaAdj->GetMaxCorrection(currentIteration) << endl; + ss << " Iteration " << std::right << std::setw(2) << std::fixed << std::setprecision(0) << currentIteration; + ss << ", max station corr: " << std::right << std::setw(PROGRESS_ADJ_BLOCK_12) << _dnaAdj->GetMaxCorrection(currentIteration) << std::endl; sst.str(""); if (first_time) - sst << setw(PROGRESS_ADJ_BLOCK_28) << left << " "; - sst << PROGRESS_BACKSPACE_28 << setw(PROGRESS_ADJ_BLOCK_28) << left << ss.str(); + sst << std::setw(PROGRESS_ADJ_BLOCK_28) << std::left << " "; + sst << PROGRESS_BACKSPACE_28 << std::setw(PROGRESS_ADJ_BLOCK_28) << std::left << ss.str(); coutMessage(sst.str()); first_time = true; } - boost::this_thread::sleep(milliseconds(40)); + boost::this_thread::sleep(boost::posix_time::milliseconds(40)); // print new block to screen when adjusting only if (block != currentBlock && _dnaAdj->IsAdjusting()) { ss.str(""); - ss << " Iteration " << right << setw(2) << fixed << setprecision(0) << _dnaAdj->CurrentIteration(); + ss << " Iteration " << std::right << std::setw(2) << std::fixed << std::setprecision(0) << _dnaAdj->CurrentIteration(); #ifdef MULTI_THREAD_ADJUST if (_p->a.multi_thread && !_dnaAdj->processingCombine()) - ss << left << setw(13) << ", adjusting..."; + ss << std::left << std::setw(13) << ", adjusting..."; else #endif - ss << ", block " << left << setw(6) << fixed << setprecision(0) << _dnaAdj->CurrentBlock() + 1; + ss << ", block " << std::left << std::setw(6) << std::fixed << std::setprecision(0) << _dnaAdj->CurrentBlock() + 1; sst.str(""); if (first_time) { - sst << setw(PROGRESS_ADJ_BLOCK_28) << left << " "; + sst << std::setw(PROGRESS_ADJ_BLOCK_28) << std::left << " "; first_time = false; } - sst << PROGRESS_BACKSPACE_28 << setw(PROGRESS_ADJ_BLOCK_28) << left << ss.str(); + sst << PROGRESS_BACKSPACE_28 << std::setw(PROGRESS_ADJ_BLOCK_28) << std::left << ss.str(); coutMessage(sst.str()); currentBlock = block; @@ -366,12 +366,12 @@ void dna_adjust_progress_thread::operator()() processAdjustment(); } -void dna_adjust_progress_thread::coutMessage(const string& message) +void dna_adjust_progress_thread::coutMessage(const std::string& message) { cout_mutex.lock(); - cout.flush(); - cout << message; - cout.flush(); + std::cout.flush(); + std::cout << message; + std::cout.flush(); cout_mutex.unlock(); } diff --git a/dynadjust/dynadjust/dnaadjustwrapper/dnaadjustprogress.hpp b/dynadjust/dynadjust/dnaadjustwrapper/dnaadjustprogress.hpp index 20c692c1..f97c0282 100644 --- a/dynadjust/dynadjust/dnaadjustwrapper/dnaadjustprogress.hpp +++ b/dynadjust/dynadjust/dnaadjustwrapper/dnaadjustprogress.hpp @@ -45,10 +45,6 @@ #include -using namespace std; -using namespace boost; -using namespace boost::posix_time; - using namespace dynadjust::networkadjust; using namespace dynadjust::exception; @@ -63,11 +59,11 @@ class dna_adjust_thread bool prepareAdjustment(); bool processAdjustment(); - void handlePrepareAdjustError(const string& error_msg); - void handleProcessAdjustError(const string& error_msg); - void printErrorMsg(const string& error_msg); - void coutMessage(stringstream& message); - void coutMessage(const string& message); + void handlePrepareAdjustError(const std::string& error_msg); + void handleProcessAdjustError(const std::string& error_msg); + void printErrorMsg(const std::string& error_msg); + void coutMessage(std::stringstream& message); + void coutMessage(const std::string& message); dna_adjust* _dnaAdj; project_settings* _p; @@ -84,7 +80,7 @@ class dna_adjust_progress_thread void prepareAdjustment(); void processAdjustment(); - void coutMessage(const string& message); + void coutMessage(const std::string& message); dna_adjust* _dnaAdj; project_settings* _p; diff --git a/dynadjust/dynadjust/dnaadjustwrapper/dnaadjustwrapper.cpp b/dynadjust/dynadjust/dnaadjustwrapper/dnaadjustwrapper.cpp index 6750f5f7..3fef13b9 100644 --- a/dynadjust/dynadjust/dnaadjustwrapper/dnaadjustwrapper.cpp +++ b/dynadjust/dynadjust/dnaadjustwrapper/dnaadjustwrapper.cpp @@ -29,13 +29,13 @@ extern boost::mutex cout_mutex; using namespace dynadjust; using namespace dynadjust::epsg; -void PrintSummaryMessage(dna_adjust* netAdjust, const project_settings* p, milliseconds *elapsed_time) +void PrintSummaryMessage(dna_adjust* netAdjust, const project_settings* p, boost::posix_time::milliseconds *elapsed_time) { if (p->g.quiet) return; cout_mutex.lock(); - cout.flush(); + std::cout.flush(); UINT32 currentIteration(0); // any messages left @@ -43,23 +43,23 @@ void PrintSummaryMessage(dna_adjust* netAdjust, const project_settings* p, milli { if (!netAdjust->GetMessageIteration(currentIteration)) break; - stringstream ss(""); - ss << " Iteration " << right << setw(2) << fixed << setprecision(0) << currentIteration; - ss << ", max station corr: " << right << setw(12) << netAdjust->GetMaxCorrection(currentIteration) << endl; - cout << PROGRESS_BACKSPACE_28 << setw(28) << left << ss.str(); + std::stringstream ss(""); + ss << " Iteration " << std::right << std::setw(2) << std::fixed << std::setprecision(0) << currentIteration; + ss << ", max station corr: " << std::right << std::setw(12) << netAdjust->GetMaxCorrection(currentIteration) << std::endl; + std::cout << PROGRESS_BACKSPACE_28 << std::setw(28) << std::left << ss.str(); } if (p->a.report_mode) { - cout << "+ Printing results of last adjustment only" << endl; + std::cout << "+ Printing results of last adjustment only" << std::endl; cout_mutex.unlock(); return; } - cout << left << "+ Done." << endl; + std::cout << std::left << "+ Done." << std::endl; UINT32 block_count(netAdjust->blockCount()); - string block_str(" block"); + std::string block_str(" block"); if (block_count > 1) block_str.append("s"); block_str.append("."); @@ -69,27 +69,27 @@ void PrintSummaryMessage(dna_adjust* netAdjust, const project_settings* p, milli case Phased_Block_1Mode: case PhasedMode: if (netAdjust->GetStatus() == ADJUST_SUCCESS) - cout << "+ Successfully adjusted " << block_count << block_str; + std::cout << "+ Successfully adjusted " << block_count << block_str; else - cout << "+ Attempted to adjust " << netAdjust->blockCount() << block_str; - cout << endl; + std::cout << "+ Attempted to adjust " << netAdjust->blockCount() << block_str; + std::cout << std::endl; } - cout << "+ Solution: "; + std::cout << "+ Solution: "; if (netAdjust->GetStatus() != ADJUST_SUCCESS) { - cout << "failed to converge after "; + std::cout << "failed to converge after "; if (p->a.adjust_mode == Phased_Block_1Mode || p->a.max_iterations == 1) - cout << "one iteration." << endl; + std::cout << "one iteration." << std::endl; else - cout << p->a.max_iterations << " iterations." << endl; + std::cout << p->a.max_iterations << " iterations." << std::endl; if (netAdjust->GetStatus() > ADJUST_THRESHOLD_EXCEEDED) { - cout << endl << "+ Open " << leafStr(p->o._adj_file) << " to view the adjustment details." << endl << endl; + std::cout << std::endl << "+ Open " << leafStr(p->o._adj_file) << " to view the adjustment details." << std::endl << std::endl; cout_mutex.unlock(); return; } @@ -99,21 +99,21 @@ void PrintSummaryMessage(dna_adjust* netAdjust, const project_settings* p, milli switch (p->a.adjust_mode) { case Phased_Block_1Mode: - cout << "estimates solved for Block 1 only." << endl << - endl << - "- Warning: Depending on the quality of the apriori station estimates, further" << endl << - " iterations may be needed. --block1-phased mode should only be used once" << endl << - " rigorous estimates have been produced for the entire network." << endl << endl; + std::cout << "estimates solved for Block 1 only." << std::endl << + std::endl << + "- Warning: Depending on the quality of the apriori station estimates, further" << std::endl << + " iterations may be needed. --block1-phased mode should only be used once" << std::endl << + " rigorous estimates have been produced for the entire network." << std::endl << std::endl; break; default: - cout << "converged after " << netAdjust->CurrentIteration() << " iteration"; + std::cout << "converged after " << netAdjust->CurrentIteration() << " iteration"; if (netAdjust->CurrentIteration() > 1) - cout << "s"; - cout << "." << endl; + std::cout << "s"; + std::cout << "." << std::endl; } } - cout << formatedElapsedTime(elapsed_time, "+ Network adjustment took ") << endl; + std::cout << formatedElapsedTime(elapsed_time, "+ Network adjustment took ") << std::endl; cout_mutex.unlock(); } @@ -127,16 +127,16 @@ void SerialiseVarianceMatrices(dna_adjust* netAdjust, const project_settings* p) if (!p->g.quiet) { - cout << "+ Serialising adjustment matrices... "; - cout.flush(); + std::cout << "+ Serialising adjustment matrices... "; + std::cout.flush(); } netAdjust->SerialiseAdjustedVarianceMatrices(); if (!p->g.quiet) { - cout << "done." << endl; - cout.flush(); + std::cout << "done." << std::endl; + std::cout.flush(); } @@ -162,45 +162,45 @@ void GenerateStatistics(dna_adjust* netAdjust, const project_settings* p) { if (!p->g.quiet) { - cout << "+ Generating statistics..."; - cout.flush(); + std::cout << "+ Generating statistics..."; + std::cout.flush(); } netAdjust->GenerateStatistics(); if (!p->g.quiet) { - cout << " done." << endl; + std::cout << " done." << std::endl; - cout << "+ Adjustment results:" << endl << endl; - cout << "+" << OUTPUTLINE << endl; - cout << setw(PRINT_VAR_PAD) << left << " Number of unknown parameters" << fixed << setprecision(0) << netAdjust->GetUnknownsCount(); + std::cout << "+ Adjustment results:" << std::endl << std::endl; + std::cout << "+" << OUTPUTLINE << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Number of unknown parameters" << std::fixed << std::setprecision(0) << netAdjust->GetUnknownsCount(); if (netAdjust->GetAllFixed()) - cout << " (All stations held constrained)"; - cout << endl; + std::cout << " (All stations held constrained)"; + std::cout << std::endl; - cout << setw(PRINT_VAR_PAD) << left << " Number of measurements" << fixed << setprecision(0) << netAdjust->GetMeasurementCount(); + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Number of measurements" << std::fixed << std::setprecision(0) << netAdjust->GetMeasurementCount(); if (netAdjust->GetPotentialOutlierCount() > 0) { - cout << " (" << netAdjust->GetPotentialOutlierCount() << " potential outlier"; + std::cout << " (" << netAdjust->GetPotentialOutlierCount() << " potential outlier"; if (netAdjust->GetPotentialOutlierCount() > 1) - cout << "s"; - cout << ")"; + std::cout << "s"; + std::cout << ")"; } - cout << endl; - cout << setw(PRINT_VAR_PAD) << left << " Degrees of freedom" << fixed << setprecision(0) << netAdjust->GetDegreesOfFreedom() << endl; - cout << setw(PRINT_VAR_PAD) << left << " Chi squared" << fixed << setprecision(2) << netAdjust->GetChiSquared() << endl; - cout << setw(PRINT_VAR_PAD) << left << " Rigorous sigma zero" << fixed << setprecision(3) << netAdjust->GetSigmaZero() << endl; - cout << setw(PRINT_VAR_PAD) << left << " Global (Pelzer) Reliability" << fixed << setw(8) << setprecision(3) << netAdjust->GetGlobalPelzerRel() << "(excludes non redundant measurements)" << endl << endl; + std::cout << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Degrees of freedom" << std::fixed << std::setprecision(0) << netAdjust->GetDegreesOfFreedom() << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Chi squared" << std::fixed << std::setprecision(2) << netAdjust->GetChiSquared() << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Rigorous sigma zero" << std::fixed << std::setprecision(3) << netAdjust->GetSigmaZero() << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Global (Pelzer) Reliability" << std::fixed << std::setw(8) << std::setprecision(3) << netAdjust->GetGlobalPelzerRel() << "(excludes non redundant measurements)" << std::endl << std::endl; - stringstream ss(""); - ss << left << " Chi-Square test (" << setprecision (1) << fixed << p->a.confidence_interval << "%)"; - cout << setw(PRINT_VAR_PAD) << left << ss.str(); + std::stringstream ss(""); + ss << std::left << " Chi-Square test (" << std::setprecision(1) << std::fixed << p->a.confidence_interval << "%)"; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << ss.str(); ss.str(""); - ss << fixed << setprecision(3) << + ss << std::fixed << std::setprecision(3) << netAdjust->GetChiSquaredLowerLimit() << " < " << netAdjust->GetSigmaZero() << " < " << netAdjust->GetChiSquaredUpperLimit(); - cout << setw(CHISQRLIMITS) << left << ss.str(); + std::cout << std::setw(CHISQRLIMITS) << std::left << ss.str(); ss.str(""); if (netAdjust->GetDegreesOfFreedom() < 1) @@ -223,12 +223,12 @@ void GenerateStatistics(dna_adjust* netAdjust, const project_settings* p) ss << " ***"; } - cout << setw(PASS_FAIL) << right << ss.str() << endl; - cout << "+" << OUTPUTLINE << endl << endl; + std::cout << std::setw(PASS_FAIL) << std::right << ss.str() << std::endl; + std::cout << "+" << OUTPUTLINE << std::endl << std::endl; } } else - cout << endl; + std::cout << std::endl; } void PrintAdjustedMeasurements(dna_adjust* netAdjust, const project_settings* p) @@ -237,13 +237,13 @@ void PrintAdjustedMeasurements(dna_adjust* netAdjust, const project_settings* p) { if (!p->g.quiet) { - cout << "+ Printing adjusted measurements..."; - cout.flush(); + std::cout << "+ Printing adjusted measurements..."; + std::cout.flush(); } netAdjust->PrintAdjustedNetworkMeasurements(); if (!p->g.quiet) - cout << " done." << endl; + std::cout << " done." << std::endl; } } @@ -254,12 +254,12 @@ void PrintMeasurementstoStations(dna_adjust* netAdjust, const project_settings* { if (!p->g.quiet) { - cout << "+ Printing summary of measurements connected to each station..."; - cout.flush(); + std::cout << "+ Printing summary of measurements connected to each station..."; + std::cout.flush(); } netAdjust->PrintMeasurementsToStation(); if (!p->g.quiet) - cout << " done." << endl; + std::cout << " done." << std::endl; } } @@ -268,12 +268,12 @@ void PrintAdjustedNetworkStations(dna_adjust* netAdjust, const project_settings* // Print adjusted stations to ADJ file if (!p->g.quiet) { - cout << "+ Printing adjusted station coordinates..."; - cout.flush(); + std::cout << "+ Printing adjusted station coordinates..."; + std::cout.flush(); } netAdjust->PrintAdjustedNetworkStations(); if (!p->g.quiet) - cout << " done." << endl; + std::cout << " done." << std::endl; } void PrintPositionalUncertainty(dna_adjust* netAdjust, const project_settings* p) @@ -283,13 +283,13 @@ void PrintPositionalUncertainty(dna_adjust* netAdjust, const project_settings* p { if (!p->g.quiet) { - cout << "+ Printing positional uncertainty of adjusted coordinates..."; - cout.flush(); + std::cout << "+ Printing positional uncertainty of adjusted coordinates..."; + std::cout.flush(); } // Print correlations as required netAdjust->PrintPositionalUncertainty(); if (!p->g.quiet) - cout << " done." << endl; + std::cout << " done." << std::endl; } } @@ -300,12 +300,12 @@ void PrintStationCorrections(dna_adjust* netAdjust, const project_settings* p) { if (!p->g.quiet) { - cout << "+ Printing corrections to initial station coordinates..."; - cout.flush(); + std::cout << "+ Printing corrections to initial station coordinates..."; + std::cout.flush(); } netAdjust->PrintNetworkStationCorrections(); if (!p->g.quiet) - cout << " done." << endl; + std::cout << " done." << std::endl; } } @@ -314,12 +314,12 @@ void UpdateBinaryFiles(dna_adjust* netAdjust, const project_settings* p) // Update bst and bms files with adjustment results if (!p->g.quiet) { - cout << "+ Updating binary station and measurement files..."; - cout.flush(); + std::cout << "+ Updating binary station and measurement files..."; + std::cout.flush(); } netAdjust->UpdateBinaryFiles(); if (!p->g.quiet) - cout << " done." << endl; + std::cout << " done." << std::endl; } void ExportDynaML(dna_adjust* netAdjust, project_settings* p) @@ -331,14 +331,14 @@ void ExportDynaML(dna_adjust* netAdjust, project_settings* p) p->o._xml_file = p->o._adj_file + ".stn.xml"; if (!p->g.quiet) - cout << "+ Serializing estimated coordinates to " << leafStr(p->o._xml_file) << "... "; + std::cout << "+ Serializing estimated coordinates to " << leafStr(p->o._xml_file) << "... "; // Export Stations file netAdjust->PrintEstimatedStationCoordinatestoDNAXML(p->o._xml_file, dynaml, (p->i.flag_unused_stn ? true : false)); if (!p->g.quiet) - cout << "Done." << endl; + std::cout << "Done." << std::endl; } // Output adjustment as XML msr @@ -348,14 +348,14 @@ void ExportDynaML(dna_adjust* netAdjust, project_settings* p) p->o._xml_file = p->o._adj_file + ".msr.xml"; if (!p->g.quiet) - cout << "+ Serializing estimated coordinates and uncertainties to " << leafStr(p->o._xml_file) << "... "; + std::cout << "+ Serializing estimated coordinates and uncertainties to " << leafStr(p->o._xml_file) << "... "; // Export Measurements file (exclude unused stations given // they will not have been estimated) netAdjust->PrintEstimatedStationCoordinatestoDNAXML_Y(p->o._xml_file, dynaml); if (!p->g.quiet) - cout << "Done." << endl; + std::cout << "Done." << std::endl; } } @@ -364,33 +364,33 @@ void ExportDNA(dna_adjust* netAdjust, project_settings* p) // Print adjusted stations and measurements to DNA stn if (p->o._export_dna_stn_file) { - string stnfilename(p->o._adj_file + ".stn"); + std::string stnfilename(p->o._adj_file + ".stn"); if (!p->g.quiet) - cout << "+ Serializing estimated coordinates to " << leafStr(stnfilename) << "... "; + std::cout << "+ Serializing estimated coordinates to " << leafStr(stnfilename) << "... "; // Export Station file netAdjust->PrintEstimatedStationCoordinatestoDNAXML(stnfilename, dna, (p->i.flag_unused_stn ? true : false)); if (!p->g.quiet) - cout << "Done." << endl; + std::cout << "Done." << std::endl; } // Print adjusted stations and measurements to DNA msr if (p->o._export_dna_msr_file) { - string msrfilename(p->o._adj_file + ".msr"); + std::string msrfilename(p->o._adj_file + ".msr"); if (!p->g.quiet) - cout << "+ Serializing estimated coordinates and uncertainties to " << leafStr(msrfilename) << "... "; + std::cout << "+ Serializing estimated coordinates and uncertainties to " << leafStr(msrfilename) << "... "; // Export Measurements file (exclude unused stations given // they will not have been estimated) netAdjust->PrintEstimatedStationCoordinatestoDNAXML_Y(msrfilename, dna); if (!p->g.quiet) - cout << "Done." << endl; + std::cout << "Done." << std::endl; } } @@ -399,31 +399,31 @@ void ExportSinex(dna_adjust* netAdjust, const project_settings* p) // Print adjusted stations and measurements to SINEX if (p->o._export_snx_file) { - string sinex_file; + std::string sinex_file; // Export to SINEX if (!p->g.quiet) - cout << "+ Printing station estimates and uncertainties to SINEX..."; + std::cout << "+ Printing station estimates and uncertainties to SINEX..."; bool success(netAdjust->PrintEstimatedStationCoordinatestoSNX(sinex_file)); // SomeFunc() if (!p->g.quiet) - cout << " done." << endl; + std::cout << " done." << std::endl; if (!success) { - cout << "- Warning: The SINEX export process produced some warnings." << endl; + std::cout << "- Warning: The SINEX export process produced some warnings." << std::endl; switch (p->a.adjust_mode) { case PhasedMode: - sinex_file = findandreplace(sinex_file, string("-block1"), string("-block*")); + sinex_file = findandreplace(sinex_file, std::string("-block1"), std::string("-block*")); } - cout << " See " << leafStr(sinex_file) << ".err for details." << endl; + std::cout << " See " << leafStr(sinex_file) << ".err for details." << std::endl; } } } -int ParseCommandLineOptions(const int& argc, char* argv[], const variables_map& vm, project_settings& p) +int ParseCommandLineOptions(const int& argc, char* argv[], const boost::program_options::variables_map& vm, project_settings& p) { // capture command line arguments for (int cmd_arg(0); cmd_arg(p.g.output_folder, p.g.network_name, "dnaproj"); + p.g.project_file = formPath(p.g.output_folder, p.g.network_name, "dnaproj"); - if (exists(p.g.project_file)) + if (boost::filesystem::exists(p.g.project_file)) { // update import settings from dnaproj file try { @@ -494,24 +494,24 @@ int ParseCommandLineOptions(const int& argc, char* argv[], const variables_map& // binary station file location (output) if (vm.count(BIN_STN_FILE)) - p.a.bst_file = formPath(p.g.input_folder, p.a.bst_file); + p.a.bst_file = formPath(p.g.input_folder, p.a.bst_file); else - p.a.bst_file = formPath(p.g.output_folder, p.g.network_name, "bst"); + p.a.bst_file = formPath(p.g.output_folder, p.g.network_name, "bst"); // binary station file location (output) if (vm.count(BIN_MSR_FILE)) - p.a.bms_file = formPath(p.g.input_folder, p.a.bms_file); + p.a.bms_file = formPath(p.g.input_folder, p.a.bms_file); else - p.a.bms_file = formPath(p.g.output_folder, p.g.network_name, "bms"); + p.a.bms_file = formPath(p.g.output_folder, p.g.network_name, "bms"); - if (!exists(p.a.bst_file) || !exists(p.a.bms_file)) + if (!boost::filesystem::exists(p.a.bst_file) || !boost::filesystem::exists(p.a.bms_file)) { cout_mutex.lock(); - cout << endl << "- Nothing to do: "; + std::cout << std::endl << "- Nothing to do: "; if (p.g.network_name.empty()) - cout << endl << "network name has not been specified specified, and " << endl << " "; - cout << p.a.bst_file << " and " << p.a.bms_file << " do not exist." << endl << endl; + std::cout << std::endl << "network name has not been specified specified, and " << std::endl << " "; + std::cout << p.a.bst_file << " and " << p.a.bms_file << " do not exist." << std::endl << std::endl; cout_mutex.unlock(); return EXIT_FAILURE; } @@ -592,22 +592,22 @@ int ParseCommandLineOptions(const int& argc, char* argv[], const variables_map& if (vm.count(TYPE_B_FILE)) p.o._apply_type_b_file = 1; - p.s.asl_file = formPath(p.g.output_folder, p.g.network_name, "asl"); // associated stations list - p.s.aml_file = formPath(p.g.output_folder, p.g.network_name, "aml"); // associated measurements list - p.a.map_file = formPath(p.g.output_folder, p.g.network_name, "map"); // station names map + p.s.asl_file = formPath(p.g.output_folder, p.g.network_name, "asl"); // associated stations list + p.s.aml_file = formPath(p.g.output_folder, p.g.network_name, "aml"); // associated measurements list + p.a.map_file = formPath(p.g.output_folder, p.g.network_name, "map"); // station names map // has a seg file name been specified? if (vm.count(SEG_FILE)) - p.a.seg_file = formPath(p.g.input_folder, p.a.seg_file); + p.a.seg_file = formPath(p.g.input_folder, p.a.seg_file); else - p.a.seg_file = formPath(p.g.output_folder, p.g.network_name, "seg"); + p.a.seg_file = formPath(p.g.output_folder, p.g.network_name, "seg"); if (vm.count(OUTPUT_APU_CORRELATIONS)) p.o._output_pu_covariances = 1; // Set up file names dependent on adjustment mode p.o._xyz_file = p.o._adj_file = - formPath(p.g.output_folder, p.g.network_name); + formPath(p.g.output_folder, p.g.network_name); if (vm.count(OUTPUT_POS_UNCERTAINTY)) { @@ -728,53 +728,53 @@ void LoadBinaryMeta(binary_file_meta_t& bst_meta, binary_file_meta_t& bms_meta, bst.load_bst_file_meta(p.a.bst_file, bst_meta); bms.load_bms_file_meta(p.a.bms_file, bms_meta); - bst_meta_import = (iequals(bst_meta.modifiedBy, __import_app_name__) || - iequals(bst_meta.modifiedBy, __import_dll_name__)); - bms_meta_import = (iequals(bms_meta.modifiedBy, __import_app_name__) || - iequals(bms_meta.modifiedBy, __import_dll_name__)); + bst_meta_import = (boost::iequals(bst_meta.modifiedBy, __import_app_name__) || + boost::iequals(bst_meta.modifiedBy, __import_dll_name__)); + bms_meta_import = (boost::iequals(bms_meta.modifiedBy, __import_app_name__) || + boost::iequals(bms_meta.modifiedBy, __import_dll_name__)); } int main(int argc, char* argv[]) { // create banner message - string cmd_line_banner, stnfilename, msrfilename; + std::string cmd_line_banner, stnfilename, msrfilename; fileproc_help_header(&cmd_line_banner); project_settings p; - variables_map vm; - positional_options_description positional_options; + boost::program_options::variables_map vm; + boost::program_options::positional_options_description positional_options; - options_description standard_options("+ " + string(ALL_MODULE_STDOPT), PROGRAM_OPTIONS_LINE_LENGTH); - options_description adj_mode_options("+ " + string(ADJUST_MODULE_MODE), PROGRAM_OPTIONS_LINE_LENGTH); - options_description phased_adj_options("+ " + string(ADJUST_MODULE_PHASED), PROGRAM_OPTIONS_LINE_LENGTH); - options_description adj_config_options("+ " + string(ADJUST_MODULE_CONFIG), PROGRAM_OPTIONS_LINE_LENGTH); - options_description staged_adj_options("+ " + string(ADJUST_MODULE_STAGE), PROGRAM_OPTIONS_LINE_LENGTH); - options_description output_options("+ " + string(ALL_MODULE_OUTPUT), PROGRAM_OPTIONS_LINE_LENGTH); - options_description export_options("+ " + string(ALL_MODULE_EXPORT), PROGRAM_OPTIONS_LINE_LENGTH); - options_description generic_options("+ " + string(ALL_MODULE_GENERIC), PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description standard_options("+ " + std::string(ALL_MODULE_STDOPT), PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description adj_mode_options("+ " + std::string(ADJUST_MODULE_MODE), PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description phased_adj_options("+ " + std::string(ADJUST_MODULE_PHASED), PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description adj_config_options("+ " + std::string(ADJUST_MODULE_CONFIG), PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description staged_adj_options("+ " + std::string(ADJUST_MODULE_STAGE), PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description output_options("+ " + std::string(ALL_MODULE_OUTPUT), PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description export_options("+ " + std::string(ALL_MODULE_EXPORT), PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description generic_options("+ " + std::string(ALL_MODULE_GENERIC), PROGRAM_OPTIONS_LINE_LENGTH); - string cmd_line_usage("+ "); + std::string cmd_line_usage("+ "); cmd_line_usage.append(__BINARY_NAME__).append(" usage: ").append(__BINARY_NAME__).append(" ").append(NETWORK_NAME).append(" [options]"); - options_description allowable_options(cmd_line_usage, PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description allowable_options(cmd_line_usage, PROGRAM_OPTIONS_LINE_LENGTH); try { standard_options.add_options() - (PROJECT_FILE_P, value(&p.g.project_file), + (PROJECT_FILE_P, boost::program_options::value(&p.g.project_file), "Project file containing all user options. If specified, all other options are ignored.") - (NETWORK_NAME_N, value(&p.g.network_name), + (NETWORK_NAME_N, boost::program_options::value(&p.g.network_name), "Network name. User defined name for all input and output files. Default is \"network#\".") - (INPUT_FOLDER_I, value(&p.g.input_folder), + (INPUT_FOLDER_I, boost::program_options::value(&p.g.input_folder), "Path containing all input files") - (OUTPUT_FOLDER_O, value(&p.g.output_folder), // default is ./, + (OUTPUT_FOLDER_O, boost::program_options::value(&p.g.output_folder), // default is ./, "Path for all output files") - (BIN_STN_FILE, value(&p.a.bst_file), + (BIN_STN_FILE, boost::program_options::value(&p.a.bst_file), "Binary station file name. Overrides network name.") - (BIN_MSR_FILE, value(&p.a.bms_file), + (BIN_MSR_FILE, boost::program_options::value(&p.a.bms_file), "Binary measurement file name. Overrides network name.") - (SEG_FILE, value(&p.a.seg_file), + (SEG_FILE, boost::program_options::value(&p.a.seg_file), "Network segmentation file name. Overrides network name.") - (COMMENTS, value(&p.a.comments), + (COMMENTS, boost::program_options::value(&p.a.comments), "Comments about the adjustment. All comments are printed to the adj file.") ; @@ -801,28 +801,28 @@ int main(int argc, char* argv[]) ; adj_config_options.add_options() - (CONF_INTERVAL, value(&p.a.confidence_interval), - (string("Confidence interval for testing the least squares solution and measurement corrections. Default is ")+ - StringFromT(p.a.confidence_interval, 1)+string("%.")).c_str()) - (ITERATION_THRESHOLD, value(&p.a.iteration_threshold), - (string("Least squares iteration threshold. Default is ")+ - StringFromT(p.a.iteration_threshold, 4)+string("m.")).c_str()) - (MAX_ITERATIONS, value(&p.a.max_iterations), - (string("Maximum number of iterations. Default is ")+ - StringFromT(p.a.max_iterations)+string(".")).c_str()) - (STN_CONSTRAINTS, value(&p.a.station_constraints), + (CONF_INTERVAL, boost::program_options::value(&p.a.confidence_interval), + (std::string("Confidence interval for testing the least squares solution and measurement corrections. Default is ")+ + StringFromT(p.a.confidence_interval, 1)+std::string("%.")).c_str()) + (ITERATION_THRESHOLD, boost::program_options::value(&p.a.iteration_threshold), + (std::string("Least squares iteration threshold. Default is ")+ + StringFromT(p.a.iteration_threshold, 4)+std::string("m.")).c_str()) + (MAX_ITERATIONS, boost::program_options::value(&p.a.max_iterations), + (std::string("Maximum number of iterations. Default is ")+ + StringFromT(p.a.max_iterations)+std::string(".")).c_str()) + (STN_CONSTRAINTS, boost::program_options::value(&p.a.station_constraints), "Station constraints. arg is a comma delimited string \"stn1,CCC,stn2,CCF\" defining specific station constraints. These constraints override those contained in the station file.") - (FREE_STN_SD, value(&p.a.free_std_dev), - (string("A-priori standard deviation for free stations. Default is ")+ - StringFromT(p.a.free_std_dev)+string("m.")).c_str()) - (FIXED_STN_SD, value(&p.a.fixed_std_dev), - (string("A-priori standard deviation for fixed stations. Default is ")+ - StringFromT(p.a.fixed_std_dev, 6)+string("m.")).c_str()) + (FREE_STN_SD, boost::program_options::value(&p.a.free_std_dev), + (std::string("A-priori standard deviation for free stations. Default is ")+ + StringFromT(p.a.free_std_dev)+std::string("m.")).c_str()) + (FIXED_STN_SD, boost::program_options::value(&p.a.fixed_std_dev), + (std::string("A-priori standard deviation for fixed stations. Default is ")+ + StringFromT(p.a.fixed_std_dev, 6)+std::string("m.")).c_str()) (SCALE_NORMAL_UNITY, "Scale adjustment normal matrices to unity prior to computing inverse to minimise loss of precision caused by tight variances placed on constraint stations.") - (TYPE_B_GLOBAL, value(&p.a.type_b_global), + (TYPE_B_GLOBAL, boost::program_options::value(&p.a.type_b_global), "Type b uncertainties to be added to each computed uncertainty. arg is a comma delimited string that provides 1D, 2D or 3D uncertainties in the local reference frame (e.g. \"up\" or \"e,n\" or \"e,n,up\").") - (TYPE_B_FILE, value(&p.a.type_b_file), + (TYPE_B_FILE, boost::program_options::value(&p.a.type_b_file), "Type b uncertainties file name. Full path to a file containing Type b uncertainties to be added to the computed uncertainty for specific sites.") ; @@ -836,8 +836,8 @@ int main(int argc, char* argv[]) output_options.add_options() (OUTPUT_MSR_TO_STN, "Output summary of measurements connected to each station.") - (OUTPUT_MSR_TO_STN_SORTBY, value(&p.o._sort_msr_to_stn), - string("Sort order for measurement to stations summary.\n " + + (OUTPUT_MSR_TO_STN_SORTBY, boost::program_options::value(&p.o._sort_msr_to_stn), + std::string("Sort order for measurement to stations summary.\n " + StringFromT(orig_stn_sort_ui) + ": Original station order (default)\n " + StringFromT(meas_stn_sort_ui) + ": Measurement count").c_str()) (OUTPUT_ADJ_STN_ITER, @@ -850,8 +850,8 @@ int main(int argc, char* argv[]) "Output computed measurements on each iteration.") (OUTPUT_ADJ_MSR, "Output final adjusted measurements.") - (OUTPUT_ADJ_GNSS_UNITS, value(&p.o._adj_gnss_units), - string("Units for adjusted GNSS baseline measurements in the .adj file.\n " + + (OUTPUT_ADJ_GNSS_UNITS, boost::program_options::value(&p.o._adj_gnss_units), + std::string("Units for adjusted GNSS baseline measurements in the .adj file.\n " + StringFromT(XYZ_adj_gnss_ui) + ": As measured (default)\n " + StringFromT(ENU_adj_gnss_ui) + ": Local [east, north, up]\n " + StringFromT(AED_adj_gnss_ui) + ": Polar [azimuth, vert. angle, slope dist]\n " + @@ -862,8 +862,8 @@ int main(int argc, char* argv[]) "Output measurement and cluster ids for database mapping.") (OUTPUT_IGNORED_MSRS, "Output adjusted measurement statistics for ignored measurements.") - (OUTPUT_ADJ_MSR_SORTBY, value(&p.o._sort_adj_msr), - string("Sort order for adjusted measurements.\n " + + (OUTPUT_ADJ_MSR_SORTBY, boost::program_options::value(&p.o._sort_adj_msr), + std::string("Sort order for adjusted measurements.\n " + StringFromT(orig_adj_msr_sort_ui) + ": Original input file order (default)\n " + StringFromT(type_adj_msr_sort_ui) + ": Measurement type\n " + StringFromT(inst_adj_msr_sort_ui) + ": Station 1\n " + @@ -871,42 +871,41 @@ int main(int argc, char* argv[]) StringFromT(meas_adj_msr_sort_ui) + ": Measurement value\n " + StringFromT(corr_adj_msr_sort_ui) + ": Correction\n " + StringFromT(a_sd_adj_msr_sort_ui) + ": Adjusted std. dev.\n " + - StringFromT(n_st_adj_msr_sort_ui) + ": N-statistic\n " + - StringFromT(outl_adj_msr_sort_ui) + ": Suspected outlier").c_str()) + StringFromT(n_st_adj_msr_sort_ui) + ": N-statistic").c_str()) (OUTPUT_ADJ_STN_BLOCKS, "For phased adjustments, output adjusted coordinates according to each block.") (OUTPUT_ADJ_MSR_BLOCKS, "For phased adjustments, output adjusted measurements according to each block.") (OUTPUT_ADJ_STN_SORT_ORDER, "Output station information using the station order in the original station file. By default, stations are output in alpha-numeric order.") - (OUTPUT_STN_COORD_TYPES, value(&p.o._stn_coord_types), - (string("Output station coordinate types. arg is a case-sensitive string of chars \"ENzPLHhXYZ\" defining the specific types to be printed. Default is ").append( + (OUTPUT_STN_COORD_TYPES, boost::program_options::value(&p.o._stn_coord_types), + (std::string("Output station coordinate types. arg is a case-sensitive string of chars \"ENzPLHhXYZ\" defining the specific types to be printed. Default is ").append( p.o._stn_coord_types).append( ".")).c_str()) - (OUTPUT_ANGULAR_TYPE_STN, value(&p.o._angular_type_stn), - string("Output type for angular station coordinates.\n" + (OUTPUT_ANGULAR_TYPE_STN, boost::program_options::value(&p.o._angular_type_stn), + std::string("Output type for angular station coordinates.\n" " 0: Degrees, minutes and seconds (default)\n" " 1: Decimal degrees").c_str()) (OUTPUT_STN_CORR, "Output station corrections with adjusted station coordinates.") - (OUTPUT_PRECISION_METRES_STN, value(&p.o._precision_metres_stn), - (string("Output precision for linear station coordinates in metres. Default is ")+ + (OUTPUT_PRECISION_METRES_STN, boost::program_options::value(&p.o._precision_metres_stn), + (std::string("Output precision for linear station coordinates in metres. Default is ")+ StringFromT(p.o._precision_metres_stn, 0)).c_str()) - (OUTPUT_PRECISION_SECONDS_STN, value(&p.o._precision_seconds_stn), - (string("Output precision for angular station coordinates. For values in degrees, minutes and seconds, precision relates to seconds. For values in decimal degrees, precision relates to degrees. Default is ")+ + (OUTPUT_PRECISION_SECONDS_STN, boost::program_options::value(&p.o._precision_seconds_stn), + (std::string("Output precision for angular station coordinates. For values in degrees, minutes and seconds, precision relates to seconds. For values in decimal degrees, precision relates to degrees. Default is ")+ StringFromT(p.o._precision_seconds_stn, 0)).c_str()) - (OUTPUT_PRECISION_METRES_MSR, value(&p.o._precision_metres_msr), - (string("Output precision for linear measurements in metres. Default is ")+ + (OUTPUT_PRECISION_METRES_MSR, boost::program_options::value(&p.o._precision_metres_msr), + (std::string("Output precision for linear measurements in metres. Default is ")+ StringFromT(p.o._precision_metres_msr, 0)).c_str()) - (OUTPUT_PRECISION_SECONDS_MSR, value(&p.o._precision_seconds_msr), - (string("Output precision for angular measurements. For values in degrees, minutes and seconds, precision relates to seconds. For values in decimal degrees, precision relates to degrees. Default is ")+ + (OUTPUT_PRECISION_SECONDS_MSR, boost::program_options::value(&p.o._precision_seconds_msr), + (std::string("Output precision for angular measurements. For values in degrees, minutes and seconds, precision relates to seconds. For values in decimal degrees, precision relates to degrees. Default is ")+ StringFromT(p.o._precision_seconds_msr, 0)).c_str()) - (OUTPUT_ANGULAR_TYPE_MSR, value(&p.o._angular_type_msr), - string("Output type for angular measurements.\n" + (OUTPUT_ANGULAR_TYPE_MSR, boost::program_options::value(&p.o._angular_type_msr), + std::string("Output type for angular measurements.\n" " 0: Degrees, minutes and seconds (default)\n" " 1: Decimal degrees").c_str()) - (OUTPUT_DMS_FORMAT_MSR, value(&p.o._dms_format_msr), - string("Output format for angular (dms) measurements.\n" + (OUTPUT_DMS_FORMAT_MSR, boost::program_options::value(&p.o._dms_format_msr), + std::string("Output format for angular (dms) measurements.\n" " 0: Separated fields (default)\n" " 1: Separated fields with symbols\n" " 2: HP notation").c_str()) @@ -917,19 +916,19 @@ int main(int argc, char* argv[]) "Output positional uncertainty and variances of adjusted station coordinates to .apu file.") (OUTPUT_APU_CORRELATIONS, "Output covariances between adjusted station coordinates to .apu file.") - (OUTPUT_APU_UNITS, value(&p.o._apu_vcv_units), - string("Variance matrix units in the .apu file.\n " + + (OUTPUT_APU_UNITS, boost::program_options::value(&p.o._apu_vcv_units), + std::string("Variance matrix units in the .apu file.\n " + StringFromT(XYZ_apu_ui) + ": Cartesian [X,Y,Z] (default)\n " + //StringFromT(LLH_apu_ui) + ": Geographic [Lat,Lon,ht]\n " + StringFromT(ENU_apu_ui) + ": Local [e,n,up]").c_str()) (OUTPUT_STN_COR_FILE, "Output corrections (azimuth, distance, e, n, up) to initial station coordinates to .cor file.") - (HZ_CORR_THRESHOLD, value(&p.o._hz_corr_threshold), - (string("Minimum horizontal threshold by which to restrict output of station corrections to .cor file. Default is ")+ - StringFromT(p.o._hz_corr_threshold, 1)+string("m")).c_str()) - (VT_CORR_THRESHOLD, value(&p.o._vt_corr_threshold), - (string("Minimum vertical threshold by which to restrict output of station corrections to .cor file. Default is ")+ - StringFromT(p.o._vt_corr_threshold, 1)+string("m")).c_str()) + (HZ_CORR_THRESHOLD, boost::program_options::value(&p.o._hz_corr_threshold), + (std::string("Minimum horizontal threshold by which to restrict output of station corrections to .cor file. Default is ")+ + StringFromT(p.o._hz_corr_threshold, 1)+std::string("m")).c_str()) + (VT_CORR_THRESHOLD, boost::program_options::value(&p.o._vt_corr_threshold), + (std::string("Minimum vertical threshold by which to restrict output of station corrections to .cor file. Default is ")+ + StringFromT(p.o._vt_corr_threshold, 1)+std::string("m")).c_str()) //(UPDATE_ORIGINAL_STN_FILE, // "Update original station file with adjusted station coordinates.") (EXPORT_XML_STN_FILE, @@ -947,17 +946,17 @@ int main(int argc, char* argv[]) // Declare a group of options that will be // allowed only on command line generic_options.add_options() - (VERBOSE, value(&p.g.verbose), - string("Give detailed information about what ").append(__BINARY_NAME__).append(" is doing.\n" + (VERBOSE, boost::program_options::value(&p.g.verbose), + std::string("Give detailed information about what ").append(__BINARY_NAME__).append(" is doing.\n" " 0: No information (default)\n" " 1: Helpful information\n" " 2: Extended information\n" " 3: Debug level information").c_str()) (QUIET, - string("Suppresses all explanation of what ").append(__BINARY_NAME__).append(" is doing unless an error occurs").c_str()) + std::string("Suppresses all explanation of what ").append(__BINARY_NAME__).append(" is doing unless an error occurs").c_str()) (VERSION_V, "Display the current program version") (HELP_H, "Show this help message") - (HELP_MODULE, value(), + (HELP_MODULE_H, boost::program_options::value(), "Provide help for a specific help category.") ; @@ -966,75 +965,92 @@ int main(int argc, char* argv[]) // add "positional options" to handle command line tokens which have no option name positional_options.add(NETWORK_NAME, -1); - command_line_parser parser(argc, argv); + boost::program_options::command_line_parser parser(argc, argv); store(parser.options(allowable_options).positional(positional_options).run(), vm); notify(vm); } catch (const std::exception& e) { cout_mutex.lock(); - cout << "- Error: " << e.what() << endl; - cout << cmd_line_banner << allowable_options << endl; + std::cout << "- Error: " << e.what() << std::endl; + std::cout << cmd_line_banner << allowable_options << std::endl; cout_mutex.unlock(); return EXIT_FAILURE; } catch (...) { - cout << "+ Exception of unknown type!\n"; + std::cout << "+ Exception of unknown type!\n"; return EXIT_FAILURE; } if (argc < 2) { - cout << endl << "- Nothing to do - no options provided. " << endl << endl; - cout << cmd_line_banner << allowable_options << endl; + std::cout << std::endl << "- Nothing to do - no options provided. " << std::endl << std::endl; + std::cout << cmd_line_banner << allowable_options << std::endl; return EXIT_FAILURE; } if (vm.count(VERSION)) { - cout << cmd_line_banner << endl; + std::cout << cmd_line_banner << std::endl; return EXIT_SUCCESS; } if (vm.count(HELP)) { - cout << cmd_line_banner << allowable_options << endl; + std::cout << cmd_line_banner << allowable_options << std::endl; return EXIT_SUCCESS; } if (vm.count(HELP_MODULE)) { - cout << cmd_line_banner; - string original_text = vm[HELP_MODULE].as(); - string help_text = str_upper(original_text); - - if (str_upper(ALL_MODULE_STDOPT).find(help_text) != string::npos) { - cout << standard_options << endl; + std::cout << cmd_line_banner; + std::string original_text = vm[HELP_MODULE].as(); + std::string help_text = str_upper(original_text); + bool module_found(false); + + if (str_upper(ALL_MODULE_STDOPT).find(help_text) != std::string::npos) { + std::cout << standard_options << std::endl; + module_found = true; } - else if (str_upper(ADJUST_MODULE_MODE).find(help_text) != string::npos) { - cout << adj_mode_options << endl; + + if (str_upper(ADJUST_MODULE_MODE).find(help_text) != std::string::npos) { + std::cout << adj_mode_options << std::endl; + module_found = true; } - else if (str_upper(ADJUST_MODULE_PHASED).find(help_text) != string::npos) { - cout << phased_adj_options << endl; + + if (str_upper(ADJUST_MODULE_PHASED).find(help_text) != std::string::npos) { + std::cout << phased_adj_options << std::endl; + module_found = true; } - else if (str_upper(ADJUST_MODULE_CONFIG).find(help_text) != string::npos) { - cout << adj_config_options << endl; + + if (str_upper(ADJUST_MODULE_CONFIG).find(help_text) != std::string::npos) { + std::cout << adj_config_options << std::endl; + module_found = true; } - else if (str_upper(ADJUST_MODULE_STAGE).find(help_text) != string::npos) { - cout << staged_adj_options << endl; + + if (str_upper(ADJUST_MODULE_STAGE).find(help_text) != std::string::npos) { + std::cout << staged_adj_options << std::endl; + module_found = true; } - else if (str_upper(ALL_MODULE_OUTPUT).find(help_text) != string::npos) { - cout << output_options << endl; + + if (str_upper(ALL_MODULE_OUTPUT).find(help_text) != std::string::npos) { + std::cout << output_options << std::endl; + module_found = true; } - else if (str_upper(ALL_MODULE_EXPORT).find(help_text) != string::npos) { - cout << export_options << endl; + + if (str_upper(ALL_MODULE_EXPORT).find(help_text) != std::string::npos) { + std::cout << export_options << std::endl; + module_found = true; } - else if (str_upper(ALL_MODULE_GENERIC).find(help_text) != string::npos) { - cout << generic_options << endl; + + if (str_upper(ALL_MODULE_GENERIC).find(help_text) != std::string::npos) { + std::cout << generic_options << std::endl; + module_found = true; } - else { - cout << endl << "- Error: Help module '" << - original_text << "' is not in the list of options." << endl; + + if (!module_found) { + std::cout << std::endl << "- Error: Help module '" << + original_text << "' is not in the list of options." << std::endl; return EXIT_FAILURE; } @@ -1063,7 +1079,14 @@ int main(int argc, char* argv[]) LoadBinaryMeta(bst_meta, bms_meta, p, bst_meta_import, bms_meta_import); // Capture datum set within project file - CDnaDatum datum(epsgStringFromName(p.r.reference_frame), p.r.epoch); + CDnaDatum datum; + + // Inspect if reftran has been executed. If so, select the appropriate + // reference frame label + if (bst_meta.reftran) + datum.SetDatumFromName(p.r.reference_frame, p.r.epoch); + else + datum.SetDatumFromName(p.i.reference_frame, p.i.epoch); if (vm.count(QUIET)) p.g.quiet = 1; @@ -1071,44 +1094,44 @@ int main(int argc, char* argv[]) if (!p.g.quiet) { cout_mutex.lock(); - cout << endl << cmd_line_banner; - - cout << "+ Options:" << endl; - cout << setw(PRINT_VAR_PAD) << left << " Network name: " << p.g.network_name << endl; - cout << setw(PRINT_VAR_PAD) << left << " Input folder: " << p.g.input_folder << endl; - cout << setw(PRINT_VAR_PAD) << left << " Output folder: " << p.g.output_folder << endl; - cout << setw(PRINT_VAR_PAD) << left << " Associated station file: " << p.s.asl_file << endl; - cout << setw(PRINT_VAR_PAD) << left << " Associated measurement file: " << p.s.aml_file << endl; - cout << setw(PRINT_VAR_PAD) << left << " Binary station file: " << p.a.bst_file << endl; - cout << setw(PRINT_VAR_PAD) << left << " Binary measurement file: " << p.a.bms_file << endl; + std::cout << std::endl << cmd_line_banner; + + std::cout << "+ Options:" << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Network name: " << p.g.network_name << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Input folder: " << p.g.input_folder << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Output folder: " << p.g.output_folder << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Associated station file: " << p.s.asl_file << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Associated measurement file: " << p.s.aml_file << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Binary station file: " << p.a.bst_file << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Binary measurement file: " << p.a.bms_file << std::endl; if (p.a.adjust_mode == PhasedMode || p.a.adjust_mode == Phased_Block_1Mode) - cout << setw(PRINT_VAR_PAD) << left << " Segmentation file: " << p.a.seg_file << endl; - cout << setw(PRINT_VAR_PAD) << left << " Adjustment output file: " << p.o._adj_file << endl; - cout << setw(PRINT_VAR_PAD) << left << " Coordinate output file: " << p.o._xyz_file << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Segmentation file: " << p.a.seg_file << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Adjustment output file: " << p.o._adj_file << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Coordinate output file: " << p.o._xyz_file << std::endl; if (p.o._init_stn_corrections) - cout << setw(PRINT_VAR_PAD) << left << " Corrections output file: " << p.o._cor_file << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Corrections output file: " << p.o._cor_file << std::endl; if (p.a.stage) { - cout << setw(PRINT_VAR_PAD) << left << " Stage using hard disk: " << "yes" << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Stage using hard disk: " << "yes" << std::endl; if (p.a.recreate_stage_files) - cout << setw(PRINT_VAR_PAD) << left << " Recreate mapped stage files: " << "yes" << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Recreate mapped stage files: " << "yes" << std::endl; if (p.a.purge_stage_files) - cout << setw(PRINT_VAR_PAD) << left << " Purge mapped stage files: " << "yes" << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Purge mapped stage files: " << "yes" << std::endl; } - cout << setw(PRINT_VAR_PAD) << left << " Reference frame: " << datum.GetName() << endl; - cout << setw(PRINT_VAR_PAD) << left << " Epoch: " << datum.GetEpoch_s() << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Reference frame: " << datum.GetName() << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Epoch: " << datum.GetEpoch_s() << std::endl; - cout << setw(PRINT_VAR_PAD) << left << " Geoid model: " << system_complete(p.n.ntv2_geoid_file).string() << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Geoid model: " << boost::filesystem::system_complete(p.n.ntv2_geoid_file).string() << std::endl; if (p.a.scale_normals_to_unity) - cout << setw(PRINT_VAR_PAD) << left << " Scale normals to unity: " << "yes" << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Scale normals to unity: " << "yes" << std::endl; if (!p.a.station_constraints.empty()) { - cout << setw(PRINT_VAR_PAD) << left << " Station constraints: " << p.a.station_constraints << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Station constraints: " << p.a.station_constraints << std::endl; if (p.i.apply_discontinuities) - cout << setw(PRINT_VAR_PAD) << left << " Apply discontinuities: " << "yes" << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Apply discontinuities: " << "yes" << std::endl; } switch (p.a.adjust_mode) @@ -1116,12 +1139,12 @@ int main(int argc, char* argv[]) case Phased_Block_1Mode: case PhasedMode: - if (!exists(p.a.seg_file)) + if (!boost::filesystem::exists(p.a.seg_file)) { - cout << endl << endl << - "- Error: The required segmentation file does not exist:" << endl; - cout << " " << p.a.seg_file << endl << endl; - cout << " Run 'segment " << p.g.network_name << "' to create a segmentation file" << endl << endl; + std::cout << std::endl << std::endl << + "- Error: The required segmentation file does not exist:" << std::endl; + std::cout << " " << p.a.seg_file << std::endl << std::endl; + std::cout << " Run 'segment " << p.g.network_name << "' to create a segmentation file" << std::endl << std::endl; cout_mutex.unlock(); return EXIT_FAILURE; } @@ -1132,40 +1155,41 @@ int main(int argc, char* argv[]) netAdjust.LoadSegmentationFileParameters(p.a.seg_file); } - cout << endl; - cout << setw(PRINT_VAR_PAD) << left; + std::cout << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left; switch (p.a.adjust_mode) { case SimultaneousMode: - cout << "+ Simultaneous adjustment mode" << endl; + std::cout << "+ Simultaneous adjustment mode" << std::endl; break; case PhasedMode: - cout << "+ Rigorous sequential phased adjustment mode"; + std::cout << "+ Rigorous sequential phased adjustment mode"; if (p.a.stage) - cout << " (staged)"; + std::cout << " (staged)"; // If the user has not provided a seg file, check the meta of the default file if (!userSuppliedSegFile) { - if (last_write_time(p.a.seg_file) < last_write_time(p.a.bst_file) || - last_write_time(p.a.seg_file) < last_write_time(p.a.bms_file)) + if (boost::filesystem::last_write_time(p.a.seg_file) < boost::filesystem::last_write_time(p.a.bst_file) || + boost::filesystem::last_write_time(p.a.seg_file) < boost::filesystem::last_write_time(p.a.bms_file)) { // Has import been run after the segmentation file was created? - if ((bst_meta_import && (last_write_time(p.a.seg_file) < last_write_time(p.a.bst_file))) || - (bms_meta_import && (last_write_time(p.a.seg_file) < last_write_time(p.a.bms_file)))) + if ((bst_meta_import && (boost::filesystem::last_write_time(p.a.seg_file) < boost::filesystem::last_write_time(p.a.bst_file))) || + (bms_meta_import && (boost::filesystem::last_write_time(p.a.seg_file) < boost::filesystem::last_write_time(p.a.bms_file)))) { - cout << endl << endl << - "- Error: The raw stations and measurements have been imported after" << endl << - " the segmentation file was created:" << endl; - - time_t t_bst(last_write_time(p.a.bst_file)), t_bms(last_write_time(p.a.bms_file)); - time_t t_seg(last_write_time(p.a.seg_file)); - - cout << " " << leafStr(p.a.bst_file) << " last modified on " << ctime(&t_bst); - cout << " " << leafStr(p.a.bms_file) << " last modified on " << ctime(&t_bms) << endl; - cout << " " << leafStr(p.a.seg_file) << " created on " << ctime(&t_seg) << endl; - cout << " Run 'segment " << p.g.network_name << " [options]' to re-create the segmentation file, or re-run" << endl << - " adjust using the --" << SEG_FILE << " option if the file " << basename(p.a.seg_file) << " must\n be used." << endl << endl; + std::cout << std::endl << std::endl << + "- Error: The raw stations and measurements have been imported after" << std::endl << + " the segmentation file was created:" << std::endl; + + time_t t_bst(boost::filesystem::last_write_time(p.a.bst_file)), t_bms(boost::filesystem::last_write_time(p.a.bms_file)); + time_t t_seg(boost::filesystem::last_write_time(p.a.seg_file)); + + std::cout << " " << leafStr(p.a.bst_file) << " last modified on " << ctime(&t_bst); + std::cout << " " << leafStr(p.a.bms_file) << " last modified on " << ctime(&t_bms) << std::endl; + std::cout << " " << leafStr(p.a.seg_file) << " created on " << ctime(&t_seg) << std::endl; + std::cout << " Run 'segment " << p.g.network_name << " [options]' to re-create the segmentation file, or re-run" << std::endl << + " adjust using the --" << SEG_FILE << " option if the file " << + boost::filesystem::path(p.a.seg_file).stem() << " must\n be used." << std::endl << std::endl; cout_mutex.unlock(); return EXIT_FAILURE; } @@ -1177,13 +1201,13 @@ int main(int argc, char* argv[]) if (p.a.stage && !p.a.recreate_stage_files) { // Simply test one file - the estimated stations file - string est_mmapfile_name = + std::string est_mmapfile_name = p.g.output_folder + FOLDER_SLASH + p.g.network_name + "-est.mtx"; - string est_mmapfile_wildcard = + std::string est_mmapfile_wildcard = p.g.output_folder + FOLDER_SLASH + p.g.network_name + "-*.mtx"; - if (exists(est_mmapfile_name)) + if (boost::filesystem::exists(est_mmapfile_name)) { // Has import been run after the segmentation file was created? @@ -1198,20 +1222,20 @@ int main(int argc, char* argv[]) // then adjust will attempt to load memory map files using the same parameters from the first import // and segment. // Hence, force the user to run adjust with the --create-stage-files option. - if ((bst_meta_import && (last_write_time(est_mmapfile_name) < last_write_time(p.a.bst_file))) || - (bms_meta_import && (last_write_time(est_mmapfile_name) < last_write_time(p.a.bms_file)))) + if ((bst_meta_import && (boost::filesystem::last_write_time(est_mmapfile_name) < boost::filesystem::last_write_time(p.a.bst_file))) || + (bms_meta_import && (boost::filesystem::last_write_time(est_mmapfile_name) < boost::filesystem::last_write_time(p.a.bms_file)))) { - cout << endl << endl << - "- Error: The raw stations and measurements have been imported after" << endl << - " a staged adjustment created the memory map files:" << endl; + std::cout << std::endl << std::endl << + "- Error: The raw stations and measurements have been imported after" << std::endl << + " a staged adjustment created the memory map files:" << std::endl; - time_t t_bst(last_write_time(p.a.bst_file)), t_bms(last_write_time(p.a.bms_file)); - time_t t_mtx(last_write_time(est_mmapfile_name)); + time_t t_bst(boost::filesystem::last_write_time(p.a.bst_file)), t_bms(boost::filesystem::last_write_time(p.a.bms_file)); + time_t t_mtx(boost::filesystem::last_write_time(est_mmapfile_name)); - cout << " " << leafStr(p.a.bst_file) << " last modified on " << ctime(&t_bst); - cout << " " << leafStr(p.a.bms_file) << " last modified on " << ctime(&t_bms) << endl; - cout << " " << leafStr(est_mmapfile_wildcard) << " created on " << ctime(&t_mtx) << endl; - cout << " To readjust this network, re-run adjust using the " << RECREATE_STAGE_FILES << " option." << endl; + std::cout << " " << leafStr(p.a.bst_file) << " last modified on " << ctime(&t_bst); + std::cout << " " << leafStr(p.a.bms_file) << " last modified on " << ctime(&t_bms) << std::endl; + std::cout << " " << leafStr(est_mmapfile_wildcard) << " created on " << ctime(&t_mtx) << std::endl; + std::cout << " To readjust this network, re-run adjust using the " << RECREATE_STAGE_FILES << " option." << std::endl; cout_mutex.unlock(); return EXIT_FAILURE; } @@ -1221,29 +1245,44 @@ int main(int argc, char* argv[]) #ifdef MULTI_THREAD_ADJUST if (p.a.multi_thread) { - cout << endl << "+ Optimised for concurrent processing via multi-threading." << endl << endl; - cout << "+ The active CPU supports the execution of " << boost::thread::hardware_concurrency() << " concurrent threads."; + std::cout << std::endl << "+ Optimised for concurrent processing via multi-threading." << std::endl << std::endl; + std::cout << "+ The active CPU supports the execution of " << boost::thread::hardware_concurrency() << " concurrent threads."; } #endif - cout << endl; + std::cout << std::endl; break; case Phased_Block_1Mode: - cout << "+ Sequential phased adjustment resulting in rigorous estimates for Block 1 only" << endl; + std::cout << "+ Sequential phased adjustment resulting in rigorous estimates for Block 1 only" << std::endl; break; case SimulationMode: - cout << "+ Adjustment simulation only" << endl; + std::cout << "+ Adjustment simulation only" << std::endl; break; } - cout << endl; + std::cout << std::endl; if (p.a.report_mode) - cout << "+ Report last adjustment results" << endl; + { + std::cout << "+ Report last adjustment results" << std::endl; + + // Has report mode been requested as well as an argument to recreate stage files? + // If so, return an error message and exit as this will lead to reporting of + // incorrect (zero!) results + if (p.a.recreate_stage_files) + { + std::cout << std::endl << + "- Error: The option --" << RECREATE_STAGE_FILES << " cannot be used in Report results mode" << std::endl << + " as it will erase the results from the latest adjustment and create new stage" << std::endl << + " files initialised to zero." << std::endl << std::endl; + cout_mutex.unlock(); + return EXIT_FAILURE; + } + } cout_mutex.unlock(); } - milliseconds elapsed_time(milliseconds(0)); + boost::posix_time::milliseconds elapsed_time(boost::posix_time::milliseconds(0)); _ADJUST_STATUS_ adjustStatus; @@ -1251,7 +1290,7 @@ int main(int argc, char* argv[]) running = true; // adjust blocks using group thread - thread_group ui_adjust_threads; + boost::thread_group ui_adjust_threads; if (!p.g.quiet) ui_adjust_threads.create_thread(dna_adjust_progress_thread(&netAdjust, &p)); ui_adjust_threads.create_thread(dna_adjust_thread(&netAdjust, &p, &adjustStatus)); @@ -1317,14 +1356,14 @@ int main(int argc, char* argv[]) } catch (const NetAdjustException& e) { cout_mutex.lock(); - cout << endl << - "- Error: " << e.what() << endl; + std::cout << std::endl << + "- Error: " << e.what() << std::endl; cout_mutex.unlock(); return EXIT_FAILURE; } if (!p.g.quiet) - cout << endl << "+ Open " << leafStr(p.o._adj_file) << " to view the adjustment details." << endl << endl; + std::cout << std::endl << "+ Open " << leafStr(p.o._adj_file) << " to view the adjustment details." << std::endl << std::endl; if (!userSuppliedSegFile) p.a.seg_file = ""; @@ -1337,7 +1376,7 @@ int main(int argc, char* argv[]) // Update the import settings. // Print the project file. If it doesn't exist, it will be created. CDnaProjectFile projectFile; - if (exists(p.g.project_file)) + if (boost::filesystem::exists(p.g.project_file)) projectFile.LoadProjectFile(p.g.project_file); projectFile.UpdateSettingsAdjust(p); diff --git a/dynadjust/dynadjust/dnaadjustwrapper/dnaadjustwrapper.hpp b/dynadjust/dynadjust/dnaadjustwrapper/dnaadjustwrapper.hpp index a1c44b5e..fef16328 100644 --- a/dynadjust/dynadjust/dnaadjustwrapper/dnaadjustwrapper.hpp +++ b/dynadjust/dynadjust/dnaadjustwrapper/dnaadjustwrapper.hpp @@ -54,13 +54,6 @@ #include #include -using namespace std; -using namespace boost; -using namespace boost::filesystem; -using namespace boost::posix_time; -using namespace boost::program_options; -namespace po = boost::program_options; - using namespace dynadjust::networkadjust; using namespace dynadjust::exception; using namespace dynadjust::iostreams; diff --git a/dynadjust/dynadjust/dnageoid/bicubic_interpolation.hpp b/dynadjust/dynadjust/dnageoid/bicubic_interpolation.hpp index 3459211f..79f0997a 100644 --- a/dynadjust/dynadjust/dnageoid/bicubic_interpolation.hpp +++ b/dynadjust/dynadjust/dnageoid/bicubic_interpolation.hpp @@ -40,8 +40,6 @@ #include #include -using namespace std; - const int wt[16][16] = { 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0, diff --git a/dynadjust/dynadjust/dnageoid/dnageoid.cpp b/dynadjust/dynadjust/dnageoid/dnageoid.cpp index 910851a7..cae46bc4 100644 --- a/dynadjust/dynadjust/dnageoid/dnageoid.cpp +++ b/dynadjust/dynadjust/dnageoid/dnageoid.cpp @@ -20,7 +20,6 @@ // Description : AusGeoid Grid File (NTv2) Interpolation library //============================================================================ - #include namespace dynadjust { namespace geoidinterpolation { @@ -78,31 +77,31 @@ void dna_geoid_interpolation::ApplyAusGeoidGrid(geoid_point *agCoord, const int& throw NetGeoidException(ErrorString(ERR_INTERPOLATION_TYPE), ERR_INTERPOLATION_TYPE); } -string dna_geoid_interpolation::ReturnBadStationRecords() +std::string dna_geoid_interpolation::ReturnBadStationRecords() { - stringstream ssPoints; + std::stringstream ssPoints; - ssPoints << setw(STATION) << left << "Station" << - setw(PAD2) << " " << - right << setw(LAT_EAST) << "Latitude" << - right << setw(LON_NORTH) << "Longitude" << - right << setw(LON_NORTH) << "Error code" << endl; + ssPoints << std::setw(STATION) << std::left << "Station" << + std::setw(PAD2) << " " << + std::right << std::setw(LAT_EAST) << "Latitude" << + std::right << std::setw(LON_NORTH) << "Longitude" << + std::right << std::setw(LON_NORTH) << "Error code" << std::endl; UINT32 i, j = STATION+PAD2+LAT_EAST+LON_NORTH+LON_NORTH; for (i=0; ifirst.stationName << - setw(PAD2) << " " << - right << setw(LAT_EAST) << FormatDmsString(RadtoDms(stn_it->first.currentLatitude), 7, true, false) << - right << setw(LON_NORTH) << FormatDmsString(RadtoDms(stn_it->first.currentLongitude), 7, true, false) << - right << setw(LON_NORTH) << stn_it->second << endl; + ssPoints << std::setw(STATION) << std::left << stn_it->first.stationName << + std::setw(PAD2) << " " << + std::right << std::setw(LAT_EAST) << FormatDmsString(RadtoDms(stn_it->first.currentLatitude), 7, true, false) << + std::right << std::setw(LON_NORTH) << FormatDmsString(RadtoDms(stn_it->first.currentLongitude), 7, true, false) << + std::right << std::setw(LON_NORTH) << stn_it->second << std::endl; } return ssPoints.str(); @@ -175,9 +174,9 @@ void dna_geoid_interpolation::ProcessCsvFile(std::ifstream* f_in, std::ofstream* double latitude, longitude, original_height; // calculate file length - f_in->seekg(0, ios::end); // set file pointer to end - streamoff lFileLen = f_in->tellg(); - f_in->seekg(0, ios::beg); // reset file pointer to beginning + f_in->seekg(0, std::ios::end); // set file pointer to end + std::streamoff lFileLen = f_in->tellg(); + f_in->seekg(0, std::ios::beg); // reset file pointer to beginning char cBuf[MAX_RECORD_LENGTH]; @@ -186,20 +185,20 @@ void dna_geoid_interpolation::ProcessCsvFile(std::ifstream* f_in, std::ofstream* bool iSuccess; int fieldCount; bool bheight_data; - string sBuf; + std::string sBuf; // Print header - *f_out << left << setw(11) << "Point" << "," << - setw(16) << right << "Latitude" << "," << - setw(16) << right << "Longitude" << "," << - setw(9) << right << "Orig. Ht" << ","; + *f_out << std::left << std::setw(11) << "Point" << "," << + std::setw(16) << std::right << "Latitude" << "," << + std::setw(16) << std::right << "Longitude" << "," << + std::setw(9) << std::right << "Orig. Ht" << ","; if (intEllipsoidtoOrtho == 1) - *f_out << setw(9) << right << trimstr(string(m_pGridfile->chSystem_t)) << ","; // "New Ht" + *f_out << std::setw(9) << std::right << trimstr(std::string(m_pGridfile->chSystem_t)) << ","; // "New Ht" else - *f_out << setw(9) << right << trimstr(string(m_pGridfile->chSystem_f)) << ","; // "New Ht" - *f_out << setw(9) << right << "N value" << "," << - setw(9) << right << "D.Merid" << "," << - setw(9) << right << "D.PrimeV" << endl; + *f_out << std::setw(9) << std::right << trimstr(std::string(m_pGridfile->chSystem_f)) << ","; // "New Ht" + *f_out << std::setw(9) << std::right << "N value" << "," << + std::setw(9) << std::right << "D.Merid" << "," << + std::setw(9) << std::right << "D.PrimeV" << std::endl; while (!f_in->eof()) // while EOF not found { @@ -240,31 +239,31 @@ void dna_geoid_interpolation::ProcessCsvFile(std::ifstream* f_in, std::ofstream* longitude < -180.0 || longitude > 180.0) { // Coordinates are invalid - *f_out << left << "ERROR (" << ERR_NUM_CSV_FIELDS << "): " << - ErrorString(ERR_NUM_CSV_FIELDS, sBuf) << endl; + *f_out << std::left << "ERROR (" << ERR_NUM_CSV_FIELDS << "): " << + ErrorString(ERR_NUM_CSV_FIELDS, sBuf) << std::endl; continue; } } } catch (...) { - *f_out << left << "ERROR (" << ERR_READING_DATA << "): " << - ErrorString(ERR_READING_DATA, cBuf) << endl; + *f_out << std::left << "ERROR (" << ERR_READING_DATA << "): " << + ErrorString(ERR_READING_DATA, cBuf) << std::endl; continue; } if (fabs(latitude) > UNRELIABLE || fabs(longitude) > UNRELIABLE) { // a comma was found, but no data - *f_out << left << "ERROR (" << ERR_NUM_CSV_FIELDS << "): " << - ErrorString(ERR_NUM_CSV_FIELDS, sBuf) << endl; + *f_out << std::left << "ERROR (" << ERR_NUM_CSV_FIELDS << "): " << + ErrorString(ERR_NUM_CSV_FIELDS, sBuf) << std::endl; continue; } if (fabs(latitude) > 90.0 || fabs(longitude) > 180.0) { // latitude or longitude invalid - *f_out << left << "ERROR (" << ERR_INVALID_INPUT << "): " << - ErrorString(ERR_INVALID_INPUT, sBuf) << endl; + *f_out << std::left << "ERROR (" << ERR_INVALID_INPUT << "): " << + ErrorString(ERR_INVALID_INPUT, sBuf) << std::endl; continue; } @@ -297,7 +296,7 @@ void dna_geoid_interpolation::ProcessCsvFile(std::ifstream* f_in, std::ofstream* iSuccess = true; } catch (const NetGeoidException& e) { - stringstream s(e.what()); + std::stringstream s(e.what()); iSuccess = false; } @@ -316,46 +315,46 @@ void dna_geoid_interpolation::ProcessCsvFile(std::ifstream* f_in, std::ofstream* apPt.cVar.dHeight = -UNRELIABLE; // Format error message using input coordinates - stringstream ss; + std::stringstream ss; strcpy(cBuf, sBuf.c_str()); char inputLatitude[50], inputLongitude[50]; GetFields(cBuf, ',', false, "sss", cPoint, inputLatitude, inputLongitude); - ss << trimstr(string(inputLatitude)) << ", " << trimstr(string(inputLongitude)); + ss << trimstr(std::string(inputLatitude)) << ", " << trimstr(std::string(inputLongitude)); // print dat - *f_out << left << "ERROR (" << apPt.cVar.IO_Status << "): " << - ErrorString(apPt.cVar.IO_Status, ss.str()) << endl; + *f_out << std::left << "ERROR (" << apPt.cVar.IO_Status << "): " << + ErrorString(apPt.cVar.IO_Status, ss.str()) << std::endl; continue; } // print csv // const char* const CSV_DDEG = "%-11s,%16.9f,%16.9f,%9.3f\n"; - *f_out << left << setw(11) << cPoint << "," << - setw(16) << setprecision(9) << fixed << right << latitude << "," << - setw(16) << setprecision(9) << fixed << right << longitude << ","; + *f_out << std::left << std::setw(11) << cPoint << "," << + std::setw(16) << std::setprecision(9) << std::fixed << std::right << latitude << "," << + std::setw(16) << std::setprecision(9) << std::fixed << std::right << longitude << ","; if (bheight_data) { // A height was supplied... // Print the 'original' height - *f_out << setw(9) << setprecision(3) << fixed << right << original_height << ","; + *f_out << std::setw(9) << std::setprecision(3) << std::fixed << std::right << original_height << ","; // Print the 'transformed' height - *f_out << setw(9) << setprecision(3) << fixed << right << apPt.cVar.dHeight << ","; + *f_out << std::setw(9) << std::setprecision(3) << std::fixed << std::right << apPt.cVar.dHeight << ","; } else { // no height was supplied, so print blanks for original height and derived heights - *f_out << setw(9) << right << " " << ","; - *f_out << setw(9) << right << " " << ","; + *f_out << std::setw(9) << std::right << " " << ","; + *f_out << std::setw(9) << std::right << " " << ","; } // As per Nick Brown's request, print the N value regardless of input height - *f_out << setw(9) << setprecision(3) << fixed << right << apPt.gVar.dN_value << ","; + *f_out << std::setw(9) << std::setprecision(3) << std::fixed << std::right << apPt.gVar.dN_value << ","; // Print the deflection values - *f_out << setw(9) << setprecision(3) << fixed << right << apPt.gVar.dDefl_meridian << "," << - setw(9) << setprecision(3) << fixed << right << apPt.gVar.dDefl_primev << endl; + *f_out << std::setw(9) << std::setprecision(3) << std::fixed << std::right << apPt.gVar.dDefl_meridian << "," << + std::setw(9) << std::setprecision(3) << std::fixed << std::right << apPt.gVar.dDefl_primev << std::endl; // write to dna geo file if (m_exportDNAGeoidFile) @@ -370,30 +369,30 @@ void dna_geoid_interpolation::ProcessDatFile(std::ifstream* f_in, std::ofstream* m_fileMode = true; // calculate file length - f_in->seekg(0, ios::end); // set file pointer to end - streamoff lFileLen = f_in->tellg(); - f_in->seekg(0, ios::beg); // reset file pointer to beginning + f_in->seekg(0, std::ios::end); // set file pointer to end + std::streamoff lFileLen = f_in->tellg(); + f_in->seekg(0, std::ios::beg); // reset file pointer to beginning char cBuf[MAX_RECORD_LENGTH]; geoid_point apPt; bool iSuccess; bool bheight_data; - string strBuf, station; + std::string strBuf, station; double original_height; // Print header - *f_out << left << setw(11) << "Point" << - setw(16) << right << "Latitude" << - setw(16) << right << "Longitude" << - setw(9) << right << "Orig. Ht"; + *f_out << std::left << std::setw(11) << "Point" << + std::setw(16) << std::right << "Latitude" << + std::setw(16) << std::right << "Longitude" << + std::setw(9) << std::right << "Orig. Ht"; if (intEllipsoidtoOrtho == 1) - *f_out << setw(9) << right << trimstr(string(m_pGridfile->chSystem_t)); // "New Ht" + *f_out << std::setw(9) << std::right << trimstr(std::string(m_pGridfile->chSystem_t)); // "New Ht" else - *f_out << setw(9) << right << trimstr(string(m_pGridfile->chSystem_f)); // "New Ht" - *f_out << setw(9) << right << "N value" << - setw(9) << right << "D.Merid" << - setw(9) << right << "D.PrimeV" << endl; + *f_out << std::setw(9) << std::right << trimstr(std::string(m_pGridfile->chSystem_f)); // "New Ht" + *f_out << std::setw(9) << std::right << "N value" << + std::setw(9) << std::right << "D.Merid" << + std::setw(9) << std::right << "D.PrimeV" << std::endl; do { @@ -424,12 +423,12 @@ void dna_geoid_interpolation::ProcessDatFile(std::ifstream* f_in, std::ofstream* if (strBuf.length() < 31) // 31 = 11 + 16 + 4 (4 is the minimum number of { // units required for longitude) // print dat - *f_out << left << "ERROR (" << ERR_LINE_TOO_SHORT << "): " << - ErrorString(ERR_LINE_TOO_SHORT, strBuf) << endl; + *f_out << std::left << "ERROR (" << ERR_LINE_TOO_SHORT << "): " << + ErrorString(ERR_LINE_TOO_SHORT, strBuf) << std::endl; continue; } - stringstream ssInput; + std::stringstream ssInput; ssInput << trimstr(strBuf.substr(11, 16)) << ", " << trimstr(strBuf.substr(27, 16)); SetInputCoordinates(ssInput.str()); @@ -465,7 +464,7 @@ void dna_geoid_interpolation::ProcessDatFile(std::ifstream* f_in, std::ofstream* // are there characters after the permitted height field? if (bheight_data) { - string height_str; + std::string height_str; if (strBuf.length() > 52) height_str = trimstr(strBuf.substr(43, 9)); else @@ -487,7 +486,7 @@ void dna_geoid_interpolation::ProcessDatFile(std::ifstream* f_in, std::ofstream* iSuccess = true; } catch (const NetGeoidException& e) { - stringstream s(e.what()); + std::stringstream s(e.what()); iSuccess = false; } @@ -506,12 +505,12 @@ void dna_geoid_interpolation::ProcessDatFile(std::ifstream* f_in, std::ofstream* apPt.cVar.dHeight = -UNRELIABLE; // Format error message using input coordinates - stringstream ss; + std::stringstream ss; ss << trimstr(strBuf.substr(11, 16)) << ", " << trimstr(strBuf.substr(27, 16)); // print dat - *f_out << left << "ERROR (" << apPt.cVar.IO_Status << "): " << - ErrorString(apPt.cVar.IO_Status, ss.str()) << endl; + *f_out << std::left << "ERROR (" << apPt.cVar.IO_Status << "): " << + ErrorString(apPt.cVar.IO_Status, ss.str()) << std::endl; continue; } @@ -521,37 +520,37 @@ void dna_geoid_interpolation::ProcessDatFile(std::ifstream* f_in, std::ofstream* apPt.cVar.dLongitude = DegtoDms(apPt.cVar.dLongitude); } - station = string(cBuf).substr(0, 11); + station = std::string(cBuf).substr(0, 11); // print dat - *f_out << left << setw(11) << station << - setw(16) << setprecision(9) << fixed << right << apPt.cVar.dLatitude << - setw(16) << setprecision(9) << fixed << right << apPt.cVar.dLongitude; + *f_out << std::left << std::setw(11) << station << + std::setw(16) << std::setprecision(9) << std::fixed << std::right << apPt.cVar.dLatitude << + std::setw(16) << std::setprecision(9) << std::fixed << std::right << apPt.cVar.dLongitude; if (bheight_data) { // A height was supplied... // Print the 'original' height - *f_out << setw(9) << setprecision(3) << fixed << right << original_height; + *f_out << std::setw(9) << std::setprecision(3) << std::fixed << std::right << original_height; // Print the 'transformed' height, unless there is no N value (-999.000) if (apPt.gVar.dN_value < -998.0) - *f_out << setw(9) << setprecision(3) << fixed << right << original_height; + *f_out << std::setw(9) << std::setprecision(3) << std::fixed << std::right << original_height; else - *f_out << setw(9) << setprecision(3) << fixed << right << apPt.cVar.dHeight; + *f_out << std::setw(9) << std::setprecision(3) << std::fixed << std::right << apPt.cVar.dHeight; } else { // no height was supplied, so print blanks for original height and derived heights - *f_out << setw(9) << right << " "; - *f_out << setw(9) << right << " "; + *f_out << std::setw(9) << std::right << " "; + *f_out << std::setw(9) << std::right << " "; } // As per Nick Brown's request, print the N value regardless of input height - *f_out << setw(9) << setprecision(3) << fixed << right << apPt.gVar.dN_value; + *f_out << std::setw(9) << std::setprecision(3) << std::fixed << std::right << apPt.gVar.dN_value; // Print the deflection values - *f_out << setw(9) << setprecision(3) << fixed << right << apPt.gVar.dDefl_meridian << - setw(9) << setprecision(3) << fixed << right << apPt.gVar.dDefl_primev << endl; + *f_out << std::setw(9) << std::setprecision(3) << std::fixed << std::right << apPt.gVar.dDefl_meridian << + std::setw(9) << std::setprecision(3) << std::fixed << std::right << apPt.gVar.dDefl_primev << std::endl; // write to dna geo file if (m_exportDNAGeoidFile) @@ -572,7 +571,7 @@ void dna_geoid_interpolation::FileTransformation(const char* fileIn, const char* m_pointsInterpolated = m_pointsNotInterpolated = 0; - //const char* ext = strrchr(trimstr(fileIn).c_str(), '.'); + //const char* ext = strrchr(trimstr(fileIn).c_str(), '.'); const char* ext = strrchr(fileIn, '.'); int iF_inType(TYPE_ASC); @@ -585,11 +584,11 @@ void dna_geoid_interpolation::FileTransformation(const char* fileIn, const char* std::ifstream f_in; try { // open input file. Throws runtime_error on failure. - file_opener(f_in, trimstr(fileIn).c_str(), ios::in, ascii, true); + file_opener(f_in, trimstr(fileIn).c_str(), std::ios::in, ascii, true); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ClearGridFileMemory(); - stringstream ss; + std::stringstream ss; ss << ErrorString(ERR_INFILE_READ) << "\n" << " " << e.what(); throw NetGeoidException(ss.str(), ERR_INFILE_READ); @@ -598,11 +597,11 @@ void dna_geoid_interpolation::FileTransformation(const char* fileIn, const char* std::ofstream f_out; try { // Create input file. Throws runtime_error on failure. - file_opener(f_out, trimstr(fileOut).c_str()); + file_opener(f_out, trimstr(fileOut).c_str()); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ClearGridFileMemory(); - stringstream ss; + std::stringstream ss; ss << ErrorString(ERR_OUTFILE_WRITE) << "\n" << " " << e.what(); throw NetGeoidException(ss.str(), ERR_OUTFILE_WRITE); @@ -614,19 +613,19 @@ void dna_geoid_interpolation::FileTransformation(const char* fileIn, const char* std::ofstream f_dnageo; if (m_exportDNAGeoidFile) { - string geofileOut; + std::string geofileOut; if (geoFile != NULL) geofileOut = geoFile; else { - geofileOut = trimstr(fileOut); + geofileOut = trimstr(fileOut); - string searchstr(ext); - string replacestr(".geo"); + std::string searchstr(ext); + std::string replacestr(".geo"); size_t pos = 0; - if ((pos = geofileOut.find(searchstr, pos)) != string::npos) + if ((pos = geofileOut.find(searchstr, pos)) != std::string::npos) geofileOut.replace(pos, replacestr.size(), replacestr); else geofileOut += ".geo"; @@ -636,9 +635,9 @@ void dna_geoid_interpolation::FileTransformation(const char* fileIn, const char* // Create geoid file. Throws runtime_error on failure. file_opener(f_dnageo, geofileOut); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ClearGridFileMemory(); - stringstream ss; + std::stringstream ss; ss << ErrorString(ERR_OUTFILE_WRITE) << "\n" << " " << e.what(); throw NetGeoidException(ss.str(), ERR_OUTFILE_WRITE); @@ -648,10 +647,10 @@ void dna_geoid_interpolation::FileTransformation(const char* fileIn, const char* // As per Nick Brown's request, print Grid file version to file f_out << "Derived "; if (intEllipsoidtoOrtho == 1) - f_out << trimstr(string(m_pGridfile->chSystem_t)); + f_out << trimstr(std::string(m_pGridfile->chSystem_t)); else - f_out << trimstr(string(m_pGridfile->chSystem_f)); - f_out << " values obtained from " << left << m_pGridfile->filename << ", Version " << trimstr(string(m_pGridfile->chVersion)) << endl; + f_out << trimstr(std::string(m_pGridfile->chSystem_f)); + f_out << " values obtained from " << std::left << m_pGridfile->filename << ", Version " << trimstr(std::string(m_pGridfile->chVersion)) << std::endl; switch (iF_inType) { @@ -671,7 +670,7 @@ void dna_geoid_interpolation::FileTransformation(const char* fileIn, const char* f_dnageo.close(); } -void dna_geoid_interpolation::PopulateBinaryStationFile(const string& bstnFile, const int& method, +void dna_geoid_interpolation::PopulateBinaryStationFile(const std::string& bstnFile, const int& method, bool convertHeights, bool exportDnaGeoidFile, const char* geoFile) { if (!m_pGridfile) @@ -689,13 +688,13 @@ void dna_geoid_interpolation::PopulateBinaryStationFile(const string& bstnFile, { if (geoFile == NULL) { - string geofileOut(bstnFile); + std::string geofileOut(bstnFile); // Export data to DNA geoid file? - string searchstr(".bst"), replacestr(".geo"); + std::string searchstr(".bst"), replacestr(".geo"); size_t pos = 0; - if ((pos = geofileOut.find(searchstr, pos)) != string::npos) + if ((pos = geofileOut.find(searchstr, pos)) != std::string::npos) geofileOut.replace(pos, replacestr.size(), replacestr); else geofileOut += ".geo"; @@ -707,16 +706,16 @@ void dna_geoid_interpolation::PopulateBinaryStationFile(const string& bstnFile, } } -void dna_geoid_interpolation::LoadBinaryStationFile(const string& bstnfileName) +void dna_geoid_interpolation::LoadBinaryStationFile(const std::string& bstnfileName) { try { // Load binary stations data. Throws runtime_error on failure. dna_io_bst bst; bst.load_bst_file(bstnfileName, &bstBinaryRecords_, bst_meta_); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ClearGridFileMemory(); - stringstream ss; + std::stringstream ss; ss << ErrorString(ERR_INFILE_READ) << "\n" << " " << e.what(); throw NetGeoidException(ss.str(), ERR_INFILE_READ); @@ -724,35 +723,36 @@ void dna_geoid_interpolation::LoadBinaryStationFile(const string& bstnfileName) } -void dna_geoid_interpolation::WriteBinaryStationFile(const string& bstnfileName) +void dna_geoid_interpolation::WriteBinaryStationFile(const std::string& bstnfileName) { sprintf(bst_meta_.modifiedBy, "%s", __BINARY_NAME__); + bst_meta_.geoid = true; try { // write binary stations data. Throws runtime_error on failure. dna_io_bst bst; bst.write_bst_file(bstnfileName, &bstBinaryRecords_, bst_meta_); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ClearGridFileMemory(); - stringstream ss; - ss << ErrorString(ERR_OUTFILE_WRITE) << endl << + std::stringstream ss; + ss << ErrorString(ERR_OUTFILE_WRITE) << std::endl << " " << e.what(); throw NetGeoidException(ss.str(), ERR_OUTFILE_WRITE); } } -void dna_geoid_interpolation::WriteDNA1GeoidFile(const string& geofileName) +void dna_geoid_interpolation::WriteDNA1GeoidFile(const std::string& geofileName) { std::ofstream f_dnageo; try { // Create geoid file. Throws runtime_error on failure. file_opener(f_dnageo, geofileName); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ClearGridFileMemory(); - stringstream ss; + std::stringstream ss; ss << ErrorString(ERR_OUTFILE_WRITE) << "\n" << " " << e.what(); throw NetGeoidException(ss.str(), ERR_OUTFILE_WRITE); @@ -763,7 +763,7 @@ void dna_geoid_interpolation::WriteDNA1GeoidFile(const string& geofileName) // Write header line dnaproj_header(f_dnageo, "DNA geoid file"); - f_dnageo << endl; + f_dnageo << std::endl; it_vstn_t _it_stn(bstBinaryRecords_.begin()); @@ -784,9 +784,9 @@ void dna_geoid_interpolation::WriteDNA1GeoidFile(const string& geofileName) Seconds(_it_stn->verticalDef)); } } - catch (const ios_base::failure& f) { - stringstream ss; - ss << "WriteDNA1GeoidFile(): An error was encountered when writing to " << geofileName << "." << endl << f.what(); + catch (const std::ios_base::failure& f) { + std::stringstream ss; + ss << "WriteDNA1GeoidFile(): An error was encountered when writing to " << geofileName << "." << std::endl << f.what(); throw NetGeoidException(ss.str(), ERR_INFILE_READ); } @@ -795,12 +795,12 @@ void dna_geoid_interpolation::WriteDNA1GeoidFile(const string& geofileName) } -void dna_geoid_interpolation::PrintDNA1GeoidRecord(std::ofstream& f_out, const string& station, const double& nValue, const double& meridianDef, const double& verticalDef) +void dna_geoid_interpolation::PrintDNA1GeoidRecord(std::ofstream& f_out, const std::string& station, const double& nValue, const double& meridianDef, const double& verticalDef) { - f_out << setw(41) << left << station << - setw(9) << right << fixed << setprecision(3) << nValue << - setw(19) << right << setprecision(3) << meridianDef << - setw(10) << right << setprecision(3) << verticalDef << endl; + f_out << std::setw(41) << std::left << station << + std::setw(9) << std::right << std::fixed << std::setprecision(3) << nValue << + std::setw(19) << std::right << std::setprecision(3) << meridianDef << + std::setw(10) << std::right << std::setprecision(3) << verticalDef << std::endl; } @@ -924,7 +924,7 @@ void dna_geoid_interpolation::CreateGridIndex(const char* fileName, const char* } } // a new filename or filetype? - else if (!iequals(m_pGridfile->filename, fileName)) + else if (!boost::iequals(m_pGridfile->filename, fileName)) { ClearGridFileMemory(); if ((m_Grid_Success = OpenGridFile(fileName, fileType, @@ -1031,11 +1031,11 @@ void dna_geoid_interpolation::CreateNTv2File(const char* datFile, const n_file_p std::ifstream f_in; try { // open dat file. Throws runtime_error on failure. - file_opener(f_in, datFile, ios::in, ascii, true); + file_opener(f_in, datFile, std::ios::in, ascii, true); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ClearGridFileMemory(); - stringstream ss; + std::stringstream ss; ss << ErrorString(ERR_INFILE_READ) << "\n" << " " << e.what(); throw NetGeoidException(ss.str(), ERR_INFILE_READ); @@ -1044,20 +1044,20 @@ void dna_geoid_interpolation::CreateNTv2File(const char* datFile, const n_file_p std::ofstream f_out; try { // open binary gsb output. Throws runtime_error on failure. - file_opener(f_out, grid->filename, ios::out | ios::binary, binary, false); + file_opener(f_out, grid->filename, std::ios::out | std::ios::binary, binary, false); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ClearGridFileMemory(); - stringstream ss; + std::stringstream ss; ss << ErrorString(ERR_OUTFILE_WRITE) << "\n" << " " << e.what(); throw NetGeoidException(ss.str(), ERR_OUTFILE_WRITE); } // calculate file length - f_in.seekg(0, ios::end); // set file pointer to end - streamoff lFileLen = f_in.tellg(); - f_in.seekg(0, ios::beg); // reset file pointer to beginning + f_in.seekg(0, std::ios::end); // set file pointer to end + std::streamoff lFileLen = f_in.tellg(); + f_in.seekg(0, std::ios::beg); // reset file pointer to beginning char szLine[MAX_RECORD_LENGTH]; @@ -1070,7 +1070,7 @@ void dna_geoid_interpolation::CreateNTv2File(const char* datFile, const n_file_p f_in.getline(szLine, MAX_RECORD_LENGTH); if (strncmp(szLine, "GEO", 3) == 0) - f_in.seekg(0, ios::beg); // put file pointer back to beginning + f_in.seekg(0, std::ios::beg); // put file pointer back to beginning // AusGeoid file prints upper lat to lower lat. NTv2 file format prints lower lat to upper lat // So, read data to the end of the file to determine grid file limits and record count, then @@ -1078,7 +1078,7 @@ void dna_geoid_interpolation::CreateNTv2File(const char* datFile, const n_file_p double lat, lon, min_lat(90.), max_lat(-90.), min_lon(180.), max_lon(-180.); double init_lat(0.), lat_inc(60.), lon_inc(60.); - cout << endl << "+ Reading contents of WINTER DAT file... "; + std::cout << std::endl << "+ Reading contents of WINTER DAT file... "; m_isReading = true; m_isWriting = false; @@ -1126,7 +1126,7 @@ void dna_geoid_interpolation::CreateNTv2File(const char* datFile, const n_file_p } } } - catch (const ios_base::failure& f) { + catch (const std::ios_base::failure& f) { if (!f_in.eof()) throw NetGeoidException(ErrorString(ERR_GRIDFILE_READ) + "\n " + f.what(), ERR_GRIDFILE_READ); } @@ -1150,17 +1150,17 @@ void dna_geoid_interpolation::CreateNTv2File(const char* datFile, const n_file_p if (lExpectedNodes != lNodeRead) { - stringstream ss; - ss << endl << "Expected number of rows is " << lExpectedLatIncrements << endl; - ss << endl << "Expected number of cols is " << lExpectedLonIncrements << endl; - ss << endl << "Expected number of nodes is " << lExpectedNodes << ", but read " << lNodeRead; + std::stringstream ss; + ss << std::endl << "Expected number of rows is " << lExpectedLatIncrements << std::endl; + ss << std::endl << "Expected number of cols is " << lExpectedLonIncrements << std::endl; + ss << std::endl << "Expected number of nodes is " << lExpectedNodes << ", but read " << lNodeRead; throw NetGeoidException(ErrorString(ERR_GRID_PARAMETERS) + ss.str(), ERR_GRID_PARAMETERS); } m_iBytesRead = 0; - cout << "done." << endl << "+ WINTER DAT file structure appears OK." << endl; - cout << "+ Creating NTv2 gsb file... "; + std::cout << "done." << std::endl << "+ WINTER DAT file structure appears OK." << std::endl; + std::cout << "+ Creating NTv2 gsb file... "; geoid_values* ag_data = new geoid_values[lNodeRead]; // Update header record @@ -1173,8 +1173,8 @@ void dna_geoid_interpolation::CreateNTv2File(const char* datFile, const n_file_p // Default option is to create a geoid grid file in seconds. // Change to Radians if required geoidConversion conversionType(geoidConversion::Same); - string shiftType(grid->chGs_type); - if (iequals(trimstr(shiftType), "radians")) + std::string shiftType(grid->chGs_type); + if (boost::iequals(trimstr(shiftType), "radians")) conversionType = SecondsToRadians; // Print default header block and subgrid header block information. @@ -1183,12 +1183,12 @@ void dna_geoid_interpolation::CreateNTv2File(const char* datFile, const n_file_p // put file pointer back to beginning f_in.clear(); - f_in.seekg(0, ios::beg); + f_in.seekg(0, std::ios::beg); // Read the first line and test for a comment line f_in.getline(szLine, MAX_RECORD_LENGTH); if (strncmp(szLine, "GEO", 3) == 0) - f_in.seekg(0, ios::beg); // put file pointer back to beginning + f_in.seekg(0, std::ios::beg); // put file pointer back to beginning // read first line of dat file and scan in values f_in.getline(szLine, MAX_RECORD_LENGTH); @@ -1230,7 +1230,7 @@ void dna_geoid_interpolation::CreateNTv2File(const char* datFile, const n_file_p f_in.getline(szLine, MAX_RECORD_LENGTH); } } - catch (const ios_base::failure& f) { + catch (const std::ios_base::failure& f) { if (!f_in.eof()) throw NetGeoidException(ErrorString(ERR_GRIDFILE_READ) + "\n " + f.what(), ERR_GRIDFILE_READ); } @@ -1255,7 +1255,7 @@ void dna_geoid_interpolation::CreateNTv2File(const char* datFile, const n_file_p f_out.close(); f_in.close(); - cout << "done." << endl; + std::cout << "done." << std::endl; } @@ -1277,7 +1277,7 @@ void dna_geoid_interpolation::ExportToAscii(const char *gridFile, const char *gr m_Grid_Success = OpenGridFile(gridFile, gridType, m_pGridfile, false); // A new grid file specified? - if (!iequals(m_pGridfile->filename, gridFile)) + if (!boost::iequals(m_pGridfile->filename, gridFile)) { ClearGridFileMemory(); m_Grid_Success = OpenGridFile(gridFile, gridType, m_pGridfile, false); @@ -1298,9 +1298,9 @@ void dna_geoid_interpolation::ExportToAscii(const char *gridFile, const char *gr // Create geoid grid file. Throws runtime_error on failure. file_opener(f_out, OutputGrid); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ClearGridFileMemory(); - stringstream ss; + std::stringstream ss; ss << ErrorString(ERR_OUTFILE_WRITE) << "\n" << " " << e.what(); throw NetGeoidException(ss.str(), ERR_OUTFILE_WRITE); @@ -1308,18 +1308,18 @@ void dna_geoid_interpolation::ExportToAscii(const char *gridFile, const char *gr *IO_Status = ERR_TRANS_SUCCESS; - string shiftTypeFrom(m_pGridfile->chGs_type); - string shiftTypeTo(shiftType); + std::string shiftTypeFrom(m_pGridfile->chGs_type); + std::string shiftTypeTo(shiftType); shiftTypeFrom = trimstr(shiftTypeFrom); shiftTypeTo = trimstr(shiftTypeTo); geoidConversion conversionType; - if (iequals(shiftTypeFrom, "seconds") && - iequals(shiftTypeTo, "radians")) + if (boost::iequals(shiftTypeFrom, "seconds") && + boost::iequals(shiftTypeTo, "radians")) conversionType = SecondsToRadians; - else if (iequals(shiftTypeFrom, "radians") && - iequals(shiftTypeTo, "seconds")) + else if (boost::iequals(shiftTypeFrom, "radians") && + boost::iequals(shiftTypeTo, "seconds")) conversionType = RadiansToSeconds; else conversionType = Same; @@ -1359,33 +1359,33 @@ void dna_geoid_interpolation::ExportToAscii(const char *gridFile, const char *gr throw NetGeoidException(ErrorString(ERR_READ_BIN_SHIFT, m_pGridfile->filename), ERR_GRIDFILE_READ); // Write N value - f_out << setw(10) << fixed << setprecision(6) << fValue1; + f_out << std::setw(10) << std::fixed << std::setprecision(6) << fValue1; // Write deflections (check type first) switch (conversionType) { case SecondsToRadians: // convert seconds values to radians - f_out << setw(10) << scientific << setprecision(3) << fValue2 / RAD_TO_SEC; - f_out << setw(10) << scientific << setprecision(3) << fValue3 / RAD_TO_SEC; + f_out << std::setw(10) << std::scientific << std::setprecision(3) << fValue2 / RAD_TO_SEC; + f_out << std::setw(10) << std::scientific << std::setprecision(3) << fValue3 / RAD_TO_SEC; break; case RadiansToSeconds: // convert radians values to seconds - f_out << setw(10) << setprecision(6) << fValue2 * RAD_TO_SEC; - f_out << setw(10) << setprecision(6) << fValue3 * RAD_TO_SEC; + f_out << std::setw(10) << std::setprecision(6) << fValue2 * RAD_TO_SEC; + f_out << std::setw(10) << std::setprecision(6) << fValue3 * RAD_TO_SEC; break; case Same: default: // as-is, so cater for precision - if (iequals(shiftTypeTo, "radians")) - f_out << scientific << setprecision(3); - f_out << setw(10) << setprecision(6) << fValue2; - f_out << setw(10) << setprecision(6) << fValue3; + if (boost::iequals(shiftTypeTo, "radians")) + f_out << std::scientific << std::setprecision(3); + f_out << std::setw(10) << std::setprecision(6) << fValue2; + f_out << std::setw(10) << std::setprecision(6) << fValue3; break; } // Write blank value (not used for NTv2 geoid grid files) - f_out << setw(10) << fixed << setprecision(6) << fValue4 << endl; + f_out << std::setw(10) << std::fixed << std::setprecision(6) << fValue4 << std::endl; m_dPercentComplete = (double)(m_pGfileptr.tellg()) / (double)m_pGridfile->iGfilelength * 100.0; } @@ -1401,7 +1401,7 @@ void dna_geoid_interpolation::ExportToAscii(const char *gridFile, const char *gr m_dPercentComplete = 0.0; // print end of file record - f_out << "END " << setw(10) << right << setprecision(2) << scientific << 3.33E+32 << endl; + f_out << "END " << std::setw(10) << std::right << std::setprecision(2) << std::scientific << 3.33E+32 << std::endl; // Finished! f_out.close(); @@ -1426,7 +1426,7 @@ void dna_geoid_interpolation::ExportToBinary(const char *gridFile, const char *g m_Grid_Success = OpenGridFile(gridFile, gridType, m_pGridfile, false); // A new grid file specified? - if (!iequals(m_pGridfile->filename, gridFile)) + if (!boost::iequals(m_pGridfile->filename, gridFile)) { ClearGridFileMemory(); m_Grid_Success = OpenGridFile(gridFile, gridType, m_pGridfile, false); @@ -1445,29 +1445,29 @@ void dna_geoid_interpolation::ExportToBinary(const char *gridFile, const char *g *IO_Status = ERR_OUTFILE_WRITE; try { // open distortion grid file. Throws runtime_error on failure. - file_opener(f_out, OutputGrid, ios::out | ios::binary, binary); + file_opener(f_out, OutputGrid, std::ios::out | std::ios::binary, binary); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ClearGridFileMemory(); - stringstream ss; + std::stringstream ss; ss << ErrorString(ERR_OUTFILE_WRITE) << "\n" << " " << e.what(); throw NetGeoidException(ss.str(), ERR_OUTFILE_WRITE); } *IO_Status = ERR_TRANS_SUCCESS; - string shiftTypeFrom(m_pGridfile->chGs_type); - string shiftTypeTo(shiftType); + std::string shiftTypeFrom(m_pGridfile->chGs_type); + std::string shiftTypeTo(shiftType); shiftTypeFrom = trimstr(shiftTypeFrom); shiftTypeTo = trimstr(shiftTypeTo); geoidConversion conversionType; - if (iequals(shiftTypeFrom, "seconds") && - iequals(shiftTypeTo, "radians")) + if (boost::iequals(shiftTypeFrom, "seconds") && + boost::iequals(shiftTypeTo, "radians")) conversionType = SecondsToRadians; - else if (iequals(shiftTypeFrom, "radians") && - iequals(shiftTypeTo, "seconds")) + else if (boost::iequals(shiftTypeFrom, "radians") && + boost::iequals(shiftTypeTo, "seconds")) conversionType = RadiansToSeconds; else conversionType = Same; @@ -1736,15 +1736,15 @@ bool dna_geoid_interpolation::IsWithinLowerLongitudeGridInterval(n_gridfileindex int dna_geoid_interpolation::DetermineFileType(const char *cType) { // case insensitive - if (iequals(cType, ASC)) // asc "ASCII" file + if (boost::iequals(cType, ASC)) // asc "ASCII" file return TYPE_ASC; - else if (iequals(cType, GSB)) // gsb "Binary" file + else if (boost::iequals(cType, GSB)) // gsb "Binary" file return TYPE_GSB; - else if (iequals(cType, TXT) || // dat/txt/prn file - iequals(cType, DAT) || // .. - iequals(cType, PRN)) // .. + else if (boost::iequals(cType, TXT) || // dat/txt/prn file + boost::iequals(cType, DAT) || // .. + boost::iequals(cType, PRN)) // .. return TYPE_DAT; - else if (iequals(cType, CSV)) // csv file + else if (boost::iequals(cType, CSV)) // csv file return TYPE_CSV; else return -1; // Unsupported filetype @@ -2242,7 +2242,7 @@ int dna_geoid_interpolation::InterpolateNvalue_BiCubic(geoid_point *dInterpPoint &m_pGridfile->ptrIndex[m_pGridfile->iTheGrid].dLatinc, &(dInterpPoint->gVar.dN_value)); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { throw NetGeoidException(e.what(), 0); } @@ -2276,7 +2276,7 @@ int dna_geoid_interpolation::InterpolateNvalue_BiCubic(geoid_point *dInterpPoint &(dInterpPoint->gVar.dDefl_meridian)); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { throw NetGeoidException(e.what(), 0); } @@ -2309,7 +2309,7 @@ int dna_geoid_interpolation::InterpolateNvalue_BiCubic(geoid_point *dInterpPoint &m_pGridfile->ptrIndex[m_pGridfile->iTheGrid].dLatinc, &(dInterpPoint->gVar.dDefl_primev)); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { throw NetGeoidException(e.what(), 0); } @@ -2444,8 +2444,8 @@ int dna_geoid_interpolation::OpenGridFile(const char *filename, const char *file if (ptheGrid->ptrIndex != NULL) delete [] ptheGrid->ptrIndex; - strcpy(ptheGrid->filename, trimstr(filename).c_str()); - strcpy(ptheGrid->filetype, trimstr(filetype).c_str()); + strcpy(ptheGrid->filename, trimstr(filename).c_str()); + strcpy(ptheGrid->filetype, trimstr(filetype).c_str()); int iLineLength = 4 * sizeof(float); ptheGrid->Can_Format = true; // assume file will be in Canadian format @@ -2457,17 +2457,17 @@ int dna_geoid_interpolation::OpenGridFile(const char *filename, const char *file try { if (gridType == TYPE_ASC) // open in ascii mode and go to end of file - file_opener(pgrid_ifs, ptheGrid->filename, ios::in | ios::ate, ascii, true); + file_opener(pgrid_ifs, ptheGrid->filename, std::ios::in | std::ios::ate, ascii, true); else if (gridType == TYPE_GSB) // open in binary mode and go to end of file - file_opener(pgrid_ifs, ptheGrid->filename, ios::in | ios::binary | ios::ate, binary, true); + file_opener(pgrid_ifs, ptheGrid->filename, std::ios::in | std::ios::binary | std::ios::ate, binary, true); else // unknown file type, so throw an exception throw NetGeoidException(ErrorString(ERR_GRIDFILE_TYPE), ERR_GRIDFILE_TYPE); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ClearGridFileMemory(); - stringstream ss; + std::stringstream ss; ss << ErrorString(ERR_GRIDFILE_READ) << "\n" << " " << e.what(); throw NetGeoidException(ss.str(), ERR_GRIDFILE_READ); @@ -2475,23 +2475,23 @@ int dna_geoid_interpolation::OpenGridFile(const char *filename, const char *file // calculate file length ptheGrid->iGfilelength = (int)pgrid_ifs->tellg(); - pgrid_ifs->seekg(0, ios::beg); + pgrid_ifs->seekg(0, std::ios::beg); char identifier[IDENT_BUF + 1]; - string sBuf; + std::string sBuf; try { // read in all Overview Header information if (gridType == TYPE_ASC) // ascii { getline(*pgrid_ifs, sBuf); - ptheGrid->iH_info = lexical_cast(trimstr(sBuf.substr(OVERVIEW_RECS))); + ptheGrid->iH_info = boost::lexical_cast(trimstr(sBuf.substr(OVERVIEW_RECS))); getline(*pgrid_ifs, sBuf); - ptheGrid->iSubH_info = lexical_cast(trimstr(sBuf.substr(OVERVIEW_RECS))); + ptheGrid->iSubH_info = boost::lexical_cast(trimstr(sBuf.substr(OVERVIEW_RECS))); getline(*pgrid_ifs, sBuf); - ptheGrid->iNumsubgrids = lexical_cast(trimstr(sBuf.substr(OVERVIEW_RECS))); + ptheGrid->iNumsubgrids = boost::lexical_cast(trimstr(sBuf.substr(OVERVIEW_RECS))); getline(*pgrid_ifs, sBuf); strcpy(ptheGrid->chGs_type, trimstr(sBuf.substr(OVERVIEW_RECS)).c_str()); @@ -2506,16 +2506,16 @@ int dna_geoid_interpolation::OpenGridFile(const char *filename, const char *file strcpy(ptheGrid->chSystem_t, trimstr(sBuf.substr(OVERVIEW_RECS)).c_str()); getline(*pgrid_ifs, sBuf); - ptheGrid->daf = lexical_cast(trimstr(sBuf.substr(OVERVIEW_RECS))); + ptheGrid->daf = boost::lexical_cast(trimstr(sBuf.substr(OVERVIEW_RECS))); getline(*pgrid_ifs, sBuf); - ptheGrid->dbf = lexical_cast(trimstr(sBuf.substr(OVERVIEW_RECS))); + ptheGrid->dbf = boost::lexical_cast(trimstr(sBuf.substr(OVERVIEW_RECS))); getline(*pgrid_ifs, sBuf); - ptheGrid->dat = lexical_cast(trimstr(sBuf.substr(OVERVIEW_RECS))); + ptheGrid->dat = boost::lexical_cast(trimstr(sBuf.substr(OVERVIEW_RECS))); getline(*pgrid_ifs, sBuf); - ptheGrid->dbt = lexical_cast(trimstr(sBuf.substr(OVERVIEW_RECS))); + ptheGrid->dbt = boost::lexical_cast(trimstr(sBuf.substr(OVERVIEW_RECS))); } else // binary { @@ -2583,8 +2583,8 @@ int dna_geoid_interpolation::OpenGridFile(const char *filename, const char *file // fills the new elements with default values ptheGrid->ptrIndex = new n_gridfileindex[ptheGrid->iNumsubgrids]; - string shiftType(ptheGrid->chGs_type); - if (iequals(trimstr(shiftType), "radians")) + std::string shiftType(ptheGrid->chGs_type); + if (boost::iequals(trimstr(shiftType), "radians")) m_isRadians = true; else m_isRadians = false; @@ -2606,25 +2606,25 @@ int dna_geoid_interpolation::OpenGridFile(const char *filename, const char *file strcpy(ptheGrid->ptrIndex[i].chUpdated, trimstr(sBuf.substr(OVERVIEW_RECS)).c_str()); getline(*pgrid_ifs, sBuf); - ptheGrid->ptrIndex[i].dSlat = lexical_cast(trimstr(sBuf.substr(OVERVIEW_RECS))); + ptheGrid->ptrIndex[i].dSlat = boost::lexical_cast(trimstr(sBuf.substr(OVERVIEW_RECS))); getline(*pgrid_ifs, sBuf); - ptheGrid->ptrIndex[i].dNlat = lexical_cast(trimstr(sBuf.substr(OVERVIEW_RECS))); + ptheGrid->ptrIndex[i].dNlat = boost::lexical_cast(trimstr(sBuf.substr(OVERVIEW_RECS))); getline(*pgrid_ifs, sBuf); - ptheGrid->ptrIndex[i].dElong = lexical_cast(trimstr(sBuf.substr(OVERVIEW_RECS))); + ptheGrid->ptrIndex[i].dElong = boost::lexical_cast(trimstr(sBuf.substr(OVERVIEW_RECS))); getline(*pgrid_ifs, sBuf); - ptheGrid->ptrIndex[i].dWlong = lexical_cast(trimstr(sBuf.substr(OVERVIEW_RECS))); + ptheGrid->ptrIndex[i].dWlong = boost::lexical_cast(trimstr(sBuf.substr(OVERVIEW_RECS))); getline(*pgrid_ifs, sBuf); - ptheGrid->ptrIndex[i].dLatinc = lexical_cast(trimstr(sBuf.substr(OVERVIEW_RECS))); + ptheGrid->ptrIndex[i].dLatinc = boost::lexical_cast(trimstr(sBuf.substr(OVERVIEW_RECS))); getline(*pgrid_ifs, sBuf); - ptheGrid->ptrIndex[i].dLonginc = lexical_cast(trimstr(sBuf.substr(OVERVIEW_RECS))); + ptheGrid->ptrIndex[i].dLonginc = boost::lexical_cast(trimstr(sBuf.substr(OVERVIEW_RECS))); getline(*pgrid_ifs, sBuf); - ptheGrid->ptrIndex[i].lGscount = lexical_cast(trimstr(sBuf.substr(OVERVIEW_RECS))); + ptheGrid->ptrIndex[i].lGscount = boost::lexical_cast(trimstr(sBuf.substr(OVERVIEW_RECS))); // Save ASCII position in grid file for first record of lat & long shifts ptheGrid->ptrIndex[i].iGridPos = (int)pgrid_ifs->tellg(); @@ -2674,7 +2674,7 @@ int dna_geoid_interpolation::OpenGridFile(const char *filename, const char *file ptheGrid->ptrIndex[i].iGridPos = (int)pgrid_ifs->tellg(); // End of file encountered first??? - pgrid_ifs->seekg(ptheGrid->ptrIndex[i].lGscount * iLineLength, ios::cur); + pgrid_ifs->seekg(ptheGrid->ptrIndex[i].lGscount * iLineLength, std::ios::cur); } } @@ -2685,17 +2685,17 @@ int dna_geoid_interpolation::OpenGridFile(const char *filename, const char *file void dna_geoid_interpolation::PrintGridHeaderInfoAscii(std::ofstream* f_out) { // print header block information - *f_out << "NUM_OREC" << setw(8) << right << m_pGridfile->iH_info << endl; // Number of header identifiers (NUM_OREC) - *f_out << "NUM_SREC" << setw(8) << right << m_pGridfile->iSubH_info << endl; // Number of sub-header idents (NUM_SREC) - *f_out << "NUM_FILE" << setw(8) << right << m_pGridfile->iNumsubgrids << endl; // number of subgrids in file (NUM_FILE) - *f_out << "GS_TYPE " << setw(8) << right << m_pGridfile->chGs_type << endl; // grid shift type (GS_TYPE) - *f_out << "VERSION " << setw(8) << right << m_pGridfile->chVersion << endl; // grid file version (VERSION) - *f_out << "SYSTEM_F" << setw(8) << right << m_pGridfile->chSystem_f << endl; // reference system (SYSTEM_F) - *f_out << "SYSTEM_T" << setw(8) << right << m_pGridfile->chSystem_t << endl; // reference system (SYSTEM_T) - *f_out << "MAJOR_F " << setw(15) << right << fixed << setprecision(3) << m_pGridfile->daf << endl; // semi major of from system (MAJOR_F) - *f_out << "MINOR_F " << setw(15) << right << fixed << setprecision(3) << m_pGridfile->dbf << endl; // semi minor of from system (MINOR_F) - *f_out << "MAJOR_T " << setw(15) << right << fixed << setprecision(3) << m_pGridfile->dat << endl; // semi major of to system (MAJOR_T) - *f_out << "MINOR_T " << setw(15) << right << fixed << setprecision(3) << m_pGridfile->dbt << endl; // semi minor of to system (MINOR_T) + *f_out << "NUM_OREC" << std::setw(8) << std::right << m_pGridfile->iH_info << std::endl; // Number of header identifiers (NUM_OREC) + *f_out << "NUM_SREC" << std::setw(8) << std::right << m_pGridfile->iSubH_info << std::endl; // Number of sub-header idents (NUM_SREC) + *f_out << "NUM_FILE" << std::setw(8) << std::right << m_pGridfile->iNumsubgrids << std::endl; // number of subgrids in file (NUM_FILE) + *f_out << "GS_TYPE " << std::setw(8) << std::right << m_pGridfile->chGs_type << std::endl; // grid shift type (GS_TYPE) + *f_out << "VERSION " << std::setw(8) << std::right << m_pGridfile->chVersion << std::endl; // grid file version (VERSION) + *f_out << "SYSTEM_F" << std::setw(8) << std::right << m_pGridfile->chSystem_f << std::endl; // reference system (SYSTEM_F) + *f_out << "SYSTEM_T" << std::setw(8) << std::right << m_pGridfile->chSystem_t << std::endl; // reference system (SYSTEM_T) + *f_out << "MAJOR_F " << std::setw(15) << std::right << std::fixed << std::setprecision(3) << m_pGridfile->daf << std::endl; // semi major of from system (MAJOR_F) + *f_out << "MINOR_F " << std::setw(15) << std::right << std::fixed << std::setprecision(3) << m_pGridfile->dbf << std::endl; // semi minor of from system (MINOR_F) + *f_out << "MAJOR_T " << std::setw(15) << std::right << std::fixed << std::setprecision(3) << m_pGridfile->dat << std::endl; // semi major of to system (MAJOR_T) + *f_out << "MINOR_T " << std::setw(15) << std::right << std::fixed << std::setprecision(3) << m_pGridfile->dbt << std::endl; // semi minor of to system (MINOR_T) } @@ -2746,22 +2746,22 @@ void dna_geoid_interpolation::PrintGridHeaderInfoBinary(std::ofstream* f_out, n_ void dna_geoid_interpolation::PrintSubGridHeaderInfoAscii(std::ofstream* f_out, n_gridfileindex* gfIndex) { // Print header info for sub-grid - *f_out << "SUB_NAME" << setw(8) << right << gfIndex->chSubname << endl; - *f_out << "PARENT " << setw(8) << right << gfIndex->chParent << endl; - *f_out << "CREATED " << setw(8) << right << gfIndex->chCreated << endl; - *f_out << "UPDATED " << setw(8) << right << gfIndex->chUpdated << endl; + *f_out << "SUB_NAME" << std::setw(8) << std::right << gfIndex->chSubname << std::endl; + *f_out << "PARENT " << std::setw(8) << std::right << gfIndex->chParent << std::endl; + *f_out << "CREATED " << std::setw(8) << std::right << gfIndex->chCreated << std::endl; + *f_out << "UPDATED " << std::setw(8) << std::right << gfIndex->chUpdated << std::endl; // Output all values in seconds, irrespective of whether shifts are in radians or not. // NTv2 simply doesn't afford enough width for these fields to provide sufficient // precision for values in radians. - *f_out << "S_LAT " << setw(15) << right << setprecision(6) << gfIndex->dSlat << endl; - *f_out << "N_LAT " << setw(15) << right << setprecision(6) << gfIndex->dNlat << endl; - *f_out << "E_LONG " << setw(15) << right << setprecision(6) << gfIndex->dElong << endl; - *f_out << "W_LONG " << setw(15) << right << setprecision(6) << gfIndex->dWlong << endl; - *f_out << "LAT_INC " << setw(15) << right << setprecision(6) << gfIndex->dLatinc << endl; - *f_out << "LONG_INC" << setw(15) << right << setprecision(6) << gfIndex->dLonginc << endl; - - *f_out << "GS_COUNT" << setw(6) << right << gfIndex->lGscount << endl; + *f_out << "S_LAT " << std::setw(15) << std::right << std::setprecision(6) << gfIndex->dSlat << std::endl; + *f_out << "N_LAT " << std::setw(15) << std::right << std::setprecision(6) << gfIndex->dNlat << std::endl; + *f_out << "E_LONG " << std::setw(15) << std::right << std::setprecision(6) << gfIndex->dElong << std::endl; + *f_out << "W_LONG " << std::setw(15) << std::right << std::setprecision(6) << gfIndex->dWlong << std::endl; + *f_out << "LAT_INC " << std::setw(15) << std::right << std::setprecision(6) << gfIndex->dLatinc << std::endl; + *f_out << "LONG_INC" << std::setw(15) << std::right << std::setprecision(6) << gfIndex->dLonginc << std::endl; + + *f_out << "GS_COUNT" << std::setw(6) << std::right << gfIndex->lGscount << std::endl; } @@ -2867,7 +2867,7 @@ void dna_geoid_interpolation::ScanNodeLocations(char* szLine, double* latitude, } -string dna_geoid_interpolation::ErrorString(const int& error, const string& data) +std::string dna_geoid_interpolation::ErrorString(const int& error, const std::string& data) { switch(error) { @@ -2884,10 +2884,10 @@ string dna_geoid_interpolation::ErrorString(const int& error, const string& data case ERR_GRIDFILE_READ: // 1 return "The specified grid file could not be opened."; case ERR_GRIDFILE_TYPE: // 2 - return string(__BINARY_NAME__) + " cannot read this type of grid file."; + return std::string(__BINARY_NAME__) + " cannot read this type of grid file."; case ERR_GRID_CORRUPT: // 3 case ERR_GRIDFILE_ERROR: // 14 - return string(__BINARY_NAME__) + " found an unrecoverable error in the specified grid file:\n\n " + + return std::string(__BINARY_NAME__) + " found an unrecoverable error in the specified grid file:\n\n " + data + "\n\nIt is likely that this file was downloaded or produced incorrectly.\nPlease select a new grid file."; case ERR_INFILE_READ: // 4 return "Could not read from the specified input file."; @@ -2921,7 +2921,7 @@ string dna_geoid_interpolation::ErrorString(const int& error, const string& data } } -string dna_geoid_interpolation::ErrorCaption(const int& error) +std::string dna_geoid_interpolation::ErrorCaption(const int& error) { switch(error) { diff --git a/dynadjust/dynadjust/dnageoid/dnageoid.hpp b/dynadjust/dynadjust/dnageoid/dnageoid.hpp index 91fcc786..ae5a938f 100644 --- a/dynadjust/dynadjust/dnageoid/dnageoid.hpp +++ b/dynadjust/dynadjust/dnageoid/dnageoid.hpp @@ -79,10 +79,6 @@ #include #include -using namespace std; - -using namespace boost::filesystem; - using namespace dynadjust::measurements; using namespace dynadjust::exception; using namespace dynadjust::iostreams; @@ -150,7 +146,7 @@ class dna_geoid_interpolation { const int& intEllipsoidtoOrtho, const int& intDmsFlag, bool exportDnaGeoidFile, const char* geoFile=NULL); - void PopulateBinaryStationFile(const string& bstnFile, const int& method, + void PopulateBinaryStationFile(const std::string& bstnFile, const int& method, bool convertHeights, bool exportDnaGeoidFile, const char* geoFile=NULL); @@ -190,12 +186,12 @@ class dna_geoid_interpolation { inline int PointsInterpolated() const { return m_pointsInterpolated; } inline int PointsNotInterpolated() const { return m_pointsNotInterpolated; } - string ErrorString(const int& error, const string& data=""); - string ErrorCaption(const int& error); + std::string ErrorString(const int& error, const std::string& data=""); + std::string ErrorCaption(const int& error); - inline void SetInputCoordinates(const string& inputCoordinates) { m_inputCoordinates = inputCoordinates; } + inline void SetInputCoordinates(const std::string& inputCoordinates) { m_inputCoordinates = inputCoordinates; } - string ReturnBadStationRecords(); + std::string ReturnBadStationRecords(); private: @@ -227,17 +223,17 @@ class dna_geoid_interpolation { bool ReadAsciiShifts(geoid_values* pNShifts[], int iNodeIndex, long lNode); bool ReadBinaryShifts(geoid_values* pNShifts[], int iNodeIndex, long lNode); - void LoadBinaryStationFile(const string& bstnfileName); - void WriteBinaryStationFile(const string& bstnfileName); + void LoadBinaryStationFile(const std::string& bstnfileName); + void WriteBinaryStationFile(const std::string& bstnfileName); void PopulateStationRecords(const int& method, bool convertHeights); - void WriteDNA1GeoidFile(const string& geofileName); - void PrintDNA1GeoidRecord(std::ofstream& f_out, const string& station, const double& nValue, const double& meridianDef, const double& verticalDef); + void WriteDNA1GeoidFile(const std::string& geofileName); + void PrintDNA1GeoidRecord(std::ofstream& f_out, const std::string& station, const double& nValue, const double& meridianDef, const double& verticalDef); void ProcessCsvFile(std::ifstream* f_in, std::ofstream* f_out, std::ofstream* f_dnageo, const int& method, const int& intEllipsoidtoOrtho, const int& intDmsFlag); void ProcessDatFile(std::ifstream* f_in, std::ofstream* f_out, std::ofstream* f_dnageo, const int& method, const int& intEllipsoidtoOrtho, const int& intDmsFlag); - //void OpenOutFile(std::ofstream& f_out, const string& fileOut, ios::open_mode mode, const string callingFunc); + //void OpenOutFile(std::ofstream& f_out, const std::string& fileOut, std::ios::open_mode mode, const std::string callingFunc); bool m_isReading; bool m_isWriting; @@ -262,7 +258,7 @@ class dna_geoid_interpolation { bool m_fileMode; - string m_inputCoordinates; + std::string m_inputCoordinates; bool m_isRadians; diff --git a/dynadjust/dynadjust/dnageoidint/FileProc.cpp b/dynadjust/dynadjust/dnageoidint/FileProc.cpp index e9ca512f..ebaeaf1f 100644 --- a/dynadjust/dynadjust/dnageoidint/FileProc.cpp +++ b/dynadjust/dynadjust/dnageoidint/FileProc.cpp @@ -50,7 +50,7 @@ CFileProc::~CFileProc() ClearFileArrayMemory(); } -void CFileProc::BuildFileArray(const char* filedir, const vector& filetypes, const int& no_filetypes) +void CFileProc::BuildFileArray(const char* filedir, const std::vector& filetypes, const int& no_filetypes) { char chFilter[_MAX_PATH]; struct _finddata_t _fFile; diff --git a/dynadjust/dynadjust/dnageoidint/FileProc.h b/dynadjust/dynadjust/dnageoidint/FileProc.h index 76e6c422..76f04086 100644 --- a/dynadjust/dynadjust/dnageoidint/FileProc.h +++ b/dynadjust/dynadjust/dnageoidint/FileProc.h @@ -15,8 +15,6 @@ struct _fileindex { int CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData); -using namespace std; - #define PATH_ERROR -1 #define PATH_NOT_FOUND 0 #define PATH_IS_FILE 1 @@ -50,7 +48,7 @@ class CFileProc CString BrowseForDialog(CString strMsg, HWND hwndOwner); void ClearFileArrayMemory(); - void BuildFileArray(const char* filedir, const vector& filetype, const int& no_filetypes); + void BuildFileArray(const char* filedir, const std::vector& filetype, const int& no_filetypes); void EnterSingleFile(char *filename); CString FileOpenSave(BOOL bOpen_Save, BOOL bMulti_Files, LPCTSTR lpszDir, char *cNewFile, LPCTSTR lpszTitle, LPCTSTR lpszExt, LPCTSTR strFilter, int iFileType); diff --git a/dynadjust/dynadjust/dnageoidint/dnageoidintDlg.cpp b/dynadjust/dynadjust/dnageoidint/dnageoidintDlg.cpp index 607c5d10..9a0e6d17 100644 --- a/dynadjust/dynadjust/dnageoidint/dnageoidintDlg.cpp +++ b/dynadjust/dynadjust/dnageoidint/dnageoidintDlg.cpp @@ -368,8 +368,8 @@ void CdnageoidintDlg::CreateGridIndex() char version[21]; m_dnaGeoid.ReportGridVersion(version); - stringstream ss; - ss << "Opened Grid file " << left << tUserSettings.GridFile << ", Version " << version << endl << endl; + std::stringstream ss; + ss << "Opened Grid file " << std::left << tUserSettings.GridFile << ", Version " << version << std::endl << std::endl; PrintLogFileMessage(ss.str().c_str()); } catch (const NetGeoidException& e) { @@ -394,15 +394,15 @@ void CdnageoidintDlg::CreateGridIndex() int CdnageoidintDlg::DetermineFileType(const char *cType) { // case insensitive - if (iequals(cType, ASC)) // asc "ASCII" file + if (boost::iequals(cType, ASC)) // asc "ASCII" file return TYPE_ASC; - else if (iequals(cType, GSB)) // gsb "Binary" file + else if (boost::iequals(cType, GSB)) // gsb "Binary" file return TYPE_GSB; - else if (iequals(cType, TXT) || // dat/txt/prn file - iequals(cType, DAT) || // .. - iequals(cType, PRN)) // .. + else if (boost::iequals(cType, TXT) || // dat/txt/prn file + boost::iequals(cType, DAT) || // .. + boost::iequals(cType, PRN)) // .. return TYPE_DAT; - else if (iequals(cType, CSV)) // csv file + else if (boost::iequals(cType, CSV)) // csv file return TYPE_CSV; else return -1; // Unsupported filetype @@ -604,7 +604,7 @@ void CdnageoidintDlg::OnTransform() strcpy(chDirectory, m_strDataFile); - vector file_type_array; + std::vector file_type_array; file_type_array.push_back("dat"); file_type_array.push_back("csv"); @@ -838,8 +838,8 @@ LRESULT CdnageoidintDlg::OnInterpolateInputCoords(WPARAM wParam, LPARAM lParam) // agCoord_.cVar.dLongitude = DmintoDeg(m_InputCoordDlg->GetLongitudeInput()); // break; case DDEG: - agCoord_.cVar.dLatitude = m_InputCoordDlg->GetLatitudeInput(); // S 12° 14' 55.92960" - agCoord_.cVar.dLongitude = m_InputCoordDlg->GetLongitudeInput(); // E 142° 03' 36.18000" + agCoord_.cVar.dLatitude = m_InputCoordDlg->GetLatitudeInput(); // S 12� 14' 55.92960" + agCoord_.cVar.dLongitude = m_InputCoordDlg->GetLongitudeInput(); // E 142� 03' 36.18000" break; } @@ -855,8 +855,8 @@ LRESULT CdnageoidintDlg::OnInterpolateInputCoords(WPARAM wParam, LPARAM lParam) agCoord_.cVar.IO_Status == ERR_PT_OUTSIDE_GRID) { // 13: Point is outside limits of the grid - stringstream ss; - ss << ">> " << fixed << setprecision(9) << agCoord_.cVar.dLatitude << ", " << fixed << setprecision(9) << agCoord_.cVar.dLongitude << endl << endl; + std::stringstream ss; + ss << ">> " << std::fixed << std::setprecision(9) << agCoord_.cVar.dLatitude << ", " << std::fixed << std::setprecision(9) << agCoord_.cVar.dLongitude << std::endl << std::endl; PrintLogFileMessage(ss.str().c_str()); } @@ -951,7 +951,7 @@ void CdnageoidintDlg::PrintLogFileMessage(const char* szMessage) void CdnageoidintDlg::DeleteLogFile(void) { CFileProc fileProc; - vector file_type_array; + std::vector file_type_array; file_type_array.push_back("log"); char chDirectory[MAX_PATH]; diff --git a/dynadjust/dynadjust/dnageoidint/precompile.h b/dynadjust/dynadjust/dnageoidint/precompile.h index 2e346d93..d24cddad 100644 --- a/dynadjust/dynadjust/dnageoidint/precompile.h +++ b/dynadjust/dynadjust/dnageoidint/precompile.h @@ -22,6 +22,10 @@ #define _SECURE_ATL 1 #endif +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif + #ifndef VC_EXTRALEAN #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers #endif @@ -47,12 +51,6 @@ #include -using namespace std; - - - - - #ifdef _UNICODE #if defined _M_IX86 #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") diff --git a/dynadjust/dynadjust/dnageoidint/stdafx.h b/dynadjust/dynadjust/dnageoidint/stdafx.h index defe7c3c..7f2d985b 100644 --- a/dynadjust/dynadjust/dnageoidint/stdafx.h +++ b/dynadjust/dynadjust/dnageoidint/stdafx.h @@ -20,6 +20,10 @@ #define _SECURE_ATL 1 #endif +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif + #ifndef VC_EXTRALEAN #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers #endif @@ -45,12 +49,6 @@ #include -using namespace std; - - - - - #ifdef _UNICODE #if defined _M_IX86 #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") diff --git a/dynadjust/dynadjust/dnageoidwrapper/dnageoidwrapper.cpp b/dynadjust/dynadjust/dnageoidwrapper/dnageoidwrapper.cpp index 63467312..9c6fc464 100644 --- a/dynadjust/dynadjust/dnageoidwrapper/dnageoidwrapper.cpp +++ b/dynadjust/dynadjust/dnageoidwrapper/dnageoidwrapper.cpp @@ -30,16 +30,16 @@ bool CreateNTv2Grid(dna_geoid_interpolation* g, const char* dat_gridfilePath, co // geoid -d ausgeoid09_gda94_v1.01_clip_1x1.dat -c -g ausgeoid_clip_1.0.1.0.gsb --grid-shift radians --grid-version 1.0.1.0 --system-fr ___GDA94 --system-to ___AHD71 --sub-grid-n 1D-grid --creation 21.04.2021 --update 22.04.2021 // - cout << "+ Creating NTv2 geoid grid file from WINTER DAT file format..." << endl; + std::cout << "+ Creating NTv2 geoid grid file from WINTER DAT file format..." << std::endl; try { g->CreateNTv2File(dat_gridfilePath, grid); } catch (const NetGeoidException& e) { - cout << endl << "- Error: " << e.what() << endl; + std::cout << std::endl << "- Error: " << e.what() << std::endl; return false; } - cout << endl; + std::cout << std::endl; // Open the new grid file and print its properties if (!reportGridProperties(g, grid->filename, grid->filetype)) @@ -55,22 +55,22 @@ bool ExportNTv2GridToAscii(dna_geoid_interpolation* g, const char* dat_gridfileP // geoid -g ausgeoid_clip_1.0.1.0.gsb --grid-shift radians --export-ntv2-asc // - path asciiGridFile(dat_gridfilePath); - string outfile = asciiGridFile.filename().string() + "." + exportfileType; + boost::filesystem::path asciiGridFile(dat_gridfilePath); + std::string outfile = asciiGridFile.filename().string() + "." + exportfileType; int ioStatus; - cout << endl << "+ Exporting NTv2 geoid grid file to " << leafStr(outfile) << "... "; + std::cout << std::endl << "+ Exporting NTv2 geoid grid file to " << leafStr(outfile) << "... "; try { g->ExportToAscii(dat_gridfilePath, gridfileType, gridshiftType, outfile.c_str(), &ioStatus); } catch (const NetGeoidException& e) { - cout << endl << "- Error: " << e.what() << endl; + std::cout << std::endl << "- Error: " << e.what() << std::endl; return false; } - cout << "done." << endl << endl; + std::cout << "done." << std::endl << std::endl; // Open the new grid file and print its properties if (!reportGridProperties(g, outfile.c_str(), exportfileType)) @@ -83,22 +83,22 @@ bool ExportNTv2GridToAscii(dna_geoid_interpolation* g, const char* dat_gridfileP bool ExportNTv2GridToBinary(dna_geoid_interpolation* g, const char* dat_gridfilePath, const char* gridfileType, const char* gridshiftType, const char* exportfileType) { - path asciiGridFile(dat_gridfilePath); - string outfile = asciiGridFile.filename().string() + "." + exportfileType; + boost::filesystem::path asciiGridFile(dat_gridfilePath); + std::string outfile = asciiGridFile.filename().string() + "." + exportfileType; int ioStatus; - cout << endl << "+ Exporting geoid file to " << leafStr(outfile) << "... "; + std::cout << std::endl << "+ Exporting geoid file to " << leafStr(outfile) << "... "; try { g->ExportToBinary(dat_gridfilePath, gridfileType, gridshiftType, outfile.c_str(), &ioStatus); } catch (const NetGeoidException& e) { - cout << endl << "- Error: " << e.what() << endl; + std::cout << std::endl << "- Error: " << e.what() << std::endl; return false; } - cout << "done." << endl << endl; + std::cout << "done." << std::endl << std::endl; // Open the grid file and print its properties if (!reportGridProperties(g, outfile.c_str(), exportfileType)) @@ -109,64 +109,64 @@ bool ExportNTv2GridToBinary(dna_geoid_interpolation* g, const char* dat_gridfile void ReturnBadStationRecords(dna_geoid_interpolation* g, project_settings& p) { - string records, filename(p.g.network_name); - string badpointsPath(formPath(p.g.output_folder, filename, "int")); - stringstream ss; + std::string records, filename(p.g.network_name); + std::string badpointsPath(formPath(p.g.output_folder, filename, "int")); + std::stringstream ss; std::ofstream badpoints_log; - ss << "- Error: Could not open " << filename << " for writing." << endl; + ss << "- Error: Could not open " << filename << " for writing." << std::endl; try { // Create dynadjust log file. Throws runtime_error on failure. file_opener(badpoints_log, badpointsPath); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } // Print formatted header print_file_header(badpoints_log, "DYNADJUST GEOID INTERPOLATION LOG FILE"); - badpoints_log << setw(PRINT_VAR_PAD) << left << "File name:" << badpointsPath << endl << endl; + badpoints_log << std::setw(PRINT_VAR_PAD) << std::left << "File name:" << badpointsPath << std::endl << std::endl; - badpoints_log << setw(PRINT_VAR_PAD) << left << "Command line arguments: "; - badpoints_log << p.n.command_line_arguments << endl << endl; - - badpoints_log << setw(PRINT_VAR_PAD) << left << "Network name:" << p.g.network_name << endl; - badpoints_log << setw(PRINT_VAR_PAD) << left << "Stations file:" << system_complete(p.n.bst_file).string() << endl; - badpoints_log << setw(PRINT_VAR_PAD) << left << "Geoid model: " << system_complete(p.n.ntv2_geoid_file).string() << endl << endl; - badpoints_log << setw(PRINT_VAR_PAD) << left << "Stations not interpolated:" << g->PointsNotInterpolated() << endl; - badpoints_log << OUTPUTLINE << endl << endl; + badpoints_log << std::setw(PRINT_VAR_PAD) << std::left << "Command line arguments: "; + badpoints_log << p.n.command_line_arguments << std::endl << std::endl; + + badpoints_log << std::setw(PRINT_VAR_PAD) << std::left << "Network name:" << p.g.network_name << std::endl; + badpoints_log << std::setw(PRINT_VAR_PAD) << std::left << "Stations file:" << boost::filesystem::system_complete(p.n.bst_file).string() << std::endl; + badpoints_log << std::setw(PRINT_VAR_PAD) << std::left << "Geoid model: " << boost::filesystem::system_complete(p.n.ntv2_geoid_file).string() << std::endl << std::endl; + badpoints_log << std::setw(PRINT_VAR_PAD) << std::left << "Stations not interpolated:" << g->PointsNotInterpolated() << std::endl; + badpoints_log << OUTPUTLINE << std::endl << std::endl; records = g->ReturnBadStationRecords(); - badpoints_log << records << endl; + badpoints_log << records << std::endl; if (p.g.verbose > 1) { - string data(""); - badpoints_log << endl << endl << - "DYNADJUST GEOID INTERPOLARION ERROR CODES" << endl << endl << - setw(PAD) << "Code" << "Description (short and long)" << endl << - "------------------------------------------------------" << endl; + std::string data(""); + badpoints_log << std::endl << std::endl << + "DYNADJUST GEOID INTERPOLARION ERROR CODES" << std::endl << std::endl << + std::setw(PAD) << "Code" << "Description (short and long)" << std::endl << + "------------------------------------------------------" << std::endl; for (int i=ERR_AUS_BINARY; i<=ERR_INTERPOLATION_TYPE; ++i) { badpoints_log << - setw(PAD) << i << - setw(ZONE) << "Short: " << g->ErrorCaption(i) << endl << - setw(PAD) << " " << - setw(ZONE) << "Long: " << g->ErrorString(i, data) << endl; + std::setw(PAD) << i << + std::setw(ZONE) << "Short: " << g->ErrorCaption(i) << std::endl << + std::setw(PAD) << " " << + std::setw(ZONE) << "Long: " << g->ErrorString(i, data) << std::endl; } } badpoints_log.close(); - cout << endl << " See " << badpointsPath << " to view the list of stations for which an" << endl << - " N-value could not be interpolated." << endl; + std::cout << std::endl << " See " << badpointsPath << " to view the list of stations for which an" << std::endl << + " N-value could not be interpolated." << std::endl; } @@ -175,17 +175,17 @@ void ReturnBadStationRecords(dna_geoid_interpolation* g, project_settings& p) bool createGridIndex(dna_geoid_interpolation* g, const char* gridfilePath, const char* gridfileType, const int& quiet) { if (!quiet) - cout << "+ Opening grid file... "; + std::cout << "+ Opening grid file... "; try { g->CreateGridIndex(gridfilePath, gridfileType); } catch (const NetGeoidException& e) { - cout << endl << "- Error: " << e.what() << endl; + std::cout << std::endl << "- Error: " << e.what() << std::endl; return false; } if (!quiet) - cout << "done." << endl; + std::cout << "done." << std::endl; return true; } @@ -199,72 +199,72 @@ bool reportGridProperties(dna_geoid_interpolation* g, const char* gridfilePath, g->ReportGridProperties(gridfilePath, gridfileType, &grid_properties); } catch (const NetGeoidException& e) { - cout << endl << "- Error: " << e.what() << endl; + std::cout << std::endl << "- Error: " << e.what() << std::endl; return false; } bool isRadians(false); - string shiftType(grid_properties.chGs_type); - if (iequals(trimstr(shiftType), "radians")) + std::string shiftType(grid_properties.chGs_type); + if (boost::iequals(trimstr(shiftType), "radians")) isRadians = true; - string formattedLimit; - - cout << "+ Grid properties for " << gridfilePath << ":" << endl; - cout << " - GS_TYPE = " << grid_properties.chGs_type << endl; // grid shift type (GS_TYPE) - cout << " - VERSION = " << grid_properties.chVersion << endl; // grid file version (VERSION) - cout << " - SYSTEM_F = " << grid_properties.chSystem_f << endl; // reference system (SYSTEM_F) - cout << " - SYSTEM_T = " << grid_properties.chSystem_t << endl; // reference system (SYSTEM_T) - cout << " - MAJOR_F = " << setprecision(3) << fixed << grid_properties.daf << endl; // semi major of from system (MAJOR_F) - cout << " - MAJOR_T = " << setprecision(3) << fixed << grid_properties.dat << endl; // semi major of to system (MAJOR_T) - cout << " - MINOR_F = " << setprecision(3) << fixed << grid_properties.dbf << endl; // semi minor of from system (MINOR_F) - cout << " - MINOR_T = " << setprecision(3) << fixed << grid_properties.dbt << endl; // semi minor of to system (MINOR_T) - cout << " - NUM_OREC = " << grid_properties.iH_info << endl; // Number of header identifiers (NUM_OREC) - cout << " - NUM_SREC = " << grid_properties.iSubH_info << endl; // Number of sub-header idents (NUM_SREC) - cout << " - NUM_FILE = " << grid_properties.iNumsubgrids << endl; // number of subgrids in file (NUM_FILE) + std::string formattedLimit; + + std::cout << "+ Grid properties for " << gridfilePath << ":" << std::endl; + std::cout << " - GS_TYPE = " << grid_properties.chGs_type << std::endl; // grid shift type (GS_TYPE) + std::cout << " - VERSION = " << grid_properties.chVersion << std::endl; // grid file version (VERSION) + std::cout << " - SYSTEM_F = " << grid_properties.chSystem_f << std::endl; // reference system (SYSTEM_F) + std::cout << " - SYSTEM_T = " << grid_properties.chSystem_t << std::endl; // reference system (SYSTEM_T) + std::cout << " - MAJOR_F = " << std::setprecision(3) << std::fixed << grid_properties.daf << std::endl; // semi major of from system (MAJOR_F) + std::cout << " - MAJOR_T = " << std::setprecision(3) << std::fixed << grid_properties.dat << std::endl; // semi major of to system (MAJOR_T) + std::cout << " - MINOR_F = " << std::setprecision(3) << std::fixed << grid_properties.dbf << std::endl; // semi minor of from system (MINOR_F) + std::cout << " - MINOR_T = " << std::setprecision(3) << std::fixed << grid_properties.dbt << std::endl; // semi minor of to system (MINOR_T) + std::cout << " - NUM_OREC = " << grid_properties.iH_info << std::endl; // Number of header identifiers (NUM_OREC) + std::cout << " - NUM_SREC = " << grid_properties.iSubH_info << std::endl; // Number of sub-header idents (NUM_SREC) + std::cout << " - NUM_FILE = " << grid_properties.iNumsubgrids << std::endl; // number of subgrids in file (NUM_FILE) for (int i=0; icVar.IO_Status != ERR_TRANS_SUCCESS) return false; - cout << "+ Interpolation results for "; - cout << inputLatitude << ", " << inputLongitude; + std::cout << "+ Interpolation results for "; + std::cout << inputLatitude << ", " << inputLongitude; if (coordinate_format == DMS) - //cout << fixed << setprecision(6) << DegtoDms(apInterpolant->cVar.dLatitude) << ", " << DegtoDms(apInterpolant->cVar.dLongitude) << " (ddd.mmssss):" << endl; - cout << " (ddd.mmssss):" << endl; + //cout << std::fixed << std::setprecision(6) << DegtoDms(apInterpolant->cVar.dLatitude) << ", " << DegtoDms(apInterpolant->cVar.dLongitude) << " (ddd.mmssss):" << std::endl; + std::cout << " (ddd.mmssss):" << std::endl; else - //cout << fixed << setprecision(6) << apInterpolant->cVar.dLatitude << ", " << apInterpolant->cVar.dLongitude << " (ddd.dddddd):" << endl; - cout << " (ddd.dddddd):" << endl; + //cout << std::fixed << std::setprecision(6) << apInterpolant->cVar.dLatitude << ", " << apInterpolant->cVar.dLongitude << " (ddd.dddddd):" << std::endl; + std::cout << " (ddd.dddddd):" << std::endl; - cout << endl; - - cout << " N value = " << setw(6) << - right << setprecision(3) << apInterpolant->gVar.dN_value << " metres" << endl; // N value - cout << " Deflections:" << endl; - cout << " - Prime meridian = " << setw(6) << - right << fixed << setprecision(2) << apInterpolant->gVar.dDefl_meridian << " seconds" << endl; // N value - cout << " - Prime vertical = " << setw(6) << - right << apInterpolant->gVar.dDefl_primev << " seconds" << endl; // N value - cout << endl; + std::cout << std::endl; + + std::cout << " N value = " << std::setw(6) << + std::right << std::setprecision(3) << apInterpolant->gVar.dN_value << " metres" << std::endl; // N value + std::cout << " Deflections:" << std::endl; + std::cout << " - Prime meridian = " << std::setw(6) << + std::right << std::fixed << std::setprecision(2) << apInterpolant->gVar.dDefl_meridian << " seconds" << std::endl; // N value + std::cout << " - Prime vertical = " << std::setw(6) << + std::right << apInterpolant->gVar.dDefl_primev << " seconds" << std::endl; // N value + std::cout << std::endl; return true; } // InterpolateGridPoint @@ -306,9 +306,9 @@ bool InterpolateGridPoint(dna_geoid_interpolation* g, geoid_point* apInterpolant bool InterpolateGridPointFile(dna_geoid_interpolation* g, const char* inputfilePath, const int& method, const int EllipsoidtoOrtho, const int& coordinate_format, - bool exportDnaGeoidFile, const char* dnageofilePath, string& outputfilePath) + bool exportDnaGeoidFile, const char* dnageofilePath, std::string& outputfilePath) { - path inputFile(inputfilePath); + boost::filesystem::path inputFile(inputfilePath); if (inputFile.has_extension()) outputfilePath = inputFile.stem().string() + "_out" + inputFile.extension().string(); else @@ -326,7 +326,7 @@ bool InterpolateGridPointFile(dna_geoid_interpolation* g, const char* inputfileP exportDnaGeoidFile, dnageofilePath); } catch (const NetGeoidException& e) { - cout << endl << "- Error: " << e.what() << endl; + std::cout << std::endl << "- Error: " << e.what() << std::endl; return false; } @@ -335,7 +335,7 @@ bool InterpolateGridPointFile(dna_geoid_interpolation* g, const char* inputfileP } // InterpolateGridPointFile -bool InterpolateGridBinaryStationFile(dna_geoid_interpolation* g, const string& bstnfilePath, +bool InterpolateGridBinaryStationFile(dna_geoid_interpolation* g, const std::string& bstnfilePath, const int& method, bool convertHeights, bool exportDnaGeoidFile, const char* dnageofilePath) { @@ -344,7 +344,7 @@ bool InterpolateGridBinaryStationFile(dna_geoid_interpolation* g, const string& exportDnaGeoidFile, dnageofilePath); } catch (const NetGeoidException& e) { - cout << endl << "- Error: " << e.what() << endl; + std::cout << std::endl << "- Error: " << e.what() << std::endl; return false; } @@ -353,16 +353,16 @@ bool InterpolateGridBinaryStationFile(dna_geoid_interpolation* g, const string& } // InterpolateGridBinaryStationFile -string GetFileType(const string inputfilePath) +std::string GetFileType(const std::string inputfilePath) { - path inputFile(inputfilePath); + boost::filesystem::path inputFile(inputfilePath); if (inputFile.has_extension()) return inputFile.extension().string(); else return ""; } -int ParseCommandLineOptions(const int& argc, char* argv[], const variables_map& vm, project_settings& p) +int ParseCommandLineOptions(const int& argc, char* argv[], const boost::program_options::variables_map& vm, project_settings& p) { // capture command line arguments for (int cmd_arg(0); cmd_arg(p.g.output_folder, p.g.network_name, "dnaproj"); + p.g.project_file = formPath(p.g.output_folder, p.g.network_name, "dnaproj"); // define bst file name - p.n.bst_file = formPath(p.g.input_folder, p.g.network_name, "bst"); + p.n.bst_file = formPath(p.g.input_folder, p.g.network_name, "bst"); p.n.file_mode = 1; - if (!exists(p.n.bst_file)) + if (!boost::filesystem::exists(p.n.bst_file)) { // Look for it in the input folder - p.n.bst_file = formPath(p.g.input_folder, leafStr(p.n.bst_file)); + p.n.bst_file = formPath(p.g.input_folder, leafStr(p.n.bst_file)); - if (!exists(p.n.bst_file)) + if (!boost::filesystem::exists(p.n.bst_file)) { - cout << endl << "- Error: "; - cout << "Binary station file " << p.n.bst_file << " does not exist." << endl << endl; + std::cout << std::endl << "- Error: "; + std::cout << "Binary station file " << p.n.bst_file << " does not exist." << std::endl << std::endl; return EXIT_FAILURE; } } @@ -472,15 +472,15 @@ int ParseCommandLineOptions(const int& argc, char* argv[], const variables_map& // Geoid DAT grid file file location (input) if (vm.count(DAT_FILEPATH)) { - if (!exists(p.n.rdat_geoid_file)) + if (!boost::filesystem::exists(p.n.rdat_geoid_file)) { // Look for it in the input folder - p.n.rdat_geoid_file = formPath(p.g.input_folder, leafStr(p.n.rdat_geoid_file)); + p.n.rdat_geoid_file = formPath(p.g.input_folder, leafStr(p.n.rdat_geoid_file)); - if (!exists(p.n.rdat_geoid_file)) + if (!boost::filesystem::exists(p.n.rdat_geoid_file)) { - cout << endl << "- Error: "; - cout << "WINTER DAT grid file " << p.n.rdat_geoid_file << " does not exist." << endl << endl; + std::cout << std::endl << "- Error: "; + std::cout << "WINTER DAT grid file " << p.n.rdat_geoid_file << " does not exist." << std::endl << std::endl; return EXIT_FAILURE; } } @@ -492,15 +492,15 @@ int ParseCommandLineOptions(const int& argc, char* argv[], const variables_map& p.n.file_mode = 1; // Geoid DAT grid file file location (input) - if (!exists(p.n.input_file)) + if (!boost::filesystem::exists(p.n.input_file)) { // Look for it in the input folder - p.n.input_file = formPath(p.g.input_folder, leafStr(p.n.input_file)); + p.n.input_file = formPath(p.g.input_folder, leafStr(p.n.input_file)); - if (!exists(p.n.input_file)) + if (!boost::filesystem::exists(p.n.input_file)) { - cout << endl << "- Error: "; - cout << "Input coordinates text file " << leafStr(p.n.input_file) << " does not exist." << endl << endl; + std::cout << std::endl << "- Error: "; + std::cout << "Input coordinates text file " << leafStr(p.n.input_file) << " does not exist." << std::endl << std::endl; return EXIT_FAILURE; } } @@ -509,7 +509,7 @@ int ParseCommandLineOptions(const int& argc, char* argv[], const variables_map& if (vm.count(EXPORT_GEO_FILE)) { if (vm.count(NETWORK_NAME)) - p.n.geo_file = formPath(p.g.output_folder, p.g.network_name, "geo"); // dna geoid file + p.n.geo_file = formPath(p.g.output_folder, p.g.network_name, "geo"); // dna geoid file p.n.export_dna_geo_file = 1; } @@ -528,20 +528,20 @@ int ParseCommandLineOptions(const int& argc, char* argv[], const variables_map& int main(int argc, char* argv[]) { - variables_map vm; - positional_options_description positional_options; + boost::program_options::variables_map vm; + boost::program_options::positional_options_description positional_options; - options_description standard_options("+ " + string(ALL_MODULE_STDOPT), PROGRAM_OPTIONS_LINE_LENGTH); - options_description ntv2_options("+ " + string(GEOID_MODULE_NTV2), PROGRAM_OPTIONS_LINE_LENGTH); - options_description interpolate_options("+ " + string(GEOID_MODULE_INTERPOLATE), PROGRAM_OPTIONS_LINE_LENGTH); - options_description interactive_options("+ " + string(GEOID_MODULE_INTERACTIVE), PROGRAM_OPTIONS_LINE_LENGTH); - options_description file_interpolate_options("+ " + string(GEOID_MODULE_FILE), PROGRAM_OPTIONS_LINE_LENGTH); - options_description export_options("+ " + string(ALL_MODULE_EXPORT), PROGRAM_OPTIONS_LINE_LENGTH); - options_description generic_options("+ " + string(ALL_MODULE_GENERIC), PROGRAM_OPTIONS_LINE_LENGTH); - - string cmd_line_usage("+ "); + boost::program_options::options_description standard_options("+ " + std::string(ALL_MODULE_STDOPT), PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description ntv2_options("+ " + std::string(GEOID_MODULE_NTV2), PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description interpolate_options("+ " + std::string(GEOID_MODULE_INTERPOLATE), PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description interactive_options("+ " + std::string(GEOID_MODULE_INTERACTIVE), PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description file_interpolate_options("+ " + std::string(GEOID_MODULE_FILE), PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description export_options("+ " + std::string(ALL_MODULE_EXPORT), PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description generic_options("+ " + std::string(ALL_MODULE_GENERIC), PROGRAM_OPTIONS_LINE_LENGTH); + + std::string cmd_line_usage("+ "); cmd_line_usage.append(__BINARY_NAME__).append(" usage: ").append(__BINARY_NAME__).append(" [options]"); - options_description allowable_options(cmd_line_usage, PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description allowable_options(cmd_line_usage, PROGRAM_OPTIONS_LINE_LENGTH); n_file_par ntv2; ntv2.ptrIndex = new n_gridfileindex[1]; @@ -549,10 +549,10 @@ int main(int argc, char* argv[]) project_settings p; - string cmd_line_banner, gs_type("seconds"), version("1.0.0.0"), system_f("GDA94 "), system_t("AHD_1971"); - string subgridname("AUSGEOID"), parent(""), created(""), updated(""); + std::string cmd_line_banner, gs_type("seconds"), version("1.0.0.0"), system_f("GDA94 "), system_t("AHD_1971"); + std::string subgridname("AUSGEOID"), parent(""), created(""), updated(""); - string inputLatitude, inputLongitude; + std::string inputLatitude, inputLongitude; fileproc_help_header(&cmd_line_banner); p.g.project_file = ""; @@ -561,30 +561,30 @@ int main(int argc, char* argv[]) // Declare a group of options that will be // allowed only on command line standard_options.add_options() - (PROJECT_FILE_P, value(&p.g.project_file), + (PROJECT_FILE_P, boost::program_options::value(&p.g.project_file), "Project file name. Full path to project file. If none specified, a new file is created using input-folder and network-name.") - (NETWORK_NAME_N, value(&p.g.network_name), - string("Network name. If [" + string(NETWORK_NAME) + "].bst exists, all records within the binary station file will be populated with N value and deflections of the vertical.").c_str()) - (INPUT_FOLDER_I, value(&p.g.input_folder), + (NETWORK_NAME_N, boost::program_options::value(&p.g.network_name), + std::string("Network name. If [" + std::string(NETWORK_NAME) + "].bst exists, all records within the binary station file will be populated with N value and deflections of the vertical.").c_str()) + (INPUT_FOLDER_I, boost::program_options::value(&p.g.input_folder), "Path containing all input files.") - (OUTPUT_FOLDER_O, value(&p.g.output_folder), // default is ./, + (OUTPUT_FOLDER_O, boost::program_options::value(&p.g.output_folder), // default is ./, "Path for all output files.") ; interpolate_options.add_options() (INTERACTIVE_E, "Interpolate geoid information using coordinates provided on the command line.") - (INPUT_FILE_T, value(&p.n.input_file), + (INPUT_FILE_T, boost::program_options::value(&p.n.input_file), "Interpolate geoid information using coordinates contained in a text file. " "arg is the path of the input text file. " "The supported text file formats include formatted text (*.txt) and comma separated values (*.csv) files. " "Refer to the User's Guide for file format information.") - (METHOD_M, value(&p.n.interpolation_method), + (METHOD_M, boost::program_options::value(&p.n.interpolation_method), "Interpolation method.\n 0 Bi-linear\n 1 Bi-cubic (default)") (CONVERT_BST_HT, "DEPRECATED. If a user-supplied height in the binary file is orthometric, the height will be converted to ellipsoidal automatically.") (DDEG_FORMAT, "Specify input coordinates in decimal degrees (dd.dddddd). Default is degrees, minutes and seconds (dd.mmssss).") (CREATE_NTV2_C, "Create NTv2 grid file from standard DAT file.") - (NTV2_FILEPATH_G, value(&p.n.ntv2_geoid_file), "Full file path of the NTv2 grid file.") + (NTV2_FILEPATH_G, boost::program_options::value(&p.n.ntv2_geoid_file), "Full file path of the NTv2 grid file.") (SUMMARY_U, "Print a summary of the grid file.") ; @@ -592,41 +592,41 @@ int main(int argc, char* argv[]) // allowed both on command line and in // config file ntv2_options.add_options() - (DAT_FILEPATH_D, value(&p.n.rdat_geoid_file), + (DAT_FILEPATH_D, boost::program_options::value(&p.n.rdat_geoid_file), "File path of the WINTER DAT grid file.") - (NTV2_GS_TYPE, value(&gs_type), + (NTV2_GS_TYPE, boost::program_options::value(&gs_type), "Units in which the grid parameters and deflections of the vertical will be stored. arg is either 'seconds' or 'radians'. Default is seconds.") - (NTV2_VERSION, value(&version), + (NTV2_VERSION, boost::program_options::value(&version), "Grid file version. Default is 1.0.0.0.") - (NTV2_SYSTEM_F, value(&system_f), + (NTV2_SYSTEM_F, boost::program_options::value(&system_f), "The 'From' reference system. Default is GDA94.") - (NTV2_SYSTEM_T, value(&system_t), + (NTV2_SYSTEM_T, boost::program_options::value(&system_t), "The 'To' reference system. Default is AHD_1971") - (NTV2_MAJOR_F, value(&ntv2.daf), + (NTV2_MAJOR_F, boost::program_options::value(&ntv2.daf), "Semi major of 'From' system. Default is 6378137.000") - (NTV2_MAJOR_T, value(&ntv2.dat), + (NTV2_MAJOR_T, boost::program_options::value(&ntv2.dat), "Semi major of 'To' system. Default is 6378137.000") - (NTV2_MINOR_F, value(&ntv2.dbf), + (NTV2_MINOR_F, boost::program_options::value(&ntv2.dbf), "Semi minor of 'From' system. Default is 6356752.314") - (NTV2_MINOR_T, value(&ntv2.dbt), + (NTV2_MINOR_T, boost::program_options::value(&ntv2.dbt), "Semi minor of 'To' system. Default is 6356752.314") - (NTV2_SUB_NAME, value(&subgridname), + (NTV2_SUB_NAME, boost::program_options::value(&subgridname), "The name of the sub-grid. Default is AUSGEOID") - (NTV2_CREATED, value(&created), + (NTV2_CREATED, boost::program_options::value(&created), "Date of geoid model creation. arg is a dot delimited string \"dd.mm.yyyy\". Default is today's date if no value is supplied.") - (NTV2_UPDATED, value(&updated), + (NTV2_UPDATED, boost::program_options::value(&updated), "Date of last file update. arg is a dot delimited string \"dd.mm.yyyy\". Default is today's date if no value is supplied.") ; interactive_options.add_options() - (LATITUDE, value(&inputLatitude), + (LATITUDE, boost::program_options::value(&inputLatitude), "Latitude of the interpolant. Default is degrees, minutes and seconds (dd.mmssss).") - (LONGITUDE, value(&inputLongitude), + (LONGITUDE, boost::program_options::value(&inputLongitude), "Longitude of the interpolant. Default is degrees, minutes and seconds (dd.mmssss).") ; file_interpolate_options.add_options() - (DIRECTION_R, value(&p.n.ellipsoid_to_ortho), + (DIRECTION_R, boost::program_options::value(&p.n.ellipsoid_to_ortho), "Conversion of heights:\n 0 Orthometric to ellipsoid (default)\n 1 Ellipsoid to orthometric") ; @@ -643,13 +643,13 @@ int main(int argc, char* argv[]) ; generic_options.add_options() - (VERBOSE, value(&p.g.verbose), - string("When importing geoid information into a project, print the stations for which an N-value could not be interpolated to a log (*.int) file.\n 0: No information (default)\n 1: Helpful information\n 2: Extended information").c_str()) + (VERBOSE, boost::program_options::value(&p.g.verbose), + std::string("When importing geoid information into a project, print the stations for which an N-value could not be interpolated to a log (*.int) file.\n 0: No information (default)\n 1: Helpful information\n 2: Extended information").c_str()) (QUIET, - string("Suppresses all explanation of what ").append(__BINARY_NAME__).append(" is doing unless an error occurs").c_str()) + std::string("Suppresses all explanation of what ").append(__BINARY_NAME__).append(" is doing unless an error occurs").c_str()) (VERSION_V, "Display the current program version") (HELP_H, "Show this help message") - (HELP_MODULE, value(), + (HELP_MODULE_H, boost::program_options::value(), "Provide help for a specific help category.") ; @@ -658,70 +658,70 @@ int main(int argc, char* argv[]) // add "positional options" to handle command line tokens which have no option name positional_options.add(NETWORK_NAME, -1); - command_line_parser parser(argc, argv); + boost::program_options::command_line_parser parser(argc, argv); store(parser.options(allowable_options).positional(positional_options).run(), vm); notify(vm); } catch (const std::exception& e) { - cout << endl << "- Error: " << e.what() << endl; - cout << cmd_line_banner << allowable_options << endl; + std::cout << std::endl << "- Error: " << e.what() << std::endl; + std::cout << cmd_line_banner << allowable_options << std::endl; return EXIT_FAILURE; } catch (...) { - cout << endl << "- Exception of unknown type!\n"; + std::cout << std::endl << "- Exception of unknown type!\n"; return EXIT_FAILURE; } if (argc < 2) { - cout << endl << "- Nothing to do - no options provided. " << endl << endl; - cout << cmd_line_banner << allowable_options << endl; + std::cout << std::endl << "- Nothing to do - no options provided. " << std::endl << std::endl; + std::cout << cmd_line_banner << allowable_options << std::endl; return EXIT_FAILURE; } if (vm.count(VERSION)) { - cout << cmd_line_banner << endl; + std::cout << cmd_line_banner << std::endl; return EXIT_SUCCESS; } if (vm.count(HELP)) { - cout << cmd_line_banner << allowable_options << endl; + std::cout << cmd_line_banner << allowable_options << std::endl; return EXIT_SUCCESS; } if (vm.count(HELP_MODULE)) { - cout << cmd_line_banner; - string original_text = vm[HELP_MODULE].as(); - string help_text = str_upper(original_text); + std::cout << cmd_line_banner; + std::string original_text = vm[HELP_MODULE].as(); + std::string help_text = str_upper(original_text); - if (str_upper(ALL_MODULE_STDOPT).find(help_text) != string::npos) { - cout << standard_options << endl; + if (str_upper(ALL_MODULE_STDOPT).find(help_text) != std::string::npos) { + std::cout << standard_options << std::endl; } - else if (str_upper(GEOID_MODULE_NTV2).find(help_text) != string::npos) { - cout << ntv2_options << endl; + else if (str_upper(GEOID_MODULE_NTV2).find(help_text) != std::string::npos) { + std::cout << ntv2_options << std::endl; } - else if (str_upper(GEOID_MODULE_INTERPOLATE).find(help_text) != string::npos) { - cout << interpolate_options << endl; + else if (str_upper(GEOID_MODULE_INTERPOLATE).find(help_text) != std::string::npos) { + std::cout << interpolate_options << std::endl; } - else if (str_upper(GEOID_MODULE_INTERACTIVE).find(help_text) != string::npos) { - cout << interactive_options << endl; + else if (str_upper(GEOID_MODULE_INTERACTIVE).find(help_text) != std::string::npos) { + std::cout << interactive_options << std::endl; } - else if (str_upper(GEOID_MODULE_FILE).find(help_text) != string::npos) { - cout << file_interpolate_options << endl; + else if (str_upper(GEOID_MODULE_FILE).find(help_text) != std::string::npos) { + std::cout << file_interpolate_options << std::endl; } - else if (str_upper(ALL_MODULE_EXPORT).find(help_text) != string::npos) { - cout << export_options << endl; + else if (str_upper(ALL_MODULE_EXPORT).find(help_text) != std::string::npos) { + std::cout << export_options << std::endl; } - else if (str_upper(ALL_MODULE_GENERIC).find(help_text) != string::npos) { - cout << generic_options << endl; + else if (str_upper(ALL_MODULE_GENERIC).find(help_text) != std::string::npos) { + std::cout << generic_options << std::endl; } else { - cout << endl << "- Error: Help module '" << - original_text << "' is not in the list of options." << endl; + std::cout << std::endl << "- Error: Help module '" << + original_text << "' is not in the list of options." << std::endl; return EXIT_FAILURE; } @@ -740,39 +740,39 @@ int main(int argc, char* argv[]) // grid file path not supplied. Generate name from dat file if (p.n.ntv2_geoid_file.empty()) { - path gsbFile(p.n.rdat_geoid_file); + boost::filesystem::path gsbFile(p.n.rdat_geoid_file); p.n.ntv2_geoid_file = gsbFile.stem().string() + gsbFile.extension().string() + ".gsb"; strcpy(ntv2.filename, p.n.ntv2_geoid_file.c_str()); strcpy(ntv2.filetype, GSB); } else { - string extension(GetFileType(p.n.ntv2_geoid_file)); + std::string extension(GetFileType(p.n.ntv2_geoid_file)); if (extension.empty()) { - cout << endl << "- Error: NTv2 grid file type cannot be determined from a file without a file extension. " << endl << endl; + std::cout << std::endl << "- Error: NTv2 grid file type cannot be determined from a file without a file extension. " << std::endl << std::endl; return EXIT_FAILURE; } - if (!iequals(extension.substr(1), GSB) && - !iequals(extension.substr(1), ASC)) + if (!boost::iequals(extension.substr(1), GSB) && + !boost::iequals(extension.substr(1), ASC)) { - cout << endl << "- Error: NTv2 grid file type cannot be determined from file extension \"" << extension << "\"." << endl << - " Supported types are ." << GSB << " and ." << ASC << " only." << endl << endl; + std::cout << std::endl << "- Error: NTv2 grid file type cannot be determined from file extension \"" << extension << "\"." << std::endl << + " Supported types are ." << GSB << " and ." << ASC << " only." << std::endl << std::endl; return EXIT_FAILURE; } if (vm.count(EXPORT_NTV2_ASCII_FILE) && - iequals(extension.substr(1), ASC)) + boost::iequals(extension.substr(1), ASC)) { - cout << endl << "- Error: Export to ASCII NTv2 grid file option only supported for " << GSB " grid files." << endl << endl; + std::cout << std::endl << "- Error: Export to ASCII NTv2 grid file option only supported for " << GSB " grid files." << std::endl << std::endl; return EXIT_FAILURE; } if (vm.count(EXPORT_NTV2_BINARY_FILE) && - iequals(extension.substr(1), GSB)) + boost::iequals(extension.substr(1), GSB)) { - cout << endl << "- Error: Export to Binary NTv2 grid file option only supported for " << ASC " grid files." << endl << endl; + std::cout << std::endl << "- Error: Export to Binary NTv2 grid file option only supported for " << ASC " grid files." << std::endl << std::endl; return EXIT_FAILURE; } @@ -787,145 +787,145 @@ int main(int argc, char* argv[]) { gs_type = trimstr(gs_type); // Unknown type? - if (!iequals(gs_type, "seconds") && !iequals(gs_type, "radians")) + if (!boost::iequals(gs_type, "seconds") && !boost::iequals(gs_type, "radians")) gs_type = "seconds"; str_toupper(gs_type); } if (!p.g.quiet) { - cout << endl << cmd_line_banner; + std::cout << std::endl << cmd_line_banner; - cout << "+ Options:" << endl; + std::cout << "+ Options:" << std::endl; if (vm.count(NETWORK_NAME)) - cout << setw(PRINT_VAR_PAD) << left << " Network name: " << p.g.network_name << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Network name: " << p.g.network_name << std::endl; if (p.n.file_mode || vm.count(CREATE_NTV2)) { - cout << setw(PRINT_VAR_PAD) << left << " Input folder: " << p.g.input_folder << endl; - cout << setw(PRINT_VAR_PAD) << left << " Output folder: " << p.g.output_folder << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Input folder: " << p.g.input_folder << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Output folder: " << p.g.output_folder << std::endl; if (!p.n.bst_file.empty()) { - cout << setw(PRINT_VAR_PAD) << left << " Binary station file: " << p.n.bst_file << endl; - //cout << setw(PRINT_VAR_PAD) << left << " Convert orthometric heights: "; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Binary station file: " << p.n.bst_file << std::endl; + //cout << std::setw(PRINT_VAR_PAD) << std::left << " Convert orthometric heights: "; //if (p.n.convert_heights) - // cout << "Yes" << endl; + // std::cout << "Yes" << std::endl; //else - // cout << "No" << endl; + // std::cout << "No" << std::endl; } if (!p.n.input_file.empty()) - cout << setw(PRINT_VAR_PAD) << left << " ASCII file: " << p.n.input_file << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " ASCII file: " << p.n.input_file << std::endl; } - cout << setw(PRINT_VAR_PAD) << left << " Geoid grid file: " << ntv2.filename << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Geoid grid file: " << ntv2.filename << std::endl; // Not applicable for project file use if (vm.count(CREATE_NTV2)) { - cout << setw(PRINT_VAR_PAD) << left << " WINTER DAT file: " << leafStr(p.n.rdat_geoid_file) << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " WINTER DAT file: " << leafStr(p.n.rdat_geoid_file) << std::endl; if (vm.count(NTV2_GS_TYPE)) - cout << setw(PRINT_VAR_PAD) << left << " Grid shift type: " << gs_type.c_str() << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Grid shift type: " << gs_type.c_str() << std::endl; if (vm.count(NTV2_VERSION)) - cout << setw(PRINT_VAR_PAD) << left << " Grid file version: " << version.c_str() << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Grid file version: " << version.c_str() << std::endl; if (vm.count(NTV2_SYSTEM_F)) - cout << setw(PRINT_VAR_PAD) << left << " From reference system: " << system_f.c_str() << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " From reference system: " << system_f.c_str() << std::endl; if (vm.count(NTV2_SYSTEM_T)) - cout << setw(PRINT_VAR_PAD) << left << " To reference system: " << system_t.c_str() << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " To reference system: " << system_t.c_str() << std::endl; if (vm.count(NTV2_MAJOR_F)) - cout << setw(PRINT_VAR_PAD) << left << " From semi-major: " << fixed << setprecision(3) << ntv2.daf << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " From semi-major: " << std::fixed << std::setprecision(3) << ntv2.daf << std::endl; if (vm.count(NTV2_MAJOR_T)) - cout << setw(PRINT_VAR_PAD) << left << " To semi-major: " << ntv2.dat << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " To semi-major: " << ntv2.dat << std::endl; if (vm.count(NTV2_MINOR_F)) - cout << setw(PRINT_VAR_PAD) << left << " From semi-minor: " << ntv2.dbf << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " From semi-minor: " << ntv2.dbf << std::endl; if (vm.count(NTV2_MINOR_T)) - cout << setw(PRINT_VAR_PAD) << left << " To semi-minor: " << ntv2.dbt << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " To semi-minor: " << ntv2.dbt << std::endl; if (vm.count(NTV2_SUB_NAME)) - cout << setw(PRINT_VAR_PAD) << left << " Sub-grid name: " << subgridname.c_str() << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Sub-grid name: " << subgridname.c_str() << std::endl; - date creationDate, updateDate; + boost::gregorian::date creationDate, updateDate; if (created.empty()) created = "today"; if (updated.empty()) updated = "today"; - creationDate = dateFromString(created); - updateDate = dateFromString(updated); + creationDate = dateFromString(created); + updateDate = dateFromString(updated); // Print dates by default //if (vm.count(NTV2_CREATED)) - cout << setw(PRINT_VAR_PAD) << left << " Date of file creation: " << - stringFromDate(creationDate, "%d %B %Y") << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Date of file creation: " << + stringFromDate(creationDate, "%d %B %Y") << std::endl; //if (vm.count(NTV2_UPDATED)) - cout << setw(PRINT_VAR_PAD) << left << " Date of file update: " << - stringFromDate(updateDate, "%d %B %Y") << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Date of file update: " << + stringFromDate(updateDate, "%d %B %Y") << std::endl; - created = stringFromDate(creationDate, "%d%m%Y"); - updated = stringFromDate(updateDate, "%d%m%Y"); + created = stringFromDate(creationDate, "%d%m%Y"); + updated = stringFromDate(updateDate, "%d%m%Y"); } if (vm.count(EXPORT_NTV2_ASCII_FILE) || vm.count(EXPORT_NTV2_BINARY_FILE)) { - cout << setw(PRINT_VAR_PAD) << left << " Export NTv2 grid file to: "; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Export NTv2 grid file to: "; if (vm.count(EXPORT_NTV2_ASCII_FILE)) - cout << "ASCII (." << ASC << ")" << endl; + std::cout << "ASCII (." << ASC << ")" << std::endl; if (vm.count(EXPORT_NTV2_BINARY_FILE)) - cout << "Binary (." << GSB << ")" << endl; + std::cout << "Binary (." << GSB << ")" << std::endl; if (vm.count(NTV2_GS_TYPE)) - cout << setw(PRINT_VAR_PAD) << left << " Grid shift type: " << gs_type.c_str() << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Grid shift type: " << gs_type.c_str() << std::endl; } if (p.n.file_mode || vm.count(INTERACTIVE)) { - cout << setw(PRINT_VAR_PAD) << left << " Interpolation method: "; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Interpolation method: "; if (p.n.interpolation_method == BICUBIC) - cout << "Bi-cubic" << endl; + std::cout << "Bi-cubic" << std::endl; else - cout << "Bi-linear" << endl; + std::cout << "Bi-linear" << std::endl; - cout << setw(PRINT_VAR_PAD) << left << " Input coordinate format: "; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Input coordinate format: "; if (p.n.coordinate_format == DDEG) - cout << "Decimal degrees" << endl; + std::cout << "Decimal degrees" << std::endl; else - cout << "Degrees minutes seconds" << endl; + std::cout << "Degrees minutes seconds" << std::endl; if (!vm.count(INTERACTIVE)) { - cout << setw(PRINT_VAR_PAD) << left << " Transformation direction: "; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Transformation direction: "; if (p.n.ellipsoid_to_ortho == 0) - cout << "Orthometric to ellipsoid" << endl; + std::cout << "Orthometric to ellipsoid" << std::endl; else - cout << "Ellipsoid to orthometric" << endl; + std::cout << "Ellipsoid to orthometric" << std::endl; } } if (p.n.export_dna_geo_file) - cout << setw(PRINT_VAR_PAD) << left << " Export to DNA geoid file: " << "Yes" << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Export to DNA geoid file: " << "Yes" << std::endl; - cout << endl; + std::cout << std::endl; if (vm.count(CONVERT_BST_HT)) - cout << "- Warning: The '--" << CONVERT_BST_HT << "' option has been deprecated. Orthometric" << endl << - " heights in the binary file will be converted to ellipsoidal by default, " << endl << - " unless the transformation direction has been modified by supplying the " << endl << - " '--" << DIRECTION << "' option with an argument of 1." << endl; + std::cout << "- Warning: The '--" << CONVERT_BST_HT << "' option has been deprecated. Orthometric" << std::endl << + " heights in the binary file will be converted to ellipsoidal by default, " << std::endl << + " unless the transformation direction has been modified by supplying the " << std::endl << + " '--" << DIRECTION << "' option with an argument of 1." << std::endl; - cout << endl; + std::cout << std::endl; // File interpolation mode... if (p.n.file_mode) { if (!p.n.bst_file.empty()) - cout << "+ Binary station file interpolation mode." << endl << endl; + std::cout << "+ Binary station file interpolation mode." << std::endl << std::endl; else - cout << "+ ASCII file interpolation mode." << endl << endl; + std::cout << "+ ASCII file interpolation mode." << std::endl << std::endl; } } @@ -961,7 +961,7 @@ int main(int argc, char* argv[]) if (ntv2.ptrIndex) delete [] ntv2.ptrIndex; - cout << endl << "+ Geoid file creation completed successfully." << endl << endl; + std::cout << std::endl << "+ Geoid file creation completed successfully." << std::endl << std::endl; return EXIT_SUCCESS; } @@ -969,7 +969,7 @@ int main(int argc, char* argv[]) { if (p.n.ntv2_geoid_file.empty()) { - cout << endl << "- Error: No NTv2 grid file specified. " << endl << endl; + std::cout << std::endl << "- Error: No NTv2 grid file specified. " << std::endl << std::endl; return EXIT_FAILURE; } @@ -979,7 +979,7 @@ int main(int argc, char* argv[]) if (!ExportNTv2GridToAscii(&g, ntv2.filename, ntv2.filetype, ntv2.chGs_type, ASC)) return EXIT_FAILURE; - cout << "+ Geoid file creation completed successfully." << endl << endl; + std::cout << "+ Geoid file creation completed successfully." << std::endl << std::endl; return EXIT_SUCCESS; } @@ -987,7 +987,7 @@ int main(int argc, char* argv[]) { if (p.n.ntv2_geoid_file.empty()) { - cout << endl << "- Error: No NTv2 grid file specified. " << endl << endl; + std::cout << std::endl << "- Error: No NTv2 grid file specified. " << std::endl << std::endl; return EXIT_FAILURE; } @@ -997,7 +997,7 @@ int main(int argc, char* argv[]) if (!ExportNTv2GridToBinary(&g, ntv2.filename, ntv2.filetype, ntv2.chGs_type, GSB)) return EXIT_FAILURE; - cout << "+ Geoid file creation completed successfully." << endl << endl; + std::cout << "+ Geoid file creation completed successfully." << std::endl << std::endl; return EXIT_SUCCESS; } @@ -1018,7 +1018,7 @@ int main(int argc, char* argv[]) apInterpolant.cVar.dLatitude = DoubleFromString(inputLatitude); apInterpolant.cVar.dLongitude = DoubleFromString(inputLongitude); - stringstream ssInput; + std::stringstream ssInput; ssInput << inputLatitude << ", " << inputLongitude; g.SetInputCoordinates(ssInput.str()); @@ -1035,7 +1035,7 @@ int main(int argc, char* argv[]) if (!InterpolateGridPoint(&g, &apInterpolant, p.n.interpolation_method, p.n.coordinate_format, inputLatitude, inputLongitude)) { - cout << endl; + std::cout << std::endl; if (apInterpolant.cVar.IO_Status == ERR_FINDSUBGRID_OUTSIDE) reportGridProperties(&g, ntv2.filename, ntv2.filetype); @@ -1054,19 +1054,19 @@ int main(int argc, char* argv[]) if (!p.g.quiet) { - cout << "+ Interpolating geoid components"; + std::cout << "+ Interpolating geoid components"; if (!p.n.bst_file.empty() && p.n.convert_heights) - cout << " and reducing" << endl << + std::cout << " and reducing" << std::endl << " heights to the ellipsoid"; - cout << "... "; + std::cout << "... "; } - cpu_timer time; + boost::timer::cpu_timer time; char dnageoFile[601], *geoFileptr; geoFileptr = NULL; memset(dnageoFile, '\0', sizeof(dnageoFile)); - string outputfilePath; + std::string outputfilePath; if (!p.n.geo_file.empty()) { @@ -1096,52 +1096,52 @@ int main(int argc, char* argv[]) if (!p.g.quiet) { - cout << "done." << endl; - cout << "+ Interpolated data for " << g.PointsInterpolated(); + std::cout << "done." << std::endl; + std::cout << "+ Interpolated data for " << g.PointsInterpolated(); if (g.PointsInterpolated() == 1) - cout << " point." << endl; + std::cout << " point." << std::endl; else - cout << " points." << endl; + std::cout << " points." << std::endl; if (g.PointsNotInterpolated() > 0) { - cout << "- Warning: Data for " << g.PointsNotInterpolated(); + std::cout << "- Warning: Data for " << g.PointsNotInterpolated(); // Is this wrapper being called to update DynAdjust station file? if (!p.n.bst_file.empty()) { if (g.PointsNotInterpolated() == 1) - cout << " station"; + std::cout << " station"; else - cout << " stations"; + std::cout << " stations"; - cout << " could not be interpolated. "; + std::cout << " could not be interpolated. "; if (p.g.verbose > 0) { try { ReturnBadStationRecords(&g, p); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { // print error message, and continue - cout << "- Error: " << e.what() << endl; + std::cout << "- Error: " << e.what() << std::endl; } } else - cout << "To view the list of stations " << endl << - " for which an N-value could not be interpolated, call " << __BINARY_NAME__ << " with --verbose-level 1." << endl; + std::cout << "To view the list of stations " << std::endl << + " for which an N-value could not be interpolated, call " << __BINARY_NAME__ << " with --verbose-level 1." << std::endl; } // If this point is reached, then this wrapper must have been called // to interpolate points in interactive mode. else //if (!p.n.input_file.empty()) { if (g.PointsNotInterpolated() == 1) - cout << " point"; + std::cout << " point"; else - cout << " points"; + std::cout << " points"; - cout << " could not be interpolated." << endl; - cout << " See " << outputfilePath << " for more information." << endl; + std::cout << " could not be interpolated." << std::endl; + std::cout << " See " << outputfilePath << " for more information." << std::endl; } } } @@ -1151,7 +1151,7 @@ int main(int argc, char* argv[]) if (userSuppliedProjectFile) { CDnaProjectFile projectFile; - if (exists(p.g.project_file)) + if (boost::filesystem::exists(p.g.project_file)) projectFile.LoadProjectFile(p.g.project_file); // Print the project file. If it doesn't exist, it will be created. @@ -1163,9 +1163,9 @@ int main(int argc, char* argv[]) return EXIT_SUCCESS; // wall time is in nanoseconds - // cout << time.elapsed().wall << endl << endl; - milliseconds elapsed_time(milliseconds(time.elapsed().wall/MILLI_TO_NANO)); - cout << endl << formatedElapsedTime(&elapsed_time, "+ Geoid file interpolation took ") << endl << endl; + // cout << time.elapsed().wall << std::endl << std::endl; + boost::posix_time::milliseconds elapsed_time(boost::posix_time::milliseconds(time.elapsed().wall/MILLI_TO_NANO)); + std::cout << std::endl << formatedElapsedTime(&elapsed_time, "+ Geoid file interpolation took ") << std::endl << std::endl; return EXIT_SUCCESS; } \ No newline at end of file diff --git a/dynadjust/dynadjust/dnageoidwrapper/dnageoidwrapper.hpp b/dynadjust/dynadjust/dnageoidwrapper/dnageoidwrapper.hpp index 63be2258..d963e91b 100644 --- a/dynadjust/dynadjust/dnageoidwrapper/dnageoidwrapper.hpp +++ b/dynadjust/dynadjust/dnageoidwrapper/dnageoidwrapper.hpp @@ -69,27 +69,18 @@ #include -using namespace std; -using namespace boost; -using namespace boost::filesystem; -using namespace boost::timer; -using namespace boost::posix_time; -using namespace boost::gregorian; -using namespace boost::program_options; -namespace po = boost::program_options; - using namespace dynadjust::geoidinterpolation; bool CreateNTv2Grid(dna_geoid_interpolation* g, const char* dat_gridfilePath, const n_file_par* grid); bool createGridIndex(dna_geoid_interpolation* g, const char* gridfilePath, const char* gridfileType, const int& quiet); bool reportGridProperties(dna_geoid_interpolation* g, const char* gridfilePath, const char* gridfileType); bool InterpolateGridPoint(dna_geoid_interpolation* g, const char* gridfilePath, geoid_point* apInterpolant, - const int& method, const int& coordinate_format, const string& inputLatitude, const string& inputLongitude); + const int& method, const int& coordinate_format, const std::string& inputLatitude, const std::string& inputLongitude); bool InterpolateGridPointFile(dna_geoid_interpolation* g, const char* inputfilePath, const int& method, const int EllipsoidtoOrtho, const int& coordinate_format, - bool exportDnaGeoidFile, const char* dnageofilePath, string& outputfilePath); -bool InterpolateGridBinaryStationFile(dna_geoid_interpolation* g, const string& bstnfilePath, + bool exportDnaGeoidFile, const char* dnageofilePath, std::string& outputfilePath); +bool InterpolateGridBinaryStationFile(dna_geoid_interpolation* g, const std::string& bstnfilePath, const int& method, bool convertHeights, bool exportDnaGeoidFile, const char* dnageofilePath); -int ParseCommandLineOptions(const int& argc, char* argv[], const variables_map& vm, project_settings& p); +int ParseCommandLineOptions(const int& argc, char* argv[], const boost::program_options::variables_map& vm, project_settings& p); #endif \ No newline at end of file diff --git a/dynadjust/dynadjust/dnaimport/dnainterop.cpp b/dynadjust/dynadjust/dnaimport/dnainterop.cpp index 32750b27..ab02e86d 100644 --- a/dynadjust/dynadjust/dnaimport/dnainterop.cpp +++ b/dynadjust/dynadjust/dnaimport/dnainterop.cpp @@ -28,8 +28,6 @@ #include using namespace dynadjust::epsg; -using namespace boost::gregorian; -using namespace boost::posix_time; MsrTally g_map_tally; MsrTally g_parsemsr_tally; @@ -128,15 +126,15 @@ void dna_import::DetermineBoundingBox() bbox_lowerLon_ = DmstoRad(bbox_lowerLon_); } -void dna_import::BuildExtractStationsList(const string& stnList, pvstring vstnList) +void dna_import::BuildExtractStationsList(const std::string& stnList, pvstring vstnList) { // Extract stations from comma delimited string try { - SplitDelimitedString(stnList, string(","), vstnList); + SplitDelimitedString(stnList, std::string(","), vstnList); } catch (...) { - stringstream ss; - ss << "BuildExtractStationsList(): An error was encountered when parsing " << stnList << "." << endl; + std::stringstream ss; + ss << "BuildExtractStationsList(): An error was encountered when parsing " << stnList << "." << std::endl; SignalExceptionParse(ss.str(), 0); } @@ -150,7 +148,7 @@ void dna_import::BuildExtractStationsList(const string& stnList, pvstring vstnLi it_string_pair _it_discont_ren; _it_vstr _it_stn; - string station_name; + std::string station_name; vstring renamed_stations; // loop through all station names in vstnList @@ -164,7 +162,7 @@ void dna_import::BuildExtractStationsList(const string& stnList, pvstring vstnLi // Advance through _it_discont_ren for all occurrences of station_name while ((_it_discont_ren = lower_bound(_it_discont_ren, stn_renamed_.end(), - station_name, ComparePairFirst())) != stn_renamed_.end()) + station_name, ComparePairFirst())) != stn_renamed_.end()) { // found a station that has been renamed. // add the discontinuity name to the list @@ -182,49 +180,18 @@ void dna_import::BuildExtractStationsList(const string& stnList, pvstring vstnLi } -void dna_import::UpdateEpoch(const vifm_t* vinput_file_meta) -{ - // Inspect the first file that was loaded. - // Assume that the epoch in that file is the desired epoch. - - string epoch(""); - - if (vinput_file_meta->empty()) - // Do nothing - return; - - epoch = vinput_file_meta->at(0).epoch; - - if (epoch.empty()) - // Do nothing - return; - - if (dateFromString(epoch) == timeImmemorial()) - epoch = ""; - - m_strProjectDefaultEpoch = epoch; - - // Set default epoch - datum_.SetEpoch(epoch); - - // Update bst and bms files accordingly - sprintf(bst_meta_.epoch, "%s", epoch.substr(0, STN_EPOCH_WIDTH).c_str()); - sprintf(bms_meta_.epoch, "%s", epoch.substr(0, STN_EPOCH_WIDTH).c_str()); -} - - -void dna_import::InitialiseDatum(const string& reference_frame) +void dna_import::InitialiseDatum(const std::string& reference_frame, const std::string epoch) { try { // Take the default reference frame, set either by the user or // the datum_ constructor (GDA2020). Epoch is that of the default // reference frame (indicated by "") - datum_.SetDatumFromName(reference_frame, ""); + datum_.SetDatumFromName(reference_frame, epoch); } - catch (const runtime_error& e) { - stringstream ss; - ss << "InitialiseDatum(): An error occurred while initialising " << endl << " the default reference frame. Details:" << endl << - " " << e.what() << endl; + catch (const std::runtime_error& e) { + std::stringstream ss; + ss << "InitialiseDatum(): An error occurred while initialising " << std::endl << " the default reference frame. Details:" << std::endl << + " " << e.what() << std::endl; SignalExceptionParse(ss.str(), 0); } @@ -232,17 +199,19 @@ void dna_import::InitialiseDatum(const string& reference_frame) m_strProjectDefaultEpsg = datum_.GetEpsgCode_s(); m_strProjectDefaultEpoch = datum_.GetEpoch_s(); - if (datum_.GetEpoch() == timeImmemorial()) + if (datum_.GetEpoch() == timeImmemorial()) m_strProjectDefaultEpoch = ""; // Update binary file meta - // Note: the following rule applies each time a new file is loaded: - // * This method (InitialiseDatum) is called (from dnaimportwrapper) before any files are loaded - // * By default, the bst & bms meta is initialised with the reference frame and reference epoch. - // * As each file is loaded, the frame and epoch from the files are captured from the header - // * Once all files have been loaded, UpdateEpoch() is called to update the default epoch, with the - // assumption that the first file contains the epoch that is to be used for the default, e.g. SINEX file. - // * DynAdjust will not attempt to reconcile multiple default epochs found across the input files + // Note: the following rule applies each time a set of files is loaded via import: + // * This method (InitialiseDatum) is called (from dnaimportwrapper) before any files are loaded. + // By default, the bst & bms meta are initialised with the reference frame and reference epoch. + // * The datum and epoch within the first file (if present) is used to set the default project + // datum. If a datum isn't provided in the first input file, e.g. SINEX file, the default datum + // (GDA2020) is used. As each subsequent file is loaded, the default frame and epoch are assumed. + // * After all files have been loaded, InitialiseDatum is called again to set the metadata. + // * import does not attempt to reconcile multiple default datums and epochs found across the input + // files. It will however produce a warning when something different to the default is discovered. sprintf(bst_meta_.epsgCode, "%s", m_strProjectDefaultEpsg.substr(0, STN_EPSG_WIDTH).c_str()); sprintf(bms_meta_.epsgCode, "%s", m_strProjectDefaultEpsg.substr(0, STN_EPSG_WIDTH).c_str()); sprintf(bst_meta_.epoch, "%s", m_strProjectDefaultEpoch.substr(0, STN_EPOCH_WIDTH).c_str()); @@ -250,102 +219,10 @@ void dna_import::InitialiseDatum(const string& reference_frame) } -// // DynaXML, dna v.1-2 and sinex file formats do not contain reference frame information, so -// // by default the reference frame for all stations is set to GDA2020. -// // This function is called to modify the default frame to a user-specified frame -// void dna_import::SetDefaultReferenceFrame(vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements) -// { -// // Default is GDA2020. -// switch (m_ift) -// { -// case sinex: // SNX -// // For sinex files, the default (or user input) reference frame is set in -// // parse_sinex_msr and parse_sinex_stn. The epoch of the sinex file is -// // also set in these functions. Hence, there is no need to override here. -// return; -// -// case dynaml: // DynaML - *stn.xml and *msr.xml -// // Reference frame is properly handled in and dnaparser_pskel.cxx dnaparser_pimpl.cxx -// case dna: // DNA - .stn and .msr -// // Reference frame is properly handled in and ParseDNAMSR... -// return; -// -// ////////////////////////////////////////////////////////// -// // UNSUPPORTED OPTIONS -// -// case geodesyml: // GeodesyML - GML application schema -// case csv: // CSV -// default: -// -// //throw XMLInteropException("ParseInputFile(): Could not deduce file type from extension or contents.", 0); -// stringstream ss; -// ss << "SetDefaultReferenceFrame(): unsupported file type."; -// parseStatus_ = PARSE_UNRECOGNISED_FILE; -// throw XMLInteropException(ss.str(), 0); -// -// -// // Does the user want to override what is contained in the input files? -// if (projectSettings_.i.override_input_rfame == 0) -// // No, so don't override the reference frame found in the input files -// return; -// break; -// } -// -// ////////////////////////////////////////////////////////// -// // Unused code - comment out until required -// // -// // // Yes, override what is contained in the input files. -// // -// // // Get defaults -// // string strEpsg(datum_.GetEpsgCode_s()); -// // string strEpoch(datum_.GetEpoch_s()); -// // -// // for_each(vStations->begin(), vStations->end(), -// // [this, &strEpsg, &strEpoch] (dnaStnPtr& s) { -// // s->SetReferenceFrame(projectSettings_.i.reference_frame); -// // s->SetEpoch(strEpoch); -// // }); -// // -// // // If only some dna records have frame and epoch, the default reference frame and epoch will be used. -// // -// // CDnaGpsBaselineCluster* bslCluster; -// // CDnaGpsPointCluster* pntCluster; -// // -// // for_each(vMeasurements->begin(), vMeasurements->end(), -// // [this, &bslCluster, &pntCluster, &strEpsg, &strEpoch](dnaMsrPtr& m){ -// // -// // // Set reference frame (and reference epoch) in the CDnaMeasurement (parent class) -// // m->SetReferenceFrame(projectSettings_.i.reference_frame); -// // m->SetEpoch(strEpoch); -// // -// // switch (m->GetTypeC()) { -// // case 'G': // Single Baseline (treat as a single-baseline cluster) -// // bslCluster = (CDnaGpsBaselineCluster*) (m.get()); -// // bslCluster->SetReferenceFrame(projectSettings_.i.reference_frame); -// // bslCluster->SetEpoch(strEpoch); -// // break; -// // case 'X': // GPS Baseline cluster -// // bslCluster = (CDnaGpsBaselineCluster*) (m.get()); -// // bslCluster->SetReferenceFrame(projectSettings_.i.reference_frame); -// // bslCluster->SetEpoch(strEpoch); -// // break; -// // case 'Y': // GPS point cluster -// // pntCluster = (CDnaGpsPointCluster*) (m.get()); -// // pntCluster->SetReferenceFrame(projectSettings_.i.reference_frame); -// // pntCluster->SetEpoch(strEpoch); -// // break; -// // default: -// // break; -// // } -// // -// // }); -// } - - -_PARSE_STATUS_ dna_import::ParseInputFile(const string& fileName, vdnaStnPtr* vStations, PUINT32 stnCount, +_PARSE_STATUS_ dna_import::ParseInputFile(const std::string& fileName, vdnaStnPtr* vStations, PUINT32 stnCount, vdnaMsrPtr* vMeasurements, PUINT32 msrCount, - PUINT32 clusterID, input_file_meta_t* input_file_meta, - string* success_msg, project_settings* p) + PUINT32 clusterID, input_file_meta_t* input_file_meta, bool firstFile, + std::string* success_msg, project_settings* p) { projectSettings_ = *p; *success_msg = ""; @@ -354,18 +231,9 @@ _PARSE_STATUS_ dna_import::ParseInputFile(const string& fileName, vdnaStnPtr* vS percentComplete_ = -99.0; isProcessing_ = true; - stringstream ss; - - try - { - // Reset default datum for the input file - // Note, the following call assumes InitialiseDatum(...) - // has already been called, and set m_strEpsg and m_strEpoch. - datum_.SetDatumFromEpsg(m_strProjectDefaultEpsg, m_strProjectDefaultEpoch); - } - catch (const runtime_error& e) { - SignalExceptionParse(e.what(), 0); - } + _filespecifiedreferenceframe = false; + _filespecifiedepoch = false; + std::stringstream ss; try { @@ -381,30 +249,31 @@ _PARSE_STATUS_ dna_import::ParseInputFile(const string& fileName, vdnaStnPtr* vS ifsInputFILE_ = new std::ifstream; // Open and seek to end immediately after opening. - file_opener(ifsInputFILE_, fileName, ios::in | ios::ate, ascii, true); + file_opener(ifsInputFILE_, fileName, std::ios::in | std::ios::ate, ascii, true); // get file size and return to start sifsFileSize_ = (size_t)ifsInputFILE_->tellg(); - ifsInputFILE_->seekg(0, ios::beg); + ifsInputFILE_->seekg(0, std::ios::beg); // release file pointer mutex import_file_mutex.unlock(); } - catch (const ios_base::failure& f) { + catch (const std::ios_base::failure& f) { ss.str(""); - ss << "ParseInputFile(): An error was encountered when opening " << fileName << "." << endl << " " << f.what() << endl << " Check that the file exists and that the file is not already opened."; + ss << "ParseInputFile(): An error was encountered when opening " << fileName << "." << std::endl << " " << f.what() << std::endl << " Check that the file exists and that the file is not already opened."; SignalExceptionParse(ss.str(), 0); } catch (...) { ss.str(""); - ss << "ParseInputFile(): An error was encountered when opening " << fileName << "." << endl << " Check that the file exists and that the file is not already opened."; + ss << "ParseInputFile(): An error was encountered when opening " << fileName << "." << std::endl << " Check that the file exists and that the file is not already opened."; SignalExceptionParse(ss.str(), 0); } // Firstly, see what type of file this is, then decide what to do with it char first_chars[PRINT_LINE_LENGTH+1]; - string fileEpsg, fileEpoch; + std::string fileEpsg, fileEpoch; + fileEpsg = ""; try { @@ -412,14 +281,14 @@ _PARSE_STATUS_ dna_import::ParseInputFile(const string& fileName, vdnaStnPtr* vS import_file_mutex.lock(); ifsInputFILE_->get(first_chars, PRINT_LINE_LENGTH, '\n'); - ifsInputFILE_->seekg(0, ios::beg); // put back to beginning + ifsInputFILE_->seekg(0, std::ios::beg); // put back to beginning // release file pointer mutex import_file_mutex.unlock(); } - catch (const ios_base::failure& f) { + catch (const std::ios_base::failure& f) { ss.str(""); - ss << "ParseInputFile(): An error was encountered when reading " << fileName << "." << endl << " " << f.what() << endl; + ss << "ParseInputFile(): An error was encountered when reading " << fileName << "." << std::endl << " " << f.what() << std::endl; SignalExceptionParse(ss.str(), 0); } @@ -434,7 +303,7 @@ _PARSE_STATUS_ dna_import::ParseInputFile(const string& fileName, vdnaStnPtr* vS m_ift = dynaml; // Parse the DynaML file - ParseXML(fileName, vStations, stnCount, vMeasurements, msrCount, clusterID, fileEpsg, fileEpoch, success_msg); + ParseXML(fileName, vStations, stnCount, vMeasurements, msrCount, clusterID, fileEpsg, fileEpoch, firstFile, success_msg); if (fileEpsg.empty()) fileEpsg = m_strProjectDefaultEpsg; @@ -459,21 +328,28 @@ _PARSE_STATUS_ dna_import::ParseInputFile(const string& fileName, vdnaStnPtr* vS sprintf(input_file_meta->epsgCode, "%s", m_strProjectDefaultEpsg.substr(0, STN_EPSG_WIDTH).c_str()); sprintf(input_file_meta->epoch, "%s", datum_.GetEpoch_s().substr(0, STN_EPOCH_WIDTH).c_str()); + if (firstFile) + { + fileEpoch = input_file_meta->epoch; + if (!fileEpoch.empty()) + m_strProjectDefaultEpoch = fileEpoch; + } + SignalComplete(); } // STN or MSR else if ( // use boost::algorithm::ifind_first, which is a case insensitive implementation of the find first algorithm. strncmp(first_chars, "!#=DNA", 6) == 0 || // dna file? - ifind_first(fileName, ".stn") || // dna station file - ifind_first(fileName, ".msr")) // dna measurement file + boost::ifind_first(fileName, ".stn") || // dna station file + boost::ifind_first(fileName, ".msr")) // dna measurement file { // Set the file type input_file_meta->filetype = dna; m_ift = dna; // Parse the DNA file - ParseDNA(fileName, vStations, stnCount, vMeasurements, msrCount, clusterID, fileEpsg, fileEpoch); + ParseDNA(fileName, vStations, stnCount, vMeasurements, msrCount, clusterID, fileEpsg, fileEpoch, firstFile); if (fileEpsg.empty()) fileEpsg = m_strProjectDefaultEpsg; @@ -488,7 +364,7 @@ _PARSE_STATUS_ dna_import::ParseInputFile(const string& fileName, vdnaStnPtr* vS { //throw XMLInteropException("ParseInputFile(): Could not deduce file type from extension or contents.", 0); ss.str(""); - ss << "ParseInputFile(): " << leafStr(fileName) << " is not a recognised station or" << endl << + ss << "ParseInputFile(): " << leafStr(fileName) << " is not a recognised station or" << std::endl << " measurement input file."; (*success_msg) = ss.str(); //SignalExceptionParse(ss.str(), 0); @@ -504,11 +380,6 @@ _PARSE_STATUS_ dna_import::ParseInputFile(const string& fileName, vdnaStnPtr* vS if (p->i.apply_discontinuities) ApplyDiscontinuities(vMeasurements); } - - // SetDefaultReferenceFrame is not needed. Keep for potential file formats that require this to be set - // - // // Set default reference frame (if the file type does not specify it). - // SetDefaultReferenceFrame(vStations, vMeasurements); // Populate metadata sprintf(input_file_meta->filename, "%s", fileName.c_str()); @@ -522,12 +393,14 @@ _PARSE_STATUS_ dna_import::ParseInputFile(const string& fileName, vdnaStnPtr* vS return parseStatus_; } -void dna_import::ParseXML(const string& fileName, vdnaStnPtr* vStations, PUINT32 stnCount, +void dna_import::ParseXML(const std::string& fileName, vdnaStnPtr* vStations, PUINT32 stnCount, vdnaMsrPtr* vMeasurements, PUINT32 msrCount, PUINT32 clusterID, - string& fileEpsg, string& fileEpoch, string* success_msg) + std::string& fileEpsg, std::string& fileEpoch, bool firstFile, std::string* success_msg) { parseStatus_ = PARSE_SUCCESS; + _filespecifiedreferenceframe = false; + _filespecifiedepoch = false; try { @@ -535,15 +408,17 @@ void dna_import::ParseXML(const string& fileName, vdnaStnPtr* vStations, PUINT32 // A hack to circumvent the problem caused by importing DynaML files in // different directories to where import is run from, causing errors // because DynaML.xsd cannot be found. - path currentPath(current_path()); - current_path(path(projectSettings_.g.input_folder)); + boost::filesystem::path currentPath(boost::filesystem::current_path()); + boost::filesystem::current_path(boost::filesystem::path(projectSettings_.g.input_folder)); // Instantiate individual parsers. DnaXmlFormat_pimpl DnaXmlFormat_p(ifsInputFILE_, // pass file stream to enable progress to be calculated clusterID, // pass cluster ID so that a unique number can be retained across multiple files datum_.GetName(), // pass the default reference frame datum_.GetEpoch_s(), // pass the default epoch + firstFile, // is this the first file to be loaded? projectSettings_.i.user_supplied_frame==1, // Has a reference frame been supplied? + projectSettings_.i.user_supplied_epoch == 1, // Has an epoch been supplied? projectSettings_.i.override_input_rfame==1); // Should this reference frame override all others? ::DnaStation_pimpl DnaStation_p; @@ -602,34 +477,76 @@ void dna_import::ParseXML(const string& fileName, vdnaStnPtr* vStations, PUINT32 *stnCount = DnaXmlFormat_p.NumStationsRead(); *msrCount = DnaXmlFormat_p.NumMeasurementsRead(); *success_msg = DnaXmlFormat_p.DnaXmlParseMessage() + "\n"; + _filespecifiedreferenceframe = DnaXmlFormat_p.filespecifiedreferenceframe(); + _filespecifiedepoch = DnaXmlFormat_p.filespecifiedepoch(); try { + // 1. Capture file epsg // Get the reference frame from the XML file (i.e. referenceframe attribute in DnaXmlFormat element) - string xml_referenceframe = referenceframe_p.str(); - string xml_epoch = epoch_p.str(); - + fileEpsg = DnaXmlFormat_p.FileEpsg(); // Is this attribute value an empty string? As long as a default value // is specified in DynaML.xsd, this value will never be empty, unless the user // has inadvertently set in the xml file, e.g.: // - if (xml_referenceframe.empty()) + if (fileEpsg.empty()) // No, so get the epsg code from the default datum fileEpsg = datum_.GetEpsgCode_s(); - else - fileEpsg = epsgStringFromName(xml_referenceframe); - if (xml_epoch.empty()) - // No, so get the epoch from the default datum - fileEpoch = datum_.GetEpoch_s(); + fileEpoch = DnaXmlFormat_p.FileEpoch(); + // Is this attribute value an empty string? As long as a default value + // is specified in DynaML.xsd, this value will never be empty, unless the user + // has inadvertently set in the xml file, e.g.: + // + // Or, is the file reference frame a static datum? + if (fileEpoch.empty() || isEpsgDatumStatic(LongFromString(fileEpsg))) + { + // Get the epoch of the nominated epsg (whether default or from the file) + fileEpoch = referenceepochFromEpsgString(fileEpsg); + } + + // Has the user supplied a reference frame on the command line (--reference-frame)? + if (projectSettings_.i.user_supplied_frame) + { + // A frame has been supplied. Now check for epoch. + + // Has the user supplied an epoch on the command line (--epoch)? + if (!projectSettings_.i.user_supplied_epoch) + { + // No epoch supplied. Take the epoch from the first file. + if (firstFile) + { + projectSettings_.i.epoch = fileEpoch; + projectSettings_.r.epoch = fileEpoch; + m_strProjectDefaultEpoch = fileEpoch; + datum_.SetEpoch(fileEpoch); + } + } + } else - fileEpoch = xml_epoch; + { + // No frame supplied. Set the datum from the first file. + // If the datum field is blank in the first file, the default will be used. + if (firstFile) + { + projectSettings_.i.reference_frame = datumFromEpsgString(fileEpsg); + projectSettings_.r.reference_frame = projectSettings_.i.reference_frame; + m_strProjectDefaultEpsg = fileEpsg; + + // If the user has not provided a reference frame on the command line, then + // take the epoch from the first file. In this case, do not take the epoch + // from the command line (dnaimportwrapper will throw in this scenario anyway) + projectSettings_.i.epoch = fileEpoch; + projectSettings_.r.epoch = fileEpoch; + m_strProjectDefaultEpoch = fileEpoch; + } + } } catch (...) { - stringstream ss; + std::stringstream ss; ss << "The default input file reference frame \"" << referenceframe_p.str() << "\" is not recognised."; - SignalExceptionParse(static_cast(ss.str()), 0); + SignalExceptionParse(static_cast(ss.str()), 0); } if (!vStations->empty() && !vMeasurements->empty()) @@ -641,7 +558,7 @@ void dna_import::ParseXML(const string& fileName, vdnaStnPtr* vStations, PUINT32 current_path(currentPath); } - catch (const ios_base::failure& f) + catch (const std::ios_base::failure& f) { if (ifsInputFILE_->eof()) { @@ -655,9 +572,9 @@ void dna_import::ParseXML(const string& fileName, vdnaStnPtr* vStations, PUINT32 import_file_mutex.unlock(); return; } - stringstream ss; - ss << "ParseXML(): An ios_base failure was encountered while parsing " << fileName << "." << endl << " " << f.what(); - SignalExceptionParse(static_cast(ss.str()), 0); + std::stringstream ss; + ss << "ParseXML(): An std::ios_base failure was encountered while parsing " << fileName << "." << std::endl << " " << f.what(); + SignalExceptionParse(static_cast(ss.str()), 0); } catch (const std::system_error& e) { @@ -673,55 +590,55 @@ void dna_import::ParseXML(const string& fileName, vdnaStnPtr* vStations, PUINT32 import_file_mutex.unlock(); return; } - stringstream ss; - ss << "ParseXML(): An ios_base failure was encountered while parsing " << fileName << "." << endl << " " << e.what(); - SignalExceptionParse(static_cast(ss.str()), 0); + std::stringstream ss; + ss << "ParseXML(): An std::ios_base failure was encountered while parsing " << fileName << "." << std::endl << " " << e.what(); + SignalExceptionParse(static_cast(ss.str()), 0); } catch (const XMLInteropException& e) { - stringstream ss; - ss << "ParseXML(): An exception was encountered while parsing " << fileName << "." << endl << " " << e.what(); - SignalExceptionParse(static_cast(ss.str()), 0); + std::stringstream ss; + ss << "ParseXML(): An exception was encountered while parsing " << fileName << "." << std::endl << " " << e.what(); + SignalExceptionParse(static_cast(ss.str()), 0); } catch (const ::xml_schema::parsing& e) { - stringstream ss(""); + std::stringstream ss(""); ss << e.what(); ::xsd::cxx::parser::diagnostics::const_iterator _it; for (_it=e.diagnostics().begin(); _it!=e.diagnostics().end(); _it++) { - ss << endl; + ss << std::endl; ss << " - line " << _it->line(); ss << ", column " << _it->column(); - ss << ", severity " << _it->severity() << endl; + ss << ", severity " << _it->severity() << std::endl; ss << " - " << _it->message(); } SignalExceptionParse(ss.str(), 0); } catch (const ::xml_schema::exception& e) { - stringstream ss; - ss << "ParseXML(): An xml_schema exception was encountered while parsing " << fileName << "." << endl << " " << e.what(); - SignalExceptionParse(static_cast(ss.str()), 0); + std::stringstream ss; + ss << "ParseXML(): An xml_schema exception was encountered while parsing " << fileName << "." << std::endl << " " << e.what(); + SignalExceptionParse(static_cast(ss.str()), 0); } catch (...) { - stringstream ss; - ss << "ParseXML(): An unknown error was encountered while parsing " << fileName << "." << endl; + std::stringstream ss; + ss << "ParseXML(): An unknown error was encountered while parsing " << fileName << "." << std::endl; SignalExceptionParse(ss.str(), 0); } if (parseStatus_ != PARSE_SUCCESS) { - stringstream ss(""); + std::stringstream ss(""); ss.str(""); - ss << "- Warning: Parse success code = " << PARSE_SUCCESS << "." << endl; + ss << "- Warning: Parse success code = " << PARSE_SUCCESS << "." << std::endl; (*success_msg) += ss.str(); } } -void dna_import::ParseSNX(const string& fileName, vdnaStnPtr* vStations, PUINT32 stnCount, +void dna_import::ParseSNX(const std::string& fileName, vdnaStnPtr* vStations, PUINT32 stnCount, vdnaMsrPtr* vMeasurements, PUINT32 msrCount, PUINT32 clusterID) { try { @@ -732,21 +649,22 @@ void dna_import::ParseSNX(const string& fileName, vdnaStnPtr* vStations, PUINT32 datum_, projectSettings_.i.apply_discontinuities==1, &stn_discontinuities_, m_discontsSortedbyName, m_lineNo, m_columnNo, parseStatus_); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionParse(e.what(), 0); } + _filespecifiedepoch = true; } // Parse discontinuities and create discontinuity tuple -void dna_import::ParseDiscontinuities(const string& fileName) +void dna_import::ParseDiscontinuities(const std::string& fileName) { std::ifstream discont_file; try { // Open discontinuity file. Throws runtime_error on failure. file_opener(discont_file, fileName, - ios::in, ascii, true); + std::ios::in, ascii, true); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionInterop(e.what(), 0, NULL); } @@ -758,7 +676,7 @@ void dna_import::ParseDiscontinuities(const string& fileName) &stn_discontinuities_, m_discontsSortedbyName, m_lineNo, m_columnNo, parseStatus_); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionParse(e.what(), 0); } @@ -775,12 +693,12 @@ void dna_import::AddDiscontinuityStations(vdnaStnPtr* vStations) it_string_pair stn_renames_it(stn_renamed_.begin()); dnaStnPtr stn_ptr; - string stationName; + std::string stationName; UINT32 i, station_count(static_cast(vStations->size())); UINT32 station_index(station_count); - sort(vStations->begin(), vStations->end(), CompareStationName()); + std::sort(vStations->begin(), vStations->end(), CompareStationName()); for (i=0; ibegin(), vStations->end(), CompareStationName()); + std::sort(vStations->begin(), vStations->end(), CompareStationName()); _it_vdnastnptr _it_stn_newend = unique(vStations->begin(), vStations->end(), EqualStationName()); if (_it_stn_newend != vStations->end()) vStations->resize(_it_stn_newend - vStations->begin()); @@ -828,7 +746,7 @@ void dna_import::ApplyDiscontinuities(vdnaMsrPtr* vMeasurements) if (!m_discontsSortedbyName) { - sort(stn_discontinuities_.begin(), stn_discontinuities_.end(), + std::sort(stn_discontinuities_.begin(), stn_discontinuities_.end(), CompareSiteTuplesByName()); m_discontsSortedbyName = true; } @@ -848,12 +766,12 @@ void dna_import::ApplyDiscontinuities(vdnaMsrPtr* vMeasurements) ApplyDiscontinuitiesMeasurements(vMeasurements); } -void dna_import::TrackDiscontinuitySite(const string& site, const string& site_renamed) +void dna_import::TrackDiscontinuitySite(const std::string& site, const std::string& site_renamed) { - if (!binary_search(stn_renamed_.begin(), stn_renamed_.end(), site_renamed, ComparePairSecond())) + if (!binary_search(stn_renamed_.begin(), stn_renamed_.end(), site_renamed, ComparePairSecond())) { stn_renamed_.push_back(string_string_pair(site, site_renamed)); - sort(stn_renamed_.begin(), stn_renamed_.end(), ComparePairFirst()); + std::sort(stn_renamed_.begin(), stn_renamed_.end(), ComparePairFirst()); } } @@ -865,13 +783,13 @@ void dna_import::ApplyDiscontinuitiesMeasurements(vdnaMsrPtr* vMeasurements) { _it_vdiscontinuity_tuple _it_discont(stn_discontinuities_.begin()); - string site_renamed, stn1, stn2, stn3; + std::string site_renamed, stn1, stn2, stn3; - date site_date; + boost::gregorian::date site_date; - vector* vdirns; - vector* vgpsBsls; - vector* vgpsPnts; + std::vector* vdirns; + std::vector* vgpsBsls; + std::vector* vgpsPnts; _it_vdnamsrptr _it_msr(vMeasurements->begin()); @@ -897,7 +815,7 @@ void dna_import::ApplyDiscontinuitiesMeasurements(vdnaMsrPtr* vMeasurements) continue; // Capture the epoch of the measurement - site_date = dateFromString(_it_msr->get()->GetEpoch()); + site_date = dateFromString(_it_msr->get()->GetEpoch()); // 2. Handle 'first' station for every measurement type stn1 = _it_msr->get()->GetFirst(); @@ -963,7 +881,7 @@ void dna_import::ApplyDiscontinuitiesMeasurements(vdnaMsrPtr* vMeasurements) case 'L': // Level difference case 'M': // MSL arc case 'S': // Slope distance - case 'V': // Zenith angle + case 'V': // Zenith distance case 'Z': // Vertical angle continue; } @@ -993,19 +911,19 @@ void dna_import::ApplyDiscontinuitiesMeasurements(vdnaMsrPtr* vMeasurements) } -void dna_import::ApplyDiscontinuitiesMeasurements_GX(vector* vGpsBaselines) +void dna_import::ApplyDiscontinuitiesMeasurements_GX(std::vector* vGpsBaselines) { - vector< CDnaGpsBaseline >::iterator _it_msr(vGpsBaselines->begin()); + std::vector< CDnaGpsBaseline >::iterator _it_msr(vGpsBaselines->begin()); _it_vdiscontinuity_tuple _it_discont(stn_discontinuities_.begin()); - string site_renamed, stn1, stn2, stn3; - date site_date; + std::string site_renamed, stn1, stn2, stn3; + boost::gregorian::date site_date; for (_it_msr = vGpsBaselines->begin(); _it_msr != vGpsBaselines->end(); _it_msr++) { // Capture the start date of the site - site_date = dateFromString(_it_msr->GetEpoch()); + site_date = dateFromString(_it_msr->GetEpoch()); // Station 1 stn1 = _it_msr->GetFirst(); @@ -1046,19 +964,19 @@ void dna_import::ApplyDiscontinuitiesMeasurements_GX(vector* vG } -void dna_import::ApplyDiscontinuitiesMeasurements_Y(vector* vGpsPoints) +void dna_import::ApplyDiscontinuitiesMeasurements_Y(std::vector* vGpsPoints) { - vector< CDnaGpsPoint >::iterator _it_msr(vGpsPoints->begin()); + std::vector< CDnaGpsPoint >::iterator _it_msr(vGpsPoints->begin()); _it_vdiscontinuity_tuple _it_discont(stn_discontinuities_.begin()); - string site_renamed, stn1, stn2, stn3; - date site_date; + std::string site_renamed, stn1, stn2, stn3; + boost::gregorian::date site_date; for (_it_msr = vGpsPoints->begin(); _it_msr != vGpsPoints->end(); _it_msr++) { // Capture the start date of the site - site_date = dateFromString(_it_msr->GetEpoch()); + site_date = dateFromString(_it_msr->GetEpoch()); // Station 1 stn1 = _it_msr->GetFirst(); @@ -1081,11 +999,11 @@ void dna_import::ApplyDiscontinuitiesMeasurements_Y(vector* vGpsPo } -void dna_import::ApplyDiscontinuitiesMeasurements_D(vector* vDirections, const date& site_date) +void dna_import::ApplyDiscontinuitiesMeasurements_D(std::vector* vDirections, const boost::gregorian::date& site_date) { - vector< CDnaDirection >::iterator _it_msr(vDirections->begin()); + std::vector< CDnaDirection >::iterator _it_msr(vDirections->begin()); _it_vdiscontinuity_tuple _it_discont(stn_discontinuities_.begin()); - string site_renamed, stn1, stn2, stn3; + std::string site_renamed, stn1, stn2, stn3; for (_it_msr = vDirections->begin(); _it_msr != vDirections->end(); @@ -1128,51 +1046,11 @@ void dna_import::ApplyDiscontinuitiesMeasurements_D(vector* vDire } } } + - -//// Get version number and assign field widths/locations -//void dna_import::ParseDNAVersion(const INPUT_DATA_TYPE& idt) -//{ -// string sBuf; -// -// // Obtain exclusive use of the input file pointer -// import_file_mutex.lock(); -// getline((*ifsInputFILE_), sBuf); -// // release file pointer mutex -// import_file_mutex.unlock(); -// -// // Set the default version -// string version("1.00"); -// -// // Attempt to get this file's version -// try { -// if (iequals("!#=DNA", sBuf.substr(0, 6))) -// version = trimstr(sBuf.substr(6, 6)); -// } -// catch (...) { -// SignalExceptionParseDNA("ParseDNAVersion(): Could not extract file version from the record: ", -// sBuf, 6); -// } -// -// stringstream ss; -// switch (idt) -// { -// case stn_data: -// determineDNASTNFieldParameters(version, dsl_, dsw_); -// break; -// case msr_data: -// determineDNAMSRFieldParameters(version, dml_, dmw_); -// break; -// default: -// ss << " Unknown file type." << endl; -// m_columnNo = 0; -// throw XMLInteropException(ss.str(), m_lineNo); -// } -//} - -void dna_import::ParseDNA(const string& fileName, vdnaStnPtr* vStations, PUINT32 stnCount, +void dna_import::ParseDNA(const std::string& fileName, vdnaStnPtr* vStations, PUINT32 stnCount, vdnaMsrPtr* vMeasurements, PUINT32 msrCount, PUINT32 clusterID, - string& fileEpsg, string& fileEpoch) + std::string& fileEpsg, std::string& fileEpoch, bool firstFile) { parseStatus_ = PARSE_SUCCESS; @@ -1181,8 +1059,8 @@ void dna_import::ParseDNA(const string& fileName, vdnaStnPtr* vStations, PUINT32 g_parsestn_tally.initialise(); g_parsemsr_tally.initialise(); - string stn_file_type(".stn"), msr_file_type(".msr"); - string version, geoversion; + std::string stn_file_type(".stn"), msr_file_type(".msr"); + std::string version, geoversion; INPUT_DATA_TYPE idt; UINT32 count; @@ -1202,50 +1080,109 @@ void dna_import::ParseDNA(const string& fileName, vdnaStnPtr* vStations, PUINT32 // Read the dna file header, and set the // reference frame based on the header and user preferences dnaFile.read_dna_header(ifsInputFILE_, version, idt, - datum_, // default datum - projectSettings_.i.user_supplied_frame==1, // Has a reference frame been supplied? - projectSettings_.i.override_input_rfame==1, // does the user want to override the datum in the input files? + datum_, // project datum fileEpsg, fileEpoch, geoversion, count); // release file pointer mutex import_file_mutex.unlock(); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { import_file_mutex.unlock(); + parseStatus_ = PARSE_EXCEPTION_RAISED; throw XMLInteropException(e.what(), 0); } + + // Set to defaults if reference frame and epoch fields are empty + if (fileEpsg.empty()) + fileEpsg = datum_.GetEpsgCode_s(); + if (fileEpoch.empty()) + fileEpoch = datum_.GetEpoch_s(); + + // Is the file reference frame a static datum? + if (isEpsgDatumStatic(LongFromString(fileEpsg))) + { + // Get the reference epoch of the nominated epsg + fileEpoch = referenceepochFromEpsgString(fileEpsg); + } + + // Has the user supplied a reference frame on the command line (--reference-frame)? + if (projectSettings_.i.user_supplied_frame) + { + // A frame has been supplied. Now check for epoch. + + // Has the user supplied an epoch on the command line (--epoch)? + if (!projectSettings_.i.user_supplied_epoch) + { + // No epoch supplied. Take the epoch from the first file. + if (firstFile) + { + projectSettings_.i.epoch = fileEpoch; + projectSettings_.r.epoch = fileEpoch; + m_strProjectDefaultEpoch = fileEpoch; + datum_.SetEpoch(fileEpoch); + } + } + } + else + { + // No frame supplied. Set the datum from the first file. + // If the datum field is blank in the first file, the default will be used. See + // dnaFile.read_dna_header(..) for details. + if (firstFile) + { + projectSettings_.i.reference_frame = datumFromEpsgString(fileEpsg); + projectSettings_.r.reference_frame = projectSettings_.i.reference_frame; + m_strProjectDefaultEpsg = fileEpsg; + + // If the user has not provided a reference frame on the command line, then + // take the epoch from the first file. In this case, do not take the epoch + // from the command line (dnaimportwrapper will throw in this scenario anyway) + projectSettings_.i.epoch = fileEpoch; + projectSettings_.r.epoch = fileEpoch; + m_strProjectDefaultEpoch = fileEpoch; + + InitialiseDatum(projectSettings_.i.reference_frame, projectSettings_.i.epoch); + } + } + + _filespecifiedreferenceframe = dnaFile.filespecifiedReferenceFrame(); + _filespecifiedepoch = dnaFile.filespecifiedEpoch(); // Station file if (idt == stn_data || - (pos = fileName.find(stn_file_type, 0)) != string::npos) + (pos = fileName.find(stn_file_type, 0)) != std::string::npos) { - // Determine the file format version - //ParseDNAVersion(stn_data); + // set the column positions and widths (using version obtained from the header) dsl_ = dnaFile.dna_stn_positions(); dsw_ = dnaFile.dna_stn_widths(); try { - ParseDNASTN(vStations, stnCount); + // Does the user want to override the datum provided in the file with the project + // datum? + if (projectSettings_.i.override_input_rfame) + ParseDNASTN(vStations, stnCount, datum_.GetEpsgCode_s(), datum_.GetEpoch_s()); + else + ParseDNASTN(vStations, stnCount, fileEpsg, fileEpoch); m_idt = stn_data; } - catch (const ios_base::failure& f) { + catch (const std::ios_base::failure& f) { if (ifsInputFILE_->eof()) { // release file pointer mutex import_file_mutex.unlock(); return; } - stringstream ss; - ss << "ParseDNA(): An ios_base failure was encountered when attempting to read stations file " << fileName << "." << endl << " " << f.what(); + std::stringstream ss; + ss << "ParseDNA(): An std::ios_base failure was encountered when attempting to read stations file " << fileName << "." << std::endl << " " << f.what(); throw XMLInteropException(ss.str(), 0); } catch (const XMLInteropException& f) { - stringstream ss; - ss << "ParseInputFile(): An exception was encountered while parsing " << fileName << "." << endl; + std::stringstream ss; + ss << "ParseInputFile(): An exception was encountered while parsing " << fileName << "." << std::endl; ss << " - line " << m_lineNo; - ss << ", column " << m_columnNo << endl; + ss << ", column " << m_columnNo << std::endl; ss << " - " << f.what(); - SignalExceptionParse(static_cast(ss.str()), 0); + SignalExceptionParse(static_cast(ss.str()), 0); } catch (...) { if (ifsInputFILE_->eof()) @@ -1254,13 +1191,13 @@ void dna_import::ParseDNA(const string& fileName, vdnaStnPtr* vStations, PUINT32 import_file_mutex.unlock(); return; } - stringstream ss; + std::stringstream ss; ss << "ParseDNA(): An error was encountered when attempting to read stations file " << fileName << "."; throw XMLInteropException(ss.str(), 0); } } else if (idt == msr_data || - (pos = fileName.find(msr_file_type, 0)) != string::npos) + (pos = fileName.find(msr_file_type, 0)) != std::string::npos) { // Determine the file format version //ParseDNAVersion(msr_data); @@ -1268,28 +1205,31 @@ void dna_import::ParseDNA(const string& fileName, vdnaStnPtr* vStations, PUINT32 dmw_ = dnaFile.dna_msr_widths(); try { - ParseDNAMSR(vMeasurements, msrCount, clusterID); + if (projectSettings_.i.override_input_rfame) + ParseDNAMSR(vMeasurements, msrCount, clusterID, datum_.GetEpsgCode_s(), datum_.GetEpoch_s()); + else + ParseDNAMSR(vMeasurements, msrCount, clusterID, fileEpsg, fileEpoch); m_idt = msr_data; } - catch (const ios_base::failure& f) { + catch (const std::ios_base::failure& f) { if (ifsInputFILE_->eof()) { // release file pointer mutex import_file_mutex.unlock(); return; } - stringstream ss; - ss << "ParseDNA(): An ios_base failure was encountered when attempting to read measurements file " << fileName << "." << endl << " " << f.what(); + std::stringstream ss; + ss << "ParseDNA(): An std::ios_base failure was encountered when attempting to read measurements file " << fileName << "." << std::endl << " " << f.what(); throw XMLInteropException(ss.str(), 0); } catch (const XMLInteropException& f) { - stringstream ss; - ss << "ParseInputFile(): An exception was encountered while parsing " << fileName << "." << endl; + std::stringstream ss; + ss << "ParseInputFile(): An exception was encountered while parsing " << fileName << "." << std::endl; ss << " - line " << m_lineNo; - ss << ", column " << m_columnNo << endl; + ss << ", column " << m_columnNo << std::endl; ss << " - " << f.what(); - SignalExceptionParse(static_cast(ss.str()), 0); + SignalExceptionParse(static_cast(ss.str()), 0); } catch (...) { if (ifsInputFILE_->eof()) @@ -1298,18 +1238,18 @@ void dna_import::ParseDNA(const string& fileName, vdnaStnPtr* vStations, PUINT32 import_file_mutex.unlock(); return; } - stringstream ss; - ss << "ParseDNA(): An error was encountered when attempting to read measurements file " << fileName << "." << endl; + std::stringstream ss; + ss << "ParseDNA(): An error was encountered when attempting to read measurements file " << fileName << "." << std::endl; ss << " - line " << m_lineNo; - ss << ", column " << m_columnNo << endl; + ss << ", column " << m_columnNo << std::endl; throw XMLInteropException(ss.str(), 0); } } } -void dna_import::ParseDNASTN(vdnaStnPtr* vStations, PUINT32 stnCount) +void dna_import::ParseDNASTN(vdnaStnPtr* vStations, PUINT32 stnCount, const std::string& epsg, const std::string& epoch) { - string sBuf, tmp; + std::string sBuf, tmp; dnaStnPtr stn_ptr; vStations->clear(); @@ -1339,8 +1279,8 @@ void dna_import::ParseDNASTN(vdnaStnPtr* vStations, PUINT32 stnCount) import_file_mutex.unlock(); return; } - stringstream ss; - ss << "ParseDNASTN(): Could not read from the station file." << endl; + std::stringstream ss; + ss << "ParseDNASTN(): Could not read from the station file." << std::endl; m_columnNo = 0; throw XMLInteropException(ss.str(), m_lineNo); } @@ -1361,7 +1301,7 @@ void dna_import::ParseDNASTN(vdnaStnPtr* vStations, PUINT32 stnCount) continue; // initialise new station - stn_ptr.reset(new CDnaStation(datum_.GetName(), datum_.GetEpoch_s())); + stn_ptr.reset(new CDnaStation(datumFromEpsgString(epsg), epoch)); stn_ptr->SetfileOrder(g_fileOrder++); @@ -1371,8 +1311,8 @@ void dna_import::ParseDNASTN(vdnaStnPtr* vStations, PUINT32 stnCount) stn_ptr->SetName(tmp); } catch (...) { - stringstream ss; - ss << "ParseDNASTN(): Could not extract station name from the record: " << endl << " " << sBuf << endl; + std::stringstream ss; + ss << "ParseDNASTN(): Could not extract station name from the record: " << std::endl << " " << sBuf << std::endl; m_columnNo = dsl_.stn_name+1; throw XMLInteropException(ss.str(), m_lineNo); } @@ -1384,8 +1324,8 @@ void dna_import::ParseDNASTN(vdnaStnPtr* vStations, PUINT32 stnCount) g_parsestn_tally.addstation(tmp); } catch (...) { - stringstream ss; - ss << "ParseDNASTN(): Could not extract station constraints from the record: " << endl << " " << sBuf << endl; + std::stringstream ss; + ss << "ParseDNASTN(): Could not extract station constraints from the record: " << std::endl << " " << sBuf << std::endl; m_columnNo = dsl_.stn_const+1; throw XMLInteropException(ss.str(), m_lineNo); } @@ -1396,8 +1336,8 @@ void dna_import::ParseDNASTN(vdnaStnPtr* vStations, PUINT32 stnCount) stn_ptr->SetCoordType(tmp); } catch (...) { - stringstream ss; - ss << "ParseDNASTN(): Could not extract coordinate type from the record: " << endl << " " << sBuf << endl; + std::stringstream ss; + ss << "ParseDNASTN(): Could not extract coordinate type from the record: " << std::endl << " " << sBuf << std::endl; m_columnNo = dsl_.stn_type+1; throw XMLInteropException(ss.str(), m_lineNo); } @@ -1408,7 +1348,7 @@ void dna_import::ParseDNASTN(vdnaStnPtr* vStations, PUINT32 stnCount) stn_ptr->SetXAxis(tmp); } catch (...) { - stringstream ss; + std::stringstream ss; ss << "ParseDNASTN(): Could not extract station "; switch (stn_ptr.get()->GetMyCoordTypeC()) { @@ -1425,7 +1365,7 @@ void dna_import::ParseDNASTN(vdnaStnPtr* vStations, PUINT32 stnCount) default: break; } - ss << " value from the record: " << endl << " " << sBuf << endl; + ss << " value from the record: " << std::endl << " " << sBuf << std::endl; m_columnNo = dsl_.stn_e_phi_x+1; throw XMLInteropException(ss.str(), m_lineNo); } @@ -1435,7 +1375,7 @@ void dna_import::ParseDNASTN(vdnaStnPtr* vStations, PUINT32 stnCount) stn_ptr->SetYAxis(tmp); } catch (...) { - stringstream ss; + std::stringstream ss; ss << "ParseDNASTN(): Could not extract station "; switch (stn_ptr->GetMyCoordTypeC()) { @@ -1452,7 +1392,7 @@ void dna_import::ParseDNASTN(vdnaStnPtr* vStations, PUINT32 stnCount) default: break; } - ss << " value from the record: " << endl << " " << sBuf << endl; + ss << " value from the record: " << std::endl << " " << sBuf << std::endl; m_columnNo = dsl_.stn_n_lam_y+1; throw XMLInteropException(ss.str(), m_lineNo); } @@ -1465,7 +1405,7 @@ void dna_import::ParseDNASTN(vdnaStnPtr* vStations, PUINT32 stnCount) stn_ptr->SetHeight(tmp); } catch (...) { - stringstream ss; + std::stringstream ss; ss << "ParseDNASTN(): Could not extract station "; switch (stn_ptr->GetMyCoordTypeC()) { @@ -1480,7 +1420,7 @@ void dna_import::ParseDNASTN(vdnaStnPtr* vStations, PUINT32 stnCount) default: break; } - ss << " value from the record: " << endl << " " << sBuf << endl; + ss << " value from the record: " << std::endl << " " << sBuf << std::endl; m_columnNo = dsl_.stn_ht_z+1; throw XMLInteropException(ss.str(), m_lineNo); } @@ -1501,8 +1441,8 @@ void dna_import::ParseDNASTN(vdnaStnPtr* vStations, PUINT32 stnCount) case XYZ_type_i: break; case UTM_type_i: // Hemisphere and zone is only essential for UTM types - stringstream ss; - ss << "ParseDNASTN(): Could not extract station hemisphere and zone from the record: " << endl << " " << sBuf << endl; + std::stringstream ss; + ss << "ParseDNASTN(): Could not extract station hemisphere and zone from the record: " << std::endl << " " << sBuf << std::endl; m_columnNo = dsl_.stn_hemi_zo+1; throw XMLInteropException(ss.str(), m_lineNo); } @@ -1526,9 +1466,9 @@ void dna_import::ParseDNASTN(vdnaStnPtr* vStations, PUINT32 stnCount) } -void dna_import::ParseDNAMSR(pvdnaMsrPtr vMeasurements, PUINT32 msrCount, PUINT32 clusterID) +void dna_import::ParseDNAMSR(pvdnaMsrPtr vMeasurements, PUINT32 msrCount, PUINT32 clusterID, const std::string& fileEpsg, const std::string& fileEpoch) { - string sBuf, tmp; + std::string sBuf, tmp; dnaMsrPtr msr_ptr; vMeasurements->clear(); @@ -1564,8 +1504,8 @@ void dna_import::ParseDNAMSR(pvdnaMsrPtr vMeasurements, PUINT32 msrCount, PUINT3 import_file_mutex.unlock(); return; } - stringstream ss; - ss << "ParseDNAMSR(): Could not read from the measurement file." << endl; + std::stringstream ss; + ss << "ParseDNAMSR(): Could not read from the measurement file." << std::endl; m_columnNo = 0; throw XMLInteropException(ss.str(), m_lineNo); } @@ -1611,13 +1551,13 @@ void dna_import::ParseDNAMSR(pvdnaMsrPtr vMeasurements, PUINT32 msrCount, PUINT3 cType = static_cast(toupper(cType)); } catch (...) { - stringstream ss; - ss << "ParseDNAMSR(): Could not extract measurement type from the record: " << endl << " " << sBuf << endl; + std::stringstream ss; + ss << "ParseDNAMSR(): Could not extract measurement type from the record: " << std::endl << " " << sBuf << std::endl; m_columnNo = dml_.msr_type+1; throw XMLInteropException(ss.str(), m_lineNo); } - ignoreMsr = iequals("*", sBuf.substr(dml_.msr_ignore, dmw_.msr_ignore)); + ignoreMsr = boost::iequals("*", sBuf.substr(dml_.msr_ignore, dmw_.msr_ignore)); switch (cType) { @@ -1656,7 +1596,8 @@ void dna_import::ParseDNAMSR(pvdnaMsrPtr vMeasurements, PUINT32 msrCount, PUINT3 break; case 'G': // GPS Baseline (treat as single-baseline cluster) case 'X': // GPS Baseline cluster - msr_ptr.reset(new CDnaGpsBaselineCluster(++(*clusterID), datum_.GetName(), datum_.GetEpoch_s())); + // Default to the fileEpsg and fileEpoch (see read_dna_header(..) in ParseDNA) + msr_ptr.reset(new CDnaGpsBaselineCluster(++(*clusterID), datumFromEpsgString(fileEpsg), fileEpoch)); ParseDNAMSRGPSBaselines(sBuf, msr_ptr, ignoreMsr); (*msrCount) += static_cast(msr_ptr->GetBaselines_ptr()->size() * 3); break; @@ -1720,14 +1661,15 @@ void dna_import::ParseDNAMSR(pvdnaMsrPtr vMeasurements, PUINT32 msrCount, PUINT3 ParseDNAMSRLinear(sBuf, msr_ptr); (*msrCount) += 1; break; - case 'V': // Zenith angle + case 'V': // Zenith distance g_parsemsr_tally.V++; msr_ptr.reset(new CDnaDirection); ParseDNAMSRAngular(sBuf, msr_ptr); (*msrCount) += 1; break; case 'Y': // GPS point cluster - msr_ptr.reset(new CDnaGpsPointCluster(++(*clusterID), datum_.GetName(), datum_.GetEpoch_s())); + // Default to the fileEpsg and fileEpoch (see read_dna_header(..) in ParseDNA) + msr_ptr.reset(new CDnaGpsPointCluster(++(*clusterID), datumFromEpsgString(fileEpsg), fileEpoch)); ParseDNAMSRGPSPoints(sBuf, msr_ptr, ignoreMsr); (*msrCount) += static_cast(msr_ptr->GetPoints_ptr()->size() * 3); break; @@ -1738,8 +1680,8 @@ void dna_import::ParseDNAMSR(pvdnaMsrPtr vMeasurements, PUINT32 msrCount, PUINT3 (*msrCount) += 1; break; default: - stringstream ss; - ss << "ParseDNAMSR(): Unknown measurement type: " << cType << endl; + std::stringstream ss; + ss << "ParseDNAMSR(): Unknown measurement type: " << cType << std::endl; throw XMLInteropException(ss.str(), m_lineNo); } @@ -1753,7 +1695,7 @@ void dna_import::ParseDNAMSR(pvdnaMsrPtr vMeasurements, PUINT32 msrCount, PUINT3 } } -void dna_import::ParseDNAMSRLinear(const string& sBuf, dnaMsrPtr& msr_ptr) +void dna_import::ParseDNAMSRLinear(const std::string& sBuf, dnaMsrPtr& msr_ptr) { // Measurement type try { @@ -1782,7 +1724,7 @@ void dna_import::ParseDNAMSRLinear(const string& sBuf, dnaMsrPtr& msr_ptr) // Value msr_ptr->SetValue(ParseLinearValue(sBuf, - measurement_name(msr_ptr->GetTypeC()), "ParseDNAMSRLinear")); + measurement_name(msr_ptr->GetTypeC()), "ParseDNAMSRLinear")); // Standard deviation msr_ptr->SetStdDev(ParseStdDevValue(sBuf, "ParseDNAMSRLinear")); @@ -1824,7 +1766,7 @@ void dna_import::ParseDNAMSRLinear(const string& sBuf, dnaMsrPtr& msr_ptr) } -void dna_import::ParseDNAMSRCoordinate(const string& sBuf, dnaMsrPtr& msr_ptr) +void dna_import::ParseDNAMSRCoordinate(const std::string& sBuf, dnaMsrPtr& msr_ptr) { // Measurement type try { @@ -1849,7 +1791,7 @@ void dna_import::ParseDNAMSRCoordinate(const string& sBuf, dnaMsrPtr& msr_ptr) // Value msr_ptr->SetValue(ParseLinearValue(sBuf, - measurement_name(msr_ptr->GetTypeC()), "ParseDNAMSRCoordinate")); + measurement_name(msr_ptr->GetTypeC()), "ParseDNAMSRCoordinate")); // Standard deviation msr_ptr->SetStdDev(ParseStdDevValue(sBuf, "ParseDNAMSRCoordinate")); @@ -1864,7 +1806,7 @@ void dna_import::ParseDNAMSRCoordinate(const string& sBuf, dnaMsrPtr& msr_ptr) } -void dna_import::ParseDNAMSRGPSBaselines(string& sBuf, dnaMsrPtr& msr_ptr, bool ignoreMsr) +void dna_import::ParseDNAMSRGPSBaselines(std::string& sBuf, dnaMsrPtr& msr_ptr, bool ignoreMsr) { CDnaGpsBaseline bslTmp; CDnaCovariance covTmp; @@ -1873,7 +1815,7 @@ void dna_import::ParseDNAMSRGPSBaselines(string& sBuf, dnaMsrPtr& msr_ptr, bool bslTmp.SetEpoch(msr_ptr->GetEpoch()); // Measurement type - string tmp; + std::string tmp; try { tmp = trimstr(sBuf.substr(dml_.msr_type, dmw_.msr_type)); } @@ -1908,13 +1850,13 @@ void dna_import::ParseDNAMSRGPSBaselines(string& sBuf, dnaMsrPtr& msr_ptr, bool // Number of baselines UINT32 bslCount(1); - if (iequals(msr_ptr->GetType(), "X")) + if (boost::iequals(msr_ptr->GetType(), "X")) msr_ptr->SetTotal(ParseMsrCountValue(sBuf, bslCount, "ParseDNAMSRGPSBaselines")); msr_ptr->SetRecordedTotal(bslCount); bslTmp.SetRecordedTotal(bslCount); msr_ptr->GetBaselines_ptr()->reserve(bslCount); - if (iequals(msr_ptr->GetType(), "X")) + if (boost::iequals(msr_ptr->GetType(), "X")) g_parsemsr_tally.X += bslCount * 3; else g_parsemsr_tally.G += bslCount * 3; @@ -1965,9 +1907,9 @@ void dna_import::ParseDNAMSRGPSBaselines(string& sBuf, dnaMsrPtr& msr_ptr, bool bslTmp.SetReferenceFrame(tmp); } } - catch (runtime_error& e) { - stringstream ss; - ss << "ParseDNAMSRGPSBaselines(): Error parsing reference frame: " << endl << + catch (std::runtime_error& e) { + std::stringstream ss; + ss << "ParseDNAMSRGPSBaselines(): Error parsing reference frame: " << std::endl << " " << e.what(); SignalExceptionParseDNA(ss.str(), "", dml_.msr_gps_reframe); } @@ -1978,7 +1920,7 @@ void dna_import::ParseDNAMSRGPSBaselines(string& sBuf, dnaMsrPtr& msr_ptr, bool if (tmp.empty()) { - if (isEpsgWGS84Ensemble(epsgCodeFromName(msr_ptr->GetReferenceFrame()))) + if (isEpsgWGS84Ensemble(epsgCodeFromName(msr_ptr->GetReferenceFrame()))) { // Set the cluster epoch msr_ptr->SetEpoch(""); @@ -1994,10 +1936,10 @@ void dna_import::ParseDNAMSRGPSBaselines(string& sBuf, dnaMsrPtr& msr_ptr, bool bslTmp.SetEpoch(tmp); } } - catch (runtime_error& e) { - stringstream ss; + catch (std::runtime_error& e) { + std::stringstream ss; ss << "ParseDNAMSRGPSBaselines(): Error parsing epoch: " << - endl << " " << e.what(); + std::endl << " " << e.what(); SignalExceptionParseDNA(ss.str(), "", dml_.msr_gps_epoch); } } @@ -2085,7 +2027,7 @@ void dna_import::ParseDNAMSRGPSBaselines(string& sBuf, dnaMsrPtr& msr_ptr, bool } } -void dna_import::ParseDNAMSRGPSPoints(string& sBuf, dnaMsrPtr& msr_ptr, bool ignoreMsr) +void dna_import::ParseDNAMSRGPSPoints(std::string& sBuf, dnaMsrPtr& msr_ptr, bool ignoreMsr) { CDnaGpsPoint pntTmp; CDnaCovariance covTmp; @@ -2094,7 +2036,7 @@ void dna_import::ParseDNAMSRGPSPoints(string& sBuf, dnaMsrPtr& msr_ptr, bool ign pntTmp.SetEpoch(msr_ptr->GetEpoch()); // Measurement type - string tmp; + std::string tmp; try { tmp = trimstr(sBuf.substr(dml_.msr_type, dmw_.msr_type)); } @@ -2140,8 +2082,8 @@ void dna_import::ParseDNAMSRGPSPoints(string& sBuf, dnaMsrPtr& msr_ptr, bool ign msr_ptr->SetCoordType(tmp); pntTmp.SetCoordType(msr_ptr->GetCoordType()); } - catch (runtime_error& e) { - SignalExceptionParseDNA("ParseDNAMSRGPSPoints(): " + string(e.what()), + catch (std::runtime_error& e) { + SignalExceptionParseDNA("ParseDNAMSRGPSPoints(): " + std::string(e.what()), "", dml_.msr_targ1); } @@ -2201,9 +2143,9 @@ void dna_import::ParseDNAMSRGPSPoints(string& sBuf, dnaMsrPtr& msr_ptr, bool ign pntTmp.SetReferenceFrame(tmp); } } - catch (runtime_error& e) { - stringstream ss; - ss << "ParseDNAMSRGPSPoints(): Error parsing reference frame: " << endl << + catch (std::runtime_error& e) { + std::stringstream ss; + ss << "ParseDNAMSRGPSPoints(): Error parsing reference frame: " << std::endl << " " << e.what(); SignalExceptionParseDNA(ss.str(), "", dml_.msr_gps_reframe); } @@ -2214,7 +2156,7 @@ void dna_import::ParseDNAMSRGPSPoints(string& sBuf, dnaMsrPtr& msr_ptr, bool ign if (tmp.empty()) { - if (isEpsgWGS84Ensemble(epsgCodeFromName(msr_ptr->GetReferenceFrame()))) + if (isEpsgWGS84Ensemble(epsgCodeFromName(msr_ptr->GetReferenceFrame()))) { // Set the cluster epoch msr_ptr->SetEpoch(""); @@ -2230,9 +2172,9 @@ void dna_import::ParseDNAMSRGPSPoints(string& sBuf, dnaMsrPtr& msr_ptr, bool ign pntTmp.SetEpoch(tmp); } } - catch (runtime_error& e) { - stringstream ss; - ss << "ParseDNAMSRGPSPoints(): Error parsing epoch: " << endl << + catch (std::runtime_error& e) { + std::stringstream ss; + ss << "ParseDNAMSRGPSPoints(): Error parsing epoch: " << std::endl << " " << e.what(); SignalExceptionParseDNA(ss.str(), "", dml_.msr_gps_epoch); } @@ -2319,7 +2261,7 @@ void dna_import::ParseDNAMSRGPSPoints(string& sBuf, dnaMsrPtr& msr_ptr, bool ign void dna_import::ParseDNAMSRCovariance(CDnaCovariance& cov) { - string sBuf; + std::string sBuf; m_lineNo++; // Obtain exclusive use of the input file pointer @@ -2359,7 +2301,7 @@ void dna_import::ParseDNAMSRCovariance(CDnaCovariance& cov) } -void dna_import::ParseDatabaseIds(const string& sBuf, const string& calling_function, const char msrType) +void dna_import::ParseDatabaseIds(const std::string& sBuf, const std::string& calling_function, const char msrType) { m_msr_db_map.is_msr_id_set = false; m_msr_db_map.is_cls_id_set = false; @@ -2392,51 +2334,51 @@ void dna_import::ParseDatabaseIds(const string& sBuf, const string& calling_func } -void dna_import::ParseDatabaseClusterId(const string& sBuf, const string& calling_function) +void dna_import::ParseDatabaseClusterId(const std::string& sBuf, const std::string& calling_function) { - string parsed_value; + std::string parsed_value; // Cluster ID try { - parsed_value = trimstr(sBuf.substr(dml_.msr_id_cluster)); + parsed_value = trimstr(sBuf.substr(dml_.msr_id_cluster, dmw_.msr_id_cluster)); if (!parsed_value.empty()) { - m_msr_db_map.cluster_id = val_uint(parsed_value); + m_msr_db_map.cluster_id = val_uint(parsed_value); m_msr_db_map.is_cls_id_set = true; } } - catch (runtime_error& e) { - stringstream ss; + catch (std::runtime_error& e) { + std::stringstream ss; ss << calling_function << "(): Could not extract database cluster id from the record: " << - endl << " " << e.what(); + std::endl << " " << e.what(); SignalExceptionParseDNA(ss.str(), sBuf, dml_.msr_id_msr); } } -void dna_import::ParseDatabaseMsrId(const string& sBuf, const string& calling_function) +void dna_import::ParseDatabaseMsrId(const std::string& sBuf, const std::string& calling_function) { - string parsed_value; + std::string parsed_value; // Measurement ID try { parsed_value = trimstr(sBuf.substr(dml_.msr_id_msr, dmw_.msr_id_msr)); if (!parsed_value.empty()) { - m_msr_db_map.msr_id = val_uint(parsed_value); + m_msr_db_map.msr_id = val_uint(parsed_value); m_msr_db_map.is_msr_id_set = true; } } - catch (runtime_error& e) { - stringstream ss; + catch (std::runtime_error& e) { + std::stringstream ss; ss << calling_function << "(): Could not extract database msr id from the record: " << - endl << " " << e.what(); + std::endl << " " << e.what(); SignalExceptionParseDNA(ss.str(), sBuf, dml_.msr_id_msr); } } -string dna_import::ParseAngularValue(const string& sBuf, const string& calling_function) +std::string dna_import::ParseAngularValue(const std::string& sBuf, const std::string& calling_function) { - string parsed_value, tmp; + std::string parsed_value, tmp; double d; UINT32 u; @@ -2469,7 +2411,7 @@ string dna_import::ParseAngularValue(const string& sBuf, const string& calling_f d = DoubleFromString(tmp); if (d < 10 && tmp.at(0) != '0') parsed_value.append("0"); - if ((pos = tmp.find(".", pos)) != string::npos) + if ((pos = tmp.find(".", pos)) != std::string::npos) parsed_value.append(tmp.substr(0, pos) + tmp.substr(pos+1)); else parsed_value.append(tmp); @@ -2481,7 +2423,7 @@ string dna_import::ParseAngularValue(const string& sBuf, const string& calling_f return parsed_value; } -string dna_import::ParseLinearValue(const string& sBuf, const string& msrName, const string& calling_function) +std::string dna_import::ParseLinearValue(const std::string& sBuf, const std::string& msrName, const std::string& calling_function) { try { return trimstr(sBuf.substr(dml_.msr_linear, dmw_.msr_linear)); // coordinate value @@ -2493,12 +2435,12 @@ string dna_import::ParseLinearValue(const string& sBuf, const string& msrName, c return ""; } -string dna_import::ParseInstrumentValue(const string& sBuf, const string& calling_function) +std::string dna_import::ParseInstrumentValue(const std::string& sBuf, const std::string& calling_function) { try { // Capture string from the designated columns; throws on failure - string stn = trimstr(sBuf.substr(dml_.msr_inst, dmw_.msr_inst)); // instrument station + std::string stn = trimstr(sBuf.substr(dml_.msr_inst, dmw_.msr_inst)); // instrument station // No value supplied? if (stn.empty()) @@ -2514,11 +2456,11 @@ string dna_import::ParseInstrumentValue(const string& sBuf, const string& callin return ""; } -string dna_import::ParseTargetValue(const string& sBuf, const string& calling_function) +std::string dna_import::ParseTargetValue(const std::string& sBuf, const std::string& calling_function) { try { // Capture string from the designated columns; throws on failure - string stn = trimstr(sBuf.substr(dml_.msr_targ1, dmw_.msr_targ1)); // first target station + std::string stn = trimstr(sBuf.substr(dml_.msr_targ1, dmw_.msr_targ1)); // first target station // No value supplied? if (stn.empty()) @@ -2534,11 +2476,11 @@ string dna_import::ParseTargetValue(const string& sBuf, const string& calling_fu return ""; } -string dna_import::ParseTarget2Value(const string& sBuf, const string& calling_function) +std::string dna_import::ParseTarget2Value(const std::string& sBuf, const std::string& calling_function) { try { // Capture string from the designated columns; throws on failure - string stn = trimstr(sBuf.substr(dml_.msr_targ2, dmw_.msr_targ2)); // second target station + std::string stn = trimstr(sBuf.substr(dml_.msr_targ2, dmw_.msr_targ2)); // second target station // No value supplied? if (stn.empty()) @@ -2554,9 +2496,9 @@ string dna_import::ParseTarget2Value(const string& sBuf, const string& calling_f return ""; } -string dna_import::ParseStdDevValue(const string& sBuf, const string& calling_function) +std::string dna_import::ParseStdDevValue(const std::string& sBuf, const std::string& calling_function) { - string tmp; + std::string tmp; try { tmp = trimstr(sBuf.substr(dml_.msr_stddev, dmw_.msr_stddev)); // standard deviation } @@ -2571,7 +2513,7 @@ string dna_import::ParseStdDevValue(const string& sBuf, const string& calling_fu return tmp; } -string dna_import::ParseInstHeightValue(const string& sBuf, const string& calling_function) +std::string dna_import::ParseInstHeightValue(const std::string& sBuf, const std::string& calling_function) { try { if (sBuf.length() > dml_.msr_targ_ht) @@ -2586,10 +2528,10 @@ string dna_import::ParseInstHeightValue(const string& sBuf, const string& callin return ""; } -string dna_import::ParseTargHeightValue(const string& sBuf, const string& calling_function) +std::string dna_import::ParseTargHeightValue(const std::string& sBuf, const std::string& calling_function) { try { - if (sBuf.length() > static_cast(dml_.msr_targ_ht + 1 + dmw_.msr_targ_ht)) + if (sBuf.length() > static_cast(dml_.msr_targ_ht + 1 + dmw_.msr_targ_ht)) return trimstr(sBuf.substr(dml_.msr_targ_ht, dmw_.msr_targ_ht)); // target height else return trimstr(sBuf.substr(dml_.msr_targ_ht)); @@ -2601,10 +2543,10 @@ string dna_import::ParseTargHeightValue(const string& sBuf, const string& callin return ""; } -string dna_import::ParseMsrCountValue(const string& sBuf, UINT32& msrCount, const string& calling_function) +std::string dna_import::ParseMsrCountValue(const std::string& sBuf, UINT32& msrCount, const std::string& calling_function) { try { - string count(trimstr(sBuf.substr(dml_.msr_targ2, dmw_.msr_targ2))); // number of measurements + std::string count(trimstr(sBuf.substr(dml_.msr_targ2, dmw_.msr_targ2))); // number of measurements if (count.empty()) SignalExceptionParseDNA(calling_function + "(): Could not extract number of measurements from the record: ", sBuf, dml_.msr_targ2); @@ -2618,12 +2560,12 @@ string dna_import::ParseMsrCountValue(const string& sBuf, UINT32& msrCount, cons return ""; } -string dna_import::ParseScaleVValue(const string& sBuf, const string& calling_function) +std::string dna_import::ParseScaleVValue(const std::string& sBuf, const std::string& calling_function) { if (sBuf.length() <= dml_.msr_gps_vscale) return "1"; - string scalar; + std::string scalar; try { if (sBuf.length() > dml_.msr_gps_pscale) scalar = trimstr(sBuf.substr(dml_.msr_gps_vscale, dmw_.msr_gps_vscale)); // v-scale @@ -2641,12 +2583,12 @@ string dna_import::ParseScaleVValue(const string& sBuf, const string& calling_fu return scalar; } -string dna_import::ParseScalePValue(const string& sBuf, const string& calling_function) +std::string dna_import::ParseScalePValue(const std::string& sBuf, const std::string& calling_function) { if (sBuf.length() <= dml_.msr_gps_pscale) return "1"; - string scalar; + std::string scalar; try { if (sBuf.length() > dml_.msr_gps_lscale) @@ -2665,12 +2607,12 @@ string dna_import::ParseScalePValue(const string& sBuf, const string& calling_fu return scalar; } -string dna_import::ParseScaleLValue(const string& sBuf, const string& calling_function) +std::string dna_import::ParseScaleLValue(const std::string& sBuf, const std::string& calling_function) { if (sBuf.length() <= dml_.msr_gps_lscale) return "1"; - string scalar; + std::string scalar; try { if (sBuf.length() > dml_.msr_gps_hscale) @@ -2689,12 +2631,12 @@ string dna_import::ParseScaleLValue(const string& sBuf, const string& calling_fu return scalar; } -string dna_import::ParseScaleHValue(const string& sBuf, const string& calling_function) +std::string dna_import::ParseScaleHValue(const std::string& sBuf, const std::string& calling_function) { if (sBuf.length() <= dml_.msr_gps_hscale) return "1"; - string scalar; + std::string scalar; try { if (sBuf.length() > (dml_.msr_gps_reframe)) @@ -2713,7 +2655,7 @@ string dna_import::ParseScaleHValue(const string& sBuf, const string& calling_fu return scalar; } -string dna_import::ParseRefFrameValue(const string& sBuf, const string& calling_function) +std::string dna_import::ParseRefFrameValue(const std::string& sBuf, const std::string& calling_function) { // Override the reference frame with the user specified frame? if (projectSettings_.i.override_input_rfame) @@ -2722,7 +2664,7 @@ string dna_import::ParseRefFrameValue(const string& sBuf, const string& calling_ if (sBuf.length() <= dml_.msr_gps_reframe) return ""; - string frame; + std::string frame; try { if (sBuf.length() > (dml_.msr_gps_epoch)) frame = trimstr(sBuf.substr(dml_.msr_gps_reframe, dmw_.msr_gps_reframe)); // reference frame @@ -2737,14 +2679,14 @@ string dna_import::ParseRefFrameValue(const string& sBuf, const string& calling_ return frame; } -string dna_import::ParseEpochValue(const string& sBuf, const string& calling_function) +std::string dna_import::ParseEpochValue(const std::string& sBuf, const std::string& calling_function) { if (sBuf.length() <= dml_.msr_gps_epoch) return ""; - string epoch; + std::string epoch; try { - if (sBuf.length() > static_cast(dml_.msr_gps_epoch + dmw_.msr_gps_epoch)) + if (sBuf.length() > static_cast(dml_.msr_gps_epoch + dmw_.msr_gps_epoch)) epoch = trimstr(sBuf.substr(dml_.msr_gps_epoch, dmw_.msr_gps_epoch)); // epoch else epoch = trimstr(sBuf.substr(dml_.msr_gps_epoch)); @@ -2757,7 +2699,7 @@ string dna_import::ParseEpochValue(const string& sBuf, const string& calling_fun return epoch; } -string dna_import::ParseGPSMsrValue(const string& sBuf, const string& element, const string& calling_function) +std::string dna_import::ParseGPSMsrValue(const std::string& sBuf, const std::string& element, const std::string& calling_function) { try { return trimstr(sBuf.substr(dml_.msr_gps, dmw_.msr_gps)); // value @@ -2769,7 +2711,7 @@ string dna_import::ParseGPSMsrValue(const string& sBuf, const string& element, c return ""; } -string dna_import::ParseGPSVarValue(const string& sBuf, const string& element, const UINT32 location, const UINT32 width, const string& calling_function) +std::string dna_import::ParseGPSVarValue(const std::string& sBuf, const std::string& element, const UINT32 location, const UINT32 width, const std::string& calling_function) { try { return trimstr(sBuf.substr(location, width)); // variance @@ -2781,7 +2723,7 @@ string dna_import::ParseGPSVarValue(const string& sBuf, const string& element, c return ""; } -void dna_import::ParseDNAMSRAngular(const string& sBuf, dnaMsrPtr& msr_ptr) +void dna_import::ParseDNAMSRAngular(const std::string& sBuf, dnaMsrPtr& msr_ptr) { // Measurement type try { @@ -2857,7 +2799,7 @@ void dna_import::ParseDNAMSRAngular(const string& sBuf, dnaMsrPtr& msr_ptr) } -UINT32 dna_import::ParseDNAMSRDirections(string& sBuf, dnaMsrPtr& msr_ptr, bool ignoreMsr) +UINT32 dna_import::ParseDNAMSRDirections(std::string& sBuf, dnaMsrPtr& msr_ptr, bool ignoreMsr) { // Measurement type try { @@ -2922,26 +2864,21 @@ UINT32 dna_import::ParseDNAMSRDirections(string& sBuf, dnaMsrPtr& msr_ptr, bool import_file_mutex.unlock(); // get ignore flag for sub direction and remove accordingly - subignoreMsr = iequals("*", sBuf.substr(dml_.msr_ignore, dmw_.msr_ignore)); + subignoreMsr = boost::iequals("*", sBuf.substr(dml_.msr_ignore, dmw_.msr_ignore)); if (subignoreMsr) { dirnCountLessIgnored--; if (dirnCountLessIgnored == 0) { - // Is the entire direction set ignored? - // If so, return 0 - if (ignoreMsr) - return 0; - - throw XMLInteropException("There aren't any non-ignored directions in the set.", m_lineNo); + // throw if the entire direction set is not ignored + if (!ignoreMsr) + throw XMLInteropException("There aren't any non-ignored directions in the set.", m_lineNo); } - msr_ptr->SetTotal(dirnCountLessIgnored); - continue; } dirnTmp.SetFirst(msr_ptr->GetFirst()); - dirnTmp.SetIgnore(ignoreMsr); + dirnTmp.SetIgnore(subignoreMsr); g_parsemsr_tally.D++; // Second target station @@ -2965,6 +2902,8 @@ UINT32 dna_import::ParseDNAMSRDirections(string& sBuf, dnaMsrPtr& msr_ptr, bool msr_ptr->AddDirection(((CDnaMeasurement*)&dirnTmp)); } + msr_ptr->SetNonIgnoredDirns(dirnCountLessIgnored); + return dirnCount; } @@ -2977,10 +2916,10 @@ void dna_import::RemoveIgnoredMeasurements(vdnaMsrPtr* vMeasurements, MsrTally* } -void dna_import::IncludeMeasurementTypes(const string& includeMsrs, vdnaMsrPtr* vMeasurements, MsrTally* parsemsrTally) +void dna_import::IncludeMeasurementTypes(const std::string& includeMsrs, vdnaMsrPtr* vMeasurements, MsrTally* parsemsrTally) { _it_vdnamsrptr _it_msr; - string msrTypes = includeMsrs; + std::string msrTypes = includeMsrs; // convert to upper case str_toupper(msrTypes); @@ -3041,7 +2980,7 @@ void dna_import::IncludeMeasurementTypes(const string& includeMsrs, vdnaMsrPtr* case 'S': // Slope distance msrtallyTmp.S = parsemsrTally->S; break; - case 'V': // Zenith angle + case 'V': // Zenith distance msrtallyTmp.V = parsemsrTally->V; break; case 'X': // GPS Baseline cluster @@ -3059,10 +2998,10 @@ void dna_import::IncludeMeasurementTypes(const string& includeMsrs, vdnaMsrPtr* *parsemsrTally = msrtallyTmp; } -void dna_import::ExcludeMeasurementTypes(const string& excludeMsrs, vdnaMsrPtr* vMeasurements, MsrTally* parsemsrTally) +void dna_import::ExcludeMeasurementTypes(const std::string& excludeMsrs, vdnaMsrPtr* vMeasurements, MsrTally* parsemsrTally) { _it_vdnamsrptr _it_msr; - string msrTypes = excludeMsrs; + std::string msrTypes = excludeMsrs; // convert to upper case str_toupper(msrTypes); @@ -3121,7 +3060,7 @@ void dna_import::ExcludeMeasurementTypes(const string& excludeMsrs, vdnaMsrPtr* case 'S': // Slope distance parsemsrTally->S = 0; break; - case 'V': // Zenith angle + case 'V': // Zenith distance parsemsrTally->V = 0; break; case 'X': // GPS Baseline cluster @@ -3148,7 +3087,7 @@ void dna_import::ExcludeAllOutsideBoundingBox(vdnaStnPtr* vStations, vdnaMsrPtr* vdnaStnPtr bvStation = *vStations; // TestNotEqualStationName requires vStations to be sorted (for binary_search) - sort(vStations->begin(), vStations->end()); + std::sort(vStations->begin(), vStations->end()); // Remove all stations outside the bounding box // vExcludedStns will contain the names of all the stations (if any) that were outside the bounding box. @@ -3167,7 +3106,7 @@ void dna_import::ExcludeAllOutsideBoundingBox(vdnaStnPtr* vStations, vdnaMsrPtr* }); // FindMsrsConnectedToStns requires vExcludedStns to be sorted (for binary_search) - sort(vExcludedStns->begin(), vExcludedStns->end()); + std::sort(vExcludedStns->begin(), vExcludedStns->end()); // OK, now measurements... if (p.i.include_transcending_msrs == 1) @@ -3180,7 +3119,7 @@ void dna_import::ExcludeAllOutsideBoundingBox(vdnaStnPtr* vStations, vdnaMsrPtr* // restore station vector, and erase stations not in vIncludedStns *vStations = bvStation; vExcludedStns->clear(); - TestNotEqualStationName selectStnFunc(&vIncludedStns, vExcludedStns); + TestNotEqualStationName selectStnFunc(&vIncludedStns, vExcludedStns); erase_if(vStations, selectStnFunc); // Rebuild station tally @@ -3188,7 +3127,7 @@ void dna_import::ExcludeAllOutsideBoundingBox(vdnaStnPtr* vStations, vdnaMsrPtr* } -void dna_import::ExtractStnsAndAssociatedMsrs(const string& stnListInclude, const string& stnListExclude, vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements, +void dna_import::ExtractStnsAndAssociatedMsrs(const std::string& stnListInclude, const std::string& stnListExclude, vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements, StnTally* parsestnTally, MsrTally* parsemsrTally, pvstring vExcludedStns, const project_settings& p, bool& splitXmsrs, bool& splitYmsrs) { @@ -3197,7 +3136,7 @@ void dna_import::ExtractStnsAndAssociatedMsrs(const string& stnListInclude, cons // backup station vector vdnaStnPtr bvStations = *vStations; - const string *stnListIn; + const std::string *stnListIn; vstring vIncludedStns; pvstring pvStnsIn, pvStnsEx; @@ -3227,7 +3166,7 @@ void dna_import::ExtractStnsAndAssociatedMsrs(const string& stnListInclude, cons // TestNotEqualStationName requires stations to be sorted (for binary_search) strip_duplicates(pvStnsIn); // Strip duplicates and sort - sort(pvStnsIn->begin(), pvStnsIn->end()); + std::sort(pvStnsIn->begin(), pvStnsIn->end()); pvStnsEx->clear(); @@ -3236,20 +3175,20 @@ void dna_import::ExtractStnsAndAssociatedMsrs(const string& stnListInclude, cons // This list will be used to strip the corresponding measurements. if (!stnListInclude.empty()) { - TestNotEqualStationName selectStnFunc(pvStnsIn, pvStnsEx); + TestNotEqualStationName selectStnFunc(pvStnsIn, pvStnsEx); erase_if(vStations, selectStnFunc); } else { - TestEqualStationName selectStnFunc(pvStnsIn, pvStnsEx); + TestEqualStationName selectStnFunc(pvStnsIn, pvStnsEx); erase_if(vStations, selectStnFunc); pvStnsIn = &vIncludedStns; pvStnsEx = vExcludedStns; - sort(pvStnsIn->begin(), pvStnsIn->end()); + std::sort(pvStnsIn->begin(), pvStnsIn->end()); } // FindMsrsConnectedToStns requires vExcludedStns to be sorted (for binary_search) - sort(pvStnsEx->begin(), pvStnsEx->end()); + std::sort(pvStnsEx->begin(), pvStnsEx->end()); // OK, get all measurements connected associated with vIncludedStns, splitting clusters as necessary if (!stnListInclude.empty()) @@ -3265,7 +3204,7 @@ void dna_import::ExtractStnsAndAssociatedMsrs(const string& stnListInclude, cons // ExtractAssociatedMsrsConnectedToStns retrieves *vStations = bvStations; pvStnsEx->clear(); - TestNotEqualStationName selectStnFunc(pvStnsIn, pvStnsEx); + TestNotEqualStationName selectStnFunc(pvStnsIn, pvStnsEx); erase_if(vStations, selectStnFunc); // Rebuild station tally @@ -3306,12 +3245,12 @@ void dna_import::SplitClusterMsrs(vdnaMsrPtr& msrsConnectedToStns, void dna_import::SplitClusterMsrsConnectedToStns(vdnaMsrPtr* vClusterMsrs, pvstring pvIncludedStns, pvstring pvExcludedStns, bool& splitXmsrs, bool& splitYmsrs) { _it_vdnamsrptr _it_msr; - vector* vgpsBsls; - vector* vgpsPnts; - vector* vgpsCovs; - vector::iterator _it_gps_bsl; - vector::iterator _it_gps_pnt; - vector::iterator _it_gps_cov; + std::vector* vgpsBsls; + std::vector* vgpsPnts; + std::vector* vgpsCovs; + std::vector::iterator _it_gps_bsl; + std::vector::iterator _it_gps_pnt; + std::vector::iterator _it_gps_cov; UINT32 msr(0), index(0), subindex(0), keepCount; vUINT32 vIndices; @@ -3549,10 +3488,10 @@ void dna_import::ExtractAssociatedMsrsBoundingBox(vdnaMsrPtr* vMeasurements, Msr } -void dna_import::ExtractAssociatedStns_GX(vector* vGpsBaselines, pvstring pvUsedStns) +void dna_import::ExtractAssociatedStns_GX(std::vector* vGpsBaselines, pvstring pvUsedStns) { - string station; - vector::iterator _it_msr(vGpsBaselines->begin()); + std::string station; + std::vector::iterator _it_msr(vGpsBaselines->begin()); _it_pair_vstring it_msr_stns; for (_it_msr=vGpsBaselines->begin(); _it_msr!=vGpsBaselines->end(); _it_msr++) @@ -3562,7 +3501,7 @@ void dna_import::ExtractAssociatedStns_GX(vector* vGpsBaselines if (it_msr_stns.first == it_msr_stns.second) { pvUsedStns->push_back(station); - sort(pvUsedStns->begin(), pvUsedStns->end()); + std::sort(pvUsedStns->begin(), pvUsedStns->end()); } station = _it_msr->GetTarget(); @@ -3570,15 +3509,15 @@ void dna_import::ExtractAssociatedStns_GX(vector* vGpsBaselines if (it_msr_stns.first == it_msr_stns.second) { pvUsedStns->push_back(station); - sort(pvUsedStns->begin(), pvUsedStns->end()); + std::sort(pvUsedStns->begin(), pvUsedStns->end()); } } } -void dna_import::ExtractAssociatedStns_Y(vector* vGpsPoints, pvstring pvUsedStns) +void dna_import::ExtractAssociatedStns_Y(std::vector* vGpsPoints, pvstring pvUsedStns) { - string station; - vector< CDnaGpsPoint >::iterator _it_msr(vGpsPoints->begin()); + std::string station; + std::vector< CDnaGpsPoint >::iterator _it_msr(vGpsPoints->begin()); _it_pair_vstring it_msr_stns; for (_it_msr=vGpsPoints->begin(); _it_msr!=vGpsPoints->end(); _it_msr++) @@ -3588,15 +3527,15 @@ void dna_import::ExtractAssociatedStns_Y(vector* vGpsPoints, pvstr if (it_msr_stns.first == it_msr_stns.second) { pvUsedStns->push_back(station); - sort(pvUsedStns->begin(), pvUsedStns->end()); + std::sort(pvUsedStns->begin(), pvUsedStns->end()); } } } -void dna_import::ExtractAssociatedStns_D(vector* vDirections, pvstring pvUsedStns) +void dna_import::ExtractAssociatedStns_D(std::vector* vDirections, pvstring pvUsedStns) { - string station; - vector::iterator _it_msr(vDirections->begin()); + std::string station; + std::vector::iterator _it_msr(vDirections->begin()); _it_pair_vstring it_msr_stns; for (_it_msr=vDirections->begin(); _it_msr!=vDirections->end(); _it_msr++) @@ -3606,7 +3545,7 @@ void dna_import::ExtractAssociatedStns_D(vector* vDirections, pvs if (it_msr_stns.first == it_msr_stns.second) { pvUsedStns->push_back(station); - sort(pvUsedStns->begin(), pvUsedStns->end()); + std::sort(pvUsedStns->begin(), pvUsedStns->end()); } station = _it_msr->GetTarget(); @@ -3614,7 +3553,7 @@ void dna_import::ExtractAssociatedStns_D(vector* vDirections, pvs if (it_msr_stns.first == it_msr_stns.second) { pvUsedStns->push_back(station); - sort(pvUsedStns->begin(), pvUsedStns->end()); + std::sort(pvUsedStns->begin(), pvUsedStns->end()); } } } @@ -3622,11 +3561,11 @@ void dna_import::ExtractAssociatedStns_D(vector* vDirections, pvs void dna_import::ExtractAssociatedStns(vdnaMsrPtr* vMeasurements, pvstring pvUsedStns) { _it_vdnamsrptr _it_msr; - vector* vdirns; - vector* vgpsBsls; - vector* vgpsPnts; + std::vector* vdirns; + std::vector* vgpsBsls; + std::vector* vgpsPnts; - string station; + std::string station; _it_pair_vstring it_msr_stns; @@ -3658,7 +3597,7 @@ void dna_import::ExtractAssociatedStns(vdnaMsrPtr* vMeasurements, pvstring pvUse if (it_msr_stns.first == it_msr_stns.second) { pvUsedStns->push_back(station); - sort(pvUsedStns->begin(), pvUsedStns->end()); + std::sort(pvUsedStns->begin(), pvUsedStns->end()); } // Finished with single station measurements @@ -3682,7 +3621,7 @@ void dna_import::ExtractAssociatedStns(vdnaMsrPtr* vMeasurements, pvstring pvUse if (it_msr_stns.first == it_msr_stns.second) { pvUsedStns->push_back(station); - sort(pvUsedStns->begin(), pvUsedStns->end()); + std::sort(pvUsedStns->begin(), pvUsedStns->end()); } // Dual station measurements... @@ -3700,7 +3639,7 @@ void dna_import::ExtractAssociatedStns(vdnaMsrPtr* vMeasurements, pvstring pvUse case 'M': // MSL arc case 'S': // Slope distance case 'L': // Level difference - case 'V': // Zenith angle + case 'V': // Zenith distance case 'Z': // Vertical angle continue; } @@ -3714,7 +3653,7 @@ void dna_import::ExtractAssociatedStns(vdnaMsrPtr* vMeasurements, pvstring pvUse if (it_msr_stns.first == it_msr_stns.second) { pvUsedStns->push_back(station); - sort(pvUsedStns->begin(), pvUsedStns->end()); + std::sort(pvUsedStns->begin(), pvUsedStns->end()); } } @@ -3745,7 +3684,7 @@ void dna_import::LoadBinaryFiles(pvstn_t binaryStn, pvmsr_t binaryMsr) dna_io_bms bms; bms.load_bms_file(projectSettings_.i.bms_file, binaryMsr, bms_meta_); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionInterop(e.what(), 0, NULL); } } @@ -3763,7 +3702,7 @@ void dna_import::LoadSegmentationFile(pvmsr_t binaryMsr) true, binaryMsr, &v_measurementCount_, &v_unknownsCount_, &v_ContiguousNetList_, &v_parameterStationCount_); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionInterop(e.what(), 0, NULL); } } @@ -3775,21 +3714,21 @@ void dna_import::LoadDatabaseId() if (databaseIDsLoaded_) return; - string dbid_filename = formPath(projectSettings_.g.output_folder, + std::string dbid_filename = formPath(projectSettings_.g.output_folder, projectSettings_.g.network_name, "dbid"); - stringstream ss; + std::stringstream ss; v_msr_db_map_.clear(); std::ifstream dbid_file; try { // Create geoid file. Throws runtime_error on failure. file_opener(dbid_file, dbid_filename, - ios::in | ios::binary, binary); + std::ios::in | std::ios::binary, binary); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } UINT32 r, recordCount; @@ -3825,7 +3764,7 @@ void dna_import::LoadDatabaseId() } catch (const std::ifstream::failure& f) { ss << f.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } } @@ -3840,15 +3779,15 @@ void dna_import::ImportStnsMsrsFromNetwork(vdnaStnPtr* vStations, vdnaMsrPtr* vM // Load Database IDs LoadDatabaseId(); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { throw XMLInteropException(e.what(), 0); } if ((p.i.import_network_number + 1) > v_ContiguousNetList_.size()) { - stringstream ss; + std::stringstream ss; ss << "The specified network ID " << p.i.import_network_number << - " does not exist in the list of " << endl << + " does not exist in the list of " << std::endl << " identified contiguous Network IDs (0 to " << (v_ContiguousNetList_.size() - 1) << ")."; throw XMLInteropException(ss.str(), 0); } @@ -3979,7 +3918,7 @@ void dna_import::ImportStnsMsrsFromNetwork(vdnaStnPtr* vStations, vdnaMsrPtr* vM case 'S': // Slope distance g_parsemsr_tally.S++; break; - case 'V': // Zenith angle + case 'V': // Zenith distance g_parsemsr_tally.V++; break; case 'X': // GPS Baseline cluster @@ -4021,15 +3960,15 @@ void dna_import::ImportStnsMsrsFromBlock(vdnaStnPtr* vStations, vdnaMsrPtr* vMea // Load Database IDs LoadDatabaseId(); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { throw XMLInteropException(e.what(), 0); } if (p.i.import_block_number > v_ISL_.size()) { - stringstream ss; + std::stringstream ss; ss << "The specified block number " << p.i.import_block_number << - " exceeds the total number of " << endl << + " exceeds the total number of " << std::endl << " segmented blocks (" << v_ISL_.size() << ")."; throw XMLInteropException(ss.str(), 0); } @@ -4137,7 +4076,7 @@ void dna_import::ImportStnsMsrsFromBlock(vdnaStnPtr* vStations, vdnaMsrPtr* vMea case 'S': // Slope distance g_parsemsr_tally.S++; break; - case 'V': // Zenith angle + case 'V': // Zenith distance g_parsemsr_tally.V++; break; case 'X': // GPS Baseline cluster @@ -4170,10 +4109,10 @@ void dna_import::RemoveNonMeasurements(const UINT32& block, pvmsr_t binaryMsr) if (v_CML_.at(block).size() < 2) return; CompareNonMeasStart measstartCompareFunc(binaryMsr, xMeas); - sort(v_CML_.at(block).begin(), v_CML_.at(block).end(), measstartCompareFunc); + std::sort(v_CML_.at(block).begin(), v_CML_.at(block).end(), measstartCompareFunc); erase_if(v_CML_.at(block), measstartCompareFunc); CompareMsrFileOrder fileorderCompareFunc(binaryMsr); - sort(v_CML_.at(block).begin(), v_CML_.at(block).end(), fileorderCompareFunc); + std::sort(v_CML_.at(block).begin(), v_CML_.at(block).end(), fileorderCompareFunc); } @@ -4208,22 +4147,22 @@ void dna_import::SignalComplete() import_file_mutex.unlock(); } -void dna_import::SignalExceptionParse(string msg, int i) +void dna_import::SignalExceptionParse(std::string msg, int i) { SignalComplete(); size_t s = msg.find("is not allowed for content model"); - if (s != string::npos) + if (s != std::string::npos) msg += "\n - check that the order of elements in the XML file matches the order of the XSD complex type elements."; parseStatus_ = PARSE_EXCEPTION_RAISED; throw XMLInteropException(msg, i); } -void dna_import::SignalExceptionParseDNA(const string& message, const string& sBuf, const int& column_no) +void dna_import::SignalExceptionParseDNA(const std::string& message, const std::string& sBuf, const int& column_no) { - stringstream ss; - ss << message << endl; + std::stringstream ss; + ss << message << std::endl; if (!sBuf.empty()) - ss << " " << sBuf << endl; + ss << " " << sBuf << std::endl; m_columnNo = column_no + 1; throw XMLInteropException(ss.str(), m_lineNo); } @@ -4233,7 +4172,7 @@ void dna_import::SignalExceptionParseDNA(const string& message, const string& sB // Purpose: Closes all files (if file pointers are passed in) and throws XMLInteropException // Called by: Any // Calls: XMLInteropException() -void dna_import::SignalExceptionInterop(string msg, int i, const char *streamType, ...) +void dna_import::SignalExceptionInterop(std::string msg, int i, const char *streamType, ...) { if (streamType == NULL) throw XMLInteropException(msg, i); @@ -4265,28 +4204,60 @@ void dna_import::SignalExceptionInterop(string msg, int i, const char *streamTyp throw XMLInteropException(msg, i); } - -void dna_import::SerialiseDNA(vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements, - const string& stnfilename, const string& msrfilename, - const project_settings& p, vifm_t* vinput_file_meta, bool flagUnused) +void dna_import::SerialiseMSR(vdnaMsrPtr* vMeasurements, const std::string& msrfilename, + const project_settings& p, vifm_t* vinput_file_meta) { - try - { - // Reset the default datum. - datum_.SetDatumFromEpsg(m_strProjectDefaultEpsg, m_strProjectDefaultEpoch); + // Measurements + std::ofstream dna_msr_file; + try { + // Create DynAdjust MSR file. + file_opener(dna_msr_file, msrfilename); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionInterop(e.what(), 0, NULL); } + _it_vdnamsrptr _it_msr(vMeasurements->begin()); + + try { + // Write version line + dna_header(dna_msr_file, "3.01", "MSR", datum_.GetName(), datum_.GetEpoch_s(), vMeasurements->size()); + + // Capture source files + std::string source_files(formatStnMsrFileSourceString(vinput_file_meta, msr_data)); + + // Write header comment lines about this file + dna_comment(dna_msr_file, "File type: Measurement file"); + dna_comment(dna_msr_file, "Project name: " + p.g.network_name); + dna_comment(dna_msr_file, "Source files: " + source_files); + + // print measurements + for (_it_msr = vMeasurements->begin(); _it_msr != vMeasurements->end(); _it_msr++) + _it_msr->get()->WriteDNAMsr(&dna_msr_file, dmw_, dml_); + + dna_msr_file.close(); + + } + catch (const std::ifstream::failure& f) { + SignalExceptionInterop(static_cast(f.what()), 0, "o", &dna_msr_file); + } + catch (const XMLInteropException& e) { + SignalExceptionInterop(static_cast(e.what()), 0, "o", &dna_msr_file); + } +} + + +void dna_import::SerialiseSTN(vdnaStnPtr* vStations, const std::string& stnfilename, + const project_settings& p, vifm_t* vinput_file_meta, bool flagUnused) +{ // Stations std::ofstream dna_stn_file; try { // Create DynAdjust STN file. file_opener(dna_stn_file, stnfilename); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionInterop(e.what(), 0, NULL); } @@ -4301,13 +4272,13 @@ void dna_import::SerialiseDNA(vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements, // Has the user specified --flag-unused-stations, in which case, do not // print stations marked unused? UINT32 count(0); - if (flagUnused) + if (flagUnused) { for_each(vStations->begin(), vStations->end(), [&count](const dnaStnPtr& stn) { if (stn.get()->IsNotUnused()) count++; - }); + }); } else count = static_cast(vStations->size()); @@ -4316,7 +4287,7 @@ void dna_import::SerialiseDNA(vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements, dna_header(dna_stn_file, "3.01", "STN", datum_.GetName(), datum_.GetEpoch_s(), count); // Capture source files - string source_files(formatStnMsrFileSourceString(vinput_file_meta, stn_data)); + std::string source_files(formatStnMsrFileSourceString(vinput_file_meta, stn_data)); // Write header comment lines about this file dna_comment(dna_stn_file, "File type: Station file"); @@ -4326,81 +4297,64 @@ void dna_import::SerialiseDNA(vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements, // print stations // Has the user specified --flag-unused-stations, in wich case, do not // print stations marked unused? - if (flagUnused) + if (flagUnused) { - for (_it_stn=vStations->begin(); _it_stn!=vStations->end(); _it_stn++) + for (_it_stn = vStations->begin(); _it_stn != vStations->end(); _it_stn++) if (_it_stn->get()->IsNotUnused()) _it_stn->get()->WriteDNAXMLStnInitialEstimates(&dna_stn_file, - datum_.GetEllipsoidRef(), &projection, - dna, &dsw_); + datum_.GetEllipsoidRef(), &projection, + dna, &dsw_); } else { // print all stations regardless of whether they are unused or not - for (_it_stn=vStations->begin(); _it_stn!=vStations->end(); _it_stn++) + for (_it_stn = vStations->begin(); _it_stn != vStations->end(); _it_stn++) _it_stn->get()->WriteDNAXMLStnInitialEstimates(&dna_stn_file, - datum_.GetEllipsoidRef(), &projection, - dna, &dsw_); + datum_.GetEllipsoidRef(), &projection, + dna, &dsw_); } dna_stn_file.close(); } catch (const std::ifstream::failure& f) { - SignalExceptionInterop(static_cast(f.what()), 0, "o", &dna_stn_file); + SignalExceptionInterop(static_cast(f.what()), 0, "o", &dna_stn_file); } - catch (const XMLInteropException& e) { - SignalExceptionInterop(static_cast(e.what()), 0, "o", &dna_stn_file); + catch (const XMLInteropException& e) { + SignalExceptionInterop(static_cast(e.what()), 0, "o", &dna_stn_file); } +} - // Measurements - std::ofstream dna_msr_file; - try { - // Create DynAdjust MSR file. - file_opener(dna_msr_file, msrfilename); +void dna_import::SerialiseDNA(vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements, + const std::string& stnfilename, const std::string& msrfilename, + const project_settings& p, vifm_t* vinput_file_meta, bool flagUnused) +{ + try + { + // Reset the default datum. + datum_.SetDatumFromEpsg(m_strProjectDefaultEpsg, m_strProjectDefaultEpoch); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionInterop(e.what(), 0, NULL); } - _it_vdnamsrptr _it_msr(vMeasurements->begin()); - - try { - // Write version line - dna_header(dna_msr_file, "3.01", "MSR", datum_.GetName(), datum_.GetEpoch_s(), vMeasurements->size()); - - // Capture source files - string source_files(formatStnMsrFileSourceString(vinput_file_meta, msr_data)); - - // Write header comment lines about this file - dna_comment(dna_msr_file, "File type: Measurement file"); - dna_comment(dna_msr_file, "Project name: " + p.g.network_name); - dna_comment(dna_msr_file, "Source files: " + source_files); - - // print measurements - for (_it_msr=vMeasurements->begin(); _it_msr!=vMeasurements->end(); _it_msr++) - _it_msr->get()->WriteDNAMsr(&dna_msr_file, dmw_, dml_); - - dna_msr_file.close(); - - } - catch (const std::ifstream::failure& f) { - SignalExceptionInterop(static_cast(f.what()), 0, "o", &dna_msr_file); - } - catch (const XMLInteropException& e) { - SignalExceptionInterop(static_cast(e.what()), 0, "o", &dna_msr_file); - } + // Write stations (if present) + if (!vStations->empty()) + SerialiseSTN(vStations, stnfilename, p, vinput_file_meta, flagUnused); + // Write measurements (if present) + if (!vMeasurements->empty()) + SerialiseMSR(vMeasurements, msrfilename, p, vinput_file_meta); } void dna_import::InitialiseDynaMLFile(const project_settings& p, vifm_t* vinput_file_meta, - const string& outfilename, std::ofstream* dynaml_file) + const std::string& outfilename, std::ofstream* dynaml_file) { // create combined filename - string dynamlfilename(outfilename); - size_t dp = string::npos; - if ((dp = dynamlfilename.rfind(".")) == string::npos) + std::string dynamlfilename(outfilename); + size_t dp = std::string::npos; + if ((dp = dynamlfilename.rfind(".")) == std::string::npos) dynamlfilename += ".xml"; try @@ -4408,7 +4362,7 @@ void dna_import::InitialiseDynaMLFile(const project_settings& p, vifm_t* vinput_ // Reset the default datum. datum_.SetDatumFromEpsg(m_strProjectDefaultEpsg, m_strProjectDefaultEpoch); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionInterop(e.what(), 0, NULL); } @@ -4420,30 +4374,30 @@ void dna_import::InitialiseDynaMLFile(const project_settings& p, vifm_t* vinput_ dynaml_header(*dynaml_file, "Combined File", datum_.GetName(), datum_.GetEpoch_s()); // Capture source files - string source_files(formatStnMsrFileSourceString(vinput_file_meta, stn_msr_data)); + std::string source_files(formatStnMsrFileSourceString(vinput_file_meta, stn_msr_data)); // Write header comment lines about this file dynaml_comment(*dynaml_file, "File type: Combined station and measurements file"); dynaml_comment(*dynaml_file, "Project name: " + p.g.network_name); dynaml_comment(*dynaml_file, "Source files: " + source_files); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionInterop(e.what(), 0, NULL); } } // A useful, but unnecessary function // -//void dna_import::SerialiseDynaMLfromBinary(const string& outfilename, +//void dna_import::SerialiseDynaMLfromBinary(const std::string& outfilename, // const project_settings& p, vifm_t* vinput_file_meta, bool flagUnused) //{ // // Load stations from binary file and serialise to XML // std::ifstream bst_file; // try { // // Load binary stations data. Throws runtime_error on failure. -// file_opener(bst_file, p.i.bst_file, ios::in | ios::binary, binary, true); +// file_opener(bst_file, p.i.bst_file, std::ios::in | std::ios::binary, binary, true); // } -// catch (const runtime_error& e) { +// catch (const std::runtime_error& e) { // SignalExceptionInterop(e.what(), 0, NULL); // } // @@ -4454,17 +4408,17 @@ void dna_import::InitialiseDynaMLFile(const project_settings& p, vifm_t* vinput_ // try { // SerialiseXmlStn(&bst_file, &dynaml_file); // } -// catch (const ios_base::failure& f) { -// SignalExceptionInterop(static_cast(f.what()), 0, +// catch (const std::ios_base::failure& f) { +// SignalExceptionInterop(static_cast(f.what()), 0, // "io", &bst_file, &dynaml_file); // } // // std::ifstream bms_file; // try { // // Load binary measurements data. Throws runtime_error on failure. -// file_opener(bms_file, p.i.bms_file, ios::in | ios::binary, binary, true); +// file_opener(bms_file, p.i.bms_file, std::ios::in | std::ios::binary, binary, true); // } -// catch (const runtime_error& e) { +// catch (const std::runtime_error& e) { // SignalExceptionInterop(e.what(), 0, NULL); // } // @@ -4473,28 +4427,28 @@ void dna_import::InitialiseDynaMLFile(const project_settings& p, vifm_t* vinput_ // SerialiseXmlMsr(&bst_file, &bms_file, &dynaml_file); // } // catch (const std::ifstream::failure& f) { -// SignalExceptionInterop(static_cast(f.what()), 0, +// SignalExceptionInterop(static_cast(f.what()), 0, // "iio", &bst_file, &bms_file, &dynaml_file); // } // catch (const XMLInteropException& e) { -// SignalExceptionInterop(static_cast(e.what()), 0, +// SignalExceptionInterop(static_cast(e.what()), 0, // "iio", &bst_file, &bms_file, &dynaml_file); // } // // bst_file.close(); // bms_file.close(); -// dynaml_file << "" << endl; +// dynaml_file << "" << std::endl; // dynaml_file.close(); //} void dna_import::SerialiseDynaMLfromMemory(vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements, - const string& outfilename, const project_settings& p, vifm_t* vinput_file_meta, bool flagUnused) + const std::string& outfilename, const project_settings& p, vifm_t* vinput_file_meta, bool flagUnused) { // create combined filename - string dynamlfilename(outfilename); - size_t dp = string::npos; - if ((dp = dynamlfilename.rfind(".")) == string::npos) + std::string dynamlfilename(outfilename); + size_t dp = std::string::npos; + if ((dp = dynamlfilename.rfind(".")) == std::string::npos) dynamlfilename += ".xml"; try @@ -4502,7 +4456,7 @@ void dna_import::SerialiseDynaMLfromMemory(vdnaStnPtr* vStations, vdnaMsrPtr* vM // Reset the default datum. datum_.SetDatumFromEpsg(m_strProjectDefaultEpsg, m_strProjectDefaultEpoch); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionInterop(e.what(), 0, NULL); } @@ -4510,7 +4464,7 @@ void dna_import::SerialiseDynaMLfromMemory(vdnaStnPtr* vStations, vdnaMsrPtr* vM InitialiseDynaMLFile(p, vinput_file_meta, outfilename, &dynaml_file); CDnaProjection projection(UTM); - string comment(""); + std::string comment(""); try { // Write the stations (from memory) @@ -4539,28 +4493,28 @@ void dna_import::SerialiseDynaMLfromMemory(vdnaStnPtr* vStations, vdnaMsrPtr* vM }); } catch (const std::ifstream::failure& f) { - SignalExceptionInterop(static_cast(f.what()), 0, + SignalExceptionInterop(static_cast(f.what()), 0, "o", &dynaml_file); } catch (const XMLInteropException& e) { - SignalExceptionInterop(static_cast(e.what()), 0, + SignalExceptionInterop(static_cast(e.what()), 0, "o", &dynaml_file); } - dynaml_file << "" << endl; + dynaml_file << "" << std::endl; dynaml_file.close(); } void dna_import::InitialiseDynaMLSepStationFile(const project_settings& p, vifm_t* vinput_file_meta, - const string& stnfilename, std::ofstream* dynaml_stn_file) + const std::string& stnfilename, std::ofstream* dynaml_stn_file) { try { // Reset the default datum. datum_.SetDatumFromEpsg(m_strProjectDefaultEpsg, m_strProjectDefaultEpoch); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionInterop(e.what(), 0, NULL); } @@ -4572,20 +4526,20 @@ void dna_import::InitialiseDynaMLSepStationFile(const project_settings& p, vifm_ dynaml_header(*dynaml_stn_file, "Station File", datum_.GetName(), datum_.GetEpoch_s()); // Capture source files - string source_files(formatStnMsrFileSourceString(vinput_file_meta, stn_data)); + std::string source_files(formatStnMsrFileSourceString(vinput_file_meta, stn_data)); // Write header comment lines about this file dynaml_comment(*dynaml_stn_file, "File type: Station file"); dynaml_comment(*dynaml_stn_file, "Project name: " + p.g.network_name); dynaml_comment(*dynaml_stn_file, "Source files: " + source_files); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionInterop(e.what(), 0, NULL); } } void dna_import::InitialiseDynaMLSepMeasurementFile(const project_settings& p, vifm_t* vinput_file_meta, - const string& msrfilename, std::ofstream* dynaml_msr_file) + const std::string& msrfilename, std::ofstream* dynaml_msr_file) { try { // Create DynaML measurement file. @@ -4595,30 +4549,30 @@ void dna_import::InitialiseDynaMLSepMeasurementFile(const project_settings& p, v dynaml_header(*dynaml_msr_file, "Measurement File", datum_.GetName(), datum_.GetEpoch_s()); // Capture source files - string source_files(formatStnMsrFileSourceString(vinput_file_meta, msr_data)); + std::string source_files(formatStnMsrFileSourceString(vinput_file_meta, msr_data)); // Write header comment lines about this file dynaml_comment(*dynaml_msr_file, "File type: Measurement file"); dynaml_comment(*dynaml_msr_file, "Project name: " + p.g.network_name); dynaml_comment(*dynaml_msr_file, "Source files: " + source_files); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionInterop(e.what(), 0, NULL); } } // A useful, but unnecessary function // -//void dna_import::SerialiseDynaMLSepfromBinary(const string& stnfilename, const string& msrfilename, +//void dna_import::SerialiseDynaMLSepfromBinary(const std::string& stnfilename, const std::string& msrfilename, // const project_settings& p, vifm_t* vinput_file_meta, bool flagUnused) //{ // // Load stations from binary file and serialise to XML // std::ifstream bst_file; // try { // // Load binary stations data. Throws runtime_error on failure. -// file_opener(bst_file, p.i.bst_file, ios::in | ios::binary, binary, true); +// file_opener(bst_file, p.i.bst_file, std::ios::in | std::ios::binary, binary, true); // } -// catch (const runtime_error& e) { +// catch (const std::runtime_error& e) { // SignalExceptionInterop(e.what(), 0, NULL); // } // @@ -4629,20 +4583,20 @@ void dna_import::InitialiseDynaMLSepMeasurementFile(const project_settings& p, v // // Write the stations (from binary file) // try { // SerialiseXmlStn(&bst_file, &dynaml_stn_file); -// dynaml_stn_file << "" << endl; +// dynaml_stn_file << "" << std::endl; // dynaml_stn_file.close(); // } -// catch (const ios_base::failure& f) { -// SignalExceptionInterop(static_cast(f.what()), 0, +// catch (const std::ios_base::failure& f) { +// SignalExceptionInterop(static_cast(f.what()), 0, // "io", &bst_file, &dynaml_stn_file); // } // // std::ifstream bms_file; // try { // // Load binary measurements data. Throws runtime_error on failure. -// file_opener(bms_file, p.i.bms_file, ios::in | ios::binary, binary, true); +// file_opener(bms_file, p.i.bms_file, std::ios::in | std::ios::binary, binary, true); // } -// catch (const runtime_error& e) { +// catch (const std::runtime_error& e) { // SignalExceptionInterop(e.what(), 0, NULL); // } // @@ -4653,15 +4607,15 @@ void dna_import::InitialiseDynaMLSepMeasurementFile(const project_settings& p, v // // Write the measurements (from binary file) // try { // SerialiseXmlMsr(&bst_file, &bms_file, &dynaml_msr_file); -// dynaml_msr_file << "" << endl; +// dynaml_msr_file << "" << std::endl; // dynaml_msr_file.close(); // } // catch (const std::ifstream::failure& f) { -// SignalExceptionInterop(static_cast(f.what()), 0, +// SignalExceptionInterop(static_cast(f.what()), 0, // "iio", &bst_file, &bms_file, &dynaml_msr_file); // } // catch (const XMLInteropException& e) { -// SignalExceptionInterop(static_cast(e.what()), 0, +// SignalExceptionInterop(static_cast(e.what()), 0, // "iio", &bst_file, &bms_file, &dynaml_msr_file); // } // @@ -4671,7 +4625,7 @@ void dna_import::InitialiseDynaMLSepMeasurementFile(const project_settings& p, v void dna_import::SerialiseDynaMLSepfromMemory(vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements, - const string& stnfilename, const string& msrfilename, + const std::string& stnfilename, const std::string& msrfilename, const project_settings& p, vifm_t* vinput_file_meta, bool flagUnused) { // Create Station file and initialise header @@ -4679,7 +4633,7 @@ void dna_import::SerialiseDynaMLSepfromMemory(vdnaStnPtr* vStations, vdnaMsrPtr* InitialiseDynaMLSepStationFile(p, vinput_file_meta, stnfilename, &dynaml_stn_file); CDnaProjection projection(UTM); - string comment(""); + std::string comment(""); // Write the stations (from memory) try { @@ -4701,15 +4655,15 @@ void dna_import::SerialiseDynaMLSepfromMemory(vdnaStnPtr* vStations, vdnaMsrPtr* }); } - dynaml_stn_file << "" << endl; + dynaml_stn_file << "" << std::endl; dynaml_stn_file.close(); } catch (const std::ifstream::failure& f) { - SignalExceptionInterop(static_cast(f.what()), 0, "o", &dynaml_stn_file); + SignalExceptionInterop(static_cast(f.what()), 0, "o", &dynaml_stn_file); } catch (const XMLInteropException& e) { - SignalExceptionInterop(static_cast(e.what()), 0, "o", &dynaml_stn_file); + SignalExceptionInterop(static_cast(e.what()), 0, "o", &dynaml_stn_file); } // Create Measurement file and initialise header @@ -4723,27 +4677,27 @@ void dna_import::SerialiseDynaMLSepfromMemory(vdnaStnPtr* vStations, vdnaMsrPtr* msr->WriteDynaMLMsr(&dynaml_msr_file, comment); }); - dynaml_msr_file << "" << endl; + dynaml_msr_file << "" << std::endl; dynaml_msr_file.close(); } catch (const std::ifstream::failure& f) { - SignalExceptionInterop(static_cast(f.what()), 0, "o", &dynaml_msr_file); + SignalExceptionInterop(static_cast(f.what()), 0, "o", &dynaml_msr_file); } catch (const XMLInteropException& e) { - SignalExceptionInterop(static_cast(e.what()), 0, "o", &dynaml_msr_file); + SignalExceptionInterop(static_cast(e.what()), 0, "o", &dynaml_msr_file); } } -//void dna_import::SerialiseGeoidData(vdnaStnPtr* vStations, const string& geofilename) +//void dna_import::SerialiseGeoidData(vdnaStnPtr* vStations, const std::string& geofilename) //{ // std::ofstream dynaml_geo_file; // try { // // Create geoid file. Throws runtime_error on failure. // file_opener(dynaml_geo_file, geofilename); // } -// catch (const runtime_error& e) { +// catch (const std::runtime_error& e) { // SignalExceptionInterop(e.what(), 0, NULL); // } // @@ -4760,10 +4714,10 @@ void dna_import::SerialiseDynaMLSepfromMemory(vdnaStnPtr* vStations, vdnaMsrPtr* // // } // catch (const std::ifstream::failure& f) { -// SignalExceptionInterop(static_cast(f.what()), 0, "o", &dynaml_geo_file); +// SignalExceptionInterop(static_cast(f.what()), 0, "o", &dynaml_geo_file); // } // catch (const XMLInteropException& e) { -// SignalExceptionInterop(static_cast(e.what()), 0, "o", &dynaml_geo_file); +// SignalExceptionInterop(static_cast(e.what()), 0, "o", &dynaml_geo_file); // } //} @@ -4777,7 +4731,7 @@ void dna_import::SerialiseDynaMLSepfromMemory(vdnaStnPtr* vStations, vdnaMsrPtr* // // Reset the default datum. // datum_.SetDatumFromEpsg(m_strProjectDefaultEpsg, m_strProjectDefaultEpoch); // } -// catch (const runtime_error& e) { +// catch (const std::runtime_error& e) { // SignalExceptionInterop(e.what(), 0, NULL); // } // @@ -4811,7 +4765,7 @@ void dna_import::SerialiseDynaMLSepfromMemory(vdnaStnPtr* vStations, vdnaMsrPtr* // // Reset the default datum. // datum_.SetDatumFromEpsg(m_strProjectDefaultEpsg, m_strProjectDefaultEpoch); // } -// catch (const runtime_error& e) { +// catch (const std::runtime_error& e) { // SignalExceptionInterop(e.what(), 0, NULL); // } // @@ -4821,7 +4775,7 @@ void dna_import::SerialiseDynaMLSepfromMemory(vdnaStnPtr* vStations, vdnaMsrPtr* // // // get number of measurements // UINT32 msrCount; -// string comment(""); +// std::string comment(""); // ifs_msrs->read(reinterpret_cast(&msrCount), sizeof(UINT32)); // // for (UINT32 i=0; i(vStations->size()); bst_meta_.inputFileCount = bst.create_stn_input_file_meta(vinput_file_meta, &(bst_meta_.inputFileMeta)); bst_meta_.reduced = true; + bst_meta_.reftran = false; + bst_meta_.geoid = false; bst.write_bst_file(bst_filename, vStations, vUnusedStns, bst_meta_, flagUnused); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionInterop(e.what(), 0, NULL); } } @@ -4890,15 +4848,15 @@ void dna_import::SerialiseBst(const string& bst_filename, vdnaStnPtr* vStations, // First item in the file is a UINT32 value - the number of records in the file // All records are of type UINT32 -void dna_import::SerialiseDatabaseId(const string& dbid_filename, pvdnaMsrPtr vMeasurements) +void dna_import::SerialiseDatabaseId(const std::string& dbid_filename, pvdnaMsrPtr vMeasurements) { std::ofstream dbid_file; try { // Create geoid file. Throws runtime_error on failure. file_opener(dbid_file, dbid_filename, - ios::out | ios::binary, binary); + std::ios::out | std::ios::binary, binary); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionInterop(e.what(), 0, NULL); } @@ -4915,16 +4873,16 @@ void dna_import::SerialiseDatabaseId(const string& dbid_filename, pvdnaMsrPtr vM dbid_file.close(); } catch (const std::ifstream::failure& f) { - SignalExceptionInterop(static_cast(f.what()), 0, NULL); + SignalExceptionInterop(static_cast(f.what()), 0, NULL); } catch (const XMLInteropException& e) { - SignalExceptionInterop(static_cast(e.what()), 0, NULL); + SignalExceptionInterop(static_cast(e.what()), 0, NULL); } } -void dna_import::PrintMeasurementsToStations(string& m2s_file, MsrTally* parsemsrTally, - string& bst_file, string& bms_file, string& aml_file, pvASLPtr vAssocStnList) +void dna_import::PrintMeasurementsToStations(std::string& m2s_file, MsrTally* parsemsrTally, + std::string& bst_file, std::string& bms_file, std::string& aml_file, pvASLPtr vAssocStnList) { dna_io_aml aml; vmsrtally v_stnmsrTally; @@ -4945,7 +4903,7 @@ void dna_import::PrintMeasurementsToStations(string& m2s_file, MsrTally* parsems // Load aml file. Throws runtime_error on failure. aml.load_aml_file(aml_file, &vAssocMsrList, &bmsBinaryRecords); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionInterop(e.what(), 0, NULL); } @@ -4963,7 +4921,7 @@ void dna_import::PrintMeasurementsToStations(string& m2s_file, MsrTally* parsems { // sort summary according to measurement to station count CompareMeasCount2 msrcountCompareFunc(vAssocStnList); - sort(vStationList.begin(), vStationList.end(), msrcountCompareFunc); + std::sort(vStationList.begin(), vStationList.end(), msrcountCompareFunc); } break; case orig_stn_sort_ui: @@ -4971,7 +4929,7 @@ void dna_import::PrintMeasurementsToStations(string& m2s_file, MsrTally* parsems { // sort summary according to original station file order CompareStnFileOrder stnorderCompareFunc(&bstBinaryRecords); - sort(vStationList.begin(), vStationList.end(), stnorderCompareFunc); + std::sort(vStationList.begin(), vStationList.end(), stnorderCompareFunc); } break; } @@ -4985,23 +4943,23 @@ void dna_import::PrintMeasurementsToStations(string& m2s_file, MsrTally* parsems // Print formatted header print_file_header(m2s_stream, "DYNADJUST MEASUREMENT TO STATION OUTPUT FILE"); - m2s_stream << setw(PRINT_VAR_PAD) << left << "File name:" << system_complete(m2s_file).string() << endl << endl; + m2s_stream << std::setw(PRINT_VAR_PAD) << std::left << "File name:" << boost::filesystem::system_complete(m2s_file).string() << std::endl << std::endl; - m2s_stream << setw(PRINT_VAR_PAD) << left << "Associated measurement file: " << system_complete(aml_file).string() << endl; - m2s_stream << setw(PRINT_VAR_PAD) << left << "Stations file:" << system_complete(bst_file).string() << endl; - m2s_stream << setw(PRINT_VAR_PAD) << left << "Measurements file:" << system_complete(bms_file).string() << endl; + m2s_stream << std::setw(PRINT_VAR_PAD) << std::left << "Associated measurement file: " << boost::filesystem::system_complete(aml_file).string() << std::endl; + m2s_stream << std::setw(PRINT_VAR_PAD) << std::left << "Stations file:" << boost::filesystem::system_complete(bst_file).string() << std::endl; + m2s_stream << std::setw(PRINT_VAR_PAD) << std::left << "Measurements file:" << boost::filesystem::system_complete(bms_file).string() << std::endl; // Print station count - m2s_stream << endl; - m2s_stream << setw(PRINT_VAR_PAD) << left << "No. stations:" << vStationList.size() << endl; + m2s_stream << std::endl; + m2s_stream << std::setw(PRINT_VAR_PAD) << std::left << "No. stations:" << vStationList.size() << std::endl; - m2s_stream << OUTPUTLINE << endl << endl; + m2s_stream << OUTPUTLINE << std::endl << std::endl; aml.write_msr_to_stn(m2s_stream, &bstBinaryRecords, &vStationList, v_stnmsrTally, parsemsrTally); m2s_stream.close(); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionInterop(e.what(), 0, NULL); } } @@ -5009,27 +4967,27 @@ void dna_import::PrintMeasurementsToStations(string& m2s_file, MsrTally* parsems // First item in the file is a UINT32 value - the number of records in the file // All records are of type UINT32 -void dna_import::SerialiseAml(const string& aml_filename, pvUINT32 vAML) +void dna_import::SerialiseAml(const std::string& aml_filename, pvUINT32 vAML) { try { // write the aml file. dna_io_aml aml; aml.write_aml_file(aml_filename, vAML); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionInterop(e.what(), 0, NULL); } } -void dna_import::SerialiseAmlTextFile(const string& bms_filename, const string& aml_filename, pvUINT32 vAML, pvASLPtr vAssocStnList, vdnaStnPtr* vStations) +void dna_import::SerialiseAmlTextFile(const std::string& bms_filename, const std::string& aml_filename, pvUINT32 vAML, pvASLPtr vAssocStnList, vdnaStnPtr* vStations) { try { // write the aml file as raw text. dna_io_aml aml; aml.write_aml_file_txt(bms_filename, aml_filename + ".txt", vAML, vAssocStnList, vStations); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionInterop(e.what(), 0, NULL); } } @@ -5037,14 +4995,14 @@ void dna_import::SerialiseAmlTextFile(const string& bms_filename, const string& // First item in the file is a UINT32 value - the number of records in the file // All records are of type ASLPtr -void dna_import::SerialiseAsl(const string& filename, pvASLPtr vAssocStnList) +void dna_import::SerialiseAsl(const std::string& filename, pvASLPtr vAssocStnList) { try { // write the asl file. dna_io_asl asl; asl.write_asl_file(filename, vAssocStnList); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionInterop(e.what(), 0, NULL); } } @@ -5052,14 +5010,14 @@ void dna_import::SerialiseAsl(const string& filename, pvASLPtr vAssocStnList) // First item in the file is a UINT32 value - the number of records in the file // All records are of type ASLPtr -void dna_import::SerialiseAslTextFile(const string& filename, pvASLPtr vAssocStnList, vdnaStnPtr* vStations) +void dna_import::SerialiseAslTextFile(const std::string& filename, pvASLPtr vAssocStnList, vdnaStnPtr* vStations) { try { // write the ASCII version of the asl file. dna_io_asl asl; asl.write_asl_file_txt(filename + ".txt", vAssocStnList, vStations); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionInterop(e.what(), 0, NULL); } } @@ -5075,10 +5033,10 @@ UINT32 dna_import::RemoveDuplicateStations(vdnaStnPtr* vStations, _it_vdnastnptr _it_stn_newend; // sort vStations on name and if equal, sort on file order - sort(vStations->begin(), vStations->end(), CompareStationName()); + std::sort(vStations->begin(), vStations->end(), CompareStationName()); vduplicateStations->clear(); - EqualStationNameSaveDuplicates duplicateStnCompareFunc(vduplicateStations); + EqualStationNameSaveDuplicates duplicateStnCompareFunc(vduplicateStations); _it_stn_newend = unique(vStations->begin(), vStations->end(), duplicateStnCompareFunc); if (_it_stn_newend != vStations->end()) @@ -5090,7 +5048,7 @@ UINT32 dna_import::RemoveDuplicateStations(vdnaStnPtr* vStations, // search nearby stations using a radial search // // begin by sorting on latitude - sort(vStations->begin(), vStations->end(), CompareLatitude()); + std::sort(vStations->begin(), vStations->end(), CompareLatitude()); vnearbyStations->clear(); NearbyStation_LowAcc @@ -5106,10 +5064,10 @@ UINT32 dna_import::RemoveDuplicateStations(vdnaStnPtr* vStations, copy_if_all_occurrences(vStations->begin(), vStations->end(), nearbyStnHCompareFunc); // sort station pairs by name - sort(vnearbyStations->begin(), vnearbyStations->end(), CompareStationPairs()); + std::sort(vnearbyStations->begin(), vnearbyStations->end(), CompareStationPairs()); // sort by station name - sort(vStations->begin(), vStations->end()); + std::sort(vStations->begin(), vStations->end()); return static_cast(vnearbyStations->size()); } @@ -5118,7 +5076,7 @@ UINT32 dna_import::RemoveDuplicateStations(vdnaStnPtr* vStations, UINT32 dna_import::FindSimilarMeasurements(vdnaMsrPtr* vMeasurements, vdnaMsrPtr* vSimilarMeasurements) { // sort measurements list by Type then by First station - sort(vMeasurements->begin(), vMeasurements->end(), CompareMsr()); + std::sort(vMeasurements->begin(), vMeasurements->end(), CompareMsr()); //bool similar; int similar_msrs_found(0); @@ -5212,7 +5170,7 @@ UINT32 dna_import::FindSimilarMeasurements(vdnaMsrPtr* vMeasurements, vdnaMsrPtr continue; break; - case 'V': // Zenith angle + case 'V': // Zenith distance case 'Z': // Vertical angle if (*(static_cast(&(*_it_msr->get()))) == *(static_cast(&(*_it_msrprev->get())))) @@ -5260,8 +5218,8 @@ UINT32 dna_import::FindSimilarMeasurements(vdnaMsrPtr* vMeasurements, vdnaMsrPtr continue; break; default: - stringstream ss; - ss << "FindSimilarMeasurements(): Unknown measurement type: " << _it_msr->get()->GetTypeC() << endl; + std::stringstream ss; + ss << "FindSimilarMeasurements(): Unknown measurement type: " << _it_msr->get()->GetTypeC() << std::endl; throw XMLInteropException(ss.str(), 0); } @@ -5280,7 +5238,7 @@ UINT32 dna_import::FindSimilarGXMeasurements(vdnaMsrPtr* vMeasurements, vdnaMsrP vdnaMsrPtr vMeasurementsG(*vMeasurements); // Strip non-GX measurements - string msrTypes("GX"); + std::string msrTypes("GX"); CompareNonMeasType meastypeCompareFuncGX(msrTypes); erase_if(vMeasurementsG, meastypeCompareFuncGX); @@ -5305,10 +5263,10 @@ UINT32 dna_import::FindSimilarGXMeasurements(vdnaMsrPtr* vMeasurements, vdnaMsrP _it_vdnamsrptr _it_msrG(vMeasurementsG.begin()); vstring stationsX; - vector *vgpsBslsX, *vgpsBslsG; - string epochX, epochG; - date dateObsX, dateObsG; - stringstream strdiffDays; + std::vector *vgpsBslsX, *vgpsBslsG; + std::string epochX, epochG; + boost::gregorian::date dateObsX, dateObsG; + std::stringstream strdiffDays; size_t diffDays; vUINT32 cluster_ids; @@ -5316,9 +5274,9 @@ UINT32 dna_import::FindSimilarGXMeasurements(vdnaMsrPtr* vMeasurements, vdnaMsrP for (_it_vdnamsrptr _it_msrX(vMeasurementsX.begin()); _it_msrX!=vMeasurementsX.end(); ++_it_msrX) { vgpsBslsX = _it_msrX->get()->GetBaselines_ptr(); - GetGXMsrStations(vgpsBslsX, stationsX); + GetGXMsrStations(vgpsBslsX, stationsX); - sort(stationsX.begin(), stationsX.end()); + std::sort(stationsX.begin(), stationsX.end()); similarG = false; @@ -5345,10 +5303,10 @@ UINT32 dna_import::FindSimilarGXMeasurements(vdnaMsrPtr* vMeasurements, vdnaMsrP epochX = _it_msrX->get()->GetEpoch(); epochG = _it_msrG->get()->GetEpoch(); - dateObsX = dateFromString(epochX); - dateObsG = dateFromString(epochG); + dateObsX = dateFromString(epochX); + dateObsG = dateFromString(epochG); - days dateDifference = dateObsX - dateObsG; + boost::gregorian::days dateDifference = dateObsX - dateObsG; diffDays = abs(dateDifference.days()); //strdiffDays << "Elapsed days: " << dateDifference; @@ -5373,7 +5331,7 @@ UINT32 dna_import::FindSimilarGXMeasurements(vdnaMsrPtr* vMeasurements, vdnaMsrP // If required, ignore the measurements if (projectSettings_.i.ignore_similar_msr) { - sort(cluster_ids.begin(), cluster_ids.end()); + std::sort(cluster_ids.begin(), cluster_ids.end()); for (_it_msrG=vMeasurements->begin(); _it_msrG != vMeasurements->end(); _it_msrG++) IgnoreGXMeasurements(_it_msrG->get(), cluster_ids.begin(), cluster_ids.end()); } @@ -5391,7 +5349,7 @@ void dna_import::SortandMapStations(vdnaStnPtr* vStations) // sort on station name (by string, not int!!!) // Note that the sort order after this will be the final order - sort(vStations->begin(), vStations->end()); + std::sort(vStations->begin(), vStations->end()); // Create the Station-Name / ID map string_uint32_pair stnID; @@ -5404,7 +5362,7 @@ void dna_import::SortandMapStations(vdnaStnPtr* vStations) } // sort on station name (i.e. first of the pair) - sort(vStnsMap_sortName_.begin(), vStnsMap_sortName_.end(), StationNameIDCompareName()); + std::sort(vStnsMap_sortName_.begin(), vStnsMap_sortName_.end(), StationNameIDCompareName()); if (vStnsMap_sortName_.size() < stnCount) throw XMLInteropException("SortandMapStations(): Could not allocate sufficient memory for the Station map.", 0); @@ -5421,7 +5379,7 @@ void dna_import::FullSortandMapStations(vdnaStnPtr* vStations, pv_string_uint32_ void dna_import::SortStationsForExport(vdnaStnPtr* vStations) { // Sort on original file order - sort(vStations->begin(), vStations->end(), CompareStnFileOrder_CDnaStn()); + std::sort(vStations->begin(), vStations->end(), CompareStnFileOrder_CDnaStn()); } @@ -5443,9 +5401,9 @@ void dna_import::ReduceStations(vdnaStnPtr* vStations, const CDnaProjection& pro void dna_import::RenameStations(vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements, project_settings* p) { - if (!exists(p->i.stn_renamingfile)) + if (!boost::filesystem::exists(p->i.stn_renamingfile)) { - string s("The station renaming file cannot be found:\n"); + std::string s("The station renaming file cannot be found:\n"); s.append(" ").append(p->i.stn_renamingfile); throw XMLInteropException(s, 0); } @@ -5461,7 +5419,7 @@ void dna_import::RenameStations(vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements v_string_vstring_pair stationNames; dna_io_dna dna; dna.read_ren_file(p->i.stn_renamingfile, &stationNames); - sort(stationNames.begin(), stationNames.end()); + std::sort(stationNames.begin(), stationNames.end()); // rename stations in stations vector for_each(vStations->begin(), vStations->end(), @@ -5482,9 +5440,9 @@ void dna_import::RenameStations(vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements }); _it_vdnamsrptr _it_msr(vMeasurements->begin()); - vector* vdirns; - vector* vgpsBsls; - vector* vgpsPnts; + std::vector* vdirns; + std::vector* vgpsBsls; + std::vector* vgpsPnts; // rename stations in each measurement for (_it_msr=vMeasurements->begin(); _it_msr != vMeasurements->end(); _it_msr++) @@ -5516,7 +5474,7 @@ void dna_import::RenameStations(vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements } -void dna_import::RenameStationsBsl(vector* vGpsBaselines, +void dna_import::RenameStationsBsl(std::vector* vGpsBaselines, v_string_vstring_pair& stnRenaming) { for_each(vGpsBaselines->begin(), vGpsBaselines->end(), @@ -5526,7 +5484,7 @@ void dna_import::RenameStationsBsl(vector* vGpsBaselines, } -void dna_import::RenameStationsPnt(vector* vGpsPoints, +void dna_import::RenameStationsPnt(std::vector* vGpsPoints, v_string_vstring_pair& stnRenaming) { for_each(vGpsPoints->begin(), vGpsPoints->end(), @@ -5536,7 +5494,7 @@ void dna_import::RenameStationsPnt(vector* vGpsPoints, } -void dna_import::RenameStationsDir(vector* vDirections, +void dna_import::RenameStationsDir(std::vector* vDirections, v_string_vstring_pair& stnRenaming) { for_each(vDirections->begin(), vDirections->end(), @@ -5545,10 +5503,10 @@ void dna_import::RenameStationsDir(vector* vDirections, }); } -void dna_import::ApplyGNSSMsrScalar(vector::iterator& _it_bsl, vscl_t& bslScalars) +void dna_import::ApplyGNSSMsrScalar(std::vector::iterator& _it_bsl, vscl_t& bslScalars) { vscl_t::iterator _it_scalar; - CompareScalarStations< scalar_t, string> scalarComparisonFunc(_it_bsl->GetFirst(), _it_bsl->GetTarget()); + CompareScalarStations< scalar_t, std::string> scalarComparisonFunc(_it_bsl->GetFirst(), _it_bsl->GetTarget()); if ((_it_scalar = find_if(bslScalars.begin(), bslScalars.end(), scalarComparisonFunc)) != bslScalars.end()) { @@ -5577,9 +5535,9 @@ void dna_import::EditGNSSMsrScalars(vdnaMsrPtr* vMeasurements, project_settings* if (!p->i.scalar_file.empty()) { - if (!exists(p->i.scalar_file)) + if (!boost::filesystem::exists(p->i.scalar_file)) { - string s("The GNSS scalar file cannot be found:\n"); + std::string s("The GNSS scalar file cannot be found:\n"); s.append(" ").append(p->i.scalar_file); throw XMLInteropException(s, 0); } @@ -5590,12 +5548,12 @@ void dna_import::EditGNSSMsrScalars(vdnaMsrPtr* vMeasurements, project_settings* scalar.load_scalar_file(p->i.scalar_file, &bslScalars); } - sort(bslScalars.begin(), bslScalars.end(), CompareScalars()); + std::sort(bslScalars.begin(), bslScalars.end(), CompareScalars()); - vector* vgpsBsls; - vector::iterator _it_bsl; - vector* vgpsPnts; - vector::iterator _it_pnt; + std::vector* vgpsBsls; + std::vector::iterator _it_bsl; + std::vector* vgpsPnts; + std::vector::iterator _it_pnt; // set scalars first for (_it_msr=vMeasurements->begin(); _it_msr != vMeasurements->end(); _it_msr++) @@ -5679,71 +5637,71 @@ void dna_import::EditGNSSMsrScalars(vdnaMsrPtr* vMeasurements, project_settings* } -void dna_import::SerialiseMap(const string& stnmap_file) +void dna_import::SerialiseMap(const std::string& stnmap_file) { try { // write the aml file. dna_io_map map; map.write_map_file(stnmap_file, &vStnsMap_sortName_); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionInterop(e.what(), 0, NULL); } } -void dna_import::SerialiseMapTextFile(const string& stnmap_file) +void dna_import::SerialiseMapTextFile(const std::string& stnmap_file) { try { // write the aml file as raw text. dna_io_map map; map.write_map_file_txt(stnmap_file + ".txt", &vStnsMap_sortName_); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionInterop(e.what(), 0, NULL); } } -void dna_import::SerialiseDiscontTextFile(const string& discont_file) +void dna_import::SerialiseDiscontTextFile(const std::string& discont_file) { std::ofstream discont_outfile; try { - path discontFile(discont_file); - string outfileName = discontFile.filename().string(); + boost::filesystem::path discontFile(discont_file); + std::string outfileName = discontFile.filename().string(); outfileName.append(".discont"); // Open discontinuity output file. Throws runtime_error on failure. file_opener(discont_outfile, outfileName, - ios::out, ascii); + std::ios::out, ascii); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionInterop(e.what(), 0, NULL); } try { discont_outfile << - setw(14) << left << "file_index" << - setw(14) << left << "solution_id" << - setw(STATION) << left << "site_name" << - setw(14) << "date_start" << - setw(14) << "date_end" << - setw(24) << "discontinuity_exists" << endl; + std::setw(14) << std::left << "file_index" << + std::setw(14) << std::left << "solution_id" << + std::setw(STATION) << std::left << "site_name" << + std::setw(14) << "date_start" << + std::setw(14) << "date_end" << + std::setw(24) << "discontinuity_exists" << std::endl; // Print discontinuity file. Throws runtime_error on failure. for_each(stn_discontinuities_.begin(), stn_discontinuities_.end(), [this, &discont_outfile](discontinuity_tuple& discont) { // use lambda expression discont_outfile << - setw(14) << left << discont.file_index << - setw(14) << left << discont.solution_id << - setw(STATION) << left << discont.site_name << - setw(14) << stringFromDate(discont.date_start) << - setw(14) << stringFromDate(discont.date_end) << - setw(24) << discont.discontinuity_exists << endl; + std::setw(14) << std::left << discont.file_index << + std::setw(14) << std::left << discont.solution_id << + std::setw(STATION) << std::left << discont.site_name << + std::setw(14) << stringFromDate(discont.date_start) << + std::setw(14) << stringFromDate(discont.date_end) << + std::setw(24) << discont.discontinuity_exists << std::endl; } ); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionParse(e.what(), 0); } @@ -5752,7 +5710,7 @@ void dna_import::SerialiseDiscontTextFile(const string& discont_file) void dna_import::SimulateMSR(vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements, - const string& msrfilename, + const std::string& msrfilename, const project_settings& p) { CDnaProjection projection(UTM); @@ -5765,7 +5723,7 @@ void dna_import::SimulateMSR(vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements, }); } catch (...) { - stringstream ss; + std::stringstream ss; ss << "SimulateMSR(): An unexpected error occurred when reducing station coordinates."; SignalExceptionInterop(ss.str(), 0, NULL); } @@ -5780,7 +5738,7 @@ void dna_import::SimulateMSR(vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements, }); } catch (...) { - stringstream ss; + std::stringstream ss; ss << "SimulateMSR(): An unexpected error occurred when simulating measurements."; SignalExceptionInterop(ss.str(), 0, NULL); } @@ -5794,7 +5752,7 @@ void dna_import::SimulateMSR(vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements, }); } catch (...) { - stringstream ss; + std::stringstream ss; ss << "SimulateMSR(): An unexpected error occurred when reducing station coordinates."; SignalExceptionInterop(ss.str(), 0, NULL); } @@ -5807,7 +5765,7 @@ void dna_import::SimulateMSR(vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements, // Create DynAdjust MSR file. file_opener(dna_msr_file, msrfilename); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionInterop(e.what(), 0, NULL); } @@ -5828,10 +5786,10 @@ void dna_import::SimulateMSR(vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements, } catch (const std::ifstream::failure& f) { - SignalExceptionInterop(static_cast(f.what()), 0, "o", &dna_msr_file); + SignalExceptionInterop(static_cast(f.what()), 0, "o", &dna_msr_file); } catch (const XMLInteropException& e) { - SignalExceptionInterop(static_cast(e.what()), 0, "o", &dna_msr_file); + SignalExceptionInterop(static_cast(e.what()), 0, "o", &dna_msr_file); } } @@ -5858,7 +5816,7 @@ void dna_import::IgnoreInsufficientMeasurements(vdnaStnPtr* vStations, vdnaMsrPt bool foundInsufficientMeasurement; vdnaMsrPtr vignMsr, vignMsrTotal; - vector* vdirns; + std::vector* vdirns; vignMsrTotal.clear(); @@ -5896,11 +5854,11 @@ void dna_import::IgnoreInsufficientMeasurements(vdnaStnPtr* vStations, vdnaMsrPt continue; case 'H': // Orthometric height case 'R': // Ellipsoidal height - case 'V': // Zenith angle + case 'V': // Zenith distance case 'Z': // Vertical angle case 'L': // Level difference // Continue if: - // - an ellipsoid/orthometric height or vertical/zenith angle is found, and either + // - an ellipsoid/orthometric height or vertical angle/zenith distance is found, and either // - the station is constrained in 3D, or // - the station is constrained in 2D switch (vStations->at(stnIndex)->GetConstraintType()) @@ -5921,7 +5879,7 @@ void dna_import::IgnoreInsufficientMeasurements(vdnaStnPtr* vStations, vdnaMsrPt default: // All other 2D measurement types, which, alone, do not // sufficiently constrain coordinates in 2D. So, continue if: - // - a latitude or longitude or ellipsoid/orthometric height or vertical/zenith angle is found, and + // - a latitude or longitude or ellipsoid/orthometric height or vertical angle/zenith distance is found, and // - the station is held constrained in two dimensions switch (vStations->at(stnIndex)->GetConstraintType()) { @@ -5950,7 +5908,7 @@ void dna_import::IgnoreInsufficientMeasurements(vdnaStnPtr* vStations, vdnaMsrPt break; if (!projectSettings_.g.quiet) - cout << "."; + std::cout << "."; // add the newly found insufficient measurements vPoorlyConstrainedStns->insert(vPoorlyConstrainedStns->end(), @@ -5959,7 +5917,7 @@ void dna_import::IgnoreInsufficientMeasurements(vdnaStnPtr* vStations, vdnaMsrPt vignMsr.clear(); // find measurements connected to these stations and ignore them - sort(vInsufficientMsrStns.begin(), vInsufficientMsrStns.end()); + std::sort(vInsufficientMsrStns.begin(), vInsufficientMsrStns.end()); for_each(vMeasurements->begin(), vMeasurements->end(), [&vInsufficientMsrStns, &vMeasurements, &vdirns, &vignMsr](dnaMsrPtr msr) { @@ -5990,7 +5948,7 @@ void dna_import::IgnoreInsufficientMeasurements(vdnaStnPtr* vStations, vdnaMsrPt case 'L': // Level difference case 'M': // MSL arc case 'S': // Slope distance - case 'V': // Zenith angle + case 'V': // Zenith distance case 'Z': // Vertical angle if (binary_search(vInsufficientMsrStns.begin(), @@ -6044,7 +6002,7 @@ void dna_import::IgnoreInsufficientMeasurements(vdnaStnPtr* vStations, vdnaMsrPt } vdirns = msr.get()->GetDirections_ptr(); - vector< CDnaDirection >::iterator _it_dir; + std::vector< CDnaDirection >::iterator _it_dir; for (_it_dir = vdirns->begin(); _it_dir != vdirns->end(); ++_it_dir) { // test the individual directions, which if found, remove the direction from the vector @@ -6088,7 +6046,7 @@ void dna_import::IgnoreInsufficientMeasurements(vdnaStnPtr* vStations, vdnaMsrPt if (vPoorlyConstrainedStns->size() > 0) - sort(vPoorlyConstrainedStns->begin(), vPoorlyConstrainedStns->end()); + std::sort(vPoorlyConstrainedStns->begin(), vPoorlyConstrainedStns->end()); // add the insufficient measurements back to the final vector. // Note, these were ignored as part of the process above @@ -6107,14 +6065,14 @@ void dna_import::MapMeasurementStations(vdnaMsrPtr* vMeasurements, pvASLPtr vAss g_map_tally.initialise(); - ostringstream ss; + std::ostringstream ss; - vector* vdirns; - vector* vgpsBsls; - vector* vgpsPnts; + std::vector* vdirns; + std::vector* vgpsBsls; + std::vector* vgpsPnts; // Association list initialisation and variables - string at_station_name, to_station_name, to2_station_name; + std::string at_station_name, to_station_name, to2_station_name; UINT32 at_station_index, to_station_index, to2_station_index; vAssocStnList->clear(); vAssocStnList->resize(vStnsMap_sortName_.size()); @@ -6187,12 +6145,12 @@ void dna_import::MapMeasurementStations(vdnaMsrPtr* vMeasurements, pvASLPtr vAss case 'L': // Level difference case 'M': // MSL arc case 'S': // Slope distance - case 'V': // Zenith angle + case 'V': // Zenith distance case 'Z': // Vertical angle ss << " to " << _it_msr->get()->GetTarget(); } - ss << " was not found in the list of network stations." << endl << + ss << " was not found in the list of network stations." << std::endl << " Please ensure that " << at_station_name << " is included in the input station file."; throw XMLInteropException(ss.str(), 0); @@ -6299,7 +6257,7 @@ void dna_import::MapMeasurementStations(vdnaMsrPtr* vMeasurements, pvASLPtr vAss g_map_tally.L ++; (*lMapCount)++; continue; - case 'V': // Zenith angle + case 'V': // Zenith distance g_map_tally.V ++; (*lMapCount)++; continue; @@ -6424,7 +6382,7 @@ UINT32 dna_import::ComputeMeasurementCount(vdnaMsrPtr* vMeasurements, const vUIN case 'S': // Slope distance msr_tally.S++; break; - case 'V': // Zenith angle + case 'V': // Zenith distance msr_tally.V++; break; case 'Y': // GPS point cluster @@ -6434,8 +6392,8 @@ UINT32 dna_import::ComputeMeasurementCount(vdnaMsrPtr* vMeasurements, const vUIN msr_tally.Z++; break; default: - stringstream ss; - ss << "ComputeMeasurementCount(): Unknown measurement type: " << _it_msr->get()->GetTypeC() << endl; + std::stringstream ss; + ss << "ComputeMeasurementCount(): Unknown measurement type: " << _it_msr->get()->GetTypeC() << std::endl; throw XMLInteropException(ss.str(), m_lineNo); } } @@ -6443,17 +6401,17 @@ UINT32 dna_import::ComputeMeasurementCount(vdnaMsrPtr* vMeasurements, const vUIN return msr_tally.TotalCount(); } -void dna_import::MapMeasurementStationsBsl(vector* vGpsBaselines, pvASLPtr vAssocStnList, PUINT32 lMapCount) +void dna_import::MapMeasurementStationsBsl(std::vector* vGpsBaselines, pvASLPtr vAssocStnList, PUINT32 lMapCount) { const size_t mapsize = vStnsMap_sortName_.size(); if (mapsize < 1) throw XMLInteropException("A station map has not been created. Run \"SortStations\" to create a station map.", 0); - ostringstream ss; + std::ostringstream ss; //_it_string_uint32_pair _it_stnmap(vStnsMap_sortName_.end()); - vector< CDnaGpsBaseline >::iterator _it_msr(vGpsBaselines->begin()); + std::vector< CDnaGpsBaseline >::iterator _it_msr(vGpsBaselines->begin()); - string station_name; + std::string station_name; UINT32 station_index; //, msrs_per_cluster_row; #ifdef _MSDEBUG @@ -6479,8 +6437,8 @@ void dna_import::MapMeasurementStationsBsl(vector* vGpsBaseline { ss.str(""); ss << station_name << " is referenced in measurement '" << _it_msr->GetType() << "' " << - _it_msr->GetFirst() << " - " << _it_msr->GetTarget() << endl; - ss << " but is not in the stations map. " << endl; + _it_msr->GetFirst() << " - " << _it_msr->GetTarget() << std::endl; + ss << " but is not in the stations map. " << std::endl; ss << " Please ensure that " << station_name << " is included in the list of stations."; throw XMLInteropException(ss.str(), 0); } @@ -6507,8 +6465,8 @@ void dna_import::MapMeasurementStationsBsl(vector* vGpsBaseline { ss.str(""); ss << station_name << " is referenced in measurement '" << _it_msr->GetType() << "' " << - _it_msr->GetFirst() << " - " << _it_msr->GetTarget() << endl; - ss << " but is not in the stations map. " << endl; + _it_msr->GetFirst() << " - " << _it_msr->GetTarget() << std::endl; + ss << " but is not in the stations map. " << std::endl; ss << " Please ensure that " << station_name << " is included in the list of stations."; throw XMLInteropException(ss.str(), 0); } @@ -6549,8 +6507,8 @@ void dna_import::MapMeasurementStationsBsl(vector* vGpsBaseline // set ID for each covariance term. This is for the convenience of assigning covariance terms // to the right index in dnaAdjust - vector< CDnaCovariance >::iterator _it_cov; - vector< CDnaGpsBaseline >::iterator _it_msr2(vGpsBaselines->begin()); + std::vector< CDnaCovariance >::iterator _it_cov; + std::vector< CDnaGpsBaseline >::iterator _it_msr2(vGpsBaselines->begin()); for (_it_msr = vGpsBaselines->begin(); _it_msr != vGpsBaselines->end(); _it_msr++) { @@ -6563,17 +6521,17 @@ void dna_import::MapMeasurementStationsBsl(vector* vGpsBaseline } } -void dna_import::MapMeasurementStationsPnt(vector* vGpsPoints, pvASLPtr vAssocStnList, PUINT32 lMapCount) +void dna_import::MapMeasurementStationsPnt(std::vector* vGpsPoints, pvASLPtr vAssocStnList, PUINT32 lMapCount) { const size_t mapsize = vStnsMap_sortName_.size(); if (mapsize < 1) throw XMLInteropException("A station map has not been created. Run \"SortStations\" to create a station map.", 0); - ostringstream ss; + std::ostringstream ss; //_it_string_uint32_pair _it_stnmap; - vector< CDnaGpsPoint >::iterator _it_msr; + std::vector< CDnaGpsPoint >::iterator _it_msr; - string station_name; + std::string station_name; UINT32 station_index; //, msrs_per_cluster_row; #ifdef _MSDEBUG @@ -6612,8 +6570,8 @@ void dna_import::MapMeasurementStationsPnt(vector* vGpsPoints, pvA // set ID for each covariance term. This is for the convenience of assigning covariance terms // to the right index in dnaAdjust - vector< CDnaCovariance >::iterator _it_cov; - vector< CDnaGpsPoint >::iterator _it_msr2(vGpsPoints->begin()); + std::vector< CDnaCovariance >::iterator _it_cov; + std::vector< CDnaGpsPoint >::iterator _it_msr2(vGpsPoints->begin()); for (_it_msr = vGpsPoints->begin(); _it_msr != vGpsPoints->end(); _it_msr++) { @@ -6627,17 +6585,17 @@ void dna_import::MapMeasurementStationsPnt(vector* vGpsPoints, pvA } -void dna_import::MapMeasurementStationsDir(vector* vDirections, pvASLPtr vAssocStnList, PUINT32 lMapCount) +void dna_import::MapMeasurementStationsDir(std::vector* vDirections, pvASLPtr vAssocStnList, PUINT32 lMapCount) { const size_t mapsize = vStnsMap_sortName_.size(); if (mapsize < 1) throw XMLInteropException("A station map has not been created. Run \"SortStations\" to create a station map.", 0); - ostringstream ss; + std::ostringstream ss; //_it_string_uint32_pair _it_stnmap; - vector< CDnaDirection >::iterator _it_msr(vDirections->begin()); + std::vector< CDnaDirection >::iterator _it_msr(vDirections->begin()); - string at_station_name, to_station_name; + std::string at_station_name, to_station_name; UINT32 at_station_index, to_station_index; // Unique list of stations involved in this cluster @@ -6687,8 +6645,11 @@ void dna_import::MapMeasurementStationsDir(vector* vDirections, p msrStations.push_back(to_station_index); - (*lMapCount)++; - g_map_tally.D ++; + if (_it_msr->NotIgnored()) + { + (*lMapCount)++; + g_map_tally.D++; + } } // Strip duplicates from msrStations, then increment station count for each of the stations tied to this cluster @@ -6733,9 +6694,9 @@ void dna_import::CompleteAssociationLists(vdnaMsrPtr* vMeasurements, pvASLPtr vA vAssocMsrList->clear(); vAssocMsrList->resize(msrstoAllStations); - vector* vDirns; - vector* vGpsBsls; - vector* vGpsPnts; + std::vector* vDirns; + std::vector* vGpsBsls; + std::vector* vGpsPnts; // reset ASL #measurements to zero for (_it_asl=vAssocStnList->begin(); _it_asl!=vAssocStnList->end(); _it_asl++) @@ -6828,7 +6789,7 @@ void dna_import::CompleteAssociationLists(vdnaMsrPtr* vMeasurements, pvASLPtr vA case 'M': // MSL arc case 'S': // Slope distance case 'L': // Level difference - case 'V': // Zenith angle + case 'V': // Zenith distance case 'Z': // Vertical angle currentBmsFileIndex ++; continue; @@ -6870,12 +6831,12 @@ void dna_import::CompleteAssociationLists(vdnaMsrPtr* vMeasurements, pvASLPtr vA // // it_vUINT32 it_ignmsr, _it_stn_newend; // -// vector* vDirns; -// vector::iterator it_Dirns; -// vector* vGpsBsls; -// vector::iterator it_GpsBsls; -// vector* vGpsPnts; -// vector::iterator it_GpsPnts; +// std::vector* vDirns; +// std::vector::iterator it_Dirns; +// std::vector* vGpsBsls; +// std::vector::iterator it_GpsBsls; +// std::vector* vGpsPnts; +// std::vector::iterator it_GpsPnts; // // vUINT32 vIgnoredMsrStations; // // Iterate through the ignored measurement list and build unique list of stations in ignored measurements @@ -6892,7 +6853,7 @@ void dna_import::CompleteAssociationLists(vdnaMsrPtr* vMeasurements, pvASLPtr vA // case 'M': // MSL arc // case 'S': // Slope distance // case 'L': // Level difference -// case 'V': // Zenith angle +// case 'V': // Zenith distance // case 'Z': // Vertical angle // vIgnoredMsrStations.push_back(it_Dirns->GetStn2Index()); // case 'H': // Orthometric height @@ -6935,19 +6896,19 @@ void dna_import::CompleteAssociationLists(vdnaMsrPtr* vMeasurements, pvASLPtr vA //} -void dna_import::CompleteASLDirections(_it_vdnamsrptr _it_msr, vector* vDirections, pvASLPtr vAssocStnList, +void dna_import::CompleteASLDirections(_it_vdnamsrptr _it_msr, std::vector* vDirections, pvASLPtr vAssocStnList, pvUINT32 vAssocMsrList, PUINT32 currentBmsFileIndex, const _AML_TYPE_ aml_type) { - ostringstream ss; + std::ostringstream ss; CAStationList* currentASL; - string station_name; + std::string station_name; UINT32 stn_indexAML, stnmsr_indexAML; const UINT32 msrstoAllStations = static_cast(vAssocMsrList->size()); const UINT32 bmsrIndex(*currentBmsFileIndex); - vector< CDnaDirection >::iterator _it_dir(vDirections->begin()); + std::vector< CDnaDirection >::iterator _it_dir(vDirections->begin()); // Unique list of stations involved in this cluster vUINT32 msrStations; @@ -7010,8 +6971,9 @@ void dna_import::CompleteASLDirections(_it_vdnamsrptr _it_msr, vectorNotIgnored()) + // is to be included. But stations should only be included if the + // parent direction set measurement is not ignored + if (_it_dir->NotIgnored() && _it_msr->get()->NotIgnored()) currentASL->SetValid(); // Set binary msr index for all stations in this cluster to the first element of the @@ -7041,7 +7003,7 @@ void dna_import::CompleteASLDirections(_it_vdnamsrptr _it_msr, vectorat(*_it_stn).get()->IncrementMsrCount(); } -void dna_import::CompleteASLGpsBaselines(vector* vGpsBaselines, pvASLPtr vAssocStnList, +void dna_import::CompleteASLGpsBaselines(std::vector* vGpsBaselines, pvASLPtr vAssocStnList, pvUINT32 vAssocMsrList, PUINT32 currentBmsFileIndex, const _AML_TYPE_ aml_type) { CAStationList* currentASL; @@ -7050,7 +7012,7 @@ void dna_import::CompleteASLGpsBaselines(vector* vGpsBaselines, const UINT32 msrstoAllStations = static_cast(vAssocMsrList->size()); const UINT32 bmsrIndex(*currentBmsFileIndex); - vector< CDnaGpsBaseline >::iterator _it_msr(vGpsBaselines->begin()); + std::vector< CDnaGpsBaseline >::iterator _it_msr(vGpsBaselines->begin()); // Unique list of stations involved in this cluster vUINT32 msrStations; @@ -7130,7 +7092,7 @@ void dna_import::CompleteASLGpsBaselines(vector* vGpsBaselines, vAssocStnList->at(*_it_stn).get()->IncrementMsrCount(); } -void dna_import::CompleteASLGpsPoints(vector* vGpsPoints, pvASLPtr vAssocStnList, +void dna_import::CompleteASLGpsPoints(std::vector* vGpsPoints, pvASLPtr vAssocStnList, pvUINT32 vAssocMsrList, PUINT32 currentBmsFileIndex, const _AML_TYPE_ aml_type) { CAStationList* currentASL; @@ -7139,7 +7101,7 @@ void dna_import::CompleteASLGpsPoints(vector* vGpsPoints, pvASLPtr const UINT32 msrstoAllStations = static_cast(vAssocMsrList->size()); const UINT32 bmsrIndex(*currentBmsFileIndex); - vector< CDnaGpsPoint >::iterator _it_msr(vGpsPoints->begin()); + std::vector< CDnaGpsPoint >::iterator _it_msr(vGpsPoints->begin()); for (_it_msr=vGpsPoints->begin(); _it_msr != vGpsPoints->end(); _it_msr++) { @@ -7191,19 +7153,19 @@ void dna_import::CompleteASLGpsPoints(vector* vGpsPoints, pvASLPtr } } -_PARSE_STATUS_ dna_import::LoadDNAGeoidFile(const string& fileName, vdnaStnPtr* vStations) +_PARSE_STATUS_ dna_import::LoadDNAGeoidFile(const std::string& fileName, vdnaStnPtr* vStations) { std::ifstream geo_file; try { // Load geoid file. Throws runtime_error on failure. file_opener(geo_file, fileName, - ios::in, ascii, true); + std::ios::in, ascii, true); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionInterop(e.what(), 0, NULL); } - string geoidRec, station, nValue, primeMeridian, primeVertical; + std::string geoidRec, station, nValue, primeMeridian, primeVertical; double value; _it_vdnastnptr _it_stn; @@ -7223,8 +7185,8 @@ _PARSE_STATUS_ dna_import::LoadDNAGeoidFile(const string& fileName, vdnaStnPtr* geo_file.close(); return parseStatus_; } - stringstream ss; - ss << "LoadDNAGeoidFile(): Could not read from the geoid file." << endl; + std::stringstream ss; + ss << "LoadDNAGeoidFile(): Could not read from the geoid file." << std::endl; m_columnNo = 0; throw XMLInteropException(ss.str(), m_lineNo); } @@ -7249,8 +7211,8 @@ _PARSE_STATUS_ dna_import::LoadDNAGeoidFile(const string& fileName, vdnaStnPtr* station = trimstr(geoidRec.substr(0, 40)); } catch (...) { - stringstream ss; - ss << "LoadDNAGeoidFile(): Could not extract station name from the record: " << endl << " " << geoidRec << endl; + std::stringstream ss; + ss << "LoadDNAGeoidFile(): Could not extract station name from the record: " << std::endl << " " << geoidRec << std::endl; m_columnNo = 0; throw XMLInteropException(ss.str(), m_lineNo); } @@ -7266,8 +7228,8 @@ _PARSE_STATUS_ dna_import::LoadDNAGeoidFile(const string& fileName, vdnaStnPtr* nValue = trimstr(geoidRec.substr(40, 10)); } catch (...) { - stringstream ss; - ss << "LoadDNAGeoidFile(): Could not extract the N-value from the record: " << endl << " " << geoidRec << endl; + std::stringstream ss; + ss << "LoadDNAGeoidFile(): Could not extract the N-value from the record: " << std::endl << " " << geoidRec << std::endl; m_columnNo = 41; throw XMLInteropException(ss.str(), m_lineNo); } @@ -7277,8 +7239,8 @@ _PARSE_STATUS_ dna_import::LoadDNAGeoidFile(const string& fileName, vdnaStnPtr* primeMeridian = trimstr(geoidRec.substr(50, 19)); } catch (...) { - stringstream ss; - ss << "LoadDNAGeoidFile(): Could not extract the deflection in prime meridian from the record: " << endl << " " << geoidRec << endl; + std::stringstream ss; + ss << "LoadDNAGeoidFile(): Could not extract the deflection in prime meridian from the record: " << std::endl << " " << geoidRec << std::endl; m_columnNo = 51; throw XMLInteropException(ss.str(), m_lineNo); } @@ -7288,8 +7250,8 @@ _PARSE_STATUS_ dna_import::LoadDNAGeoidFile(const string& fileName, vdnaStnPtr* primeVertical = trimstr(geoidRec.substr(69)); } catch (...) { - stringstream ss; - ss << "LoadDNAGeoidFile(): Could not extract the deflection in prime meridian from the record: " << endl << " " << geoidRec << endl; + std::stringstream ss; + ss << "LoadDNAGeoidFile(): Could not extract the deflection in prime meridian from the record: " << std::endl << " " << geoidRec << std::endl; m_columnNo = 70; throw XMLInteropException(ss.str(), m_lineNo); } diff --git a/dynadjust/dynadjust/dnaimport/dnainterop.hpp b/dynadjust/dynadjust/dnaimport/dnainterop.hpp index 11ff92aa..dd1cb9dd 100644 --- a/dynadjust/dynadjust/dnaimport/dnainterop.hpp +++ b/dynadjust/dynadjust/dnaimport/dnainterop.hpp @@ -79,10 +79,6 @@ #include #include -using namespace std; -using namespace boost; -using namespace boost::filesystem; - using namespace dynadjust::measurements; using namespace dynadjust::math; using namespace dynadjust::exception; @@ -110,22 +106,22 @@ class dna_import { public: // Parse an xml file - _PARSE_STATUS_ ParseInputFile(const string& filename, vdnaStnPtr* vStations, PUINT32 stnCount, + _PARSE_STATUS_ ParseInputFile(const std::string& filename, vdnaStnPtr* vStations, PUINT32 stnCount, vdnaMsrPtr* vMeasurements, PUINT32 msrCount, - PUINT32 clusterID, input_file_meta_t* input_file_meta, - string* success_msg, project_settings* p); + PUINT32 clusterID, input_file_meta_t* input_file_meta, bool firstFILE, + std::string* success_msg, project_settings* p); - _PARSE_STATUS_ LoadDNAGeoidFile(const string& fileName, vdnaStnPtr* vStations); + _PARSE_STATUS_ LoadDNAGeoidFile(const std::string& fileName, vdnaStnPtr* vStations); void RemoveIgnoredMeasurements(vdnaMsrPtr* vMeasurements, MsrTally* parsemsrTally); - void IncludeMeasurementTypes(const string& includeMsrs, vdnaMsrPtr* vMeasurements, MsrTally* parsemsrTally); - void ExcludeMeasurementTypes(const string& excludeMsrs, vdnaMsrPtr* vMeasurements, MsrTally* parsemsrTally); + void IncludeMeasurementTypes(const std::string& includeMsrs, vdnaMsrPtr* vMeasurements, MsrTally* parsemsrTally); + void ExcludeMeasurementTypes(const std::string& excludeMsrs, vdnaMsrPtr* vMeasurements, MsrTally* parsemsrTally); void IgnoreInsufficientMeasurements(vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements, pvstring vPoorlyConstrainedStns); void ExcludeAllOutsideBoundingBox(vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements, StnTally* parsestnTally, MsrTally* parsemsrTally, pvstring pvUnusedStns, const project_settings& p, bool& splitXmsrs, bool& splitYmsrs); - void ExtractStnsAndAssociatedMsrs(const string& stnListInclude, const string& stnListExclude, vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements, + void ExtractStnsAndAssociatedMsrs(const std::string& stnListInclude, const std::string& stnListExclude, vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements, StnTally* parsestnTally, MsrTally* parsemsrTally, pvstring vExcludedStns, const project_settings& p, bool& splitXmsrs, bool& splitYmsrs); void ImportStnsMsrsFromBlock(vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements, const project_settings& p); @@ -141,41 +137,43 @@ class dna_import { void ReduceStations(vdnaStnPtr* vStations, const CDnaProjection& projection, const UINT32& cores); void RenameStations(vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements, project_settings* p); void ApplyDiscontinuities(vdnaMsrPtr* vMeasurements); - void TrackDiscontinuitySite(const string& site, const string& site_renamed); + void TrackDiscontinuitySite(const std::string& site, const std::string& site_renamed); void ApplyDiscontinuitiesMeasurements(vdnaMsrPtr* vMeasurements); - void ApplyDiscontinuitiesMeasurements_GX(vector* vGpsBaselines); - void ApplyDiscontinuitiesMeasurements_Y(vector* vGpsPoints); - void ApplyDiscontinuitiesMeasurements_D(vector* vDirections, const date& site_date); + void ApplyDiscontinuitiesMeasurements_GX(std::vector* vGpsBaselines); + void ApplyDiscontinuitiesMeasurements_Y(std::vector* vGpsPoints); + void ApplyDiscontinuitiesMeasurements_D(std::vector* vDirections, const boost::gregorian::date& site_date); void AddDiscontinuityStations(vdnaStnPtr* vstationsTotal); void EditGNSSMsrScalars(vdnaMsrPtr* vMeasurements, project_settings* p); - void ApplyGNSSMsrScalar(vector::iterator& _it_bsl, vscl_t& bslScalars); + void ApplyGNSSMsrScalar(std::vector::iterator& _it_bsl, vscl_t& bslScalars); void MapMeasurementStations(vdnaMsrPtr* vMeasurements, pvASLPtr vAssocStnList, PUINT32 lMapCount, pvstring vUnusedStns, pvUINT32 vIgnoredMsrs); UINT32 ComputeMeasurementCount(vdnaMsrPtr* vMeasurements, const vUINT32& vIgnoredMsrs); // file handling - void SerialiseDNA(vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements, const string& stnfilename, const string& msrfilename, const project_settings& p, vifm_t* vinput_file_meta, bool flagUnused=false); - //void SerialiseDynaMLfromBinary(const string& outfilename, const project_settings& p, vifm_t* vinput_file_meta, bool flagUnused=false); - void SerialiseDynaMLfromMemory(vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements, const string& outfilename, const project_settings& p, vifm_t* vinput_file_meta, bool flagUnused=false); - //void SerialiseDynaMLSepfromBinary(const string& stnfilename, const string& msrfilename, const project_settings& p, vifm_t* vinput_file_meta, bool flagUnused=false); - void SerialiseDynaMLSepfromMemory(vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements, const string& stnfilename, const string& msrfilename, const project_settings& p, vifm_t* vinput_file_meta, bool flagUnused=false); - //void SerialiseGeoidData(vdnaStnPtr* vStations, const string& geofilename); - void SimulateMSR(vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements, const string& msrfilename, const project_settings& p); - - void SerialiseBst(const string& bst_filename, vdnaStnPtr* vStations, pvstring vUnusedStns, vifm_t& vinput_file_meta, bool flagUnused=false); - void SerialiseBms(const string& bms_filename, vdnaMsrPtr* vMeasurements, vifm_t& vinput_file_meta); - void SerialiseMap(const string& stnmap_file); - void SerialiseAml(const string& filename, pvUINT32 vAssocMsrList); - void SerialiseAsl(const string& filename, pvASLPtr vAssocStnList); - void SerialiseMapTextFile(const string& stnmap_file); - void SerialiseDiscontTextFile(const string& discont_file); - void SerialiseAmlTextFile(const string& bms_filename, const string& aml_filename, pvUINT32 vAML, pvASLPtr vAssocStnList, vdnaStnPtr* vStations); - void SerialiseAslTextFile(const string& filename, pvASLPtr vAssocStnList, vdnaStnPtr* vStations); - - void SerialiseDatabaseId(const string& dbid_filename, pvdnaMsrPtr vMeasurements); + void SerialiseDNA(vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements, const std::string& stnfilename, const std::string& msrfilename, const project_settings& p, vifm_t* vinput_file_meta, bool flagUnused=false); + void SerialiseMSR(vdnaMsrPtr* vMeasurements, const std::string& msrfilename, const project_settings& p, vifm_t* vinput_file_meta); + void SerialiseSTN(vdnaStnPtr* vStations, const std::string& stnfilename, const project_settings& p, vifm_t* vinput_file_meta, bool flagUnused = false); + //void SerialiseDynaMLfromBinary(const std::string& outfilename, const project_settings& p, vifm_t* vinput_file_meta, bool flagUnused=false); + void SerialiseDynaMLfromMemory(vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements, const std::string& outfilename, const project_settings& p, vifm_t* vinput_file_meta, bool flagUnused=false); + //void SerialiseDynaMLSepfromBinary(const std::string& stnfilename, const std::string& msrfilename, const project_settings& p, vifm_t* vinput_file_meta, bool flagUnused=false); + void SerialiseDynaMLSepfromMemory(vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements, const std::string& stnfilename, const std::string& msrfilename, const project_settings& p, vifm_t* vinput_file_meta, bool flagUnused=false); + //void SerialiseGeoidData(vdnaStnPtr* vStations, const std::string& geofilename); + void SimulateMSR(vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements, const std::string& msrfilename, const project_settings& p); + + void SerialiseBst(const std::string& bst_filename, vdnaStnPtr* vStations, pvstring vUnusedStns, vifm_t& vinput_file_meta, bool flagUnused=false); + void SerialiseBms(const std::string& bms_filename, vdnaMsrPtr* vMeasurements, vifm_t& vinput_file_meta); + void SerialiseMap(const std::string& stnmap_file); + void SerialiseAml(const std::string& filename, pvUINT32 vAssocMsrList); + void SerialiseAsl(const std::string& filename, pvASLPtr vAssocStnList); + void SerialiseMapTextFile(const std::string& stnmap_file); + void SerialiseDiscontTextFile(const std::string& discont_file); + void SerialiseAmlTextFile(const std::string& bms_filename, const std::string& aml_filename, pvUINT32 vAML, pvASLPtr vAssocStnList, vdnaStnPtr* vStations); + void SerialiseAslTextFile(const std::string& filename, pvASLPtr vAssocStnList, vdnaStnPtr* vStations); + + void SerialiseDatabaseId(const std::string& dbid_filename, pvdnaMsrPtr vMeasurements); void CompleteAssociationLists(vdnaMsrPtr* vMeasurements, pvASLPtr vAssocStnList, pvUINT32 vAssocMsrList, const _AML_TYPE_ aml_type = str_msr); @@ -186,66 +184,69 @@ class dna_import { inline _PARSE_STATUS_ GetStatus() const { return parseStatus_; } - void inline ResetFileOrder() const { g_fileOrder = 0; } - void InitialiseDatum(const string& reference_frame); - void UpdateEpoch(const vifm_t* vinput_file_meta); + inline void ResetFileOrder() const { g_fileOrder = 0; } + inline bool filespecifiedReferenceFrame() const { return _filespecifiedreferenceframe; } + inline bool filespecifiedEpoch() const { return _filespecifiedepoch; } + void InitialiseDatum(const std::string& reference_frame, const std::string epoch=""); - void PrintMeasurementsToStations(string& m2s_file, MsrTally* parsemsrTally, - string& bst_file, string& bms_file, string& aml_file, pvASLPtr vAssocStnList); + void PrintMeasurementsToStations(std::string& m2s_file, MsrTally* parsemsrTally, + std::string& bst_file, std::string& bms_file, std::string& aml_file, pvASLPtr vAssocStnList); // Discontonuity file - void ParseDiscontinuities(const string& fileName); + void ParseDiscontinuities(const std::string& fileName); private: // DynaML files - void ParseXML(const string& fileName, vdnaStnPtr* vStations, PUINT32 stnCount, + void ParseXML(const std::string& fileName, vdnaStnPtr* vStations, PUINT32 stnCount, vdnaMsrPtr* vMeasurements, PUINT32 msrCount, PUINT32 clusterID, - string& fileEpsg, string& fileEpoch, string* success_msg); + std::string& fileEpsg, std::string& fileEpoch, bool firstFile, std::string* success_msg); // SINEX files - void ParseSNX(const string& fileName, vdnaStnPtr* vStations, PUINT32 stnCount, + void ParseSNX(const std::string& fileName, vdnaStnPtr* vStations, PUINT32 stnCount, vdnaMsrPtr* vMeasurements, PUINT32 msrCount, PUINT32 clusterID); // DNA Ascii files //void ParseDNAVersion(const INPUT_DATA_TYPE& idt); - void ParseDNA(const string& fileName, vdnaStnPtr* vStations, PUINT32 stnCount, + void ParseDNA(const std::string& fileName, vdnaStnPtr* vStations, PUINT32 stnCount, vdnaMsrPtr* vMeasurements, PUINT32 msrCount, PUINT32 clusterID, - string& fileEpsg, string& fileEpoch); - void ParseDNASTN(vdnaStnPtr* vStations, PUINT32 stnCount); - void ParseDNAMSR(pvdnaMsrPtr vMeasurements, PUINT32 msrCount, PUINT32 clusterID); + std::string& fileEpsg, std::string& fileEpoch, bool firstFile); + void ParseDNASTN(vdnaStnPtr* vStations, PUINT32 stnCount, + const std::string& fileEpsg, const std::string& fileEpoch); + void ParseDNAMSR(pvdnaMsrPtr vMeasurements, PUINT32 msrCount, PUINT32 clusterID, + const std::string& fileEpsg, const std::string& fileEpoch); //void SetDefaultReferenceFrame(vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements); - void ParseDNAMSRAngular(const string& sBuf, dnaMsrPtr& msr_ptr); - void ParseDNAMSRCoordinate(const string& sBuf, dnaMsrPtr& msr_ptr); - UINT32 ParseDNAMSRDirections(string& sBuf, dnaMsrPtr& msr_ptr, bool ignoreMsr); - void ParseDNAMSRGPSBaselines(string& sBuf, dnaMsrPtr& msr_ptr, bool ignoreMsr); - void ParseDNAMSRGPSPoints(string& sBuf, dnaMsrPtr& msr_ptr, bool ignoreMsr); - void ParseDNAMSRLinear(const string& sBuf, dnaMsrPtr& msr_ptr); + void ParseDNAMSRAngular(const std::string& sBuf, dnaMsrPtr& msr_ptr); + void ParseDNAMSRCoordinate(const std::string& sBuf, dnaMsrPtr& msr_ptr); + UINT32 ParseDNAMSRDirections(std::string& sBuf, dnaMsrPtr& msr_ptr, bool ignoreMsr); + void ParseDNAMSRGPSBaselines(std::string& sBuf, dnaMsrPtr& msr_ptr, bool ignoreMsr); + void ParseDNAMSRGPSPoints(std::string& sBuf, dnaMsrPtr& msr_ptr, bool ignoreMsr); + void ParseDNAMSRLinear(const std::string& sBuf, dnaMsrPtr& msr_ptr); void ParseDNAMSRCovariance(CDnaCovariance& cov); - string ParseAngularValue(const string& sBuf, const string& calling_function); - string ParseLinearValue(const string& sBuf, const string& msrName, const string& calling_function); - string ParseGPSMsrValue(const string& sBuf, const string& element, const string& calling_function); - string ParseGPSVarValue(const string& sBuf, const string& element, const UINT32 location, const UINT32 width, const string& calling_function); - string ParseInstrumentValue(const string& sBuf, const string& calling_function); - string ParseTargetValue(const string& sBuf, const string& calling_function); - string ParseTarget2Value(const string& sBuf, const string& calling_function); - string ParseStdDevValue(const string& sBuf, const string& calling_function); - string ParseInstHeightValue(const string& sBuf, const string& calling_function); - string ParseTargHeightValue(const string& sBuf, const string& calling_function); - string ParseMsrCountValue(const string& sBuf, UINT32& msrCount, const string& calling_function); - string ParseScaleVValue(const string& sBuf, const string& calling_function); - string ParseScalePValue(const string& sBuf, const string& calling_function); - string ParseScaleLValue(const string& sBuf, const string& calling_function); - string ParseScaleHValue(const string& sBuf, const string& calling_function); - string ParseRefFrameValue(const string& sBuf, const string& calling_function); - string ParseEpochValue(const string& sBuf, const string& calling_function); - - void ParseDatabaseIds(const string& sBuf, const string& calling_function, const char msrType); - void ParseDatabaseClusterId(const string& sBuf, const string& calling_function); - void ParseDatabaseMsrId(const string& sBuf, const string& calling_function); + std::string ParseAngularValue(const std::string& sBuf, const std::string& calling_function); + std::string ParseLinearValue(const std::string& sBuf, const std::string& msrName, const std::string& calling_function); + std::string ParseGPSMsrValue(const std::string& sBuf, const std::string& element, const std::string& calling_function); + std::string ParseGPSVarValue(const std::string& sBuf, const std::string& element, const UINT32 location, const UINT32 width, const std::string& calling_function); + std::string ParseInstrumentValue(const std::string& sBuf, const std::string& calling_function); + std::string ParseTargetValue(const std::string& sBuf, const std::string& calling_function); + std::string ParseTarget2Value(const std::string& sBuf, const std::string& calling_function); + std::string ParseStdDevValue(const std::string& sBuf, const std::string& calling_function); + std::string ParseInstHeightValue(const std::string& sBuf, const std::string& calling_function); + std::string ParseTargHeightValue(const std::string& sBuf, const std::string& calling_function); + std::string ParseMsrCountValue(const std::string& sBuf, UINT32& msrCount, const std::string& calling_function); + std::string ParseScaleVValue(const std::string& sBuf, const std::string& calling_function); + std::string ParseScalePValue(const std::string& sBuf, const std::string& calling_function); + std::string ParseScaleLValue(const std::string& sBuf, const std::string& calling_function); + std::string ParseScaleHValue(const std::string& sBuf, const std::string& calling_function); + std::string ParseRefFrameValue(const std::string& sBuf, const std::string& calling_function); + std::string ParseEpochValue(const std::string& sBuf, const std::string& calling_function); + + void ParseDatabaseIds(const std::string& sBuf, const std::string& calling_function, const char msrType); + void ParseDatabaseClusterId(const std::string& sBuf, const std::string& calling_function); + void ParseDatabaseMsrId(const std::string& sBuf, const std::string& calling_function); void LoadNetworkFiles(pvstn_t binaryStn, pvmsr_t binaryMsr, const project_settings& projectSettings, bool loadSegmentFile); void LoadBinaryFiles(pvstn_t binaryStn, pvmsr_t binaryMsr); @@ -264,29 +265,29 @@ class dna_import { pvstring pvUsedStns, pvstring pvUnusedStns, const project_settings& p, bool& splitXmsrs, bool& splitYmsrs); void ExtractAssociatedStns(vdnaMsrPtr* vMeasurements, pvstring pvUsedStns); - void ExtractAssociatedStns_GX(vector* vGpsBaselines, pvstring pvUsedStns); - void ExtractAssociatedStns_Y(vector* vGpsPoints, pvstring pvUsedStns); - void ExtractAssociatedStns_D(vector* vDirections, pvstring pvUsedStns); + void ExtractAssociatedStns_GX(std::vector* vGpsBaselines, pvstring pvUsedStns); + void ExtractAssociatedStns_Y(std::vector* vGpsPoints, pvstring pvUsedStns); + void ExtractAssociatedStns_D(std::vector* vDirections, pvstring pvUsedStns); void SortandMapStations(vdnaStnPtr* vStations); - void MapMeasurementStationsBsl(vector* vGpsBaselines, + void MapMeasurementStationsBsl(std::vector* vGpsBaselines, pvASLPtr vAssocStnList, PUINT32 lMapCount); - void MapMeasurementStationsPnt(vector* vGpsPoints, + void MapMeasurementStationsPnt(std::vector* vGpsPoints, pvASLPtr vAssocStnList, PUINT32 lMapCount); - void MapMeasurementStationsDir(vector* vDirections, + void MapMeasurementStationsDir(std::vector* vDirections, pvASLPtr vAssocStnList, PUINT32 lMapCount); //void RenameStationsMsr(CDnaMeasurement* msr, v_string_string_pair& variables); - void RenameStationsBsl(vector* vGpsBaselines, v_string_vstring_pair& stnRenaming); - void RenameStationsPnt(vector* vGpsPoints, v_string_vstring_pair& stnRenaming); - void RenameStationsDir(vector* vDirections, v_string_vstring_pair& stnRenaming); + void RenameStationsBsl(std::vector* vGpsBaselines, v_string_vstring_pair& stnRenaming); + void RenameStationsPnt(std::vector* vGpsPoints, v_string_vstring_pair& stnRenaming); + void RenameStationsDir(std::vector* vDirections, v_string_vstring_pair& stnRenaming); - void CompleteASLDirections(_it_vdnamsrptr _it_msr, vector* vDirections, pvASLPtr vAssocStnList, + void CompleteASLDirections(_it_vdnamsrptr _it_msr, std::vector* vDirections, pvASLPtr vAssocStnList, pvUINT32 vAssocMsrList, PUINT32 currentBmsFileIndex, const _AML_TYPE_ aml_type); - void CompleteASLGpsBaselines(vector* vGpsBaselines, pvASLPtr vAssocStnList, + void CompleteASLGpsBaselines(std::vector* vGpsBaselines, pvASLPtr vAssocStnList, pvUINT32 vAssocMsrList, PUINT32 currentBmsFileIndex, const _AML_TYPE_ aml_type); - void CompleteASLGpsPoints(vector* vGpsPoints, pvASLPtr vAssocStnList, + void CompleteASLGpsPoints(std::vector* vGpsPoints, pvASLPtr vAssocStnList, pvUINT32 vAssocMsrList, PUINT32 currentBmsFileIndex, const _AML_TYPE_ aml_type); //void FindUnusedStationsInIgnoredMeasurements(vdnaMsrPtr* vMeasurements, pvASLPtr vAssocStnList, pvUINT32 vAssocMsrList, pvstring vUnusedStns, pvUINT32 vIgnoredMsrs); @@ -295,22 +296,22 @@ class dna_import { void SerialiseXmlMsr(std::ifstream* ifs_stns, std::ifstream* ifs_msrs, std::ofstream* ofs_dynaml); void InitialiseDynaMLSepStationFile(const project_settings& p, vifm_t* vinput_file_meta, - const string& stnfilename, std::ofstream* dynaml_stn_file); + const std::string& stnfilename, std::ofstream* dynaml_stn_file); void InitialiseDynaMLSepMeasurementFile(const project_settings& p, vifm_t* vinput_file_meta, - const string& msrfilename, std::ofstream* dynaml_msr_file); + const std::string& msrfilename, std::ofstream* dynaml_msr_file); void InitialiseDynaMLFile(const project_settings& p, vifm_t* vinput_file_meta, - const string& outfilename, std::ofstream* dynaml_file); + const std::string& outfilename, std::ofstream* dynaml_file); void DetermineBoundingBox(); - void BuildExtractStationsList(const string& stnList, pvstring vstnList); + void BuildExtractStationsList(const std::string& stnList, pvstring vstnList); void RemoveNonMeasurements(const UINT32& block, pvmsr_t binaryMsr); void SignalComplete(); - void SignalExceptionParseDNA(const string& message, const string& sBuf, const int& column_no); - void SignalExceptionParse(string msg, int i); - void SignalExceptionInterop(string msg, int i, const char *streamType, ...); + void SignalExceptionParseDNA(const std::string& message, const std::string& sBuf, const int& column_no); + void SignalExceptionParse(std::string msg, int i); + void SignalExceptionInterop(std::string msg, int i, const char *streamType, ...); project_settings projectSettings_; @@ -342,9 +343,9 @@ class dna_import { UINT32 m_lineNo; UINT32 m_columnNo; - string m_strProjectDefaultEpsg; - string m_strProjectDefaultEpoch; - string m_msrComments; + std::string m_strProjectDefaultEpsg; + std::string m_strProjectDefaultEpoch; + std::string m_msrComments; vvUINT32 v_ISL_; // Inner stations vvUINT32 v_JSL_; // Junction stations @@ -375,6 +376,9 @@ class dna_import { vUINT32 v_measurementCount_, v_unknownsCount_, v_ContiguousNetList_, v_parameterStationCount_; + bool _filespecifiedreferenceframe; + bool _filespecifiedepoch; + }; } // namespace dynamlinterop diff --git a/dynadjust/dynadjust/dnaimport/dnaparser_pimpl.cxx b/dynadjust/dynadjust/dnaimport/dnaparser_pimpl.cxx index 519160e6..50a2c87e 100644 --- a/dynadjust/dynadjust/dnaimport/dnaparser_pimpl.cxx +++ b/dynadjust/dynadjust/dnaimport/dnaparser_pimpl.cxx @@ -16,7 +16,6 @@ #include -using namespace std; using namespace dynadjust::measurements; using namespace dynadjust::epsg; using namespace dynadjust::exception; @@ -150,12 +149,11 @@ void Directions_pimpl::Value(const ::std::string& Value) { _dnaDirection->SetValue(Value); - if (_dnaDirection->NotIgnored()) - { + //if (_dnaDirection->NotIgnored()) + //{ // increment measurement counter *(_pMeasurementCount) += 1; - g_parsemsr_tally.D++; - } + //} } void Directions_pimpl::StdDev(const ::std::string& StdDev) @@ -175,29 +173,38 @@ void Directions_pimpl::post_Directions(const UINT32& total) { if (!_parent_dnaDirectionSet) return; + + // Is the parent ignored? Add it to the ignored set + if (_parent_dnaDirectionSet->GetIgnore()) + { + _parent_dnaDirectionSet->AddDirection(_dnaDirection.get()); + return; + } + // Is the parent not ignored, and the direction not ignored? Add it to the set if (_dnaDirection->NotIgnored()) - _parent_dnaDirectionSet->AddDirection(_dnaDirection.get()); - else { - UINT32 t = _parent_dnaDirectionSet->GetTotal() - 1; - _parent_dnaDirectionSet->SetTotal(t); + _parent_dnaDirectionSet->AddDirection(_dnaDirection.get()); + return; + } - if (t == 0) - { - // Is the entire direction set ignored? - if (_parent_dnaDirectionSet->GetIgnore()) - return; - - stringstream ss, ss2; - ss << - "...', total of " << total << " element(s)" << endl << - " - found 0 , or there aren't any non-ignored directions in the set. '"; - ss2 << " ~ " << total << ""; - throw ::xsd::cxx::parser::expected_element< char >( - ss.str(), ss2.str()); - } + // At this point, the parent is not ignored, but a sub direction is. + // Test if this ignored sub direction will lead to a false direction + UINT32 t = _parent_dnaDirectionSet->GetTotal() - 1; + + if (t == 0) + { + std::stringstream ss, ss2; + ss << + "...', total of " << total << " element(s)" << std::endl << + " - found 0 , or there aren't any non-ignored directions in the set. '"; + ss2 << " ~ " << total << ""; + throw ::xsd::cxx::parser::expected_element< char >( + ss.str(), ss2.str()); } + + _parent_dnaDirectionSet->AddDirection(_dnaDirection.get()); + } // DnaMeasurement_pimpl @@ -206,6 +213,10 @@ void Directions_pimpl::post_Directions(const UINT32& total) void DnaMeasurement_pimpl::pre() { _dnaCurrentMsr.reset(); + + // Initialise flags that will track whether Reference frame has been supplied + _ReferenceframeTagSupplied = false; + _EpochTagSupplied = false; } @@ -214,6 +225,18 @@ void DnaMeasurement_pimpl::Type(const ::std::string& Type) if (Type.empty()) throw XMLInteropException("\"Type\" element cannot be empty.", 0); + std::string frame, epoch; + + if (_ReferenceframeTagSupplied || _overridereferenceframe) + frame = _referenceframe; + else + frame = datumFromEpsgString(_fileEpsg); + + if (_EpochTagSupplied || _overridereferenceframe) + epoch = _epoch; + else + epoch = _fileEpoch; + char cType = (Type.c_str())[0]; switch (cType) { case 'A': // Horizontal angle @@ -232,6 +255,7 @@ void DnaMeasurement_pimpl::Type(const ::std::string& Type) _dnaCurrentMsr.reset(new CDnaDistance); break; case 'D': // Direction set + g_parsemsr_tally.D++; _dnaCurrentMsr.reset(new CDnaDirectionSet(++(*(_pclusterID)))); break; case 'E': // Ellipsoid arc @@ -241,7 +265,7 @@ void DnaMeasurement_pimpl::Type(const ::std::string& Type) break; case 'G': // GPS Baseline (treat as single-baseline cluster) case 'X': // GPS Baseline cluster - _dnaCurrentMsr.reset(new CDnaGpsBaselineCluster(++(*(_pclusterID)), _referenceframe, _epoch)); + _dnaCurrentMsr.reset(new CDnaGpsBaselineCluster(++(*(_pclusterID)), frame, epoch)); break; case 'H': // Orthometric height g_parsemsr_tally.H++; @@ -293,7 +317,7 @@ void DnaMeasurement_pimpl::Type(const ::std::string& Type) *(_pMeasurementCount) += 1; _dnaCurrentMsr.reset(new CDnaDistance); break; - case 'V': // Zenith angle + case 'V': // Zenith distance g_parsemsr_tally.V++; *(_pMeasurementCount) += 1; _dnaCurrentMsr.reset(new CDnaDirection); @@ -307,7 +331,7 @@ void DnaMeasurement_pimpl::Type(const ::std::string& Type) _dnaCurrentMsr.reset(new CDnaDirection); break; default: - stringstream ss; + std::stringstream ss; ss << "Unknown measurement type: " << Type; throw XMLInteropException(ss.str(), 0); } @@ -354,12 +378,12 @@ void DnaMeasurement_pimpl::Second(const ::std::string& Second) case 'D': // Direction set case 'G': // GPS Baseline case 'L': // Level difference - case 'V': // Zenith angle + case 'V': // Zenith distance case 'Z': // Vertical angle case 'X': // GPS Baseline cluster if (Second.empty()) { - stringstream ss; + std::stringstream ss; ss << "\"Second\" element cannot be empty for measurement type " << _dnaCurrentMsr->GetTypeC() << " (first station: " << _dnaCurrentMsr->GetFirst() << ")."; throw XMLInteropException(ss.str(), 0); @@ -377,7 +401,7 @@ void DnaMeasurement_pimpl::Third(const ::std::string& Third) case 'A': // Horizontal angle if (Third.empty()) { - stringstream ss; + std::stringstream ss; ss << "\"Third\" element cannot be empty for measurement type " << _dnaCurrentMsr->GetTypeC() << " (first station: " << _dnaCurrentMsr->GetFirst() << ")."; throw XMLInteropException(ss.str(), 0); @@ -408,11 +432,11 @@ void DnaMeasurement_pimpl::Value(const ::std::string& Value) case 'P': // Geodetic latitude case 'Q': // Geodetic longitude case 'L': // Level difference - case 'V': // Zenith angle + case 'V': // Zenith distance case 'Z': // Vertical angle if (Value.empty()) { - stringstream ss; + std::stringstream ss; ss << "\"Value\" element cannot be empty for measurement type " << _dnaCurrentMsr->GetTypeC() << " (first station: " << _dnaCurrentMsr->GetFirst() << ")."; throw XMLInteropException(ss.str(), 0); @@ -443,18 +467,18 @@ void DnaMeasurement_pimpl::StdDev(const ::std::string& StdDev) case 'P': // Geodetic latitude case 'Q': // Geodetic longitude case 'L': // Level difference - case 'V': // Zenith angle + case 'V': // Zenith distance case 'Z': // Vertical angle if (StdDev.empty()) { - stringstream ss; + std::stringstream ss; ss << "\"StdDev\" element cannot be empty for " << _dnaCurrentMsr->GetTypeC() << " measurements (first station: " << _dnaCurrentMsr->GetFirst() << ")."; throw XMLInteropException(ss.str(), 0); } if (DoubleFromString(StdDev) < PRECISION_1E25) { - stringstream ss; + std::stringstream ss; ss << "\"StdDev\" element cannot contain a zero or negative value for " << _dnaCurrentMsr->GetTypeC() << " measurements (first station: " << _dnaCurrentMsr->GetFirst() << ")."; throw XMLInteropException(ss.str(), 0); } @@ -560,15 +584,16 @@ void DnaMeasurement_pimpl::Epoch(const ::std::string& Epoch) return; _dnaCurrentMsr->SetEpoch(Epoch); + _EpochTagSupplied = true; } - catch (const runtime_error& e) { - stringstream ss(""); + catch (const std::runtime_error& e) { + std::stringstream ss(""); ss << e.what(); - ss << " - Measurement type: " << _dnaCurrentMsr->GetType() << endl << - " - From: " << _dnaCurrentMsr->GetFirst() << endl << - " - To: " << _dnaCurrentMsr->GetTarget() << endl << - " - Reference frame: " << _dnaCurrentMsr->GetReferenceFrame() << endl << - " - Epoch: " << Epoch << endl; + ss << " - Measurement type: " << _dnaCurrentMsr->GetType() << std::endl << + " - From: " << _dnaCurrentMsr->GetFirst() << std::endl << + " - To: " << _dnaCurrentMsr->GetTarget() << std::endl << + " - Reference frame: " << _dnaCurrentMsr->GetReferenceFrame() << std::endl << + " - Epoch: " << Epoch << std::endl; throw XMLInteropException(ss.str(), 0); } } @@ -596,21 +621,24 @@ void DnaMeasurement_pimpl::ReferenceFrame(const ::std::string& ReferenceFrame) // Set the reference frame found for this measurement _dnaCurrentMsr->SetReferenceFrame(ReferenceFrame); + _ReferenceframeTagSupplied = true; } - catch (const runtime_error& e) { - stringstream ss(""); + catch (const std::runtime_error& e) { + std::stringstream ss(""); ss << e.what(); - ss << " - Measurement type: " << _dnaCurrentMsr->GetType() << endl << - " - From: " << _dnaCurrentMsr->GetFirst() << endl << - " - To: " << _dnaCurrentMsr->GetTarget() << endl << - " - Reference frame: " << ReferenceFrame << endl << - " - Epoch: " << _dnaCurrentMsr->GetEpoch() << endl; + ss << " - Measurement type: " << _dnaCurrentMsr->GetType() << std::endl << + " - From: " << _dnaCurrentMsr->GetFirst() << std::endl << + " - To: " << _dnaCurrentMsr->GetTarget() << std::endl << + " - Reference frame: " << ReferenceFrame << std::endl << + " - Epoch: " << _dnaCurrentMsr->GetEpoch() << std::endl; throw XMLInteropException(ss.str(), 0); } } void DnaMeasurement_pimpl::GPSBaseline() { + if (!_dnaCurrentMsr) + throw XMLInteropException("\"Type\" element must be the first element within \"DnaMeasurement\".", 0); } @@ -707,7 +735,7 @@ void DnaMeasurement_pimpl::post_DnaMeasurement() UINT32 total, found; // Is the direction set empty and ignored? - // If so, do nothing. + // If so, do nothing (an invalid measurement). switch (_dnaCurrentMsr->GetTypeC()) { case 'D': @@ -729,16 +757,39 @@ void DnaMeasurement_pimpl::post_DnaMeasurement() found = static_cast(_dnaCurrentMsr->GetDirections_ptr()->size()); if (total != found) { - stringstream ss, ss2; + std::stringstream ss, ss2; ss << - "...', total of " << total << " element(s)" << endl << + "...', total of " << total << " element(s)" << std::endl << " - found " << found << " in the set. '"; ss2 << " ~ " << total << ""; throw ::xsd::cxx::parser::expected_element< char >( ss.str(), ss2.str()); } - // Okay, capture all the elements for this baseline (cluster) + found = 0; + + // Test for non-ignored measurements + for_each(_dnaCurrentMsr->GetDirections_ptr()->begin(), + _dnaCurrentMsr->GetDirections_ptr()->end(), + [this, &found](CDnaDirection& d) { + if (d.NotIgnored()) + found++; + }); + + if (found == 0 && _dnaCurrentMsr->NotIgnored()) + { + std::stringstream ss, ss2; + ss << + "...', total of " << total << " element(s)" << std::endl << + " - There aren't any non-ignored directions in the set. "; + ss2 << " ~ " << total << ""; + throw ::xsd::cxx::parser::expected_element< char >( + ss.str(), ss2.str()); + } + + _dnaCurrentMsr->SetNonIgnoredDirns(found); + + // Okay, capture all the elements for this direction set for_each(_dnaCurrentMsr->GetDirections_ptr()->begin(), _dnaCurrentMsr->GetDirections_ptr()->end(), [this](CDnaDirection& d) { @@ -759,9 +810,9 @@ void DnaMeasurement_pimpl::post_DnaMeasurement() found = static_cast(_dnaCurrentMsr->GetBaselines_ptr()->size()); if (total != found) { - stringstream ss, ss2; + std::stringstream ss, ss2; ss << - "...', total of " << total << " element(s)" << endl << + "...', total of " << total << " element(s)" << std::endl << " - found " << found << " in the set. '"; ss2 << " ~ " << total << ""; throw ::xsd::cxx::parser::expected_element< char >( @@ -789,9 +840,9 @@ void DnaMeasurement_pimpl::post_DnaMeasurement() found = static_cast(_dnaCurrentMsr->GetPoints_ptr()->size()); if (total != found) { - stringstream ss, ss2; + std::stringstream ss, ss2; ss << - "...', total of " << total << " element(s)" << endl << + "...', total of " << total << " element(s)" << std::endl << " - found " << found << " in the set. '"; ss2 << " ~ " << total << ""; throw ::xsd::cxx::parser::expected_element< char >( @@ -822,7 +873,19 @@ void DnaMeasurement_pimpl::post_DnaMeasurement() void DnaStation_pimpl::pre() { - _dnaCurrentStn.reset(new CDnaStation(_referenceframe, _epoch)); + std::string frame, epoch; + + if (_overridereferenceframe) + frame = _referenceframe; + else + frame = datumFromEpsgString(_fileEpsg); + + if (_overridereferenceframe) + epoch = _epoch; + else + epoch = _fileEpoch; + + _dnaCurrentStn.reset(new CDnaStation(frame, epoch)); _dnaCurrentStn->SetfileOrder(g_fileOrder++); } @@ -867,7 +930,10 @@ void DnaStation_pimpl::post_DnaStation() // DnaXmlFormat_pimpl // -DnaXmlFormat_pimpl::DnaXmlFormat_pimpl(std::ifstream* is, PUINT32 clusterID, const string& referenceframe, const string& epoch, bool userspecifiedreferenceframe, bool overridereferenceframe) +DnaXmlFormat_pimpl::DnaXmlFormat_pimpl(std::ifstream* is, PUINT32 clusterID, const std::string& referenceframe, const std::string& epoch, + bool firstFile, + bool userspecifiedreferenceframe, bool userspecifiedepoch, + bool overridereferenceframe) { // capture pointer to file stream is_ = is; @@ -879,9 +945,15 @@ DnaXmlFormat_pimpl::DnaXmlFormat_pimpl(std::ifstream* is, PUINT32 clusterID, con _referenceframe = referenceframe; _epoch = epoch; + // capture first file flag + _firstFile = firstFile; + // Has the user supplied a reference frame and should this be used to override all? _userspecifiedreferenceframe = userspecifiedreferenceframe; + _filespecifiedreferenceframe = false; + _filespecifiedepoch = false; _overridereferenceframe = overridereferenceframe; + _userspecifiedepoch = userspecifiedepoch; } void DnaXmlFormat_pimpl::pre() @@ -918,7 +990,7 @@ void DnaXmlFormat_pimpl::epoch() void DnaXmlFormat_pimpl::post_DnaXmlFormat(vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements) { - ostringstream ss(""); + std::ostringstream ss(""); if (_station_count > 0) { ss << "Loaded " << _station_count << " stations"; @@ -1306,33 +1378,37 @@ void referenceframe_pimpl::pre() // For DynaML.xsd, the following is specified: // // In this case, post_string() will return "GDA2020" -void referenceframe_pimpl::post_type(string& referenceframe, bool userspecifiedreferenceframe, bool overridereferenceframe) +void referenceframe_pimpl::post_type(std::string& referenceframe, std::string& fileEpsg, + bool userspecifiedreferenceframe, bool firstFile) { // 1. Get the DnaXmlFormat referenceframe attribute value from the file _referenceframe = trimstr(post_string()); - // 2. Does the user want to override the default datum? - if (overridereferenceframe) - // Do nothing, just return as referenceframe will become - // the default for all stations and measurements loaded - // from the file. - return; - - // 3. Does the user want the referenceframe attribute in the file to become the default? + // But, is this attribute value an empty string? As long as a default value + // is specified in DynaML.xsd, this value will never be empty, unless the user + // has inadvertently set in the xml file, e.g.: + // + // Check anyway ... + if (_referenceframe.empty()) + // If the file doesn't contain reference frame, set + // to the default reference frame passed from import + _referenceframe = referenceframe; + + try { + // Capture epsg code for the file + fileEpsg = epsgStringFromName(_referenceframe); + } + catch (std::runtime_error& e) { + std::stringstream ss(""); + ss << e.what() << std::endl; + throw XMLInteropException(ss.str(), 0); + } + if (!userspecifiedreferenceframe) { - // Here, the assumption is, if the user did not specify a reference frame, - // then the user wants to adopt the DnaXmlFormat referenceframe attribute - - // But, is this attribute value an empty string? As long as a default value - // is specified in DynaML.xsd, this value will never be empty, unless the user - // has inadvertently set in the xml file, e.g.: - // - if (_referenceframe.empty()) - // Set to the default reference frame passed from import - _referenceframe = referenceframe; - else - // adopt the DnaXmlFormat referenceframe attribute + // No frame supplied. Set the datum from the first file. + // If the datum field is blank in the first file, the default will be used. + if (firstFile) referenceframe = _referenceframe; } } @@ -1349,22 +1425,50 @@ void epoch_pimpl::pre() // For DynaML.xsd, the following is specified: // // In this case, post_string() will return "01.01.1994" -void epoch_pimpl::post_type(string& epoch, bool overridereferenceframe) +void epoch_pimpl::post_type(std::string& epoch, std::string& fileEpoch, + bool userspecifiedreferenceframe, bool userspecifiedepoch, + bool firstFile) { // 1. Get the DnaXmlFormat epoch attribute value from the file - _epoch = post_string(); + _epoch = trimstr(post_string()); + + // But, is this attribute value an empty string? As long as a default value + // is specified in DynaML.xsd, this value will never be empty, unless the user + // has inadvertently set in the xml file, e.g.: + // + // Check anyway ... + if (_epoch.empty()) + // Set to the default epoch passed from import + _epoch = epoch; - // 2. Does the user want to override the default datum? - if (overridereferenceframe) - // Do nothing, just return as epoch will become - // the default for all stations and measurements loaded - // from the file. - return; + // Capture epoch for the file + fileEpoch = _epoch; - // Since import doesn't offer an option to capture epoch on the command line, - // take the epoch from the DnaXmlFormat referenceframe attribute - if (_epoch.empty()) - epoch = _epoch; + // Set the epoch, provided the user does not want to + // override all epoch information + // Note, epoch is contingent upon how the frame has been + // supplied + if (userspecifiedreferenceframe) + { + // A frame has been supplied. Now check for epoch. + + // Has the user supplied an epoch on the command line (--epoch)? + if (!userspecifiedepoch) + { + // No epoch supplied. Take the epoch from the first file. + if (firstFile) + // If the user didn't specify a frame, take it from the file + epoch = _epoch; + } + + } + else + { + // No frame supplied. Set the datum from the first file. + // If the datum field is blank in the first file, the default will be used. + if (firstFile) + epoch = _epoch; + } } // system_pimpl diff --git a/dynadjust/dynadjust/dnaimport/dnaparser_pimpl.hxx b/dynadjust/dynadjust/dnaimport/dnaparser_pimpl.hxx index 86d98fc3..187dde41 100644 --- a/dynadjust/dynadjust/dnaimport/dnaparser_pimpl.hxx +++ b/dynadjust/dynadjust/dnaimport/dnaparser_pimpl.hxx @@ -18,8 +18,6 @@ #include #include -using namespace std; -using namespace boost; using namespace dynadjust::measurements; class Clusterpoint_pimpl: public virtual Clusterpoint_pskel @@ -40,15 +38,15 @@ public: virtual void post_Clusterpoint (); protected: - string _X; - string _Y; - string _Z; - string _SigmaXX; - string _SigmaXY; - string _SigmaXZ; - string _SigmaYY; - string _SigmaYZ; - string _SigmaZZ; + std::string _X; + std::string _Y; + std::string _Z; + std::string _SigmaXX; + std::string _SigmaXY; + std::string _SigmaXZ; + std::string _SigmaYY; + std::string _SigmaYZ; + std::string _SigmaZZ; }; class Directions_pimpl: public virtual Directions_pskel @@ -63,10 +61,10 @@ public: virtual void post_Directions (const UINT32&); protected: - string _Ignore; - string _Target; - string _Value; - string _StdDev; + std::string _Ignore; + std::string _Target; + std::string _Value; + std::string _StdDev; }; @@ -116,8 +114,10 @@ class DnaXmlFormat_pimpl: public virtual DnaXmlFormat_pskel { public: DnaXmlFormat_pimpl(std::ifstream* is, PUINT32 clusterID, - const string& referenceframe, const string& epoch, - bool userspecifiedreferenceframe, bool overridereferenceframe); + const std::string& referenceframe, const std::string& epoch, + bool firstFile, + bool userspecifiedreferenceframe, bool userspecifiedepoch, + bool overridereferenceframe); virtual void pre (); virtual void DnaStation (); virtual void DnaMeasurement (); @@ -125,15 +125,20 @@ public: virtual void referenceframe (); virtual void epoch (); virtual void post_DnaXmlFormat (vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements); + inline bool filespecifiedreferenceframe() { return _filespecifiedreferenceframe; } + inline bool filespecifiedepoch() { return _filespecifiedepoch; } - string DnaXmlParseMessage() { return _parse_msg; } + std::string DnaXmlParseMessage() { return _parse_msg; } inline UINT32 NumStationsRead() const { return _station_count; } inline UINT32 NumMeasurementsRead() const { return _measurement_count; } inline UINT32 CurrentClusterID() const { return _clusterID; } + inline std::string FileEpsg() const { return _fileEpsg; } + inline std::string FileEpoch() const { return _fileEpoch; } + protected: - string _parse_msg; + std::string _parse_msg; private: std::ifstream* is_; @@ -233,11 +238,12 @@ class referenceframe_pimpl: public virtual referenceframe_pskel, { public: virtual void pre (); - virtual void post_type (string& referenceframe, bool userspecifiedreferenceframe, bool override_referenceframe); - inline const string str() { return _referenceframe; } + virtual void post_type (std::string& referenceframe, std::string& fileEpsg, + bool userspecifiedreferenceframe, bool firstFile); + inline const std::string str() { return _referenceframe; } protected: - string _referenceframe; + std::string _referenceframe; bool _overridereferenceframe; }; @@ -246,11 +252,12 @@ class epoch_pimpl: public virtual epoch_pskel, { public: virtual void pre (); - virtual void post_type (string& epoch, bool override_referenceframe); - inline const string str() { return _epoch; } + virtual void post_type (std::string& epoch, std::string& fileEpoch, + bool userspecifiedreferenceframe, bool userspecifiedepoch, bool firstFile); + inline const std::string str() { return _epoch; } protected: - string _epoch; + std::string _epoch; }; class system_pimpl: public virtual system_pskel, diff --git a/dynadjust/dynadjust/dnaimport/dnaparser_pskel.cxx b/dynadjust/dynadjust/dnaimport/dnaparser_pskel.cxx index 5bb21374..d5ca0718 100644 --- a/dynadjust/dynadjust/dnaimport/dnaparser_pskel.cxx +++ b/dynadjust/dynadjust/dnaimport/dnaparser_pskel.cxx @@ -42,7 +42,6 @@ #include -using namespace std; using namespace dynadjust::measurements; // Clusterpoint_pskel @@ -2045,8 +2044,10 @@ bool DnaXmlFormat_pskel::_start_element_impl (const ::xml_schema::ro_string& ns, { this->DnaStation_parser_->InitparentStnVector(_pStns); - // Set default reference frame and epoch for this measurement - this->DnaStation_parser_->SetDefaultReferenceFrame(_referenceframe); + // Set the default reference frame and epoch for this station + this->DnaStation_parser_->InitfileEpsg(_fileEpsg); + this->DnaStation_parser_->InitfileEpoch(_fileEpoch); + this->DnaStation_parser_->SetDefaultReferenceFrame(_referenceframe, _overridereferenceframe); this->DnaStation_parser_->SetDefaultEpoch(_epoch); this->DnaStation_parser_->pre (); @@ -2065,6 +2066,8 @@ bool DnaXmlFormat_pskel::_start_element_impl (const ::xml_schema::ro_string& ns, this->DnaMeasurement_parser_->InitparentMsrVector(_pMsrs); this->DnaMeasurement_parser_->InitparentClusterID(&(_clusterID)); // Set default reference frame and epoch for this measurement + this->DnaMeasurement_parser_->InitfileEpsg(_fileEpsg); + this->DnaMeasurement_parser_->InitfileEpoch(_fileEpoch); this->DnaMeasurement_parser_->SetDefaultReferenceFrame(_referenceframe, _overridereferenceframe); this->DnaMeasurement_parser_->SetDefaultEpoch(_epoch); @@ -2143,8 +2146,11 @@ bool DnaXmlFormat_pskel::_attribute_impl (const ::xml_schema::ro_string& ns, this->epoch_parser_->_pre_impl (); this->epoch_parser_->_characters (v); this->epoch_parser_->_post_impl (); - this->epoch_parser_->post_type (_epoch, _overridereferenceframe); + this->epoch_parser_->post_type (_epoch, _fileEpoch, + _userspecifiedreferenceframe, _userspecifiedepoch, + _firstFile); this->epoch(); + _filespecifiedepoch = true; } return true; @@ -2163,10 +2169,10 @@ bool DnaXmlFormat_pskel::_attribute_impl (const ::xml_schema::ro_string& ns, this->referenceframe_parser_->_pre_impl (); this->referenceframe_parser_->_characters (v); this->referenceframe_parser_->_post_impl (); - this->referenceframe_parser_->post_type (_referenceframe, _userspecifiedreferenceframe, _overridereferenceframe); + this->referenceframe_parser_->post_type (_referenceframe, _fileEpsg, + _userspecifiedreferenceframe, _firstFile); this->referenceframe (); - - + _filespecifiedreferenceframe = true; } return true; @@ -3187,15 +3193,15 @@ void type_pskel::post_type () } // referenceframe_pskel -// string& referenceframe, bool user_specified, bool override_referenceframe -void referenceframe_pskel::post_type (string&, bool, bool) +// std::string& referenceframe, bool user_specified, bool override_referenceframe +void referenceframe_pskel::post_type (std::string&, std::string&, bool, bool) { } // epoch_pskel -// string& epoch, bool override_referenceframe -void epoch_pskel::post_type (string&, bool) +// std::string& epoch, bool override_referenceframe +void epoch_pskel::post_type (std::string&, std::string&, bool, bool, bool) { } diff --git a/dynadjust/dynadjust/dnaimport/dnaparser_pskel.hxx b/dynadjust/dynadjust/dnaimport/dnaparser_pskel.hxx index 29bcd12f..4166b357 100644 --- a/dynadjust/dynadjust/dnaimport/dnaparser_pskel.hxx +++ b/dynadjust/dynadjust/dnaimport/dnaparser_pskel.hxx @@ -99,8 +99,6 @@ class system_pskel; #include -using namespace std; -using namespace boost; using namespace dynadjust::measurements; namespace xml_schema @@ -477,12 +475,21 @@ public: virtual void post_DnaMeasurement (); // Initialisation - inline void SetDefaultReferenceFrame(string& referenceframe, bool overridereferenceframe) { + + inline void InitfileEpsg(std::string& fileEpsg) { + _fileEpsg = fileEpsg; + } + + inline void InitfileEpoch(std::string& fileEpoch) { + _fileEpoch = fileEpoch; + } + + inline void SetDefaultReferenceFrame(std::string& referenceframe, bool overridereferenceframe) { _referenceframe = referenceframe; _overridereferenceframe = overridereferenceframe; } - inline void SetDefaultEpoch(string& epoch) { + inline void SetDefaultEpoch(std::string& epoch) { _epoch = epoch; } @@ -635,8 +642,12 @@ protected: PUINT32 _pMeasurementCount; PUINT32 _pclusterID; - string _epoch; - string _referenceframe; + std::string _fileEpoch; + std::string _fileEpsg; + std::string _epoch; + std::string _referenceframe; + bool _EpochTagSupplied; + bool _ReferenceframeTagSupplied; bool _overridereferenceframe; bool _preferSingleXasG; @@ -660,16 +671,25 @@ public: virtual void post_DnaStation (); // Initialisation + inline void InitfileEpsg(std::string& fileEpsg) { + _fileEpsg = fileEpsg; + } + + inline void InitfileEpoch(std::string& fileEpoch) { + _fileEpoch = fileEpoch; + } + inline void InitparentStnVector(vdnaStnPtr* pStns) { _vParentStns = pStns; } - inline void SetDefaultReferenceFrame(string& referenceframe) { + inline void SetDefaultReferenceFrame(std::string& referenceframe, bool overridereferenceframe) { _referenceframe = referenceframe; + _overridereferenceframe = overridereferenceframe; } - inline void SetDefaultEpoch(string& epoch) { + inline void SetDefaultEpoch(std::string& epoch) { _epoch = epoch; } @@ -741,8 +761,11 @@ protected: vdnaStnPtr* _vParentStns; dnaStnPtr _dnaCurrentStn; - string _epoch; - string _referenceframe; + std::string _fileEpoch; + std::string _fileEpsg; + std::string _epoch; + std::string _referenceframe; + bool _overridereferenceframe; }; class DnaXmlFormat_pskel: public ::xml_schema::complex_content @@ -818,10 +841,16 @@ protected: UINT32 _clusterID; UINT32 _measurement_count; UINT32 _station_count; - string _referenceframe; - string _epoch; + std::string _referenceframe; + std::string _epoch; + std::string _fileEpsg; + std::string _fileEpoch; + bool _firstFile; bool _userspecifiedreferenceframe; + bool _filespecifiedreferenceframe; bool _overridereferenceframe; + bool _userspecifiedepoch; + bool _filespecifiedepoch; }; class GPSBaseline_pskel: public ::xml_schema::complex_content @@ -1225,8 +1254,8 @@ public: // virtual void // pre (); - // string& referenceframe, bool user_specified, bool overridereferenceframe - virtual void post_type (string&, bool, bool); + // std::string& referenceframe, bool user_specified, bool overridereferenceframe + virtual void post_type (std::string&, std::string&, bool, bool); }; class epoch_pskel: public virtual ::xml_schema::string_pskel @@ -1237,8 +1266,8 @@ public: // virtual void // pre (); - // string& referenceframe, bool overridereferenceframe - virtual void post_type (string&, bool); + // std::string& referenceframe, bool overridereferenceframe + virtual void post_type (std::string&, std::string&, bool, bool, bool); }; class system_pskel: public virtual ::xml_schema::string_pskel diff --git a/dynadjust/dynadjust/dnaimportwrapper/dnaimportwrapper.cpp b/dynadjust/dynadjust/dnaimportwrapper/dnaimportwrapper.cpp index 68161de8..57dcfa19 100644 --- a/dynadjust/dynadjust/dnaimportwrapper/dnaimportwrapper.cpp +++ b/dynadjust/dynadjust/dnaimportwrapper/dnaimportwrapper.cpp @@ -29,84 +29,104 @@ using namespace dynadjust::epsg; bool running; boost::mutex cout_mutex; -void PrintOutputFileHeaderInfo(std::ofstream* f_out, const string& out_file, project_settings* p, const string& header) +void PrintOutputFileHeaderInfo(std::ofstream* f_out, const std::string& out_file, project_settings* p, const std::string& header) { // Print formatted header print_file_header(*f_out, header); - *f_out << setw(PRINT_VAR_PAD) << left << "File name:" << system_complete(out_file).string() << endl << endl; + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "File name:" << boost::filesystem::system_complete(out_file).string() << std::endl << std::endl; - *f_out << setw(PRINT_VAR_PAD) << left << "Command line arguments: "; - *f_out << p->i.command_line_arguments << endl << endl; - - *f_out << setw(PRINT_VAR_PAD) << left << "Network name:" << p->g.network_name << endl; - *f_out << setw(PRINT_VAR_PAD) << left << "Input folder: " << system_complete(p->g.input_folder).string() << endl; - *f_out << setw(PRINT_VAR_PAD) << left << "Output folder: " << system_complete(p->g.output_folder).string() << endl; - *f_out << setw(PRINT_VAR_PAD) << left << "Stations file:" << system_complete(p->i.bst_file).string() << endl; - *f_out << setw(PRINT_VAR_PAD) << left << "Measurements file:" << system_complete(p->i.bms_file).string() << endl; - *f_out << setw(PRINT_VAR_PAD) << left << "Associated station file:" << system_complete(p->i.asl_file).string() << endl; - *f_out << setw(PRINT_VAR_PAD) << left << "Associated measurement file:" << system_complete(p->i.aml_file).string() << endl; - *f_out << setw(PRINT_VAR_PAD) << left << "Duplicate stations output file:" << system_complete(p->i.dst_file).string() << endl; - *f_out << setw(PRINT_VAR_PAD) << left << "Similar measurement output file:" << system_complete(p->i.dms_file).string() << endl; + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "Command line arguments: "; + *f_out << p->i.command_line_arguments << std::endl << std::endl; + + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "Network name:" << p->g.network_name << std::endl; + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "Input folder: " << boost::filesystem::system_complete(p->g.input_folder).string() << std::endl; + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "Output folder: " << boost::filesystem::system_complete(p->g.output_folder).string() << std::endl; + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "Stations file:" << boost::filesystem::system_complete(p->i.bst_file).string() << std::endl; + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "Measurements file:" << boost::filesystem::system_complete(p->i.bms_file).string() << std::endl; + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "Associated station file:" << boost::filesystem::system_complete(p->i.asl_file).string() << std::endl; + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "Associated measurement file:" << boost::filesystem::system_complete(p->i.aml_file).string() << std::endl; + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "Duplicate stations output file:" << boost::filesystem::system_complete(p->i.dst_file).string() << std::endl; + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "Similar measurement output file:" << boost::filesystem::system_complete(p->i.dms_file).string() << std::endl; if (!p->i.input_files.empty()) { _it_vstr _it_files(p->i.input_files.begin()); - string str("Input files:"); + std::string str("Input files:"); while (_it_files!=p->i.input_files.end()) { - *f_out << setw(PRINT_VAR_PAD) << left << str << *_it_files++ << endl; + *f_out << std::setw(PRINT_VAR_PAD) << std::left << str << *_it_files++ << std::endl; str = " "; } } - - if (!p->i.reference_frame.empty()) - *f_out << setw(PRINT_VAR_PAD) << left << "Default reference frame:" << p->i.reference_frame << endl; + + // If a reference frame has been supplied, report it. + // If not, the assumption is, the project frame will be adopted from the first file and + // in this case, it will be reported later + if (p->i.user_supplied_frame) + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "Project reference frame:" << p->i.reference_frame << " (user supplied)" << std::endl; + else + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "Project reference frame:" << "To be adopted from the first input file" << std::endl; + + if (p->i.override_input_rfame) + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "Override input file ref frame:" << yesno_string(p->i.override_input_rfame) << std::endl; + + UINT32 epsgCode(epsgCodeFromName(p->i.reference_frame)); + + if (isEpsgDatumStatic(epsgCode) && p->i.user_supplied_frame) + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "Project epoch:" << p->i.epoch << " (adopted reference epoch of " << p->i.reference_frame << ")" << std::endl; + else + { + if (p->i.user_supplied_epoch) + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "Project epoch:" << p->i.epoch << " (user supplied)" << std::endl; + else + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "Project epoch:" << "To be adopted from the first input file" << std::endl; + } if (!p->i.include_msrs.empty()) - *f_out << setw(PRINT_VAR_PAD) << left << "Strip all measurements except:" << p->i.include_msrs << endl; + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "Strip all measurements except:" << p->i.include_msrs << std::endl; else if (!p->i.exclude_msrs.empty()) - *f_out << setw(PRINT_VAR_PAD) << left << "Strip measurement types:" << p->i.exclude_msrs << endl; + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "Strip measurement types:" << p->i.exclude_msrs << std::endl; if (p->i.ignore_insufficient_msrs == 1) - *f_out << setw(PRINT_VAR_PAD) << left << "Ignore insufficient measurements:" << "yes" << endl; + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "Ignore insufficient measurements:" << "yes" << std::endl; if (p->i.search_nearby_stn) - *f_out << setw(PRINT_VAR_PAD) << left << "Search for nearby stations:" << "tolerance = " << p->i.search_stn_radius << "m" << endl; + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "Search for nearby stations:" << "tolerance = " << p->i.search_stn_radius << "m" << std::endl; if (p->i.search_similar_msr) - *f_out << setw(PRINT_VAR_PAD) << left << "Search for similar measurements:" << "yes" << endl; + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "Search for similar measurements:" << "yes" << std::endl; if (p->i.search_similar_msr_gx) - *f_out << setw(PRINT_VAR_PAD) << left << "Search for similar GNSS measurements:" << "yes" << endl; + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "Search for similar GNSS measurements:" << "yes" << std::endl; if (!p->i.bounding_box.empty()) { - *f_out << setw(PRINT_VAR_PAD) << left << "Bounding box: " << p->i.bounding_box << endl; + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "Bounding box: " << p->i.bounding_box << std::endl; if (p->i.split_clusters) - *f_out << setw(PRINT_VAR_PAD) << left << "Split GNSS clusters: " << (p->i.split_clusters ? "Yes" : "No") << endl; + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "Split GNSS clusters: " << (p->i.split_clusters ? "Yes" : "No") << std::endl; } else { if (!p->i.stn_associated_msr_include.empty()) - *f_out << setw(PRINT_VAR_PAD) << left << "Stations to include: " << p->i.stn_associated_msr_include << endl; + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "Stations to include: " << p->i.stn_associated_msr_include << std::endl; if (!p->i.stn_associated_msr_exclude.empty()) - *f_out << setw(PRINT_VAR_PAD) << left << "Stations to exclude: " << p->i.stn_associated_msr_exclude << endl; + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "Stations to exclude: " << p->i.stn_associated_msr_exclude << std::endl; if (p->i.split_clusters) - *f_out << setw(PRINT_VAR_PAD) << left << "Split GNSS clusters: " << (p->i.split_clusters ? "Yes" : "No") << endl; + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "Split GNSS clusters: " << (p->i.split_clusters ? "Yes" : "No") << std::endl; } if (!p->i.seg_file.empty()) - *f_out << setw(PRINT_VAR_PAD) << left << "Segmentation file:" << system_complete(p->i.seg_file).string() << endl; + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "Segmentation file:" << boost::filesystem::system_complete(p->i.seg_file).string() << std::endl; if (p->i.import_block) - *f_out << setw(PRINT_VAR_PAD) << left << "Import stns & msrs from block: " << p->i.import_block_number << endl; + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "Import stns & msrs from block: " << p->i.import_block_number << std::endl; else if (p->i.import_network) - *f_out << setw(PRINT_VAR_PAD) << left << "Import stns & msrs from network: " << p->i.import_network_number << endl; + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "Import stns & msrs from network: " << p->i.import_network_number << std::endl; - *f_out << OUTPUTLINE << endl << endl; + *f_out << OUTPUTLINE << std::endl << std::endl; } -int ParseCommandLineOptions(const int& argc, char* argv[], const variables_map& vm, project_settings& p) +int ParseCommandLineOptions(const int& argc, char* argv[], const boost::program_options::variables_map& vm, project_settings& p) { // capture command line arguments for (int cmd_arg(0); cmd_arg(p.g.input_folder, file); + [&p] (std::string& file) { + formPath(p.g.input_folder, file); } ); @@ -155,18 +181,18 @@ int ParseCommandLineOptions(const int& argc, char* argv[], const variables_map& { // Iterate through network1, network2, network3, etc // until the first name not used is found - stringstream netname_ss; - string networkASL; + std::stringstream netname_ss; + std::string networkASL; UINT32 networkID(1); // This loop terminates when a file name cannot be found while (true) { // 1. Form ASL file and see if it exists - networkASL = formPath(p.g.output_folder, p.g.network_name, "asl"); + networkASL = formPath(p.g.output_folder, p.g.network_name, "asl"); // 2. Does this network exist? - if (!exists(networkASL)) + if (!boost::filesystem::exists(networkASL)) break; // 3. Flush and look for the next network @@ -176,37 +202,64 @@ int ParseCommandLineOptions(const int& argc, char* argv[], const variables_map& } } - p.g.project_file = formPath(p.g.output_folder, p.g.network_name, "dnaproj"); + p.g.project_file = formPath(p.g.output_folder, p.g.network_name, "dnaproj"); // binary station file location (output) if (vm.count(BIN_STN_FILE)) - p.i.bst_file = formPath(p.g.output_folder, p.i.bst_file); + p.i.bst_file = formPath(p.g.output_folder, p.i.bst_file); else - p.i.bst_file = formPath(p.g.output_folder, p.g.network_name, "bst"); + p.i.bst_file = formPath(p.g.output_folder, p.g.network_name, "bst"); // binary station file location (output) if (vm.count(BIN_MSR_FILE)) - p.i.bms_file = formPath(p.g.output_folder, p.i.bms_file); + p.i.bms_file = formPath(p.g.output_folder, p.i.bms_file); else - p.i.bms_file = formPath(p.g.output_folder, p.g.network_name, "bms"); + p.i.bms_file = formPath(p.g.output_folder, p.g.network_name, "bms"); if (vm.count(IMPORT_GEO_FILE)) p.i.import_geo_file = 1; // output files - p.i.asl_file = formPath(p.g.output_folder, p.g.network_name, "asl"); // associated stations list - p.i.aml_file = formPath(p.g.output_folder, p.g.network_name, "aml"); // associated measurements list - p.i.map_file = formPath(p.g.output_folder, p.g.network_name, "map"); // station names map - p.i.dst_file = formPath(p.g.output_folder, p.g.network_name, "dst"); // fuplicate stations - p.i.dms_file = formPath(p.g.output_folder, p.g.network_name, "dms"); // duplicate measurements - p.i.imp_file = formPath(p.g.output_folder, p.g.network_name, "imp"); // log + p.i.asl_file = formPath(p.g.output_folder, p.g.network_name, "asl"); // associated stations list + p.i.aml_file = formPath(p.g.output_folder, p.g.network_name, "aml"); // associated measurements list + p.i.map_file = formPath(p.g.output_folder, p.g.network_name, "map"); // station names map + p.i.dst_file = formPath(p.g.output_folder, p.g.network_name, "dst"); // duplicate stations + p.i.dms_file = formPath(p.g.output_folder, p.g.network_name, "dms"); // duplicate measurements + p.i.imp_file = formPath(p.g.output_folder, p.g.network_name, "imp"); // log ////////////////////////////////////////////////////////////////////////////// // Ref frame options if (vm.count(OVERRIDE_INPUT_FRAME)) p.i.override_input_rfame = 1; if (vm.count(REFERENCE_FRAME)) + { + p.i.reference_frame = str_upper(p.i.reference_frame); p.i.user_supplied_frame = 1; + } + + if (vm.count(EPOCH)) + { + // Get today's date? + if (boost::iequals(p.i.epoch, "today")) + p.i.epoch = stringFromToday(); + // Has the user supplied the year only? + else if (p.i.epoch.rfind(".") == std::string::npos) + p.i.epoch.insert(0, "01.01."); + + if (p.i.epoch.length() < 10) + { + std::string dateStr = FormatDateString(p.i.epoch); + if (dateStr.empty()) + { + std::cout << std::endl << "- Error: Cannot parse date '" << p.i.epoch << "'." << std::endl << + " Please supply date in the format dd.mm.yyyy" << std::endl << std::endl; + return EXIT_FAILURE; + } + p.i.epoch = dateStr; + } + + p.i.user_supplied_epoch = 1; + } ////////////////////////////////////////////////////////////////////////////// // Data screening options @@ -218,8 +271,8 @@ int ParseCommandLineOptions(const int& argc, char* argv[], const variables_map& if (vm.count(IMPORT_SEG_BLOCK) && vm.count(IMPORT_CONTIG_NET)) { - cout << endl << "- Error: Cannot import stations and measurements using both options" << endl << " --" << IMPORT_SEG_BLOCK << " and --" << IMPORT_CONTIG_NET << "." << endl << - " Please supply only one option." << endl << endl; + std::cout << std::endl << "- Error: Cannot import stations and measurements using both options" << std::endl << " --" << IMPORT_SEG_BLOCK << " and --" << IMPORT_CONTIG_NET << "." << std::endl << + " Please supply only one option." << std::endl << std::endl; return EXIT_FAILURE; } @@ -239,9 +292,9 @@ int ParseCommandLineOptions(const int& argc, char* argv[], const variables_map& if (vm.count(SEG_FILE)) { // Does it exist? - if (!exists(p.i.seg_file)) + if (!boost::filesystem::exists(p.i.seg_file)) // Look for it in the input folder - p.i.seg_file = formPath(p.g.input_folder, leafStr(p.i.seg_file)); + p.i.seg_file = formPath(p.g.input_folder, leafStr(p.i.seg_file)); } // convert all single X measurements to G measurements? @@ -282,10 +335,10 @@ int ParseCommandLineOptions(const int& argc, char* argv[], const variables_map& p.i.apply_scaling = 1; if (vm.count(SCALAR_FILE)) - if (!exists(p.i.scalar_file)) // does it exist? + if (!boost::filesystem::exists(p.i.scalar_file)) // does it exist? // No. Assume it is a filename contained in the input folder. import will throw // an exception if it cannot be found. - p.i.scalar_file = formPath(p.g.input_folder, p.i.scalar_file); + p.i.scalar_file = formPath(p.g.input_folder, p.i.scalar_file); ////////////////////////////////////////////////////////////////////////////// // Export options @@ -293,19 +346,19 @@ int ParseCommandLineOptions(const int& argc, char* argv[], const variables_map& if (vm.count(OUTPUT_MSR_TO_STN)) p.o._msr_to_stn = 1; - p.o._m2s_file = formPath(p.g.output_folder, p.g.network_name, "m2s"); // measurement to stations table + p.o._m2s_file = formPath(p.g.output_folder, p.g.network_name, "m2s"); // measurement to stations table // Create file name based on the provided block number or contiguous network number - string fileName(p.g.network_name); + std::string fileName(p.g.network_name); if (p.i.import_block) { - stringstream blk(""); + std::stringstream blk(""); blk << ".block-" << p.i.import_block_number; fileName += blk.str(); } else if (p.i.import_network) { - stringstream net(""); + std::stringstream net(""); net << ".network-" << p.i.import_network_number; fileName += net.str(); } @@ -323,16 +376,16 @@ int ParseCommandLineOptions(const int& argc, char* argv[], const variables_map& if (vm.count(EXPORT_SINGLE_XML_FILE)) { p.i.export_single_xml_file = 1; - p.i.xml_outfile = formPath(p.g.output_folder, + p.i.xml_outfile = formPath(p.g.output_folder, fileName, "xml"); } // unique files for stations and measurements else { p.i.export_single_xml_file = 0; - p.i.xml_stnfile = formPath(p.g.output_folder, + p.i.xml_stnfile = formPath(p.g.output_folder, fileName + "stn", "xml"); - p.i.xml_msrfile = formPath(p.g.output_folder, + p.i.xml_msrfile = formPath(p.g.output_folder, fileName + "msr", "xml"); } } @@ -341,9 +394,9 @@ int ParseCommandLineOptions(const int& argc, char* argv[], const variables_map& if (vm.count(EXPORT_DNA_FILES)) { p.i.export_dna_files = 1; - p.i.dna_stnfile = formPath(p.g.output_folder, + p.i.dna_stnfile = formPath(p.g.output_folder, fileName, "stn"); - p.i.dna_msrfile = formPath(p.g.output_folder, + p.i.dna_msrfile = formPath(p.g.output_folder, fileName, "msr"); } @@ -360,7 +413,7 @@ int ParseCommandLineOptions(const int& argc, char* argv[], const variables_map& if (vm.count(SIMULATE_MSR_FILE)) { p.i.simulate_measurements = 1; - p.i.simulate_msrfile = formPath(p.g.output_folder, + p.i.simulate_msrfile = formPath(p.g.output_folder, p.g.network_name, "simulated.msr"); } @@ -379,13 +432,13 @@ void PrintMeasurementstoStations(MsrTally* parsemsrTally, dna_import* parserDyna { if (!p->g.quiet) { - cout << "+ Printing summary of measurements connected to each station..."; - cout.flush(); + std::cout << "+ Printing summary of measurements connected to each station..."; + std::cout.flush(); } parserDynaML->PrintMeasurementsToStations(p->o._m2s_file, parsemsrTally, p->i.bst_file, p->i.bms_file, p->i.aml_file, vAssocStnList); if (!p->g.quiet) - cout << " done." << endl; + std::cout << " done." << std::endl; } } @@ -395,13 +448,13 @@ int SearchForSimilarMeasurements(dna_import* parserDynaML, project_settings* p, std::ofstream dms_file; UINT32 msr; vdnaMsrPtr vSimilarMeasurements; - string comment(""); + std::string comment(""); try { if (!p->g.quiet) { - cout << "+ Searching for similar measurements... "; - cout.flush(); + std::cout << "+ Searching for similar measurements... "; + std::cout.flush(); } *imp_file << "+ Searching for similar measurements... "; @@ -414,32 +467,32 @@ int SearchForSimilarMeasurements(dna_import* parserDynaML, project_settings* p, if (!vSimilarMeasurements.empty()) { - ostringstream ss_msg; + std::ostringstream ss_msg; if (!p->i.ignore_similar_msr) - ss_msg << endl << "- Warning: "; + ss_msg << std::endl << "- Warning: "; else - ss_msg << endl << "- Note: "; + ss_msg << std::endl << "- Note: "; ss_msg << msr << " measurement" << (msr > 1 ? "s were" : " was") << " found to be very similar (if not identical)\n to " << (msr > 1 ? "other measurements" : "another measurement") << - ". See " << p->i.dms_file << " for details." << endl; + ". See " << p->i.dms_file << " for details." << std::endl; *imp_file << ss_msg.str(); if (!p->g.quiet) - cout << ss_msg.str(); + std::cout << ss_msg.str(); ss_msg.str(""); try { // Create duplicate measurements file file_opener(dms_file, p->i.dms_file); } - catch (const ios_base::failure& f) { - stringstream ss; - ss << "- Error: Could not open " << p->i.dms_file << "." << endl; - ss << " Check that the file exists and that the file is not already opened." << endl << f.what(); + catch (const std::ios_base::failure& f) { + std::stringstream ss; + ss << "- Error: Could not open " << p->i.dms_file << "." << std::endl; + ss << " Check that the file exists and that the file is not already opened." << std::endl << f.what(); if (!p->g.quiet) - cout << ss.str(); + std::cout << ss.str(); *imp_file << ss.str(); imp_file->close(); return EXIT_FAILURE; @@ -448,13 +501,13 @@ int SearchForSimilarMeasurements(dna_import* parserDynaML, project_settings* p, PrintOutputFileHeaderInfo(&dms_file, p->i.dms_file, p, "DUPLICATE MEASUREMENTS FILE"); // output message - dms_file << endl << "- " << msr << " measurement" << (msr > 1 ? "s were" : " was") << + dms_file << std::endl << "- " << msr << " measurement" << (msr > 1 ? "s were" : " was") << " found to be very similar (if not identical)\n to " << (msr > 1 ? "other measurements." : "another measurement. "); if (p->i.ignore_similar_msr) - dms_file << endl << "+ These measurements have been ignored."; - dms_file << endl << endl; + dms_file << std::endl << "+ These measurements have been ignored."; + dms_file << std::endl << std::endl; // dump measurements to dms file for_each (vSimilarMeasurements.begin(), vSimilarMeasurements.end(), @@ -465,16 +518,16 @@ int SearchForSimilarMeasurements(dna_import* parserDynaML, project_settings* p, dms_file.close(); if (p->i.ignore_similar_msr) - ss_msg << " These measurements have been ignored." << endl; + ss_msg << " These measurements have been ignored." << std::endl; else - ss_msg << endl << - " If the listed measurements are true duplicates, either remove each duplicate " << endl << - " from the measurement file and re-run " << __BINARY_NAME__ << ", or re-run " << __BINARY_NAME__ << " with the" << endl << - " --" << IGNORE_SIMILAR_MSRS << " option. Alternatively, if each measurement " << endl << - " is unique, then call " << __BINARY_NAME__ << " without the --" << TEST_SIMILAR_MSRS << " option." << endl << endl; + ss_msg << std::endl << + " If the listed measurements are true duplicates, either remove each duplicate " << std::endl << + " from the measurement file and re-run " << __BINARY_NAME__ << ", or re-run " << __BINARY_NAME__ << " with the" << std::endl << + " --" << IGNORE_SIMILAR_MSRS << " option. Alternatively, if each measurement " << std::endl << + " is unique, then call " << __BINARY_NAME__ << " without the --" << TEST_SIMILAR_MSRS << " option." << std::endl << std::endl; if (!p->g.quiet) - cout << ss_msg.str(); + std::cout << ss_msg.str(); *imp_file << ss_msg.str(); if (!p->i.ignore_similar_msr) @@ -488,22 +541,22 @@ int SearchForSimilarMeasurements(dna_import* parserDynaML, project_settings* p, *imp_file << "Done. "; if (!p->g.quiet) { - cout << "Done. "; - cout.flush(); + std::cout << "Done. "; + std::cout.flush(); } } - *imp_file << endl; + *imp_file << std::endl; if (!p->g.quiet) { - cout << endl; - cout.flush(); + std::cout << std::endl; + std::cout.flush(); } } catch (const XMLInteropException& e) { - cout << endl << "- Error: " << e.what() << endl; - *imp_file << endl << "- Error: " << e.what() << endl; + std::cout << std::endl << "- Error: " << e.what() << std::endl; + *imp_file << std::endl << "- Error: " << e.what() << std::endl; imp_file->close(); return EXIT_FAILURE; } @@ -511,26 +564,78 @@ int SearchForSimilarMeasurements(dna_import* parserDynaML, project_settings* p, return EXIT_SUCCESS; } + +void ReportExportedData(const project_settings& p, std::ostream& out, const size_t& file_type, + const UINT32& stnCount, const UINT32& msrCount) +{ + std::string dataExported; + if (stnCount > 0 && msrCount == 0) + dataExported = "stations"; + else if (stnCount == 0 && msrCount > 0) + dataExported = "measurements"; + else if (stnCount > 0 && msrCount > 0) + dataExported = "stations and measurements"; + + std::string stn_file, msr_file, single_file; + bool print_single_xml = (p.i.export_single_xml_file && p.i.export_dynaml); + + switch (file_type) + { + case dna: + stn_file = leafStr(p.i.dna_stnfile); + msr_file = leafStr(p.i.dna_msrfile); + break; + case dynaml: + if (print_single_xml) + single_file = leafStr(p.i.xml_outfile); + else + { + stn_file = leafStr(p.i.xml_stnfile); + msr_file = leafStr(p.i.xml_msrfile); + } + break; + default: + break; + } + + out << "+ Exporting " << dataExported << " to:" << std::endl; + if (file_type == dynaml && print_single_xml) + out << " - " << single_file << "... "; + else + { + if (stnCount > 0) + { + out << " - " << stn_file; + if (msrCount > 0) + out << std::endl; + } + if (msrCount > 0) + out << " - " << msr_file; + out << "... "; + } + out.flush(); +} void ExportStationsandMeasurements(dna_import* parserDynaML, const project_settings& p, std::ofstream* imp_file, vifm_t* vinput_file_meta, vdnaStnPtr* vstationsTotal, vdnaMsrPtr* vmeasurementsTotal, const UINT32& stnCount, const UINT32& msrCount) { - stringstream ssEpsgWarning; + std::stringstream ssEpsgWarning; bool displayEpsgWarning(false); - string epsgCode(epsgStringFromName(p.i.reference_frame)); + std::string epsgCode(epsgStringFromName(p.i.reference_frame)); // Check inconsistent reference frames - if ((p.i.export_dynaml || p.i.export_dna_files) && !p.i.override_input_rfame && !p.i.user_supplied_frame) + if ((p.i.export_dynaml || p.i.export_dna_files) && !p.i.override_input_rfame) { for (UINT32 i(0); isize(); ++i) { - if (!iequals(epsgCode, vinput_file_meta->at(i).epsgCode)) + if (!boost::iequals(epsgCode, vinput_file_meta->at(i).epsgCode)) { - string inputFrame(datumFromEpsgString(vinput_file_meta->at(i).epsgCode)); - ssEpsgWarning << endl << "- Warning: The default reference frame (used for all exported files)" << endl << - " does not match the reference frame of one or more input files. To" << endl << - " suppress this warning, override the default reference frame using" << endl << + std::string inputFrame(datumFromEpsgString(vinput_file_meta->at(i).epsgCode)); + ssEpsgWarning << std::endl << "- Warning: The default reference frame (" << p.i.reference_frame << ")" << + " used for all exported" << std::endl << + " files does not match the reference frame of one or more input files." << std::endl << + " To suppress this warning, override the default reference frame using" << std::endl << " --reference-frame, or provide --override-input-ref-frame."; displayEpsgWarning = true; break; @@ -543,16 +648,14 @@ void ExportStationsandMeasurements(dna_import* parserDynaML, const project_setti // DynaML file format if (p.i.export_dynaml && (stnCount > 0 || msrCount > 0)) - { + { + if (!p.g.quiet) + ReportExportedData(p, std::cout, dynaml, stnCount, msrCount); + ReportExportedData(p, *imp_file, dynaml, stnCount, msrCount); + if (p.i.export_single_xml_file) { // Single output file - if (!p.g.quiet) - { - cout << "+ Exporting stations and measurements to " << leafStr(p.i.xml_outfile) << "... "; - cout.flush(); - } - *imp_file << "+ Exporting stations and measurements to " << leafStr(p.i.xml_outfile) << "... "; parserDynaML->SerialiseDynaMLfromMemory( vstationsTotal, vmeasurementsTotal, p.i.xml_outfile, p, vinput_file_meta, (p.i.flag_unused_stn ? true : false)); @@ -560,22 +663,16 @@ void ExportStationsandMeasurements(dna_import* parserDynaML, const project_setti else { // Separate output files (default) - if (!p.g.quiet) - { - cout << "+ Exporting stations and measurements to " << leafStr(p.i.xml_stnfile) << " and " << leafStr(p.i.xml_msrfile) << "... "; - cout.flush(); - } - *imp_file << "+ Exporting stations and measurements to " << leafStr(p.i.xml_stnfile) << " and " << leafStr(p.i.xml_msrfile) << "... "; parserDynaML->SerialiseDynaMLSepfromMemory( vstationsTotal, vmeasurementsTotal, p.i.xml_stnfile, p.i.xml_msrfile, p, vinput_file_meta, (p.i.flag_unused_stn ? true : false)); } if (!p.g.quiet) { - cout << "Done." << endl; - cout.flush(); + std::cout << "Done." << std::endl; + std::cout.flush(); } - *imp_file << "Done." << endl; + *imp_file << "Done." << std::endl; } // DNA file format @@ -583,25 +680,23 @@ void ExportStationsandMeasurements(dna_import* parserDynaML, const project_setti { // Separate output files (default) if (!p.g.quiet) - { - cout << "+ Exporting stations and measurements to " << leafStr(p.i.dna_stnfile) << " and " << leafStr(p.i.dna_msrfile) << "... "; - cout.flush(); - } - *imp_file << "+ Exporting stations and measurements to " << leafStr(p.i.dna_msrfile) << " and " << leafStr(p.i.dna_msrfile) << "... "; + ReportExportedData(p, std::cout, dna, stnCount, msrCount); + ReportExportedData(p, *imp_file, dna, stnCount, msrCount); + parserDynaML->SerialiseDNA( vstationsTotal, vmeasurementsTotal, p.i.dna_stnfile, p.i.dna_msrfile, p, vinput_file_meta, (p.i.flag_unused_stn ? true : false)); - if (!p.g.quiet) - cout << "Done." << endl; - *imp_file << "Done." << endl; + if (!p.g.quiet) + std::cout << "Done." << std::endl; + *imp_file << "Done." << std::endl; } if (displayEpsgWarning) { - cout << ssEpsgWarning.str() << endl; - *imp_file << ssEpsgWarning.str() << endl; - cout.flush(); + std::cout << ssEpsgWarning.str() << std::endl; + *imp_file << ssEpsgWarning.str() << std::endl; + std::cout.flush(); } } @@ -614,35 +709,35 @@ int PrepareImportSegmentedData(project_settings& p, bool& userSuppliedSegFile) if (!p.i.seg_file.empty()) userSuppliedSegFile = true; else - p.i.seg_file = formPath(p.g.input_folder, p.g.network_name, "seg"); + p.i.seg_file = formPath(p.g.input_folder, p.g.network_name, "seg"); - if (!exists(p.i.seg_file)) + if (!boost::filesystem::exists(p.i.seg_file)) { - cout << endl << "- Error: The required segmentation file does not exist:" << endl << - " " << p.i.seg_file << endl << endl << - " Run 'segment " << p.g.network_name << "' to create a segmentation file" << endl << endl; + std::cout << std::endl << "- Error: The required segmentation file does not exist:" << std::endl << + " " << p.i.seg_file << std::endl << std::endl << + " Run 'segment " << p.g.network_name << "' to create a segmentation file" << std::endl << std::endl; return EXIT_FAILURE; } - if (!exists(p.i.bst_file)) + if (!boost::filesystem::exists(p.i.bst_file)) { - cout << endl << "- Error: The required binary station file does not exist:" << endl << - " " << p.i.bst_file << endl << endl; + std::cout << std::endl << "- Error: The required binary station file does not exist:" << std::endl << + " " << p.i.bst_file << std::endl << std::endl; return EXIT_FAILURE; } - if (!exists(p.i.bms_file)) + if (!boost::filesystem::exists(p.i.bms_file)) { - cout << endl << "- Error: The required binary measurement file does not exist:" << endl << - " " << p.i.bms_file << endl << endl; + std::cout << std::endl << "- Error: The required binary measurement file does not exist:" << std::endl << + " " << p.i.bms_file << std::endl << std::endl; return EXIT_FAILURE; } // If the user has not provided a seg file, check the meta of the default file if (!userSuppliedSegFile) { - if (last_write_time(p.i.seg_file) < last_write_time(p.i.bst_file) || - last_write_time(p.i.seg_file) < last_write_time(p.i.bms_file)) + if (boost::filesystem::last_write_time(p.i.seg_file) < boost::filesystem::last_write_time(p.i.bst_file) || + boost::filesystem::last_write_time(p.i.seg_file) < boost::filesystem::last_write_time(p.i.bms_file)) { // Has import been run after the segmentation file was created? binary_file_meta_t bst_meta, bms_meta; @@ -651,27 +746,27 @@ int PrepareImportSegmentedData(project_settings& p, bool& userSuppliedSegFile) bst.load_bst_file_meta(p.i.bst_file, bst_meta); bms.load_bms_file_meta(p.i.bms_file, bms_meta); - bool bst_meta_import(iequals(bst_meta.modifiedBy, __import_app_name__) || - iequals(bst_meta.modifiedBy, __import_dll_name__)); - bool bms_meta_import(iequals(bms_meta.modifiedBy, __import_app_name__) || - iequals(bms_meta.modifiedBy, __import_dll_name__)); + bool bst_meta_import(boost::iequals(bst_meta.modifiedBy, __import_app_name__) || + boost::iequals(bst_meta.modifiedBy, __import_dll_name__)); + bool bms_meta_import(boost::iequals(bms_meta.modifiedBy, __import_app_name__) || + boost::iequals(bms_meta.modifiedBy, __import_dll_name__)); - if ((bst_meta_import && (last_write_time(p.i.seg_file) < last_write_time(p.i.bst_file))) || - (bms_meta_import && (last_write_time(p.i.seg_file) < last_write_time(p.i.bms_file)))) + if ((bst_meta_import && (boost::filesystem::last_write_time(p.i.seg_file) < boost::filesystem::last_write_time(p.i.bst_file))) || + (bms_meta_import && (boost::filesystem::last_write_time(p.i.seg_file) < boost::filesystem::last_write_time(p.i.bms_file)))) { - cout << endl << endl << - "- Error: The raw stations and measurements have been imported after" << endl << - " the segmentation file was created:" << endl; + std::cout << std::endl << std::endl << + "- Error: The raw stations and measurements have been imported after" << std::endl << + " the segmentation file was created:" << std::endl; - time_t t_bst(last_write_time(p.i.bst_file)), t_bms(last_write_time(p.i.bms_file)); - time_t t_seg(last_write_time(p.i.seg_file)); + time_t t_bst(boost::filesystem::last_write_time(p.i.bst_file)), t_bms(boost::filesystem::last_write_time(p.i.bms_file)); + time_t t_seg(boost::filesystem::last_write_time(p.i.seg_file)); - cout << " " << leafStr(p.i.bst_file) << " last modified on " << ctime(&t_bst); - cout << " " << leafStr(p.i.bms_file) << " last modified on " << ctime(&t_bms) << endl; - cout << " " << leafStr(p.i.seg_file) << " created on " << ctime(&t_seg) << endl; - cout << " Run 'segment " << p.g.network_name << " [options]' to re-create the segmentation file, or re-run" << endl << - " the import using the " << SEG_FILE << " option if this segmentation file must\n be used." << endl << endl; + std::cout << " " << leafStr(p.i.bst_file) << " last modified on " << ctime(&t_bst); + std::cout << " " << leafStr(p.i.bms_file) << " last modified on " << ctime(&t_bms) << std::endl; + std::cout << " " << leafStr(p.i.seg_file) << " created on " << ctime(&t_seg) << std::endl; + std::cout << " Run 'segment " << p.g.network_name << " [options]' to re-create the segmentation file, or re-run" << std::endl << + " the import using the " << SEG_FILE << " option if this segmentation file must\n be used." << std::endl << std::endl; return EXIT_FAILURE; } } @@ -691,22 +786,22 @@ int ImportSegmentedBlock(dna_import& parserDynaML, vdnaStnPtr* vStations, vdnaMs // Import stations and measurements from a particular block if (!p.g.quiet) - cout << endl << "+ Importing stations and measurements from block " << p.i.import_block_number << " of\n " << p.i.seg_file << "... "; + std::cout << std::endl << "+ Importing stations and measurements from block " << p.i.import_block_number << " of\n " << p.i.seg_file << "... "; try { parserDynaML.ImportStnsMsrsFromBlock(vStations, vMeasurements, p); } catch (const XMLInteropException& e) { - stringstream ss; - ss << endl << endl << "- Error: " << e.what(); - cout << ss.str() << endl; + std::stringstream ss; + ss << std::endl << std::endl << "- Error: " << e.what(); + std::cout << ss.str() << std::endl; return EXIT_FAILURE; } *parsestnTally += parserDynaML.GetStnTally(); *parsemsrTally += parserDynaML.GetMsrTally(); if (!p.g.quiet) - cout << "Done. " << endl; + std::cout << "Done. " << std::endl; // Restore seg_file to null if (!userSuppliedSegFile) @@ -726,22 +821,22 @@ int ImportContiguousNetwork(dna_import& parserDynaML, vdnaStnPtr* vStations, vdn // Import stations and measurements from a particular block if (!p.g.quiet) - cout << endl << "+ Importing stations and measurements from contiguous network " << p.i.import_network_number << " of\n " << p.i.seg_file << "... "; + std::cout << std::endl << "+ Importing stations and measurements from contiguous network " << p.i.import_network_number << " of\n " << p.i.seg_file << "... "; try { parserDynaML.ImportStnsMsrsFromNetwork(vStations, vMeasurements, p); } catch (const XMLInteropException& e) { - stringstream ss; - ss << endl << endl << "- Error: " << e.what(); - cout << ss.str() << endl; + std::stringstream ss; + ss << std::endl << std::endl << "- Error: " << e.what(); + std::cout << ss.str() << std::endl; return EXIT_FAILURE; } *parsestnTally += parserDynaML.GetStnTally(); *parsemsrTally += parserDynaML.GetMsrTally(); if (!p.g.quiet) - cout << "Done. " << endl; + std::cout << "Done. " << std::endl; // Restore seg_file to null if (!userSuppliedSegFile) @@ -780,70 +875,72 @@ int ImportDataFiles(dna_import& parserDynaML, vdnaStnPtr* vStations, vdnaMsrPtr* // UINT32 stnCount(0), msrCount(0), clusterID(0); - // obtain the project reference frame - string epsgCode(epsgStringFromName(p.i.reference_frame)); - - size_t pos = string::npos; + size_t pos = std::string::npos; size_t strlen_arg = 0; for_each(p.i.input_files.begin(), p.i.input_files.end(), - [&strlen_arg](string& file) { - if (leafStr(file).length() > strlen_arg) - strlen_arg = leafStr(file).length(); + [&strlen_arg](std::string& file) { + if (leafStr(file).length() > strlen_arg) + strlen_arg = leafStr(file).length(); }); strlen_arg += (6 + PROGRESS_PERCENT_04); size_t i, nfiles(p.i.input_files.size()); // for each file... - string input_file, ss, status_msg; - vstring input_files; - ostringstream ss_time, ss_msg; + std::string input_file, ss, status_msg; + std::ostringstream ss_time, ss_msg; input_file_meta_t input_file_meta; - milliseconds elapsed_time(milliseconds(0)); - ptime pt; + boost::posix_time::milliseconds elapsed_time(boost::posix_time::milliseconds(0)); + boost::posix_time::ptime pt; if (!p.g.quiet) - cout << "+ Parsing: " << endl; - *imp_file << "+ Parsing " << endl; + std::cout << "+ Parsing: " << std::endl; + *imp_file << "+ Parsing " << std::endl; + + bool firstFile; + + // obtain the (default) project reference frame epsg code + std::string projectEpsgCode(epsgStringFromName(p.i.reference_frame)); for (i=0; i(p.g.input_folder, input_file); - if (!exists(input_file)) + input_file = formPath(p.g.input_folder, input_file); + if (!boost::filesystem::exists(input_file)) { - cout << "- Error: " << input_file << " does not exist" << endl; + std::cout << "- Error: " << input_file << " does not exist" << std::endl; return EXIT_FAILURE; } } - input_files.push_back(input_file); - ss = leafStr(p.i.input_files.at(i)) + "... "; + ss = leafStr(p.i.input_files.at(i)) + "... "; if (!p.g.quiet) - cout << " " << setw(strlen_arg) << left << ss; - *imp_file << " " << setw(strlen_arg) << left << ss; + std::cout << " " << std::setw(strlen_arg) << std::left << ss; + *imp_file << " " << std::setw(strlen_arg) << std::left << ss; running = true; - thread_group ui_interop_threads; + firstFile = bool(i == 0); + + boost::thread_group ui_interop_threads; if (!p.g.quiet) ui_interop_threads.create_thread(dna_import_progress_thread(&parserDynaML, &p)); ui_interop_threads.create_thread(dna_import_thread(&parserDynaML, &p, input_file, vStations, &stnCount, vMeasurements, &msrCount, - &clusterID, &input_file_meta, &status_msg, + &clusterID, &input_file_meta, firstFile, &status_msg, &elapsed_time)); ui_interop_threads.join_all(); switch (parserDynaML.GetStatus()) { case PARSE_EXCEPTION_RAISED: - *imp_file << endl << status_msg; + *imp_file << std::endl << status_msg; running = false; return EXIT_FAILURE; break; case PARSE_UNRECOGNISED_FILE: - *imp_file << status_msg << endl; + *imp_file << status_msg << std::endl; errorCount++; continue; case PARSE_SUCCESS: @@ -851,7 +948,7 @@ int ImportDataFiles(dna_import& parserDynaML, vdnaStnPtr* vStations, vdnaMsrPtr* break; default: errorCount++; - cout << endl; + std::cout << std::endl; continue; } @@ -870,58 +967,285 @@ int ImportDataFiles(dna_import& parserDynaML, vdnaStnPtr* vStations, vdnaMsrPtr* ss_time << msrCount << " measurements"; ss_time << " in "; - pt = ptime(gregorian::day_clock::local_day(), elapsed_time); - if (elapsed_time < seconds(3)) + pt = boost::posix_time::ptime(boost::gregorian::day_clock::local_day(), elapsed_time); + if (elapsed_time < boost::posix_time::seconds(3)) { - time_facet* facet(new time_facet("%s")); - ss_time.imbue(locale(ss_time.getloc(), facet)); + boost::posix_time::time_facet* facet(new boost::posix_time::time_facet("%s")); + ss_time.imbue(std::locale(ss_time.getloc(), facet)); ss_time << pt << "s"; } - else if (elapsed_time < seconds(61)) + else if (elapsed_time < boost::posix_time::seconds(61)) { - time_facet* facet(new time_facet("%S")); - ss_time.imbue(locale(ss_time.getloc(), facet)); + boost::posix_time::time_facet* facet(new boost::posix_time::time_facet("%S")); + ss_time.imbue(std::locale(ss_time.getloc(), facet)); ss_time << pt << "s"; } else ss_time << elapsed_time; - string time_message = ss_time.str(); - while ((pos = time_message.find("0s")) != string::npos) + std::string time_message = ss_time.str(); + while ((pos = time_message.find("0s")) != std::string::npos) time_message = time_message.substr(0, pos) + "s"; - if ((pos = time_message.find(" 00.")) != string::npos) + if ((pos = time_message.find(" 00.")) != std::string::npos) time_message = time_message.replace(pos, 4, " 0."); - if ((pos = time_message.find(" 0.s")) != string::npos) + if ((pos = time_message.find(" 0.s")) != std::string::npos) time_message = time_message.replace(pos, 4, " 0s"); if (!p.g.quiet) { if (isatty(fileno(stdout))) - cout << PROGRESS_BACKSPACE_04; - cout << time_message << endl; + std::cout << PROGRESS_BACKSPACE_04; + std::cout << time_message << std::endl; } - *imp_file << time_message << endl; + *imp_file << time_message << std::endl; - // Produce a warning if the input file's default reference frame - // is different to the project reference frame - string inputFileEpsg; + // Capture the input file's default reference frame and set the + // project reference frame (if not specified on the command-line) + std::string inputFileEpsg(""), inputFileDatum(""), inputFileEpoch(""); + UINT32 inputFileEpsgi; try { - inputFileEpsg = datumFromEpsgString(input_file_meta.epsgCode); + inputFileDatum = datumFromEpsgString(input_file_meta.epsgCode); + inputFileEpsg = input_file_meta.epsgCode; + inputFileEpsgi = LongFromString(inputFileEpsg); + inputFileEpoch = input_file_meta.epoch; } - catch (...) { - inputFileEpsg = epsgCode; + catch (...) + { + // Do nothing, revert to defaults + // p.i.reference_frame + // p.i.epoch } - if (!iequals(epsgCode, input_file_meta.epsgCode)) + // Is this the first file? If so, attempt to set the default datum from + // the input file (if applicable). + + bool referenceframeChanged(false); + bool epochChanged(false); + + if (firstFile) { - stringstream ssEpsgWarning; + bool isStaticFrame(false); + + // If the user has not provided a reference frame, then inspect the file reference frame + // If the file does not contain a reference frame (e.g. SNX) or the user has left it blank, + // fileEpsg will be empty. Thus, no change will occur (retain the default GDA2020). + if (!inputFileEpsg.empty() && !p.i.user_supplied_frame) + { + // Set the project defaults + referenceframeChanged = true; + + p.i.reference_frame = inputFileDatum; + p.r.reference_frame = inputFileDatum; + projectEpsgCode = epsgStringFromName(p.i.reference_frame); + } + + isStaticFrame = isEpsgDatumStatic(LongFromString(projectEpsgCode)); - ssEpsgWarning << "- Warning: Input file reference frame (" << inputFileEpsg << - ") does not match the " << endl << " default reference frame."; - if (!p.g.quiet) - cout << ssEpsgWarning.str() << endl; - *imp_file << ssEpsgWarning.str() << endl; + // Has the user supplied a static reference frame? + // If so, set the epoch + if (p.i.user_supplied_frame && isStaticFrame) + { + p.i.epoch = referenceepochFromEpsgString(projectEpsgCode); + p.r.epoch = p.i.epoch; + } + else if (!p.i.user_supplied_epoch) + { + if (inputFileEpoch.empty()) + { + // revert to epoch of the file frame + p.i.epoch = referenceepochFromEpsgCode(inputFileEpsgi); + p.r.epoch = p.i.epoch; + } + else + { + p.i.epoch = inputFileEpoch; + p.r.epoch = p.i.epoch; + } + } + + + try { + // Initialise the 'default' datum (frame and epoch) for the project, from the first file, unless the + // frame and epoch have been set by the user, in which case InitialiseDatum has already initialised the datum. + parserDynaML.InitialiseDatum(p.i.reference_frame, p.i.epoch); + } + catch (const XMLInteropException& e) { + std::stringstream ss; + ss << "- Error: "; + std::cout << ss.str() << e.what() << std::endl; + return EXIT_FAILURE; + } + + if (p.i.import_block || p.i.import_network) + continue; + + // When the user has not supplied a frame on the command line + if (!p.i.user_supplied_frame) + { + // reference frame + std::stringstream datumSource; + switch (input_file_meta.filetype) + { + case sinex: + datumSource << ". DynAdjust default (frame not present within SNX file)"; + break; + default: + if (parserDynaML.filespecifiedReferenceFrame()) + datumSource << ". Taken from " << FormatFileType(input_file_meta.filetype) << " header."; + else + datumSource << ". Reference frame not supplied in " << FormatFileType(input_file_meta.filetype) << " header."; + } + + if (!p.g.quiet) + std::cout << std::left << " Project reference frame set to " << p.i.reference_frame << datumSource.str() << std::endl; + *imp_file << std::left << " Project reference frame set to " << p.i.reference_frame << datumSource.str() << std::endl; + } + // When the user has supplied a frame on the command line, and the input file datum field is blank + else if (!parserDynaML.filespecifiedReferenceFrame()) + { + std::stringstream ssEpsgWarning; + switch (input_file_meta.filetype) + { + case sinex: + ssEpsgWarning << " - Warning: SNX reference frame set to " << p.i.reference_frame << "."; + break; + default: + ssEpsgWarning << " - Warning: Input file reference frame not supplied. Adopting " << inputFileDatum << "."; + } + + if (!p.g.quiet) + std::cout << ssEpsgWarning.str() << std::endl; + *imp_file << ssEpsgWarning.str() << std::endl; + } + // when reference frame has been supplied and the value in the file doesn't match + else if (p.i.user_supplied_frame) + { + if (!boost::iequals(projectEpsgCode, input_file_meta.epsgCode)) + { + std::stringstream ssEpsgWarning; + ssEpsgWarning << " - Warning: File reference frame (" << inputFileDatum << ") differs from project frame (" << p.i.reference_frame << ")."; + if (!p.g.quiet) + std::cout << ssEpsgWarning.str() << std::endl; + *imp_file << ssEpsgWarning.str() << std::endl; + } + } + + // When the user has not supplied an epoch on the command line + if (!p.i.user_supplied_epoch) + { + // epoch + std::stringstream epochSource; + if (isStaticFrame) + { + epochSource << " - Warning: File epoch (" << inputFileEpoch << ") will be ignored." << std::endl; + if (!p.g.quiet) + std::cout << epochSource.str(); + *imp_file << epochSource.str(); + } + else + { + if (parserDynaML.filespecifiedEpoch()) + { + if (isEpsgDatumStatic(inputFileEpsgi)) + epochSource << " (adopted reference epoch of " << inputFileDatum << ")."; + else + epochSource << ". Taken from " << FormatFileType(input_file_meta.filetype) << " header."; + } + else + epochSource << ". Epoch not supplied in " << FormatFileType(input_file_meta.filetype) << " header."; + if (!p.g.quiet) + std::cout << std::left << " Project epoch set to " << p.i.epoch << epochSource.str() << std::endl; + *imp_file << std::left << " Project epoch set to " << p.i.epoch << epochSource.str() << std::endl; + epochChanged = true; + } + } + // When the user has supplied an epoch on the command line, and the input file epoch field is blank + else if (!parserDynaML.filespecifiedEpoch()) + { + std::stringstream ssEpochWarning; + ssEpochWarning << " - Warning: Input file epoch not supplied. Adopting " << p.i.epoch << "."; + + if (!p.g.quiet) + std::cout << ssEpochWarning.str() << std::endl; + *imp_file << ssEpochWarning.str() << std::endl; + } + // when epoch has been supplied and the value in the file doesn't match + else if (p.i.user_supplied_epoch) + { + if (!boost::iequals(p.i.epoch, input_file_meta.epoch)) + { + std::stringstream ssEpochWarning; + ssEpochWarning << " - Warning: File epoch (" << inputFileEpoch << ") differs from project epoch (" << p.i.epoch << ")."; + if (!p.g.quiet) + std::cout << ssEpochWarning.str() << std::endl; + *imp_file << ssEpochWarning.str() << std::endl; + } + } + + if (referenceframeChanged || epochChanged) + { + if (!p.g.quiet) + std::cout << std::endl; + *imp_file << std::endl; + } + } + else + { + if (p.i.import_block || p.i.import_network) + continue; + + // Was the datum field empty in the file? + if (!parserDynaML.filespecifiedReferenceFrame()) + { + std::stringstream ssEpsgWarning; + ssEpsgWarning << " - Warning: Input file reference frame not supplied. Adopting " << inputFileDatum << "."; + if (!p.g.quiet) + std::cout << ssEpsgWarning.str() << std::endl; + *imp_file << ssEpsgWarning.str() << std::endl; + } + // Is the datum in the file different to the project datum? + else if (!boost::iequals(projectEpsgCode, input_file_meta.epsgCode)) + { + std::stringstream ssEpsgWarning; + if (referenceframeChanged) + { + ssEpsgWarning << " - Warning: The project reference frame has been set to the default" << std::endl << + " file datum of " << leafStr(p.i.input_files.at(i)) << " (" << inputFileDatum << ")."; + + // set the project reference frame epsg code + projectEpsgCode = epsgStringFromName(p.i.reference_frame); + } + else + { + ssEpsgWarning << " - Warning: File reference frame (" << inputFileDatum << ") differs from project frame (" << p.i.reference_frame << ")."; + } + + if (!p.g.quiet) + std::cout << ssEpsgWarning.str() << std::endl; + *imp_file << ssEpsgWarning.str() << std::endl; + } + + // Was the epoch field empty in the file? + if (!parserDynaML.filespecifiedEpoch()) + { + std::stringstream ssEpochWarning; + ssEpochWarning << " - Warning: Input file epoch not supplied. Adopting " << p.i.epoch << "."; + if (!p.g.quiet) + std::cout << ssEpochWarning.str() << std::endl; + *imp_file << ssEpochWarning.str() << std::endl; + } + // Is the epoch in the file different to the project epoch? + else if (!boost::iequals(p.i.epoch, input_file_meta.epoch)) + { + std::stringstream ssEpochWarning; + + ssEpochWarning << " - Warning: File epoch (" << inputFileEpoch << ") differs from project epoch (" << p.i.epoch << ")."; + + if (!p.g.quiet) + std::cout << ssEpochWarning.str() << std::endl; + *imp_file << ssEpochWarning.str() << std::endl; + } } } @@ -960,89 +1284,93 @@ int ImportDataFiles(dna_import& parserDynaML, vdnaStnPtr* vStations, vdnaMsrPtr* int main(int argc, char* argv[]) { // create banner message - string cmd_line_banner; + std::string cmd_line_banner; fileproc_help_header(&cmd_line_banner); project_settings p; - variables_map vm; - positional_options_description positional_options; + boost::program_options::variables_map vm; + boost::program_options::positional_options_description positional_options; - options_description standard_options("+ " + string(ALL_MODULE_STDOPT), PROGRAM_OPTIONS_LINE_LENGTH); - options_description ref_frame_options("+ " + string(IMPORT_MODULE_FRAME), PROGRAM_OPTIONS_LINE_LENGTH); - options_description data_screening_options("+ " + string(IMPORT_MODULE_SCREEN), PROGRAM_OPTIONS_LINE_LENGTH); - options_description gnss_scaling_options("+ " + string(IMPORT_MODULE_GNSS_VAR), PROGRAM_OPTIONS_LINE_LENGTH); - options_description simulation_options("+ " + string(IMPORT_MODULE_SIMULATE), PROGRAM_OPTIONS_LINE_LENGTH); - options_description output_options("+ " + string(ALL_MODULE_OUTPUT), PROGRAM_OPTIONS_LINE_LENGTH); - options_description export_options("+ " + string(ALL_MODULE_EXPORT), PROGRAM_OPTIONS_LINE_LENGTH); - options_description generic_options("+ " + string(ALL_MODULE_GENERIC), PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description standard_options("+ " + std::string(ALL_MODULE_STDOPT), PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description ref_frame_options("+ " + std::string(IMPORT_MODULE_FRAME), PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description data_screening_options("+ " + std::string(IMPORT_MODULE_SCREEN), PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description gnss_scaling_options("+ " + std::string(IMPORT_MODULE_GNSS_VAR), PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description simulation_options("+ " + std::string(IMPORT_MODULE_SIMULATE), PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description output_options("+ " + std::string(ALL_MODULE_OUTPUT), PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description export_options("+ " + std::string(ALL_MODULE_EXPORT), PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description generic_options("+ " + std::string(ALL_MODULE_GENERIC), PROGRAM_OPTIONS_LINE_LENGTH); - string cmd_line_usage("+ "); + std::string cmd_line_usage("+ "); cmd_line_usage.append(__BINARY_NAME__).append(" usage: ").append(__BINARY_NAME__).append(" [options] [files]..."); - options_description allowable_options(cmd_line_usage, PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description allowable_options(cmd_line_usage, PROGRAM_OPTIONS_LINE_LENGTH); try { // Declare a group of options that will be // allowed only on command line standard_options.add_options() - (PROJECT_FILE_P, value(&p.g.project_file), + (PROJECT_FILE_P, boost::program_options::value(&p.g.project_file), "Project file name. Full path to project file. If none specified, a new file is created using input-folder and network-name. If a project file exists, the file is used to set all command line options.") - (NETWORK_NAME_N, value(&p.g.network_name), + (NETWORK_NAME_N, boost::program_options::value(&p.g.network_name), "Network name. User defined name for all input and output files. Default is \"network#\", where # is incremented until the first available network is reached.") - (IMPORT_FILE_F, value< vstring >(&p.i.input_files), + (IMPORT_FILE_F, boost::program_options::value< vstring >(&p.i.input_files), "Station and measurement input file(s). Switch is not required.") - (IMPORT_GEO_FILE_G, value(&p.i.geo_file), + (IMPORT_GEO_FILE_G, boost::program_options::value(&p.i.geo_file), "Import DNA geoid file.") - (INPUT_FOLDER_I, value(&p.g.input_folder), + (INPUT_FOLDER_I, boost::program_options::value(&p.g.input_folder), "Path containing all input files.") - (OUTPUT_FOLDER_O, value(&p.g.output_folder), // default is ./, + (OUTPUT_FOLDER_O, boost::program_options::value(&p.g.output_folder), // default is ./, "Path for all output files.") - (BIN_STN_FILE_S, value(&p.i.bst_file), + (BIN_STN_FILE_S, boost::program_options::value(&p.i.bst_file), "Binary station output file name. Overrides network name.") - (BIN_MSR_FILE_M, value(&p.i.bms_file), + (BIN_MSR_FILE_M, boost::program_options::value(&p.i.bms_file), "Binary measurement output file name. Overrides network name.") ; ref_frame_options.add_options() - (REFERENCE_FRAME_R, value(&p.i.reference_frame), - (string("Default reference frame for all stations and measurements, and for preliminary reductions on the ellipsoid when input files do not specify a reference frame. Default is ") + + (REFERENCE_FRAME_R, boost::program_options::value(&p.i.reference_frame), + (std::string("Project reference frame for all stations, measurements, and preliminary reductions on the ellipsoid when input files do not specify a reference frame. Default is ") + p.i.reference_frame + ".").c_str()) + (EPOCH_E, boost::program_options::value(&p.i.epoch), + (std::string("Project epoch for all stations and measurements when input files do not specify an epoch. Default is ") + + p.i.epoch + ".").c_str()) (OVERRIDE_INPUT_FRAME, - "Override the reference frame specified for each measurement in input files.") + (std::string("Replace the reference frame specified in the input files with the reference frame specified by arg in --") + + std::string(REFERENCE_FRAME)).c_str()) ; data_screening_options.add_options() - (BOUNDING_BOX, value(&p.i.bounding_box), + (BOUNDING_BOX, boost::program_options::value(&p.i.bounding_box), "Import stations and measurements within bounding box. arg is a comma delimited string \"lat1,lon1,lat2,lon2\" (in dd.mmss) defining the upper-left and lower-right limits.") (GET_MSRS_TRANSCENDING_BOX, "Include measurements which transcend bounding box, including associated stations.") - (INCLUDE_STN_ASSOC_MSRS, value(&p.i.stn_associated_msr_include), + (INCLUDE_STN_ASSOC_MSRS, boost::program_options::value(&p.i.stn_associated_msr_include), "Include stations and all associated measurements. arg is a comma delimited string \"stn 1,stn 2,stn 3,...,stn N\" of the stations to include.") - (EXCLUDE_STN_ASSOC_MSRS, value(&p.i.stn_associated_msr_exclude), + (EXCLUDE_STN_ASSOC_MSRS, boost::program_options::value(&p.i.stn_associated_msr_exclude), "Exclude stations and all associated measurements. arg is a comma delimited string \"stn 1,stn 2,stn 3,...,stn N\" of the stations to exclude.") (SPLIT_CLUSTERS, "Allow bounding-box or get-stns-and-assoc-msrs to split GNSS point and baseline cluster measurements.") - (IMPORT_SEG_BLOCK, value(&p.i.import_block_number), + (IMPORT_SEG_BLOCK, boost::program_options::value(&p.i.import_block_number), "Extract stations and measurements from this block.") - (IMPORT_CONTIG_NET, value(&p.i.import_network_number), + (IMPORT_CONTIG_NET, boost::program_options::value(&p.i.import_network_number), "Extract stations and measurements from this contiguous network.") - (SEG_FILE, value(&p.i.seg_file), + (SEG_FILE, boost::program_options::value(&p.i.seg_file), "Network segmentation input file. Filename overrides network name.") (PREFER_X_MSR_AS_G, "Import single baseline cluster measurements (X) as single baselines (G).") - (INCLUDE_MSRS, value(&p.i.include_msrs), + (INCLUDE_MSRS, boost::program_options::value(&p.i.include_msrs), "Import the specified measurement types. arg is a non-delimited string of measurement types (eg \"GXY\").") - (EXCLUDE_MSRS, value(&p.i.exclude_msrs), + (EXCLUDE_MSRS, boost::program_options::value(&p.i.exclude_msrs), "Exclude the specified measurement types. arg is a non-delimited string of measurement typs (eg \"IJK\").") - (STATION_RENAMING_FILE, value(&p.i.stn_renamingfile), + (STATION_RENAMING_FILE, boost::program_options::value(&p.i.stn_renamingfile), "Station renaming file") - (STATION_DISCONTINUITY_FILE, value(&p.i.stn_discontinuityfile), + (STATION_DISCONTINUITY_FILE, boost::program_options::value(&p.i.stn_discontinuityfile), "Station discontinuity file. Applies discontinuity dates to station names in station and measurement files.") (TEST_NEARBY_STNS, "Search for nearby stations.") - (TEST_NEARBY_STN_DIST, value(&p.i.search_stn_radius), - (string("Specify the radius of the circle within which to search for nearby stations. Default is ")+ - StringFromT(STN_SEARCH_RADIUS)+string("m")).c_str()) + (TEST_NEARBY_STN_DIST, boost::program_options::value(&p.i.search_stn_radius), + (std::string("Specify the radius of the circle within which to search for nearby stations. Default is ")+ + StringFromT(STN_SEARCH_RADIUS)+std::string("m")).c_str()) (TEST_SIMILAR_GNSS_MSRS, "Search and provide warnings for GNSS baselines (G) and baseline clusters (X) which appear to have been derived from the same source data.") (TEST_SIMILAR_MSRS, @@ -1060,27 +1388,27 @@ int main(int argc, char* argv[]) ; gnss_scaling_options.add_options() - (VSCALE, value(&p.i.vscale), - (string("Global variance (v) matrix scalar for all GNSS measurements. Replaces existing scalar. Default is ")+ - StringFromT(p.i.vscale)+string(".")).c_str()) - (PSCALE, value(&p.i.pscale), - (string("Latitude (p=phi) variance matrix scalar for all GNSS measurements. Replaces existing scalar. Default is ")+ - StringFromT(p.i.pscale)+string(".")).c_str()) - (LSCALE, value(&p.i.lscale), - (string("Longitude (l=lambda) variance matrix scalar for all GNSS measurements. Replaces existing scalar. Default is ")+ - StringFromT(p.i.lscale)+string(".")).c_str()) - (HSCALE, value(&p.i.hscale), - (string("Height (h) variance matrix scalar for all GNSS measurements. Replaces existing scalar. Default is ")+ - StringFromT(p.i.hscale)+string(".")).c_str()) - (SCALAR_FILE, value(&p.i.scalar_file), + (VSCALE, boost::program_options::value(&p.i.vscale), + (std::string("Global variance (v) matrix scalar for all GNSS measurements. Replaces existing scalar. Default is ")+ + StringFromT(p.i.vscale)+std::string(".")).c_str()) + (PSCALE, boost::program_options::value(&p.i.pscale), + (std::string("Latitude (p=phi) variance matrix scalar for all GNSS measurements. Replaces existing scalar. Default is ")+ + StringFromT(p.i.pscale)+std::string(".")).c_str()) + (LSCALE, boost::program_options::value(&p.i.lscale), + (std::string("Longitude (l=lambda) variance matrix scalar for all GNSS measurements. Replaces existing scalar. Default is ")+ + StringFromT(p.i.lscale)+std::string(".")).c_str()) + (HSCALE, boost::program_options::value(&p.i.hscale), + (std::string("Height (h) variance matrix scalar for all GNSS measurements. Replaces existing scalar. Default is ")+ + StringFromT(p.i.hscale)+std::string(".")).c_str()) + (SCALAR_FILE, boost::program_options::value(&p.i.scalar_file), "File containing v, p, l and h scalars for GNSS baseline measurements between specific station pairs. Scalar file values do not apply to GNSS point or baseline clusters.") ; output_options.add_options() (OUTPUT_MSR_TO_STN, "Output summary of measurements connected to each station.") - (OUTPUT_MSR_TO_STN_SORTBY, value(&p.o._sort_msr_to_stn), - string("Sort order for measurement to stations summary.\n " + + (OUTPUT_MSR_TO_STN_SORTBY, boost::program_options::value(&p.o._sort_msr_to_stn), + std::string("Sort order for measurement to stations summary.\n " + StringFromT(orig_stn_sort_ui) + ": Original station order (default)\n " + StringFromT(meas_stn_sort_ui) + ": Measurement count").c_str()) ; @@ -1112,13 +1440,13 @@ int main(int argc, char* argv[]) ; generic_options.add_options() - (VERBOSE, value(&p.g.verbose), - string("Give detailed information about what ").append(__BINARY_NAME__).append(" is doing.\n 0: No information (default)\n 1: Helpful information\n 2: Extended information\n 3: Debug level information").c_str()) + (VERBOSE, boost::program_options::value(&p.g.verbose), + std::string("Give detailed information about what ").append(__BINARY_NAME__).append(" is doing.\n 0: No information (default)\n 1: Helpful information\n 2: Extended information\n 3: Debug level information").c_str()) (QUIET, - string("Suppresses all explanation of what ").append(__BINARY_NAME__).append(" is doing unless an error occurs.").c_str()) + std::string("Suppresses all explanation of what ").append(__BINARY_NAME__).append(" is doing unless an error occurs.").c_str()) (VERSION_V, "Display the current program version.") (HELP_H, "Show this help message.") - (HELP_MODULE, value(), + (HELP_MODULE_H, boost::program_options::value(), "Provide help for a specific help category.") ; @@ -1127,74 +1455,74 @@ int main(int argc, char* argv[]) // add "positional options" to handle command line tokens which have no option name positional_options.add(IMPORT_FILE, -1); - command_line_parser parser(argc, argv); + boost::program_options::command_line_parser parser(argc, argv); store(parser.options(allowable_options).positional(positional_options).run(), vm); notify(vm); } catch(const std::exception& e) { - cout << "- Error: " << e.what() << endl; - cout << cmd_line_banner << allowable_options << endl; + std::cout << "- Error: " << e.what() << std::endl; + std::cout << cmd_line_banner << allowable_options << std::endl; return EXIT_FAILURE; } catch (...) { - cout << "+ Exception of unknown type!\n"; + std::cout << "+ Exception of unknown type!\n"; return EXIT_FAILURE; } if (argc < 2) { - cout << endl << "- Nothing to do - no options provided. " << endl << endl; - cout << cmd_line_banner << allowable_options << endl; + std::cout << std::endl << "- Nothing to do - no options provided. " << std::endl << std::endl; + std::cout << cmd_line_banner << allowable_options << std::endl; return EXIT_FAILURE; } if (vm.count(VERSION)) { - cout << cmd_line_banner << endl; + std::cout << cmd_line_banner << std::endl; return EXIT_SUCCESS; } if (vm.count(HELP)) { - cout << cmd_line_banner << allowable_options << endl; + std::cout << cmd_line_banner << allowable_options << std::endl; return EXIT_SUCCESS; } if (vm.count(HELP_MODULE)) { - cout << cmd_line_banner; - string original_text = vm[HELP_MODULE].as(); - string help_text = str_upper(original_text); + std::cout << cmd_line_banner; + std::string original_text = vm[HELP_MODULE].as(); + std::string help_text = str_upper(original_text); - if (str_upper(ALL_MODULE_STDOPT).find(help_text) != string::npos) { - cout << standard_options << endl; + if (str_upper(ALL_MODULE_STDOPT).find(help_text) != std::string::npos) { + std::cout << standard_options << std::endl; } - else if (str_upper(IMPORT_MODULE_FRAME).find(help_text) != string::npos) { - cout << ref_frame_options << endl; + else if (str_upper(IMPORT_MODULE_FRAME).find(help_text) != std::string::npos) { + std::cout << ref_frame_options << std::endl; } - else if (str_upper(IMPORT_MODULE_SCREEN).find(help_text) != string::npos) { - cout << data_screening_options << endl; + else if (str_upper(IMPORT_MODULE_SCREEN).find(help_text) != std::string::npos) { + std::cout << data_screening_options << std::endl; } - else if (str_upper(IMPORT_MODULE_GNSS_VAR).find(help_text) != string::npos) { - cout << gnss_scaling_options << endl; + else if (str_upper(IMPORT_MODULE_GNSS_VAR).find(help_text) != std::string::npos) { + std::cout << gnss_scaling_options << std::endl; } - else if (str_upper(IMPORT_MODULE_SIMULATE).find(help_text) != string::npos) { - cout << simulation_options << endl; + else if (str_upper(IMPORT_MODULE_SIMULATE).find(help_text) != std::string::npos) { + std::cout << simulation_options << std::endl; } - else if (str_upper(ALL_MODULE_OUTPUT).find(help_text) != string::npos) { - cout << output_options << endl; + else if (str_upper(ALL_MODULE_OUTPUT).find(help_text) != std::string::npos) { + std::cout << output_options << std::endl; } - else if (str_upper(ALL_MODULE_EXPORT).find(help_text) != string::npos) { - cout << export_options << endl; + else if (str_upper(ALL_MODULE_EXPORT).find(help_text) != std::string::npos) { + std::cout << export_options << std::endl; } - else if (str_upper(ALL_MODULE_GENERIC).find(help_text) != string::npos) { - cout << generic_options << endl; + else if (str_upper(ALL_MODULE_GENERIC).find(help_text) != std::string::npos) { + std::cout << generic_options << std::endl; } else { - cout << endl << "- Error: Help module '" << - original_text << "' is not in the list of options." << endl; + std::cout << std::endl << "- Error: Help module '" << + original_text << "' is not in the list of options." << std::endl; return EXIT_FAILURE; } @@ -1217,19 +1545,19 @@ int main(int argc, char* argv[]) UINT32 errorCount(0); bool stn_map_created = false, measurements_mapped = false; - string input_file; + std::string input_file; vstring input_files; - string status_msg; + std::string status_msg; std::ofstream imp_file; try { // Create import log file. Throws runtime_error on failure. file_opener(imp_file, p.i.imp_file); } - catch (const runtime_error& e) { - stringstream ss; - ss << "- Error: Could not open " << p.i.imp_file << ". \n Check that the file exists and that the file is not already opened." << endl; - cout << ss.str() << e.what() << endl; + catch (const std::runtime_error& e) { + std::stringstream ss; + ss << "- Error: Could not open " << p.i.imp_file << ". \n Check that the file exists and that the file is not already opened." << std::endl; + std::cout << ss.str() << e.what() << std::endl; return EXIT_FAILURE; } @@ -1243,88 +1571,159 @@ int main(int argc, char* argv[]) vstationsTotal.clear(); vmeasurementsTotal.clear(); + dna_import parserDynaML; + + //////////////////////////////////////////////////////////////////////////////////// + // First things first! + // Set the 'default' reference frame for the binary station and measurement files + // At this point, the frame may be the hard-coded default, or a user-specified + // frame via: -r [--reference-frame] arg + // See comments in InitialiseDatum() + try { + // Initialise the 'default' datum for the project. + parserDynaML.InitialiseDatum(p.i.reference_frame, p.i.epoch); + } + catch (const XMLInteropException& e) { + + std::cout << std::endl << cmd_line_banner; + imp_file << std::endl << cmd_line_banner; + + std::stringstream ss; + ss << "- Error: "; + std::cout << ss.str() << e.what() << std::endl; + imp_file << ss.str() << e.what() << std::endl; + return EXIT_FAILURE; + } + + // obtain the project reference frame + UINT32 epsgCode(epsgCodeFromName(p.i.reference_frame)); + + // set the default output reference frame and epoch, so that + // if adjust is called without reftran, it reflects the datum + // supplied on import + p.r.reference_frame = p.i.reference_frame; + + // if the reference frame supplied is static, then force the epoch + // to be the reference epoch + if (isEpsgDatumStatic(epsgCode)) + { + p.i.epoch = referenceepochFromEpsgCode(epsgCode); + p.r.epoch = p.i.epoch; + } + else + { + // Dynamic reference frame. For this code to be reached, which + // is prior to the input files been parsed, the user must have + // supplied a dynamic reference frame on the command line. + // + // Has the user not supplied an epoch? + if (!p.i.user_supplied_epoch) + // No, so set the "default" epoch for the project to be the + // reference epoch of the supplied dynamic reference frame + p.i.epoch = referenceepochFromEpsgCode(epsgCode); + + // Set the project epoch for reftran also + p.r.epoch = p.i.epoch; + } + + //////////////////////////////////////////////////////////////////////////////////// + if (vm.count(QUIET)) p.g.quiet = 1; - + if (!p.g.quiet) { - cout << endl << cmd_line_banner; - - cout << "+ Options:" << endl; - cout << setw(PRINT_VAR_PAD) << left << " Network name: " << p.g.network_name << endl; - cout << setw(PRINT_VAR_PAD) << left << " Input folder: " << p.g.input_folder << endl; - cout << setw(PRINT_VAR_PAD) << left << " Output folder: " << p.g.output_folder << endl; - cout << setw(PRINT_VAR_PAD) << left << " Associated station file: " << p.i.asl_file << endl; - cout << setw(PRINT_VAR_PAD) << left << " Associated measurement file: " << p.i.aml_file << endl; - cout << setw(PRINT_VAR_PAD) << left << " Binary station output file: " << p.i.bst_file << endl; - cout << setw(PRINT_VAR_PAD) << left << " Binary measurement output file: " << p.i.bms_file << endl; + std::cout << std::endl << cmd_line_banner; + + std::cout << "+ Options:" << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Network name: " << p.g.network_name << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Input folder: " << p.g.input_folder << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Output folder: " << p.g.output_folder << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Associated station file: " << p.i.asl_file << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Associated measurement file: " << p.i.aml_file << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Binary station output file: " << p.i.bst_file << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Binary measurement output file: " << p.i.bms_file << std::endl; + + // If a reference frame and epoch have been supplied, report them. + // If not, the assumption is, the project frame and epoch will be adopted from the first file and + // in this case, it will be reported later + if (p.i.user_supplied_frame) + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Project reference frame:" << p.i.reference_frame << " (user supplied)" << std::endl; + else + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Project reference frame:" << "To be adopted from the first input file" << std::endl; - if (!p.i.reference_frame.empty()) - cout << setw(PRINT_VAR_PAD) << left << " Default reference frame:" << p.i.reference_frame << endl; - if (p.i.override_input_rfame) - cout << setw(PRINT_VAR_PAD) << left << " Override input file ref frame:" << yesno_string(p.i.override_input_rfame) << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Override input file ref frame:" << yesno_string(p.i.override_input_rfame) << std::endl; + + if (isEpsgDatumStatic(epsgCode) && p.i.user_supplied_frame) + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Project epoch:" << p.i.epoch << " (adopted reference epoch of " << p.i.reference_frame << ")" << std::endl; + else + { + if (p.i.user_supplied_epoch) + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Project epoch:" << p.i.epoch << " (user supplied)" << std::endl; + else + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Project epoch:" << "To be adopted from the first input file" << std::endl; + } if (p.i.export_dynaml) { if (p.i.export_single_xml_file) - cout << setw(PRINT_VAR_PAD) << left << " DynaML output file: " << p.i.xml_outfile << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " DynaML output file: " << p.i.xml_outfile << std::endl; else { - cout << setw(PRINT_VAR_PAD) << left << " DynaML station file: " << p.i.xml_stnfile << endl; - cout << setw(PRINT_VAR_PAD) << left << " DynaML measurement file: " << p.i.xml_msrfile << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " DynaML station file: " << p.i.xml_stnfile << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " DynaML measurement file: " << p.i.xml_msrfile << std::endl; } } if (p.i.export_dna_files) { - cout << setw(PRINT_VAR_PAD) << left << " DNA station file: " << p.i.dna_stnfile << endl; - cout << setw(PRINT_VAR_PAD) << left << " DNA measurement file: " << p.i.dna_msrfile << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " DNA station file: " << p.i.dna_stnfile << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " DNA measurement file: " << p.i.dna_msrfile << std::endl; } if (p.i.simulate_measurements) { - cout << setw(PRINT_VAR_PAD) << left << " DNA simulated msr file: " << p.i.simulate_msrfile << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " DNA simulated msr file: " << p.i.simulate_msrfile << std::endl; } if (!p.i.bounding_box.empty()) { - cout << setw(PRINT_VAR_PAD) << left << " Bounding box: " << p.i.bounding_box << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Bounding box: " << p.i.bounding_box << std::endl; if (p.i.split_clusters) - cout << setw(PRINT_VAR_PAD) << left << " Split GNSS clusters: " << (p.i.split_clusters ? "Yes" : "No") << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Split GNSS clusters: " << (p.i.split_clusters ? "Yes" : "No") << std::endl; } else { if (!p.i.stn_associated_msr_include.empty()) - cout << setw(PRINT_VAR_PAD) << left << " Stations to include: " << p.i.stn_associated_msr_include << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Stations to include: " << p.i.stn_associated_msr_include << std::endl; if (!p.i.stn_associated_msr_exclude.empty()) - cout << setw(PRINT_VAR_PAD) << left << " Stations to exclude: " << p.i.stn_associated_msr_exclude << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Stations to exclude: " << p.i.stn_associated_msr_exclude << std::endl; if (p.i.split_clusters) - cout << setw(PRINT_VAR_PAD) << left << " Split GNSS clusters: " << (p.i.split_clusters ? "Yes" : "No") << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Split GNSS clusters: " << (p.i.split_clusters ? "Yes" : "No") << std::endl; } if (p.i.import_block) { if (!p.i.seg_file.empty()) - cout << setw(PRINT_VAR_PAD) << left << " Segmentation file: " << p.i.seg_file << endl; - cout << setw(PRINT_VAR_PAD) << left << " Import stns & msrs from block: " << p.i.import_block_number << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Segmentation file: " << p.i.seg_file << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Import stns & msrs from block: " << p.i.import_block_number << std::endl; } else if (p.i.import_network) { if (!p.i.seg_file.empty()) - cout << setw(PRINT_VAR_PAD) << left << " Segmentation file: " << p.i.seg_file << endl; - cout << setw(PRINT_VAR_PAD) << left << " Import stns & msrs from network: " << p.i.import_network_number << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Segmentation file: " << p.i.seg_file << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Import stns & msrs from network: " << p.i.import_network_number << std::endl; } if (!p.i.scalar_file.empty()) - cout << setw(PRINT_VAR_PAD) << left << " GNSS baseline scalar file: " << p.i.scalar_file << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " GNSS baseline scalar file: " << p.i.scalar_file << std::endl; - cout << endl; + std::cout << std::endl; } PrintOutputFileHeaderInfo(&imp_file, p.i.imp_file, &p, "DYNADJUST IMPORT LOG FILE"); - dna_import parserDynaML; MsrTally parsemsrTally; StnTally parsestnTally; @@ -1332,31 +1731,9 @@ int main(int argc, char* argv[]) vifm_t vinput_file_meta; - // First things first! - // Set the 'default' reference frame for the binary station and measurement files - try { - // Initialise the 'default' datum for the project. - parserDynaML.InitialiseDatum(p.i.reference_frame); - } - catch (const XMLInteropException& e) { - stringstream ss; - ss << "- Error: "; - cout << ss.str() << e.what() << endl; - return EXIT_FAILURE; - } - - // obtain the project reference frame - UINT32 epsgCode(epsgCodeFromName(p.i.reference_frame)); - - // set the default output reference frame and epoch, so that - // if adjust is called without reftran, it reflects the datum - // supplied on import - p.r.reference_frame = p.i.reference_frame; - p.r.epoch = referenceepochFromEpsgCode(epsgCode); - /////////////////////////////////////////////////////////////////////////////////////////////////////////// // start "total" time - cpu_timer time; + boost::timer::cpu_timer time; // Import discontinuity file and apply discontinuities @@ -1367,47 +1744,50 @@ int main(int argc, char* argv[]) p.i.apply_discontinuities = true; // Does it exist? - if (!exists(p.i.stn_discontinuityfile)) + if (!boost::filesystem::exists(p.i.stn_discontinuityfile)) { - path discontPath(p.i.stn_discontinuityfile); - stringstream ss; - ss << "- Warning: The station discontinuity file " << discontPath.filename().string() << " does not exist... ignoring discontinuity input." << endl; - imp_file << endl << ss.str(); + boost::filesystem::path discontPath(p.i.stn_discontinuityfile); + std::stringstream ss; + ss << "- Warning: The station discontinuity file " << discontPath.filename().string() << " does not exist... ignoring discontinuity input." << std::endl; + imp_file << std::endl << ss.str(); } else { if (!p.g.quiet) { - cout << "+ Importing station discontinuities from " << p.i.stn_discontinuityfile << "... "; - cout.flush(); + std::cout << "+ Importing station discontinuities from " << p.i.stn_discontinuityfile << "... "; + std::cout.flush(); } imp_file << "+ Importing station discontinuities from " << p.i.stn_discontinuityfile << "... "; parserDynaML.ParseDiscontinuities(p.i.stn_discontinuityfile); if (!p.g.quiet) - cout << "Done." << endl; - imp_file << "Done." << endl; + std::cout << "Done." << std::endl; + imp_file << "Done." << std::endl; } if (p.i.export_discont_file) { if (!p.g.quiet) { - cout << "+ Exporting discontinuity information to text file... "; - cout.flush(); + std::cout << "+ Exporting discontinuity information to text file... "; + std::cout.flush(); } imp_file << "+ Exporting discontinuity information to text file... "; parserDynaML.SerialiseDiscontTextFile(p.i.stn_discontinuityfile); if (!p.g.quiet) { - cout << "Done." << endl; - cout.flush(); + std::cout << "Done." << std::endl; + std::cout.flush(); } - imp_file << "Done." << endl; + imp_file << "Done." << std::endl; } } + // Now, set the 'default' epoch in the binary station and measurement files + std::string default_datum = p.i.reference_frame; + // Import network information based on a segmentation block? if (p.i.import_block) { @@ -1418,7 +1798,7 @@ int main(int argc, char* argv[]) &parsestnTally, &parsemsrTally, p) != EXIT_SUCCESS) return EXIT_FAILURE; - imp_file << "Done." << endl; + imp_file << "Done." << std::endl; } // Import network information based on a contiguous network? else if (p.i.import_network) @@ -1430,7 +1810,7 @@ int main(int argc, char* argv[]) &parsestnTally, &parsemsrTally, p) != EXIT_SUCCESS) return EXIT_FAILURE; - imp_file << "Done." << endl; + imp_file << "Done." << std::endl; } // Import data as normal else @@ -1440,22 +1820,13 @@ int main(int argc, char* argv[]) if (ImportDataFiles(parserDynaML, &vStations, &vMeasurements, &vstationsTotal, &vmeasurementsTotal, &imp_file, &vinput_file_meta, &parsestnTally, &parsemsrTally, errorCount, p) != EXIT_SUCCESS) return EXIT_FAILURE; - } + } - if (!p.g.quiet) - cout << endl; + epsgCode = epsgCodeFromName(p.i.reference_frame); - // Now, set the 'default' epoch in the binary station and measurement files - try { - // Initialise the 'default' datum for the project. - parserDynaML.UpdateEpoch(&vinput_file_meta); - } - catch (const XMLInteropException& e) { - stringstream ss; - ss << "- Error: "; - cout << ss.str() << e.what() << endl; - return EXIT_FAILURE; - } + if (!p.g.quiet) + std::cout << std::endl; + imp_file << std::endl; vstring vPoorlyConstrainedStns; @@ -1465,23 +1836,23 @@ int main(int argc, char* argv[]) size_t msrCount = vmeasurementsTotal.size(); if (!p.g.quiet) { - cout << "+ Identifying stations with insufficient measurements"; - cout.flush(); + std::cout << "+ Identifying stations with insufficient measurements"; + std::cout.flush(); } imp_file << "+ Identifying stations with insufficient measurements..."; parserDynaML.IgnoreInsufficientMeasurements(&vstationsTotal, &vmeasurementsTotal, &vPoorlyConstrainedStns); if (!p.g.quiet) { - cout << " Done. " << endl; + std::cout << " Done. " << std::endl; if (msrCount > vmeasurementsTotal.size()) - cout << "+ Removed " << (msrCount - vmeasurementsTotal.size()) << " measurements which alone do not sufficiently allow for" << endl << - " the estimation of 2D coordinates." << endl; + std::cout << "+ Removed " << (msrCount - vmeasurementsTotal.size()) << " measurements which alone do not sufficiently allow for" << std::endl << + " the estimation of 2D coordinates." << std::endl; } - imp_file << " Done. " << endl; + imp_file << " Done. " << std::endl; if (msrCount > vmeasurementsTotal.size()) - imp_file << "+ Removed " << (msrCount - vmeasurementsTotal.size()) << " measurements which alone do not sufficiently allow for" << endl << - " the estimation of 2D coordinates." << endl; + imp_file << "+ Removed " << (msrCount - vmeasurementsTotal.size()) << " measurements which alone do not sufficiently allow for" << std::endl << + " the estimation of 2D coordinates." << std::endl; if (!vPoorlyConstrainedStns.empty()) { @@ -1490,14 +1861,14 @@ int main(int argc, char* argv[]) if (p.g.verbose > 2) { if (!p.g.quiet) - cout << "- Warning: station " << vPoorlyConstrainedStns.at(0) << " is not associated with sufficient measurements." << endl; - imp_file << "- Warning: station " << vPoorlyConstrainedStns.at(0) << " is not associated with sufficient measurements." << endl; + std::cout << "- Warning: station " << vPoorlyConstrainedStns.at(0) << " is not associated with sufficient measurements." << std::endl; + imp_file << "- Warning: station " << vPoorlyConstrainedStns.at(0) << " is not associated with sufficient measurements." << std::endl; } else { if (!p.g.quiet) - cout << "- Warning: 1 station is not associated with sufficient measurements." << endl; - imp_file << "- Warning: 1 station is not associated with sufficient measurements." << endl; + std::cout << "- Warning: 1 station is not associated with sufficient measurements." << std::endl; + imp_file << "- Warning: 1 station is not associated with sufficient measurements." << std::endl; } } else @@ -1505,21 +1876,21 @@ int main(int argc, char* argv[]) if (p.g.verbose > 2) { if (!p.g.quiet) - cout << "- Warning: The following " << vPoorlyConstrainedStns.size() << " stations are not associated with sufficient measurements." << endl; - imp_file << "- Warning: The following " << vPoorlyConstrainedStns.size() << " stations are not associated with sufficient measurements." << endl; + std::cout << "- Warning: The following " << vPoorlyConstrainedStns.size() << " stations are not associated with sufficient measurements." << std::endl; + imp_file << "- Warning: The following " << vPoorlyConstrainedStns.size() << " stations are not associated with sufficient measurements." << std::endl; _it_vstr poorly; for (poorly = vPoorlyConstrainedStns.begin(); poorly != vPoorlyConstrainedStns.end(); poorly++) { if (!p.g.quiet) - outputObject(string(" - " + *poorly + "\n"), cout); - outputObject(string(" - " + *poorly + "\n"), imp_file); + outputObject(std::string(" - " + *poorly + "\n"), std::cout); + outputObject(std::string(" - " + *poorly + "\n"), imp_file); } } else { if (!p.g.quiet) - cout << "- Warning: " << vPoorlyConstrainedStns.size() << " stations are not associated with sufficient measurements." << endl; - imp_file << "- Warning: " << vPoorlyConstrainedStns.size() << " stations are not associated with sufficient measurements." << endl; + std::cout << "- Warning: " << vPoorlyConstrainedStns.size() << " stations are not associated with sufficient measurements." << std::endl; + imp_file << "- Warning: " << vPoorlyConstrainedStns.size() << " stations are not associated with sufficient measurements." << std::endl; } } } @@ -1530,14 +1901,14 @@ int main(int argc, char* argv[]) { if (!p.g.quiet) { - cout << "+ Removing ignored measurements... "; - cout.flush(); + std::cout << "+ Removing ignored measurements... "; + std::cout.flush(); } imp_file << "+ Removing ignored measurements... "; parserDynaML.RemoveIgnoredMeasurements(&vmeasurementsTotal, &parsemsrTally); if (!p.g.quiet) - cout << "Done. " << endl; - imp_file << "Done. " << endl; + std::cout << "Done. " << std::endl; + imp_file << "Done. " << std::endl; } // Strip all measurements except required measurements (if supplied) @@ -1545,14 +1916,14 @@ int main(int argc, char* argv[]) { if (!p.g.quiet) { - cout << "+ Stripping all measurements except types " << p.i.include_msrs << "... "; - cout.flush(); + std::cout << "+ Stripping all measurements except types " << p.i.include_msrs << "... "; + std::cout.flush(); } imp_file << "+ Stripping all measurements except types " << p.i.include_msrs << "... "; parserDynaML.IncludeMeasurementTypes(p.i.include_msrs, &vmeasurementsTotal, &parsemsrTally); if (!p.g.quiet) - cout << "Done. " << endl; - imp_file << "Done. " << endl; + std::cout << "Done. " << std::endl; + imp_file << "Done. " << std::endl; } // Strip all unwanted measurements (if supplied) @@ -1560,14 +1931,14 @@ int main(int argc, char* argv[]) { if (!p.g.quiet) { - cout << "+ Stripping measurement types " << p.i.exclude_msrs << "... "; - cout.flush(); + std::cout << "+ Stripping measurement types " << p.i.exclude_msrs << "... "; + std::cout.flush(); } imp_file << "+ Stripping measurement types " << p.i.exclude_msrs << "... "; parserDynaML.ExcludeMeasurementTypes(p.i.exclude_msrs, &vmeasurementsTotal, &parsemsrTally); if (!p.g.quiet) - cout << "Done. " << endl; - imp_file << "Done. " << endl; + std::cout << "Done. " << std::endl; + imp_file << "Done. " << std::endl; } // Reduce stations. @@ -1581,23 +1952,23 @@ int main(int argc, char* argv[]) try { if (!p.g.quiet) { - cout << "+ Reducing stations... "; - cout.flush(); + std::cout << "+ Reducing stations... "; + std::cout.flush(); } imp_file << "+ Reducing stations... "; parserDynaML.ReduceStations(&vstationsTotal, projection); if (!p.g.quiet) - cout << "Done." << endl; - imp_file << "Done." << endl; + std::cout << "Done." << std::endl; + imp_file << "Done." << std::endl; } catch (const XMLInteropException& e) { - cout << endl << "- Error: " << e.what() << endl; - imp_file << endl << "- Error: " << e.what() << endl; + std::cout << std::endl << "- Error: " << e.what() << std::endl; + imp_file << std::endl << "- Error: " << e.what() << std::endl; imp_file.close(); return EXIT_FAILURE; } } - + ///////////////////////////////////////////////////////////////////////// // Add discontinuity sites to vStations // @@ -1622,8 +1993,8 @@ int main(int argc, char* argv[]) try { if (!p.g.quiet) { - cout << "+ Extracting stations and associated measurements... "; - cout.flush(); + std::cout << "+ Extracting stations and associated measurements... "; + std::cout.flush(); } imp_file << "+ Extracting stations and associated measurements... "; @@ -1632,15 +2003,15 @@ int main(int argc, char* argv[]) &parsestnTally, &parsemsrTally, &vUnusedStns, p, splitXmsrs, splitYmsrs); } catch (const XMLInteropException& e) { - cout << "- Error: " << e.what() << endl; - imp_file << endl << "- Error: " << e.what() << endl; + std::cout << "- Error: " << e.what() << std::endl; + imp_file << std::endl << "- Error: " << e.what() << std::endl; imp_file.close(); return EXIT_FAILURE; } if (!p.g.quiet) - cout << "Done. " << endl; - imp_file << "Done." << endl; + std::cout << "Done. " << std::endl; + imp_file << "Done." << std::endl; //msrCount = vmeasurementsTotal.size(); } @@ -1655,32 +2026,32 @@ int main(int argc, char* argv[]) try { if (!p.g.quiet) { - cout << "+ Stripping stations and measurements outside the bounding box... "; - cout.flush(); + std::cout << "+ Stripping stations and measurements outside the bounding box... "; + std::cout.flush(); } imp_file << "+ Stripping stations and measurements outside the bounding box... "; parserDynaML.ExcludeAllOutsideBoundingBox(&vstationsTotal, &vmeasurementsTotal, &parsestnTally, &parsemsrTally, &vUnusedStns, p, splitXmsrs, splitYmsrs); } catch (const XMLInteropException& e) { - cout << "- Error: " << e.what() << endl; - imp_file << endl << "- Error: " << e.what() << endl; + std::cout << "- Error: " << e.what() << std::endl; + imp_file << std::endl << "- Error: " << e.what() << std::endl; imp_file.close(); return EXIT_FAILURE; } if (!p.g.quiet) - cout << "Done. " << endl; - imp_file << "Done." << endl; + std::cout << "Done. " << std::endl; + imp_file << "Done." << std::endl; if (!vUnusedStns.empty()) { - ostringstream ss_msg; + std::ostringstream ss_msg; ss_msg << " - " << vstationsTotal.size() << (vstationsTotal.size() == 1 ? " station is" : " stations are") << - " within the bounding box." << endl; + " within the bounding box." << std::endl; imp_file << ss_msg.str(); if (!p.g.quiet) - cout << ss_msg.str(); + std::cout << ss_msg.str(); ss_msg.str(""); ss_msg << " - "; if (vUnusedStns.size() > 1) @@ -1690,8 +2061,8 @@ int main(int argc, char* argv[]) else ss_msg << "Station " << vUnusedStns.at(0) << " was"; - ss_msg << " found outside the bounding box and " << (vUnusedStns.size() > 1 ? "have been" : "has been") << endl << - " removed together with the corresponding measurements." << endl; + ss_msg << " found outside the bounding box and " << (vUnusedStns.size() > 1 ? "have been" : "has been") << std::endl << + " removed together with the corresponding measurements." << std::endl; if (p.i.split_clusters && (splitXmsrs || splitYmsrs)) { ss_msg << " - Note: GPS "; @@ -1701,22 +2072,22 @@ int main(int argc, char* argv[]) ss_msg << "baseline"; else //if (splitYmsrs) ss_msg << "point"; - ss_msg << " cluster measurements straddling the limits of" << endl << - " the bounding box have been split." << endl; + ss_msg << " cluster measurements straddling the limits of" << std::endl << + " the bounding box have been split." << std::endl; } - imp_file << ss_msg.str() << " - Excluded stations:" << endl; + imp_file << ss_msg.str() << " - Excluded stations:" << std::endl; if (!p.g.quiet) - cout << ss_msg.str() << endl; + std::cout << ss_msg.str() << std::endl; for (stn=0; stn(vmeasurementsTotal.size())); if (!p.g.quiet) - cout << endl; - imp_file << endl; + std::cout << std::endl; + imp_file << std::endl; /////////////////////////////////////////////////////////////////////// // Ok, now that unwanted stations and measurements have been stripped, @@ -1737,19 +2108,19 @@ int main(int argc, char* argv[]) if (p.i.import_block || p.i.import_network) { if (!p.g.quiet) - cout << "+ Binary file "; + std::cout << "+ Binary file "; imp_file << "+ Binary file "; } else { if (!p.g.quiet) - cout << "+ File "; + std::cout << "+ File "; imp_file << "+ File "; } if (!p.g.quiet) - cout << "parsing summary:" << endl << endl; - imp_file << "parsing summary:" << endl << endl; + std::cout << "parsing summary:" << std::endl << std::endl; + imp_file << "parsing summary:" << std::endl << std::endl; } // @@ -1758,11 +2129,11 @@ int main(int argc, char* argv[]) { if (!p.g.quiet) { - parsestnTally.coutSummary(cout, string(" Read")); - cout << endl; + parsestnTally.coutSummary(std::cout, std::string(" Read")); + std::cout << std::endl; } - parsestnTally.coutSummary(imp_file, string(" Read")); - imp_file << endl; + parsestnTally.coutSummary(imp_file, std::string(" Read")); + imp_file << std::endl; } // @@ -1771,20 +2142,20 @@ int main(int argc, char* argv[]) { if (!p.g.quiet) { - parsemsrTally.coutSummary(cout, string(" Read")); - cout << endl; + parsemsrTally.coutSummary(std::cout, std::string(" Read")); + std::cout << std::endl; } - parsemsrTally.coutSummary(imp_file, string(" Read")); - imp_file << endl; + parsemsrTally.coutSummary(imp_file, std::string(" Read")); + imp_file << std::endl; } //////////////////////////////////////////////////////////////////////// // Can we proceed? if (stnCount < 1) { - imp_file << "- No further processing can be done as no stations were loaded." << endl; + imp_file << "- No further processing can be done as no stations were loaded." << std::endl; if (!p.g.quiet) - cout << "- No further processing can be done as no stations were loaded." << endl; + std::cout << "- No further processing can be done as no stations were loaded." << std::endl; imp_file.close(); return PARSE_SUCCESS; } @@ -1794,26 +2165,26 @@ int main(int argc, char* argv[]) if (p.i.rename_stations && (stnCount > 0 || msrCount > 0)) { // Does it exist? - if (!exists(p.i.stn_renamingfile)) + if (!boost::filesystem::exists(p.i.stn_renamingfile)) // Look for it in the input folder - p.i.stn_renamingfile = formPath(p.g.input_folder, leafStr(p.i.stn_renamingfile)); + p.i.stn_renamingfile = formPath(p.g.input_folder, leafStr(p.i.stn_renamingfile)); // Apply renaming try { if (!p.g.quiet) { - cout << "+ Renaming stations... "; - cout.flush(); + std::cout << "+ Renaming stations... "; + std::cout.flush(); } imp_file << "+ Renaming stations... "; parserDynaML.RenameStations(&vstationsTotal, &vmeasurementsTotal, &p); if (!p.g.quiet) - cout << "Done." << endl; - imp_file << "Done." << endl; + std::cout << "Done." << std::endl; + imp_file << "Done." << std::endl; } catch (const XMLInteropException& e) { - cout << endl << "- Error: " << e.what() << endl; - imp_file << endl << "- Error: " << e.what() << endl; + std::cout << std::endl << "- Error: " << e.what() << std::endl; + imp_file << std::endl << "- Error: " << e.what() << std::endl; imp_file.close(); return EXIT_FAILURE; } @@ -1826,18 +2197,18 @@ int main(int argc, char* argv[]) try { if (!p.g.quiet) { - cout << "+ Applying scalars to GNSS measurements... "; - cout.flush(); + std::cout << "+ Applying scalars to GNSS measurements... "; + std::cout.flush(); } imp_file << "+ Applying scalars to GNSS measurements... "; parserDynaML.EditGNSSMsrScalars(&vmeasurementsTotal, &p); if (!p.g.quiet) - cout << "Done." << endl; - imp_file << "Done." << endl; + std::cout << "Done." << std::endl; + imp_file << "Done." << std::endl; } catch (const XMLInteropException& e) { - cout << endl << "- Error: " << e.what() << endl; - imp_file << endl << "- Error: " << e.what() << endl; + std::cout << std::endl << "- Error: " << e.what() << std::endl; + imp_file << std::endl << "- Error: " << e.what() << std::endl; imp_file.close(); return EXIT_FAILURE; } @@ -1847,20 +2218,20 @@ int main(int argc, char* argv[]) // flush duplicate stations/measurements files try { - if (exists(p.i.dst_file)) - remove(p.i.dst_file); - if (exists(p.i.dms_file)) - remove(p.i.dms_file); + if (boost::filesystem::exists(p.i.dst_file)) + boost::filesystem::remove(p.i.dst_file); + if (boost::filesystem::exists(p.i.dms_file)) + boost::filesystem::remove(p.i.dms_file); } - catch (const ios_base::failure& f) { + catch (const std::ios_base::failure& f) { // do nothing on failure. - imp_file << endl << "- Warning: " << f.what() << endl; + imp_file << std::endl << "- Warning: " << f.what() << std::endl; } // Prepare file names if importing from a segmentation block or contiguous network if (p.i.import_block == 1 || p.i.import_network == 1) { - stringstream modifier(""); + std::stringstream modifier(""); if (p.i.import_block == 1) modifier << ".block-" << p.i.import_block_number; else if (p.i.import_network == 1) @@ -1868,33 +2239,33 @@ int main(int argc, char* argv[]) // create new output file names based on block number // reform file name for each so as to preserve full path for each file - stringstream ss(""); - ss << formPath(path(p.i.bst_file).parent_path().generic_string(), path(p.i.bst_file).stem().generic_string()); + std::stringstream ss(""); + ss << formPath(boost::filesystem::path(p.i.bst_file).parent_path().generic_string(), boost::filesystem::path(p.i.bst_file).stem().generic_string()); ss << modifier.str() << ".bst"; p.i.bst_file = ss.str(); ss.str(""); - ss << formPath(path(p.i.bms_file).parent_path().generic_string(), path(p.i.bms_file).stem().generic_string()); + ss << formPath(boost::filesystem::path(p.i.bms_file).parent_path().generic_string(), boost::filesystem::path(p.i.bms_file).stem().generic_string()); ss << modifier.str() << ".bms"; p.i.bms_file = ss.str(); ss.str(""); - ss << formPath(path(p.i.asl_file).parent_path().generic_string(), path(p.i.asl_file).stem().generic_string()); + ss << formPath(boost::filesystem::path(p.i.asl_file).parent_path().generic_string(), boost::filesystem::path(p.i.asl_file).stem().generic_string()); ss << modifier.str() << ".asl"; p.i.asl_file = ss.str(); ss.str(""); - ss << formPath(path(p.i.aml_file).parent_path().generic_string(), path(p.i.aml_file).stem().generic_string()); + ss << formPath(boost::filesystem::path(p.i.aml_file).parent_path().generic_string(), boost::filesystem::path(p.i.aml_file).stem().generic_string()); ss << modifier.str() << ".aml"; p.i.aml_file = ss.str(); ss.str(""); - ss << formPath(path(p.i.map_file).parent_path().generic_string(), path(p.i.map_file).stem().generic_string()); + ss << formPath(boost::filesystem::path(p.i.map_file).parent_path().generic_string(), boost::filesystem::path(p.i.map_file).stem().generic_string()); ss << modifier.str() << ".map"; p.i.map_file = ss.str(); ss.str(""); - ss << formPath(path(p.i.map_file).parent_path().generic_string(), path(p.i.map_file).stem().generic_string()); + ss << formPath(boost::filesystem::path(p.i.map_file).parent_path().generic_string(), boost::filesystem::path(p.i.map_file).stem().generic_string()); ss << ".dbid"; p.i.dbid_file = ss.str(); } @@ -1908,7 +2279,7 @@ int main(int argc, char* argv[]) // Remove duplicates and, if required, identify station pairs // separated by distances less than search_stn_radius try { - ostringstream ss_msg; + std::ostringstream ss_msg; if (p.i.search_nearby_stn) ss_msg << "+ Testing for duplicate and nearby stations... "; else @@ -1916,8 +2287,8 @@ int main(int argc, char* argv[]) if (!p.g.quiet) { - cout << ss_msg.str(); - cout.flush(); + std::cout << ss_msg.str(); + std::cout.flush(); } imp_file << ss_msg.str(); @@ -1925,7 +2296,7 @@ int main(int argc, char* argv[]) stn = parserDynaML.RemoveDuplicateStations(&vstationsTotal, &vduplicateStns, &vnearbyStns); if (!p.g.quiet) - cout << "Done. "; + std::cout << "Done. "; imp_file << "Done. "; if (stn > 0) @@ -1934,11 +2305,11 @@ int main(int argc, char* argv[]) // Create duplicate station file file_opener(dst_file, p.i.dst_file); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss_msg << "- Error: Could not open " << p.i.dst_file << ". \n Check that the file exists and that the file is not already opened." << - endl << e.what() << endl; + std::endl << e.what() << std::endl; if (!p.g.quiet) - cout << ss_msg.str(); + std::cout << ss_msg.str(); imp_file << ss_msg.str(); imp_file.close(); return EXIT_FAILURE; @@ -1952,66 +2323,66 @@ int main(int argc, char* argv[]) ss_msg << "Removed " << vduplicateStns.size() << " duplicate station" << (vduplicateStns.size() > 1 ? "s" : ""); // print message to .dst file - dst_file << ss_msg.str() << ":" << endl; + dst_file << ss_msg.str() << ":" << std::endl; for (stn=0; stn 1 ? " pairs of stations were" : " pair of station was") << - " found to be separated by less than " << setprecision(3) << p.i.search_stn_radius << "m."; + " found to be separated by less than " << std::setprecision(3) << p.i.search_stn_radius << "m."; - imp_file << endl << "- Warning: " << ss_msg.str() << endl << - " See " << p.i.dst_file << " for details." << endl << endl; + imp_file << std::endl << "- Warning: " << ss_msg.str() << std::endl << + " See " << p.i.dst_file << " for details." << std::endl << std::endl; if (!p.g.quiet) - cout << endl << "- Warning: " << ss_msg.str() << endl << - " See " << p.i.dst_file << " for details." << endl << endl; + std::cout << std::endl << "- Warning: " << ss_msg.str() << std::endl << + " See " << p.i.dst_file << " for details." << std::endl << std::endl; ss_msg.str(""); // output message - dst_file << "Nearby station search results:" << endl << ss_msg.str() << endl << endl; + dst_file << "Nearby station search results:" << std::endl << ss_msg.str() << std::endl << std::endl; dst_file << - setw(HEADER_20) << left << "First station" << - setw(HEADER_20) << "Nearby station" << - setw(HEADER_20) << right << "Separation (m)" << - setw(HEADER_20) << "Diff height (m)" << - endl; + std::setw(HEADER_20) << std::left << "First station" << + std::setw(HEADER_20) << "Nearby station" << + std::setw(HEADER_20) << std::right << "Separation (m)" << + std::setw(HEADER_20) << "Diff height (m)" << + std::endl; for (UINT32 i(0); i<(HEADER_20*4); ++i) dst_file << "-"; - dst_file << endl; + dst_file << std::endl; // dump nearby stations to dst file for (stn=0; stn 0) { measurements_mapped = true; - imp_file << "Mapped " << mapCount << " measurements to " << vStnsMap_sortName.size() - vunusedStations.size() << " stations." << endl; + imp_file << "Mapped " << mapCount << " measurements to " << vStnsMap_sortName.size() - vunusedStations.size() << " stations." << std::endl; } else - imp_file << endl; + imp_file << std::endl; if (!vunusedStations.empty()) { @@ -2162,14 +2533,14 @@ int main(int argc, char* argv[]) if (p.g.verbose > 2) { if (!p.g.quiet) - cout << "- Warning: station " << vunusedStations.at(0) << " was not associated with any measurements." << endl; - imp_file << "- Warning: station " << vunusedStations.at(0) << " was not associated with any measurements." << endl; + std::cout << "- Warning: station " << vunusedStations.at(0) << " was not associated with any measurements." << std::endl; + imp_file << "- Warning: station " << vunusedStations.at(0) << " was not associated with any measurements." << std::endl; } else { if (!p.g.quiet) - cout << "- Warning: " << vunusedStations.size() << " station was not associated with any measurements." << endl; - imp_file << "- Warning: " << vunusedStations.size() << " station was not associated with any measurements." << endl; + std::cout << "- Warning: " << vunusedStations.size() << " station was not associated with any measurements." << std::endl; + imp_file << "- Warning: " << vunusedStations.size() << " station was not associated with any measurements." << std::endl; } } else @@ -2177,21 +2548,21 @@ int main(int argc, char* argv[]) if (p.g.verbose > 2) { if (!p.g.quiet) - cout << "- Warning: The following " << vunusedStations.size() << " stations were not associated with any measurements." << endl; - imp_file << "- Warning: The following " << vunusedStations.size() << " stations were not associated with any measurements." << endl; + std::cout << "- Warning: The following " << vunusedStations.size() << " stations were not associated with any measurements." << std::endl; + imp_file << "- Warning: The following " << vunusedStations.size() << " stations were not associated with any measurements." << std::endl; _it_vstr unused; for (unused = vunusedStations.begin(); unused!=vunusedStations.end(); unused++) { if (!p.g.quiet) - outputObject(string(" - " + *unused + "\n"), cout); - outputObject(string(" - " + *unused + "\n"), imp_file); + outputObject(std::string(" - " + *unused + "\n"), std::cout); + outputObject(std::string(" - " + *unused + "\n"), imp_file); } } else { if (!p.g.quiet) - cout << "- Warning: " << vunusedStations.size() << " stations were not associated with any measurements." << endl; - imp_file << "- Warning: " << vunusedStations.size() << " stations were not associated with any measurements." << endl; + std::cout << "- Warning: " << vunusedStations.size() << " stations were not associated with any measurements." << std::endl; + imp_file << "- Warning: " << vunusedStations.size() << " stations were not associated with any measurements." << std::endl; } } } @@ -2199,25 +2570,25 @@ int main(int argc, char* argv[]) if (msrRead < mapCount && vignoredMeasurements.empty()) { if (!p.g.quiet) - cout << "- Warning: Not all measurements were mapped: " << msrRead << " msrs read vs. " << mapCount - << " msrs mapped." << endl; + std::cout << "- Warning: Not all measurements were mapped: " << msrRead << " msrs read vs. " << mapCount + << " msrs mapped." << std::endl; } else if (msrRead != mapCount && !vignoredMeasurements.empty()) { ignMsrCount = parserDynaML.ComputeMeasurementCount(&vmeasurementsTotal, vignoredMeasurements); if (!p.g.quiet) { - cout << "- Warning: " << ignMsrCount << " ignored measurements were not mapped." << endl; + std::cout << "- Warning: " << ignMsrCount << " ignored measurements were not mapped." << std::endl; if ((msrRead - mapCount) != ignMsrCount) - cout << "- " << msrRead << " m.read vs. " << mapCount << " m.mapped." << endl; + std::cout << "- " << msrRead << " m.read vs. " << mapCount << " m.mapped." << std::endl; } } if (!p.g.quiet) - cout.flush(); + std::cout.flush(); } catch (const XMLInteropException& e) { - cout << endl << "- Error: " << e.what() << endl; - imp_file << endl << "- Error: " << e.what() << endl; + std::cout << std::endl << "- Error: " << e.what() << std::endl; + imp_file << std::endl << "- Error: " << e.what() << std::endl; imp_file.close(); return EXIT_FAILURE; } @@ -2236,8 +2607,8 @@ int main(int argc, char* argv[]) // if (stnCount == 0) // { // if (!p.g.quiet) - // cout << "- Error: there are no stations from which to simulate measurements." << endl; - // imp_file << "- Error: there are no stations from which to simulate measurements." << endl; + // std::cout << "- Error: there are no stations from which to simulate measurements." << std::endl; + // imp_file << "- Error: there are no stations from which to simulate measurements." << std::endl; // imp_file.close(); // return EXIT_FAILURE; // } @@ -2246,22 +2617,22 @@ int main(int argc, char* argv[]) // Simulate measurements if (!p.g.quiet) { - cout << "+ Simulating and exporting measurements to " << leafStr(p.i.simulate_msrfile) << "... "; - cout.flush(); + std::cout << "+ Simulating and exporting measurements to " << leafStr(p.i.simulate_msrfile) << "... "; + std::cout.flush(); } - imp_file << "+ Simulating and exporting measurements to " << leafStr(p.i.simulate_msrfile) << "... "; + imp_file << "+ Simulating and exporting measurements to " << leafStr(p.i.simulate_msrfile) << "... "; parserDynaML.SimulateMSR( ((vdnaStnPtr*) &vstationsTotal), ((vdnaMsrPtr*) &vmeasurementsTotal), p.i.simulate_msrfile, p); if (!p.g.quiet) - cout << "Done." << endl; - imp_file << "Done." << endl; + std::cout << "Done." << std::endl; + imp_file << "Done." << std::endl; } catch (const XMLInteropException& e) { - cout.flush(); - cout << endl << "- Error: " << e.what() << endl; - imp_file << endl << "- Error: " << e.what() << endl; + std::cout.flush(); + std::cout << std::endl << "- Error: " << e.what() << std::endl; + imp_file << std::endl << "- Error: " << e.what() << std::endl; imp_file.close(); return EXIT_FAILURE; } @@ -2273,21 +2644,21 @@ int main(int argc, char* argv[]) try { if (!p.g.quiet) { - cout << "+ Creating association lists... "; - cout.flush(); + std::cout << "+ Creating association lists... "; + std::cout.flush(); } imp_file << "+ Creating association lists... "; parserDynaML.CompleteAssociationLists(&vmeasurementsTotal, &associatedSL, &associatedML); if (!p.g.quiet) { - cout << "Done." << endl; - cout.flush(); + std::cout << "Done." << std::endl; + std::cout.flush(); } - imp_file << "Done." << endl; + imp_file << "Done." << std::endl; } catch (const XMLInteropException& e) { - cout << "- Error: " << e.what() << endl; - imp_file << endl << "- Error: " << e.what() << endl; + std::cout << "- Error: " << e.what() << std::endl; + imp_file << std::endl << "- Error: " << e.what() << std::endl; imp_file.close(); return EXIT_FAILURE; } @@ -2295,22 +2666,22 @@ int main(int argc, char* argv[]) try { if (!p.g.quiet) { - cout << "+ Serialising association lists... "; - cout.flush(); + std::cout << "+ Serialising association lists... "; + std::cout.flush(); } imp_file << "+ Serialising association lists... "; parserDynaML.SerialiseAsl(p.i.asl_file, &associatedSL); parserDynaML.SerialiseAml(p.i.aml_file, &associatedML); if (!p.g.quiet) { - cout << "Done." << endl; - cout.flush(); + std::cout << "Done." << std::endl; + std::cout.flush(); } - imp_file << "Done." << endl; + imp_file << "Done." << std::endl; } catch (const XMLInteropException& e) { - cout << "- Error: " << e.what() << endl; - imp_file << endl << "- Error: " << e.what() << endl; + std::cout << "- Error: " << e.what() << std::endl; + imp_file << std::endl << "- Error: " << e.what() << std::endl; imp_file.close(); return EXIT_FAILURE; } @@ -2325,25 +2696,25 @@ int main(int argc, char* argv[]) { if (!p.g.quiet) { - cout << "+ Serialising binary station file " << leafStr(p.i.bst_file) << "... "; - cout.flush(); + std::cout << "+ Serialising binary station file " << leafStr(p.i.bst_file) << "... "; + std::cout.flush(); } - imp_file << "+ Serialising binary station file " << leafStr(p.i.bst_file) << "... "; + imp_file << "+ Serialising binary station file " << leafStr(p.i.bst_file) << "... "; parserDynaML.SerialiseBst( p.i.bst_file, ((vdnaStnPtr*) &vstationsTotal), &vunusedStations, vinput_file_meta, (p.i.flag_unused_stn ? true : false)); if (!p.g.quiet) { - cout << "Done." << endl; - cout.flush(); + std::cout << "Done." << std::endl; + std::cout.flush(); } - imp_file << "Done." << endl; + imp_file << "Done." << std::endl; } } catch (const XMLInteropException& e) { - cout << "- Error: " << e.what() << endl; - imp_file << endl << "- Error: " << e.what() << endl; + std::cout << "- Error: " << e.what() << std::endl; + imp_file << std::endl << "- Error: " << e.what() << std::endl; imp_file.close(); return EXIT_FAILURE; } @@ -2358,25 +2729,25 @@ int main(int argc, char* argv[]) { if (!p.g.quiet) { - cout << "+ Serialising binary measurement file " << leafStr(p.i.bms_file) << "... "; - cout.flush(); + std::cout << "+ Serialising binary measurement file " << leafStr(p.i.bms_file) << "... "; + std::cout.flush(); } - imp_file << "+ Serialising binary measurement file " << leafStr(p.i.bms_file) << "... "; + imp_file << "+ Serialising binary measurement file " << leafStr(p.i.bms_file) << "... "; parserDynaML.SerialiseBms( p.i.bms_file, ((vdnaMsrPtr*) &vmeasurementsTotal), vinput_file_meta); if (!p.g.quiet) { - cout << "Done." << endl; - cout.flush(); + std::cout << "Done." << std::endl; + std::cout.flush(); } - imp_file << "Done." << endl; + imp_file << "Done." << std::endl; } } catch (const XMLInteropException& e) { - cout << "- Error: " << e.what() << endl; - imp_file << endl << "- Error: " << e.what() << endl; + std::cout << "- Error: " << e.what() << std::endl; + imp_file << std::endl << "- Error: " << e.what() << std::endl; imp_file.close(); return EXIT_FAILURE; } @@ -2390,22 +2761,22 @@ int main(int argc, char* argv[]) { if (!p.g.quiet) { - cout << "+ Exporting associated station list to text file... "; - cout.flush(); + std::cout << "+ Exporting associated station list to text file... "; + std::cout.flush(); } imp_file << "+ Exporting associated station list to text file... "; parserDynaML.SerialiseAslTextFile(p.i.asl_file, &associatedSL, (vdnaStnPtr*) &vstationsTotal); if (!p.g.quiet) { - cout << "Done." << endl; - cout.flush(); + std::cout << "Done." << std::endl; + std::cout.flush(); } - imp_file << "Done." << endl; + imp_file << "Done." << std::endl; } } catch (const XMLInteropException& e) { - cout << "- Error: " << e.what() << endl; - imp_file << endl << "- Error: " << e.what() << endl; + std::cout << "- Error: " << e.what() << std::endl; + imp_file << std::endl << "- Error: " << e.what() << std::endl; imp_file.close(); return EXIT_FAILURE; } @@ -2415,22 +2786,22 @@ int main(int argc, char* argv[]) { if (!p.g.quiet) { - cout << "+ Exporting associated measurement list to text file... "; - cout.flush(); + std::cout << "+ Exporting associated measurement list to text file... "; + std::cout.flush(); } imp_file << "+ Exporting associated measurement list to text file... "; parserDynaML.SerialiseAmlTextFile(p.i.bms_file, p.i.aml_file, &associatedML, &associatedSL, (vdnaStnPtr*) &vstationsTotal); if (!p.g.quiet) { - cout << "Done." << endl; - cout.flush(); + std::cout << "Done." << std::endl; + std::cout.flush(); } - imp_file << "Done." << endl; + imp_file << "Done." << std::endl; } } catch (const XMLInteropException& e) { - cout << "- Error: " << e.what() << endl; - imp_file << endl << "- Error: " << e.what() << endl; + std::cout << "- Error: " << e.what() << std::endl; + imp_file << std::endl << "- Error: " << e.what() << std::endl; imp_file.close(); return EXIT_FAILURE; } @@ -2439,20 +2810,20 @@ int main(int argc, char* argv[]) { if (!p.g.quiet) { - cout << "+ Testing internal integrity of ASL, AML and binary files... "; - cout.flush(); + std::cout << "+ Testing internal integrity of ASL, AML and binary files... "; + std::cout.flush(); } - std::ifstream binaryMS(p.i.bms_file.c_str(), ios::in | ios::binary | std::ifstream::ate); /// Open and seek to end immediately after opening. + std::ifstream binaryMS(p.i.bms_file.c_str(), std::ios::in | std::ios::binary | std::ifstream::ate); /// Open and seek to end immediately after opening. if (!binaryMS.good()) { - cout << endl << "- Could not open binary file for reading." << endl; - imp_file << endl << "- Could not open binary file for reading." << endl; + std::cout << std::endl << "- Could not open binary file for reading." << std::endl; + imp_file << std::endl << "- Could not open binary file for reading." << std::endl; imp_file.close(); return EXIT_FAILURE; } // get size, then go back to beginning size_t sFileSize = (size_t)binaryMS.tellg(); - binaryMS.seekg(0, ios::beg); + binaryMS.seekg(0, std::ios::beg); measurement_t measRecord; @@ -2467,16 +2838,16 @@ int main(int argc, char* argv[]) amlindex = associatedSL.at(stn).get()->GetAMLStnIndex() + msr; if (associatedML.at(amlindex) * sizeof(measurement_t) >= sFileSize) { - cout << "Error: index " << associatedML.at(amlindex) << " is out of range for the binary file." << endl; + std::cout << "Error: index " << associatedML.at(amlindex) << " is out of range for the binary file." << std::endl; continue; } - binaryMS.seekg(sizeof(UINT32) + associatedML.at(amlindex) * sizeof(measurement_t), ios::beg); + binaryMS.seekg(sizeof(UINT32) + associatedML.at(amlindex) * sizeof(measurement_t), std::ios::beg); binaryMS.read(reinterpret_cast(&measRecord), sizeof(measurement_t)); } } binaryMS.close(); if (!p.g.quiet) - cout << "OK." << endl; + std::cout << "OK." << std::endl; } } @@ -2485,9 +2856,9 @@ int main(int argc, char* argv[]) PrintMeasurementstoStations(&parsemsrTally, &parserDynaML, &p, &associatedSL); } catch (const XMLInteropException& e) { - cout.flush(); - cout << endl << "- Error: " << e.what() << endl; - imp_file << endl << "- Error: " << e.what() << endl; + std::cout.flush(); + std::cout << std::endl << "- Error: " << e.what() << std::endl; + imp_file << std::endl << "- Error: " << e.what() << std::endl; imp_file.close(); return EXIT_FAILURE; } @@ -2501,13 +2872,10 @@ int main(int argc, char* argv[]) } else { - p.i.dbid_file = formPath(p.g.output_folder, p.g.network_name, "dbid"); + p.i.dbid_file = formPath(p.g.output_folder, p.g.network_name, "dbid"); parserDynaML.SerialiseDatabaseId(p.i.dbid_file, &vmeasurementsTotal); } - - - // Export stations and measurements try { if (p.i.export_dynaml || p.i.export_dna_files) @@ -2515,9 +2883,9 @@ int main(int argc, char* argv[]) &vstationsTotal, &vmeasurementsTotal, stnCount, msrCount); } catch (const XMLInteropException& e) { - cout.flush(); - cout << endl << "- Error: " << e.what() << endl; - imp_file << endl << "- Error: " << e.what() << endl; + std::cout.flush(); + std::cout << std::endl << "- Error: " << e.what() << std::endl; + imp_file << std::endl << "- Error: " << e.what() << std::endl; imp_file.close(); return EXIT_FAILURE; } @@ -2533,7 +2901,7 @@ int main(int argc, char* argv[]) // Update the import settings. // Print the project file. If it doesn't exist, it will be created. CDnaProjectFile projectFile; - if (exists(p.g.project_file)) + if (boost::filesystem::exists(p.g.project_file)) projectFile.LoadProjectFile(p.g.project_file); projectFile.UpdateSettingsImport(p); @@ -2543,44 +2911,45 @@ int main(int argc, char* argv[]) if (msrCount == 0) { - cout << "- Warning: there are no measurements to process." << endl; - imp_file << "- Warning: there are no measurements to process." << endl; + std::cout << "- Warning: there are no measurements to process." << std::endl; + imp_file << "- Warning: there are no measurements to process." << std::endl; } if (errorCount) { - cout << "- Warning: some files were not parsed - please read the log file for more details." << endl; - imp_file << "- Warning: some files were not parsed - please read the log file for more details." << endl; + if (!p.g.quiet) + std::cout << "- Warning: some files were not parsed - please read the log file for more details." << std::endl; + imp_file << "- Warning: some files were not parsed - please read the log file for more details." << std::endl; } // Produce a warning if an ensemble is set as the default reference frame if (isEpsgWGS84Ensemble(epsgCode)) { - stringstream ssEnsembleWarning; - ssEnsembleWarning << endl << - "- Warning: The '" << p.i.reference_frame << "' reference frame set for this project refers to the" << endl << - " \"World Geodetic System 1984 (WGS 84) ensemble\". The WGS 84 ensemble is" << endl << - " only suitable for low accuracy (metre level) positioning and does not" << endl << - " provide for precise transformations to other well-known reference frames." << endl << - " To achieve reliable adjustment results from data on WGS 84, please refer" << endl << - " to \"Configuring import options\" in the DynAdjust User's Guide." << endl; + std::stringstream ssEnsembleWarning; + ssEnsembleWarning << std::endl << + "- Warning: The '" << p.i.reference_frame << "' reference frame set for this project refers to the" << std::endl << + " \"World Geodetic System 1984 (WGS 84) ensemble\". The WGS 84 ensemble is" << std::endl << + " only suitable for low accuracy (metre level) positioning and does not" << std::endl << + " provide for precise transformations to other well-known reference frames." << std::endl << + " To achieve reliable adjustment results from data on WGS 84, please refer" << std::endl << + " to \"Configuring import options\" in the DynAdjust User's Guide." << std::endl; if (!p.g.quiet) - cout << ssEnsembleWarning.str(); + std::cout << ssEnsembleWarning.str(); imp_file << ssEnsembleWarning.str(); } - milliseconds elapsed_time(milliseconds(time.elapsed().wall/MILLI_TO_NANO)); - string time_message = formatedElapsedTime(&elapsed_time, "+ Total file handling process took "); + boost::posix_time::milliseconds elapsed_time(boost::posix_time::milliseconds(time.elapsed().wall/MILLI_TO_NANO)); + std::string time_message = formatedElapsedTime(&elapsed_time, "+ Total file handling process took "); if (!p.g.quiet) - cout << endl << time_message << endl; - imp_file << endl << time_message << endl; + std::cout << std::endl << time_message << std::endl; + imp_file << std::endl << time_message << std::endl; if (stnCount > 0 && msrCount > 0) { if (!p.g.quiet) - cout << "+ Binary station and measurement files are now ready for processing." << endl << endl; - imp_file << "+ Binary station and measurement files are now ready for processing." << endl << endl; + std::cout << "+ Binary station and measurement files are now ready for processing." << std::endl << std::endl; + imp_file << "+ Binary station and measurement files are now ready for processing." << std::endl << std::endl; } imp_file.close(); diff --git a/dynadjust/dynadjust/dnaimportwrapper/dnaimportwrapper.hpp b/dynadjust/dynadjust/dnaimportwrapper/dnaimportwrapper.hpp index d363439e..fb28ad4d 100644 --- a/dynadjust/dynadjust/dnaimportwrapper/dnaimportwrapper.hpp +++ b/dynadjust/dynadjust/dnaimportwrapper/dnaimportwrapper.hpp @@ -56,16 +56,6 @@ #include #include -using namespace std; -using namespace boost; -using namespace boost::filesystem; -using namespace boost::timer; -using namespace boost::posix_time; -using namespace boost::program_options; -using namespace boost::iostreams::detail; - -namespace po = boost::program_options; - #include #include #include @@ -88,52 +78,53 @@ extern boost::mutex cout_mutex; class dna_import_thread { public: - dna_import_thread(dna_import* dnaParse, project_settings* p, const string& filename, + dna_import_thread(dna_import* dnaParse, project_settings* p, const std::string& filename, vdnaStnPtr* vStations, PUINT32 stnCount, vdnaMsrPtr* vMeasurements, PUINT32 msrCount, - PUINT32 clusterID, input_file_meta_t* input_file_meta, string* status_msg, - milliseconds* ms) + PUINT32 clusterID, input_file_meta_t* input_file_meta, bool firstFile, std::string* status_msg, + boost::posix_time::milliseconds* ms) : _dnaParse(dnaParse), _p(p), _filename(filename) , _vStations(vStations), _stnCount(stnCount), _vMeasurements(vMeasurements), _msrCount(msrCount) - , _clusterID(clusterID), _input_file_meta(input_file_meta) + , _clusterID(clusterID), _input_file_meta(input_file_meta), _firstFile(firstFile) , _status_msg(status_msg), _ms(ms) {}; void operator()() { - cpu_timer time; // constructor of boost::timer::cpu_timer calls start() + boost::timer::cpu_timer time; // constructor of boost::timer::cpu_timer calls start() try { _dnaParse->ParseInputFile(_filename, _vStations, _stnCount, _vMeasurements, _msrCount, - _clusterID, _input_file_meta, + _clusterID, _input_file_meta, _firstFile, _status_msg, _p); - *_ms = milliseconds(time.elapsed().wall/MILLI_TO_NANO); + *_ms = boost::posix_time::milliseconds(time.elapsed().wall/MILLI_TO_NANO); } catch (const XMLInteropException& e) { running = false; - boost::this_thread::sleep(milliseconds(50)); - stringstream err_msg; + boost::this_thread::sleep(boost::posix_time::milliseconds(50)); + std::stringstream err_msg; cout_mutex.lock(); - err_msg << endl << "- Error: " << e.what() << endl; - cout << err_msg.str(); + err_msg << std::endl << "- Error: " << e.what() << std::endl; + std::cout << err_msg.str(); *_status_msg = err_msg.str(); cout_mutex.unlock(); return; } running = false; } - inline void SetFile(const string& file) { _filename = file; } + inline void SetFile(const std::string& file) { _filename = file; } private: - dna_import* _dnaParse; + dna_import* _dnaParse; project_settings* _p; - string _filename; + std::string _filename; vdnaStnPtr* _vStations; PUINT32 _stnCount; vdnaMsrPtr* _vMeasurements; PUINT32 _msrCount; PUINT32 _clusterID; input_file_meta_t* _input_file_meta; - string* _status_msg; - milliseconds* _ms; + bool _firstFile; + std::string* _status_msg; + boost::posix_time::milliseconds* _ms; }; class dna_import_progress_thread @@ -144,7 +135,7 @@ class dna_import_progress_thread void operator()() { double percentComplete(0.); - ostringstream ss; + std::ostringstream ss; int is_terminal(isatty(fileno(stdout))); @@ -158,13 +149,13 @@ class dna_import_progress_thread if (is_terminal && !_p->g.quiet) { ss.str(""); - ss << setw(3) << fixed << setprecision(0) << right << percentComplete << "%"; + ss << std::setw(3) << std::fixed << std::setprecision(0) << std::right << percentComplete << "%"; cout_mutex.lock(); - cout << PROGRESS_BACKSPACE_04 << setw(PROGRESS_PERCENT_04) << ss.str(); - cout.flush(); + std::cout << PROGRESS_BACKSPACE_04 << std::setw(PROGRESS_PERCENT_04) << ss.str(); + std::cout.flush(); cout_mutex.unlock(); } - boost::this_thread::sleep(milliseconds(10)); + boost::this_thread::sleep(boost::posix_time::milliseconds(10)); percentComplete = _dnaParse->GetProgress(); } } diff --git a/dynadjust/dynadjust/dnaplot/dnaplot.cpp b/dynadjust/dynadjust/dnaplot/dnaplot.cpp index e3b44a55..a2f0609e 100644 --- a/dynadjust/dynadjust/dnaplot/dnaplot.cpp +++ b/dynadjust/dynadjust/dnaplot/dnaplot.cpp @@ -132,7 +132,7 @@ void dna_plot::CleanupGnuplotFiles(const plotGraphMode& graphMode) if (pprj_->p._keep_gen_files) return; - stringstream ss; + std::stringstream ss; ss << _DELETE_CMD_; // remove gnuplot command file @@ -152,7 +152,7 @@ void dna_plot::CleanupGnuplotFiles(const plotGraphMode& graphMode) } // delete - string system_file_cmd = ss.str(); + std::string system_file_cmd = ss.str(); std::system(system_file_cmd.c_str()); } @@ -163,9 +163,9 @@ void dna_plot::CreategnuplotGraphEnvironment(project_settings* pprj, const plotG // Set up the environment pprj_ = pprj; - if (!exists(pprj_->g.output_folder)) + if (!boost::filesystem::exists(pprj_->g.output_folder)) { - stringstream ss("CreategnuplotGraphEnvironment(): Output path does not exist... \n\n "); + std::stringstream ss("CreategnuplotGraphEnvironment(): Output path does not exist... \n\n "); ss << pprj_->g.output_folder << "."; SignalExceptionPlot(ss.str(), 0, NULL); } @@ -175,9 +175,9 @@ void dna_plot::CreategnuplotGraphEnvironment(project_settings* pprj, const plotG ///////////////////////////////////////////////////////// // create gnuplot command file and set gnuplot parameters - string gnuplot_cmd_filename("graph_" + network_name_); + std::string gnuplot_cmd_filename("graph_" + network_name_); - string gnuplot_pic_name; + std::string gnuplot_pic_name; switch (graphMode) { case StationsMode: @@ -191,7 +191,7 @@ void dna_plot::CreategnuplotGraphEnvironment(project_settings* pprj, const plotG } gnuplot_cmd_filename.append(_CMD_EXT_); - string gnuplot_cmd_file(output_folder_ + FOLDER_SLASH + gnuplot_cmd_filename); + std::string gnuplot_cmd_file(output_folder_ + FOLDER_SLASH + gnuplot_cmd_filename); pprj_->p._gnuplot_cmd_file = gnuplot_cmd_file; @@ -215,7 +215,7 @@ void dna_plot::CreategnuplotGraphEnvironment(project_settings* pprj, const plotG void dna_plot::InvokeGnuplot() { // Invoke gnuplot using absolute path - string system_file_cmd = "gnuplot " + absolute(pprj_->p._gnuplot_cmd_file).string(); + std::string system_file_cmd = "gnuplot " + boost::filesystem::absolute(pprj_->p._gnuplot_cmd_file).string(); // set up a thread group to execute the gnuplot in parallel boost::thread gnuplot_thread{dna_create_threaded_process(system_file_cmd)}; @@ -236,27 +236,27 @@ void dna_plot::PlotGnuplotDatFileStns() // Create gnuplot station segment data file. Throws runtime_error on failure. file_opener(seg_data, seg_stn_graph_file_); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionPlot(e.what(), 0, NULL); } - stringstream ss(""), st(""); - ss << "\"Max block size (" << setprecision(0) << blockThreshold_ << ")\" "; + std::stringstream ss(""), st(""); + ss << "\"Max block size (" << std::setprecision(0) << blockThreshold_ << ")\" "; st << "\"Min inner stns (" << minInnerStns_ << ")\" "; - seg_data << setw(HEADER_18) << left << "Block" << - setw(HEADER_32) << left << ss.str() << - setw(HEADER_32) << left << st.str() << - setw(HEADER_25) << left << "\"Total block size\"" << - setw(HEADER_18) << left << "\"Inner stns\"" << - setw(HEADER_18) << left << "\"Junction stns\"" << endl; + seg_data << std::setw(HEADER_18) << std::left << "Block" << + std::setw(HEADER_32) << std::left << ss.str() << + std::setw(HEADER_32) << std::left << st.str() << + std::setw(HEADER_25) << std::left << "\"Total block size\"" << + std::setw(HEADER_18) << std::left << "\"Inner stns\"" << + std::setw(HEADER_18) << std::left << "\"Junction stns\"" << std::endl; for (UINT32 block=0; block(_combined_msr_list.at(c)) << " (" << + ss << "\"" << measurement_name(_combined_msr_list.at(c)) << " (" << parsemsrTally_.MeasurementCount(_combined_msr_list.at(c)) << ")\""; - seg_data << setw(PRINT_VAR_PAD) << left << ss.str(); + seg_data << std::setw(PRINT_VAR_PAD) << std::left << ss.str(); } - seg_data << endl; + seg_data << std::endl; // Tally up measurement types for each block ComputeMeasurementCount(); @@ -301,8 +301,8 @@ void dna_plot::PlotGnuplotDatFileMsrs() UINT32 block; for (block=0; blockp._pdf_file_name << "'" << endl; + gnuplotbat_file_ << "set output '" << pprj_->p._pdf_file_name << "'" << std::endl; // histogram style - gnuplotbat_file_ << "set style fill transparent solid 0.4" << endl; - gnuplotbat_file_ << "set boxwidth 0.5" << endl; + gnuplotbat_file_ << "set style fill transparent solid 0.4" << std::endl; + gnuplotbat_file_ << "set boxwidth 0.5" << std::endl; UINT32 upperLimit(0), block(0); @@ -447,11 +447,11 @@ void dna_plot::PrintGnuplotCommandFile(const string& gnuplot_cmd_file, const plo if (upperLimit < (v_ISL_.at(block).size() + v_JSL_.at(block).size())) upperLimit = static_cast(v_ISL_.at(block).size() + v_JSL_.at(block).size()); - upperLimit = max(blockThreshold_, upperLimit); + upperLimit = std::max(blockThreshold_, upperLimit); - gnuplotbat_file_ << "set title \"" << "Station segmentation summary for " << network_name_ << "\" font \"Calibri,16\" noenhanced" << endl << endl; - gnuplotbat_file_ << "set key outside center bottom horizontal Left reverse enhanced autotitles samplen 2.5 font \"Calibri,8\"" << endl; - gnuplotbat_file_ << "set key width -2 height 2.5" << endl << endl; + gnuplotbat_file_ << "set title \"" << "Station segmentation summary for " << network_name_ << "\" font \"Calibri,16\" noenhanced" << std::endl << std::endl; + gnuplotbat_file_ << "set key outside center bottom horizontal Left reverse enhanced autotitles samplen 2.5 font \"Calibri,8\"" << std::endl; + gnuplotbat_file_ << "set key width -2 height 2.5" << std::endl << std::endl; break; case MeasurementsMode: @@ -459,63 +459,63 @@ void dna_plot::PrintGnuplotCommandFile(const string& gnuplot_cmd_file, const plo if (upperLimit < v_msr_tally_.at(block).TotalCount()) upperLimit = v_msr_tally_.at(block).TotalCount(); - gnuplotbat_file_ << "set title \"" << "Measurement segmentation summary for " << network_name_ << "\" font \"Calibri,20\" noenhanced" << endl << endl; - //gnuplotbat_file_ << "set key outside right top vertical Left reverse enhanced autotitles columnhead box samplen 2.5 font \"Calibri,8\"" << endl; - gnuplotbat_file_ << "set key outside center bottom horizontal Left reverse enhanced autotitles columnhead samplen 2.5 font \"Calibri,8\"" << endl; - //gnuplotbat_file_ << "set key width -15 height 0" << endl << endl; - gnuplotbat_file_ << "set key width -2 height 2.5" << endl << endl; - - gnuplotbat_file_ << "set style histogram rowstacked title offset character 0, 0, 0" << endl; - gnuplotbat_file_ << "set style data histograms" << endl; - gnuplotbat_file_ << "set datafile missing '-'" << endl; - gnuplotbat_file_ << endl; + gnuplotbat_file_ << "set title \"" << "Measurement segmentation summary for " << network_name_ << "\" font \"Calibri,20\" noenhanced" << std::endl << std::endl; + //gnuplotbat_file_ << "set key outside right top vertical Left reverse enhanced autotitles columnhead box samplen 2.5 font \"Calibri,8\"" << std::endl; + gnuplotbat_file_ << "set key outside center bottom horizontal Left reverse enhanced autotitles columnhead samplen 2.5 font \"Calibri,8\"" << std::endl; + //gnuplotbat_file_ << "set key width -15 height 0" << std::endl << std::endl; + gnuplotbat_file_ << "set key width -2 height 2.5" << std::endl << std::endl; + + gnuplotbat_file_ << "set style histogram rowstacked title offset character 0, 0, 0" << std::endl; + gnuplotbat_file_ << "set style data histograms" << std::endl; + gnuplotbat_file_ << "set datafile missing '-'" << std::endl; + gnuplotbat_file_ << std::endl; break; } upperLimit = upperLimit + upperLimit / 10; - gnuplotbat_file_ << "set format x '%.0f'" << endl; - gnuplotbat_file_ << "set format y '%.0f'" << endl; - gnuplotbat_file_ << "set yrange[0:" << upperLimit << "]" << endl; - gnuplotbat_file_ << "set auto x" << endl; - gnuplotbat_file_ << "set ytics scale 0.25 font \"Calibri,8\"" << endl; + gnuplotbat_file_ << "set format x '%.0f'" << std::endl; + gnuplotbat_file_ << "set format y '%.0f'" << std::endl; + gnuplotbat_file_ << "set yrange[0:" << upperLimit << "]" << std::endl; + gnuplotbat_file_ << "set auto x" << std::endl; + gnuplotbat_file_ << "set ytics scale 0.25 font \"Calibri,8\"" << std::endl; - gnuplotbat_file_ << "set xtics scale 0.25 nomirror" << endl; + gnuplotbat_file_ << "set xtics scale 0.25 nomirror" << std::endl; UINT32 fontSize(8); if (blockCount_ > 5000) { fontSize = 5; - gnuplotbat_file_ << "set xtics 0,500 font \"Calibri,6\"" << endl << endl; + gnuplotbat_file_ << "set xtics 0,500 font \"Calibri,6\"" << std::endl << std::endl; } else if (blockCount_ > 1000) { fontSize = 5; - gnuplotbat_file_ << "set xtics 0,100 font \"Calibri,6\"" << endl << endl; + gnuplotbat_file_ << "set xtics 0,100 font \"Calibri,6\"" << std::endl << std::endl; } else if (blockCount_ > 500) { fontSize = 5; - gnuplotbat_file_ << "set xtics 0,50 font \"Calibri,5\"" << endl << endl; + gnuplotbat_file_ << "set xtics 0,50 font \"Calibri,5\"" << std::endl << std::endl; } else if (blockCount_ > 100) { fontSize = 5; - gnuplotbat_file_ << "set xtics 0,10 font \"Calibri,6\"" << endl << endl; + gnuplotbat_file_ << "set xtics 0,10 font \"Calibri,6\"" << std::endl << std::endl; } else if (blockCount_ > 50) { fontSize = 6; - gnuplotbat_file_ << "set xtics 0,5 font \"Calibri,8\"" << endl << endl; + gnuplotbat_file_ << "set xtics 0,5 font \"Calibri,8\"" << std::endl << std::endl; } else - gnuplotbat_file_ << "set xtics 0,1 font \"Calibri,8\"" << endl << endl; + gnuplotbat_file_ << "set xtics 0,1 font \"Calibri,8\"" << std::endl << std::endl; // x-axis label - stringstream ss(""); - ss << "Segmented Network Blocks (Total " << fixed << setprecision(0) << blockCount_ << ")"; - gnuplotbat_file_ << "set xlabel '" << ss.str() << "' font \"Calibri,10\"" << endl; + std::stringstream ss(""); + ss << "Segmented Network Blocks (Total " << std::fixed << std::setprecision(0) << blockCount_ << ")"; + gnuplotbat_file_ << "set xlabel '" << ss.str() << "' font \"Calibri,10\"" << std::endl; switch (graphMode) { @@ -532,37 +532,37 @@ void dna_plot::PrintGnuplotCommandFile(const string& gnuplot_cmd_file, const plo void dna_plot::PrintGnuplotCommandFileStns(const UINT32& fontSize) { - stringstream ss(""); - ss << "Station Count (Total " << fixed << setprecision(0) << stationCount_ << ")"; - gnuplotbat_file_ << "set ylabel '" << ss.str() << "' font \"Calibri,10\"" << endl << endl; + std::stringstream ss(""); + ss << "Station Count (Total " << std::fixed << std::setprecision(0) << stationCount_ << ")"; + gnuplotbat_file_ << "set ylabel '" << ss.str() << "' font \"Calibri,10\"" << std::endl << std::endl; // All colours based on a palette: // https://coolors.co/ffd275-235789-da5552-43aa8b-39a9db - gnuplotbat_file_ << "set style line 1 lw 0.75 lt 1 pt 7 ps 0.25 lc rgb \"#35A7FF\" # total block size" << endl; // royalblue - gnuplotbat_file_ << "set style line 2 lw 2 lt 5 pt 7 ps 0.25 lc rgb \"#43AA8B\" # threshold" << endl; // zomp (green) - gnuplotbat_file_ << "set style line 3 lw 2 lt 5 pt 7 ps 0.25 lc rgb \"#FFD275\" # minimum inner size" << endl; // orange yellow crayola - gnuplotbat_file_ << "set style line 4 lw 2 lt 1 pt 7 ps 0.25 lc rgb \"#235789\" # inners" << endl; // bdazzled blue - gnuplotbat_file_ << "set style line 5 lw 2 lt 1 pt 7 ps 0.25 lc rgb \"#DA5552\" # junctions" << endl << endl; // indian red + gnuplotbat_file_ << "set style line 1 lw 0.75 lt 1 pt 7 ps 0.25 lc rgb \"#35A7FF\" # total block size" << std::endl; // royalblue + gnuplotbat_file_ << "set style line 2 lw 2 lt 5 pt 7 ps 0.25 lc rgb \"#43AA8B\" # threshold" << std::endl; // zomp (green) + gnuplotbat_file_ << "set style line 3 lw 2 lt 5 pt 7 ps 0.25 lc rgb \"#FFD275\" # minimum inner size" << std::endl; // orange yellow crayola + gnuplotbat_file_ << "set style line 4 lw 2 lt 1 pt 7 ps 0.25 lc rgb \"#235789\" # inners" << std::endl; // bdazzled blue + gnuplotbat_file_ << "set style line 5 lw 2 lt 1 pt 7 ps 0.25 lc rgb \"#DA5552\" # junctions" << std::endl << std::endl; // indian red - gnuplotbat_file_ << "plot '" << seg_stn_graph_file_ << "' using 1:4 with boxes ls 1 title columnheader(4), \\" << endl; + gnuplotbat_file_ << "plot '" << seg_stn_graph_file_ << "' using 1:4 with boxes ls 1 title columnheader(4), \\" << std::endl; gnuplotbat_file_ << " '" << seg_stn_graph_file_ << "' using 1:4:(sprintf(\"%.0f\",$4)) with labels font \"Calibri," << - fontSize << "\" center offset 0,0.5 notitle, \\" << endl; - gnuplotbat_file_ << " '" << seg_stn_graph_file_ << "' using 1:2 with lines ls 2 title columnheader(2), \\" << endl; - gnuplotbat_file_ << " '" << seg_stn_graph_file_ << "' using 1:3 with lines ls 3 title columnheader(3), \\" << endl; - gnuplotbat_file_ << " '" << seg_stn_graph_file_ << "' using 1:5 with linespoints ls 4 title columnheader(5), \\" << endl; + fontSize << "\" center offset 0,0.5 notitle, \\" << std::endl; + gnuplotbat_file_ << " '" << seg_stn_graph_file_ << "' using 1:2 with lines ls 2 title columnheader(2), \\" << std::endl; + gnuplotbat_file_ << " '" << seg_stn_graph_file_ << "' using 1:3 with lines ls 3 title columnheader(3), \\" << std::endl; + gnuplotbat_file_ << " '" << seg_stn_graph_file_ << "' using 1:5 with linespoints ls 4 title columnheader(5), \\" << std::endl; gnuplotbat_file_ << " '" << seg_stn_graph_file_ << "' using 1:5:(sprintf(\"%.0f\",$5)) with labels tc ls 4 font \"Calibri," << - fontSize << "\" center offset 1,0 notitle, \\" << endl; - gnuplotbat_file_ << " '" << seg_stn_graph_file_ << "' using 1:6 with linespoints ls 5 title columnheader(6), \\" << endl; + fontSize << "\" center offset 1,0 notitle, \\" << std::endl; + gnuplotbat_file_ << " '" << seg_stn_graph_file_ << "' using 1:6 with linespoints ls 5 title columnheader(6), \\" << std::endl; gnuplotbat_file_ << " '" << seg_stn_graph_file_ << "' using 1:6:(sprintf(\"%.0f\",$6)) with labels tc ls 5 font \"Calibri," << - fontSize << "\" center offset 1,0 notitle" << endl << endl; + fontSize << "\" center offset 1,0 notitle" << std::endl << std::endl; } void dna_plot::PrintGnuplotCommandFileMsrs(const UINT32& fontSize) { - stringstream ss(""); - ss << "Measurement Count (Total " << fixed << setprecision(0) << measurementCount_ << ")"; - gnuplotbat_file_ << "set ylabel '" << ss.str() << "' font \"Calibri,10\"" << endl << endl; + std::stringstream ss(""); + ss << "Measurement Count (Total " << std::fixed << std::setprecision(0) << measurementCount_ << ")"; + gnuplotbat_file_ << "set ylabel '" << ss.str() << "' font \"Calibri,10\"" << std::endl << std::endl; // All colours based on a palette: // https://coolors.co/ffd275-235789-da5552-43aa8b-39a9db @@ -570,14 +570,14 @@ void dna_plot::PrintGnuplotCommandFileMsrs(const UINT32& fontSize) UINT32 line(1); ss.str(""); ss << "\"#4169e1\""; - gnuplotbat_file_ << "set style line " << line++ << " lw 1 lt 1 pt 7 ps 0.5 lc rgb " << left << setw(PRINT_VAR_PAD) << ss.str() << " # total block size" << endl; // royalblue + gnuplotbat_file_ << "set style line " << line++ << " lw 1 lt 1 pt 7 ps 0.5 lc rgb " << std::left << std::setw(PRINT_VAR_PAD) << ss.str() << " # total block size" << std::endl; // royalblue // print measurements for each block UINT32 c; - string colour; + std::string colour; it_pair_string _it_colour; - sort(pprj_->p._msr_colours.begin(), pprj_->p._msr_colours.end(), ComparePairFirst()); + std::sort(pprj_->p._msr_colours.begin(), pprj_->p._msr_colours.end(), ComparePairFirst()); for (c=0; c<_combined_msr_list.size(); c++) { @@ -585,7 +585,7 @@ void dna_plot::PrintGnuplotCommandFileMsrs(const UINT32& fontSize) continue; colour = _combined_msr_list.at(c); _it_colour = equal_range(pprj_->p._msr_colours.begin(), pprj_->p._msr_colours.end(), - colour, ComparePairFirst()); + colour, ComparePairFirst()); if (_it_colour.first == _it_colour.second) colour = "light-gray"; @@ -594,11 +594,11 @@ void dna_plot::PrintGnuplotCommandFileMsrs(const UINT32& fontSize) ss.str(""); ss << "\"" << colour << "\""; - gnuplotbat_file_ << "set style line " << line++ << " lw 1 lt 1 pt 7 ps 0.5 lc rgb " << left << setw(PRINT_VAR_PAD) << ss.str() << - " # \"" << measurement_name(_combined_msr_list.at(c)) << "\"" << endl; + gnuplotbat_file_ << "set style line " << line++ << " lw 1 lt 1 pt 7 ps 0.5 lc rgb " << std::left << std::setw(PRINT_VAR_PAD) << ss.str() << + " # \"" << measurement_name(_combined_msr_list.at(c)) << "\"" << std::endl; } - gnuplotbat_file_ << endl; + gnuplotbat_file_ << std::endl; //UINT32 block(0); //if (v_msr_tally_.at(block).MeasurementCount(_combined_msr_list.at(c)) == 0) @@ -615,14 +615,14 @@ void dna_plot::PrintGnuplotCommandFileMsrs(const UINT32& fontSize) if (parsemsrTally_.MeasurementCount(_combined_msr_list.at(c)) < 1) continue; if (msrs++ > 0) - gnuplotbat_file_ << ", \\" << endl << " '"; + gnuplotbat_file_ << ", \\" << std::endl << " '"; gnuplotbat_file_ << seg_msr_graph_file_ << "' using " << line++ << ":xtic(1) ls " << linestyle++; measurementCategories_++; } - gnuplotbat_file_ << ", \\" << endl << " '" << seg_msr_graph_file_ << + gnuplotbat_file_ << ", \\" << std::endl << " '" << seg_msr_graph_file_ << "' using 0:2:(sprintf(\"%d\",$2)) with labels font \"Calibri," << - fontSize << "\" center offset 0,0.5 notitle" << endl; + fontSize << "\" center offset 0,0.5 notitle" << std::endl; } @@ -630,9 +630,9 @@ void dna_plot::PrintGnuplotCommandFileMsrs(const UINT32& fontSize) void dna_plot::InitialiseGMTParameters() { // Set initial parameters - if (!exists(pprj_->g.output_folder)) + if (!boost::filesystem::exists(pprj_->g.output_folder)) { - stringstream ss("InitialiseGMTParameters(): Output path does not exist... \n\n "); + std::stringstream ss("InitialiseGMTParameters(): Output path does not exist... \n\n "); ss << pprj_->g.output_folder << "."; SignalExceptionPlot(ss.str(), 0, NULL); } @@ -688,15 +688,15 @@ void dna_plot::FinaliseGMTParameters() if (rightDeg_ < leftDeg_) { - stringstream ss; - ss << "Right limit cannot be less than left limit." << endl; + std::stringstream ss; + ss << "Right limit cannot be less than left limit." << std::endl; throw NetPlotException(ss.str(), 0); } if (upperDeg_ < lowerDeg_) { - stringstream ss; - ss << "Upper limit cannot be less than lower limit." << endl; + std::stringstream ss; + ss << "Upper limit cannot be less than lower limit." << std::endl; throw NetPlotException(ss.str(), 0); } @@ -711,7 +711,7 @@ void dna_plot::FinaliseGMTParameters() dWidth_ += seconds15; // capture smallest dimension - dDimension_ = (min(dWidth_, dHeight_)); + dDimension_ = (std::min(dWidth_, dHeight_)); // Determine a buffer to envelope the entire plot, set to // 10% of the width/height (whichever is smaller) @@ -1059,7 +1059,7 @@ void dna_plot::InitialiseGMTFilenames() // create__block_n.[bat|sh] v_gmt_cmd_filenames_.clear(); v_gmt_pdf_filenames_.clear(); - string gmt_filename, gmt_cmd_basename("create_" + network_name_ + "_block_"); + std::string gmt_filename, gmt_cmd_basename("create_" + network_name_ + "_block_"); UINT32 block; bool oneBlockOnly = InitialiseandValidateStartingBlock(block); @@ -1074,7 +1074,7 @@ void dna_plot::InitialiseGMTFilenames() gmt_filename = pprj_->g.output_folder + FOLDER_SLASH + gmt_filename; // Create absolute path - gmt_filename = absolute(gmt_filename).string(); + gmt_filename = boost::filesystem::absolute(gmt_filename).string(); // Add to the list v_gmt_cmd_filenames_.push_back(gmt_filename); @@ -1126,12 +1126,12 @@ void dna_plot::CreateGMTCommandFiles() // Create GMT batch file. Throws runtime_error on failure. file_opener(gmtbat_file_, v_gmt_cmd_filenames_.at(block)); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionPlot(e.what(), 0, NULL); } // set header - gmtbat_file_ << _CMD_HEADER_ << endl; + gmtbat_file_ << _CMD_HEADER_ << std::endl; // GMT bat file is printed last to reflect the options and dimensions as determined // by PrintStationsDataFile and PrintMeasurementsDatFiles @@ -1142,7 +1142,7 @@ void dna_plot::CreateGMTCommandFiles() // change file permission to executable #if defined(__linux) || defined(sun) || defined(__unix__) || defined(__APPLE__) - string system_file_cmd = _CHMOD_CMD_ + v_gmt_cmd_filenames_.at(block); + std::string system_file_cmd = _CHMOD_CMD_ + v_gmt_cmd_filenames_.at(block); std::system(system_file_cmd.c_str()); #endif @@ -1164,53 +1164,53 @@ void dna_plot::CreateGMTCommandFile(const UINT32& block) double error_ellipse_scale(uncertainty_legend_length_/largest_uncertainty_); UINT32 uncertainty_legend_precision(4); - string psTempFile("tmp-"); + std::string psTempFile("tmp-"); psTempFile.append(StringFromT(block)).append(".ps"); - string pdfTempFile("tmp-"); + std::string pdfTempFile("tmp-"); pdfTempFile.append(StringFromT(block)).append(".pdf"); - string legendTempFile("map-block"); + std::string legendTempFile("map-block"); legendTempFile.append(StringFromT(block)).append(".legend"); // make temporary directory for gmt.conf gmt.history to prevent corruption of // gmt.conf and gmt.history during parallel processing - gmtbat_file_ << endl << _COMMENT_PREFIX_ << "Create temporary folder for gmt.conf and gmt.history" << endl; + gmtbat_file_ << std::endl << _COMMENT_PREFIX_ << "Create temporary folder for gmt.conf and gmt.history" << std::endl; #if defined(_WIN32) || defined(__WIN32__) // set, create and provide access to temporary folder for gmt.conf file - gmtbat_file_ << _MAKEENV_CMD_ << _GMT_TMP_DIR_ << "=%TEMP%\\gmt.block-" << block << endl; - gmtbat_file_ << _MAKEDIR_CMD_ << _ENV_GMT_TMP_DIR_ << endl; - //gmtbat_file_ << "icacls " << _ENV_GMT_TMP_DIR_ << " /grant Everyone:(f)" << endl; + gmtbat_file_ << _MAKEENV_CMD_ << _GMT_TMP_DIR_ << "=%TEMP%\\gmt.block-" << block << std::endl; + gmtbat_file_ << _MAKEDIR_CMD_ << _ENV_GMT_TMP_DIR_ << std::endl; + //gmtbat_file_ << "icacls " << _ENV_GMT_TMP_DIR_ << " /grant Everyone:(f)" << std::endl; #elif defined(__linux) || defined(sun) || defined(__unix__) || defined(__APPLE__) // temporary gmt.conf file location - gmtbat_file_ << _MAKEENV_CMD_ << _GMT_TMP_DIR_ << "=$(" << _MAKETEMP_CMD_ << "-d ${TMPDIR:-/tmp}/gmt.XXXXXX)" << endl << endl; + gmtbat_file_ << _MAKEENV_CMD_ << _GMT_TMP_DIR_ << "=$(" << _MAKETEMP_CMD_ << "-d ${TMPDIR:-/tmp}/gmt.XXXXXX)" << std::endl << std::endl; #endif UINT32 colours(0), columns(5); if (plotBlocks_) - gmtbat_file_ << endl << - _COMMENT_PREFIX_ << "GMT command file for segmented network block " << (block + 1) << endl; + gmtbat_file_ << std::endl << + _COMMENT_PREFIX_ << "GMT command file for segmented network block " << (block + 1) << std::endl; else - gmtbat_file_ << endl << - _COMMENT_PREFIX_ << "GMT command file for simultaneous network" << endl << endl; + gmtbat_file_ << std::endl << + _COMMENT_PREFIX_ << "GMT command file for simultaneous network" << std::endl << std::endl; // write GMT parameters PrintGMTParameters(); if (isLandscape) - gmtbat_file_ << _APP_GMTSET_ << " PS_PAGE_ORIENTATION landscape" << endl << endl; + gmtbat_file_ << _APP_GMTSET_ << " PS_PAGE_ORIENTATION landscape" << std::endl << std::endl; else - gmtbat_file_ << _APP_GMTSET_ << " PS_PAGE_ORIENTATION portrait" << endl << endl; + gmtbat_file_ << _APP_GMTSET_ << " PS_PAGE_ORIENTATION portrait" << std::endl << std::endl; - gmtbat_file_ << _APP_GMTSET_ << " FONT_ANNOT " << fixed << setprecision(1) << annot_font_size_primary << "p" << endl; - gmtbat_file_ << _APP_GMTSET_ << " FONT_ANNOT_PRIMARY " << fixed << setprecision(1) << annot_font_size_primary << "p" << endl; - gmtbat_file_ << _APP_GMTSET_ << " FONT_LABEL " << fixed << setprecision(1) << label_font_size << "p" << endl; + gmtbat_file_ << _APP_GMTSET_ << " FONT_ANNOT " << std::fixed << std::setprecision(1) << annot_font_size_primary << "p" << std::endl; + gmtbat_file_ << _APP_GMTSET_ << " FONT_ANNOT_PRIMARY " << std::fixed << std::setprecision(1) << annot_font_size_primary << "p" << std::endl; + gmtbat_file_ << _APP_GMTSET_ << " FONT_LABEL " << std::fixed << std::setprecision(1) << label_font_size << "p" << std::endl; if (graticule_width_ < 60./3600.) - gmtbat_file_ << _APP_GMTSET_ << " FORMAT_GEO_MAP ddd:mm:ss.x" << endl << endl; + gmtbat_file_ << _APP_GMTSET_ << " FORMAT_GEO_MAP ddd:mm:ss.x" << std::endl << std::endl; else - gmtbat_file_ << _APP_GMTSET_ << " FORMAT_GEO_MAP ddd:mm" << endl << endl; + gmtbat_file_ << _APP_GMTSET_ << " FORMAT_GEO_MAP ddd:mm" << std::endl << std::endl; page_width_ = pprj_->p._page_width; @@ -1231,13 +1231,13 @@ void dna_plot::CreateGMTCommandFile(const UINT32& block) gmtbat_file_ << _APP_PSCOAST_ << " -Rg" << // Carree Cylindrical equidistant projection, which looks the nicest " -JQ" << page_width_ << "c -B60g30 -D" << coastResolution_ << - " -A10000 -W0.75p,16/169/243 -G245/245/245 -K > " << psTempFile << endl; + " -A10000 -W0.75p,16/169/243 -G245/245/245 -K > " << psTempFile << std::endl; // // Miller's Cylindrical projection, which is neither equal nor conformal. All meridians and parallels are straight lines. - // " -JJ" << page_width << "c -B60g30 -D" << coastResolution << " -A10000 -W0.75p,16/169/243 -G245/245/245 -P -K > " << psTempFile << endl; + // " -JJ" << page_width << "c -B60g30 -D" << coastResolution << " -A10000 -W0.75p,16/169/243 -G245/245/245 -P -K > " << psTempFile << std::endl; // // Cylindrical equal-area projection - //" -JY" << page_width << "c -B60g30 -D" << coastResolution << " -A10000 -W0.75p,16/169/243 -G245/245/245 -P -K > " << psTempFile << endl; + //" -JY" << page_width << "c -B60g30 -D" << coastResolution << " -A10000 -W0.75p,16/169/243 -G245/245/245 -P -K > " << psTempFile << std::endl; break; // // Orthographic projection @@ -1252,10 +1252,10 @@ void dna_plot::CreateGMTCommandFile(const UINT32& block) pprj_->p._label_font_size = 5; gmtbat_file_ << _APP_PSCOAST_ << " -Rg -JG" << - fixed << setprecision(7) << centre_width_ << "/" << // longitude - fixed << setprecision(7) << centre_height_ << "/" << // latitude - fixed << setprecision(1) << page_width_ << "c -B30g15 -D" << coastResolution_ << - " -A10000 -W0.75p,16/169/243 -G245/245/245 -P -K > " << psTempFile << endl; + std::fixed << std::setprecision(7) << centre_width_ << "/" << // longitude + std::fixed << std::setprecision(7) << centre_height_ << "/" << // latitude + std::fixed << std::setprecision(1) << page_width_ << "c -B30g15 -D" << coastResolution_ << + " -A10000 -W0.75p,16/169/243 -G245/245/245 -P -K > " << psTempFile << std::endl; break; // // Mercator projection @@ -1264,23 +1264,23 @@ void dna_plot::CreateGMTCommandFile(const UINT32& block) pprj_->p._label_font_size = 6; gmtbat_file_ << _APP_PSCOAST_ << " -R" << - fixed << setprecision(7) << leftDeg_ << "/" << - fixed << setprecision(7) << lowerDeg_ << "/" << - fixed << setprecision(7) << rightDeg_ << "/" << - fixed << setprecision(7) << upperDeg_; + std::fixed << std::setprecision(7) << leftDeg_ << "/" << + std::fixed << std::setprecision(7) << lowerDeg_ << "/" << + std::fixed << std::setprecision(7) << rightDeg_ << "/" << + std::fixed << std::setprecision(7) << upperDeg_; // example: -Jm1.2e-2i - gmtbat_file_ << "r -JM" << fixed << setprecision(1) << page_width_ << "c"; + gmtbat_file_ << "r -JM" << std::fixed << std::setprecision(1) << page_width_ << "c"; gmtbat_file_ << " -D" << coastResolution_ << " -N2/0.25p -W0.75p,16/169/243 -G255/255/255 -S233/246/255 -Lf" << - fixed << setprecision(5) << centre_width_ << "/" << fixed << setprecision(5) << dScaleLat_ << "/" << - fixed << setprecision(5) << centre_height_ << "/" << fixed << setprecision(scale_precision_) << scale_bar_width_ << "k+lKilometres+jt " << + std::fixed << std::setprecision(5) << centre_width_ << "/" << std::fixed << std::setprecision(5) << dScaleLat_ << "/" << + std::fixed << std::setprecision(5) << centre_height_ << "/" << std::fixed << std::setprecision(scale_precision_) << scale_bar_width_ << "k+lKilometres+jt " << "-B" << - fixed << setprecision(graticule_width_precision_) << graticule_width_ << "g" << fixed << setprecision(graticule_width_precision_) << graticule_width_ << "/" << - fixed << setprecision(graticule_width_precision_) << graticule_width_ << "g" << fixed << setprecision(graticule_width_precision_) << graticule_width_; + std::fixed << std::setprecision(graticule_width_precision_) << graticule_width_ << "g" << std::fixed << std::setprecision(graticule_width_precision_) << graticule_width_ << "/" << + std::fixed << std::setprecision(graticule_width_precision_) << graticule_width_ << "g" << std::fixed << std::setprecision(graticule_width_precision_) << graticule_width_; if (!isLandscape) gmtbat_file_ << " -P"; - gmtbat_file_ << " -K > " << psTempFile << endl; + gmtbat_file_ << " -K > " << psTempFile << std::endl; break; // @@ -1290,27 +1290,27 @@ void dna_plot::CreateGMTCommandFile(const UINT32& block) pprj_->p._label_font_size = 6; gmtbat_file_ << _APP_PSCOAST_ << " -R" << - fixed << setprecision(7) << leftDeg_ << "/" << - fixed << setprecision(7) << lowerDeg_ << "/" << - fixed << setprecision(7) << rightDeg_ << "/" << - fixed << setprecision(7) << upperDeg_; + std::fixed << std::setprecision(7) << leftDeg_ << "/" << + std::fixed << std::setprecision(7) << lowerDeg_ << "/" << + std::fixed << std::setprecision(7) << rightDeg_ << "/" << + std::fixed << std::setprecision(7) << upperDeg_; // example: -Jt139.9944444/-24.1486111/1:1000000 - //gmtbat_file_ << "r -Jt" << fixed << setprecision(7) << centre_width_ << "/" << - // fixed << setprecision(7) << centre_height_ << "/1:" << fixed << setprecision(0) << scale; - gmtbat_file_ << "r -JT" << fixed << setprecision(7) << centre_width_ << "/" << - fixed << setprecision(1) << page_width_ << "c"; + //gmtbat_file_ << "r -Jt" << std::fixed << std::setprecision(7) << centre_width_ << "/" << + // std::fixed << std::setprecision(7) << centre_height_ << "/1:" << std::fixed << std::setprecision(0) << scale; + gmtbat_file_ << "r -JT" << std::fixed << std::setprecision(7) << centre_width_ << "/" << + std::fixed << std::setprecision(1) << page_width_ << "c"; gmtbat_file_ << " -D" << coastResolution_ << " -N2/0.25p -W0.75p,16/169/243 -G255/255/255 -S233/246/255 -Lf" << - fixed << setprecision(5) << centre_width_ << "/" << fixed << setprecision(5) << dScaleLat_ << "/" << - fixed << setprecision(5) << centre_height_ << "/" << fixed << setprecision(scale_precision_) << scale_bar_width_ << "k+lKilometres+jt " << + std::fixed << std::setprecision(5) << centre_width_ << "/" << std::fixed << std::setprecision(5) << dScaleLat_ << "/" << + std::fixed << std::setprecision(5) << centre_height_ << "/" << std::fixed << std::setprecision(scale_precision_) << scale_bar_width_ << "k+lKilometres+jt " << "-B" << - fixed << setprecision(graticule_width_precision_) << graticule_width_ << "g" << fixed << setprecision(graticule_width_precision_) << graticule_width_ << "/" << - fixed << setprecision(graticule_width_precision_) << graticule_width_ << "g" << fixed << setprecision(graticule_width_precision_) << graticule_width_; + std::fixed << std::setprecision(graticule_width_precision_) << graticule_width_ << "g" << std::fixed << std::setprecision(graticule_width_precision_) << graticule_width_ << "/" << + std::fixed << std::setprecision(graticule_width_precision_) << graticule_width_ << "g" << std::fixed << std::setprecision(graticule_width_precision_) << graticule_width_; if (!isLandscape) gmtbat_file_ << " -P"; - gmtbat_file_ << " -K > " << psTempFile << endl; + gmtbat_file_ << " -K > " << psTempFile << std::endl; break; // @@ -1320,34 +1320,34 @@ void dna_plot::CreateGMTCommandFile(const UINT32& block) pprj_->p._label_font_size = 6; gmtbat_file_ << _APP_PSCOAST_ << " -R" << - fixed << setprecision(7) << leftDeg_ << "/" << - fixed << setprecision(7) << lowerDeg_ << "/" << - fixed << setprecision(7) << rightDeg_ << "/" << - fixed << setprecision(7) << upperDeg_; + std::fixed << std::setprecision(7) << leftDeg_ << "/" << + std::fixed << std::setprecision(7) << lowerDeg_ << "/" << + std::fixed << std::setprecision(7) << rightDeg_ << "/" << + std::fixed << std::setprecision(7) << upperDeg_; // example: -Jb136.5/-36/-18/-36/1:45000000 - //gmtbat_file_ << "r -Jb" << fixed << setprecision(7) << centre_width_ << "/" << - // fixed << setprecision(7) << centre_height_ << "/" << - // fixed << setprecision(7) << upperDeg_ - fabs(dHeight/3.) << "/" << - // fixed << setprecision(7) << lowerDeg_ + fabs(dHeight/3.) << "/" << - // "1:" << fixed << setprecision(0) << scale; - gmtbat_file_ << "r -JB" << fixed << setprecision(7) << centre_width_ << "/" << - fixed << setprecision(7) << centre_height_ << "/" << - fixed << setprecision(7) << upperDeg_ - fabs(dHeight_/3.) << "/" << - fixed << setprecision(7) << lowerDeg_ + fabs(dHeight_/3.) << "/" << - fixed << setprecision(1) << page_width_ << "c"; + //gmtbat_file_ << "r -Jb" << std::fixed << std::setprecision(7) << centre_width_ << "/" << + // std::fixed << std::setprecision(7) << centre_height_ << "/" << + // std::fixed << std::setprecision(7) << upperDeg_ - fabs(dHeight/3.) << "/" << + // std::fixed << std::setprecision(7) << lowerDeg_ + fabs(dHeight/3.) << "/" << + // "1:" << std::fixed << std::setprecision(0) << scale; + gmtbat_file_ << "r -JB" << std::fixed << std::setprecision(7) << centre_width_ << "/" << + std::fixed << std::setprecision(7) << centre_height_ << "/" << + std::fixed << std::setprecision(7) << upperDeg_ - fabs(dHeight_/3.) << "/" << + std::fixed << std::setprecision(7) << lowerDeg_ + fabs(dHeight_/3.) << "/" << + std::fixed << std::setprecision(1) << page_width_ << "c"; gmtbat_file_ << " -D" << coastResolution_ << " -N2/0.25p -W0.75p,16/169/243 -G255/255/255 -S233/246/255 -Lf" << - fixed << setprecision(5) << centre_width_ << "/" << fixed << setprecision(5) << dScaleLat_ << "/" << - fixed << setprecision(5) << centre_height_ << "/" << fixed << setprecision(scale_precision_) << scale_bar_width_ << "k+lKilometres+jt " << + std::fixed << std::setprecision(5) << centre_width_ << "/" << std::fixed << std::setprecision(5) << dScaleLat_ << "/" << + std::fixed << std::setprecision(5) << centre_height_ << "/" << std::fixed << std::setprecision(scale_precision_) << scale_bar_width_ << "k+lKilometres+jt " << "-B" << - //fixed << setprecision(7) << DmstoDeg(0.3) << "g" << fixed << setprecision(7) << DmstoDeg(0.3) << " -K > " << psTempFile << endl; - fixed << setprecision(graticule_width_precision_) << graticule_width_ << "g" << fixed << setprecision(graticule_width_precision_) << graticule_width_ << "/" << - fixed << setprecision(graticule_width_precision_) << graticule_width_ << "g" << fixed << setprecision(graticule_width_precision_) << graticule_width_; + //fixed << std::setprecision(7) << DmstoDeg(0.3) << "g" << std::fixed << std::setprecision(7) << DmstoDeg(0.3) << " -K > " << psTempFile << std::endl; + std::fixed << std::setprecision(graticule_width_precision_) << graticule_width_ << "g" << std::fixed << std::setprecision(graticule_width_precision_) << graticule_width_ << "/" << + std::fixed << std::setprecision(graticule_width_precision_) << graticule_width_ << "g" << std::fixed << std::setprecision(graticule_width_precision_) << graticule_width_; if (!isLandscape) gmtbat_file_ << " -P"; - gmtbat_file_ << " -K > " << psTempFile << endl; + gmtbat_file_ << " -K > " << psTempFile << std::endl; break; // // Lambert Azimuthal Equal-Area @@ -1356,26 +1356,26 @@ void dna_plot::CreateGMTCommandFile(const UINT32& block) pprj_->p._label_font_size = 6; gmtbat_file_ << _APP_PSCOAST_ << " -R" << - fixed << setprecision(7) << leftDeg_ << "/" << - fixed << setprecision(7) << lowerDeg_ << "/" << - fixed << setprecision(7) << rightDeg_ << "/" << - fixed << setprecision(7) << upperDeg_; + std::fixed << std::setprecision(7) << leftDeg_ << "/" << + std::fixed << std::setprecision(7) << lowerDeg_ << "/" << + std::fixed << std::setprecision(7) << rightDeg_ << "/" << + std::fixed << std::setprecision(7) << upperDeg_; // example: -JA30/-30/4.5i - gmtbat_file_ << "r -JA" << fixed << setprecision(7) << centre_width_ << "/" << - fixed << setprecision(7) << centre_height_ << "/" << - fixed << setprecision(1) << page_width_ << "c"; + gmtbat_file_ << "r -JA" << std::fixed << std::setprecision(7) << centre_width_ << "/" << + std::fixed << std::setprecision(7) << centre_height_ << "/" << + std::fixed << std::setprecision(1) << page_width_ << "c"; gmtbat_file_ << " -D" << coastResolution_ << " -N2/0.25p -W0.75p,16/169/243 -G255/255/255 -S233/246/255 -Lf" << - fixed << setprecision(5) << centre_width_ << "/" << fixed << setprecision(5) << dScaleLat_ << "/" << - fixed << setprecision(5) << centre_height_ << "/" << fixed << setprecision(scale_precision_) << scale_bar_width_ << "k+lKilometres+jt " << + std::fixed << std::setprecision(5) << centre_width_ << "/" << std::fixed << std::setprecision(5) << dScaleLat_ << "/" << + std::fixed << std::setprecision(5) << centre_height_ << "/" << std::fixed << std::setprecision(scale_precision_) << scale_bar_width_ << "k+lKilometres+jt " << "-B" << - fixed << setprecision(graticule_width_precision_) << graticule_width_ << "g" << fixed << setprecision(graticule_width_precision_) << graticule_width_ << "/" << - fixed << setprecision(graticule_width_precision_) << graticule_width_ << "g" << fixed << setprecision(graticule_width_precision_) << graticule_width_; + std::fixed << std::setprecision(graticule_width_precision_) << graticule_width_ << "g" << std::fixed << std::setprecision(graticule_width_precision_) << graticule_width_ << "/" << + std::fixed << std::setprecision(graticule_width_precision_) << graticule_width_ << "g" << std::fixed << std::setprecision(graticule_width_precision_) << graticule_width_; if (!isLandscape) gmtbat_file_ << " -P"; - gmtbat_file_ << " -K > " << psTempFile << endl; + gmtbat_file_ << " -K > " << psTempFile << std::endl; break; // @@ -1385,26 +1385,26 @@ void dna_plot::CreateGMTCommandFile(const UINT32& block) pprj_->p._label_font_size = 6; gmtbat_file_ << _APP_PSCOAST_ << " -R" << - fixed << setprecision(7) << leftDeg_ << "/" << - fixed << setprecision(7) << lowerDeg_ << "/" << - fixed << setprecision(7) << rightDeg_ << "/" << - fixed << setprecision(7) << upperDeg_; + std::fixed << std::setprecision(7) << leftDeg_ << "/" << + std::fixed << std::setprecision(7) << lowerDeg_ << "/" << + std::fixed << std::setprecision(7) << rightDeg_ << "/" << + std::fixed << std::setprecision(7) << upperDeg_; // example: -R100/-40/160/-10r -JS130/-30/4i - gmtbat_file_ << "r -JS" << fixed << setprecision(7) << centre_width_ << "/" << - fixed << setprecision(7) << centre_height_ << "/" << - fixed << setprecision(1) << page_width_ << "c"; + gmtbat_file_ << "r -JS" << std::fixed << std::setprecision(7) << centre_width_ << "/" << + std::fixed << std::setprecision(7) << centre_height_ << "/" << + std::fixed << std::setprecision(1) << page_width_ << "c"; gmtbat_file_ << " -D" << coastResolution_ << " -N2/0.25p -W0.75p,16/169/243 -G255/255/255 -S233/246/255 -Lf" << - fixed << setprecision(5) << centre_width_ << "/" << fixed << setprecision(5) << dScaleLat_ << "/" << - fixed << setprecision(5) << centre_height_ << "/" << fixed << setprecision(scale_precision_) << scale_bar_width_ << "k+lKilometres+jt " << + std::fixed << std::setprecision(5) << centre_width_ << "/" << std::fixed << std::setprecision(5) << dScaleLat_ << "/" << + std::fixed << std::setprecision(5) << centre_height_ << "/" << std::fixed << std::setprecision(scale_precision_) << scale_bar_width_ << "k+lKilometres+jt " << "-B" << - fixed << setprecision(graticule_width_precision_) << graticule_width_ << "g" << fixed << setprecision(graticule_width_precision_) << graticule_width_ << "/" << - fixed << setprecision(graticule_width_precision_) << graticule_width_ << "g" << fixed << setprecision(graticule_width_precision_) << graticule_width_; + std::fixed << std::setprecision(graticule_width_precision_) << graticule_width_ << "g" << std::fixed << std::setprecision(graticule_width_precision_) << graticule_width_ << "/" << + std::fixed << std::setprecision(graticule_width_precision_) << graticule_width_ << "g" << std::fixed << std::setprecision(graticule_width_precision_) << graticule_width_; if (!isLandscape) gmtbat_file_ << " -P"; - gmtbat_file_ << " -K > " << psTempFile << endl; + gmtbat_file_ << " -K > " << psTempFile << std::endl; break; // Robinson projection @@ -1426,16 +1426,16 @@ void dna_plot::CreateGMTCommandFile(const UINT32& block) gmtbat_file_ << _APP_PSCOAST_ << " -R" << (centre_width_-180) << "/" << (centre_width_+180) << "/-90/90" " -JN" << page_width_ << "c -B60g30 -D" << coastResolution_ << - " -A10000 -W0.75p,16/169/243 -G245/245/245 -K > " << psTempFile << endl; + " -A10000 -W0.75p,16/169/243 -G245/245/245 -K > " << psTempFile << std::endl; } - sort(pprj_->p._msr_colours.begin(), pprj_->p._msr_colours.end(), ComparePairFirst()); + std::sort(pprj_->p._msr_colours.begin(), pprj_->p._msr_colours.end(), ComparePairFirst()); if (pprj_->p._plot_plate_boundaries) { // print plate boundaries first gmtbat_file_ << _APP_PSXY_ << " -R -J \"" << v_tectonic_plate_file_.at(block) << - "\" -W0.75p,#DA5552 -O -K >> " << psTempFile << endl; + "\" -W0.75p,#DA5552 -O -K >> " << psTempFile << std::endl; } // Does the user want to print measurements? @@ -1468,20 +1468,20 @@ void dna_plot::CreateGMTCommandFile(const UINT32& block) circle_radius_2_ = circle_radius_ * 3.0; _it_colour = equal_range(pprj_->p._msr_colours.begin(), pprj_->p._msr_colours.end(), - v_msr_file_.at(block).at(i).second, ComparePairFirst()); + v_msr_file_.at(block).at(i).second, ComparePairFirst()); if (_it_colour.first == _it_colour.second) { - gmtbat_file_ << _APP_PSXY_ << " -R -J -Skcircle/" << fixed << setprecision(2) << circle_radius_2_ << - " \"" << v_msr_file_.at(block).at(i).first << "\" -W" << setprecision(2) << circle_line_width_ << + gmtbat_file_ << _APP_PSXY_ << " -R -J -Skcircle/" << std::fixed << std::setprecision(2) << circle_radius_2_ << + " \"" << v_msr_file_.at(block).at(i).first << "\" -W" << std::setprecision(2) << circle_line_width_ << "p,darkgray -Glightgray"; - gmtbat_file_ << " -O -K >> " << psTempFile << endl; + gmtbat_file_ << " -O -K >> " << psTempFile << std::endl; } else { colours++; - gmtbat_file_ << _APP_PSXY_ << " -R -J -Skcircle/" << fixed << setprecision(2) << circle_radius_2_ << - " \"" << v_msr_file_.at(block).at(i).first << "\" -W" << setprecision(2) << circle_line_width_ << + gmtbat_file_ << _APP_PSXY_ << " -R -J -Skcircle/" << std::fixed << std::setprecision(2) << circle_radius_2_ << + " \"" << v_msr_file_.at(block).at(i).first << "\" -W" << std::setprecision(2) << circle_line_width_ << "p,"; // Line colour @@ -1500,31 +1500,31 @@ void dna_plot::CreateGMTCommandFile(const UINT32& block) gmtbat_file_ << _it_colour.first->second; // Fill colour - gmtbat_file_ << " -G" << _it_colour.first->second << " -O -K >> " << psTempFile << endl; + gmtbat_file_ << " -G" << _it_colour.first->second << " -O -K >> " << psTempFile << std::endl; } } } // print stations first to enable measurements to be seen - gmtbat_file_ << _APP_PSXY_ << " -R -J -Skcircle/" << fixed << setprecision(2) << circle_radius_ << - " \"" << v_isl_pts_file_.at(block) << "\" -W" << setprecision(2) << circle_line_width_ << - "p,#235789 -Gwhite -O -K >> " << psTempFile << endl; + gmtbat_file_ << _APP_PSXY_ << " -R -J -Skcircle/" << std::fixed << std::setprecision(2) << circle_radius_ << + " \"" << v_isl_pts_file_.at(block) << "\" -W" << std::setprecision(2) << circle_line_width_ << + "p,#235789 -Gwhite -O -K >> " << psTempFile << std::endl; if (plotConstraints_) // don't plot line, just fill - gmtbat_file_ << _APP_PSXY_ << " -R -J -Skcircle/" << fixed << setprecision(2) << circle_radius_ << - " \"" << v_isl_const_file_.at(block) << "\" -G#235789 -O -K >> " << psTempFile << endl; + gmtbat_file_ << _APP_PSXY_ << " -R -J -Skcircle/" << std::fixed << std::setprecision(2) << circle_radius_ << + " \"" << v_isl_const_file_.at(block) << "\" -G#235789 -O -K >> " << psTempFile << std::endl; if (plotBlocks_) { - gmtbat_file_ << _APP_PSXY_ << " -R -J -Skcircle/" << fixed << setprecision(2) << circle_radius_ << - " \"" << v_jsl_pts_file_.at(block) << "\" -W" << setprecision(2) << circle_line_width_ * 2.0 << - "p,#DA5552 -Gwhite -O -K >> " << psTempFile << endl; + gmtbat_file_ << _APP_PSXY_ << " -R -J -Skcircle/" << std::fixed << std::setprecision(2) << circle_radius_ << + " \"" << v_jsl_pts_file_.at(block) << "\" -W" << std::setprecision(2) << circle_line_width_ * 2.0 << + "p,#DA5552 -Gwhite -O -K >> " << psTempFile << std::endl; if (plotConstraints_) // don't plot line, just fill - gmtbat_file_ << _APP_PSXY_ << " -R -J -Skcircle/" << fixed << setprecision(2) << circle_radius_ << - " \"" << v_jsl_const_file_.at(block) << "\" -G#DA5552 -O -K >> " << psTempFile << endl; + gmtbat_file_ << _APP_PSXY_ << " -R -J -Skcircle/" << std::fixed << std::setprecision(2) << circle_radius_ << + " \"" << v_jsl_const_file_.at(block) << "\" -G#DA5552 -O -K >> " << psTempFile << std::endl; } // Does the user want to print measurements? @@ -1549,26 +1549,26 @@ void dna_plot::CreateGMTCommandFile(const UINT32& block) continue; _it_colour = equal_range(pprj_->p._msr_colours.begin(), pprj_->p._msr_colours.end(), - v_msr_file_.at(block).at(i).second, ComparePairFirst()); + v_msr_file_.at(block).at(i).second, ComparePairFirst()); if (_it_colour.first == _it_colour.second) { gmtbat_file_ << _APP_PSXY_ << " -R -J \"" << v_msr_file_.at(block).at(i).first << - "\" " << "-W" << setprecision(2) << line_width_ << + "\" " << "-W" << std::setprecision(2) << line_width_ << "p,lightgray"; //if (v_msr_file_.at(block).at(i).second == "Y") // not a vector measurement, so represent as dashed // gmtbat_file_ << ",6_8:1p"; - gmtbat_file_ << " -O -K >> " << psTempFile << endl; + gmtbat_file_ << " -O -K >> " << psTempFile << std::endl; } else { colours++; gmtbat_file_ << _APP_PSXY_ << " -R -J \"" << v_msr_file_.at(block).at(i).first << - "\" " << "-W" << setprecision(2) << line_width_ << + "\" " << "-W" << std::setprecision(2) << line_width_ << "p," << _it_colour.first->second; //if (v_msr_file_.at(block).at(i).second == "Y") // not a vector measurement, so represent as dashed // gmtbat_file_ << ",6_8:1p"; - gmtbat_file_ << " -O -K >> " << psTempFile << endl; + gmtbat_file_ << " -O -K >> " << psTempFile << std::endl; } } } @@ -1596,30 +1596,30 @@ void dna_plot::CreateGMTCommandFile(const UINT32& block) { // print positional uncertainty gmtbat_file_ << _APP_PSVELO_ << " -R -J \"" << v_stn_apu_file_.at(block) << - "\" -Sr" << error_ellipse_scale << "/0.95/0c -L -W1.25p,#FFD275 -O -K >> " << psTempFile << endl; + "\" -Sr" << error_ellipse_scale << "/0.95/0c -L -W1.25p,#FFD275 -O -K >> " << psTempFile << std::endl; // Shift plot north to account for error ellipse legend if (pprj_->p._plot_error_ellipses) gmtbat_file_ << _APP_PSXY_ << " -R -J -T -Y" << label_font_size * 1.5 << "p " << - " -O -K >> " << psTempFile << endl; + " -O -K >> " << psTempFile << std::endl; // Add text for positional uncertainty legend gmtbat_file_ << _ECHO_CMD_ << - setprecision(precision) << fixed << left << uncertainty_legend_long_ << " " << - setprecision(precision) << fixed << left << uncertainty_legend_lat_ << " " << + std::setprecision(precision) << std::fixed << std::left << uncertainty_legend_long_ << " " << + std::setprecision(precision) << std::fixed << std::left << uncertainty_legend_lat_ << " " << " 95% positional uncertainty " << // the label - setprecision(uncertainty_legend_precision) << // '' - fixed << largest_uncertainty_ / pprj_->p._pu_ellipse_scale << " radius \\(m\\)" << // radius + std::setprecision(uncertainty_legend_precision) << // '' + std::fixed << largest_uncertainty_ / pprj_->p._pu_ellipse_scale << " radius \\(m\\)" << // radius " | "; // Push to pstext gmtbat_file_ << _APP_PSTEXT_ << " -R -J -F+f" << - fixed << setprecision(0) << + std::fixed << std::setprecision(0) << pprj_->p._label_font_size * 2.0 << "p,Helvetica" << // font size and face "=~" << pprj_->p._label_font_size/2.0 << "p,white" << // outline (or glow) "+jLM " << // justification "-Dj" << pprj_->p._label_font_size * 2.0 << // x shift - "p/0p -O -K >> " << psTempFile << endl; // y shift + "p/0p -O -K >> " << psTempFile << std::endl; // y shift } if (pprj_->p._plot_error_ellipses) @@ -1628,7 +1628,7 @@ void dna_plot::CreateGMTCommandFile(const UINT32& block) if (pprj_->p._plot_positional_uncertainty) gmtbat_file_ << _APP_PSXY_ << " -R -J -T -Y-" << label_font_size * 1.5 << "p " << - " -O -K >> " << psTempFile << endl; + " -O -K >> " << psTempFile << std::endl; double ellipse_scale(1.); @@ -1641,27 +1641,27 @@ void dna_plot::CreateGMTCommandFile(const UINT32& block) // print error ellipses in indian red gmtbat_file_ << _APP_PSVELO_ << " -R -J \"" << v_stn_err_file_.at(block) << - "\" -Sr" << error_ellipse_scale << "/0.95/0c -L -W0.75p,#DA5552 -O -K >> " << psTempFile << endl; + "\" -Sr" << error_ellipse_scale << "/0.95/0c -L -W0.75p,#DA5552 -O -K >> " << psTempFile << std::endl; // Add text for error ellipse legend gmtbat_file_ << _ECHO_CMD_ << - setprecision(precision) << fixed << left << uncertainty_legend_long_ << " " << - setprecision(precision) << fixed << left << uncertainty_legend_lat_ << " " << + std::setprecision(precision) << std::fixed << std::left << uncertainty_legend_long_ << " " << + std::setprecision(precision) << std::fixed << std::left << uncertainty_legend_lat_ << " " << " 1 sigma error ellipse " << // the label - setprecision(uncertainty_legend_precision) << // '' - fixed << largest_uncertainty_ / ellipse_scale / pprj_->p._pu_ellipse_scale << // semi-major + std::setprecision(uncertainty_legend_precision) << // '' + std::fixed << largest_uncertainty_ / ellipse_scale / pprj_->p._pu_ellipse_scale << // semi-major ", " << - fixed << largest_uncertainty_ / 3.0 / ellipse_scale / pprj_->p._pu_ellipse_scale << // semi-minor (make it third the height) + std::fixed << largest_uncertainty_ / 3.0 / ellipse_scale / pprj_->p._pu_ellipse_scale << // semi-minor (make it third the height) " \\(m\\)" << " | "; // Push to pstext gmtbat_file_ << _APP_PSTEXT_ << " -R -J -F+f" << - fixed << setprecision(0) << + std::fixed << std::setprecision(0) << pprj_->p._label_font_size * 2.0 << "p,Helvetica" << // font size and face "=~" << pprj_->p._label_font_size/2.0 << "p,white" << // outline (or glow) "+jLM " << // justification "-Dj" << pprj_->p._label_font_size * 2.0 << // x shift - "p/0p -O -K >> " << psTempFile << endl; // y shift + "p/0p -O -K >> " << psTempFile << std::endl; // y shift } if (pprj_->p._plot_correction_arrows) @@ -1688,52 +1688,52 @@ void dna_plot::CreateGMTCommandFile(const UINT32& block) // print text in black (no arrows) if (pprj_->p._plot_correction_labels) gmtbat_file_ << _APP_PSVELO_ << " -R -J \"" << v_stn_cor_file_.at(block) << - "\" -Se0.0001/0.95+f" << setprecision(0) << pprj_->p._label_font_size << - "p,Helvetica,black -L -A0.0001/0.0001/0.0001c -O -K >> " << psTempFile << endl; + "\" -Se0.0001/0.95+f" << std::setprecision(0) << pprj_->p._label_font_size << + "p,Helvetica,black -L -A0.0001/0.0001/0.0001c -O -K >> " << psTempFile << std::endl; // print arrows (without black outline!) gmtbat_file_ << _APP_PSVELO_ << " -R -J \"" << v_stn_cor_file_.at(block) << "\" -Se" << correction_arrow_scale << "/0.95/0c -L -A" << line_width_ / 2.0 * CM_TO_INCH << - "/0.5/0.1c -G#DA5552 -W0.0p,#DA5552 -O -K >> " << psTempFile << endl; + "/0.5/0.1c -G#DA5552 -W0.0p,#DA5552 -O -K >> " << psTempFile << std::endl; // Add text below the corrections arrow legend gmtbat_file_ << _ECHO_CMD_ << - setprecision(precision) << fixed << left << arrow_legend_long_ << " " << - setprecision(precision) << fixed << left << arrow_legend_lat_ << " " << - setprecision(correction_legend_precision) << // the label - fixed << average_correction_ / pprj_->p._correction_scale << " \\(m\\)" << // '' + std::setprecision(precision) << std::fixed << std::left << arrow_legend_long_ << " " << + std::setprecision(precision) << std::fixed << std::left << arrow_legend_lat_ << " " << + std::setprecision(correction_legend_precision) << // the label + std::fixed << average_correction_ / pprj_->p._correction_scale << " \\(m\\)" << // '' " | "; // Push to pstext gmtbat_file_ << _APP_PSTEXT_ << " -R -J -F+f" << - fixed << setprecision(0) << + std::fixed << std::setprecision(0) << pprj_->p._label_font_size * 2.0 << "p,Helvetica" << // font size and face "=~" << pprj_->p._label_font_size/2.0 << "p,white" << // outline (or glow) "+jRM " << // justification "-Dj" << pprj_->p._label_font_size * 2.0 << // x shift - "p/0p -O -K >> " << psTempFile << endl; // y shift + "p/0p -O -K >> " << psTempFile << std::endl; // y shift gmtbat_file_ << _APP_PSXY_ << " -R -J -T -Y-" << label_font_size * 1.5 << "p " << - " -O -K >> " << psTempFile << endl; + " -O -K >> " << psTempFile << std::endl; // Add text above for corrections legend gmtbat_file_ << _ECHO_CMD_ << - setprecision(precision) << fixed << left << arrow_legend_long_ << " " << - setprecision(precision) << fixed << left << arrow_legend_lat_ << " " << + std::setprecision(precision) << std::fixed << std::left << arrow_legend_long_ << " " << + std::setprecision(precision) << std::fixed << std::left << arrow_legend_lat_ << " " << "Corrections scale" << // the label " | "; // Push to pstext gmtbat_file_ << _APP_PSTEXT_ << " -R -J -F+f" << - fixed << setprecision(0) << + std::fixed << std::setprecision(0) << pprj_->p._label_font_size * 2.0 << "p,Helvetica" << // font size and face "=~" << pprj_->p._label_font_size/2.0 << "p,white" << // outline (or glow) "+jCM " << // justification "-Dj-" << pprj_->p._label_font_size * 2.0 << // x shift - "p/0p -O -K >> " << psTempFile << endl; // y shift + "p/0p -O -K >> " << psTempFile << std::endl; // y shift gmtbat_file_ << _APP_PSXY_ << " -R -J -T -Y" << label_font_size * 1.5 << "p " << - " -O -K >> " << psTempFile << endl; + " -O -K >> " << psTempFile << std::endl; } if (pprj_->p._plot_station_labels) @@ -1742,14 +1742,14 @@ void dna_plot::CreateGMTCommandFile(const UINT32& block) // print shadow gmtbat_file_ << " -F+f" << - fixed << setprecision(0) << + std::fixed << std::setprecision(0) << pprj_->p._label_font_size << "p,Helvetica" << // font size and face "=~" << pprj_->p._label_font_size/3.0 << "p,white" << // outline (or glow) "+jLM " << // justification "-Dj" << pprj_->p._label_font_size + sqrt(pprj_->p._label_font_size) << // x shift "p/" << pprj_->p._label_font_size/2.0 << // y shift - "p -O -K >> " << psTempFile << endl; + "p -O -K >> " << psTempFile << std::endl; if (plotBlocks_) { @@ -1757,14 +1757,14 @@ void dna_plot::CreateGMTCommandFile(const UINT32& block) // print shadow gmtbat_file_ << " -F+f" << - fixed << setprecision(0) << + std::fixed << std::setprecision(0) << pprj_->p._label_font_size << "p,Helvetica" << // font size and face "=~" << pprj_->p._label_font_size/3.0 << "p,white" << // outline (or glow) "+jLM " << // justification "-Dj" << pprj_->p._label_font_size + sqrt(pprj_->p._label_font_size) << // x shift "p/" << pprj_->p._label_font_size/2.0 << // y shift - "p -O -K >> " << psTempFile << endl; + "p -O -K >> " << psTempFile << std::endl; } } @@ -1772,7 +1772,7 @@ void dna_plot::CreateGMTCommandFile(const UINT32& block) // any plotting output (depending on whether a title block is required) gmtbat_file_ << _APP_PSXY_ << " -R -J -T -O"; - string legendCommand1(_LEGEND_CMD_1_), legendCommand2(_LEGEND_CMD_2_); + std::string legendCommand1(_LEGEND_CMD_1_), legendCommand2(_LEGEND_CMD_2_); #if defined(_WIN32) || defined(__WIN32__) // temporary legend files @@ -1784,27 +1784,27 @@ void dna_plot::CreateGMTCommandFile(const UINT32& block) if (pprj_->p._omit_title_block) { // Terminate a sequence of GMT plotting commands without producing any plotting output - gmtbat_file_ << " >> " << psTempFile << endl << endl; + gmtbat_file_ << " >> " << psTempFile << std::endl << std::endl; } else { - gmtbat_file_ << " -K >> " << psTempFile << endl << endl; + gmtbat_file_ << " -K >> " << psTempFile << std::endl << std::endl; // legend - gmtbat_file_ << _APP_GMTSET_ << " FONT_TITLE 1" << endl; + gmtbat_file_ << _APP_GMTSET_ << " FONT_TITLE 1" << std::endl; gmtbat_file_ << _APP_GMTSET_ << " FONT_ANNOT_PRIMARY " << label_font_size * 1.1 << "p"; - gmtbat_file_ << endl; + gmtbat_file_ << std::endl; #if defined(__linux) || defined(sun) || defined(__unix__) || defined(__APPLE__) - gmtbat_file_ << "cat > " << legendTempFile << " << END" << endl; + gmtbat_file_ << "cat > " << legendTempFile << " << END" << std::endl; #endif - bool isnameaNumber(is_number(pprj_->p._title)); + bool isnameaNumber(is_number(pprj_->p._title)); - gmtbat_file_ << _LEGEND_ECHO_ << "G 0.25" << legendCommand1 << endl; - gmtbat_file_ << _LEGEND_ECHO_ << "N 1" << legendCommand2 << endl; - gmtbat_file_ << _LEGEND_ECHO_ << "H " << fixed << setprecision(0) << label_font_size * 2.0 << "p,Helvetica-Bold "; + gmtbat_file_ << _LEGEND_ECHO_ << "G 0.25" << legendCommand1 << std::endl; + gmtbat_file_ << _LEGEND_ECHO_ << "N 1" << legendCommand2 << std::endl; + gmtbat_file_ << _LEGEND_ECHO_ << "H " << std::fixed << std::setprecision(0) << label_font_size * 2.0 << "p,Helvetica-Bold "; if (isnameaNumber) gmtbat_file_ << "'" << pprj_->p._title << "'"; else @@ -1816,12 +1816,12 @@ void dna_plot::CreateGMTCommandFile(const UINT32& block) if (!pprj_->p._plot_station_centre.empty()) gmtbat_file_ << " centred on " << pprj_->p._plot_station_centre; - gmtbat_file_ << legendCommand2 << endl; - gmtbat_file_ << _LEGEND_ECHO_ << "G 0.25" << legendCommand2 << endl; + gmtbat_file_ << legendCommand2 << std::endl; + gmtbat_file_ << _LEGEND_ECHO_ << "G 0.25" << legendCommand2 << std::endl; // Print stations legend - gmtbat_file_ << _LEGEND_ECHO_ << "D 0 1p" << legendCommand2 << endl; // horizontal line - gmtbat_file_ << _LEGEND_ECHO_ << "G 0.25" << legendCommand2 << endl; // space + gmtbat_file_ << _LEGEND_ECHO_ << "D 0 1p" << legendCommand2 << std::endl; // horizontal line + gmtbat_file_ << _LEGEND_ECHO_ << "G 0.25" << legendCommand2 << std::endl; // space UINT32 station_count(1); // Simultaneous or ISL @@ -1838,32 +1838,32 @@ void dna_plot::CreateGMTCommandFile(const UINT32& block) //if (pprj_->p._plot_correction_arrows) // station_count++; // Corrections to station coordinates - gmtbat_file_ << _LEGEND_ECHO_ << "N " << station_count << legendCommand2 << endl; - gmtbat_file_ << _LEGEND_ECHO_ << "V 0 1p" << legendCommand2 << endl; // vertical line + gmtbat_file_ << _LEGEND_ECHO_ << "N " << station_count << legendCommand2 << std::endl; + gmtbat_file_ << _LEGEND_ECHO_ << "V 0 1p" << legendCommand2 << std::endl; // vertical line circle_radius_2_ = circle_radius_ * 1.75; // Simultaneous stations or Phased inner stations gmtbat_file_ << _LEGEND_ECHO_ << - "S " << fixed << setprecision(1) << symbol_offset << " c " << + "S " << std::fixed << std::setprecision(1) << symbol_offset << " c " << circle_radius_2_ << " white " << circle_line_width_ * 2 << "p,#235789 " << - fixed << setprecision(1) << label_offset; + std::fixed << std::setprecision(1) << label_offset; if (plotBlocks_) gmtbat_file_ << " Free Inner stations "; else gmtbat_file_ << " Free Stations"; - gmtbat_file_ << legendCommand2 << endl; + gmtbat_file_ << legendCommand2 << std::endl; // Simultaneous stations or Phased inner stations if (plotBlocks_) { gmtbat_file_ << _LEGEND_ECHO_ << - "S " << fixed << setprecision(1) << symbol_offset << " c " << + "S " << std::fixed << std::setprecision(1) << symbol_offset << " c " << circle_radius_2_ << " white " << circle_line_width_ * 2 << "p,#DA5552 " << - fixed << setprecision(1) << label_offset << - " Free Junction stations" << legendCommand2 << endl; + std::fixed << std::setprecision(1) << label_offset << + " Free Junction stations" << legendCommand2 << std::endl; } if (plotConstraints_) @@ -1871,25 +1871,25 @@ void dna_plot::CreateGMTCommandFile(const UINT32& block) if (plotBlocks_) { gmtbat_file_ << _LEGEND_ECHO_ << - "S " << fixed << setprecision(1) << symbol_offset << " c " << + "S " << std::fixed << std::setprecision(1) << symbol_offset << " c " << circle_radius_2_ << " #235789 " << circle_line_width_ * 2 << "p,#235789 " << - fixed << setprecision(1) << label_offset << - " Constrained inner stations" << legendCommand2 << endl; + std::fixed << std::setprecision(1) << label_offset << + " Constrained inner stations" << legendCommand2 << std::endl; gmtbat_file_ << _LEGEND_ECHO_ << - "S " << fixed << setprecision(1) << symbol_offset << " c " << + "S " << std::fixed << std::setprecision(1) << symbol_offset << " c " << circle_radius_2_ << " #DA5552 " << circle_line_width_ * 2 << "p,#DA5552 " << - fixed << setprecision(1) << label_offset << - " Constrained junction stations" << legendCommand2 << endl; + std::fixed << std::setprecision(1) << label_offset << + " Constrained junction stations" << legendCommand2 << std::endl; } else gmtbat_file_ << _LEGEND_ECHO_ << - "S " << fixed << setprecision(1) << symbol_offset << " c " << + "S " << std::fixed << std::setprecision(1) << symbol_offset << " c " << circle_radius_2_ << " #235789 " << circle_line_width_ * 2 << "p,#235789 " << - fixed << setprecision(1) << label_offset << - " Constraint stations" << legendCommand2 << endl; + std::fixed << std::setprecision(1) << label_offset << + " Constraint stations" << legendCommand2 << std::endl; } title_block_height_ = 5; @@ -1898,33 +1898,33 @@ void dna_plot::CreateGMTCommandFile(const UINT32& block) { // // Add corrections to end of stations legend // gmtbat_file_ << _LEGEND_ECHO_ << - // "S " << fixed << setprecision(1) << symbol_offset << + // "S " << std::fixed << std::setprecision(1) << symbol_offset << // " v 1.5c/0.04/0.5/0.1 red " << // arrowlength/linewidth/arrowheadwidth/arrowheadlength // line_width * 2 << "p,#DA5552 " - // << fixed << setprecision(1) << label_offset * 1.5 << " Corrections to stations" << legendCommand2 << endl; + // << std::fixed << std::setprecision(1) << label_offset * 1.5 << " Corrections to stations" << legendCommand2 << std::endl; } // If corrections are not being printed, then print measurements legend else { - gmtbat_file_ << _LEGEND_ECHO_ << "G 0.25" << legendCommand2 << endl; // space - gmtbat_file_ << _LEGEND_ECHO_ << "D 0 1p" << legendCommand2 << endl; // horizontal line - gmtbat_file_ << _LEGEND_ECHO_ << "G 0.25" << legendCommand2 << endl; // space + gmtbat_file_ << _LEGEND_ECHO_ << "G 0.25" << legendCommand2 << std::endl; // space + gmtbat_file_ << _LEGEND_ECHO_ << "D 0 1p" << legendCommand2 << std::endl; // horizontal line + gmtbat_file_ << _LEGEND_ECHO_ << "G 0.25" << legendCommand2 << std::endl; // space if (v_msr_file_.at(block).size() > columns) - gmtbat_file_ << _LEGEND_ECHO_ << "N " << columns << legendCommand2 << endl; + gmtbat_file_ << _LEGEND_ECHO_ << "N " << columns << legendCommand2 << std::endl; else - gmtbat_file_ << _LEGEND_ECHO_ << "N " << v_msr_file_.at(block).size() << legendCommand2 << endl; + gmtbat_file_ << _LEGEND_ECHO_ << "N " << v_msr_file_.at(block).size() << legendCommand2 << std::endl; bool bOtherTypes(false); for (UINT32 i=0; ip._msr_colours.begin(), pprj_->p._msr_colours.end(), - v_msr_file_.at(block).at(i).second, ComparePairFirst()); + v_msr_file_.at(block).at(i).second, ComparePairFirst()); if (_it_colour.first != _it_colour.second) { - gmtbat_file_ << _LEGEND_ECHO_ << "S " << fixed << setprecision(1) << symbol_offset; + gmtbat_file_ << _LEGEND_ECHO_ << "S " << std::fixed << std::setprecision(1) << symbol_offset; circle_radius_2_ = circle_radius_ * 1.75; @@ -1959,8 +1959,8 @@ void dna_plot::CreateGMTCommandFile(const UINT32& block) else gmtbat_file_ << _it_colour.first->second; - gmtbat_file_ << " " << fixed << setprecision(1) << label_offset << " " << - measurement_name(static_cast(_it_colour.first->first.at(0))) << legendCommand2 << endl; + gmtbat_file_ << " " << std::fixed << std::setprecision(1) << label_offset << " " << + measurement_name(static_cast(_it_colour.first->first.at(0))) << legendCommand2 << std::endl; } else bOtherTypes = true; @@ -1968,30 +1968,30 @@ void dna_plot::CreateGMTCommandFile(const UINT32& block) if (bOtherTypes) gmtbat_file_ << _LEGEND_ECHO_ << - "S " << fixed << setprecision(1) << symbol_offset << " - 0.5 lightgray " << line_width_ * 2.5 << "p,lightgray " - << fixed << setprecision(1) << label_offset << " All other types" << legendCommand2 << endl; + "S " << std::fixed << std::setprecision(1) << symbol_offset << " - 0.5 lightgray " << line_width_ * 2.5 << "p,lightgray " + << std::fixed << std::setprecision(1) << label_offset << " All other types" << legendCommand2 << std::endl; title_block_height_ += floor(((double)colours)/columns) * 0.25; } - gmtbat_file_ << _LEGEND_ECHO_ << "G 0.25" << legendCommand2 << endl; // space - gmtbat_file_ << _LEGEND_ECHO_ << "D 0 1p" << legendCommand2 << endl; // horizontal line - gmtbat_file_ << _LEGEND_ECHO_ << "G 0.25" << legendCommand2 << endl; // space - gmtbat_file_ << _LEGEND_ECHO_ << "N 5" << legendCommand2 << endl; - gmtbat_file_ << _LEGEND_ECHO_ << "S 0.01 c 0.01 white 1p,white 1 " << pprj_->p._title_block_subname << legendCommand2 << endl; - gmtbat_file_ << _LEGEND_ECHO_ << "S 0.01 c 0.01 white 1p,white 0 " << pprj_->p._title_block_name << legendCommand2 << endl; - gmtbat_file_ << _LEGEND_ECHO_ << "S 0.01 c 0.01 white 1p,white 3 " << reference_frame_ << legendCommand2 << endl; - gmtbat_file_ << _LEGEND_ECHO_ << "S 0.01 c 0.01 white 1p,white 0 " << projectionTypes[pprj_->p._projection] << " projection" << legendCommand2 << endl; - gmtbat_file_ << _LEGEND_ECHO_ << "S 0.01 c 0.01 white 1p,white 1 Scale 1:" << static_cast(scale_) << " (A3)" << legendCommand2 << endl; + gmtbat_file_ << _LEGEND_ECHO_ << "G 0.25" << legendCommand2 << std::endl; // space + gmtbat_file_ << _LEGEND_ECHO_ << "D 0 1p" << legendCommand2 << std::endl; // horizontal line + gmtbat_file_ << _LEGEND_ECHO_ << "G 0.25" << legendCommand2 << std::endl; // space + gmtbat_file_ << _LEGEND_ECHO_ << "N 5" << legendCommand2 << std::endl; + gmtbat_file_ << _LEGEND_ECHO_ << "S 0.01 c 0.01 white 1p,white 1 " << pprj_->p._title_block_subname << legendCommand2 << std::endl; + gmtbat_file_ << _LEGEND_ECHO_ << "S 0.01 c 0.01 white 1p,white 0 " << pprj_->p._title_block_name << legendCommand2 << std::endl; + gmtbat_file_ << _LEGEND_ECHO_ << "S 0.01 c 0.01 white 1p,white 3 " << reference_frame_ << legendCommand2 << std::endl; + gmtbat_file_ << _LEGEND_ECHO_ << "S 0.01 c 0.01 white 1p,white 0 " << projectionTypes[pprj_->p._projection] << " projection" << legendCommand2 << std::endl; + gmtbat_file_ << _LEGEND_ECHO_ << "S 0.01 c 0.01 white 1p,white 1 Scale 1:" << static_cast(scale_) << " (A3)" << legendCommand2 << std::endl; #if defined(__linux) || defined(sun) || defined(__unix__) || defined(__APPLE__) - gmtbat_file_ << "END" << endl << endl; + gmtbat_file_ << "END" << std::endl << std::endl; #endif - gmtbat_file_ << _APP_PSLEGEND_ << " -R -J -DJTL+w" << fixed << setprecision(1) << page_width_ << + gmtbat_file_ << _APP_PSLEGEND_ << " -R -J -DJTL+w" << std::fixed << std::setprecision(1) << page_width_ << "c+jBL+l1.5+o0/1.5c -C0.3/0.3 -O -F+p+gwhite " << - legendTempFile << " -P >> " << psTempFile << endl; + legendTempFile << " -P >> " << psTempFile << std::endl; } @@ -2000,42 +2000,42 @@ void dna_plot::CreateGMTCommandFile(const UINT32& block) // conversion to PDF // - gmtbat_file_ << endl << _COMMENT_PREFIX_ << "convert ps to pdf" << endl; + gmtbat_file_ << std::endl << _COMMENT_PREFIX_ << "convert ps to pdf" << std::endl; size_t lastindex = v_gmt_pdf_filenames_.at(block).find_last_of("."); - string pdf_filename = v_gmt_pdf_filenames_.at(block).substr(0, lastindex); - gmtbat_file_ << _APP_PSCONVERT_ << " -A0.2c+white -Tf -F\"" << pdf_filename << "\" " << psTempFile << endl << endl; + std::string pdf_filename = v_gmt_pdf_filenames_.at(block).substr(0, lastindex); + gmtbat_file_ << _APP_PSCONVERT_ << " -A0.2c+white -Tf -F\"" << pdf_filename << "\" " << psTempFile << std::endl << std::endl; if (pprj_->p._export_png) { - gmtbat_file_ << endl << _COMMENT_PREFIX_ << "convert ps to png" << endl; - gmtbat_file_ << _APP_PSCONVERT_ << " -A0.2c+white -Tg -F\"" << pdf_filename << "\" " << psTempFile << endl << endl; + gmtbat_file_ << std::endl << _COMMENT_PREFIX_ << "convert ps to png" << std::endl; + gmtbat_file_ << _APP_PSCONVERT_ << " -A0.2c+white -Tg -F\"" << pdf_filename << "\" " << psTempFile << std::endl << std::endl; } //////////////////////////////////////////////// //////////////////////////////////////////////// // clean up legend files - gmtbat_file_ << _COMMENT_PREFIX_ << "cleanup" << endl; + gmtbat_file_ << _COMMENT_PREFIX_ << "cleanup" << std::endl; gmtbat_file_ << _DELETE_CMD_ << psTempFile; if (!pprj_->p._omit_title_block) - gmtbat_file_ << " " << legendTempFile << endl; + gmtbat_file_ << " " << legendTempFile << std::endl; else - gmtbat_file_ << endl; + gmtbat_file_ << std::endl; //////////////////////////////////////////////// // remove temporary directory for gmt.conf and gmt.history - gmtbat_file_ << _RMDIR_CMD_ << _ENV_GMT_TMP_DIR_ << endl; + gmtbat_file_ << _RMDIR_CMD_ << _ENV_GMT_TMP_DIR_ << std::endl; #if defined(__linux) || defined(sun) || defined(__unix__) || defined(__APPLE__) - gmtbat_file_ << "unset " << _GMT_TMP_DIR_ << endl; + gmtbat_file_ << "unset " << _GMT_TMP_DIR_ << std::endl; #endif - gmtbat_file_ << endl; + gmtbat_file_ << std::endl; ////////////////////////////////////////////////////////////////////////////////////////// // delete data files @@ -2081,13 +2081,13 @@ void dna_plot::CreateGMTCommandFile(const UINT32& block) if (pprj_->p._plot_plate_boundaries) gmtbat_file_ << " \"" << v_tectonic_plate_file_.at(block) << "\""; - gmtbat_file_ << endl; + gmtbat_file_ << std::endl; } else - gmtbat_file_ << endl; + gmtbat_file_ << std::endl; ////////////////////////////////////////////////////////////////////////////////////////// - gmtbat_file_ << endl; + gmtbat_file_ << std::endl; } @@ -2120,7 +2120,7 @@ void dna_plot::CreateGMTPlotEnvironment(project_settings* pprj) void dna_plot::InvokeGMT() { // set up a thread group to execute the GMT scripts in parallel - thread_group gmt_plot_threads; + boost::thread_group gmt_plot_threads; for (UINT32 plot=0; plotp._keep_gen_files) return; - stringstream ss; + std::stringstream ss; ss << _DELETE_CMD_; // shell scripts for_each(v_gmt_cmd_filenames_.begin(), v_gmt_cmd_filenames_.end(), - [&ss](const string& gmt_cmd_file) { + [&ss](const std::string& gmt_cmd_file) { ss << " \"" << gmt_cmd_file << "\""; }); @@ -2193,13 +2193,13 @@ void dna_plot::CleanupGMTFiles() { // PDF files for each block (except simultaneous) for_each(v_gmt_pdf_filenames_.begin(), v_gmt_pdf_filenames_.end(), - [&ss](const string& gmt_pdf_file) { + [&ss](const std::string& gmt_pdf_file) { ss << " \"" << gmt_pdf_file << "\""; }); } // delete - string clean_up_gmt_config_files = ss.str(); + std::string clean_up_gmt_config_files = ss.str(); std::system(clean_up_gmt_config_files.c_str()); } @@ -2233,7 +2233,7 @@ void dna_plot::CalculateLimitsFromStation() if (_it_stnmap.first == _it_stnmap.second) { - stringstream ss; + std::stringstream ss; ss.str(""); ss << pprj_->p._plot_station_centre << " is not in the list of network stations."; SignalExceptionPlot(ss.str(), 0, NULL); @@ -2272,15 +2272,15 @@ void dna_plot::CalculateLimitsFromPoint() void dna_plot::FormGMTDataFileNames(const UINT32& block) { - string firstPartISL = pprj_->g.output_folder + FOLDER_SLASH + network_name_; - string firstPartSTN = pprj_->g.output_folder + FOLDER_SLASH + network_name_; + std::string firstPartISL = pprj_->g.output_folder + FOLDER_SLASH + network_name_; + std::string firstPartSTN = pprj_->g.output_folder + FOLDER_SLASH + network_name_; firstPartSTN.append("_stn"); if (plotBlocks_) { - stringstream firstPart; - string firstPartJSL; + std::stringstream firstPart; + std::string firstPartJSL; // add isl and jsl filenames for this block firstPart << firstPartSTN << "_block" << block + 1; @@ -2333,7 +2333,7 @@ void dna_plot::PrintStationsDataFileBlock(const UINT32& block) file_opener(isl_const, v_isl_const_file_.at(block_index)); file_opener(jsl_const, v_jsl_const_file_.at(block_index)); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionPlot(e.what(), 0, NULL); } @@ -2402,11 +2402,11 @@ void dna_plot::PrintStationsDataFile() // Create constraint stations data file. Throws runtime_error on failure. file_opener(stn_const, v_isl_const_file_.at(0)); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionPlot(e.what(), 0, NULL); } - stringstream ss; + std::stringstream ss; for (it_vstn_t_const _it_stn(bstBinaryRecords_.begin()); _it_stninitialLongitude << " " << - _it_stn->initialLatitude << endl; + os << std::setprecision(10) << std::fixed << _it_stn->initialLongitude << " " << + _it_stn->initialLatitude << std::endl; } -void dna_plot::PrintStationLabel(ostream& os, it_vstn_t_const _it_stn) +void dna_plot::PrintStationLabel(std::ostream& os, it_vstn_t_const _it_stn) { if (_it_stn->unusedStation) return; // Print longitude, latitude and label - os << setprecision(10) << fixed << + os << std::setprecision(10) << std::fixed << _it_stn->initialLongitude << " " << // E/W _it_stn->initialLatitude << " "; // N/S // Print the label, default is station name (i.e. 200100350) - string label(_it_stn->stationName); + std::string label(_it_stn->stationName); // plot alternate name? if (pprj_->p._plot_alt_name) @@ -2492,7 +2492,7 @@ void dna_plot::PrintStationLabel(ostream& os, it_vstn_t_const _it_stn) _it_stn->stationConst[1] == 'C' || _it_stn->stationConst[2] == 'C') os << " (" << _it_stn->stationConst << ")"; - os << endl; + os << std::endl; } void dna_plot::PrintStationLabels() @@ -2502,7 +2502,7 @@ void dna_plot::PrintStationLabels() // Create stations data file. Throws runtime_error on failure. file_opener(stn_lbl, v_isl_lbl_file_.at(0)); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionPlot(e.what(), 0, NULL); } @@ -2515,7 +2515,7 @@ void dna_plot::PrintStationLabels() // sort stations on longitude so labels to the left are placed last CompareStnLongitude stnorderCompareFunc(&bstBinaryRecords_, false); - sort(stnList.begin(), stnList.end(), stnorderCompareFunc); + std::sort(stnList.begin(), stnList.end(), stnorderCompareFunc); it_vstn_t _it_bstn; @@ -2542,13 +2542,13 @@ void dna_plot::PrintStationLabelsBlock(const UINT32& block) // Create stations data file. Throws runtime_error on failure. file_opener(isl_lbl, v_isl_lbl_file_.at(block_index)); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionPlot(e.what(), 0, NULL); } // sort ISLs on longitude so labels to the left are placed last CompareStnLongitude stnorderCompareFunc(&bstBinaryRecords_, false); - sort(v_ISL_.at(block).begin(), v_ISL_.at(block).end(), stnorderCompareFunc); + std::sort(v_ISL_.at(block).begin(), v_ISL_.at(block).end(), stnorderCompareFunc); it_vstn_t _it_bstn; @@ -2565,7 +2565,7 @@ void dna_plot::PrintStationLabelsBlock(const UINT32& block) isl_lbl.close(); // return to former sort order - sort(v_ISL_.at(block).begin(), v_ISL_.at(block).end()); + std::sort(v_ISL_.at(block).begin(), v_ISL_.at(block).end()); std::ofstream jsl_lbl; @@ -2573,12 +2573,12 @@ void dna_plot::PrintStationLabelsBlock(const UINT32& block) // Create stations data file. Throws runtime_error on failure. file_opener(jsl_lbl, v_jsl_lbl_file_.at(block_index)); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionPlot(e.what(), 0, NULL); } // sort JSLs on longitude so labels to the left are placed last - sort(v_JSL_.at(block).begin(), v_JSL_.at(block).end(), stnorderCompareFunc); + std::sort(v_JSL_.at(block).begin(), v_JSL_.at(block).end(), stnorderCompareFunc); for (it_vUINT32 _it_jsl(v_JSL_.at(block).begin()); _it_jsl_longitude << " " << - setw(MSR) << setprecision(precision) << fixed << left << _it_pu->_latitude << " " << + std::setw(MSR) << std::setprecision(precision) << std::fixed << std::left << _it_pu->_longitude << " " << + std::setw(MSR) << std::setprecision(precision) << std::fixed << std::left << _it_pu->_latitude << " " << " 0 0 " << - setw(MSR) << setprecision(4) << scientific << right << _it_pu->_hzPosU * pprj_->p._pu_ellipse_scale << - setw(MSR) << setprecision(4) << scientific << right << _it_pu->_hzPosU * pprj_->p._pu_ellipse_scale << - setw(MSR) << setprecision(1) << fixed << right << "0." << endl; + std::setw(MSR) << std::setprecision(4) << std::scientific << std::right << _it_pu->_hzPosU * pprj_->p._pu_ellipse_scale << + std::setw(MSR) << std::setprecision(4) << std::scientific << std::right << _it_pu->_hzPosU * pprj_->p._pu_ellipse_scale << + std::setw(MSR) << std::setprecision(1) << std::fixed << std::right << "0." << std::endl; } stn_apu.close(); @@ -2673,7 +2673,7 @@ void dna_plot::PrintErrorEllipses(const UINT32& block) // Create error ellipse file. Throws runtime_error on failure. file_opener(stn_err, v_stn_err_file_.at(block_index)); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionPlot(e.what(), 0, NULL); } @@ -2694,15 +2694,15 @@ void dna_plot::PrintErrorEllipses(const UINT32& block) // Print uncertainty legend, using average xx length. See LoadPosUncertaintyFile(). stn_err << - setw(MSR) << setprecision(precision) << fixed << left << uncertainty_legend_long_ << " " << - setw(MSR) << setprecision(precision) << fixed << left << uncertainty_legend_lat_ << " " << + std::setw(MSR) << std::setprecision(precision) << std::fixed << std::left << uncertainty_legend_long_ << " " << + std::setw(MSR) << std::setprecision(precision) << std::fixed << std::left << uncertainty_legend_lat_ << " " << " 0 0 " << - setw(MSR) << setprecision(4) << scientific << right << + std::setw(MSR) << std::setprecision(4) << std::scientific << std::right << largest_uncertainty_ / ellipse_scale << // semi-major - setw(MSR) << setprecision(4) << scientific << right << + std::setw(MSR) << std::setprecision(4) << std::scientific << std::right << largest_uncertainty_ / 3.0 / ellipse_scale << // semi-minor - setw(MSR) << setprecision(2) << fixed << right << - "45.0" << endl; // orientation from e-axis + std::setw(MSR) << std::setprecision(2) << std::fixed << std::right << + "45.0" << std::endl; // orientation from e-axis double angle; @@ -2736,12 +2736,12 @@ void dna_plot::PrintErrorEllipses(const UINT32& block) angle = DegtoDms(90. - DmstoDeg(_it_pu->_orientation)); stn_err << - setw(MSR) << setprecision(precision) << fixed << left << _it_pu->_longitude << " " << - setw(MSR) << setprecision(precision) << fixed << left << _it_pu->_latitude << " " << + std::setw(MSR) << std::setprecision(precision) << std::fixed << std::left << _it_pu->_longitude << " " << + std::setw(MSR) << std::setprecision(precision) << std::fixed << std::left << _it_pu->_latitude << " " << " 0 0 " << - setw(MSR) << setprecision(4) << scientific << right << _it_pu->_semimMajor * pprj_->p._pu_ellipse_scale << - setw(MSR) << setprecision(4) << scientific << right << _it_pu->_semimMinor * pprj_->p._pu_ellipse_scale << - setw(MSR) << setprecision(4) << fixed << right << angle << endl; + std::setw(MSR) << std::setprecision(4) << std::scientific << std::right << _it_pu->_semimMajor * pprj_->p._pu_ellipse_scale << + std::setw(MSR) << std::setprecision(4) << std::scientific << std::right << _it_pu->_semimMinor * pprj_->p._pu_ellipse_scale << + std::setw(MSR) << std::setprecision(4) << std::fixed << std::right << angle << std::endl; } stn_err.close(); @@ -2759,7 +2759,7 @@ void dna_plot::PrintCorrectionArrows(const UINT32& block) // Create corrections file. Throws runtime_error on failure. file_opener(stn_cor, v_stn_cor_file_.at(block_index)); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionPlot(e.what(), 0, NULL); } @@ -2771,11 +2771,11 @@ void dna_plot::PrintCorrectionArrows(const UINT32& block) // Print correction legend, using average correction length. See LoadCorrectionsFile(). stn_cor << - setw(MSR) << setprecision(precision) << fixed << left << arrow_legend_long_ << " " << - setw(MSR) << setprecision(precision) << fixed << left << arrow_legend_lat_ << " " << - setw(MSR) << setprecision(4) << scientific << right << average_correction_ << - setw(MSR) << setprecision(2) << fixed << right << 0.0 << - " 0 0 0 " << endl; + std::setw(MSR) << std::setprecision(precision) << std::fixed << std::left << arrow_legend_long_ << " " << + std::setw(MSR) << std::setprecision(precision) << std::fixed << std::left << arrow_legend_lat_ << " " << + std::setw(MSR) << std::setprecision(4) << std::scientific << std::right << average_correction_ << + std::setw(MSR) << std::setprecision(2) << std::fixed << std::right << 0.0 << + " 0 0 0 " << std::endl; for (_it_cor=v_stn_corrs_.begin(); _it_cor!=v_stn_corrs_.end(); @@ -2802,17 +2802,17 @@ void dna_plot::PrintCorrectionArrows(const UINT32& block) continue; stn_cor << - setw(MSR) << setprecision(precision) << fixed << left << bstBinaryRecords_.at(_it_stnmap.first->second).initialLongitude << " " << - setw(MSR) << setprecision(precision) << fixed << left << bstBinaryRecords_.at(_it_stnmap.first->second).initialLatitude << " " << - setw(MSR) << setprecision(4) << scientific << right << _it_cor->_east * pprj_->p._correction_scale << - setw(MSR) << setprecision(4) << scientific << right << _it_cor->_north * pprj_->p._correction_scale << + std::setw(MSR) << std::setprecision(precision) << std::fixed << std::left << bstBinaryRecords_.at(_it_stnmap.first->second).initialLongitude << " " << + std::setw(MSR) << std::setprecision(precision) << std::fixed << std::left << bstBinaryRecords_.at(_it_stnmap.first->second).initialLatitude << " " << + std::setw(MSR) << std::setprecision(4) << std::scientific << std::right << _it_cor->_east * pprj_->p._correction_scale << + std::setw(MSR) << std::setprecision(4) << std::scientific << std::right << _it_cor->_north * pprj_->p._correction_scale << " 0 0 0 "; if (pprj_->p._plot_correction_labels) stn_cor << - setw(HEIGHT) << setprecision(3) << fixed << right << _it_cor->_east << "e," << - setprecision(3) << fixed << _it_cor->_north << "n "; - stn_cor << endl; + std::setw(HEIGHT) << std::setprecision(3) << std::fixed << std::right << _it_cor->_east << "e," << + std::setprecision(3) << std::fixed << _it_cor->_north << "n "; + stn_cor << std::endl; } stn_cor.close(); @@ -2826,17 +2826,17 @@ void dna_plot::PrintPlateBoundaries(const UINT32& block) // Tectonic plate boundaries v_string_v_doubledouble_pair global_plates; - stringstream ss; - ss << "PrintPlateBoundaries(): An error was encountered when loading tectonic plate information." << endl; + std::stringstream ss; + ss << "PrintPlateBoundaries(): An error was encountered when loading tectonic plate information." << std::endl; try { // Load tectonic plate polygons. Throws runtime_error on failure. tpb.load_tpb_file(pprj_->r.tpb_file, global_plates); - sort(global_plates.begin(), global_plates.end()); + std::sort(global_plates.begin(), global_plates.end()); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } UINT32 block_index(block); @@ -2848,19 +2848,19 @@ void dna_plot::PrintPlateBoundaries(const UINT32& block) // Create corrections file. Throws runtime_error on failure. file_opener(tectonic_plate, v_tectonic_plate_file_.at(block_index)); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionPlot(e.what(), 0, NULL); } for_each(global_plates.begin(), global_plates.end(), [&tectonic_plate](const string_v_doubledouble_pair& plate){ - tectonic_plate << ">" << endl; + tectonic_plate << ">" << std::endl; for_each(plate.second.begin(), plate.second.end(), [&tectonic_plate](const doubledouble_pair& coordinate){ - tectonic_plate << fixed << setprecision(3) << - setw(10) << right << coordinate.first << "," << - setw(10) << right << coordinate.second << endl; + tectonic_plate << std::fixed << std::setprecision(3) << + std::setw(10) << std::right << coordinate.first << "," << + std::setw(10) << std::right << coordinate.second << std::endl; }); }); @@ -2874,8 +2874,8 @@ void dna_plot::PrintMeasurementsDatFilesBlock(const UINT32& block) { v_msr_file_.at(block).clear(); - string type; - stringstream ss, filename; + std::string type; + std::stringstream ss, filename; std::ofstream msr_file_stream; @@ -2897,7 +2897,7 @@ void dna_plot::PrintMeasurementsDatFilesBlock(const UINT32& block) // Create msr data file. Throws runtime_error on failure. file_opener(msr_file_stream, v_msr_def_file_.back()); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionPlot(e.what(), 0, NULL); } @@ -2916,7 +2916,7 @@ void dna_plot::PrintMeasurementsDatFilesBlock(const UINT32& block) } } - vector::const_iterator _it_type; + std::vector::const_iterator _it_type; bool printOtherTypes(false); for (_it_type=_combined_msr_list.begin(); _it_type!=_combined_msr_list.end(); ++_it_type) { @@ -2945,7 +2945,7 @@ void dna_plot::PrintMeasurementsDatFilesBlock(const UINT32& block) // Create msr data file. Throws runtime_error on failure. file_opener(msr_file_stream, v_msr_all_file_.back()); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionPlot(e.what(), 0, NULL); } @@ -2979,20 +2979,20 @@ void dna_plot::PrintMeasurementsDatFiles() _combined_msr_list.push_back('Q'); // Geodetic longitude _combined_msr_list.push_back('R'); // Ellipsoidal height _combined_msr_list.push_back('S'); // Slope distance - _combined_msr_list.push_back('V'); // Zenith angle + _combined_msr_list.push_back('V'); // Zenith distance _combined_msr_list.push_back('X'); // GPS Baseline cluster _combined_msr_list.push_back('Y'); // GPS point cluster _combined_msr_list.push_back('Z'); // Vertical angle //vector::iterator _it_type(_combined_msr_list.end()); - string msr_file_name; + std::string msr_file_name; v_msr_file_.at(0).clear(); YClusterStations_.clear(); - string type; - stringstream ss; + std::string type; + std::stringstream ss; std::ofstream msr_file_stream; @@ -3012,7 +3012,7 @@ void dna_plot::PrintMeasurementsDatFiles() // Create msr data file. Throws runtime_error on failure. file_opener(msr_file_stream, msr_file_name); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionPlot(e.what(), 0, NULL); } @@ -3031,7 +3031,7 @@ void dna_plot::PrintMeasurementsDatFiles() } } - vector::const_iterator _it_type; + std::vector::const_iterator _it_type; bool printOtherTypes(false); for (_it_type=_combined_msr_list.begin(); _it_type!=_combined_msr_list.end(); ++_it_type) { @@ -3059,7 +3059,7 @@ void dna_plot::PrintMeasurementsDatFiles() // Create msr data file. Throws runtime_error on failure. file_opener(msr_file_stream, msr_file_name); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionPlot(e.what(), 0, NULL); } @@ -3088,13 +3088,13 @@ void dna_plot::PrintMeasurementsDatFileBlock(const UINT32& block, char msrType, UINT32 precision(10); bool FirstisWithinLimits, SecondisWithinLimits, ThirdisWithinLimits; - stringstream ss; + std::stringstream ss; it_vUINT32 _it_block_msr(v_CML_.at(block).begin()); vUINT32 msrIndices; it_vmsr_t _it_msr; - (*msr_file_stream) << ">" << endl; + (*msr_file_stream) << ">" << std::endl; for (_it_block_msr=v_CML_.at(block).begin(); _it_block_msrstation3).initialLongitude; + ss << std::setprecision(precision) << std::fixed << bstBinaryRecords_.at(_it_msr->station3).initialLongitude; ss << " "; - ss << setprecision(precision) << fixed << bstBinaryRecords_.at(_it_msr->station3).initialLatitude; - ss << endl; + ss << std::setprecision(precision) << std::fixed << bstBinaryRecords_.at(_it_msr->station3).initialLatitude; + ss << std::endl; // test if point is within limits of custom defined box if (!default_limits_) @@ -3143,7 +3143,7 @@ void dna_plot::PrintMeasurementsDatFileBlock(const UINT32& block, char msrType, case 'M': // MSL arc case 'S': // Slope distance case 'L': // Level difference - case 'V': // Zenith angle + case 'V': // Zenith distance case 'Z': // Vertical angle // Get the measurement indices involved in this measurement GetMsrIndices(bmsBinaryRecords_, *_it_block_msr, msrIndices); @@ -3170,16 +3170,16 @@ void dna_plot::PrintMeasurementsDatFileBlock(const UINT32& block, char msrType, (*msr_file_stream) << ss.str(); // First - (*msr_file_stream) << setprecision(precision) << fixed << bstBinaryRecords_.at(bmsBinaryRecords_.at(*msr).station1).initialLongitude; + (*msr_file_stream) << std::setprecision(precision) << std::fixed << bstBinaryRecords_.at(bmsBinaryRecords_.at(*msr).station1).initialLongitude; (*msr_file_stream) << " "; - (*msr_file_stream) << setprecision(precision) << fixed << bstBinaryRecords_.at(bmsBinaryRecords_.at(*msr).station1).initialLatitude; - (*msr_file_stream) << endl; + (*msr_file_stream) << std::setprecision(precision) << std::fixed << bstBinaryRecords_.at(bmsBinaryRecords_.at(*msr).station1).initialLatitude; + (*msr_file_stream) << std::endl; // Second - (*msr_file_stream) << setprecision(precision) << fixed << bstBinaryRecords_.at(bmsBinaryRecords_.at(*msr).station2).initialLongitude; + (*msr_file_stream) << std::setprecision(precision) << std::fixed << bstBinaryRecords_.at(bmsBinaryRecords_.at(*msr).station2).initialLongitude; (*msr_file_stream) << " "; - (*msr_file_stream) << setprecision(precision) << fixed << bstBinaryRecords_.at(bmsBinaryRecords_.at(*msr).station2).initialLatitude; - (*msr_file_stream) << endl << ">" << endl; + (*msr_file_stream) << std::setprecision(precision) << std::fixed << bstBinaryRecords_.at(bmsBinaryRecords_.at(*msr).station2).initialLatitude; + (*msr_file_stream) << std::endl << ">" << std::endl; } break; @@ -3197,10 +3197,10 @@ void dna_plot::PrintMeasurementsDatFileBlock(const UINT32& block, char msrType, continue; // First - (*msr_file_stream) << setprecision(precision) << fixed << bstBinaryRecords_.at(_it_msr->station1).initialLongitude; + (*msr_file_stream) << std::setprecision(precision) << std::fixed << bstBinaryRecords_.at(_it_msr->station1).initialLongitude; (*msr_file_stream) << " "; - (*msr_file_stream) << setprecision(precision) << fixed << bstBinaryRecords_.at(_it_msr->station1).initialLatitude; - (*msr_file_stream) << endl << ">" << endl; + (*msr_file_stream) << std::setprecision(precision) << std::fixed << bstBinaryRecords_.at(_it_msr->station1).initialLatitude; + (*msr_file_stream) << std::endl << ">" << std::endl; break; @@ -3221,10 +3221,10 @@ void dna_plot::PrintMeasurementsDatFileBlock(const UINT32& block, char msrType, continue; // First - (*msr_file_stream) << setprecision(precision) << fixed << bstBinaryRecords_.at(bmsBinaryRecords_.at(*msr).station1).initialLongitude; + (*msr_file_stream) << std::setprecision(precision) << std::fixed << bstBinaryRecords_.at(bmsBinaryRecords_.at(*msr).station1).initialLongitude; (*msr_file_stream) << " "; - (*msr_file_stream) << setprecision(precision) << fixed << bstBinaryRecords_.at(bmsBinaryRecords_.at(*msr).station1).initialLatitude; - (*msr_file_stream) << endl << ">" << endl; + (*msr_file_stream) << std::setprecision(precision) << std::fixed << bstBinaryRecords_.at(bmsBinaryRecords_.at(*msr).station1).initialLatitude; + (*msr_file_stream) << std::endl << ">" << std::endl; } } } @@ -3240,9 +3240,9 @@ void dna_plot::PrintMeasurementsDatFile(char msrType, std::ofstream* msr_file_st UINT32 precision(10); bool FirstisWithinLimits, SecondisWithinLimits, ThirdisWithinLimits; - stringstream ss; + std::stringstream ss; - (*msr_file_stream) << ">" << endl; + (*msr_file_stream) << ">" << std::endl; for (_it_msr=bmsBinaryRecords_.begin(); _it_msr!=bmsBinaryRecords_.end(); _it_msr++) { @@ -3261,10 +3261,10 @@ void dna_plot::PrintMeasurementsDatFile(char msrType, std::ofstream* msr_file_st // Print 3 - 1 - 2 // // Third - ss << setprecision(precision) << fixed << bstBinaryRecords_.at(_it_msr->station3).initialLongitude; + ss << std::setprecision(precision) << std::fixed << bstBinaryRecords_.at(_it_msr->station3).initialLongitude; ss << " "; - ss << setprecision(precision) << fixed << bstBinaryRecords_.at(_it_msr->station3).initialLatitude; - ss << endl; + ss << std::setprecision(precision) << std::fixed << bstBinaryRecords_.at(_it_msr->station3).initialLatitude; + ss << std::endl; // test if point is within limits of custom defined box if (!default_limits_) @@ -3289,7 +3289,7 @@ void dna_plot::PrintMeasurementsDatFile(char msrType, std::ofstream* msr_file_st case 'M': // MSL arc case 'S': // Slope distance case 'L': // Level difference - case 'V': // Zenith angle + case 'V': // Zenith distance case 'Z': // Vertical angle if (!default_limits_) @@ -3307,16 +3307,16 @@ void dna_plot::PrintMeasurementsDatFile(char msrType, std::ofstream* msr_file_st (*msr_file_stream) << ss.str(); // First - (*msr_file_stream) << setprecision(precision) << fixed << bstBinaryRecords_.at(_it_msr->station1).initialLongitude; + (*msr_file_stream) << std::setprecision(precision) << std::fixed << bstBinaryRecords_.at(_it_msr->station1).initialLongitude; (*msr_file_stream) << " "; - (*msr_file_stream) << setprecision(precision) << fixed << bstBinaryRecords_.at(_it_msr->station1).initialLatitude; - (*msr_file_stream) << endl; + (*msr_file_stream) << std::setprecision(precision) << std::fixed << bstBinaryRecords_.at(_it_msr->station1).initialLatitude; + (*msr_file_stream) << std::endl; // Second - (*msr_file_stream) << setprecision(precision) << fixed << bstBinaryRecords_.at(_it_msr->station2).initialLongitude; + (*msr_file_stream) << std::setprecision(precision) << std::fixed << bstBinaryRecords_.at(_it_msr->station2).initialLongitude; (*msr_file_stream) << " "; - (*msr_file_stream) << setprecision(precision) << fixed << bstBinaryRecords_.at(_it_msr->station2).initialLatitude; - (*msr_file_stream) << endl << ">" << endl; + (*msr_file_stream) << std::setprecision(precision) << std::fixed << bstBinaryRecords_.at(_it_msr->station2).initialLatitude; + (*msr_file_stream) << std::endl << ">" << std::endl; break; // single station @@ -3335,10 +3335,10 @@ void dna_plot::PrintMeasurementsDatFile(char msrType, std::ofstream* msr_file_st } // First - (*msr_file_stream) << setprecision(precision) << fixed << bstBinaryRecords_.at(_it_msr->station1).initialLongitude; + (*msr_file_stream) << std::setprecision(precision) << std::fixed << bstBinaryRecords_.at(_it_msr->station1).initialLongitude; (*msr_file_stream) << " "; - (*msr_file_stream) << setprecision(precision) << fixed << bstBinaryRecords_.at(_it_msr->station1).initialLatitude; - (*msr_file_stream) << endl << ">" << endl; + (*msr_file_stream) << std::setprecision(precision) << std::fixed << bstBinaryRecords_.at(_it_msr->station1).initialLatitude; + (*msr_file_stream) << std::endl << ">" << std::endl; break; case 'Y': // GPS point cluster @@ -3366,13 +3366,13 @@ void dna_plot::PrintMeasurementsDatFile(char msrType, std::ofstream* msr_file_st continue; YClusterStations_.push_back(_it_msr->station1); - sort(YClusterStations_.begin(), YClusterStations_.end()); + std::sort(YClusterStations_.begin(), YClusterStations_.end()); // First - (*msr_file_stream) << setprecision(precision) << fixed << bstBinaryRecords_.at(_it_msr->station1).initialLongitude; + (*msr_file_stream) << std::setprecision(precision) << std::fixed << bstBinaryRecords_.at(_it_msr->station1).initialLongitude; (*msr_file_stream) << " "; - (*msr_file_stream) << setprecision(precision) << fixed << bstBinaryRecords_.at(_it_msr->station1).initialLatitude; - (*msr_file_stream) << endl << ">" << endl; + (*msr_file_stream) << std::setprecision(precision) << std::fixed << bstBinaryRecords_.at(_it_msr->station1).initialLatitude; + (*msr_file_stream) << std::endl << ">" << std::endl; } } @@ -3386,11 +3386,11 @@ void dna_plot::PrintGMTParameters() try { for (; _it_vpstr!=pprj_->p._gmt_params.end(); _it_vpstr++) - gmtbat_file_ << _APP_GMTSET_ << " " << _it_vpstr->first << " " << _it_vpstr->second << endl; - gmtbat_file_ << endl; + gmtbat_file_ << _APP_GMTSET_ << " " << _it_vpstr->first << " " << _it_vpstr->second << std::endl; + gmtbat_file_ << std::endl; } - catch (const ios_base::failure& f) { - SignalExceptionPlot(static_cast(f.what()), 0, "o", &gmtbat_file_); + catch (const std::ios_base::failure& f) { + SignalExceptionPlot(static_cast(f.what()), 0, "o", &gmtbat_file_); } } @@ -3445,14 +3445,14 @@ void dna_plot::LoadBinaryFiles() dna_io_bms bms; bms.load_bms_file(projectSettings_.i.bms_file, &bmsBinaryRecords_, bms_meta_); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionPlot(e.what(), 0, NULL); } reference_frame_ = projectSettings_.i.reference_frame; try { - reference_frame_ = datumFromEpsgString(bst_meta_.epsgCode); + reference_frame_ = datumFromEpsgString(bst_meta_.epsgCode); } catch (...) { // do nothing @@ -3524,7 +3524,7 @@ void dna_plot::LoadBinaryFiles() case 'S': // Slope distance parsemsrTally_.S++; break; - case 'V': // Zenith angle + case 'V': // Zenith distance parsemsrTally_.V++; break; case 'X': // GPS Baseline cluster @@ -3560,7 +3560,7 @@ void dna_plot::LoadStationMap() dna_io_map map; map.load_map_file(projectSettings_.i.map_file, &stnsMap_); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionPlot(e.what(), 0, NULL); } } @@ -3582,7 +3582,7 @@ void dna_plot::LoadStationMap() // } // // // sort on station name (i.e. first of the pair) -// sort(stnsMap_.begin(), stnsMap_.end(), StationNameIDCompareName()); +// std::sort(stnsMap_.begin(), stnsMap_.end(), StationNameIDCompareName()); // // if (stnsMap_.size() < stnCount) // SignalExceptionPlot("SortandMapStations(): Could not allocate sufficient memory for the Station map.", 0, NULL); @@ -3602,17 +3602,17 @@ void dna_plot::LoadSegmentationFile() &v_measurementCount_, &v_unknownsCount_, &v_ContiguousNetList, &v_parameterStationCount); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionPlot(e.what(), 0, NULL); } if (projectSettings_.p._plot_block_number > blockCount_) { - stringstream ss; + std::stringstream ss; ss << "Specified block number (" << projectSettings_.p._plot_block_number << ") exceeds the total number of blocks (" << - blockCount_ << ")." << endl; + blockCount_ << ")." << std::endl; SignalExceptionPlot(ss.str(), 0, NULL); } @@ -3627,15 +3627,15 @@ void dna_plot::LoadPosUncertaintyFile() std::ifstream apu_file; try { // Load apu file. Throws runtime_error on failure. - file_opener(apu_file, projectSettings_.o._apu_file, ios::in, ascii, true); + file_opener(apu_file, projectSettings_.o._apu_file, std::ios::in, ascii, true); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionPlot(e.what(), 0, NULL); } bool fullCovarianceMatrix(false); UINT32 block(0), stn(0), stn_cov, blockstnCount; - string strLine; + std::string strLine; stationPosUncertainty_t posUnc; v_stn_pu_.resize(blockCount_); @@ -3660,41 +3660,43 @@ void dna_plot::LoadPosUncertaintyFile() apu_file.ignore(PRINT_LINE_LENGTH, '\n'); // File name apu_file.ignore(PRINT_LINE_LENGTH, '\n'); // apu_file.ignore(PRINT_LINE_LENGTH, '\n'); // PU Confidence interval + apu_file.ignore(PRINT_LINE_LENGTH, '\n'); // Error ellipse axes + apu_file.ignore(PRINT_LINE_LENGTH, '\n'); // Variances apu_file.getline(line, PRINT_LINE_LENGTH); // Stations printed in blocks - strLine = trimstr(string(line)); - if (!iequals(strLine.substr(0, 16), "Stations printed")) + strLine = trimstr(std::string(line)); + if (!boost::iequals(strLine.substr(0, 16), "Stations printed")) { - stringstream ss; - ss << "LoadPosUncertaintyFile(): " << projectSettings_.o._apu_file << " is corrupt." << endl; - ss << " Expected to find 'Stations printed in blocks' field." << endl; + std::stringstream ss; + ss << "LoadPosUncertaintyFile(): " << projectSettings_.o._apu_file << " is corrupt." << std::endl; + ss << " Expected to find 'Stations printed in blocks' field." << std::endl; SignalExceptionPlot(ss.str(), 0, "i", &apu_file); } - if ((dataBlocks = yesno_uint(strLine.substr(PRINT_VAR_PAD)))) + if ((dataBlocks = yesno_uint(strLine.substr(PRINT_VAR_PAD)))) v_stn_pu_.resize(bstBinaryRecords_.size()); else v_stn_pu_.reserve(bstBinaryRecords_.size()); apu_file.getline(line, PRINT_LINE_LENGTH); // Variance matrix units - strLine = trimstr(string(line)); - if (iequals(strLine.substr(PRINT_VAR_PAD, 3), "XYZ")) + strLine = trimstr(std::string(line)); + if (boost::iequals(strLine.substr(PRINT_VAR_PAD, 3), "XYZ")) vcv_units = XYZ_apu_ui; else vcv_units = ENU_apu_ui; apu_file.getline(line, PRINT_LINE_LENGTH); // Full covariance matrix - strLine = trimstr(string(line)); - if (!iequals(strLine.substr(0, 15), "Full covariance")) + strLine = trimstr(std::string(line)); + if (!boost::iequals(strLine.substr(0, 15), "Full covariance")) { - stringstream ss; - ss << "LoadPosUncertaintyFile(): " << projectSettings_.o._apu_file << " is corrupt." << endl; - ss << " Expected to find 'Full covariance matrix' field." << endl; + std::stringstream ss; + ss << "LoadPosUncertaintyFile(): " << projectSettings_.o._apu_file << " is corrupt." << std::endl; + ss << " Expected to find 'Full covariance matrix' field." << std::endl; SignalExceptionPlot(ss.str(), 0, "i", &apu_file); } - fullCovarianceMatrix = yesno_uint(strLine.substr(PRINT_VAR_PAD)); + fullCovarianceMatrix = yesno_uint(strLine.substr(PRINT_VAR_PAD)); // If covariances are printed, then the data will appear in blocks if (fullCovarianceMatrix) @@ -3714,21 +3716,21 @@ void dna_plot::LoadPosUncertaintyFile() apu_file.ignore(PRINT_LINE_LENGTH, '\n'); // apu_file.getline(line, PRINT_LINE_LENGTH); // Block # - strLine = trimstr(string(line)); + strLine = trimstr(std::string(line)); - if (!iequals(strLine.substr(0, 5), "Block")) + if (!boost::iequals(strLine.substr(0, 5), "Block")) { - stringstream ss; - ss << "LoadPosUncertaintyFile(): " << projectSettings_.o._apu_file << " is corrupt." << endl; - ss << " Expected to read Block data, but found " << strLine << endl; + std::stringstream ss; + ss << "LoadPosUncertaintyFile(): " << projectSettings_.o._apu_file << " is corrupt." << std::endl; + ss << " Expected to read Block data, but found " << strLine << std::endl; SignalExceptionPlot(ss.str(), 0, "i", &apu_file); } if (LongFromString(strLine.substr(6)) != block + 1) { - stringstream ss; - ss << "LoadPosUncertaintyFile(): " << projectSettings_.o._apu_file << " is corrupt." << endl; - ss << " Expected to read data for block " << strLine.substr(6) << ", but found " << strLine << endl; + std::stringstream ss; + ss << "LoadPosUncertaintyFile(): " << projectSettings_.o._apu_file << " is corrupt." << std::endl; + ss << " Expected to read data for block " << strLine.substr(6) << ", but found " << strLine << std::endl; SignalExceptionPlot(ss.str(), 0, "i", &apu_file); } } @@ -3745,7 +3747,7 @@ void dna_plot::LoadPosUncertaintyFile() { apu_file.getline(line, PRINT_LINE_LENGTH); // Now the data... - strLine = trimstr(string(line)); + strLine = trimstr(std::string(line)); if (strLine.length() < STATION) { if (apu_file.eof()) @@ -3767,7 +3769,7 @@ void dna_plot::LoadPosUncertaintyFile() // get yy from next row of variance matrix apu_file.getline(line, PRINT_LINE_LENGTH); - strLine = string(line); + strLine = std::string(line); posUnc._yy = DoubleFromString(trimstr(strLine.substr(STATION+PAD2+LAT_EAST+LON_NORTH+STAT+STAT+PREC+PREC+PREC+MSR, MSR))); posUnc._yz = DoubleFromString(trimstr(strLine.substr(STATION+PAD2+LAT_EAST+LON_NORTH+STAT+STAT+PREC+PREC+PREC+MSR+MSR, MSR))); @@ -3786,7 +3788,7 @@ void dna_plot::LoadPosUncertaintyFile() { // get yy from next row of variance matrix apu_file.getline(line, PRINT_LINE_LENGTH); - strLine = trimstr(string(line)); + strLine = trimstr(std::string(line)); posUnc._zz = DoubleFromString(trimstr(strLine)); vcv_cart.put(0, 0, posUnc._xx); @@ -3838,11 +3840,11 @@ void dna_plot::LoadPosUncertaintyFile() } } } - catch (const ios_base::failure& f) { + catch (const std::ios_base::failure& f) { if (!apu_file.eof()) { - stringstream ss; - ss << "LoadPosUncertaintyFile(): An error was encountered when reading " << projectSettings_.o._apu_file << "." << endl << " " << f.what(); + std::stringstream ss; + ss << "LoadPosUncertaintyFile(): An error was encountered when reading " << projectSettings_.o._apu_file << "." << std::endl << " " << f.what(); SignalExceptionPlot(ss.str(), 0, "i", &apu_file); } } @@ -3979,7 +3981,7 @@ void dna_plot::BuildParameterStationList() v_parameterStationList_.at(block) = v_ISL_.at(block); v_parameterStationList_.at(block).insert(v_parameterStationList_.at(block).end(), v_JSL_.at(block).begin(), v_JSL_.at(block).end()); - sort(v_parameterStationList_.at(block).begin(), v_parameterStationList_.at(block).end()); + std::sort(v_parameterStationList_.at(block).begin(), v_parameterStationList_.at(block).end()); } } @@ -3998,15 +4000,15 @@ void dna_plot::LoadCorrectionsFile() std::ifstream cor_file; try { // Load corrections file. Throws runtime_error on failure. - file_opener(cor_file, projectSettings_.o._cor_file, ios::in, ascii, true); + file_opener(cor_file, projectSettings_.o._cor_file, std::ios::in, ascii, true); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionPlot(e.what(), 0, NULL); } UINT32 correction_count(0); UINT32 block(0), stn(0), blockstnCount, corFileBlockCount(blockCount_); - string strLine; + std::string strLine; stationCorrections_t stnCor; average_correction_ = 0.0; @@ -4029,20 +4031,20 @@ void dna_plot::LoadCorrectionsFile() cor_file.getline(line, PRINT_LINE_LENGTH); // Stations printed in blocks // Get the yes/no string and convert to bool - strLine = trimstr(string(line)); - if (!iequals(strLine.substr(0, 16), "Stations printed")) + strLine = trimstr(std::string(line)); + if (!boost::iequals(strLine.substr(0, 16), "Stations printed")) { - stringstream ss; + std::stringstream ss; // TODO - make use of Boost current function // http://www.boost.org/doc/libs/1_58_0/boost/current_function.hpp // and if required, print the filename and line number using __FILE__ and __LINE__ // https://stackoverflow.com/questions/15305310/predefined-macros-for-function-name-func - ss << "LoadCorrectionsFile(): " << projectSettings_.o._cor_file << " is corrupt." << endl; - ss << " Expected to find 'Stations printed in blocks' field." << endl; + ss << "LoadCorrectionsFile(): " << projectSettings_.o._cor_file << " is corrupt." << std::endl; + ss << " Expected to find 'Stations printed in blocks' field." << std::endl; SignalExceptionPlot(ss.str(), 0, "i", &cor_file); } - if ((dataBlocks = yesno_uint(strLine.substr(PRINT_VAR_PAD)))) // Data printed in blocks? + if ((dataBlocks = yesno_uint(strLine.substr(PRINT_VAR_PAD)))) // Data printed in blocks? v_stn_corrs_.resize(bstBinaryRecords_.size()); else { @@ -4063,21 +4065,21 @@ void dna_plot::LoadCorrectionsFile() cor_file.ignore(PRINT_LINE_LENGTH, '\n'); // cor_file.getline(line, PRINT_LINE_LENGTH); // Block # - strLine = trimstr(string(line)); + strLine = trimstr(std::string(line)); - if (!iequals(strLine.substr(0, 5), "Block")) + if (!boost::iequals(strLine.substr(0, 5), "Block")) { - stringstream ss; - ss << "LoadCorrectionsFile(): " << projectSettings_.o._cor_file << " is corrupt." << endl; - ss << " Expected to read Block data, but found " << strLine << endl; + std::stringstream ss; + ss << "LoadCorrectionsFile(): " << projectSettings_.o._cor_file << " is corrupt." << std::endl; + ss << " Expected to read Block data, but found " << strLine << std::endl; SignalExceptionPlot(ss.str(), 0, "i", &cor_file); } if (LongFromString(strLine.substr(6)) != block + 1) { - stringstream ss; - ss << "LoadCorrectionsFile(): " << projectSettings_.o._cor_file << " is corrupt." << endl; - ss << " Expected to read data for block " << strLine.substr(6) << ", but found " << strLine << endl; + std::stringstream ss; + ss << "LoadCorrectionsFile(): " << projectSettings_.o._cor_file << " is corrupt." << std::endl; + ss << " Expected to read data for block " << strLine.substr(6) << ", but found " << strLine << std::endl; SignalExceptionPlot(ss.str(), 0, "i", &cor_file); } } @@ -4094,7 +4096,7 @@ void dna_plot::LoadCorrectionsFile() { cor_file.getline(line, PRINT_LINE_LENGTH); // Now the data... - strLine = trimstr(string(line)); + strLine = trimstr(std::string(line)); if (strLine.length() < STATION) { if (cor_file.eof()) @@ -4104,15 +4106,15 @@ void dna_plot::LoadCorrectionsFile() //// print... //// station and constraint - //os << setw(STATION) << left << bstBinaryRecords_.at(stn).stationName << setw(PAD2) << " "; + //os << std::setw(STATION) << std::left << bstBinaryRecords_.at(stn).stationName << std::setw(PAD2) << " "; //// data - //os << setw(MSR) << right << FormatDmsString(RadtoDms(azimuth), 4, true, false) << - // setw(MSR) << right << FormatDmsString(RadtoDms(vertical_angle), 4, true, false) << - // setw(MSR) << setprecision(PRECISION_MTR_STN) << fixed << right << slope_distance << - // setw(MSR) << setprecision(PRECISION_MTR_STN) << fixed << right << horiz_distance << - // setw(HEIGHT) << setprecision(PRECISION_MTR_STN) << fixed << right << local_12e << - // setw(HEIGHT) << setprecision(PRECISION_MTR_STN) << fixed << right << local_12n << - // setw(HEIGHT) << setprecision(PRECISION_MTR_STN) << fixed << right << local_12up << endl; + //os << std::setw(MSR) << std::right << FormatDmsString(RadtoDms(azimuth), 4, true, false) << + // std::setw(MSR) << std::right << FormatDmsString(RadtoDms(vertical_angle), 4, true, false) << + // std::setw(MSR) << std::setprecision(PRECISION_MTR_STN) << std::fixed << std::right << slope_distance << + // std::setw(MSR) << std::setprecision(PRECISION_MTR_STN) << std::fixed << std::right << horiz_distance << + // std::setw(HEIGHT) << std::setprecision(PRECISION_MTR_STN) << std::fixed << std::right << local_12e << + // std::setw(HEIGHT) << std::setprecision(PRECISION_MTR_STN) << std::fixed << std::right << local_12n << + // std::setw(HEIGHT) << std::setprecision(PRECISION_MTR_STN) << std::fixed << std::right << local_12up << std::endl; stnCor._station = trimstr(strLine.substr(0, STATION)); stnCor._azimuth = ParseDmsString(trimstr(strLine.substr(STATION+PAD2, MSR)), " "); @@ -4143,11 +4145,11 @@ void dna_plot::LoadCorrectionsFile() } } } - catch (const ios_base::failure& f) { + catch (const std::ios_base::failure& f) { if (!cor_file.eof()) { - stringstream ss; - ss << "LoadCorrectionsFile(): An error was encountered when reading " << projectSettings_.o._cor_file << "." << endl << " " << f.what(); + std::stringstream ss; + ss << "LoadCorrectionsFile(): An error was encountered when reading " << projectSettings_.o._cor_file << "." << std::endl << " " << f.what(); SignalExceptionPlot(ss.str(), 0, "i", &cor_file); } } @@ -4163,7 +4165,7 @@ void dna_plot::LoadCorrectionsFile() // Purpose: Closes all files (if file pointers are passed in) and throws runtime_error // Called by: Any // Calls: runtime_error() -void dna_plot::SignalExceptionPlot(const string& msg, const int& line_no, const char *streamType, ...) +void dna_plot::SignalExceptionPlot(const std::string& msg, const int& line_no, const char *streamType, ...) { plotStatus_ = PLOT_EXCEPTION_RAISED; @@ -4213,8 +4215,8 @@ void dna_plot::SignalExceptionPlot(const string& msg, const int& line_no, const // UINT32 precision; // _COORD_TYPE_ ctType; // -// vector* vdirns; -// vector* vgpsBsls; +// std::vector* vdirns; +// std::vector* vgpsBsls; // // for (; _it_msr!=vMeasurements->end(); _it_msr++) // { @@ -4229,23 +4231,23 @@ void dna_plot::SignalExceptionPlot(const string& msg, const int& line_no, const // // if (it_stnmap_range.first == it_stnmap_range.second) // { -// cout << _it_msr->get()->GetTarget2() << " is not in the list of network stations."; +// std::cout << _it_msr->get()->GetTarget2() << " is not in the list of network stations."; // continue; // } // precision = 3; // if ((ctType = vStations->at(it_stnmap_range.first->second)->GetMyCoordTypeC()) == LLH_type_i) // precision = 10; // -// osMsr << setprecision(precision) << fixed << +// osMsr << std::setprecision(precision) << std::fixed << // (ctType == LLH_type_i ? // Degrees(vStations->at(it_stnmap_range.first->second)->GetYAxis()) : // vStations->at(it_stnmap_range.first->second)->GetYAxis()); // osMsr << " "; -// osMsr << setprecision(precision) << fixed << +// osMsr << std::setprecision(precision) << std::fixed << // (ctType == LLH_type_i ? // Degrees(vStations->at(it_stnmap_range.first->second)->GetXAxis()) : // vStations->at(it_stnmap_range.first->second)->GetXAxis()); -// osMsr << endl; +// osMsr << std::endl; // case 'B': // Geodetic azimuth // case 'K': // Astronomic azimuth // case 'C': // Chord dist @@ -4253,7 +4255,7 @@ void dna_plot::SignalExceptionPlot(const string& msg, const int& line_no, const // case 'M': // MSL arc // case 'S': // Slope distance // case 'L': // Level difference -// case 'V': // Zenith angle +// case 'V': // Zenith distance // case 'Z': // Vertical angle // // First // it_stnmap_range = equal_range(stnsMap_.begin(), stnsMap_.end(), @@ -4261,17 +4263,17 @@ void dna_plot::SignalExceptionPlot(const string& msg, const int& line_no, const // // if (it_stnmap_range.first == it_stnmap_range.second) // { -// cout << _it_msr->get()->GetFirst() << " is not in the list of network stations."; +// std::cout << _it_msr->get()->GetFirst() << " is not in the list of network stations."; // continue; // } // precision = 3; // if ((ctType = vStations->at(it_stnmap_range.first->second)->GetMyCoordTypeC()) == LLH_type_i) // precision = 10; // -// osMsr << setprecision(precision) << fixed << (ctType == LLH_type_i ? Degrees(vStations->at(it_stnmap_range.first->second)->GetYAxis()): vStations->at(it_stnmap_range.first->second)->GetYAxis()); +// osMsr << std::setprecision(precision) << std::fixed << (ctType == LLH_type_i ? Degrees(vStations->at(it_stnmap_range.first->second)->GetYAxis()): vStations->at(it_stnmap_range.first->second)->GetYAxis()); // osMsr << " "; -// osMsr << setprecision(precision) << fixed << (ctType == LLH_type_i ? Degrees(vStations->at(it_stnmap_range.first->second)->GetXAxis()): vStations->at(it_stnmap_range.first->second)->GetXAxis()); -// osMsr << endl; +// osMsr << std::setprecision(precision) << std::fixed << (ctType == LLH_type_i ? Degrees(vStations->at(it_stnmap_range.first->second)->GetXAxis()): vStations->at(it_stnmap_range.first->second)->GetXAxis()); +// osMsr << std::endl; // // // Second // it_stnmap_range = equal_range(stnsMap_.begin(), stnsMap_.end(), @@ -4279,17 +4281,17 @@ void dna_plot::SignalExceptionPlot(const string& msg, const int& line_no, const // // if (it_stnmap_range.first == it_stnmap_range.second) // { -// cout << _it_msr->get()->GetTarget() << " is not in the list of network stations."; +// std::cout << _it_msr->get()->GetTarget() << " is not in the list of network stations."; // continue; // } // precision = 3; // if ((ctType = vStations->at(it_stnmap_range.first->second)->GetMyCoordTypeC()) == LLH_type_i) // precision = 10; // -// osMsr << setprecision(precision) << fixed << (ctType == LLH_type_i ? Degrees(vStations->at(it_stnmap_range.first->second)->GetYAxis()): vStations->at(it_stnmap_range.first->second)->GetYAxis()); +// osMsr << std::setprecision(precision) << std::fixed << (ctType == LLH_type_i ? Degrees(vStations->at(it_stnmap_range.first->second)->GetYAxis()): vStations->at(it_stnmap_range.first->second)->GetYAxis()); // osMsr << " "; -// osMsr << setprecision(precision) << fixed << (ctType == LLH_type_i ? Degrees(vStations->at(it_stnmap_range.first->second)->GetXAxis()): vStations->at(it_stnmap_range.first->second)->GetXAxis()); -// osMsr << endl << "#" << endl; +// osMsr << std::setprecision(precision) << std::fixed << (ctType == LLH_type_i ? Degrees(vStations->at(it_stnmap_range.first->second)->GetXAxis()): vStations->at(it_stnmap_range.first->second)->GetXAxis()); +// osMsr << std::endl << "#" << std::endl; // break; // case 'D': // Direction set // vdirns = _it_msr->get()->GetDirections_ptr(); @@ -4305,9 +4307,9 @@ void dna_plot::SignalExceptionPlot(const string& msg, const int& line_no, const //} // // -//void dna_plot::PrintGMTPlotCoords_D(vdnaStnPtr* vStations, vector* vDirections, ostream& osMsr) +//void dna_plot::PrintGMTPlotCoords_D(vdnaStnPtr* vStations, std::vector* vDirections, ostream& osMsr) //{ -// vector::iterator _it_dirn(vDirections->begin()); +// std::vector::iterator _it_dirn(vDirections->begin()); // //v_string_uint32_pair::iterator _it_stnmap(stnsMap_.begin()); // // UINT32 precision; @@ -4321,17 +4323,17 @@ void dna_plot::SignalExceptionPlot(const string& msg, const int& line_no, const // // if (it_stnmap_range.first == it_stnmap_range.second) // { -// cout << _it_dirn->GetFirst() << " is not in the list of network stations."; +// std::cout << _it_dirn->GetFirst() << " is not in the list of network stations."; // continue; // } // precision = 3; // if ((ctType = vStations->at(it_stnmap_range.first->second)->GetMyCoordTypeC()) == LLH_type_i) // precision = 10; // -// osMsr << setprecision(precision) << fixed << (ctType == LLH_type_i ? Degrees(vStations->at(it_stnmap_range.first->second)->GetYAxis()): vStations->at(it_stnmap_range.first->second)->GetYAxis()); +// osMsr << std::setprecision(precision) << std::fixed << (ctType == LLH_type_i ? Degrees(vStations->at(it_stnmap_range.first->second)->GetYAxis()): vStations->at(it_stnmap_range.first->second)->GetYAxis()); // osMsr << " "; -// osMsr << setprecision(precision) << fixed << (ctType == LLH_type_i ? Degrees(vStations->at(it_stnmap_range.first->second)->GetXAxis()): vStations->at(it_stnmap_range.first->second)->GetXAxis()); -// osMsr << endl; +// osMsr << std::setprecision(precision) << std::fixed << (ctType == LLH_type_i ? Degrees(vStations->at(it_stnmap_range.first->second)->GetXAxis()): vStations->at(it_stnmap_range.first->second)->GetXAxis()); +// osMsr << std::endl; // // // Second // it_stnmap_range = equal_range(stnsMap_.begin(), stnsMap_.end(), @@ -4339,24 +4341,24 @@ void dna_plot::SignalExceptionPlot(const string& msg, const int& line_no, const // // if (it_stnmap_range.first == it_stnmap_range.second) // { -// cout << _it_dirn->GetTarget() << " is not in the list of network stations."; +// std::cout << _it_dirn->GetTarget() << " is not in the list of network stations."; // continue; // } // precision = 3; // if ((ctType = vStations->at(it_stnmap_range.first->second)->GetMyCoordTypeC()) == LLH_type_i) // precision = 10; // -// osMsr << setprecision(precision) << fixed << (ctType == LLH_type_i ? Degrees(vStations->at(it_stnmap_range.first->second)->GetYAxis()): vStations->at(it_stnmap_range.first->second)->GetYAxis()); +// osMsr << std::setprecision(precision) << std::fixed << (ctType == LLH_type_i ? Degrees(vStations->at(it_stnmap_range.first->second)->GetYAxis()): vStations->at(it_stnmap_range.first->second)->GetYAxis()); // osMsr << " "; -// osMsr << setprecision(precision) << fixed << (ctType == LLH_type_i ? Degrees(vStations->at(it_stnmap_range.first->second)->GetXAxis()): vStations->at(it_stnmap_range.first->second)->GetXAxis()); -// osMsr << endl << "#" << endl; +// osMsr << std::setprecision(precision) << std::fixed << (ctType == LLH_type_i ? Degrees(vStations->at(it_stnmap_range.first->second)->GetXAxis()): vStations->at(it_stnmap_range.first->second)->GetXAxis()); +// osMsr << std::endl << "#" << std::endl; // } //} // // -//void dna_plot::PrintGMTPlotCoords_GX(vdnaStnPtr* vStations, vector* vGPSBaselines, ostream& osMsr) +//void dna_plot::PrintGMTPlotCoords_GX(vdnaStnPtr* vStations, std::vector* vGPSBaselines, ostream& osMsr) //{ -// vector::iterator _it_bsl(vGPSBaselines->begin()); +// std::vector::iterator _it_bsl(vGPSBaselines->begin()); // //v_string_uint32_pair::iterator _it_stnmap(stnsMap_.begin()); // // UINT32 precision; @@ -4370,17 +4372,17 @@ void dna_plot::SignalExceptionPlot(const string& msg, const int& line_no, const // // if (it_stnmap_range.first == it_stnmap_range.second) // { -// cout << _it_bsl->GetFirst() << " is not in the list of network stations."; +// std::cout << _it_bsl->GetFirst() << " is not in the list of network stations."; // continue; // } // precision = 3; // if ((ctType = vStations->at(it_stnmap_range.first->second)->GetMyCoordTypeC()) == LLH_type_i) // precision = 10; // -// osMsr << setprecision(precision) << fixed << (ctType == LLH_type_i ? Degrees(vStations->at(it_stnmap_range.first->second)->GetYAxis()): vStations->at(it_stnmap_range.first->second)->GetYAxis()); +// osMsr << std::setprecision(precision) << std::fixed << (ctType == LLH_type_i ? Degrees(vStations->at(it_stnmap_range.first->second)->GetYAxis()): vStations->at(it_stnmap_range.first->second)->GetYAxis()); // osMsr << " "; -// osMsr << setprecision(precision) << fixed << (ctType == LLH_type_i ? Degrees(vStations->at(it_stnmap_range.first->second)->GetXAxis()): vStations->at(it_stnmap_range.first->second)->GetXAxis()); -// osMsr << endl; +// osMsr << std::setprecision(precision) << std::fixed << (ctType == LLH_type_i ? Degrees(vStations->at(it_stnmap_range.first->second)->GetXAxis()): vStations->at(it_stnmap_range.first->second)->GetXAxis()); +// osMsr << std::endl; // // // Second // it_stnmap_range = equal_range(stnsMap_.begin(), stnsMap_.end(), @@ -4388,17 +4390,17 @@ void dna_plot::SignalExceptionPlot(const string& msg, const int& line_no, const // // if (it_stnmap_range.first == it_stnmap_range.second) // { -// cout << _it_bsl->GetTarget() << " is not in the list of network stations."; +// std::cout << _it_bsl->GetTarget() << " is not in the list of network stations."; // continue; // } // precision = 3; // if ((ctType = vStations->at(it_stnmap_range.first->second)->GetMyCoordTypeC()) == LLH_type_i) // precision = 10; // -// osMsr << setprecision(precision) << fixed << (ctType == LLH_type_i ? Degrees(vStations->at(it_stnmap_range.first->second)->GetYAxis()): vStations->at(it_stnmap_range.first->second)->GetYAxis()); +// osMsr << std::setprecision(precision) << std::fixed << (ctType == LLH_type_i ? Degrees(vStations->at(it_stnmap_range.first->second)->GetYAxis()): vStations->at(it_stnmap_range.first->second)->GetYAxis()); // osMsr << " "; -// osMsr << setprecision(precision) << fixed << (ctType == LLH_type_i ? Degrees(vStations->at(it_stnmap_range.first->second)->GetXAxis()): vStations->at(it_stnmap_range.first->second)->GetXAxis()); -// osMsr << endl << "#" << endl; +// osMsr << std::setprecision(precision) << std::fixed << (ctType == LLH_type_i ? Degrees(vStations->at(it_stnmap_range.first->second)->GetXAxis()): vStations->at(it_stnmap_range.first->second)->GetXAxis()); +// osMsr << std::endl << "#" << std::endl; // } //} @@ -4550,7 +4552,7 @@ void dna_plot::NormaliseGraticule(double& graticule_width_, UINT32& graticule_wi graticule_width_ = graticule / 3600.; } -void dna_plot::SelectCoastlineResolution(const double& dDimension, string& coastResolution, plot_settings* plotCriteria) +void dna_plot::SelectCoastlineResolution(const double& dDimension, std::string& coastResolution, plot_settings* plotCriteria) { plotCriteria->_coasline_resolution = low; coastResolution = "l"; diff --git a/dynadjust/dynadjust/dnaplot/dnaplot.hpp b/dynadjust/dynadjust/dnaplot/dnaplot.hpp index 295e6790..af70332a 100644 --- a/dynadjust/dynadjust/dnaplot/dnaplot.hpp +++ b/dynadjust/dynadjust/dnaplot/dnaplot.hpp @@ -83,11 +83,6 @@ #include #include -using namespace std; -using namespace boost; -using namespace boost::posix_time; -using namespace boost::filesystem; - using namespace dynadjust::measurements; using namespace dynadjust::epsg; using namespace dynadjust::exception; @@ -140,7 +135,7 @@ class dna_plot { // Gnuplot plotting methods void PlotGnuplotDatFileStns(); void PlotGnuplotDatFileMsrs(); - void PrintGnuplotCommandFile(const string& gnuplot_cmd_file, const plotGraphMode& graphMode); + void PrintGnuplotCommandFile(const std::string& gnuplot_cmd_file, const plotGraphMode& graphMode); void PrintGnuplotCommandFileStns(const UINT32& fontSize); void PrintGnuplotCommandFileMsrs(const UINT32& fontSize); @@ -179,11 +174,11 @@ class dna_plot { void FormGMTDataFileNames(const UINT32& block=0); void PrintGMTParameters(); - void PrintStationDataFile(ostream& os, it_vstn_t_const _it_stn); + void PrintStationDataFile(std::ostream& os, it_vstn_t_const _it_stn); void PrintStationsDataFile(); void PrintStationsDataFileBlock(const UINT32& block); - void PrintStationLabel(ostream& os, it_vstn_t_const _it_stn); + void PrintStationLabel(std::ostream& os, it_vstn_t_const _it_stn); void PrintStationLabels(); void PrintStationLabelsBlock(const UINT32& block); @@ -199,21 +194,21 @@ class dna_plot { void PrintMeasurementsDatFileBlock(const UINT32& block, char msrType, std::ofstream* msr_file_stream); //void PrintGMTPlotCoords(vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements, ostream& osStn, ostream& osStn2, ostream& osMsr); - //void PrintGMTPlotCoords_D(vdnaStnPtr* vStations, vector* vDirections, ostream& osMsr); - //void PrintGMTPlotCoords_GX(vdnaStnPtr* vStations, vector* vBaselines, ostream& osMsr); + //void PrintGMTPlotCoords_D(vdnaStnPtr* vStations, std::vector* vDirections, ostream& osMsr); + //void PrintGMTPlotCoords_GX(vdnaStnPtr* vStations, std::vector* vBaselines, ostream& osMsr); void CalculateLimitsFromStation(); void CalculateLimitsFromPoint(); void DetermineBoundingBox(); - void SignalExceptionPlot(const string& msg, const int& line_no, const char *streamType, ...); + void SignalExceptionPlot(const std::string& msg, const int& line_no, const char *streamType, ...); void ReduceStationCoordinates(station_t* stationRecord); void NormaliseScale(double& scale); void NormaliseScaleBar(double& scale_bar_width); void NormaliseGraticule(double& graticule_width, UINT32& graticule_width_precision); - void SelectCoastlineResolution(const double& dDimension, string& coastResolution, plot_settings* plotCriteria); + void SelectCoastlineResolution(const double& dDimension, std::string& coastResolution, plot_settings* plotCriteria); bool WithinLimits(const double& latitude, const double& longitude); @@ -225,19 +220,19 @@ class dna_plot { std::ofstream gnuplotbat_file_; MsrTally parsemsrTally_; // total network tally - vector v_msr_tally_; // per block tally + std::vector v_msr_tally_; // per block tally vstn_t bstBinaryRecords_; vmsr_t bmsBinaryRecords_; binary_file_meta_t bst_meta_; binary_file_meta_t bms_meta_; - string output_folder_; - string network_name_; + std::string output_folder_; + std::string network_name_; v_string_uint32_pair stnsMap_; // Station Name Map sorted on name (string) _PLOT_STATUS_ plotStatus_; project_settings projectSettings_; project_settings* pprj_; - string reference_frame_; + std::string reference_frame_; double lowerDeg_; double leftDeg_; @@ -267,8 +262,8 @@ class dna_plot { double default_paper_width_; double default_paper_height_; - string seg_stn_graph_file_; - string seg_msr_graph_file_; + std::string seg_stn_graph_file_; + std::string seg_msr_graph_file_; vstring v_isl_pts_file_; vstring v_isl_const_file_; @@ -311,34 +306,34 @@ class dna_plot { vUINT32 v_measurementCount_; // number of raw measurements and constrained stations vUINT32 v_unknownsCount_; // number of all stations (constrained and free) - string _APP_GMTSET_; - string _APP_PSCOAST_; - string _APP_PSCONVERT_; - string _APP_PSTEXT_; - string _APP_PSVELO_; - string _APP_PSXY_; - string _APP_PSLEGEND_; - string _PDF_AGGREGATE_; - string _CMD_EXT_; - string _ECHO_CMD_; - string _LEGEND_ECHO_; - string _LEGEND_CMD_1_; - string _LEGEND_CMD_2_; - - string _COMMENT_PREFIX_; - - string _CMD_HEADER_; - string _DELETE_CMD_; - string _CHMOD_CMD_; - string _COPY_CMD_; - string _MOVE_CMD_; - string _NULL_OUTPUT_; - string _MAKEDIR_CMD_; - string _RMDIR_CMD_; - string _MAKEENV_CMD_; - string _MAKETEMP_CMD_; - string _ENV_GMT_TMP_DIR_; - string _GMT_TMP_DIR_; + std::string _APP_GMTSET_; + std::string _APP_PSCOAST_; + std::string _APP_PSCONVERT_; + std::string _APP_PSTEXT_; + std::string _APP_PSVELO_; + std::string _APP_PSXY_; + std::string _APP_PSLEGEND_; + std::string _PDF_AGGREGATE_; + std::string _CMD_EXT_; + std::string _ECHO_CMD_; + std::string _LEGEND_ECHO_; + std::string _LEGEND_CMD_1_; + std::string _LEGEND_CMD_2_; + + std::string _COMMENT_PREFIX_; + + std::string _CMD_HEADER_; + std::string _DELETE_CMD_; + std::string _CHMOD_CMD_; + std::string _COPY_CMD_; + std::string _MOVE_CMD_; + std::string _NULL_OUTPUT_; + std::string _MAKEDIR_CMD_; + std::string _RMDIR_CMD_; + std::string _MAKEENV_CMD_; + std::string _MAKETEMP_CMD_; + std::string _ENV_GMT_TMP_DIR_; + std::string _GMT_TMP_DIR_; double dWidth_; double dHeight_; @@ -357,7 +352,7 @@ class dna_plot { double circle_radius_2_; double circle_line_width_; - string coastResolution_; + std::string coastResolution_; }; diff --git a/dynadjust/dynadjust/dnaplotwrapper/dnaplotwrapper.cpp b/dynadjust/dynadjust/dnaplotwrapper/dnaplotwrapper.cpp index 1d1e3952..4300d983 100644 --- a/dynadjust/dynadjust/dnaplotwrapper/dnaplotwrapper.cpp +++ b/dynadjust/dynadjust/dnaplotwrapper/dnaplotwrapper.cpp @@ -24,7 +24,7 @@ void ProcessGnuPlot(dna_plot* plotDynaML, project_settings& p, plotGraphMode mode) { - string str_mode; + std::string str_mode; switch (mode) { case StationsMode: @@ -37,34 +37,34 @@ void ProcessGnuPlot(dna_plot* plotDynaML, project_settings& p, plotGraphMode mod if (p.g.verbose > 0 || p.g.quiet != 1) { - cout << "+ Preparing the " << str_mode << " histogram via gnuplot... "; - cout.flush(); + std::cout << "+ Preparing the " << str_mode << " histogram via gnuplot... "; + std::cout.flush(); } plotDynaML->CreategnuplotGraphEnvironment(&p, mode); if (p.g.verbose > 0 || p.g.quiet != 1) { - cout << "done." << endl << endl; + std::cout << "done." << std::endl << std::endl; - cout << setw(PRINT_VAR_PAD) << "+ Plot details:" << endl; - cout << setw(PRINT_VAR_PAD) << " PDF file name:" << p.p._pdf_file_name << endl; + std::cout << std::setw(PRINT_VAR_PAD) << "+ Plot details:" << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << " PDF file name:" << p.p._pdf_file_name << std::endl; if (p.p._supress_pdf_creation || p.p._keep_gen_files) { #if defined(_WIN32) || defined(__WIN32__) - cout << setw(PRINT_VAR_PAD) << " Batch file:" << p.p._gnuplot_cmd_file << endl; + std::cout << std::setw(PRINT_VAR_PAD) << " Batch file:" << p.p._gnuplot_cmd_file << std::endl; #elif defined(__linux) || defined(sun) || defined(__unix__) || defined(__APPLE__) - cout << setw(PRINT_VAR_PAD) << " Shell script:" << p.p._gnuplot_cmd_file << endl; + std::cout << std::setw(PRINT_VAR_PAD) << " Shell script:" << p.p._gnuplot_cmd_file << std::endl; #endif } - cout << setw(PRINT_VAR_PAD) << " Block threshold:" << plotDynaML->blockThreshold() << endl; - cout << setw(PRINT_VAR_PAD) << " Min inner stns:" << plotDynaML->minInnerStns() << endl; - cout << setw(PRINT_VAR_PAD) << " Block count:" << plotDynaML->blockCount() << endl; - cout << setw(PRINT_VAR_PAD) << " Station count:" << plotDynaML->stationCount() << endl; - cout << setw(PRINT_VAR_PAD) << " Measurement count:" << plotDynaML->measurementCount() << endl; - cout << setw(PRINT_VAR_PAD) << " Measurement categories:" << plotDynaML->measurementCategories() << endl; + std::cout << std::setw(PRINT_VAR_PAD) << " Block threshold:" << plotDynaML->blockThreshold() << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << " Min inner stns:" << plotDynaML->minInnerStns() << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << " Block count:" << plotDynaML->blockCount() << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << " Station count:" << plotDynaML->stationCount() << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << " Measurement count:" << plotDynaML->measurementCount() << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << " Measurement categories:" << plotDynaML->measurementCategories() << std::endl; - cout << endl; + std::cout << std::endl; } @@ -74,22 +74,22 @@ void ProcessGnuPlot(dna_plot* plotDynaML, project_settings& p, plotGraphMode mod { if (p.g.verbose > 0 || p.g.quiet != 1) { - cout << "+ The input data files and " << + std::cout << "+ The input data files and " << #if defined(_WIN32) || defined(__WIN32__) "batch file"; #elif defined(__linux) || defined(sun) || defined(__unix__) || defined(__APPLE__) "shell script"; #endif - cout << " to create the final PDF histogram" << endl << - " via gnuplot have been generated." << endl; - cout << "+ To configure the histogram's font sizes, colours, scale, annotations, etc.," << endl << + std::cout << " to create the final PDF histogram" << std::endl << + " via gnuplot have been generated." << std::endl; + std::cout << "+ To configure the histogram's font sizes, colours, scale, annotations, etc.," << std::endl << " edit the " << #if defined(_WIN32) || defined(__WIN32__) "batch file"; #elif defined(__linux) || defined(sun) || defined(__unix__) || defined(__APPLE__) "shell script"; #endif - cout << " directly and execute as normal." << endl << endl; + std::cout << " directly and execute as normal." << std::endl << std::endl; } return; @@ -97,8 +97,8 @@ void ProcessGnuPlot(dna_plot* plotDynaML, project_settings& p, plotGraphMode mod if (p.g.verbose > 0 || p.g.quiet != 1) { - cout << "+ Creating the PDF... "; - cout.flush(); + std::cout << "+ Creating the PDF... "; + std::cout.flush(); } // Invoke gnuplot to create the PDF plot. @@ -108,19 +108,19 @@ void ProcessGnuPlot(dna_plot* plotDynaML, project_settings& p, plotGraphMode mod if (p.g.verbose > 0 || p.g.quiet != 1) { - cout << "done." << endl << endl; - cout << "+ Open " << p.p._pdf_file_name << " to view the PDF " << - str_mode << " histogram." << endl << endl; - cout.flush(); + std::cout << "done." << std::endl << std::endl; + std::cout << "+ Open " << p.p._pdf_file_name << " to view the PDF " << + str_mode << " histogram." << std::endl << std::endl; + std::cout.flush(); } } -void ProcessGMTPlot(dna_plot* plotDynaML, project_settings& p, string& measurement_types) +void ProcessGMTPlot(dna_plot* plotDynaML, project_settings& p, std::string& measurement_types) { if (p.g.verbose > 0 || p.g.quiet != 1) { - cout << "+ Preparing shell script and data files in GMT format... "; - cout.flush(); + std::cout << "+ Preparing shell script and data files in GMT format... "; + std::cout.flush(); } p.p._gmt_params.clear(); @@ -184,72 +184,72 @@ void ProcessGMTPlot(dna_plot* plotDynaML, project_settings& p, string& measureme plotDynaML->CreateGMTPlotEnvironment(&p); if (p.g.verbose > 0 || p.g.quiet != 1) { - cout << "done." << endl << endl; + std::cout << "done." << std::endl << std::endl; - cout << setw(PRINT_VAR_PAD) << "+ Plot details:" << endl; - cout << setw(PRINT_VAR_PAD) << " PDF file name:" << p.p._pdf_file_name << endl; + std::cout << std::setw(PRINT_VAR_PAD) << "+ Plot details:" << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << " PDF file name:" << p.p._pdf_file_name << std::endl; if (p.p._export_png) - cout << setw(PRINT_VAR_PAD) << " Export to png:" << "Yes" << endl; + std::cout << std::setw(PRINT_VAR_PAD) << " Export to png:" << "Yes" << std::endl; if (p.p._supress_pdf_creation || p.p._keep_gen_files) { #if defined(_WIN32) || defined(__WIN32__) if (p.p._plot_phased_blocks && p.p._plot_block_number < 1) - cout << setw(PRINT_VAR_PAD) << " Batch files:" << p.p._gmt_cmd_file << "..." << endl; + std::cout << std::setw(PRINT_VAR_PAD) << " Batch files:" << p.p._gmt_cmd_file << "..." << std::endl; else - cout << setw(PRINT_VAR_PAD) << " Batch file:" << p.p._gmt_cmd_file << endl; + std::cout << std::setw(PRINT_VAR_PAD) << " Batch file:" << p.p._gmt_cmd_file << std::endl; #elif defined(__linux) || defined(sun) || defined(__unix__) || defined(__APPLE__) if (p.p._plot_phased_blocks && p.p._plot_block_number < 1) - cout << setw(PRINT_VAR_PAD) << " Shell scripts:" << p.p._gmt_cmd_file << "..." << endl; + std::cout << std::setw(PRINT_VAR_PAD) << " Shell scripts:" << p.p._gmt_cmd_file << "..." << std::endl; else - cout << setw(PRINT_VAR_PAD) << " Shell script:" << p.p._gmt_cmd_file << endl; + std::cout << std::setw(PRINT_VAR_PAD) << " Shell script:" << p.p._gmt_cmd_file << std::endl; #endif } if (!measurement_types.empty()) - cout << setw(PRINT_VAR_PAD) << left << " Measurement types: " << measurement_types << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Measurement types: " << measurement_types << std::endl; if (p.p._plot_station_labels) - cout << setw(PRINT_VAR_PAD) << " Label stations:" << "Yes" << endl; + std::cout << std::setw(PRINT_VAR_PAD) << " Label stations:" << "Yes" << std::endl; if (p.p._plot_alt_name) - cout << setw(PRINT_VAR_PAD) << " Use alternate name:" << "Yes" << endl; + std::cout << std::setw(PRINT_VAR_PAD) << " Use alternate name:" << "Yes" << std::endl; if (p.p._plot_station_constraints) - cout << setw(PRINT_VAR_PAD) << " Label constraints:" << "Yes" << endl; + std::cout << std::setw(PRINT_VAR_PAD) << " Label constraints:" << "Yes" << std::endl; if (p.p._plot_correction_arrows) - cout << setw(PRINT_VAR_PAD) << " Plot correction arrows:" << "Yes" << endl; + std::cout << std::setw(PRINT_VAR_PAD) << " Plot correction arrows:" << "Yes" << std::endl; if (p.p._plot_correction_labels) - cout << setw(PRINT_VAR_PAD) << " Label corrections:" << "Yes" << endl; + std::cout << std::setw(PRINT_VAR_PAD) << " Label corrections:" << "Yes" << std::endl; if (p.p._plot_error_ellipses) - cout << setw(PRINT_VAR_PAD) << " Plot error ellipses:" << "Yes" << endl; + std::cout << std::setw(PRINT_VAR_PAD) << " Plot error ellipses:" << "Yes" << std::endl; if (p.p._plot_positional_uncertainty) - cout << setw(PRINT_VAR_PAD) << " Plot positional uncertainty:" << "Yes" << endl; + std::cout << std::setw(PRINT_VAR_PAD) << " Plot positional uncertainty:" << "Yes" << std::endl; if (!are_floats_equal(p.p._correction_scale, 1.)) - cout << setw(PRINT_VAR_PAD) << left << " Scale correction arrows: " << fixed << setprecision(3) << p.p._correction_scale << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Scale correction arrows: " << std::fixed << std::setprecision(3) << p.p._correction_scale << std::endl; if (!are_floats_equal(p.p._pu_ellipse_scale, 1.)) - cout << setw(PRINT_VAR_PAD) << left << " Scale uncertainties/ellipses: " << fixed << setprecision(3) << p.p._pu_ellipse_scale << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Scale uncertainties/ellipses: " << std::fixed << std::setprecision(3) << p.p._pu_ellipse_scale << std::endl; if (!p.p._bounding_box.empty()) - cout << setw(PRINT_VAR_PAD) << left << " Bounding box: " << p.p._bounding_box << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Bounding box: " << p.p._bounding_box << std::endl; else { if (!p.p._plot_station_centre.empty()) - cout << setw(PRINT_VAR_PAD) << " Centre on Station:" << p.p._plot_station_centre << endl; + std::cout << std::setw(PRINT_VAR_PAD) << " Centre on Station:" << p.p._plot_station_centre << std::endl; else { if (!are_floats_equal(p.p._plot_centre_latitude, -999.)) - cout << setw(PRINT_VAR_PAD) << " Centre latitude:" << fixed << setprecision(9) << FormatDmsString(DegtoDms(p.p._plot_centre_latitude), 4, true, true) << endl; + std::cout << std::setw(PRINT_VAR_PAD) << " Centre latitude:" << std::fixed << std::setprecision(9) << FormatDmsString(DegtoDms(p.p._plot_centre_latitude), 4, true, true) << std::endl; if (!are_floats_equal(p.p._plot_centre_longitude, -999.)) - cout << setw(PRINT_VAR_PAD) << " Centre longitude:" << fixed << setprecision(9) << FormatDmsString(DegtoDms(p.p._plot_centre_longitude), 4, true, true) << endl; + std::cout << std::setw(PRINT_VAR_PAD) << " Centre longitude:" << std::fixed << std::setprecision(9) << FormatDmsString(DegtoDms(p.p._plot_centre_longitude), 4, true, true) << std::endl; } if (!are_floats_equal(p.p._plot_area_radius, 5000.)) - cout << setw(PRINT_VAR_PAD) << " Area radius:" << fixed << setprecision(2) << p.p._plot_area_radius << " metres" << endl; + std::cout << std::setw(PRINT_VAR_PAD) << " Area radius:" << std::fixed << std::setprecision(2) << p.p._plot_area_radius << " metres" << std::endl; } - cout << setw(PRINT_VAR_PAD) << " Map projection:" << projectionTypes[p.p._projection] << endl; - cout << setw(PRINT_VAR_PAD) << " Ground width:" << fixed << setprecision(4) << p.p._ground_width / 1000. << " kilometres" << endl; - cout << setw(PRINT_VAR_PAD) << " Page width:" << fixed << setprecision(2) << p.p._page_width << " centimetres" << endl; - cout << setw(PRINT_VAR_PAD) << " Coastline resolution:" << coastResolutionTypes[p.p._coasline_resolution] << endl; - cout << setw(PRINT_VAR_PAD) << " Scale:" << "1:" << fixed << setprecision(0) << p.p._plot_scale << endl; - cout << setw(PRINT_VAR_PAD) << " Label font size:" << fixed << setprecision(0) << p.p._label_font_size << endl; + std::cout << std::setw(PRINT_VAR_PAD) << " Map projection:" << projectionTypes[p.p._projection] << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << " Ground width:" << std::fixed << std::setprecision(4) << p.p._ground_width / 1000. << " kilometres" << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << " Page width:" << std::fixed << std::setprecision(2) << p.p._page_width << " centimetres" << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << " Coastline resolution:" << coastResolutionTypes[p.p._coasline_resolution] << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << " Scale:" << "1:" << std::fixed << std::setprecision(0) << p.p._plot_scale << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << " Label font size:" << std::fixed << std::setprecision(0) << p.p._label_font_size << std::endl; - cout << endl; + std::cout << std::endl; } // Does the user not want to create the PDf plots? @@ -257,17 +257,17 @@ void ProcessGMTPlot(dna_plot* plotDynaML, project_settings& p, string& measureme { if (p.g.verbose > 0 || p.g.quiet != 1) { - cout << "+ The input data files and " << + std::cout << "+ The input data files and " << #if defined(_WIN32) || defined(__WIN32__) "batch file"; #elif defined(__linux) || defined(sun) || defined(__unix__) || defined(__APPLE__) "shell script"; #endif if (p.p._plot_phased_blocks && p.p._plot_block_number < 1) - cout << "s"; + std::cout << "s"; - cout << " to create the final PDF plot" << endl << " via GMT have been generated." << endl; - cout << "+ To configure the plot's font sizes, colours, scale, annotations, etc.," << endl << + std::cout << " to create the final PDF plot" << std::endl << " via GMT have been generated." << std::endl; + std::cout << "+ To configure the plot's font sizes, colours, scale, annotations, etc.," << std::endl << " edit the " << #if defined(_WIN32) || defined(__WIN32__) "batch file"; @@ -275,8 +275,8 @@ void ProcessGMTPlot(dna_plot* plotDynaML, project_settings& p, string& measureme "shell script"; #endif if (p.p._plot_phased_blocks && p.p._plot_block_number < 1) - cout << "s"; - cout << " directly and execute as normal." << endl << endl; + std::cout << "s"; + std::cout << " directly and execute as normal." << std::endl << std::endl; } return; @@ -285,8 +285,8 @@ void ProcessGMTPlot(dna_plot* plotDynaML, project_settings& p, string& measureme // create the PDF image.. if (p.g.verbose > 0 || p.g.quiet != 1) { - cout << "+ Generating PDF via GMT... "; - cout.flush(); + std::cout << "+ Generating PDF via GMT... "; + std::cout.flush(); } // Invoke concurrent GMT process to create the PDF plot. @@ -299,9 +299,9 @@ void ProcessGMTPlot(dna_plot* plotDynaML, project_settings& p, string& measureme if (p.g.verbose > 0 || p.g.quiet != 1) { - cout << "done." << endl << endl << - "+ Open " << p.p._pdf_file_name << " to view the final PDF plot." << endl << endl; - cout.flush(); + std::cout << "done." << std::endl << std::endl << + "+ Open " << p.p._pdf_file_name << " to view the final PDF plot." << std::endl << std::endl; + std::cout.flush(); } } @@ -309,52 +309,52 @@ void ProcessGMTPlot(dna_plot* plotDynaML, project_settings& p, string& measureme int main(int argc, char* argv[]) { // create banner message - string cmd_line_banner, tmp; + std::string cmd_line_banner, tmp; fileproc_help_header(&cmd_line_banner); - string stnfilename, msrfilename, measurement_types; + std::string stnfilename, msrfilename, measurement_types; project_settings p; - variables_map vm; - positional_options_description positional_options; + boost::program_options::variables_map vm; + boost::program_options::positional_options_description positional_options; - options_description standard_options("+ " + string(ALL_MODULE_STDOPT), PROGRAM_OPTIONS_LINE_LENGTH); - options_description config_options("+ " + string(PLOT_MODULE_CONFIG), PROGRAM_OPTIONS_LINE_LENGTH); - options_description titleblock_options("+ " + string(PLOT_MODULE_TITLEBLOCK), PROGRAM_OPTIONS_LINE_LENGTH); - options_description map_options("+ " + string(PLOT_MODULE_MAP), PROGRAM_OPTIONS_LINE_LENGTH); - options_description generic_options("+ " + string(ALL_MODULE_GENERIC), PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description standard_options("+ " + std::string(ALL_MODULE_STDOPT), PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description config_options("+ " + std::string(PLOT_MODULE_CONFIG), PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description titleblock_options("+ " + std::string(PLOT_MODULE_TITLEBLOCK), PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description map_options("+ " + std::string(PLOT_MODULE_MAP), PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description generic_options("+ " + std::string(ALL_MODULE_GENERIC), PROGRAM_OPTIONS_LINE_LENGTH); tmp = "+ "; tmp.append(__BINARY_NAME__).append(" usage: ").append(__BINARY_NAME__).append(" ").append(NETWORK_NAME).append(" [options]"); - options_description allowable_options(tmp, PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description allowable_options(tmp, PROGRAM_OPTIONS_LINE_LENGTH); try { // Declare a group of options that will be // allowed only on command line generic_options.add_options() - (VERBOSE, value(&p.g.verbose), - string("Give detailed information about what ").append(__BINARY_NAME__).append(" is doing.\n 0: No information (default)\n 1: Helpful information\n 2: Extended information\n 3: Debug level information").c_str()) + (VERBOSE, boost::program_options::value(&p.g.verbose), + std::string("Give detailed information about what ").append(__BINARY_NAME__).append(" is doing.\n 0: No information (default)\n 1: Helpful information\n 2: Extended information\n 3: Debug level information").c_str()) (QUIET, - string("Suppresses all explanation of what ").append(__BINARY_NAME__).append(" is doing unless an error occurs").c_str()) + std::string("Suppresses all explanation of what ").append(__BINARY_NAME__).append(" is doing unless an error occurs").c_str()) (VERSION_V, "Display the current program version") (HELP_H, "Show this help message") - (HELP_MODULE, value(), + (HELP_MODULE_H, boost::program_options::value(), "Provide help for a specific help category.") ; standard_options.add_options() - (PROJECT_FILE_P, value(&p.g.project_file), + (PROJECT_FILE_P, boost::program_options::value(&p.g.project_file), "Project file name. Full path to project file. If none specified, a new file is created using input-folder and network-name.") - (NETWORK_NAME_N, value(&p.g.network_name), + (NETWORK_NAME_N, boost::program_options::value(&p.g.network_name), "Network name. User defined name for all output files. Default is \"network#\".") - (INPUT_FOLDER_I, value(&p.g.input_folder), + (INPUT_FOLDER_I, boost::program_options::value(&p.g.input_folder), "Path containing all input files") - (OUTPUT_FOLDER_O, value(&p.g.output_folder), // default is ./, + (OUTPUT_FOLDER_O, boost::program_options::value(&p.g.output_folder), // default is ./, "Path for all output files") - (BIN_STN_FILE, value(&p.i.bst_file), + (BIN_STN_FILE, boost::program_options::value(&p.i.bst_file), "Binary station file name. Overrides network name.") - (BIN_MSR_FILE, value(&p.i.bms_file), + (BIN_MSR_FILE, boost::program_options::value(&p.i.bms_file), "Binary measurement file name. Overrides network name.") ; @@ -362,15 +362,15 @@ int main(int argc, char* argv[]) // allowed both on command line and in // config file config_options.add_options() - (PLOT_MSRS, value(&measurement_types), + (PLOT_MSRS, boost::program_options::value(&measurement_types), "Plot the specified measurement types. arg is a non-delimited string of measurement types (eg \"GXY\").") (PLOT_MSRS_IGNORED, "Plot ignored measurements.") (PLOT_BLOCKS, "Plot the blocks of a segmented network in individual sheets. Requires a corresponding segmentation file.") - (SEG_FILE, value(&p.s.seg_file), + (SEG_FILE, boost::program_options::value(&p.s.seg_file), "Network segmentation file. Filename overrides network name.") - (BLOCK_NUMBER, value(&p.p._plot_block_number), + (BLOCK_NUMBER, boost::program_options::value(&p.p._plot_block_number), "When plotting phased adjustments, plot this block only. Zero (default) plots all blocks.") (PLOT_STN_LABELS, "Plot the station labels.") @@ -390,24 +390,24 @@ int main(int argc, char* argv[]) "Plot error ellipses.") (PLOT_POSITIONAL_UNCERTAINTY, "Plot positional uncertainty.") - (CORRECTION_SCALE, value(&p.p._correction_scale), + (CORRECTION_SCALE, boost::program_options::value(&p.p._correction_scale), "The amount by which to scale the size of the correction arrows.") - (PU_ELLIPSE_SCALE, value(&p.p._pu_ellipse_scale), + (PU_ELLIPSE_SCALE, boost::program_options::value(&p.p._pu_ellipse_scale), "The amount by which to scale the size of error ellipses and positional uncertainty cirlces.") - (BOUNDING_BOX, value(&p.p._bounding_box), + (BOUNDING_BOX, boost::program_options::value(&p.p._bounding_box), "Plot stations and measurements within bounding box. arg is a comma delimited string \"lat1,lon1,lat2,lon2\" (in dd.mmss) defining the upper-left and lower-right limits.") - (PLOT_CENTRE_LAT, value(&p.p._plot_centre_latitude), + (PLOT_CENTRE_LAT, boost::program_options::value(&p.p._plot_centre_latitude), "Centre the plot according to this latitude. Format: dd.mmsssss") - (PLOT_CENTRE_LON, value(&p.p._plot_centre_longitude), + (PLOT_CENTRE_LON, boost::program_options::value(&p.p._plot_centre_longitude), "Centre the plot according to this longitude. Format: ddd.mmsssss") - (PLOT_CENTRE_STATION, value(&p.p._plot_station_centre), - (string("The station name upon which to centre the plot. The plot area is circumscribed by ")+ - string(PLOT_AREA_RADIUS)+string(".")).c_str()) - (PLOT_AREA_RADIUS, value(&p.p._plot_area_radius), - (string("The radius (in metres) of an area to bound the plot. Default is ")+ - StringFromT(p.p._plot_area_radius)+string("m")).c_str()) - (TECTONIC_PLATE_BDY_FILE, value(&p.r.tpb_file), - string("Plot global tectonic plate boundaries.").c_str()) + (PLOT_CENTRE_STATION, boost::program_options::value(&p.p._plot_station_centre), + (std::string("The station name upon which to centre the plot. The plot area is circumscribed by ")+ + std::string(PLOT_AREA_RADIUS)+std::string(".")).c_str()) + (PLOT_AREA_RADIUS, boost::program_options::value(&p.p._plot_area_radius), + (std::string("The radius (in metres) of an area to bound the plot. Default is ")+ + StringFromT(p.p._plot_area_radius)+std::string("m")).c_str()) + (TECTONIC_PLATE_BDY_FILE, boost::program_options::value(&p.r.tpb_file), + std::string("Plot global tectonic plate boundaries.").c_str()) (GRAPH_SEGMENTATION_STNS, "Plot a graph of the block stations resulting from network segmentation.") (GRAPH_SEGMENTATION_MSRS, @@ -419,14 +419,14 @@ int main(int argc, char* argv[]) titleblock_options.add_options() (OMIT_TITLE_BLOCK, "Do not print a title block and measurements legend.") - (TITLEBLOCK_TITLE, value(&p.p._title), + (TITLEBLOCK_TITLE, boost::program_options::value(&p.p._title), "The title of the plot. Supply quotation marks if spaces are required. Default is the network name.") - (TITLEBLOCK_NAME, value(&p.p._title_block_name), - (string("The name of the organisational unit name. Default is ")+ - string(p.p._title_block_name)+string(".")).c_str()) - (TITLEBLOCK_SUBNAME, value(&p.p._title_block_subname), - (string("The name of the organisational sub-unit unit name. Default is ")+ - string(p.p._title_block_subname)+string(".")).c_str()) + (TITLEBLOCK_NAME, boost::program_options::value(&p.p._title_block_name), + (std::string("The name of the organisational unit name. Default is ")+ + std::string(p.p._title_block_name)+std::string(".")).c_str()) + (TITLEBLOCK_SUBNAME, boost::program_options::value(&p.p._title_block_subname), + (std::string("The name of the organisational sub-unit unit name. Default is ")+ + std::string(p.p._title_block_subname)+std::string(".")).c_str()) ; // mapping options @@ -440,8 +440,8 @@ int main(int argc, char* argv[]) // 6 Lambert conformal // 7 General stereographic // 8 Robinson Projection - (PROJECTION, value(&p.p._projection), - string("Map projection type.\n"). + (PROJECTION, boost::program_options::value(&p.p._projection), + std::string("Map projection type.\n"). append(" 0: Let ").append(__BINARY_NAME__).append(" choose best projection (default)\n"). append(" 1: ").append(projectionTypes[1]).append("\n"). append(" 2: ").append(projectionTypes[2]).append("\n"). @@ -451,12 +451,12 @@ int main(int argc, char* argv[]) append(" 6: ").append(projectionTypes[6]).append("\n"). append(" 7: ").append(projectionTypes[7]).append("\n"). append(" 8: ").append(projectionTypes[8]).c_str()) - (LABEL_FONT_SIZE, value(&p.p._label_font_size), - (string("Label font size for station names and constraints. Default is ")+ - StringFromT(p.p._label_font_size)+string(".")).c_str()) - (MSR_LINE_WIDTH, value(&p.p._msr_line_width), - (string("Measurement line width. Default is ")+ - StringFromT(p.p._msr_line_width)+string(".")).c_str()) + (LABEL_FONT_SIZE, boost::program_options::value(&p.p._label_font_size), + (std::string("Label font size for station names and constraints. Default is ")+ + StringFromT(p.p._label_font_size)+std::string(".")).c_str()) + (MSR_LINE_WIDTH, boost::program_options::value(&p.p._msr_line_width), + (std::string("Measurement line width. Default is ")+ + StringFromT(p.p._msr_line_width)+std::string(".")).c_str()) (DONT_CREATE_PDF, "Don't create a pdf, just the command files.") (EXPORT_PNG, @@ -468,65 +468,65 @@ int main(int argc, char* argv[]) // add "positional options" to handle command line tokens which have no option name positional_options.add(NETWORK_NAME, -1); - command_line_parser parser(argc, argv); + boost::program_options::command_line_parser parser(argc, argv); store(parser.options(allowable_options).positional(positional_options).run(), vm); notify(vm); } catch (const std::exception& e) { - cout << "- Error: " << e.what() << endl; - cout << cmd_line_banner << allowable_options << endl; + std::cout << "- Error: " << e.what() << std::endl; + std::cout << cmd_line_banner << allowable_options << std::endl; return EXIT_FAILURE; } catch (...) { - cout << "+ Exception of unknown type!\n"; + std::cout << "+ Exception of unknown type!\n"; return EXIT_FAILURE; } if (argc < 2) { - cout << endl << "- Nothing to do - no options provided. " << endl << endl; - cout << cmd_line_banner << allowable_options << endl; + std::cout << std::endl << "- Nothing to do - no options provided. " << std::endl << std::endl; + std::cout << cmd_line_banner << allowable_options << std::endl; return EXIT_FAILURE; } if (vm.count(VERSION)) { - cout << cmd_line_banner << endl; + std::cout << cmd_line_banner << std::endl; return EXIT_SUCCESS; } if (vm.count(HELP)) { - cout << cmd_line_banner << allowable_options << endl; + std::cout << cmd_line_banner << allowable_options << std::endl; return EXIT_SUCCESS; } if (vm.count(HELP_MODULE)) { - cout << cmd_line_banner; - string original_text = vm[HELP_MODULE].as(); - string help_text = str_upper(original_text); + std::cout << cmd_line_banner; + std::string original_text = vm[HELP_MODULE].as(); + std::string help_text = str_upper(original_text); - if (str_upper(ALL_MODULE_STDOPT).find(help_text) != string::npos) { - cout << standard_options << endl; + if (str_upper(ALL_MODULE_STDOPT).find(help_text) != std::string::npos) { + std::cout << standard_options << std::endl; } - else if (str_upper(PLOT_MODULE_CONFIG).find(help_text) != string::npos) { - cout << config_options << endl; + else if (str_upper(PLOT_MODULE_CONFIG).find(help_text) != std::string::npos) { + std::cout << config_options << std::endl; } - else if (str_upper(PLOT_MODULE_TITLEBLOCK).find(help_text) != string::npos) { - cout << titleblock_options << endl; + else if (str_upper(PLOT_MODULE_TITLEBLOCK).find(help_text) != std::string::npos) { + std::cout << titleblock_options << std::endl; } - else if (str_upper(PLOT_MODULE_MAP).find(help_text) != string::npos) { - cout << map_options << endl; + else if (str_upper(PLOT_MODULE_MAP).find(help_text) != std::string::npos) { + std::cout << map_options << std::endl; } - else if (str_upper(ALL_MODULE_GENERIC).find(help_text) != string::npos) { - cout << generic_options << endl; + else if (str_upper(ALL_MODULE_GENERIC).find(help_text) != std::string::npos) { + std::cout << generic_options << std::endl; } else { - cout << endl << "- Error: Help module '" << - original_text << "' is not in the list of options." << endl; + std::cout << std::endl << "- Error: Help module '" << + original_text << "' is not in the list of options." << std::endl; return EXIT_FAILURE; } @@ -536,11 +536,11 @@ int main(int argc, char* argv[]) if (vm.count(QUIET)) p.g.quiet = 1; else - cout << endl << cmd_line_banner; + std::cout << std::endl << cmd_line_banner; if (!vm.count(NETWORK_NAME)) { - cout << endl << "- Nothing to do - no network name specified. " << endl << endl; + std::cout << std::endl << "- Nothing to do - no network name specified. " << std::endl << std::endl; return EXIT_FAILURE; } @@ -638,84 +638,84 @@ int main(int argc, char* argv[]) ////////////////////////////////////////////////////// // Form paths size_t lastindex; - if ((lastindex = p.g.output_folder.find_last_of("/")) != string::npos) + if ((lastindex = p.g.output_folder.find_last_of("/")) != std::string::npos) p.g.output_folder.pop_back(); - if ((lastindex = p.g.output_folder.find_last_of("\\")) != string::npos) + if ((lastindex = p.g.output_folder.find_last_of("\\")) != std::string::npos) p.g.output_folder.pop_back(); - if (equals(p.g.output_folder.substr(0, 2), "./")) + if (boost::equals(p.g.output_folder.substr(0, 2), "./")) p.g.output_folder = p.g.output_folder.substr(2); - if (equals(p.g.output_folder.substr(0, 2), ".\\")) + if (boost::equals(p.g.output_folder.substr(0, 2), ".\\")) p.g.output_folder = p.g.output_folder.substr(2); // binary station file if (!p.i.bst_file.empty()) - p.i.bst_file = formPath(p.g.input_folder, p.i.bst_file); + p.i.bst_file = formPath(p.g.input_folder, p.i.bst_file); else - p.i.bst_file = formPath(p.g.input_folder, p.g.network_name, "bst"); + p.i.bst_file = formPath(p.g.input_folder, p.g.network_name, "bst"); // binary measurement file if (!p.i.bms_file.empty()) - p.i.bms_file = formPath(p.g.input_folder, p.i.bms_file); + p.i.bms_file = formPath(p.g.input_folder, p.i.bms_file); else - p.i.bms_file = formPath(p.g.input_folder, p.g.network_name, "bms"); + p.i.bms_file = formPath(p.g.input_folder, p.g.network_name, "bms"); // station map file - p.i.map_file = formPath(p.g.input_folder, p.g.network_name, "map"); + p.i.map_file = formPath(p.g.input_folder, p.g.network_name, "map"); // segmentation file if (p.p._plot_phased_blocks) { if (vm.count(SEG_FILE)) - p.s.seg_file = formPath(p.g.input_folder, p.s.seg_file); + p.s.seg_file = formPath(p.g.input_folder, p.s.seg_file); else - p.s.seg_file = formPath(p.g.input_folder, p.g.network_name, "seg"); + p.s.seg_file = formPath(p.g.input_folder, p.g.network_name, "seg"); } // correction file if (p.p._plot_correction_arrows) { if (p.p._plot_phased_blocks) - p.o._cor_file = formPath(p.g.input_folder, p.g.network_name, "phased.cor"); + p.o._cor_file = formPath(p.g.input_folder, p.g.network_name, "phased.cor"); else - p.o._cor_file = formPath(p.g.input_folder, p.g.network_name, "simult.cor"); + p.o._cor_file = formPath(p.g.input_folder, p.g.network_name, "simult.cor"); } // adjusted positional uncertainty file if (p.p._plot_error_ellipses || p.p._plot_positional_uncertainty) { if (p.p._plot_phased_blocks) - p.o._apu_file = formPath(p.g.input_folder, p.g.network_name, "phased.apu"); + p.o._apu_file = formPath(p.g.input_folder, p.g.network_name, "phased.apu"); else - p.o._apu_file = formPath(p.g.input_folder, p.g.network_name, "simult.apu"); + p.o._apu_file = formPath(p.g.input_folder, p.g.network_name, "simult.apu"); } // ////////////////////////////////////////////////////// if (p.g.quiet != 1) { - cout << endl << "+ Options:" << endl; - cout << setw(PRINT_VAR_PAD) << left << " Network name: " << p.g.network_name << endl; - cout << setw(PRINT_VAR_PAD) << left << " Input folder: " << p.g.input_folder << endl; - cout << setw(PRINT_VAR_PAD) << left << " Output folder: " << p.g.output_folder << endl; - cout << setw(PRINT_VAR_PAD) << left << " Binary station file: " << p.i.bst_file << endl; - cout << setw(PRINT_VAR_PAD) << left << " Binary measurement file: " << p.i.bms_file << endl; + std::cout << std::endl << "+ Options:" << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Network name: " << p.g.network_name << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Input folder: " << p.g.input_folder << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Output folder: " << p.g.output_folder << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Binary station file: " << p.i.bst_file << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Binary measurement file: " << p.i.bms_file << std::endl; if (p.p._plot_phased_blocks) - cout << setw(PRINT_VAR_PAD) << left << " Segmentation file: " << p.s.seg_file << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Segmentation file: " << p.s.seg_file << std::endl; if (p.p._plot_correction_arrows && !p.p._compute_corrections) - cout << setw(PRINT_VAR_PAD) << left << " Corrections file: " << p.o._cor_file << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Corrections file: " << p.o._cor_file << std::endl; if (p.p._plot_error_ellipses || p.p._plot_positional_uncertainty) - cout << setw(PRINT_VAR_PAD) << left << " Positional uncertainty file: " << p.o._apu_file << endl; - cout << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Positional uncertainty file: " << p.o._apu_file << std::endl; + std::cout << std::endl; } - if (!exists(p.i.bst_file) || !exists(p.i.bms_file)) + if (!boost::filesystem::exists(p.i.bst_file) || !boost::filesystem::exists(p.i.bms_file)) { - cout << endl << endl << "- Nothing to do: network"; + std::cout << std::endl << std::endl << "- Nothing to do: network"; if (!vm.count(NETWORK_NAME)) - cout << " name has not been specified, and" << endl << " "; + std::cout << " name has not been specified, and" << std::endl << " "; - cout << " files " << p.i.bst_file << " and " << p.i.bms_file << " do not exist." << endl << endl; + std::cout << " files " << p.i.bst_file << " and " << p.i.bms_file << " do not exist." << std::endl << std::endl; return EXIT_FAILURE; } @@ -723,17 +723,17 @@ int main(int argc, char* argv[]) { if (!p.p._compute_corrections) { - if (!exists(p.o._cor_file)) + if (!boost::filesystem::exists(p.o._cor_file)) { - cout << endl << endl << - "- Error: The required corrections file does not exist:" << endl; - cout << " " << p.o._cor_file << endl << endl; - cout << " Run: 'adjust " << p.g.network_name << " --" << OUTPUT_STN_COR_FILE; + std::cout << std::endl << std::endl << + "- Error: The required corrections file does not exist:" << std::endl; + std::cout << " " << p.o._cor_file << std::endl << std::endl; + std::cout << " Run: 'adjust " << p.g.network_name << " --" << OUTPUT_STN_COR_FILE; if (p.p._plot_phased_blocks) - cout << " --" << MODE_PHASED << "'"; + std::cout << " --" << MODE_PHASED << "'"; else - cout << "'"; - cout << endl << " to create a corrections file" << endl << endl; + std::cout << "'"; + std::cout << std::endl << " to create a corrections file" << std::endl << std::endl; return EXIT_FAILURE; } } @@ -741,17 +741,17 @@ int main(int argc, char* argv[]) if (p.p._plot_error_ellipses || p.p._plot_positional_uncertainty) { - if (!exists(p.o._apu_file)) + if (!boost::filesystem::exists(p.o._apu_file)) { - cout << endl << endl << - "- Error: The required positional uncertainty file does not exist:" << endl; - cout << " " << p.o._apu_file << endl << endl; - cout << " Run: '" << __adjust_app_name__ << " " << p.g.network_name << " --" << OUTPUT_POS_UNCERTAINTY; + std::cout << std::endl << std::endl << + "- Error: The required positional uncertainty file does not exist:" << std::endl; + std::cout << " " << p.o._apu_file << std::endl << std::endl; + std::cout << " Run: '" << __adjust_app_name__ << " " << p.g.network_name << " --" << OUTPUT_POS_UNCERTAINTY; if (p.p._plot_phased_blocks) - cout << " --" << MODE_PHASED << "'"; + std::cout << " --" << MODE_PHASED << "'"; else - cout << "'"; - cout << endl << " to create a positional uncertainty file" << endl << endl; + std::cout << "'"; + std::cout << std::endl << " to create a positional uncertainty file" << std::endl << std::endl; return EXIT_FAILURE; } } @@ -762,17 +762,17 @@ int main(int argc, char* argv[]) // if (p.p._plot_phased_blocks || graph_mode) { - if (!exists(p.s.seg_file)) + if (!boost::filesystem::exists(p.s.seg_file)) { - cout << endl << endl << - "- Error: The required segmentation file does not exist:" << endl; - cout << " " << p.s.seg_file << endl << endl; - cout << " Run '" << __segment_app_name__ << " " << p.g.network_name << "' to create a segmentation file" << endl << endl; + std::cout << std::endl << std::endl << + "- Error: The required segmentation file does not exist:" << std::endl; + std::cout << " " << p.s.seg_file << std::endl << std::endl; + std::cout << " Run '" << __segment_app_name__ << " " << p.g.network_name << "' to create a segmentation file" << std::endl << std::endl; return EXIT_FAILURE; } - if (last_write_time(p.s.seg_file) < last_write_time(p.i.bst_file) || - last_write_time(p.s.seg_file) < last_write_time(p.i.bms_file)) + if (boost::filesystem::last_write_time(p.s.seg_file) < boost::filesystem::last_write_time(p.i.bst_file) || + boost::filesystem::last_write_time(p.s.seg_file) < boost::filesystem::last_write_time(p.i.bms_file)) { if (!vm.count(SEG_FILE)) { @@ -783,26 +783,26 @@ int main(int argc, char* argv[]) bst.load_bst_file_meta(p.i.bst_file, bst_meta); bms.load_bms_file_meta(p.i.bms_file, bms_meta); - bool bst_meta_import(iequals(bst_meta.modifiedBy, __import_app_name__) || - iequals(bst_meta.modifiedBy, __import_dll_name__)); - bool bms_meta_import(iequals(bms_meta.modifiedBy, __import_app_name__) || - iequals(bms_meta.modifiedBy, __import_dll_name__)); + bool bst_meta_import(boost::iequals(bst_meta.modifiedBy, __import_app_name__) || + boost::iequals(bst_meta.modifiedBy, __import_dll_name__)); + bool bms_meta_import(boost::iequals(bms_meta.modifiedBy, __import_app_name__) || + boost::iequals(bms_meta.modifiedBy, __import_dll_name__)); - if ((bst_meta_import && (last_write_time(p.s.seg_file) < last_write_time(p.i.bst_file))) || - (bms_meta_import && (last_write_time(p.s.seg_file) < last_write_time(p.i.bms_file)))) + if ((bst_meta_import && (boost::filesystem::last_write_time(p.s.seg_file) < boost::filesystem::last_write_time(p.i.bst_file))) || + (bms_meta_import && (boost::filesystem::last_write_time(p.s.seg_file) < boost::filesystem::last_write_time(p.i.bms_file)))) { - cout << endl << endl << - "- Error: The binary station and measurement files have been modified since" << endl << - " the segmentation file was created:" << endl; - - time_t t_bst(last_write_time(p.i.bst_file)), t_bms(last_write_time(p.i.bms_file)); - time_t t_seg(last_write_time(p.s.seg_file)); - - cout << " " << leafStr(p.i.bst_file) << " last modified on " << ctime(&t_bst); - cout << " " << leafStr(p.i.bms_file) << " last modified on " << ctime(&t_bms) << endl; - cout << " " << leafStr(p.s.seg_file) << " created on " << ctime(&t_seg) << endl; - cout << " Run '" << __segment_app_name__ << " " << p.g.network_name << " [options]' to re-create the segmentation file, or re-run" << endl << - " the plot using the " << SEG_FILE << " option if this segmentation file must\n be used." << endl << endl; + std::cout << std::endl << std::endl << + "- Error: The binary station and measurement files have been modified since" << std::endl << + " the segmentation file was created:" << std::endl; + + time_t t_bst(boost::filesystem::last_write_time(p.i.bst_file)), t_bms(boost::filesystem::last_write_time(p.i.bms_file)); + time_t t_seg(boost::filesystem::last_write_time(p.s.seg_file)); + + std::cout << " " << leafStr(p.i.bst_file) << " last modified on " << ctime(&t_bst); + std::cout << " " << leafStr(p.i.bms_file) << " last modified on " << ctime(&t_bms) << std::endl; + std::cout << " " << leafStr(p.s.seg_file) << " created on " << ctime(&t_seg) << std::endl; + std::cout << " Run '" << __segment_app_name__ << " " << p.g.network_name << " [options]' to re-create the segmentation file, or re-run" << std::endl << + " the plot using the " << SEG_FILE << " option if this segmentation file must\n be used." << std::endl << std::endl; return EXIT_FAILURE; } } @@ -813,8 +813,8 @@ int main(int argc, char* argv[]) if (p.g.verbose > 0 || p.g.quiet != 1) { - cout << "+ Loading network files... "; - cout.flush(); + std::cout << "+ Loading network files... "; + std::cout.flush(); } dna_plot plotDynaML; @@ -822,8 +822,8 @@ int main(int argc, char* argv[]) if (p.g.verbose > 0 || p.g.quiet != 1) { - cout << "done." << endl << endl; - cout.flush(); + std::cout << "done." << std::endl << std::endl; + std::cout.flush(); } // set up colours for each measurement @@ -898,11 +898,11 @@ int main(int argc, char* argv[]) } catch (const NetPlotException& e) { - cout << endl << "- Error: " << e.what() << endl; + std::cout << std::endl << "- Error: " << e.what() << std::endl; return EXIT_FAILURE; } - catch (const runtime_error& e) { - cout << "+ Exception of unknown type: " << e.what(); + catch (const std::runtime_error& e) { + std::cout << "+ Exception of unknown type: " << e.what(); return EXIT_FAILURE; } diff --git a/dynadjust/dynadjust/dnaplotwrapper/dnaplotwrapper.hpp b/dynadjust/dynadjust/dnaplotwrapper/dnaplotwrapper.hpp index 8140c4fb..8640f76e 100644 --- a/dynadjust/dynadjust/dnaplotwrapper/dnaplotwrapper.hpp +++ b/dynadjust/dynadjust/dnaplotwrapper/dnaplotwrapper.hpp @@ -58,13 +58,6 @@ #include -using namespace std; -using namespace boost; -using namespace boost::filesystem; -using namespace boost::posix_time; -using namespace boost::program_options; -namespace po = boost::program_options; - using namespace dynadjust::networkplot; using namespace dynadjust::exception; diff --git a/dynadjust/dynadjust/dnareftran/dnareftran.cpp b/dynadjust/dynadjust/dnareftran/dnareftran.cpp index 210dc014..c70e475d 100644 --- a/dynadjust/dynadjust/dnareftran/dnareftran.cpp +++ b/dynadjust/dynadjust/dnareftran/dnareftran.cpp @@ -59,7 +59,7 @@ dna_reftran::~dna_reftran() } -void dna_reftran::TransformBinaryFiles(const string& bstFile, const string& bmsFile, const string& newFrame, const string& newEpoch) +void dna_reftran::TransformBinaryFiles(const std::string& bstFile, const std::string& bmsFile, const std::string& newFrame, const std::string& newEpoch) { // TODO - Would it be faster to use memory mapping instead of reading // binary files into memory? Not sure. @@ -88,23 +88,14 @@ void dna_reftran::TransformBinaryFiles(const string& bstFile, const string& bmsF // coordinates are required) TransformMeasurementRecords(newFrame, newEpoch); - // Were any measurements updated? - if (transformationPerformed_) - { - // write the binary measurement file - WriteBinaryMeasurementFile(bmsFile); - } + // write the binary measurement file + WriteBinaryMeasurementFile(bmsFile); // 3. Transform stations TransformStationRecords(newFrame, newEpoch); - // Were any coordinates updated? - if (transformationPerformed_) - { - // write the binary station file - WriteBinaryStationFile(bstFile); - } - + // write the binary station file + WriteBinaryStationFile(bstFile); } // Obtain the two-character ID for the tectonic plate on which each station lies, and assign @@ -121,7 +112,7 @@ void dna_reftran::IdentifyStationPlate() it_v_string_v_doubledouble_pair _it_plates; dnaGeometryPoint point; - //cout << endl; + //cout << std::endl; size_t plateCount(global_plates_.size()); string_uint32_pair stnPlate; @@ -151,9 +142,9 @@ void dna_reftran::IdentifyStationPlate() stnPlate.second = p++; vplateMap_.push_back(stnPlate); - //if (iequals(_it_plates->first, "AU")) - // cout << endl << _it_plates->first << endl << - // boost::geometry::wkt(platePolygon) << endl; + //if (boost::iequals(_it_plates->first, "AU")) + // std::cout << std::endl << _it_plates->first << std::endl << + // boost::geometry::wkt(platePolygon) << std::endl; for (stn_it=bstBinaryRecords_.begin(); stn_it!=bstBinaryRecords_.end(); ++stn_it) { @@ -166,21 +157,21 @@ void dna_reftran::IdentifyStationPlate() if (boost::geometry::within(point, platePolygon)) { sprintf(stn_it->plate, "%s", _it_plates->first.c_str()); - //cout << "Station " << stn_it->stationName << " is on plate " << _it_plates->first << endl; + //cout << "Station " << stn_it->stationName << " is on plate " << _it_plates->first << std::endl; } } } - sort(vplateMap_.begin(), vplateMap_.end()); + std::sort(vplateMap_.begin(), vplateMap_.end()); } -void dna_reftran::LoadTectonicPlateParameters(const string& pltfileName, const string& pmmfileName) +void dna_reftran::LoadTectonicPlateParameters(const std::string& pltfileName, const std::string& pmmfileName) { dna_io_tpb tpb; - stringstream ss; - ss << "LoadTectonicPlateParameters(): An error was encountered when loading" << endl << - " tectonic plate information." << endl; + std::stringstream ss; + ss << "LoadTectonicPlateParameters(): An error was encountered when loading" << std::endl << + " tectonic plate information." << std::endl; projectSettings_.r.plate_model_option = 1; @@ -188,30 +179,30 @@ void dna_reftran::LoadTectonicPlateParameters(const string& pltfileName, const s // Load tectonic plate parameters. Throws runtime_error on failure. tpb.load_tpp_file(pmmfileName, plate_motion_eulers_); - sort(plate_motion_eulers_.begin(), plate_motion_eulers_.end()); + std::sort(plate_motion_eulers_.begin(), plate_motion_eulers_.end()); // Load tectonic plate polygons. Throws runtime_error on failure. tpb.load_tpb_file(pltfileName, global_plates_); - sort(global_plates_.begin(), global_plates_.end()); + std::sort(global_plates_.begin(), global_plates_.end()); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } - string message; + std::string message; if (!tpb.validate_plate_files(global_plates_, plate_motion_eulers_, message)) { - ss << " " << message << endl; - throw boost::enable_current_exception(runtime_error(ss.str())); + ss << " " << message << std::endl; + throw boost::enable_current_exception(std::runtime_error(ss.str())); } try { CalculateRotations(); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } } @@ -226,21 +217,21 @@ void dna_reftran::CalculateRotations() if (projectSettings_.g.verbose > 1) { j = PAD + (HEADER_18 * 6) + PAD + COMMENT; - *rft_file << endl << endl << "Euler pole rotation parameters" << endl << - "-------------------------------------------" << endl << endl; - *rft_file << setw(PAD) << left << "Plate" << - setw(HEADER_18) << right << "Pole Latitude" << - setw(HEADER_18) << right << "Pole Longitude" << - setw(HEADER_18) << right << "Euler Rot. Rate" << - setw(HEADER_18) << right << "X Rot. Rate" << - setw(HEADER_18) << right << "Y Rot. Rate" << - setw(HEADER_18) << right << "Z Rot. Rate" << - setw(PAD) << " " << - setw(COMMENT) << left << "Reference" << endl; + *rft_file << std::endl << std::endl << "Euler pole rotation parameters" << std::endl << + "-------------------------------------------" << std::endl << std::endl; + *rft_file << std::setw(PAD) << std::left << "Plate" << + std::setw(HEADER_18) << std::right << "Pole Latitude" << + std::setw(HEADER_18) << std::right << "Pole Longitude" << + std::setw(HEADER_18) << std::right << "Euler Rot. Rate" << + std::setw(HEADER_18) << std::right << "X Rot. Rate" << + std::setw(HEADER_18) << std::right << "Y Rot. Rate" << + std::setw(HEADER_18) << std::right << "Z Rot. Rate" << + std::setw(PAD) << " " << + std::setw(COMMENT) << std::left << "Reference" << std::endl; UINT32 i; for (i=0; i 1) - *rft_file << setw(PAD) << left << i->plate_name << - setw(HEADER_18) << right << fixed << setprecision(4) << i->pole_latitude << - setw(HEADER_18) << right << fixed << setprecision(4) << i->pole_longitude << - setw(HEADER_18) << right << fixed << setprecision(4) << i->pole_rotation_rate << - setw(HEADER_18) << right << fixed << setprecision(6) << pmm.x_rotation << - setw(HEADER_18) << right << fixed << setprecision(6) << pmm.y_rotation << - setw(HEADER_18) << right << fixed << setprecision(6) << pmm.z_rotation << - setw(PAD) << " " << - left << i->pole_param_author << endl; + *rft_file << std::setw(PAD) << std::left << i->plate_name << + std::setw(HEADER_18) << std::right << std::fixed << std::setprecision(4) << i->pole_latitude << + std::setw(HEADER_18) << std::right << std::fixed << std::setprecision(4) << i->pole_longitude << + std::setw(HEADER_18) << std::right << std::fixed << std::setprecision(4) << i->pole_rotation_rate << + std::setw(HEADER_18) << std::right << std::fixed << std::setprecision(6) << pmm.x_rotation << + std::setw(HEADER_18) << std::right << std::fixed << std::setprecision(6) << pmm.y_rotation << + std::setw(HEADER_18) << std::right << std::fixed << std::setprecision(6) << pmm.z_rotation << + std::setw(PAD) << " " << + std::left << i->pole_param_author << std::endl; } - } // Load substitutions for WGS84 and WGS84 (...) @@ -281,61 +271,61 @@ void dna_reftran::LoadWGS84FrameSubstitutions() _frameSubstitutions.clear(); // WGS84 (transit) and WGS84 to ITRF90 - frameSubstitution.reset(new WGS84_TRANSIT_ITRF90); + frameSubstitution.reset(new WGS84_TRANSIT_ITRF90); _frameSubstitutions.push_back(frameSubstitution); - frameSubstitution.reset(new WGS84_ITRF90); + frameSubstitution.reset(new WGS84_ITRF90); _frameSubstitutions.push_back(frameSubstitution); // WGS84 (G730) and WGS84 to ITRF91 - frameSubstitution.reset(new WGS84_G730_ITRF91); + frameSubstitution.reset(new WGS84_G730_ITRF91); _frameSubstitutions.push_back(frameSubstitution); - frameSubstitution.reset(new WGS84_ITRF91); + frameSubstitution.reset(new WGS84_ITRF91); _frameSubstitutions.push_back(frameSubstitution); // WGS84 (G873) and WGS84 to ITRF94 - frameSubstitution.reset(new WGS84_G873_ITRF94); + frameSubstitution.reset(new WGS84_G873_ITRF94); _frameSubstitutions.push_back(frameSubstitution); - frameSubstitution.reset(new WGS84_ITRF94); + frameSubstitution.reset(new WGS84_ITRF94); _frameSubstitutions.push_back(frameSubstitution); // WGS84 (G1150) and WGS84 to ITRF2000 - frameSubstitution.reset(new WGS84_G1150_ITRF2000); + frameSubstitution.reset(new WGS84_G1150_ITRF2000); _frameSubstitutions.push_back(frameSubstitution); - frameSubstitution.reset(new WGS84_ITRF2000); + frameSubstitution.reset(new WGS84_ITRF2000); _frameSubstitutions.push_back(frameSubstitution); // WGS84 (G1674) and WGS84 to ITRF2008 - frameSubstitution.reset(new WGS84_G1674_ITRF2008); + frameSubstitution.reset(new WGS84_G1674_ITRF2008); _frameSubstitutions.push_back(frameSubstitution); - frameSubstitution.reset(new WGS84_ITRF2008_1); + frameSubstitution.reset(new WGS84_ITRF2008_1); _frameSubstitutions.push_back(frameSubstitution); // WGS84 (G1762) and WGS84 to ITRF2008 - frameSubstitution.reset(new WGS84_G1762_ITRF2008); + frameSubstitution.reset(new WGS84_G1762_ITRF2008); _frameSubstitutions.push_back(frameSubstitution); - frameSubstitution.reset(new WGS84_ITRF2008_2); + frameSubstitution.reset(new WGS84_ITRF2008_2); _frameSubstitutions.push_back(frameSubstitution); // WGS84 (G2139) and WGS84 to ITRF2014 - frameSubstitution.reset(new WGS84_G2139_ITRF2014); + frameSubstitution.reset(new WGS84_G2139_ITRF2014); _frameSubstitutions.push_back(frameSubstitution); - frameSubstitution.reset(new WGS84_ITRF2014); + frameSubstitution.reset(new WGS84_ITRF2014); _frameSubstitutions.push_back(frameSubstitution); - sort(_frameSubstitutions.begin(), _frameSubstitutions.end(), - CompareSubstituteOnFrameName< frame_substitutions_t, string>()); + std::sort(_frameSubstitutions.begin(), _frameSubstitutions.end(), + CompareSubstituteOnFrameName< frame_substitutions_t, std::string>()); } -void dna_reftran::LogFrameSubstitutions(vector& substitutions, const string& type) +void dna_reftran::LogFrameSubstitutions(std::vector& substitutions, const std::string& type) { // Sort, count and remove duplicates - vector::iterator _it_sub_1, _it_sub_2, _it_sub_newend; + std::vector::iterator _it_sub_1, _it_sub_2, _it_sub_newend; UINT32 i(0); vUINT32 subs; // sort - sort(substitutions.begin(), substitutions.end()); + std::sort(substitutions.begin(), substitutions.end()); // count unique pairs for (_it_sub_1 = substitutions.begin(); @@ -370,23 +360,23 @@ void dna_reftran::LogFrameSubstitutions(vector& substitution // print vUINT32::iterator _it_subs = subs.begin(); - stringstream ss1, ss2; + std::stringstream ss1, ss2; ss1 << type << " reference frame substitutions"; ss2 << "(" << subs_count << ")"; - *rft_file << endl << endl << - setw(PRINT_VAL_PAD) << left << ss1.str() << - setw(NUMERIC_WIDTH) << right << ss2.str() << endl; - *rft_file << string(PRINT_VAL_PAD + NUMERIC_WIDTH, '-') << endl; + *rft_file << std::endl << std::endl << + std::setw(PRINT_VAL_PAD) << std::left << ss1.str() << + std::setw(NUMERIC_WIDTH) << std::right << ss2.str() << std::endl; + *rft_file << std::string(PRINT_VAL_PAD + NUMERIC_WIDTH, '-') << std::endl; for_each( substitutions.begin(), substitutions.end(), [this, &_it_subs](string_string_pair& substitution) { - *rft_file << setw(BLOCK) << left << substitution.first << + *rft_file << std::setw(BLOCK) << std::left << substitution.first << " --> " << - setw(BLOCK) << substitution.second << - setw(HEADER_20) << right << *(_it_subs++) << endl; + std::setw(BLOCK) << substitution.second << + std::setw(HEADER_20) << std::right << *(_it_subs++) << std::endl; } ); @@ -398,7 +388,7 @@ void dna_reftran::ApplyStationFrameSubstitutions() // loop through binary station records and replace occurrences of // the frame to be replaced with a substitute it_vstn_t stn_it; - string epsgSubstitute; + std::string epsgSubstitute; _v_stn_substitutions.clear(); @@ -408,25 +398,25 @@ void dna_reftran::ApplyStationFrameSubstitutions() if (IsolateandApplySubstitute(stn_it->epsgCode, stn_it->epoch, epsgSubstitute)) { _v_stn_substitutions.push_back(string_string_pair( - datumFromEpsgString(string(stn_it->epsgCode)), + datumFromEpsgString(std::string(stn_it->epsgCode)), datumFromEpsgString(epsgSubstitute))); strcpy(stn_it->epsgCode, epsgSubstitute.c_str()); } } catch (const RefTranException& e) { - stringstream error_msg; - error_msg << endl << - " - Station: " << stn_it->stationName << endl << - " - Frame and epoch: " << datumFromEpsgString(stn_it->epsgCode) << - " (no epoch)" << endl; + std::stringstream error_msg; + error_msg << std::endl << + " - Station: " << stn_it->stationName << std::endl << + " - Frame and epoch: " << datumFromEpsgString(stn_it->epsgCode) << + " (no epoch)" << std::endl; switch (e.exception_type()) { case REFTRAN_WGS84_TRANS_UNSUPPORTED: { - stringstream throw_msg; - throw_msg << e.what() << error_msg.str() << endl; + std::stringstream throw_msg; + throw_msg << e.what() << error_msg.str() << std::endl; throw RefTranException(throw_msg.str(), REFTRAN_WGS84_TRANS_UNSUPPORTED); break; } @@ -450,7 +440,7 @@ void dna_reftran::ApplyMeasurementFrameSubstitutions() // loop through binary station records and replace occurrences of // the frame to be replaced with a substitute it_vmsr_t msr_it; - string epsgSubstitute; + std::string epsgSubstitute; _v_msr_substitutions.clear(); @@ -461,27 +451,27 @@ void dna_reftran::ApplyMeasurementFrameSubstitutions() { if (msr_it->measStart == xMeas) _v_msr_substitutions.push_back(string_string_pair( - datumFromEpsgString(string(msr_it->epsgCode)), + datumFromEpsgString(std::string(msr_it->epsgCode)), datumFromEpsgString(epsgSubstitute))); strcpy(msr_it->epsgCode, epsgSubstitute.c_str()); } } catch (const RefTranException& e) { - stringstream error_msg; - error_msg << endl << - " - Measurement type: " << measurement_name(msr_it->measType) << endl << - " - From: " << bstBinaryRecords_.at(msr_it->station1).stationName << endl << - " - To: " << bstBinaryRecords_.at(msr_it->station2).stationName << endl << - " - Frame and epoch: " << datumFromEpsgString(msr_it->epsgCode) << - " (no epoch)" << endl; + std::stringstream error_msg; + error_msg << std::endl << + " - Measurement type: " << measurement_name(msr_it->measType) << std::endl << + " - From: " << bstBinaryRecords_.at(msr_it->station1).stationName << std::endl << + " - To: " << bstBinaryRecords_.at(msr_it->station2).stationName << std::endl << + " - Frame and epoch: " << datumFromEpsgString(msr_it->epsgCode) << + " (no epoch)" << std::endl; switch (e.exception_type()) { case REFTRAN_WGS84_TRANS_UNSUPPORTED: { - stringstream throw_msg; - throw_msg << e.what() << error_msg.str() << endl; + std::stringstream throw_msg; + throw_msg << e.what() << error_msg.str() << std::endl; throw RefTranException(throw_msg.str(), REFTRAN_WGS84_TRANS_UNSUPPORTED); break; } @@ -501,12 +491,12 @@ void dna_reftran::ApplyMeasurementFrameSubstitutions() } -bool dna_reftran::IsolateandApplySubstitute(const string& epsgCode, const string& stnEpoch, string& epsgSubstitute) +bool dna_reftran::IsolateandApplySubstitute(const std::string& epsgCode, const std::string& stnEpoch, std::string& epsgSubstitute) { _it_vframesubptr _it_subst = _frameSubstitutions.begin(); - string frame; - frame = datumFromEpsgCode(LongFromString(epsgCode)); + std::string frame; + frame = datumFromEpsgCode(LongFromString(epsgCode)); // first, find the first occurrence of the substitute in _frameSubstitutions if ((_it_subst = binary_search_substitution( @@ -524,18 +514,18 @@ bool dna_reftran::IsolateandApplySubstitute(const string& epsgCode, const string { if (stnEpoch.empty()) { - stringstream throw_msg; - throw_msg << " Cannot perform a reference frame substitution for data on '" << frame << "'" << endl << - " without a valid epoch. '" << frame << "' refers to the \"World Geodetic System 1984" << endl << - " (WGS 84) ensemble\". When transforming stations and measurements from the" << endl << - " WGS 84 ensemble, each record must be accompanied with an epoch. Refer to" << endl << - " the DynAdjust User's Guide (\"Configuring import options\") for information" << endl << - " on how to achieve reliable transformation results using WGS 84." << endl; + std::stringstream throw_msg; + throw_msg << " Cannot perform a reference frame substitution for data on '" << frame << "'" << std::endl << + " without a valid epoch. '" << frame << "' refers to the \"World Geodetic System 1984" << std::endl << + " (WGS 84) ensemble\". When transforming stations and measurements from the" << std::endl << + " WGS 84 ensemble, each record must be accompanied with an epoch. Refer to" << std::endl << + " the DynAdjust User's Guide (\"Configuring import options\") for information" << std::endl << + " on how to achieve reliable transformation results using WGS 84." << std::endl; throw RefTranException(throw_msg.str(), REFTRAN_WGS84_TRANS_UNSUPPORTED); } // In this case, use the epoch to identify the correct substitution - boost::gregorian::date epoch = dateFromString(stnEpoch); + boost::gregorian::date epoch = dateFromString(stnEpoch); while (_it_subst != _frameSubstitutions.end()) { @@ -554,87 +544,89 @@ bool dna_reftran::IsolateandApplySubstitute(const string& epsgCode, const string if (epsgSubstitute.empty()) return false; - epsgSubstitute = epsgStringFromName(epsgSubstitute); + epsgSubstitute = epsgStringFromName(epsgSubstitute); return true; } -void dna_reftran::LoadBinaryStationFile(const string& bstfileName) +void dna_reftran::LoadBinaryStationFile(const std::string& bstfileName) { try { // Load binary stations data. Throws runtime_error on failure. dna_io_bst bst; bst.load_bst_file(bstfileName, &bstBinaryRecords_, bst_meta_); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { throw RefTranException(e.what()); } } -void dna_reftran::WriteBinaryStationFile(const string& bstfileName) +void dna_reftran::WriteBinaryStationFile(const std::string& bstfileName) { - string strEpsg(datumTo_.GetEpsgCode_s()); - string strEpoch(datumTo_.GetEpoch_s()); + std::string strEpsg(datumTo_.GetEpsgCode_s()); + std::string strEpoch(datumTo_.GetEpoch_s()); // update binary file meta sprintf(bst_meta_.modifiedBy, "%s", __BINARY_NAME__); sprintf(bst_meta_.epsgCode, "%s", strEpsg.substr(0, STN_EPSG_WIDTH).c_str()); sprintf(bst_meta_.epoch, "%s", strEpoch.substr(0, STN_EPOCH_WIDTH).c_str()); - + bst_meta_.reftran = true; + try { // write binary stations data. Throws runtime_error on failure. dna_io_bst bst; bst.write_bst_file(bstfileName, &bstBinaryRecords_, bst_meta_); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { throw RefTranException(e.what()); } } -void dna_reftran::LoadBinaryMeasurementFile(const string& bmsfileName) +void dna_reftran::LoadBinaryMeasurementFile(const std::string& bmsfileName) { try { // Load binary measurements data. Throws runtime_error on failure. dna_io_bms bms; bms.load_bms_file(bmsfileName, &bmsBinaryRecords_, bms_meta_); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { throw RefTranException(e.what()); } } -void dna_reftran::WriteBinaryMeasurementFile(const string& bmsfileName) +void dna_reftran::WriteBinaryMeasurementFile(const std::string& bmsfileName) { - string strEpsg(datumTo_.GetEpsgCode_s()); - string strEpoch(datumTo_.GetEpoch_s()); + std::string strEpsg(datumTo_.GetEpsgCode_s()); + std::string strEpoch(datumTo_.GetEpoch_s()); // update binary file meta sprintf(bms_meta_.modifiedBy, "%s", __BINARY_NAME__); sprintf(bms_meta_.epsgCode, "%s", strEpsg.substr(0, STN_EPSG_WIDTH).c_str()); sprintf(bms_meta_.epoch, "%s", strEpoch.substr(0, STN_EPOCH_WIDTH).c_str()); - + bms_meta_.reftran = true; + try { // write binary measurement data. Throws runtime_error on failure. dna_io_bms bms; bms.write_bms_file(bmsfileName, &bmsBinaryRecords_, bms_meta_); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { throw RefTranException(e.what()); } } -UINT32 dna_reftran::DetermineTectonicPlate(const string& plate) +UINT32 dna_reftran::DetermineTectonicPlate(const std::string& plate) { it_pair_string_vUINT32 it_plate = equal_range(vplateMap_.begin(), vplateMap_.end(), plate, StationNameIDCompareName()); if (it_plate.first == it_plate.second) { - stringstream error_msg; + std::stringstream error_msg; error_msg << "An attempt to find plate motion model parameters failed for " << plate << "."; throw RefTranException(error_msg.str()); @@ -680,7 +672,7 @@ void dna_reftran::JoinTransformationParameters(it_vstn_t& stn_it, double* reduce { transformation_parameter_set transP_a, transP_b; - CDnaDatum datumStep(epsgCodeFromName(ITRF2014_s)); + CDnaDatum datumStep(epsgCodeFromName(ITRF2014_s)); // Set the reference epoch to the epoch of the data switch (transType) @@ -701,7 +693,7 @@ void dna_reftran::JoinTransformationParameters(it_vstn_t& stn_it, double* reduce double reduced_parameters_step[7]; double timeElapsed_a(0.0), timeElapsed_b(0.0); - string epoch_step; + std::string epoch_step; transformationType transformation_type; @@ -751,9 +743,9 @@ void dna_reftran::JoinTransformationParameters(it_vstn_t& stn_it, double* reduce epoch_step = datumTo.GetEpoch_s(); break; default: - stringstream error_msg; + std::stringstream error_msg; error_msg << "Attempting to join parameters between " << - datumFrom_.GetName() << " and " << datumStep.GetName() << ":" << endl << + datumFrom_.GetName() << " and " << datumStep.GetName() << ":" << std::endl << " " << rft.what(); throw RefTranException(error_msg.str()); } @@ -764,28 +756,28 @@ void dna_reftran::JoinTransformationParameters(it_vstn_t& stn_it, double* reduce matrix_2d coordinates_step(3, 1); Transform_7parameter(coordinates, coordinates_step, reduced_parameters); - *rft_file << setw(PAD3) << left << "JN" << - setw(STATION) << left << stn_it->stationName << - setw(REL) << right << ITRF2014_s << - setw(REL) << right << epoch_step << - setw(PAD3) << " " << - setw(PAD) << left << stn_it->plate << - setw(MEASR) << right << fixed << setprecision(4) << coordinates_step.get(0, 0) << - setw(MEASR) << right << fixed << setprecision(4) << coordinates_step.get(1, 0) << - setw(MEASR) << right << fixed << setprecision(4) << coordinates_step.get(2, 0); + *rft_file << std::setw(PAD3) << std::left << "JN" << + std::setw(STATION) << std::left << stn_it->stationName << + std::setw(REL) << std::right << ITRF2014_s << + std::setw(REL) << std::right << epoch_step << + std::setw(PAD3) << " " << + std::setw(PAD) << std::left << stn_it->plate << + std::setw(MEASR) << std::right << std::fixed << std::setprecision(4) << coordinates_step.get(0, 0) << + std::setw(MEASR) << std::right << std::fixed << std::setprecision(4) << coordinates_step.get(1, 0) << + std::setw(MEASR) << std::right << std::fixed << std::setprecision(4) << coordinates_step.get(2, 0); if (projectSettings_.g.verbose > 2) { - *rft_file << setw(PACORR) << right << fixed << setprecision(4) << reduced_parameters[0] << - setw(PACORR) << right << fixed << setprecision(4) << reduced_parameters[1] << - setw(PACORR) << right << fixed << setprecision(4) << reduced_parameters[2] << - setw(PACORR) << right << scientific << setprecision(4) << reduced_parameters[3] << - setw(PACORR) << right << scientific << setprecision(4) << reduced_parameters[4] << - setw(PACORR) << right << scientific << setprecision(4) << reduced_parameters[5] << - setw(PACORR) << right << scientific << setprecision(4) << reduced_parameters[6] << - setw(PACORR) << right << fixed << setprecision(4) << timeElapsed_a; + *rft_file << std::setw(PACORR) << std::right << std::fixed << std::setprecision(4) << reduced_parameters[0] << + std::setw(PACORR) << std::right << std::fixed << std::setprecision(4) << reduced_parameters[1] << + std::setw(PACORR) << std::right << std::fixed << std::setprecision(4) << reduced_parameters[2] << + std::setw(PACORR) << std::right << std::scientific << std::setprecision(4) << reduced_parameters[3] << + std::setw(PACORR) << std::right << std::scientific << std::setprecision(4) << reduced_parameters[4] << + std::setw(PACORR) << std::right << std::scientific << std::setprecision(4) << reduced_parameters[5] << + std::setw(PACORR) << std::right << std::scientific << std::setprecision(4) << reduced_parameters[6] << + std::setw(PACORR) << std::right << std::fixed << std::setprecision(4) << timeElapsed_a; } - *rft_file << endl; + *rft_file << std::endl; } // Step -> datumTo @@ -828,9 +820,9 @@ void dna_reftran::JoinTransformationParameters(it_vstn_t& stn_it, double* reduce ObtainPlateMotionParameters(stn_it, reduced_parameters_step, datumFrom, datumTo, transformParameters, timeElapsed_b); break; default: - stringstream error_msg; + std::stringstream error_msg; error_msg << "Attempting to join parameters between " << - datumStep.GetName() << " and " << datumTo.GetName() << ":" << endl << + datumStep.GetName() << " and " << datumTo.GetName() << ":" << std::endl << " " << rft.what(); throw RefTranException(error_msg.str()); } @@ -889,32 +881,32 @@ void dna_reftran::TransformEpochs_PlateMotionModel(it_vstn_t& stn_it, const matr if (projectSettings_.g.verbose > 1 && data_type_ == stn_data) { - *rft_file << setw(PAD3) << left << "PM" << - setw(STATION) << left << stn_it->stationName << - setw(REL) << right << datumTo.GetName() << - setw(REL) << right << datumTo.GetEpoch_s() << - setw(PAD3) << " " << - setw(PAD) << left << stn_it->plate << - setw(MEASR) << right << fixed << setprecision(4) << coordinates_mod.get(0, 0) << - setw(MEASR) << right << fixed << setprecision(4) << coordinates_mod.get(1, 0) << - setw(MEASR) << right << fixed << setprecision(4) << coordinates_mod.get(2, 0); + *rft_file << std::setw(PAD3) << std::left << "PM" << + std::setw(STATION) << std::left << stn_it->stationName << + std::setw(REL) << std::right << datumTo.GetName() << + std::setw(REL) << std::right << datumTo.GetEpoch_s() << + std::setw(PAD3) << " " << + std::setw(PAD) << std::left << stn_it->plate << + std::setw(MEASR) << std::right << std::fixed << std::setprecision(4) << coordinates_mod.get(0, 0) << + std::setw(MEASR) << std::right << std::fixed << std::setprecision(4) << coordinates_mod.get(1, 0) << + std::setw(MEASR) << std::right << std::fixed << std::setprecision(4) << coordinates_mod.get(2, 0); if (projectSettings_.g.verbose > 2) { - *rft_file << setw(PACORR) << right << fixed << setprecision(4) << reduced_parameters[0] << - setw(PACORR) << right << fixed << setprecision(4) << reduced_parameters[1] << - setw(PACORR) << right << fixed << setprecision(4) << reduced_parameters[2] << - setw(PACORR) << right << scientific << setprecision(4) << reduced_parameters[3] << - setw(PACORR) << right << scientific << setprecision(4) << reduced_parameters[4] << - setw(PACORR) << right << scientific << setprecision(4) << reduced_parameters[5] << - setw(PACORR) << right << scientific << setprecision(4) << reduced_parameters[6] << - setw(PACORR) << right << fixed << setprecision(4) << timeElapsed; + *rft_file << std::setw(PACORR) << std::right << std::fixed << std::setprecision(4) << reduced_parameters[0] << + std::setw(PACORR) << std::right << std::fixed << std::setprecision(4) << reduced_parameters[1] << + std::setw(PACORR) << std::right << std::fixed << std::setprecision(4) << reduced_parameters[2] << + std::setw(PACORR) << std::right << std::scientific << std::setprecision(4) << reduced_parameters[3] << + std::setw(PACORR) << std::right << std::scientific << std::setprecision(4) << reduced_parameters[4] << + std::setw(PACORR) << std::right << std::scientific << std::setprecision(4) << reduced_parameters[5] << + std::setw(PACORR) << std::right << std::scientific << std::setprecision(4) << reduced_parameters[6] << + std::setw(PACORR) << std::right << std::fixed << std::setprecision(4) << timeElapsed; } - *rft_file << endl; + *rft_file << std::endl; } #ifdef _MSDEBUG - stringstream ss; + std::stringstream ss; ss << "coords, " << datumFrom.GetName() << " @ " << referenceEpoch(datumFrom.GetEpoch()); coordinates.trace(ss.str(), "%.4f "); ss.str(""); @@ -936,8 +928,8 @@ void dna_reftran::TransformFrames_PlateMotionModel(it_vstn_t& stn_it, const matr // 3. Transform ITRF2014 to datumTo (using the epoch of the output dynamic frame) // Create the step datum and set the epoch to the epoch of the input data - CDnaDatum datumStep1(epsgCodeFromName(ITRF2014_s), datumFrom.GetEpoch()); - CDnaDatum datumStep2(epsgCodeFromName(ITRF2014_s), datumTo.GetEpoch()); + CDnaDatum datumStep1(epsgCodeFromName(ITRF2014_s), datumFrom.GetEpoch()); + CDnaDatum datumStep2(epsgCodeFromName(ITRF2014_s), datumTo.GetEpoch()); matrix_2d coordinates_tmp(coordinates); @@ -955,8 +947,8 @@ void dna_reftran::TransformFrames_PlateMotionModel(it_vstn_t& stn_it, const matr #ifdef _MSDEBUG TRACE("Step 2: Plate motion model transformation on ITRF from epoch of input frame to epoch of output frame\n"); - stringstream ss; - ss << "Transforming from " << datumStep1.GetName() << " @ " << datumStep1.GetEpoch() << endl; + std::stringstream ss; + ss << "Transforming from " << datumStep1.GetName() << " @ " << datumStep1.GetEpoch() << std::endl; ss << " to " << datumStep2.GetName() << " @ " << datumStep2.GetEpoch(); TRACE("%s\n", ss.str().c_str()); #endif @@ -1003,9 +995,9 @@ void dna_reftran::TransformFrames_WithoutPlateMotionModel(it_vstn_t& stn_it, con timeElapsed, transType); #ifdef _MSDEBUG - stringstream ss; - ss << "Transforming from " << datumFrom.GetName() << " @ " << fixed << setprecision(4) << referenceEpoch(datumFrom.GetEpoch()) << endl; - ss << " to " << datumTo.GetName() << " @ " << fixed << setprecision(4) << transformParameters.reference_epoch_; + std::stringstream ss; + ss << "Transforming from " << datumFrom.GetName() << " @ " << std::fixed << std::setprecision(4) << referenceEpoch(datumFrom.GetEpoch()) << std::endl; + ss << " to " << datumTo.GetName() << " @ " << std::fixed << std::setprecision(4) << transformParameters.reference_epoch_; TRACE("%s\n", ss.str().c_str()); //TRACE("Raw parameters:\n"); @@ -1047,28 +1039,28 @@ void dna_reftran::TransformFrames_WithoutPlateMotionModel(it_vstn_t& stn_it, con if (projectSettings_.g.verbose > 1 && data_type_ == stn_data) { - *rft_file << setw(PAD3) << left << TransformationType(transType) << - setw(STATION) << left << stn_it->stationName << - setw(REL) << right << datumTo.GetName() << - setw(REL) << right << datumTo.GetEpoch_s() << - setw(PAD3) << " " << - setw(PAD) << left << stn_it->plate << - setw(MEASR) << right << fixed << setprecision(4) << coordinates_mod.get(0, 0) << - setw(MEASR) << right << fixed << setprecision(4) << coordinates_mod.get(1, 0) << - setw(MEASR) << right << fixed << setprecision(4) << coordinates_mod.get(2, 0); + *rft_file << std::setw(PAD3) << std::left << TransformationType(transType) << + std::setw(STATION) << std::left << stn_it->stationName << + std::setw(REL) << std::right << datumTo.GetName() << + std::setw(REL) << std::right << datumTo.GetEpoch_s() << + std::setw(PAD3) << " " << + std::setw(PAD) << std::left << stn_it->plate << + std::setw(MEASR) << std::right << std::fixed << std::setprecision(4) << coordinates_mod.get(0, 0) << + std::setw(MEASR) << std::right << std::fixed << std::setprecision(4) << coordinates_mod.get(1, 0) << + std::setw(MEASR) << std::right << std::fixed << std::setprecision(4) << coordinates_mod.get(2, 0); if (projectSettings_.g.verbose > 2) { - *rft_file << setw(PACORR) << right << fixed << setprecision(4) << reduced_parameters[0] << - setw(PACORR) << right << fixed << setprecision(4) << reduced_parameters[1] << - setw(PACORR) << right << fixed << setprecision(4) << reduced_parameters[2] << - setw(PACORR) << right << scientific << setprecision(4) << reduced_parameters[3] << - setw(PACORR) << right << scientific << setprecision(4) << reduced_parameters[4] << - setw(PACORR) << right << scientific << setprecision(4) << reduced_parameters[5] << - setw(PACORR) << right << scientific << setprecision(4) << reduced_parameters[6] << - setw(PACORR) << right << fixed << setprecision(4) << timeElapsed; + *rft_file << std::setw(PACORR) << std::right << std::fixed << std::setprecision(4) << reduced_parameters[0] << + std::setw(PACORR) << std::right << std::fixed << std::setprecision(4) << reduced_parameters[1] << + std::setw(PACORR) << std::right << std::fixed << std::setprecision(4) << reduced_parameters[2] << + std::setw(PACORR) << std::right << std::scientific << std::setprecision(4) << reduced_parameters[3] << + std::setw(PACORR) << std::right << std::scientific << std::setprecision(4) << reduced_parameters[4] << + std::setw(PACORR) << std::right << std::scientific << std::setprecision(4) << reduced_parameters[5] << + std::setw(PACORR) << std::right << std::scientific << std::setprecision(4) << reduced_parameters[6] << + std::setw(PACORR) << std::right << std::fixed << std::setprecision(4) << timeElapsed; } - *rft_file << endl; + *rft_file << std::endl; } @@ -1125,8 +1117,8 @@ void dna_reftran::TransformDynamic(it_vstn_t& stn_it, const matrix_2d& coordinat frame_similarity = __frame_frame_diff__; #ifdef _MSDEBUG - stringstream ss; - ss << "Transforming from " << datumFrom.GetName() << " @ " << datumFrom.GetEpoch() << endl; + std::stringstream ss; + ss << "Transforming from " << datumFrom.GetName() << " @ " << datumFrom.GetEpoch() << std::endl; ss << " to " << datumTo.GetName() << " @ " << datumTo.GetEpoch(); TRACE("%s\n", ss.str().c_str()); #endif @@ -1236,7 +1228,7 @@ void dna_reftran::TransformFrames_Join(it_vstn_t& stn_it, const matrix_2d& coord double dna_reftran::DetermineElapsedTime(const CDnaDatum& datumFrom, const CDnaDatum& datumTo, transformation_parameter_set& transParams, transformationType transType) { - stringstream ss; + std::stringstream ss; double dTime(0.0); try @@ -1292,7 +1284,7 @@ double dna_reftran::DetermineElapsedTime(const CDnaDatum& datumFrom, const CDnaD #endif ss.str(""); - date dt; + boost::gregorian::date dt; double dt0(transParams.reference_epoch_); switch (transType) @@ -1359,8 +1351,8 @@ double dna_reftran::DetermineElapsedTime(const CDnaDatum& datumFrom, const CDnaD dTime = elapsedTime(dt, dt0); #ifdef _MSDEBUG - ss << "From epoch: " << fixed << setprecision(4) << referenceEpoch(dt) << " -> to epoch: " << fixed << setprecision(4) << dt0 << - " = " << setprecision(4) << fixed << dTime; + ss << "From epoch: " << std::fixed << std::setprecision(4) << referenceEpoch(dt) << " -> to epoch: " << std::fixed << std::setprecision(4) << dt0 << + " = " << std::setprecision(4) << std::fixed << dTime; TRACE("%s\n", ss.str().c_str()); #endif @@ -1371,7 +1363,7 @@ double dna_reftran::DetermineElapsedTime(const CDnaDatum& datumFrom, const CDnaD } catch (...) { - stringstream ss; + std::stringstream ss; ss << "DetermineElapsedTime(): an error occurred whilst computing the elapsed time."; throw RefTranException(ss.str()); } @@ -1405,7 +1397,7 @@ void dna_reftran::ObtainHelmertParameters(const CDnaDatum& datumFrom, const CDna timeElapsed = 0.; } -void dna_reftran::TransformStationRecords(const string& newFrame, const string& newEpoch) +void dna_reftran::TransformStationRecords(const std::string& newFrame, const std::string& newEpoch) { it_vstn_t stn_it; CDnaDatum datumFrom; @@ -1416,38 +1408,38 @@ void dna_reftran::TransformStationRecords(const string& newFrame, const string& if (projectSettings_.g.verbose > 1) { j = (PAD3 * 2) + PAD + STATION + (REL * 2) + (MEASR * 3); - *rft_file << endl << endl << "Station coordinate transformations" << endl << - "-------------------------------------------" << endl << endl; - *rft_file << setw(PAD3) << left << "ID" << - setw(STATION) << left << "Station" << - setw(REL) << right << "Frame" << - setw(REL) << right << "Epoch" << - setw(PAD3) << " " << - setw(PAD) << left << "Plate" << - setw(MEASR) << right << "X" << - setw(MEASR) << right << "Y" << - setw(MEASR) << right << "Z"; + *rft_file << std::endl << std::endl << "Station coordinate transformations" << std::endl << + "-------------------------------------------" << std::endl << std::endl; + *rft_file << std::setw(PAD3) << std::left << "ID" << + std::setw(STATION) << std::left << "Station" << + std::setw(REL) << std::right << "Frame" << + std::setw(REL) << std::right << "Epoch" << + std::setw(PAD3) << " " << + std::setw(PAD) << std::left << "Plate" << + std::setw(MEASR) << std::right << "X" << + std::setw(MEASR) << std::right << "Y" << + std::setw(MEASR) << std::right << "Z"; // Print reduced transformation parameters if (projectSettings_.g.verbose > 2) { - *rft_file << setw(PACORR) << right << "dX" << - setw(PACORR) << right << "dY" << - setw(PACORR) << right << "dZ" << - setw(PACORR) << right << "Sc" << - setw(PACORR) << right << "rX" << - setw(PACORR) << right << "rY" << - setw(PACORR) << right << "rZ" << - setw(PACORR) << right << "dt"; + *rft_file << std::setw(PACORR) << std::right << "dX" << + std::setw(PACORR) << std::right << "dY" << + std::setw(PACORR) << std::right << "dZ" << + std::setw(PACORR) << std::right << "Sc" << + std::setw(PACORR) << std::right << "rX" << + std::setw(PACORR) << std::right << "rY" << + std::setw(PACORR) << std::right << "rZ" << + std::setw(PACORR) << std::right << "dt"; j += (8 * PACORR); } - *rft_file << endl; + *rft_file << std::endl; UINT32 i; for (i=0; iepoch)).empty()) + if (trimstr(std::string(stn_it->epoch)).empty()) datumFrom.SetDatum(stn_it->epsgCode); else datumFrom.SetDatumFromEpsg(stn_it->epsgCode, stn_it->epoch); @@ -1493,22 +1485,22 @@ void dna_reftran::TransformStationRecords(const string& newFrame, const string& m_stnsTransformed++; } } - catch (const runtime_error& e) + catch (const std::runtime_error& e) { - stringstream error_msg; - error_msg << e.what() << endl << - " - Station: " << stn_it->stationName << endl << - " - Frame and epoch: " << datumFromEpsgString(stn_it->epsgCode) << " @ " << - stn_it->epoch << endl; + std::stringstream error_msg; + error_msg << e.what() << std::endl << + " - Station: " << stn_it->stationName << std::endl << + " - Frame and epoch: " << datumFromEpsgString(stn_it->epsgCode) << " @ " << + stn_it->epoch << std::endl; throw RefTranException(e.what()); } catch (const RefTranException& e) { - stringstream error_msg; - error_msg << e.what() << endl << - " - Station: " << stn_it->stationName << endl << - " - Frame and epoch: " << datumFromEpsgString(stn_it->epsgCode) << " @ " << - stn_it->epoch << endl; + std::stringstream error_msg; + error_msg << e.what() << std::endl << + " - Station: " << stn_it->stationName << std::endl << + " - Frame and epoch: " << datumFromEpsgString(stn_it->epsgCode) << " @ " << + stn_it->epoch << std::endl; throw RefTranException(e.what()); } @@ -1530,29 +1522,29 @@ void dna_reftran::TransformStation(it_vstn_t& stn_it, const CDnaDatum& datumFrom datumFrom.GetEllipsoidRef()); if (projectSettings_.g.verbose > 1) - *rft_file << setw(PAD3) << left << "FR" << - setw(STATION) << left << stn_it->stationName << - setw(REL) << right << datumFrom.GetName() << - setw(REL) << right << datumFrom.GetEpoch_s() << - setw(PAD3) << " " << - setw(PAD) << left << stn_it->plate << - setw(MEASR) << right << fixed << setprecision(4) << coordinates.get(0, 0) << - setw(MEASR) << right << fixed << setprecision(4) << coordinates.get(1, 0) << - setw(MEASR) << right << fixed << setprecision(4) << coordinates.get(2, 0) << endl; + *rft_file << std::setw(PAD3) << std::left << "FR" << + std::setw(STATION) << std::left << stn_it->stationName << + std::setw(REL) << std::right << datumFrom.GetName() << + std::setw(REL) << std::right << datumFrom.GetEpoch_s() << + std::setw(PAD3) << " " << + std::setw(PAD) << std::left << stn_it->plate << + std::setw(MEASR) << std::right << std::fixed << std::setprecision(4) << coordinates.get(0, 0) << + std::setw(MEASR) << std::right << std::fixed << std::setprecision(4) << coordinates.get(1, 0) << + std::setw(MEASR) << std::right << std::fixed << std::setprecision(4) << coordinates.get(2, 0) << std::endl; // 2. Transform! Transform(stn_it, coordinates, coordinates_mod, datumFrom, transformParameters); if (projectSettings_.g.verbose > 1) - *rft_file << setw(PAD3) << left << "TO" << - setw(STATION) << left << stn_it->stationName << - setw(REL) << right << datumTo_.GetName() << - setw(REL) << right << datumTo_.GetEpoch_s() << - setw(PAD3) << " " << - setw(PAD) << left << stn_it->plate << - setw(MEASR) << right << fixed << setprecision(4) << coordinates_mod.get(0, 0) << - setw(MEASR) << right << fixed << setprecision(4) << coordinates_mod.get(1, 0) << - setw(MEASR) << right << fixed << setprecision(4) << coordinates_mod.get(2, 0) << endl; + *rft_file << std::setw(PAD3) << std::left << "TO" << + std::setw(STATION) << std::left << stn_it->stationName << + std::setw(REL) << std::right << datumTo_.GetName() << + std::setw(REL) << std::right << datumTo_.GetEpoch_s() << + std::setw(PAD3) << " " << + std::setw(PAD) << std::left << stn_it->plate << + std::setw(MEASR) << std::right << std::fixed << std::setprecision(4) << coordinates_mod.get(0, 0) << + std::setw(MEASR) << std::right << std::fixed << std::setprecision(4) << coordinates_mod.get(1, 0) << + std::setw(MEASR) << std::right << std::fixed << std::setprecision(4) << coordinates_mod.get(2, 0) << std::endl; // 3. Convert back to geographic CartToGeo(coordinates_mod.get(0, 0), @@ -1562,7 +1554,7 @@ void dna_reftran::TransformStation(it_vstn_t& stn_it, const CDnaDatum& datumFrom } -void dna_reftran::TransformMeasurementRecords(const string& newFrame, const string& newEpoch) +void dna_reftran::TransformMeasurementRecords(const std::string& newFrame, const std::string& newEpoch) { it_vmsr_t msr_it; CDnaDatum datumFrom; @@ -1607,7 +1599,7 @@ void dna_reftran::TransformMeasurementRecords(const string& newFrame, const stri case 'Q': // Geodetic longitude case 'R': // Ellipsoidal height case 'S': // Slope distance - case 'V': // Zenith angle + case 'V': // Zenith distance case 'Z': // Vertical angle continue; } @@ -1616,7 +1608,7 @@ void dna_reftran::TransformMeasurementRecords(const string& newFrame, const stri continue; // b. Get datum of current measurement - if (trimstr(string(msr_it->epoch)).empty()) + if (trimstr(std::string(msr_it->epoch)).empty()) datumFrom.SetDatum(msr_it->epsgCode); else datumFrom.SetDatumFromEpsg(msr_it->epsgCode, msr_it->epoch); @@ -1635,26 +1627,26 @@ void dna_reftran::TransformMeasurementRecords(const string& newFrame, const stri transformationPerformed_ = true; } } - catch (const runtime_error& e) + catch (const std::runtime_error& e) { - stringstream error_msg; - error_msg << e.what() << endl << - " - Measurement type: " << measurement_name(msr_it->measType) << endl << - " - From: " << bstBinaryRecords_.at(msr_it->station1).stationName << endl << - " - To: " << bstBinaryRecords_.at(msr_it->station2).stationName << endl << - " - Frame and epoch: " << datumFromEpsgString(msr_it->epsgCode) << " @ " << - msr_it->epoch << endl; + std::stringstream error_msg; + error_msg << e.what() << std::endl << + " - Measurement type: " << measurement_name(msr_it->measType) << std::endl << + " - From: " << bstBinaryRecords_.at(msr_it->station1).stationName << std::endl << + " - To: " << bstBinaryRecords_.at(msr_it->station2).stationName << std::endl << + " - Frame and epoch: " << datumFromEpsgString(msr_it->epsgCode) << " @ " << + msr_it->epoch << std::endl; throw RefTranException(error_msg.str()); } catch (const RefTranException& e) { - stringstream error_msg; - error_msg << e.what() << endl << - " - Measurement type: " << measurement_name(msr_it->measType) << endl << - " - From: " << bstBinaryRecords_.at(msr_it->station1).stationName << endl << - " - To: " << bstBinaryRecords_.at(msr_it->station2).stationName << endl << - " - Frame and epoch: " << datumFromEpsgString(msr_it->epsgCode) << " @ " << - msr_it->epoch << endl; + std::stringstream error_msg; + error_msg << e.what() << std::endl << + " - Measurement type: " << measurement_name(msr_it->measType) << std::endl << + " - From: " << bstBinaryRecords_.at(msr_it->station1).stationName << std::endl << + " - To: " << bstBinaryRecords_.at(msr_it->station2).stationName << std::endl << + " - Frame and epoch: " << datumFromEpsgString(msr_it->epsgCode) << " @ " << + msr_it->epoch << std::endl; throw RefTranException(error_msg.str()); } @@ -1871,21 +1863,21 @@ void dna_reftran::LoadDatabaseId() if (databaseIDsLoaded_) return; - string dbid_filename = formPath(projectSettings_.g.output_folder, + std::string dbid_filename = formPath(projectSettings_.g.output_folder, projectSettings_.g.network_name, "dbid"); - stringstream ss; + std::stringstream ss; v_msr_db_map_.clear(); std::ifstream dbid_file; try { // Create geoid file. Throws runtime_error on failure. file_opener(dbid_file, dbid_filename, - ios::in | ios::binary, binary); + std::ios::in | std::ios::binary, binary); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } UINT32 r, recordCount; @@ -1921,18 +1913,18 @@ void dna_reftran::LoadDatabaseId() } catch (const std::ifstream::failure& f) { ss << f.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } } -void dna_reftran::SerialiseDNA(const string& stnfilename, const string& msrfilename, bool flagUnused) +void dna_reftran::SerialiseDNA(const std::string& stnfilename, const std::string& msrfilename, bool flagUnused) { try { // Load Database IDs LoadDatabaseId(); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { throw RefTranException(e.what()); } @@ -1940,7 +1932,7 @@ void dna_reftran::SerialiseDNA(const string& stnfilename, const string& msrfilen try { // write binary stations data. Throws runtime_error on failure. dna_io_dna dna; - string comment(" transformed to "); + std::string comment(" transformed to "); comment.append(datumTo_.GetName()); if (datumTo_.isDynamic()) comment.append(", epoch ").append(datumTo_.GetEpoch_s()); @@ -1950,18 +1942,18 @@ void dna_reftran::SerialiseDNA(const string& stnfilename, const string& msrfilen stnfilename, msrfilename, projectSettings_.g.network_name, datumTo_, projection, flagUnused, "Station coordinates" + comment, "GNSS measurements" + comment); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { throw RefTranException(e.what()); } } -void dna_reftran::SerialiseDynaML(const string& stnfilename, const string& msrfilename, bool flagUnused) +void dna_reftran::SerialiseDynaML(const std::string& stnfilename, const std::string& msrfilename, bool flagUnused) { try { // Load Database IDs LoadDatabaseId(); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { throw RefTranException(e.what()); } @@ -1976,14 +1968,14 @@ void dna_reftran::SerialiseDynaML(const string& stnfilename, const string& msrfi dynaml_comment(dynaml_stn_file, "File type: Station file"); dynaml_comment(dynaml_stn_file, "Project name: " + projectSettings_.g.network_name); // Write header comment line - string comment("Station coordinates transformed to "); + std::string comment("Station coordinates transformed to "); comment.append(datumTo_.GetName()); if (datumTo_.isDynamic()) comment.append(", epoch ").append(datumTo_.GetEpoch_s()); comment.append(". Exported by reftran."); dynaml_comment(dynaml_stn_file, comment); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { throw RefTranException(e.what()); } @@ -1995,7 +1987,7 @@ void dna_reftran::SerialiseDynaML(const string& stnfilename, const string& msrfi dynaml_footer(dynaml_stn_file); dynaml_stn_file.close(); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { throw RefTranException(e.what()); } @@ -2009,14 +2001,14 @@ void dna_reftran::SerialiseDynaML(const string& stnfilename, const string& msrfi dynaml_comment(dynaml_msr_file, "File type: Measurement file"); dynaml_comment(dynaml_msr_file, "Project name: " + projectSettings_.g.network_name); // Write header comment line - string comment("GNSS measurements transformed to "); + std::string comment("GNSS measurements transformed to "); comment.append(datumTo_.GetName()); if (datumTo_.isDynamic()) comment.append(", epoch ").append(datumTo_.GetEpoch_s()); comment.append(". Exported by reftran."); dynaml_comment(dynaml_msr_file, comment); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { throw RefTranException(e.what()); } @@ -2026,19 +2018,19 @@ void dna_reftran::SerialiseDynaML(const string& stnfilename, const string& msrfi dynaml_footer(dynaml_msr_file); dynaml_msr_file.close(); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { throw RefTranException(e.what()); } } -void dna_reftran::SerialiseDynaML(const string& xmlfilename, bool flagUnused) +void dna_reftran::SerialiseDynaML(const std::string& xmlfilename, bool flagUnused) { try { // Load Database IDs LoadDatabaseId(); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { throw RefTranException(e.what()); } @@ -2049,14 +2041,14 @@ void dna_reftran::SerialiseDynaML(const string& xmlfilename, bool flagUnused) // write header dynaml_header(dynaml_xml_file, "Combined File", datumTo_.GetName(), datumTo_.GetEpoch_s()); // Write header comment line - string comment("Station coordinates and measurements transformed to "); + std::string comment("Station coordinates and measurements transformed to "); comment.append(datumTo_.GetName()); if (datumTo_.isDynamic()) comment.append(", epoch ").append(datumTo_.GetEpoch_s()); comment.append(". Exported by reftran."); dynaml_comment(dynaml_xml_file, comment); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { throw RefTranException(e.what()); } @@ -2071,7 +2063,7 @@ void dna_reftran::SerialiseDynaML(const string& xmlfilename, bool flagUnused) // 2. Measurements SerialiseDynaMLMsr(&dynaml_xml_file); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { throw RefTranException(e.what()); } @@ -2084,8 +2076,8 @@ void dna_reftran::SerialiseDynaML(const string& xmlfilename, bool flagUnused) void dna_reftran::SerialiseDynaMLStn(std::ofstream* xml_file, CDnaProjection& projection, bool flagUnused/*=false*/) { UINT32 epsgCode(LongFromString(bstBinaryRecords_.at(0).epsgCode)); - string datum(datumFromEpsgCode(epsgCode)); - string epoch(referenceepochFromEpsgCode(epsgCode)); + std::string datum(datumFromEpsgCode(epsgCode)); + std::string epoch(referenceepochFromEpsgCode(epsgCode)); dnaStnPtr stnPtr(new CDnaStation(datum, epoch)); it_vstn_t _it_stn; @@ -2117,7 +2109,7 @@ void dna_reftran::SerialiseDynaMLMsr(std::ofstream* xml_file) { dnaMsrPtr msrPtr; it_vmsr_t _it_msr; - string comment(""); + std::string comment(""); size_t dbindex; it_vdbid_t _it_dbid; @@ -2144,7 +2136,7 @@ void dna_reftran::SerialiseDynaMLMsr(std::ofstream* xml_file) // // Open output file stream. Throws runtime_error on failure. // file_opener(sinex_file, projectSettings_.o._snx_file); // } -// catch (const runtime_error& e) { +// catch (const std::runtime_error& e) { // throw RefTranException(e.what()); // } // diff --git a/dynadjust/dynadjust/dnareftran/dnareftran.hpp b/dynadjust/dynadjust/dnareftran/dnareftran.hpp index 271e58ae..6376f41f 100644 --- a/dynadjust/dynadjust/dnareftran/dnareftran.hpp +++ b/dynadjust/dynadjust/dnareftran/dnareftran.hpp @@ -40,11 +40,6 @@ #include #include -using namespace std; -using namespace boost; -using namespace boost::posix_time; -using namespace boost::filesystem; - #include #include #include @@ -108,7 +103,7 @@ class dna_reftran { dna_reftran& operator=(const dna_reftran&); public: - void TransformBinaryFiles(const string& bstFile, const string& bmsFile, const string& newFrame, const string& newEpoch=""); + void TransformBinaryFiles(const std::string& bstFile, const std::string& bmsFile, const std::string& newFrame, const std::string& newEpoch=""); // Returns the file progress //inline int ReturnFileProgress() const { return (int)m_dPercentComplete; } @@ -124,32 +119,32 @@ class dna_reftran { inline UINT32 MeasurementsNotTransformed() const { return m_msrsNotTransformed; } // file handling - void SerialiseDNA(const string& stnfilename, const string& msrfilename, bool flagUnused=false); - void SerialiseDynaML(const string& xmlfilename, bool flagUnused=false); - void SerialiseDynaML(const string& stnfilename, const string& msrfilename, bool flagUnused=false); + void SerialiseDNA(const std::string& stnfilename, const std::string& msrfilename, bool flagUnused=false); + void SerialiseDynaML(const std::string& xmlfilename, bool flagUnused=false); + void SerialiseDynaML(const std::string& stnfilename, const std::string& msrfilename, bool flagUnused=false); void SerialiseDynaMLStn(std::ofstream* xml_file, CDnaProjection& projection, bool flagUnused=false); void SerialiseDynaMLMsr(std::ofstream* xml_file); //bool PrintTransformedStationCoordinatestoSNX(); - void LoadTectonicPlateParameters(const string& pltfileName, const string& pmmfileName); + void LoadTectonicPlateParameters(const std::string& pltfileName, const std::string& pmmfileName); - //void LoadFrameSubstitutions(const string& frxfileName); + //void LoadFrameSubstitutions(const std::string& frxfileName); void LoadWGS84FrameSubstitutions(); inline void InitialiseSettings(const project_settings& p) {projectSettings_ = p;} private: - void LoadBinaryStationFile(const string& bstfileName); - void LoadBinaryMeasurementFile(const string& bmsfileName); + void LoadBinaryStationFile(const std::string& bstfileName); + void LoadBinaryMeasurementFile(const std::string& bmsfileName); - void WriteBinaryStationFile(const string& bstfileName); - void WriteBinaryMeasurementFile(const string& bmsfileName); + void WriteBinaryStationFile(const std::string& bstfileName); + void WriteBinaryMeasurementFile(const std::string& bmsfileName); - void TransformStationRecords(const string& newFrame, const string& newEpoch); - void TransformMeasurementRecords(const string& newFrame, const string& newEpoch); + void TransformStationRecords(const std::string& newFrame, const std::string& newEpoch); + void TransformMeasurementRecords(const std::string& newFrame, const std::string& newEpoch); double DetermineElapsedTime(const CDnaDatum& datumFrom, const CDnaDatum& datumTo, transformation_parameter_set& transParams, transformationType transType); @@ -157,7 +152,7 @@ class dna_reftran { void ObtainHelmertParameters(const CDnaDatum& datumFrom, const CDnaDatum& datumTo, transformation_parameter_set& transParams, double& timeElapsed, transformationType transType); - UINT32 DetermineTectonicPlate(const string& plate); + UINT32 DetermineTectonicPlate(const std::string& plate); void ObtainPlateMotionParameters(it_vstn_t& stn_it, double* reduced_parameters, const CDnaDatum& datumFrom, const CDnaDatum& datumTo, transformation_parameter_set& transformParameters, double& timeElapsed); @@ -200,11 +195,11 @@ class dna_reftran { void CalculateRotations(); - void LogFrameSubstitutions(vector& substitutions, const string& type); + void LogFrameSubstitutions(std::vector& substitutions, const std::string& type); void ApplyStationFrameSubstitutions(); void ApplyMeasurementFrameSubstitutions(); - bool IsolateandApplySubstitute(const string& epsgCode, const string& epoch, string& epsgSubstitute); + bool IsolateandApplySubstitute(const std::string& epsgCode, const std::string& epoch, std::string& epsgSubstitute); //double m_dPercentComplete; // percentage of bytes read from file int m_iBytesRead; // bytes read from file @@ -230,8 +225,8 @@ class dna_reftran { v_plate_motion_cartesians plate_motion_cartesians_; // Helmert parameters computed from Euler parameters vframeSubsPtr _frameSubstitutions; // Reference frame substitutions - vector _v_stn_substitutions; // station substitutions made - vector _v_msr_substitutions; // station substitutions made + std::vector _v_stn_substitutions; // station substitutions made + std::vector _v_msr_substitutions; // station substitutions made v_string_uint32_pair vplateMap_; // Plate Map index sorted on plate ID diff --git a/dynadjust/dynadjust/dnareftranwrapper/dnareftranwrapper.cpp b/dynadjust/dynadjust/dnareftranwrapper/dnareftranwrapper.cpp index bb4714d6..912e7bf3 100644 --- a/dynadjust/dynadjust/dnareftranwrapper/dnareftranwrapper.cpp +++ b/dynadjust/dynadjust/dnareftranwrapper/dnareftranwrapper.cpp @@ -24,64 +24,83 @@ using namespace dynadjust; -void PrintOutputFileHeaderInfo(std::ofstream* f_out, const string& out_file, project_settings* p, const string& header) +void PrintOutputFileHeaderInfo(std::ofstream* f_out, const std::string& out_file, project_settings* p, const std::string& header, UINT32& epsgCode, bool userSuppliedFrame, bool userSuppliedEpoch) { // Print formatted header print_file_header(*f_out, header); - *f_out << setw(PRINT_VAR_PAD) << left << "File name:" << system_complete(out_file).string() << endl << endl; + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "File name:" << boost::filesystem::system_complete(out_file).string() << std::endl << std::endl; - *f_out << setw(PRINT_VAR_PAD) << left << "Command line arguments: "; - *f_out << p->r.command_line_arguments << endl << endl; - - *f_out << setw(PRINT_VAR_PAD) << left << "Network name:" << p->g.network_name << endl; - *f_out << setw(PRINT_VAR_PAD) << left << "Input folder: " << system_complete(p->g.input_folder).string() << endl; - *f_out << setw(PRINT_VAR_PAD) << left << "Output folder: " << system_complete(p->g.output_folder).string() << endl; - *f_out << setw(PRINT_VAR_PAD) << left << "Stations file:" << system_complete(p->r.bst_file).string() << endl; - *f_out << setw(PRINT_VAR_PAD) << left << "Measurements file:" << system_complete(p->r.bms_file).string() << endl; - *f_out << setw(PRINT_VAR_PAD) << left << "Target reference frame:" << p->r.reference_frame << endl; + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "Command line arguments: "; + *f_out << p->r.command_line_arguments << std::endl << std::endl; + + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "Network name:" << p->g.network_name << std::endl; + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "Input folder: " << boost::filesystem::system_complete(p->g.input_folder).string() << std::endl; + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "Output folder: " << boost::filesystem::system_complete(p->g.output_folder).string() << std::endl; + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "Stations file:" << boost::filesystem::system_complete(p->r.bst_file).string() << std::endl; + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "Measurements file:" << boost::filesystem::system_complete(p->r.bms_file).string() << std::endl; + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "Target reference frame:" << p->r.reference_frame; + + if (userSuppliedFrame) + *f_out << " (user supplied)" << std::endl; + else + *f_out << " (project reference frame)" << std::endl; if (!p->r.epoch.empty()) { // Has the user supplied the year only? - if (p->r.epoch.rfind(".") == string::npos) + if (p->r.epoch.rfind(".") == std::string::npos) p->r.epoch.insert(0, "01.01."); - *f_out << setw(PRINT_VAR_PAD) << left << "Target Epoch: " << - formattedDateStringFromNumericString(p->r.epoch) << endl; + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "Target epoch: " << p->r.epoch; + if (isEpsgDatumStatic(epsgCode)) + *f_out << " (adopted reference epoch of " << p->r.reference_frame << ")"; + else + { + if (userSuppliedEpoch) + *f_out << " (user supplied)" << std::endl; + else + { + if (userSuppliedFrame) + *f_out << " (adopted reference epoch of " << p->r.reference_frame << ")" << std::endl; + else + *f_out << " (project epoch)" << std::endl; + } + } + *f_out << std::endl; } if (p->r.plate_model_option > 0) { - *f_out << setw(PRINT_VAR_PAD) << left << "Plate boundaries file: " << p->r.tpb_file << endl; - *f_out << setw(PRINT_VAR_PAD) << left << "Plate pole parameter file: " << p->r.tpp_file << endl; + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "Plate boundaries file: " << p->r.tpb_file << std::endl; + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "Plate pole parameter file: " << p->r.tpp_file << std::endl; } if (p->i.export_dynaml) { if (p->i.export_single_xml_file) - *f_out << setw(PRINT_VAR_PAD) << left << "DynaML output file: " << p->i.xml_outfile << endl; + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "DynaML output file: " << p->i.xml_outfile << std::endl; else { - *f_out << setw(PRINT_VAR_PAD) << left << "DynaML station file: " << p->i.xml_stnfile << endl; - *f_out << setw(PRINT_VAR_PAD) << left << "DynaML measurement file: " << p->i.xml_msrfile << endl; + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "DynaML station file: " << p->i.xml_stnfile << std::endl; + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "DynaML measurement file: " << p->i.xml_msrfile << std::endl; } } if (p->i.export_dna_files) { - *f_out << setw(PRINT_VAR_PAD) << left << "DNA station file: " << p->i.dna_stnfile << endl; - *f_out << setw(PRINT_VAR_PAD) << left << "DNA measurement file: " << p->i.dna_msrfile << endl; + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "DNA station file: " << p->i.dna_stnfile << std::endl; + *f_out << std::setw(PRINT_VAR_PAD) << std::left << "DNA measurement file: " << p->i.dna_msrfile << std::endl; } // if (p->o._export_snx_file) -// *f_out << setw(PRINT_VAR_PAD) << left << "SINEX file: " << p->o._snx_file << endl; +// *f_out << std::setw(PRINT_VAR_PAD) << std::left << "SINEX file: " << p->o._snx_file << std::endl; - *f_out << OUTPUTLINE << endl << endl; + *f_out << OUTPUTLINE << std::endl << std::endl; } -int ParseCommandLineOptions(const int& argc, char* argv[], const variables_map& vm, project_settings& p) +int ParseCommandLineOptions(const int& argc, char* argv[], const boost::program_options::variables_map& vm, project_settings& p, UINT32& epsgCode) { // capture command line arguments for (int cmd_arg(0); cmd_arg(p.g.output_folder, p.g.network_name, "dnaproj"); + p.r.rft_file = formPath(p.g.output_folder, p.g.network_name, "rft"); + + bool frameSupplied(true); + project_settings tmp; + if (!vm.count(REFERENCE_FRAME)) { - cout << endl << "- Nothing to do - reference frame was not supplied. " << endl << endl; - return EXIT_FAILURE; + if (boost::filesystem::exists(p.g.project_file)) + { + try { + CDnaProjectFile projectFile(p.g.project_file, reftranSetting); + tmp = projectFile.GetSettings(); + p.r.reference_frame = tmp.r.reference_frame; + frameSupplied = false; + } + catch (const std::runtime_error& e) { + std::cout << std::endl << "- Error: " << e.what() << std::endl; + return EXIT_FAILURE; + } + } + + //cout << std::endl << "- Reference frame was not supplied. Using project default (" << p.r.reference_frame << ")" << std::endl << std::endl; + + try + { + // Okay, no frame supplied, set the frame epsg code from the project settings. + // The following throws an exception if the frame is unknown + epsgCode = epsgCodeFromName(p.r.reference_frame); + } + catch (const std::runtime_error& e) { + std::cout << std::endl << "- Error: " << e.what() << std::endl; + return EXIT_FAILURE; + } } - if (!vm.count(EPOCH)) + if (vm.count(EPOCH)) + { + // Get today's date? + if (boost::iequals(p.r.epoch, "today")) + p.r.epoch = stringFromToday(); + // Has the user supplied the year only? + else if (p.r.epoch.rfind(".") == std::string::npos) + p.r.epoch.insert(0, "01.01."); + + if (p.r.epoch.length() < 10) + p.r.epoch = FormatDateString(p.r.epoch); + } + else { try { - // Okay, no epoch supplied, so set the epoch to be the reference epoch of the reference frame - p.r.epoch = referenceepochFromEpsgCode(epsgCodeFromName(p.r.reference_frame)); + if (frameSupplied) + // Okay, frame supplied, but no epoch supplied. + // Set the epoch to be the reference epoch of the supplied reference frame + p.r.epoch = referenceepochFromEpsgCode(epsgCodeFromName(p.r.reference_frame)); + else + // Take the epoch from the project file + p.r.epoch = tmp.r.epoch; } - catch (const runtime_error& e) { - cout << endl << "- Error: " << e.what() << endl; + catch (const std::runtime_error& e) { + std::cout << std::endl << "- Error: " << e.what() << std::endl; return EXIT_FAILURE; } } if (vm.count(TECTONIC_PLATE_BDY_FILE)) { - if (!exists(p.r.tpb_file)) + if (!boost::filesystem::exists(p.r.tpb_file)) { - cout << endl << "- Error: "; - cout << endl << "tectonic plate boundary file " << endl << " "; - cout << p.r.tpb_file << " does not exist." << endl << endl; + std::cout << std::endl << "- Error: "; + std::cout << std::endl << "tectonic plate boundary file " << std::endl << " "; + std::cout << p.r.tpb_file << " does not exist." << std::endl << std::endl; return EXIT_FAILURE; } } if (vm.count(TECTONIC_PLATE_POLE_FILE)) { - if (!exists(p.r.tpp_file)) + if (!boost::filesystem::exists(p.r.tpp_file)) { - cout << endl << "- Error: "; - cout << endl << "Euler pole parameters file " << endl << " "; - cout << p.r.tpp_file << " does not exist." << endl << endl; + std::cout << std::endl << "- Error: "; + std::cout << std::endl << "Euler pole parameters file " << std::endl << " "; + std::cout << p.r.tpp_file << " does not exist." << std::endl << std::endl; return EXIT_FAILURE; } } - p.g.project_file = formPath(p.g.output_folder, p.g.network_name, "dnaproj"); - p.r.rft_file = formPath(p.g.output_folder, p.g.network_name, "rft"); - // binary station file location (input) if (vm.count(BIN_STN_FILE)) - p.r.bst_file = formPath(p.g.input_folder, p.r.bst_file); + p.r.bst_file = formPath(p.g.input_folder, p.r.bst_file); else - p.r.bst_file = formPath(p.g.output_folder, p.g.network_name, "bst"); + p.r.bst_file = formPath(p.g.output_folder, p.g.network_name, "bst"); // binary station file location (input) if (vm.count(BIN_MSR_FILE)) - p.r.bms_file = formPath(p.g.input_folder, p.r.bms_file); + p.r.bms_file = formPath(p.g.input_folder, p.r.bms_file); else - p.r.bms_file = formPath(p.g.output_folder, p.g.network_name, "bms"); + p.r.bms_file = formPath(p.g.output_folder, p.g.network_name, "bms"); - if (!exists(p.r.bst_file) || !exists(p.r.bms_file)) + if (!boost::filesystem::exists(p.r.bst_file) || !boost::filesystem::exists(p.r.bms_file)) { - cout << endl << "- Nothing to do: "; + std::cout << std::endl << "- Nothing to do: "; if (p.g.network_name.empty()) - cout << endl << "network name has not been specified specified, and " << endl << " "; - cout << p.r.bst_file << " and " << p.r.bms_file << " do not exist." << endl << endl; + std::cout << std::endl << "network name has not been specified specified, and " << std::endl << " "; + std::cout << p.r.bst_file << " and " << p.r.bms_file << " do not exist." << std::endl << std::endl; return EXIT_FAILURE; } @@ -189,12 +252,15 @@ int ParseCommandLineOptions(const int& argc, char* argv[], const variables_map& // Export options // Create file name based on the provided block - string fileName(p.g.network_name); + std::string fileName(p.g.network_name); fileName.append(".").append(p.r.reference_frame); - if (iequals(p.r.epoch, "today")) - p.r.epoch = stringFromToday(); - fileName.append(".").append(p.r.epoch); + if (!isEpsgDatumStatic(epsgCode)) + { + if (boost::iequals(p.r.epoch, "today")) + p.r.epoch = stringFromToday(); + fileName.append(".").append(p.r.epoch); + } // Export to dynaml? if (vm.count(EXPORT_XML_FILES)) @@ -205,16 +271,16 @@ int ParseCommandLineOptions(const int& argc, char* argv[], const variables_map& if (vm.count(EXPORT_SINGLE_XML_FILE)) { p.i.export_single_xml_file = 1; - p.i.xml_outfile = formPath(p.g.output_folder, + p.i.xml_outfile = formPath(p.g.output_folder, fileName, "xml"); } // unique files for stations and measurements else { p.i.export_single_xml_file = 0; - p.i.xml_stnfile = formPath(p.g.output_folder, + p.i.xml_stnfile = formPath(p.g.output_folder, fileName + "stn", "xml"); - p.i.xml_msrfile = formPath(p.g.output_folder, + p.i.xml_msrfile = formPath(p.g.output_folder, fileName + "msr", "xml"); } } @@ -223,9 +289,9 @@ int ParseCommandLineOptions(const int& argc, char* argv[], const variables_map& if (vm.count(EXPORT_DNA_FILES)) { p.i.export_dna_files = 1; - p.i.dna_stnfile = formPath(p.g.output_folder, + p.i.dna_stnfile = formPath(p.g.output_folder, fileName, "stn"); - p.i.dna_msrfile = formPath(p.g.output_folder, + p.i.dna_msrfile = formPath(p.g.output_folder, fileName, "msr"); } @@ -233,7 +299,7 @@ int ParseCommandLineOptions(const int& argc, char* argv[], const variables_map& // if (vm.count(EXPORT_SNX_FILE)) // { // p.o._export_snx_file = 1; -// p.o._snx_file = formPath(p.g.output_folder, +// p.o._snx_file = formPath(p.g.output_folder, // fileName, "snx"); // } @@ -243,57 +309,57 @@ int ParseCommandLineOptions(const int& argc, char* argv[], const variables_map& int main(int argc, char* argv[]) { // create banner message - string cmd_line_banner; + std::string cmd_line_banner; fileproc_help_header(&cmd_line_banner); project_settings p; - variables_map vm; - positional_options_description positional_options; + boost::program_options::variables_map vm; + boost::program_options::positional_options_description positional_options; - options_description standard_options("+ " + string(ALL_MODULE_STDOPT), PROGRAM_OPTIONS_LINE_LENGTH); - options_description transformation_options("+ " + string(REFTRAN_MODULE_TRANSFORM), PROGRAM_OPTIONS_LINE_LENGTH); - options_description export_options("+ " + string(ALL_MODULE_EXPORT), PROGRAM_OPTIONS_LINE_LENGTH); - options_description generic_options("+ " + string(ALL_MODULE_GENERIC), PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description standard_options("+ " + std::string(ALL_MODULE_STDOPT), PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description transformation_options("+ " + std::string(REFTRAN_MODULE_TRANSFORM), PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description export_options("+ " + std::string(ALL_MODULE_EXPORT), PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description generic_options("+ " + std::string(ALL_MODULE_GENERIC), PROGRAM_OPTIONS_LINE_LENGTH); - string cmd_line_usage("+ "); + std::string cmd_line_usage("+ "); cmd_line_usage.append(__BINARY_NAME__).append(" usage: ").append(__BINARY_NAME__).append(" ").append(NETWORK_NAME).append(" [options]"); - options_description allowable_options(cmd_line_usage, PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description allowable_options(cmd_line_usage, PROGRAM_OPTIONS_LINE_LENGTH); try { // Declare a group of options that will be // allowed only on command line standard_options.add_options() - (PROJECT_FILE_P, value(&p.g.project_file), + (PROJECT_FILE_P, boost::program_options::value(&p.g.project_file), "Project file name. Full path to project file. If none specified, a new file is created using input-folder and network-name.") - (NETWORK_NAME_N, value(&p.g.network_name), + (NETWORK_NAME_N, boost::program_options::value(&p.g.network_name), "Network name. User defined name for all output files. Default is \"network#\".") - (INPUT_FOLDER_I, value(&p.g.input_folder), + (INPUT_FOLDER_I, boost::program_options::value(&p.g.input_folder), "Path containing all input files") - (OUTPUT_FOLDER_O, value(&p.g.output_folder), // default is ./, + (OUTPUT_FOLDER_O, boost::program_options::value(&p.g.output_folder), // default is ./, "Path for all output files") - (BIN_STN_FILE, value(&p.r.bst_file), + (BIN_STN_FILE, boost::program_options::value(&p.r.bst_file), "Binary station file name. Overrides network name.") - (BIN_MSR_FILE, value(&p.r.bms_file), + (BIN_MSR_FILE, boost::program_options::value(&p.r.bms_file), "Binary measurement file name. Overrides network name.") ; transformation_options.add_options() - (REFERENCE_FRAME_R, value(&p.r.reference_frame), + (REFERENCE_FRAME_R, boost::program_options::value(&p.r.reference_frame), "Target reference frame for all stations and datum-dependent measurements.") - (EPOCH_E, value(&p.r.epoch), + (EPOCH_E, boost::program_options::value(&p.r.epoch), "Projected date for the transformed stations and measurements. arg is a dot delimited string \"dd.mm.yyyy\", or \"today\" if today's date is required. If no date is supplied, the reference epoch of the supplied reference frame will be used.") - (TECTONIC_PLATE_MODEL_OPTION, value(&p.r.plate_model_option), - string("Plate motion model option.\n" + (TECTONIC_PLATE_MODEL_OPTION, boost::program_options::value(&p.r.plate_model_option), + std::string("Plate motion model option.\n" " 0: Assume all stations are on the Australian plate (default)\n" " 1: Interpolate plate motion model parameters from a defined\n" " set of global tectonic plates. For this option, a global\n" " tectonic plate boundary file and corresponding Euler\n" " pole parameters file must be provided.").c_str()) - (TECTONIC_PLATE_BDY_FILE_B, value(&p.r.tpb_file), - string("Global tectonic plate boundaries.").c_str()) - (TECTONIC_PLATE_POLE_FILE_M, value(&p.r.tpp_file), - string("Euler pole parameters corresponding to the global tectonic plate boundaries supplied with option --" + + (TECTONIC_PLATE_BDY_FILE_B, boost::program_options::value(&p.r.tpb_file), + std::string("Global tectonic plate boundaries.").c_str()) + (TECTONIC_PLATE_POLE_FILE_M, boost::program_options::value(&p.r.tpp_file), + std::string("Euler pole parameters corresponding to the global tectonic plate boundaries supplied with option --" + StringFromT(TECTONIC_PLATE_BDY_FILE) + ".").c_str()) ; @@ -310,13 +376,13 @@ int main(int argc, char* argv[]) ; generic_options.add_options() - (VERBOSE, value(&p.g.verbose), - string("Give detailed information about what ").append(__BINARY_NAME__).append(" is doing.\n 0: No information (default)\n 1: Helpful information\n 2: Extended information\n 3: Debug level information").c_str()) + (VERBOSE, boost::program_options::value(&p.g.verbose), + std::string("Give detailed information about what ").append(__BINARY_NAME__).append(" is doing.\n 0: No information (default)\n 1: Helpful information\n 2: Extended information\n 3: Debug level information").c_str()) (QUIET, - string("Suppresses all explanation of what ").append(__BINARY_NAME__).append(" is doing unless an error occurs").c_str()) + std::string("Suppresses all explanation of what ").append(__BINARY_NAME__).append(" is doing unless an error occurs").c_str()) (VERSION_V, "Display the current program version") (HELP_H, "Show this help message") - (HELP_MODULE, value(), + (HELP_MODULE_H, boost::program_options::value(), "Provide help for a specific help category.") ; @@ -325,61 +391,61 @@ int main(int argc, char* argv[]) // add "positional options" to handle command line tokens which have no option name positional_options.add(NETWORK_NAME, -1); - command_line_parser parser(argc, argv); + boost::program_options::command_line_parser parser(argc, argv); store(parser.options(allowable_options).positional(positional_options).run(), vm); notify(vm); } catch (const std::exception& e) { - cout << "- Error: " << e.what() << endl; - cout << cmd_line_banner << allowable_options << endl; + std::cout << "- Error: " << e.what() << std::endl; + std::cout << cmd_line_banner << allowable_options << std::endl; return EXIT_FAILURE; } catch (...) { - cout << "+ Exception of unknown type!\n"; + std::cout << "+ Exception of unknown type!\n"; return EXIT_FAILURE; } if (argc < 2) { - cout << endl << "- Nothing to do - no options provided. " << endl << endl; - cout << cmd_line_banner << allowable_options << endl; + std::cout << std::endl << "- Nothing to do - no options provided. " << std::endl << std::endl; + std::cout << cmd_line_banner << allowable_options << std::endl; return EXIT_FAILURE; } if (vm.count(VERSION)) { - cout << cmd_line_banner << endl; + std::cout << cmd_line_banner << std::endl; return EXIT_SUCCESS; } if (vm.count(HELP)) { - cout << cmd_line_banner << allowable_options << endl; + std::cout << cmd_line_banner << allowable_options << std::endl; return EXIT_SUCCESS; } if (vm.count(HELP_MODULE)) { - cout << cmd_line_banner; - string original_text = vm[HELP_MODULE].as(); - string help_text = str_upper(original_text); + std::cout << cmd_line_banner; + std::string original_text = vm[HELP_MODULE].as(); + std::string help_text = str_upper(original_text); - if (str_upper(ALL_MODULE_STDOPT).find(help_text) != string::npos) { - cout << standard_options << endl; + if (str_upper(ALL_MODULE_STDOPT).find(help_text) != std::string::npos) { + std::cout << standard_options << std::endl; } - else if (str_upper(REFTRAN_MODULE_TRANSFORM).find(help_text) != string::npos) { - cout << transformation_options << endl; + else if (str_upper(REFTRAN_MODULE_TRANSFORM).find(help_text) != std::string::npos) { + std::cout << transformation_options << std::endl; } - else if (str_upper(ALL_MODULE_EXPORT).find(help_text) != string::npos) { - cout << export_options << endl; + else if (str_upper(ALL_MODULE_EXPORT).find(help_text) != std::string::npos) { + std::cout << export_options << std::endl; } - else if (str_upper(ALL_MODULE_GENERIC).find(help_text) != string::npos) { - cout << generic_options << endl; + else if (str_upper(ALL_MODULE_GENERIC).find(help_text) != std::string::npos) { + std::cout << generic_options << std::endl; } else { - cout << endl << "- Error: Help module '" << - original_text << "' is not in the list of options." << endl; + std::cout << std::endl << "- Error: Help module '" << + original_text << "' is not in the list of options." << std::endl; return EXIT_FAILURE; } @@ -390,110 +456,143 @@ int main(int argc, char* argv[]) { if (!vm.count(TECTONIC_PLATE_BDY_FILE)) { - cout << endl << "- Error: A plate boundary file must be supplied in order to interpolate plate motion model parameters. See command line help for further information." << endl; + std::cout << std::endl << "- Error: A plate boundary file must be supplied in order to interpolate plate motion model parameters. See command line help for further information." << std::endl; return EXIT_FAILURE; } if (!vm.count(TECTONIC_PLATE_POLE_FILE)) { - cout << endl << "- Error: A Euler pole parameters file must be supplied in order to interpolate plate motion model parameters. See command line help for further information." << endl; + std::cout << std::endl << "- Error: A Euler pole parameters file must be supplied in order to interpolate plate motion model parameters. See command line help for further information." << std::endl; return EXIT_FAILURE; } } - if (ParseCommandLineOptions(argc, argv, vm, p) != EXIT_SUCCESS) + // Test for a valid reference frame label + UINT32 epsgCode; + try { + epsgCode = epsgCodeFromName(p.r.reference_frame); + } + catch (const std::runtime_error& e) { + std::cout << std::endl << cmd_line_banner; + + std::cout << "- Error: " << e.what() << std::endl; + return EXIT_FAILURE; + } + + if (ParseCommandLineOptions(argc, argv, vm, p, epsgCode) != EXIT_SUCCESS) return EXIT_FAILURE; + // If the reference frame supplied is static, then force the epoch + // to be the reference epoch + if (isEpsgDatumStatic(epsgCode)) + p.r.epoch = referenceepochFromEpsgCode(epsgCode); + std::ofstream rft_file; try { // Create import log file. Throws runtime_error on failure. file_opener(rft_file, p.r.rft_file); } - catch (const runtime_error& e) { - stringstream ss; - ss << "- Error: Could not open " << p.r.rft_file << ". \n Check that the file exists and that the file is not already opened." << endl; - cout << ss.str() << e.what() << endl; + catch (const std::runtime_error& e) { + std::stringstream ss; + ss << "- Error: Could not open " << p.r.rft_file << ". \n Check that the file exists and that the file is not already opened." << std::endl; + std::cout << ss.str() << e.what() << std::endl; return EXIT_FAILURE; } + + if (vm.count(QUIET)) p.g.quiet = 1; - + if (!p.g.quiet) { - cout << endl << cmd_line_banner; + std::cout << std::endl << cmd_line_banner; - cout << "+ Options:" << endl; - cout << setw(PRINT_VAR_PAD) << left << " Network name: " << p.g.network_name << endl; - cout << setw(PRINT_VAR_PAD) << left << " Input folder: " << p.g.input_folder << endl; - cout << setw(PRINT_VAR_PAD) << left << " Output folder: " << p.g.output_folder << endl; - cout << setw(PRINT_VAR_PAD) << left << " Binary station file: " << p.r.bst_file << endl; - cout << setw(PRINT_VAR_PAD) << left << " Binary measurement file: " << p.r.bms_file << endl; - cout << setw(PRINT_VAR_PAD) << left << " Target reference frame: " << p.r.reference_frame << endl; + std::cout << "+ Options:" << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Network name: " << p.g.network_name << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Input folder: " << p.g.input_folder << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Output folder: " << p.g.output_folder << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Binary station file: " << p.r.bst_file << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Binary measurement file: " << p.r.bms_file << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Target reference frame: " << p.r.reference_frame; + if (vm.count(REFERENCE_FRAME)) + std::cout << " (user supplied)" << std::endl; + else + std::cout << " (project reference frame)" << std::endl; // try to parse user supplied string. If this fails, then there's not much point in attempting // to transform stations and measurements try { if (!p.r.epoch.empty()) - { - // Has the user supplied the year only? - if (p.r.epoch.rfind(".") == string::npos) - p.r.epoch.insert(0, "01.01."); - - cout << setw(PRINT_VAR_PAD) << left << " Target Epoch: " << - formattedDateStringFromNumericString(p.r.epoch) << endl; + { + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Target epoch: " << p.r.epoch; + if (isEpsgDatumStatic(epsgCode)) + std::cout << " (adopted reference epoch of " << p.r.reference_frame << ")"; + else + { + if (vm.count(EPOCH)) + std::cout << " (user supplied)" << std::endl; + else + { + if (vm.count(REFERENCE_FRAME)) + std::cout << " (adopted reference epoch of " << p.r.reference_frame << ")" << std::endl; + else + std::cout << " (project epoch)" << std::endl; + } + } + std::cout << std::endl; } } - catch (const runtime_error& e) { - cout << endl << "- Error: " << e.what() << endl; + catch (const std::runtime_error& e) { + std::cout << std::endl << "- Error: " << e.what() << std::endl; rft_file.close(); return EXIT_FAILURE; } catch (const RefTranException& e) { - cout << endl << "- Error: " << e.what() << endl; + std::cout << std::endl << "- Error: " << e.what() << std::endl; rft_file.close(); return EXIT_FAILURE; } catch (...) { - cout << endl << "- Error: Unknown error." << endl; + std::cout << std::endl << "- Error: Unknown error." << std::endl; rft_file.close(); return EXIT_FAILURE; } if (p.r.plate_model_option > 0) { - cout << setw(PRINT_VAR_PAD) << left << " Plate boundaries file: " << p.r.tpb_file << endl; - cout << setw(PRINT_VAR_PAD) << left << " Plate pole parameter file: " << p.r.tpp_file << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Plate boundaries file: " << p.r.tpb_file << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Plate pole parameter file: " << p.r.tpp_file << std::endl; } // Export options if (p.i.export_dynaml) { if (p.i.export_single_xml_file) - cout << setw(PRINT_VAR_PAD) << left << " DynaML output file: " << p.i.xml_outfile << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " DynaML output file: " << p.i.xml_outfile << std::endl; else { - cout << setw(PRINT_VAR_PAD) << left << " DynaML station file: " << p.i.xml_stnfile << endl; - cout << setw(PRINT_VAR_PAD) << left << " DynaML measurement file: " << p.i.xml_msrfile << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " DynaML station file: " << p.i.xml_stnfile << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " DynaML measurement file: " << p.i.xml_msrfile << std::endl; } } if (p.i.export_dna_files) { - cout << setw(PRINT_VAR_PAD) << left << " DNA station file: " << p.i.dna_stnfile << endl; - cout << setw(PRINT_VAR_PAD) << left << " DNA measurement file: " << p.i.dna_msrfile << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " DNA station file: " << p.i.dna_stnfile << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " DNA measurement file: " << p.i.dna_msrfile << std::endl; } // if (p.o._export_snx_file) -// cout << setw(PRINT_VAR_PAD) << left << " SINEX file: " << p.o._snx_file << endl; +// std::cout << std::setw(PRINT_VAR_PAD) << std::left << " SINEX file: " << p.o._snx_file << std::endl; - cout << endl; + std::cout << std::endl; } - PrintOutputFileHeaderInfo(&rft_file, p.r.rft_file, &p, "DYNADJUST REFTRAN LOG FILE"); + PrintOutputFileHeaderInfo(&rft_file, p.r.rft_file, &p, "DYNADJUST REFTRAN LOG FILE", epsgCode, vm.count(REFERENCE_FRAME), vm.count(EPOCH)); dna_reftran refTran(p, &rft_file); - stringstream ss_msg; + std::stringstream ss_msg; // Load plate boundary and euler pole information if (vm.count(TECTONIC_PLATE_MODEL_OPTION)) @@ -501,33 +600,33 @@ int main(int argc, char* argv[]) ss_msg << "+ Loading global tectonic plate boundaries and plate motion information... "; if (!p.g.quiet) - cout << ss_msg.str(); + std::cout << ss_msg.str(); rft_file << ss_msg.str(); try { refTran.LoadTectonicPlateParameters(p.r.tpb_file, p.r.tpp_file); } - catch (const runtime_error& e) { - cout << endl << "- Error: " << e.what() << endl; - rft_file << endl << "- Error: " << e.what() << endl; + catch (const std::runtime_error& e) { + std::cout << std::endl << "- Error: " << e.what() << std::endl; + rft_file << std::endl << "- Error: " << e.what() << std::endl; rft_file.close(); return EXIT_FAILURE; } if (!p.g.quiet) - cout << "done." << endl; + std::cout << "done." << std::endl; if (p.g.verbose == 0) - rft_file << "done." << endl; + rft_file << "done." << std::endl; else - rft_file << endl << "+ Done." << endl << endl; + rft_file << std::endl << "+ Done." << std::endl << std::endl; } ss_msg.str(""); ss_msg << "+ Transforming stations and measurements... "; if (!p.g.quiet) - cout << ss_msg.str(); + std::cout << ss_msg.str(); rft_file << ss_msg.str(); ss_msg.str(""); @@ -538,9 +637,9 @@ int main(int argc, char* argv[]) refTran.TransformBinaryFiles(p.r.bst_file, p.r.bms_file, p.r.reference_frame, p.r.epoch); } - catch (const runtime_error& e) { - cout << endl << "- Error: " << e.what() << endl; - rft_file << endl << "- Error: " << e.what() << endl; + catch (const std::runtime_error& e) { + std::cout << std::endl << "- Error: " << e.what() << std::endl; + rft_file << std::endl << "- Error: " << e.what() << std::endl; rft_file.close(); return EXIT_FAILURE; } @@ -550,25 +649,25 @@ int main(int argc, char* argv[]) case REFTRAN_WGS84_TRANS_UNSUPPORTED: break; } - cout << endl << endl << "- Error: " << e.what() << endl; - rft_file << endl << endl << "- Error: " << e.what() << endl; + std::cout << std::endl << std::endl << "- Error: " << e.what() << std::endl; + rft_file << std::endl << std::endl << "- Error: " << e.what() << std::endl; rft_file.close(); return EXIT_FAILURE; } catch (...) { - cout << endl << "- Error: Unknown error." << endl; - rft_file << endl << "- Error: Unknown error." << endl; + std::cout << std::endl << "- Error: Unknown error." << std::endl; + rft_file << std::endl << "- Error: Unknown error." << std::endl; rft_file.close(); return EXIT_FAILURE; } if (!p.g.quiet) - cout << "done." << endl; + std::cout << "done." << std::endl; if (p.g.verbose == 0) - rft_file << "done." << endl; + rft_file << "done." << std::endl; else - rft_file << endl << "+ Done." << endl << endl; + rft_file << std::endl << "+ Done." << std::endl << std::endl; ss_msg.str(""); @@ -578,15 +677,15 @@ int main(int argc, char* argv[]) ss_msg << "+ Transformed " << refTran.StationsTransformed(); if (refTran.StationsTransformed() == 1) - ss_msg << " station." << endl; + ss_msg << " station." << std::endl; else - ss_msg << " stations." << endl; + ss_msg << " stations." << std::endl; } else - ss_msg << "+ No stations were transformed." << endl; + ss_msg << "+ No stations were transformed." << std::endl; if (!p.g.quiet) - cout << ss_msg.str(); + std::cout << ss_msg.str(); rft_file << ss_msg.str(); ss_msg.str(""); @@ -605,13 +704,16 @@ int main(int argc, char* argv[]) ss_msg << " stations were"; ss_msg << " already referenced to " << p.r.reference_frame; - if (!p.r.epoch.empty()) - ss_msg << ", epoch " << p.r.epoch; - ss_msg << endl; + if (!isEpsgDatumStatic(epsgCode)) + { + if (!p.r.epoch.empty()) + ss_msg << ", epoch " << p.r.epoch; + } + ss_msg << std::endl; } if (!p.g.quiet) - cout << ss_msg.str(); + std::cout << ss_msg.str(); rft_file << ss_msg.str(); ss_msg.str(""); @@ -622,15 +724,15 @@ int main(int argc, char* argv[]) ss_msg << "+ Transformed " << refTran.MeasurementsTransformed(); if (refTran.MeasurementsTransformed() == 1) - ss_msg << " measurement." << endl; + ss_msg << " measurement." << std::endl; else - ss_msg << " measurements." << endl; + ss_msg << " measurements." << std::endl; } else - ss_msg << "+ No measurements were transformed." << endl; + ss_msg << "+ No measurements were transformed." << std::endl; if (!p.g.quiet) - cout << ss_msg.str(); + std::cout << ss_msg.str(); rft_file << ss_msg.str(); ss_msg.str(""); @@ -649,14 +751,17 @@ int main(int argc, char* argv[]) ss_msg << " measurements were"; ss_msg << " already referenced to " << p.r.reference_frame; - if (!p.r.epoch.empty()) - ss_msg << ", epoch " << p.r.epoch; - ss_msg << endl; + if (!isEpsgDatumStatic(epsgCode)) + { + if (!p.r.epoch.empty()) + ss_msg << ", epoch " << p.r.epoch; + } + ss_msg << std::endl; } if (!p.g.quiet) - cout << ss_msg.str() << endl; - rft_file << ss_msg.str() << endl; + std::cout << ss_msg.str() << std::endl; + rft_file << ss_msg.str() << std::endl; ss_msg.str(""); @@ -669,9 +774,9 @@ int main(int argc, char* argv[]) // Single output file if (!p.g.quiet) { - cout << "+ Exporting stations and measurements to " << leafStr(p.i.xml_outfile) << "... "; - cout.flush(); - rft_file << "+ Exporting stations and measurements to " << leafStr(p.i.xml_outfile) << "... "; + std::cout << "+ Exporting stations and measurements to " << leafStr(p.i.xml_outfile) << "... "; + std::cout.flush(); + rft_file << "+ Exporting stations and measurements to " << leafStr(p.i.xml_outfile) << "... "; } refTran.SerialiseDynaML( p.i.xml_outfile, @@ -682,9 +787,13 @@ int main(int argc, char* argv[]) // Separate output files (default) if (!p.g.quiet) { - cout << "+ Exporting stations and measurements to " << leafStr(p.i.xml_stnfile) << " and " << leafStr(p.i.xml_msrfile) << "... "; - cout.flush(); - rft_file << "+ Exporting stations and measurements to " << leafStr(p.i.xml_stnfile) << " and " << leafStr(p.i.xml_msrfile) << "... "; + std::cout << "+ Exporting stations and measurements to:" << std::endl << + " - " << leafStr(p.i.xml_stnfile) << std::endl << + " - " << leafStr(p.i.xml_msrfile) << "... "; + std::cout.flush(); + rft_file << "+ Exporting stations and measurements to:" << std::endl << + " - " << leafStr(p.i.xml_stnfile) << std::endl << + " - " << leafStr(p.i.xml_msrfile) << "... "; } refTran.SerialiseDynaML( p.i.xml_stnfile, p.i.xml_msrfile, @@ -693,17 +802,17 @@ int main(int argc, char* argv[]) if (!p.g.quiet) { - cout << "done." << endl; - cout.flush(); + std::cout << "done." << std::endl; + std::cout.flush(); } - rft_file << "done." << endl; + rft_file << "done." << std::endl; } catch (const XMLInteropException& e) { - cout.flush(); - cout << endl << "- Error: " << e.what() << endl; - rft_file << endl << "- Error: " << e.what() << endl; + std::cout.flush(); + std::cout << std::endl << "- Error: " << e.what() << std::endl; + rft_file << std::endl << "- Error: " << e.what() << std::endl; rft_file.close(); return EXIT_FAILURE; } @@ -715,25 +824,27 @@ int main(int argc, char* argv[]) // Separate output files (default) if (!p.g.quiet) { - cout << "+ Exporting stations and measurements to " << - leafStr(p.i.dna_stnfile) << " and " << leafStr(p.i.dna_msrfile) << "... "; - cout.flush(); + std::cout << "+ Exporting stations and measurements to:" << std::endl << + " - " << leafStr(p.i.dna_stnfile) << std::endl << + " - " << leafStr(p.i.dna_msrfile) << "... "; + std::cout.flush(); } - rft_file << "+ Exporting stations and measurements to " << - leafStr(p.i.dna_stnfile) << " and " << leafStr(p.i.dna_msrfile) << "... "; + rft_file << "+ Exporting stations and measurements to:" << std::endl << + " - " << leafStr(p.i.dna_stnfile) << std::endl << + " - " << leafStr(p.i.dna_msrfile) << "... "; refTran.SerialiseDNA( p.i.dna_stnfile, p.i.dna_msrfile, (p.i.flag_unused_stn ? true : false)); if (!p.g.quiet) - cout << "Done." << endl; - rft_file << "Done." << endl; + std::cout << "Done." << std::endl; + rft_file << "Done." << std::endl; } catch (const XMLInteropException& e) { - cout.flush(); - cout << endl << "- Error: " << e.what() << endl; - rft_file << endl << "- Error: " << e.what() << endl; + std::cout.flush(); + std::cout << std::endl << "- Error: " << e.what() << std::endl; + rft_file << std::endl << "- Error: " << e.what() << std::endl; rft_file.close(); return EXIT_FAILURE; } @@ -744,40 +855,40 @@ int main(int argc, char* argv[]) // { // // Export to SINEX // if (!p.g.quiet) -// cout << "+ Exporting stations and measurements to " << -// leafStr(p.o._snx_file) << "... "; -// cout.flush(); +// std::cout << "+ Exporting stations and measurements to " << +// leafStr(p.o._snx_file) << "... "; +// std::cout.flush(); // rft_file << "+ Exporting stations and measurements to " << -// leafStr(p.o._snx_file) << "... "; +// leafStr(p.o._snx_file) << "... "; // // bool success(refTran.PrintTransformedStationCoordinatestoSNX()); // // // SomeFunc() // if (!p.g.quiet) -// cout << " done." << endl; -// rft_file << " done." << endl; +// std::cout << " done." << std::endl; +// rft_file << " done." << std::endl; // // ss_msg.str(""); // // if (!success) // { -// ss_msg << "- Warning: The SINEX export process produced some warnings." << endl; -// ss_msg << " See " << p.g.network_name << "*.snx.err for details." << endl; +// ss_msg << "- Warning: The SINEX export process produced some warnings." << std::endl; +// ss_msg << " See " << p.g.network_name << "*.snx.err for details." << std::endl; // } -// cout << ss_msg.str(); +// std::cout << ss_msg.str(); // rft_file << ss_msg.str(); // } if (!p.g.quiet) { - cout << endl; + std::cout << std::endl; } // Look for a project file. If it exists, open and load it. // Update the import settings. // Print the project file. If it doesn't exist, it will be created. CDnaProjectFile projectFile; - if (exists(p.g.project_file)) + if (boost::filesystem::exists(p.g.project_file)) projectFile.LoadProjectFile(p.g.project_file); projectFile.UpdateSettingsReftran(p); diff --git a/dynadjust/dynadjust/dnareftranwrapper/dnareftranwrapper.hpp b/dynadjust/dynadjust/dnareftranwrapper/dnareftranwrapper.hpp index b35116e4..4dd9fa88 100644 --- a/dynadjust/dynadjust/dnareftranwrapper/dnareftranwrapper.hpp +++ b/dynadjust/dynadjust/dnareftranwrapper/dnareftranwrapper.hpp @@ -62,16 +62,6 @@ #include #include - -using namespace std; -using namespace boost; -using namespace boost::gregorian; -using namespace boost::filesystem; -using namespace boost::posix_time; -using namespace boost::local_time; -using namespace boost::program_options; -namespace po = boost::program_options; - using namespace dynadjust::referenceframe; using namespace dynadjust::exception; using namespace dynadjust::iostreams; diff --git a/dynadjust/dynadjust/dnasegment/dnasegment.cpp b/dynadjust/dynadjust/dnasegment/dnasegment.cpp index 72330555..5437e789 100644 --- a/dynadjust/dynadjust/dnasegment/dnasegment.cpp +++ b/dynadjust/dynadjust/dnasegment/dnasegment.cpp @@ -21,11 +21,9 @@ //============================================================================ #include -#ifdef _MSDEBUG -#include -#endif -namespace dynadjust { namespace networksegment { +namespace dynadjust { +namespace networksegment { dna_segment::dna_segment() : isProcessing_(false) @@ -51,13 +49,13 @@ void dna_segment::LoadNetFile() try { // Load net file. Throws runtime_error on failure. file_opener(net_file, projectSettings_.s.net_file, - ios::in, ascii, true); + std::ios::in, ascii, true); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionSerialise(e.what(), 0, NULL); } - string station; + std::string station; char line[PROGRAM_OPTIONS_LINE_LENGTH]; // read header lines @@ -78,12 +76,12 @@ void dna_segment::LoadNetFile() vinitialStns_.push_back(station); } } - catch (const ios_base::failure& f) { + catch (const std::ios_base::failure& f) { if (!net_file.eof()) { - stringstream ss; - ss << "ParseStartingStations(): An error was encountered when reading " << projectSettings_.s.net_file << "." << endl << f.what(); + std::stringstream ss; + ss << "ParseStartingStations(): An error was encountered when reading " << projectSettings_.s.net_file << "." << std::endl << f.what(); SignalExceptionSerialise(ss.str(), 0, "i", &net_file); } } @@ -97,7 +95,7 @@ void dna_segment::ParseStartingStations() // Rememeber, calling app should make sure that // projectSettings_.s.net_file contains a valid path if // the user wants to use a net file. - if (exists(projectSettings_.s.net_file.c_str())) + if (boost::filesystem::exists(projectSettings_.s.net_file.c_str())) LoadNetFile(); // OK, now get the additionalstations on the command line @@ -108,9 +106,9 @@ void dna_segment::ParseStartingStations() try { // Extract stations from comma delimited string - SplitDelimitedString( + SplitDelimitedString( projectSettings_.s.seg_starting_stns, // the comma delimited string - string(","), // the delimiter + std::string(","), // the delimiter &cmd_line_stations); // the respective values } catch (...) { @@ -177,33 +175,33 @@ _SEGMENT_STATUS_ dna_segment::SegmentNetwork(project_settings* p) if ((debug_level_ = p->g.verbose) > 2) { - string s(p->s.seg_file + ".trace"); + std::string s(p->s.seg_file + ".trace"); try { // Create trace file. Throws runtime_error on failure. file_opener(trace_file, s); print_file_header(trace_file, "DYNADJUST SEGMENTATION TRACE FILE"); - trace_file << OUTPUTLINE << endl << endl; + trace_file << OUTPUTLINE << std::endl << std::endl; } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionSerialise(e.what(), 0, NULL); } } if ((debug_level_ = p->g.verbose) > 1) { - string s(p->s.seg_file + ".debug"); + std::string s(p->s.seg_file + ".debug"); try { // Create debug file. Throws runtime_error on failure. file_opener(debug_file, s); } - catch (const ios_base::failure& f) { + catch (const std::ios_base::failure& f) { SignalExceptionSerialise(f.what(), 0, NULL); } } segmentStatus_ = SEGMENT_SUCCESS; - ostringstream ss; + std::ostringstream ss; if (debug_level_ > 2) WriteFreeStnListSortedbyASLMsrCount(); @@ -211,9 +209,9 @@ _SEGMENT_STATUS_ dna_segment::SegmentNetwork(project_settings* p) currentBlock_ = 1; if (debug_level_ > 2) - trace_file << "Block " << currentBlock_ << "..." << endl; + trace_file << "Block " << currentBlock_ << "..." << std::endl; - cpu_timer time; + boost::timer::cpu_timer time; v_ContiguousNetList_.clear(); v_ContiguousNetList_.push_back(currentNetwork_ = 0); @@ -240,7 +238,7 @@ _SEGMENT_STATUS_ dna_segment::SegmentNetwork(project_settings* p) currentBlock_++; if (debug_level_ > 2) - trace_file << "Block " << currentBlock_ << "..." << endl; + trace_file << "Block " << currentBlock_ << "..." << std::endl; v_ContiguousNetList_.push_back(currentNetwork_); @@ -253,9 +251,9 @@ _SEGMENT_STATUS_ dna_segment::SegmentNetwork(project_settings* p) break; } - milliseconds elapsed_time(milliseconds(0)); + boost::posix_time::milliseconds elapsed_time(boost::posix_time::milliseconds(0)); if (debug_level_ > 1) - elapsed_time = milliseconds(time.elapsed().wall/MILLI_TO_NANO); + elapsed_time = boost::posix_time::milliseconds(time.elapsed().wall/MILLI_TO_NANO); isProcessing_ = false; @@ -267,16 +265,16 @@ _SEGMENT_STATUS_ dna_segment::SegmentNetwork(project_settings* p) { valid_stations = 1; ss.str(""); - ss << endl << "- Warning: The following stations were not used:" << endl; + ss << std::endl << "- Warning: The following stations were not used:" << std::endl; ss << " "; it_vUINT32_const _it_freestn(vfreeStnList_.begin()); for (; _it_freestn!=vfreeStnList_.end(); ++_it_freestn) ss << bstBinaryRecords_.at(*_it_freestn).stationName << " "; - ss << endl; - ss << "- Possible reasons why these stations were not used include:" << endl; - ss << " - No measurements to these stations were found," << endl; - ss << " - The network is made up of non-contiguous blocks," << endl; - ss << " - There is a bug in this program." << endl; + ss << std::endl; + ss << "- Possible reasons why these stations were not used include:" << std::endl; + ss << " - No measurements to these stations were found," << std::endl; + ss << " - The network is made up of non-contiguous blocks," << std::endl; + ss << " - There is a bug in this program." << std::endl; if (debug_level_ > 1) debug_file << ss.str(); @@ -284,8 +282,8 @@ _SEGMENT_STATUS_ dna_segment::SegmentNetwork(project_settings* p) if (debug_level_ > 1) { - debug_file << formatedElapsedTime(&elapsed_time, "+ Network segmentation took ") << - " The network is now ready for adjustment." << endl; + debug_file << formatedElapsedTime(&elapsed_time, "+ Network segmentation took ") << + " The network is now ready for adjustment." << std::endl; debug_file.close(); } @@ -317,7 +315,7 @@ void dna_segment::CalculateAverageBlockSize() } -string dna_segment::DefaultStartingStation() +std::string dna_segment::DefaultStartingStation() { if (vfreeStnList_.empty()) return ""; @@ -377,7 +375,7 @@ void dna_segment::VerifyStationsandBuildBlock(bool validationOnly) if (it_stnmap_range.first == it_stnmap_range.second) { // If this point is reached, _it_stnmap->second is not a known network station - stringstream ss; + std::stringstream ss; ss << "VerifyStationsandBuildBlock(): " << *_it_name << " is not in the list of network stations."; SignalExceptionSerialise(ss.str(), 0, NULL); } @@ -412,7 +410,7 @@ void dna_segment::VerifyStationsandBuildBlock(bool validationOnly) { // If this point is reached, _it_stnmap->second is a known network station but is // invalid or has no measurements connected to it. - stringstream ss; + std::stringstream ss; ss << "VerifyStationsandBuildBlock(): " << bstBinaryRecords_.at(_it_stnmap->second).stationName << " does not have any measurements connected to it."; SignalExceptionSerialise(ss.str(), 0, NULL); } @@ -436,10 +434,10 @@ UINT32 dna_segment::SelectInner() UINT32 stn_index = *it_currjsl; if (debug_level_ > 2) - trace_file << " + Inner '" << bstBinaryRecords_.at(stn_index).stationName << "'" << endl; + trace_file << " + Inner '" << bstBinaryRecords_.at(stn_index).stationName << "'" << std::endl; #ifdef _MSDEBUG - string station_name = bstBinaryRecords_.at(stn_index).stationName; + std::string station_name = bstBinaryRecords_.at(stn_index).stationName; #endif // add this junction station to inner station list @@ -470,14 +468,14 @@ it_vUINT32 dna_segment::MoveStation(vUINT32& fromList, it_vUINT32 it_from, vUINT } -void dna_segment::MoveFreeStn(it_vUINT32 it_freeisl, vUINT32& toList, const UINT32& stn_index, const string& type) +void dna_segment::MoveFreeStn(it_vUINT32 it_freeisl, vUINT32& toList, const UINT32& stn_index, const std::string& type) { if (debug_level_ > 2) trace_file << " + New " << type << " station (" << stn_index << ") '" << - bstBinaryRecords_.at(stn_index).stationName << "'" << endl; + bstBinaryRecords_.at(stn_index).stationName << "'" << std::endl; #ifdef _MSDEBUG - string station_name = bstBinaryRecords_.at(stn_index).stationName; + std::string station_name = bstBinaryRecords_.at(stn_index).stationName; #endif // Mark this station as unavailable @@ -512,7 +510,7 @@ void dna_segment::BuildNextBlock() vCurrMeasurementList_.clear(); #ifdef _MSDEBUG - string station_name; + std::string station_name; #endif // Select a new junction station if there are none on the JSL @@ -524,9 +522,9 @@ void dna_segment::BuildNextBlock() if (debug_level_ > 1) { - debug_file << "+ Non-contiguous block found... creating a new block using " << bstBinaryRecords_.at(vfreeStnList_.at(0)).stationName << endl; + debug_file << "+ Non-contiguous block found... creating a new block using " << bstBinaryRecords_.at(vfreeStnList_.at(0)).stationName << std::endl; if (debug_level_ > 2) - trace_file << " + Non-contiguous block found... creating a new block using " << bstBinaryRecords_.at(vfreeStnList_.at(0)).stationName << endl; + trace_file << " + Non-contiguous block found... creating a new block using " << bstBinaryRecords_.at(vfreeStnList_.at(0)).stationName << std::endl; } // Select a new junction from the free station list @@ -589,9 +587,9 @@ void dna_segment::BuildNextBlock() if (debug_level_ > 2) { if (block_threshold_reached) - trace_file << " + Block size threshold exceeded... finishing block." << endl; + trace_file << " + Block size threshold exceeded... finishing block." << std::endl; else - trace_file << " + Block " << currentBlock_ << " complete." << endl; + trace_file << " + Block " << currentBlock_ << " complete." << std::endl; } FinaliseBlock(); @@ -603,8 +601,8 @@ void dna_segment::FinaliseBlock() MoveJunctiontoISL(); // Sort lists - sort(vCurrInnerStnList_.begin(), vCurrInnerStnList_.end()); - sort(vCurrJunctStnList_.begin(), vCurrJunctStnList_.end()); + std::sort(vCurrInnerStnList_.begin(), vCurrInnerStnList_.end()); + std::sort(vCurrJunctStnList_.begin(), vCurrJunctStnList_.end()); strip_duplicates(vCurrMeasurementList_); // remove duplicates and sort vISL_.push_back(vCurrInnerStnList_); @@ -623,22 +621,22 @@ void dna_segment::FinaliseBlock() currentTotalSize = currentISLSize + currentJSLSize; currentMsrSize = static_cast(vCurrMeasurementList_.size()); - trace_file << " + Done." << endl; - trace_file << " + BLOCK " << currentBlock_ << " SUMMARY:" << endl; + trace_file << " + Done." << std::endl; + trace_file << " + BLOCK " << currentBlock_ << " SUMMARY:" << std::endl; trace_file << " - " << currentISLSize << " inner stations, " << currentJSLSize << " junction stations, "; - trace_file << currentTotalSize << " total stations, " << currentMsrSize << " measurements." << endl; + trace_file << currentTotalSize << " total stations, " << currentMsrSize << " measurements." << std::endl; - trace_file << " - Inners (" << currentISLSize << "):" << endl << " "; + trace_file << " - Inners (" << currentISLSize << "):" << std::endl << " "; it_vUINT32_const _it_freeisl(vfreeStnList_.end()); for (_it_freeisl=vCurrInnerStnList_.begin(); _it_freeisl!=vCurrInnerStnList_.end(); ++_it_freeisl) trace_file << "'" << bstBinaryRecords_.at(*_it_freeisl).stationName << "' "; - trace_file << endl; + trace_file << std::endl; - trace_file << " - Junctions (" << currentJSLSize << "):" << endl << " "; + trace_file << " - Junctions (" << currentJSLSize << "):" << std::endl << " "; for (_it_freeisl=vCurrJunctStnList_.begin(); _it_freeisl!=vCurrJunctStnList_.end(); ++_it_freeisl) trace_file << "'" << bstBinaryRecords_.at(*_it_freeisl).stationName << "' "; - trace_file << endl << " + ------------------------------------------" << endl; + trace_file << std::endl << " + ------------------------------------------" << std::endl; } } } @@ -692,10 +690,10 @@ void dna_segment::FinaliseBlock() void dna_segment::GetInnerMeasurements(const UINT32& innerStation) { if (debug_level_ > 2) - trace_file << " + GetInnerMeasurements()" << endl; + trace_file << " + GetInnerMeasurements()" << std::endl; #ifdef _MSDEBUG - string from, to, to2; + std::string from, to, to2; #endif measurement_t measRecord; @@ -765,7 +763,7 @@ bool dna_segment::AddtoCurrentMsrList(const UINT32& amlIndex, const vUINT32& msr #ifdef _MSDEBUG measurement_t msr(bmsBinaryRecords_.at(bmsrindex)); char measType(msr.measType); - string station; + std::string station; UINT32 stn_index; #endif @@ -826,7 +824,7 @@ bool dna_segment::AddtoCurrentMsrList(const UINT32& amlIndex, const vUINT32& msr } if (debug_level_ > 2) - trace_file << endl; + trace_file << std::endl; return true; } @@ -842,17 +840,17 @@ void dna_segment::FindCommonMeasurements() // Create a temporary vector vUINT32 vCurrBlockStnList(vCurrJunctStnList_), msrStations; - sort(vCurrBlockStnList.begin(), vCurrBlockStnList.end()); + std::sort(vCurrBlockStnList.begin(), vCurrBlockStnList.end()); it_vUINT32 _it_stn, _it_mstn; measurement_t measRecord; bool inList; if (debug_level_ > 2) - trace_file << " + FindCommonMeasurements()" << endl; + trace_file << " + FindCommonMeasurements()" << std::endl; #ifdef _MSDEBUG - string stn; + std::string stn; #endif UINT32 m, msrCount, amlIndex; @@ -935,10 +933,10 @@ void dna_segment::MoveJunctiontoISL() // Move stations on the current junction station list to the inner station list if // there are no more measurements tied to this station if (debug_level_ > 2) - trace_file << " + MoveJunctiontoISL()" << endl; + trace_file << " + MoveJunctiontoISL()" << std::endl; #ifdef _MSDEBUG - string station_name; + std::string station_name; #endif it_vUINT32 _it_currjsl(vCurrJunctStnList_.begin()); @@ -958,7 +956,7 @@ void dna_segment::MoveJunctiontoISL() if (debug_level_ > 2) trace_file << " - Junction station '" << bstBinaryRecords_.at(static_cast(stn_index)).stationName << - "' was moved to inner list (no more available measurements)." << endl; + "' was moved to inner list (no more available measurements)." << std::endl; // Move this station from the junctions list to inners list _it_currjsl = MoveStation(vCurrJunctStnList_, _it_currjsl, @@ -1017,7 +1015,7 @@ void dna_segment::AddtoJunctionStnList(const vUINT32& msrStations) // Purpose: Closes all files (if file pointers are passed in) and throws NetSegmentException // Called by: Any // Calls: NetSegmentException() -void dna_segment::SignalExceptionSerialise(const string& msg, const int& i, const char *streamType, ...) +void dna_segment::SignalExceptionSerialise(const std::string& msg, const int& i, const char *streamType, ...) { isProcessing_ = false; segmentStatus_ = SEGMENT_EXCEPTION_RAISED; @@ -1061,7 +1059,7 @@ void dna_segment::SignalExceptionSerialise(const string& msg, const int& i, cons throw NetSegmentException(msg, i); } -void dna_segment::LoadAssociationFiles(const string& aslfileName, const string& amlfileName) +void dna_segment::LoadAssociationFiles(const std::string& aslfileName, const std::string& amlfileName) { UINT32 stn, stnCount(0); @@ -1069,7 +1067,7 @@ void dna_segment::LoadAssociationFiles(const string& aslfileName, const string& dna_io_asl asl; stnCount = asl.load_asl_file(aslfileName, &vAssocStnList_, &vfreeStnList_); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionSerialise(e.what(), 0, NULL); } @@ -1093,7 +1091,7 @@ void dna_segment::LoadAssociationFiles(const string& aslfileName, const string& dna_io_aml aml; aml.load_aml_file(amlfileName, &vAssocFreeMsrList_, &bmsBinaryRecords_); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionSerialise(e.what(), 0, NULL); } @@ -1102,18 +1100,18 @@ void dna_segment::LoadAssociationFiles(const string& aslfileName, const string& } -void dna_segment::LoadStationMap(const string& stnmap_file) +void dna_segment::LoadStationMap(const std::string& stnmap_file) { try { dna_io_map map; map.load_map_file(stnmap_file, &stnsMap_); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionSerialise(e.what(), 0, NULL); } } -void dna_segment::LoadBinaryFiles(const string& bstrfileName, const string& bmsrfileName) +void dna_segment::LoadBinaryFiles(const std::string& bstrfileName, const std::string& bmsrfileName) { binary_file_meta_t bst_meta_, bms_meta_; try { @@ -1125,7 +1123,7 @@ void dna_segment::LoadBinaryFiles(const string& bstrfileName, const string& bmsr dna_io_bms bms; bms.load_bms_file(bmsrfileName, &bmsBinaryRecords_, bms_meta_); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionSerialise(e.what(), 0, NULL); } @@ -1139,9 +1137,9 @@ void dna_segment::LoadBinaryFiles(const string& bstrfileName, const string& bmsr // throw an exception if no measurements are available if (m == 0) { - stringstream ss; - ss << "No measurements were found." << endl << - " If measurements were successfully loaded on import, ensure that\n all measurements have not been ignored." << endl; + std::stringstream ss; + ss << "No measurements were found." << std::endl << + " If measurements were successfully loaded on import, ensure that\n all measurements have not been ignored." << std::endl; SignalExceptionSerialise(ss.str(), 0, NULL); } } @@ -1253,7 +1251,7 @@ void dna_segment::SortbyMeasurementCount(pvUINT32 vStnList) return; // sort vStnList by number of measurements to each station (held by vAssocStnList CompareMeasCount msrcountCompareFunc(&vAssocStnList_); - sort(vStnList->begin(), vStnList->end(), msrcountCompareFunc); + std::sort(vStnList->begin(), vStnList->end(), msrcountCompareFunc); // Search lower level if (projectSettings_.s.seg_search_level == 0) @@ -1320,7 +1318,7 @@ void dna_segment::SetAvailableMsrCount() void dna_segment::RemoveInvalidFreeStations() { CompareValidity aslValidityCompareFunc(&vAssocStnList_, FALSE); - sort(vfreeStnList_.begin(), vfreeStnList_.end(), aslValidityCompareFunc); + std::sort(vfreeStnList_.begin(), vfreeStnList_.end(), aslValidityCompareFunc); erase_if(vfreeStnList_, aslValidityCompareFunc); } @@ -1346,7 +1344,7 @@ void dna_segment::RemoveDuplicateStations(pvstring vStations) // if (vfreeMsrList_.size() < 2) // return; // CompareNonMeasStart measstartCompareFunc(&bmsBinaryRecords_, xMeas); -// sort(vfreeMsrList_.begin(), vfreeMsrList_.end(), measstartCompareFunc); +// std::sort(vfreeMsrList_.begin(), vfreeMsrList_.end(), measstartCompareFunc); // erase_if(vfreeMsrList_, measstartCompareFunc); // //} @@ -1357,7 +1355,7 @@ void dna_segment::RemoveDuplicateStations(pvstring vStations) // if (vfreeMsrList_.size() < 2) // return; // CompareIgnoreedMeas ignoremeasCompareFunc(&bmsBinaryRecords_); -// sort(vfreeMsrList_.begin(), vfreeMsrList_.end(), ignoremeasCompareFunc); +// std::sort(vfreeMsrList_.begin(), vfreeMsrList_.end(), ignoremeasCompareFunc); // erase_if(vfreeMsrList_, ignoremeasCompareFunc); // //} @@ -1365,17 +1363,17 @@ void dna_segment::RemoveDuplicateStations(pvstring vStations) void dna_segment::WriteFreeStnListSortedbyASLMsrCount() { - if (!exists(output_folder_)) + if (!boost::filesystem::exists(output_folder_)) { - stringstream ss("WriteFreeStnListSortedbyASLMsrCount(): Path does not exist... \n\n "); + std::stringstream ss("WriteFreeStnListSortedbyASLMsrCount(): Path does not exist... \n\n "); ss << output_folder_ << "."; SignalExceptionSerialise(ss.str(), 0, NULL); } - string file(output_folder_ + "/free_stn_sorted_by_msr_count.lst"); + std::string file(output_folder_ + "/free_stn_sorted_by_msr_count.lst"); std::ofstream freestnlist(file.c_str()); UINT32 x(0); - string s; + std::string s; UINT32 u, msrCount, m, amlindex; for (; x(_it_isl->size()); - cout << "+ Segmentation summary:" << endl << endl; - cout << setw(BLOCK) << left << " Block" << setw(JUNCT) << left << "Junction stns" << setw(INNER) << left << "Inner stns" << setw(MEASR) << left << "Measurements" << setw(TOTAL) << left << "Total stns" << endl; - cout << " "; + std::cout << "+ Segmentation summary:" << std::endl << std::endl; + std::cout << std::setw(BLOCK) << std::left << " Block" << std::setw(JUNCT) << std::left << "Junction stns" << std::setw(INNER) << std::left << "Inner stns" << std::setw(MEASR) << std::left << "Measurements" << std::setw(TOTAL) << std::left << "Total stns" << std::endl; + std::cout << " "; for (char dash=BLOCK+NETID+INNER+JUNCT+TOTAL+MEASR; dash>2; dash--) - cout << "-"; - cout << endl; + std::cout << "-"; + std::cout << std::endl; UINT32 b = 1; _it_jsl = vJSL_.begin(); _it_cml = vCML_.begin(); for (_it_isl=vISL_.begin(); _it_isl!=vISL_.end(); ++_it_isl) { // block - cout << " " << setw(BLOCK-2) << left << b; + std::cout << " " << std::setw(BLOCK-2) << std::left << b; // junction stns if (_it_jsl!=vJSL_.end()) - cout << setw(JUNCT) << left << _it_jsl->size(); + std::cout << std::setw(JUNCT) << std::left << _it_jsl->size(); else - cout << setw(JUNCT) << " "; + std::cout << std::setw(JUNCT) << " "; // inner stns - cout << setw(INNER) << left << _it_isl->size(); + std::cout << std::setw(INNER) << std::left << _it_isl->size(); // total measurements if (_it_cml!=vCML_.end()) - cout << setw(MEASR) << left << _it_cml->size(); + std::cout << std::setw(MEASR) << std::left << _it_cml->size(); else - cout << setw(MEASR) << " "; + std::cout << std::setw(MEASR) << " "; // total stns if (_it_jsl!=vJSL_.end()) - cout << setw(TOTAL) << left << (_it_isl->size() + _it_jsl->size()); + std::cout << std::setw(TOTAL) << std::left << (_it_isl->size() + _it_jsl->size()); else - cout << setw(TOTAL) << left << _it_isl->size(); + std::cout << std::setw(TOTAL) << std::left << _it_isl->size(); - cout << endl; + std::cout << std::endl; ++_it_jsl; ++_it_cml; b++; } - cout << endl; + std::cout << std::endl; - cout << "+ Stations used: " << setw(10) << right << stns << endl; - cout << "+ Measurements used: " << setw(10) << right << msrs << endl; + std::cout << "+ Stations used: " << std::setw(10) << std::right << stns << std::endl; + std::cout << "+ Measurements used: " << std::setw(10) << std::right << msrs << std::endl; if (!vfreeStnList_.empty()) - cout << "+ Unused stations: " << setw(10) << right << vfreeStnList_.size() << endl; + std::cout << "+ Unused stations: " << std::setw(10) << std::right << vfreeStnList_.size() << std::endl; //if (!vfreeMsrList_.empty()) - // cout << "+ Unused measurements: " << setw(10) << right << vfreeMsrList_.size() << endl; + // std::cout << "+ Unused measurements: " << std::setw(10) << std::right << vfreeMsrList_.size() << std::endl; } -void dna_segment::WriteSegmentedNetwork(const string& segfileName) +void dna_segment::WriteSegmentedNetwork(const std::string& segfileName) { if (bstBinaryRecords_.empty()) SignalExceptionSerialise("WriteSegmentedNetwork(): the binary stations file has not been loaded into memory yet.", 0, NULL); @@ -1508,7 +1506,7 @@ void dna_segment::WriteSegmentedNetwork(const string& segfileName) vISL_, vJSL_, vCML_, v_ContiguousNetList_, &bstBinaryRecords_, &bmsBinaryRecords_); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { SignalExceptionSerialise(e.what(), 0, NULL); } catch (...) { @@ -1531,7 +1529,7 @@ void dna_segment::VerifyStationConnections_Block(const UINT32& block) vUINT32 unusedStns, msrStations, allmsrStations; #ifdef _MSDEBUG - string isl_stn_name; + std::string isl_stn_name; #endif // get all stations connected with measurements @@ -1566,12 +1564,12 @@ void dna_segment::VerifyStationConnections_Block(const UINT32& block) if (!unusedStns.empty()) { - stringstream ss; - ss << "The following station(s) are not associated with any" << endl << - " measurements in block " << block+1 << ":" << endl; + std::stringstream ss; + ss << "The following station(s) are not associated with any" << std::endl << + " measurements in block " << block+1 << ":" << std::endl; for_each(unusedStns.begin(), unusedStns.end(), [this, &ss](UINT32& stn){ - ss << " " << bstBinaryRecords_.at(stn).stationName << " (" << stn << ")" << endl; + ss << " " << bstBinaryRecords_.at(stn).stationName << " (" << stn << ")" << std::endl; }); SignalExceptionSerialise(ss.str(), 0, NULL); } diff --git a/dynadjust/dynadjust/dnasegment/dnasegment.hpp b/dynadjust/dynadjust/dnasegment/dnasegment.hpp index 35e2707c..ad5ffe1f 100644 --- a/dynadjust/dynadjust/dnasegment/dnasegment.hpp +++ b/dynadjust/dynadjust/dnasegment/dnasegment.hpp @@ -45,11 +45,6 @@ #include #include -using namespace std; -using namespace boost; -using namespace boost::posix_time; -using namespace boost::filesystem; - #include #include #include @@ -109,26 +104,26 @@ class dna_segment { inline UINT32 minBlockSize() const { return minBlockSize_; } void coutSummary() const; - void coutCurrentBlockSummary(ostream &os); + void coutCurrentBlockSummary(std::ostream &os); void LoadNetFile(); - void LoadBinaryFiles(const string& bstrfileName, const string& bmsrfileName); - void LoadAssociationFiles(const string& aslfileName, const string& amlfileName); - void LoadStationMap(const string& stnmap_file); + void LoadBinaryFiles(const std::string& bstrfileName, const std::string& bmsrfileName); + void LoadAssociationFiles(const std::string& aslfileName, const std::string& amlfileName); + void LoadStationMap(const std::string& stnmap_file); - void WriteSegmentedNetwork(const string& segfileName); + void WriteSegmentedNetwork(const std::string& segfileName); void WriteFreeStnListSortedbyASLMsrCount(); void VerifyStationConnections(); - string DefaultStartingStation(); + std::string DefaultStartingStation(); vstring StartingStations(); inline _SEGMENT_STATUS_ GetStatus() const { return segmentStatus_; } private: - void SignalExceptionSerialise(const string& msg, const int& i, const char *streamType, ...); + void SignalExceptionSerialise(const std::string& msg, const int& i, const char *streamType, ...); void ParseStartingStations(); void BuildFirstBlock(); void BuildNextBlock(); @@ -140,7 +135,7 @@ class dna_segment { void SelectJunction(); it_vUINT32 MoveStation(vUINT32& fromList, it_vUINT32 it_from, vUINT32& toList, const UINT32& stn_index); - void MoveFreeStn(it_vUINT32 it_freeisl, vUINT32& toList, const UINT32& stn_index, const string& type); + void MoveFreeStn(it_vUINT32 it_freeisl, vUINT32& toList, const UINT32& stn_index, const std::string& type); void MoveFreeStnToInnerList(it_vUINT32 it_freeisl, const UINT32& stn_index); void MoveFreeStnToJunctionList(it_vUINT32 it_freeisl, const UINT32& stn_index); @@ -150,12 +145,12 @@ class dna_segment { void IdentifyLowestStationAssociation(pvUINT32 vStnList, vUINT32& totalStations,const int currentLevel, const int maxLevel, pvUINT32 vStnCount); void IdentifyInnerMsrsandAssociatedStns(const UINT32& innerStation, vUINT32& totalStations); void AddtoJunctionStnList(const vUINT32& msrStations); - void AddtoJunctionStnList_sortedbyMsrCount(measurement_t* msr, const UINT32& innerStation); - void AddtoJunctionStnList_sortedbyName(measurement_t* msr, const UINT32& innerStation); + //void AddtoJunctionStnList_sortedbyMsrCount(measurement_t* msr, const UINT32& innerStation); + //void AddtoJunctionStnList_sortedbyName(measurement_t* msr, const UINT32& innerStation); bool AddtoCurrentMsrList(const UINT32& amlindex, const vUINT32& msrStations); UINT32 GetAvailableMsrCount(const UINT32& stn_index); void FindCommonMeasurements(); - void MoveJuncttoInnerStnList(); + //void MoveJuncttoInnerStnList(); void MoveJunctiontoISL(); void SetAvailableMsrCount(); void RemoveDuplicateStations(pvstring vStations); @@ -163,8 +158,8 @@ class dna_segment { //void RemoveNonMeasurements(); //void RemoveIgnoredMeasurements(); void BuildFreeStationAvailabilityList(); - void BuildFreeStationAvailabilityList(vASL& assocStnList, v_freestn_pair& freeStnList); - void BuildStationAppearanceList(); + //void BuildFreeStationAvailabilityList(vASL& assocStnList, v_freestn_pair& freeStnList); + //void BuildStationAppearanceList(); void CalculateAverageBlockSize(); @@ -178,10 +173,10 @@ class dna_segment { UINT32 currentBlock_; UINT32 currentNetwork_; // current contiguous network ID - string network_name_; // network name + std::string network_name_; // network name UINT16 debug_level_; - string output_folder_; + std::string output_folder_; // functors CompareClusterID clusteridCompareFunc_; diff --git a/dynadjust/dynadjust/dnasegment/dnasegment.vcxproj b/dynadjust/dynadjust/dnasegment/dnasegment.vcxproj index df3f7e84..afa87ef6 100644 --- a/dynadjust/dynadjust/dnasegment/dnasegment.vcxproj +++ b/dynadjust/dynadjust/dnasegment/dnasegment.vcxproj @@ -42,7 +42,7 @@ Parallel v143 Parallel - false + true DynamicLibrary @@ -63,7 +63,7 @@ Parallel v143 Parallel - false + true @@ -112,6 +112,7 @@ $(BoostLibDir);$(LibraryPath) $(SolutionDir)bin\$(Configuration)\$(Platform)\ $(SolutionDir)build\$(ProjectName)\$(Configuration)\$(Platform)\ + $(SolutionDir);$(VC_SourcePath); @@ -143,6 +144,7 @@ /Zm280 /permissive- precompile.h precompile.h + false stdcpp17 @@ -164,6 +166,7 @@ /Zm245 precompile.h precompile.h + Speed stdcpp17 diff --git a/dynadjust/dynadjust/dnasegment/dnasegment.vcxproj.filters b/dynadjust/dynadjust/dnasegment/dnasegment.vcxproj.filters index 5c0569dd..3c99a9d8 100644 --- a/dynadjust/dynadjust/dnasegment/dnasegment.vcxproj.filters +++ b/dynadjust/dynadjust/dnasegment/dnasegment.vcxproj.filters @@ -21,19 +21,19 @@ Header Files - + Header Files - + Header Files - + Header Files - + Header Files - + Header Files @@ -45,7 +45,7 @@ Header Files - + Header Files @@ -101,4 +101,4 @@ Resource Files - \ No newline at end of file + diff --git a/dynadjust/dynadjust/dnasegmentwrapper/dnasegmentwrapper.cpp b/dynadjust/dynadjust/dnasegmentwrapper/dnasegmentwrapper.cpp index e4aa5a7f..6df5c487 100644 --- a/dynadjust/dynadjust/dnasegmentwrapper/dnasegmentwrapper.cpp +++ b/dynadjust/dynadjust/dnasegmentwrapper/dnasegmentwrapper.cpp @@ -27,7 +27,7 @@ using namespace dynadjust; bool running; boost::mutex cout_mutex; -int ParseCommandLineOptions(const int& argc, char* argv[], const variables_map& vm, project_settings& p) +int ParseCommandLineOptions(const int& argc, char* argv[], const boost::program_options::variables_map& vm, project_settings& p) { // capture command line arguments for (int cmd_arg(0); cmd_arg(p.g.output_folder, p.g.network_name, "dnaproj"); + p.g.project_file = formPath(p.g.output_folder, p.g.network_name, "dnaproj"); // input files - p.s.asl_file = formPath(p.g.input_folder, p.g.network_name, "asl"); // associated stations list - p.s.aml_file = formPath(p.g.input_folder, p.g.network_name, "aml"); // associated measurements list - p.s.map_file = formPath(p.g.input_folder, p.g.network_name, "map"); // station names map + p.s.asl_file = formPath(p.g.input_folder, p.g.network_name, "asl"); // associated stations list + p.s.aml_file = formPath(p.g.input_folder, p.g.network_name, "aml"); // associated measurements list + p.s.map_file = formPath(p.g.input_folder, p.g.network_name, "map"); // station names map if (vm.count(NET_FILE)) - p.s.net_file = formPath(p.g.input_folder, p.g.network_name, "net"); // Starting stations file + p.s.net_file = formPath(p.g.input_folder, p.g.network_name, "net"); // Starting stations file // binary station file location (input) if (vm.count(BIN_STN_FILE)) - p.s.bst_file = formPath(p.g.input_folder, p.s.bst_file); + p.s.bst_file = formPath(p.g.input_folder, p.s.bst_file); else - p.s.bst_file = formPath(p.g.output_folder, p.g.network_name, "bst"); + p.s.bst_file = formPath(p.g.output_folder, p.g.network_name, "bst"); // binary station file location (input) if (vm.count(BIN_MSR_FILE)) - p.s.bms_file = formPath(p.g.input_folder, p.s.bms_file); + p.s.bms_file = formPath(p.g.input_folder, p.s.bms_file); else - p.s.bms_file = formPath(p.g.output_folder, p.g.network_name, "bms"); + p.s.bms_file = formPath(p.g.output_folder, p.g.network_name, "bms"); - if (!exists(p.s.bst_file) || !exists(p.s.bms_file)) + if (!boost::filesystem::exists(p.s.bst_file) || !boost::filesystem::exists(p.s.bms_file)) { - cout << endl << "- Nothing to do: "; + std::cout << std::endl << "- Nothing to do: "; if (p.g.network_name.empty()) - cout << endl << "network name has not been specified specified, and " << endl << " "; - cout << p.s.bst_file << " and " << p.s.bms_file << " do not exist." << endl << endl; + std::cout << std::endl << "network name has not been specified specified, and " << std::endl << " "; + std::cout << p.s.bst_file << " and " << p.s.bms_file << " do not exist." << std::endl << std::endl; return EXIT_FAILURE; } @@ -99,24 +99,24 @@ int ParseCommandLineOptions(const int& argc, char* argv[], const variables_map& if (vm.count(SEG_FILE)) { // Does it exist? - if (!exists(p.s.seg_file)) + if (!boost::filesystem::exists(p.s.seg_file)) { // Look for it in the input folder - p.s.seg_file = formPath(p.g.input_folder, leafStr(p.s.seg_file)); + p.s.seg_file = formPath(p.g.input_folder, leafStr(p.s.seg_file)); - if (!exists(p.s.seg_file)) + if (!boost::filesystem::exists(p.s.seg_file)) { - cout << endl << "- Error: " << - "Segmentation file " << leafStr(p.s.seg_file) << " does not exist." << endl << endl; + std::cout << std::endl << "- Error: " << + "Segmentation file " << leafStr(p.s.seg_file) << " does not exist." << std::endl << std::endl; return EXIT_FAILURE; } } } else - p.s.seg_file = formPath(p.g.input_folder, p.g.network_name, "seg"); + p.s.seg_file = formPath(p.g.input_folder, p.g.network_name, "seg"); // Station appearance file - p.s.sap_file = formPath(p.g.input_folder, p.g.network_name, "sap"); + p.s.sap_file = formPath(p.g.input_folder, p.g.network_name, "sap"); if (vm.count(TEST_INTEGRITY)) p.i.test_integrity = 1; @@ -130,41 +130,41 @@ int ParseCommandLineOptions(const int& argc, char* argv[], const variables_map& int main(int argc, char* argv[]) { // create banner message - string cmd_line_banner; + std::string cmd_line_banner; fileproc_help_header(&cmd_line_banner); - string stnfilename, msrfilename; + std::string stnfilename, msrfilename; project_settings p; - variables_map vm; - positional_options_description positional_options; + boost::program_options::variables_map vm; + boost::program_options::positional_options_description positional_options; - options_description standard_options("+ " + string(ALL_MODULE_STDOPT), PROGRAM_OPTIONS_LINE_LENGTH); - options_description config_options("+ " + string(SEGMENT_MODULE_CONFIG), PROGRAM_OPTIONS_LINE_LENGTH); - options_description generic_options("+ " + string(ALL_MODULE_GENERIC), PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description standard_options("+ " + std::string(ALL_MODULE_STDOPT), PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description config_options("+ " + std::string(SEGMENT_MODULE_CONFIG), PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description generic_options("+ " + std::string(ALL_MODULE_GENERIC), PROGRAM_OPTIONS_LINE_LENGTH); - string cmd_line_usage("+ "); + std::string cmd_line_usage("+ "); cmd_line_usage.append(__BINARY_NAME__).append(" usage: ").append(__BINARY_NAME__).append(" ").append(NETWORK_NAME).append(" [options]"); - options_description allowable_options(cmd_line_usage, PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description allowable_options(cmd_line_usage, PROGRAM_OPTIONS_LINE_LENGTH); try { // Declare a group of options that will be // allowed only on command line standard_options.add_options() - (PROJECT_FILE_P, value(&p.g.project_file), + (PROJECT_FILE_P, boost::program_options::value(&p.g.project_file), "Project file name. Full path to project file. If none specified, a new file is created using input-folder and network-name.") - (NETWORK_NAME_N, value(&p.g.network_name), + (NETWORK_NAME_N, boost::program_options::value(&p.g.network_name), "Network name. User defined name for all input and output files. Default is \"network#\".") - (INPUT_FOLDER_I, value(&p.g.input_folder), + (INPUT_FOLDER_I, boost::program_options::value(&p.g.input_folder), "Path containing all input files") - (OUTPUT_FOLDER_O, value(&p.g.output_folder), // default is ./, + (OUTPUT_FOLDER_O, boost::program_options::value(&p.g.output_folder), // default is ./, "Path for all output files") - (BIN_STN_FILE, value(&p.s.bst_file), + (BIN_STN_FILE, boost::program_options::value(&p.s.bst_file), "Binary station file name. Overrides network name.") - (BIN_MSR_FILE, value(&p.s.bms_file), + (BIN_MSR_FILE, boost::program_options::value(&p.s.bms_file), "Binary measurement file name. Overrides network name.") - (SEG_FILE, value(&p.s.seg_file), + (SEG_FILE, boost::program_options::value(&p.s.seg_file), "Segmentation output file name. Overrides network name.") ; @@ -174,35 +174,35 @@ int main(int argc, char* argv[]) config_options.add_options() (NET_FILE, "Look for a .net file containing stations to be incorporated within the first block.") - (SEG_STARTING_STN, value(&p.s.seg_starting_stns), + (SEG_STARTING_STN, boost::program_options::value(&p.s.seg_starting_stns), "Additional stations to be incorporated within the first block. arg is a comma delimited string \"stn1, stn 2,stn3 , stn 4\".") - (SEG_MIN_INNER_STNS, value(&p.s.min_inner_stations), - (string("Minimum number of inner stations within each block. Default is ")+ - StringFromT(p.s.min_inner_stations)+string(".")).c_str()) - (SEG_THRESHOLD_STNS, value(&p.s.max_total_stations), - (string("Threshold limit for maximum number of stations per block. Default is ")+ - StringFromT(p.s.max_total_stations)+string(".")).c_str()) - (SEG_FORCE_CONTIGUOUS, value(&p.s.force_contiguous_blocks), - (string("Treatment of isolated networks:\n")+ - string(" 0: Isolated networks as individual blocks ")+ + (SEG_MIN_INNER_STNS, boost::program_options::value(&p.s.min_inner_stations), + (std::string("Minimum number of inner stations within each block. Default is ")+ + StringFromT(p.s.min_inner_stations)+std::string(".")).c_str()) + (SEG_THRESHOLD_STNS, boost::program_options::value(&p.s.max_total_stations), + (std::string("Threshold limit for maximum number of stations per block. Default is ")+ + StringFromT(p.s.max_total_stations)+std::string(".")).c_str()) + (SEG_FORCE_CONTIGUOUS, boost::program_options::value(&p.s.force_contiguous_blocks), + (std::string("Treatment of isolated networks:\n")+ + std::string(" 0: Isolated networks as individual blocks ")+ (p.s.force_contiguous_blocks==0 ? "(default)\n" : "\n")+ - string(" 1: Force production of contiguous blocks ")+ + std::string(" 1: Force production of contiguous blocks ")+ (p.s.force_contiguous_blocks==1 ? "(default)" : "") ).c_str()) - (SEG_SEARCH_LEVEL, value(&p.s.seg_search_level), + (SEG_SEARCH_LEVEL, boost::program_options::value(&p.s.seg_search_level), "Level to which searches should be conducted to find stations with the lowest measurement count. Default is 0.") (TEST_INTEGRITY, "Test the integrity of all output files.") ; generic_options.add_options() - (VERBOSE, value(&p.g.verbose), - string("Give detailed information about what ").append(__BINARY_NAME__).append(" is doing.\n 0: No information (default)\n 1: Helpful information\n 2: Extended information\n 3: Debug level information").c_str()) + (VERBOSE, boost::program_options::value(&p.g.verbose), + std::string("Give detailed information about what ").append(__BINARY_NAME__).append(" is doing.\n 0: No information (default)\n 1: Helpful information\n 2: Extended information\n 3: Debug level information").c_str()) (QUIET, - string("Suppresses all explanation of what ").append(__BINARY_NAME__).append(" is doing unless an error occurs").c_str()) + std::string("Suppresses all explanation of what ").append(__BINARY_NAME__).append(" is doing unless an error occurs").c_str()) (VERSION_V, "Display the current program version") (HELP_H, "Show this help message") - (HELP_MODULE, value(), + (HELP_MODULE_H, boost::program_options::value(), "Provide help for a specific help category.") ; @@ -211,53 +211,53 @@ int main(int argc, char* argv[]) // add "positional options" to handle command line tokens which have no option name positional_options.add(NETWORK_NAME, -1); - command_line_parser parser(argc, argv); + boost::program_options::command_line_parser parser(argc, argv); store(parser.options(allowable_options).positional(positional_options).run(), vm); notify(vm); } catch (const std::exception& e) { - cout << "- Error: " << e.what() << endl << - cmd_line_banner << allowable_options << endl; + std::cout << "- Error: " << e.what() << std::endl << + cmd_line_banner << allowable_options << std::endl; return EXIT_FAILURE; } if (argc < 2) { - cout << endl << "- Nothing to do - no options provided. " << endl << endl << - cmd_line_banner << allowable_options << endl; + std::cout << std::endl << "- Nothing to do - no options provided. " << std::endl << std::endl << + cmd_line_banner << allowable_options << std::endl; return EXIT_FAILURE; } if (vm.count(VERSION)) { - cout << cmd_line_banner << endl; + std::cout << cmd_line_banner << std::endl; return EXIT_SUCCESS; } if (vm.count(HELP)) { - cout << cmd_line_banner << allowable_options << endl; + std::cout << cmd_line_banner << allowable_options << std::endl; return EXIT_SUCCESS; } if (vm.count(HELP_MODULE)) { - cout << cmd_line_banner; - string original_text = vm[HELP_MODULE].as(); - string help_text = str_upper(original_text); + std::cout << cmd_line_banner; + std::string original_text = vm[HELP_MODULE].as(); + std::string help_text = str_upper(original_text); - if (str_upper(ALL_MODULE_STDOPT).find(help_text) != string::npos) { - cout << standard_options << endl; + if (str_upper(ALL_MODULE_STDOPT).find(help_text) != std::string::npos) { + std::cout << standard_options << std::endl; } - else if (str_upper(SEGMENT_MODULE_CONFIG).find(help_text) != string::npos) { - cout << config_options << endl; + else if (str_upper(SEGMENT_MODULE_CONFIG).find(help_text) != std::string::npos) { + std::cout << config_options << std::endl; } - else if (str_upper(ALL_MODULE_GENERIC).find(help_text) != string::npos) { - cout << generic_options << endl; + else if (str_upper(ALL_MODULE_GENERIC).find(help_text) != std::string::npos) { + std::cout << generic_options << std::endl; } else { - cout << endl << "- Error: Help module '" << - original_text << "' is not in the list of options." << endl; + std::cout << std::endl << "- Error: Help module '" << + original_text << "' is not in the list of options." << std::endl; return EXIT_FAILURE; } @@ -282,54 +282,54 @@ int main(int argc, char* argv[]) if (!p.g.quiet) { - cout << endl << cmd_line_banner; + std::cout << std::endl << cmd_line_banner; - cout << "+ Options:" << endl; - cout << setw(PRINT_VAR_PAD) << left << " Network name: " << p.g.network_name << endl; - cout << setw(PRINT_VAR_PAD) << left << " Input folder: " << p.g.input_folder << endl; - cout << setw(PRINT_VAR_PAD) << left << " Output folder: " << p.g.output_folder << endl; - cout << setw(PRINT_VAR_PAD) << left << " Associated station file: " << p.s.asl_file << endl; - cout << setw(PRINT_VAR_PAD) << left << " Associated measurement file: " << p.s.aml_file << endl; - cout << setw(PRINT_VAR_PAD) << left << " Binary station file: " << p.s.bst_file << endl; - cout << setw(PRINT_VAR_PAD) << left << " Binary measurement file: " << p.s.bms_file << endl; - cout << setw(PRINT_VAR_PAD) << left << " Segmentation output file: " << p.s.seg_file << endl; + std::cout << "+ Options:" << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Network name: " << p.g.network_name << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Input folder: " << p.g.input_folder << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Output folder: " << p.g.output_folder << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Associated station file: " << p.s.asl_file << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Associated measurement file: " << p.s.aml_file << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Binary station file: " << p.s.bst_file << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Binary measurement file: " << p.s.bms_file << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Segmentation output file: " << p.s.seg_file << std::endl; if (!p.s.net_file.empty()) - cout << setw(PRINT_VAR_PAD) << left << " Block 1 stations file: " << p.s.net_file << endl; - cout << setw(PRINT_VAR_PAD) << left << " Minimum inner stations: " << p.s.min_inner_stations << endl; - cout << setw(PRINT_VAR_PAD) << left << " Block size threshold: " << p.s.max_total_stations << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Block 1 stations file: " << p.s.net_file << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Minimum inner stations: " << p.s.min_inner_stations << std::endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Block size threshold: " << p.s.max_total_stations << std::endl; if (!p.s.seg_starting_stns.empty()) - cout << setw(PRINT_VAR_PAD) << left << " Additional Block 1 stations: " << p.s.seg_starting_stns << endl; + std::cout << std::setw(PRINT_VAR_PAD) << std::left << " Additional Block 1 stations: " << p.s.seg_starting_stns << std::endl; else if (p.s.net_file.empty()) - cout << " No initial station specified. The first station will be used." << endl; + std::cout << " No initial station specified. The first station will be used." << std::endl; - cout << endl; + std::cout << std::endl; } // Should segment look for a net file? if (!p.s.net_file.empty()) { - if (!exists(p.s.net_file)) + if (!boost::filesystem::exists(p.s.net_file)) { cout_mutex.lock(); - cout << endl << - "- Error: " << p.s.net_file << " does not exist." << endl << - " A file named " << p.g.network_name << ".net must exist in the input folder\n in order to use this option." << endl << endl; + std::cout << std::endl << + "- Error: " << p.s.net_file << " does not exist." << std::endl << + " A file named " << p.g.network_name << ".net must exist in the input folder\n in order to use this option." << std::endl << std::endl; cout_mutex.unlock(); return EXIT_FAILURE; } } dna_segment netSegment; - milliseconds elapsed_time(milliseconds(0)); + boost::posix_time::milliseconds elapsed_time(boost::posix_time::milliseconds(0)); _SEGMENT_STATUS_ segmentStatus; - string status_msg; + std::string status_msg; try { netSegment.InitialiseSegmentation(); running = true; // segment blocks using group thread - thread_group ui_segment_threads; + boost::thread_group ui_segment_threads; if (!p.g.quiet) ui_segment_threads.create_thread(dna_segment_progress_thread(&netSegment, &p)); ui_segment_threads.create_thread(dna_segment_thread(&netSegment, &p, &segmentStatus, &elapsed_time, &status_msg)); @@ -346,61 +346,61 @@ int main(int argc, char* argv[]) //// print station appearance file //if (!p.g.quiet) - // cout << "+ Printing station appearance list... "; + // std::cout << "+ Printing station appearance list... "; //netSegment.WriteStationAppearanceList(p.s.sap_file); //if (!p.g.quiet) - // cout << "done." << endl; + // std::cout << "done." << std::endl; if (p.g.verbose > 1 && !p.g.quiet) netSegment.coutSummary(); if (segmentStatus != SEGMENT_SUCCESS) - cout << status_msg << endl; + std::cout << status_msg << std::endl; if (!p.g.quiet) { - cout << "+ Segmentation statistics:" << endl; - cout << endl << left << " " << - setw(STATION) << "No. blocks" << - setw(STAT) << "Max size" << - setw(STAT) << "Min size" << - setw(STAT) << "Average" << - setw(STATION) << "Total size" << endl; - cout << " "; + std::cout << "+ Segmentation statistics:" << std::endl; + std::cout << std::endl << std::left << " " << + std::setw(STATION) << "No. blocks" << + std::setw(STAT) << "Max size" << + std::setw(STAT) << "Min size" << + std::setw(STAT) << "Average" << + std::setw(STATION) << "Total size" << std::endl; + std::cout << " "; for (UINT32 i(0), j(STATION + STAT*3 + STATION); i(p.s.seg_file) << "... "; + std::cout << "+ Printing blocks to " << leafStr(p.s.seg_file) << "... "; netSegment.WriteSegmentedNetwork(p.s.seg_file); if (!p.g.quiet) - cout << "done." << endl; + std::cout << "done." << std::endl; } catch (const NetSegmentException& e) { - cout << endl << "- Error: " << e.what() << endl; + std::cout << std::endl << "- Error: " << e.what() << std::endl; return EXIT_FAILURE; } - catch (const runtime_error& e) { - cout << "+ Exception of unknown type: " << e.what(); + catch (const std::runtime_error& e) { + std::cout << "+ Exception of unknown type: " << e.what(); return EXIT_FAILURE; } @@ -415,7 +415,7 @@ int main(int argc, char* argv[]) // Update the import settings. // Print the project file. If it doesn't exist, it will be created. CDnaProjectFile projectFile; - if (exists(p.g.project_file)) + if (boost::filesystem::exists(p.g.project_file)) projectFile.LoadProjectFile(p.g.project_file); projectFile.UpdateSettingsSegment(p); @@ -424,8 +424,8 @@ int main(int argc, char* argv[]) if (p.g.quiet) return EXIT_SUCCESS; - cout << endl << formatedElapsedTime(&elapsed_time, "+ Network segmentation took ") << endl; - cout << "+ " << p.g.network_name << " is now ready for sequential phased adjustment." << endl << endl; + std::cout << std::endl << formatedElapsedTime(&elapsed_time, "+ Network segmentation took ") << std::endl; + std::cout << "+ " << p.g.network_name << " is now ready for sequential phased adjustment." << std::endl << std::endl; return EXIT_SUCCESS; } diff --git a/dynadjust/dynadjust/dnasegmentwrapper/dnasegmentwrapper.hpp b/dynadjust/dynadjust/dnasegmentwrapper/dnasegmentwrapper.hpp index 93b6167b..43a7a82d 100644 --- a/dynadjust/dynadjust/dnasegmentwrapper/dnasegmentwrapper.hpp +++ b/dynadjust/dynadjust/dnasegmentwrapper/dnasegmentwrapper.hpp @@ -49,13 +49,6 @@ #include #include -using namespace std; -using namespace boost; -using namespace boost::filesystem; -using namespace boost::posix_time; -using namespace boost::program_options; -namespace po = boost::program_options; - #include #include #include @@ -77,7 +70,7 @@ extern boost::mutex cout_mutex; class dna_segment_thread { public: - dna_segment_thread(dna_segment* dnaSeg, project_settings* p, _SEGMENT_STATUS_* segmentStatus, milliseconds* s, string* status_msg) + dna_segment_thread(dna_segment* dnaSeg, project_settings* p, _SEGMENT_STATUS_* segmentStatus, boost::posix_time::milliseconds* s, std::string* status_msg) : _dnaSeg(dnaSeg) , _p(p) , _segmentStatus(segmentStatus) @@ -90,7 +83,7 @@ class dna_segment_thread if (!_p->g.quiet) { cout_mutex.lock(); - cout << "+ Loading binary files..."; + std::cout << "+ Loading binary files..."; cout_mutex.unlock(); } @@ -100,7 +93,7 @@ class dna_segment_thread } catch (const NetSegmentException& e) { cout_mutex.lock(); - cout << endl << "- Error: " << e.what() << endl; + std::cout << std::endl << "- Error: " << e.what() << std::endl; cout_mutex.unlock(); running = false; return; @@ -109,19 +102,19 @@ class dna_segment_thread if (!_p->g.quiet) { cout_mutex.lock(); - cout << " done." << endl; + std::cout << " done." << std::endl; if (_dnaSeg->StartingStations().empty()) { - string startStn(_dnaSeg->DefaultStartingStation()); + std::string startStn(_dnaSeg->DefaultStartingStation()); if (startStn == "") startStn = "the first station"; - cout << "+ Adopting " << _dnaSeg->DefaultStartingStation() << " as the initial station in the first block." << endl; + std::cout << "+ Adopting " << _dnaSeg->DefaultStartingStation() << " as the initial station in the first block." << std::endl; } - cout << "+ Creating block " << setw(PROGRESS_PAD_39) << " "; + std::cout << "+ Creating block " << std::setw(PROGRESS_PAD_39) << " "; cout_mutex.unlock(); } - cpu_timer time; + boost::timer::cpu_timer time; try { *_segmentStatus = SEGMENT_EXCEPTION_RAISED; *_segmentStatus = _dnaSeg->SegmentNetwork(_p); @@ -129,26 +122,26 @@ class dna_segment_thread catch (const NetSegmentException& e) { running = false; cout_mutex.lock(); - cout << endl << "- Error: " << e.what() << endl; + std::cout << std::endl << "- Error: " << e.what() << std::endl; cout_mutex.unlock(); return; } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { running = false; - boost::this_thread::sleep(milliseconds(250)); + boost::this_thread::sleep(boost::posix_time::milliseconds(250)); cout_mutex.lock(); - cout << endl << "- Error: " << e.what() << endl; + std::cout << std::endl << "- Error: " << e.what() << std::endl; cout_mutex.unlock(); return; } - *_s = milliseconds(time.elapsed().wall/MILLI_TO_NANO); + *_s = boost::posix_time::milliseconds(time.elapsed().wall/MILLI_TO_NANO); running = false; if (!_p->g.quiet) { cout_mutex.lock(); - cout << PROGRESS_BACKSPACE_39 << "\b" << setw(PROGRESS_PAD_39+3) << left << "s... done. " << endl; + std::cout << PROGRESS_BACKSPACE_39 << "\b" << std::setw(PROGRESS_PAD_39+3) << std::left << "s... done. " << std::endl; cout_mutex.unlock(); } } @@ -156,8 +149,8 @@ class dna_segment_thread dna_segment* _dnaSeg; project_settings* _p; _SEGMENT_STATUS_* _segmentStatus; - milliseconds* _s; - string* _status_msg; + boost::posix_time::milliseconds* _s; + std::string* _status_msg; }; class dna_segment_progress_thread @@ -168,7 +161,7 @@ class dna_segment_progress_thread void operator()() { UINT32 block, currentBlock(0); - ostringstream ss; + std::ostringstream ss; while (running) { @@ -178,15 +171,15 @@ class dna_segment_progress_thread if (block != currentBlock) { ss.str(""); - ss << "(" << fixed << setw(2) << right << setprecision(0) << _dnaSeg->GetProgress() << "% stations used)"; + ss << "(" << std::fixed << std::setw(2) << std::right << std::setprecision(0) << _dnaSeg->GetProgress() << "% stations used)"; cout_mutex.lock(); - cout << PROGRESS_BACKSPACE_39 << setw(PROGRESS_BLOCK) << left << block << setw(PROGRESS_PERCENT_29) << right << ss.str(); - cout.flush(); + std::cout << PROGRESS_BACKSPACE_39 << std::setw(PROGRESS_BLOCK) << std::left << block << std::setw(PROGRESS_PERCENT_29) << std::right << ss.str(); + std::cout.flush(); cout_mutex.unlock(); currentBlock = block; } } - boost::this_thread::sleep(milliseconds(75)); + boost::this_thread::sleep(boost::posix_time::milliseconds(75)); } } diff --git a/dynadjust/dynadjust/driver/driver.cpp b/dynadjust/dynadjust/driver/driver.cpp index b751a07e..1f6f4d11 100644 --- a/dynadjust/dynadjust/driver/driver.cpp +++ b/dynadjust/dynadjust/driver/driver.cpp @@ -40,11 +40,9 @@ #include -using namespace std; - bool CreateNTv2Grid(const char* datGridFile, const char* gsbGridFile) { - cout << "+ Creating NTv2 grid file... "; + std::cout << "+ Creating NTv2 grid file... "; int status(0); n_file_par theGrid; @@ -54,11 +52,11 @@ bool CreateNTv2Grid(const char* datGridFile, const char* gsbGridFile) if (!DNAGEOID_CreateNTv2Grid(datGridFile, &theGrid, &status)) { - cout << endl << "Error: " << status << endl; + std::cout << std::endl << "Error: " << status << std::endl; return false; } - cout << "done." << endl << endl; + std::cout << "done." << std::endl << std::endl; return true; @@ -67,17 +65,17 @@ bool CreateNTv2Grid(const char* datGridFile, const char* gsbGridFile) bool createGridIndex(const char* gridfilePath, const char* gridfileType) { - cout << "+ Opening grid file... "; + std::cout << "+ Opening grid file... "; int status(0); if (!DNAGEOID_CreateGridIndex(gridfilePath, gridfileType, &status)) { - cout << "Error: " << status << endl; + std::cout << "Error: " << status << std::endl; return false; } - cout << "done." << endl << endl; + std::cout << "done." << std::endl << std::endl; return true; } @@ -85,7 +83,7 @@ bool createGridIndex(const char* gridfilePath, const char* gridfileType) bool reportGridProperties(const char* gridfilePath, const char* gridfileType) { - cout << "+ Reporting grid file properties... "; + std::cout << "+ Reporting grid file properties... "; n_file_par grid_properties; @@ -93,43 +91,43 @@ bool reportGridProperties(const char* gridfilePath, const char* gridfileType) if (!DNAGEOID_ReportGridProperties(gridfilePath, gridfileType, &grid_properties, &status)) { - cout << "Error: " << status << endl; + std::cout << "Error: " << status << std::endl; return false; } - cout << endl << endl << + std::cout << std::endl << std::endl << "----------------------------------------------------------------" << - endl << - "Grid properties for \"" << gridfilePath << "\":" << endl; - cout << "+ GS_TYPE = " << grid_properties.chGs_type << endl; // grid shift type (GS_TYPE) - cout << "+ VERSION = " << grid_properties.chVersion << endl; // grid file version (VERSION) - cout << "+ SYSTEM_F = " << grid_properties.chSystem_f << endl; // reference system (SYSTEM_F) - cout << "+ SYSTEM_T = " << grid_properties.chSystem_t << endl; // reference system (SYSTEM_T) - cout << "+ MAJOR_F = " << setprecision(3) << fixed << grid_properties.daf << endl; // semi major of from system (MAJOR_F) - cout << "+ MAJOR_T = " << setprecision(3) << fixed << grid_properties.dat << endl; // semi major of to system (MAJOR_T) - cout << "+ MINOR_F = " << setprecision(3) << fixed << grid_properties.dbf << endl; // semi minor of from system (MINOR_F) - cout << "+ MINOR_T = " << setprecision(3) << fixed << grid_properties.dbt << endl; // semi minor of to system (MINOR_T) - cout << "+ NUM_OREC = " << grid_properties.iH_info << endl; // Number of header identifiers (NUM_OREC) - cout << "+ NUM_SREC = " << grid_properties.iSubH_info << endl; // Number of sub-header idents (NUM_SREC) - cout << "+ NUM_FILE = " << grid_properties.iNumsubgrids << endl; // number of subgrids in file (NUM_FILE) + std::endl << + "Grid properties for \"" << gridfilePath << "\":" << std::endl; + std::cout << "+ GS_TYPE = " << grid_properties.chGs_type << std::endl; // grid shift type (GS_TYPE) + std::cout << "+ VERSION = " << grid_properties.chVersion << std::endl; // grid file version (VERSION) + std::cout << "+ SYSTEM_F = " << grid_properties.chSystem_f << std::endl; // reference system (SYSTEM_F) + std::cout << "+ SYSTEM_T = " << grid_properties.chSystem_t << std::endl; // reference system (SYSTEM_T) + std::cout << "+ MAJOR_F = " << std::setprecision(3) << std::fixed << grid_properties.daf << std::endl; // semi major of from system (MAJOR_F) + std::cout << "+ MAJOR_T = " << std::setprecision(3) << std::fixed << grid_properties.dat << std::endl; // semi major of to system (MAJOR_T) + std::cout << "+ MINOR_F = " << std::setprecision(3) << std::fixed << grid_properties.dbf << std::endl; // semi minor of from system (MINOR_F) + std::cout << "+ MINOR_T = " << std::setprecision(3) << std::fixed << grid_properties.dbt << std::endl; // semi minor of to system (MINOR_T) + std::cout << "+ NUM_OREC = " << grid_properties.iH_info << std::endl; // Number of header identifiers (NUM_OREC) + std::cout << "+ NUM_SREC = " << grid_properties.iSubH_info << std::endl; // Number of sub-header idents (NUM_SREC) + std::cout << "+ NUM_FILE = " << grid_properties.iNumsubgrids << std::endl; // number of subgrids in file (NUM_FILE) for (int i=0; icVar.dLatitude << ", " << theGeoidPoint->cVar.dLongitude << " is outside the grid file." << endl << endl; + std::cout << "+ The point " << std::fixed << std::setprecision(6) << theGeoidPoint->cVar.dLatitude << ", " << theGeoidPoint->cVar.dLongitude << " is outside the grid file." << std::endl << std::endl; return true; } - cout << "Error: " << status << endl; + std::cout << "Error: " << status << std::endl; return false; } - cout << "+ Interpolation results for "; - cout << fixed << setprecision(6) << theGeoidPoint->cVar.dLatitude << ", " << theGeoidPoint->cVar.dLongitude << " (ddd.dddddd):" << endl; + std::cout << "+ Interpolation results for "; + std::cout << std::fixed << std::setprecision(6) << theGeoidPoint->cVar.dLatitude << ", " << theGeoidPoint->cVar.dLongitude << " (ddd.dddddd):" << std::endl; - cout << " N VALUE = " << setw(6) << right << setprecision(3) << theGeoidPoint->gVar.dN_value << endl; // N value - cout << " DEFL PRIME M = " << setw(6) << right << theGeoidPoint->gVar.dDefl_meridian << endl; // Defl PM value - cout << " DEFL PRIME V = " << setw(6) << right << theGeoidPoint->gVar.dDefl_primev << endl; // Defl PV value - cout << endl; + std::cout << " N VALUE = " << std::setw(6) << std::right << std::setprecision(3) << theGeoidPoint->gVar.dN_value << std::endl; // N value + std::cout << " DEFL PRIME M = " << std::setw(6) << std::right << theGeoidPoint->gVar.dDefl_meridian << std::endl; // Defl PM value + std::cout << " DEFL PRIME V = " << std::setw(6) << std::right << theGeoidPoint->gVar.dDefl_primev << std::endl; // Defl PV value + std::cout << std::endl; return true; @@ -163,7 +161,7 @@ bool interpolateGridPoint(geoid_point* theGeoidPoint, const int& method) bool FileTransformation(const char* fileIn, const char* fileOut, const int& intDmsFlag=0) { - cout << "+ Interpolating geoid information using a points file... "; + std::cout << "+ Interpolating geoid information using a points file... "; int method(BICUBIC); @@ -174,30 +172,30 @@ bool FileTransformation(const char* fileIn, const char* fileOut, const int& intD if (!DNAGEOID_FileTransformation(fileIn, fileOut, method, intEllipsoidtoOrtho, intDmsFlag, exportDnaGeoidFile, &status)) { - cout << "Error: " << status << endl; + std::cout << "Error: " << status << std::endl; return false; } - cout << "done." << endl << - "+ File written to:" << endl << - " " << fileOut << endl << endl; + std::cout << "done." << std::endl << + "+ File written to:" << std::endl << + " " << fileOut << std::endl << std::endl; int pointsInterpolated(0), pointsNotInterpolated(0); if (!DNAGEOID_PointsInterpolated(&pointsInterpolated, &status)) { - cout << "Error: " << status << endl; + std::cout << "Error: " << status << std::endl; return false; } if (!DNAGEOID_PointsNotInterpolated(&pointsNotInterpolated, &status)) { - cout << "Error: " << status << endl; + std::cout << "Error: " << status << std::endl; return false; } - cout << "+ Points interpolated: " << pointsInterpolated << endl << - "+ Points not interpolated: " << pointsNotInterpolated << endl << endl; + std::cout << "+ Points interpolated: " << pointsInterpolated << std::endl << + "+ Points not interpolated: " << pointsNotInterpolated << std::endl << std::endl; return true; } @@ -235,7 +233,7 @@ int main(int argc, char* argv[]) theGeoidPoint.cVar.iHeightSystem = 0; // 2. Call interpolateGridPoint() as many times as required - cout << "+ Interpolating from grid file... " << endl; + std::cout << "+ Interpolating from grid file... " << std::endl; for (int i=0; i<4; ++i) { diff --git a/dynadjust/dynadjust/dynadjust/dynadjust.cpp b/dynadjust/dynadjust/dynadjust/dynadjust.cpp index aae2e10a..767a4e44 100644 --- a/dynadjust/dynadjust/dynadjust/dynadjust.cpp +++ b/dynadjust/dynadjust/dynadjust/dynadjust.cpp @@ -19,12 +19,6 @@ #include #include -using namespace std; -using namespace boost; -using namespace boost::filesystem; -using namespace boost::posix_time; -using namespace boost::program_options; - boost::mutex cout_mutex; #include @@ -44,66 +38,66 @@ boost::mutex cout_mutex; using namespace dynadjust; -int CloseLogandReturn(std::ofstream& os, const int status, const string& output_file="") +int CloseLogandReturn(std::ofstream& os, const int status, const std::string& output_file="") { if (status == EXIT_FAILURE) { - os << setw(25) << left << formattedDateTimeString() << - "Failed. " << endl << endl << + os << std::setw(25) << std::left << formattedDateTimeString() << + "Failed. " << std::endl << std::endl << "+ DynAdjust ended prematurely. "; if (!output_file.empty()) { std::ifstream f(output_file); - os << " Contents of last output file:" << endl << endl << f.rdbuf(); + os << " Contents of last output file:" << std::endl << std::endl << f.rdbuf(); } else - os << endl; + os << std::endl; } else - os << endl << endl << "+ DynAdjust finished successfully." << endl; + os << std::endl << std::endl << "+ DynAdjust finished successfully." << std::endl; os.close(); return status; } -void PrintAppStartTimeMessage(std::ofstream& os, string&& app) +void PrintAppStartTimeMessage(std::ofstream& os, std::string&& app) { // App start time - os << setw(15) << left << string("+ " + app) << setw(25) << - formattedDateTimeString(); + os << std::setw(15) << std::left << std::string("+ " + app) << std::setw(25) << + formattedDateTimeString(); } void PrintSuccessStatusMessage(std::ofstream& os) { // end time - os << setw(25) << left << formattedDateTimeString() << - "Ended successfully." << endl; + os << std::setw(25) << std::left << formattedDateTimeString() << + "Ended successfully." << std::endl; } int main(int argc, char* argv[]) { - stringstream ss; + std::stringstream ss; - string cmd_line_banner; + std::string cmd_line_banner; fileproc_help_header(&cmd_line_banner); project_settings p; - variables_map vm; - positional_options_description positional_options; + boost::program_options::variables_map vm; + boost::program_options::positional_options_description positional_options; - options_description standard_options("+ " + string(ALL_MODULE_STDOPT), PROGRAM_OPTIONS_LINE_LENGTH); - options_description generic_options("+ " + string(ALL_MODULE_GENERIC), PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description standard_options("+ " + std::string(ALL_MODULE_STDOPT), PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description generic_options("+ " + std::string(ALL_MODULE_GENERIC), PROGRAM_OPTIONS_LINE_LENGTH); - string cmd_line_usage("+ "); + std::string cmd_line_usage("+ "); cmd_line_usage.append(__BINARY_NAME__).append(" usage: ").append(__BINARY_NAME__).append(" ").append(" [options]"); - options_description allowable_options(cmd_line_usage, PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description allowable_options(cmd_line_usage, PROGRAM_OPTIONS_LINE_LENGTH); try { standard_options.add_options() - (PROJECT_FILE_P, value(&p.g.project_file), + (PROJECT_FILE_P, boost::program_options::value(&p.g.project_file), "Project file containing all user options for import, segment, geoid, reftran, adjust and plot.") - (NETWORK_NAME_N, value(&p.g.network_name), + (NETWORK_NAME_N, boost::program_options::value(&p.g.network_name), "Network name. User defined name for all input and output files. Default is \"network#\".") (RUN_IMPORT, "Run import - DynAdjust file exchange software.") @@ -118,13 +112,13 @@ int main(int argc, char* argv[]) ; generic_options.add_options() - (VERBOSE, value(&p.g.verbose), - string("Give detailed information about what ").append(__BINARY_NAME__).append(" is doing.\n 0: No information (default)\n 1: Helpful information\n 2: Extended information\n 3: Debug level information").c_str()) + (VERBOSE, boost::program_options::value(&p.g.verbose), + std::string("Give detailed information about what ").append(__BINARY_NAME__).append(" is doing.\n 0: No information (default)\n 1: Helpful information\n 2: Extended information\n 3: Debug level information").c_str()) (QUIET, - string("Suppresses all explanation of what ").append(__BINARY_NAME__).append(" is doing unless an error occurs.").c_str()) + std::string("Suppresses all explanation of what ").append(__BINARY_NAME__).append(" is doing unless an error occurs.").c_str()) (VERSION_V, "Display the current program version.") (HELP_H, "Show this help message.") - (HELP_MODULE, value(), + (HELP_MODULE_H, boost::program_options::value(), "Provide help for a specific help category.") ; @@ -133,52 +127,52 @@ int main(int argc, char* argv[]) // add "positional options" to handle command line tokens which have no option name positional_options.add(NETWORK_NAME, -1); - command_line_parser parser(argc, argv); + boost::program_options::command_line_parser parser(argc, argv); store(parser.options(allowable_options).positional(positional_options).run(), vm); notify(vm); } catch (const std::exception& e) { cout_mutex.lock(); - cout << "- Error: " << e.what() << endl; - cout << cmd_line_banner << allowable_options << endl; + std::cout << "- Error: " << e.what() << std::endl; + std::cout << cmd_line_banner << allowable_options << std::endl; cout_mutex.unlock(); return EXIT_FAILURE; } if (argc < 2) { - cout << endl << "- Nothing to do - no options provided. " << endl << endl; - cout << cmd_line_banner << allowable_options << endl; + std::cout << std::endl << "- Nothing to do - no options provided. " << std::endl << std::endl; + std::cout << cmd_line_banner << allowable_options << std::endl; return EXIT_FAILURE; } if (vm.count(VERSION)) { - cout << cmd_line_banner << endl; + std::cout << cmd_line_banner << std::endl; return EXIT_SUCCESS; } if (vm.count(HELP)) { - cout << cmd_line_banner << allowable_options << endl; + std::cout << cmd_line_banner << allowable_options << std::endl; return EXIT_SUCCESS; } if (vm.count(HELP_MODULE)) { - cout << cmd_line_banner; - string original_text = vm[HELP_MODULE].as(); - string help_text = str_upper(original_text); + std::cout << cmd_line_banner; + std::string original_text = vm[HELP_MODULE].as(); + std::string help_text = str_upper(original_text); - if (str_upper(ALL_MODULE_STDOPT).find(help_text) != string::npos) { - cout << standard_options << endl; + if (str_upper(ALL_MODULE_STDOPT).find(help_text) != std::string::npos) { + std::cout << standard_options << std::endl; } - else if (str_upper(ALL_MODULE_GENERIC).find(help_text) != string::npos) { - cout << generic_options << endl; + else if (str_upper(ALL_MODULE_GENERIC).find(help_text) != std::string::npos) { + std::cout << generic_options << std::endl; } else { - cout << endl << "- Error: Help module '" << - original_text << "' is not in the list of options." << endl; + std::cout << std::endl << "- Error: Help module '" << + original_text << "' is not in the list of options." << std::endl; return EXIT_FAILURE; } @@ -188,11 +182,11 @@ int main(int argc, char* argv[]) if (vm.count(QUIET)) p.g.quiet = 1; else - cout << endl << cmd_line_banner; + std::cout << std::endl << cmd_line_banner; if (!vm.count(PROJECT_FILE) && !vm.count(NETWORK_NAME)) { - cout << endl << "- Nothing to do - no project file or network name specified. " << endl << endl; + std::cout << std::endl << "- Nothing to do - no project file or network name specified. " << std::endl << std::endl; return EXIT_FAILURE; } @@ -202,29 +196,29 @@ int main(int argc, char* argv[]) !vm.count(RUN_SEGMENT) && !vm.count(RUN_ADJUST)) { - cout << endl << "- Nothing to do - no programs were specified. " << endl << endl; + std::cout << std::endl << "- Nothing to do - no programs were specified. " << std::endl << std::endl; return EXIT_FAILURE; } if (vm.count(PROJECT_FILE) && vm.count(NETWORK_NAME)) { - if (equals(basename(p.g.project_file), p.g.network_name)) + if (boost::equals(boost::filesystem::path(p.g.project_file).stem().string(), p.g.network_name)) { - cout << endl << "- Error: project file name doesn't match network name. Provide" << endl; - cout << endl << " either a project file path or the network name. " << endl << endl; + std::cout << std::endl << "- Error: project file name doesn't match network name. Provide" << std::endl; + std::cout << std::endl << " either a project file path or the network name. " << std::endl << std::endl; return EXIT_FAILURE; } } // If a name was supplied, form full file path for project file using the current folder if (vm.count(NETWORK_NAME)) - p.g.project_file = formPath(".", p.g.network_name, "dnaproj"); + p.g.project_file = formPath(".", p.g.network_name, "dnaproj"); - if (!exists(p.g.project_file)) + if (!boost::filesystem::exists(p.g.project_file)) { - cout << endl << + std::cout << std::endl << "- Error: Project file " << p.g.project_file << - " does not exist. " << endl << endl; + " does not exist. " << std::endl << std::endl; return EXIT_FAILURE; } @@ -233,7 +227,7 @@ int main(int argc, char* argv[]) projectFile.LoadProjectFile(p.g.project_file); p = projectFile.GetSettings(); - string dynadjustLogFilePath(formPath(p.g.output_folder, "dynadjust", "log")); + std::string dynadjustLogFilePath(formPath(p.g.output_folder, "dynadjust", "log")); p.g.log_file = dynadjustLogFilePath; projectFile.UpdateSettingsGeneral(p.g); @@ -241,36 +235,36 @@ int main(int argc, char* argv[]) std::ofstream dynadjust_log; - ss << "- Error: Could not open dynadjust.log for writing." << endl; + ss << "- Error: Could not open dynadjust.log for writing." << std::endl; try { // Create dynadjust log file. Exit failure. file_opener(dynadjust_log, dynadjustLogFilePath); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - cout << endl << ss.str() << endl << endl; + std::cout << std::endl << ss.str() << std::endl << std::endl; return EXIT_FAILURE; } catch (...) { - cout << endl << ss.str() << endl << endl; + std::cout << std::endl << ss.str() << std::endl << std::endl; return EXIT_FAILURE; } - dynadjust_log << cmd_line_banner << endl; + dynadjust_log << cmd_line_banner << std::endl; - dynadjust_log << left << setw(15) << "+ Executable" << - setw(25) << "Start date and time" << - setw(25) << "End date and time" << - setw(25) << "Exit status" << endl; + dynadjust_log << std::left << std::setw(15) << "+ Executable" << + std::setw(25) << "Start date and time" << + std::setw(25) << "End date and time" << + std::setw(25) << "Exit status" << std::endl; for (UINT32 d=0, linelen(15+25+25+25); d(p.g.output_folder, p.g.network_name, "imp"); + p.i.imp_file = formPath(p.g.output_folder, p.g.network_name, "imp"); return CloseLogandReturn(dynadjust_log, EXIT_FAILURE, p.i.imp_file); } // end time PrintSuccessStatusMessage(dynadjust_log); - boost::this_thread::sleep(milliseconds(40)); + boost::this_thread::sleep(boost::posix_time::milliseconds(40)); } // Run reftran (optional) if (vm.count(RUN_REFTRAN)) { - stringstream cmd; + std::stringstream cmd; cmd << __reftran_app_name__ << " -p " << p.g.project_file; if (p.g.quiet) @@ -309,13 +303,13 @@ int main(int argc, char* argv[]) // end time PrintSuccessStatusMessage(dynadjust_log); - boost::this_thread::sleep(milliseconds(40)); + boost::this_thread::sleep(boost::posix_time::milliseconds(40)); } // Run geoid (optional) if (vm.count(RUN_GEOID)) { - stringstream cmd; + std::stringstream cmd; cmd << __geoid_app_name__ << " -p " << p.g.project_file; if (p.g.quiet) @@ -330,13 +324,13 @@ int main(int argc, char* argv[]) // end time PrintSuccessStatusMessage(dynadjust_log); - boost::this_thread::sleep(milliseconds(40)); + boost::this_thread::sleep(boost::posix_time::milliseconds(40)); } // Run segment (optional) if (vm.count(RUN_SEGMENT)) { - stringstream cmd; + std::stringstream cmd; cmd << __segment_app_name__ << " -p " << p.g.project_file; if (p.g.quiet) @@ -351,13 +345,13 @@ int main(int argc, char* argv[]) // end time PrintSuccessStatusMessage(dynadjust_log); - boost::this_thread::sleep(milliseconds(40)); + boost::this_thread::sleep(boost::posix_time::milliseconds(40)); } // Run adjust (optional) if (vm.count(RUN_ADJUST)) { - stringstream cmd; + std::stringstream cmd; cmd << __adjust_app_name__ << " -p " << p.g.project_file; if (p.g.quiet) @@ -372,7 +366,7 @@ int main(int argc, char* argv[]) // end time PrintSuccessStatusMessage(dynadjust_log); - boost::this_thread::sleep(milliseconds(40)); + boost::this_thread::sleep(boost::posix_time::milliseconds(40)); } return CloseLogandReturn(dynadjust_log, EXIT_SUCCESS); diff --git a/dynadjust/dynadjust/metadata/metadata.cpp b/dynadjust/dynadjust/metadata/metadata.cpp index 53bfa844..03d6fa0d 100644 --- a/dynadjust/dynadjust/metadata/metadata.cpp +++ b/dynadjust/dynadjust/metadata/metadata.cpp @@ -20,12 +20,6 @@ #include #include -using namespace std; -using namespace boost; -using namespace boost::filesystem; -using namespace boost::posix_time; -using namespace boost::program_options; - boost::mutex cout_mutex; boost::mutex import_file_mutex; @@ -48,21 +42,21 @@ using namespace dynadjust; using namespace dynadjust::exception; using namespace dynadjust::datum_parameters; -void processGNSSMeasurement(string& dnaMeasurementGNSS, string& referenceFrame, string& epoch, size_t& lineNo, size_t& measurementUpdateCount) +void processGNSSMeasurement(std::string& dnaMeasurementGNSS, std::string& referenceFrame, std::string& epoch, size_t& lineNo, size_t& measurementUpdateCount) { - string tmp(dnaMeasurementGNSS); + std::string tmp(dnaMeasurementGNSS); // Validate reference frame and epoch. Throws on error CDnaDatum datum; datum.SetDatumFromName(referenceFrame, epoch); - string FirstTag = ""; - string referenceframeTagOpen = ""; - string referenceframeTagClose = ""; - string epochTagOpen = ""; - string epochTagClose = ""; + std::string FirstTag = ""; + std::string referenceframeTagOpen = ""; + std::string referenceframeTagClose = ""; + std::string epochTagOpen = ""; + std::string epochTagClose = ""; - string referenceFrameElement, epochElement; + std::string referenceFrameElement, epochElement; referenceFrameElement = referenceframeTagOpen + referenceFrame + referenceframeTagClose + "\n "; epochElement = epochTagOpen + epoch + epochTagClose + "\n "; @@ -73,14 +67,14 @@ void processGNSSMeasurement(string& dnaMeasurementGNSS, string& referenceFrame, /////////////////////////////////////////////////////////// // Look for the existence of in data // If none, add new - if ((pos = tmp.find(referenceframeTagOpen)) == string::npos) + if ((pos = tmp.find(referenceframeTagOpen)) == std::string::npos) { // Okay, no reference frame tag. Add it before - if ((pos = tmp.find(FirstTag)) == string::npos) + if ((pos = tmp.find(FirstTag)) == std::string::npos) { - stringstream ss; - ss << "processGNSSMeasurement(): Could not find element in:" << endl << - dnaMeasurementGNSS << endl; + std::stringstream ss; + ss << "processGNSSMeasurement(): Could not find element in:" << std::endl << + dnaMeasurementGNSS << std::endl; throw XMLInteropException(ss.str(), (int)lineNo); } @@ -91,14 +85,14 @@ void processGNSSMeasurement(string& dnaMeasurementGNSS, string& referenceFrame, /////////////////////////////////////////////////////////// // Look for the existence of in data // If none, add new - if ((pos = tmp.find(epochTagOpen)) == string::npos) + if ((pos = tmp.find(epochTagOpen)) == std::string::npos) { // Okay, no reference frame tag. Add it before - if ((pos = tmp.find(FirstTag)) == string::npos) + if ((pos = tmp.find(FirstTag)) == std::string::npos) { - stringstream ss; - ss << "processGNSSMeasurement(): Could not find element in:" << endl << - dnaMeasurementGNSS << endl; + std::stringstream ss; + ss << "processGNSSMeasurement(): Could not find element in:" << std::endl << + dnaMeasurementGNSS << std::endl; throw XMLInteropException(ss.str(), (int)lineNo); } @@ -111,15 +105,15 @@ void processGNSSMeasurement(string& dnaMeasurementGNSS, string& referenceFrame, measurementUpdateCount++; } -void GetDefaultReferenceFrameEpoch(string& sBuf, string& referenceFrame, string& epoch) +void GetDefaultReferenceFrameEpoch(std::string& sBuf, std::string& referenceFrame, std::string& epoch) { size_t pos; - string referenceFrameAttribute = "referenceframe"; - string epochAttribute = "epoch"; + std::string referenceFrameAttribute = "referenceframe"; + std::string epochAttribute = "epoch"; - string tmp; + std::string tmp; - if ((pos = sBuf.find(referenceFrameAttribute)) != string::npos) + if ((pos = sBuf.find(referenceFrameAttribute)) != std::string::npos) { // Okay, get the reference frame // Advance to = @@ -128,13 +122,13 @@ void GetDefaultReferenceFrameEpoch(string& sBuf, string& referenceFrame, string& pos++; tmp = sBuf.substr(pos); - if ((pos = tmp.find("\"")) != string::npos) + if ((pos = tmp.find("\"")) != std::string::npos) tmp = tmp.substr(0, pos); referenceFrame = tmp; } - if ((pos = sBuf.find(epochAttribute)) != string::npos) + if ((pos = sBuf.find(epochAttribute)) != std::string::npos) { // Okay, get the epoch // Advance to = @@ -143,7 +137,7 @@ void GetDefaultReferenceFrameEpoch(string& sBuf, string& referenceFrame, string& pos++; tmp = sBuf.substr(pos); - if ((pos = tmp.find("\"")) != string::npos) + if ((pos = tmp.find("\"")) != std::string::npos) tmp = tmp.substr(0, pos); epoch = tmp; @@ -151,30 +145,30 @@ void GetDefaultReferenceFrameEpoch(string& sBuf, string& referenceFrame, string& } -void processFile(std::ifstream* ifsFile, std::ofstream* ofsFile, string& defaultFrame, string& defaultEpoch, +void processFile(std::ifstream* ifsFile, std::ofstream* ofsFile, std::string& defaultFrame, std::string& defaultEpoch, size_t& measurementUpdateCount, size_t& unsureFrameCount, size_t& unsureEpochCount) { - string sBuf, tmp; + std::string sBuf, tmp; - string referenceFrame(GDA94_s); - string epoch("01.01.1994"); + std::string referenceFrame(GDA94_s); + std::string epoch("01.01.1994"); - string openingDnaMeasurementTag = ""; - string closingDnaMeasurementTag = ""; + std::string openingDnaMeasurementTag = ""; + std::string closingDnaMeasurementTag = ""; - string dnaxmlFormatTag = " - const string metadataReferenceFrame = "[BASELINE REFFRAME]"; + const std::string metadataReferenceFrame = "[BASELINE REFFRAME]"; // - const string metadataEpoch = "[BASELINE EPOCH]"; + const std::string metadataEpoch = "[BASELINE EPOCH]"; - stringstream dnameasurementStream; + std::stringstream dnameasurementStream; bool newMeasurement(false); dnameasurementStream.str(""); @@ -198,14 +192,14 @@ void processFile(std::ifstream* ifsFile, std::ofstream* ofsFile, string& default if (ifsFile->eof()) return; - stringstream ss; - ss << "processFile(): Could not read from the station file." << endl; + std::stringstream ss; + ss << "processFile(): Could not read from the station file." << std::endl; throw XMLInteropException(ss.str(), (int)lineNo); } // Reached a DnaMeasurement opening tag? - if (sBuf.find(dnaxmlFormatTag) != string::npos) + if (sBuf.find(dnaxmlFormatTag) != std::string::npos) { // Get the default reference frame and epoch GetDefaultReferenceFrameEpoch(sBuf, referenceFrame, epoch); @@ -219,7 +213,7 @@ void processFile(std::ifstream* ifsFile, std::ofstream* ofsFile, string& default } // Reached a DnaMeasurement opening tag? - if (sBuf.find(openingDnaMeasurementTag) != string::npos) + if (sBuf.find(openingDnaMeasurementTag) != std::string::npos) { // yes, found an opening tag! newMeasurement = true; @@ -228,30 +222,30 @@ void processFile(std::ifstream* ifsFile, std::ofstream* ofsFile, string& default dnameasurementStream.str(""); // Add this string to the stringstream (for subsequent processing) - dnameasurementStream << sBuf << endl; + dnameasurementStream << sBuf << std::endl; } // Reached a DnaMeasurement closing tag? - else if (sBuf.find(closingDnaMeasurementTag) != string::npos) + else if (sBuf.find(closingDnaMeasurementTag) != std::string::npos) { // yes, found a closing tag! - dnameasurementStream << sBuf << endl; + dnameasurementStream << sBuf << std::endl; // capture the measurement - string dnaMeasurementGNSS = dnameasurementStream.str(); + std::string dnaMeasurementGNSS = dnameasurementStream.str(); // Is this a GNSS measurement? if not, dump and continue - if (dnaMeasurementGNSS.find(gType) != string::npos) + if (dnaMeasurementGNSS.find(gType) != std::string::npos) { // Process GNSS measurement processGNSSMeasurement(dnaMeasurementGNSS, referenceFrame, epoch, lineNo, measurementUpdateCount); } - else if (dnaMeasurementGNSS.find(xType) != string::npos) + else if (dnaMeasurementGNSS.find(xType) != std::string::npos) { // Process GNSS measurement processGNSSMeasurement(dnaMeasurementGNSS, referenceFrame, epoch, lineNo, measurementUpdateCount); } - else if (dnaMeasurementGNSS.find(yType) != string::npos) + else if (dnaMeasurementGNSS.find(yType) != std::string::npos) { // Process GNSS measurement processGNSSMeasurement(dnaMeasurementGNSS, referenceFrame, epoch, lineNo, measurementUpdateCount); @@ -273,7 +267,7 @@ void processFile(std::ifstream* ifsFile, std::ofstream* ofsFile, string& default if (newMeasurement) { // Yes, add this string to the stringstream (for subsequent processing) - dnameasurementStream << sBuf << endl; + dnameasurementStream << sBuf << std::endl; } else { @@ -282,14 +276,14 @@ void processFile(std::ifstream* ifsFile, std::ofstream* ofsFile, string& default // - A comment preceding a DnaMeasurement // Dump the line to output file - (*ofsFile) << sBuf << endl; + (*ofsFile) << sBuf << std::endl; } // Now check for Reference frame and epoch comments tmp = trimstr(sBuf); // Is this line a comment? - if (tmp.find(xmlComment) == string::npos) + if (tmp.find(xmlComment) == std::string::npos) { // No, this is a measurement element. @@ -300,21 +294,21 @@ void processFile(std::ifstream* ifsFile, std::ofstream* ofsFile, string& default // At this point, tmp is a comment. // Is this line a reference frame metadata tag in the comment? - if (tmp.find(metadataReferenceFrame) != string::npos) + if (tmp.find(metadataReferenceFrame) != std::string::npos) { - if ((pos = tmp.find("]", 0)) != string::npos) + if ((pos = tmp.find("]", 0)) != std::string::npos) { referenceFrame = tmp.substr(pos+1); - if ((pos = referenceFrame.find("-->", 0)) != string::npos) + if ((pos = referenceFrame.find("-->", 0)) != std::string::npos) referenceFrame = trimstr(referenceFrame.substr(0, pos)); - if (iequals(referenceFrame, "unsure")) + if (boost::iequals(referenceFrame, "unsure")) { referenceFrame = defaultFrame; unsureFrameCount++; } - if (iequals(referenceFrame, "WGS84")) + if (boost::iequals(referenceFrame, "WGS84")) { referenceFrame = "ITRF1989"; } @@ -322,15 +316,15 @@ void processFile(std::ifstream* ifsFile, std::ofstream* ofsFile, string& default } // Is this line a epoch metadata tag in the comment? - else if (tmp.find(metadataEpoch) != string::npos) + else if (tmp.find(metadataEpoch) != std::string::npos) { - if ((pos = tmp.find("]", 0)) != string::npos) + if ((pos = tmp.find("]", 0)) != std::string::npos) { epoch = tmp.substr(pos+1); - if ((pos = epoch.find("-->", 0)) != string::npos) + if ((pos = epoch.find("-->", 0)) != std::string::npos) epoch = trimstr(epoch.substr(0, pos)); - if (iequals(epoch, "unsure")) + if (boost::iequals(epoch, "unsure")) { epoch = "01.01.2005"; unsureEpochCount++; @@ -345,36 +339,36 @@ void processFile(std::ifstream* ifsFile, std::ofstream* ofsFile, string& default int main(int argc, char* argv[]) { - stringstream ss_err; + std::stringstream ss_err; - string cmd_line_banner; + std::string cmd_line_banner; fileproc_help_header(&cmd_line_banner); project_settings p; - variables_map vm; - positional_options_description positional_options; + boost::program_options::variables_map vm; + boost::program_options::positional_options_description positional_options; - options_description standard_options("+ " + string(ALL_MODULE_STDOPT), PROGRAM_OPTIONS_LINE_LENGTH); - options_description generic_options("+ " + string(ALL_MODULE_GENERIC), PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description standard_options("+ " + std::string(ALL_MODULE_STDOPT), PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description generic_options("+ " + std::string(ALL_MODULE_GENERIC), PROGRAM_OPTIONS_LINE_LENGTH); - string cmd_line_usage("+ "); + std::string cmd_line_usage("+ "); cmd_line_usage.append(__BINARY_NAME__).append(" usage: ").append(__BINARY_NAME__).append(" ").append(" [options]"); - options_description allowable_options(cmd_line_usage, PROGRAM_OPTIONS_LINE_LENGTH); + boost::program_options::options_description allowable_options(cmd_line_usage, PROGRAM_OPTIONS_LINE_LENGTH); try { standard_options.add_options() - (IMPORT_FILE_F, value< vstring >(&p.i.input_files), + (IMPORT_FILE_F, boost::program_options::value< vstring >(&p.i.input_files), "Station and measurement input file(s). Switch is not required.") ; generic_options.add_options() - (VERBOSE, value(&p.g.verbose), - string("Give detailed information about what ").append(__BINARY_NAME__).append(" is doing.\n 0: No information (default)\n 1: Helpful information\n 2: Extended information\n 3: Debug level information").c_str()) + (VERBOSE, boost::program_options::value(&p.g.verbose), + std::string("Give detailed information about what ").append(__BINARY_NAME__).append(" is doing.\n 0: No information (default)\n 1: Helpful information\n 2: Extended information\n 3: Debug level information").c_str()) (QUIET, - string("Suppresses all explanation of what ").append(__BINARY_NAME__).append(" is doing unless an error occurs.").c_str()) + std::string("Suppresses all explanation of what ").append(__BINARY_NAME__).append(" is doing unless an error occurs.").c_str()) (VERSION_V, "Display the current program version.") (HELP_H, "Show this help message.") - (HELP_MODULE, value(), + (HELP_MODULE_H, boost::program_options::value(), "Provide help for a specific help category.") ; @@ -383,52 +377,52 @@ int main(int argc, char* argv[]) // add "positional options" to handle command line tokens which have no option name positional_options.add(IMPORT_FILE, -1); - command_line_parser parser(argc, argv); + boost::program_options::command_line_parser parser(argc, argv); store(parser.options(allowable_options).positional(positional_options).run(), vm); notify(vm); } catch (const std::exception& e) { cout_mutex.lock(); - cout << "- Error: " << e.what() << endl; - cout << cmd_line_banner << allowable_options << endl; + std::cout << "- Error: " << e.what() << std::endl; + std::cout << cmd_line_banner << allowable_options << std::endl; cout_mutex.unlock(); return EXIT_FAILURE; } if (argc < 2) { - cout << endl << "- Nothing to do - no files or options provided. " << endl << endl; - cout << cmd_line_banner << allowable_options << endl; + std::cout << std::endl << "- Nothing to do - no files or options provided. " << std::endl << std::endl; + std::cout << cmd_line_banner << allowable_options << std::endl; return EXIT_FAILURE; } if (vm.count(VERSION)) { - cout << cmd_line_banner << endl; + std::cout << cmd_line_banner << std::endl; return EXIT_SUCCESS; } if (vm.count(HELP)) { - cout << cmd_line_banner << allowable_options << endl; + std::cout << cmd_line_banner << allowable_options << std::endl; return EXIT_SUCCESS; } if (vm.count(HELP_MODULE)) { - cout << cmd_line_banner; - string original_text = vm[HELP_MODULE].as(); - string help_text = str_upper(original_text); + std::cout << cmd_line_banner; + std::string original_text = vm[HELP_MODULE].as(); + std::string help_text = str_upper(original_text); - if (str_upper(ALL_MODULE_STDOPT).find(help_text) != string::npos) { - cout << standard_options << endl; + if (str_upper(ALL_MODULE_STDOPT).find(help_text) != std::string::npos) { + std::cout << standard_options << std::endl; } - else if (str_upper(ALL_MODULE_GENERIC).find(help_text) != string::npos) { - cout << generic_options << endl; + else if (str_upper(ALL_MODULE_GENERIC).find(help_text) != std::string::npos) { + std::cout << generic_options << std::endl; } else { - cout << endl << "- Error: Help module '" << - original_text << "' is not in the list of options." << endl; + std::cout << std::endl << "- Error: Help module '" << + original_text << "' is not in the list of options." << std::endl; return EXIT_FAILURE; } @@ -437,28 +431,28 @@ int main(int argc, char* argv[]) // Normalise files using input folder for_each(p.i.input_files.begin(), p.i.input_files.end(), - [&p] (string& file) { - formPath(p.g.input_folder, file); + [&p] (std::string& file) { + formPath(p.g.input_folder, file); } ); UINT32 stnCount(0), msrCount(0), clusterID(0); size_t i, nfiles(p.i.input_files.size()); // for each file... - string input_file, output_file, ss; - string defaultFrame, defaultEpoch; + std::string input_file, output_file, ss; + std::string defaultFrame, defaultEpoch; - ostringstream ss_time, ss_msg; - milliseconds elapsed_time(milliseconds(0)); - ptime pt; + std::ostringstream ss_time, ss_msg; + boost::posix_time::milliseconds elapsed_time(boost::posix_time::milliseconds(0)); + boost::posix_time::ptime pt; if (!p.g.quiet) { - cout << endl << cmd_line_banner; - cout << "+ Parsing: " << endl; + std::cout << std::endl << cmd_line_banner; + std::cout << "+ Parsing: " << std::endl; } - cpu_timer time; // constructor of boost::timer::cpu_timer calls start() + boost::timer::cpu_timer time; // constructor of boost::timer::cpu_timer calls start() std::ifstream* ifsDynaML_; size_t sifsFileSize_, measurementUpdateCount(0), unsureFrameCount(0), unsureEpochCount(0); @@ -470,9 +464,9 @@ int main(int argc, char* argv[]) size_t strlen_arg = 0; for_each(p.i.input_files.begin(), p.i.input_files.end(), - [&strlen_arg](string& file) { - if (leafStr(file).length() > strlen_arg) - strlen_arg = leafStr(file).length(); + [&strlen_arg](std::string& file) { + if (leafStr(file).length() > strlen_arg) + strlen_arg = leafStr(file).length(); }); strlen_arg += (6 + PROGRESS_PERCENT_04); @@ -482,25 +476,25 @@ int main(int argc, char* argv[]) time.start(); - if (!exists(input_file)) + if (!boost::filesystem::exists(input_file)) { - input_file = formPath(p.g.input_folder, input_file); - if (!exists(input_file)) + input_file = formPath(p.g.input_folder, input_file); + if (!boost::filesystem::exists(input_file)) { - cout << "- Error: " << input_file << " does not exist" << endl; + std::cout << "- Error: " << input_file << " does not exist" << std::endl; return EXIT_FAILURE; } } // Form output file path - stringstream ss_outputfile(""); - ss_outputfile << path(input_file).stem().generic_string(); + std::stringstream ss_outputfile(""); + ss_outputfile << boost::filesystem::path(input_file).stem().generic_string(); ss_outputfile << ".edit.xml"; output_file = ss_outputfile.str(); - ss = leafStr(p.i.input_files.at(i)) + "... "; + ss = leafStr(p.i.input_files.at(i)) + "... "; if (!p.g.quiet) - cout << " " << setw(strlen_arg) << left << ss; + std::cout << " " << std::setw(strlen_arg) << std::left << ss; // Obtain exclusive use of the input file pointer import_file_mutex.lock(); @@ -516,20 +510,20 @@ int main(int argc, char* argv[]) ifsDynaML_ = new std::ifstream; // Open and seek to end immediately after opening. - file_opener(ifsDynaML_, input_file, ios::in | ios::ate, ascii, true); + file_opener(ifsDynaML_, input_file, std::ios::in | std::ios::ate, ascii, true); // get file size and return to start sifsFileSize_ = (size_t)ifsDynaML_->tellg(); - ifsDynaML_->seekg(0, ios::beg); + ifsDynaML_->seekg(0, std::ios::beg); } - catch (const ios_base::failure& f) { - cout << "- Error: An error was encountered when opening " << input_file << "." << endl; - cout << " Check that the file exists and that the file is not already opened." << endl << f.what(); + catch (const std::ios_base::failure& f) { + std::cout << "- Error: An error was encountered when opening " << input_file << "." << std::endl; + std::cout << " Check that the file exists and that the file is not already opened." << std::endl << f.what(); return EXIT_FAILURE; } catch (...) { - cout << "- Error: An error was encountered when opening " << input_file << "." << endl; - cout << " Check that the file exists and that the file is not already opened."; + std::cout << "- Error: An error was encountered when opening " << input_file << "." << std::endl; + std::cout << " Check that the file exists and that the file is not already opened."; return EXIT_FAILURE; } @@ -544,15 +538,15 @@ int main(int argc, char* argv[]) ofsDynaML_ = new std::ofstream; // Open output file - file_opener(ofsDynaML_, output_file, ios::out, ascii); + file_opener(ofsDynaML_, output_file, std::ios::out, ascii); } - catch (const ios_base::failure& f) { - cout << "- Error: An error was encountered when opening " << output_file << "." << endl << f.what(); + catch (const std::ios_base::failure& f) { + std::cout << "- Error: An error was encountered when opening " << output_file << "." << std::endl << f.what(); return EXIT_FAILURE; } catch (...) { - cout << "- Error: An error was encountered when opening " << output_file << "." << endl; + std::cout << "- Error: An error was encountered when opening " << output_file << "." << std::endl; return EXIT_FAILURE; } @@ -565,32 +559,32 @@ int main(int argc, char* argv[]) processFile(ifsDynaML_, ofsDynaML_, defaultFrame, defaultEpoch, measurementUpdateCount, unsureFrameCount, unsureEpochCount); } - catch (const runtime_error& e) { - cout << endl << "- Error: " << e.what() << endl; + catch (const std::runtime_error& e) { + std::cout << std::endl << "- Error: " << e.what() << std::endl; return EXIT_FAILURE; }catch (const XMLInteropException& e) { - cout << endl << "- Error: " << e.what() << endl; + std::cout << std::endl << "- Error: " << e.what() << std::endl; return EXIT_FAILURE; } catch (...) { - cout << "+ Exception of unknown type!\n"; + std::cout << "+ Exception of unknown type!\n"; return EXIT_FAILURE; } // Finish up time.stop(); - elapsed_time = milliseconds(time.elapsed().wall/MILLI_TO_NANO); + elapsed_time = boost::posix_time::milliseconds(time.elapsed().wall/MILLI_TO_NANO); if (!p.g.quiet) { - cout << "done." << endl << endl; - cout << "+ Output file: " << output_file << endl; - cout << "+ Default reference frame: " << defaultFrame << endl; - cout << "+ Default epoch: " << defaultEpoch << endl; - cout << "+ No. DnaMeasurement records updated: " << measurementUpdateCount << endl; - cout << "+ No. comments with \"unsure\" frame: " << unsureFrameCount << endl; - cout << "+ No. comments with \"unsure\" epoch: " << unsureEpochCount << endl; + std::cout << "done." << std::endl << std::endl; + std::cout << "+ Output file: " << output_file << std::endl; + std::cout << "+ Default reference frame: " << defaultFrame << std::endl; + std::cout << "+ Default epoch: " << defaultEpoch << std::endl; + std::cout << "+ No. DnaMeasurement records updated: " << measurementUpdateCount << std::endl; + std::cout << "+ No. comments with \"unsure\" frame: " << unsureFrameCount << std::endl; + std::cout << "+ No. comments with \"unsure\" epoch: " << unsureEpochCount << std::endl; } @@ -609,7 +603,7 @@ int main(int argc, char* argv[]) { ifsDynaML_ = 0; } - cout << "- Error: An error was encountered when closing " << input_file << "." << endl << endl << e.what() << endl << " Check that the file exists and that the file is not already opened."; + std::cout << "- Error: An error was encountered when closing " << input_file << "." << std::endl << std::endl << e.what() << std::endl << " Check that the file exists and that the file is not already opened."; return EXIT_FAILURE; } @@ -630,7 +624,7 @@ int main(int argc, char* argv[]) { ofsDynaML_ = 0; } - cout << "- Error: An error was encountered when closing " << output_file << "." << endl << endl << e.what() << endl; + std::cout << "- Error: An error was encountered when closing " << output_file << "." << std::endl << std::endl << e.what() << std::endl; return EXIT_FAILURE; } @@ -638,8 +632,8 @@ int main(int argc, char* argv[]) if (!p.g.quiet) { - string time_message = formatedElapsedTime(&elapsed_time, "+ File processing time: "); - cout << time_message << endl << endl; + std::string time_message = formatedElapsedTime(&elapsed_time, "+ File processing time: "); + std::cout << time_message << std::endl << std::endl; } // release file pointer mutex diff --git a/dynadjust/dynadjust/metadata/precompile.h b/dynadjust/dynadjust/metadata/precompile.h index 9f5ad3ea..1b47ed3c 100644 --- a/dynadjust/dynadjust/metadata/precompile.h +++ b/dynadjust/dynadjust/metadata/precompile.h @@ -5,6 +5,13 @@ #pragma once +// prevent conflict with std::min(...) std::max(...) +#ifdef _WIN32 +#ifndef NOMINMAX +#define NOMINMAX +#endif +#endif + #include #include diff --git a/dynadjust/include/config/dnaconsts.hpp b/dynadjust/include/config/dnaconsts.hpp index 92062194..044b9977 100644 --- a/dynadjust/include/config/dnaconsts.hpp +++ b/dynadjust/include/config/dnaconsts.hpp @@ -107,7 +107,7 @@ const double HPOS_UNCERT_Q3(0.371625); const double E4_SEC_DEFLECTION(0.0001 * SEC_TO_RAD); const double STN_SEARCH_RADIUS(0.3); -const string STN_SEARCH_RADIUS_STR("0.3"); +const std::string STN_SEARCH_RADIUS_STR("0.3"); const double TOLERANCE_SEC_MIN(1.); const double TOLERANCE_SEC_MAX(7200.); // 120 minutes (or 2 degrees) @@ -122,9 +122,9 @@ const double MAX_DBL_VALUE(+1.7e308); const UINT32 MAX_UINT32_VALUE(0xffffffff); #if defined(_WIN32) || defined(__WIN32__) -const string FOLDER_SLASH("\\"); +const std::string FOLDER_SLASH("\\"); #elif defined(__linux) || defined(sun) || defined(__unix__) || defined(__APPLE__) -const string FOLDER_SLASH("/"); +const std::string FOLDER_SLASH("/"); #endif #endif // DNACONSTS_HPP diff --git a/dynadjust/include/config/dnaoptions-interface.hpp b/dynadjust/include/config/dnaoptions-interface.hpp index 8632c558..07059a2d 100644 --- a/dynadjust/include/config/dnaoptions-interface.hpp +++ b/dynadjust/include/config/dnaoptions-interface.hpp @@ -74,6 +74,7 @@ const char* const BIN_MSR_FILE = "binary-msr-file"; const char* const BIN_MSR_FILE_M = "binary-msr-file,m"; const char* const CONVERT_BST_HT = "convert-stn-hts"; const char* const HELP_MODULE = "help-module"; +const char* const HELP_MODULE_H = "help-module,?"; const char* const HELP = "help"; const char* const HELP_H = "help,h"; const char* const VERSION = "version"; diff --git a/dynadjust/include/config/dnaoptions.hpp b/dynadjust/include/config/dnaoptions.hpp index e9f83ffa..f5ebc00c 100644 --- a/dynadjust/include/config/dnaoptions.hpp +++ b/dynadjust/include/config/dnaoptions.hpp @@ -143,8 +143,6 @@ enum coastResolution full = 4 }; -using namespace boost; - // general settings used by all programs struct general_settings : private boost::equality_comparable { public: @@ -171,11 +169,11 @@ struct general_settings : private boost::equality_comparable { UINT16 verbose; // Give detailed information about what dnainterop is doing.\n0: No information (default)\n1: Helpful information\n2: Extended information\n3: Debug level information UINT16 version; // Display the current program version UINT16 interactive; // whether to display a Qt Dialog or continue with command window - string log_file; // dynadjust log filename - string project_file; // project filename - string network_name; // network name - string input_folder; // Additional include folder containing input files (used for command line help only) - string output_folder; // Path for all output (intermediate) files + std::string log_file; // dynadjust log filename + std::string project_file; // project filename + std::string network_name; // network name + std::string input_folder; // Additional include folder containing input files (used for command line help only) + std::string output_folder; // Path for all output (intermediate) files v_string_string_pair variables; // Shortcut tags to assist with file naming }; @@ -183,7 +181,7 @@ struct general_settings : private boost::equality_comparable { struct import_settings : private boost::equality_comparable { public: import_settings() - : reference_frame(DEFAULT_DATUM), user_supplied_frame(0), override_input_rfame(0) + : reference_frame(DEFAULT_DATUM), epoch(DEFAULT_EPOCH), user_supplied_frame(0), user_supplied_epoch(0), override_input_rfame(0) , test_integrity(0), verify_coordinates(0), export_dynaml(0), export_from_bfiles(0) , export_single_xml_file(0), prefer_single_x_as_g(0), export_asl_file(0), export_aml_file(0), export_map_file(0) , export_dna_files(0), export_discont_file(0), import_geo_file(0), simulate_measurements(0), split_clusters(0), include_transcending_msrs(0) @@ -229,8 +227,10 @@ struct import_settings : private boost::equality_comparable { //} public: - string reference_frame; // Default reference frame - used primarily for reductions on the ellipsoid. + std::string reference_frame; // Project reference frame - used primarily for reductions on the ellipsoid. + std::string epoch; // Project epoch UINT16 user_supplied_frame; // User has supplied a frame - use this to change the default frame + UINT16 user_supplied_epoch; // User has supplied a epoch - use this to change the default epoch UINT16 override_input_rfame; // Override reference frame specified in input files using the default or user supplied frame. UINT16 test_integrity; // Test integrity of network UINT16 verify_coordinates; // Test integrity of coordinates @@ -248,30 +248,30 @@ struct import_settings : private boost::equality_comparable { UINT16 split_clusters; // Allow bounding box or station selection to split GNSS point and baseline clusters. UINT16 include_transcending_msrs; // Include measurements straddling bounding box. UINT16 apply_scaling; // Apply scaling? - string map_file; // Station map output file - string asl_file; // Associated stations output file - string aml_file; // Associated measurements output file - string bst_file; // Binary station output file - string bms_file; // Binary measurement output file - string dst_file; // Duplicate station output file - string dms_file; // Duplicate measurement output file - string imp_file; // import log file - string geo_file; // Geoid file to use on import - string seg_file; // Segmentation input file - string dbid_file; // Database ID file - string xml_outfile; // Create DynaML output file (combined stn and msr) - string xml_stnfile; // DynaML station file - string xml_msrfile; // DynaML measurement file - string dna_stnfile; // DNA station file - string dna_msrfile; // DNA measurement file - string stn_renamingfile; // Station renaming file - string stn_discontinuityfile; // Station discontinuity file (SINEX format) - string simulate_msrfile; // Simulation control file - string include_msrs; // Import the measurements corresponding to the user-supplied string of measurement types - string exclude_msrs; // Exclude the measurements corresponding to the user-supplied string of measurement types - string bounding_box; // Import stations and measurements within bounding box using comma delimited string \"lat1,lon1,lat2,lon2\" to define upper-left and lower-right limits. - string stn_associated_msr_include; // Include stations and all associated measurements. arg is a comma delimited string \"stn 1,stn 2,stn 3,...,stn N\" of the stations to include. - string stn_associated_msr_exclude; // Exclude stations and all associated measurements. arg is a comma delimited string \"stn 1,stn 2,stn 3,...,stn N\" of the stations to exclude. + std::string map_file; // Station map output file + std::string asl_file; // Associated stations output file + std::string aml_file; // Associated measurements output file + std::string bst_file; // Binary station output file + std::string bms_file; // Binary measurement output file + std::string dst_file; // Duplicate station output file + std::string dms_file; // Duplicate measurement output file + std::string imp_file; // import log file + std::string geo_file; // Geoid file to use on import + std::string seg_file; // Segmentation input file + std::string dbid_file; // Database ID file + std::string xml_outfile; // Create DynaML output file (combined stn and msr) + std::string xml_stnfile; // DynaML station file + std::string xml_msrfile; // DynaML measurement file + std::string dna_stnfile; // DNA station file + std::string dna_msrfile; // DNA measurement file + std::string stn_renamingfile; // Station renaming file + std::string stn_discontinuityfile; // Station discontinuity file (SINEX format) + std::string simulate_msrfile; // Simulation control file + std::string include_msrs; // Import the measurements corresponding to the user-supplied string of measurement types + std::string exclude_msrs; // Exclude the measurements corresponding to the user-supplied string of measurement types + std::string bounding_box; // Import stations and measurements within bounding box using comma delimited string \"lat1,lon1,lat2,lon2\" to define upper-left and lower-right limits. + std::string stn_associated_msr_include; // Include stations and all associated measurements. arg is a comma delimited string \"stn 1,stn 2,stn 3,...,stn N\" of the stations to include. + std::string stn_associated_msr_exclude; // Exclude stations and all associated measurements. arg is a comma delimited string \"stn 1,stn 2,stn 3,...,stn N\" of the stations to exclude. UINT16 rename_stations; // Rename stations using a station renaming file UINT16 apply_discontinuities; // Rename stations using discontinuities and measurement epochs UINT16 search_nearby_stn; // Search for nearby stations @@ -292,8 +292,8 @@ struct import_settings : private boost::equality_comparable { double pscale; // phi scalar double lscale; // lambda scalar double hscale; // height scalar - string scalar_file; // scalar file (individual scalars defined for measurements between specific stations) - string command_line_arguments; + std::string scalar_file; // scalar file (individual scalars defined for measurements between specific stations) + std::string command_line_arguments; vstring input_files; // Default input arguments if no switch is provided. }; @@ -302,7 +302,7 @@ struct reftran_settings : private boost::equality_comparable { public: reftran_settings() : rft_file(""), bst_file(""), bms_file("") - , reference_frame(DEFAULT_DATUM), epoch("") + , reference_frame(DEFAULT_DATUM), epoch(DEFAULT_EPOCH) , tpb_file(""), tpp_file("") , plate_model_option(0) , command_line_arguments("") {} @@ -317,15 +317,15 @@ struct reftran_settings : private boost::equality_comparable { //} public: - string rft_file; // reftran log file - string bst_file; // Binary station output file - string bms_file; // Binary measurement output file - string reference_frame; // Reference frame for all stations and measurements. Requires datum.conf and ellipsoid.conf. - string epoch; // Epoch - string tpb_file; // Tectonic plate boundary file - string tpp_file; // Tectonic plate pole file + std::string rft_file; // reftran log file + std::string bst_file; // Binary station output file + std::string bms_file; // Binary measurement output file + std::string reference_frame; // Reference frame for all stations and measurements. Requires datum.conf and ellipsoid.conf. + std::string epoch; // Epoch + std::string tpb_file; // Tectonic plate boundary file + std::string tpp_file; // Tectonic plate pole file UINT16 plate_model_option; // Informs reftran which plate model option to use - string command_line_arguments; + std::string command_line_arguments; }; // geoid settings @@ -360,12 +360,12 @@ struct geoid_settings : private boost::equality_comparable { UINT16 coordinate_format; // ddeg or dms (default) UINT16 convert_heights; // convert ortho binary station heights to ellipsoidal UINT16 export_dna_geo_file; // Export geoid information in DNA geoid file - string rdat_geoid_file; // raw dat geoid file - string ntv2_geoid_file; // ntv2 geoid file - string input_file; // input file - string bst_file; // bst file - string geo_file; // dna geo file - string command_line_arguments; + std::string rdat_geoid_file; // raw dat geoid file + std::string ntv2_geoid_file; // ntv2 geoid file + std::string input_file; // input file + std::string bst_file; // bst file + std::string geo_file; // dna geo file + std::string command_line_arguments; }; // network segmentation settings @@ -402,16 +402,16 @@ struct segment_settings : private boost::equality_comparable { UINT16 show_segment_summary; // show segmentation summary dialog UINT16 print_segment_debug; // print segmentation debug information UINT16 force_contiguous_blocks; // force contiguous blocks - string map_file; // Station map file - string asl_file; // Associated stations file - string aml_file; // Associated measurements file - string bst_file; // Binary station file - string bms_file; // Binary measurement file - string seg_file; // Segmentation output file - string sap_file; // Station appearance list file - string net_file; // Starting stations output file - string seg_starting_stns; // Stations to be incorporated within the first block. - string command_line_arguments; + std::string map_file; // Station map file + std::string asl_file; // Associated stations file + std::string aml_file; // Associated measurements file + std::string bst_file; // Binary station file + std::string bms_file; // Binary measurement file + std::string seg_file; // Segmentation output file + std::string sap_file; // Station appearance list file + std::string net_file; // Starting stations output file + std::string seg_starting_stns; // Stations to be incorporated within the first block. + std::string command_line_arguments; }; // network segmentation settings @@ -444,7 +444,7 @@ struct adjust_settings : private boost::equality_comparable { //} public: - inline void setFilenames(const string& name) { + inline void setFilenames(const std::string& name) { map_file = name + ".map"; bst_file = name + ".bst"; bms_file = name + ".bms"; @@ -469,22 +469,22 @@ struct adjust_settings : private boost::equality_comparable { float iteration_threshold; // Convergence limit double free_std_dev; // SD for free stations double fixed_std_dev; // SD for fixed stations - string station_constraints; // Station constraints. Comma delimited string. - string map_file; // Station map file - string bst_file; // Binary station file - string bms_file; // Binary measurement file - string seg_file; // Segmentation file - string comments; // General comments about the adjustment, printed to the adj file. - string command_line_arguments; - string type_b_global; // Comma delimited string containing Type b uncertainties to be applied to all uncertainties computed from an adjustment - string type_b_file; // File path to Type b uncertainties to be applied to specific site uncertainties computed from an adjustment + std::string station_constraints; // Station constraints. Comma delimited string. + std::string map_file; // Station map file + std::string bst_file; // Binary station file + std::string bms_file; // Binary measurement file + std::string seg_file; // Segmentation file + std::string comments; // General comments about the adjustment, printed to the adj file. + std::string command_line_arguments; + std::string type_b_global; // Comma delimited string containing Type b uncertainties to be applied to all uncertainties computed from an adjustment + std::string type_b_file; // File path to Type b uncertainties to be applied to specific site uncertainties computed from an adjustment }; // datum and geoid settings struct output_settings : private boost::equality_comparable { public: output_settings() - : _datum(DEFAULT_DATUM), _m2s_file(""), _adj_file(""), _xyz_file("") + : _m2s_file(""), _adj_file(""), _xyz_file("") , _snx_file(""), _xml_file(""), _cor_file(""), _apu_file("") , _adj_stn_iteration(0), _adj_msr_iteration(0), _cmp_msr_iteration(0), _adj_stat_iteration(0) , _adj_msr_final(0), _adj_msr_tstat(0), _database_ids(0), _print_ignored_msrs(0), _adj_gnss_units(0) @@ -535,14 +535,13 @@ struct output_settings : private boost::equality_comparable { //} public: - string _datum; // Datum switch. Requires datum.conf and ellipsoid.conf. - string _m2s_file; // Measurement to stations file - string _adj_file; // Adjustment output - string _xyz_file; // Adjusted coordinate output - string _snx_file; // Adjusted coordinate output in SINEX format - string _xml_file; // Estimated station coordinates and full variance matrix in DynaML (DynAdjust XML) format. Uses Y cluster. - string _cor_file; // Corrections to intial stations output - string _apu_file; // Adjusted positional uncertainty output + std::string _m2s_file; // Measurement to stations file + std::string _adj_file; // Adjustment output + std::string _xyz_file; // Adjusted coordinate output + std::string _snx_file; // Adjusted coordinate output in SINEX format + std::string _xml_file; // Estimated station coordinates and full variance matrix in DynaML (DynAdjust XML) format. Uses Y cluster. + std::string _cor_file; // Corrections to intial stations output + std::string _apu_file; // Adjusted positional uncertainty output UINT16 _adj_stn_iteration; // Outputs adjusted stations for each block within each iteration UINT16 _adj_msr_iteration; // Outputs adjusted measurements for each block within each iteration UINT16 _cmp_msr_iteration; // Outputs computed measurements for each block within each iteration @@ -570,7 +569,7 @@ struct output_settings : private boost::equality_comparable { UINT16 _export_snx_file; // Create a sinex file from the adjustment double _hz_corr_threshold; // Minimum horizontal threshold for station corrections double _vt_corr_threshold; // Minimum vertical threshold for station corrections - string _stn_coord_types; // String defining the cooridnate types to be printed for each station + std::string _stn_coord_types; // String defining the cooridnate types to be printed for each station UINT16 _angular_type_stn; // Type of angular station coordinates (dms or ddeg) UINT16 _precision_seconds_stn; // Precision of angular station values given in seconds UINT16 _precision_metres_stn; // Precision of linear station values given in seconds @@ -637,10 +636,10 @@ struct plot_settings : private boost::equality_comparable { // 4 Transverse Mercator // 5 Albers conic equal-area // 6 Lambert conformal - string _gmt_cmd_file; // GMT command file to create the eps - string _gnuplot_cmd_file; // Gnuplot command file to create the eps - string _eps_file_name; // The eps file generated either by gmt or gnuplot - string _pdf_file_name; // The PDF file generated either by gmt or gnuplot + std::string _gmt_cmd_file; // GMT command file to create the eps + std::string _gnuplot_cmd_file; // Gnuplot command file to create the eps + std::string _eps_file_name; // The eps file generated either by gmt or gnuplot + std::string _pdf_file_name; // The PDF file generated either by gmt or gnuplot bool _plot_phased_blocks; // Plot the blocks of a segmented network. Requires a corresponding segmentation file. bool _plot_station_labels; // Plots the station labels bool _plot_ignored_msrs; // Plot ignored measurements @@ -662,8 +661,8 @@ struct plot_settings : private boost::equality_comparable { double _msr_line_width; // Measurement line width double _correction_scale; // The amount by which to scale the size of correction arrows double _pu_ellipse_scale; // The amount by which to scale the size of error ellipses and positional uncertainty cirlces - string _plot_station_centre; // Centre the map according to this station - string _bounding_box; // user defined bounding box for plot + std::string _plot_station_centre; // Centre the map according to this station + std::string _bounding_box; // user defined bounding box for plot double _plot_area_radius; // Set the limits of the plot according to a radius double _plot_centre_latitude; // Centre the map according to this latitude double _plot_centre_longitude; // Centre the map according to this longitude @@ -672,10 +671,10 @@ struct plot_settings : private boost::equality_comparable { double _ground_width; // ground width in metres UINT32 _plot_block_number; // Plots this block only UINT16 _coasline_resolution; // ncdf resolution - string _title; // Title of the plot - string _title_block_name; // Name of the unit to display in the title block - string _title_block_subname; // Name of the cub-unit to display in the title block - string command_line_arguments; + std::string _title; // Title of the plot + std::string _title_block_name; // Name of the unit to display in the title block + std::string _title_block_subname; // Name of the cub-unit to display in the title block + std::string command_line_arguments; v_string_string_pair _gmt_params; // GMT parameters vchar _separate_msrs; // A char vector of measurement types to be created individually v_string_string_pair _msr_colours; // A vector of measurement types and corresponding colours diff --git a/dynadjust/include/config/dnaprojectfile.cpp b/dynadjust/include/config/dnaprojectfile.cpp index 4c38ea36..dcf20433 100644 --- a/dynadjust/include/config/dnaprojectfile.cpp +++ b/dynadjust/include/config/dnaprojectfile.cpp @@ -36,7 +36,7 @@ CDnaProjectFile::CDnaProjectFile(void) } // Create instance and initialise settings based on context -CDnaProjectFile::CDnaProjectFile(const string& projectFile, const UINT16& verifyContext) +CDnaProjectFile::CDnaProjectFile(const std::string& projectFile, const UINT16& verifyContext) { LoadProjectFile(projectFile); @@ -89,20 +89,20 @@ CDnaProjectFile::CDnaProjectFile(const string& projectFile, const UINT16& verify //} -void CDnaProjectFile::LoadProjectFile(const string& projectFile) +void CDnaProjectFile::LoadProjectFile(const std::string& projectFile) { // load project file - if (exists(projectFile)) + if (boost::filesystem::exists(projectFile)) { settings_.g.project_file = projectFile; LoadProjectFile(); } else { - stringstream err_msg; + std::stringstream err_msg; err_msg << "LoadProjectFile(): Project file " << - projectFile << " does not exist." << endl; - throw boost::enable_current_exception(runtime_error(err_msg.str())); + projectFile << " does not exist." << std::endl; + throw boost::enable_current_exception(std::runtime_error(err_msg.str())); } } @@ -112,29 +112,29 @@ void CDnaProjectFile::LoadProjectFile() // load project file using p.g.project_file std::ifstream dnaproj_file; - stringstream err_msg; + std::stringstream err_msg; err_msg << "LoadProjectFile(): An error was encountered when opening " << - settings_.g.project_file << "." << endl; + settings_.g.project_file << "." << std::endl; try { // create binary aml file. Throws runtime_error on failure. file_opener(dnaproj_file, settings_.g.project_file, - ios::in, ascii, true); + std::ios::in, ascii, true); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { err_msg << e.what(); - throw boost::enable_current_exception(runtime_error(err_msg.str())); + throw boost::enable_current_exception(std::runtime_error(err_msg.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(err_msg.str())); + throw boost::enable_current_exception(std::runtime_error(err_msg.str())); } err_msg.str(""); err_msg << "LoadProjectFile(): An error was encountered when loading from " << - settings_.g.project_file << "." << endl; + settings_.g.project_file << "." << std::endl; - string str, line, var, val; - stringstream ss; + std::string str, line, var, val; + std::stringstream ss; settingMode mSetting(unknownSetting); @@ -148,16 +148,16 @@ void CDnaProjectFile::LoadProjectFile() if (dnaproj_file.eof()) break; - err_msg << f.what() << endl; - throw boost::enable_current_exception(runtime_error(err_msg.str())); + err_msg << f.what() << std::endl; + throw boost::enable_current_exception(std::runtime_error(err_msg.str())); } catch (...) { if (dnaproj_file.eof()) break; - err_msg << "Could not read file." << endl; - throw boost::enable_current_exception(runtime_error(err_msg.str())); + err_msg << "Could not read file." << std::endl; + throw boost::enable_current_exception(std::runtime_error(err_msg.str())); } @@ -170,77 +170,77 @@ void CDnaProjectFile::LoadProjectFile() continue; // #variables - if (line.find(section_variables) != string::npos) + if (line.find(section_variables) != std::string::npos) { mSetting = switchSetting; continue; } // #general - if (line.find(section_general) != string::npos) + if (line.find(section_general) != std::string::npos) { mSetting = generalSetting; continue; } // #import - if (line.find(section_import) != string::npos) + if (line.find(section_import) != std::string::npos) { mSetting = importSetting; continue; } // #reftran - if (line.find(section_reftran) != string::npos) + if (line.find(section_reftran) != std::string::npos) { mSetting = reftranSetting; continue; } // #general - if (line.find(section_geoid) != string::npos) + if (line.find(section_geoid) != std::string::npos) { mSetting = geoidSetting; continue; } // #segment - if (line.find(section_segment) != string::npos) + if (line.find(section_segment) != std::string::npos) { mSetting = segmentSetting; continue; } // #adjust - if (line.find(section_adjust) != string::npos) + if (line.find(section_adjust) != std::string::npos) { mSetting = adjustSetting; continue; } // #output - if (line.find(section_output) != string::npos) + if (line.find(section_output) != std::string::npos) { mSetting = outputSetting; continue; } // #plot - if (line.find(section_plot) != string::npos) + if (line.find(section_plot) != std::string::npos) { mSetting = plotSetting; continue; } // #display - if (line.find(section_display) != string::npos) + if (line.find(section_display) != std::string::npos) { mSetting = displaySetting; continue; } // Line? - if (line.find("----------") != string::npos) + if (line.find("----------") != std::string::npos) continue; // Now get the variables and their value relating to the setting @@ -284,12 +284,12 @@ void CDnaProjectFile::LoadProjectFile() break; } } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { err_msg << e.what(); - throw boost::enable_current_exception(runtime_error(err_msg.str())); + throw boost::enable_current_exception(std::runtime_error(err_msg.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(err_msg.str())); + throw boost::enable_current_exception(std::runtime_error(err_msg.str())); } } @@ -301,9 +301,9 @@ void CDnaProjectFile::InitialiseGeneralSettings() { if (settings_.g.network_name.empty()) { - stringstream ss; - ss << "The project file does not provide the network name. " << endl << endl; - throw boost::enable_current_exception(runtime_error(ss.str())); + std::stringstream ss; + ss << "The project file does not provide the network name. " << std::endl << std::endl; + throw boost::enable_current_exception(std::runtime_error(ss.str())); } } @@ -314,33 +314,33 @@ void CDnaProjectFile::InitialiseImportSettings() if (settings_.i.input_files.empty() && settings_.i.seg_file.empty()) { - stringstream ss; - ss << "Nothing to do - the project file does not list any files to import. " << endl << endl; - throw boost::enable_current_exception(runtime_error(ss.str())); + std::stringstream ss; + ss << "Nothing to do - the project file does not list any files to import. " << std::endl << std::endl; + throw boost::enable_current_exception(std::runtime_error(ss.str())); } - string firstPart(settings_.g.output_folder + FOLDER_SLASH + settings_.g.network_name + "."); + std::string firstPart(settings_.g.output_folder + FOLDER_SLASH + settings_.g.network_name + "."); if (!settings_.i.bst_file.empty()) { - if (!exists(settings_.i.bst_file)) + if (!boost::filesystem::exists(settings_.i.bst_file)) // Does the file exist? No. // Assume it is a filename contained in the input folder. // import will throw an exception if it cannot be found. - settings_.i.bst_file = formPath(settings_.g.input_folder, - leafStr(settings_.i.bst_file)); + settings_.i.bst_file = formPath(settings_.g.input_folder, + leafStr(settings_.i.bst_file)); } else settings_.i.bst_file = firstPart + "bst"; // binary stations file if (!settings_.i.bms_file.empty()) { - if (!exists(settings_.i.bms_file)) + if (!boost::filesystem::exists(settings_.i.bms_file)) // Does the file exist? No. // Assume it is a filename contained in the input folder. // import will throw an exception if it cannot be found. - settings_.i.bms_file = formPath(settings_.g.input_folder, - leafStr(settings_.i.bms_file)); + settings_.i.bms_file = formPath(settings_.g.input_folder, + leafStr(settings_.i.bms_file)); } else settings_.i.bms_file = firstPart + "bms"; // binary measurements file @@ -357,12 +357,12 @@ void CDnaProjectFile::InitialiseImportSettings() if (!settings_.i.seg_file.empty()) { - if (!exists(settings_.i.seg_file)) + if (!boost::filesystem::exists(settings_.i.seg_file)) // Does the file exist? No. // Assume it is a filename contained in the input folder. // import will throw an exception if it cannot be found. - settings_.i.seg_file = formPath(settings_.g.input_folder, - leafStr(settings_.i.seg_file)); + settings_.i.seg_file = formPath(settings_.g.input_folder, + leafStr(settings_.i.seg_file)); } ////////////////////////////////////////////////////////////////////////////// @@ -376,19 +376,19 @@ void CDnaProjectFile::InitialiseImportSettings() if (!settings_.i.scalar_file.empty()) { - if (!exists(settings_.i.scalar_file)) + if (!boost::filesystem::exists(settings_.i.scalar_file)) // Does the file exist? No. // Assume it is a filename contained in the input folder. // import will throw an exception if it cannot be found. - settings_.i.scalar_file = formPath(settings_.g.input_folder, - leafStr(settings_.i.scalar_file)); + settings_.i.scalar_file = formPath(settings_.g.input_folder, + leafStr(settings_.i.scalar_file)); } // Create file name based on the provided block - string fileName(settings_.g.network_name); + std::string fileName(settings_.g.network_name); if (settings_.i.import_block) { - stringstream blk(""); + std::stringstream blk(""); blk << ".block-" << settings_.i.import_block_number; fileName += blk.str(); } @@ -396,27 +396,27 @@ void CDnaProjectFile::InitialiseImportSettings() if (settings_.i.export_dynaml) { if (settings_.i.export_single_xml_file) - settings_.i.xml_outfile = formPath(settings_.g.output_folder, + settings_.i.xml_outfile = formPath(settings_.g.output_folder, fileName, "xml"); else { - settings_.i.xml_stnfile = formPath(settings_.g.output_folder, + settings_.i.xml_stnfile = formPath(settings_.g.output_folder, fileName + "stn", "xml"); - settings_.i.xml_msrfile = formPath(settings_.g.output_folder, + settings_.i.xml_msrfile = formPath(settings_.g.output_folder, fileName + "msr", "xml"); } } if (settings_.i.export_dna_files) { - settings_.i.dna_stnfile = formPath(settings_.g.output_folder, + settings_.i.dna_stnfile = formPath(settings_.g.output_folder, fileName, "stn"); - settings_.i.dna_msrfile = formPath(settings_.g.output_folder, + settings_.i.dna_msrfile = formPath(settings_.g.output_folder, fileName, "msr"); } if (settings_.i.simulate_measurements) - settings_.i.simulate_msrfile = formPath(settings_.g.output_folder, + settings_.i.simulate_msrfile = formPath(settings_.g.output_folder, settings_.g.network_name, "simulated.msr"); } @@ -427,12 +427,12 @@ void CDnaProjectFile::InitialiseReftranSettings() if (settings_.r.reference_frame.empty()) { - stringstream ss; - ss << "Nothing to do - the project file does not specify a reference frame." << endl << endl; - throw boost::enable_current_exception(runtime_error(ss.str())); + std::stringstream ss; + ss << "Nothing to do - the project file does not specify a reference frame." << std::endl << std::endl; + throw boost::enable_current_exception(std::runtime_error(ss.str())); } - string firstPart(settings_.g.output_folder + FOLDER_SLASH + settings_.g.network_name + "."); + std::string firstPart(settings_.g.output_folder + FOLDER_SLASH + settings_.g.network_name + "."); settings_.r.bst_file = firstPart + "bst"; // binary stations file settings_.r.bms_file = firstPart + "bms"; // binary measurements file settings_.r.rft_file = firstPart + "rft"; // log @@ -443,9 +443,9 @@ void CDnaProjectFile::InitialiseReftranSettings() settings_.i.xml_outfile = firstPart + "xml"; // single XML file else { - settings_.i.xml_stnfile = formPath(settings_.g.output_folder, + settings_.i.xml_stnfile = formPath(settings_.g.output_folder, settings_.g.network_name + "stn", "xml"); - settings_.i.xml_msrfile = formPath(settings_.g.output_folder, + settings_.i.xml_msrfile = formPath(settings_.g.output_folder, settings_.g.network_name + "msr", "xml");; } } @@ -468,20 +468,20 @@ void CDnaProjectFile::InitialiseGeoidSettings() // Expected behaviour: when running geoid using a project file, network name must exist if (settings_.g.network_name.empty()) { - stringstream ss; - ss << "Nothing to do - the project file does not provide a network name. " << endl << endl; - throw boost::enable_current_exception(runtime_error(ss.str())); + std::stringstream ss; + ss << "Nothing to do - the project file does not provide a network name. " << std::endl << std::endl; + throw boost::enable_current_exception(std::runtime_error(ss.str())); } - settings_.n.bst_file = formPath(settings_.g.input_folder, settings_.g.network_name, "bst"); // binary stations file - settings_.n.geo_file = formPath(settings_.g.output_folder, settings_.g.network_name, "geo"); // dna geo file + settings_.n.bst_file = formPath(settings_.g.input_folder, settings_.g.network_name, "bst"); // binary stations file + settings_.n.geo_file = formPath(settings_.g.output_folder, settings_.g.network_name, "geo"); // dna geo file settings_.n.file_mode = 1; if (settings_.n.ntv2_geoid_file.empty()) { - stringstream ss; - ss << "Nothing to do - the project file does not provide an NTv2 grid file path. " << endl << endl; - throw boost::enable_current_exception(runtime_error(ss.str())); + std::stringstream ss; + ss << "Nothing to do - the project file does not provide an NTv2 grid file path. " << std::endl << std::endl; + throw boost::enable_current_exception(std::runtime_error(ss.str())); } } @@ -489,7 +489,7 @@ void CDnaProjectFile::InitialiseSegmentSettings() { InitialiseGeneralSettings(); - string firstPart(settings_.g.output_folder + FOLDER_SLASH + settings_.g.network_name + "."); + std::string firstPart(settings_.g.output_folder + FOLDER_SLASH + settings_.g.network_name + "."); settings_.s.bst_file = firstPart + "bst"; // binary stations file settings_.s.bms_file = firstPart + "bms"; // binary measurements file settings_.s.asl_file = firstPart + "asl"; // associated stations list @@ -503,19 +503,19 @@ void CDnaProjectFile::InitialiseAdjustSettings() { InitialiseGeneralSettings(); - string firstPart(settings_.g.output_folder + FOLDER_SLASH + settings_.g.network_name + "."); + std::string firstPart(settings_.g.output_folder + FOLDER_SLASH + settings_.g.network_name + "."); settings_.a.bst_file = firstPart + "bst"; // binary stations file settings_.a.bms_file = firstPart + "bms"; // binary measurements file - if (!exists(settings_.a.bst_file) || !exists(settings_.a.bms_file)) + if (!boost::filesystem::exists(settings_.a.bst_file) || !boost::filesystem::exists(settings_.a.bms_file)) { - stringstream ss; + std::stringstream ss; ss << "- Nothing to do: "; if (settings_.g.network_name.empty()) - ss << endl << "network name has not been specified specified, and " << endl << " "; - ss << settings_.a.bst_file << " and " << settings_.a.bms_file << " do not exist." << endl << endl; - throw boost::enable_current_exception(runtime_error(ss.str())); + ss << std::endl << "network name has not been specified specified, and " << std::endl << " "; + ss << settings_.a.bst_file << " and " << settings_.a.bms_file << " do not exist." << std::endl << std::endl; + throw boost::enable_current_exception(std::runtime_error(ss.str())); } // Station appearance file @@ -527,7 +527,7 @@ void CDnaProjectFile::InitialiseAdjustSettings() // Set up file names dependent on adjustment mode settings_.o._xyz_file = settings_.o._adj_file = - formPath(settings_.g.output_folder, settings_.g.network_name); + formPath(settings_.g.output_folder, settings_.g.network_name); if (settings_.o._positional_uncertainty) settings_.o._apu_file = settings_.o._adj_file; @@ -619,34 +619,34 @@ void CDnaProjectFile::InitialiseAdjustSettings() } -void CDnaProjectFile::LoadSettingGeneral(const settingMode mSetting, const string& var, string& val) +void CDnaProjectFile::LoadSettingGeneral(const settingMode mSetting, const std::string& var, std::string& val) { // general settings - if (iequals(var, QUIET)) + if (boost::iequals(var, QUIET)) { if (val.empty()) return; - settings_.g.quiet = yesno_uint(val); + settings_.g.quiet = yesno_uint(val); } - else if (iequals(var, VERBOSE)) + else if (boost::iequals(var, VERBOSE)) { if (val.empty()) return; - settings_.g.verbose = lexical_cast(val); + settings_.g.verbose = boost::lexical_cast(val); } - else if (iequals(var, PROJECT_FILE)) + else if (boost::iequals(var, PROJECT_FILE)) { if (val.empty()) return; settings_.g.project_file = val; } - else if (iequals(var, DYNADJUST_LOG_FILE)) + else if (boost::iequals(var, DYNADJUST_LOG_FILE)) { if (val.empty()) return; settings_.g.log_file = val; } - else if (iequals(var, NETWORK_NAME)) + else if (boost::iequals(var, NETWORK_NAME)) { if (val.empty()) return; @@ -660,7 +660,7 @@ void CDnaProjectFile::LoadSettingGeneral(const settingMode mSetting, const strin if (t.second.substr(0,2) == "${" && t.second.at(3) == '}') { settings_.g.variables.push_back(t); - sort(settings_.g.variables.begin(), settings_.g.variables.end(), PairCompareFirst()); + std::sort(settings_.g.variables.begin(), settings_.g.variables.end(), PairCompareFirst()); } break; case generalSetting: @@ -670,13 +670,13 @@ void CDnaProjectFile::LoadSettingGeneral(const settingMode mSetting, const strin break; } } - else if (iequals(var, INPUT_FOLDER)) + else if (boost::iequals(var, INPUT_FOLDER)) { if (val.empty()) return; settings_.g.input_folder = val; } - else if (iequals(var, OUTPUT_FOLDER)) + else if (boost::iequals(var, OUTPUT_FOLDER)) { if (val.empty()) return; @@ -685,35 +685,41 @@ void CDnaProjectFile::LoadSettingGeneral(const settingMode mSetting, const strin } -void CDnaProjectFile::LoadSettingImport(const settingMode mSetting, const string& var, string& val) +void CDnaProjectFile::LoadSettingImport(const settingMode mSetting, const std::string& var, std::string& val) { // Import settings - if (iequals(var, IMPORT_FILE)) + if (boost::iequals(var, IMPORT_FILE)) { if (val.empty()) return; - settings_.i.input_files.push_back(formPath(settings_.g.input_folder, val)); + settings_.i.input_files.push_back(formPath(settings_.g.input_folder, val)); } - else if (iequals(var, REFERENCE_FRAME)) + else if (boost::iequals(var, REFERENCE_FRAME)) { if (val.empty()) return; settings_.i.reference_frame = val; } - else if (iequals(var, OVERRIDE_INPUT_FRAME)) + else if (boost::iequals(var, EPOCH)) { if (val.empty()) return; - settings_.i.override_input_rfame = yesno_uint(val);; + settings_.i.epoch = val; } - else if (iequals(var, IMPORT_GEO_FILE)) + else if (boost::iequals(var, OVERRIDE_INPUT_FRAME)) { if (val.empty()) return; - settings_.i.geo_file = formPath(settings_.g.input_folder, val); + settings_.i.override_input_rfame = yesno_uint(val);; + } + else if (boost::iequals(var, IMPORT_GEO_FILE)) + { + if (val.empty()) + return; + settings_.i.geo_file = formPath(settings_.g.input_folder, val); settings_.i.import_geo_file = 1; } - else if (iequals(var, BIN_STN_FILE)) + else if (boost::iequals(var, BIN_STN_FILE)) { string_string_pair t; switch (mSetting) @@ -727,22 +733,22 @@ void CDnaProjectFile::LoadSettingImport(const settingMode mSetting, const string if (t.second.substr(0,2) == "${" && t.second.at(3) == '}') { settings_.g.variables.push_back(t); - sort(settings_.g.variables.begin(), settings_.g.variables.end(), PairCompareFirst()); + std::sort(settings_.g.variables.begin(), settings_.g.variables.end(), PairCompareFirst()); } break; case importSetting: if (val.empty()) // default export bst file - create in output folder - settings_.i.bst_file = formPath(settings_.g.output_folder, settings_.g.network_name, "bst"); // binary stations file + settings_.i.bst_file = formPath(settings_.g.output_folder, settings_.g.network_name, "bst"); // binary stations file else // user specified bst file - look in input folder - settings_.i.bst_file = formPath(settings_.g.input_folder, val); + settings_.i.bst_file = formPath(settings_.g.input_folder, val); break; default: break; } } - else if (iequals(var, BIN_MSR_FILE)) + else if (boost::iequals(var, BIN_MSR_FILE)) { string_string_pair t; switch (mSetting) @@ -756,20 +762,20 @@ void CDnaProjectFile::LoadSettingImport(const settingMode mSetting, const string if (t.second.substr(0,2) == "${" && t.second.at(3) == '}') { settings_.g.variables.push_back(t); - sort(settings_.g.variables.begin(), settings_.g.variables.end(), PairCompareFirst()); + std::sort(settings_.g.variables.begin(), settings_.g.variables.end(), PairCompareFirst()); } break; case importSetting: if (val.empty()) - settings_.i.bms_file = formPath(settings_.g.output_folder, settings_.g.network_name, "bms"); // binary stations file + settings_.i.bms_file = formPath(settings_.g.output_folder, settings_.g.network_name, "bms"); // binary stations file else - settings_.i.bms_file = formPath(settings_.g.input_folder, val); + settings_.i.bms_file = formPath(settings_.g.input_folder, val); break; default: break; } } - else if (iequals(var, MAP_FILE)) + else if (boost::iequals(var, MAP_FILE)) { if (val.empty()) return; @@ -783,17 +789,17 @@ void CDnaProjectFile::LoadSettingImport(const settingMode mSetting, const string if (t.second.substr(0,2) == "${" && t.second.at(3) == '}') { settings_.g.variables.push_back(t); - sort(settings_.g.variables.begin(), settings_.g.variables.end(), PairCompareFirst()); + std::sort(settings_.g.variables.begin(), settings_.g.variables.end(), PairCompareFirst()); } break; case importSetting: - settings_.i.map_file = formPath(settings_.g.output_folder, val); + settings_.i.map_file = formPath(settings_.g.output_folder, val); break; default: break; } } - else if (iequals(var, ASL_FILE)) + else if (boost::iequals(var, ASL_FILE)) { if (val.empty()) return; @@ -807,17 +813,17 @@ void CDnaProjectFile::LoadSettingImport(const settingMode mSetting, const string if (t.second.substr(0,2) == "${" && t.second.at(3) == '}') { settings_.g.variables.push_back(t); - sort(settings_.g.variables.begin(), settings_.g.variables.end(), PairCompareFirst()); + std::sort(settings_.g.variables.begin(), settings_.g.variables.end(), PairCompareFirst()); } break; case importSetting: - settings_.i.asl_file = formPath(settings_.g.output_folder, val); + settings_.i.asl_file = formPath(settings_.g.output_folder, val); break; default: break; } } - else if (iequals(var, AML_FILE)) + else if (boost::iequals(var, AML_FILE)) { if (val.empty()) return; @@ -831,468 +837,474 @@ void CDnaProjectFile::LoadSettingImport(const settingMode mSetting, const string if (t.second.substr(0,2) == "${" && t.second.at(3) == '}') { settings_.g.variables.push_back(t); - sort(settings_.g.variables.begin(), settings_.g.variables.end(), PairCompareFirst()); + std::sort(settings_.g.variables.begin(), settings_.g.variables.end(), PairCompareFirst()); } break; case importSetting: - settings_.i.aml_file = formPath(settings_.g.output_folder, val); + settings_.i.aml_file = formPath(settings_.g.output_folder, val); break; default: break; } } - else if (iequals(var, DST_FILE)) + else if (boost::iequals(var, DST_FILE)) { if (val.empty()) return; - settings_.i.dst_file = formPath(settings_.g.output_folder, val); + settings_.i.dst_file = formPath(settings_.g.output_folder, val); } - else if (iequals(var, DMS_FILE)) + else if (boost::iequals(var, DMS_FILE)) { if (val.empty()) return; - settings_.i.dms_file = formPath(settings_.g.output_folder, val); + settings_.i.dms_file = formPath(settings_.g.output_folder, val); } - else if (iequals(var, BOUNDING_BOX)) + else if (boost::iequals(var, BOUNDING_BOX)) { if (val.empty()) return; settings_.i.bounding_box = val; } - else if (iequals(var, GET_MSRS_TRANSCENDING_BOX)) + else if (boost::iequals(var, GET_MSRS_TRANSCENDING_BOX)) { if (val.empty()) return; - settings_.i.include_transcending_msrs = yesno_uint(val); + settings_.i.include_transcending_msrs = yesno_uint(val); } - else if (iequals(var, INCLUDE_STN_ASSOC_MSRS)) + else if (boost::iequals(var, INCLUDE_STN_ASSOC_MSRS)) { if (val.empty()) return; - settings_.i.stn_associated_msr_include = valorno_string(val); + settings_.i.stn_associated_msr_include = valorno_string(val); } - else if (iequals(var, EXCLUDE_STN_ASSOC_MSRS)) + else if (boost::iequals(var, EXCLUDE_STN_ASSOC_MSRS)) { if (val.empty()) return; - settings_.i.stn_associated_msr_exclude = valorno_string(val); + settings_.i.stn_associated_msr_exclude = valorno_string(val); } - else if (iequals(var, SPLIT_CLUSTERS)) + else if (boost::iequals(var, SPLIT_CLUSTERS)) { if (val.empty()) return; - settings_.i.split_clusters = yesno_uint(val); + settings_.i.split_clusters = yesno_uint(val); } - else if (iequals(var, IMPORT_SEG_BLOCK)) + else if (boost::iequals(var, IMPORT_SEG_BLOCK)) { if (val.empty()) return; - settings_.i.import_block_number = valorno_uint(val, settings_.i.import_block); + settings_.i.import_block_number = valorno_uint(val, settings_.i.import_block); } - else if (iequals(var, SEG_FILE)) + else if (boost::iequals(var, SEG_FILE)) { if (val.empty()) return; - settings_.i.seg_file = formPath(settings_.g.input_folder, val); + settings_.i.seg_file = formPath(settings_.g.input_folder, val); } - else if (iequals(var, PREFER_X_MSR_AS_G)) + else if (boost::iequals(var, PREFER_X_MSR_AS_G)) { if (val.empty()) return; - settings_.i.prefer_single_x_as_g = yesno_uint(val); + settings_.i.prefer_single_x_as_g = yesno_uint(val); } - else if (iequals(var, INCLUDE_MSRS)) + else if (boost::iequals(var, INCLUDE_MSRS)) { if (val.empty()) return; settings_.i.include_msrs = val; } - else if (iequals(var, EXCLUDE_MSRS)) + else if (boost::iequals(var, EXCLUDE_MSRS)) { if (val.empty()) return; settings_.i.exclude_msrs = val; } - else if (iequals(var, STATION_RENAMING_FILE)) + else if (boost::iequals(var, STATION_RENAMING_FILE)) { if (val.empty()) return; - settings_.i.stn_renamingfile = formPath(settings_.g.input_folder, val); + settings_.i.stn_renamingfile = formPath(settings_.g.input_folder, val); } - else if (iequals(var, STATION_DISCONTINUITY_FILE)) + else if (boost::iequals(var, STATION_DISCONTINUITY_FILE)) { if (val.empty()) return; - settings_.i.stn_discontinuityfile = formPath(settings_.g.input_folder, val); + settings_.i.stn_discontinuityfile = formPath(settings_.g.input_folder, val); settings_.i.apply_discontinuities = true; } - else if (iequals(var, TEST_NEARBY_STNS)) + else if (boost::iequals(var, TEST_NEARBY_STNS)) { if (val.empty()) return; - settings_.i.search_nearby_stn = yesno_uint(val); + settings_.i.search_nearby_stn = yesno_uint(val); } - else if (iequals(var, TEST_NEARBY_STN_DIST)) + else if (boost::iequals(var, TEST_NEARBY_STN_DIST)) { if (val.empty()) return; settings_.i.search_stn_radius = DoubleFromString(val); } - else if (iequals(var, TEST_SIMILAR_MSRS)) + else if (boost::iequals(var, TEST_SIMILAR_MSRS)) { if (val.empty()) return; - settings_.i.search_similar_msr = yesno_uint(val); + settings_.i.search_similar_msr = yesno_uint(val); } - else if (iequals(var, TEST_SIMILAR_GNSS_MSRS)) + else if (boost::iequals(var, TEST_SIMILAR_GNSS_MSRS)) { if (val.empty()) return; - settings_.i.search_similar_msr_gx = yesno_uint(val); + settings_.i.search_similar_msr_gx = yesno_uint(val); } - else if (iequals(var, IGNORE_SIMILAR_MSRS)) + else if (boost::iequals(var, IGNORE_INSUFFICIENT_MSRS)) + { + if (val.empty()) + return; + settings_.i.ignore_insufficient_msrs = yesno_uint(val); + } + else if (boost::iequals(var, IGNORE_SIMILAR_MSRS)) { if (val.empty()) return; - settings_.i.ignore_similar_msr = yesno_uint(val); + settings_.i.ignore_similar_msr = yesno_uint(val); } - else if (iequals(var, REMOVE_IGNORED_MSRS)) + else if (boost::iequals(var, REMOVE_IGNORED_MSRS)) { if (val.empty()) return; - settings_.i.remove_ignored_msr = yesno_uint(val); + settings_.i.remove_ignored_msr = yesno_uint(val); } - else if (iequals(var, FLAG_UNUSED_STNS)) + else if (boost::iequals(var, FLAG_UNUSED_STNS)) { if (val.empty()) return; - settings_.i.flag_unused_stn = yesno_uint(val); + settings_.i.flag_unused_stn = yesno_uint(val); } - else if (iequals(var, TEST_INTEGRITY)) + else if (boost::iequals(var, TEST_INTEGRITY)) { if (val.empty()) return; - settings_.i.test_integrity = yesno_uint(val); + settings_.i.test_integrity = yesno_uint(val); } - else if (iequals(var, VSCALE)) + else if (boost::iequals(var, VSCALE)) { if (val.empty()) return; settings_.i.vscale = DoubleFromString(val); } - else if (iequals(var, PSCALE)) + else if (boost::iequals(var, PSCALE)) { if (val.empty()) return; settings_.i.pscale = DoubleFromString(val); } - else if (iequals(var, LSCALE)) + else if (boost::iequals(var, LSCALE)) { if (val.empty()) return; settings_.i.lscale = DoubleFromString(val); } - else if (iequals(var, HSCALE)) + else if (boost::iequals(var, HSCALE)) { if (val.empty()) return; settings_.i.hscale = DoubleFromString(val); } - else if (iequals(var, SCALAR_FILE)) + else if (boost::iequals(var, SCALAR_FILE)) { if (val.empty()) return; - settings_.i.scalar_file = formPath(settings_.g.input_folder, val); + settings_.i.scalar_file = formPath(settings_.g.input_folder, val); } - else if (iequals(var, EXPORT_XML_FILES)) + else if (boost::iequals(var, EXPORT_XML_FILES)) { if (val.empty()) return; - settings_.i.export_dynaml = yesno_uint(val); + settings_.i.export_dynaml = yesno_uint(val); } - else if (iequals(var, EXPORT_SINGLE_XML_FILE)) + else if (boost::iequals(var, EXPORT_SINGLE_XML_FILE)) { if (val.empty()) return; - settings_.i.export_single_xml_file = yesno_uint(val); + settings_.i.export_single_xml_file = yesno_uint(val); } - else if (iequals(var, EXPORT_FROM_BINARY)) + else if (boost::iequals(var, EXPORT_FROM_BINARY)) { if (val.empty()) return; - settings_.i.export_from_bfiles = yesno_uint(val); + settings_.i.export_from_bfiles = yesno_uint(val); } - else if (iequals(var, EXPORT_DNA_FILES)) + else if (boost::iequals(var, EXPORT_DNA_FILES)) { if (val.empty()) return; - settings_.i.export_dna_files = yesno_uint(val); + settings_.i.export_dna_files = yesno_uint(val); } - else if (iequals(var, EXPORT_ASL_FILE)) + else if (boost::iequals(var, EXPORT_ASL_FILE)) { if (val.empty()) return; - settings_.i.export_asl_file = yesno_uint(val); + settings_.i.export_asl_file = yesno_uint(val); } - else if (iequals(var, EXPORT_AML_FILE)) + else if (boost::iequals(var, EXPORT_AML_FILE)) { if (val.empty()) return; - settings_.i.export_aml_file = yesno_uint(val); + settings_.i.export_aml_file = yesno_uint(val); } - else if (iequals(var, EXPORT_MAP_FILE)) + else if (boost::iequals(var, EXPORT_MAP_FILE)) { if (val.empty()) return; - settings_.i.export_map_file = yesno_uint(val); + settings_.i.export_map_file = yesno_uint(val); } - else if (iequals(var, SIMULATE_MSR_FILE)) + else if (boost::iequals(var, SIMULATE_MSR_FILE)) { if (val.empty()) return; - settings_.i.simulate_measurements = yesno_uint(val); + settings_.i.simulate_measurements = yesno_uint(val); } - //else if (iequals(var, VERIFY_COORDS)) + //else if (boost::iequals(var, VERIFY_COORDS)) //{ // if (val.empty()) // return; - // settings_.i.verify_coordinates = lexical_cast(val); + // settings_.i.verify_coordinates = boost::lexical_cast(val); //} } -void CDnaProjectFile::LoadSettingReftran(const string& var, string& val) +void CDnaProjectFile::LoadSettingReftran(const std::string& var, std::string& val) { - if (iequals(var, REFERENCE_FRAME)) + if (boost::iequals(var, REFERENCE_FRAME)) { if (val.empty()) return; settings_.r.reference_frame = val; } - else if (iequals(var, EPOCH)) + else if (boost::iequals(var, EPOCH)) { if (val.empty()) return; settings_.r.epoch = val; } - else if (iequals(var, TECTONIC_PLATE_MODEL_OPTION)) + else if (boost::iequals(var, TECTONIC_PLATE_MODEL_OPTION)) { if (val.empty()) return; - settings_.r.plate_model_option = lexical_cast(val); + settings_.r.plate_model_option = boost::lexical_cast(val); } - else if (iequals(var, TECTONIC_PLATE_BDY_FILE)) + else if (boost::iequals(var, TECTONIC_PLATE_BDY_FILE)) { if (val.empty()) return; settings_.r.tpb_file = val; - if (!exists(val)) - if (exists(formPath(settings_.g.input_folder, val))) - settings_.r.tpb_file = formPath(settings_.g.input_folder, val); + if (!boost::filesystem::exists(val)) + if (boost::filesystem::exists(formPath(settings_.g.input_folder, val))) + settings_.r.tpb_file = formPath(settings_.g.input_folder, val); } - else if (iequals(var, TECTONIC_PLATE_POLE_FILE)) + else if (boost::iequals(var, TECTONIC_PLATE_POLE_FILE)) { if (val.empty()) return; settings_.r.tpp_file = val; - if (!exists(val)) - if (exists(formPath(settings_.g.input_folder, val))) - settings_.r.tpp_file = formPath(settings_.g.input_folder, val); + if (!boost::filesystem::exists(val)) + if (boost::filesystem::exists(formPath(settings_.g.input_folder, val))) + settings_.r.tpp_file = formPath(settings_.g.input_folder, val); } } -void CDnaProjectFile::LoadSettingGeoid(const string& var, string& val) +void CDnaProjectFile::LoadSettingGeoid(const std::string& var, std::string& val) { - if (iequals(var, DAT_FILEPATH)) + if (boost::iequals(var, DAT_FILEPATH)) { if (val.empty()) return; - settings_.n.rdat_geoid_file = formPath(settings_.g.input_folder, val); + settings_.n.rdat_geoid_file = formPath(settings_.g.input_folder, val); } - else if (iequals(var, NTV2_FILEPATH)) + else if (boost::iequals(var, NTV2_FILEPATH)) { if (val.empty()) return; settings_.n.ntv2_geoid_file = val; - if (!exists(val)) - if (exists(formPath(settings_.g.input_folder, val))) - settings_.n.ntv2_geoid_file = formPath(settings_.g.input_folder, val); + if (!boost::filesystem::exists(val)) + if (boost::filesystem::exists(formPath(settings_.g.input_folder, val))) + settings_.n.ntv2_geoid_file = formPath(settings_.g.input_folder, val); } - else if (iequals(var, INPUT_FILE)) + else if (boost::iequals(var, INPUT_FILE)) { if (val.empty()) return; - settings_.n.input_file = formPath(settings_.g.input_folder, val); + settings_.n.input_file = formPath(settings_.g.input_folder, val); } - //else if (iequals(var, BIN_STN_FILE)) + //else if (boost::iequals(var, BIN_STN_FILE)) //{ // if (val.empty()) // return; - // settings_.n.bst_file = formPath(settings_.g.input_folder, val); + // settings_.n.bst_file = formPath(settings_.g.input_folder, val); //} - else if (iequals(var, METHOD)) + else if (boost::iequals(var, METHOD)) { if (val.empty()) return; - settings_.n.interpolation_method = lexical_cast(val); + settings_.n.interpolation_method = boost::lexical_cast(val); } - else if (iequals(var, DDEG_FORMAT)) + else if (boost::iequals(var, DDEG_FORMAT)) { if (val.empty()) return; - settings_.n.coordinate_format = lexical_cast(val); + settings_.n.coordinate_format = boost::lexical_cast(val); } - else if (iequals(var, DIRECTION)) + else if (boost::iequals(var, DIRECTION)) { if (val.empty()) return; - settings_.n.ellipsoid_to_ortho = lexical_cast(val); + settings_.n.ellipsoid_to_ortho = boost::lexical_cast(val); } - else if (iequals(var, CONVERT_BST_HT)) + else if (boost::iequals(var, CONVERT_BST_HT)) { if (val.empty()) return; - settings_.n.convert_heights = yesno_uint(val); + settings_.n.convert_heights = yesno_uint(val); } - else if (iequals(var, EXPORT_GEO_FILE)) + else if (boost::iequals(var, EXPORT_GEO_FILE)) { if (val.empty()) return; - settings_.n.export_dna_geo_file = yesno_uint(val); + settings_.n.export_dna_geo_file = yesno_uint(val); } } -void CDnaProjectFile::LoadSettingSegment(const string& var, string& val) +void CDnaProjectFile::LoadSettingSegment(const std::string& var, std::string& val) { - if (iequals(var, NET_FILE)) + if (boost::iequals(var, NET_FILE)) { if (val.empty()) return; - settings_.s.net_file = formPath(settings_.g.input_folder, val); + settings_.s.net_file = formPath(settings_.g.input_folder, val); } - else if (iequals(var, SEG_FILE)) + else if (boost::iequals(var, SEG_FILE)) { if (val.empty()) return; settings_.s.seg_file = val; - if (!exists(val)) - if (exists(formPath(settings_.g.input_folder, val))) - settings_.s.seg_file = formPath(settings_.g.input_folder, val); + if (!boost::filesystem::exists(val)) + if (boost::filesystem::exists(formPath(settings_.g.input_folder, val))) + settings_.s.seg_file = formPath(settings_.g.input_folder, val); } - else if (iequals(var, BIN_STN_FILE)) + else if (boost::iequals(var, BIN_STN_FILE)) { if (val.empty()) return; settings_.s.bst_file = val; - if (!exists(val)) - if (exists(formPath(settings_.g.input_folder, val))) - settings_.s.bst_file = formPath(settings_.g.input_folder, val); + if (!boost::filesystem::exists(val)) + if (boost::filesystem::exists(formPath(settings_.g.input_folder, val))) + settings_.s.bst_file = formPath(settings_.g.input_folder, val); } - else if (iequals(var, BIN_MSR_FILE)) + else if (boost::iequals(var, BIN_MSR_FILE)) { if (val.empty()) return; settings_.s.bms_file = val; - if (!exists(val)) - if (exists(formPath(settings_.g.input_folder, val))) - settings_.s.bms_file = formPath(settings_.g.input_folder, val); + if (!boost::filesystem::exists(val)) + if (boost::filesystem::exists(formPath(settings_.g.input_folder, val))) + settings_.s.bms_file = formPath(settings_.g.input_folder, val); } - else if (iequals(var, SEG_MIN_INNER_STNS)) + else if (boost::iequals(var, SEG_MIN_INNER_STNS)) { if (val.empty()) return; - settings_.s.min_inner_stations = lexical_cast(val); + settings_.s.min_inner_stations = boost::lexical_cast(val); } - else if (iequals(var, SEG_THRESHOLD_STNS)) + else if (boost::iequals(var, SEG_THRESHOLD_STNS)) { if (val.empty()) return; - settings_.s.max_total_stations = lexical_cast(val); + settings_.s.max_total_stations = boost::lexical_cast(val); } - else if (iequals(var, SEG_FORCE_CONTIGUOUS)) + else if (boost::iequals(var, SEG_FORCE_CONTIGUOUS)) { if (val.empty()) return; - settings_.s.force_contiguous_blocks = yesno_uint(val); + settings_.s.force_contiguous_blocks = yesno_uint(val); } - else if (iequals(var, SEG_STARTING_STN)) + else if (boost::iequals(var, SEG_STARTING_STN)) { if (val.empty()) return; settings_.s.seg_starting_stns = val; } - else if (iequals(var, SEG_SEARCH_LEVEL)) + else if (boost::iequals(var, SEG_SEARCH_LEVEL)) { if (val.empty()) return; - settings_.s.seg_search_level = lexical_cast(val); + settings_.s.seg_search_level = boost::lexical_cast(val); } } -void CDnaProjectFile::LoadSettingAdjust(const string& var, string& val) +void CDnaProjectFile::LoadSettingAdjust(const std::string& var, std::string& val) { - if (iequals(var, BIN_STN_FILE)) + if (boost::iequals(var, BIN_STN_FILE)) { if (val.empty()) return; settings_.a.bst_file = val; - if (!exists(val)) - if (exists(formPath(settings_.g.input_folder, val))) - settings_.a.bst_file = formPath(settings_.g.input_folder, val); + if (!boost::filesystem::exists(val)) + if (boost::filesystem::exists(formPath(settings_.g.input_folder, val))) + settings_.a.bst_file = formPath(settings_.g.input_folder, val); } - else if (iequals(var, BIN_MSR_FILE)) + else if (boost::iequals(var, BIN_MSR_FILE)) { if (val.empty()) return; settings_.a.bms_file = val; - if (!exists(val)) - if (exists(formPath(settings_.g.input_folder, val))) - settings_.a.bms_file = formPath(settings_.g.input_folder, val); + if (!boost::filesystem::exists(val)) + if (boost::filesystem::exists(formPath(settings_.g.input_folder, val))) + settings_.a.bms_file = formPath(settings_.g.input_folder, val); } - else if (iequals(var, SEG_FILE)) + else if (boost::iequals(var, SEG_FILE)) { if (val.empty()) return; settings_.a.seg_file = val; - if (!exists(val)) - if (exists(formPath(settings_.g.input_folder, val))) - settings_.a.seg_file = formPath(settings_.g.input_folder, val); + if (!boost::filesystem::exists(val)) + if (boost::filesystem::exists(formPath(settings_.g.input_folder, val))) + settings_.a.seg_file = formPath(settings_.g.input_folder, val); } - else if (iequals(var, COMMENTS)) + else if (boost::iequals(var, COMMENTS)) { if (val.empty()) return; settings_.a.comments = val; } - if (iequals(var, ADJUSTMENT_MODE)) + if (boost::iequals(var, ADJUSTMENT_MODE)) { if (val.empty()) return; - if (iequals(val, MODE_SIMULTANEOUS)) + if (boost::iequals(val, MODE_SIMULTANEOUS)) { settings_.a.adjust_mode = SimultaneousMode; settings_.a.multi_thread = false; settings_.a.stage = false; } - else if (iequals(val, MODE_PHASED)) + else if (boost::iequals(val, MODE_PHASED)) { settings_.a.adjust_mode = PhasedMode; } - else if (iequals(val, MODE_PHASED_BLOCK1)) + else if (boost::iequals(val, MODE_PHASED_BLOCK1)) { settings_.a.adjust_mode = Phased_Block_1Mode; settings_.a.multi_thread = false; } - else if (iequals(val, MODE_SIMULATION)) + else if (boost::iequals(val, MODE_SIMULATION)) { settings_.a.adjust_mode = SimulationMode; settings_.a.multi_thread = false; @@ -1300,321 +1312,323 @@ void CDnaProjectFile::LoadSettingAdjust(const string& var, string& val) } } - else if (iequals(var, MODE_PHASED_MT)) + else if (boost::iequals(var, MODE_PHASED_MT)) { if (val.empty()) return; - settings_.a.multi_thread = yesno_uint(val); + settings_.a.multi_thread = yesno_uint(val); } - else if (iequals(var, STAGED_ADJUSTMENT)) + else if (boost::iequals(var, STAGED_ADJUSTMENT)) { if (val.empty()) return; - settings_.a.stage = yesno_uint(val); + settings_.a.stage = yesno_uint(val); } - else if (iequals(var, CONF_INTERVAL)) + else if (boost::iequals(var, CONF_INTERVAL)) { if (val.empty()) return; settings_.a.confidence_interval = FloatFromString(val); } - else if (iequals(var, ITERATION_THRESHOLD)) + else if (boost::iequals(var, ITERATION_THRESHOLD)) { if (val.empty()) return; settings_.a.iteration_threshold = FloatFromString(val); } - else if (iequals(var, MAX_ITERATIONS)) + else if (boost::iequals(var, MAX_ITERATIONS)) { if (val.empty()) return; - settings_.a.max_iterations = lexical_cast(val); + settings_.a.max_iterations = boost::lexical_cast(val); } - else if (iequals(var, STN_CONSTRAINTS)) + else if (boost::iequals(var, STN_CONSTRAINTS)) { if (val.empty()) return; settings_.a.station_constraints = val; } - else if (iequals(var, FREE_STN_SD)) + else if (boost::iequals(var, FREE_STN_SD)) { if (val.empty()) return; settings_.a.free_std_dev = DoubleFromString(val); } - else if (iequals(var, FIXED_STN_SD)) + else if (boost::iequals(var, FIXED_STN_SD)) { if (val.empty()) return; settings_.a.fixed_std_dev = DoubleFromString(val); } - //else if (iequals(var, LSQ_INVERSE_METHOD)) + //else if (boost::iequals(var, LSQ_INVERSE_METHOD)) //{ // if (val.empty()) // return; - // settings_.a.inverse_method_lsq = lexical_cast(val); + // settings_.a.inverse_method_lsq = boost::lexical_cast(val); //} - else if (iequals(var, SCALE_NORMAL_UNITY)) + else if (boost::iequals(var, SCALE_NORMAL_UNITY)) { if (val.empty()) return; - settings_.a.scale_normals_to_unity = yesno_uint(val); + settings_.a.scale_normals_to_unity = yesno_uint(val); } - else if (iequals(var, RECREATE_STAGE_FILES)) + else if (boost::iequals(var, RECREATE_STAGE_FILES)) { if (val.empty()) return; - settings_.a.recreate_stage_files = yesno_uint(val); + settings_.a.recreate_stage_files = yesno_uint(val); } - else if (iequals(var, PURGE_STAGE_FILES)) + else if (boost::iequals(var, PURGE_STAGE_FILES)) { if (val.empty()) return; - settings_.a.purge_stage_files = yesno_uint(val) == 1; + settings_.a.purge_stage_files = yesno_uint(val) == 1; } - else if (iequals(var, TYPE_B_GLOBAL)) + else if (boost::iequals(var, TYPE_B_GLOBAL)) { if (val.empty()) return; settings_.a.type_b_global = val; } - else if (iequals(var, TYPE_B_FILE)) + else if (boost::iequals(var, TYPE_B_FILE)) { if (val.empty()) return; settings_.a.type_b_file = val; - if (!exists(val)) - if (exists(formPath(settings_.g.input_folder, val))) - settings_.a.type_b_file = formPath(settings_.g.input_folder, val); + if (!boost::filesystem::exists(val)) + if (boost::filesystem::exists(formPath(settings_.g.input_folder, val))) + settings_.a.type_b_file = formPath(settings_.g.input_folder, val); } } -void CDnaProjectFile::LoadSettingOutput(const string& var, string& val) +void CDnaProjectFile::LoadSettingOutput(const std::string& var, std::string& val) { - if (iequals(var, OUTPUT_MSR_TO_STN)) + if (boost::iequals(var, OUTPUT_MSR_TO_STN)) { if (val.empty()) return; - settings_.o._msr_to_stn = yesno_uint(val); + settings_.o._msr_to_stn = yesno_uint(val); } - else if (iequals(var, OUTPUT_MSR_TO_STN_SORTBY)) + else if (boost::iequals(var, OUTPUT_MSR_TO_STN_SORTBY)) { if (val.empty()) return; - settings_.o._sort_msr_to_stn = lexical_cast(val); + settings_.o._sort_msr_to_stn = boost::lexical_cast(val); } - else if (iequals(var, OUTPUT_ADJ_STN_ITER)) + else if (boost::iequals(var, OUTPUT_ADJ_STN_ITER)) { if (val.empty()) return; - settings_.o._adj_stn_iteration = yesno_uint(val); + settings_.o._adj_stn_iteration = yesno_uint(val); } - else if (iequals(var, OUTPUT_ADJ_STAT_ITER)) + else if (boost::iequals(var, OUTPUT_ADJ_STAT_ITER)) { if (val.empty()) return; - settings_.o._adj_stat_iteration = yesno_uint(val); + settings_.o._adj_stat_iteration = yesno_uint(val); } - else if (iequals(var, OUTPUT_ADJ_MSR_ITER)) + else if (boost::iequals(var, OUTPUT_ADJ_MSR_ITER)) { if (val.empty()) return; - settings_.o._adj_msr_iteration = yesno_uint(val); + settings_.o._adj_msr_iteration = yesno_uint(val); } - else if (iequals(var, OUTPUT_CMP_MSR_ITER)) + else if (boost::iequals(var, OUTPUT_CMP_MSR_ITER)) { if (val.empty()) return; - settings_.o._cmp_msr_iteration = yesno_uint(val); + settings_.o._cmp_msr_iteration = yesno_uint(val); } - else if (iequals(var, OUTPUT_ADJ_MSR)) + else if (boost::iequals(var, OUTPUT_ADJ_MSR)) { if (val.empty()) return; - settings_.o._adj_msr_final = yesno_uint(val); + settings_.o._adj_msr_final = yesno_uint(val); } - else if (iequals(var, OUTPUT_ADJ_GNSS_UNITS)) + else if (boost::iequals(var, OUTPUT_ADJ_GNSS_UNITS)) { if (val.empty()) return; - settings_.o._adj_gnss_units = lexical_cast(val); + settings_.o._adj_gnss_units = boost::lexical_cast(val); } - else if (iequals(var, OUTPUT_ADJ_MSR_TSTAT)) + else if (boost::iequals(var, OUTPUT_ADJ_MSR_TSTAT)) { if (val.empty()) return; - settings_.o._adj_msr_tstat = yesno_uint(val); + settings_.o._adj_msr_tstat = yesno_uint(val); } - else if (iequals(var, OUTPUT_ADJ_MSR_SORTBY)) + else if (boost::iequals(var, OUTPUT_ADJ_MSR_SORTBY)) { if (val.empty()) return; - settings_.o._sort_adj_msr = lexical_cast(val); + settings_.o._sort_adj_msr = boost::lexical_cast(val); } - else if (iequals(var, OUTPUT_ADJ_MSR_DBID)) + else if (boost::iequals(var, OUTPUT_ADJ_MSR_DBID)) { if (val.empty()) return; - settings_.o._database_ids = yesno_uint(val); + settings_.o._database_ids = yesno_uint(val); } - else if (iequals(var, OUTPUT_ADJ_STN_BLOCKS)) + else if (boost::iequals(var, OUTPUT_ADJ_STN_BLOCKS)) { if (val.empty()) return; - settings_.o._output_stn_blocks = yesno_uint(val); + settings_.o._output_stn_blocks = yesno_uint(val); } - else if (iequals(var, OUTPUT_ADJ_MSR_BLOCKS)) + else if (boost::iequals(var, OUTPUT_ADJ_MSR_BLOCKS)) { if (val.empty()) return; - settings_.o._output_msr_blocks = yesno_uint(val); + settings_.o._output_msr_blocks = yesno_uint(val); } - else if (iequals(var, OUTPUT_ADJ_STN_SORT_ORDER)) + else if (boost::iequals(var, OUTPUT_ADJ_STN_SORT_ORDER)) { if (val.empty()) return; - settings_.o._sort_stn_file_order = yesno_uint(val); + settings_.o._sort_stn_file_order = yesno_uint(val); } - else if (iequals(var, OUTPUT_STN_COORD_TYPES)) + else if (boost::iequals(var, OUTPUT_STN_COORD_TYPES)) { if (val.empty()) return; settings_.o._stn_coord_types = val; } - else if (iequals(var, OUTPUT_ANGULAR_TYPE_STN)) + else if (boost::iequals(var, OUTPUT_ANGULAR_TYPE_STN)) { if (val.empty()) return; - settings_.o._angular_type_stn = lexical_cast(val); + settings_.o._angular_type_stn = boost::lexical_cast(val); } - else if (iequals(var, OUTPUT_STN_CORR)) + else if (boost::iequals(var, OUTPUT_STN_CORR)) { if (val.empty()) return; - settings_.o._stn_corr = yesno_uint(val); + settings_.o._stn_corr = yesno_uint(val); } - else if (iequals(var, OUTPUT_PRECISION_METRES_STN)) + else if (boost::iequals(var, OUTPUT_PRECISION_METRES_STN)) { if (val.empty()) return; - settings_.o._precision_metres_stn = lexical_cast(val); + settings_.o._precision_metres_stn = boost::lexical_cast(val); } - else if (iequals(var, OUTPUT_PRECISION_SECONDS_STN)) + else if (boost::iequals(var, OUTPUT_PRECISION_SECONDS_STN)) { if (val.empty()) return; - settings_.o._precision_seconds_stn = lexical_cast(val); + settings_.o._precision_seconds_stn = boost::lexical_cast(val); } - else if (iequals(var, OUTPUT_PRECISION_METRES_MSR)) + else if (boost::iequals(var, OUTPUT_PRECISION_METRES_MSR)) { if (val.empty()) return; - settings_.o._precision_metres_msr = lexical_cast(val); + settings_.o._precision_metres_msr = boost::lexical_cast(val); } - else if (iequals(var, OUTPUT_PRECISION_SECONDS_MSR)) + else if (boost::iequals(var, OUTPUT_PRECISION_SECONDS_MSR)) { if (val.empty()) return; - settings_.o._precision_seconds_msr = lexical_cast(val); + settings_.o._precision_seconds_msr = boost::lexical_cast(val); } - else if (iequals(var, OUTPUT_ANGULAR_TYPE_MSR)) + else if (boost::iequals(var, OUTPUT_ANGULAR_TYPE_MSR)) { if (val.empty()) return; - settings_.o._angular_type_msr = lexical_cast(val); + settings_.o._angular_type_msr = boost::lexical_cast(val); } - else if (iequals(var, OUTPUT_DMS_FORMAT_MSR)) + else if (boost::iequals(var, OUTPUT_DMS_FORMAT_MSR)) { if (val.empty()) return; - settings_.o._dms_format_msr = lexical_cast(val); + settings_.o._dms_format_msr = boost::lexical_cast(val); } - else if (iequals(var, OUTPUT_POS_UNCERTAINTY)) + else if (boost::iequals(var, OUTPUT_POS_UNCERTAINTY)) { if (val.empty()) return; - settings_.o._positional_uncertainty = yesno_uint(val); + settings_.o._positional_uncertainty = yesno_uint(val); } - else if (iequals(var, OUTPUT_APU_CORRELATIONS)) + else if (boost::iequals(var, OUTPUT_APU_CORRELATIONS)) { if (val.empty()) return; - settings_.o._output_pu_covariances = yesno_uint(val); + settings_.o._output_pu_covariances = yesno_uint(val); } - else if (iequals(var, OUTPUT_APU_UNITS)) + else if (boost::iequals(var, OUTPUT_APU_UNITS)) { if (val.empty()) return; - settings_.o._apu_vcv_units = lexical_cast(val); + settings_.o._apu_vcv_units = boost::lexical_cast(val); } - else if (iequals(var, OUTPUT_STN_COR_FILE)) + else if (boost::iequals(var, OUTPUT_STN_COR_FILE)) { if (val.empty()) return; - settings_.o._init_stn_corrections = yesno_uint(val); + settings_.o._init_stn_corrections = yesno_uint(val); } - else if (iequals(var, HZ_CORR_THRESHOLD)) + else if (boost::iequals(var, HZ_CORR_THRESHOLD)) { if (val.empty()) return; settings_.o._hz_corr_threshold = DoubleFromString(val); } - else if (iequals(var, VT_CORR_THRESHOLD)) + else if (boost::iequals(var, VT_CORR_THRESHOLD)) { if (val.empty()) return; settings_.o._vt_corr_threshold = DoubleFromString(val); } - //else if (iequals(var, UPDATE_ORIGINAL_STN_FILE)) + //else if (boost::iequals(var, UPDATE_ORIGINAL_STN_FILE)) //{ // if (val.empty()) // return; - // settings_.o. = yesno_uint(val); + // settings_.o. = yesno_uint(val); //} - else if (iequals(var, EXPORT_XML_STN_FILE)) + else if (boost::iequals(var, EXPORT_XML_STN_FILE)) { if (val.empty()) return; - settings_.o._export_xml_stn_file= yesno_uint(val); + settings_.o._export_xml_stn_file= yesno_uint(val); } - else if (iequals(var, EXPORT_DNA_STN_FILE)) + else if (boost::iequals(var, EXPORT_DNA_STN_FILE)) { if (val.empty()) return; - settings_.o._export_dna_stn_file = yesno_uint(val); + settings_.o._export_dna_stn_file = yesno_uint(val); } - else if (iequals(var, EXPORT_SNX_FILE)) + else if (boost::iequals(var, EXPORT_SNX_FILE)) { if (val.empty()) return; - settings_.o._export_snx_file = yesno_uint(val); + settings_.o._export_snx_file = yesno_uint(val); } + // ??? + // EXPORT_DISCONT_FILE = "export-discont-file"; } -//void CDnaProjectFile::LoadSettingPlot(const string& var, string& val) +//void CDnaProjectFile::LoadSettingPlot(const std::string& var, std::string& val) //{ //} // -//void CDnaProjectFile::LoadSettingDisplay(const string& var, string& val) +//void CDnaProjectFile::LoadSettingDisplay(const std::string& var, std::string& val) //{ //} template -void CDnaProjectFile::AddOptionValue(ostream& os, const char* const option, const T& value) { +void CDnaProjectFile::AddOptionValue(std::ostream& os, const char* const option, const T& value) { os << " --" << option << " " << value; } template -void CDnaProjectFile::AddDefaultValue(ostream& os, const T& value) +void CDnaProjectFile::AddDefaultValue(std::ostream& os, const T& value) { os << " " << value; } template -void CDnaProjectFile::PrintRecord(ostream& os, const T& variable, const U& value) { +void CDnaProjectFile::PrintRecord(std::ostream& os, const T& variable, const U& value) { PrintVariable(os, variable); PrintValue(os, value); @@ -1622,22 +1636,22 @@ void CDnaProjectFile::PrintRecord(ostream& os, const T& variable, const U& value template -void CDnaProjectFile::PrintVariable(ostream& os, const T& variable) { +void CDnaProjectFile::PrintVariable(std::ostream& os, const T& variable) { // width of 35 - os << setw(PRINT_VAR_PAD) << left << variable; + os << std::setw(PRINT_VAR_PAD) << std::left << variable; } template -void CDnaProjectFile::PrintValue(ostream& os, const T& value) { +void CDnaProjectFile::PrintValue(std::ostream& os, const T& value) { // width of 45 - os << setw(PRINT_VAL_PAD) << left << value << endl; + os << std::setw(PRINT_VAL_PAD) << std::left << value << std::endl; } -string CDnaProjectFile::FormCommandLineOptionsStringImport() +std::string CDnaProjectFile::FormCommandLineOptionsStringImport() { - stringstream options; + std::stringstream options; ////////////////////////////////////////////////////// // General settings AddDefaultValue(options, FormCommandLineOptionsStringGeneral()); @@ -1647,22 +1661,22 @@ string CDnaProjectFile::FormCommandLineOptionsStringImport() // files for (_it_vstr_const _it_tmp(settings_.i.input_files.begin()); _it_tmp!=settings_.i.input_files.end(); ++_it_tmp) - AddDefaultValue(options, - leafStr(trimstr(_it_tmp->c_str()))); + AddDefaultValue(options, + leafStr(trimstr(_it_tmp->c_str()))); return options.str(); } -string CDnaProjectFile::FormCommandLineOptionsStringGeneral() +std::string CDnaProjectFile::FormCommandLineOptionsStringGeneral() { - stringstream options; + std::stringstream options; ////////////////////////////////////////////////////// // General settings // project file - AddOptionValue(options, PROJECT_FILE, settings_.g.project_file); + AddOptionValue(options, PROJECT_FILE, settings_.g.project_file); // network name - AddOptionValue(options, NETWORK_NAME, settings_.g.network_name); + AddOptionValue(options, NETWORK_NAME, settings_.g.network_name); // verbose AddOptionValue(options, VERBOSE, settings_.g.verbose); // verbose @@ -1675,72 +1689,73 @@ void CDnaProjectFile::PrintProjectFile() { std::ofstream dnaproj_file; - stringstream err_msg; + std::stringstream err_msg; err_msg << "PrintProjectFile(): An error was encountered when opening " << - settings_.g.project_file << "." << endl; + settings_.g.project_file << "." << std::endl; try { // create binary aml file. Throws runtime_error on failure. file_opener(dnaproj_file, settings_.g.project_file, - ios::out, ascii); + std::ios::out, ascii); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { err_msg << e.what(); - throw boost::enable_current_exception(runtime_error(err_msg.str())); + throw boost::enable_current_exception(std::runtime_error(err_msg.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(err_msg.str())); + throw boost::enable_current_exception(std::runtime_error(err_msg.str())); } err_msg.str(""); err_msg << "PrintProjectFile(): An error was encountered when writing to " << - settings_.g.project_file << "." << endl; + settings_.g.project_file << "." << std::endl; - stringstream ss; + std::stringstream ss; // Write header line - dnaproj_header(dnaproj_file, settings_.g.network_name + " project file."); - dnaproj_file << endl << endl; + dnaproj_header(dnaproj_file, settings_.g.network_name + " project file"); + dnaproj_file << std::endl << std::endl; //////////////////////////////////////////////////////////////////////////////////////////////// // #general ss.str(""); ss << section_general << " (" << PRINT_VAR_PAD << ")"; PrintRecord(dnaproj_file, ss.str(), "VALUE"); - dnaproj_file << OUTPUTLINE << endl; + dnaproj_file << OUTPUTLINE << std::endl; PrintRecord(dnaproj_file, NETWORK_NAME, settings_.g.network_name); // network name - PrintRecord(dnaproj_file, INPUT_FOLDER, system_complete(settings_.g.input_folder).string()); // Path containing all input files - PrintRecord(dnaproj_file, OUTPUT_FOLDER, system_complete(settings_.g.output_folder).string()); // Path for all output files + PrintRecord(dnaproj_file, INPUT_FOLDER, boost::filesystem::system_complete(settings_.g.input_folder).string()); // Path containing all input files + PrintRecord(dnaproj_file, OUTPUT_FOLDER, boost::filesystem::system_complete(settings_.g.output_folder).string()); // Path for all output files PrintRecord(dnaproj_file, VERBOSE, settings_.g.verbose); // Give detailed information about what dnainterop is doing. // 0: No information (default) // 1: Helpful information // 2: Extended information\n3: Debug level information PrintRecord(dnaproj_file, QUIET, yesno_string(settings_.g.quiet)); // Run quietly? - PrintRecord(dnaproj_file, PROJECT_FILE, system_complete(settings_.g.project_file).string()); // project file - PrintRecord(dnaproj_file, DYNADJUST_LOG_FILE, system_complete(settings_.g.log_file).string()); // dynadjust log file + PrintRecord(dnaproj_file, PROJECT_FILE, boost::filesystem::system_complete(settings_.g.project_file).string()); // project file + PrintRecord(dnaproj_file, DYNADJUST_LOG_FILE, boost::filesystem::system_complete(settings_.g.log_file).string()); // dynadjust log file - dnaproj_file << endl; + dnaproj_file << std::endl; //////////////////////////////////////////////////////////////////////////////////////////////// // #import ss.str(""); ss << section_import << " (" << PRINT_VAR_PAD << ")"; PrintRecord(dnaproj_file, ss.str(), "VALUE"); - dnaproj_file << OUTPUTLINE << endl; + dnaproj_file << OUTPUTLINE << std::endl; // Input files for_each (settings_.i.input_files.begin(), settings_.i.input_files.end(), - [&dnaproj_file, this] (string file) { - PrintRecord(dnaproj_file, IMPORT_FILE, leafStr(file.c_str())); + [&dnaproj_file, this] (std::string file) { + PrintRecord(dnaproj_file, IMPORT_FILE, leafStr(file.c_str())); }); // geoid file PrintRecord(dnaproj_file, IMPORT_GEO_FILE, - (settings_.i.geo_file.empty() ? " " : leafStr(settings_.i.geo_file))); + (settings_.i.geo_file.empty() ? " " : leafStr(settings_.i.geo_file))); // reference frame settings PrintRecord(dnaproj_file, REFERENCE_FRAME, settings_.i.reference_frame); + PrintRecord(dnaproj_file, EPOCH, settings_.i.epoch); PrintRecord(dnaproj_file, OVERRIDE_INPUT_FRAME, yesno_string(settings_.i.override_input_rfame)); @@ -1756,25 +1771,27 @@ void CDnaProjectFile::PrintProjectFile() PrintRecord(dnaproj_file, SPLIT_CLUSTERS, yesno_string(settings_.i.split_clusters)); PrintRecord(dnaproj_file, IMPORT_SEG_BLOCK, - (settings_.i.import_block ? val_uint(settings_.i.import_block_number) : "no")); + (settings_.i.import_block ? val_uint(settings_.i.import_block_number) : "no")); PrintRecord(dnaproj_file, SEG_FILE, - (settings_.i.seg_file.empty() ? " " : leafStr(settings_.i.seg_file))); + (settings_.i.seg_file.empty() ? " " : leafStr(settings_.i.seg_file))); PrintRecord(dnaproj_file, PREFER_X_MSR_AS_G, yesno_string(settings_.i.prefer_single_x_as_g)); PrintRecord(dnaproj_file, INCLUDE_MSRS, settings_.i.include_msrs); PrintRecord(dnaproj_file, EXCLUDE_MSRS, settings_.i.exclude_msrs); PrintRecord(dnaproj_file, STATION_RENAMING_FILE, - leafStr(settings_.i.stn_renamingfile)); + leafStr(settings_.i.stn_renamingfile)); PrintRecord(dnaproj_file, STATION_DISCONTINUITY_FILE, - leafStr(settings_.i.stn_discontinuityfile)); + leafStr(settings_.i.stn_discontinuityfile)); PrintRecord(dnaproj_file, TEST_NEARBY_STNS, yesno_string(settings_.i.search_nearby_stn)); PrintRecord(dnaproj_file, TEST_NEARBY_STN_DIST, settings_.i.search_stn_radius); - PrintRecord(dnaproj_file, TEST_SIMILAR_MSRS, - yesno_string(settings_.i.search_similar_msr)); PrintRecord(dnaproj_file, TEST_SIMILAR_GNSS_MSRS, yesno_string(settings_.i.search_similar_msr_gx)); + PrintRecord(dnaproj_file, TEST_SIMILAR_MSRS, + yesno_string(settings_.i.search_similar_msr)); + PrintRecord(dnaproj_file, IGNORE_INSUFFICIENT_MSRS, + yesno_string(settings_.i.ignore_insufficient_msrs)); PrintRecord(dnaproj_file, IGNORE_SIMILAR_MSRS, yesno_string(settings_.i.ignore_similar_msr)); PrintRecord(dnaproj_file, REMOVE_IGNORED_MSRS, @@ -1789,7 +1806,7 @@ void CDnaProjectFile::PrintProjectFile() PrintRecord(dnaproj_file, PSCALE, settings_.i.pscale); PrintRecord(dnaproj_file, LSCALE, settings_.i.lscale); PrintRecord(dnaproj_file, HSCALE, settings_.i.hscale); - PrintRecord(dnaproj_file, SCALAR_FILE, leafStr(settings_.i.scalar_file)); + PrintRecord(dnaproj_file, SCALAR_FILE, leafStr(settings_.i.scalar_file)); // export options PrintRecord(dnaproj_file, EXPORT_XML_FILES, @@ -1807,33 +1824,33 @@ void CDnaProjectFile::PrintProjectFile() PrintRecord(dnaproj_file, SIMULATE_MSR_FILE, yesno_string(settings_.i.simulate_measurements)); - dnaproj_file << endl; + dnaproj_file << std::endl; //////////////////////////////////////////////////////////////////////////////////////////////// // #reftran ss.str(""); ss << section_reftran << " (" << PRINT_VAR_PAD << ")"; PrintRecord(dnaproj_file, ss.str(), "VALUE"); - dnaproj_file << OUTPUTLINE << endl; + dnaproj_file << OUTPUTLINE << std::endl; PrintRecord(dnaproj_file, REFERENCE_FRAME, settings_.r.reference_frame); PrintRecord(dnaproj_file, EPOCH, settings_.r.epoch); PrintRecord(dnaproj_file, TECTONIC_PLATE_MODEL_OPTION, settings_.r.plate_model_option); // Plate motion model option - PrintRecord(dnaproj_file, TECTONIC_PLATE_BDY_FILE, leafStr(settings_.r.tpb_file)); // Tectonic plate boundary file - PrintRecord(dnaproj_file, TECTONIC_PLATE_POLE_FILE, leafStr(settings_.r.tpp_file)); // Tectonic plate pole file + PrintRecord(dnaproj_file, TECTONIC_PLATE_BDY_FILE, leafStr(settings_.r.tpb_file)); // Tectonic plate boundary file + PrintRecord(dnaproj_file, TECTONIC_PLATE_POLE_FILE, leafStr(settings_.r.tpp_file)); // Tectonic plate pole file - dnaproj_file << endl; + dnaproj_file << std::endl; //////////////////////////////////////////////////////////////////////////////////////////////// // #geoid ss.str(""); ss << section_geoid << " (" << PRINT_VAR_PAD << ")"; PrintRecord(dnaproj_file, ss.str(), "VALUE"); - dnaproj_file << OUTPUTLINE << endl; + dnaproj_file << OUTPUTLINE << std::endl; // Output configured to populate binary station files - PrintRecord(dnaproj_file, NTV2_FILEPATH, system_complete(settings_.n.ntv2_geoid_file).string()); // Full file path to geoid file + PrintRecord(dnaproj_file, NTV2_FILEPATH, boost::filesystem::system_complete(settings_.n.ntv2_geoid_file).string()); // Full file path to geoid file PrintRecord(dnaproj_file, METHOD, settings_.n.interpolation_method); PrintRecord(dnaproj_file, DDEG_FORMAT, settings_.n.coordinate_format); @@ -1843,17 +1860,17 @@ void CDnaProjectFile::PrintProjectFile() PrintRecord(dnaproj_file, EXPORT_GEO_FILE, yesno_string(settings_.n.export_dna_geo_file)); - dnaproj_file << endl; + dnaproj_file << std::endl; //////////////////////////////////////////////////////////////////////////////////////////////// // #segment ss.str(""); ss << section_segment << " (" << PRINT_VAR_PAD << ")"; PrintRecord(dnaproj_file, ss.str(), "VALUE"); - dnaproj_file << OUTPUTLINE << endl; + dnaproj_file << OUTPUTLINE << std::endl; - PrintRecord(dnaproj_file, NET_FILE, leafStr(settings_.s.net_file)); // Starting stations file - PrintRecord(dnaproj_file, SEG_FILE, leafStr(settings_.s.seg_file)); // Segmentation output file + PrintRecord(dnaproj_file, NET_FILE, leafStr(settings_.s.net_file)); // Starting stations file + PrintRecord(dnaproj_file, SEG_FILE, leafStr(settings_.s.seg_file)); // Segmentation output file PrintRecord(dnaproj_file, SEG_MIN_INNER_STNS, settings_.s.min_inner_stations); // Minimum number of inner stations per block PrintRecord(dnaproj_file, SEG_THRESHOLD_STNS, settings_.s.max_total_stations); // Maximum number of total stations per block PrintRecord(dnaproj_file, SEG_FORCE_CONTIGUOUS, @@ -1862,19 +1879,19 @@ void CDnaProjectFile::PrintProjectFile() // Stations to be incorporated within the first block. PrintRecord(dnaproj_file, SEG_STARTING_STN, settings_.s.seg_starting_stns); - dnaproj_file << endl; + dnaproj_file << std::endl; //////////////////////////////////////////////////////////////////////////////////////////////// // #adjust ss.str(""); ss << section_adjust << " (" << PRINT_VAR_PAD << ")"; PrintRecord(dnaproj_file, ss.str(), "VALUE"); - dnaproj_file << OUTPUTLINE << endl; + dnaproj_file << OUTPUTLINE << std::endl; - PrintRecord(dnaproj_file, SEG_FILE, leafStr(settings_.a.seg_file)); // Starting stations file + PrintRecord(dnaproj_file, SEG_FILE, leafStr(settings_.a.seg_file)); // Starting stations file PrintRecord(dnaproj_file, COMMENTS, settings_.a.comments); // Starting stations file - PrintRecord(dnaproj_file, ADJUSTMENT_MODE, adjustmentMode(settings_.a.adjust_mode)); + PrintRecord(dnaproj_file, ADJUSTMENT_MODE, adjustmentMode(settings_.a.adjust_mode)); PrintRecord(dnaproj_file, MODE_PHASED_MT, yesno_string(settings_.a.multi_thread)); @@ -1887,10 +1904,10 @@ void CDnaProjectFile::PrintProjectFile() PrintRecord(dnaproj_file, STN_CONSTRAINTS, settings_.a.station_constraints); ss.str(""); - ss << fixed << setprecision(3) << settings_.a.free_std_dev; + ss << std::fixed << std::setprecision(3) << settings_.a.free_std_dev; PrintRecord(dnaproj_file, FREE_STN_SD, ss.str()); // SD for free stations ss.str(""); - ss << scientific << setprecision(4) << settings_.a.fixed_std_dev; + ss << std::scientific << std::setprecision(4) << settings_.a.fixed_std_dev; PrintRecord(dnaproj_file, FIXED_STN_SD, ss.str()); // SD for fixed stations //PrintRecord(dnaproj_file, LSQ_INVERSE_METHOD, settings_.a.inverse_method_lsq); // Least squares inverse method @@ -1903,16 +1920,16 @@ void CDnaProjectFile::PrintProjectFile() yesno_string(settings_.a.purge_stage_files)); // Purge stage files PrintRecord(dnaproj_file, TYPE_B_GLOBAL, settings_.a.type_b_global); // Global Type B uncertainties - PrintRecord(dnaproj_file, TYPE_B_FILE, leafStr(settings_.a.type_b_file)); // Type B uncertainty file + PrintRecord(dnaproj_file, TYPE_B_FILE, leafStr(settings_.a.type_b_file)); // Type B uncertainty file - dnaproj_file << endl; + dnaproj_file << std::endl; //////////////////////////////////////////////////////////////////////////////////////////////// // #output ss.str(""); ss << section_output << " (" << PRINT_VAR_PAD << ")"; PrintRecord(dnaproj_file, ss.str(), "VALUE"); - dnaproj_file << OUTPUTLINE << endl; + dnaproj_file << OUTPUTLINE << std::endl; PrintRecord(dnaproj_file, OUTPUT_MSR_TO_STN, yesno_string(settings_.o._msr_to_stn)); @@ -1963,10 +1980,10 @@ void CDnaProjectFile::PrintProjectFile() yesno_string(settings_.o._init_stn_corrections)); ss.str(""); - ss << fixed << setprecision(3) << settings_.o._hz_corr_threshold; + ss << std::fixed << std::setprecision(3) << settings_.o._hz_corr_threshold; PrintRecord(dnaproj_file, HZ_CORR_THRESHOLD, ss.str()); ss.str(""); - ss << fixed << setprecision(3) << settings_.o._vt_corr_threshold; + ss << std::fixed << std::setprecision(3) << settings_.o._vt_corr_threshold; PrintRecord(dnaproj_file, VT_CORR_THRESHOLD, ss.str()); PrintRecord(dnaproj_file, EXPORT_XML_STN_FILE, @@ -1976,16 +1993,16 @@ void CDnaProjectFile::PrintProjectFile() PrintRecord(dnaproj_file, EXPORT_SNX_FILE, yesno_string(settings_.o._export_snx_file)); - dnaproj_file << endl; + dnaproj_file << std::endl; //////////////////////////////////////////////////////////////////////////////////////////////// // #plot ss.str(""); ss << section_plot << " (" << PRINT_VAR_PAD << ")"; PrintRecord(dnaproj_file, ss.str(), "VALUE"); - dnaproj_file << OUTPUTLINE << endl; + dnaproj_file << OUTPUTLINE << std::endl; - dnaproj_file << endl; + dnaproj_file << std::endl; dnaproj_file.close(); } diff --git a/dynadjust/include/config/dnaprojectfile.hpp b/dynadjust/include/config/dnaprojectfile.hpp index c17ec89a..a7a6b5a6 100644 --- a/dynadjust/include/config/dnaprojectfile.hpp +++ b/dynadjust/include/config/dnaprojectfile.hpp @@ -34,11 +34,6 @@ #include #include - -using namespace std; -using namespace boost; -using namespace boost::timer; - #include #include #include @@ -51,7 +46,7 @@ class CDnaProjectFile public: CDnaProjectFile(void); - CDnaProjectFile(const string& projectFile, const UINT16& verifyContext); + CDnaProjectFile(const std::string& projectFile, const UINT16& verifyContext); virtual inline ~CDnaProjectFile(void) {} //virtual inline CDnaProjectFile* clone() const { @@ -69,16 +64,16 @@ class CDnaProjectFile inline project_settings GetSettings() const { return settings_; } //inline CDnaProjectFile& operator[](int iIndex) { return this[iIndex]; } - void LoadProjectFile(const string& projectFile); + void LoadProjectFile(const std::string& projectFile); void LoadProjectFile(); void PrintProjectFile(); template - void PrintRecord(ostream& os, const T& variable, const U& value); + void PrintRecord(std::ostream& os, const T& variable, const U& value); template - void PrintVariable(ostream& os, const T& variable); + void PrintVariable(std::ostream& os, const T& variable); template - void PrintValue(ostream& os, const T& value); + void PrintValue(std::ostream& os, const T& value); inline void UpdateSettingsGeneral(const general_settings& g) { settings_.g = g; @@ -113,12 +108,12 @@ class CDnaProjectFile } template - void AddOptionValue(ostream& os, const char* const option, const T& value); + void AddOptionValue(std::ostream& os, const char* const option, const T& value); template - void AddDefaultValue(ostream& os, const T& value); + void AddDefaultValue(std::ostream& os, const T& value); - string FormCommandLineOptionsStringImport(); - string FormCommandLineOptionsStringGeneral(); + std::string FormCommandLineOptionsStringImport(); + std::string FormCommandLineOptionsStringGeneral(); private: void InitialiseGeneralSettings(); @@ -128,15 +123,15 @@ class CDnaProjectFile void InitialiseSegmentSettings(); void InitialiseAdjustSettings(); - void LoadSettingGeneral(const settingMode mSetting, const string& var, string& val); - void LoadSettingImport(const settingMode mSetting, const string& var, string& val); - void LoadSettingReftran(const string& var, string& val); - void LoadSettingGeoid(const string& var, string& val); - void LoadSettingSegment(const string& var, string& val); - void LoadSettingAdjust(const string& var, string& val); - void LoadSettingOutput(const string& var, string& val); - //void LoadSettingPlot(const string& var, string& val); - //void LoadSettingDisplay(const string& var, string& val); + void LoadSettingGeneral(const settingMode mSetting, const std::string& var, std::string& val); + void LoadSettingImport(const settingMode mSetting, const std::string& var, std::string& val); + void LoadSettingReftran(const std::string& var, std::string& val); + void LoadSettingGeoid(const std::string& var, std::string& val); + void LoadSettingSegment(const std::string& var, std::string& val); + void LoadSettingAdjust(const std::string& var, std::string& val); + void LoadSettingOutput(const std::string& var, std::string& val); + //void LoadSettingPlot(const std::string& var, std::string& val); + //void LoadSettingDisplay(const std::string& var, std::string& val); project_settings settings_; }; diff --git a/dynadjust/include/config/dnatypes-gui.hpp b/dynadjust/include/config/dnatypes-gui.hpp index 5819b05c..392d2059 100644 --- a/dynadjust/include/config/dnatypes-gui.hpp +++ b/dynadjust/include/config/dnatypes-gui.hpp @@ -53,8 +53,7 @@ typedef enum ADJ_MSR_SORT_UI meas_adj_msr_sort_ui = 4, corr_adj_msr_sort_ui = 5, a_sd_adj_msr_sort_ui = 6, - n_st_adj_msr_sort_ui = 7, - outl_adj_msr_sort_ui = 8 + n_st_adj_msr_sort_ui = 7 } _ADJ_MSR_SORT_UI_; typedef enum MSR_TO_STN_SORT_UI diff --git a/dynadjust/include/config/dnatypes.hpp b/dynadjust/include/config/dnatypes.hpp index 9599ed7a..0809c30d 100644 --- a/dynadjust/include/config/dnatypes.hpp +++ b/dynadjust/include/config/dnatypes.hpp @@ -36,8 +36,6 @@ #include // memset #include -using namespace std; - #ifdef UINT32 #undef UINT32 #endif @@ -68,61 +66,61 @@ const char UPPER_TRIANGLE = 'U'; const UINT16 VALID_STATION = 1; const UINT16 INVALID_STATION = 0; -typedef vector vchar; +typedef std::vector vchar; typedef vchar::iterator _it_chr; -typedef vector vdouble; +typedef std::vector vdouble; typedef vdouble::iterator _it_dbl; -typedef vector vbool; +typedef std::vector vbool; typedef vbool::iterator _it_bool; -typedef vector::reference boolRef; +typedef std::vector::reference boolRef; -typedef string::iterator _it_str; -typedef string::const_iterator _it_str_const; -typedef vector vstring, *pvstring; +typedef std::string::iterator _it_str; +typedef std::string::const_iterator _it_str_const; +typedef std::vector vstring, *pvstring; typedef vstring::iterator _it_vstr; typedef vstring::const_iterator _it_vstr_const; -typedef pair _it_pair_vchar; +typedef std::pair _it_pair_vchar; -typedef pair _it_pair_vstring; +typedef std::pair _it_pair_vstring; -typedef queue qUINT32; +typedef std::queue qUINT32; -typedef vector vUINT32, *pvUINT32; -typedef vector vvUINT32, *pvvUINT32; +typedef std::vector vUINT32, *pvUINT32; +typedef std::vector vvUINT32, *pvvUINT32; typedef vUINT32::iterator it_vUINT32; typedef vUINT32::const_iterator it_vUINT32_const; typedef vvUINT32::iterator it_vvUINT32; -typedef pair string_string_pair; -typedef pair string_uint32_pair; -typedef pair uint32_uint32_pair; -typedef pair uint32_string_pair; +typedef std::pair string_string_pair; +typedef std::pair string_uint32_pair; +typedef std::pair uint32_uint32_pair; +typedef std::pair uint32_string_pair; -typedef pair bool_uint32_pair; +typedef std::pair bool_uint32_pair; -typedef pair string_vstring_pair; +typedef std::pair string_vstring_pair; -typedef pair u32u32_uint32_pair; -typedef pair uint32_u32u32_pair; +typedef std::pair u32u32_uint32_pair; +typedef std::pair uint32_u32u32_pair; -typedef pair doubledouble_pair; -typedef pair stringstring_doubledouble_pair; -typedef vector v_stringstring_doubledouble_pair, *pv_stringstring_doubledouble_pair; +typedef std::pair doubledouble_pair; +typedef std::pair stringstring_doubledouble_pair; +typedef std::vector v_stringstring_doubledouble_pair, *pv_stringstring_doubledouble_pair; typedef v_stringstring_doubledouble_pair::iterator _it_string_doubledouble_pair; -typedef vector v_doubledouble_pair, *pv_doubledouble_pair; -typedef pair string_v_doubledouble_pair; -typedef vector v_string_v_doubledouble_pair, *pv_string_v_doubledouble_pair; +typedef std::vector v_doubledouble_pair, *pv_doubledouble_pair; +typedef std::pair string_v_doubledouble_pair; +typedef std::vector v_string_v_doubledouble_pair, *pv_string_v_doubledouble_pair; typedef v_string_v_doubledouble_pair::iterator it_v_string_v_doubledouble_pair; -typedef pair u32u32_double_pair; +typedef std::pair u32u32_double_pair; -typedef pair stringbool_pair; -typedef pair stringuint32_stringbool_pair; +typedef std::pair stringbool_pair; +typedef std::pair stringuint32_stringbool_pair; ///////////////////////////////////////////////////////////// // Custom pair type to manage appearances of a station @@ -152,9 +150,9 @@ struct stn_appearance_t }; typedef stn_appearance_t stn_appear; -typedef vector v_stn_appear; +typedef std::vector v_stn_appear; typedef v_stn_appear::iterator it_vstn_appear; -typedef vector vv_stn_appear; +typedef std::vector vv_stn_appear; typedef vv_stn_appear::iterator it_vvstn_appear; ///////////////////////////////////////////////////////////// @@ -194,7 +192,7 @@ struct stn_block_map_t }; typedef stn_block_map_t stn_block_map; -typedef vector v_stn_block_map; +typedef std::vector v_stn_block_map; typedef v_stn_block_map::iterator it_vstn_block_map; ///////////////////////////////////////////////////////////// @@ -217,7 +215,7 @@ struct freestnpair_t }; typedef freestnpair_t freestn_pair; -typedef vector v_freestn_pair; +typedef std::vector v_freestn_pair; typedef v_freestn_pair::iterator it_freestn_pair; ///////////////////////////////////////////////////////////// @@ -239,7 +237,7 @@ struct amlpair_t }; typedef amlpair_t aml_pair; -typedef vector v_aml_pair; +typedef std::vector v_aml_pair; typedef v_aml_pair::iterator it_aml_pair; ///////////////////////////////////////////////////////////// @@ -265,23 +263,23 @@ struct sequential_adj_t }; typedef sequential_adj_t sequential_adj; -typedef vector v_sequential_adj; +typedef std::vector v_sequential_adj; typedef v_sequential_adj::iterator it_sequential_adj; ///////////////////////////////////////////////////////////// -typedef map uint32_uint32_map; +typedef std::map uint32_uint32_map; typedef uint32_uint32_map::iterator it_uint32_uint32_map; -typedef vector v_uint32_uint32_map; +typedef std::vector v_uint32_uint32_map; typedef v_uint32_uint32_map::iterator it_v_uint32_uint32_map; -typedef vector v_string_string_pair, *pv_string_string_pair; -typedef vector v_string_vstring_pair, *pv_string_vstring_pair; +typedef std::vector v_string_string_pair, *pv_string_string_pair; +typedef std::vector v_string_vstring_pair, *pv_string_vstring_pair; -typedef vector v_string_uint32_pair, *pv_string_uint32_pair; -typedef vector v_uint32_uint32_pair, *pv_uint32_uint32_pair; -typedef vector v_uint32_string_pair, *pv_uint32_string_pair; -typedef vector v_u32u32_uint32_pair; -typedef vector v_uint32_u32u32_pair; +typedef std::vector v_string_uint32_pair, *pv_string_uint32_pair; +typedef std::vector v_uint32_uint32_pair, *pv_uint32_uint32_pair; +typedef std::vector v_uint32_string_pair, *pv_uint32_string_pair; +typedef std::vector v_u32u32_uint32_pair; +typedef std::vector v_uint32_u32u32_pair; typedef v_string_vstring_pair::iterator _it_string_vstring_pair; typedef v_string_uint32_pair::iterator _it_string_uint32_pair; @@ -290,18 +288,20 @@ typedef v_u32u32_uint32_pair::iterator _it_u32u32_uint32_pair; typedef v_uint32_u32u32_pair::iterator _it_uint32_u32u32_pair; typedef v_uint32_uint32_pair::iterator _it_uint32_uint32_pair; -typedef vector vv_string_string_pair; +typedef std::pair<_it_u32u32_uint32_pair, _it_u32u32_uint32_pair> _it_pair_u32u32_uint32; + +typedef std::vector vv_string_string_pair; -typedef pair _it_pair_vUINT32_const; -typedef pair it_pair_vUINT32; +typedef std::pair _it_pair_vUINT32_const; +typedef std::pair it_pair_vUINT32; typedef v_string_string_pair::iterator it_string_pair; -typedef pair it_pair_string; -typedef pair<_it_string_uint32_pair, _it_string_uint32_pair> it_pair_string_vUINT32; -typedef pair<_it_uint32_string_pair, _it_uint32_string_pair> it_pair_uint32_string; +typedef std::pair it_pair_string; +typedef std::pair<_it_string_uint32_pair, _it_string_uint32_pair> it_pair_string_vUINT32; +typedef std::pair<_it_uint32_string_pair, _it_uint32_string_pair> it_pair_uint32_string; -typedef pair it_pair_map_vUINT32_vUINT32; +typedef std::pair it_pair_map_vUINT32_vUINT32; typedef enum _SIGMA_ZERO_STAT_PASS_ { @@ -466,11 +466,11 @@ typedef struct { } statSummary_t; typedef struct stationCorrections { - stationCorrections(const string& stn="") + stationCorrections(const std::string& stn="") : _station(stn), _azimuth(0.), _vAngle(0.), _sDistance(0.) , _hDistance(0.), _east(0.), _north(0.), _up(0.) {} - string _station; + std::string _station; double _azimuth; double _vAngle; double _sDistance; @@ -480,12 +480,12 @@ typedef struct stationCorrections { double _up; } stationCorrections_t; -typedef vector vstnCor_t, *pvstnCor_t; -typedef vector vvstnCor_t; +typedef std::vector vstnCor_t, *pvstnCor_t; +typedef std::vector vvstnCor_t; typedef vstnCor_t::iterator it_vstnCor_t; typedef struct { - string _station; + std::string _station; double _latitude; double _longitude; double _hzPosU; @@ -501,12 +501,12 @@ typedef struct { double _zz; } stationPosUncertainty_t; -typedef vector vstnPU_t, *pvstnPU_t; -typedef vector vvstnPU_t; +typedef std::vector vstnPU_t, *pvstnPU_t; +typedef std::vector vvstnPU_t; typedef vstnPU_t::iterator it_vstnPU_t; typedef struct { - string _networkName; + std::string _networkName; vstring _initialStns; UINT32 _minInnerStns; UINT32 _maxTotalStns; @@ -590,13 +590,13 @@ typedef struct stn_t { } station_t; -typedef vector vstn_t, *pvstn_t; +typedef std::vector vstn_t, *pvstn_t; typedef vstn_t::iterator it_vstn_t; typedef vstn_t::const_iterator it_vstn_t_const; -typedef vector vsummary_t, *pvsummary_t; +typedef std::vector vsummary_t, *pvsummary_t; -typedef pair stn_t_string_pair; -typedef vector v_stn_string; +typedef std::pair stn_t_string_pair; +typedef std::vector v_stn_string; typedef v_stn_string::iterator it_stn_string; const UINT32 MOD_NAME_WIDTH(20); @@ -612,9 +612,9 @@ typedef struct input_file_meta { typedef struct binary_file_meta { binary_file_meta () - : binCount(0), reduced(false), inputFileCount(0), inputFileMeta(NULL) {} - binary_file_meta (const string& app_name) - : binCount(0), reduced(false), inputFileCount(0), inputFileMeta(NULL) { + : binCount(0), reduced(false), reftran(false), geoid(false), inputFileCount(0), inputFileMeta(NULL) {} + binary_file_meta (const std::string& app_name) + : binCount(0), reduced(false), reftran(false), geoid(false), inputFileCount(0), inputFileMeta(NULL) { sprintf(modifiedBy, "%s", app_name.c_str()); } ~binary_file_meta() { @@ -626,19 +626,21 @@ typedef struct binary_file_meta { char modifiedBy[MOD_NAME_WIDTH+1]; // the program that modified this file char epsgCode[STN_EPSG_WIDTH+1]; // epsg ID, i.e. NNNNN (where NNNNN is in the range 0-32767). "Mixed" if stations are on different reference frames char epoch[STN_EPOCH_WIDTH+1]; // date, i.e. "DD.MM.YYYY" (10 chars) + bool reftran; // the data has been transformed to another frame and/or epoch + bool geoid; // geoid separation values have been obtained UINT16 inputFileCount; // Number of source file metadata elements input_file_meta_t* inputFileMeta; // Source file metadata } binary_file_meta_t; -typedef vector vifm_t; +typedef std::vector vifm_t; typedef vifm_t::iterator it_vifm_t; -typedef vector vbfm_t; +typedef std::vector vbfm_t; typedef vbfm_t::iterator it_vbfm_t; template S formatStnMsrFileSourceString(const vifm_t* vfile_meta, const size_t& file_type) { - string source_files(""); + std::string source_files(""); bool this_file; for (UINT32 i(0); isize(); ++i) @@ -674,4 +676,28 @@ S formatStnMsrFileSourceString(const vifm_t* vfile_meta, const size_t& file_type return source_files; } +template +S FormatFileType(const size_t& file_type) +{ + switch (file_type) + { + case dna: + return "DNA"; + break; + case sinex: + return "SNX"; + break; + case geodesyml: + return "GML"; + break; + case dynaml: + return "XML"; + break; + case csv: + return "CSV"; + break; + } + return "unknown"; +} + #endif // DNATYPES_H_ diff --git a/dynadjust/include/config/dnaversion-stream.hpp b/dynadjust/include/config/dnaversion-stream.hpp index 2475132d..ec12b501 100644 --- a/dynadjust/include/config/dnaversion-stream.hpp +++ b/dynadjust/include/config/dnaversion-stream.hpp @@ -31,6 +31,8 @@ #include +using std::setw; + #include #include @@ -73,7 +75,7 @@ template void output_version(T& stream, bool PAD=false) { if (PAD) - stream << setw(PRINT_VAR_PAD) << left << "Version: "; + stream << std::setw(PRINT_VAR_PAD) << std::left << "Version: "; else stream << "Version: "; stream << __BINARY_VERSION__ << ", " << __BINARY_BUILDTYPE__; @@ -84,7 +86,7 @@ template void output_build(T& stream, bool PAD=false) { if (PAD) - stream << setw(PRINT_VAR_PAD) << left << "Build: "; + stream << std::setw(PRINT_VAR_PAD) << std::left << "Build: "; else stream << "Build: "; stream << diff --git a/dynadjust/include/config/dnaversion.hpp b/dynadjust/include/config/dnaversion.hpp index 4c3a8c48..f51481c4 100644 --- a/dynadjust/include/config/dnaversion.hpp +++ b/dynadjust/include/config/dnaversion.hpp @@ -171,7 +171,7 @@ const char* const __plot_dll_name__ = "libdnaplot.so"; #endif #define __CONTACT_EMAIL__ "geodesy@ga.gov.au" -#define __COPYRIGHT_YEAR__ "2022" +#define __COPYRIGHT_YEAR__ "2025" #define __COPYRIGHT_OWNER__ "Geoscience Australia" #define __COPYRIGHT_MSG__ "This software is released under the Apache License." @@ -303,11 +303,12 @@ const char* const __plot_dll_name__ = "libdnaplot.so"; #define __COMPILER_VERSION__ __SUNPRO_CC #elif defined(__ICC) || defined(__INTEL_COMPILER) // Intel compiler #define __COMPILER__ "Intel ICC" -#define __COMPILER_VERSION__ lexical_cast(__INTEL_COMPILER) +#define __COMPILER_VERSION__ boost::lexical_cast(__INTEL_COMPILER) #elif defined(__HP_aCC) // Oracle Solaris #define __COMPILER__ "HP C++" #define __COMPILER_VERSION__ __HP_aCC #elif defined(_MSC_VER) +// https://learn.microsoft.com/en-us/cpp/overview/compiler-versions?view=msvc-170#version-macros #define __COMPILER__ "MSVC++" #if (_MSC_VER == 1100) #define __COMPILER_VERSION__ "5.0" @@ -375,8 +376,24 @@ const char* const __plot_dll_name__ = "libdnaplot.so"; #define __COMPILER_VERSION__ "17.4, VS2022" #elif (_MSC_VER == 1935) #define __COMPILER_VERSION__ "17.5, VS2022" - -#elif (_MSC_VER > 1935) +#elif (_MSC_VER == 1936) +#define __COMPILER_VERSION__ "17.6, VS2022" +#elif (_MSC_VER == 1937) +#define __COMPILER_VERSION__ "17.7, VS2022" +#elif (_MSC_VER == 1938) +#define __COMPILER_VERSION__ "17.8, VS2022" +#elif (_MSC_VER == 1939) +#define __COMPILER_VERSION__ "17.9, VS2022" +#elif (_MSC_VER == 1940) +#define __COMPILER_VERSION__ "17.10, VS2022" +#elif (_MSC_VER == 1941) +#define __COMPILER_VERSION__ "17.11, VS2022" +#elif (_MSC_VER == 1942) +#define __COMPILER_VERSION__ "17.12, VS2022" +#elif (_MSC_VER == 1943) +#define __COMPILER_VERSION__ "17.13, VS2022" + +#elif (_MSC_VER > 1943) #define __COMPILER_VERSION__ _MSC_VER #endif #else diff --git a/dynadjust/include/exception/dnaexception.hpp b/dynadjust/include/exception/dnaexception.hpp index 4bc928d2..a9e3b9ff 100644 --- a/dynadjust/include/exception/dnaexception.hpp +++ b/dynadjust/include/exception/dnaexception.hpp @@ -35,9 +35,6 @@ #include #include -using namespace std; -using namespace boost; - typedef enum _PARSE_STATUS_ { PARSE_SUCCESS = 0, PARSE_MSR_MAP = 1, @@ -77,21 +74,19 @@ typedef enum _REFTRAN_STATUS_ { REFTRAN_WGS84_TRANS_UNSUPPORTED = 5 } REFTRAN_STATUS; -using namespace std; - namespace dynadjust { namespace exception { // Exception handler class XMLInteropException : public std::exception { public: - explicit XMLInteropException(const string& what, const UINT32& line_no) + explicit XMLInteropException(const std::string& what, const UINT32& line_no) : what_(what), line_no_(line_no) {} virtual const char* what() const throw() { return what_.c_str(); } virtual ~XMLInteropException() throw() {} private: - string what_; + std::string what_; UINT32 line_no_; }; @@ -99,13 +94,13 @@ class XMLInteropException : public std::exception class NetPlotException : public std::exception { public: - explicit NetPlotException(const string& what, const UINT32& line_no) + explicit NetPlotException(const std::string& what, const UINT32& line_no) : what_(what), line_no_(line_no) {} virtual const char* what() const throw() { return what_.c_str(); } virtual ~NetPlotException() throw() {} private: - string what_; + std::string what_; UINT32 line_no_; }; @@ -113,13 +108,13 @@ class NetPlotException : public std::exception class NetSegmentException : public std::exception { public: - explicit NetSegmentException(const string& what, const UINT32& line_no) + explicit NetSegmentException(const std::string& what, const UINT32& line_no) : what_(what), line_no_(line_no) {} virtual const char* what() const throw() { return what_.c_str(); } virtual ~NetSegmentException() throw() {} private: - string what_; + std::string what_; UINT32 line_no_; }; @@ -127,13 +122,13 @@ class NetSegmentException : public std::exception class NetAdjustException : public std::exception { public: - explicit NetAdjustException(const string& what, const UINT32 block_no) + explicit NetAdjustException(const std::string& what, const UINT32 block_no) : what_(what), block_no_(block_no) {} virtual const char* what() const throw() { return what_.c_str(); } virtual ~NetAdjustException() throw() {} private: - string what_; + std::string what_; UINT32 block_no_; }; @@ -141,20 +136,20 @@ class NetAdjustException : public std::exception class NetMemoryException : public std::exception { public: - explicit NetMemoryException(const string& what) + explicit NetMemoryException(const std::string& what) : what_(what) {} virtual const char* what() const throw() { return what_.c_str(); } virtual ~NetMemoryException() throw() {} private: - string what_; + std::string what_; }; // Exception handler class NetGeoidException : public std::exception { public: - explicit NetGeoidException(const string& what, const int& error_no, const UINT32& line_no = 0) + explicit NetGeoidException(const std::string& what, const int& error_no, const UINT32& line_no = 0) : what_(what), error_no_(error_no), line_no_(line_no) {} virtual const char* what() const throw() { return what_.c_str(); } virtual ~NetGeoidException() throw() {} @@ -163,7 +158,7 @@ class NetGeoidException : public std::exception inline UINT32 line_no () const { return line_no_; } private: - string what_; + std::string what_; int error_no_; UINT32 line_no_; }; @@ -172,7 +167,7 @@ class NetGeoidException : public std::exception class RefTranException : public std::exception { public: - explicit RefTranException(const string& what, size_t exception_type = REFTRAN_EXCEPTION_RAISED) + explicit RefTranException(const std::string& what, size_t exception_type = REFTRAN_EXCEPTION_RAISED) : what_(what) , exception_type_(exception_type) {} virtual const char* what() const throw() { return what_.c_str(); } @@ -180,7 +175,7 @@ class RefTranException : public std::exception virtual ~RefTranException() throw() {} private: - string what_; + std::string what_; size_t exception_type_; }; diff --git a/dynadjust/include/functions/dnafilepathfuncs.hpp b/dynadjust/include/functions/dnafilepathfuncs.hpp index 6f31498e..b027f389 100644 --- a/dynadjust/include/functions/dnafilepathfuncs.hpp +++ b/dynadjust/include/functions/dnafilepathfuncs.hpp @@ -30,7 +30,6 @@ #endif #include -#include #include #include @@ -42,12 +41,6 @@ #include -using namespace std; -using namespace boost; -using namespace boost::filesystem; - -using namespace std; - template T formPath(const T& folder, const T& file, const T& ext) { @@ -63,7 +56,7 @@ T formPath(const T& folder, const T file) template T leafStr(const T& filePath) { - return path(filePath).leaf().string(); + return boost::filesystem::path(filePath).filename().string(); } #endif //DNAFILEPATHFUNCS_H_ \ No newline at end of file diff --git a/dynadjust/include/functions/dnaintegermanipfuncs.hpp b/dynadjust/include/functions/dnaintegermanipfuncs.hpp index 77ae4a1a..8234b118 100644 --- a/dynadjust/include/functions/dnaintegermanipfuncs.hpp +++ b/dynadjust/include/functions/dnaintegermanipfuncs.hpp @@ -31,13 +31,10 @@ #include -using namespace std; -using namespace boost; - #include template -void initialiseIncrementingIntegerVector(vector& vt, const T& size) +void initialiseIncrementingIntegerVector(std::vector& vt, const T& size) { vt.resize(size); T t(0); @@ -48,15 +45,15 @@ void initialiseIncrementingIntegerVector(vector& vt, const T& size) } template -void initialiseIncrementingIntegerVector(vector* vt, const T& size) +void initialiseIncrementingIntegerVector(std::vector* vt, const T& size) { initialiseIncrementingIntegerVector(*vt, size); } template -vector createIncrementingIntegerVector(const T& size) +std::vector createIncrementingIntegerVector(const T& size) { - vector vt(size); + std::vector vt(size); initialiseIncrementingIntegerVector(vt, size); return vt; } diff --git a/dynadjust/include/functions/dnaiostreamfuncs.hpp b/dynadjust/include/functions/dnaiostreamfuncs.hpp index e80e79e7..2ab3727d 100644 --- a/dynadjust/include/functions/dnaiostreamfuncs.hpp +++ b/dynadjust/include/functions/dnaiostreamfuncs.hpp @@ -32,6 +32,9 @@ #include #include +using std::ostringstream; +using std::locale; + #include #include #include @@ -42,39 +45,6 @@ #include #include -using namespace std; -using namespace boost; -using namespace boost::filesystem; -using namespace boost::timer; -using namespace boost::posix_time; -using namespace boost::gregorian; - - -//template -//std::ostream &operator<<(std::ostream &output, T const &input) { -// T::size_type size = input.size(); -// -// output << size << "\n"; -// std::copy(input.begin(), input.end(), -// std::ostream_iterator(output, "\n")); -// -// return output; -//} -// -//template -//std::istream &operator>>(std::istream &input, T &output) { -// T::size_type size, i; -// -// input >> size; -// output.resize(size); -// std::copy_n( -// std::istream_iterator(input), -// size, -// output.begin()); -// -// return input; -//} - template T real_line_length_ascii(const T& line_length_ascii) { @@ -100,8 +70,8 @@ T real_line_length_ascii(const T& line_length_ascii) template void file_opener( T* stream, - const string& str, - ios_base::openmode mode=ios_base::out, // default: output + const std::string& str, + std::ios_base::openmode mode=std::ios_base::out, // default: output const iosMode type=ascii, // default: ascii bool fileMustExist=false) // default: no need for file to exist { @@ -111,62 +81,62 @@ void file_opener( template void file_opener( T& stream, - const string& str, - ios_base::openmode mode=ios_base::out, // default: output + const std::string& str, + std::ios_base::openmode mode=std::ios_base::out, // default: output const iosMode type=ascii, // default: ascii bool fileMustExist=false) // default: no need for file to exist { try { stream.open(str.c_str(), mode); - stream.exceptions (/*ios_base::eofbit | */ios_base::badbit | ios_base::failbit); + stream.exceptions (/*std::ios_base::eofbit | */std::ios_base::badbit | std::ios_base::failbit); stream.iword(0) = type; } - catch (const ios_base::failure& f) { - stringstream ss; + catch (const std::ios_base::failure& f) { + std::stringstream ss; if (fileMustExist && !boost::filesystem::exists(str.c_str())) ss << "file_opener(): Can't find " << str << "."; else ss << "file_opener(): An error was encountered when opening " << str << ". \n Check that the file is not already opened."; - ss << endl << f.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + ss << std::endl << f.what(); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } if (!stream.good()) { - stringstream ss; + std::stringstream ss; ss << "file_opener(): An error was encountered when opening " << str << ". \n Check that the file is not already opened."; - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } } template void print_file_header( T& stream, - const string& header) + const std::string& header) { // Print formatted header - stream << OUTPUTLINE << endl; - stream << header << endl << endl; + stream << OUTPUTLINE << std::endl; + stream << header << std::endl << std::endl; // version output_version(stream, true); - stream << endl; + stream << std::endl; // build output_build(stream, true); - stream << endl; + stream << std::endl; // File creation time - stream << setw(PRINT_VAR_PAD) << left << "File created:"; - ostringstream datetime_ss; - time_facet* p_time_output = new time_facet; - locale special_locale (locale(""), p_time_output); + stream << std::setw(PRINT_VAR_PAD) << std::left << "File created:"; + std::ostringstream datetime_ss; + boost::posix_time::time_facet* p_time_output = new boost::posix_time::time_facet; + std::locale special_locale (std::locale(""), p_time_output); // special_locale takes ownership of the p_time_output facet datetime_ss.imbue (special_locale); (*p_time_output).format("%A, %d %B %Y, %X"); - datetime_ss << second_clock::local_time(); - stream << datetime_ss.str().c_str() << endl; + datetime_ss << boost::posix_time::second_clock::local_time(); + stream << datetime_ss.str().c_str() << std::endl; } diff --git a/dynadjust/include/functions/dnaparallelfuncs.hpp b/dynadjust/include/functions/dnaparallelfuncs.hpp index 8cf80ff2..3ec12217 100644 --- a/dynadjust/include/functions/dnaparallelfuncs.hpp +++ b/dynadjust/include/functions/dnaparallelfuncs.hpp @@ -37,9 +37,6 @@ #include -using namespace std; -using namespace boost; - template void parallel_for_each(Iterator first, Iterator last, Func f) { diff --git a/dynadjust/include/functions/dnaprocessfuncs.cpp b/dynadjust/include/functions/dnaprocessfuncs.cpp index 17007af7..583b5c87 100644 --- a/dynadjust/include/functions/dnaprocessfuncs.cpp +++ b/dynadjust/include/functions/dnaprocessfuncs.cpp @@ -21,12 +21,10 @@ //============================================================================ #include - +#include #include -using namespace boost::process; - -bool run_command(const string& executable_path, const UINT16& quiet) +bool run_command(const std::string& executable_path, const UINT16& quiet) { // use boost's platform independent code to invoke a process // see https://www.boost.org/doc/libs/develop/doc/html/process.html @@ -63,12 +61,20 @@ bool run_command(const string& executable_path, const UINT16& quiet) #elif defined(__linux) || defined(sun) || defined(__unix__) || defined(__APPLE__) int return_value(0); - - if (quiet) - return_value = boost::process::system(executable_path, boost::process::std_out > boost::process::null); - else - return_value = boost::process::system(executable_path, boost::process::std_out > stdout); - + + try { + if (quiet) + return_value = boost::process::system(executable_path, boost::process::std_out > boost::process::null); + else + return_value = boost::process::system(executable_path, boost::process::std_out > stdout); + } + catch (const boost::process::process_error& e) + { + std::cout << std::endl << "- Error: Cannot find " << executable_path << "\n" << + " " << e.what() << std::endl; + return EXIT_FAILURE; + } + return (return_value == EXIT_SUCCESS); #endif diff --git a/dynadjust/include/functions/dnaprocessfuncs.hpp b/dynadjust/include/functions/dnaprocessfuncs.hpp index 10aeeb92..24161d65 100644 --- a/dynadjust/include/functions/dnaprocessfuncs.hpp +++ b/dynadjust/include/functions/dnaprocessfuncs.hpp @@ -34,17 +34,34 @@ #include #if defined(_WIN32) || defined(__WIN32__) + +// prevent conflict with std::min(...) std::max(...) +#ifndef NOMINMAX +#define NOMINMAX +#endif + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif + +#ifndef VC_EXTRALEAN +#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#endif + #include + #endif + + #include -bool run_command(const string& executable_path, const UINT16& quiet = 0); +bool run_command(const std::string& executable_path, const UINT16& quiet = 0); class dna_create_threaded_process { public: - dna_create_threaded_process(const string& command_path, const UINT16& quiet = 0) + dna_create_threaded_process(const std::string& command_path, const UINT16& quiet = 0) : _command_path(command_path), _quiet(quiet) {}; @@ -55,7 +72,7 @@ class dna_create_threaded_process run_command(_command_path, _quiet); } private: - string _command_path; + std::string _command_path; UINT16 _quiet; }; diff --git a/dynadjust/include/functions/dnastringfuncs.cpp b/dynadjust/include/functions/dnastringfuncs.cpp index 21894212..f7cd350b 100644 --- a/dynadjust/include/functions/dnastringfuncs.cpp +++ b/dynadjust/include/functions/dnastringfuncs.cpp @@ -128,30 +128,30 @@ int GetFields(char *line, char delim, bool multiple_delim_as_one, const char *fm // + Contact : geodesy@ga.gov.au // + --------------------------------------------------------------------------- // -void fileproc_help_header(string* msg) +void fileproc_help_header(std::string* msg) { - stringstream str; + std::stringstream str; - str << "+---------------------------------------------------------------------------" << endl; + str << "+---------------------------------------------------------------------------" << std::endl; str << "+ "; output_binaryname(str); str << " - "; output_theappname(str); str << "."; - str << endl; + str << std::endl; str << "+ "; output_binarydescription(str); - str << endl; + str << std::endl; str << "+ "; output_version(str); - str << endl; + str << std::endl; str << "+ "; output_build(str); - str << endl; + str << std::endl; *msg = str.str(); @@ -170,100 +170,100 @@ void fileproc_help_header(string* msg) } -void dynaml_header(ostream& os, const string& fileType, const string& referenceFrame, const string& epoch) +void dynaml_header(std::ostream& os, const std::string& fileType, const std::string& referenceFrame, const std::string& epoch) { - os << "" << endl; + os << "" << std::endl; os << "" << endl; + "\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"DynaML.xsd\">" << std::endl; os << "" << endl; + os << " -->" << std::endl; os << "" << endl; + os << " -->" << std::endl; os << "" << endl; + os << " -->" << std::endl; } -void dynaml_footer(ostream& os) +void dynaml_footer(std::ostream& os) { - os << "" << endl; + os << "" << std::endl; } -void dynaml_comment(ostream& os, const string& comment) +void dynaml_comment(std::ostream& os, const std::string& comment) { - os << "" << endl; + os << "" << std::endl; } -string snx_softwarehardware_text() +std::string snx_softwarehardware_text() { - stringstream str, str2; + std::stringstream str, str2; // name output_globalname(str2); - str << " SOFTWARE " << left << setw(60) << str2.str() << endl; + str << " SOFTWARE " << std::left << std::setw(60) << str2.str() << std::endl; // version str2.str(""); output_version(str2); - str << " SOFTWARE " << left << setw(60) << str2.str() << endl; + str << " SOFTWARE " << std::left << std::setw(60) << str2.str() << std::endl; // build str2.str(""); output_build(str2); - str << " SOFTWARE " << left << setw(60) << str2.str() << endl; + str << " SOFTWARE " << std::left << std::setw(60) << str2.str() << std::endl; // hardware - str << " HARDWARE " << left << setw(60) << __HARDWARE__ << endl; + str << " HARDWARE " << std::left << std::setw(60) << __HARDWARE__ << std::endl; return str.str(); } -void dna_header(ostream& os, const string& fileVersion, const string& fileType, const string& reference_frame, const string& epoch_version, const size_t& count) +void dna_header(std::ostream& os, const std::string& fileVersion, const std::string& fileType, const std::string& reference_frame, const std::string& epoch_version, const size_t& count) { - stringstream str; + std::stringstream str; str << "!#=DNA " << fileVersion << " " << fileType; - date today(day_clock::local_day()); + boost::gregorian::date today(boost::gregorian::day_clock::local_day()); // creation date - str << setw(14) << right << stringFromDate(today); + str << std::setw(14) << std::right << stringFromDate(today); // default reference frame - str << setw(14) << right << reference_frame; + str << std::setw(14) << std::right << reference_frame; // default epoch - str << setw(14) << right << epoch_version; + str << std::setw(14) << std::right << epoch_version; // count of records - str << setw(10) << right << count; + str << std::setw(10) << std::right << count; - os << str.str() << endl; + os << str.str() << std::endl; // Provide comments on the version of DynAdjust that is creating this file os << "* "; output_createdby(os); - os << ". " << endl; + os << ". " << std::endl; os << "* "; output_version(os); - os << ". " << endl; + os << ". " << std::endl; os << "* "; output_build(os); - os << endl; + os << std::endl; } -void dna_comment(ostream& os, const string& comment) +void dna_comment(std::ostream& os, const std::string& comment) { - os << "* " << comment << endl; + os << "* " << comment << std::endl; } -void dnaproj_header(ostream& os, const string& comment) +void dnaproj_header(std::ostream& os, const std::string& comment) { // DynAdjust version os << "# " << comment << ". "; @@ -274,8 +274,8 @@ void dnaproj_header(ostream& os, const string& comment) output_build(os); } -void dnaproj_comment(ostream& os, const string& comment) +void dnaproj_comment(std::ostream& os, const std::string& comment) { - os << "# " << comment << endl; + os << "# " << comment << std::endl; } diff --git a/dynadjust/include/functions/dnastringfuncs.hpp b/dynadjust/include/functions/dnastringfuncs.hpp index 1b156ea3..a1617105 100644 --- a/dynadjust/include/functions/dnastringfuncs.hpp +++ b/dynadjust/include/functions/dnastringfuncs.hpp @@ -36,19 +36,17 @@ #include #include -using namespace std; - // Returns the number of fields with valid data int GetFields(char *line, char delim, bool multiple_delim_as_one, const char *fmt, ...); -void fileproc_help_header(string* msg); -void dynaml_header(ostream& os, const string& fileType, const string& referenceFrame, const string& epoch); -void dynaml_footer(ostream& os); -void dynaml_comment(ostream& os, const string& comment); -void dna_header(ostream& os, const string& fileVersion, const string& fileType, const string& reference_frame, const string& epoch_version, const size_t& count); -void dna_comment(ostream& os, const string& comment); -void dnaproj_header(ostream& os, const string& comment); -void dnaproj_comment(ostream& os, const string& comment); - -string snx_softwarehardware_text(); +void fileproc_help_header(std::string* msg); +void dynaml_header(std::ostream& os, const std::string& fileType, const std::string& referenceFrame, const std::string& epoch); +void dynaml_footer(std::ostream& os); +void dynaml_comment(std::ostream& os, const std::string& comment); +void dna_header(std::ostream& os, const std::string& fileVersion, const std::string& fileType, const std::string& reference_frame, const std::string& epoch_version, const size_t& count); +void dna_comment(std::ostream& os, const std::string& comment); +void dnaproj_header(std::ostream& os, const std::string& comment); +void dnaproj_comment(std::ostream& os, const std::string& comment); + +std::string snx_softwarehardware_text(); #endif // DNASTRINGFUNCS_HPP_ \ No newline at end of file diff --git a/dynadjust/include/functions/dnastrmanipfuncs.hpp b/dynadjust/include/functions/dnastrmanipfuncs.hpp index 40b8d635..e53dac47 100644 --- a/dynadjust/include/functions/dnastrmanipfuncs.hpp +++ b/dynadjust/include/functions/dnastrmanipfuncs.hpp @@ -30,7 +30,6 @@ #endif #include -#include #include #include @@ -48,7 +47,6 @@ #include #include -using namespace std; using boost::spirit::qi::double_; using boost::spirit::qi::float_; using boost::spirit::qi::parse; @@ -56,23 +54,23 @@ using boost::spirit::qi::parse; template T val_uint(const U& value) { - return lexical_cast(value); + return boost::lexical_cast(value); } template T valorno_uint(const U& value, T& var) { - if (iequals(value, "no")) + if (boost::iequals(value, "no")) return var = 0; var = 1; - return lexical_cast(value); + return boost::lexical_cast(value); } template T valorno_string(const T& value) { - if (iequals(value, "no")) + if (boost::iequals(value, "no")) return ""; return value; } @@ -80,29 +78,29 @@ T valorno_string(const T& value) template T yesno_uint(const U& value) { - if (iequals(value, "yes")) + if (boost::iequals(value, "yes")) return 1; - //if (iequals(value, "no")) + //if (boost::iequals(value, "no")) return 0; } template -string yesno_string(const T value) +std::string yesno_string(const T value) { if (value == 1) - return string("yes"); + return std::string("yes"); else - return string("no"); + return std::string("no"); } template -string bool_string(const T value) +std::string bool_string(const T value) { if (value) - return string("true"); + return std::string("true"); else - return string("false"); + return std::string("false"); } template @@ -117,7 +115,7 @@ T findandreplace(const T& source, const T& find, const T& replace) // convert to upper case template -void str_toupper(string& strtext) +void str_toupper(std::string& strtext) { transform(strtext.begin(), strtext.end(), strtext.begin(), (T(*)(T))toupper); } @@ -143,10 +141,10 @@ template T trimstr_(const T& Src, const T& c) { size_t p2 = Src.find_last_not_of(c); - if (p2 == string::npos) + if (p2 == std::string::npos) return std::string(); size_t p1 = Src.find_first_not_of(c); - if (p1 == string::npos) + if (p1 == std::string::npos) p1 = 0; return Src.substr(p1, (p2-p1)+1); } @@ -156,7 +154,7 @@ T trimstrleft_(const T& Src, const T& c) { size_t p2 = Src.length(); size_t p1 = Src.find_first_not_of(c); - if (p1 == string::npos) + if (p1 == std::string::npos) p1 = 0; return Src.substr(p1, (p2-p1)+1); } @@ -165,7 +163,7 @@ template T trimstrright_(const T& Src, const T& c) { size_t p2 = Src.find_last_not_of(c); - if (p2 == string::npos) + if (p2 == std::string::npos) return std::string(); return Src.substr(0, p2+1); } @@ -188,12 +186,12 @@ T trimstrright(const T& Src) { } template -string StringFromTW(const T& t, const U& width, const U& precision=0) +std::string StringFromTW(const T& t, const U& width, const U& precision=0) { - stringstream ss; + std::stringstream ss; // Assume number at precision prints within width - ss << setw(width) << fixed << right << setprecision(precision) << t; + ss << std::setw(width) << std::fixed << std::right << std::setprecision(precision) << t; int trim = (int)trimstr(ss.str()).length() - width; // Formatted string length is less than or equal to the fixed width @@ -213,7 +211,7 @@ string StringFromTW(const T& t, const U& width, const U& precision=0) if (width < UINT32(t < 0. ? 6 : 5)) { // insufficient space for scientific notation!!! - ss << setw(width) << string(width, '#'); + ss << std::setw(width) << std::string(width, '#'); return ss.str(); } @@ -223,29 +221,29 @@ string StringFromTW(const T& t, const U& width, const U& precision=0) if (prec1 > 0) prec1--; - int prec = min(precision, prec1); + int prec = std::min(precision, prec1); - ss << setw(width) << scientific << right << setprecision(prec) << t; + ss << std::setw(width) << std::scientific << std::right << std::setprecision(prec) << t; } else { int prec = precision - trim; if (prec < 0) prec = 0; - ss << setw(width) << fixed << right << setprecision(prec) << t; + ss << std::setw(width) << std::fixed << std::right << std::setprecision(prec) << t; } return ss.str(); } template -string StringFromT(const T& t, const int& precision=-1) +std::string StringFromT(const T& t, const int& precision=-1) { - stringstream ss; + std::stringstream ss; if (precision < 0) ss << t; else - ss << setprecision(precision) << fixed << t; + ss << std::setprecision(precision) << std::fixed << t; return ss.str(); } @@ -274,7 +272,7 @@ S double_string_width(const T value, const U& width) // http://tinodidriksen.com/2011/05/28/cpp-convert-string-to-double-speed/ template -T DoubleFromString(const string& str) +T DoubleFromString(const std::string& str) { T t(0.); parse(str.begin(), str.end(), double_, t); @@ -282,7 +280,7 @@ T DoubleFromString(const string& str) } template -T FloatFromString(const string& str) +T FloatFromString(const std::string& str) { T t(0.); parse(str.begin(), str.end(), float_, t); @@ -290,19 +288,19 @@ T FloatFromString(const string& str) } template -void DoubleFromString(T& t, const string& str) +void DoubleFromString(T& t, const std::string& str) { parse(str.begin(), str.end(), double_, t); } template -void FloatFromString(T& t, const string& str) +void FloatFromString(T& t, const std::string& str) { parse(str.begin(), str.end(), float_, t); } template -bool DoubleFromString_ZeroCheck(T& t, const string& str) +bool DoubleFromString_ZeroCheck(T& t, const std::string& str) { parse(str.begin(), str.end(), double_, t); if (fabs(t) < PRECISION_1E35) @@ -312,16 +310,16 @@ bool DoubleFromString_ZeroCheck(T& t, const string& str) template // signed -typename std::enable_if::value, T>::type LongFromString(const string& str) +typename std::enable_if::value, T>::type LongFromString(const std::string& str) { char* end(NULL); T t(strtol(str.c_str(), &end, 10)); if (*end) { - stringstream ss; + std::stringstream ss; ss << "String to long conversion error: non-convertible part: " << end; - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } return t; @@ -329,53 +327,53 @@ typename std::enable_if::value, T>::type LongFromString(const template // unsigned -typename std::enable_if::value, T>::type LongFromString(const string& str) +typename std::enable_if::value, T>::type LongFromString(const std::string& str) { char* end(NULL); T t(strtoul(str.c_str(), &end, 10)); if (*end) { - stringstream ss; + std::stringstream ss; ss << "String to long conversion error: non-convertible part: " << end; - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } return t; } //template -//T LongFromString(const string& str) +//T LongFromString(const std::string& str) //{ // char* end(NULL); // T t; -// string s(typeid(t).name()); +// std::string s(typeid(t).name()); // -// if (iequals(s, "unsigned int") || iequals(s, "unsigned long") || // msvc -// iequals(s, "j") || iequals(s, "m")) // gcc +// if (boost::iequals(s, "unsigned int") || boost::iequals(s, "unsigned long") || // msvc +// boost::iequals(s, "j") || boost::iequals(s, "m")) // gcc // t = strtoul(str.c_str(), &end, 10); -// else if (iequals(s, "int") || iequals(s, "long") || // msvc -// iequals(s, "i") || iequals(s, "l")) // gcc +// else if (boost::iequals(s, "int") || boost::iequals(s, "long") || // msvc +// boost::iequals(s, "i") || boost::iequals(s, "l")) // gcc // t = strtol(str.c_str(), &end, 10); // else // { -// stringstream ss; +// std::stringstream ss; // ss << "String to long conversion error: " << s << " is not an integer." << end; -// throw boost::enable_current_exception(runtime_error(ss.str())); +// throw boost::enable_current_exception(std::runtime_error(ss.str())); // } // // if (*end) // { -// stringstream ss; +// std::stringstream ss; // ss << "String to long conversion error: non-convertible part: " << end; -// throw boost::enable_current_exception(runtime_error(ss.str())); +// throw boost::enable_current_exception(std::runtime_error(ss.str())); // } // // return t; //} //template -//void LongFromString(T *l, const string& str) +//void LongFromString(T *l, const std::string& str) //{ // //*l = atol(str.c_str()); // @@ -383,41 +381,41 @@ typename std::enable_if::value, T>::type LongFromString(cons //} // template -void FromDmsString(T *d, const string& str) +void FromDmsString(T *d, const std::string& str) { DmstoDeg(atof(str.c_str()), d); } template -T FromDmsString(const string& str) +T FromDmsString(const std::string& str) { return DmstoDeg(atof(str.c_str())); } template -void RadFromDmsString(T *d, const string& str) +void RadFromDmsString(T *d, const std::string& str) { DmstoDeg(atof(str.c_str()), d); Radians(d); } template -void RadFromSecondsString(T *d, const string& str) +void RadFromSecondsString(T *d, const std::string& str) { *d = SecondstoRadians(atof(str.c_str())); } template -void SplitDelimitedString(const T& str, const T& separator, vector* tokenList) +void SplitDelimitedString(const T& str, const T& separator, std::vector* tokenList) { // use boost to extract stations from comma delimited string - typedef tokenizer > tokenizer; - char_separator sepa(separator.c_str()); - tokenizer tokens(str, sepa); + typedef boost::tokenizer > btokenizer; + boost::char_separator sepa(separator.c_str()); + btokenizer tokens(str, sepa); tokenList->clear(); try { for_each(tokens.begin(), tokens.end(), - [&tokenList](const string& s) { + [&tokenList](const std::string& s) { if (!trimstr(s).empty()) tokenList->push_back(trimstr(s)); }); diff --git a/dynadjust/include/functions/dnatemplatecalcfuncs.hpp b/dynadjust/include/functions/dnatemplatecalcfuncs.hpp index ff58e26e..db2ef3ad 100644 --- a/dynadjust/include/functions/dnatemplatecalcfuncs.hpp +++ b/dynadjust/include/functions/dnatemplatecalcfuncs.hpp @@ -36,7 +36,6 @@ #include #include #include -#include #include #include @@ -46,9 +45,6 @@ #include #include -using namespace std; -using namespace boost; - template U sumOfConsecutiveIntegers(const U& max, const U& min = 1) { diff --git a/dynadjust/include/functions/dnatemplatedatetimefuncs.hpp b/dynadjust/include/functions/dnatemplatedatetimefuncs.hpp index 9e4f33bc..eb60c75d 100644 --- a/dynadjust/include/functions/dnatemplatedatetimefuncs.hpp +++ b/dynadjust/include/functions/dnatemplatedatetimefuncs.hpp @@ -37,11 +37,6 @@ const UINT32 TIME_IMMEMORIAL = 1900; -using namespace std; -using namespace boost::timer; -using namespace boost::posix_time; -using namespace boost::gregorian; - // Boost implementation of gregorian calendar supports dates in the range 1400-Jan-01 to 9999-Dec-31. // Integer representation of these dates is 2232400 and 5373484, which appears to be the Julian Date. // GPS time begins on 6 January 1980 (2444245) @@ -54,21 +49,21 @@ using namespace boost::gregorian; //UINT32 itoday = today.day_number(); //stringstream str; -//const std::locale fmt(locale::classic(), new date_facet("%m/%d/%Y")); +//const std::locale fmt(std::locale::classic(), new date_facet("%m/%d/%Y")); //str.imbue(fmt); -//str << gpsday << endl; -//str << "Today: " << today.day_number() << endl; +//str << gpsday << std::endl; +//str << "Today: " << today.day_number() << std::endl; //str << -// static_cast(today.year()) << endl << -// static_cast(today.month()) << endl << -// static_cast(today.day()) << endl << endl; -//str << "GPS day: " << gpsday.day_number() << endl; +// static_cast(today.year()) << std::endl << +// static_cast(today.month()) << std::endl << +// static_cast(today.day()) << std::endl << std::endl; +//str << "GPS day: " << gpsday.day_number() << std::endl; //str << -// static_cast(gpsday.year()) << endl << -// static_cast(gpsday.month()) << endl << -// static_cast(gpsday.day()) << endl; +// static_cast(gpsday.year()) << std::endl << +// static_cast(gpsday.month()) << std::endl << +// static_cast(gpsday.day()) << std::endl; -//cout << str.str().c_str() << endl; +//cout << str.str().c_str() << std::endl; //TRACE("%s", str.str().c_str()); @@ -79,7 +74,7 @@ using namespace boost::gregorian; //TRACE("Today is %d days since the beginning of GPS time\n", str.str().c_str()); template -void dateSINEXFormat(T* os, const date& theDate, bool calculateSeconds=false) +void dateSINEXFormat(T* os, const boost::gregorian::date& theDate, bool calculateSeconds=false) { // Time stamps must be in the following format: YY:DOY:SECOD // where: @@ -90,32 +85,32 @@ void dateSINEXFormat(T* os, const date& theDate, bool calculateSeconds=false) // 95:120:86399 denotes April 30, 1995 (23:59:59UT). // - stringstream year; - time_facet* facet(new time_facet("%y")); + std::stringstream year; + boost::posix_time::time_facet* facet(new boost::posix_time::time_facet("%y")); - year.imbue(locale(year.getloc(), facet)); - ptime dateTime(theDate); + year.imbue(std::locale(year.getloc(), facet)); + boost::posix_time::ptime dateTime(theDate); year << dateTime; - stringstream dayofyear; - dayofyear << right << setw(3) << theDate.day_of_year(); - string dayofyearstr(dayofyear.str()); - dayofyearstr = findandreplace(dayofyearstr, " ", "0"); + std::stringstream dayofyear; + dayofyear << std::right << std::setw(3) << theDate.day_of_year(); + std::string dayofyearstr(dayofyear.str()); + dayofyearstr = findandreplace(dayofyearstr, " ", "0"); *os << - right << setw(2) << + std::right << std::setw(2) << year.str() << ":" << // year (YY) - right << setw(3) << + std::right << std::setw(3) << dayofyearstr << ":"; // day of year if (calculateSeconds) { - ptime currentTime(second_clock::local_time()); - time_duration timeInterval(currentTime - dateTime); + boost::posix_time::ptime currentTime(boost::posix_time::second_clock::local_time()); + boost::posix_time::time_duration timeInterval(currentTime - dateTime); - stringstream secondsofday; - secondsofday << left << setw(5) << timeInterval.total_seconds(); - *os << left << setw(5) << secondsofday.str(); + std::stringstream secondsofday; + secondsofday << std::left << std::setw(5) << timeInterval.total_seconds(); + *os << std::left << std::setw(5) << secondsofday.str(); return; } @@ -123,31 +118,31 @@ void dateSINEXFormat(T* os, const date& theDate, bool calculateSeconds=false) } template -U dateYear(const date& theDate) +U dateYear(const boost::gregorian::date& theDate) { return theDate.year(); } template -U dateDOY(const date& theDate) +U dateDOY(const boost::gregorian::date& theDate) { return theDate.day_of_year(); } template -U dateMonth(const date& theDate) +U dateMonth(const boost::gregorian::date& theDate) { return theDate.month(); } template -U dateDay(const date& theDate) +U dateDay(const boost::gregorian::date& theDate) { return theDate.day(); } template -U dateDaynumber(const date& theDate) +U dateDaynumber(const boost::gregorian::date& theDate) { return theDate.day_number(); } @@ -155,31 +150,31 @@ U dateDaynumber(const date& theDate) template U todayYear() { - return dateYear(day_clock::local_day()); + return dateYear(boost::gregorian::day_clock::local_day()); } template U todayMonth() { - return dateMonth(day_clock::local_day()); + return dateMonth(boost::gregorian::day_clock::local_day()); } template U todayDay() { - return dateDay(day_clock::local_day()); + return dateDay(boost::gregorian::day_clock::local_day()); } template U todayDaynumber() { - return dateDaynumber(day_clock::local_day()); + return dateDaynumber(boost::gregorian::day_clock::local_day()); } template T integerToDate(const U& integer) { - return date(integer); + return boost::gregorian::date(integer); } template @@ -191,7 +186,7 @@ T dateToInteger(const T& theDate) template T ymdToDate(const U& year, const U& month, const U& day) { - return date(year, month, day); + return boost::gregorian::date(year, month, day); } template @@ -290,7 +285,7 @@ void year_doy_Average(const T& start_year, const T& end_year, template // epochFrom -> epochTo -T yearFraction(const date& epoch) +T yearFraction(const boost::gregorian::date& epoch) { // Day of year, less 0.5 day correction to // bring to middle of day, divided by number @@ -322,7 +317,7 @@ T yearFraction(const date& epoch) template // Return as a double or float the decimal year -T referenceEpoch(const date& theDate) +T referenceEpoch(const boost::gregorian::date& theDate) { // Epoch of interest return yearFraction(theDate) + theDate.year(); @@ -338,58 +333,58 @@ T elapsedTime(const T& current_epoch, const T& reference_epoch) template // elapsedTime = current_epoch - reference_epoch -T elapsedTime(const T& current_epoch, const date& reference_epoch) +T elapsedTime(const T& current_epoch, const boost::gregorian::date& reference_epoch) { return elapsedTime(current_epoch, referenceEpoch(reference_epoch)); } template // elapsedTime = current_epoch - reference_epoch -T elapsedTime(const date& current_epoch, const T& reference_epoch) +T elapsedTime(const boost::gregorian::date& current_epoch, const T& reference_epoch) { return elapsedTime(referenceEpoch(current_epoch), reference_epoch); } template // elapsedTime = current_epoch - reference_epoch -T elapsedTime(const date& current_epoch, const date& reference_epoch) +T elapsedTime(const boost::gregorian::date& current_epoch, const boost::gregorian::date& reference_epoch) { return elapsedTime(referenceEpoch(current_epoch), referenceEpoch(reference_epoch)); } template // dateString = dd.mm.yyyy -date dateFromString_safe(const string& dateString) +boost::gregorian::date dateFromString_safe(const std::string& dateString) { - vector vdateList; - SplitDelimitedString(dateString, string("."), &vdateList); + std::vector vdateList; + SplitDelimitedString(dateString, std::string("."), &vdateList); try { // boost date requires input in the following order: year, month, day - return date( + return boost::gregorian::date( LongFromString(vdateList.at(2)), // year LongFromString(vdateList.at(1)), // month LongFromString(vdateList.at(0))); // day } - catch (runtime_error& e) + catch (std::runtime_error& e) { - stringstream ss; - ss << "dateFromString_safe(): Could not parse the date string \"" << dateString << "\"" << endl << - " Details: " << e.what() << endl; - throw boost::enable_current_exception(runtime_error(ss.str())); + std::stringstream ss; + ss << "dateFromString_safe(): Could not parse the date string \"" << dateString << "\"" << std::endl << + " Details: " << e.what() << std::endl; + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - stringstream ss; - ss << "dateFromString_safe(): Could not parse the date string \"" << dateString << "\"." << endl << - " Check that the epoch is formatted as dd.mm.yyyy" << endl; - throw boost::enable_current_exception(runtime_error(ss.str())); + std::stringstream ss; + ss << "dateFromString_safe(): Could not parse the date string \"" << dateString << "\"." << std::endl << + " Check that the epoch is formatted as dd.mm.yyyy" << std::endl; + throw boost::enable_current_exception(std::runtime_error(ss.str())); } } template // dateString = ddd yyyy -T dateFromStringstream_doy_year(S& date) +T dateFromStringstream_doy_year(S& thedate) { T parsedDate; // From boost_1_54_0/doc/html/date_time/date_time_io.html @@ -401,14 +396,14 @@ T dateFromStringstream_doy_year(S& date) // "2005" => 2005 // But! 94 => 2094! // So use %Y" - date.imbue(locale(date.getloc(), new date_input_facet("%j %Y"))); - date >> parsedDate; + thedate.imbue(std::locale(thedate.getloc(), new boost::gregorian::date_input_facet("%j %Y"))); + thedate >> parsedDate; return parsedDate; } template // dateString = ddd yyyy -T dateFromString_doy_year(S& date) +T dateFromString_doy_year(S& thedate) { T parsedDate; // From boost_1_54_0/doc/html/date_time/date_time_io.html @@ -420,20 +415,20 @@ T dateFromString_doy_year(S& date) // "2005" => 2005 // But! 94 => 2094! // So use %Y" - stringstream ss_date; - ss_date << date; - ss_date.imbue(locale(ss_date.getloc(), new date_input_facet("%j %Y"))); + std::stringstream ss_date; + ss_date << thedate; + ss_date.imbue(std::locale(ss_date.getloc(), new boost::gregorian::date_input_facet("%j %Y"))); ss_date >> parsedDate; return parsedDate; } template // date = yyyy.yyyyy -T dateFromDouble_doy_year(const D& date) +T dateFromDouble_doy_year(const D& thedate) { T parsedDate; - D year(floor(date)); - D year_fraction(date - year); + D year(floor(thedate)); + D year_fraction(thedate - year); D days_in_year(365.0); if (fmod(year, 400.) == 0) @@ -460,59 +455,59 @@ T dateFromDouble_doy_year(const D& date) // "2005" => 2005 // But! 94 => 2094! // So use %Y" - stringstream strdate; + std::stringstream strdate; if (idoy < 10.) strdate << "00"; else if (idoy < 100.) strdate << "0"; - strdate << idoy << " " << fixed << setprecision(0) << year; - strdate.imbue(locale(strdate.getloc(), new date_input_facet("%j %Y"))); + strdate << idoy << " " << std::fixed << std::setprecision(0) << year; + strdate.imbue(std::locale(strdate.getloc(), new boost::gregorian::date_input_facet("%j %Y"))); strdate >> parsedDate; return parsedDate; } template // dateString = dd.mm.yyyy -string stringFromDate(const T& date) +std::string stringFromDate(const T& thedate) { - stringstream ss; - ss.imbue(locale(ss.getloc(), new date_facet("%d.%m.%Y"))); + std::stringstream ss; + ss.imbue(std::locale(ss.getloc(), new boost::gregorian::date_facet("%d.%m.%Y"))); - ss << date; + ss << thedate; return ss.str(); } template // dateString = dd.mm.yyyy -string stringFromToday() +std::string stringFromToday() { - stringstream ss; - ss.imbue(locale(ss.getloc(), new date_facet("%d.%m.%Y"))); + std::stringstream ss; + ss.imbue(std::locale(ss.getloc(), new boost::gregorian::date_facet("%d.%m.%Y"))); - ss << date(day_clock::local_day()); + ss << boost::gregorian::date(boost::gregorian::day_clock::local_day()); return ss.str(); } template // dateString = dd.mm.yyyy -string stringFromDate(const T& date, const string& format) +std::string stringFromDate(const T& thedate, const std::string& format) { - stringstream ss; - ss.imbue(locale(ss.getloc(), new date_facet(format.c_str()))); + std::stringstream ss; + ss.imbue(std::locale(ss.getloc(), new boost::gregorian::date_facet(format.c_str()))); - ss << date; + ss << thedate; return ss.str(); } template // dateString = dd.mm.yyyy -T dateFromString(const string& dateString) +T dateFromString(const std::string& dateString) { // The following works well when dateString is "03.02.2013", but fails // if dateString is "3.2.2013". // //istringstream ss(dateString); - //ss.imbue(locale(std::locale::classic(), new gregorian::date_input_facet("%e.%m.%Y"))); + //ss.imbue(std::locale(std::locale::classic(), new boost::gregorian::date_input_facet("%e.%m.%Y"))); //T date; //ss >> date; //return date; @@ -524,8 +519,8 @@ T dateFromString(const string& dateString) // The flags marked with a hash sign (#) are implemented by system locale and are known to be missing on some platforms // Is today's date required? - if (iequals(dateString, "today")) - return dateFromString_safe(stringFromDate(T(day_clock::local_day()))); + if (boost::iequals(dateString, "today")) + return dateFromString_safe(stringFromDate(T(boost::gregorian::day_clock::local_day()))); // Parse manually. return dateFromString_safe(dateString); @@ -534,66 +529,66 @@ T dateFromString(const string& dateString) template // dateString = dd.mm.yyyy -string formattedDateStringFromNumericString(const string& dateString) +std::string formattedDateStringFromNumericString(const std::string& dateString) { - date date(dateFromString(dateString)); + boost::gregorian::date ddate(dateFromString(dateString)); - stringstream ss; - ss.imbue(locale(ss.getloc(), new date_facet("%A, %d %B %Y"))); + std::stringstream ss; + ss.imbue(std::locale(ss.getloc(), new boost::gregorian::date_facet("%A, %d %B %Y"))); - ss << date; + ss << ddate; return ss.str(); } template T formattedDateTimeString() { - stringstream datetime_ss, stream; - time_facet* p_time_output = new time_facet; - locale special_locale (locale(""), p_time_output); + std::stringstream datetime_ss, stream; + boost::posix_time::time_facet* p_time_output = new boost::posix_time::time_facet; + std::locale special_locale (std::locale(""), p_time_output); // special_locale takes ownership of the p_time_output facet datetime_ss.imbue (special_locale); (*p_time_output).format("%d-%m-%Y %X"); - datetime_ss << second_clock::local_time(); + datetime_ss << boost::posix_time::second_clock::local_time(); stream << datetime_ss.str().c_str(); return stream.str(); } template -S formatedElapsedTime(milliseconds* elapsed_time, S app_message) +S formatedElapsedTime(boost::posix_time::milliseconds* elapsed_time, S app_message) { - ostringstream ss_time; - ptime pt(ptime(gregorian::day_clock::local_day(), *elapsed_time)); + std::ostringstream ss_time; + boost::posix_time::ptime pt(boost::posix_time::ptime(boost::gregorian::day_clock::local_day(), *elapsed_time)); - if (*elapsed_time < seconds(3)) + if (*elapsed_time < boost::posix_time::seconds(3)) { - time_facet* facet(new time_facet("%s")); - ss_time.imbue(locale(ss_time.getloc(), facet)); + boost::posix_time::time_facet* facet(new boost::posix_time::time_facet("%s")); + ss_time.imbue(std::locale(ss_time.getloc(), facet)); ss_time.str(""); ss_time << pt << "s"; } - else if (*elapsed_time < seconds(61)) + else if (*elapsed_time < boost::posix_time::seconds(61)) { - time_facet* facet(new time_facet("%S")); - ss_time.imbue(locale(ss_time.getloc(), facet)); + boost::posix_time::time_facet* facet(new boost::posix_time::time_facet("%S")); + ss_time.imbue(std::locale(ss_time.getloc(), facet)); ss_time.str(""); ss_time << pt << "s"; } else - ss_time << seconds(static_cast(elapsed_time->total_seconds())); + ss_time << boost::posix_time::seconds(static_cast(elapsed_time->total_seconds())); - size_t pos = string::npos; - string time_message = ss_time.str(); - while ((pos = time_message.find("0s")) != string::npos) + size_t pos = std::string::npos; + std::string time_message = ss_time.str(); + while ((pos = time_message.find("0s")) != std::string::npos) time_message = time_message.substr(0, pos) + "s"; time_message = app_message + time_message + "."; - if ((pos = time_message.find(" 00.")) != string::npos) + if ((pos = time_message.find(" 00.")) != std::string::npos) time_message = time_message.replace(pos, 4, " 0."); - if ((pos = time_message.find(" 0.s")) != string::npos) + if ((pos = time_message.find(" 0.s")) != std::string::npos) time_message = time_message.replace(pos, 4, " 0s"); return time_message; diff --git a/dynadjust/include/functions/dnatemplatefuncs.hpp b/dynadjust/include/functions/dnatemplatefuncs.hpp index ec2d40c9..d309e837 100644 --- a/dynadjust/include/functions/dnatemplatefuncs.hpp +++ b/dynadjust/include/functions/dnatemplatefuncs.hpp @@ -34,7 +34,6 @@ #include #include #include -#include #include #include @@ -45,9 +44,6 @@ #include #include -using namespace std; -using namespace boost; - using namespace dynadjust::datum_parameters; using namespace dynadjust::measurements; @@ -120,7 +116,7 @@ void copy_if_all_occurrences(InputIterator begin, InputIterator end, Predicate p template void erase_if_impl(T* t, InputIterator begin, InputIterator end, Predicate pred) { - t->erase(remove_if(begin, end, pred), end); + t->erase(std::remove_if(begin, end, pred), end); } template @@ -138,8 +134,8 @@ void erase_if(T* t, Predicate pred) template void strip_duplicates(T& t) { - sort(t.begin(), t.end()); - typename T::iterator it_newend(unique(t.begin(), t.end())); + std::sort(t.begin(), t.end()); + typename T::iterator it_newend(std::unique(t.begin(), t.end())); if (it_newend != t.end()) t.resize(it_newend - t.begin()); } @@ -152,7 +148,7 @@ void strip_duplicates(T* t) // template function for output to file or cout template -void outputObject(T t, ostream &os) { os << t; } +void outputObject(T t, std::ostream &os) { os << t; } //// template functor for equality of (type)value //template @@ -185,20 +181,42 @@ class value_equals { value_equals (const V& v) : value(v) { } // comparison - bool operator() (pair elem) { + bool operator() (std::pair elem) { return elem.second == value; } }; +// insert leading zeros into date string +template +S FormatDateString(const S& datestring) +{ + std::vector tokenList; + S delimiter("."); + SplitDelimitedString(datestring, delimiter, &tokenList); + + if (tokenList.size() < 3) + return ""; + + if (tokenList.at(0).size() < 2) + tokenList.at(0).insert(0, "0"); + if (tokenList.at(1).size() < 2) + tokenList.at(1).insert(0, "0"); + + std::stringstream datess; + datess << tokenList.at(0) << "." << tokenList.at(1) << "." << tokenList.at(2); + return datess.str(); +} + + //delimiter should be a space, commar or similar // Expected input is -38 43 28.24255 // Use of NSEW to indicate negative/positive hemispheres // is not supported yet. template -T ParseDmsString(const string& dmsString, const string& delimiter) +T ParseDmsString(const std::string& dmsString, const std::string& delimiter) { - vector tokenList; - SplitDelimitedString(dmsString, delimiter, &tokenList); + std::vector tokenList; + SplitDelimitedString(dmsString, delimiter, &tokenList); // "-38 43 28.24255" // "-38" -> 38.000000000 @@ -231,26 +249,26 @@ T ParseDmsString(const string& dmsString, const string& delimiter) return dms; } - + //symbols is only optional if withSpaces is true template -string FormatDmsString(const T& dDegMinSec, const int precision, bool withSpaces, bool withSymbols) +std::string FormatDmsString(const T& dDegMinSec, const int precision, bool withSpaces, bool withSymbols) { - stringstream ss; - ss << fixed << setprecision(precision) << dDegMinSec; + std::stringstream ss; + ss << std::fixed << std::setprecision(precision) << dDegMinSec; - // No symbols or spaces? return string + // No symbols or spaces? return std::string if (!withSpaces && !withSymbols) return ss.str(); - string strNumber(ss.str()), strBuf(ss.str()); - + std::string strNumber(ss.str()), strBuf(ss.str()); + size_t decimal(0); int precision_fmt(precision); - int minute_symbol_loc(withSymbols?4:3), second_symbol_loc(withSymbols?8:6); - + int minute_symbol_loc(withSymbols ? 4 : 3), second_symbol_loc(withSymbols ? 8 : 6); + // Add symbols for degrees minutes and seconds - if ((decimal = strNumber.find('.')) != string::npos) + if ((decimal = strNumber.find('.')) != std::string::npos) { // found a decimal point! if (decimal == 0) // decimal point at start, ie >> .0123 @@ -261,47 +279,47 @@ string FormatDmsString(const T& dDegMinSec, const int precision, bool withSpaces // add spaces if (withSpaces) - strBuf.replace(decimal, 1, " "); - + strBuf.replace(decimal, 1, " "); + // add symbols if (withSymbols) strBuf.insert(decimal, "\260"); // 272 is the degree symbol - + // add zero after "tens" minute or "tens" second value if (precision == 1 || precision == 3) { strBuf += "0"; precision_fmt++; } - + if (precision > 2) { // add spaces if (withSpaces) - strBuf.insert((decimal+minute_symbol_loc), " "); - + strBuf.insert((decimal + minute_symbol_loc), " "); + // add symbols if (withSymbols) - strBuf.insert((decimal+minute_symbol_loc), "\222"); //minutes symbol + strBuf.insert((decimal + minute_symbol_loc), "\222"); //minutes symbol } if (precision == 2 && withSymbols) - strBuf += "\222"; - + strBuf += "\222"; + if (precision > 4) { - strBuf.insert((decimal+second_symbol_loc), "."); + strBuf.insert((decimal + second_symbol_loc), "."); if (withSymbols) strBuf += "\224"; } - + if (precision == 4 && withSymbols) - strBuf += "\224"; - } + strBuf += "\224"; + } else if (withSymbols) strBuf += "\260"; // couldn't find a decimal point, so append the degree symbol - - + + //// Show North and South notation //if (strNumber[0] == '-' || strNumber[0] == 's' || strNumber[0] == 'S' || // strNumber[0] == 'w' || strNumber[0] == 'W') @@ -327,19 +345,19 @@ string FormatDmsString(const T& dDegMinSec, const int precision, bool withSpaces //symbols is only optional if withSpaces is true template -string FormatDnaDmsString(const T& dDegMinSec, int precision) +std::string FormatDnaDmsString(const T& dDegMinSec, int precision) { - stringstream ss; + std::stringstream ss; if (precision < 4) precision = 4; - ss << fixed << setprecision(precision) << dDegMinSec; - string strBuf(ss.str()); + ss << std::fixed << std::setprecision(precision) << dDegMinSec; + std::string strBuf(ss.str()); size_t decimal(0); - string d, m, s; + std::string d, m, s; // Format degrees minutes and seconds - if ((decimal = strBuf.find('.')) != string::npos) + if ((decimal = strBuf.find('.')) != std::string::npos) { // found a decimal point! if (decimal == 0) // decimal point at start, ie >> .0123 @@ -381,7 +399,7 @@ string FormatDnaDmsString(const T& dDegMinSec, int precision) } ss.str(""); - ss << setw(3) << d << setw(3) << right << m << " " << setw(6) << s; + ss << std::setw(3) << d << std::setw(3) << std::right << m << " " << std::setw(6) << s; strBuf = ss.str(); } @@ -407,7 +425,7 @@ class CompareClusterID public: CompareClusterID() : _m(0), _id(0) {} - CompareClusterID(const vector* m, const U& id=0) + CompareClusterID(const std::vector* m, const U& id=0) : _m(m), _id(id) {} // used for lower_bound, upper_bound, etc... bool operator()(const boost::shared_ptr lhs, const U& rhs) { @@ -434,11 +452,11 @@ class CompareClusterID bool operator()(const U& id) { return _m->at(id).clusterID == _id; } - inline void SetAMLPointer(const vector* m) { _m = m; } + inline void SetAMLPointer(const std::vector* m) { _m = m; } inline void SetClusterID(const U& id) { _id = id; } inline bool IsAMLPointerNull() { return _m == NULL; } private: - const vector* _m; + const std::vector* _m; U _id; }; @@ -452,7 +470,7 @@ template class CompareMeasCount { public: - CompareMeasCount(const vector* a) : _a(a) {} + CompareMeasCount(const std::vector* a) : _a(a) {} // used for lower_bound, upper_bound, etc... bool operator()(const boost::shared_ptr lhs, const U& rhs) { @@ -467,10 +485,10 @@ class CompareMeasCount return _a->at(lhs).GetAMLStnIndex() < _a->at(rhs).GetAMLStnIndex(); return _a->at(lhs).GetAssocMsrCount() < _a->at(rhs).GetAssocMsrCount(); } - inline void SetASLPointer(const vector* a) { _a = a; } + inline void SetASLPointer(const std::vector* a) { _a = a; } inline bool IsASLPointerNull() { return _a == NULL; } private: - const vector* _a; + const std::vector* _a; }; @@ -478,7 +496,7 @@ template class CompareMeasCount2 { public: - CompareMeasCount2(const vector* a) : _a(a) {} + CompareMeasCount2(const std::vector* a) : _a(a) {} bool operator()(const U& lhs, const U& rhs) { @@ -487,7 +505,7 @@ class CompareMeasCount2 return _a->at(lhs).get()->GetAssocMsrCount() < _a->at(rhs).get()->GetAssocMsrCount(); } private: - const vector* _a; + const std::vector* _a; }; @@ -495,7 +513,7 @@ template class CompareValidity { public: - CompareValidity(const vector* a, const UINT16& v) : _a(a), _v(v) {} + CompareValidity(const std::vector* a, const UINT16& v) : _a(a), _v(v) {} // used for lower_bound, upper_bound, etc... bool operator()(const U& asl_index) { @@ -506,7 +524,7 @@ class CompareValidity return _a->at(lhs).Validity() < _a->at(rhs).Validity(); } private: - const vector* _a; + const std::vector* _a; const UINT16 _v; }; @@ -516,7 +534,7 @@ template class CompareMeasStart { public: - CompareMeasStart(vector* m, MEASUREMENT_START id=xMeas) + CompareMeasStart(std::vector* m, MEASUREMENT_START id=xMeas) : _m(m), _id(id) {} bool operator()(const U& freemsr_index) { return _m->at(freemsr_index).measStart == _id; @@ -525,7 +543,7 @@ class CompareMeasStart return _m->at(lhs).measStart < _m->at(rhs).measStart; } private: - vector* _m; + std::vector* _m; MEASUREMENT_START _id; }; @@ -534,7 +552,7 @@ template class CompareNonMeasStart { public: - CompareNonMeasStart(vector* m, MEASUREMENT_START id=xMeas) + CompareNonMeasStart(std::vector* m, MEASUREMENT_START id=xMeas) : _m(m), _id(id) {} bool operator()(const U& freemsr_index) { return _m->at(freemsr_index).measStart != _id; @@ -543,7 +561,7 @@ class CompareNonMeasStart return _m->at(lhs).measStart < _m->at(rhs).measStart; } private: - vector* _m; + std::vector* _m; MEASUREMENT_START _id; }; @@ -552,13 +570,13 @@ template class CompareMsrFileOrder { public: - CompareMsrFileOrder(vector* m) + CompareMsrFileOrder(std::vector* m) : _m(m) {} bool operator()(const U& lhs, const U& rhs) { return _m->at(lhs).fileOrder < _m->at(rhs).fileOrder; } private: - vector* _m; + std::vector* _m; }; @@ -574,18 +592,35 @@ class CompareBlockStationMapUnique_byBlock } }; +// used to sort nearby stations +template +class CompareBlockStationMapUnique_Station { +public: + bool operator()(const T& left, const T& right) { + return left.first.first < right.first.first; + } + + bool operator()(const U& left, const T& right) { + return left < right.first.first; + } + + bool operator()(const T& left, const U& right) { + return left.first.first < right; + } +}; + // S = station_t, U = u32u32_double_pair template class CompareBlockStationMapUnique_byFileOrder { public: - CompareBlockStationMapUnique_byFileOrder(vector* s) + CompareBlockStationMapUnique_byFileOrder(std::vector* s) : _s(s) {} bool operator()(const U& left, const U& right) { return _s->at(left.first.first).fileOrder < _s->at(right.first.first).fileOrder; } private: - vector* _s; + std::vector* _s; }; // M = measurement_t, U = UINT32 @@ -593,9 +628,9 @@ template class CompareMeasType_PairFirst { public: - CompareMeasType_PairFirst(vector* m) + CompareMeasType_PairFirst(std::vector* m) : _m(m) {} - bool operator()(const pair >& lhs, const pair >& rhs) { + bool operator()(const std::pair >& lhs, const std::pair >& rhs) { if (_m->at(lhs.first).measType == _m->at(rhs.first).measType) { if (_m->at(lhs.first).station1 == _m->at(rhs.first).station1) @@ -610,7 +645,7 @@ class CompareMeasType_PairFirst return _m->at(lhs.first).measType < _m->at(rhs.first).measType; } private: - vector* _m; + std::vector* _m; }; @@ -619,9 +654,9 @@ template class CompareMeasFromStn_PairFirst { public: - CompareMeasFromStn_PairFirst(vector* m) + CompareMeasFromStn_PairFirst(std::vector* m) : _m(m) {} - bool operator()(const pair >& lhs, const pair >& rhs) { + bool operator()(const std::pair >& lhs, const std::pair >& rhs) { if (_m->at(lhs.first).station1 == _m->at(rhs.first).station1) { if (_m->at(lhs.first).measType == _m->at(rhs.first).measType) @@ -636,7 +671,7 @@ class CompareMeasFromStn_PairFirst return _m->at(lhs.first).station1 < _m->at(rhs.first).station1; } private: - vector* _m; + std::vector* _m; }; @@ -645,9 +680,9 @@ template class CompareMeasToStn_PairFirst { public: - CompareMeasToStn_PairFirst(vector* m) + CompareMeasToStn_PairFirst(std::vector* m) : _m(m) {} - bool operator()(const pair >& lhs, const pair >& rhs) { + bool operator()(const std::pair >& lhs, const std::pair >& rhs) { if (_m->at(lhs.first).station2 == _m->at(rhs.first).station2) { if (_m->at(lhs.first).measType == _m->at(rhs.first).measType) @@ -662,7 +697,7 @@ class CompareMeasToStn_PairFirst return _m->at(lhs.first).station2 < _m->at(rhs.first).station2; } private: - vector* _m; + std::vector* _m; }; @@ -727,30 +762,165 @@ template class CompareMeasValue_PairFirst { public: - CompareMeasValue_PairFirst(vector* m) + CompareMeasValue_PairFirst(std::vector* m) : _m(m) {} - bool operator()(const pair >& lhs, const pair >& rhs) { - if (isCompoundMeas(_m->at(lhs.first).measType) && notCompoundMeas(_m->at(rhs.first).measType)) + bool operator()(const std::pair >& lhs, const std::pair >& rhs) { + if (isCompoundMeasAll(_m->at(lhs.first).measType) && notCompoundMeasAll(_m->at(rhs.first).measType)) { - double lhsValue(magnitude(_m->at(lhs.first).term1, _m->at(lhs.first+1).term1, _m->at(lhs.first+2).term1)); - return lhsValue > _m->at(rhs.first).term1; + double lhsValue = 0.0; + U increment(0); + UINT32 vector_count(_m->at(lhs.first).vectorCount1), covariance_count; + + // Get the largest LHS value from the cluster + switch (_m->at(lhs.first).measType) + { + case 'G': + case 'X': + case 'Y': + for (UINT32 g(0); g < vector_count; ++g) + { + covariance_count = _m->at(lhs.first + increment).vectorCount2; + if (fabs(_m->at(lhs.first + increment).term1) > lhsValue) // X + lhsValue = fabs(_m->at(lhs.first + increment).term1); + if (fabs(_m->at(lhs.first + increment + 1).term1) > lhsValue) // Y + lhsValue = fabs(_m->at(lhs.first + increment + 1).term1); + if (fabs(_m->at(lhs.first + increment + 2).term1) > lhsValue) // Z + lhsValue = fabs(_m->at(lhs.first + increment + 2).term1); + increment += 3; // move to covariances + increment += (covariance_count * 3); // skip over covariances + } + break; + case 'D': + //TRACE("%.9f\n", radians_to_degrees_(_m->at(lhs.first).term1)); + lhsValue = fabs(_m->at(lhs.first).term1); + for (UINT32 d(1); d < vector_count; ++d) + { + //TRACE("%.9f\n", _m->at(lhs.first+d).term1); + if (fabs(_m->at(lhs.first + d).term1) > lhsValue) + lhsValue = fabs(_m->at(lhs.first + d).term1); + } + break; + } + //TRACE("LHS: %.2f; RHS: %.2f\n", fabs(lhsValue), fabs(_m->at(rhs.first).term1)); + return fabs(lhsValue) > fabs(_m->at(rhs.first).term1); } - else if (notCompoundMeas(_m->at(lhs.first).measType) && isCompoundMeas(_m->at(rhs.first).measType)) + else if (notCompoundMeasAll(_m->at(lhs.first).measType) && isCompoundMeasAll(_m->at(rhs.first).measType)) { - double rhsValue(magnitude(_m->at(rhs.first).term1, _m->at(rhs.first+1).term1, _m->at(rhs.first+2).term1)); - return _m->at(lhs.first).term1 > rhsValue; + double rhsValue = 0.0; + U increment(0); + UINT32 vector_count(_m->at(rhs.first).vectorCount1), covariance_count; + + // Get the largest RHS value from the cluster + switch (_m->at(rhs.first).measType) + { + case 'G': + case 'X': + case 'Y': + for (UINT32 g(0); g < vector_count; ++g) + { + covariance_count = _m->at(rhs.first + increment).vectorCount2; + if (fabs(_m->at(rhs.first + increment).term1) > rhsValue) // X + rhsValue = fabs(_m->at(rhs.first + increment).term1); + if (fabs(_m->at(rhs.first + increment + 1).term1) > rhsValue) // Y + rhsValue = fabs(_m->at(rhs.first + increment + 1).term1); + if (fabs(_m->at(rhs.first + increment + 2).term1) > rhsValue) // Z + rhsValue = fabs(_m->at(rhs.first + increment + 2).term1); + increment += 3; // move to covariances + increment += (covariance_count * 3); // skip over covariances + } + break; + case 'D': + //TRACE("%.9f\n", radians_to_degrees_(_m->at(rhs.first).term1)); + rhsValue = fabs(_m->at(rhs.first).term1); + for (UINT32 d(1); d < vector_count; ++d) + { + //TRACE("%.9f\n", _m->at(lhs.first+d).term1); + if (fabs(_m->at(rhs.first + d).term1) > rhsValue) + rhsValue = fabs(_m->at(rhs.first + d).term1); + } + break; + } + + return fabs(_m->at(lhs.first).term1) > fabs(rhsValue); } - else if (isCompoundMeas(_m->at(lhs.first).measType) && isCompoundMeas(_m->at(rhs.first).measType)) + else if (isCompoundMeasAll(_m->at(lhs.first).measType) && isCompoundMeasAll(_m->at(rhs.first).measType)) { - double lhsValue(magnitude(_m->at(lhs.first).term1, _m->at(lhs.first+1).term1, _m->at(lhs.first+2).term1)); - double rhsValue(magnitude(_m->at(rhs.first).term1, _m->at(rhs.first+1).term1, _m->at(rhs.first+2).term1)); - return lhsValue > rhsValue; + double lhsValue = 0.0; + U increment(0); + UINT32 vector_count(_m->at(lhs.first).vectorCount1), covariance_count; + + // Get the largest LHS value from the cluster + switch (_m->at(lhs.first).measType) + { + case 'G': + case 'X': + case 'Y': + for (UINT32 g(0); g < vector_count; ++g) + { + covariance_count = _m->at(lhs.first + increment).vectorCount2; + if (fabs(_m->at(lhs.first + increment).term1) > lhsValue) // X + lhsValue = fabs(_m->at(lhs.first + increment).term1); + if (fabs(_m->at(lhs.first + increment + 1).term1) > lhsValue) // Y + lhsValue = fabs(_m->at(lhs.first + increment + 1).term1); + if (fabs(_m->at(lhs.first + increment + 2).term1) > lhsValue) // Z + lhsValue = fabs(_m->at(lhs.first + increment + 2).term1); + increment += 3; // move to covariances + increment += (covariance_count * 3); // skip over covariances + } + break; + case 'D': + //TRACE("%.9f\n", radians_to_degrees_(_m->at(lhs.first).term1)); + lhsValue = fabs(_m->at(lhs.first).term1); + for (UINT32 d(1); d < vector_count; ++d) + { + //TRACE("%.9f\n", _m->at(lhs.first+d).term1); + if (fabs(_m->at(lhs.first + d).term1) > lhsValue) + lhsValue = fabs(_m->at(lhs.first + d).term1); + } + break; + } + + double rhsValue = 0.0; + increment = 0; + vector_count = _m->at(rhs.first).vectorCount1; + + // Get the largest RHS value from the cluster + switch (_m->at(rhs.first).measType) + { + case 'G': + case 'X': + case 'Y': + for (UINT32 g(0); g < vector_count; ++g) + { + covariance_count = _m->at(rhs.first + increment).vectorCount2; + if (fabs(_m->at(rhs.first + increment).term1) > rhsValue) // X + rhsValue = fabs(_m->at(rhs.first + increment).term1); + if (fabs(_m->at(rhs.first + increment + 1).term1) > rhsValue) // Y + rhsValue = fabs(_m->at(rhs.first + increment + 1).term1); + if (fabs(_m->at(rhs.first + increment + 2).term1) > rhsValue) // Z + rhsValue = fabs(_m->at(rhs.first + increment + 2).term1); + increment += 3; // move to covariances + increment += (covariance_count * 3); // skip over covariances + } + break; + case 'D': + //TRACE("%.9f\n", radians_to_degrees_(_m->at(rhs.first).term1)); + rhsValue = fabs(_m->at(rhs.first).term1); + for (UINT32 d(1); d < vector_count; ++d) + { + //TRACE("%.9f\n", _m->at(lhs.first+d).term1); + if (fabs(_m->at(rhs.first + d).term1) > rhsValue) + rhsValue = fabs(_m->at(rhs.first + d).term1); + } + } + + return fabs(lhsValue) > fabs(rhsValue); } else - return _m->at(lhs.first).term1 > _m->at(rhs.first).term1; + return fabs(_m->at(lhs.first).term1) > fabs(_m->at(rhs.first).term1); } private: - vector* _m; + std::vector* _m; }; @@ -759,30 +929,165 @@ template class CompareMeasResidual_PairFirst { public: - CompareMeasResidual_PairFirst(vector* m) - : _m(m) {} - bool operator()(const pair >& lhs, const pair >& rhs) { - if (isCompoundMeas(_m->at(lhs.first).measType) && notCompoundMeas(_m->at(rhs.first).measType)) + CompareMeasResidual_PairFirst(std::vector* m) + : _m(m) {} + bool operator()(const std::pair >& lhs, const std::pair >& rhs) { + if (isCompoundMeasAll(_m->at(lhs.first).measType) && notCompoundMeasAll(_m->at(rhs.first).measType)) { - double lhsValue(magnitude(_m->at(lhs.first).measCorr, _m->at(lhs.first+1).measCorr, _m->at(lhs.first+2).measCorr)); - return lhsValue > _m->at(rhs.first).measCorr; + double lhsValue = 0.0; + U increment(0); + UINT32 vector_count(_m->at(lhs.first).vectorCount1), covariance_count; + + // Get the largest LHS value from the cluster + switch (_m->at(lhs.first).measType) + { + case 'G': + case 'X': + case 'Y': + for (UINT32 g(0); g < vector_count; ++g) + { + covariance_count = _m->at(lhs.first + increment).vectorCount2; + if (fabs(_m->at(lhs.first + increment).measCorr) > lhsValue) // X + lhsValue = fabs(_m->at(lhs.first + increment).measCorr); + if (fabs(_m->at(lhs.first + increment + 1).measCorr) > lhsValue) // Y + lhsValue = fabs(_m->at(lhs.first + increment + 1).measCorr); + if (fabs(_m->at(lhs.first + increment + 2).measCorr) > lhsValue) // Z + lhsValue = fabs(_m->at(lhs.first + increment + 2).measCorr); + increment += 3; // move to covariances + increment += (covariance_count * 3); // skip over covariances + } + break; + case 'D': + //TRACE("%.9f\n", radians_to_degrees_(_m->at(lhs.first).term1)); + lhsValue = fabs(_m->at(lhs.first).measCorr); + for (UINT32 d(1); d < vector_count; ++d) + { + //TRACE("%.9f\n", _m->at(lhs.first+d).term1); + if (fabs(_m->at(lhs.first + d).measCorr) > lhsValue) + lhsValue = fabs(_m->at(lhs.first + d).measCorr); + } + break; + } + //TRACE("LHS: %.2f; RHS: %.2f\n", fabs(lhsValue), fabs(_m->at(rhs.first).measCorr)); + return fabs(lhsValue) > fabs(_m->at(rhs.first).measCorr); } - else if (notCompoundMeas(_m->at(lhs.first).measType) && isCompoundMeas(_m->at(rhs.first).measType)) + else if (notCompoundMeasAll(_m->at(lhs.first).measType) && isCompoundMeasAll(_m->at(rhs.first).measType)) { - double rhsValue(magnitude(_m->at(rhs.first).measCorr, _m->at(rhs.first+1).measCorr, _m->at(rhs.first+2).measCorr)); - return _m->at(lhs.first).measCorr > rhsValue; + double rhsValue = 0.0; + U increment(0); + UINT32 vector_count(_m->at(rhs.first).vectorCount1), covariance_count; + + // Get the largest RHS value from the cluster + switch (_m->at(rhs.first).measType) + { + case 'G': + case 'X': + case 'Y': + for (UINT32 g(0); g < vector_count; ++g) + { + covariance_count = _m->at(rhs.first + increment).vectorCount2; + if (fabs(_m->at(rhs.first + increment).measCorr) > rhsValue) // X + rhsValue = fabs(_m->at(rhs.first + increment).measCorr); + if (fabs(_m->at(rhs.first + increment + 1).measCorr) > rhsValue) // Y + rhsValue = fabs(_m->at(rhs.first + increment + 1).measCorr); + if (fabs(_m->at(rhs.first + increment + 2).measCorr) > rhsValue) // Z + rhsValue = fabs(_m->at(rhs.first + increment + 2).measCorr); + increment += 3; // move to covariances + increment += (covariance_count * 3); // skip over covariances + } + break; + case 'D': + //TRACE("%.9f\n", radians_to_degrees_(_m->at(rhs.first).term1)); + rhsValue = fabs(_m->at(rhs.first).measCorr); + for (UINT32 d(1); d < vector_count; ++d) + { + //TRACE("%.9f\n", _m->at(lhs.first+d).term1); + if (fabs(_m->at(rhs.first + d).measCorr) > rhsValue) + rhsValue = fabs(_m->at(rhs.first + d).measCorr); + } + break; + } + + return fabs(_m->at(lhs.first).measCorr) > fabs(rhsValue); } - else if (isCompoundMeas(_m->at(lhs.first).measType) && isCompoundMeas(_m->at(rhs.first).measType)) + else if (isCompoundMeasAll(_m->at(lhs.first).measType) && isCompoundMeasAll(_m->at(rhs.first).measType)) { - double lhsValue(magnitude(_m->at(lhs.first).measCorr, _m->at(lhs.first+1).measCorr, _m->at(lhs.first+2).measCorr)); - double rhsValue(magnitude(_m->at(rhs.first).measCorr, _m->at(rhs.first+1).measCorr, _m->at(rhs.first+2).measCorr)); - return lhsValue > rhsValue; + double lhsValue = 0.0; + U increment(0); + UINT32 vector_count(_m->at(lhs.first).vectorCount1), covariance_count; + + // Get the largest LHS value from the cluster + switch (_m->at(lhs.first).measType) + { + case 'G': + case 'X': + case 'Y': + for (UINT32 g(0); g < vector_count; ++g) + { + covariance_count = _m->at(lhs.first + increment).vectorCount2; + if (fabs(_m->at(lhs.first + increment).measCorr) > lhsValue) // X + lhsValue = fabs(_m->at(lhs.first + increment).measCorr); + if (fabs(_m->at(lhs.first + increment + 1).measCorr) > lhsValue) // Y + lhsValue = fabs(_m->at(lhs.first + increment + 1).measCorr); + if (fabs(_m->at(lhs.first + increment + 2).measCorr) > lhsValue) // Z + lhsValue = fabs(_m->at(lhs.first + increment + 2).measCorr); + increment += 3; // move to covariances + increment += (covariance_count * 3); // skip over covariances + } + break; + case 'D': + //TRACE("%.9f\n", radians_to_degrees_(_m->at(lhs.first).term1)); + lhsValue = fabs(_m->at(lhs.first).measCorr); + for (UINT32 d(1); d < vector_count; ++d) + { + //TRACE("%.9f\n", _m->at(lhs.first+d).term1); + if (fabs(_m->at(lhs.first + d).measCorr) > lhsValue) + lhsValue = fabs(_m->at(lhs.first + d).measCorr); + } + break; + } + + double rhsValue = 0.0; + increment = 0; + vector_count = _m->at(rhs.first).vectorCount1; + + // Get the largest RHS value from the cluster + switch (_m->at(rhs.first).measType) + { + case 'G': + case 'X': + case 'Y': + for (UINT32 g(0); g < vector_count; ++g) + { + covariance_count = _m->at(rhs.first + increment).vectorCount2; + if (fabs(_m->at(rhs.first + increment).measCorr) > rhsValue) // X + rhsValue = fabs(_m->at(rhs.first + increment).measCorr); + if (fabs(_m->at(rhs.first + increment + 1).measCorr) > rhsValue) // Y + rhsValue = fabs(_m->at(rhs.first + increment + 1).measCorr); + if (fabs(_m->at(rhs.first + increment + 2).measCorr) > rhsValue) // Z + rhsValue = fabs(_m->at(rhs.first + increment + 2).measCorr); + increment += 3; // move to covariances + increment += (covariance_count * 3); // skip over covariances + } + break; + case 'D': + //TRACE("%.9f\n", radians_to_degrees_(_m->at(rhs.first).term1)); + rhsValue = fabs(_m->at(rhs.first).measCorr); + for (UINT32 d(1); d < vector_count; ++d) + { + //TRACE("%.9f\n", _m->at(lhs.first+d).term1); + if (fabs(_m->at(rhs.first + d).measCorr) > rhsValue) + rhsValue = fabs(_m->at(rhs.first + d).measCorr); + } + } + + return fabs(lhsValue) > fabs(rhsValue); } else - return _m->at(lhs.first).measCorr > _m->at(rhs.first).measCorr; + return fabs(_m->at(lhs.first).measCorr) > fabs(_m->at(rhs.first).measCorr); } private: - vector* _m; + std::vector* _m; }; @@ -791,30 +1096,165 @@ template class CompareMeasAdjSD_PairFirst { public: - CompareMeasAdjSD_PairFirst(vector* m) - : _m(m) {} - bool operator()(const pair >& lhs, const pair >& rhs) { - if (isCompoundMeas(_m->at(lhs.first).measType) && notCompoundMeas(_m->at(rhs.first).measType)) + CompareMeasAdjSD_PairFirst(std::vector* m) + : _m(m) {} + bool operator()(const std::pair >& lhs, const std::pair >& rhs) { + if (isCompoundMeasAll(_m->at(lhs.first).measType) && notCompoundMeasAll(_m->at(rhs.first).measType)) { - double lhsValue(magnitude(_m->at(lhs.first).measAdjPrec, _m->at(lhs.first+1).measAdjPrec, _m->at(lhs.first+2).measAdjPrec)); - return lhsValue > _m->at(rhs.first).measAdjPrec; + double lhsValue = 0.0; + U increment(0); + UINT32 vector_count(_m->at(lhs.first).vectorCount1), covariance_count; + + // Get the largest LHS value from the cluster + switch (_m->at(lhs.first).measType) + { + case 'G': + case 'X': + case 'Y': + for (UINT32 g(0); g < vector_count; ++g) + { + covariance_count = _m->at(lhs.first + increment).vectorCount2; + if (fabs(_m->at(lhs.first + increment).measAdjPrec) > lhsValue) // X + lhsValue = fabs(_m->at(lhs.first + increment).measAdjPrec); + if (fabs(_m->at(lhs.first + increment + 1).measAdjPrec) > lhsValue) // Y + lhsValue = fabs(_m->at(lhs.first + increment + 1).measAdjPrec); + if (fabs(_m->at(lhs.first + increment + 2).measAdjPrec) > lhsValue) // Z + lhsValue = fabs(_m->at(lhs.first + increment + 2).measAdjPrec); + increment += 3; // move to covariances + increment += (covariance_count * 3); // skip over covariances + } + break; + case 'D': + //TRACE("%.9f\n", radians_to_degrees_(_m->at(lhs.first).term1)); + lhsValue = fabs(_m->at(lhs.first).measAdjPrec); + for (UINT32 d(1); d < vector_count; ++d) + { + //TRACE("%.9f\n", _m->at(lhs.first+d).term1); + if (fabs(_m->at(lhs.first + d).measAdjPrec) > lhsValue) + lhsValue = fabs(_m->at(lhs.first + d).measAdjPrec); + } + break; + } + //TRACE("LHS: %.2f; RHS: %.2f\n", fabs(lhsValue), fabs(_m->at(rhs.first).measAdjPrec)); + return fabs(lhsValue) > fabs(_m->at(rhs.first).measAdjPrec); } - else if (notCompoundMeas(_m->at(lhs.first).measType) && isCompoundMeas(_m->at(rhs.first).measType)) + else if (notCompoundMeasAll(_m->at(lhs.first).measType) && isCompoundMeasAll(_m->at(rhs.first).measType)) { - double rhsValue(magnitude(_m->at(rhs.first).measAdjPrec, _m->at(rhs.first+1).measAdjPrec, _m->at(rhs.first+2).measAdjPrec)); - return _m->at(lhs.first).measAdjPrec > rhsValue; + double rhsValue = 0.0; + U increment(0); + UINT32 vector_count(_m->at(rhs.first).vectorCount1), covariance_count; + + // Get the largest RHS value from the cluster + switch (_m->at(rhs.first).measType) + { + case 'G': + case 'X': + case 'Y': + for (UINT32 g(0); g < vector_count; ++g) + { + covariance_count = _m->at(rhs.first + increment).vectorCount2; + if (fabs(_m->at(rhs.first + increment).measAdjPrec) > rhsValue) // X + rhsValue = fabs(_m->at(rhs.first + increment).measAdjPrec); + if (fabs(_m->at(rhs.first + increment + 1).measAdjPrec) > rhsValue) // Y + rhsValue = fabs(_m->at(rhs.first + increment + 1).measAdjPrec); + if (fabs(_m->at(rhs.first + increment + 2).measAdjPrec) > rhsValue) // Z + rhsValue = fabs(_m->at(rhs.first + increment + 2).measAdjPrec); + increment += 3; // move to covariances + increment += (covariance_count * 3); // skip over covariances + } + break; + case 'D': + //TRACE("%.9f\n", radians_to_degrees_(_m->at(rhs.first).term1)); + rhsValue = fabs(_m->at(rhs.first).measAdjPrec); + for (UINT32 d(1); d < vector_count; ++d) + { + //TRACE("%.9f\n", _m->at(lhs.first+d).term1); + if (fabs(_m->at(rhs.first + d).measAdjPrec) > rhsValue) + rhsValue = fabs(_m->at(rhs.first + d).measAdjPrec); + } + break; + } + + return fabs(_m->at(lhs.first).measAdjPrec) > fabs(rhsValue); } - else if (isCompoundMeas(_m->at(lhs.first).measType) && isCompoundMeas(_m->at(rhs.first).measType)) + else if (isCompoundMeasAll(_m->at(lhs.first).measType) && isCompoundMeasAll(_m->at(rhs.first).measType)) { - double lhsValue(magnitude(_m->at(lhs.first).measAdjPrec, _m->at(lhs.first+1).measAdjPrec, _m->at(lhs.first+2).measAdjPrec)); - double rhsValue(magnitude(_m->at(rhs.first).measAdjPrec, _m->at(rhs.first+1).measAdjPrec, _m->at(rhs.first+2).measAdjPrec)); - return lhsValue > rhsValue; + double lhsValue = 0.0; + U increment(0); + UINT32 vector_count(_m->at(lhs.first).vectorCount1), covariance_count; + + // Get the largest LHS value from the cluster + switch (_m->at(lhs.first).measType) + { + case 'G': + case 'X': + case 'Y': + for (UINT32 g(0); g < vector_count; ++g) + { + covariance_count = _m->at(lhs.first + increment).vectorCount2; + if (fabs(_m->at(lhs.first + increment).measAdjPrec) > lhsValue) // X + lhsValue = fabs(_m->at(lhs.first + increment).measAdjPrec); + if (fabs(_m->at(lhs.first + increment + 1).measAdjPrec) > lhsValue) // Y + lhsValue = fabs(_m->at(lhs.first + increment + 1).measAdjPrec); + if (fabs(_m->at(lhs.first + increment + 2).measAdjPrec) > lhsValue) // Z + lhsValue = fabs(_m->at(lhs.first + increment + 2).measAdjPrec); + increment += 3; // move to covariances + increment += (covariance_count * 3); // skip over covariances + } + break; + case 'D': + //TRACE("%.9f\n", radians_to_degrees_(_m->at(lhs.first).term1)); + lhsValue = fabs(_m->at(lhs.first).measAdjPrec); + for (UINT32 d(1); d < vector_count; ++d) + { + //TRACE("%.9f\n", _m->at(lhs.first+d).term1); + if (fabs(_m->at(lhs.first + d).measAdjPrec) > lhsValue) + lhsValue = fabs(_m->at(lhs.first + d).measAdjPrec); + } + break; + } + + double rhsValue = 0.0; + increment = 0; + vector_count = _m->at(rhs.first).vectorCount1; + + // Get the largest RHS value from the cluster + switch (_m->at(rhs.first).measType) + { + case 'G': + case 'X': + case 'Y': + for (UINT32 g(0); g < vector_count; ++g) + { + covariance_count = _m->at(rhs.first + increment).vectorCount2; + if (fabs(_m->at(rhs.first + increment).measAdjPrec) > rhsValue) // X + rhsValue = fabs(_m->at(rhs.first + increment).measAdjPrec); + if (fabs(_m->at(rhs.first + increment + 1).measAdjPrec) > rhsValue) // Y + rhsValue = fabs(_m->at(rhs.first + increment + 1).measAdjPrec); + if (fabs(_m->at(rhs.first + increment + 2).measAdjPrec) > rhsValue) // Z + rhsValue = fabs(_m->at(rhs.first + increment + 2).measAdjPrec); + increment += 3; // move to covariances + increment += (covariance_count * 3); // skip over covariances + } + break; + case 'D': + //TRACE("%.9f\n", radians_to_degrees_(_m->at(rhs.first).term1)); + rhsValue = fabs(_m->at(rhs.first).measAdjPrec); + for (UINT32 d(1); d < vector_count; ++d) + { + //TRACE("%.9f\n", _m->at(lhs.first+d).term1); + if (fabs(_m->at(rhs.first + d).measAdjPrec) > rhsValue) + rhsValue = fabs(_m->at(rhs.first + d).measAdjPrec); + } + } + + return fabs(lhsValue) > fabs(rhsValue); } else - return _m->at(lhs.first).measAdjPrec > _m->at(rhs.first).measAdjPrec; + return fabs(_m->at(lhs.first).measAdjPrec) > fabs(_m->at(rhs.first).measAdjPrec); } private: - vector* _m; + std::vector* _m; }; @@ -823,55 +1263,81 @@ template class CompareMeasNstat_PairFirst { public: - CompareMeasNstat_PairFirst(vector* m) + CompareMeasNstat_PairFirst(std::vector* m) : _m(m) {} - bool operator()(const pair >& lhs, const pair >& rhs) { + bool operator()(const std::pair >& lhs, const std::pair >& rhs) { if (isCompoundMeasAll(_m->at(lhs.first).measType) && notCompoundMeasAll(_m->at(rhs.first).measType)) { double lhsValue = 0.0; + U increment(0); + UINT32 vector_count(_m->at(lhs.first).vectorCount1), covariance_count; + + // Get the largest LHS value from the cluster switch (_m->at(lhs.first).measType) { case 'G': case 'X': - case 'Y': - //lhsValue = magnitude(_m->at(lhs.first).NStat, _m->at(lhs.first+1).NStat, _m->at(lhs.first+2).NStat); - lhsValue = max(fabs(_m->at(lhs.first).NStat), fabs(_m->at(lhs.first + 1).NStat)); - lhsValue = max(lhsValue, fabs(_m->at(lhs.first + 2).NStat)); + case 'Y': + for (UINT32 g(0); g < vector_count; ++g) + { + covariance_count = _m->at(lhs.first + increment).vectorCount2; + if (fabs(_m->at(lhs.first + increment).NStat) > lhsValue) // X + lhsValue = fabs(_m->at(lhs.first + increment).NStat); + if (fabs(_m->at(lhs.first + increment + 1).NStat) > lhsValue) // Y + lhsValue = fabs(_m->at(lhs.first + increment + 1).NStat); + if (fabs(_m->at(lhs.first + increment + 2).NStat) > lhsValue) // Z + lhsValue = fabs(_m->at(lhs.first + increment + 2).NStat); + increment += 3; // move to covariances + increment += (covariance_count * 3); // skip over covariances + } break; case 'D': //TRACE("%.9f\n", radians_to_degrees_(_m->at(lhs.first).term1)); lhsValue = fabs(_m->at(lhs.first).NStat); - for (UINT32 d(1); d<_m->at(lhs.first).vectorCount1; ++d) + for (UINT32 d(1); d < vector_count; ++d) { //TRACE("%.9f\n", _m->at(lhs.first+d).term1); - if (fabs(_m->at(lhs.first+d).NStat) > lhsValue) - lhsValue = fabs( _m->at(lhs.first+d).NStat); + if (fabs(_m->at(lhs.first + d).NStat) > lhsValue) + lhsValue = fabs( _m->at(lhs.first + d).NStat); } break; } - + //TRACE("LHS: %.2f; RHS: %.2f\n", fabs(lhsValue), fabs(_m->at(rhs.first).NStat)); return fabs(lhsValue) > fabs(_m->at(rhs.first).NStat); } else if (notCompoundMeasAll(_m->at(lhs.first).measType) && isCompoundMeasAll(_m->at(rhs.first).measType)) { - double rhsValue = 0.0; + double rhsValue = 0.0; + U increment(0); + UINT32 vector_count(_m->at(rhs.first).vectorCount1), covariance_count; + + // Get the largest RHS value from the cluster switch (_m->at(rhs.first).measType) { case 'G': case 'X': - case 'Y': - //rhsValue = magnitude(_m->at(rhs.first).NStat, _m->at(rhs.first+1).NStat, _m->at(rhs.first+2).NStat); - rhsValue = max(fabs(_m->at(rhs.first).NStat), fabs(_m->at(rhs.first + 1).NStat)); - rhsValue = max(rhsValue, fabs(_m->at(rhs.first + 2).NStat)); + case 'Y': + for (UINT32 g(0); g < vector_count; ++g) + { + covariance_count = _m->at(rhs.first + increment).vectorCount2; + if (fabs(_m->at(rhs.first + increment).NStat) > rhsValue) // X + rhsValue = fabs(_m->at(rhs.first + increment).NStat); + if (fabs(_m->at(rhs.first + increment + 1).NStat) > rhsValue) // Y + rhsValue = fabs(_m->at(rhs.first + increment + 1).NStat); + if (fabs(_m->at(rhs.first + increment + 2).NStat) > rhsValue) // Z + rhsValue = fabs(_m->at(rhs.first + increment + 2).NStat); + increment += 3; // move to covariances + increment += (covariance_count * 3); // skip over covariances + } break; case 'D': //TRACE("%.9f\n", radians_to_degrees_(_m->at(rhs.first).term1)); rhsValue = fabs(_m->at(rhs.first).NStat); - for (UINT32 d(1); d<_m->at(rhs.first).vectorCount1; ++d) + for (UINT32 d(1); d < vector_count; ++d) { //TRACE("%.9f\n", _m->at(lhs.first+d).term1); - if (fabs(_m->at(rhs.first+d).NStat) > rhsValue) - rhsValue = fabs(_m->at(rhs.first+d).NStat); + if (fabs(_m->at(rhs.first + d).NStat) > rhsValue) + rhsValue = fabs(_m->at(rhs.first + d).NStat); } break; } @@ -881,19 +1347,32 @@ class CompareMeasNstat_PairFirst else if (isCompoundMeasAll(_m->at(lhs.first).measType) && isCompoundMeasAll(_m->at(rhs.first).measType)) { double lhsValue = 0.0; + U increment(0); + UINT32 vector_count(_m->at(lhs.first).vectorCount1), covariance_count; + + // Get the largest LHS value from the cluster switch (_m->at(lhs.first).measType) { case 'G': case 'X': case 'Y': - //lhsValue = magnitude(_m->at(lhs.first).NStat, _m->at(lhs.first+1).NStat, _m->at(lhs.first+2).NStat); - lhsValue = max(fabs(_m->at(lhs.first).NStat), fabs(_m->at(lhs.first + 1).NStat)); - lhsValue = max(lhsValue, fabs(_m->at(lhs.first + 2).NStat)); + for (UINT32 g(0); g < vector_count; ++g) + { + covariance_count = _m->at(lhs.first + increment).vectorCount2; + if (fabs(_m->at(lhs.first + increment).NStat) > lhsValue) // X + lhsValue = fabs(_m->at(lhs.first + increment).NStat); + if (fabs(_m->at(lhs.first + increment + 1).NStat) > lhsValue) // Y + lhsValue = fabs(_m->at(lhs.first + increment + 1).NStat); + if (fabs(_m->at(lhs.first + increment + 2).NStat) > lhsValue) // Z + lhsValue = fabs(_m->at(lhs.first + increment + 2).NStat); + increment += 3; // move to covariances + increment += (covariance_count * 3); // skip over covariances + } break; case 'D': //TRACE("%.9f\n", radians_to_degrees_(_m->at(lhs.first).term1)); lhsValue = fabs(_m->at(lhs.first).NStat); - for (UINT32 d(1); d<_m->at(lhs.first).vectorCount1; ++d) + for (UINT32 d(1); d < vector_count; ++d) { //TRACE("%.9f\n", _m->at(lhs.first+d).term1); if (fabs(_m->at(lhs.first+d).NStat) > lhsValue) @@ -903,19 +1382,32 @@ class CompareMeasNstat_PairFirst } double rhsValue = 0.0; + increment = 0; + vector_count = _m->at(rhs.first).vectorCount1; + + // Get the largest RHS value from the cluster switch (_m->at(rhs.first).measType) { case 'G': case 'X': - case 'Y': - //rhsValue = magnitude(_m->at(rhs.first).NStat, _m->at(rhs.first+1).NStat, _m->at(rhs.first+2).NStat); - rhsValue = max(fabs(_m->at(rhs.first).NStat), fabs(_m->at(rhs.first + 1).NStat)); - rhsValue = max(rhsValue, fabs(_m->at(rhs.first + 2).NStat)); + case 'Y': + for (UINT32 g(0); g < vector_count; ++g) + { + covariance_count = _m->at(rhs.first + increment).vectorCount2; + if (fabs(_m->at(rhs.first + increment).NStat) > rhsValue) // X + rhsValue = fabs(_m->at(rhs.first + increment).NStat); + if (fabs(_m->at(rhs.first + increment + 1).NStat) > rhsValue) // Y + rhsValue = fabs(_m->at(rhs.first + increment + 1).NStat); + if (fabs(_m->at(rhs.first + increment + 2).NStat) > rhsValue) // Z + rhsValue = fabs(_m->at(rhs.first + increment + 2).NStat); + increment += 3; // move to covariances + increment += (covariance_count * 3); // skip over covariances + } break; case 'D': //TRACE("%.9f\n", radians_to_degrees_(_m->at(rhs.first).term1)); rhsValue = fabs(_m->at(rhs.first).NStat); - for (UINT32 d(1); d<_m->at(rhs.first).vectorCount1; ++d) + for (UINT32 d(1); d < vector_count; ++d) { //TRACE("%.9f\n", _m->at(lhs.first+d).term1); if (fabs(_m->at(rhs.first+d).NStat) > rhsValue) @@ -929,40 +1421,7 @@ class CompareMeasNstat_PairFirst return fabs(_m->at(lhs.first).NStat) > fabs(_m->at(rhs.first).NStat); } private: - vector* _m; -}; - - -// M = measurement_t, U = UINT32, T = double -template -class CompareMeasOutlier_PairFirst -{ -public: - CompareMeasOutlier_PairFirst(vector* m, const T t) - : _m(m), _t(t) {} - bool operator()(const pair >& lhs, const pair >& rhs) { - if (isCompoundMeas(_m->at(lhs.first).measType) && notCompoundMeas(_m->at(rhs.first).measType)) - { - bool lhs_pass((fabs(_m->at(lhs.first).NStat) < _t) || (fabs(_m->at(lhs.first+1).NStat) < _t) || (fabs(_m->at(lhs.first+2).NStat) < _t)); - return (lhs_pass < (fabs(_m->at(rhs.first).NStat) < _t)); - } - else if (notCompoundMeas(_m->at(lhs.first).measType) && isCompoundMeas(_m->at(rhs.first).measType)) - { - bool rhs_pass((fabs(_m->at(rhs.first).NStat) < _t) || (fabs(_m->at(rhs.first+1).NStat) < _t) || (fabs(_m->at(rhs.first+2).NStat) < _t)); - return ((fabs(_m->at(lhs.first).NStat) < _t) < rhs_pass); - } - else if (isCompoundMeas(_m->at(lhs.first).measType) && isCompoundMeas(_m->at(rhs.first).measType)) - { - bool lhs_pass((fabs(_m->at(lhs.first).NStat) < _t) || (fabs(_m->at(lhs.first+1).NStat) < _t) || (fabs(_m->at(lhs.first+2).NStat) < _t)); - bool rhs_pass((fabs(_m->at(rhs.first).NStat) < _t) || (fabs(_m->at(rhs.first+1).NStat) < _t) || (fabs(_m->at(rhs.first+2).NStat) < _t)); - return lhs_pass < rhs_pass; - } - else - return ((fabs(_m->at(lhs.first).NStat) < _t) < (fabs(_m->at(rhs.first).NStat) < _t)); - } -private: - vector* _m; - T _t; + std::vector* _m; }; @@ -971,13 +1430,13 @@ template class CompareStnFileOrder { public: - CompareStnFileOrder(vector* s) + CompareStnFileOrder(std::vector* s) : _s(s) {} bool operator()(const U& lhs, const U& rhs) { return _s->at(lhs).fileOrder < _s->at(rhs).fileOrder; } private: - vector* _s; + std::vector* _s; }; @@ -1024,13 +1483,13 @@ template class CompareStnFileOrder_StnBlockMap { public: - CompareStnFileOrder_StnBlockMap(vector* s) + CompareStnFileOrder_StnBlockMap(std::vector* s) : _s(s) {} bool operator()(const U& lhs, const U& rhs) { return _s->at(lhs.station_id).fileOrder < _s->at(rhs.station_id).fileOrder; } private: - vector* _s; + std::vector* _s; }; @@ -1047,30 +1506,30 @@ class CompareStnOrder_StnBlockMap }; -// T = station_t, S = string +// T = station_t, S = std::string template class CompareStnName { public: bool operator()(const T& lhs, const T& rhs) { - return string(lhs.stationName) < string(rhs.stationName); + return std::string(lhs.stationName) < std::string(rhs.stationName); } }; -// T = station_t, S = string +// T = station_t, S = std::string template class CompareStnOriginalName { public: bool operator()(const T& lhs, const T& rhs) { - return string(lhs.stationNameOrig) < string(rhs.stationNameOrig); + return std::string(lhs.stationNameOrig) < std::string(rhs.stationNameOrig); } bool operator()(const T& lhs, const S& rhs) { - return string(lhs.stationNameOrig) < rhs; + return std::string(lhs.stationNameOrig) < rhs; } bool operator()(const S& lhs, const T& rhs) { - return lhs < string(rhs.stationNameOrig); + return lhs < std::string(rhs.stationNameOrig); } }; @@ -1080,7 +1539,7 @@ template class CompareStnLongitude { public: - CompareStnLongitude(vector* s, bool leftToRight=true) + CompareStnLongitude(std::vector* s, bool leftToRight=true) : _s(s) , _leftToRight(leftToRight) {} bool operator()(const U& lhs, const U& rhs) { @@ -1090,7 +1549,7 @@ class CompareStnLongitude return _s->at(lhs).initialLongitude > _s->at(rhs).initialLongitude; } private: - vector* _s; + std::vector* _s; bool _leftToRight; }; @@ -1141,7 +1600,7 @@ class CompareScalars } }; -template +template class CompareScalarStations { public: @@ -1167,10 +1626,10 @@ template class CompareValidFreeMeasType_vT { public: - CompareValidFreeMeasType_vT(vector* msrs, vector& vtypes) + CompareValidFreeMeasType_vT(std::vector* msrs, std::vector& vtypes) : _msrs(msrs), _vtypes(vtypes) { - sort(vtypes.begin(), vtypes.end()); + std::sort(vtypes.begin(), vtypes.end()); } bool operator()(const U& msr_index) { return _msrs->at(msr_index).ignore == false && @@ -1178,8 +1637,8 @@ class CompareValidFreeMeasType_vT } private: - vector* _msrs; - vector _vtypes; + std::vector* _msrs; + std::vector _vtypes; }; @@ -1188,7 +1647,7 @@ template class CompareIgnoreedMeas { public: - CompareIgnoreedMeas(vector* m) : _m(m) {} + CompareIgnoreedMeas(std::vector* m) : _m(m) {} bool operator()(const U& freemsr_index) { return _m->at(freemsr_index).ignore; } @@ -1196,7 +1655,7 @@ class CompareIgnoreedMeas return _m->at(lhs).ignore < _m->at(rhs).ignore; } private: - vector* _m; + std::vector* _m; }; @@ -1304,7 +1763,7 @@ template class CompareMeasType { public: - CompareMeasType(const string& s) : _s(s) {} + CompareMeasType(const std::string& s) : _s(s) {} inline void SetComparand(const char& s) { _s = s; } bool operator()(boost::shared_ptr m) { @@ -1316,7 +1775,7 @@ class CompareMeasType } private: - string _s; + std::string _s; _it_str _it_s; }; @@ -1325,8 +1784,8 @@ template class CompareNonMeasType { public: - CompareNonMeasType(const string& s) : _s(s), _bFd(false) {} - inline void SetComparand(const string& s) { _s = s; } + CompareNonMeasType(const std::string& s) : _s(s), _bFd(false) {} + inline void SetComparand(const std::string& s) { _s = s; } bool operator()(boost::shared_ptr m) { _bFd = true; @@ -1337,7 +1796,7 @@ class CompareNonMeasType private: - string _s; + std::string _s; _it_str _it_s; bool _bFd; }; @@ -1347,12 +1806,12 @@ template class CompareCovarianceStart { public: - CompareCovarianceStart(vector* m) : _m(m) {} + CompareCovarianceStart(std::vector* m) : _m(m) {} bool operator()(const U& freemsr_index) { return _m->at(freemsr_index).measStart > zMeas; } private: - vector* _m; + std::vector* _m; }; @@ -1360,13 +1819,13 @@ template class ComparePairSecond { public: - bool operator()(const pair& lhs, const pair& rhs) const { + bool operator()(const std::pair& lhs, const std::pair& rhs) const { return pair_secondless(lhs.second, rhs.second); } - bool operator()(const pair& lhs, const T& rhs) { + bool operator()(const std::pair& lhs, const T& rhs) { return pair_secondless(lhs.second, rhs); } - bool operator()(const T& lhs, const pair& rhs) { + bool operator()(const T& lhs, const std::pair& rhs) { return pair_secondless(lhs, rhs.second); } private: @@ -1379,13 +1838,13 @@ template class ComparePairFirst { public: - bool operator()(const pair& lhs, const pair& rhs) const { + bool operator()(const std::pair& lhs, const std::pair& rhs) const { return pair_firstless(lhs.first, rhs.first); } - bool operator()(const pair& lhs, const T& rhs) { + bool operator()(const std::pair& lhs, const T& rhs) { return pair_firstless(lhs.first, rhs); } - bool operator()(const T& lhs, const pair& rhs) { + bool operator()(const T& lhs, const std::pair& rhs) { return pair_firstless(lhs, rhs.first); } private: @@ -1399,23 +1858,23 @@ template class CompareOddPairFirst { public: - bool operator()(const pair& lhs, const pair& rhs) const { + bool operator()(const std::pair& lhs, const std::pair& rhs) const { return lhs.first < rhs.first; } }; -// S = station_t, T = UINT32, U = string +// S = station_t, T = UINT32, U = std::string template class CompareOddPairFirst_FileOrder { public: - CompareOddPairFirst_FileOrder(vector* s) + CompareOddPairFirst_FileOrder(std::vector* s) : _s(s) {} - bool operator()(const pair& lhs, const pair& rhs) { + bool operator()(const std::pair& lhs, const std::pair& rhs) { return _s->at(lhs.first).fileOrder < _s->at(rhs.first).fileOrder; } private: - vector* _s; + std::vector* _s; }; @@ -1424,7 +1883,7 @@ class ComparePairSecondf { public: ComparePairSecondf(T t) : _t(t) {} - bool operator()(const pair& t) { + bool operator()(const std::pair& t) { return t.second == _t; } @@ -1473,7 +1932,7 @@ template class CompareFreeClusterAllStns { public: - CompareFreeClusterAllStns(vector* u, vector* m, const C& c) : _u(u), _m(m), _c(c) {} + CompareFreeClusterAllStns(std::vector* u, std::vector* m, const C& c) : _u(u), _m(m), _c(c) {} bool operator()(const U& amlindex) { // one-station measurement types // is this station on the list? @@ -1503,7 +1962,7 @@ class CompareFreeClusterAllStns case 'M': // MSL arc case 'S': // Slope distance case 'L': // Level difference - case 'V': // Zenith angle + case 'V': // Zenith distance case 'Z': // Vertical angle case 'G': // GPS Baseline (treat as single-baseline cluster) case 'X': // GPS Baseline cluster @@ -1521,8 +1980,8 @@ class CompareFreeClusterAllStns return false; } private: - vector* _u; - vector* _m; + std::vector* _u; + std::vector* _m; char _c; }; @@ -1532,23 +1991,23 @@ template class PairCompareFirst { public: //functions // comparison func for sorting - //bool operator()(const pair& lhs, const pair& rhs) const { + //bool operator()(const std::pair& lhs, const std::pair& rhs) const { bool operator()(const string_string_pair& lhs, const string_string_pair& rhs) const { return keyLess(lhs.first, rhs.first); } // comparison func for lookups - //bool operator()(const pair& lhs, const pair::first_type& rhs) const { + //bool operator()(const std::pair& lhs, const std::pair::first_type& rhs) const { bool operator()(const string_string_pair& lhs, const string_string_pair::first_type& rhs) const { return keyLess(lhs.first, rhs); } // comparison func for lookups - //bool operator()(const pair::first_type& lhs, const pair& rhs) const { + //bool operator()(const std::pair::first_type& lhs, const std::pair& rhs) const { bool operator()(const string_string_pair::first_type& lhs, const string_string_pair& rhs) const { return keyLess(lhs, rhs.first); } private: // the "real" comparison function - //bool keyLess(const pair::first_type& k1, const pair::first_type& k2) const { + //bool keyLess(const std::pair::first_type& k1, const std::pair::first_type& k2) const { bool keyLess(const string_string_pair::first_type& k1, const string_string_pair::first_type& k2) const { return k1 < k2; } diff --git a/dynadjust/include/functions/dnatemplategeodesyfuncs.hpp b/dynadjust/include/functions/dnatemplategeodesyfuncs.hpp index f332941c..2a7699ec 100644 --- a/dynadjust/include/functions/dnatemplategeodesyfuncs.hpp +++ b/dynadjust/include/functions/dnatemplategeodesyfuncs.hpp @@ -34,7 +34,6 @@ #include #include #include -#include #include #include @@ -45,9 +44,6 @@ #include #include -using namespace std; -using namespace boost; - using namespace dynadjust::datum_parameters; // nu helper @@ -149,11 +145,11 @@ template // double dXAxis(-3563081.362), dYAxis(-2057145.984), dZAxis(-4870449.482), dHeight(0.); // CDnaEllipsoid e; // CartToGeo(dXAxis, dYAxis, dZAxis, &dXAxis, &dYAxis, &dHeight, &e); -// stringstream ss; -// ss << setw(MSR) << right << FormatDmsString(RadtoDms(dXAxis), 5, true, false) << ", "; -// ss << setw(MSR) << right << FormatDmsString(RadtoDms(dYAxis), 5, true, false) << ", "; -// ss << setw(MSR) << setprecision(4) << fixed << right << dHeight; -// string comp(ss.str()); +// std::stringstream ss; +// ss << std::setw(MSR) << std::right << FormatDmsString(RadtoDms(dXAxis), 5, true, false) << ", "; +// ss << std::setw(MSR) << std::right << FormatDmsString(RadtoDms(dYAxis), 5, true, false) << ", "; +// ss << std::setw(MSR) << std::setprecision(4) << std::fixed << std::right << dHeight; +// std::string comp(ss.str()); // comp should equal "-50 00 00.0000, -150 00 00.0000, 10000.000" // void CartToGeo(const T& X, const T& Y, const T& Z, diff --git a/dynadjust/include/functions/dnatemplatematrixfuncs.hpp b/dynadjust/include/functions/dnatemplatematrixfuncs.hpp index 1423912f..421bca97 100644 --- a/dynadjust/include/functions/dnatemplatematrixfuncs.hpp +++ b/dynadjust/include/functions/dnatemplatematrixfuncs.hpp @@ -34,7 +34,6 @@ #include #include #include -#include #include #include @@ -46,19 +45,17 @@ #include #include -using namespace std; -using namespace boost; - using namespace dynadjust::datum_parameters; using namespace dynadjust::math; -// msr_t_Iterator = vector::iterator +// msr_t_Iterator = std::vector::iterator template // Fills upper triangle void GetDirectionsVarianceMatrix(msr_t_Iterator begin, matrix_2d* vmat) { msr_t_Iterator bmsRecord(begin); - UINT32 a, angle_count(bmsRecord->vectorCount1 - 1); // number of directions excluding the RO + UINT32 a, angle_count(bmsRecord->vectorCount2 - 1); // number of directions excluding the RO + UINT32 skip(0), ignored(bmsRecord->vectorCount1 - bmsRecord->vectorCount2); vmat->zero(); vmat->redim(angle_count, angle_count); @@ -67,6 +64,18 @@ void GetDirectionsVarianceMatrix(msr_t_Iterator begin, matrix_2d* vmat) for (a=0; aignore) + { + while (skip < ignored) + { + skip++; + bmsRecord++; + if (!bmsRecord->ignore) + break; + } + } + vmat->put(a, a, bmsRecord->scale2); // derived angle variance if (a+1 < angle_count) vmat->put(a, a+1, bmsRecord->scale3); // derived angle covariance @@ -117,13 +126,14 @@ void GetGPSVarianceMatrix(const msr_t_Iterator begin, matrix_2d* vmat) } -// msr_t_Iterator = vector::iterator +// msr_t_Iterator = std::vector::iterator template // Sets values based on upper triangle void SetDirectionsVarianceMatrix(msr_t_Iterator begin, const matrix_2d& vmat) { msr_t_Iterator bmsRecord(begin); - UINT32 a, angle_count(bmsRecord->vectorCount1 - 1); // number of directions excluding the RO + UINT32 a, angle_count(bmsRecord->vectorCount2 - 1); // number of directions excluding the RO + UINT32 skip(0), ignored(bmsRecord->vectorCount1 - bmsRecord->vectorCount2); bmsRecord->scale2 = 0.; // variance (angle) bmsRecord->scale3 = 0.; // covariance (angle) @@ -132,6 +142,18 @@ void SetDirectionsVarianceMatrix(msr_t_Iterator begin, const matrix_2d& vmat) for (a=0; aignore) + { + while (skip < ignored) + { + skip++; + bmsRecord++; + if (!bmsRecord->ignore) + break; + } + } + bmsRecord->scale2 = vmat.get(a, a); // derived angle variance if (a+1 < angle_count) bmsRecord->scale3 = vmat.get(a, a+1); // derived angle covariance @@ -142,7 +164,7 @@ void SetDirectionsVarianceMatrix(msr_t_Iterator begin, const matrix_2d& vmat) } } -// msr_t_Iterator = vector::iterator +// msr_t_Iterator = std::vector::iterator template // Sets values based on upper triangle void SetGPSVarianceMatrix(msr_t_Iterator begin, const matrix_2d& vmat) diff --git a/dynadjust/include/functions/dnatemplatematrixio.hpp b/dynadjust/include/functions/dnatemplatematrixio.hpp index db1ce3fb..b668417e 100644 --- a/dynadjust/include/functions/dnatemplatematrixio.hpp +++ b/dynadjust/include/functions/dnatemplatematrixio.hpp @@ -16,7 +16,6 @@ #include #include #include -#include #include #include @@ -25,9 +24,6 @@ #include -using namespace std; -using namespace boost; - using namespace dynadjust::math; diff --git a/dynadjust/include/functions/dnatemplatestnmsrfuncs.hpp b/dynadjust/include/functions/dnatemplatestnmsrfuncs.hpp index 824ca8c6..4481d9db 100644 --- a/dynadjust/include/functions/dnatemplatestnmsrfuncs.hpp +++ b/dynadjust/include/functions/dnatemplatestnmsrfuncs.hpp @@ -49,13 +49,11 @@ #include -using namespace std; -using namespace boost; using namespace dynadjust::measurements; template // Get all the statons asociated with a measurement -void GetGXMsrStations(vector* vgpsBsls, vector& msrStations) +void GetGXMsrStations(std::vector* vgpsBsls, std::vector& msrStations) { msrStations.clear(); @@ -73,7 +71,7 @@ void GetGXMsrStations(vector* vgpsBsls, vector& msrStations) template // Get all the statons asociated with a measurement -void GetMsrStations(const vmsr_t& binaryMsrs, const T& bmsIndex, vector& msrStations) +void GetMsrStations(const vmsr_t& binaryMsrs, const T& bmsIndex, std::vector& msrStations) { msrStations.clear(); T clusterID(binaryMsrs.at(bmsIndex).clusterID); @@ -140,7 +138,7 @@ template // Get all the binary measurement indices involved in a measurement // On return, msrIndices will contain only one index. For clusters // and directions, msrIndices will be more than one. -void GetMsrIndices(const vmsr_t& binaryMsrs, const T& bmsIndex, vector& msrIndices) +void GetMsrIndices(const vmsr_t& binaryMsrs, const T& bmsIndex, std::vector& msrIndices) { msrIndices.clear(); @@ -394,7 +392,7 @@ void CopyClusterMsr(T& cluster, const msriterator _it_msr, T& clusterCopy) // Comparison functions -template +template class CompareStationName { public: bool operator()(const T& left, const T& right) { @@ -410,19 +408,19 @@ class CompareStationName { } }; -template +template class EqualStationNameSaveDuplicates { public: - EqualStationNameSaveDuplicates(vector* stns) : _stns(stns) {} + EqualStationNameSaveDuplicates(std::vector* stns) : _stns(stns) {} bool operator()(const T& left, const T& right) { - if (equals(left->GetName(), right->GetName())) + if (boost::equals(left->GetName(), right->GetName())) _stns->push_back(right->GetName()); return (left->GetName() == right->GetName()); } - vector* _stns; + std::vector* _stns; }; @@ -435,27 +433,27 @@ class EqualStationName { }; -template +template class EqualStationName_CaseInsensitive { public: - EqualStationName_CaseInsensitive(vector* stns) : _stns(stns) {} + EqualStationName_CaseInsensitive(std::vector* stns) : _stns(stns) {} bool operator()(const T& left, const T& right) { - if (iequals(left->GetName(), right->GetName())) + if (boost::iequals(left->GetName(), right->GetName())) { _stns->push_back(right->GetName()); return true; } return false; } - vector* _stns; + std::vector* _stns; }; -template +template class TestEqualStationName { public: - TestEqualStationName(vector* usedStns, vector* unusedStns) + TestEqualStationName(std::vector* usedStns, std::vector* unusedStns) : _usedStns(usedStns) , _unusedStns(unusedStns) {} @@ -468,15 +466,15 @@ class TestEqualStationName { _unusedStns->push_back(stn->GetName()); return false; } - vector* _usedStns; - vector* _unusedStns; + std::vector* _usedStns; + std::vector* _unusedStns; }; -template +template class TestNotEqualStationName { public: - TestNotEqualStationName(vector* usedStns, vector* unusedStns) + TestNotEqualStationName(std::vector* usedStns, std::vector* unusedStns) : _usedStns(usedStns) , _unusedStns(unusedStns) {} @@ -489,8 +487,8 @@ class TestNotEqualStationName { _unusedStns->push_back(stn->GetName()); return true; } - vector* _usedStns; - vector* _unusedStns; + std::vector* _usedStns; + std::vector* _unusedStns; }; @@ -498,7 +496,7 @@ class TestNotEqualStationName { template class NearbyStation_LowAcc { public: - NearbyStation_LowAcc (const U& tolerance, vector* stns) + NearbyStation_LowAcc (const U& tolerance, std::vector* stns) : _tolerance(tolerance), _stns(stns), _dist(0.) {} bool operator()(const T& left, const T& right) { @@ -517,7 +515,7 @@ class NearbyStation_LowAcc { } U _tolerance; - vector* _stns; + std::vector* _stns; double _dist; }; @@ -526,7 +524,7 @@ class NearbyStation_LowAcc { template class NearbyStation_HighAcc { public: - NearbyStation_HighAcc(const U& tolerance, vector* stns, const E& ellipsoid) + NearbyStation_HighAcc(const U& tolerance, std::vector* stns, const E& ellipsoid) : _tolerance(tolerance), _stns(stns), _dAzimuth(0.), _dist(0.), _ellipsoid(ellipsoid) {} bool operator()(const T& left, const T& right) { @@ -546,7 +544,7 @@ class NearbyStation_HighAcc { } U _tolerance; - vector* _stns; + std::vector* _stns; U _dAzimuth; double _dist; E _ellipsoid; // GDA by default @@ -594,7 +592,7 @@ class FindStnsWithinBoundingBox{ }; // requires stns to be sorted -template +template class FindMsrsConnectedToStns_GX{ public: FindMsrsConnectedToStns_GX(const pvstring stns) @@ -612,7 +610,7 @@ class FindMsrsConnectedToStns_GX{ }; // requires stns to be sorted -template +template class FindMsrsConnectedToStns_Y{ public: FindMsrsConnectedToStns_Y(const pvstring stns) @@ -628,7 +626,7 @@ class FindMsrsConnectedToStns_Y{ }; // requires stns to be sorted -template +template class FindMsrsConnectedToStns_D{ public: FindMsrsConnectedToStns_D(const pvstring stns) @@ -653,9 +651,9 @@ class FindMsrsConnectedToStns{ bool operator()(dnaMsrPtr m) { - FindMsrsConnectedToStns_GX gpsbslFunc(_stns); - FindMsrsConnectedToStns_Y gpspntFunc(_stns); - FindMsrsConnectedToStns_D dirnFunc(_stns); + FindMsrsConnectedToStns_GX gpsbslFunc(_stns); + FindMsrsConnectedToStns_Y gpspntFunc(_stns); + FindMsrsConnectedToStns_D dirnFunc(_stns); switch (m->GetTypeC()) { @@ -704,7 +702,7 @@ class FindMsrsConnectedToStns{ case 'L': // Level difference case 'B': // Geodetic azimuth case 'K': // Astronomic azimuth - case 'V': // Zenith angle + case 'V': // Zenith distance case 'Z': // Vertical angle return false; } @@ -770,7 +768,7 @@ void ResetMeasurementPtr(dnaMsrPtr* msrPtr, const T& cType) case 'R': // Ellipsoidal height msrPtr->reset(new CDnaHeight); break; - case 'V': // Zenith angle + case 'V': // Zenith distance case 'Z': // Vertical angle msrPtr->reset(new CDnaDirection); break; @@ -817,7 +815,7 @@ class CompareMsr { public: bool operator()(const boost::shared_ptr left, const boost::shared_ptr right) { if (left->GetIgnore() == right->GetIgnore()) { - if (iequals(left->GetType(), right->GetType())) + if (boost::iequals(left->GetType(), right->GetType())) { switch (left->GetTypeC()) { @@ -857,7 +855,7 @@ class CompareMsr { return *(dynamic_cast(&(*left))) < *(dynamic_cast(&(*right))); - case 'V': // Zenith angle + case 'V': // Zenith distance case 'Z': // Vertical angle return *(dynamic_cast(&(*left))) < *(dynamic_cast(&(*right))); @@ -883,7 +881,7 @@ class CompareMsr { template -basic_istream& operator>>(basic_istream& is, CAStationList t) +std::basic_istream& operator>>(std::basic_istream& is, CAStationList t) { is.read(reinterpret_cast(t.GetAssocMsrCountPtr()), sizeof(UINT32)); is.read(reinterpret_cast(t.GetAMLStnIndexPtr()), sizeof(UINT32)); @@ -892,7 +890,7 @@ basic_istream& operator>>(basic_istream& is, CASta } template -basic_istream& operator>>(basic_istream& is, CAStationList* t) +std::basic_istream& operator>>(std::basic_istream& is, CAStationList* t) { is.read(reinterpret_cast(t->GetAssocMsrCountPtr()), sizeof(UINT32)); is.read(reinterpret_cast(t->GetAMLStnIndexPtr()), sizeof(UINT32)); @@ -901,7 +899,7 @@ basic_istream& operator>>(basic_istream& is, CASta } template -basic_ostream& operator<<(std::basic_ostream& os, CAStationList t) +std::basic_ostream& operator<<(std::basic_ostream& os, CAStationList t) { os.write(reinterpret_cast(t.GetAssocMsrCountPtr()), sizeof(UINT32)); os.write(reinterpret_cast(t.GetAMLStnIndexPtr()), sizeof(UINT32)); @@ -910,7 +908,7 @@ basic_ostream& operator<<(std::basic_ostream& os } template -basic_ostream& operator<<(std::basic_ostream& os, CAStationList* t) +std::basic_ostream& operator<<(std::basic_ostream& os, CAStationList* t) { os.write(reinterpret_cast(t->GetAssocMsrCountPtr()), sizeof(UINT32)); os.write(reinterpret_cast(t->GetAMLStnIndexPtr()), sizeof(UINT32)); diff --git a/dynadjust/include/functions/dnatransparamfuncs.hpp b/dynadjust/include/functions/dnatransparamfuncs.hpp index 6528127e..af634191 100644 --- a/dynadjust/include/functions/dnatransparamfuncs.hpp +++ b/dynadjust/include/functions/dnatransparamfuncs.hpp @@ -38,9 +38,6 @@ #include #include -using namespace std; -using namespace boost; - using namespace dynadjust::epsg; namespace dynadjust { @@ -51,7 +48,7 @@ template S message_parameters_undefined(U from_epsg_code, U to_epsg_code) { // No direct parameters exist! - stringstream ss; + std::stringstream ss; ss << datumFromEpsgCode(from_epsg_code) << " to " << datumFromEpsgCode(to_epsg_code) << " parameters have not been defined."; return ss.str(); @@ -104,7 +101,7 @@ void determineGDA94Parameters(transformation_parameter_set& tParam) case ITRF1994_i_xyz: case ITRF1994_i: // No direct parameters exist! - throw RefTranException(message_parameters_undefined(tParam.from_to_.first, tParam.from_to_.second), + throw RefTranException(message_parameters_undefined(tParam.from_to_.first, tParam.from_to_.second), REFTRAN_DIRECT_PARAMS_UNAVAILABLE); // GDA94-to-ITRF1996 case ITRF1996_i_xyz: @@ -164,7 +161,7 @@ void determineGDA94Parameters(transformation_parameter_set& tParam) case ITRF2020_i_xyz: case ITRF2020_i: // No direct parameters exist! - throw RefTranException(message_parameters_undefined(tParam.from_to_.first, tParam.from_to_.second), + throw RefTranException(message_parameters_undefined(tParam.from_to_.first, tParam.from_to_.second), REFTRAN_DIRECT_PARAMS_UNAVAILABLE); // GDA94-to-WGS84 case WGS84_i_xyz: @@ -184,7 +181,7 @@ void determineGDA94Parameters(transformation_parameter_set& tParam) case WGS84_G2139_i_xyz: case WGS84_G2139_i: default: - throw boost::enable_current_exception(runtime_error("determineGDA94Parameters(): ")); + throw boost::enable_current_exception(std::runtime_error("determineGDA94Parameters(): ")); } } @@ -236,7 +233,7 @@ void determineGDA2020Parameters(transformation_parameter_set& tParam) case ITRF1994_i_xyz: case ITRF1994_i: // No direct parameters exist! - throw RefTranException(message_parameters_undefined(tParam.from_to_.first, tParam.from_to_.second), + throw RefTranException(message_parameters_undefined(tParam.from_to_.first, tParam.from_to_.second), REFTRAN_DIRECT_PARAMS_UNAVAILABLE); // GDA2020-to-ITRF1996 case ITRF1996_i_xyz: @@ -319,7 +316,7 @@ void determineGDA2020Parameters(transformation_parameter_set& tParam) case WGS84_G2139_i_xyz: case WGS84_G2139_i: default: - throw boost::enable_current_exception(runtime_error("determineGDA2020Parameters(): ")); + throw boost::enable_current_exception(std::runtime_error("determineGDA2020Parameters(): ")); } } @@ -368,7 +365,7 @@ void determineITRF1988Parameters(transformation_parameter_set& tParam) case ITRF2005_i_xyz: case ITRF2005_i: // No direct parameters exist! - throw RefTranException(message_parameters_undefined(tParam.from_to_.first, tParam.from_to_.second), + throw RefTranException(message_parameters_undefined(tParam.from_to_.first, tParam.from_to_.second), REFTRAN_DIRECT_PARAMS_UNAVAILABLE); // ITRF1988-to-ITRF1988 case ITRF1988_i_xyz: @@ -431,7 +428,7 @@ void determineITRF1988Parameters(transformation_parameter_set& tParam) case WGS84_G2139_i_xyz: case WGS84_G2139_i: default: - throw boost::enable_current_exception(runtime_error("determineITRF1988Parameters(): ")); + throw boost::enable_current_exception(std::runtime_error("determineITRF1988Parameters(): ")); } } @@ -479,7 +476,7 @@ void determineITRF1989Parameters(transformation_parameter_set& tParam) case ITRF2005_i_xyz: case ITRF2005_i: // No direct parameters exist! - throw RefTranException(message_parameters_undefined(tParam.from_to_.first, tParam.from_to_.second), + throw RefTranException(message_parameters_undefined(tParam.from_to_.first, tParam.from_to_.second), REFTRAN_DIRECT_PARAMS_UNAVAILABLE); // ITRF1989-to-ITRF1989 case ITRF1989_i_xyz: @@ -542,7 +539,7 @@ void determineITRF1989Parameters(transformation_parameter_set& tParam) case WGS84_G2139_i_xyz: case WGS84_G2139_i: default: - throw boost::enable_current_exception(runtime_error("determineITRF1989Parameters(): ")); + throw boost::enable_current_exception(std::runtime_error("determineITRF1989Parameters(): ")); } } @@ -590,7 +587,7 @@ void determineITRF1990Parameters(transformation_parameter_set& tParam) case ITRF2005_i_xyz: case ITRF2005_i: // No direct parameters exist! - throw RefTranException(message_parameters_undefined(tParam.from_to_.first, tParam.from_to_.second), + throw RefTranException(message_parameters_undefined(tParam.from_to_.first, tParam.from_to_.second), REFTRAN_DIRECT_PARAMS_UNAVAILABLE); // ITRF1990-to-ITRF1990 case ITRF1990_i_xyz: @@ -653,7 +650,7 @@ void determineITRF1990Parameters(transformation_parameter_set& tParam) case WGS84_G2139_i_xyz: case WGS84_G2139_i: default: - throw boost::enable_current_exception(runtime_error("determineITRF1990Parameters(): ")); + throw boost::enable_current_exception(std::runtime_error("determineITRF1990Parameters(): ")); } } @@ -701,7 +698,7 @@ void determineITRF1991Parameters(transformation_parameter_set& tParam) case ITRF2005_i_xyz: case ITRF2005_i: // No direct parameters exist! - throw RefTranException(message_parameters_undefined(tParam.from_to_.first, tParam.from_to_.second), + throw RefTranException(message_parameters_undefined(tParam.from_to_.first, tParam.from_to_.second), REFTRAN_DIRECT_PARAMS_UNAVAILABLE); // ITRF1991-to-ITRF1991 case ITRF1991_i_xyz: @@ -764,7 +761,7 @@ void determineITRF1991Parameters(transformation_parameter_set& tParam) case WGS84_G2139_i_xyz: case WGS84_G2139_i: default: - throw boost::enable_current_exception(runtime_error("determineITRF1991Parameters(): ")); + throw boost::enable_current_exception(std::runtime_error("determineITRF1991Parameters(): ")); } } @@ -812,7 +809,7 @@ void determineITRF1992Parameters(transformation_parameter_set& tParam) case ITRF2005_i_xyz: case ITRF2005_i: // No direct parameters exist! - throw RefTranException(message_parameters_undefined(tParam.from_to_.first, tParam.from_to_.second), + throw RefTranException(message_parameters_undefined(tParam.from_to_.first, tParam.from_to_.second), REFTRAN_DIRECT_PARAMS_UNAVAILABLE); // ITRF1992-to-ITRF1992 case ITRF1992_i_xyz: @@ -875,7 +872,7 @@ void determineITRF1992Parameters(transformation_parameter_set& tParam) case WGS84_G2139_i_xyz: case WGS84_G2139_i: default: - throw boost::enable_current_exception(runtime_error("determineITRF1992Parameters(): ")); + throw boost::enable_current_exception(std::runtime_error("determineITRF1992Parameters(): ")); } } @@ -923,7 +920,7 @@ void determineITRF1993Parameters(transformation_parameter_set& tParam) case ITRF2005_i_xyz: case ITRF2005_i: // No direct parameters exist! - throw RefTranException(message_parameters_undefined(tParam.from_to_.first, tParam.from_to_.second), + throw RefTranException(message_parameters_undefined(tParam.from_to_.first, tParam.from_to_.second), REFTRAN_DIRECT_PARAMS_UNAVAILABLE); // ITRF1993-to-ITRF1993 case ITRF1993_i_xyz: @@ -986,7 +983,7 @@ void determineITRF1993Parameters(transformation_parameter_set& tParam) case WGS84_G2139_i_xyz: case WGS84_G2139_i: default: - throw boost::enable_current_exception(runtime_error("determineITRF1993Parameters(): ")); + throw boost::enable_current_exception(std::runtime_error("determineITRF1993Parameters(): ")); } } @@ -1034,7 +1031,7 @@ void determineITRF1994Parameters(transformation_parameter_set& tParam) case ITRF2005_i_xyz: case ITRF2005_i: // No direct parameters exist! - throw RefTranException(message_parameters_undefined(tParam.from_to_.first, tParam.from_to_.second), + throw RefTranException(message_parameters_undefined(tParam.from_to_.first, tParam.from_to_.second), REFTRAN_DIRECT_PARAMS_UNAVAILABLE); // ITRF1994-to-ITRF1994 case ITRF1994_i_xyz: @@ -1097,7 +1094,7 @@ void determineITRF1994Parameters(transformation_parameter_set& tParam) case WGS84_G2139_i_xyz: case WGS84_G2139_i: default: - throw boost::enable_current_exception(runtime_error("determineITRF1994Parameters(): ")); + throw boost::enable_current_exception(std::runtime_error("determineITRF1994Parameters(): ")); } } @@ -1153,7 +1150,7 @@ void determineITRF1996Parameters(transformation_parameter_set& tParam) case ITRF2005_i_xyz: case ITRF2005_i: // No direct parameters exist! - throw RefTranException(message_parameters_undefined(tParam.from_to_.first, tParam.from_to_.second), + throw RefTranException(message_parameters_undefined(tParam.from_to_.first, tParam.from_to_.second), REFTRAN_DIRECT_PARAMS_UNAVAILABLE); // ITRF1996-to-ITRF1996 case ITRF1996_i_xyz: @@ -1216,7 +1213,7 @@ void determineITRF1996Parameters(transformation_parameter_set& tParam) case WGS84_G2139_i_xyz: case WGS84_G2139_i: default: - throw boost::enable_current_exception(runtime_error("determineITRF1996Parameters(): ")); + throw boost::enable_current_exception(std::runtime_error("determineITRF1996Parameters(): ")); } } @@ -1272,7 +1269,7 @@ void determineITRF1997Parameters(transformation_parameter_set& tParam) case ITRF2005_i_xyz: case ITRF2005_i: // No direct parameters exist! - throw RefTranException(message_parameters_undefined(tParam.from_to_.first, tParam.from_to_.second), + throw RefTranException(message_parameters_undefined(tParam.from_to_.first, tParam.from_to_.second), REFTRAN_DIRECT_PARAMS_UNAVAILABLE); // ITRF1997-to-ITRF1997 case ITRF1997_i_xyz: @@ -1335,7 +1332,7 @@ void determineITRF1997Parameters(transformation_parameter_set& tParam) case WGS84_G2139_i_xyz: case WGS84_G2139_i: default: - throw boost::enable_current_exception(runtime_error("determineITRF1997Parameters(): ")); + throw boost::enable_current_exception(std::runtime_error("determineITRF1997Parameters(): ")); } } @@ -1487,7 +1484,7 @@ void determineITRF2000Parameters(transformation_parameter_set& tParam) case WGS84_G2139_i_xyz: case WGS84_G2139_i: default: - throw boost::enable_current_exception(runtime_error("determineITRF2000Parameters(): ")); + throw boost::enable_current_exception(std::runtime_error("determineITRF2000Parameters(): ")); } } @@ -1543,7 +1540,7 @@ void determineITRF2005Parameters(transformation_parameter_set& tParam) case ITRF1997_i_xyz: case ITRF1997_i: // No direct parameters exist! - throw RefTranException(message_parameters_undefined(tParam.from_to_.first, tParam.from_to_.second), + throw RefTranException(message_parameters_undefined(tParam.from_to_.first, tParam.from_to_.second), REFTRAN_DIRECT_PARAMS_UNAVAILABLE); // ITRF2005-to-ITRF2000 case ITRF2000_i_xyz: @@ -1604,7 +1601,7 @@ void determineITRF2005Parameters(transformation_parameter_set& tParam) case WGS84_G2139_i_xyz: case WGS84_G2139_i: default: - throw boost::enable_current_exception(runtime_error("determineITRF2005Parameters(): ")); + throw boost::enable_current_exception(std::runtime_error("determineITRF2005Parameters(): ")); } } @@ -1752,7 +1749,7 @@ void determineITRF2008Parameters(transformation_parameter_set& tParam) case WGS84_G2139_i_xyz: case WGS84_G2139_i: default: - throw boost::enable_current_exception(runtime_error("determineITRF2008Parameters(): ")); + throw boost::enable_current_exception(std::runtime_error("determineITRF2008Parameters(): ")); } } @@ -1899,7 +1896,7 @@ void determineITRF2014Parameters(transformation_parameter_set& tParam) case WGS84_G2139_i_xyz: case WGS84_G2139_i: default: - throw boost::enable_current_exception(runtime_error("determineITRF2014Parameters(): ")); + throw boost::enable_current_exception(std::runtime_error("determineITRF2014Parameters(): ")); } } @@ -1923,7 +1920,7 @@ void determineITRF2020Parameters(transformation_parameter_set& tParam) case GDA94_i_2d: case GDA94_i: // No direct parameters exist! - throw RefTranException(message_parameters_undefined(tParam.from_to_.first, tParam.from_to_.second), + throw RefTranException(message_parameters_undefined(tParam.from_to_.first, tParam.from_to_.second), REFTRAN_DIRECT_PARAMS_UNAVAILABLE); break; ////////////////////////////////// @@ -2043,7 +2040,7 @@ void determineITRF2020Parameters(transformation_parameter_set& tParam) case WGS84_G2139_i_xyz: case WGS84_G2139_i: default: - throw boost::enable_current_exception(runtime_error("determineITRF2020Parameters(): ")); + throw boost::enable_current_exception(std::runtime_error("determineITRF2020Parameters(): ")); } } @@ -2194,18 +2191,18 @@ void determineHelmertParameters(transformation_parameter_set& tParam) REFTRAN_WGS84_TRANS_UNSUPPORTED); break; default: - throw boost::enable_current_exception(runtime_error("")); + throw boost::enable_current_exception(std::runtime_error("")); } } - catch (runtime_error& e) + catch (std::runtime_error& e) { - stringstream ss; - ss << "determineHelmertParameters():" << endl << - " " << e.what() << " Parameters for transforming between" << endl << - " " << datumFromEpsgCode(tParam.from_to_.first) << " and " << - datumFromEpsgCode(tParam.from_to_.second) << - " have not been defined yet." << endl; - throw boost::enable_current_exception(runtime_error(ss.str())); + std::stringstream ss; + ss << "determineHelmertParameters():" << std::endl << + " " << e.what() << " Parameters for transforming between" << std::endl << + " " << datumFromEpsgCode(tParam.from_to_.first) << " and " << + datumFromEpsgCode(tParam.from_to_.second) << + " have not been defined yet." << std::endl; + throw boost::enable_current_exception(std::runtime_error(ss.str())); } } diff --git a/dynadjust/include/ide/trace.cpp b/dynadjust/include/ide/trace.cpp index c4d662ed..81526dd0 100644 --- a/dynadjust/include/ide/trace.cpp +++ b/dynadjust/include/ide/trace.cpp @@ -20,7 +20,23 @@ // Description : Provides debug trace functionality when MFC is not used //============================================================================ +// prevent conflict with std::min(...) std::max(...) +#ifdef _WIN32 +#ifndef NOMINMAX +#define NOMINMAX +#endif +#endif + #ifdef _DEBUG + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif + +#ifndef VC_EXTRALEAN +#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#endif + #include #include #include diff --git a/dynadjust/include/io/dnaioadj.cpp b/dynadjust/include/io/dnaioadj.cpp index 16e6152b..4e5c7c6c 100644 --- a/dynadjust/include/io/dnaioadj.cpp +++ b/dynadjust/include/io/dnaioadj.cpp @@ -29,22 +29,22 @@ using namespace dynadjust::measurements; namespace dynadjust { namespace iostreams { -void dna_io_adj::print_adj_stn_header(ostream& os) +void dna_io_adj::print_adj_stn_header(std::ostream& os) { - os << endl << "Adjusted Coordinates" << endl << - "------------------------------------------" << endl << endl; + os << std::endl << "Adjusted Coordinates" << std::endl << + "------------------------------------------" << std::endl << std::endl; } -void dna_io_adj::print_adj_stn_block_header(ostream& os, const UINT32& block) +void dna_io_adj::print_adj_stn_block_header(std::ostream& os, const UINT32& block) { - os << endl << "Adjusted Coordinates (Block " << block + 1 << ")" << endl << - "------------------------------------------" << endl << endl; + os << std::endl << "Adjusted Coordinates (Block " << block + 1 << ")" << std::endl << + "------------------------------------------" << std::endl << std::endl; } -void dna_io_adj::print_stn_info_col_header(ostream& os, - const string& stn_coord_types, const UINT16& printStationCorrections) +void dna_io_adj::print_stn_info_col_header(std::ostream& os, + const std::string& stn_coord_types, const UINT16& printStationCorrections) { - os << setw(STATION) << left << "Station" << setw(CONSTRAINT) << left << "Const"; + os << std::setw(STATION) << std::left << "Station" << std::setw(CONSTRAINT) << std::left << "Const"; _it_str_const it_s; UINT32 width(0); @@ -90,32 +90,32 @@ void dna_io_adj::print_stn_info_col_header(ostream& os, } if (validType) - os << right << setw(width) << CDnaStation::CoordinateName(c); + os << std::right << std::setw(width) << CDnaStation::CoordinateName(c); } - os << setw(PAD2) << " " << - right << setw(STDDEV) << "SD(e)" << - right << setw(STDDEV) << "SD(n)" << - right << setw(STDDEV) << "SD(up)"; + os << std::setw(PAD2) << " " << + std::right << std::setw(STDDEV) << "SD(e)" << + std::right << std::setw(STDDEV) << "SD(n)" << + std::right << std::setw(STDDEV) << "SD(up)"; j += PAD2+STDDEV+STDDEV+STDDEV+PAD2+COMMENT; if (printStationCorrections) { - os << setw(PAD2) << " " << - right << setw(HEIGHT) << "Corr(e)" << - right << setw(HEIGHT) << "Corr(n)" << - right << setw(HEIGHT) << "Corr(up)"; + os << std::setw(PAD2) << " " << + std::right << std::setw(HEIGHT) << "Corr(e)" << + std::right << std::setw(HEIGHT) << "Corr(n)" << + std::right << std::setw(HEIGHT) << "Corr(up)"; j += PAD2+HEIGHT+HEIGHT+HEIGHT; } - os << setw(PAD2) << " " << left << "Description" << endl; + os << std::setw(PAD2) << " " << std::left << "Description" << std::endl; UINT32 i; for (i=0; i(vbinary_aml->size())); @@ -128,16 +128,16 @@ void dna_io_aml::write_aml_file(const string& aml_filename, pvUINT32 vbinary_aml aml_file.write(reinterpret_cast(&(*_it_aml)), sizeof(UINT32)); } } - catch (const ios_base::failure& f) { + catch (const std::ios_base::failure& f) { ss << f.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } aml_file.close(); @@ -171,11 +171,11 @@ void dna_io_aml::create_msr_to_stn_tally(const pvASLPtr vAssocStnList, v_aml_pai } -void dna_io_aml::write_msr_to_stn(ostream &os, pvstn_t bstBinaryRecords, +void dna_io_aml::write_msr_to_stn(std::ostream &os, pvstn_t bstBinaryRecords, pvUINT32 vStationList, vmsrtally& v_stnmsrTally, MsrTally* parsemsrTally) { // Print measurement to station summary header - string header("MEASUREMENT TO STATIONS "); + std::string header("MEASUREMENT TO STATIONS "); MsrToStnSummaryHeader(os, header); it_vUINT32 _it_stn(vStationList->begin()); @@ -211,7 +211,7 @@ void dna_io_aml::write_msr_to_stn(ostream &os, pvstn_t bstBinaryRecords, // Print the total count per measurement parsemsrTally->coutSummaryMsrToStn(os, "Totals"); - os << endl << endl; + os << std::endl << std::endl; if (msrRedundancies > 0) { @@ -221,11 +221,11 @@ void dna_io_aml::write_msr_to_stn(ostream &os, pvstn_t bstBinaryRecords, else os << " stations were"; - os << " found to have GNSS measurements and absolute terrestrial measurements:" << endl << endl; + os << " found to have GNSS measurements and absolute terrestrial measurements:" << std::endl << std::endl; // Print header - os << setw(STATION) << left << "Station" << setw(30) << "Measurement types" << "Count" << endl; - os << "------------------------------------------------------------" << endl; + os << std::setw(STATION) << std::left << "Station" << std::setw(30) << "Measurement types" << "Count" << std::endl; + os << "------------------------------------------------------------" << std::endl; // Print measurements to each station and the total count for each station for (_it_stn=vStationList->begin(); _it_stn != vStationList->end(); ++_it_stn) @@ -249,11 +249,11 @@ void dna_io_aml::write_msr_to_stn(ostream &os, pvstn_t bstBinaryRecords, } -void dna_io_aml::write_aml_file_txt(const string& bms_filename, const string& aml_filename, pvUINT32 vbinary_aml, const pvASLPtr vAssocStnList, vdnaStnPtr* vStations) +void dna_io_aml::write_aml_file_txt(const std::string& bms_filename, const std::string& aml_filename, pvUINT32 vbinary_aml, const pvASLPtr vAssocStnList, vdnaStnPtr* vStations) { vmsr_t binaryMsrRecords; - stringstream ss; - ss << "write_aml_file(): An error was encountered when opening " << bms_filename << "." << endl; + std::stringstream ss; + ss << "write_aml_file(): An error was encountered when opening " << bms_filename << "." << std::endl; binary_file_meta_t bms_meta; try { @@ -261,42 +261,42 @@ void dna_io_aml::write_aml_file_txt(const string& bms_filename, const string& am // Load binary stations data. Throws runtime_error on failure. bms.load_bms_file(bms_filename, &binaryMsrRecords, bms_meta); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } std::ofstream aml_file; ss.str(""); - ss << "write_aml_file(): An error was encountered when opening " << aml_filename << "." << endl; + ss << "write_aml_file(): An error was encountered when opening " << aml_filename << "." << std::endl; try { // create binary aml file. Throws runtime_error on failure. file_opener(aml_file, aml_filename, - ios::out | ios::binary, binary); + std::ios::out | std::ios::binary, binary); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } ss.str(""); - ss << "write_aml_file(): An error was encountered when writing to " << aml_filename << "." << endl; + ss << "write_aml_file(): An error was encountered when writing to " << aml_filename << "." << std::endl; // Write number of measurement records to file - stringstream ss_aml; + std::stringstream ss_aml; ss_aml << vbinary_aml->size() << " records"; - aml_file << left << setw(HEADER_18) << ss_aml.str(); - aml_file << left << setw(MSR) << "Msr index"; - aml_file << left << setw(MSR) << "Msr type"; - aml_file << left << setw(MSR) << "Cluster"; - aml_file << left << setw(MSR) << "Ignored msr?" << endl; + aml_file << std::left << std::setw(HEADER_18) << ss_aml.str(); + aml_file << std::left << std::setw(MSR) << "Msr index"; + aml_file << std::left << std::setw(MSR) << "Msr type"; + aml_file << std::left << std::setw(MSR) << "Cluster"; + aml_file << std::left << std::setw(MSR) << "Ignored msr?" << std::endl; it_vUINT32_const _it_aml(vbinary_aml->begin()); @@ -340,11 +340,11 @@ void dna_io_aml::write_aml_file_txt(const string& bms_filename, const string& am // may be unused. // Print station name - aml_file << setw(HEADER_18) << left << vStations->at(stn_index)->GetName(); + aml_file << std::setw(HEADER_18) << std::left << vStations->at(stn_index)->GetName(); // print the bmsr index // For clusters, this will be the index of the first binary element - aml_file << setw(MSR) << left << *_it_aml; + aml_file << std::setw(MSR) << std::left << *_it_aml; GetMsrIndices(binaryMsrRecords, *_it_aml, msrIndices); @@ -356,18 +356,18 @@ void dna_io_aml::write_aml_file_txt(const string& bms_filename, const string& am if (stn_index == binaryMsrRecords.at(*_it_msr).station1) { // All measurements have a first station - ss_aml << left << " (First)"; - aml_file << setw(MSR) << left << ss_aml.str(); + ss_aml << std::left << " (First)"; + aml_file << std::setw(MSR) << std::left << ss_aml.str(); ss_aml.str(""); switch (binaryMsrRecords.at(*_it_msr).measType) { case 'D': // Direction set case 'X': // GPS Baseline cluster case 'Y': // GPS point cluster - ss_aml << setw(MSR) << left << binaryMsrRecords.at(*_it_msr).clusterID; + ss_aml << std::setw(MSR) << std::left << binaryMsrRecords.at(*_it_msr).clusterID; break; default: - ss_aml << setw(MSR) << left << " "; + ss_aml << std::setw(MSR) << std::left << " "; break; } continue; @@ -382,13 +382,13 @@ void dna_io_aml::write_aml_file_txt(const string& bms_filename, const string& am if (stn_index == binaryMsrRecords.at(*_it_msr).station2) { if (binaryMsrRecords.at(*_it_msr).vectorCount1 > 0) - ss_aml << left << " (Second)"; + ss_aml << std::left << " (Second)"; else - ss_aml << left << " (Target)"; + ss_aml << std::left << " (Target)"; } - aml_file << setw(MSR) << left << ss_aml.str(); + aml_file << std::setw(MSR) << std::left << ss_aml.str(); ss_aml.str(""); - ss_aml << setw(MSR) << left << binaryMsrRecords.at(*_it_msr).clusterID; + ss_aml << std::setw(MSR) << std::left << binaryMsrRecords.at(*_it_msr).clusterID; break; case 'B': // Geodetic azimuth case 'C': // Chord dist @@ -398,40 +398,40 @@ void dna_io_aml::write_aml_file_txt(const string& bms_filename, const string& am case 'L': // Level difference case 'M': // MSL arc case 'S': // Slope distance - case 'V': // Zenith angle + case 'V': // Zenith distance case 'Z': // Vertical angle if (stn_index == binaryMsrRecords.at(*_it_msr).station2) - ss_aml << left << " (Second)"; - aml_file << setw(MSR) << left << ss_aml.str(); + ss_aml << std::left << " (Second)"; + aml_file << std::setw(MSR) << std::left << ss_aml.str(); ss_aml.str(""); - ss_aml << setw(MSR) << left << " "; + ss_aml << std::setw(MSR) << std::left << " "; break; case 'X': // GPS Baseline cluster if (stn_index == binaryMsrRecords.at(*_it_msr).station2) - ss_aml << left << " (Second)"; - aml_file << setw(MSR) << left << ss_aml.str(); + ss_aml << std::left << " (Second)"; + aml_file << std::setw(MSR) << std::left << ss_aml.str(); ss_aml.str(""); - ss_aml << setw(MSR) << left << binaryMsrRecords.at(*_it_msr).clusterID; + ss_aml << std::setw(MSR) << std::left << binaryMsrRecords.at(*_it_msr).clusterID; break; case 'A': // Horizontal angle if (stn_index == binaryMsrRecords.at(*_it_msr).station2) - ss_aml << left << " (Second)"; + ss_aml << std::left << " (Second)"; else if (stn_index == binaryMsrRecords.at(*_it_msr).station3) - ss_aml << left << " (Third)"; - aml_file << setw(MSR) << left << ss_aml.str(); + ss_aml << std::left << " (Third)"; + aml_file << std::setw(MSR) << std::left << ss_aml.str(); ss_aml.str(""); - ss_aml << setw(MSR) << left << " "; + ss_aml << std::setw(MSR) << std::left << " "; break; } } } - aml_file << setw(MSR) << left << ss_aml.str(); + aml_file << std::setw(MSR) << std::left << ss_aml.str(); if (binaryMsrRecords.at(*_it_aml).ignore) - aml_file << setw(MSR) << left << "*" << endl; // Ignored + aml_file << std::setw(MSR) << std::left << "*" << std::endl; // Ignored else - aml_file << setw(MSR) << left << " " << endl; + aml_file << std::setw(MSR) << std::left << " " << std::endl; // Move to the next AML record if (++_it_aml == vbinary_aml->end()) @@ -443,16 +443,16 @@ void dna_io_aml::write_aml_file_txt(const string& bms_filename, const string& am } while (_it_aml != vbinary_aml->end()); } - catch (const ios_base::failure& f) { + catch (const std::ios_base::failure& f) { ss << f.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } aml_file.close(); diff --git a/dynadjust/include/io/dnaioaml.hpp b/dynadjust/include/io/dnaioaml.hpp index 412838c4..7ab1ddde 100644 --- a/dynadjust/include/io/dnaioaml.hpp +++ b/dynadjust/include/io/dnaioaml.hpp @@ -44,14 +44,14 @@ class dna_io_aml : public dna_io_base dna_io_aml& operator=(const dna_io_aml& rhs); - void load_aml_file(const string& aml_filename, v_aml_pair* vbinary_aml, pvmsr_t bmsRecords); - void write_aml_file(const string& aml_filename, pvUINT32 vbinary_aml); - void write_aml_file_txt(const string& bms_filename, const string& aml_filename, pvUINT32 vbinary_aml, const pvASLPtr vAssocStnList, vdnaStnPtr* vStations); + void load_aml_file(const std::string& aml_filename, v_aml_pair* vbinary_aml, pvmsr_t bmsRecords); + void write_aml_file(const std::string& aml_filename, pvUINT32 vbinary_aml); + void write_aml_file_txt(const std::string& bms_filename, const std::string& aml_filename, pvUINT32 vbinary_aml, const pvASLPtr vAssocStnList, vdnaStnPtr* vStations); void create_msr_to_stn_tally(const pvASLPtr vAssocStnList, v_aml_pair& vAssocMsrList, vmsrtally& stnmsrTally, vmsr_t& bmsBinaryRecords); - void write_msr_to_stn(ostream &os, pvstn_t bstBinaryRecords, + void write_msr_to_stn(std::ostream &os, pvstn_t bstBinaryRecords, pvUINT32 vStationList, vmsrtally& v_stnmsrTally, MsrTally* parsemsrTally); protected: diff --git a/dynadjust/include/io/dnaioasl.cpp b/dynadjust/include/io/dnaioasl.cpp index f5cfe6ab..34b4237f 100644 --- a/dynadjust/include/io/dnaioasl.cpp +++ b/dynadjust/include/io/dnaioasl.cpp @@ -30,26 +30,26 @@ namespace iostreams { // open the asl file. the asl file is required to ensure invalid stations are // excluded from the adjustment. invalid stations are those with no measurements. -UINT32 dna_io_asl::load_asl_file(const string& asl_filename, vASL* vbinary_asl, vUINT32* vfree_stn) +UINT32 dna_io_asl::load_asl_file(const std::string& asl_filename, vASL* vbinary_asl, vUINT32* vfree_stn) { std::ifstream asl_file; - stringstream ss; - ss << "load_asl_file(): An error was encountered when opening " << asl_filename << "." << endl; + std::stringstream ss; + ss << "load_asl_file(): An error was encountered when opening " << asl_filename << "." << std::endl; try { // open stations asl file. Throws runtime_error on failure. - file_opener(asl_file, asl_filename, ios::in | ios::binary, binary, true); + file_opener(asl_file, asl_filename, std::ios::in | std::ios::binary, binary, true); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } ss.str(""); - ss << "load_asl_file(): An error was encountered when reading from " << asl_filename << "." << endl; + ss << "load_asl_file(): An error was encountered when reading from " << asl_filename << "." << std::endl; UINT32 stnCount; @@ -77,16 +77,16 @@ UINT32 dna_io_asl::load_asl_file(const string& asl_filename, vASL* vbinary_asl, } } - catch (const ios_base::failure& f) { + catch (const std::ios_base::failure& f) { ss << f.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } asl_file.close(); @@ -94,27 +94,27 @@ UINT32 dna_io_asl::load_asl_file(const string& asl_filename, vASL* vbinary_asl, return stnCount; } -void dna_io_asl::write_asl_file(const string& asl_filename, pvASLPtr vbinary_asl) +void dna_io_asl::write_asl_file(const std::string& asl_filename, pvASLPtr vbinary_asl) { std::ofstream asl_file; - stringstream ss; - ss << "write_asl_file(): An error was encountered when opening " << asl_filename << "." << endl; + std::stringstream ss; + ss << "write_asl_file(): An error was encountered when opening " << asl_filename << "." << std::endl; try { // create binary asl file. Throws runtime_error on failure. file_opener(asl_file, asl_filename, - ios::out | ios::binary, binary); + std::ios::out | std::ios::binary, binary); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } ss.str(""); - ss << "write_asl_file(): An error was encountered when writing to " << asl_filename << "." << endl; + ss << "write_asl_file(): An error was encountered when writing to " << asl_filename << "." << std::endl; // Calculate number of station records and write to binary file UINT32 aslCount = static_cast(vbinary_asl->size()); @@ -130,16 +130,16 @@ void dna_io_asl::write_asl_file(const string& asl_filename, pvASLPtr vbinary_asl if (_it_asl->get()) asl_file << _it_asl->get(); // see dnastation.hpp (region CAStationList stream handlers) } - catch (const ios_base::failure& f) { + catch (const std::ios_base::failure& f) { ss << f.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } asl_file.close(); @@ -147,37 +147,37 @@ void dna_io_asl::write_asl_file(const string& asl_filename, pvASLPtr vbinary_asl // prints ASL entries sorted according to measurement count, which is useful when determining // the starting station to begin network segmentation. -void dna_io_asl::write_asl_file_txt(const string& asl_filename, pvASLPtr vbinary_asl, vdnaStnPtr* vStations) +void dna_io_asl::write_asl_file_txt(const std::string& asl_filename, pvASLPtr vbinary_asl, vdnaStnPtr* vStations) { std::ofstream asl_file; - stringstream ss; - ss << "write_asl_file_txt(): An error was encountered when opening " << asl_filename << "." << endl; + std::stringstream ss; + ss << "write_asl_file_txt(): An error was encountered when opening " << asl_filename << "." << std::endl; try { // create binary asl file. Throws runtime_error on failure. file_opener(asl_file, asl_filename); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } ss.str(""); - ss << "write_asl_file_txt(): An error was encountered when writing to " << asl_filename << "." << endl; + ss << "write_asl_file_txt(): An error was encountered when writing to " << asl_filename << "." << std::endl; // Calculate number of station records and write to binary file size_t aslCount = vbinary_asl->size(); // Pump to text file - stringstream ss_asl; + std::stringstream ss_asl; ss_asl << aslCount << " stations"; - asl_file << left << setw(STATION) << ss_asl.str(); - asl_file << setw(HEADER_20) << right << "No. connected msrs"; - asl_file << setw(STATION) << right << "AML index"; - asl_file << setw(STATION) << right << "Unused?" << endl; + asl_file << std::left << std::setw(STATION) << ss_asl.str(); + asl_file << std::setw(HEADER_20) << std::right << "No. connected msrs"; + asl_file << std::setw(STATION) << std::right << "AML index"; + asl_file << std::setw(STATION) << std::right << "Unused?" << std::endl; // Create an incrementing list and sort on number of measurements to each station vUINT32 aslPtrs(vbinary_asl->size()); @@ -185,7 +185,7 @@ void dna_io_asl::write_asl_file_txt(const string& asl_filename, pvASLPtr vbinary // Sort on measurement count CompareMeasCount2 msrcountCompareFunc(vbinary_asl); - sort(aslPtrs.begin(), aslPtrs.end(), msrcountCompareFunc); + std::sort(aslPtrs.begin(), aslPtrs.end(), msrcountCompareFunc); vbinary_asl->at(0).get()->GetAMLStnIndex(); @@ -202,28 +202,28 @@ void dna_io_asl::write_asl_file_txt(const string& asl_filename, pvASLPtr vbinary _it_pasl = vbinary_asl->begin() + *_it_asl; // Name and measurement count - asl_file << setw(STATION) << left << + asl_file << std::setw(STATION) << std::left << vStations->at(*_it_asl)->GetName() << - setw(HEADER_20) << right << _it_pasl->get()->GetAssocMsrCount(); + std::setw(HEADER_20) << std::right << _it_pasl->get()->GetAssocMsrCount(); // Aml station index if (_it_pasl->get()->GetAssocMsrCount() == 0) - asl_file << setw(STATION) << "-"; + asl_file << std::setw(STATION) << "-"; else - asl_file << setw(STATION) << right << _it_pasl->get()->GetAMLStnIndex(); + asl_file << std::setw(STATION) << std::right << _it_pasl->get()->GetAMLStnIndex(); // Valid station? - asl_file << setw(STATION) << right << (_it_pasl->get()->IsValid() ? " " : "*") << endl; + asl_file << std::setw(STATION) << std::right << (_it_pasl->get()->IsValid() ? " " : "*") << std::endl; } } - catch (const ios_base::failure& f) { + catch (const std::ios_base::failure& f) { ss << f.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } asl_file.close(); diff --git a/dynadjust/include/io/dnaioasl.hpp b/dynadjust/include/io/dnaioasl.hpp index 72327167..d288bf9d 100644 --- a/dynadjust/include/io/dnaioasl.hpp +++ b/dynadjust/include/io/dnaioasl.hpp @@ -47,9 +47,9 @@ class dna_io_asl : public dna_io_base dna_io_asl& operator=(const dna_io_asl& rhs); - UINT32 load_asl_file(const string& asl_filename, vASL* vbinary_asl, vUINT32* vfree_stn); - void write_asl_file(const string& asl_filename, pvASLPtr vbinary_asl); - void write_asl_file_txt(const string& asl_filename, pvASLPtr vbinary_asl, vdnaStnPtr* vStations); + UINT32 load_asl_file(const std::string& asl_filename, vASL* vbinary_asl, vUINT32* vfree_stn); + void write_asl_file(const std::string& asl_filename, pvASLPtr vbinary_asl); + void write_asl_file_txt(const std::string& asl_filename, pvASLPtr vbinary_asl, vdnaStnPtr* vStations); protected: diff --git a/dynadjust/include/io/dnaiobase.cpp b/dynadjust/include/io/dnaiobase.cpp index 24315e4d..2e74d2a5 100644 --- a/dynadjust/include/io/dnaiobase.cpp +++ b/dynadjust/include/io/dnaiobase.cpp @@ -25,15 +25,13 @@ #include #include -using namespace boost::gregorian; - namespace dynadjust { namespace iostreams { dna_io_base::dna_io_base(void) : m_strVersion(__FILE_VERSION__) , m_strDate("") - , m_strApp("DNA" + string(__SHORT_VERSION__)) + , m_strApp("DNA" + std::string(__SHORT_VERSION__)) { } @@ -91,11 +89,16 @@ void dna_io_base::writeFileMetadata(std::ofstream& file_stream, binary_file_meta file_stream.write(reinterpret_cast(file_meta.epsgCode), STN_EPSG_WIDTH); file_stream.write(reinterpret_cast(file_meta.epoch), STN_EPOCH_WIDTH); + file_stream.write(reinterpret_cast(&file_meta.reftran), sizeof(bool)); + file_stream.write(reinterpret_cast(&file_meta.geoid), sizeof(bool)); + // Write file count and file meta file_stream.write(reinterpret_cast(&file_meta.inputFileCount), sizeof(UINT16)); for (UINT16 i(0); i(file_meta.inputFileMeta[i].filename), FILE_NAME_WIDTH); + file_stream.write(reinterpret_cast(file_meta.inputFileMeta[i].epsgCode), STN_EPSG_WIDTH); + file_stream.write(reinterpret_cast(file_meta.inputFileMeta[i].epoch), STN_EPOCH_WIDTH); file_stream.write(reinterpret_cast(&file_meta.inputFileMeta[i].filetype), sizeof(UINT16)); file_stream.write(reinterpret_cast(&file_meta.inputFileMeta[i].datatype), sizeof(UINT16)); } @@ -113,6 +116,9 @@ void dna_io_base::readFileMetadata(std::ifstream& file_stream, binary_file_meta_ file_stream.read(reinterpret_cast(file_meta.epsgCode), STN_EPSG_WIDTH); file_stream.read(reinterpret_cast(file_meta.epoch), STN_EPOCH_WIDTH); + file_stream.read(reinterpret_cast(&file_meta.reftran), sizeof(bool)); + file_stream.read(reinterpret_cast(&file_meta.geoid), sizeof(bool)); + // Read file count and file meta file_stream.read(reinterpret_cast(&file_meta.inputFileCount), sizeof(UINT16)); if (file_meta.inputFileMeta != NULL) @@ -123,6 +129,8 @@ void dna_io_base::readFileMetadata(std::ifstream& file_stream, binary_file_meta_ for (UINT16 i(0); i(file_meta.inputFileMeta[i].filename), FILE_NAME_WIDTH); + file_stream.read(reinterpret_cast(file_meta.inputFileMeta[i].epsgCode), STN_EPSG_WIDTH); + file_stream.read(reinterpret_cast(file_meta.inputFileMeta[i].epoch), STN_EPOCH_WIDTH); file_stream.read(reinterpret_cast(&file_meta.inputFileMeta[i].filetype), sizeof(UINT16)); file_stream.read(reinterpret_cast(&file_meta.inputFileMeta[i].datatype), sizeof(UINT16)); } @@ -164,9 +172,9 @@ void dna_io_base::writeDate(std::ofstream& file_stream) char dateField[identifier_field_width+1]; // Form date string - date today(day_clock::local_day()); - stringstream date_string; - date_string << right << to_iso_extended_string(today); + boost::gregorian::date today(boost::gregorian::day_clock::local_day()); + std::stringstream date_string; + date_string << std::right << to_iso_extended_string(today); m_strDate = date_string.str(); // write creation date field name diff --git a/dynadjust/include/io/dnaiobase.hpp b/dynadjust/include/io/dnaiobase.hpp index dd90662a..e8aa9b16 100644 --- a/dynadjust/include/io/dnaiobase.hpp +++ b/dynadjust/include/io/dnaiobase.hpp @@ -36,8 +36,6 @@ #define __FILE_VERSION__ "1.0" -using namespace std; - namespace dynadjust { namespace iostreams { @@ -69,8 +67,8 @@ class dna_io_base dna_io_base& operator=(const dna_io_base& rhs); - inline string getVersion() const { return m_strVersion; } - inline void setVersion(const string& version) { m_strVersion = version; } + inline std::string getVersion() const { return m_strVersion; } + inline void setVersion(const std::string& version) { m_strVersion = version; } void writeFileInfo(std::ofstream& file_stream); void readFileInfo(std::ifstream& file_stream); @@ -87,9 +85,9 @@ class dna_io_base void writeApp(std::ofstream& file_stream); void readApp(std::ifstream& file_stream); - string m_strVersion; - string m_strDate; - string m_strApp; + std::string m_strVersion; + std::string m_strDate; + std::string m_strApp; }; } // namespace measurements diff --git a/dynadjust/include/io/dnaiobms.cpp b/dynadjust/include/io/dnaiobms.cpp index a541e02b..f9e1f6ac 100644 --- a/dynadjust/include/io/dnaiobms.cpp +++ b/dynadjust/include/io/dnaiobms.cpp @@ -29,9 +29,9 @@ namespace iostreams { UINT16 dna_io_bms::create_msr_input_file_meta(vifm_t& vinput_file_meta, input_file_meta_t** input_file_meta) { UINT16 msr_file_count(0); - stringstream ss; - ss << "create_msr_input_file_meta(): An error was encountered when creating " << endl << - " the binary measurement file metadata." << endl; + std::stringstream ss; + ss << "create_msr_input_file_meta(): An error was encountered when creating " << std::endl << + " the binary measurement file metadata." << std::endl; // Determine how many measurement files were supplied try { @@ -58,32 +58,32 @@ UINT16 dna_io_bms::create_msr_input_file_meta(vifm_t& vinput_file_meta, input_fi } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } return msr_file_count; } -void dna_io_bms::load_bms_file_meta(const string& bms_filename, binary_file_meta_t& bms_meta) +void dna_io_bms::load_bms_file_meta(const std::string& bms_filename, binary_file_meta_t& bms_meta) { std::ifstream bms_file; - stringstream ss; - ss << "load_bms_file(): An error was encountered when opening " << bms_filename << "." << endl; + std::stringstream ss; + ss << "load_bms_file(): An error was encountered when opening " << bms_filename << "." << std::endl; try { // open binary measurements file. Throws runtime_error on failure. - file_opener(bms_file, bms_filename, ios::in | ios::binary, binary, true); + file_opener(bms_file, bms_filename, std::ios::in | std::ios::binary, binary, true); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } ss.str(""); - ss << "load_bms_file(): An error was encountered when reading from " << bms_filename << "." << endl; + ss << "load_bms_file(): An error was encountered when reading from " << bms_filename << "." << std::endl; try { // read the file information @@ -92,44 +92,44 @@ void dna_io_bms::load_bms_file_meta(const string& bms_filename, binary_file_meta // read the metadata readFileMetadata(bms_file, bms_meta); } - catch (const ios_base::failure& f) { + catch (const std::ios_base::failure& f) { ss << f.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } bms_file.close(); } -UINT32 dna_io_bms::load_bms_file(const string& bms_filename, pvmsr_t vbinary_msr, binary_file_meta_t& bms_meta) +UINT32 dna_io_bms::load_bms_file(const std::string& bms_filename, pvmsr_t vbinary_msr, binary_file_meta_t& bms_meta) { std::ifstream bms_file; - stringstream ss; - ss << "load_bms_file(): An error was encountered when opening " << bms_filename << "." << endl; + std::stringstream ss; + ss << "load_bms_file(): An error was encountered when opening " << bms_filename << "." << std::endl; try { // open binary measurements file. Throws runtime_error on failure. - file_opener(bms_file, bms_filename, ios::in | ios::binary, binary, true); + file_opener(bms_file, bms_filename, std::ios::in | std::ios::binary, binary, true); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } measurement_t measRecord; UINT32 msr; ss.str(""); - ss << "load_bms_file(): An error was encountered when reading from " << bms_filename << "." << endl; + ss << "load_bms_file(): An error was encountered when reading from " << bms_filename << "." << std::endl; try { // read the file information @@ -146,16 +146,16 @@ UINT32 dna_io_bms::load_bms_file(const string& bms_filename, pvmsr_t vbinary_msr vbinary_msr->push_back(measRecord); } } - catch (const ios_base::failure& f) { + catch (const std::ios_base::failure& f) { ss << f.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } bms_file.close(); @@ -163,27 +163,27 @@ UINT32 dna_io_bms::load_bms_file(const string& bms_filename, pvmsr_t vbinary_msr return bms_meta.binCount; } -void dna_io_bms::write_bms_file(const string& bms_filename, pvmsr_t vbinary_msr, binary_file_meta_t& bms_meta) +void dna_io_bms::write_bms_file(const std::string& bms_filename, pvmsr_t vbinary_msr, binary_file_meta_t& bms_meta) { std::ofstream bms_file; - stringstream ss; - ss << "write_bms_file(): An error was encountered when opening " << bms_filename << "." << endl; + std::stringstream ss; + ss << "write_bms_file(): An error was encountered when opening " << bms_filename << "." << std::endl; try { // open binary measurements file. Throws runtime_error on failure. file_opener(bms_file, bms_filename, - ios::out | ios::binary, binary); + std::ios::out | std::ios::binary, binary); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } ss.str(""); - ss << "write_bms_file(): An error was encountered when writing to " << bms_filename << "." << endl; + ss << "write_bms_file(): An error was encountered when writing to " << bms_filename << "." << std::endl; try { // write the file information @@ -197,42 +197,42 @@ void dna_io_bms::write_bms_file(const string& bms_filename, pvmsr_t vbinary_msr, for (_it_msr=vbinary_msr->begin(); _it_msr!=vbinary_msr->end(); ++_it_msr) bms_file.write(reinterpret_cast(&(*_it_msr)), sizeof(measurement_t)); } - catch (const ios_base::failure& f) { + catch (const std::ios_base::failure& f) { ss << f.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } bms_file.close(); } -void dna_io_bms::write_bms_file(const string& bms_filename, vdnaMsrPtr* vMeasurements, binary_file_meta_t& bms_meta) +void dna_io_bms::write_bms_file(const std::string& bms_filename, vdnaMsrPtr* vMeasurements, binary_file_meta_t& bms_meta) { std::ofstream bms_file; - stringstream ss; - ss << "write_bms_file(): An error was encountered when opening " << bms_filename << "." << endl; + std::stringstream ss; + ss << "write_bms_file(): An error was encountered when opening " << bms_filename << "." << std::endl; try { // open binary measurements file. Throws runtime_error on failure. file_opener(bms_file, bms_filename, - ios::out | ios::binary, binary); + std::ios::out | std::ios::binary, binary); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } ss.str(""); - ss << "write_bms_file(): An error was encountered when writing to " << bms_filename << "." << endl; + ss << "write_bms_file(): An error was encountered when writing to " << bms_filename << "." << std::endl; _it_vdnamsrptr _it_msr; UINT32 msrIndex(0); @@ -248,16 +248,16 @@ void dna_io_bms::write_bms_file(const string& bms_filename, vdnaMsrPtr* vMeasure for (_it_msr=vMeasurements->begin(); _it_msr!=vMeasurements->end(); ++_it_msr) _it_msr->get()->WriteBinaryMsr(&bms_file, &msrIndex); } - catch (const ios_base::failure& f) { + catch (const std::ios_base::failure& f) { ss << f.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } bms_file.close(); diff --git a/dynadjust/include/io/dnaiobms.hpp b/dynadjust/include/io/dnaiobms.hpp index 61f10728..8f7d4192 100644 --- a/dynadjust/include/io/dnaiobms.hpp +++ b/dynadjust/include/io/dnaiobms.hpp @@ -48,10 +48,10 @@ class dna_io_bms : public dna_io_base dna_io_bms& operator=(const dna_io_bms& rhs); UINT16 create_msr_input_file_meta(vifm_t& vinput_file_meta, input_file_meta_t** input_file_meta); - void load_bms_file_meta(const string& bms_filename, binary_file_meta_t& bms_meta); - UINT32 load_bms_file(const string& bms_filename, pvmsr_t vbinary_msr, binary_file_meta_t& bms_meta); - void write_bms_file(const string& bms_filename, pvmsr_t vbinary_msr, binary_file_meta_t& bms_meta); - void write_bms_file(const string& bms_filename, vdnaMsrPtr* vMeasurements, binary_file_meta_t& bms_meta); + void load_bms_file_meta(const std::string& bms_filename, binary_file_meta_t& bms_meta); + UINT32 load_bms_file(const std::string& bms_filename, pvmsr_t vbinary_msr, binary_file_meta_t& bms_meta); + void write_bms_file(const std::string& bms_filename, pvmsr_t vbinary_msr, binary_file_meta_t& bms_meta); + void write_bms_file(const std::string& bms_filename, vdnaMsrPtr* vMeasurements, binary_file_meta_t& bms_meta); protected: diff --git a/dynadjust/include/io/dnaiobst.cpp b/dynadjust/include/io/dnaiobst.cpp index 731f409b..f3132259 100644 --- a/dynadjust/include/io/dnaiobst.cpp +++ b/dynadjust/include/io/dnaiobst.cpp @@ -29,9 +29,9 @@ namespace iostreams { UINT16 dna_io_bst::create_stn_input_file_meta(vifm_t& vinput_file_meta, input_file_meta_t** input_file_meta) { UINT16 stn_file_count(0); - stringstream ss; - ss << "create_stn_input_file_meta(): An error was encountered when creating " << endl << - " the binary station file metadata." << endl; + std::stringstream ss; + ss << "create_stn_input_file_meta(): An error was encountered when creating " << std::endl << + " the binary station file metadata." << std::endl; // Determine how many station files were supplied try { @@ -58,32 +58,32 @@ UINT16 dna_io_bst::create_stn_input_file_meta(vifm_t& vinput_file_meta, input_fi } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } return stn_file_count; } -void dna_io_bst::load_bst_file_meta(const string& bst_filename, binary_file_meta_t& bst_meta) +void dna_io_bst::load_bst_file_meta(const std::string& bst_filename, binary_file_meta_t& bst_meta) { std::ifstream bst_file; - stringstream ss; - ss << "load_bst_file(): An error was encountered when opening " << bst_filename << "." << endl; + std::stringstream ss; + ss << "load_bst_file(): An error was encountered when opening " << bst_filename << "." << std::endl; try { // open binary stations file. Throws runtime_error on failure. - file_opener(bst_file, bst_filename, ios::in | ios::binary, binary, true); + file_opener(bst_file, bst_filename, std::ios::in | std::ios::binary, binary, true); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } ss.str(""); - ss << "load_bst_file(): An error was encountered when reading from " << bst_filename << "." << endl; + ss << "load_bst_file(): An error was encountered when reading from " << bst_filename << "." << std::endl; try { // read the file information @@ -92,45 +92,45 @@ void dna_io_bst::load_bst_file_meta(const string& bst_filename, binary_file_meta // read the metadata readFileMetadata(bst_file, bst_meta); } - catch (const ios_base::failure& f) { + catch (const std::ios_base::failure& f) { ss << f.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } bst_file.close(); } -UINT32 dna_io_bst::load_bst_file(const string& bst_filename, pvstn_t vbinary_stn, binary_file_meta_t& bst_meta) +UINT32 dna_io_bst::load_bst_file(const std::string& bst_filename, pvstn_t vbinary_stn, binary_file_meta_t& bst_meta) { std::ifstream bst_file; - stringstream ss; - ss << "load_bst_file(): An error was encountered when opening " << bst_filename << "." << endl; + std::stringstream ss; + ss << "load_bst_file(): An error was encountered when opening " << bst_filename << "." << std::endl; try { // open binary stations file. Throws runtime_error on failure. - file_opener(bst_file, bst_filename, ios::in | ios::binary, binary, true); + file_opener(bst_file, bst_filename, std::ios::in | std::ios::binary, binary, true); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } station_t stationRecord; UINT32 stn; ss.str(""); - ss << "load_bst_file(): An error was encountered when reading from " << bst_filename << "." << endl; + ss << "load_bst_file(): An error was encountered when reading from " << bst_filename << "." << std::endl; try { // read the file information @@ -147,16 +147,16 @@ UINT32 dna_io_bst::load_bst_file(const string& bst_filename, pvstn_t vbinary_stn vbinary_stn->push_back(stationRecord); } } - catch (const ios_base::failure& f) { + catch (const std::ios_base::failure& f) { ss << f.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } bst_file.close(); @@ -164,27 +164,27 @@ UINT32 dna_io_bst::load_bst_file(const string& bst_filename, pvstn_t vbinary_stn return bst_meta.binCount; } -void dna_io_bst::write_bst_file(const string& bst_filename, pvstn_t vbinary_stn, binary_file_meta_t& bst_meta) +void dna_io_bst::write_bst_file(const std::string& bst_filename, pvstn_t vbinary_stn, binary_file_meta_t& bst_meta) { std::ofstream bst_file; - stringstream ss; - ss << "write_bst_file(): An error was encountered when opening " << bst_filename << "." << endl; + std::stringstream ss; + ss << "write_bst_file(): An error was encountered when opening " << bst_filename << "." << std::endl; try { // open binary stations file. Throws runtime_error on failure. file_opener(bst_file, bst_filename, - ios::out | ios::binary, binary); + std::ios::out | std::ios::binary, binary); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } ss.str(""); - ss << "write_bst_file(): An error was encountered when writing to " << bst_filename << "." << endl; + ss << "write_bst_file(): An error was encountered when writing to " << bst_filename << "." << std::endl; try { // write version @@ -198,42 +198,42 @@ void dna_io_bst::write_bst_file(const string& bst_filename, pvstn_t vbinary_stn, for (; _it_stn!=vbinary_stn->end(); ++_it_stn) bst_file.write(reinterpret_cast(&(*_it_stn)), sizeof(station_t)); } - catch (const ios_base::failure& f) { + catch (const std::ios_base::failure& f) { ss << f.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } bst_file.close(); } -bool dna_io_bst::write_bst_file(const string& bst_filename, vdnaStnPtr* vStations, pvstring vUnusedStns, binary_file_meta_t& bst_meta, bool flagUnused) +bool dna_io_bst::write_bst_file(const std::string& bst_filename, vdnaStnPtr* vStations, pvstring vUnusedStns, binary_file_meta_t& bst_meta, bool flagUnused) { std::ofstream bst_file; - stringstream ss; - ss << "write_bst_file(): An error was encountered when opening " << bst_filename << "." << endl; + std::stringstream ss; + ss << "write_bst_file(): An error was encountered when opening " << bst_filename << "." << std::endl; try { // open binary stations file. Throws runtime_error on failure. file_opener(bst_file, bst_filename, - ios::out | ios::binary, binary); + std::ios::out | std::ios::binary, binary); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } ss.str(""); - ss << "write_bst_file(): An error was encountered when writing to " << bst_filename << "." << endl; + ss << "write_bst_file(): An error was encountered when writing to " << bst_filename << "." << std::endl; _it_vdnastnptr _it_stn; @@ -247,7 +247,7 @@ bool dna_io_bst::write_bst_file(const string& bst_filename, vdnaStnPtr* vStation // write the bst data if (flagUnused) { - sort(vUnusedStns->begin(), vUnusedStns->end()); + std::sort(vUnusedStns->begin(), vUnusedStns->end()); for (_it_stn=vStations->begin(); _it_stn!=vStations->end(); _it_stn++) { if (binary_search(vUnusedStns->begin(), vUnusedStns->end(), _it_stn->get()->GetName())) @@ -263,16 +263,16 @@ bool dna_io_bst::write_bst_file(const string& bst_filename, vdnaStnPtr* vStation for (_it_stn=vStations->begin(); _it_stn!=vStations->end(); _it_stn++) _it_stn->get()->WriteBinaryStn(&bst_file); } - catch (const ios_base::failure& f) { + catch (const std::ios_base::failure& f) { ss << f.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } bst_file.close(); diff --git a/dynadjust/include/io/dnaiobst.hpp b/dynadjust/include/io/dnaiobst.hpp index b9146f05..7b844c5a 100644 --- a/dynadjust/include/io/dnaiobst.hpp +++ b/dynadjust/include/io/dnaiobst.hpp @@ -48,10 +48,10 @@ class dna_io_bst : public dna_io_base dna_io_bst& operator=(const dna_io_bst& rhs); UINT16 create_stn_input_file_meta(vifm_t& vinput_file_meta, input_file_meta_t** input_file_meta); - void load_bst_file_meta(const string& bst_filename, binary_file_meta_t& bst_meta); - UINT32 load_bst_file(const string& bst_filename, pvstn_t vbinary_stn, binary_file_meta_t& bst_meta); - void write_bst_file(const string& bst_filename, pvstn_t vbinary_stn, binary_file_meta_t& bst_meta); - bool write_bst_file(const string& bst_filename, vdnaStnPtr* vStations, pvstring vUnusedStns, binary_file_meta_t& bst_meta, bool flagUnused); + void load_bst_file_meta(const std::string& bst_filename, binary_file_meta_t& bst_meta); + UINT32 load_bst_file(const std::string& bst_filename, pvstn_t vbinary_stn, binary_file_meta_t& bst_meta); + void write_bst_file(const std::string& bst_filename, pvstn_t vbinary_stn, binary_file_meta_t& bst_meta); + bool write_bst_file(const std::string& bst_filename, vdnaStnPtr* vStations, pvstring vUnusedStns, binary_file_meta_t& bst_meta, bool flagUnused); protected: diff --git a/dynadjust/include/io/dnaiodna.cpp b/dynadjust/include/io/dnaiodna.cpp index 7caa5898..d3ad830d 100644 --- a/dynadjust/include/io/dnaiodna.cpp +++ b/dynadjust/include/io/dnaiodna.cpp @@ -31,9 +31,9 @@ namespace dynadjust { namespace iostreams { void dna_io_dna::write_dna_files(vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements, - const string& stnfilename, const string& msrfilename, const string& networkname, + const std::string& stnfilename, const std::string& msrfilename, const std::string& networkname, const CDnaDatum& datum, const CDnaProjection& projection, bool flagUnused, - const string& stn_comment, const string& msr_comment) + const std::string& stn_comment, const std::string& msr_comment) { write_stn_file(vStations, stnfilename, networkname, datum, projection, flagUnused, stn_comment); @@ -41,21 +41,21 @@ void dna_io_dna::write_dna_files(vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurement } void dna_io_dna::write_dna_files(pvstn_t vbinary_stn, pvmsr_t vbinary_msr, - const string& stnfilename, const string& msrfilename, const string& networkname, + const std::string& stnfilename, const std::string& msrfilename, const std::string& networkname, const CDnaDatum& datum, const CDnaProjection& projection, bool flagUnused, - const string& stn_comment, const string& msr_comment) + const std::string& stn_comment, const std::string& msr_comment) { write_stn_file(vbinary_stn, stnfilename, networkname, datum, projection, flagUnused, stn_comment); write_msr_file(*vbinary_stn, vbinary_msr, msrfilename, networkname, datum, msr_comment); } -void dna_io_dna::create_file_stn(std::ofstream* ptr, const string& filename) +void dna_io_dna::create_file_stn(std::ofstream* ptr, const std::string& filename) { determineDNASTNFieldParameters("3.01", dsl_, dsw_); create_file_pointer(ptr, filename); } -void dna_io_dna::create_file_msr(std::ofstream* ptr, const string& filename) +void dna_io_dna::create_file_msr(std::ofstream* ptr, const std::string& filename) { determineDNAMSRFieldParameters("3.01", dml_, dmw_); create_file_pointer(ptr, filename); @@ -69,30 +69,30 @@ void dna_io_dna::prepare_sort_list(const UINT32 count) initialiseIncrementingIntegerVector(vStationList_, count); } -void dna_io_dna::create_file_pointer(std::ofstream* ptr, const string& filename) +void dna_io_dna::create_file_pointer(std::ofstream* ptr, const std::string& filename) { try { // Create file pointer to DNA file. file_opener(*ptr, filename); } - catch (const runtime_error& e) { - throw boost::enable_current_exception(runtime_error(e.what())); + catch (const std::runtime_error& e) { + throw boost::enable_current_exception(std::runtime_error(e.what())); } } -void dna_io_dna::open_file_pointer(std::ifstream* ptr, const string& filename) +void dna_io_dna::open_file_pointer(std::ifstream* ptr, const std::string& filename) { try { // Open DNA file. - file_opener(*ptr, filename, ios::in, ascii, true); + file_opener(*ptr, filename, std::ios::in, ascii, true); } - catch (const runtime_error& e) { - throw boost::enable_current_exception(runtime_error(e.what())); + catch (const std::runtime_error& e) { + throw boost::enable_current_exception(std::runtime_error(e.what())); } } -void dna_io_dna::write_stn_header_data(std::ofstream* ptr, const string& networkname, const string& datum, - const string& epoch, const size_t& count, const string& comment) +void dna_io_dna::write_stn_header_data(std::ofstream* ptr, const std::string& networkname, const std::string& datum, + const std::string& epoch, const size_t& count, const std::string& comment) { // Write version line dna_header(*ptr, "3.01", "STN", datum, epoch, count); @@ -105,8 +105,8 @@ void dna_io_dna::write_stn_header_data(std::ofstream* ptr, const string& network dna_comment(*ptr, comment); } -void dna_io_dna::write_stn_header(std::ofstream* ptr, vdnaStnPtr* vStations, const string& networkname, - const CDnaDatum& datum, bool flagUnused, const string& comment) +void dna_io_dna::write_stn_header(std::ofstream* ptr, vdnaStnPtr* vStations, const std::string& networkname, + const CDnaDatum& datum, bool flagUnused, const std::string& comment) { // print stations // Has the user specified --flag-unused-stations, in which case, do not @@ -128,8 +128,8 @@ void dna_io_dna::write_stn_header(std::ofstream* ptr, vdnaStnPtr* vStations, con } -void dna_io_dna::write_stn_header(std::ofstream* ptr, pvstn_t vbinary_stn, const string& networkname, - const CDnaDatum& datum, bool flagUnused, const string& comment) +void dna_io_dna::write_stn_header(std::ofstream* ptr, pvstn_t vbinary_stn, const std::string& networkname, + const CDnaDatum& datum, bool flagUnused, const std::string& comment) { // print stations // Has the user specified --flag-unused-stations, in which case, do not @@ -151,21 +151,21 @@ void dna_io_dna::write_stn_header(std::ofstream* ptr, pvstn_t vbinary_stn, const } -void dna_io_dna::read_ren_file(const string& filename, pv_string_vstring_pair stnRenaming) +void dna_io_dna::read_ren_file(const std::string& filename, pv_string_vstring_pair stnRenaming) { std::ifstream renaming_file; // create file pointer open_file_pointer(&renaming_file, filename); - string version; + std::string version; INPUT_DATA_TYPE idt; CDnaDatum datum; - string geoidVersion, fileEpsg, fileEpoch; + std::string geoidVersion, fileEpsg, fileEpoch; UINT32 count(0); // read header information - read_dna_header(&renaming_file, version, idt, datum, false, false, fileEpsg, fileEpoch, geoidVersion, count); + read_dna_header(&renaming_file, version, idt, datum, fileEpsg, fileEpoch, geoidVersion, count); read_ren_data(&renaming_file, stnRenaming); @@ -174,7 +174,7 @@ void dna_io_dna::read_ren_file(const string& filename, pv_string_vstring_pair st void dna_io_dna::read_ren_data(std::ifstream* ptr, pv_string_vstring_pair stnRenaming) { - string sBuf; + std::string sBuf; string_vstring_pair stnNames; vstring altStnNames; @@ -187,9 +187,9 @@ void dna_io_dna::read_ren_data(std::ifstream* ptr, pv_string_vstring_pair stnRen catch (...) { if (ptr->eof()) return; - stringstream ss; - ss << "read_ren_data(): Could not read from the renaming file." << endl; - boost::enable_current_exception(runtime_error(ss.str())); + std::stringstream ss; + ss << "read_ren_data(): Could not read from the renaming file." << std::endl; + boost::enable_current_exception(std::runtime_error(ss.str())); } // blank or whitespace? @@ -204,7 +204,7 @@ void dna_io_dna::read_ren_data(std::ifstream* ptr, pv_string_vstring_pair stnRen if (sBuf.compare(0, 1, "*") == 0) continue; - string tmp; + std::string tmp; // Add the preferred name try { @@ -212,10 +212,10 @@ void dna_io_dna::read_ren_data(std::ifstream* ptr, pv_string_vstring_pair stnRen stnNames.first = tmp; } catch (...) { - stringstream ss; + std::stringstream ss; ss << "read_ren_data(): Could not extract station name from the record: " << - endl << " " << sBuf << endl; - boost::enable_current_exception(runtime_error(ss.str())); + std::endl << " " << sBuf << std::endl; + boost::enable_current_exception(std::runtime_error(ss.str())); } // Alternative names @@ -237,7 +237,7 @@ void dna_io_dna::read_ren_data(std::ifstream* ptr, pv_string_vstring_pair stnRen } // sort for faster searching - sort(altStnNames.begin(), altStnNames.end()); + std::sort(altStnNames.begin(), altStnNames.end()); // Add the alternate names stnNames.second = altStnNames; @@ -248,24 +248,26 @@ void dna_io_dna::read_ren_data(std::ifstream* ptr, pv_string_vstring_pair stnRen } -void dna_io_dna::read_dna_header(std::ifstream* ptr, string& version, INPUT_DATA_TYPE& idt, - CDnaDatum& referenceframe, bool user_supplied_frame, bool override_input_frame, - string& fileEpsg, string& fileEpoch, string& geoidversion, UINT32& count) +void dna_io_dna::read_dna_header(std::ifstream* ptr, std::string& version, INPUT_DATA_TYPE& idt, + CDnaDatum& referenceframe, + std::string& fileEpsg, std::string& fileEpoch, std::string& geoidversion, UINT32& count) { - string sBuf; + std::string sBuf; getline((*ptr), sBuf); sBuf = trimstr(sBuf); + m_filespecifiedReferenceFrame_ = false; + m_filespecifiedEpoch_ = false; // Set the default version version = "1.00"; // Attempt to get the file's version try { - if (iequals("!#=DNA", sBuf.substr(0, 6))) + if (boost::iequals("!#=DNA", sBuf.substr(0, 6))) version = trimstr(sBuf.substr(6, 6)); } - catch (const runtime_error& e) { - throw boost::enable_current_exception(runtime_error(e.what())); + catch (const std::runtime_error& e) { + throw boost::enable_current_exception(std::runtime_error(e.what())); } // Attempt to get the file's type @@ -273,51 +275,51 @@ void dna_io_dna::read_dna_header(std::ifstream* ptr, string& version, INPUT_DATA determineDNASTNFieldParameters(version, dsl_, dsw_); determineDNAMSRFieldParameters(version, dml_, dmw_); } - catch (const runtime_error& e) { - stringstream ssError; - ssError << "- Error: Unable to determine DNA file version." << endl << - sBuf << endl << " " << e.what() << endl; - throw boost::enable_current_exception(runtime_error(ssError.str())); + catch (const std::runtime_error& e) { + std::stringstream ssError; + ssError << "- Error: Unable to determine DNA file version." << std::endl << + sBuf << std::endl << " " << e.what() << std::endl; + throw boost::enable_current_exception(std::runtime_error(ssError.str())); } // Version 1 - if (iequals(version, "1.00")) + if (boost::iequals(version, "1.00")) { idt = unknown; // could be stn or msr count = 100; // set default 100 stations return; } - string type; + std::string type; // Attempt to get the file's type try { type = trimstr(sBuf.substr(12, 3)); } - catch (const runtime_error& e) { - stringstream ssError; - ssError << "- Error: File type has not been provided in the header" << endl << - sBuf << endl << e.what() << endl; - throw boost::enable_current_exception(runtime_error(ssError.str())); + catch (const std::runtime_error& e) { + std::stringstream ssError; + ssError << "- Error: File type has not been provided in the header" << std::endl << + sBuf << std::endl << e.what() << std::endl; + throw boost::enable_current_exception(std::runtime_error(ssError.str())); } // Station file - if (iequals(type, "stn")) + if (boost::iequals(type, "stn")) idt = stn_data; - // MEasurement file - else if (iequals(type, "msr")) + // Measurement file + else if (boost::iequals(type, "msr")) idt = msr_data; // Geoid information file - else if (iequals(type, "geo")) + else if (boost::iequals(type, "geo")) idt = geo_data; // Station renaming - else if (iequals(type, "ren")) + else if (boost::iequals(type, "ren")) idt = ren_data; else { idt = unknown; - stringstream ssError; - ssError << "The supplied filetype '" << type << "' is not recognised" << endl; - throw boost::enable_current_exception(runtime_error(ssError.str())); + std::stringstream ssError; + ssError << "The supplied filetype '" << type << "' is not recognised" << std::endl; + throw boost::enable_current_exception(std::runtime_error(ssError.str())); } if (sBuf.length() < 29) @@ -326,7 +328,7 @@ void dna_io_dna::read_dna_header(std::ifstream* ptr, string& version, INPUT_DATA return; } - string file_referenceframe; + std::string file_referenceframe; // Attempt to get the default reference frame try { if (sBuf.length() > 42) @@ -341,7 +343,10 @@ void dna_io_dna::read_dna_header(std::ifstream* ptr, string& version, INPUT_DATA file_referenceframe = ""; } - string epoch_version; + if (!file_referenceframe.empty()) + m_filespecifiedReferenceFrame_ = true; + + std::string epoch_version; // Attempt to get the default epoch / geoid version try { if (sBuf.length() > 56) @@ -356,54 +361,36 @@ void dna_io_dna::read_dna_header(std::ifstream* ptr, string& version, INPUT_DATA epoch_version = ""; } + if (!epoch_version.empty()) + m_filespecifiedEpoch_ = true; + // Try to get the reference frame + // For the first file, and unless the user has specified a reference frame, + // the reference frame will be used to set the frame for all other files. try { - switch (idt) { case stn_data: case msr_data: - + // Capture file epsg if (file_referenceframe.empty()) - // Get the epsg code from the default datum + // Empty? Get the epsg code from the project datum fileEpsg = referenceframe.GetEpsgCode_s(); else - fileEpsg = epsgStringFromName(file_referenceframe); + fileEpsg = epsgStringFromName(file_referenceframe); + // capture file epoch if (epoch_version.empty()) - // No, so get the epoch from the default datum - fileEpoch = referenceframe.GetEpoch_s(); - else - fileEpoch = epoch_version; - - // Presently, the logic for handling default reference frame is duplicated for - // each file type, here and in dnaparser_pimpl.cxx: - // void referenceframe_pimpl::post_type(...) - - // 2. Does the user want to override the default datum? - if (override_input_frame) - // Do nothing, just return as referenceframe will become - // the default for all stations and measurements loaded - // from the file. - break; - - // 3. Does the user want the referenceframe attribute in the file to become the default? - if (!user_supplied_frame) { - if (!file_referenceframe.empty()) - // adopt the reference frame supplied in the file - referenceframe.SetDatumFromName(file_referenceframe, epoch_version); + // Empty? Get the epoch of the nominated epsg (set above) + fileEpoch = referenceepochFromEpsgString(fileEpsg); } + else + fileEpoch = epoch_version; - // Since import doesn't offer an option to capture epoch on the command line, - // take the epoch from the file (if not empty). - if (!epoch_version.empty()) - referenceframe.SetEpoch(epoch_version); - break; - case geo_data: geoidversion = epoch_version; break; @@ -411,19 +398,19 @@ void dna_io_dna::read_dna_header(std::ifstream* ptr, string& version, INPUT_DATA break; } } - catch (const runtime_error& e) { - stringstream ssError; - ssError << "The supplied frame is not recognised" << endl << - e.what() << endl; - throw boost::enable_current_exception(runtime_error(ssError.str())); + catch (const std::runtime_error& e) { + std::stringstream ssError; + ssError << "The supplied frame (" << file_referenceframe << ") is not recognised" << std::endl << + e.what() << std::endl; + throw boost::enable_current_exception(std::runtime_error(ssError.str())); } // Attempt to get the data count try { if (sBuf.length() > 66) - count = val_uint(trimstr(sBuf.substr(57, 10))); + count = val_uint(trimstr(sBuf.substr(57, 10))); else if (sBuf.length() > 57) - count = val_uint(trimstr(sBuf.substr(57))); + count = val_uint(trimstr(sBuf.substr(57))); else count = 100; } @@ -433,9 +420,9 @@ void dna_io_dna::read_dna_header(std::ifstream* ptr, string& version, INPUT_DATA } -void dna_io_dna::write_stn_file(pvstn_t vbinary_stn, const string& stnfilename, const string& networkname, +void dna_io_dna::write_stn_file(pvstn_t vbinary_stn, const std::string& stnfilename, const std::string& networkname, const CDnaDatum& datum, const CDnaProjection& projection, bool flagUnused, - const string& comment) + const std::string& comment) { // Print DNA stations from a vector of stn_t std::ofstream dna_stn_file; @@ -450,7 +437,7 @@ void dna_io_dna::write_stn_file(pvstn_t vbinary_stn, const string& stnfilename, // Sort on original file order prepare_sort_list(static_cast(vbinary_stn->size())); CompareStnFileOrder stnorderCompareFunc(vbinary_stn); - sort(vStationList_.begin(), vStationList_.end(), stnorderCompareFunc); + std::sort(vStationList_.begin(), vStationList_.end(), stnorderCompareFunc); dnaStnPtr stnPtr(new CDnaStation(datum.GetName(), datum.GetEpoch_s())); @@ -485,14 +472,14 @@ void dna_io_dna::write_stn_file(pvstn_t vbinary_stn, const string& stnfilename, } catch (const std::ifstream::failure& f) { - throw boost::enable_current_exception(runtime_error(f.what())); + throw boost::enable_current_exception(std::runtime_error(f.what())); } } -void dna_io_dna::write_stn_file(vdnaStnPtr* vStations, const string& stnfilename, const string& networkname, +void dna_io_dna::write_stn_file(vdnaStnPtr* vStations, const std::string& stnfilename, const std::string& networkname, const CDnaDatum& datum, const CDnaProjection& projection, bool flagUnused, - const string& comment) + const std::string& comment) { // Print DNA stations from a vector of dnaStnPtr std::ofstream dna_stn_file; @@ -505,7 +492,7 @@ void dna_io_dna::write_stn_file(vdnaStnPtr* vStations, const string& stnfilename write_stn_header(&dna_stn_file, vStations, networkname, datum, flagUnused, comment); // Sort on original file order - sort(vStations->begin(), vStations->end(), CompareStnFileOrder_CDnaStn()); + std::sort(vStations->begin(), vStations->end(), CompareStnFileOrder_CDnaStn()); // print stations // Has the user specified --flag-unused-stations, in wich case, do not @@ -534,12 +521,12 @@ void dna_io_dna::write_stn_file(vdnaStnPtr* vStations, const string& stnfilename } catch (const std::ifstream::failure& f) { - throw boost::enable_current_exception(runtime_error(f.what())); + throw boost::enable_current_exception(std::runtime_error(f.what())); } } -void dna_io_dna::write_msr_header_data(std::ofstream* ptr, const string& networkname, const string& datum, - const string& epoch, const size_t& count, const string& comment) +void dna_io_dna::write_msr_header_data(std::ofstream* ptr, const std::string& networkname, const std::string& datum, + const std::string& epoch, const size_t& count, const std::string& comment) { // Write version line dna_header(*ptr, "3.01", "MSR", datum, epoch, count); @@ -554,24 +541,24 @@ void dna_io_dna::write_msr_header_data(std::ofstream* ptr, const string& network } -void dna_io_dna::write_msr_header(std::ofstream* ptr, vdnaMsrPtr* vMeasurements, const string& networkname, - const CDnaDatum& datum, const string& comment) +void dna_io_dna::write_msr_header(std::ofstream* ptr, vdnaMsrPtr* vMeasurements, const std::string& networkname, + const CDnaDatum& datum, const std::string& comment) { // write header write_msr_header_data(ptr, networkname, datum.GetName(), datum.GetEpoch_s(), vMeasurements->size(), comment); } -void dna_io_dna::write_msr_header(std::ofstream* ptr, pvmsr_t vbinary_msrn, const string& networkname, - const CDnaDatum& datum, const string& comment) +void dna_io_dna::write_msr_header(std::ofstream* ptr, pvmsr_t vbinary_msrn, const std::string& networkname, + const CDnaDatum& datum, const std::string& comment) { // write header write_msr_header_data(ptr, networkname, datum.GetName(), datum.GetEpoch_s(), vbinary_msrn->size(), comment); } -void dna_io_dna::write_msr_file(const vstn_t& vbinary_stn, pvmsr_t vbinary_msr, const string& msrfilename, const string& networkname, - const CDnaDatum& datum, const string& comment) +void dna_io_dna::write_msr_file(const vstn_t& vbinary_stn, pvmsr_t vbinary_msr, const std::string& msrfilename, const std::string& networkname, + const CDnaDatum& datum, const std::string& comment) { // Print DNA measurements @@ -609,12 +596,12 @@ void dna_io_dna::write_msr_file(const vstn_t& vbinary_stn, pvmsr_t vbinary_msr, } catch (const std::ifstream::failure& f) { - throw boost::enable_current_exception(runtime_error(f.what())); + throw boost::enable_current_exception(std::runtime_error(f.what())); } } -void dna_io_dna::write_msr_file(vdnaMsrPtr* vMeasurements, const string& msrfilename, const string& networkname, - const CDnaDatum& datum, const string& comment) +void dna_io_dna::write_msr_file(vdnaMsrPtr* vMeasurements, const std::string& msrfilename, const std::string& networkname, + const CDnaDatum& datum, const std::string& comment) { // Print DNA measurements @@ -647,7 +634,7 @@ void dna_io_dna::write_msr_file(vdnaMsrPtr* vMeasurements, const string& msrfile } catch (const std::ifstream::failure& f) { - throw boost::enable_current_exception(runtime_error(f.what())); + throw boost::enable_current_exception(std::runtime_error(f.what())); } diff --git a/dynadjust/include/io/dnaiodna.hpp b/dynadjust/include/io/dnaiodna.hpp index 17740c60..3fd47e79 100644 --- a/dynadjust/include/io/dnaiodna.hpp +++ b/dynadjust/include/io/dnaiodna.hpp @@ -50,47 +50,53 @@ class dna_io_dna : public dna_io_base public: dna_io_dna(void) : pv_msr_db_map_(0) - , m_databaseIDsSet_(false) {}; + , m_databaseIDsSet_(false) + , m_filespecifiedReferenceFrame_(false) + , m_filespecifiedEpoch_(false) { + }; dna_io_dna(const dna_io_dna& dna) : dna_io_base(dna) , pv_msr_db_map_(0) - , m_databaseIDsSet_(false) {}; + , m_databaseIDsSet_(false) + , m_filespecifiedReferenceFrame_(false) + , m_filespecifiedEpoch_(false) { + }; virtual ~dna_io_dna(void) {}; dna_io_dna& operator=(const dna_io_dna& rhs); - void read_ren_file(const string& filename, pv_string_vstring_pair stnRenaming); + void read_ren_file(const std::string& filename, pv_string_vstring_pair stnRenaming); void write_dna_files(vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements, - const string& stnfilename, const string& msrfilename, const string& networkname, + const std::string& stnfilename, const std::string& msrfilename, const std::string& networkname, const CDnaDatum& datum, const CDnaProjection& projection, bool flagUnused, - const string& stn_comment, const string& msr_comment); + const std::string& stn_comment, const std::string& msr_comment); void write_dna_files(pvstn_t vbinary_stn, pvmsr_t vbinary_msr, - const string& stnfilename, const string& msrfilename, const string& networkname, + const std::string& stnfilename, const std::string& msrfilename, const std::string& networkname, const CDnaDatum& datum, const CDnaProjection& projection, bool flagUnused, - const string& stn_comment, const string& msr_comment); + const std::string& stn_comment, const std::string& msr_comment); // CDnaStation - void write_stn_file(vdnaStnPtr* vStations, const string& stnfilename, const string& networkname, + void write_stn_file(vdnaStnPtr* vStations, const std::string& stnfilename, const std::string& networkname, const CDnaDatum& datum, const CDnaProjection& projection, bool flagUnused, - const string& comment); + const std::string& comment); // station_t - void write_stn_file(pvstn_t vbinary_stn, const string& stnfilename, const string& networkname, + void write_stn_file(pvstn_t vbinary_stn, const std::string& stnfilename, const std::string& networkname, const CDnaDatum& datum, const CDnaProjection& projection, bool flagUnused, - const string& comment); + const std::string& comment); // CDnaMeasurement - void write_msr_file(vdnaMsrPtr* vMeasurements, const string& msrfilename, const string& networkname, - const CDnaDatum& datum, const string& comment); + void write_msr_file(vdnaMsrPtr* vMeasurements, const std::string& msrfilename, const std::string& networkname, + const CDnaDatum& datum, const std::string& comment); // measurement_t - void write_msr_file(const vstn_t& binaryStn, pvmsr_t vbinary_msr, const string& msrfilename, const string& networkname, - const CDnaDatum& datum, const string& comment); + void write_msr_file(const vstn_t& binaryStn, pvmsr_t vbinary_msr, const std::string& msrfilename, const std::string& networkname, + const CDnaDatum& datum, const std::string& comment); - void read_dna_header(std::ifstream* ptr, string& version, INPUT_DATA_TYPE& idt, - CDnaDatum& referenceframe, bool user_supplied_frame, bool override_input_frame, - string& fileEpsg, string& fileEpoch, string& geoidversion, UINT32& count); + void read_dna_header(std::ifstream* ptr, std::string& version, INPUT_DATA_TYPE& idt, + CDnaDatum& referenceframe, + std::string& fileEpsg, std::string& fileEpoch, std::string& geoidversion, UINT32& count); inline const dna_stn_fields dna_stn_positions() { return dsl_; } inline const dna_stn_fields dna_stn_widths() { return dsw_; } @@ -98,29 +104,32 @@ class dna_io_dna : public dna_io_base inline const dna_msr_fields dna_msr_widths() { return dmw_; } void set_dbid_ptr(pv_msr_database_id_map pv_msr_db_map); + + inline bool filespecifiedReferenceFrame() { return m_filespecifiedReferenceFrame_; } + inline bool filespecifiedEpoch() { return m_filespecifiedEpoch_; } protected: private: - void create_file_stn(std::ofstream* ptr, const string& filename); - void create_file_msr(std::ofstream* ptr, const string& filename); - void create_file_pointer(std::ofstream* ptr, const string& filename); - void open_file_pointer(std::ifstream* ptr, const string& filename); - - void write_stn_header_data(std::ofstream* ptr, const string& networkname, const string& datum, - const string& epoch, const size_t& count, const string& comment); - void write_stn_header(std::ofstream* ptr, vdnaStnPtr* vStations, const string& networkname, - const CDnaDatum& datum, bool flagUnused, const string& comment); - void write_stn_header(std::ofstream* ptr, pvstn_t vbinary_stn, const string& networkname, - const CDnaDatum& datum, bool flagUnused, const string& comment); - - void write_msr_header_data(std::ofstream* ptr, const string& networkname, const string& datum, - const string& epoch, const size_t& count, const string& comment); - void write_msr_header(std::ofstream* ptr, vdnaMsrPtr* vMeasurements, const string& networkname, - const CDnaDatum& datum, const string& comment); - void write_msr_header(std::ofstream* ptr, pvmsr_t vbinary_msrn, const string& networkname, - const CDnaDatum& datum, const string& comment); + void create_file_stn(std::ofstream* ptr, const std::string& filename); + void create_file_msr(std::ofstream* ptr, const std::string& filename); + void create_file_pointer(std::ofstream* ptr, const std::string& filename); + void open_file_pointer(std::ifstream* ptr, const std::string& filename); + + void write_stn_header_data(std::ofstream* ptr, const std::string& networkname, const std::string& datum, + const std::string& epoch, const size_t& count, const std::string& comment); + void write_stn_header(std::ofstream* ptr, vdnaStnPtr* vStations, const std::string& networkname, + const CDnaDatum& datum, bool flagUnused, const std::string& comment); + void write_stn_header(std::ofstream* ptr, pvstn_t vbinary_stn, const std::string& networkname, + const CDnaDatum& datum, bool flagUnused, const std::string& comment); + + void write_msr_header_data(std::ofstream* ptr, const std::string& networkname, const std::string& datum, + const std::string& epoch, const size_t& count, const std::string& comment); + void write_msr_header(std::ofstream* ptr, vdnaMsrPtr* vMeasurements, const std::string& networkname, + const CDnaDatum& datum, const std::string& comment); + void write_msr_header(std::ofstream* ptr, pvmsr_t vbinary_msrn, const std::string& networkname, + const CDnaDatum& datum, const std::string& comment); void read_ren_data(std::ifstream* ptr, pv_string_vstring_pair stnRenaming); @@ -133,6 +142,8 @@ class dna_io_dna : public dna_io_base pv_msr_database_id_map pv_msr_db_map_; bool m_databaseIDsSet_; + bool m_filespecifiedReferenceFrame_; + bool m_filespecifiedEpoch_; }; } // namespace iostreams diff --git a/dynadjust/include/io/dnaiodnatypes.hpp b/dynadjust/include/io/dnaiodnatypes.hpp index a4dd4e65..cbac7c9c 100644 --- a/dynadjust/include/io/dnaiodnatypes.hpp +++ b/dynadjust/include/io/dnaiodnatypes.hpp @@ -32,9 +32,6 @@ #include #include -using namespace std; -using namespace boost; - #include using namespace dynadjust::exception; @@ -56,7 +53,7 @@ typedef struct msr_database_t { } msr_database_id_map; -typedef vector v_msr_database_id_map, *pv_msr_database_id_map; +typedef std::vector v_msr_database_id_map, *pv_msr_database_id_map; typedef v_msr_database_id_map::iterator it_vdbid_t; typedef struct { @@ -467,10 +464,10 @@ void assignDNASTNFieldParameters(const UINT16* locs, const UINT16* widths, template -void determineDNASTNFieldParameters(const string& version, +void determineDNASTNFieldParameters(const std::string& version, dna_stn_fields& dflocs, dna_stn_fields& dfwidths) { - if (iequals(version, "3.01")) + if (boost::iequals(version, "3.01")) { assignDNASTNFieldParameters(dna_stn_fields_301::_locations_, dna_stn_fields_301::_widths_, @@ -478,7 +475,7 @@ void determineDNASTNFieldParameters(const string& version, return; } - if (iequals(version, "3.00")) + if (boost::iequals(version, "3.00")) { assignDNASTNFieldParameters(dna_stn_fields_300::_locations_, dna_stn_fields_300::_widths_, @@ -486,7 +483,7 @@ void determineDNASTNFieldParameters(const string& version, return; } - if (iequals(version, "1.00")) + if (boost::iequals(version, "1.00")) { assignDNASTNFieldParameters(dna_stn_fields_100::_locations_, dna_stn_fields_100::_widths_, @@ -554,10 +551,10 @@ void assignDNAMSRFieldParameters(const UINT16* locs, const UINT16* widths, template -void determineDNAMSRFieldParameters(const string& version, +void determineDNAMSRFieldParameters(const std::string& version, dna_msr_fields& dflocs, dna_msr_fields& dfwidths, const U u=0) { - if (iequals(version, "3.01")) + if (boost::iequals(version, "3.01")) { assignDNAMSRFieldParameters(dna_msr_fields_301::_locations_, dna_msr_fields_301::_widths_, @@ -565,7 +562,7 @@ void determineDNAMSRFieldParameters(const string& version, return; } - if (iequals(version, "3.00")) + if (boost::iequals(version, "3.00")) { assignDNAMSRFieldParameters(dna_msr_fields_300::_locations_, dna_msr_fields_300::_widths_, @@ -573,7 +570,7 @@ void determineDNAMSRFieldParameters(const string& version, return; } - if (iequals(version, "1.00")) + if (boost::iequals(version, "1.00")) { assignDNAMSRFieldParameters(dna_msr_fields_100::_locations_, dna_msr_fields_100::_widths_, @@ -581,8 +578,8 @@ void determineDNAMSRFieldParameters(const string& version, return; } - stringstream ss; - ss << " Unknown file version: " << version << endl; + std::stringstream ss; + ss << " Unknown file version: " << version << std::endl; throw XMLInteropException(ss.str(), u); } diff --git a/dynadjust/include/io/dnaiomap.cpp b/dynadjust/include/io/dnaiomap.cpp index 781df3f3..f79ce1c8 100644 --- a/dynadjust/include/io/dnaiomap.cpp +++ b/dynadjust/include/io/dnaiomap.cpp @@ -29,26 +29,26 @@ namespace dynadjust { namespace iostreams { -void dna_io_map::load_map_file(const string& map_filename, pv_string_uint32_pair stnsMap) +void dna_io_map::load_map_file(const std::string& map_filename, pv_string_uint32_pair stnsMap) { std::ifstream map_file; - stringstream ss; - ss << "load_map_file(): An error was encountered when opening " << map_filename << "." << endl; + std::stringstream ss; + ss << "load_map_file(): An error was encountered when opening " << map_filename << "." << std::endl; try { // open stations map file. Throws runtime_error on failure. - file_opener(map_file, map_filename, ios::in | ios::binary, binary, true); + file_opener(map_file, map_filename, std::ios::in | std::ios::binary, binary, true); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } ss.str(""); - ss << "load_map_file(): An error was encountered when reading from " << map_filename << "." << endl; + ss << "load_map_file(): An error was encountered when reading from " << map_filename << "." << std::endl; stnsMap->clear(); UINT32 mapsize; @@ -72,46 +72,46 @@ void dna_io_map::load_map_file(const string& map_filename, pv_string_uint32_pair stnsMap->push_back(stnID); } } - catch (const ios_base::failure& f) { + catch (const std::ios_base::failure& f) { ss << f.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } map_file.close(); if (stnsMap->size() < mapsize) throw boost::enable_current_exception( - runtime_error("load_map_file(): Could not allocate sufficient memory for the Station map.")); + std::runtime_error("load_map_file(): Could not allocate sufficient memory for the Station map.")); } -void dna_io_map::write_map_file(const string& map_filename, pv_string_uint32_pair stnsMap) +void dna_io_map::write_map_file(const std::string& map_filename, pv_string_uint32_pair stnsMap) { std::ofstream map_file; - stringstream ss; - ss << "write_map_file(): An error was encountered when opening " << map_filename << "." << endl; + std::stringstream ss; + ss << "write_map_file(): An error was encountered when opening " << map_filename << "." << std::endl; try { // Open station map file. Throws runtime_error on failure. file_opener(map_file, map_filename, - ios::out | ios::binary, binary); + std::ios::out | std::ios::binary, binary); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } ss.str(""); - ss << "write_map_file(): An error was encountered when writing to " << map_filename << "." << endl; + ss << "write_map_file(): An error was encountered when writing to " << map_filename << "." << std::endl; v_string_uint32_pair::const_iterator _it_stnmap(stnsMap->begin()); UINT32 mapval(static_cast(stnsMap->size())); @@ -131,77 +131,77 @@ void dna_io_map::write_map_file(const string& map_filename, pv_string_uint32_pai map_file.write(reinterpret_cast(&mapval), sizeof(UINT32)); } } - catch (const ios_base::failure& f) { + catch (const std::ios_base::failure& f) { ss << f.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } map_file.close(); } -void dna_io_map::write_map_file_txt(const string& map_filename, pv_string_uint32_pair stnsMap) +void dna_io_map::write_map_file_txt(const std::string& map_filename, pv_string_uint32_pair stnsMap) { std::ofstream map_file; - stringstream ss; - ss << "write_map_file_txt(): An error was encountered when opening " << map_filename << "." << endl; + std::stringstream ss; + ss << "write_map_file_txt(): An error was encountered when opening " << map_filename << "." << std::endl; try { // Create station map text file. Throws runtime_error on failure. file_opener(map_file, map_filename); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } ss.str(""); - ss << "write_map_file_txt(): An error was encountered when writing to " << map_filename << "." << endl; + ss << "write_map_file_txt(): An error was encountered when writing to " << map_filename << "." << std::endl; try { - stringstream ss_map; + std::stringstream ss_map; ss_map << stnsMap->size() << " stations"; - map_file << left << setw(STATION) << ss_map.str(); - map_file << setw(HEADER_20) << right << "Stn. index" << endl; + map_file << std::left << std::setw(STATION) << ss_map.str(); + map_file << std::setw(HEADER_20) << std::right << "Stn. index" << std::endl; v_string_uint32_pair::const_iterator _it_stnmap(stnsMap->begin()); for (_it_stnmap=stnsMap->begin(); _it_stnmap!=stnsMap->end(); ++_it_stnmap) { - map_file << setw(STATION) << left << + map_file << std::setw(STATION) << std::left << _it_stnmap->first.c_str() << - setw(HEADER_20) << right << _it_stnmap->second << endl; + std::setw(HEADER_20) << std::right << _it_stnmap->second << std::endl; } } - catch (const ios_base::failure& f) { + catch (const std::ios_base::failure& f) { ss << f.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } map_file.close(); } -//void dna_io_map::load_renaming_file(const string& renaming_filename, pv_string_string_pair stnRenaming) +//void dna_io_map::load_renaming_file(const std::string& renaming_filename, pv_string_string_pair stnRenaming) //{ // std::ifstream renaming_file; // -// stringstream ss; -// ss << "load_renaming_file(): An error was encountered when opening " << renaming_filename << "." << endl; +// std::stringstream ss; +// ss << "load_renaming_file(): An error was encountered when opening " << renaming_filename << "." << std::endl; // // // The contents of the renaming file is as follows: // // @@ -224,23 +224,23 @@ void dna_io_map::write_map_file_txt(const string& map_filename, pv_string_uint32 // try { // // Load renaming file. Throws runtime_error on failure. // file_opener(renaming_file, renaming_filename, -// ios::in, ascii, true); +// std::ios::in, ascii, true); // } -// catch (const runtime_error& e) { +// catch (const std::runtime_error& e) { // ss << e.what(); -// throw boost::enable_current_exception(runtime_error(ss.str())); +// throw boost::enable_current_exception(std::runtime_error(ss.str())); // } // catch (...) { -// throw boost::enable_current_exception(runtime_error(ss.str())); +// throw boost::enable_current_exception(std::runtime_error(ss.str())); // } // // ss.str(""); -// ss << "load_renaming_file(): An error was encountered when reading from " << renaming_filename << "." << endl; +// ss << "load_renaming_file(): An error was encountered when reading from " << renaming_filename << "." << std::endl; // // stnRenaming->clear(); // // string_string_pair stnNames; -// string sBuf(""); +// std::string sBuf(""); // UINT32 stationWidth(STATION), stationCount(100); // UINT32 line(0); // @@ -252,27 +252,27 @@ void dna_io_map::write_map_file_txt(const string& map_filename, pv_string_uint32 // line++; // getline(renaming_file, sBuf); // -// if (iequals(trimstr(sBuf), "STATION NAMES")) +// if (boost::iequals(trimstr(sBuf), "STATION NAMES")) // break; // // // blank or whitespace? // if (trimstr(sBuf).empty()) // continue; // -// if (iequals(trimstr(sBuf.substr(0, 13)), "Station count")) +// if (boost::iequals(trimstr(sBuf.substr(0, 13)), "Station count")) // { -// stationCount = lexical_cast(trimstr(sBuf.substr(PRINT_VAR_PAD))); +// stationCount = boost::lexical_cast(trimstr(sBuf.substr(PRINT_VAR_PAD))); // continue; // } // -// if (iequals(trimstr(sBuf.substr(0, 18)), "Station name width")) +// if (boost::iequals(trimstr(sBuf.substr(0, 18)), "Station name width")) // { -// stationWidth = lexical_cast(trimstr(sBuf.substr(PRINT_VAR_PAD))); +// stationWidth = boost::lexical_cast(trimstr(sBuf.substr(PRINT_VAR_PAD))); // continue; // } // // } -// while (!iequals(trimstr(sBuf), "STATION NAMES")); +// while (!boost::iequals(trimstr(sBuf), "STATION NAMES")); // // stnRenaming->reserve(stationCount); // @@ -288,10 +288,10 @@ void dna_io_map::write_map_file_txt(const string& map_filename, pv_string_uint32 // if (trimstr(sBuf).length() < stationWidth) // continue; // -// if (iequals(trimstr(sBuf.substr(0, 8)), "OLD NAME")) +// if (boost::iequals(trimstr(sBuf.substr(0, 8)), "OLD NAME")) // continue; // -// if (iequals(trimstr(sBuf.substr(0, 3)), "---")) +// if (boost::iequals(trimstr(sBuf.substr(0, 3)), "---")) // continue; // // // Ignore lines with blank station name @@ -312,23 +312,23 @@ void dna_io_map::write_map_file_txt(const string& map_filename, pv_string_uint32 // stnRenaming->push_back(stnNames); // } // } -// catch (const ios_base::failure& f) { +// catch (const std::ios_base::failure& f) { // if (renaming_file.eof()) // { // renaming_file.close(); // return; // } // ss << f.what(); -// throw boost::enable_current_exception(runtime_error(ss.str())); +// throw boost::enable_current_exception(std::runtime_error(ss.str())); // } -// catch (const runtime_error& e) { +// catch (const std::runtime_error& e) { // if (renaming_file.eof()) // { // renaming_file.close(); // return; // } // ss << e.what(); -// throw boost::enable_current_exception(runtime_error(ss.str())); +// throw boost::enable_current_exception(std::runtime_error(ss.str())); // } // catch (...) { // if (renaming_file.eof()) @@ -336,7 +336,7 @@ void dna_io_map::write_map_file_txt(const string& map_filename, pv_string_uint32 // renaming_file.close(); // return; // } -// throw boost::enable_current_exception(runtime_error(ss.str())); +// throw boost::enable_current_exception(std::runtime_error(ss.str())); // } // // renaming_file.close(); diff --git a/dynadjust/include/io/dnaiomap.hpp b/dynadjust/include/io/dnaiomap.hpp index 1ec0a1ce..26b2ec7b 100644 --- a/dynadjust/include/io/dnaiomap.hpp +++ b/dynadjust/include/io/dnaiomap.hpp @@ -44,11 +44,11 @@ class dna_io_map : public dna_io_base dna_io_map& operator=(const dna_io_map& rhs); - void load_map_file(const string& map_filename, pv_string_uint32_pair stnsMap); - void write_map_file(const string& map_filename, pv_string_uint32_pair stnsMap); - void write_map_file_txt(const string& map_filename, pv_string_uint32_pair stnsMap); + void load_map_file(const std::string& map_filename, pv_string_uint32_pair stnsMap); + void write_map_file(const std::string& map_filename, pv_string_uint32_pair stnsMap); + void write_map_file_txt(const std::string& map_filename, pv_string_uint32_pair stnsMap); - //void load_renaming_file(const string& map_filename, pv_string_string_pair stnRenaming); + //void load_renaming_file(const std::string& map_filename, pv_string_string_pair stnRenaming); protected: diff --git a/dynadjust/include/io/dnaiopdf.cpp b/dynadjust/include/io/dnaiopdf.cpp index c484f5ae..d40d5603 100644 --- a/dynadjust/include/io/dnaiopdf.cpp +++ b/dynadjust/include/io/dnaiopdf.cpp @@ -23,15 +23,10 @@ #include #include #include - -using namespace std; - -using namespace boost::filesystem; - namespace dynadjust { namespace iostreams { -string dna_io_pdf::form_pdf_action_command_string(const string& pdf_filename, const string& ddename, const string& action) +std::string dna_io_pdf::form_pdf_action_command_string(const std::string& pdf_filename, const std::string& ddename, const std::string& action) { if (pdf_filename.empty()) @@ -41,11 +36,11 @@ string dna_io_pdf::form_pdf_action_command_string(const string& pdf_filename, co char viewer_filepath[256]; FindExecutable(pdf_filename.c_str(), 0, viewer_filepath); - string viewer(basename(viewer_filepath)); + std::string viewer(path(viewer_filepath).stem()); - if (iequals(viewer, "AcroRd32") || iequals(viewer, "Acrobat")) + if (boost::iequals(viewer, "AcroRd32") || boost::iequals(viewer, "Acrobat")) { - stringstream ss; + std::stringstream ss; ss << "\"" << viewer_filepath << "\" " << pdf_filename; return ss.str(); } @@ -59,13 +54,13 @@ string dna_io_pdf::form_pdf_action_command_string(const string& pdf_filename, co return ""; } -string dna_io_pdf::form_pdf_close_string(const string& pdf_filename, const string& ddename) +std::string dna_io_pdf::form_pdf_close_string(const std::string& pdf_filename, const std::string& ddename) { //return form_pdf_action_command_string(pdf_filename, ddename, "DocClose"); return ""; } -string dna_io_pdf::form_pdf_open_string(const string& pdf_filename, const string& ddename) +std::string dna_io_pdf::form_pdf_open_string(const std::string& pdf_filename, const std::string& ddename) { // return form_pdf_action_command_string(pdf_filename, ddename, "DocOpen"); return ""; diff --git a/dynadjust/include/io/dnaiopdf.hpp b/dynadjust/include/io/dnaiopdf.hpp index 753ba298..eba570da 100644 --- a/dynadjust/include/io/dnaiopdf.hpp +++ b/dynadjust/include/io/dnaiopdf.hpp @@ -30,9 +30,24 @@ #endif #if defined(_WIN32) || defined(__WIN32__) + + // prevent conflict with std::min(...) std::max(...) + #ifndef NOMINMAX + #define NOMINMAX + #endif + + #ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN + #endif + + #ifndef VC_EXTRALEAN + #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers + #endif + #include #include #include // for FindExecutable + #elif defined(__linux) || defined(sun) || defined(__unix__) || defined(__APPLE__) #include #endif @@ -60,9 +75,9 @@ class dna_io_pdf : public dna_io_base dna_io_pdf& operator=(const dna_io_pdf& rhs); - string form_pdf_action_command_string(const string& pdf_filename, const string& ddename, const string& action); - string form_pdf_close_string(const string& pdf_filename, const string& ddename); - string form_pdf_open_string(const string& pdf_filename, const string& ddename); + std::string form_pdf_action_command_string(const std::string& pdf_filename, const std::string& ddename, const std::string& action); + std::string form_pdf_close_string(const std::string& pdf_filename, const std::string& ddename); + std::string form_pdf_open_string(const std::string& pdf_filename, const std::string& ddename); protected: diff --git a/dynadjust/include/io/dnaioscalar.cpp b/dynadjust/include/io/dnaioscalar.cpp index 0da5c10a..2692d521 100644 --- a/dynadjust/include/io/dnaioscalar.cpp +++ b/dynadjust/include/io/dnaioscalar.cpp @@ -27,11 +27,11 @@ namespace dynadjust { namespace iostreams { -void dna_io_scalar::load_scalar_file(const string& scalar_filename, pvscl_t bslScaling) +void dna_io_scalar::load_scalar_file(const std::string& scalar_filename, pvscl_t bslScaling) { std::ifstream scalar_file; - stringstream ss; - ss << "load_scalar_file(): An error was encountered when opening " << scalar_filename << "." << endl; + std::stringstream ss; + ss << "load_scalar_file(): An error was encountered when opening " << scalar_filename << "." << std::endl; // The contents of the scalar file is as follows: // @@ -54,23 +54,23 @@ void dna_io_scalar::load_scalar_file(const string& scalar_filename, pvscl_t bslS try { // Load scalar file. Throws runtime_error on failure. file_opener(scalar_file, scalar_filename, - ios::in, ascii, true); + std::ios::in, ascii, true); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } ss.str(""); - ss << "load_scalar_file(): An error was encountered when reading from " << scalar_filename << "." << endl; + ss << "load_scalar_file(): An error was encountered when reading from " << scalar_filename << "." << std::endl; bslScaling->clear(); scalar_t bslScalars; - string sBuf(""), tmp; + std::string sBuf(""), tmp; UINT32 stationWidth(STATION), scalarCount(100); UINT32 line(0), position(0); @@ -82,23 +82,23 @@ void dna_io_scalar::load_scalar_file(const string& scalar_filename, pvscl_t bslS line++; getline(scalar_file, sBuf); - if (iequals(trimstr(sBuf), "SCALARS")) + if (boost::iequals(trimstr(sBuf), "SCALARS")) break; - if (iequals(trimstr(sBuf.substr(0, 16)), "Baseline count")) + if (boost::iequals(trimstr(sBuf.substr(0, 16)), "Baseline count")) { - scalarCount = lexical_cast(trimstr(sBuf.substr(PRINT_VAR_PAD))); + scalarCount = boost::lexical_cast(trimstr(sBuf.substr(PRINT_VAR_PAD))); continue; } - if (iequals(trimstr(sBuf.substr(0, 18)), "Station name width")) + if (boost::iequals(trimstr(sBuf.substr(0, 18)), "Station name width")) { - stationWidth = lexical_cast(trimstr(sBuf.substr(PRINT_VAR_PAD))); + stationWidth = boost::lexical_cast(trimstr(sBuf.substr(PRINT_VAR_PAD))); continue; } } - while (!iequals(trimstr(sBuf), "SCALARS")); + while (!boost::iequals(trimstr(sBuf), "SCALARS")); bslScaling->reserve(scalarCount); @@ -114,10 +114,10 @@ void dna_io_scalar::load_scalar_file(const string& scalar_filename, pvscl_t bslS if (trimstr(sBuf).length() < stationWidth+1) continue; - if (iequals(trimstr(sBuf.substr(0, 20)), "Station 1")) + if (boost::iequals(trimstr(sBuf.substr(0, 20)), "Station 1")) continue; - if (iequals(trimstr(sBuf.substr(0, 3)), "---")) + if (boost::iequals(trimstr(sBuf.substr(0, 3)), "---")) continue; // Ignore lines with blank station name @@ -143,7 +143,7 @@ void dna_io_scalar::load_scalar_file(const string& scalar_filename, pvscl_t bslS if (sBuf.length() > position) { if ((tmp = trimstr(sBuf.substr(position, 10))).length() > 0) - bslScalars.v_scale = lexical_cast(tmp); + bslScalars.v_scale = boost::lexical_cast(tmp); } else continue; @@ -154,7 +154,7 @@ void dna_io_scalar::load_scalar_file(const string& scalar_filename, pvscl_t bslS if (sBuf.length() > position) { if ((tmp = trimstr(sBuf.substr(position, 10))).length() > 0) - bslScalars.p_scale = lexical_cast(tmp); + bslScalars.p_scale = boost::lexical_cast(tmp); } else continue; @@ -165,7 +165,7 @@ void dna_io_scalar::load_scalar_file(const string& scalar_filename, pvscl_t bslS if (sBuf.length() > position) { if ((tmp = trimstr(sBuf.substr(position, 10))).length() > 0) - bslScalars.l_scale = lexical_cast(tmp); + bslScalars.l_scale = boost::lexical_cast(tmp); } else continue; @@ -176,7 +176,7 @@ void dna_io_scalar::load_scalar_file(const string& scalar_filename, pvscl_t bslS if (sBuf.length() > position) { if ((tmp = trimstr(sBuf.substr(position, 10))).length() > 0) - bslScalars.h_scale = lexical_cast(tmp); + bslScalars.h_scale = boost::lexical_cast(tmp); } else continue; @@ -184,23 +184,23 @@ void dna_io_scalar::load_scalar_file(const string& scalar_filename, pvscl_t bslS bslScaling->push_back(bslScalars); } } - catch (const ios_base::failure& f) { + catch (const std::ios_base::failure& f) { if (scalar_file.eof()) { scalar_file.close(); return; } ss << f.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { if (scalar_file.eof()) { scalar_file.close(); return; } ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { if (scalar_file.eof()) @@ -208,7 +208,7 @@ void dna_io_scalar::load_scalar_file(const string& scalar_filename, pvscl_t bslS scalar_file.close(); return; } - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } scalar_file.close(); diff --git a/dynadjust/include/io/dnaioscalar.hpp b/dynadjust/include/io/dnaioscalar.hpp index a578ee27..72a9b83a 100644 --- a/dynadjust/include/io/dnaioscalar.hpp +++ b/dynadjust/include/io/dnaioscalar.hpp @@ -47,7 +47,7 @@ class dna_io_scalar : public dna_io_base dna_io_scalar& operator=(const dna_io_scalar& rhs); - void load_scalar_file(const string& map_filename, pvscl_t bslScaling); + void load_scalar_file(const std::string& map_filename, pvscl_t bslScaling); protected: diff --git a/dynadjust/include/io/dnaioseg.cpp b/dynadjust/include/io/dnaioseg.cpp index 97371017..3739dafd 100644 --- a/dynadjust/include/io/dnaioseg.cpp +++ b/dynadjust/include/io/dnaioseg.cpp @@ -27,41 +27,41 @@ namespace dynadjust { namespace iostreams { -void dna_io_seg::load_seg_file_header_f(const string& seg_filename, UINT32& blockCount, +void dna_io_seg::load_seg_file_header_f(const std::string& seg_filename, UINT32& blockCount, UINT32& blockThreshold, UINT32& minInnerStns) { std::ifstream seg_file; - stringstream ss_err; + std::stringstream ss_err; try { // open stations seg file. Throws runtime_error on failure. - ss_err << "load_seg_file_f(): An error was encountered when opening " << seg_filename << "." << endl; - file_opener(seg_file, seg_filename, ios::in, ascii, true); + ss_err << "load_seg_file_f(): An error was encountered when opening " << seg_filename << "." << std::endl; + file_opener(seg_file, seg_filename, std::ios::in, ascii, true); ss_err.str(""); - ss_err << "load_seg_file_f(): An error was encountered when reading " << seg_filename << "." << endl; + ss_err << "load_seg_file_f(): An error was encountered when reading " << seg_filename << "." << std::endl; load_seg_file_header(seg_filename, seg_file, blockCount, blockThreshold, minInnerStns); seg_file.close(); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss_err << e.what(); - throw boost::enable_current_exception(runtime_error(ss_err.str())); + throw boost::enable_current_exception(std::runtime_error(ss_err.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss_err.str())); + throw boost::enable_current_exception(std::runtime_error(ss_err.str())); } } -void dna_io_seg::load_seg_file_header(const string& seg_filename, istream& seg_file, UINT32& blockCount, +void dna_io_seg::load_seg_file_header(const std::string& seg_filename, std::istream& seg_file, UINT32& blockCount, UINT32& blockThreshold, UINT32& minInnerStns) { - stringstream ss_err; - ss_err << "load_seg_file_header(): An error was encountered when reading from " << seg_filename << "." << endl; + std::stringstream ss_err; + ss_err << "load_seg_file_header(): An error was encountered when reading from " << seg_filename << "." << std::endl; char line[PRINT_LINE_LENGTH]; memset(line, '\0', PRINT_LINE_LENGTH); @@ -101,20 +101,20 @@ void dna_io_seg::load_seg_file_header(const string& seg_filename, istream& seg_f seg_file.getline(line, PRINT_LINE_LENGTH); // No. blocks produced blockCount = strtoul(line+PRINT_VAR_PAD, NULL, 0); } - catch (const ios_base::failure& f) { + catch (const std::ios_base::failure& f) { ss_err << f.what(); - throw boost::enable_current_exception(runtime_error(ss_err.str())); + throw boost::enable_current_exception(std::runtime_error(ss_err.str())); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss_err << e.what(); - throw boost::enable_current_exception(runtime_error(ss_err.str())); + throw boost::enable_current_exception(std::runtime_error(ss_err.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss_err.str())); + throw boost::enable_current_exception(std::runtime_error(ss_err.str())); } } -void dna_io_seg::load_seg_file(const string& seg_filename, UINT32& blockCount, +void dna_io_seg::load_seg_file(const std::string& seg_filename, UINT32& blockCount, UINT32& blockThreshold, UINT32& minInnerStns, vvUINT32& v_ISL, vvUINT32& v_JSL, vvUINT32& v_CML, bool loadMetrics, @@ -123,23 +123,23 @@ void dna_io_seg::load_seg_file(const string& seg_filename, UINT32& blockCount, pvUINT32 v_parameterStationCount) { std::ifstream seg_file; - stringstream ss_err; - ss_err << "load_seg_file(): An error was encountered when opening " << seg_filename << "." << endl; + std::stringstream ss_err; + ss_err << "load_seg_file(): An error was encountered when opening " << seg_filename << "." << std::endl; try { // open stations seg file. Throws runtime_error on failure. - file_opener(seg_file, seg_filename, ios::in, ascii, true); + file_opener(seg_file, seg_filename, std::ios::in, ascii, true); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss_err << e.what(); - throw boost::enable_current_exception(runtime_error(ss_err.str())); + throw boost::enable_current_exception(std::runtime_error(ss_err.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss_err.str())); + throw boost::enable_current_exception(std::runtime_error(ss_err.str())); } ss_err.str(""); - ss_err << "load_seg_file(): An error was encountered when reading from " << seg_filename << "." << endl; + ss_err << "load_seg_file(): An error was encountered when reading from " << seg_filename << "." << std::endl; UINT32 b, blk, c, i, j, m, blkCount(0), netID(0), jslCount(0), islCount(0), msrCount(0), stnCount(0); @@ -147,7 +147,7 @@ void dna_io_seg::load_seg_file(const string& seg_filename, UINT32& blockCount, char line[PRINT_LINE_LENGTH], format_spec_netid[6], format_spec_junct[6], format_spec_inner[6], format_spec_measr[6]; - string sBuf, tmp; + std::string sBuf, tmp; try { @@ -186,19 +186,19 @@ void dna_io_seg::load_seg_file(const string& seg_filename, UINT32& blockCount, getline(seg_file, sBuf); if (sBuf.compare(0, 20, "--------------------") == 0) - throw boost::enable_current_exception(runtime_error(" Segmentation file is corrupt.")); + throw boost::enable_current_exception(std::runtime_error(" Segmentation file is corrupt.")); // Block number try { tmp = trimstr(sBuf.substr(column, BLOCK)); if (tmp.empty()) - throw boost::enable_current_exception(runtime_error(" Unable to retrieve Block number.")); + throw boost::enable_current_exception(std::runtime_error(" Unable to retrieve Block number.")); blkCount = LongFromString(tmp); } catch (...) { ss_err.str(""); - ss_err << " Segmentation file is corrupt: Could not extract Block number from the record: " << endl << " " << sBuf << endl; - throw boost::enable_current_exception(runtime_error(ss_err.str().c_str())); + ss_err << " Segmentation file is corrupt: Could not extract Block number from the record: " << std::endl << " " << sBuf << std::endl; + throw boost::enable_current_exception(std::runtime_error(ss_err.str().c_str())); } column += BLOCK; @@ -207,13 +207,13 @@ void dna_io_seg::load_seg_file(const string& seg_filename, UINT32& blockCount, try { tmp = trimstr(sBuf.substr(column, NETID)); if (tmp.empty()) - throw boost::enable_current_exception(runtime_error(" Unable to retrieve Network ID.")); + throw boost::enable_current_exception(std::runtime_error(" Unable to retrieve Network ID.")); netID = LongFromString(tmp); } catch (...) { ss_err.str(""); - ss_err << " Segmentation file is corrupt: Could not extract Network ID from the record: " << endl << " " << sBuf << endl; - throw boost::enable_current_exception(runtime_error(ss_err.str().c_str())); + ss_err << " Segmentation file is corrupt: Could not extract Network ID from the record: " << std::endl << " " << sBuf << std::endl; + throw boost::enable_current_exception(std::runtime_error(ss_err.str().c_str())); } column += NETID; @@ -222,13 +222,13 @@ void dna_io_seg::load_seg_file(const string& seg_filename, UINT32& blockCount, try { tmp = trimstr(sBuf.substr(column, JUNCT)); if (tmp.empty()) - throw boost::enable_current_exception(runtime_error(" Unable to retrieve Junction station count.")); + throw boost::enable_current_exception(std::runtime_error(" Unable to retrieve Junction station count.")); jslCount = LongFromString(tmp); } catch (...) { ss_err.str(""); - ss_err << " Segmentation file is corrupt: Could not extract Junction station count from the record: " << endl << " " << sBuf << endl; - throw boost::enable_current_exception(runtime_error(ss_err.str().c_str())); + ss_err << " Segmentation file is corrupt: Could not extract Junction station count from the record: " << std::endl << " " << sBuf << std::endl; + throw boost::enable_current_exception(std::runtime_error(ss_err.str().c_str())); } column += JUNCT; @@ -237,13 +237,13 @@ void dna_io_seg::load_seg_file(const string& seg_filename, UINT32& blockCount, try { tmp = trimstr(sBuf.substr(column, INNER)); if (tmp.empty()) - throw boost::enable_current_exception(runtime_error(" Unable to retrieve Inner station count.")); + throw boost::enable_current_exception(std::runtime_error(" Unable to retrieve Inner station count.")); islCount = LongFromString(tmp); } catch (...) { ss_err.str(""); - ss_err << " Segmentation file is corrupt: Could not extract Inner station count from the record: " << endl << " " << sBuf << endl; - throw boost::enable_current_exception(runtime_error(ss_err.str().c_str())); + ss_err << " Segmentation file is corrupt: Could not extract Inner station count from the record: " << std::endl << " " << sBuf << std::endl; + throw boost::enable_current_exception(std::runtime_error(ss_err.str().c_str())); } column += INNER; @@ -252,13 +252,13 @@ void dna_io_seg::load_seg_file(const string& seg_filename, UINT32& blockCount, try { tmp = trimstr(sBuf.substr(column, MEASR)); if (tmp.empty()) - throw boost::enable_current_exception(runtime_error(" Unable to retrieve Measurement count.")); + throw boost::enable_current_exception(std::runtime_error(" Unable to retrieve Measurement count.")); msrCount = LongFromString(tmp); } catch (...) { ss_err.str(""); - ss_err << " Segmentation file is corrupt: Could not extract Measurement count from the record: " << endl << " " << sBuf << endl; - throw boost::enable_current_exception(runtime_error(ss_err.str().c_str())); + ss_err << " Segmentation file is corrupt: Could not extract Measurement count from the record: " << std::endl << " " << sBuf << std::endl; + throw boost::enable_current_exception(std::runtime_error(ss_err.str().c_str())); } column += MEASR; @@ -267,17 +267,17 @@ void dna_io_seg::load_seg_file(const string& seg_filename, UINT32& blockCount, try { tmp = trimstr(sBuf.substr(column)); if (tmp.empty()) - throw boost::enable_current_exception(runtime_error(" Unable to retrieve Total station count.")); + throw boost::enable_current_exception(std::runtime_error(" Unable to retrieve Total station count.")); stnCount = LongFromString(tmp); } catch (...) { ss_err.str(""); - ss_err << " Segmentation file is corrupt: Could not extract Total station count from the record: " << endl << " " << sBuf << endl; - throw boost::enable_current_exception(runtime_error(ss_err.str().c_str())); + ss_err << " Segmentation file is corrupt: Could not extract Total station count from the record: " << std::endl << " " << sBuf << std::endl; + throw boost::enable_current_exception(std::runtime_error(ss_err.str().c_str())); } if (stnCount != islCount + jslCount) - throw boost::enable_current_exception(runtime_error(" Segmentation file is corrupt.")); + throw boost::enable_current_exception(std::runtime_error(" Segmentation file is corrupt.")); v_JSL.at(t) = vUINT32(jslCount); v_ISL.at(t) = vUINT32(islCount); @@ -292,7 +292,7 @@ void dna_io_seg::load_seg_file(const string& seg_filename, UINT32& blockCount, } if (blkCount != blockCount) - throw boost::enable_current_exception(runtime_error("load_seg_file(): Segmentation file is corrupt.")); + throw boost::enable_current_exception(std::runtime_error("load_seg_file(): Segmentation file is corrupt.")); // skip header info seg_file.ignore(PRINT_LINE_LENGTH, '\n'); // ------------------------ @@ -310,7 +310,7 @@ void dna_io_seg::load_seg_file(const string& seg_filename, UINT32& blockCount, seg_file.getline(line, PRINT_LINE_LENGTH); // Block # sscanf(line+5, "%ud", &blk); if (b+1 != blk) - throw boost::enable_current_exception(runtime_error("load_seg_file(): segmentation file is corrupt.")); + throw boost::enable_current_exception(std::runtime_error("load_seg_file(): segmentation file is corrupt.")); seg_file.ignore(PRINT_LINE_LENGTH, '\n'); // ------------------------ seg_file.ignore(PRINT_LINE_LENGTH, '\n'); // Junction stns: @@ -364,7 +364,7 @@ void dna_io_seg::load_seg_file(const string& seg_filename, UINT32& blockCount, v_measurementCount->at(b) += bmsBinaryRecords->at(m).vectorCount1 * 3; break; case 'D': // Direction set - v_measurementCount->at(b) += bmsBinaryRecords->at(m).vectorCount1 - 1; + v_measurementCount->at(b) += bmsBinaryRecords->at(m).vectorCount2 - 1; break; case 'A': // Horizontal angle case 'B': // Geodetic azimuth @@ -380,7 +380,7 @@ void dna_io_seg::load_seg_file(const string& seg_filename, UINT32& blockCount, case 'R': // Ellipsoidal height case 'M': // MSL arc case 'S': // Slope distance - case 'V': // Zenith angle + case 'V': // Zenith distance case 'Z': // Vertical angle default: v_measurementCount->at(b)++; // single measurement quantity @@ -393,16 +393,16 @@ void dna_io_seg::load_seg_file(const string& seg_filename, UINT32& blockCount, } } } - catch (const ios_base::failure& f) { + catch (const std::ios_base::failure& f) { ss_err << f.what(); - throw boost::enable_current_exception(runtime_error(ss_err.str())); + throw boost::enable_current_exception(std::runtime_error(ss_err.str())); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss_err << e.what(); - throw boost::enable_current_exception(runtime_error(ss_err.str())); + throw boost::enable_current_exception(std::runtime_error(ss_err.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss_err.str())); + throw boost::enable_current_exception(std::runtime_error(ss_err.str())); } seg_file.close(); @@ -488,7 +488,7 @@ void dna_io_seg::create_stn_appearance_list(vv_stn_appear& stnAppearance, } } -void dna_io_seg::write_seg_block(ostream &os, +void dna_io_seg::write_seg_block(std::ostream &os, const vUINT32& vISL, const vUINT32& vJSL, const vUINT32& vCML, const UINT32& currentBlock, const vstn_t* bstBinaryRecords, const vmsr_t* bmsBinaryRecords, @@ -496,28 +496,28 @@ void dna_io_seg::write_seg_block(ostream &os, { char dash; - os << endl << "Block " << currentBlock << endl; + os << std::endl << "Block " << currentBlock << std::endl; for (dash=INNER+JUNCT+MEASR+PAD; dash>0; dash--) os << "-"; - os << endl; + os << std::endl; - //os << setw(JUNCT) << left << "Block:" << setw(BLOCK) << right << currentBlock_ << endl; - os << setw(JUNCT) << left << "Junction stns:" << setw(BLOCK) << vJSL.size() << endl; - os << setw(JUNCT) << left << "Inner stns:" << setw(BLOCK) << vISL.size() << endl; - os << setw(JUNCT) << left << "Measurements:" << setw(BLOCK) << vCML.size() << endl; - os << setw(JUNCT) << left << "Total stns:" << setw(BLOCK) << (vJSL.size() + vISL.size()) << endl << endl; + //os << std::setw(JUNCT) << std::left << "Block:" << std::setw(BLOCK) << std::right << currentBlock_ << std::endl; + os << std::setw(JUNCT) << std::left << "Junction stns:" << std::setw(BLOCK) << vJSL.size() << std::endl; + os << std::setw(JUNCT) << std::left << "Inner stns:" << std::setw(BLOCK) << vISL.size() << std::endl; + os << std::setw(JUNCT) << std::left << "Measurements:" << std::setw(BLOCK) << vCML.size() << std::endl; + os << std::setw(JUNCT) << std::left << "Total stns:" << std::setw(BLOCK) << (vJSL.size() + vISL.size()) << std::endl << std::endl; it_vUINT32_const _it_isl(vISL.begin()); it_vUINT32_const _it_jsl(vJSL.begin()); it_vUINT32_const _it_msr(vCML.begin()); - os << setw(INNER) << left << "Inner stns" << setw(JUNCT) << left << "Junction stns" << - setw(MEASR) << "Measurements" << setw(PAD) << "Type" << endl; + os << std::setw(INNER) << std::left << "Inner stns" << std::setw(JUNCT) << std::left << "Junction stns" << + std::setw(MEASR) << "Measurements" << std::setw(PAD) << "Type" << std::endl; for (dash=INNER+JUNCT+MEASR+PAD; dash>0; dash--) os << "-"; - os << endl; - ostringstream tmp; + os << std::endl; + std::ostringstream tmp; vUINT32 msrStations; @@ -527,27 +527,27 @@ void dna_io_seg::write_seg_block(ostream &os, if (_it_isl != vISL.end()) { if (PRINT_NAMES) { - os << setw(INNER) << left << ((ostringstream&)(tmp << bstBinaryRecords->at(*_it_isl).stationName)).str(); + os << std::setw(INNER) << std::left << ((ostringstream&)(tmp << bstBinaryRecords->at(*_it_isl).stationName)).str(); tmp.str(""); } else - os << setw(INNER) << left << *_it_isl; + os << std::setw(INNER) << std::left << *_it_isl; _it_isl++; } else - os << setw(INNER) << left << " "; + os << std::setw(INNER) << std::left << " "; if (_it_jsl != vJSL.end()) { if (PRINT_NAMES) { - os << setw(JUNCT) << left << ((ostringstream&)(tmp << bstBinaryRecords->at(*_it_jsl).stationName)).str(); + os << std::setw(JUNCT) << std::left << ((ostringstream&)(tmp << bstBinaryRecords->at(*_it_jsl).stationName)).str(); tmp.str(""); } else - os << setw(JUNCT) << left << *_it_jsl; + os << std::setw(JUNCT) << std::left << *_it_jsl; _it_jsl++; } else - os << setw(JUNCT) << left << " "; + os << std::setw(JUNCT) << std::left << " "; if (_it_msr != vCML.end()) { if (PRINT_NAMES) { @@ -555,7 +555,7 @@ void dna_io_seg::write_seg_block(ostream &os, // Get all the stations associated with this measurement GetMsrStations(*bmsBinaryRecords, *_it_msr, msrStations); - os << left << bmsBinaryRecords->at(*_it_msr).measType << " ("; + os << std::left << bmsBinaryRecords->at(*_it_msr).measType << " ("; for_each(msrStations.begin(), msrStations.end(), [&os, &bstBinaryRecords](UINT32 stn){ @@ -567,14 +567,14 @@ void dna_io_seg::write_seg_block(ostream &os, if (bmsBinaryRecords->at(*_it_msr).clusterID > 0) os << "cluster " << bmsBinaryRecords->at(*_it_msr).clusterID; - os << endl; + os << std::endl; } else - os << setw(MEASR) << left << *_it_msr << setw(PAD) << left << bmsBinaryRecords->at(*_it_msr).measType << endl; + os << std::setw(MEASR) << std::left << *_it_msr << std::setw(PAD) << std::left << bmsBinaryRecords->at(*_it_msr).measType << std::endl; _it_msr++; } else - os << endl; + os << std::endl; // continue until all lists are exhausted if (_it_msr==vCML.end() && @@ -585,76 +585,76 @@ void dna_io_seg::write_seg_block(ostream &os, for (dash=INNER+JUNCT+MEASR+PAD; dash>0; dash--) os << "-"; - os << endl; + os << std::endl; } -void dna_io_seg::write_seg_file(const string& seg_filename, const string& bst_filename, const string& bms_filename, +void dna_io_seg::write_seg_file(const std::string& seg_filename, const std::string& bst_filename, const std::string& bms_filename, const UINT32& min_inner_stns, const UINT32& max_block_stns, - const string& seg_starting_stns, const vstring& vinitialStns, - const string& command_line_arguments, + const std::string& seg_starting_stns, const vstring& vinitialStns, + const std::string& command_line_arguments, vvUINT32& v_ISL, vvUINT32& v_JSL, vvUINT32& v_CML, vUINT32& v_ContiguousNetList, const pvstn_t bstBinaryRecords, const pvmsr_t bmsBinaryRecords) { std::ofstream seg_file; - stringstream ss; - ss << "write_seg_file(): An error was encountered when opening " << seg_filename << "." << endl; + std::stringstream ss; + ss << "write_seg_file(): An error was encountered when opening " << seg_filename << "." << std::endl; try { // Create segmentation file. Throws runtime_error on failure. file_opener(seg_file, seg_filename); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } // Print formatted header print_file_header(seg_file, "DYNADJUST SEGMENTATION OUTPUT FILE"); - seg_file << setw(PRINT_VAR_PAD) << left << "File name:" << system_complete(seg_filename).string() << endl << endl; + seg_file << std::setw(PRINT_VAR_PAD) << std::left << "File name:" << boost::filesystem::system_complete(seg_filename).string() << std::endl << std::endl; - seg_file << setw(PRINT_VAR_PAD) << left << "Command line arguments: "; - seg_file << command_line_arguments << endl << endl; + seg_file << std::setw(PRINT_VAR_PAD) << std::left << "Command line arguments: "; + seg_file << command_line_arguments << std::endl << std::endl; - seg_file << setw(PRINT_VAR_PAD) << left << "Stations file:" << system_complete(bst_filename).string() << endl; - seg_file << setw(PRINT_VAR_PAD) << left << "Measurements file:" << system_complete(bms_filename).string() << endl; + seg_file << std::setw(PRINT_VAR_PAD) << std::left << "Stations file:" << boost::filesystem::system_complete(bst_filename).string() << std::endl; + seg_file << std::setw(PRINT_VAR_PAD) << std::left << "Measurements file:" << boost::filesystem::system_complete(bms_filename).string() << std::endl; UINT32 b = 1; - seg_file << endl << setw(PRINT_VAR_PAD) << left << "Minimum inner stations" << min_inner_stns << endl; - seg_file << setw(PRINT_VAR_PAD) << left << "Block size threshold" << max_block_stns << endl; + seg_file << std::endl << std::setw(PRINT_VAR_PAD) << std::left << "Minimum inner stations" << min_inner_stns << std::endl; + seg_file << std::setw(PRINT_VAR_PAD) << std::left << "Block size threshold" << max_block_stns << std::endl; if (seg_starting_stns.size() == 1) - seg_file << setw(PRINT_VAR_PAD) << left << "Starting station" << seg_starting_stns.at(0) << endl; + seg_file << std::setw(PRINT_VAR_PAD) << std::left << "Starting station" << seg_starting_stns.at(0) << std::endl; else { - string s("Starting station(s)"); + std::string s("Starting station(s)"); for (b=0; b 0) - seg_file << endl; - seg_file << setw(PRINT_VAR_PAD) << left << s << + seg_file << std::endl; + seg_file << std::setw(PRINT_VAR_PAD) << std::left << s << vinitialStns.at(b); s = " "; } - seg_file << endl; + seg_file << std::endl; } - seg_file << OUTPUTLINE << endl << endl; - seg_file << setw(PRINT_VAR_PAD) << left << "SEGMENTATION SUMMARY" << endl << endl; - seg_file << setw(PRINT_VAR_PAD) << left << "No. blocks produced" << v_ISL.size() << endl; + seg_file << OUTPUTLINE << std::endl << std::endl; + seg_file << std::setw(PRINT_VAR_PAD) << std::left << "SEGMENTATION SUMMARY" << std::endl << std::endl; + seg_file << std::setw(PRINT_VAR_PAD) << std::left << "No. blocks produced" << v_ISL.size() << std::endl; char dash; for (dash=BLOCK+NETID+INNER+JUNCT+TOTAL+MEASR; dash>2; dash--) seg_file << "-"; - seg_file << endl; - seg_file << setw(BLOCK) << left << " Block" << setw(NETID) << left << "Network ID" - << setw(JUNCT) << left << "Junction stns" << setw(INNER) << left << "Inner stns" - << setw(MEASR) << left << "Measurements" << setw(TOTAL) << left << "Total stns" << endl; + seg_file << std::endl; + seg_file << std::setw(BLOCK) << std::left << " Block" << std::setw(NETID) << std::left << "Network ID" + << std::setw(JUNCT) << std::left << "Junction stns" << std::setw(INNER) << std::left << "Inner stns" + << std::setw(MEASR) << std::left << "Measurements" << std::setw(TOTAL) << std::left << "Total stns" << std::endl; it_vUINT32 _it_net(v_ContiguousNetList.begin()); it_vvUINT32 _it_isl(v_ISL.begin()), _it_jsl(v_JSL.begin()), _it_cml(v_CML.begin()); @@ -664,33 +664,33 @@ void dna_io_seg::write_seg_file(const string& seg_filename, const string& bst_fi for (; _it_isl!=v_ISL.end(); _it_isl++) { // block - seg_file << " " << setw(BLOCK-2) << left << b; + seg_file << " " << std::setw(BLOCK-2) << std::left << b; // network id - seg_file << setw(NETID) << left << *_it_net; + seg_file << std::setw(NETID) << std::left << *_it_net; // junction stns if (_it_jsl!=v_JSL.end()) - seg_file << setw(JUNCT) << left << _it_jsl->size(); + seg_file << std::setw(JUNCT) << std::left << _it_jsl->size(); else - seg_file << setw(JUNCT) << " "; + seg_file << std::setw(JUNCT) << " "; // inner stns - seg_file << setw(INNER) << left << _it_isl->size(); + seg_file << std::setw(INNER) << std::left << _it_isl->size(); // total measurements if (_it_cml!=v_CML.end()) - seg_file << setw(MEASR) << left << _it_cml->size(); + seg_file << std::setw(MEASR) << std::left << _it_cml->size(); else - seg_file << setw(MEASR) << " "; + seg_file << std::setw(MEASR) << " "; // total stns if (_it_jsl!=v_JSL.end()) - seg_file << setw(TOTAL) << left << (_it_isl->size() + _it_jsl->size()); + seg_file << std::setw(TOTAL) << std::left << (_it_isl->size() + _it_jsl->size()); else - seg_file << setw(TOTAL) << left << _it_isl->size(); + seg_file << std::setw(TOTAL) << std::left << _it_isl->size(); - seg_file << endl; + seg_file << std::endl; _it_jsl++; _it_cml++; @@ -700,10 +700,10 @@ void dna_io_seg::write_seg_file(const string& seg_filename, const string& bst_fi for (dash=BLOCK+NETID+INNER+JUNCT+TOTAL+MEASR; dash>2; dash--) seg_file << "-"; - seg_file << endl << endl << "INDIVIDUAL BLOCK DATA" << endl; + seg_file << std::endl << std::endl << "INDIVIDUAL BLOCK DATA" << std::endl; for (dash=BLOCK+NETID+INNER+JUNCT+TOTAL+MEASR; dash>2; dash--) seg_file << "-"; - seg_file << endl; + seg_file << std::endl; _it_isl = v_ISL.begin(); _it_jsl = v_JSL.begin(); @@ -717,27 +717,27 @@ void dna_io_seg::write_seg_file(const string& seg_filename, const string& bst_fi _it_cml++; } - seg_file << endl; + seg_file << std::endl; seg_file.close(); } -void dna_io_seg::write_stn_appearance(const string& sap_filename, const v_stn_block_map& stnAppearance) +void dna_io_seg::write_stn_appearance(const std::string& sap_filename, const v_stn_block_map& stnAppearance) { std::ofstream sap_file; - stringstream ss; - ss << "write_sap_file(): An error was encountered when opening " << sap_filename << "." << endl; + std::stringstream ss; + ss << "write_sap_file(): An error was encountered when opening " << sap_filename << "." << std::endl; try { // Create segmentation file. Throws runtime_error on failure. - file_opener(sap_file, sap_filename, ios::out | ios::binary, binary); + file_opener(sap_file, sap_filename, std::ios::out | std::ios::binary, binary); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } // write the list @@ -755,22 +755,22 @@ void dna_io_seg::write_stn_appearance(const string& sap_filename, const v_stn_bl sap_file.close(); } -void dna_io_seg::load_stn_appearance(const string& sap_filename, v_stn_block_map& stnAppearance) +void dna_io_seg::load_stn_appearance(const std::string& sap_filename, v_stn_block_map& stnAppearance) { std::ifstream sap_file; - stringstream ss; - ss << "load_sap_file(): An error was encountered when opening " << sap_filename << "." << endl; + std::stringstream ss; + ss << "load_sap_file(): An error was encountered when opening " << sap_filename << "." << std::endl; try { // Create segmentation file. Throws runtime_error on failure. - file_opener(sap_file, sap_filename, ios::in | ios::binary, binary); + file_opener(sap_file, sap_filename, std::ios::in | std::ios::binary, binary); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } // write the list diff --git a/dynadjust/include/io/dnaioseg.hpp b/dynadjust/include/io/dnaioseg.hpp index d82e9452..9e00a052 100644 --- a/dynadjust/include/io/dnaioseg.hpp +++ b/dynadjust/include/io/dnaioseg.hpp @@ -47,13 +47,13 @@ class dna_io_seg : public dna_io_base dna_io_seg& operator=(const dna_io_seg& rhs); - void load_seg_file_header(const string& seg_filename, istream& seg_file, UINT32& blockCount, + void load_seg_file_header(const std::string& seg_filename, std::istream& seg_file, UINT32& blockCount, UINT32& blockThreshold, UINT32& minInnerStns); - void load_seg_file_header_f(const string& seg_filename, UINT32& blockCount, + void load_seg_file_header_f(const std::string& seg_filename, UINT32& blockCount, UINT32& blockThreshold, UINT32& minInnerStns); - void load_seg_file(const string& seg_filename, UINT32& blockCount, + void load_seg_file(const std::string& seg_filename, UINT32& blockCount, UINT32& blockThreshold, UINT32& minInnerStns, vvUINT32& v_ISL, vvUINT32& v_JSL, vvUINT32& v_CML, bool loadMetrics, @@ -65,23 +65,23 @@ class dna_io_seg : public dna_io_base const vvUINT32& paramStationList, vASL& assocStnList); - void write_seg_block(ostream &os, + void write_seg_block(std::ostream &os, const vUINT32& vISL, const vUINT32& vJSL, const vUINT32& vCML, const UINT32& currentBlock, const vstn_t* bstBinaryRecords, const vmsr_t* bmsBinaryRecords, bool PRINT_NAMES=false); - void write_seg_file(const string& seg_filename, const string& bst_filename, const string& bms_filename, + void write_seg_file(const std::string& seg_filename, const std::string& bst_filename, const std::string& bms_filename, const UINT32& min_inner_stns, const UINT32& max_block_stns, - const string& seg_starting_stns, const vstring& vinitialStns, - const string& command_line_arguments, + const std::string& seg_starting_stns, const vstring& vinitialStns, + const std::string& command_line_arguments, vvUINT32& v_ISL, vvUINT32& v_JSL, vvUINT32& v_CML, vUINT32& v_ContiguousNetList, const pvstn_t bstBinaryRecords, const pvmsr_t bmsBinaryRecords); void build_free_stn_availability(vASL& assocStnList, v_freestn_pair& freeStnList); - void write_stn_appearance(const string& sap_filename, const v_stn_block_map& stnAppearance); - void load_stn_appearance(const string& sap_filename, v_stn_block_map& stnAppearance); + void write_stn_appearance(const std::string& sap_filename, const v_stn_block_map& stnAppearance); + void load_stn_appearance(const std::string& sap_filename, v_stn_block_map& stnAppearance); protected: diff --git a/dynadjust/include/io/dnaiosnx.hpp b/dynadjust/include/io/dnaiosnx.hpp index a016669f..cee40ebe 100644 --- a/dynadjust/include/io/dnaiosnx.hpp +++ b/dynadjust/include/io/dnaiosnx.hpp @@ -41,8 +41,6 @@ using namespace dynadjust::math; using namespace dynadjust::datum_parameters; using namespace dynadjust::measurements; -using namespace boost::local_time; - namespace dynadjust { namespace iostreams { @@ -60,7 +58,7 @@ typedef enum _SINEX_WARN_TYPE_ //T2 formatted_name; //T2 formatted_date; //T3 last_occurrence; -template +template struct site_id_tuple_t { T1 file_index; @@ -89,8 +87,8 @@ struct site_id_tuple_t }; // Now create types for the site_id variable, container and iterator -typedef site_id_tuple_t site_id; -typedef vector v_site_id_tuple, *pv_v_site_id_tuple; +typedef site_id_tuple_t site_id; +typedef std::vector v_site_id_tuple, *pv_v_site_id_tuple; typedef v_site_id_tuple::iterator _it_vsite_id_tuple; // Used to sort site tuples by file order @@ -111,7 +109,7 @@ class CompareSiteTuplesByName { public: bool operator()(const T& left, const T& right) { // if the station names are equal - if (equals(left.site_name, right.site_name)) + if (boost::equals(left.site_name, right.site_name)) // sort on file order return left.file_index < right.file_index; // sort on station name @@ -121,7 +119,7 @@ class CompareSiteTuplesByName { ///////////////////////////////////////////////////////////// // Custom struct to manage site discontinuities -template +template struct discontinuity_tuple_t { T1 file_index; @@ -133,7 +131,7 @@ struct discontinuity_tuple_t discontinuity_tuple_t() : file_index(0), solution_id(0), site_name("") - , date_start(date(TIME_IMMEMORIAL, 1, 1)), date_end(date(TIME_IMMEMORIAL, 1, 1)), discontinuity_exists(false) {} + , date_start(boost::gregorian::date(TIME_IMMEMORIAL, 1, 1)), date_end(boost::gregorian::date(TIME_IMMEMORIAL, 1, 1)), discontinuity_exists(false) {} discontinuity_tuple_t(const T1& index, const T1& solution, const T2& name, const T3& from, const T3& to, const T4& discontinuity) : file_index(index), solution_id(solution), site_name(name) @@ -150,8 +148,8 @@ struct discontinuity_tuple_t }; // Now create types for the site_id variable, container and iterator -typedef discontinuity_tuple_t discontinuity_tuple; -typedef vector v_discontinuity_tuple, *pv_v_discontinuity_tuple; +typedef discontinuity_tuple_t discontinuity_tuple; +typedef std::vector v_discontinuity_tuple, *pv_v_discontinuity_tuple; typedef v_discontinuity_tuple::iterator _it_vdiscontinuity_tuple; template @@ -160,7 +158,7 @@ bool rename_discont_station(T& begin, S& site_name, D& site_date, S& site_rename UINT32 doy, year; // find the next occurrence of this site - while (equals(site_name, begin->site_name)) + while (boost::equals(site_name, begin->site_name)) { // Check if discontinuities exist at this site, if not, skip if (!begin->discontinuity_exists) @@ -173,7 +171,7 @@ bool rename_discont_station(T& begin, S& site_name, D& site_date, S& site_rename if (site_date >= begin->date_start && site_date < begin->date_end) { - stringstream ss; + std::stringstream ss; doy = begin->date_start.day_of_year(); year = begin->date_start.year(); ss << site_name << "_"; @@ -217,7 +215,7 @@ struct CompareDiscontinuityOnSite template T binary_search_discontinuity_site(T begin, T end, S value) { - T i = lower_bound(begin, end, value, CompareDiscontinuityOnSite()); + T i = lower_bound(begin, end, value, CompareDiscontinuityOnSite()); if (i != end && i->site_name == value) return i; else @@ -254,17 +252,17 @@ class dna_io_snx : public dna_io_base dna_io_snx& operator=(const dna_io_snx& rhs); - stringstream parse_date_from_string(const string& date_str, DATE_FORMAT_TYPE date_type, DATE_TERMINAL_TYPE terminal_type, const string& separator); - stringstream parse_date_from_yy_doy(const UINT32& yy, const UINT32& doy, DATE_FORMAT_TYPE date_type, const string& separator); + std::stringstream parse_date_from_string(const std::string& date_str, DATE_FORMAT_TYPE date_type, DATE_TERMINAL_TYPE terminal_type, const std::string& separator); + std::stringstream parse_date_from_yy_doy(const UINT32& yy, const UINT32& doy, DATE_FORMAT_TYPE date_type, const std::string& separator); - void parse_sinex(std::ifstream** snx_file, const string& fileName, vdnaStnPtr* vStations, PUINT32 stnCount, + void parse_sinex(std::ifstream** snx_file, const std::string& fileName, vdnaStnPtr* vStations, PUINT32 stnCount, vdnaMsrPtr* vMeasurements, PUINT32 msrCount, PUINT32 clusterID, StnTally& parsestn_tally, MsrTally& parsemsr_tally, UINT32& fileOrder, CDnaDatum& datum, bool applyDiscontinuities, v_discontinuity_tuple* stn_discontinuities_, bool& m_discontsSortedbyName, UINT32& lineNo, UINT32& columnNo, _PARSE_STATUS_& parseStatus); - void parse_discontinuity_file(std::ifstream* snx_file, const string& fileName, + void parse_discontinuity_file(std::ifstream* snx_file, const std::string& fileName, v_discontinuity_tuple* stn_discontinuities_, bool& m_discontsSortedbyName, UINT32& lineNo, UINT32& columnNo, _PARSE_STATUS_& parseStatus); @@ -278,7 +276,7 @@ class dna_io_snx : public dna_io_base inline bool warnings_exist() { return !warningMessages_.empty(); } - void print_warnings(std::ofstream* warning_file, const string& fileName); + void print_warnings(std::ofstream* warning_file, const std::string& fileName); protected: @@ -325,9 +323,9 @@ class dna_io_snx : public dna_io_base void serialise_solution_variances(std::ofstream* snx_file, matrix_2d* variances); void print_line(std::ofstream* snx_file); - //string format_exponent(string value); + //string format_exponent(std::string value); void print_matrix_index(std::ofstream* snx_file, const UINT32& row, const UINT32& col); - void add_warning(const string& message, SINEX_WARN_TYPE warning); + void add_warning(const std::string& message, SINEX_WARN_TYPE warning); UINT32 blockCount_; UINT32 block_; @@ -338,9 +336,9 @@ class dna_io_snx : public dna_io_base uint32_uint32_map* blockStationsMap_; vUINT32* blockStations_; - vector warningMessages_; + std::vector warningMessages_; - date averageEpoch_; + boost::gregorian::date averageEpoch_; UINT32 uniqueStationCount_; bool containsVelocities_; diff --git a/dynadjust/include/io/dnaiosnxread.cpp b/dynadjust/include/io/dnaiosnxread.cpp index 112fab1b..294d5c38 100644 --- a/dynadjust/include/io/dnaiosnxread.cpp +++ b/dynadjust/include/io/dnaiosnxread.cpp @@ -28,7 +28,7 @@ namespace dynadjust { namespace iostreams { -void dna_io_snx::parse_sinex(std::ifstream** snx_file, const string& fileName, vdnaStnPtr* vStations, PUINT32 stnCount, +void dna_io_snx::parse_sinex(std::ifstream** snx_file, const std::string& fileName, vdnaStnPtr* vStations, PUINT32 stnCount, vdnaMsrPtr* vMeasurements, PUINT32 msrCount, PUINT32 clusterID, StnTally& parsestn_tally, MsrTally& parsemsr_tally, UINT32& fileOrder, CDnaDatum& datum, bool applyDiscontinuities, @@ -52,9 +52,9 @@ void dna_io_snx::parse_sinex(std::ifstream** snx_file, const string& fileName, v // read header line and extract epoch if (!parse_sinex_header(snx_file, datum, lineNo)) { - stringstream ss; - ss << "parse_sinex(): The SINEX file " << fileName << " did not contain a header record." << endl; - throw boost::enable_current_exception(runtime_error(ss.str())); + std::stringstream ss; + ss << "parse_sinex(): The SINEX file " << fileName << " did not contain a header record." << std::endl; + throw boost::enable_current_exception(std::runtime_error(ss.str())); } try { @@ -65,24 +65,24 @@ void dna_io_snx::parse_sinex(std::ifstream** snx_file, const string& fileName, v stn_discontinuities, m_discontsSortedbyName, fileOrder, lineNo, columnNo); } - catch (const ios_base::failure& f) { + catch (const std::ios_base::failure& f) { if ((*snx_file)->eof()) return; - stringstream ss; - ss << "parse_sinex(): An error was encountered when attempting to read SINEX file " << fileName << "." << endl << " " << f.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + std::stringstream ss; + ss << "parse_sinex(): An error was encountered when attempting to read SINEX file " << fileName << "." << std::endl << " " << f.what(); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } - catch (const runtime_error& f) { - stringstream ss; + catch (const std::runtime_error& f) { + std::stringstream ss; ss << " - line " << lineNo; - ss << ", column " << columnNo << endl; + ss << ", column " << columnNo << std::endl; ss << " - " << f.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } } -void dna_io_snx::parse_discontinuity_file(std::ifstream* snx_file, const string& fileName, +void dna_io_snx::parse_discontinuity_file(std::ifstream* snx_file, const std::string& fileName, v_discontinuity_tuple* stn_discontinuities, bool& m_discontsSortedbyName, UINT32& lineNo, UINT32& columnNo, _PARSE_STATUS_& parseStatus) { @@ -96,7 +96,7 @@ void dna_io_snx::parse_discontinuity_file(std::ifstream* snx_file, const string& containsVelocities_ = false; containsDiscontinuities_ = false; - string sBuf, tmp; + std::string sBuf, tmp; try { // As the purpose of the discontinuity file is to provide dates on when discontinuities occur, @@ -110,7 +110,7 @@ void dna_io_snx::parse_discontinuity_file(std::ifstream* snx_file, const string& getline((*snx_file), sBuf); // End of data? - if (iequals(sBuf.substr(0, 7), ENDSNX)) + if (boost::iequals(sBuf.substr(0, 7), ENDSNX)) break; try { @@ -121,34 +121,34 @@ void dna_io_snx::parse_discontinuity_file(std::ifstream* snx_file, const string& lineNo, columnNo); } catch (...) { - stringstream ss; - ss << "parse_sinex_data(): Could not extract data from the record: " << endl << " " << sBuf << "."; - throw boost::enable_current_exception(runtime_error(ss.str())); + std::stringstream ss; + ss << "parse_sinex_data(): Could not extract data from the record: " << std::endl << " " << sBuf << "."; + throw boost::enable_current_exception(std::runtime_error(ss.str())); } } } - catch (const ios_base::failure& f) { + catch (const std::ios_base::failure& f) { if (snx_file->eof()) return; - stringstream ss; - ss << "parse_discontinuity_file(): An error was encountered when attempting to read SINEX file " << fileName << "." << endl << " " << f.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + std::stringstream ss; + ss << "parse_discontinuity_file(): An error was encountered when attempting to read SINEX file " << fileName << "." << std::endl << " " << f.what(); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } - catch (const runtime_error& f) { - stringstream ss; + catch (const std::runtime_error& f) { + std::stringstream ss; ss << " - line " << lineNo; - ss << ", column " << columnNo << endl; + ss << ", column " << columnNo << std::endl; ss << " - " << f.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } } // Expects yy as two digit year, and doy as three digit day of year -stringstream dna_io_snx::parse_date_from_yy_doy(const UINT32& yy, const UINT32& doy, DATE_FORMAT_TYPE date_type, const string& separator) +std::stringstream dna_io_snx::parse_date_from_yy_doy(const UINT32& yy, const UINT32& doy, DATE_FORMAT_TYPE date_type, const std::string& separator) { - stringstream ss_doy, ss_year, ss_date; + std::stringstream ss_doy, ss_year, ss_date; // format the day of year so that boost date_input_facet is happy if (doy < 100) @@ -201,7 +201,7 @@ stringstream dna_io_snx::parse_date_from_yy_doy(const UINT32& yy, const UINT32& } // date is a string "YY:DDD:SSSSS" -stringstream dna_io_snx::parse_date_from_string(const string& date_str, DATE_FORMAT_TYPE date_type, DATE_TERMINAL_TYPE terminal_type, const string& separator) +std::stringstream dna_io_snx::parse_date_from_string(const std::string& date_str, DATE_FORMAT_TYPE date_type, DATE_TERMINAL_TYPE terminal_type, const std::string& separator) { // Year UINT32 yy = LongFromString(date_str.substr(0, 2)); @@ -211,8 +211,8 @@ stringstream dna_io_snx::parse_date_from_string(const string& date_str, DATE_FOR if (yy == 0 && doy == 0) { - date today(day_clock::local_day()); - stringstream date_ss; + boost::gregorian::date today(boost::gregorian::day_clock::local_day()); + std::stringstream date_ss; switch (terminal_type) { @@ -242,18 +242,18 @@ bool dna_io_snx::parse_sinex_header(std::ifstream** snx_file, CDnaDatum& datum, return false; } - string sBuf, sinex_code; + std::string sBuf, sinex_code; UINT32 average_year, average_doy; - stringstream ss; + std::stringstream ss; lineNo++; try { getline((**snx_file), sBuf); } catch (...) { - ss << "parse_sinex_header(): Could not read from the SINEX file. " << endl << "."; - throw boost::enable_current_exception(runtime_error(ss.str())); + ss << "parse_sinex_header(): Could not read from the SINEX file. " << std::endl << "."; + throw boost::enable_current_exception(std::runtime_error(ss.str())); } try { @@ -266,13 +266,13 @@ bool dna_io_snx::parse_sinex_header(std::ifstream** snx_file, CDnaDatum& datum, average_year, average_doy); - ss = parse_date_from_yy_doy(average_year, average_doy, doy_yyyy, string(" ")); - datum.SetEpoch(dateFromStringstream_doy_year(ss)); + ss = parse_date_from_yy_doy(average_year, average_doy, doy_yyyy, std::string(" ")); + datum.SetEpoch(dateFromStringstream_doy_year(ss)); } catch (...) { - ss << "parse_sinex_header(): Could not extract date and time information from the header record: " << endl << " " << sBuf << "."; - throw boost::enable_current_exception(runtime_error(ss.str())); + ss << "parse_sinex_header(): Could not extract date and time information from the header record: " << std::endl << " " << sBuf << "."; + throw boost::enable_current_exception(std::runtime_error(ss.str())); } return true; @@ -285,7 +285,7 @@ void dna_io_snx::parse_sinex_data(std::ifstream** snx_file, vdnaStnPtr* vStation v_discontinuity_tuple* stn_discontinuities, bool& m_discontsSortedbyName, UINT32& fileOrder, UINT32& lineNo, UINT32& columnNo) { - string sBuf, tmp; + std::string sBuf, tmp; vStations->clear(); vMeasurements->clear(); @@ -299,7 +299,7 @@ void dna_io_snx::parse_sinex_data(std::ifstream** snx_file, vdnaStnPtr* vStation getline((**snx_file), sBuf); // End of data? - if (iequals(sBuf.substr(0, 7), ENDSNX)) + if (boost::iequals(sBuf.substr(0, 7), ENDSNX)) break; try { @@ -308,16 +308,16 @@ void dna_io_snx::parse_sinex_data(std::ifstream** snx_file, vdnaStnPtr* vStation parse_sinex_block(snx_file, sBuf.c_str(), vStations, stnCount, vMeasurements, msrCount, clusterID, parsestn_tally, parsemsr_tally, datum, fileOrder, lineNo, columnNo); } - catch (runtime_error& e) { - stringstream ss; - ss << "parse_sinex_data(): Error parsing SINEX file: " << endl << + catch (std::runtime_error& e) { + std::stringstream ss; + ss << "parse_sinex_data(): Error parsing SINEX file: " << std::endl << " " << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - stringstream ss; - ss << "parse_sinex_data(): Could not extract data from the record: " << endl << " " << sBuf << "."; - throw boost::enable_current_exception(runtime_error(ss.str())); + std::stringstream ss; + ss << "parse_sinex_data(): Could not extract data from the record: " << std::endl << " " << sBuf << "."; + throw boost::enable_current_exception(std::runtime_error(ss.str())); } } @@ -333,23 +333,23 @@ void dna_io_snx::format_station_names(v_discontinuity_tuple* stn_discontinuities vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements) { UINT32 site, doy, year; - string site_name; + std::string site_name; #ifdef _MSDEBUG - string date_str; + std::string date_str; #endif _it_vdiscontinuity_tuple _it_discont(stn_discontinuities->end()), _it_discont_site; - date site_date; + boost::gregorian::date site_date; if (!m_discontsSortedbyName) { - sort(stn_discontinuities->begin(), stn_discontinuities->end(), + std::sort(stn_discontinuities->begin(), stn_discontinuities->end(), CompareSiteTuplesByName()); m_discontsSortedbyName = true; } - sort(siteOccurrence_.begin(), siteOccurrence_.end(), + std::sort(siteOccurrence_.begin(), siteOccurrence_.end(), CompareSiteTuplesByName()); _it_discont = stn_discontinuities->begin(); @@ -363,7 +363,7 @@ void dna_io_snx::format_station_names(v_discontinuity_tuple* stn_discontinuities // 2. the first occurrence of discontinuity for site_name // To prevent searching through the entire array again on 2. , check if // _it_discont->site_name = site_name - if (!equals(site_name, _it_discont->site_name)) + if (!boost::equals(site_name, _it_discont->site_name)) { // Save the iterator _it_discont_site = _it_discont; @@ -384,7 +384,7 @@ void dna_io_snx::format_station_names(v_discontinuity_tuple* stn_discontinuities continue; // Capture the (start date of the site) - site_date = dateFromString_doy_year(siteOccurrence_.at(site).formatted_date); + site_date = dateFromString_doy_year(siteOccurrence_.at(site).formatted_date); #ifdef _MSDEBUG //date_str = stringFromDate(_it_discont->date_start, "%y:%j:00000"); @@ -392,14 +392,14 @@ void dna_io_snx::format_station_names(v_discontinuity_tuple* stn_discontinuities _it_discont_site = _it_discont; // find the next occurrence of this site - while (equals(site_name, _it_discont_site->site_name)) + while (boost::equals(site_name, _it_discont_site->site_name)) { // Test if the start epoch of this site is within this discontinuity window if (site_date >= _it_discont_site->date_start && site_date < _it_discont_site->date_end) // if (siteOccurrence_.at(site).solution_id == _it_discont_site->solution_id) { - stringstream ss; + std::stringstream ss; doy = _it_discont_site->date_start.day_of_year(); year = _it_discont_site->date_start.year(); ss << siteOccurrence_.at(site).site_name << "_"; @@ -424,21 +424,21 @@ void dna_io_snx::format_station_names(v_discontinuity_tuple* stn_discontinuities if (siteOccurrence_.size() != vStations->size() || siteOccurrence_.size() != vMeasurements->at(0)->GetTotal()) { - stringstream ss; + std::stringstream ss; ss << "format_station_names(): Inconsistent number of stations in SINEX file."; - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } _it_vsite_id_tuple _it_site(siteOccurrence_.begin()); // sort on file index (default sort) - sort(siteOccurrence_.begin(), siteOccurrence_.end(), + std::sort(siteOccurrence_.begin(), siteOccurrence_.end(), CompareSiteTuples()); // Now update station vector for_each(vStations->begin(), vStations->end(), [&_it_site](const dnaStnPtr& stn) { - if (!equals(_it_site->site_name, _it_site->formatted_name)) + if (!boost::equals(_it_site->site_name, _it_site->formatted_name)) { stn->SetOriginalName(); stn->SetName(_it_site->formatted_name); @@ -450,12 +450,12 @@ void dna_io_snx::format_station_names(v_discontinuity_tuple* stn_discontinuities _it_site = siteOccurrence_.begin(); _it_vdnamsrptr _it_msr(vMeasurements->begin()); - vector* vgpsPnts(_it_msr->get()->GetPoints_ptr()); + std::vector* vgpsPnts(_it_msr->get()->GetPoints_ptr()); // Now update measurement vector for_each(vgpsPnts->begin(), vgpsPnts->end(), [&_it_site](CDnaGpsPoint& pnt) { - if (!equals(_it_site->site_name, _it_site->formatted_name)) + if (!boost::equals(_it_site->site_name, _it_site->formatted_name)) pnt.SetFirst(_it_site->formatted_name); _it_site++; }); @@ -527,11 +527,11 @@ void dna_io_snx::parse_sinex_discontinuities(std::ifstream* snx_file, v_discontinuity_tuple* stn_discontinuities, bool& m_discontsSortedbyName, UINT32& lineNo, UINT32& columnNo) { - string sBuf("+"), stn, stn_prev(""), model; + std::string sBuf("+"), stn, stn_prev(""), model; UINT32 file_rec(0), solution_id; - date discont_start_date, discont_end_date; + boost::gregorian::date discont_start_date, discont_end_date; - stringstream ss, discont_from, discont_to; + std::stringstream ss, discont_from, discont_to; stn_discontinuities->clear(); m_discontsSortedbyName = false; @@ -553,7 +553,7 @@ void dna_io_snx::parse_sinex_discontinuities(std::ifstream* snx_file, stn = trimstr(sBuf.substr(1, 4)); // station name // solution ID - solution_id = val_uint( + solution_id = val_uint( trimstr(sBuf.substr(9, 4))); // solution id // model @@ -568,7 +568,7 @@ void dna_io_snx::parse_sinex_discontinuities(std::ifstream* snx_file, model = trimstr(sBuf.substr(42, 1)); // model // Is this a discontinuity in position? If not, continue to next - if (!iequals(model, "P")) + if (!boost::iequals(model, "P")) continue; // If there are multiple solutions, then there must be a discontinuity, but only if @@ -588,17 +588,17 @@ void dna_io_snx::parse_sinex_discontinuities(std::ifstream* snx_file, // the sequence of time series. // start epoch (yy:doy:sssss) - discont_from = parse_date_from_string(trimstr(sBuf.substr(16, 6)), doy_yyyy, date_from, string(" ")); - discont_start_date = dateFromStringstream_doy_year(discont_from); + discont_from = parse_date_from_string(trimstr(sBuf.substr(16, 6)), doy_yyyy, date_from, std::string(" ")); + discont_start_date = dateFromStringstream_doy_year(discont_from); // end epoch (yy:doy:sssss) - discont_to = parse_date_from_string(trimstr(sBuf.substr(29, 6)), doy_yyyy, date_to, string(" ")); - discont_end_date = dateFromStringstream_doy_year(discont_to); + discont_to = parse_date_from_string(trimstr(sBuf.substr(29, 6)), doy_yyyy, date_to, std::string(" ")); + discont_end_date = dateFromStringstream_doy_year(discont_to); //////////////////////////////////////////////////////////////////////////////////////////// stn_discontinuities->push_back( - discontinuity_tuple_t( + discontinuity_tuple_t( file_rec, // file_index solution_id, // solution_id stn, // site_name @@ -612,8 +612,8 @@ void dna_io_snx::parse_sinex_discontinuities(std::ifstream* snx_file, catch (...) { ss.str(""); columnNo = 1; - ss << "parse_sinex_discontinuities(): Could not extract station name from the record: " << endl << " " << sBuf << "."; - throw boost::enable_current_exception(runtime_error(ss.str())); + ss << "parse_sinex_discontinuities(): Could not extract station name from the record: " << std::endl << " " << sBuf << "."; + throw boost::enable_current_exception(std::runtime_error(ss.str())); } } @@ -622,7 +622,7 @@ void dna_io_snx::parse_sinex_discontinuities(std::ifstream* snx_file, return; // sort the station discontinuities on station name - sort(stn_discontinuities->begin(), stn_discontinuities->end(), + std::sort(stn_discontinuities->begin(), stn_discontinuities->end(), CompareSiteTuplesByName()); // Identify if discontinuity exists (by equal station names) and @@ -637,7 +637,7 @@ void dna_io_snx::parse_sinex_discontinuities(std::ifstream* snx_file, break; // Are station names equal? - if (equals(it_discont->site_name, it_discont_next->site_name)) + if (boost::equals(it_discont->site_name, it_discont_next->site_name)) { // Then this is a discontinuity site! it_discont->discontinuity_exists = true; @@ -646,7 +646,7 @@ void dna_io_snx::parse_sinex_discontinuities(std::ifstream* snx_file, } // re-sort the station discontinuities back to the original file order - sort(stn_discontinuities->begin(), stn_discontinuities->end(), + std::sort(stn_discontinuities->begin(), stn_discontinuities->end(), CompareSiteTuples()); m_discontsSortedbyName = false; } @@ -655,7 +655,7 @@ void dna_io_snx::parse_sinex_discontinuities(std::ifstream* snx_file, // Read sites void dna_io_snx::parse_sinex_sites(std::ifstream** snx_file, UINT32& lineNo, UINT32& columnNo) { - string sBuf("+"), stn, domes; + std::string sBuf("+"), stn, domes; // Has the SOLUTION/EPOCHS block already been read? If so, no need // to continue with this block - just skip to the end. @@ -674,7 +674,7 @@ void dna_io_snx::parse_sinex_sites(std::ifstream** snx_file, UINT32& lineNo, UIN siteOccurrence_.clear(); UINT32 file_rec(0); - stringstream ss; + std::stringstream ss; while (sBuf.at(0) != '-') { @@ -697,7 +697,7 @@ void dna_io_snx::parse_sinex_sites(std::ifstream** snx_file, UINT32& lineNo, UIN // set default values (amended later) siteOccurrence_.push_back( - site_id_tuple_t( + site_id_tuple_t( file_rec, // file_index, 1, // solution_id (set to 1 since SITE/ID doesn't hold solution_id) stn, // station name @@ -711,8 +711,8 @@ void dna_io_snx::parse_sinex_sites(std::ifstream** snx_file, UINT32& lineNo, UIN catch (...) { ss.str(""); columnNo = 1; - ss << "parse_sinex_discontinuities(): Could not extract station name from the record: " << endl << " " << sBuf << "."; - throw boost::enable_current_exception(runtime_error(ss.str())); + ss << "parse_sinex_discontinuities(): Could not extract station name from the record: " << std::endl << " " << sBuf << "."; + throw boost::enable_current_exception(std::runtime_error(ss.str())); } } @@ -725,10 +725,10 @@ void dna_io_snx::parse_sinex_sites(std::ifstream** snx_file, UINT32& lineNo, UIN // Read station epochs void dna_io_snx::parse_sinex_epochs(std::ifstream** snx_file, UINT32& lineNo, UINT32& columnNo) { - string sBuf("+"), stn, site, date_start; + std::string sBuf("+"), stn, site, date_start; UINT32 file_rec(0), solution_id; - stringstream ss; + std::stringstream ss; if (!siteIDsRead_) siteOccurrence_.clear(); @@ -750,15 +750,15 @@ void dna_io_snx::parse_sinex_epochs(std::ifstream** snx_file, UINT32& lineNo, UI // station stn = trimstr(sBuf.substr(1, 4)); // solution ID - solution_id = val_uint(trimstr(sBuf.substr(9, 4))); + solution_id = val_uint(trimstr(sBuf.substr(9, 4))); // Get start epoch (yy:doy:sssss) of data window used to process this site - date_start = parse_date_from_string(trimstr(sBuf.substr(16, 6)), doy_yyyy, date_from, string(" ")).str(); + date_start = parse_date_from_string(trimstr(sBuf.substr(16, 6)), doy_yyyy, date_from, std::string(" ")).str(); } catch (...) { ss.str(""); columnNo = 1; - ss << "parse_sinex_epochs(): Could not extract station name from the record: " << endl << " " << sBuf << "."; - throw boost::enable_current_exception(runtime_error(ss.str())); + ss << "parse_sinex_epochs(): Could not extract station name from the record: " << std::endl << " " << sBuf << "."; + throw boost::enable_current_exception(std::runtime_error(ss.str())); } // Perform some file consistency checks @@ -772,23 +772,23 @@ void dna_io_snx::parse_sinex_epochs(std::ifstream** snx_file, UINT32& lineNo, UI catch (...) { ss.str(""); columnNo = 1; - ss << "parse_sinex_epochs(): The number of sites in SITE/ID and SOLUTION/EPOCHS" << endl << - " is inconsistent: " << endl << - " " << "SITE/ID block has " << siteOccurrence_.size() << " sites" << endl << - " " << "SOLUTION/EPOCHS block contains additional sites not listed in SITE/ID. Next record is:" << endl << + ss << "parse_sinex_epochs(): The number of sites in SITE/ID and SOLUTION/EPOCHS" << std::endl << + " is inconsistent: " << std::endl << + " " << "SITE/ID block has " << siteOccurrence_.size() << " sites" << std::endl << + " " << "SOLUTION/EPOCHS block contains additional sites not listed in SITE/ID. Next record is:" << std::endl << " " << sBuf << "."; - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } - if (!equals(site, stn)) + if (!boost::equals(site, stn)) { ss.str(""); columnNo = 1; - ss << "parse_sinex_epochs(): The order of sites in SITE/ID and SOLUTION/EPOCHS" << endl << - " is inconsistent: " << endl << - " " << "Index " << file_rec << " in SITE/ID block is " << siteOccurrence_.at(file_rec).site_name << endl << + ss << "parse_sinex_epochs(): The order of sites in SITE/ID and SOLUTION/EPOCHS" << std::endl << + " is inconsistent: " << std::endl << + " " << "Index " << file_rec << " in SITE/ID block is " << siteOccurrence_.at(file_rec).site_name << std::endl << " " << "Index " << file_rec << " in SOLUTION/EPOCHS block is " << stn << "."; - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } } @@ -805,7 +805,7 @@ void dna_io_snx::parse_sinex_epochs(std::ifstream** snx_file, UINT32& lineNo, UI { // Create new elements and add to the vector siteOccurrence_.push_back( - site_id_tuple_t( + site_id_tuple_t( file_rec, // file_index, solution_id, // solution_id stn, // station name @@ -820,9 +820,9 @@ void dna_io_snx::parse_sinex_epochs(std::ifstream** snx_file, UINT32& lineNo, UI catch (...) { ss.str(""); columnNo = 1; - ss << "parse_sinex_epochs(): Failed to add a new record to the site occurrence list." << endl << + ss << "parse_sinex_epochs(): Failed to add a new record to the site occurrence list." << std::endl << " " << sBuf << "."; - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } } @@ -835,7 +835,7 @@ void dna_io_snx::parse_sinex_epochs(std::ifstream** snx_file, UINT32& lineNo, UI void dna_io_snx::reduce_sinex_sites() { // sort the sites on station name - sort(siteOccurrence_.begin(), siteOccurrence_.end(), + std::sort(siteOccurrence_.begin(), siteOccurrence_.end(), CompareSiteTuplesByName()); // Identify if discontinuity exists from internal evidence (i.e. equal station names). If so, @@ -857,7 +857,7 @@ void dna_io_snx::reduce_sinex_sites() // if this station occurs again: // - increment the next occurrence of it // - set the index of the first occurrence - if (equals(it_site->site_name, it_site_next->site_name)) + if (boost::equals(it_site->site_name, it_site_next->site_name)) { // increment next occurrence. Note, if SOLUTION/EPOCHS block has been read, // this will have already been set @@ -874,7 +874,7 @@ void dna_io_snx::reduce_sinex_sites() } // sort on file index (default sort) - sort(siteOccurrence_.begin(), siteOccurrence_.end(), + std::sort(siteOccurrence_.begin(), siteOccurrence_.end(), CompareSiteTuples()); } @@ -882,18 +882,18 @@ void dna_io_snx::parse_sinex_stn(std::ifstream** snx_file, const char* sinexRec, StnTally& parsestn_tally, CDnaDatum& datum, UINT32& fileOrder, UINT32& lineNo, UINT32& columnNo) { - stringstream ss; + std::stringstream ss; if (applyDiscontinuities_ && !solutionEpochsRead_) { ss.str(""); - ss << "parse_sinex_stn(): Cannot apply discontinuities to the stations" << endl << - " if the station epochs have not been loaded beforehand. To rectify this problem," << endl << + ss << "parse_sinex_stn(): Cannot apply discontinuities to the stations" << std::endl << + " if the station epochs have not been loaded beforehand. To rectify this problem," << std::endl << " reformat the SINEX file so that the +SOLUTION/EPOCHS block appears before the +SOLUTION/ESTIMATE block."; - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } - string sBuf(sinexRec), site, tmp, stn; + std::string sBuf(sinexRec), site, tmp, stn; dnaStnPtr stn_ptr; UINT32 yy, doy, file_rec(0); @@ -940,25 +940,25 @@ void dna_io_snx::parse_sinex_stn(std::ifstream** snx_file, const char* sinexRec, yy = LongFromString(sBuf.substr(27, 2)), doy = LongFromString(sBuf.substr(30, 3)), - ss = parse_date_from_yy_doy(yy, doy, doy_yyyy, string(" ")); - stn_ptr->SetEpoch(stringFromDate(dateFromStringstream_doy_year(ss))); + ss = parse_date_from_yy_doy(yy, doy, doy_yyyy, std::string(" ")); + stn_ptr->SetEpoch(stringFromDate(dateFromStringstream_doy_year(ss))); stn_ptr->SetfileOrder(fileOrder++); stn_ptr->SetXAxis_d(DoubleFromString(trimstr(sBuf.substr(47, 21)))); stn_ptr->SetXAxisStdDev_d(DoubleFromString(trimstr(sBuf.substr(68, 12)))); } - catch (const runtime_error& f) { + catch (const std::runtime_error& f) { ss.str(""); ss << " - line " << lineNo; - ss << ", column " << columnNo << endl; + ss << ", column " << columnNo << std::endl; ss << " - " << f.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { ss.str(""); columnNo = 47; - ss << "parse_sinex_stn(): Could not extract X coordinate estimate from the record: " << endl << " " << sBuf << "."; - throw boost::enable_current_exception(runtime_error(ss.str())); + ss << "parse_sinex_stn(): Could not extract X coordinate estimate from the record: " << std::endl << " " << sBuf << "."; + throw boost::enable_current_exception(std::runtime_error(ss.str())); } continue; } @@ -972,23 +972,23 @@ void dna_io_snx::parse_sinex_stn(std::ifstream** snx_file, const char* sinexRec, catch (...) { ss.str(""); columnNo = 1; - ss << "parse_sinex_stn(): The number of sites in SOLUTION/EPOCHS and SOLUTION/ESTIMATE" << endl << - " is inconsistent: " << endl << - " " << "SOLUTION/EPOCHS block has " << siteOccurrence_.size() << " sites" << endl << - " " << "SOLUTION/ESTIMATE block contains additional sites not listed in SOLUTION/EPOCHS. Next record is:" << endl << + ss << "parse_sinex_stn(): The number of sites in SOLUTION/EPOCHS and SOLUTION/ESTIMATE" << std::endl << + " is inconsistent: " << std::endl << + " " << "SOLUTION/EPOCHS block has " << siteOccurrence_.size() << " sites" << std::endl << + " " << "SOLUTION/ESTIMATE block contains additional sites not listed in SOLUTION/EPOCHS. Next record is:" << std::endl << " " << sBuf << "."; - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } - if (!equals(site, stn)) + if (!boost::equals(site, stn)) { ss.str(""); columnNo = 1; - ss << "parse_sinex_stn(): The order of sites in SOLUTION/EPOCHS and SOLUTION/ESTIMATE" << endl << - " is inconsistent: " << endl << - " " << "Index " << file_rec << " in SOLUTION/EPOCHS block is " << siteOccurrence_.at(file_rec).site_name << endl << + ss << "parse_sinex_stn(): The order of sites in SOLUTION/EPOCHS and SOLUTION/ESTIMATE" << std::endl << + " is inconsistent: " << std::endl << + " " << "Index " << file_rec << " in SOLUTION/EPOCHS block is " << siteOccurrence_.at(file_rec).site_name << std::endl << " " << "Index " << file_rec << " in SOLUTION/ESTIMATE block is " << stn << "."; - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } // Capture the Y coordinate @@ -1001,8 +1001,8 @@ void dna_io_snx::parse_sinex_stn(std::ifstream** snx_file, const char* sinexRec, catch (...) { ss.str(""); columnNo = 47; - ss << "parse_sinex_stn(): Could not extract Y coordinate estimate from the record: " << endl << " " << sBuf << "."; - throw boost::enable_current_exception(runtime_error(ss.str())); + ss << "parse_sinex_stn(): Could not extract Y coordinate estimate from the record: " << std::endl << " " << sBuf << "."; + throw boost::enable_current_exception(std::runtime_error(ss.str())); } continue; } @@ -1017,8 +1017,8 @@ void dna_io_snx::parse_sinex_stn(std::ifstream** snx_file, const char* sinexRec, catch (...) { ss.str(""); columnNo = 47; - ss << "parse_sinex_stn(): Could not extract Z coordinate estimate from the record: " << endl << " " << sBuf << "."; - throw boost::enable_current_exception(runtime_error(ss.str())); + ss << "parse_sinex_stn(): Could not extract Z coordinate estimate from the record: " << std::endl << " " << sBuf << "."; + throw boost::enable_current_exception(std::runtime_error(ss.str())); } // Add this station to the vStations vector @@ -1054,18 +1054,18 @@ void dna_io_snx::parse_sinex_stn(std::ifstream** snx_file, const char* sinexRec, void dna_io_snx::parse_sinex_msr(std::ifstream** snx_file, const char* sinexRec, vdnaStnPtr* vStations, vdnaMsrPtr* vMeasurements, PUINT32 clusterID, PUINT32 msrCount, MsrTally& parsemsr_tally, CDnaDatum& datum, UINT32& lineNo) { - stringstream ss; + std::stringstream ss; if (applyDiscontinuities_ && !solutionEpochsRead_) { ss.str(""); - ss << "parse_sinex_msr(): Cannot apply discontinuities to the measurements" << endl << - " if the station epochs have not been loaded beforehand. To rectify this problem," << endl << + ss << "parse_sinex_msr(): Cannot apply discontinuities to the measurements" << std::endl << + " if the station epochs have not been loaded beforehand. To rectify this problem," << std::endl << " reformat the SINEX file so that the +SOLUTION/EPOCHS block appears before the +SOLUTION/ESTIMATE block."; - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } - string sBuf(sinexRec), tmp; + std::string sBuf(sinexRec), tmp; parsemsr_tally.Y = static_cast(vStations->size() * 3); (*msrCount) = static_cast(vStations->size() * 3); @@ -1113,7 +1113,7 @@ void dna_io_snx::parse_sinex_msr(std::ifstream** snx_file, const char* sinexRec, { ss.str(""); ss << "parse_sinex_msr: Failed to read covariance elements from the record " << cBuf << "."; - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } // if the number of covariance elements has reached the number of stations, break out. diff --git a/dynadjust/include/io/dnaiosnxwrite.cpp b/dynadjust/include/io/dnaiosnxwrite.cpp index 7d200e8b..9100473c 100644 --- a/dynadjust/include/io/dnaiosnxwrite.cpp +++ b/dynadjust/include/io/dnaiosnxwrite.cpp @@ -53,14 +53,14 @@ void dna_io_snx::serialise_sinex(std::ofstream* snx_file, pvstn_t bstRecords, serialise_solution_estimates(snx_file, bstRecords, estimates, variances, datum); serialise_solution_variances(snx_file, variances); - *snx_file << "%ENDSNX" << endl; + *snx_file << "%ENDSNX" << std::endl; } void dna_io_snx::print_line(std::ofstream* snx_file) { *snx_file << "*-------------------------------------------------------------------------------" << - endl; + std::endl; } @@ -74,7 +74,7 @@ void dna_io_snx::serialise_meta(std::ofstream* snx_file, "DNA "; // Agency creating this file // Creation time of this SINEX file - dateSINEXFormat(snx_file, gregorian::day_clock::local_day(), true); + dateSINEXFormat(snx_file, boost::gregorian::day_clock::local_day(), true); // the agency providing the data in the SINEX file *snx_file << " DNA "; @@ -85,14 +85,14 @@ void dna_io_snx::serialise_meta(std::ofstream* snx_file, dateSINEXFormat(snx_file, datum->GetEpoch()); // end = start *snx_file << " "; - stringstream numberofparams; - numberofparams << right << setw(5) << unknownParams_; - string numberofparamsstr(numberofparams.str()); - numberofparamsstr = findandreplace(numberofparamsstr, " ", "0"); + std::stringstream numberofparams; + numberofparams << std::right << std::setw(5) << unknownParams_; + std::string numberofparamsstr(numberofparams.str()); + numberofparamsstr = findandreplace(numberofparamsstr, " ", "0"); *snx_file << "P " << // Technique(s) used to generate the SINEX solution - left << setw(6) << + std::left << std::setw(6) << numberofparamsstr << // Number of parameters estimated in the SINEX file "0 " << // Single character indicating the constraint in the SINEX solution "S " << // Solution types contained in this SINEX file. @@ -103,16 +103,16 @@ void dna_io_snx::serialise_meta(std::ofstream* snx_file, // C � Celestial Reference Frame // A � Antenna parameters // BLANK - endl; + std::endl; // FILE/REFERENCE print_line(snx_file); - stringstream ss; + std::stringstream ss; // description: Organization(s) gathering/altering the file contents. - *snx_file << "+FILE/REFERENCE" << endl << - "*INFO_TYPE_________ INFO________________________________________________________" << endl << - " DESCRIPTION " << left << "Network " << p.g.network_name << endl; + *snx_file << "+FILE/REFERENCE" << std::endl << + "*INFO_TYPE_________ INFO________________________________________________________" << std::endl << + " DESCRIPTION " << std::left << "Network " << p.g.network_name << std::endl; // output: Description of the file contents. ss.str(""); @@ -120,16 +120,16 @@ void dna_io_snx::serialise_meta(std::ofstream* snx_file, ss << "Phased adjustment results. Block " << block_ + 1 << " of " << blockCount_; else ss << "Simultaneous adjustment results."; - *snx_file << " OUTPUT " << left << setw(60) << ss.str() << endl; + *snx_file << " OUTPUT " << std::left << std::setw(60) << ss.str() << std::endl; // contact: address of the relevant contact email - //*snx_file << " OUTPUT " << left << setw(60) << __COPYRIGHT_OWNER__ << endl; + //*snx_file << " OUTPUT " << std::left << std::setw(60) << __COPYRIGHT_OWNER__ << std::endl; // software/hardware *snx_file << snx_softwarehardware_text(); // input files. first, create a unique list of filenames - vector files; + std::vector files; for (UINT16 i(0); i 1) { *snx_file << " This file contains the rigorous estimates for block " << block_ + 1 << - " of a segmented" << endl << - " network comprised of " << blockCount_ << " blocks. Due to the way in which junction stations" << endl << - " are carried through successive blocks, stations appearing in this file" << endl << - " may also be found in other SINEX files relating to this network, such as" << endl << - " " << p.g.network_name << "-block1.snx, " << p.g.network_name << "-block2.snx, etc." << endl; + " of a segmented" << std::endl << + " network comprised of " << blockCount_ << " blocks. Due to the way in which junction stations" << std::endl << + " are carried through successive blocks, stations appearing in this file" << std::endl << + " may also be found in other SINEX files relating to this network, such as" << std::endl << + " " << p.g.network_name << "-block1.snx, " << p.g.network_name << "-block2.snx, etc." << std::endl; } *snx_file << - "-FILE/COMMENT" << endl; + "-FILE/COMMENT" << std::endl; } -void dna_io_snx::add_warning(const string& message, SINEX_WARN_TYPE warning) +void dna_io_snx::add_warning(const std::string& message, SINEX_WARN_TYPE warning) { - stringstream ss; + std::stringstream ss; switch (warning) { @@ -181,18 +181,18 @@ void dna_io_snx::add_warning(const string& message, SINEX_WARN_TYPE warning) } -void dna_io_snx::print_warnings(std::ofstream* warning_file, const string& fileName) +void dna_io_snx::print_warnings(std::ofstream* warning_file, const std::string& fileName) { // Print formatted header print_file_header(*warning_file, "DYNADJUST SINEX OUTPUT WARNINGS FILE"); - *warning_file << setw(PRINT_VAR_PAD) << left << "File name:" << system_complete(fileName).string() << endl; + *warning_file << std::setw(PRINT_VAR_PAD) << std::left << "File name:" << boost::filesystem::system_complete(fileName).string() << std::endl; - *warning_file << OUTPUTLINE << endl << endl; + *warning_file << OUTPUTLINE << std::endl << std::endl; for_each( warningMessages_.begin(), warningMessages_.end(), - [warning_file] (string warning) { - *warning_file << warning << endl; + [warning_file] (std::string warning) { + *warning_file << warning << std::endl; }); } @@ -202,11 +202,11 @@ void dna_io_snx::serialise_site_id(std::ofstream* snx_file, pvstn_t bstRecords) print_line(snx_file); - *snx_file << "+SITE/ID" << endl; - *snx_file << "*CODE PT __DOMES__ T _STATION DESCRIPTION__ APPROX_LON_ APPROX_LAT_ _APP_H_" << endl; + *snx_file << "+SITE/ID" << std::endl; + *snx_file << "*CODE PT __DOMES__ T _STATION DESCRIPTION__ APPROX_LON_ APPROX_LAT_ _APP_H_" << std::endl; const station_t* stn; - string stationName; + std::string stationName; for (UINT32 i(0); isize(); ++i) { @@ -217,17 +217,17 @@ void dna_io_snx::serialise_site_id(std::ofstream* snx_file, pvstn_t bstRecords) add_warning(stationName, excessive_name_chars); *snx_file << " " << - left << setw(4) << stationName.substr(0, 4) << " " << - right << setw(2) << "A" << " " << - left << setw(9) << stationName.substr(0, 9) << " " << - right << setw(1) << "P" << " " << - left << setw(22) << string(stn->description).substr(0, 22) << " " << - right << setw(11) << FormatDmsString(RadtoDms(stn->currentLongitude), 5, true, false) << " " << - right << setw(11) << FormatDmsString(RadtoDms(stn->currentLatitude), 5, true, false) << " " << - right << setw(7) << setprecision(1) << fixed << stn->currentHeight << endl; + std::left << std::setw(4) << stationName.substr(0, 4) << " " << + std::right << std::setw(2) << "A" << " " << + std::left << std::setw(9) << stationName.substr(0, 9) << " " << + std::right << std::setw(1) << "P" << " " << + std::left << std::setw(22) << std::string(stn->description).substr(0, 22) << " " << + std::right << std::setw(11) << FormatDmsString(RadtoDms(stn->currentLongitude), 5, true, false) << " " << + std::right << std::setw(11) << FormatDmsString(RadtoDms(stn->currentLatitude), 5, true, false) << " " << + std::right << std::setw(7) << std::setprecision(1) << std::fixed << stn->currentHeight << std::endl; } - *snx_file << "-SITE/ID" << endl; + *snx_file << "-SITE/ID" << std::endl; } @@ -235,23 +235,23 @@ void dna_io_snx::serialise_statistics(std::ofstream* snx_file) { print_line(snx_file); - *snx_file << "+SOLUTION/STATISTICS" << endl; - *snx_file << "*_STATISTICAL PARAMETER________ __VALUE(S)____________" << endl; + *snx_file << "+SOLUTION/STATISTICS" << std::endl; + *snx_file << "*_STATISTICAL PARAMETER________ __VALUE(S)____________" << std::endl; *snx_file << " " << - left << setw(30) << "NUMBER OF OBSERVATIONS" << " " << - right << setw(22) << measurementParams_ << endl; + std::left << std::setw(30) << "NUMBER OF OBSERVATIONS" << " " << + std::right << std::setw(22) << measurementParams_ << std::endl; *snx_file << " " << - left << setw(30) << "NUMBER OF UNKNOWNS" << " " << - right << setw(22) << unknownParams_ << endl; + std::left << std::setw(30) << "NUMBER OF UNKNOWNS" << " " << + std::right << std::setw(22) << unknownParams_ << std::endl; *snx_file << " " << - left << setw(30) << "NUMBER OF DEGREES OF FREEDOM" << " " << - right << setw(22) << (measurementParams_ - unknownParams_) << endl; + std::left << std::setw(30) << "NUMBER OF DEGREES OF FREEDOM" << " " << + std::right << std::setw(22) << (measurementParams_ - unknownParams_) << std::endl; *snx_file << " " << - left << setw(30) << "VARIANCE FACTOR" << " " << - right << setw(22) << fixed << setprecision(6) << sigmaZero_ << endl; + std::left << std::setw(30) << "VARIANCE FACTOR" << " " << + std::right << std::setw(22) << std::fixed << std::setprecision(6) << sigmaZero_ << std::endl; - *snx_file << "-SOLUTION/STATISTICS" << endl; + *snx_file << "-SOLUTION/STATISTICS" << std::endl; } @@ -260,12 +260,12 @@ void dna_io_snx::serialise_solution_estimates(std::ofstream* snx_file, pvstn_t b { print_line(snx_file); - *snx_file << "+SOLUTION/ESTIMATE" << endl; - *snx_file << "*INDEX TYPE__ CODE PT SOLN _REF_EPOCH__ UNIT S __ESTIMATED VALUE____ _STD_DEV___" << endl; + *snx_file << "+SOLUTION/ESTIMATE" << std::endl; + *snx_file << "*INDEX TYPE__ CODE PT SOLN _REF_EPOCH__ UNIT S __ESTIMATED VALUE____ _STD_DEV___" << std::endl; UINT32 i, j, index(1); - string floating_value; - stringstream ss; + std::string floating_value; + std::stringstream ss; // Print stations for (i=0; isize(); ++i) @@ -275,13 +275,13 @@ void dna_io_snx::serialise_solution_estimates(std::ofstream* snx_file, pvstn_t b // estimated parameter (X) *snx_file << " " << // parameter index - right << setw(5) << index++ << " " << + std::right << std::setw(5) << index++ << " " << // parameter type "STAX " << // 4 character site code - left << setw(4) << string(bstRecords->at(blockStations_->at(i)).stationName).substr(0, 4) << " " << + std::left << std::setw(4) << std::string(bstRecords->at(blockStations_->at(i)).stationName).substr(0, 4) << " " << // Point code - right << setw(2) << "A" << " " << + std::right << std::setw(2) << "A" << " " << // Solution id "0001 "; // epoch @@ -289,29 +289,29 @@ void dna_io_snx::serialise_solution_estimates(std::ofstream* snx_file, pvstn_t b *snx_file << " " << // Parameter units - left << setw(4) << "m" << " " << + std::left << std::setw(4) << "m" << " " << // Constraint code "0" << " "; // Parameter estimate ss.str(""); - ss << setiosflags(ios_base::uppercase | ios_base::scientific) << setprecision(14) << estimates->get(j, 0); - *snx_file << right << setw(21) << ss.str() << " "; + ss << std::setiosflags(std::ios_base::uppercase | std::ios_base::scientific) << std::setprecision(14) << estimates->get(j, 0); + *snx_file << std::right << std::setw(21) << ss.str() << " "; // standard deviation ss.str(""); - ss << setprecision(5) << sqrt(variances->get(j, j)); - *snx_file << right << setw(11) << ss.str() << endl; + ss << std::setprecision(5) << sqrt(variances->get(j, j)); + *snx_file << std::right << std::setw(11) << ss.str() << std::endl; // estimated parameter (Y) *snx_file << " " << // parameter index - right << setw(5) << index++ << " " << + std::right << std::setw(5) << index++ << " " << // parameter type "STAY " << // 4 character site code - left << setw(4) << string(bstRecords->at(blockStations_->at(i)).stationName).substr(0, 4) << " " << + std::left << std::setw(4) << std::string(bstRecords->at(blockStations_->at(i)).stationName).substr(0, 4) << " " << // Point code - right << setw(2) << "A" << " " << + std::right << std::setw(2) << "A" << " " << // Solution id "0001 "; // epoch @@ -319,29 +319,29 @@ void dna_io_snx::serialise_solution_estimates(std::ofstream* snx_file, pvstn_t b *snx_file << " " << // Parameter units - left << setw(4) << "m" << " " << + std::left << std::setw(4) << "m" << " " << // Constraint code "0" << " "; // Parameter estimate ss.str(""); - ss << setprecision(14) << estimates->get(j+1, 0); - *snx_file << right << setw(21) << ss.str() << " "; + ss << std::setprecision(14) << estimates->get(j+1, 0); + *snx_file << std::right << std::setw(21) << ss.str() << " "; // standard deviation ss.str(""); - ss << setprecision(5) << sqrt(variances->get(j+1, j+1)); - *snx_file << right << setw(11) << ss.str() << endl; + ss << std::setprecision(5) << sqrt(variances->get(j+1, j+1)); + *snx_file << std::right << std::setw(11) << ss.str() << std::endl; // estimated parameter (Z) *snx_file << " " << // parameter index - right << setw(5) << index++ << " " << + std::right << std::setw(5) << index++ << " " << // parameter type "STAZ " << // 4 character site code - left << setw(4) << string(bstRecords->at(blockStations_->at(i)).stationName).substr(0, 4) << " " << + std::left << std::setw(4) << std::string(bstRecords->at(blockStations_->at(i)).stationName).substr(0, 4) << " " << // Point code - right << setw(2) << "A" << " " << + std::right << std::setw(2) << "A" << " " << // Solution id "0001 "; // epoch @@ -349,42 +349,42 @@ void dna_io_snx::serialise_solution_estimates(std::ofstream* snx_file, pvstn_t b *snx_file << " " << // Parameter units - left << setw(4) << "m" << " " << + std::left << std::setw(4) << "m" << " " << // Constraint code "0" << " "; // Parameter estimate ss.str(""); - ss << setprecision(14) << estimates->get(j+2, 0); - *snx_file << right << setw(21) << ss.str() << " "; + ss << std::setprecision(14) << estimates->get(j+2, 0); + *snx_file << std::right << std::setw(21) << ss.str() << " "; // standard deviation ss.str(""); - ss << setprecision(5) << sqrt(variances->get(j+2, j+2)); - *snx_file << right << setw(11) << ss.str() << endl; + ss << std::setprecision(5) << sqrt(variances->get(j+2, j+2)); + *snx_file << std::right << std::setw(11) << ss.str() << std::endl; } - *snx_file << "-SOLUTION/ESTIMATE" << endl; + *snx_file << "-SOLUTION/ESTIMATE" << std::endl; } void dna_io_snx::print_matrix_index(std::ofstream* snx_file, const UINT32& row, const UINT32& col) { *snx_file << " " << - right << setw(5) << row + 1 << " " << - right << setw(5) << col + 1 << " "; + std::right << std::setw(5) << row + 1 << " " << + std::right << std::setw(5) << col + 1 << " "; } void dna_io_snx::serialise_solution_variances(std::ofstream* snx_file, matrix_2d* variances) { print_line(snx_file); - *snx_file << "+SOLUTION/MATRIX_ESTIMATE L COVA" << endl; - *snx_file << "*PARA1 PARA2 ____PARA2+0__________ ____PARA2+1__________ ____PARA2+2__________" << endl; + *snx_file << "+SOLUTION/MATRIX_ESTIMATE L COVA" << std::endl; + *snx_file << "*PARA1 PARA2 ____PARA2+0__________ ____PARA2+1__________ ____PARA2+2__________" << std::endl; UINT32 row, col, max_dimension(variances->rows()); - string floating_value; - stringstream ss; - ss << setiosflags(ios_base::uppercase | ios_base::scientific); + std::string floating_value; + std::stringstream ss; + ss << std::setiosflags(std::ios_base::uppercase | std::ios_base::scientific); bool newRecord(true); UINT16 field(1); @@ -403,19 +403,19 @@ void dna_io_snx::serialise_solution_variances(std::ofstream* snx_file, matrix_2d // variance ss.str(""); - ss << setprecision(14) << variances->get(row, col); - *snx_file << right << setw(21) << ss.str() << " "; + ss << std::setprecision(14) << variances->get(row, col); + *snx_file << std::right << std::setw(21) << ss.str() << " "; if (row == col || ++field > 3) { - *snx_file << endl; + *snx_file << std::endl; newRecord = true; field = 1; } } } - *snx_file << "-SOLUTION/MATRIX_ESTIMATE L COVA" << endl; + *snx_file << "-SOLUTION/MATRIX_ESTIMATE L COVA" << std::endl; } diff --git a/dynadjust/include/io/dnaiotbu.cpp b/dynadjust/include/io/dnaiotbu.cpp index c6431509..5835db0d 100644 --- a/dynadjust/include/io/dnaiotbu.cpp +++ b/dynadjust/include/io/dnaiotbu.cpp @@ -29,7 +29,7 @@ void dna_io_tbu::assign_typeb_values_global(const vstring& typeBUncertainties, t { double e(0.), n(0.), u(0.); UINT32 i(0); - stringstream ss; + std::stringstream ss; if (typeBUncertainties.size() > 2) { @@ -56,8 +56,8 @@ void dna_io_tbu::assign_typeb_values_global(const vstring& typeBUncertainties, t u = DoubleFromString(typeBUncertainties.at(i)); } else { - ss << " No Type b uncertainties provided." << endl; - throw boost::enable_current_exception(runtime_error(ss.str())); + ss << " No Type b uncertainties provided." << std::endl; + throw boost::enable_current_exception(std::runtime_error(ss.str())); } // assign @@ -83,36 +83,36 @@ void dna_io_tbu::assign_typeb_values_local(const vstring& typeBUncertainties, ty } -void dna_io_tbu::validate_typeb_values(const string& argument, vstring& typeBUncertainties) +void dna_io_tbu::validate_typeb_values(const std::string& argument, vstring& typeBUncertainties) { - stringstream ss; + std::stringstream ss; if (typeBUncertainties.size() == 0) { - ss << " No Type b uncertainties provided:" << endl << - " " << argument << endl; - throw boost::enable_current_exception(runtime_error(ss.str())); + ss << " No Type b uncertainties provided:" << std::endl << + " " << argument << std::endl; + throw boost::enable_current_exception(std::runtime_error(ss.str())); } UINT32 i(0), j; for (j = i; j < typeBUncertainties.size(); j++) { - if (!is_floatingpoint(typeBUncertainties.at(i))) + if (!is_floatingpoint(typeBUncertainties.at(i))) { ss << " Type b uncertainty '" << typeBUncertainties.at(i) << - "' is not a number:" << endl << - " " << argument << endl; - throw boost::enable_current_exception(runtime_error(ss.str())); + "' is not a number:" << std::endl << + " " << argument << std::endl; + throw boost::enable_current_exception(std::runtime_error(ss.str())); } i++; } } -void dna_io_tbu::read_tbu_header(std::ifstream* ptr, string& version, INPUT_DATA_TYPE& idt) +void dna_io_tbu::read_tbu_header(std::ifstream* ptr, std::string& version, INPUT_DATA_TYPE& idt) { - string sBuf; + std::string sBuf; getline((*ptr), sBuf); sBuf = trimstr(sBuf); @@ -121,52 +121,52 @@ void dna_io_tbu::read_tbu_header(std::ifstream* ptr, string& version, INPUT_DATA // Attempt to get the file's version try { - if (iequals("!#=DNA", sBuf.substr(0, 6))) + if (boost::iequals("!#=DNA", sBuf.substr(0, 6))) version = trimstr(sBuf.substr(6, 6)); } - catch (const runtime_error& e) { - throw boost::enable_current_exception(runtime_error(e.what())); + catch (const std::runtime_error& e) { + throw boost::enable_current_exception(std::runtime_error(e.what())); } - string type; - stringstream ssError; - ssError << " File type has not been provided in the header:" << endl << - " " << sBuf << endl; + std::string type; + std::stringstream ssError; + ssError << " File type has not been provided in the header:" << std::endl << + " " << sBuf << std::endl; if (sBuf.length() < 15) - throw boost::enable_current_exception(runtime_error(ssError.str())); + throw boost::enable_current_exception(std::runtime_error(ssError.str())); // Attempt to get the file's type try { type = trimstr(sBuf.substr(12, 3)); } - catch (const runtime_error& e) { - ssError << " " << e.what() << endl; - throw boost::enable_current_exception(runtime_error(ssError.str())); + catch (const std::runtime_error& e) { + ssError << " " << e.what() << std::endl; + throw boost::enable_current_exception(std::runtime_error(ssError.str())); } // Check this is a Type B file - if (iequals(type, "tbu")) + if (boost::iequals(type, "tbu")) idt = tbu_data; else { idt = unknown; - stringstream ssError; - ssError << " The supplied filetype '" << type << "' is not recognised:" << endl << - " " << sBuf << endl; - throw boost::enable_current_exception(runtime_error(ssError.str())); + std::stringstream ssError; + ssError << " The supplied filetype '" << type << "' is not recognised:" << std::endl << + " " << sBuf << std::endl; + throw boost::enable_current_exception(std::runtime_error(ssError.str())); } } -void dna_io_tbu::load_tbu_argument(const string& argument, type_b_uncertainty& type_b_uncertainties) +void dna_io_tbu::load_tbu_argument(const std::string& argument, type_b_uncertainty& type_b_uncertainties) { vstring typeBUncertainties; typeBUncertainties.resize(3); // Extract constraints from comma delimited string - SplitDelimitedString( + SplitDelimitedString( argument, // the comma delimited string - string(","), // the delimiter + std::string(","), // the delimiter &typeBUncertainties); // the respective values // validate values. Throws on exception @@ -178,18 +178,18 @@ void dna_io_tbu::load_tbu_argument(const string& argument, type_b_uncertainty& t } -void dna_io_tbu::identify_station_id(const string& stn_str, UINT32& stn_id, v_string_uint32_pair& vStnsMap) +void dna_io_tbu::identify_station_id(const std::string& stn_str, UINT32& stn_id, v_string_uint32_pair& vStnsMap) { it_pair_string_vUINT32 it_stnmap_range; - stringstream ss; + std::stringstream ss; // find this station in the station map it_stnmap_range = equal_range(vStnsMap.begin(), vStnsMap.end(), stn_str, StationNameIDCompareName()); if (it_stnmap_range.first == it_stnmap_range.second) { ss << " Station '" << stn_str << - "' is not included in the network." << endl; - throw boost::enable_current_exception(runtime_error(ss.str())); + "' is not included in the network." << std::endl; + throw boost::enable_current_exception(std::runtime_error(ss.str())); } stn_id = it_stnmap_range.first->second; @@ -197,7 +197,7 @@ void dna_io_tbu::identify_station_id(const string& stn_str, UINT32& stn_id, v_st } -void dna_io_tbu::load_tbu_file(const string& tbu_filename, v_type_b_uncertainty& type_b_uncertainties, v_string_uint32_pair& vStnsMap) +void dna_io_tbu::load_tbu_file(const std::string& tbu_filename, v_type_b_uncertainty& type_b_uncertainties, v_string_uint32_pair& vStnsMap) { // Type B uncertainty file structure is as follows. // Note - uncertainties are in metres, in the local reference frame (e,n,u) @@ -208,33 +208,33 @@ void dna_io_tbu::load_tbu_file(const string& tbu_filename, v_type_b_uncertainty& // EOF std::ifstream tbu_file; - stringstream ss; - ss << "load_tbu_file(): An error was encountered when opening " << tbu_filename << "." << endl; + std::stringstream ss; + ss << "load_tbu_file(): An error was encountered when opening " << tbu_filename << "." << std::endl; INPUT_DATA_TYPE idt; - string version; + std::string version; try { // open ascii plate boundaries file. Throws runtime_error on failure. - file_opener(tbu_file, tbu_filename, ios::in, ascii, true); + file_opener(tbu_file, tbu_filename, std::ios::in, ascii, true); // read header information read_tbu_header(&tbu_file, version, idt); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } ss.str(""); - ss << "load_tbu_file(): An error was encountered when reading from " << tbu_filename << "." << endl; + ss << "load_tbu_file(): An error was encountered when reading from " << tbu_filename << "." << std::endl; UINT32 stn_id; - string record, stn_str; + std::string record, stn_str; vstring typeb_values; const UINT16 STDDEVn(STATION + STDDEV); const UINT16 STDDEVu(STATION + STDDEV + STDDEV); @@ -269,7 +269,7 @@ void dna_io_tbu::load_tbu_file(const string& tbu_filename, v_type_b_uncertainty& try { identify_station_id(stn_str, stn_id, vStnsMap); } - catch (const runtime_error&) { + catch (const std::runtime_error&) { // Can't find the station, ignore. continue; } @@ -306,7 +306,7 @@ void dna_io_tbu::load_tbu_file(const string& tbu_filename, v_type_b_uncertainty& // to the next set of values validate_typeb_values(record, typeb_values); } - catch (const runtime_error&) { + catch (const std::runtime_error&) { continue; } @@ -321,18 +321,18 @@ void dna_io_tbu::load_tbu_file(const string& tbu_filename, v_type_b_uncertainty& tbu_file.close(); } - catch (const ios_base::failure& f) { + catch (const std::ios_base::failure& f) { if (tbu_file.eof()) { tbu_file.close(); return; } ss << f.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { if (tbu_file.eof()) @@ -340,7 +340,7 @@ void dna_io_tbu::load_tbu_file(const string& tbu_filename, v_type_b_uncertainty& tbu_file.close(); return; } - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } return; diff --git a/dynadjust/include/io/dnaiotbu.hpp b/dynadjust/include/io/dnaiotbu.hpp index 281f46a2..0222e6f2 100644 --- a/dynadjust/include/io/dnaiotbu.hpp +++ b/dynadjust/include/io/dnaiotbu.hpp @@ -38,9 +38,6 @@ #include #include -using namespace std; -using namespace boost; - using namespace dynadjust::math; namespace dynadjust { @@ -80,9 +77,9 @@ struct type_b_uncertainty_t // Create types for the type b uncertainties to be managed for sites typedef type_b_uncertainty_t type_b_uncertainty; -typedef vector v_type_b_uncertainty; +typedef std::vector v_type_b_uncertainty; typedef v_type_b_uncertainty::iterator it_type_b_uncertainty; -typedef pair it_pair_type_b_uncertainty; +typedef std::pair it_pair_type_b_uncertainty; template class CompareTypeBStationID @@ -134,7 +131,7 @@ struct type_b_method_t }; typedef type_b_method_t type_b_method; -typedef vector v_type_b_method; +typedef std::vector v_type_b_method; typedef v_type_b_method::iterator it_type_b_method; @@ -149,14 +146,14 @@ class dna_io_tbu : public dna_io_base dna_io_tbu& operator=(const dna_io_tbu& rhs); - void read_tbu_header(std::ifstream* ptr, string& version, INPUT_DATA_TYPE& idt); + void read_tbu_header(std::ifstream* ptr, std::string& version, INPUT_DATA_TYPE& idt); - void load_tbu_file(const string& tbu_filename, v_type_b_uncertainty& type_b_uncertainties, v_string_uint32_pair& vStnsMap); - void load_tbu_argument(const string& argument, type_b_uncertainty& type_b_uncertainties); + void load_tbu_file(const std::string& tbu_filename, v_type_b_uncertainty& type_b_uncertainties, v_string_uint32_pair& vStnsMap); + void load_tbu_argument(const std::string& argument, type_b_uncertainty& type_b_uncertainties); - void identify_station_id(const string& stn_str, UINT32& stn_id, v_string_uint32_pair& vStnsMap); + void identify_station_id(const std::string& stn_str, UINT32& stn_id, v_string_uint32_pair& vStnsMap); - void validate_typeb_values(const string& argument, vstring& typeBUncertainties); + void validate_typeb_values(const std::string& argument, vstring& typeBUncertainties); void assign_typeb_values_global(const vstring& typeBUncertainties, type_b_uncertainty& type_b); void assign_typeb_values_local(const vstring& typeBUncertainties, type_b_uncertainty& type_b); diff --git a/dynadjust/include/io/dnaiotpb.cpp b/dynadjust/include/io/dnaiotpb.cpp index 8c384cc5..6e9bddc3 100644 --- a/dynadjust/include/io/dnaiotpb.cpp +++ b/dynadjust/include/io/dnaiotpb.cpp @@ -27,7 +27,7 @@ namespace dynadjust { namespace iostreams { -void dna_io_tpb::load_tpb_file(const string& tpb_filename, v_string_v_doubledouble_pair& global_plates) +void dna_io_tpb::load_tpb_file(const std::string& tpb_filename, v_string_v_doubledouble_pair& global_plates) { // From the standard: // PB2002_plates.dig.For some applications it is necessary to @@ -62,26 +62,26 @@ void dna_io_tpb::load_tpb_file(const string& tpb_filename, v_string_v_doubledoub // *** end of line segment *** std::ifstream tpb_file; - stringstream ss; - ss << "load_tpb_file(): An error was encountered when opening " << tpb_filename << "." << endl; + std::stringstream ss; + ss << "load_tpb_file(): An error was encountered when opening " << tpb_filename << "." << std::endl; try { // open ascii plate boundaries file. Throws runtime_error on failure. - file_opener(tpb_file, tpb_filename, ios::in, ascii, true); + file_opener(tpb_file, tpb_filename, std::ios::in, ascii, true); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } ss.str(""); - ss << "load_tpb_file(): An error was encountered when reading from " << tpb_filename << "." << endl; + ss << "load_tpb_file(): An error was encountered when reading from " << tpb_filename << "." << std::endl; v_doubledouble_pair plate_nodes; - string plate_name, node_coordinates; + std::string plate_name, node_coordinates; vstring coordinates; try { @@ -99,7 +99,7 @@ void dna_io_tpb::load_tpb_file(const string& tpb_filename, v_string_v_doubledoub // Ignore lines with comments if ((plate_name.compare(0, 1, "*") == 0) && - !iequals(plate_name.substr(0, 7), "*** end")) + !boost::iequals(plate_name.substr(0, 7), "*** end")) continue; str_toupper(plate_name); @@ -107,12 +107,12 @@ void dna_io_tpb::load_tpb_file(const string& tpb_filename, v_string_v_doubledoub // get the next set of plate coordinates getline(tpb_file, node_coordinates); - while (!iequals(node_coordinates.substr(0, 7), "*** end")) + while (!boost::iequals(node_coordinates.substr(0, 7), "*** end")) { // Extract coordinates from comma delimited string - SplitDelimitedString( + SplitDelimitedString( node_coordinates, // the comma delimited string - string(","), // the delimiter + std::string(","), // the delimiter &coordinates); // the respective values plate_nodes.push_back(doubledouble_pair( @@ -131,18 +131,18 @@ void dna_io_tpb::load_tpb_file(const string& tpb_filename, v_string_v_doubledoub tpb_file.close(); } - catch (const ios_base::failure& f) { + catch (const std::ios_base::failure& f) { if (tpb_file.eof()) { tpb_file.close(); return; } ss << f.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { if (tpb_file.eof()) @@ -150,13 +150,13 @@ void dna_io_tpb::load_tpb_file(const string& tpb_filename, v_string_v_doubledoub tpb_file.close(); return; } - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } return; } -void dna_io_tpb::load_tpp_file(const string& tpp_filename, v_plate_motion_eulers& plate_pole_parameters) +void dna_io_tpb::load_tpp_file(const std::string& tpp_filename, v_plate_motion_eulers& plate_pole_parameters) { // Tectonic pole parameters file structure is as follows. // Note - coordinates are in degrees. @@ -165,26 +165,26 @@ void dna_io_tpb::load_tpp_file(const string& tpp_filename, v_plate_motion_eulers // std::ifstream tpp_file; - stringstream ss; - ss << "load_tpp_file(): An error was encountered when opening " << tpp_filename << "." << endl; + std::stringstream ss; + ss << "load_tpp_file(): An error was encountered when opening " << tpp_filename << "." << std::endl; try { // open ascii pole parameters file. Throws runtime_error on failure. - file_opener(tpp_file, tpp_filename, ios::in, ascii, true); + file_opener(tpp_file, tpp_filename, std::ios::in, ascii, true); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } ss.str(""); - ss << "load_tpp_file(): An error was encountered when reading from " << tpp_filename << "." << endl; + ss << "load_tpp_file(): An error was encountered when reading from " << tpp_filename << "." << std::endl; plate_motion_euler pmm; - string record; + std::string record; try { @@ -221,18 +221,18 @@ void dna_io_tpb::load_tpp_file(const string& tpp_filename, v_plate_motion_eulers tpp_file.close(); } - catch (const ios_base::failure& f) { + catch (const std::ios_base::failure& f) { if (tpp_file.eof()) { tpp_file.close(); return; } ss << f.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } - catch (const runtime_error& e) { + catch (const std::runtime_error& e) { ss << e.what(); - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } catch (...) { if (tpp_file.eof()) @@ -240,14 +240,14 @@ void dna_io_tpb::load_tpp_file(const string& tpp_filename, v_plate_motion_eulers tpp_file.close(); return; } - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } return; } bool dna_io_tpb::validate_plate_files(v_string_v_doubledouble_pair& global_plates, - v_plate_motion_eulers& plate_pole_parameters, string& message) + v_plate_motion_eulers& plate_pole_parameters, std::string& message) { if (plate_pole_parameters.size() != global_plates.size()) { diff --git a/dynadjust/include/io/dnaiotpb.hpp b/dynadjust/include/io/dnaiotpb.hpp index 3f7a91cf..eabcc4cc 100644 --- a/dynadjust/include/io/dnaiotpb.hpp +++ b/dynadjust/include/io/dnaiotpb.hpp @@ -37,7 +37,7 @@ namespace iostreams { ///////////////////////////////////////////////////////////// // Custom type to manage euler plate motion model parameters -template +template struct plate_motion_euler_t { T1 plate_name; @@ -75,15 +75,15 @@ struct plate_motion_euler_t }; -typedef plate_motion_euler_t plate_motion_euler; -typedef vector v_plate_motion_eulers; +typedef plate_motion_euler_t plate_motion_euler; +typedef std::vector v_plate_motion_eulers; typedef v_plate_motion_eulers::iterator it_plate_motion_euler; ///////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// // Custom type to manage cartesian plate motion model parameters -template +template struct plate_motion_cartesian_t { T1 plate_name; @@ -124,8 +124,8 @@ struct plate_motion_cartesian_t }; -typedef plate_motion_cartesian_t plate_motion_cartesian; -typedef vector v_plate_motion_cartesians; +typedef plate_motion_cartesian_t plate_motion_cartesian; +typedef std::vector v_plate_motion_cartesians; typedef v_plate_motion_cartesians::iterator it_plate_motion_cartesian; ///////////////////////////////////////////////////////////// @@ -139,11 +139,11 @@ class dna_io_tpb : public dna_io_base dna_io_tpb& operator=(const dna_io_tpb& rhs); - void load_tpb_file(const string& tpb_filename, v_string_v_doubledouble_pair& global_plates); - void load_tpp_file(const string& tpp_filename, v_plate_motion_eulers& plate_pole_parameters); + void load_tpb_file(const std::string& tpb_filename, v_string_v_doubledouble_pair& global_plates); + void load_tpp_file(const std::string& tpp_filename, v_plate_motion_eulers& plate_pole_parameters); bool validate_plate_files(v_string_v_doubledouble_pair& global_plates, - v_plate_motion_eulers& plate_pole_parameters, string& message); + v_plate_motion_eulers& plate_pole_parameters, std::string& message); protected: diff --git a/dynadjust/include/io/pdfdde.cpp b/dynadjust/include/io/pdfdde.cpp index 1cae365d..f8105430 100644 --- a/dynadjust/include/io/pdfdde.cpp +++ b/dynadjust/include/io/pdfdde.cpp @@ -21,13 +21,27 @@ PURPOSE ***************************************************************************/ -// #include +// prevent conflict with std::min(...) std::max(...) +#ifdef _WIN32 +#ifndef NOMINMAX +#define NOMINMAX +#endif +#endif + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif + +#ifndef VC_EXTRALEAN +#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#endif + + #define MAXPATHLEN 256 #include #include #include #include -#include #include #include diff --git a/dynadjust/include/math/dnamatrix_contiguous.cpp b/dynadjust/include/math/dnamatrix_contiguous.cpp index 8b6e64da..ab7645e7 100644 --- a/dynadjust/include/math/dnamatrix_contiguous.cpp +++ b/dynadjust/include/math/dnamatrix_contiguous.cpp @@ -32,20 +32,18 @@ //FLT_MAX; //#include -//cout << "Float max: " << numeric_limits::max() << endl; -//cout << "Float min: " << numeric_limits::min() << endl; -//cout << "Double max: " << numeric_limits::max() << endl; -//cout << "Double min: " << numeric_limits::min() << endl; -//cout << "UINT16 max: " << numeric_limits::min() << endl; -//cout << "UINT16 min: " << numeric_limits::min() << endl; -//cout << "UINT32 max: " << numeric_limits::min() << endl; -//cout << "UINT32 min: " << numeric_limits::min() << endl; - -using namespace std; +//cout << "Float max: " << numeric_limits::max() << std::endl; +//cout << "Float min: " << numeric_limits::min() << std::endl; +//cout << "Double max: " << numeric_limits::max() << std::endl; +//cout << "Double min: " << numeric_limits::min() << std::endl; +//cout << "UINT16 max: " << numeric_limits::min() << std::endl; +//cout << "UINT16 min: " << numeric_limits::min() << std::endl; +//cout << "UINT32 max: " << numeric_limits::min() << std::endl; +//cout << "UINT32 min: " << numeric_limits::min() << std::endl; namespace dynadjust { namespace math { -ostream& operator<< (ostream& os, const matrix_2d& rhs) +std::ostream& operator<< (std::ostream& os, const matrix_2d& rhs) { if (os.iword(0) == binary) { @@ -68,7 +66,7 @@ ostream& operator<< (ostream& os, const matrix_2d& rhs) case mtx_lower: // output lower triangular part of a square matrix if (rhs._mem_rows != rhs._mem_cols) - throw boost::enable_current_exception(runtime_error("matrix_2d operator<< (): Matrix is not square.")); + throw boost::enable_current_exception(std::runtime_error("matrix_2d operator<< (): Matrix is not square.")); // print each column for (c=0; c(rhs.size())); // if (os.iword(0) == binary) // os.write(reinterpret_cast(&vector_size), sizeof(UINT32)); // else -// os << vector_size << endl; +// os << vector_size << std::endl; // for (_it_v_mat_2d_const iter = rhs.begin(); iter != rhs.end(); ++iter) -// os << *iter; // calls ostream& operator<< (ostream& os, const matrix_2d& rhs) +// os << *iter; // calls ostream& operator<< (std::ostream& os, const matrix_2d& rhs) // return os; //} //// Output to stream vectors of matrix_2d -//ostream& operator<< (ostream& os, const v_mat_2d* rhs) +//ostream& operator<< (std::ostream& os, const v_mat_2d* rhs) //{ // os << *rhs; // return os; @@ -160,7 +158,7 @@ ostream& operator<< (ostream& os, const matrix_2d& rhs) // case mtx_lower: // // output lower triangular part of a square matrix // if (rhs._mem_rows != rhs._mem_cols) -// throw boost::enable_current_exception(runtime_error("matrix_2d operator>> (): Matrix is not square.")); +// throw boost::enable_current_exception(std::runtime_error("matrix_2d operator>> (): Matrix is not square.")); // // // retrieve each column // for (c=0; c> has not been tested")); +// //throw boost::enable_current_exception(std::runtime_error("istream& operator>> has not been tested")); // -// string str; +// std::string str; // UINT32 type; // is >> type; // rhs._matrixType = static_cast(type); @@ -243,13 +241,13 @@ UINT32 __col__; void out_of_memory_handler() { - stringstream ss(""); - UINT32 mem(max(__row__, __col__)); - mem *= min(__row__, __col__) * sizeof(UINT32); + std::stringstream ss(""); + UINT32 mem(std::max(__row__, __col__)); + mem *= std::min(__row__, __col__) * sizeof(UINT32); ss << "Insufficient memory available to create a " << __row__ << " x " << __col__ << " matrix (" << - fixed << setprecision(2); + std::fixed << std::setprecision(2); if (mem < MEGABYTE_SIZE) ss << (mem/KILOBYTE_SIZE) << " KB)."; @@ -271,14 +269,14 @@ matrix_2d::matrix_2d() , _maxvalRow(0) , _matrixType(mtx_full) { - ::set_new_handler(out_of_memory_handler); + std::set_new_handler(out_of_memory_handler); // if this class were to be modified to use templates, each // instance could be tested for an invalid data type as follows // //if (strcmp(typeid(a(1,1)).name(), "double") != 0 && // strcmp(typeid(a(1,1)).name(), "float") != 0 ) { - // throw boost::enable_current_exception(runtime_error("Not a floating point type")); + // throw boost::enable_current_exception(std::runtime_error("Not a floating point type")); } matrix_2d::matrix_2d(const UINT32& rows, const UINT32& columns) @@ -291,7 +289,7 @@ matrix_2d::matrix_2d(const UINT32& rows, const UINT32& columns) , _maxvalRow(0) , _matrixType(mtx_full) { - ::set_new_handler(out_of_memory_handler); + std::set_new_handler(out_of_memory_handler); allocate(_rows, _cols); } @@ -307,9 +305,9 @@ matrix_2d::matrix_2d(const UINT32& rows, const UINT32& columns, , _maxvalRow(0) , _matrixType(matrix_type) { - ::set_new_handler(out_of_memory_handler); + std::set_new_handler(out_of_memory_handler); - stringstream ss; + std::stringstream ss; UINT32 upperMatrixElements(sumOfConsecutiveIntegers(rows)); UINT32 j; @@ -322,7 +320,7 @@ matrix_2d::matrix_2d(const UINT32& rows, const UINT32& columns, if (upperMatrixElements != data_size) { ss << "Data size must be equivalent to upper matrix element count for " << rows << " x " << columns << "."; - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } // Create memory and store the data @@ -339,7 +337,7 @@ matrix_2d::matrix_2d(const UINT32& rows, const UINT32& columns, case mtx_sparse: ss << "matrix_2d(): A sparse matrix cannot be initialised with a double array."; - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); break; case mtx_full: @@ -348,7 +346,7 @@ matrix_2d::matrix_2d(const UINT32& rows, const UINT32& columns, if (data_size != rows * columns) { ss << "Data size must be equivalent to matrix dimensions (" << rows << " x " << columns << ")."; - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } // Create memory and store the data @@ -371,7 +369,7 @@ matrix_2d::matrix_2d(const matrix_2d& newmat) , _maxvalRow(newmat.maxvalueRow()) , _matrixType(newmat.matrixType()) { - ::set_new_handler(out_of_memory_handler); + std::set_new_handler(out_of_memory_handler); allocate(_mem_rows, _mem_cols); @@ -636,7 +634,7 @@ void matrix_2d::buy(const UINT32& rows, const UINT32& columns, double** mem_spac if ((*mem_space) == NULL) { - stringstream ss; + std::stringstream ss; ss << "Insufficient memory for a " << rows << " x " << columns << " matrix."; throw boost::enable_current_exception(NetMemoryException(ss.str())); } @@ -669,39 +667,39 @@ void matrix_2d::submatrix(const UINT32& row_begin, const UINT32& col_begin, matrix_2d* dest, const UINT32& subrows, const UINT32& subcolumns) const { if (row_begin >= _rows) { - stringstream ss; + std::stringstream ss; ss << row_begin << ", " << col_begin << " lies outside the range of the matrix (" << _rows << ", " << _cols << ")."; - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } if (col_begin >= _cols) { - stringstream ss; + std::stringstream ss; ss << row_begin << ", " << col_begin << " lies outside the range of the matrix (" << _rows << ", " << _cols << ")."; - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } if (subrows > dest->rows()) { - stringstream ss; + std::stringstream ss; ss << subrows << ", " << subcolumns << " exceeds the size of the matrix (" << dest->rows() << ", " << dest->columns() << ")."; - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } if (subcolumns > dest->columns()) { - stringstream ss; + std::stringstream ss; ss << subrows << ", " << subcolumns << " exceeds the size of the matrix (" << dest->rows() << ", " << dest->columns() << ")."; - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } if (row_begin + subrows > _rows) { - stringstream ss; + std::stringstream ss; ss << row_begin + subrows << ", " << col_begin + subcolumns << " lies outside the range of the matrix (" << _rows << ", " << _cols << ")."; - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } if (col_begin + subcolumns > _cols) { - stringstream ss; + std::stringstream ss; ss << row_begin + subrows << ", " << col_begin + subcolumns << " lies outside the range of the matrix (" << _rows << ", " << _cols << ")."; - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } UINT32 i, j, m(0), n(0), row_end(row_begin+subrows), col_end(col_begin+subcolumns); @@ -736,7 +734,7 @@ void matrix_2d::redim(const UINT32& rows, const UINT32& columns) //deallocate(); //_buffer = new_buffer; - ::set_new_handler(out_of_memory_handler); + std::set_new_handler(out_of_memory_handler); deallocate(); allocate(rows, columns); @@ -750,13 +748,13 @@ void matrix_2d::shrink(const UINT32& rows, const UINT32& columns) { if (rows > _rows || columns > _cols) { - stringstream ss; - ss << " " << endl; + std::stringstream ss; + ss << " " << std::endl; if (rows >= _rows) - ss << " Cannot shrink by " << rows << " rows on a matrix of " << _rows << " rows. " << endl; + ss << " Cannot shrink by " << rows << " rows on a matrix of " << _rows << " rows. " << std::endl; if (columns >= _cols) ss << " Cannot shrink by " << columns << " columns on a matrix of " << _cols << " columns."; - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } _rows -= rows; @@ -768,13 +766,13 @@ void matrix_2d::grow(const UINT32& rows, const UINT32& columns) { if ((rows+_rows) > _mem_rows || (columns+_cols) > _mem_cols) { - stringstream ss; - ss << " " << endl; + std::stringstream ss; + ss << " " << std::endl; if (rows >= _rows) ss << " Cannot grow matrix by " << rows << " rows: growth exceeds row memory limit (" << _mem_rows << ")."; if (columns >= _cols) ss << " Cannot grow matrix by " << columns << " columns: growth exceeds column memory limit (" << _mem_cols << ")."; - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } _rows += rows; @@ -866,13 +864,13 @@ void matrix_2d::copybuffer(const UINT32& rowstart, const UINT32& columnstart, co UINT32 rowend(rowstart+rows), columnend(columnstart+columns); if (rowend > _rows || columnend > _cols) { - stringstream ss; - ss << " " << endl; + std::stringstream ss; + ss << " " << std::endl; if (rowend >= _rows) - ss << " Row index " << rowend << " exceeds the matrix row count (" << _rows << "). " << endl; + ss << " Row index " << rowend << " exceeds the matrix row count (" << _rows << "). " << std::endl; if (columnend >= _cols) ss << " Column index " << columnend << " exceeds the matrix column count (" << _cols << ")."; - throw boost::enable_current_exception(runtime_error(ss.str())); + throw boost::enable_current_exception(std::runtime_error(ss.str())); } #if defined(DNAMATRIX_ROW_WISE) @@ -938,17 +936,17 @@ void matrix_2d::copyelements(const UINT32& row_dest, const UINT32& column_dest, // UINT32 rowend_src(row_src+rows), columnend_src(column_src+columns); // if (rowend_src > _rows || columnend_src > _cols || rowend_dest > _rows || columnend_dest > _cols) // { -// stringstream ss; -// ss << "copyelements(): " << endl; +// std::stringstream ss; +// ss << "copyelements(): " << std::endl; // if (rowend_src >= _rows) -// ss << " Row index (source) " << rowend_src << " exceeds the matrix row count (" << _rows << "). " << endl; +// ss << " Row index (source) " << rowend_src << " exceeds the matrix row count (" << _rows << "). " << std::endl; // if (columnend_src >= _cols) // ss << " Column index (source) " << columnend_src << " exceeds the matrix column count (" << _cols << ")."; // if (rowend_dest >= _rows) -// ss << " Row index (destination) " << rowend_dest << " exceeds the matrix row count (" << _rows << "). " << endl; +// ss << " Row index (destination) " << rowend_dest << " exceeds the matrix row count (" << _rows << "). " << std::endl; // if (columnend_dest >= _cols) // ss << " Column index (destination) " << columnend_dest << " exceeds the matrix column count (" << _cols << ")."; -// throw boost::enable_current_exception(runtime_error(ss.str())); +// throw boost::enable_current_exception(std::runtime_error(ss.str())); // } // // UINT32 m, n; @@ -967,24 +965,24 @@ void matrix_2d::copyelements(const UINT32& row_dest, const UINT32& column_dest, // UINT32 rowend_src(row_src+rows), columnend_src(column_src+columns); // if (rowend_src > src.rows() || columnend_src > src.columns()) // { -// stringstream ss; -// ss << "copyelements(): " << endl; +// std::stringstream ss; +// ss << "copyelements(): " << std::endl; // if (rowend_src >= src.rows()) -// ss << " Row index (source) " << rowend_src << " exceeds the matrix row count (" << src.rows() << "). " << endl; +// ss << " Row index (source) " << rowend_src << " exceeds the matrix row count (" << src.rows() << "). " << std::endl; // if (columnend_src >= src.columns()) // ss << " Column index (source) " << columnend_src << " exceeds the matrix column count (" << src.columns() << ")."; -// throw boost::enable_current_exception(runtime_error(ss.str())); +// throw boost::enable_current_exception(std::runtime_error(ss.str())); // } // // if (rowend_dest > _rows || columnend_dest > _cols) // { -// stringstream ss; -// ss << "copyelements(): " << endl; +// std::stringstream ss; +// ss << "copyelements(): " << std::endl; // if (rowend_dest >= _rows) -// ss << " Row index (destination) " << rowend_dest << " exceeds the matrix row count (" << _rows << "). " << endl; +// ss << " Row index (destination) " << rowend_dest << " exceeds the matrix row count (" << _rows << "). " << std::endl; // if (columnend_dest >= _cols) // ss << " Column index (destination) " << columnend_dest << " exceeds the matrix column count (" << _cols << ")."; -// throw boost::enable_current_exception(runtime_error(ss.str())); +// throw boost::enable_current_exception(std::runtime_error(ss.str())); // } // // UINT32 m, n; @@ -1001,13 +999,13 @@ void matrix_2d::copyelements(const UINT32& row_dest, const UINT32& column_dest, //{ // if (row >= _rows || column >= _cols) // { -// stringstream ss; -// ss << " " << endl; +// std::stringstream ss; +// ss << " " << std::endl; // if (row >= _rows) -// ss << " Row index " << row << " exceeds the matrix row count (" << _rows << "). " << endl; +// ss << " Row index " << row << " exceeds the matrix row count (" << _rows << "). " << std::endl; // if (column >= _cols) // ss << " Column index " << column << " exceeds the matrix column count (" << _cols << ")."; -// throw boost::enable_current_exception(runtime_error(ss.str())); +// throw boost::enable_current_exception(std::runtime_error(ss.str())); // } // // return get(row, column); @@ -1016,13 +1014,13 @@ void matrix_2d::copyelements(const UINT32& row_dest, const UINT32& column_dest, //void matrix_2d::put(const double data[], const UINT32& data_size) //{ -// ::set_new_handler(out_of_memory_handler); +// std::set_new_handler(out_of_memory_handler); // // if (data_size != _rows * _cols) // { -// stringstream ss; +// std::stringstream ss; // ss << "Data size must be equivalent to matrix dimensions (" << _rows << " x " << _cols << ")."; -// throw boost::enable_current_exception(runtime_error(ss.str())); +// throw boost::enable_current_exception(std::runtime_error(ss.str())); // } // // UINT32 i, j, k(0); @@ -1036,13 +1034,13 @@ void matrix_2d::copyelements(const UINT32& row_dest, const UINT32& column_dest, //{ // if (row >= _rows || column >= _cols) // { -// stringstream ss; -// ss << " " << endl; +// std::stringstream ss; +// ss << " " << std::endl; // if (row >= _rows) -// ss << " Row index " << row << " exceeds the matrix row count (" << _rows << "). " << endl; +// ss << " Row index " << row << " exceeds the matrix row count (" << _rows << "). " << std::endl; // if (column >= _cols) // ss << " Column index " << column << " exceeds the matrix column count (" << _cols << ")."; -// throw boost::enable_current_exception(runtime_error(ss.str())); +// throw boost::enable_current_exception(std::runtime_error(ss.str())); // } // // put(row, column, value); @@ -1052,9 +1050,9 @@ void matrix_2d::copyelements(const UINT32& row_dest, const UINT32& column_dest, //void matrix_2d::elementadd_safe(const UINT32& row, const UINT32& column, const double& increment) //{ // if (row >= _rows || column >= _cols) { -// stringstream ss; +// std::stringstream ss; // ss << row << ", " << column << " lies outside the range of the matrix (" << _rows << ", " << _cols << ")."; -// throw boost::enable_current_exception(runtime_error(ss.str())); +// throw boost::enable_current_exception(std::runtime_error(ss.str())); // } // elementadd(row, column, increment); //} @@ -1063,28 +1061,28 @@ void matrix_2d::copyelements(const UINT32& row_dest, const UINT32& column_dest, // const UINT32& row_src, const UINT32& col_src, const UINT32& rows, const UINT32& cols) //{ // if (row_dest >= _rows || col_dest >= _cols) { -// stringstream ss; +// std::stringstream ss; // ss << row_dest << ", " << col_dest << " lies outside the range of the destination matrix (" << // _rows << ", " << _cols << ")."; -// throw boost::enable_current_exception(runtime_error(ss.str())); +// throw boost::enable_current_exception(std::runtime_error(ss.str())); // } // if (row_dest+rows > _rows || col_dest+cols > _cols) { -// stringstream ss; +// std::stringstream ss; // ss << "Adding a " << rows << ", " << cols << " matrix extends beyond the range of the destination matrix (" << // _rows << ", " << _cols << ")."; -// throw boost::enable_current_exception(runtime_error(ss.str())); +// throw boost::enable_current_exception(std::runtime_error(ss.str())); // } // if (row_src >= mat_src.rows() || col_src >= mat_src.columns()) { -// stringstream ss; +// std::stringstream ss; // ss << mat_src.rows() << ", " << mat_src.columns() << " lies outside the range of the source matrix (" << // mat_src.rows() << ", " << mat_src.columns() << ")."; -// throw boost::enable_current_exception(runtime_error(ss.str())); +// throw boost::enable_current_exception(std::runtime_error(ss.str())); // } // if (row_src+rows > mat_src.rows() || col_src+cols > mat_src.columns()) { -// stringstream ss; +// std::stringstream ss; // ss << "Adding a " << rows << ", " << cols << " matrix extends beyond the range of the destination matrix (" << // mat_src.rows() << ", " << mat_src.columns() << ")."; -// throw boost::enable_current_exception(runtime_error(ss.str())); +// throw boost::enable_current_exception(std::runtime_error(ss.str())); // } // // blockadd(row_dest, col_dest, mat_src, row_src, col_src, rows, cols); @@ -1094,30 +1092,30 @@ void matrix_2d::copyelements(const UINT32& row_dest, const UINT32& column_dest, // const UINT32& row_src, const UINT32& col_src, const UINT32& rows, const UINT32& cols) //{ // if (rows != cols) -// throw boost::enable_current_exception(runtime_error("The source matrix is not square.")); +// throw boost::enable_current_exception(std::runtime_error("The source matrix is not square.")); // if (row_dest >= _rows || col_dest >= _cols) { -// stringstream ss; +// std::stringstream ss; // ss << row_dest << ", " << col_dest << " lies outside the range of the destination matrix (" << // _rows << ", " << _cols << ")."; -// throw boost::enable_current_exception(runtime_error(ss.str())); +// throw boost::enable_current_exception(std::runtime_error(ss.str())); // } // if (row_dest+rows > _rows || col_dest+cols > _cols) { -// stringstream ss; +// std::stringstream ss; // ss << "Adding a " << rows << ", " << cols << " matrix extends beyond the range of the destination matrix (" << // _rows << ", " << _cols << ")."; -// throw boost::enable_current_exception(runtime_error(ss.str())); +// throw boost::enable_current_exception(std::runtime_error(ss.str())); // } // if (row_src >= mat_src.rows() || col_src >= mat_src.columns()) { -// stringstream ss; +// std::stringstream ss; // ss << mat_src.rows() << ", " << mat_src.columns() << " lies outside the range of the source matrix (" << // mat_src.rows() << ", " << mat_src.columns() << ")."; -// throw boost::enable_current_exception(runtime_error(ss.str())); +// throw boost::enable_current_exception(std::runtime_error(ss.str())); // } // if (row_src+rows > mat_src.rows() || col_src+cols > mat_src.columns()) { -// stringstream ss; +// std::stringstream ss; // ss << "Adding a " << rows << ", " << cols << " matrix extends beyond the range of the destination matrix (" << // mat_src.rows() << ", " << mat_src.columns() << ")."; -// throw boost::enable_current_exception(runtime_error(ss.str())); +// throw boost::enable_current_exception(std::runtime_error(ss.str())); // } // // blockTadd(row_dest, col_dest, mat_src, row_src, col_src, rows, cols); @@ -1129,15 +1127,15 @@ void matrix_2d::copyelements(const UINT32& row_dest, const UINT32& column_dest, //{ // // comparison of unsigned expression < 0 is always false // if (row_begin >= _rows) { -// stringstream ss; +// std::stringstream ss; // ss << row_begin << ", " << col_begin << " lies outside the range of the matrix (" << _rows << ", " << _cols << ")."; -// throw boost::enable_current_exception(runtime_error(ss.str())); +// throw boost::enable_current_exception(std::runtime_error(ss.str())); // } // // comparison of unsigned expression < 0 is always false // if (col_begin >= _cols) { -// stringstream ss; +// std::stringstream ss; // ss << row_begin << ", " << col_begin << " lies outside the range of the matrix (" << _rows << ", " << _cols << ")."; -// throw boost::enable_current_exception(runtime_error(ss.str())); +// throw boost::enable_current_exception(std::runtime_error(ss.str())); // } // if (rows < 1) // rows = _rows - row_begin; // apply scale from row_begin to end @@ -1145,14 +1143,14 @@ void matrix_2d::copyelements(const UINT32& row_dest, const UINT32& column_dest, // columns = _cols - col_begin; // apply scale from col_begin to end // // if (row_begin + rows > _rows || rows < 0) { -// stringstream ss; +// std::stringstream ss; // ss << row_begin + rows << ", " << col_begin + rows << " lies outside the range of the matrix (" << _rows << ", " << _cols << ")."; -// throw boost::enable_current_exception(runtime_error(ss.str())); +// throw boost::enable_current_exception(std::runtime_error(ss.str())); // } // if (col_begin + columns > _cols || columns < 0) { -// stringstream ss; +// std::stringstream ss; // ss << row_begin + rows << ", " << col_begin + rows << " lies outside the range of the matrix (" << _rows << ", " << _cols << ")."; -// throw boost::enable_current_exception(runtime_error(ss.str())); +// throw boost::enable_current_exception(std::runtime_error(ss.str())); // } // // UINT32 i, j, row_end(row_begin+rows), col_end(col_begin+columns); @@ -1231,7 +1229,7 @@ void matrix_2d::sweep(UINT32 k1, UINT32 k2) matrix_2d matrix_2d::sweepinverse() { if (_rows != _cols) - throw boost::enable_current_exception(runtime_error("sweepinverse(): Matrix is not square.")); + throw boost::enable_current_exception(std::runtime_error("sweepinverse(): Matrix is not square.")); sweep(0, _rows); return *this; @@ -1250,7 +1248,7 @@ matrix_2d matrix_2d::sweepinverse() //matrix_2d matrix_2d::gaussianinverse() //{ // if (_rows != _cols) -// throw boost::enable_current_exception(runtime_error("gaussinverse(): Matrix is not square.")); +// throw boost::enable_current_exception(std::runtime_error("gaussinverse(): Matrix is not square.")); // // // create copy of upper triangular // matrix_2d matcopy(*this); @@ -1268,7 +1266,7 @@ matrix_2d matrix_2d::sweepinverse() // for (nCol = nRow+1; nCol=0; nRow--) // { // if (fabs(matcopy.get(nRow, nRow)) < epsilon) -// throw boost::enable_current_exception(runtime_error("gaussinverse(): Matrix inversion failed.")); +// throw boost::enable_current_exception(std::runtime_error("gaussinverse(): Matrix inversion failed.")); // // for (nCol = 0; nCol _rows || columnend > _cols) // { -// stringstream ss; -// ss << "identity(): " << endl; +// std::stringstream ss; +// ss << "identity(): " << std::endl; // if (rowend >= _rows) -// ss << " Row index (destination) " << rowend << " exceeds the matrix row count (" << _rows << "). " << endl; +// ss << " Row index (destination) " << rowend << " exceeds the matrix row count (" << _rows << "). " << std::endl; // if (columnend >= _cols) // ss << " Column index (destination) " << columnend << " exceeds the matrix column count (" << _cols << ")."; -// throw boost::enable_current_exception(runtime_error(ss.str())); +// throw boost::enable_current_exception(std::runtime_error(ss.str())); // } // // UINT32 row, column; @@ -1655,29 +1653,29 @@ void matrix_2d::zero(const UINT32& row_begin, const UINT32& col_begin, //// coutMatrix() //// -//void matrix_2d::coutmatrix(const string& sTitle, const short& precision) const +//void matrix_2d::coutmatrix(const std::string& sTitle, const short& precision) const //{ -// cout << sTitle << " (" << _rows << "x" << _cols << ")" << endl; +// std::cout << sTitle << " (" << _rows << "x" << _cols << ")" << std::endl; // UINT32 column, row; -// stringstream ss; +// std::stringstream ss; // for (row=0; row<_rows; row++) { // for (column=0; column<_cols; column++) { // ss.str(""); -// ss << fixed << setprecision(precision) << get(row, column) << " "; +// ss << std::fixed << std::setprecision(precision) << get(row, column) << " "; // if (precision < 1) -// cout << setw(3) << ss.str(); +// std::cout << std::setw(3) << ss.str(); // else -// cout << setw(precision + 4) << right << ss.str(); +// std::cout << std::setw(precision + 4) << std::right << ss.str(); // // if (column > 20) // break; // } -// cout << endl; +// std::cout << std::endl; // if (row > 20) // break; // // } -// cout << endl; +// std::cout << std::endl; // //} // coutMatrix() @@ -1738,7 +1736,7 @@ matrix_2d matrix_2d::operator*(const double& rhs) const //matrix_2d matrix_2d::operator*(const matrix_2d& rhs) const //{ // if (_cols != rhs.rows()) -// throw boost::enable_current_exception(runtime_error("operator*(): Matrix dimensions are incompatible.")); +// throw boost::enable_current_exception(std::runtime_error("operator*(): Matrix dimensions are incompatible.")); // // matrix_2d m(_rows, rhs.columns()); // @@ -1760,7 +1758,7 @@ matrix_2d matrix_2d::operator*(const double& rhs) const //matrix_2d matrix_2d::operator+(const matrix_2d& rhs) const //{ // if (_cols != rhs.rows()) -// throw boost::enable_current_exception(runtime_error("operator+(): Matrix dimensions are incompatible.")); +// throw boost::enable_current_exception(std::runtime_error("operator+(): Matrix dimensions are incompatible.")); // // matrix_2d m(_rows, rhs.columns()); // @@ -1780,7 +1778,7 @@ matrix_2d matrix_2d::operator*(const double& rhs) const //matrix_2d matrix_2d::operator-(const matrix_2d& rhs) const //{ // if (_cols != rhs.rows()) -// throw boost::enable_current_exception(runtime_error("operator-(): Matrix dimensions are incompatible.")); +// throw boost::enable_current_exception(std::runtime_error("operator-(): Matrix dimensions are incompatible.")); // // matrix_2d m(_rows, rhs.columns()); // @@ -1801,7 +1799,7 @@ matrix_2d matrix_2d::operator*(const double& rhs) const //matrix_2d matrix_2d::operator*=(const matrix_2d& rhs) //{ // if (_cols != rhs.rows()) -// throw boost::enable_current_exception(runtime_error("operator*=(): Matrix dimensions are incompatible.")); +// throw boost::enable_current_exception(std::runtime_error("operator*=(): Matrix dimensions are incompatible.")); // // matrix_2d m(_rows, rhs.columns()); // @@ -1822,7 +1820,7 @@ matrix_2d matrix_2d::operator*(const double& rhs) const //matrix_2d matrix_2d::operator+=(const matrix_2d& rhs) //{ // if (_cols != rhs.columns() || _rows != rhs.rows()) -// throw boost::enable_current_exception(runtime_error("operator+=(): Matrix dimensions are incompatible.")); +// throw boost::enable_current_exception(std::runtime_error("operator+=(): Matrix dimensions are incompatible.")); // // // Perform the addition // UINT32 row, column; @@ -1837,7 +1835,7 @@ matrix_2d matrix_2d::operator*(const double& rhs) const //matrix_2d matrix_2d::operator-=(const matrix_2d& rhs) //{ // if (_cols != rhs.columns() || _rows != rhs.rows()) -// throw boost::enable_current_exception(runtime_error("operator-=(): Matrix dimensions are incompatible.")); +// throw boost::enable_current_exception(std::runtime_error("operator-=(): Matrix dimensions are incompatible.")); // // // Perform the addition // UINT32 row, column; @@ -1850,7 +1848,7 @@ matrix_2d matrix_2d::operator*(const double& rhs) const matrix_2d matrix_2d::add(const matrix_2d& rhs) { if (_rows != rhs.rows() || _cols != rhs.columns()) - throw boost::enable_current_exception(runtime_error("add(): Result matrix dimensions are incompatible.")); + throw boost::enable_current_exception(std::runtime_error("add(): Result matrix dimensions are incompatible.")); UINT32 row, column; for (row=0; row<_rows; row++) { @@ -1865,10 +1863,10 @@ matrix_2d matrix_2d::add(const matrix_2d& rhs) //matrix_2d matrix_2d::add(const matrix_2d& lhs, const matrix_2d& rhs) //{ // if (_rows != lhs.rows() || _cols != lhs.columns()) -// throw boost::enable_current_exception(runtime_error("add(): Result matrix dimensions are incompatible.")); +// throw boost::enable_current_exception(std::runtime_error("add(): Result matrix dimensions are incompatible.")); // // if (_rows != rhs.rows() || _cols != rhs.columns()) -// throw boost::enable_current_exception(runtime_error("add(): Result matrix dimensions are incompatible.")); +// throw boost::enable_current_exception(std::runtime_error("add(): Result matrix dimensions are incompatible.")); // // UINT32 row, column; // for (row=0; row<_rows; row++) { @@ -1884,7 +1882,7 @@ matrix_2d matrix_2d::add(const matrix_2d& rhs) //matrix_2d matrix_2d::multiply(const matrix_2d& rhs) //{ // if (_cols != rhs.rows()) -// throw boost::enable_current_exception(runtime_error("multiply(): Matrix dimensions are incompatible.")); +// throw boost::enable_current_exception(std::runtime_error("multiply(): Matrix dimensions are incompatible.")); // // matrix_2d m(_rows, rhs.columns()); // @@ -1937,9 +1935,9 @@ matrix_2d matrix_2d::multiply_mkl(const char* lhs_trans, const matrix_2d& rhs, c } if (lhs_cols != rhs_rows) - throw boost::enable_current_exception(runtime_error("multiply_mkl(): Matrix dimensions are incompatible.")); + throw boost::enable_current_exception(std::runtime_error("multiply_mkl(): Matrix dimensions are incompatible.")); else if (_rows != lhs_rows || _cols != rhs_cols) - throw boost::enable_current_exception(runtime_error("multiply_mkl(): Result matrix dimensions are incompatible.")); + throw boost::enable_current_exception(std::runtime_error("multiply_mkl(): Result matrix dimensions are incompatible.")); dgemm(lhs_trans, rhs_trans, // Type of matrices &lhs_rows, // rows of A @@ -1961,9 +1959,9 @@ matrix_2d matrix_2d::multiply_mkl(const char* lhs_trans, const matrix_2d& rhs, c //matrix_2d matrix_2d::multiply(const matrix_2d& lhs, const matrix_2d& rhs) //{ // if (lhs.columns() != rhs.rows()) -// throw boost::enable_current_exception(runtime_error("multiply(): Matrix dimensions are incompatible.")); +// throw boost::enable_current_exception(std::runtime_error("multiply(): Matrix dimensions are incompatible.")); // else if (_rows != lhs.rows() || _cols != rhs.columns()) -// throw boost::enable_current_exception(runtime_error("multiply(): Result matrix dimensions are incompatible.")); +// throw boost::enable_current_exception(std::runtime_error("multiply(): Result matrix dimensions are incompatible.")); // // // Perform the multiplication // UINT32 row, column, i; @@ -2014,9 +2012,9 @@ matrix_2d matrix_2d::multiply_mkl(const matrix_2d& lhs, const char* lhs_trans, } if (lhs_cols != rhs_rows) - throw boost::enable_current_exception(runtime_error("multiply_mkl(): Matrix dimensions are incompatible.")); + throw boost::enable_current_exception(std::runtime_error("multiply_mkl(): Matrix dimensions are incompatible.")); else if (_rows != lhs_rows || _cols != rhs_cols) - throw boost::enable_current_exception(runtime_error("multiply_mkl(): Result matrix dimensions are incompatible.")); + throw boost::enable_current_exception(std::runtime_error("multiply_mkl(): Result matrix dimensions are incompatible.")); dgemm(lhs_trans, rhs_trans, // Type of matrices &lhs_rows, // rows of A @@ -2041,11 +2039,11 @@ matrix_2d matrix_2d::multiply_mkl(const matrix_2d& lhs, const char* lhs_trans, //matrix_2d matrix_2d::multiply_square(const matrix_2d& lhs, const matrix_2d& rhs) //{ // //if (lhs.columns() != rhs.rows()) -// // throw boost::enable_current_exception(runtime_error("multiply_square(): Matrix dimensions are incompatible.")); +// // throw boost::enable_current_exception(std::runtime_error("multiply_square(): Matrix dimensions are incompatible.")); // //else if (_rows != lhs.rows() || _cols != rhs.columns()) -// // throw boost::enable_current_exception(runtime_error("multiply_square(): Result matrix dimensions are incompatible.")); +// // throw boost::enable_current_exception(std::runtime_error("multiply_square(): Result matrix dimensions are incompatible.")); // //else if (_rows != _cols) -// // throw boost::enable_current_exception(runtime_error("multiply_square(): Result matrix must be square.")); +// // throw boost::enable_current_exception(std::runtime_error("multiply_square(): Result matrix must be square.")); // // // //// Perform the multiplication: // //UINT32 row, column, i; @@ -2070,11 +2068,11 @@ matrix_2d matrix_2d::multiply_mkl(const matrix_2d& lhs, const char* lhs_trans, //matrix_2d matrix_2d::multiply_square_triangular(const matrix_2d& lhs, const matrix_2d& rhs) //{ // if (lhs.columns() != rhs.rows()) -// throw boost::enable_current_exception(runtime_error("multiply_square_triangular(): Matrix dimensions are incompatible.")); +// throw boost::enable_current_exception(std::runtime_error("multiply_square_triangular(): Matrix dimensions are incompatible.")); // else if (_rows != lhs.rows() || _cols != rhs.columns()) -// throw boost::enable_current_exception(runtime_error("multiply_square_triangular(): Result matrix dimensions are incompatible.")); +// throw boost::enable_current_exception(std::runtime_error("multiply_square_triangular(): Result matrix dimensions are incompatible.")); // else if (_rows != _cols) -// throw boost::enable_current_exception(runtime_error("multiply_square_triangular(): Result matrix must be square.")); +// throw boost::enable_current_exception(std::runtime_error("multiply_square_triangular(): Result matrix must be square.")); // // // Perform the multiplication: // UINT32 row, column, i; @@ -2097,11 +2095,11 @@ matrix_2d matrix_2d::multiply_mkl(const matrix_2d& lhs, const char* lhs_trans, //matrix_2d matrix_2d::multiply_square_t(const matrix_2d& lhs, const matrix_2d& rhs) //{ // if (lhs.columns() != rhs.rows()) -// throw boost::enable_current_exception(runtime_error("multiply_square_t(): Matrix dimensions are incompatible.")); +// throw boost::enable_current_exception(std::runtime_error("multiply_square_t(): Matrix dimensions are incompatible.")); // else if (_rows != lhs.rows() || _cols != rhs.columns()) -// throw boost::enable_current_exception(runtime_error("multiply_square_t(): Result matrix dimensions are incompatible.")); +// throw boost::enable_current_exception(std::runtime_error("multiply_square_t(): Result matrix dimensions are incompatible.")); // else if (_rows != _cols) -// throw boost::enable_current_exception(runtime_error("multiply_square_t(): Result matrix must be square.")); +// throw boost::enable_current_exception(std::runtime_error("multiply_square_t(): Result matrix must be square.")); // // // Perform the multiplication: // UINT32 row, column, i; @@ -2121,7 +2119,7 @@ matrix_2d matrix_2d::multiply_mkl(const matrix_2d& lhs, const char* lhs_trans, matrix_2d matrix_2d::transpose(const matrix_2d& matA) { if ((matA.columns() != _rows) || (matA.rows() != _cols)) - throw boost::enable_current_exception(runtime_error("transpose(): Matrix dimensions are incompatible.")); + throw boost::enable_current_exception(std::runtime_error("transpose(): Matrix dimensions are incompatible.")); UINT32 column, row; for (row=0; row<_rows; row++) @@ -2163,7 +2161,7 @@ double matrix_2d::compute_maximum_value() //double matrix_2d::vectordifference(const matrix_2d& rhs) //{ // if (_rows != rhs.rows() && _cols != rhs.columns()) -// throw boost::enable_current_exception(runtime_error("vectordifference(): Matrix dimensions are incompatible.")); +// throw boost::enable_current_exception(std::runtime_error("vectordifference(): Matrix dimensions are incompatible.")); // // double diffPrev(0.), diff(0.); // for (UINT32 row=0; row<_rows; ++row) @@ -2178,10 +2176,10 @@ double matrix_2d::compute_maximum_value() //void matrix_2d::difference(const matrix_2d* lhs, const matrix_2d* rhs) //{ // if (_rows != rhs->rows() && _cols != rhs->columns()) -// throw boost::enable_current_exception(runtime_error("difference(): Matrix dimensions are incompatible.")); +// throw boost::enable_current_exception(std::runtime_error("difference(): Matrix dimensions are incompatible.")); // // if (_rows != lhs->rows() && _cols != lhs->columns()) -// throw boost::enable_current_exception(runtime_error("difference(): Matrix dimensions are incompatible.")); +// throw boost::enable_current_exception(std::runtime_error("difference(): Matrix dimensions are incompatible.")); // // UINT32 i, j; // for (i=0; i<_rows; ++i) @@ -2193,7 +2191,7 @@ double matrix_2d::compute_maximum_value() //void matrix_2d::difference(const UINT32& row_begin, const UINT32& col_begin, const matrix_2d& lhs, const matrix_2d& rhs) //{ // if (lhs.rows() != rhs.rows() && lhs.columns() != rhs.columns()) -// throw boost::enable_current_exception(runtime_error("differenceabs(): Matrix dimensions are incompatible.")); +// throw boost::enable_current_exception(std::runtime_error("differenceabs(): Matrix dimensions are incompatible.")); // if (row_begin >= _rows) // return; // if (col_begin >= _cols) @@ -2214,10 +2212,10 @@ double matrix_2d::compute_maximum_value() //void matrix_2d::differenceabs(const matrix_2d& lhs, const matrix_2d& rhs) //{ // if (_rows != rhs.rows() && _cols != rhs.columns()) -// throw boost::enable_current_exception(runtime_error("differenceabs(): Matrix dimensions are incompatible.")); +// throw boost::enable_current_exception(std::runtime_error("differenceabs(): Matrix dimensions are incompatible.")); // // if (_rows != lhs.rows() && _cols != lhs.columns()) -// throw boost::enable_current_exception(runtime_error("differenceabs(): Matrix dimensions are incompatible.")); +// throw boost::enable_current_exception(std::runtime_error("differenceabs(): Matrix dimensions are incompatible.")); // // UINT32 i, j; // for (i=0; i<_rows; ++i) @@ -2228,10 +2226,10 @@ double matrix_2d::compute_maximum_value() //void matrix_2d::differenceabs(const matrix_2d& lhs, const matrix_2d* rhs) //{ // if (_rows != rhs->rows() && _cols != rhs->columns()) -// throw boost::enable_current_exception(runtime_error("differenceabs(): Matrix dimensions are incompatible.")); +// throw boost::enable_current_exception(std::runtime_error("differenceabs(): Matrix dimensions are incompatible.")); // // if (_rows != lhs.rows() && _cols != lhs.columns()) -// throw boost::enable_current_exception(runtime_error("differenceabs(): Matrix dimensions are incompatible.")); +// throw boost::enable_current_exception(std::runtime_error("differenceabs(): Matrix dimensions are incompatible.")); // // UINT32 i, j; // for (i=0; i<_rows; ++i) @@ -2240,7 +2238,7 @@ double matrix_2d::compute_maximum_value() //} #ifdef _MSDEBUG -void matrix_2d::trace(const string& comment, const string& format) const +void matrix_2d::trace(const std::string& comment, const std::string& format) const { UINT32 i, j; if (comment.empty()) @@ -2256,7 +2254,7 @@ void matrix_2d::trace(const string& comment, const string& format) const #endif #ifdef _MSDEBUG -void matrix_2d::trace(const string& comment, const string& submat_comment, const string& format, +void matrix_2d::trace(const std::string& comment, const std::string& submat_comment, const std::string& format, const UINT32& row_begin, const UINT32& col_begin, const UINT32& rows, const UINT32& columns) const { // comparison of unsigned expression < 0 is always false diff --git a/dynadjust/include/math/dnamatrix_contiguous.hpp b/dynadjust/include/math/dnamatrix_contiguous.hpp index e84a587f..cd7a3e9b 100644 --- a/dynadjust/include/math/dnamatrix_contiguous.hpp +++ b/dynadjust/include/math/dnamatrix_contiguous.hpp @@ -26,6 +26,13 @@ #ifndef DNAMATRIX_CONTIGUOUS_H_ #define DNAMATRIX_CONTIGUOUS_H_ +// prevent conflict with std::min(...) std::max(...) +#ifdef _WIN32 +#ifndef NOMINMAX +#define NOMINMAX +#endif +#endif + #if defined(_MSC_VER) #if defined(LIST_INCLUDES_ON_BUILD) #pragma message(" " __FILE__) @@ -59,18 +66,16 @@ #include #include // memset -using namespace std; -using namespace boost; using namespace dynadjust::memory; using namespace dynadjust::exception; namespace dynadjust { namespace math { class matrix_2d; -typedef vector v_mat_2d, *pv_mat_2d; +typedef std::vector v_mat_2d, *pv_mat_2d; typedef v_mat_2d::iterator _it_v_mat_2d; typedef v_mat_2d::const_iterator _it_v_mat_2d_const; -typedef vector vv_mat_2d; +typedef std::vector vv_mat_2d; // Uncomment the following to store matrices in row-wise fashion //#define DNAMATRIX_ROW_WISE @@ -305,11 +310,11 @@ class matrix_2d: public new_handler_support double compute_maximum_value(); // Printing - //void coutmatrix(const string& sTitle, const short& precision) const; - friend ostream& operator<< (ostream& os, const matrix_2d& rhs); - //friend ostream& operator<< (ostream& os, const matrix_2d* rhs); - //friend ostream& operator<< (ostream& os, const v_mat_2d& rhs); - //friend ostream& operator<< (ostream& os, const v_mat_2d* rhs); + //void coutmatrix(const std::string& sTitle, const short& precision) const; + friend std::ostream& operator<< (std::ostream& os, const matrix_2d& rhs); + //friend ostream& operator<< (std::ostream& os, const matrix_2d* rhs); + //friend ostream& operator<< (std::ostream& os, const v_mat_2d& rhs); + //friend ostream& operator<< (std::ostream& os, const v_mat_2d* rhs); //// Reading //friend istream& operator>> (istream& is, matrix_2d& rhs); @@ -325,8 +330,8 @@ class matrix_2d: public new_handler_support // debug #ifdef _MSDEBUG - void trace(const string& comment, const string& format) const; - void trace(const string& comment, const string& submat_comment, const string& format, + void trace(const std::string& comment, const std::string& format) const; + void trace(const std::string& comment, const std::string& submat_comment, const std::string& format, const UINT32& row_begin, const UINT32& col_begin, const UINT32& rows, const UINT32& columns) const; #endif diff --git a/dynadjust/include/measurement_types/dnaangle.cpp b/dynadjust/include/measurement_types/dnaangle.cpp index 390990c6..064b4d08 100644 --- a/dynadjust/include/measurement_types/dnaangle.cpp +++ b/dynadjust/include/measurement_types/dnaangle.cpp @@ -79,65 +79,65 @@ bool CDnaAngle::operator< (const CDnaAngle& rhs) const } -void CDnaAngle::WriteDynaMLMsr(std::ofstream* dynaml_stream, const string& comment, bool) const +void CDnaAngle::WriteDynaMLMsr(std::ofstream* dynaml_stream, const std::string& comment, bool) const { if (comment.empty()) - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; else - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; - *dynaml_stream << " " << endl; - *dynaml_stream << " " << m_strType << "" << endl; + *dynaml_stream << " " << std::endl; + *dynaml_stream << " " << m_strType << "" << std::endl; // Source file from which the measurement came - *dynaml_stream << " " << m_sourceFile << "" << endl; + *dynaml_stream << " " << m_sourceFile << "" << std::endl; if (m_bIgnore) - *dynaml_stream << " *" << endl; + *dynaml_stream << " *" << std::endl; else - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; if (m_epoch.empty()) - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; else - *dynaml_stream << " " << m_epoch << "" << endl; + *dynaml_stream << " " << m_epoch << "" << std::endl; - *dynaml_stream << " " << m_strFirst << "" << endl; - *dynaml_stream << " " << m_strTarget << "" << endl; - *dynaml_stream << " " << m_strTarget2 << "" << endl; - *dynaml_stream << " " << setprecision(8) << fixed << RadtoDms(m_drValue) << "" << endl; - *dynaml_stream << " " << scientific << setprecision(6) << Seconds(m_dStdDev) << "" << endl; + *dynaml_stream << " " << m_strFirst << "" << std::endl; + *dynaml_stream << " " << m_strTarget << "" << std::endl; + *dynaml_stream << " " << m_strTarget2 << "" << std::endl; + *dynaml_stream << " " << std::setprecision(8) << std::fixed << RadtoDms(m_drValue) << "" << std::endl; + *dynaml_stream << " " << std::scientific << std::setprecision(6) << Seconds(m_dStdDev) << "" << std::endl; if (m_msr_db_map.is_msr_id_set) - *dynaml_stream << " " << m_msr_db_map.msr_id << "" << endl; + *dynaml_stream << " " << m_msr_db_map.msr_id << "" << std::endl; - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; } void CDnaAngle::WriteDNAMsr(std::ofstream* dna_stream, const dna_msr_fields& dmw, const dna_msr_fields& dml, bool) const { - *dna_stream << setw(dmw.msr_type) << m_strType; + *dna_stream << std::setw(dmw.msr_type) << m_strType; if (m_bIgnore) - *dna_stream << setw(dmw.msr_ignore) << "*"; + *dna_stream << std::setw(dmw.msr_ignore) << "*"; else - *dna_stream << setw(dmw.msr_ignore) << " "; - *dna_stream << left << setw(dmw.msr_inst) << m_strFirst; - *dna_stream << left << setw(dmw.msr_targ1) << m_strTarget; - *dna_stream << left << setw(dmw.msr_targ2) << m_strTarget2; - *dna_stream << setw(dmw.msr_linear) << " "; // linear measurement value - *dna_stream << setw(dmw.msr_ang_d + dmw.msr_ang_m + dmw.msr_ang_s) << - right << FormatDnaDmsString(RadtoDms(m_drValue), 8); + *dna_stream << std::setw(dmw.msr_ignore) << " "; + *dna_stream << std::left << std::setw(dmw.msr_inst) << m_strFirst; + *dna_stream << std::left << std::setw(dmw.msr_targ1) << m_strTarget; + *dna_stream << std::left << std::setw(dmw.msr_targ2) << m_strTarget2; + *dna_stream << std::setw(dmw.msr_linear) << " "; // linear measurement value + *dna_stream << std::setw(dmw.msr_ang_d + dmw.msr_ang_m + dmw.msr_ang_s) << + std::right << FormatDnaDmsString(RadtoDms(m_drValue), 8); UINT32 m_stdDevPrec(3); - *dna_stream << setw(dmw.msr_stddev) << StringFromTW(Seconds(m_dStdDev), dmw.msr_stddev, m_stdDevPrec); - //*dna_stream << setw(dmw.msr_stddev) << fixed << setprecision(3) << Seconds(m_dStdDev); + *dna_stream << std::setw(dmw.msr_stddev) << StringFromTW(Seconds(m_dStdDev), dmw.msr_stddev, m_stdDevPrec); + //*dna_stream << std::setw(dmw.msr_stddev) << std::fixed << std::setprecision(3) << Seconds(m_dStdDev); - *dna_stream << setw(dml.msr_gps_epoch - dml.msr_inst_ht) << " "; - *dna_stream << setw(dmw.msr_gps_epoch) << m_epoch; + *dna_stream << std::setw(dml.msr_gps_epoch - dml.msr_inst_ht) << " "; + *dna_stream << std::setw(dmw.msr_gps_epoch) << m_epoch; if (m_msr_db_map.is_msr_id_set) - *dna_stream << setw(dmw.msr_id_msr) << m_msr_db_map.msr_id; + *dna_stream << std::setw(dmw.msr_id_msr) << m_msr_db_map.msr_id; - *dna_stream << endl; + *dna_stream << std::endl; } @@ -280,13 +280,13 @@ void CDnaAngle::WriteBinaryMsr(std::ofstream* binary_stream, PUINT32 msrIndex) c binary_stream->write(reinterpret_cast(&measRecord), sizeof(measurement_t)); } -void CDnaAngle::SetValue(const string& str) +void CDnaAngle::SetValue(const std::string& str) { // convert to radians RadFromDmsString(&m_drValue, trimstr(str)); } -void CDnaAngle::SetStdDev(const string& str) +void CDnaAngle::SetStdDev(const std::string& str) { // convert seconds to radians RadFromSecondsString(&m_dStdDev, trimstr(str)); diff --git a/dynadjust/include/measurement_types/dnaangle.hpp b/dynadjust/include/measurement_types/dnaangle.hpp index d13d4c52..d6901f93 100644 --- a/dynadjust/include/measurement_types/dnaangle.hpp +++ b/dynadjust/include/measurement_types/dnaangle.hpp @@ -32,8 +32,6 @@ #include #include -using namespace std; - namespace dynadjust { namespace measurements { @@ -49,34 +47,34 @@ class CDnaAngle : public CDnaMeasurement //CDnaAngle& operator=(const CDnaAngle& rhs); public: - //CDnaAngle(const bool strIgnore, const string& strFirst, const string& strTarget, const string& strTarget2, const double& drValue, const double& dStdDev); + //CDnaAngle(const bool strIgnore, const std::string& strFirst, const std::string& strTarget, const std::string& strTarget2, const double& drValue, const double& dStdDev); bool operator==(const CDnaAngle& rhs) const; bool operator<(const CDnaAngle& rhs) const; //inline CDnaAngle& operator[](int iIndex) { return this[iIndex]; } - inline string GetTarget() const { return m_strTarget; } - inline string GetTarget2() const { return m_strTarget2; } + inline std::string GetTarget() const { return m_strTarget; } + inline std::string GetTarget2() const { return m_strTarget2; } inline double GetValue() const { return m_drValue; } inline double GetStdDev() const { return m_dStdDev; } - inline void SetTarget(const string& str) { m_strTarget = trimstr(str); } - inline void SetTarget2(const string& str) { m_strTarget2 = trimstr(str); } + inline void SetTarget(const std::string& str) { m_strTarget = trimstr(str); } + inline void SetTarget2(const std::string& str) { m_strTarget2 = trimstr(str); } - void SetValue(const string& str); - void SetStdDev(const string& str); + void SetValue(const std::string& str); + void SetStdDev(const std::string& str); inline virtual UINT32 CalcBinaryRecordCount() const { return 1; } virtual void WriteBinaryMsr(std::ofstream* binary_stream, PUINT32 msrIndex) const; virtual UINT32 SetMeasurementRec(const vstn_t& binaryStn, it_vmsr_t& it_msr, it_vdbid_t& dbidmap); - virtual void WriteDynaMLMsr(std::ofstream* dynaml_stream, const string& comment, bool) const; + virtual void WriteDynaMLMsr(std::ofstream* dynaml_stream, const std::string& comment, bool) const; virtual void WriteDNAMsr(std::ofstream* dna_stream, const dna_msr_fields& dmw, const dna_msr_fields& dml, bool) const; virtual void SimulateMsr(vdnaStnPtr* vStations, const CDnaEllipsoid* ellipsoid); protected: - string m_strTarget; - string m_strTarget2; + std::string m_strTarget; + std::string m_strTarget2; double m_drValue; double m_dStdDev; }; diff --git a/dynadjust/include/measurement_types/dnacoordinate.cpp b/dynadjust/include/measurement_types/dnacoordinate.cpp index b8262bfe..f0b71c82 100644 --- a/dynadjust/include/measurement_types/dnacoordinate.cpp +++ b/dynadjust/include/measurement_types/dnacoordinate.cpp @@ -72,30 +72,30 @@ bool CDnaCoordinate::operator< (const CDnaCoordinate& rhs) const } -void CDnaCoordinate::WriteDynaMLMsr(std::ofstream* dynaml_stream, const string& comment, bool) const +void CDnaCoordinate::WriteDynaMLMsr(std::ofstream* dynaml_stream, const std::string& comment, bool) const { if (comment.empty()) - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; else - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; - *dynaml_stream << " " << endl; - *dynaml_stream << " " << m_strType << "" << endl; + *dynaml_stream << " " << std::endl; + *dynaml_stream << " " << m_strType << "" << std::endl; // Source file from which the measurement came - *dynaml_stream << " " << m_sourceFile << "" << endl; + *dynaml_stream << " " << m_sourceFile << "" << std::endl; if (m_bIgnore) - *dynaml_stream << " *" << endl; + *dynaml_stream << " *" << std::endl; else - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; if (m_epoch.empty()) - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; else - *dynaml_stream << " " << m_epoch << "" << endl; + *dynaml_stream << " " << m_epoch << "" << std::endl; - *dynaml_stream << " " << m_strFirst << "" << endl; + *dynaml_stream << " " << m_strFirst << "" << std::endl; - *dynaml_stream << " " << fixed << setprecision(10); + *dynaml_stream << " " << std::fixed << std::setprecision(10); switch (GetTypeC()) { case 'P': @@ -108,41 +108,41 @@ void CDnaCoordinate::WriteDynaMLMsr(std::ofstream* dynaml_stream, const string& break; } - *dynaml_stream << "" << endl; + *dynaml_stream << "" << std::endl; - *dynaml_stream << " " << scientific << setprecision(6) << Seconds(m_dStdDev) << "" << endl; + *dynaml_stream << " " << std::scientific << std::setprecision(6) << Seconds(m_dStdDev) << "" << std::endl; if (m_msr_db_map.is_msr_id_set) - *dynaml_stream << " " << m_msr_db_map.msr_id << "" << endl; + *dynaml_stream << " " << m_msr_db_map.msr_id << "" << std::endl; - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; } void CDnaCoordinate::WriteDNAMsr(std::ofstream* dna_stream, const dna_msr_fields& dmw, const dna_msr_fields& dml, bool) const { - *dna_stream << setw(dmw.msr_type) << m_strType; + *dna_stream << std::setw(dmw.msr_type) << m_strType; if (m_bIgnore) - *dna_stream << setw(dmw.msr_ignore) << "*"; + *dna_stream << std::setw(dmw.msr_ignore) << "*"; else - *dna_stream << setw(dmw.msr_ignore) << " "; - *dna_stream << left << setw(dmw.msr_inst) << m_strFirst; - *dna_stream << setw(dmw.msr_targ1) << " "; // first target - *dna_stream << setw(dmw.msr_targ2) << " "; // second target - *dna_stream << right << setw(dmw.msr_linear) << fixed << setprecision(9) << RadtoDms(m_drValue); // linear measurement value - *dna_stream << setw(dmw.msr_ang_d + dmw.msr_ang_m + dmw.msr_ang_s) << " "; + *dna_stream << std::setw(dmw.msr_ignore) << " "; + *dna_stream << std::left << std::setw(dmw.msr_inst) << m_strFirst; + *dna_stream << std::setw(dmw.msr_targ1) << " "; // first target + *dna_stream << std::setw(dmw.msr_targ2) << " "; // second target + *dna_stream << std::right << std::setw(dmw.msr_linear) << std::fixed << std::setprecision(9) << RadtoDms(m_drValue); // linear measurement value + *dna_stream << std::setw(dmw.msr_ang_d + dmw.msr_ang_m + dmw.msr_ang_s) << " "; UINT32 m_stdDevPrec(6); - *dna_stream << setw(dmw.msr_stddev) << StringFromTW(Seconds(m_dStdDev), dmw.msr_stddev, m_stdDevPrec); - //*dna_stream << setw(dmw.msr_stddev) << fixed << setprecision(6) << Seconds(m_dStdDev); + *dna_stream << std::setw(dmw.msr_stddev) << StringFromTW(Seconds(m_dStdDev), dmw.msr_stddev, m_stdDevPrec); + //*dna_stream << std::setw(dmw.msr_stddev) << std::fixed << std::setprecision(6) << Seconds(m_dStdDev); - *dna_stream << setw(dml.msr_gps_epoch - dml.msr_inst_ht) << " "; - *dna_stream << setw(dmw.msr_gps_epoch) << m_epoch; + *dna_stream << std::setw(dml.msr_gps_epoch - dml.msr_inst_ht) << " "; + *dna_stream << std::setw(dmw.msr_gps_epoch) << m_epoch; if (m_msr_db_map.is_msr_id_set) - *dna_stream << setw(dmw.msr_id_msr) << m_msr_db_map.msr_id; + *dna_stream << std::setw(dmw.msr_id_msr) << m_msr_db_map.msr_id; - *dna_stream << endl; + *dna_stream << std::endl; } @@ -232,12 +232,12 @@ void CDnaCoordinate::WriteBinaryMsr(std::ofstream* binary_stream, PUINT32 msrInd } -void CDnaCoordinate::SetValue(const string& str) +void CDnaCoordinate::SetValue(const std::string& str) { RadFromDmsString(&m_drValue, trimstr(str)); } -void CDnaCoordinate::SetStdDev(const string& str) +void CDnaCoordinate::SetStdDev(const std::string& str) { RadFromSecondsString(&m_dStdDev, trimstr(str)); // convert to radians } diff --git a/dynadjust/include/measurement_types/dnacoordinate.hpp b/dynadjust/include/measurement_types/dnacoordinate.hpp index ee5be48a..d0e4d296 100644 --- a/dynadjust/include/measurement_types/dnacoordinate.hpp +++ b/dynadjust/include/measurement_types/dnacoordinate.hpp @@ -37,8 +37,6 @@ const int ASTRONOMIC_LONITUDE = 1; const int GEODETIC_LATITUDE = 2; const int GEODETIC_LONITUDE = 3; -using namespace std; - namespace dynadjust { namespace measurements { @@ -54,7 +52,7 @@ class CDnaCoordinate : public CDnaMeasurement //CDnaCoordinate& operator=(const CDnaCoordinate& rhs); public: - //CDnaCoordinate(const bool, const string&, const double&, const double&); + //CDnaCoordinate(const bool, const std::string&, const double&, const double&); bool operator==(const CDnaCoordinate& rhs) const; bool operator<(const CDnaCoordinate& rhs) const; @@ -64,13 +62,13 @@ class CDnaCoordinate : public CDnaMeasurement inline double GetValue() const { return m_drValue; } inline double GetStdDev() const { return m_dStdDev; } - void SetValue(const string& str); - void SetStdDev(const string& str); + void SetValue(const std::string& str); + void SetStdDev(const std::string& str); inline virtual UINT32 CalcBinaryRecordCount() const { return 1; } virtual void WriteBinaryMsr(std::ofstream* binary_stream, PUINT32 msrIndex) const; virtual UINT32 SetMeasurementRec(const vstn_t& binaryStn, it_vmsr_t& it_msr, it_vdbid_t& dbidmap); - virtual void WriteDynaMLMsr(std::ofstream* dynaml_stream, const string& comment, bool) const; + virtual void WriteDynaMLMsr(std::ofstream* dynaml_stream, const std::string& comment, bool) const; virtual void WriteDNAMsr(std::ofstream* dna_stream, const dna_msr_fields& dmw, const dna_msr_fields& dml, bool) const; virtual void SimulateMsr(vdnaStnPtr* vStations, const CDnaEllipsoid* ellipsoid); diff --git a/dynadjust/include/measurement_types/dnadirection.cpp b/dynadjust/include/measurement_types/dnadirection.cpp index fc940bdd..e9e8a7f9 100644 --- a/dynadjust/include/measurement_types/dnadirection.cpp +++ b/dynadjust/include/measurement_types/dnadirection.cpp @@ -115,7 +115,7 @@ CDnaDirection& CDnaDirection::operator= (CDnaDirection&& rhs) //} -//CDnaDirection::CDnaDirection(const bool bIgnore, const string& strFirst, const string& strTarget, const double& drValue, const double& dStdDev) +//CDnaDirection::CDnaDirection(const bool bIgnore, const std::string& strFirst, const std::string& strTarget, const double& drValue, const double& dStdDev) //{ // m_strType = "D"; // m_strFirst = strFirst; @@ -196,78 +196,78 @@ bool CDnaDirection::operator< (const CDnaDirection& rhs) const } -void CDnaDirection::WriteDynaMLMsr(std::ofstream* dynaml_stream, const string& comment, bool bSubMeasurement /*= false*/) const +void CDnaDirection::WriteDynaMLMsr(std::ofstream* dynaml_stream, const std::string& comment, bool bSubMeasurement /*= false*/) const { if (bSubMeasurement) { // Direction set - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; if (m_bIgnore) - *dynaml_stream << " *" << endl; + *dynaml_stream << " *" << std::endl; else - *dynaml_stream << " " << endl; - *dynaml_stream << " " << m_strTarget << "" << endl; - *dynaml_stream << " " << setprecision(8) << fixed - << RadtoDms(m_drValue) << "" << endl; - *dynaml_stream << " " << scientific << setprecision(6) << Seconds(m_dStdDev) << "" << endl; + *dynaml_stream << " " << std::endl; + *dynaml_stream << " " << m_strTarget << "" << std::endl; + *dynaml_stream << " " << std::setprecision(8) << std::fixed + << RadtoDms(m_drValue) << "" << std::endl; + *dynaml_stream << " " << std::scientific << std::setprecision(6) << Seconds(m_dStdDev) << "" << std::endl; if (m_msr_db_map.is_msr_id_set) - *dynaml_stream << " " << m_msr_db_map.msr_id << "" << endl; + *dynaml_stream << " " << m_msr_db_map.msr_id << "" << std::endl; - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; } else { // Zenith distance, vertical angle if (comment.empty()) - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; else - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; - *dynaml_stream << " " << endl; - *dynaml_stream << " " << m_strType << "" << endl; + *dynaml_stream << " " << std::endl; + *dynaml_stream << " " << m_strType << "" << std::endl; // Source file from which the measurement came - *dynaml_stream << " " << m_sourceFile << "" << endl; + *dynaml_stream << " " << m_sourceFile << "" << std::endl; if (m_bIgnore) - *dynaml_stream << " *" << endl; + *dynaml_stream << " *" << std::endl; else - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; if (m_epoch.empty()) - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; else - *dynaml_stream << " " << m_epoch << "" << endl; + *dynaml_stream << " " << m_epoch << "" << std::endl; - *dynaml_stream << " " << m_strFirst << "" << endl; - *dynaml_stream << " " << m_strTarget << "" << endl; - *dynaml_stream << " " << setprecision(8) << fixed - << RadtoDms(m_drValue) << "" << endl; - *dynaml_stream << " " << scientific << setprecision(6) << Seconds(m_dStdDev) << "" << endl; + *dynaml_stream << " " << m_strFirst << "" << std::endl; + *dynaml_stream << " " << m_strTarget << "" << std::endl; + *dynaml_stream << " " << std::setprecision(8) << std::fixed + << RadtoDms(m_drValue) << "" << std::endl; + *dynaml_stream << " " << std::scientific << std::setprecision(6) << Seconds(m_dStdDev) << "" << std::endl; // Zenith distance, vertical angle switch (GetTypeC()) { case 'Z': case 'V': - *dynaml_stream << " " << fixed << setprecision(3) << m_fInstHeight << "" << endl; - *dynaml_stream << " " << fixed << setprecision(3) << m_fTargHeight << "" << endl; + *dynaml_stream << " " << std::fixed << std::setprecision(3) << m_fInstHeight << "" << std::endl; + *dynaml_stream << " " << std::fixed << std::setprecision(3) << m_fTargHeight << "" << std::endl; break; } if (m_msr_db_map.is_msr_id_set) - *dynaml_stream << " " << m_msr_db_map.msr_id << "" << endl; + *dynaml_stream << " " << m_msr_db_map.msr_id << "" << std::endl; - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; } } void CDnaDirection::WriteDNAMsr(std::ofstream* dna_stream, const dna_msr_fields& dmw, const dna_msr_fields& dml, bool bSubMeasurement /*= false*/) const { - *dna_stream << setw(dmw.msr_type) << m_strType; + *dna_stream << std::setw(dmw.msr_type) << m_strType; if (m_bIgnore) - *dna_stream << setw(dmw.msr_ignore) << "*"; + *dna_stream << std::setw(dmw.msr_ignore) << "*"; else - *dna_stream << setw(dmw.msr_ignore) << " "; + *dna_stream << std::setw(dmw.msr_ignore) << " "; // database id width UINT32 width(dml.msr_id_msr - dml.msr_stddev - dmw.msr_stddev); @@ -275,30 +275,30 @@ void CDnaDirection::WriteDNAMsr(std::ofstream* dna_stream, const dna_msr_fields& if (bSubMeasurement) { // Direction set - *dna_stream << left << setw(dmw.msr_inst) << " "; - *dna_stream << setw(dmw.msr_targ1) << " "; - *dna_stream << left << setw(dmw.msr_targ2) << m_strTarget; - *dna_stream << setw(dmw.msr_linear) << " "; // linear measurement value - *dna_stream << setw(dmw.msr_ang_d + dmw.msr_ang_m + dmw.msr_ang_s) << - right << FormatDnaDmsString(RadtoDms(m_drValue), 8); + *dna_stream << std::left << std::setw(dmw.msr_inst) << " "; + *dna_stream << std::setw(dmw.msr_targ1) << " "; + *dna_stream << std::left << std::setw(dmw.msr_targ2) << m_strTarget; + *dna_stream << std::setw(dmw.msr_linear) << " "; // linear measurement value + *dna_stream << std::setw(dmw.msr_ang_d + dmw.msr_ang_m + dmw.msr_ang_s) << + std::right << FormatDnaDmsString(RadtoDms(m_drValue), 8); UINT32 m_stdDevPrec(3); - *dna_stream << setw(dmw.msr_stddev) << StringFromTW(Seconds(m_dStdDev), dmw.msr_stddev, m_stdDevPrec); - //*dna_stream << setw(dmw.msr_stddev) << fixed << setprecision(3) << Seconds(m_dStdDev); + *dna_stream << std::setw(dmw.msr_stddev) << StringFromTW(Seconds(m_dStdDev), dmw.msr_stddev, m_stdDevPrec); + //*dna_stream << std::setw(dmw.msr_stddev) << std::fixed << std::setprecision(3) << Seconds(m_dStdDev); } else { // Azimuth, zenith distance, vertical angle - *dna_stream << left << setw(dmw.msr_inst) << m_strFirst; - *dna_stream << left << setw(dmw.msr_targ1) << m_strTarget; - *dna_stream << setw(dmw.msr_targ2) << " "; - *dna_stream << setw(dmw.msr_linear) << " "; // linear measurement value - *dna_stream << setw(dmw.msr_ang_d + dmw.msr_ang_m + dmw.msr_ang_s) << - right << FormatDnaDmsString(RadtoDms(m_drValue), 8); + *dna_stream << std::left << std::setw(dmw.msr_inst) << m_strFirst; + *dna_stream << std::left << std::setw(dmw.msr_targ1) << m_strTarget; + *dna_stream << std::setw(dmw.msr_targ2) << " "; + *dna_stream << std::setw(dmw.msr_linear) << " "; // linear measurement value + *dna_stream << std::setw(dmw.msr_ang_d + dmw.msr_ang_m + dmw.msr_ang_s) << + std::right << FormatDnaDmsString(RadtoDms(m_drValue), 8); UINT32 m_stdDevPrec(3); - *dna_stream << setw(dmw.msr_stddev) << StringFromTW(Seconds(m_dStdDev), dmw.msr_stddev, m_stdDevPrec); - //*dna_stream << setw(dmw.msr_stddev) << fixed << setprecision(3) << Seconds(m_dStdDev); + *dna_stream << std::setw(dmw.msr_stddev) << StringFromTW(Seconds(m_dStdDev), dmw.msr_stddev, m_stdDevPrec); + //*dna_stream << std::setw(dmw.msr_stddev) << std::fixed << std::setprecision(3) << Seconds(m_dStdDev); width = dml.msr_gps_epoch - dml.msr_inst_ht; // Zenith distance, vertical angle @@ -306,29 +306,29 @@ void CDnaDirection::WriteDNAMsr(std::ofstream* dna_stream, const dna_msr_fields& { case 'Z': case 'V': - *dna_stream << setw(dmw.msr_inst_ht) << fixed << setprecision(3) << m_fInstHeight; - *dna_stream << setw(dmw.msr_targ_ht) << fixed << setprecision(3) << m_fTargHeight; + *dna_stream << std::setw(dmw.msr_inst_ht) << std::fixed << std::setprecision(3) << m_fInstHeight; + *dna_stream << std::setw(dmw.msr_targ_ht) << std::fixed << std::setprecision(3) << m_fTargHeight; width = dml.msr_gps_epoch - dml.msr_targ_ht - dmw.msr_targ_ht; break; } - *dna_stream << setw(width) << " "; - *dna_stream << setw(dmw.msr_gps_epoch) << m_epoch; + *dna_stream << std::setw(width) << " "; + *dna_stream << std::setw(dmw.msr_gps_epoch) << m_epoch; width = 0; } if (m_msr_db_map.is_msr_id_set) { if (width) - *dna_stream << setw(width) << " "; - *dna_stream << setw(dmw.msr_id_msr) << m_msr_db_map.msr_id; + *dna_stream << std::setw(width) << " "; + *dna_stream << std::setw(dmw.msr_id_msr) << m_msr_db_map.msr_id; if (bSubMeasurement) if (m_msr_db_map.is_cls_id_set) - *dna_stream << setw(dmw.msr_id_cluster) << m_msr_db_map.cluster_id; + *dna_stream << std::setw(dmw.msr_id_cluster) << m_msr_db_map.cluster_id; } - *dna_stream << endl; + *dna_stream << std::endl; } void CDnaDirection::SimulateMsr(vdnaStnPtr* vStations, const CDnaEllipsoid*) @@ -539,7 +539,7 @@ void CDnaDirection::SimulateMsr(vdnaStnPtr* vStations, const CDnaEllipsoid*) // // // first station // m_lstn1Index = measRecord->station1; -// ifs_stns->seekg(sizeof(UINT32) + measRecord->station1 * sizeof(station_t), ios::beg); +// ifs_stns->seekg(sizeof(UINT32) + measRecord->station1 * sizeof(station_t), std::ios::beg); // ifs_stns->read(reinterpret_cast(&stationName), sizeof(stationName)); // m_strFirst = stationName; // @@ -549,7 +549,7 @@ void CDnaDirection::SimulateMsr(vdnaStnPtr* vStations, const CDnaEllipsoid*) // // // target station // m_lstn2Index = measRecord->station2; -// ifs_stns->seekg(sizeof(UINT32) + measRecord->station2 * sizeof(station_t), ios::beg); +// ifs_stns->seekg(sizeof(UINT32) + measRecord->station2 * sizeof(station_t), std::ios::beg); // ifs_stns->read(reinterpret_cast(&stationName), sizeof(stationName)); // m_strTarget = stationName; // @@ -629,7 +629,6 @@ void CDnaDirection::WriteBinaryMsr(std::ofstream* binary_stream, PUINT32 msrInde measRecord.clusterID = m_lsetID; // number of Directions in the parent cluster including the first - // measRecord.vectorCount1 = m_lRecordedTotal + 1; measRecord.vectorCount1 = m_lRecordedTotal; measRecord.measurementStations = m_MSmeasurementStations; measRecord.fileOrder = ((*msrIndex)++); @@ -640,31 +639,31 @@ void CDnaDirection::WriteBinaryMsr(std::ofstream* binary_stream, PUINT32 msrInde } -//void CDnaDirection::coutDirectionData(ostream &os) const +//void CDnaDirection::coutDirectionData(std::ostream &os) const //{ -// os << setw(16) << " " << setw(MSR2_WIDTH) << m_strTarget; -// os << setw(3) << (m_bIgnore ? "*" : " ") << setw(MEAS_WIDTH) << m_drValue; -// os << setw(VAR_WIDTH) << m_dStdDev; -// os << setw(7) << " "; // m_fInstHeight +// os << std::setw(16) << " " << std::setw(MSR2_WIDTH) << m_strTarget; +// os << std::setw(3) << (m_bIgnore ? "*" : " ") << std::setw(MEAS_WIDTH) << m_drValue; +// os << std::setw(VAR_WIDTH) << m_dStdDev; +// os << std::setw(7) << " "; // m_fInstHeight // switch (GetTypeC()) // { // case 'Z': // case 'V': -// os << setw(7) << setprecision(3) << fixed << m_fTargHeight; +// os << std::setw(7) << std::setprecision(3) << std::fixed << m_fTargHeight; // break; // default: -// os << setw(7) << " "; +// os << std::setw(7) << " "; // break; // } -// os << endl; +// os << std::endl; //} -void CDnaDirection::SetValue(const string& str) +void CDnaDirection::SetValue(const std::string& str) { RadFromDmsString(&m_drValue, trimstr(str)); } -void CDnaDirection::SetStdDev(const string& str) +void CDnaDirection::SetStdDev(const std::string& str) { // convert seconds to radians RadFromSecondsString(&m_dStdDev, trimstr(str)); @@ -675,12 +674,12 @@ void CDnaDirection::SetStdDev(const string& str) // Note: vertical angles and zenith distances are derived // from CDnaDirection, so these methods are provided here, // but don't need instrument height for 'D' measurements. -void CDnaDirection::SetInstrumentHeight(const string& str) +void CDnaDirection::SetInstrumentHeight(const std::string& str) { FloatFromString(m_fInstHeight, trimstr(str)); } -void CDnaDirection::SetTargetHeight(const string& str) +void CDnaDirection::SetTargetHeight(const std::string& str) { FloatFromString(m_fTargHeight, trimstr(str)); } @@ -728,7 +727,7 @@ CDnaAzimuth::~CDnaAzimuth(void) //} -//CDnaAzimuth::CDnaAzimuth(const bool bIgnore, const string& strFirst, const string& strTarget, const double& drValue, const double& dStdDev) +//CDnaAzimuth::CDnaAzimuth(const bool bIgnore, const std::string& strFirst, const std::string& strTarget, const double& drValue, const double& dStdDev) //{ // m_bIgnore = bIgnore; // m_strTarget = strTarget; diff --git a/dynadjust/include/measurement_types/dnadirection.hpp b/dynadjust/include/measurement_types/dnadirection.hpp index 2c8a0f2b..9cec0ab0 100644 --- a/dynadjust/include/measurement_types/dnadirection.hpp +++ b/dynadjust/include/measurement_types/dnadirection.hpp @@ -33,8 +33,6 @@ #include #include -using namespace std; - namespace dynadjust { namespace measurements { @@ -54,7 +52,7 @@ class CDnaDirection : public CDnaMeasurement //CDnaDirection& operator=(const CDnaDirection& rhs); public: - //CDnaDirection(const bool bIgnore, const string& strFirst, const string& strTarget, const double& dValue, const double& dStdDev); + //CDnaDirection(const bool bIgnore, const std::string& strFirst, const std::string& strTarget, const double& dValue, const double& dStdDev); //virtual inline CDnaDirection* clone() const { return new CDnaDirection(*this); } bool operator==(const CDnaDirection& rhs) const; @@ -62,7 +60,7 @@ class CDnaDirection : public CDnaMeasurement //inline CDnaDirection& operator[](int iIndex) { return this[iIndex]; } - inline string GetTarget() const { return m_strTarget; } + inline std::string GetTarget() const { return m_strTarget; } inline double GetValue() const { return m_drValue; } inline double GetStdDev() const { return m_dStdDev; } inline float GetInstrHeight() const { return m_fInstHeight; } @@ -70,23 +68,23 @@ class CDnaDirection : public CDnaMeasurement inline void SetRecordedTotal(const UINT32& l) { m_lRecordedTotal = l; } inline void SetClusterID(const UINT32& id) { m_lsetID = id; } - inline void SetTarget(const string& str) { m_strTarget = trimstr(str); } - void SetValue(const string& str); - void SetStdDev(const string& str); - void SetInstrumentHeight(const string& str); - void SetTargetHeight(const string& str); + inline void SetTarget(const std::string& str) { m_strTarget = trimstr(str); } + void SetValue(const std::string& str); + void SetStdDev(const std::string& str); + void SetInstrumentHeight(const std::string& str); + void SetTargetHeight(const std::string& str); inline virtual UINT32 CalcBinaryRecordCount() const { return 1; } - //void coutDirectionData(ostream &os) const; + //void coutDirectionData(std::ostream &os) const; virtual void WriteBinaryMsr(std::ofstream* binary_stream, PUINT32 msrIndex) const; virtual UINT32 SetMeasurementRec(const vstn_t& binaryStn, it_vmsr_t& it_msr, it_vdbid_t& dbidmap); - virtual void WriteDynaMLMsr(std::ofstream* dynaml_stream, const string& comment, bool bSubMeasurement = false) const; + virtual void WriteDynaMLMsr(std::ofstream* dynaml_stream, const std::string& comment, bool bSubMeasurement = false) const; virtual void WriteDNAMsr(std::ofstream* dna_stream, const dna_msr_fields& dmw, const dna_msr_fields& dml, bool bSubMeasurement = false) const; virtual void SimulateMsr(vdnaStnPtr* vStations, const CDnaEllipsoid* ellipsoid); //virtual inline void SetDatabaseMap_bmsIndex(const UINT32& bmsIndex) { m_msr_db_map.bms_index = bmsIndex; } public: - string m_strTarget; + std::string m_strTarget; protected: double m_drValue; @@ -114,7 +112,7 @@ class CDnaAzimuth : public CDnaDirection public: - //CDnaAzimuth(const bool bIgnore, const string& strFirst, const string& strTarget, const double& drValue, const double& dStdDev); + //CDnaAzimuth(const bool bIgnore, const std::string& strFirst, const std::string& strTarget, const double& drValue, const double& dStdDev); bool operator==(const CDnaAzimuth& rhs) const; diff --git a/dynadjust/include/measurement_types/dnadirectionset.cpp b/dynadjust/include/measurement_types/dnadirectionset.cpp index 5b0d08b6..4057f42f 100644 --- a/dynadjust/include/measurement_types/dnadirectionset.cpp +++ b/dynadjust/include/measurement_types/dnadirectionset.cpp @@ -32,6 +32,7 @@ CDnaDirectionSet::CDnaDirectionSet(void) , m_drValue(0.) , m_dStdDev(0.) , m_lRecordedTotal(0) + , m_lNonIgnoredDirns(0) , m_lsetID(0) { m_strType = "D"; @@ -51,6 +52,7 @@ CDnaDirectionSet::CDnaDirectionSet(const UINT32 lsetID) , m_drValue(0.) , m_dStdDev(0.) , m_lRecordedTotal(0) + , m_lNonIgnoredDirns(0) , m_lsetID(lsetID) { m_strType = "D"; @@ -70,6 +72,7 @@ CDnaDirectionSet::CDnaDirectionSet(CDnaDirectionSet&& d) m_drValue = d.m_drValue; m_dStdDev = d.m_dStdDev; m_lRecordedTotal = d.m_lRecordedTotal; + m_lNonIgnoredDirns = d.m_lNonIgnoredDirns; m_MSmeasurementStations = d.m_MSmeasurementStations; m_lsetID = d.m_lsetID; @@ -94,6 +97,7 @@ CDnaDirectionSet& CDnaDirectionSet::operator= (CDnaDirectionSet&& rhs) m_drValue = rhs.m_drValue; m_dStdDev = rhs.m_dStdDev; m_lRecordedTotal = rhs.m_lRecordedTotal; + m_lNonIgnoredDirns = rhs.m_lNonIgnoredDirns; m_lsetID = rhs.m_lsetID; m_MSmeasurementStations = rhs.m_MSmeasurementStations; @@ -118,6 +122,7 @@ bool CDnaDirectionSet::operator== (const CDnaDirectionSet& rhs) const m_drValue == rhs.m_drValue && m_dStdDev == rhs.m_dStdDev && m_lRecordedTotal == rhs.m_lRecordedTotal && + m_lNonIgnoredDirns == rhs.m_lNonIgnoredDirns && m_vTargetDirections == rhs.m_vTargetDirections && m_epoch == rhs.m_epoch ); @@ -163,13 +168,13 @@ void CDnaDirectionSet::ClearDirections() } -//bool CDnaDirectionSet::IsRepeatedDirection(string strTarget) +//bool CDnaDirectionSet::IsRepeatedDirection(std::string strTarget) //{ // if (m_vTargetDirections.empty()) // return false; // // if (find_if(m_vTargetDirections.begin(), m_vTargetDirections.end(), -// bind2nd(operator_on_mem(&CDnaDirection::m_strTarget, std::equal_to()), strTarget)) != m_vTargetDirections.end()) +// bind2nd(operator_on_mem(&CDnaDirection::m_strTarget, std::equal_to()), strTarget)) != m_vTargetDirections.end()) // return true; // return false; //} @@ -213,54 +218,54 @@ UINT32 CDnaDirectionSet::CalcBinaryRecordCount() const } -void CDnaDirectionSet::WriteDynaMLMsr(std::ofstream* dynaml_stream, const string& comment, bool) const +void CDnaDirectionSet::WriteDynaMLMsr(std::ofstream* dynaml_stream, const std::string& comment, bool) const { const size_t dirCount(GetNumDirections()); if (comment.empty()) { - *dynaml_stream << " " << endl; + *dynaml_stream << " (single)"; + *dynaml_stream << " -->" << std::endl; } else - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; - *dynaml_stream << " " << endl; - *dynaml_stream << " " << m_strType << "" << endl; + *dynaml_stream << " " << std::endl; + *dynaml_stream << " " << m_strType << "" << std::endl; // Source file from which the measurement came - *dynaml_stream << " " << m_sourceFile << "" << endl; + *dynaml_stream << " " << m_sourceFile << "" << std::endl; if (m_bIgnore) - *dynaml_stream << " *" << endl; + *dynaml_stream << " *" << std::endl; else - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; if (m_epoch.empty()) - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; else - *dynaml_stream << " " << m_epoch << "" << endl; + *dynaml_stream << " " << m_epoch << "" << std::endl; - *dynaml_stream << " " << m_strFirst << "" << endl; - *dynaml_stream << " " << m_strTarget << "" << endl; - *dynaml_stream << " " << setprecision(8) << fixed << RadtoDms(m_drValue) << "" << endl; - *dynaml_stream << " " << scientific << setprecision(6) << Seconds(m_dStdDev) << "" << endl; + *dynaml_stream << " " << m_strFirst << "" << std::endl; + *dynaml_stream << " " << m_strTarget << "" << std::endl; + *dynaml_stream << " " << std::setprecision(8) << std::fixed << RadtoDms(m_drValue) << "" << std::endl; + *dynaml_stream << " " << std::scientific << std::setprecision(6) << Seconds(m_dStdDev) << "" << std::endl; if (m_msr_db_map.is_msr_id_set) - *dynaml_stream << " " << m_msr_db_map.msr_id << "" << endl; + *dynaml_stream << " " << m_msr_db_map.msr_id << "" << std::endl; if (m_msr_db_map.is_cls_id_set) - *dynaml_stream << " " << m_msr_db_map.cluster_id << "" << endl; + *dynaml_stream << " " << m_msr_db_map.cluster_id << "" << std::endl; - *dynaml_stream << " " << dirCount << "" << endl; + *dynaml_stream << " " << dirCount << "" << std::endl; // write directions - vector::const_iterator _it_dir = m_vTargetDirections.begin(); + std::vector::const_iterator _it_dir = m_vTargetDirections.begin(); for (_it_dir = m_vTargetDirections.begin(); _it_dir!=m_vTargetDirections.end(); ++_it_dir) _it_dir->WriteDynaMLMsr(dynaml_stream, comment, true); - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; } @@ -268,34 +273,34 @@ void CDnaDirectionSet::WriteDNAMsr(std::ofstream* dna_stream, const dna_msr_fiel { const size_t dirCount(GetNumDirections()); - *dna_stream << setw(dmw.msr_type) << m_strType; + *dna_stream << std::setw(dmw.msr_type) << m_strType; if (m_bIgnore) - *dna_stream << setw(dmw.msr_ignore) << "*"; + *dna_stream << std::setw(dmw.msr_ignore) << "*"; else - *dna_stream << setw(dmw.msr_ignore) << " "; + *dna_stream << std::setw(dmw.msr_ignore) << " "; - *dna_stream << left << setw(dmw.msr_inst) << m_strFirst; - *dna_stream << left << setw(dmw.msr_targ1) << m_strTarget; - *dna_stream << left << setw(dmw.msr_targ2) << dirCount; - *dna_stream << setw(dmw.msr_linear) << " "; // linear measurement value - *dna_stream << setw(dmw.msr_ang_d + dmw.msr_ang_m + dmw.msr_ang_s) << - right << FormatDnaDmsString(RadtoDms(m_drValue), 8); + *dna_stream << std::left << std::setw(dmw.msr_inst) << m_strFirst; + *dna_stream << std::left << std::setw(dmw.msr_targ1) << m_strTarget; + *dna_stream << std::left << std::setw(dmw.msr_targ2) << dirCount; + *dna_stream << std::setw(dmw.msr_linear) << " "; // linear measurement value + *dna_stream << std::setw(dmw.msr_ang_d + dmw.msr_ang_m + dmw.msr_ang_s) << + std::right << FormatDnaDmsString(RadtoDms(m_drValue), 8); UINT32 m_stdDevPrec(3); - *dna_stream << setw(dmw.msr_stddev) << StringFromTW(Seconds(m_dStdDev), dmw.msr_stddev, m_stdDevPrec); - //*dna_stream << setw(dmw.msr_stddev) << fixed << setprecision(3) << Seconds(m_dStdDev); + *dna_stream << std::setw(dmw.msr_stddev) << StringFromTW(Seconds(m_dStdDev), dmw.msr_stddev, m_stdDevPrec); + //*dna_stream << std::setw(dmw.msr_stddev) << std::fixed << std::setprecision(3) << Seconds(m_dStdDev); - *dna_stream << setw(dml.msr_gps_epoch - dml.msr_inst_ht) << " "; - *dna_stream << setw(dmw.msr_gps_epoch) << m_epoch; + *dna_stream << std::setw(dml.msr_gps_epoch - dml.msr_inst_ht) << " "; + *dna_stream << std::setw(dmw.msr_gps_epoch) << m_epoch; if (m_msr_db_map.is_msr_id_set) - *dna_stream << setw(dmw.msr_id_msr) << m_msr_db_map.msr_id; + *dna_stream << std::setw(dmw.msr_id_msr) << m_msr_db_map.msr_id; if (m_msr_db_map.is_cls_id_set) - *dna_stream << setw(dmw.msr_id_cluster) << m_msr_db_map.cluster_id; + *dna_stream << std::setw(dmw.msr_id_cluster) << m_msr_db_map.cluster_id; - *dna_stream << endl; + *dna_stream << std::endl; // write directions - vector::const_iterator _it_dir = m_vTargetDirections.begin(); + std::vector::const_iterator _it_dir = m_vTargetDirections.begin(); for (_it_dir = m_vTargetDirections.begin(); _it_dir!=m_vTargetDirections.end(); ++_it_dir) _it_dir->WriteDNAMsr(dna_stream, dmw, dml, true); } @@ -320,7 +325,7 @@ void CDnaDirectionSet::SimulateMsr(vdnaStnPtr* vStations, const CDnaEllipsoid* e // Deflections available? if (fabs(stn1_it->get()->GetverticalDef()) > E4_SEC_DEFLECTION || fabs(stn1_it->get()->GetmeridianDef()) > E4_SEC_DEFLECTION) { - // 1. compute zenith angle + // 1. compute zenith distance double zenithDistance = ZenithDistance( stn1_it->get()->GetXAxis(), stn1_it->get()->GetYAxis(), @@ -351,7 +356,7 @@ void CDnaDirectionSet::SimulateMsr(vdnaStnPtr* vStations, const CDnaEllipsoid* e m_epoch = "01.10.1985"; - vector::iterator _it_dir = m_vTargetDirections.begin(); + std::vector::iterator _it_dir = m_vTargetDirections.begin(); for (_it_dir = m_vTargetDirections.begin(); _it_dir!=m_vTargetDirections.end(); ++_it_dir) _it_dir->SimulateMsr(vStations, ellipsoid); } @@ -382,7 +387,10 @@ UINT32 CDnaDirectionSet::SetMeasurementRec(const vstn_t& binaryStn, it_vmsr_t& i // it_msr holds the full number of measurement blocks, which is // the number of directions in the vector plus one for the RO m_lRecordedTotal = it_msr->vectorCount1 - 1; - + // Calculate afresh the number of non-ignored directions + if (it_msr->vectorCount2 > 0) + m_lNonIgnoredDirns = it_msr->vectorCount2 - 1; + m_lsetID = it_msr->clusterID; m_epoch = it_msr->epoch; @@ -395,7 +403,7 @@ UINT32 CDnaDirectionSet::SetMeasurementRec(const vstn_t& binaryStn, it_vmsr_t& i CDnaMeasurement::SetDatabaseMap(*dbidmap); // now covariances - vector::iterator _it_dir = m_vTargetDirections.begin(); + std::vector::iterator _it_dir = m_vTargetDirections.begin(); for (; _it_dir!=m_vTargetDirections.end(); ++_it_dir) { it_msr++; @@ -420,6 +428,9 @@ void CDnaDirectionSet::WriteBinaryMsr(std::ofstream* binary_stream, PUINT32 msrI // number of Directions in the parent cluster including the first measRecord.vectorCount1 = static_cast(m_vTargetDirections.size()) + 1; + // number of non-ignored directions in the cluster including the first + if (!m_bIgnore && m_lNonIgnoredDirns > 0) + measRecord.vectorCount2 = m_lNonIgnoredDirns + 1; measRecord.measAdj = m_measAdj; measRecord.measCorr = m_measCorr; @@ -428,7 +439,7 @@ void CDnaDirectionSet::WriteBinaryMsr(std::ofstream* binary_stream, PUINT32 msrI measRecord.preAdjCorr = m_preAdjCorr; measRecord.term1 = m_drValue; measRecord.term2 = m_dStdDev * m_dStdDev; // convert to variance - + measRecord.clusterID = m_lsetID; measRecord.measurementStations = m_MSmeasurementStations; measRecord.fileOrder = ((*msrIndex)++); @@ -437,22 +448,22 @@ void CDnaDirectionSet::WriteBinaryMsr(std::ofstream* binary_stream, PUINT32 msrI binary_stream->write(reinterpret_cast(&measRecord), sizeof(measurement_t)); - vector::const_iterator _it_dir; + std::vector::const_iterator _it_dir; for (_it_dir = m_vTargetDirections.begin(); _it_dir!=m_vTargetDirections.end(); ++_it_dir) _it_dir->WriteBinaryMsr(binary_stream, msrIndex); } -void CDnaDirectionSet::SetValue(const string& str) +void CDnaDirectionSet::SetValue(const std::string& str) { RadFromDmsString(&m_drValue, trimstr(str)); } -void CDnaDirectionSet::SetStdDev(const string& str) +void CDnaDirectionSet::SetStdDev(const std::string& str) { RadFromSecondsString(&m_dStdDev, trimstr(str)); } -void CDnaDirectionSet::SetTotal(const string& str) +void CDnaDirectionSet::SetTotal(const std::string& str) { m_lRecordedTotal = LongFromString(trimstr(str)); m_vTargetDirections.reserve(m_lRecordedTotal); diff --git a/dynadjust/include/measurement_types/dnadirectionset.hpp b/dynadjust/include/measurement_types/dnadirectionset.hpp index 8f47bdd6..f6858594 100644 --- a/dynadjust/include/measurement_types/dnadirectionset.hpp +++ b/dynadjust/include/measurement_types/dnadirectionset.hpp @@ -36,9 +36,6 @@ #include -using namespace std; -using namespace boost; - namespace dynadjust { namespace measurements { @@ -61,7 +58,7 @@ class CDnaDirectionSet : public CDnaMeasurement CDnaDirectionSet(const UINT32 lsetID); //CDnaDirectionSet(bool bIgnore, - // const string& strFirst, const string& strTarget, + // const std::string& strFirst, const std::string& strTarget, // const double& drValue, const double& dStdDev, // const float& fInstrHeight, const float& fTargetHeight); @@ -70,24 +67,25 @@ class CDnaDirectionSet : public CDnaMeasurement //inline CDnaDirectionSet& operator[](int iIndex) { return this[iIndex]; } - void LoadDirectionSet(const char* const, const int&, const string&, const string&, bool, const int&); + void LoadDirectionSet(const char* const, const int&, const std::string&, const std::string&, bool, const int&); inline UINT32 GetClusterID() const { return m_lsetID; } - inline string GetTarget() const { return m_strTarget; } + inline std::string GetTarget() const { return m_strTarget; } inline UINT32 GetTotal() const { return m_lRecordedTotal; } inline double GetValue() const { return m_drValue; } inline double GetStdDev() const { return m_dStdDev; } inline size_t GetNumDirections() const { return m_vTargetDirections.size(); } - inline vector* GetDirections_ptr() { return &m_vTargetDirections; } + inline std::vector* GetDirections_ptr() { return &m_vTargetDirections; } inline void SetClusterID(const UINT32& id) { m_lsetID = id; } - inline void SetTarget(const string& str) { m_strTarget = trimstr(str); } + inline void SetTarget(const std::string& str) { m_strTarget = trimstr(str); } inline void SetTotal(const UINT32& l) { m_lRecordedTotal = l; } + inline void SetNonIgnoredDirns(const UINT32& n) { m_lNonIgnoredDirns = n; } - void SetTotal(const string& str); - void SetValue(const string& str); - void SetStdDev(const string& str); + void SetTotal(const std::string& str); + void SetValue(const std::string& str); + void SetStdDev(const std::string& str); void AddDirection(const CDnaMeasurement* pDirection); void ClearDirections(); @@ -96,7 +94,7 @@ class CDnaDirectionSet : public CDnaMeasurement virtual UINT32 CalcBinaryRecordCount() const; virtual void WriteBinaryMsr(std::ofstream* binary_stream, PUINT32 msrIndex) const; virtual UINT32 SetMeasurementRec(const vstn_t& binaryStn, it_vmsr_t& it_msr, it_vdbid_t& dbidmap); - virtual void WriteDynaMLMsr(std::ofstream* dynaml_stream, const string& comment, bool) const; + virtual void WriteDynaMLMsr(std::ofstream* dynaml_stream, const std::string& comment, bool) const; virtual void WriteDNAMsr(std::ofstream* dna_stream, const dna_msr_fields& dmw, const dna_msr_fields& dml, bool) const; virtual void SimulateMsr(vdnaStnPtr* vStations, const CDnaEllipsoid* ellipsoid); @@ -104,13 +102,14 @@ class CDnaDirectionSet : public CDnaMeasurement void SetDatabaseMaps(it_vdbid_t& dbidmap); - string m_strTarget; + std::string m_strTarget; protected: double m_drValue; double m_dStdDev; UINT32 m_lRecordedTotal; - vector m_vTargetDirections; + UINT32 m_lNonIgnoredDirns; + std::vector m_vTargetDirections; UINT32 m_lsetID; it_vdbid_t m_dbidmap; diff --git a/dynadjust/include/measurement_types/dnadistance.cpp b/dynadjust/include/measurement_types/dnadistance.cpp index 2144a8ed..60de315f 100644 --- a/dynadjust/include/measurement_types/dnadistance.cpp +++ b/dynadjust/include/measurement_types/dnadistance.cpp @@ -89,64 +89,64 @@ bool CDnaDistance::operator< (const CDnaDistance& rhs) const } -void CDnaDistance::WriteDynaMLMsr(std::ofstream* dynaml_stream, const string& comment, bool) const +void CDnaDistance::WriteDynaMLMsr(std::ofstream* dynaml_stream, const std::string& comment, bool) const { if (comment.empty()) - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; else - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; - *dynaml_stream << " " << endl; - *dynaml_stream << " " << m_strType << "" << endl; + *dynaml_stream << " " << std::endl; + *dynaml_stream << " " << m_strType << "" << std::endl; // Source file from which the measurement came - *dynaml_stream << " " << m_sourceFile << "" << endl; + *dynaml_stream << " " << m_sourceFile << "" << std::endl; if (m_bIgnore) - *dynaml_stream << " *" << endl; + *dynaml_stream << " *" << std::endl; else - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; if (m_epoch.empty()) - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; else - *dynaml_stream << " " << m_epoch << "" << endl; + *dynaml_stream << " " << m_epoch << "" << std::endl; - *dynaml_stream << " " << m_strFirst << "" << endl; - *dynaml_stream << " " << m_strTarget << "" << endl; - *dynaml_stream << " " << fixed << setprecision(4) << m_dValue << "" << endl; - *dynaml_stream << " " << fixed << setprecision(4) << m_dStdDev << "" << endl; + *dynaml_stream << " " << m_strFirst << "" << std::endl; + *dynaml_stream << " " << m_strTarget << "" << std::endl; + *dynaml_stream << " " << std::fixed << std::setprecision(4) << m_dValue << "" << std::endl; + *dynaml_stream << " " << std::fixed << std::setprecision(4) << m_dStdDev << "" << std::endl; switch (GetTypeC()) { case 'S': - *dynaml_stream << " " << fixed << setprecision(3) << m_fInstHeight << "" << endl; - *dynaml_stream << " " << fixed << setprecision(3) << m_fTargHeight << "" << endl; + *dynaml_stream << " " << std::fixed << std::setprecision(3) << m_fInstHeight << "" << std::endl; + *dynaml_stream << " " << std::fixed << std::setprecision(3) << m_fTargHeight << "" << std::endl; break; } if (m_msr_db_map.is_msr_id_set) - *dynaml_stream << " " << m_msr_db_map.msr_id << "" << endl; + *dynaml_stream << " " << m_msr_db_map.msr_id << "" << std::endl; - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; } void CDnaDistance::WriteDNAMsr(std::ofstream* dna_stream, const dna_msr_fields& dmw, const dna_msr_fields& dml, bool) const { - *dna_stream << setw(dmw.msr_type) << m_strType; + *dna_stream << std::setw(dmw.msr_type) << m_strType; if (m_bIgnore) - *dna_stream << setw(dmw.msr_ignore) << "*"; + *dna_stream << std::setw(dmw.msr_ignore) << "*"; else - *dna_stream << setw(dmw.msr_ignore) << " "; + *dna_stream << std::setw(dmw.msr_ignore) << " "; - *dna_stream << left << setw(dmw.msr_inst) << m_strFirst; - *dna_stream << left << setw(dmw.msr_targ1) << m_strTarget; - *dna_stream << setw(dmw.msr_targ2) << " "; - *dna_stream << right << setw(dmw.msr_linear) << fixed << setprecision(4) << m_dValue; - *dna_stream << setw(dmw.msr_ang_d + dmw.msr_ang_m + dmw.msr_ang_s) << " "; + *dna_stream << std::left << std::setw(dmw.msr_inst) << m_strFirst; + *dna_stream << std::left << std::setw(dmw.msr_targ1) << m_strTarget; + *dna_stream << std::setw(dmw.msr_targ2) << " "; + *dna_stream << std::right << std::setw(dmw.msr_linear) << std::fixed << std::setprecision(4) << m_dValue; + *dna_stream << std::setw(dmw.msr_ang_d + dmw.msr_ang_m + dmw.msr_ang_s) << " "; UINT32 m_stdDevPrec(3); - *dna_stream << setw(dmw.msr_stddev) << StringFromTW(m_dStdDev, dmw.msr_stddev, m_stdDevPrec); - //*dna_stream << setw(dmw.msr_stddev) << fixed << setprecision(3) << m_dStdDev; + *dna_stream << std::setw(dmw.msr_stddev) << StringFromTW(m_dStdDev, dmw.msr_stddev, m_stdDevPrec); + //*dna_stream << std::setw(dmw.msr_stddev) << std::fixed << std::setprecision(3) << m_dStdDev; // database id width UINT32 width(dml.msr_gps_epoch - dml.msr_inst_ht); @@ -155,19 +155,19 @@ void CDnaDistance::WriteDNAMsr(std::ofstream* dna_stream, const dna_msr_fields& switch (GetTypeC()) { case 'S': - *dna_stream << setw(dmw.msr_inst_ht) << fixed << setprecision(3) << m_fInstHeight; - *dna_stream << setw(dmw.msr_targ_ht) << fixed << setprecision(3) << m_fTargHeight; + *dna_stream << std::setw(dmw.msr_inst_ht) << std::fixed << std::setprecision(3) << m_fInstHeight; + *dna_stream << std::setw(dmw.msr_targ_ht) << std::fixed << std::setprecision(3) << m_fTargHeight; width = dml.msr_gps_epoch - dml.msr_targ_ht - dmw.msr_targ_ht; break; } - *dna_stream << setw(width) << " "; - *dna_stream << setw(dmw.msr_gps_epoch) << m_epoch; + *dna_stream << std::setw(width) << " "; + *dna_stream << std::setw(dmw.msr_gps_epoch) << m_epoch; if (m_msr_db_map.is_msr_id_set) - *dna_stream << setw(dmw.msr_id_msr) << m_msr_db_map.msr_id; + *dna_stream << std::setw(dmw.msr_id_msr) << m_msr_db_map.msr_id; - *dna_stream << endl; + *dna_stream << std::endl; } @@ -316,12 +316,12 @@ void CDnaDistance::WriteBinaryMsr(std::ofstream* binary_stream, PUINT32 msrIndex } -void CDnaDistance::SetValue(const string& str) +void CDnaDistance::SetValue(const std::string& str) { DoubleFromString(m_dValue, trimstr(str)); } -void CDnaDistance::SetStdDev(const string& str) +void CDnaDistance::SetStdDev(const std::string& str) { DoubleFromString(m_dStdDev, trimstr(str)); } @@ -331,12 +331,12 @@ void CDnaDistance::SetStdDev(const string& str) // Note: slope distances are derived from CDnaDistance, so // these methods are provided here, but don't need // instrument height for 'C', 'E' and 'M' measurements. -void CDnaDistance::SetInstrumentHeight(const string& str) +void CDnaDistance::SetInstrumentHeight(const std::string& str) { FloatFromString(m_fInstHeight, trimstr(str)); } -void CDnaDistance::SetTargetHeight(const string& str) +void CDnaDistance::SetTargetHeight(const std::string& str) { DoubleFromString(m_fTargHeight, trimstr(str)); } diff --git a/dynadjust/include/measurement_types/dnadistance.hpp b/dynadjust/include/measurement_types/dnadistance.hpp index 53d2ddb0..99ad3ea5 100644 --- a/dynadjust/include/measurement_types/dnadistance.hpp +++ b/dynadjust/include/measurement_types/dnadistance.hpp @@ -31,8 +31,6 @@ #include -using namespace std; - namespace dynadjust { namespace measurements { @@ -48,35 +46,35 @@ class CDnaDistance : public CDnaMeasurement //CDnaDistance& operator=(const CDnaDistance& rhs); public: - //CDnaDistance(const bool bIgnore, const string& strType, const string& strFirst, const string& strTarget, const double& dValue, const double& dStdDev); + //CDnaDistance(const bool bIgnore, const std::string& strType, const std::string& strFirst, const std::string& strTarget, const double& dValue, const double& dStdDev); bool operator==(const CDnaDistance& rhs) const; bool operator<(const CDnaDistance& rhs) const; //inline CDnaDistance& operator[](int iIndex) { return this[iIndex]; } - inline string GetTarget() const { return m_strTarget; } + inline std::string GetTarget() const { return m_strTarget; } inline double GetValue() const { return m_dValue; } inline double GetStdDev() const { return m_dStdDev; } inline float GetInstrHeight() const { return m_fInstHeight; } inline float GetTargetHeight() const { return m_fTargHeight; } - inline void SetTarget(const string& str) { m_strTarget = trimstr(str); } - void SetValue(const string& str); - void SetStdDev(const string& str); - void SetInstrumentHeight(const string& str); - void SetTargetHeight(const string& str); + inline void SetTarget(const std::string& str) { m_strTarget = trimstr(str); } + void SetValue(const std::string& str); + void SetStdDev(const std::string& str); + void SetInstrumentHeight(const std::string& str); + void SetTargetHeight(const std::string& str); inline virtual UINT32 CalcBinaryRecordCount() const { return 1; } virtual void WriteBinaryMsr(std::ofstream* binary_stream, PUINT32 msrIndex) const; virtual UINT32 SetMeasurementRec(const vstn_t& binaryStn, it_vmsr_t& it_msr, it_vdbid_t& dbidmap); - virtual void WriteDynaMLMsr(std::ofstream* dynaml_stream, const string& comment, bool) const; + virtual void WriteDynaMLMsr(std::ofstream* dynaml_stream, const std::string& comment, bool) const; virtual void WriteDNAMsr(std::ofstream* dna_stream, const dna_msr_fields& dmw, const dna_msr_fields& dml, bool) const; virtual void SimulateMsr(vdnaStnPtr* vStations, const CDnaEllipsoid* ellipsoid); protected: - string m_strTarget; + std::string m_strTarget; double m_dValue; double m_dStdDev; float m_fInstHeight; diff --git a/dynadjust/include/measurement_types/dnageometries.hpp b/dynadjust/include/measurement_types/dnageometries.hpp index b5aaec65..bdb378f4 100644 --- a/dynadjust/include/measurement_types/dnageometries.hpp +++ b/dynadjust/include/measurement_types/dnageometries.hpp @@ -34,9 +34,6 @@ #include #include -using namespace std; -using namespace boost::geometry; - namespace dynadjust { namespace geometries { diff --git a/dynadjust/include/measurement_types/dnagpsbaseline.cpp b/dynadjust/include/measurement_types/dnagpsbaseline.cpp index 51e49254..bdacd8f2 100644 --- a/dynadjust/include/measurement_types/dnagpsbaseline.cpp +++ b/dynadjust/include/measurement_types/dnagpsbaseline.cpp @@ -50,7 +50,7 @@ CDnaGpsBaseline::CDnaGpsBaseline(void) , m_lclusterID(0) { SetEpoch(DEFAULT_EPOCH); - SetEpsg(epsgStringFromName(m_referenceFrame)); + SetEpsg(epsgStringFromName(m_referenceFrame)); m_vGpsCovariances.clear(); m_vGpsCovariances.reserve(0); @@ -151,7 +151,7 @@ bool CDnaGpsBaseline::operator== (const CDnaGpsBaseline& rhs) const fabs(m_dX - rhs.m_dX) < PRECISION_1E4 && fabs(m_dY - rhs.m_dY) < PRECISION_1E4 && fabs(m_dZ - rhs.m_dZ) < PRECISION_1E4 && - iequals(m_referenceFrame, rhs.m_referenceFrame) && + boost::iequals(m_referenceFrame, rhs.m_referenceFrame) && m_epoch == rhs.m_epoch ); } @@ -206,55 +206,55 @@ void CDnaGpsBaseline::AddGpsCovariance(const CDnaCovariance* pGpsCovariance) UINT32 CDnaGpsBaseline::CalcBinaryRecordCount() const { UINT32 RecordCount = 3; - vector::const_iterator _it_cov = m_vGpsCovariances.begin(); + std::vector::const_iterator _it_cov = m_vGpsCovariances.begin(); for (; _it_cov!=m_vGpsCovariances.end(); ++_it_cov) RecordCount += _it_cov->CalcBinaryRecordCount(); return RecordCount; } -void CDnaGpsBaseline::WriteDynaMLMsr(std::ofstream* dynaml_stream, const string&, bool) const +void CDnaGpsBaseline::WriteDynaMLMsr(std::ofstream* dynaml_stream, const std::string&, bool) const { - *dynaml_stream << " " << m_strFirst << "" << endl; - *dynaml_stream << " " << m_strTarget << "" << endl; + *dynaml_stream << " " << m_strFirst << "" << std::endl; + *dynaml_stream << " " << m_strTarget << "" << std::endl; UINT32 precision = 4; - *dynaml_stream << " " << endl; - *dynaml_stream << " " << fixed << setprecision(precision) << m_dX << "" << endl; - *dynaml_stream << " " << m_dY << "" << endl; - *dynaml_stream << " " << m_dZ << "" << endl; + *dynaml_stream << " " << std::endl; + *dynaml_stream << " " << std::fixed << std::setprecision(precision) << m_dX << "" << std::endl; + *dynaml_stream << " " << m_dY << "" << std::endl; + *dynaml_stream << " " << m_dZ << "" << std::endl; if (m_msr_db_map.is_msr_id_set) - *dynaml_stream << " " << m_msr_db_map.msr_id << "" << endl; + *dynaml_stream << " " << m_msr_db_map.msr_id << "" << std::endl; - *dynaml_stream << " " << scientific << setprecision(13) << m_dSigmaXX << "" << endl; - *dynaml_stream << " " << m_dSigmaXY << "" << endl; - *dynaml_stream << " " << m_dSigmaXZ << "" << endl; - *dynaml_stream << " " << m_dSigmaYY << "" << endl; - *dynaml_stream << " " << m_dSigmaYZ << "" << endl; - *dynaml_stream << " " << m_dSigmaZZ << "" << endl; + *dynaml_stream << " " << std::scientific << std::setprecision(13) << m_dSigmaXX << "" << std::endl; + *dynaml_stream << " " << m_dSigmaXY << "" << std::endl; + *dynaml_stream << " " << m_dSigmaXZ << "" << std::endl; + *dynaml_stream << " " << m_dSigmaYY << "" << std::endl; + *dynaml_stream << " " << m_dSigmaYZ << "" << std::endl; + *dynaml_stream << " " << m_dSigmaZZ << "" << std::endl; // write GPSPoint covariances - vector::const_iterator _it_cov = m_vGpsCovariances.begin(); + std::vector::const_iterator _it_cov = m_vGpsCovariances.begin(); for (; _it_cov!=m_vGpsCovariances.end(); ++_it_cov) _it_cov->WriteDynaMLMsr(dynaml_stream); - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; } void CDnaGpsBaseline::WriteDNAMsr(std::ofstream* dna_stream, const dna_msr_fields& dmw, const dna_msr_fields& dml, bool) const { - *dna_stream << setw(dmw.msr_type) << m_strType; + *dna_stream << std::setw(dmw.msr_type) << m_strType; if (m_bIgnore) - *dna_stream << setw(dmw.msr_ignore) << "*"; + *dna_stream << std::setw(dmw.msr_ignore) << "*"; else - *dna_stream << setw(dmw.msr_ignore) << " "; + *dna_stream << std::setw(dmw.msr_ignore) << " "; - *dna_stream << left << setw(dmw.msr_inst) << m_strFirst; - *dna_stream << left << setw(dmw.msr_targ1) << m_strTarget; + *dna_stream << std::left << std::setw(dmw.msr_inst) << m_strFirst; + *dna_stream << std::left << std::setw(dmw.msr_targ1) << m_strTarget; // Print header for G baseline and first X cluster baseline bool printHeader(true); @@ -267,69 +267,69 @@ void CDnaGpsBaseline::WriteDNAMsr(std::ofstream* dna_stream, const dna_msr_field // print database ids if (m_msr_db_map.is_msr_id_set) - *dna_stream << setw(dml.msr_id_msr - dml.msr_targ2) << " " << - right << setw(dmw.msr_id_msr) << m_msr_db_map.msr_id; + *dna_stream << std::setw(dml.msr_id_msr - dml.msr_targ2) << " " << + std::right << std::setw(dmw.msr_id_msr) << m_msr_db_map.msr_id; if (m_msr_db_map.is_cls_id_set) - *dna_stream << setw(dmw.msr_id_cluster) << m_msr_db_map.cluster_id; + *dna_stream << std::setw(dmw.msr_id_cluster) << m_msr_db_map.cluster_id; } } if (printHeader) { if (GetTypeC() == 'X') - *dna_stream << left << setw(dmw.msr_targ2) << m_lRecordedTotal; + *dna_stream << std::left << std::setw(dmw.msr_targ2) << m_lRecordedTotal; else - *dna_stream << right << setw(dmw.msr_targ2) << " "; + *dna_stream << std::right << std::setw(dmw.msr_targ2) << " "; // print scaling *dna_stream << - fixed << setprecision(2) << - right << setw(dmw.msr_gps_vscale) << double_string_width(m_dVscale, dmw.msr_gps_vscale) << - right << setw(dmw.msr_gps_pscale) << double_string_width(m_dPscale, dmw.msr_gps_vscale) << - right << setw(dmw.msr_gps_lscale) << double_string_width(m_dLscale, dmw.msr_gps_vscale) << - right << setw(dmw.msr_gps_hscale) << double_string_width(m_dHscale, dmw.msr_gps_vscale); + std::fixed << std::setprecision(2) << + std::right << std::setw(dmw.msr_gps_vscale) << double_string_width(m_dVscale, dmw.msr_gps_vscale) << + std::right << std::setw(dmw.msr_gps_pscale) << double_string_width(m_dPscale, dmw.msr_gps_vscale) << + std::right << std::setw(dmw.msr_gps_lscale) << double_string_width(m_dLscale, dmw.msr_gps_vscale) << + std::right << std::setw(dmw.msr_gps_hscale) << double_string_width(m_dHscale, dmw.msr_gps_vscale); // print reference frame and epoch *dna_stream << - right << setw(dmw.msr_gps_reframe) << m_referenceFrame << - right << setw(dmw.msr_gps_epoch) << m_epoch; + std::right << std::setw(dmw.msr_gps_reframe) << m_referenceFrame << + std::right << std::setw(dmw.msr_gps_epoch) << m_epoch; // print database ids if (m_msr_db_map.is_msr_id_set) - *dna_stream << setw(dmw.msr_id_msr) << m_msr_db_map.msr_id; + *dna_stream << std::setw(dmw.msr_id_msr) << m_msr_db_map.msr_id; if (m_msr_db_map.is_cls_id_set) - *dna_stream << setw(dmw.msr_id_cluster) << m_msr_db_map.cluster_id; + *dna_stream << std::setw(dmw.msr_id_cluster) << m_msr_db_map.cluster_id; } - *dna_stream << endl; + *dna_stream << std::endl; UINT32 pad(dmw.msr_type + dmw.msr_ignore + dmw.msr_inst + dmw.msr_targ1 + dmw.msr_targ2); // X - *dna_stream << setw(pad) << " "; - *dna_stream << right << setw(dmw.msr_gps) << fixed << setprecision(4) << m_dX; - *dna_stream << right << setw(dmw.msr_gps_vcv_1) << scientific << setprecision(13) << m_dSigmaXX; - *dna_stream << endl; + *dna_stream << std::setw(pad) << " "; + *dna_stream << std::right << std::setw(dmw.msr_gps) << std::fixed << std::setprecision(4) << m_dX; + *dna_stream << std::right << std::setw(dmw.msr_gps_vcv_1) << std::scientific << std::setprecision(13) << m_dSigmaXX; + *dna_stream << std::endl; // Y - *dna_stream << setw(pad) << " "; - *dna_stream << right << setw(dmw.msr_gps) << fixed << setprecision(4) << m_dY; + *dna_stream << std::setw(pad) << " "; + *dna_stream << std::right << std::setw(dmw.msr_gps) << std::fixed << std::setprecision(4) << m_dY; *dna_stream << - right << setw(dmw.msr_gps_vcv_1) << scientific << setprecision(13) << m_dSigmaXY << - right << setw(dmw.msr_gps_vcv_2) << m_dSigmaYY; - *dna_stream << endl; + std::right << std::setw(dmw.msr_gps_vcv_1) << std::scientific << std::setprecision(13) << m_dSigmaXY << + std::right << std::setw(dmw.msr_gps_vcv_2) << m_dSigmaYY; + *dna_stream << std::endl; // Z - *dna_stream << setw(pad) << " "; - *dna_stream << right << setw(dmw.msr_gps) << fixed << setprecision(4) << m_dZ; + *dna_stream << std::setw(pad) << " "; + *dna_stream << std::right << std::setw(dmw.msr_gps) << std::fixed << std::setprecision(4) << m_dZ; *dna_stream << - right << setw(dmw.msr_gps_vcv_1) << scientific << setprecision(13) << m_dSigmaXZ << - right << setw(dmw.msr_gps_vcv_2) << m_dSigmaYZ << - right << setw(dmw.msr_gps_vcv_3) << m_dSigmaZZ; - *dna_stream << endl; + std::right << std::setw(dmw.msr_gps_vcv_1) << std::scientific << std::setprecision(13) << m_dSigmaXZ << + std::right << std::setw(dmw.msr_gps_vcv_2) << m_dSigmaYZ << + std::right << std::setw(dmw.msr_gps_vcv_3) << m_dSigmaZZ; + *dna_stream << std::endl; // write GPSBaseline covariances (not supported by DNA format) - vector::const_iterator _it_cov = m_vGpsCovariances.begin(); + std::vector::const_iterator _it_cov = m_vGpsCovariances.begin(); for (_it_cov=m_vGpsCovariances.begin(); _it_cov!=m_vGpsCovariances.end(); ++_it_cov) _it_cov->WriteDNAMsr(dna_stream, dmw, dml); } @@ -348,7 +348,7 @@ void CDnaGpsBaseline::SimulateMsr(vdnaStnPtr* vStations, const CDnaEllipsoid* el m_dSigmaYZ = -2.035E-05; m_dSigmaZZ = 6.803E-05; - vector::iterator _it_cov = m_vGpsCovariances.begin(); + std::vector::iterator _it_cov = m_vGpsCovariances.begin(); for (_it_cov=m_vGpsCovariances.begin(); _it_cov!=m_vGpsCovariances.end(); ++_it_cov) _it_cov->SimulateMsr(vStations, ellipsoid); } @@ -371,7 +371,7 @@ UINT32 CDnaGpsBaseline::SetMeasurementRec(const vstn_t& binaryStn, it_vmsr_t& it m_epoch = it_msr->epoch; m_epsgCode = it_msr->epsgCode; - m_referenceFrame = datumFromEpsgString(it_msr->epsgCode); + m_referenceFrame = datumFromEpsgString(it_msr->epsgCode); m_lclusterID = it_msr->clusterID; m_MSmeasurementStations = (MEASUREMENT_STATIONS)it_msr->measurementStations; @@ -405,7 +405,7 @@ UINT32 CDnaGpsBaseline::SetMeasurementRec(const vstn_t& binaryStn, it_vmsr_t& it dbidmap += (it_msr->vectorCount2 * 3); // now covariances - vector::iterator _it_cov = m_vGpsCovariances.begin(); + std::vector::iterator _it_cov = m_vGpsCovariances.begin(); for (; _it_cov!=m_vGpsCovariances.end(); ++_it_cov) _it_cov->SetMeasurementRec(binaryStn, it_msr); @@ -480,7 +480,7 @@ void CDnaGpsBaseline::WriteBinaryMsr(std::ofstream* binary_stream, PUINT32 msrIn binary_stream->write(reinterpret_cast(&measRecord), sizeof(measurement_t)); // now write covariance elements - vector::const_iterator _it_cov; + std::vector::const_iterator _it_cov; for (_it_cov=m_vGpsCovariances.begin(); _it_cov!=m_vGpsCovariances.end(); ++_it_cov) _it_cov->WriteBinaryMsr(binary_stream, msrIndex, m_epsgCode, m_epoch); } @@ -504,96 +504,96 @@ void CDnaGpsBaseline::SerialiseDatabaseMap(std::ofstream* os) -void CDnaGpsBaseline::SetX(const string& str) +void CDnaGpsBaseline::SetX(const std::string& str) { DoubleFromString(m_dX, trimstr(str)); } -void CDnaGpsBaseline::SetY(const string& str) +void CDnaGpsBaseline::SetY(const std::string& str) { DoubleFromString(m_dY, trimstr(str)); } -void CDnaGpsBaseline::SetZ(const string& str) +void CDnaGpsBaseline::SetZ(const std::string& str) { DoubleFromString(m_dZ, trimstr(str)); } -void CDnaGpsBaseline::SetSigmaXX(const string& str) +void CDnaGpsBaseline::SetSigmaXX(const std::string& str) { if (DoubleFromString_ZeroCheck(m_dSigmaXX, trimstr(str))) { - stringstream ss; + std::stringstream ss; ss << "SetSigmaXX(): Variances cannot be zero: " << str << "."; throw XMLInteropException(ss.str(), 0); } } -void CDnaGpsBaseline::SetSigmaXY(const string& str) +void CDnaGpsBaseline::SetSigmaXY(const std::string& str) { DoubleFromString(m_dSigmaXY, trimstr(str)); } -void CDnaGpsBaseline::SetSigmaXZ(const string& str) +void CDnaGpsBaseline::SetSigmaXZ(const std::string& str) { DoubleFromString(m_dSigmaXZ, trimstr(str)); } -void CDnaGpsBaseline::SetSigmaYY(const string& str) +void CDnaGpsBaseline::SetSigmaYY(const std::string& str) { if (DoubleFromString_ZeroCheck(m_dSigmaYY, trimstr(str))) { - stringstream ss; + std::stringstream ss; ss << "SetSigmaYY(): Variances cannot be zero: " << str << "."; throw XMLInteropException(ss.str(), 0); } } -void CDnaGpsBaseline::SetSigmaYZ(const string& str) +void CDnaGpsBaseline::SetSigmaYZ(const std::string& str) { DoubleFromString(m_dSigmaYZ, trimstr(str)); } -void CDnaGpsBaseline::SetSigmaZZ(const string& str) +void CDnaGpsBaseline::SetSigmaZZ(const std::string& str) { if (DoubleFromString_ZeroCheck(m_dSigmaZZ, trimstr(str))) { - stringstream ss; + std::stringstream ss; ss << "SetSigmaZZ(): Variances cannot be zero: " << str << "."; throw XMLInteropException(ss.str(), 0); } } -void CDnaGpsBaseline::SetEpsg(const string& epsg) +void CDnaGpsBaseline::SetEpsg(const std::string& epsg) { m_epsgCode = epsg; } -void CDnaGpsBaseline::SetReferenceFrame(const string& refFrame) +void CDnaGpsBaseline::SetReferenceFrame(const std::string& refFrame) { m_referenceFrame = refFrame; - SetEpsg(epsgStringFromName(refFrame)); + SetEpsg(epsgStringFromName(refFrame)); } -void CDnaGpsBaseline::SetPscale(const string& str) +void CDnaGpsBaseline::SetPscale(const std::string& str) { DoubleFromString(m_dPscale, trimstr(str)); } -void CDnaGpsBaseline::SetLscale(const string& str) +void CDnaGpsBaseline::SetLscale(const std::string& str) { DoubleFromString(m_dLscale, trimstr(str)); } -void CDnaGpsBaseline::SetHscale(const string& str) +void CDnaGpsBaseline::SetHscale(const std::string& str) { DoubleFromString(m_dHscale, trimstr(str)); } -void CDnaGpsBaseline::SetVscale(const string& str) +void CDnaGpsBaseline::SetVscale(const std::string& str) { DoubleFromString(m_dVscale, trimstr(str)); } @@ -617,7 +617,7 @@ CDnaGpsBaselineCluster::CDnaGpsBaselineCluster(void) , m_lclusterID(0) { SetEpoch(DEFAULT_EPOCH); - SetEpsg(epsgStringFromName(m_referenceFrame)); + SetEpsg(epsgStringFromName(m_referenceFrame)); m_vGpsBaselines.clear(); m_vGpsBaselines.reserve(1); @@ -690,7 +690,7 @@ CDnaGpsBaselineCluster& CDnaGpsBaselineCluster::operator= (CDnaGpsBaselineCluste } -CDnaGpsBaselineCluster::CDnaGpsBaselineCluster(const UINT32 lclusterID, const string& referenceframe, const string& epoch) +CDnaGpsBaselineCluster::CDnaGpsBaselineCluster(const UINT32 lclusterID, const std::string& referenceframe, const std::string& epoch) : m_strTarget("") , m_lRecordedTotal(1) , m_dPscale(1.) @@ -701,7 +701,7 @@ CDnaGpsBaselineCluster::CDnaGpsBaselineCluster(const UINT32 lclusterID, const st , m_lclusterID(lclusterID) { SetEpoch(epoch); - SetEpsg(epsgStringFromName(referenceframe)); + SetEpsg(epsgStringFromName(referenceframe)); m_vGpsBaselines.clear(); m_vGpsBaselines.reserve(1); @@ -723,7 +723,7 @@ bool CDnaGpsBaselineCluster::operator== (const CDnaGpsBaselineCluster& rhs) cons m_dHscale == rhs.m_dHscale && m_dVscale == rhs.m_dVscale && m_vGpsBaselines == rhs.m_vGpsBaselines && - iequals(m_referenceFrame, rhs.m_referenceFrame) && + boost::iequals(m_referenceFrame, rhs.m_referenceFrame) && m_epoch == rhs.m_epoch ); } @@ -805,58 +805,58 @@ UINT32 CDnaGpsBaselineCluster::CalcBinaryRecordCount() const } -void CDnaGpsBaselineCluster::WriteDynaMLMsr(std::ofstream* dynaml_stream, const string& comment, bool) const +void CDnaGpsBaselineCluster::WriteDynaMLMsr(std::ofstream* dynaml_stream, const std::string& comment, bool) const { const size_t bslCount = m_vGpsBaselines.size(); char cType = GetTypeC(); if (comment.empty()) { - *dynaml_stream << " " << endl; + *dynaml_stream << " -->" << std::endl; } else - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; - *dynaml_stream << " " << endl; - *dynaml_stream << " " << cType << "" << endl; + *dynaml_stream << " " << std::endl; + *dynaml_stream << " " << cType << "" << std::endl; // Source file from which the measurement came - *dynaml_stream << " " << m_sourceFile << "" << endl; + *dynaml_stream << " " << m_sourceFile << "" << std::endl; if (m_bIgnore) - *dynaml_stream << " *" << endl; + *dynaml_stream << " *" << std::endl; else - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; // Reference frame and epoch - *dynaml_stream << " " << m_referenceFrame << "" << endl; - *dynaml_stream << " " << m_epoch << "" << endl; + *dynaml_stream << " " << m_referenceFrame << "" << std::endl; + *dynaml_stream << " " << m_epoch << "" << std::endl; // Scalars - *dynaml_stream << " " << fixed << setprecision(3) << m_dVscale << "" << endl; - *dynaml_stream << " " << m_dPscale << "" << endl; - *dynaml_stream << " " << m_dLscale << "" << endl; - *dynaml_stream << " " << m_dHscale << "" << endl; + *dynaml_stream << " " << std::fixed << std::setprecision(3) << m_dVscale << "" << std::endl; + *dynaml_stream << " " << m_dPscale << "" << std::endl; + *dynaml_stream << " " << m_dLscale << "" << std::endl; + *dynaml_stream << " " << m_dHscale << "" << std::endl; if (m_msr_db_map.is_cls_id_set) - *dynaml_stream << " " << m_msr_db_map.cluster_id << "" << endl; + *dynaml_stream << " " << m_msr_db_map.cluster_id << "" << std::endl; // baseline count if (cType == 'X') - *dynaml_stream << " " << bslCount << "" << endl; + *dynaml_stream << " " << bslCount << "" << std::endl; // write GpsBaselines - vector::const_iterator _it_bsl; + std::vector::const_iterator _it_bsl; for (_it_bsl=m_vGpsBaselines.begin(); _it_bsl!=m_vGpsBaselines.end(); ++_it_bsl) _it_bsl->WriteDynaMLMsr(dynaml_stream, comment, true); - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; } @@ -864,7 +864,7 @@ void CDnaGpsBaselineCluster::WriteDynaMLMsr(std::ofstream* dynaml_stream, const void CDnaGpsBaselineCluster::WriteDNAMsr(std::ofstream* dna_stream, const dna_msr_fields& dmw, const dna_msr_fields& dml, bool) const { // write GpsBaselines - vector::const_iterator _it_bsl; + std::vector::const_iterator _it_bsl; for (_it_bsl=m_vGpsBaselines.begin(); _it_bsl!=m_vGpsBaselines.end(); ++_it_bsl) _it_bsl->WriteDNAMsr(dna_stream, dmw, dml, true); } @@ -872,7 +872,7 @@ void CDnaGpsBaselineCluster::WriteDNAMsr(std::ofstream* dna_stream, const dna_ms void CDnaGpsBaselineCluster::SimulateMsr(vdnaStnPtr* vStations, const CDnaEllipsoid* ellipsoid) { - vector::iterator _it_bsl; + std::vector::iterator _it_bsl; for (_it_bsl=m_vGpsBaselines.begin(); _it_bsl!=m_vGpsBaselines.end(); ++_it_bsl) _it_bsl->SimulateMsr(vStations, ellipsoid); } @@ -886,7 +886,7 @@ UINT32 CDnaGpsBaselineCluster::SetMeasurementRec(const vstn_t& binaryStn, it_vms m_vGpsBaselines.clear(); m_vGpsBaselines.resize(m_lRecordedTotal); - m_referenceFrame = datumFromEpsgString(it_msr->epsgCode); + m_referenceFrame = datumFromEpsgString(it_msr->epsgCode); m_epoch = it_msr->epoch; m_epsgCode = it_msr->epsgCode; @@ -918,49 +918,49 @@ UINT32 CDnaGpsBaselineCluster::SetMeasurementRec(const vstn_t& binaryStn, it_vms void CDnaGpsBaselineCluster::WriteBinaryMsr(std::ofstream* binary_stream, PUINT32 msrIndex) const { - vector::const_iterator _it_bsl; + std::vector::const_iterator _it_bsl; for (_it_bsl=m_vGpsBaselines.begin(); _it_bsl!=m_vGpsBaselines.end(); ++_it_bsl) _it_bsl->WriteBinaryMsr(binary_stream, msrIndex); } -void CDnaGpsBaselineCluster::SetEpsg(const string& epsg) +void CDnaGpsBaselineCluster::SetEpsg(const std::string& epsg) { // m_epsgCode is a member of CDnaMeasurement m_epsgCode = epsg; } -void CDnaGpsBaselineCluster::SetReferenceFrame(const string& refFrame) +void CDnaGpsBaselineCluster::SetReferenceFrame(const std::string& refFrame) { // m_referenceFrame is a member of CDnaGpsBaselineCluster m_referenceFrame = refFrame; - SetEpsg(epsgStringFromName(refFrame)); + SetEpsg(epsgStringFromName(refFrame)); } -void CDnaGpsBaselineCluster::SetTotal(const string& str) +void CDnaGpsBaselineCluster::SetTotal(const std::string& str) { m_lRecordedTotal = LongFromString(trimstr(str)); m_vGpsBaselines.reserve(m_lRecordedTotal); } -void CDnaGpsBaselineCluster::SetPscale(const string& str) +void CDnaGpsBaselineCluster::SetPscale(const std::string& str) { DoubleFromString(m_dPscale, trimstr(str)); } -void CDnaGpsBaselineCluster::SetLscale(const string& str) +void CDnaGpsBaselineCluster::SetLscale(const std::string& str) { DoubleFromString(m_dLscale, trimstr(str)); } -void CDnaGpsBaselineCluster::SetHscale(const string& str) +void CDnaGpsBaselineCluster::SetHscale(const std::string& str) { DoubleFromString(m_dHscale, trimstr(str)); } -void CDnaGpsBaselineCluster::SetVscale(const string& str) +void CDnaGpsBaselineCluster::SetVscale(const std::string& str) { DoubleFromString(m_dVscale, trimstr(str)); } diff --git a/dynadjust/include/measurement_types/dnagpsbaseline.hpp b/dynadjust/include/measurement_types/dnagpsbaseline.hpp index df69cb66..7403314f 100644 --- a/dynadjust/include/measurement_types/dnagpsbaseline.hpp +++ b/dynadjust/include/measurement_types/dnagpsbaseline.hpp @@ -32,8 +32,6 @@ #include -using namespace std; - namespace dynadjust { namespace measurements { @@ -53,7 +51,7 @@ class CDnaGpsBaseline : public CDnaMeasurement //CDnaGpsBaseline& operator=(const CDnaGpsBaseline& rhs); public: - //CDnaGpsBaseline(const bool bIgnore, const string& strType, const string& strFirstStation, const string& strSecondStation); + //CDnaGpsBaseline(const bool bIgnore, const std::string& strType, const std::string& strFirstStation, const std::string& strSecondStation); //virtual inline CDnaGpsBaseline* clone() const { return new CDnaGpsBaseline(*this); } bool operator==(const CDnaGpsBaseline& rhs) const; @@ -62,8 +60,8 @@ class CDnaGpsBaseline : public CDnaMeasurement //inline CDnaGpsBaseline& operator[](int iIndex) { return this[iIndex]; } inline UINT32 GetClusterID() const { return m_lclusterID; } - inline string GetTarget() const { return m_strTarget; } - inline vector* GetCovariances_ptr() { return &m_vGpsCovariances; } + inline std::string GetTarget() const { return m_strTarget; } + inline std::vector* GetCovariances_ptr() { return &m_vGpsCovariances; } void AddGpsCovariance(const CDnaCovariance* pGpsCovariance); @@ -71,27 +69,27 @@ class CDnaGpsBaseline : public CDnaMeasurement void ResizeGpsCovariancesCount(const UINT32& size = 0); inline void SetClusterID(const UINT32& id) { m_lclusterID = id; } - inline void SetTarget(const string& str) { m_strTarget = trimstr(str); } - void SetX(const string& str); - void SetY(const string& str); - void SetZ(const string& str); - void SetSigmaXX(const string& str); - void SetSigmaXY(const string& str); - void SetSigmaXZ(const string& str); - void SetSigmaYY(const string& str); - void SetSigmaYZ(const string& str); - void SetSigmaZZ(const string& str); + inline void SetTarget(const std::string& str) { m_strTarget = trimstr(str); } + void SetX(const std::string& str); + void SetY(const std::string& str); + void SetZ(const std::string& str); + void SetSigmaXX(const std::string& str); + void SetSigmaXY(const std::string& str); + void SetSigmaXZ(const std::string& str); + void SetSigmaYY(const std::string& str); + void SetSigmaYZ(const std::string& str); + void SetSigmaZZ(const std::string& str); - void SetReferenceFrame(const string& refFrame); - //void SetEpoch(const string& epoch); //moved to CDnaMeasurement - void SetEpsg(const string& epsg); - inline string GetReferenceFrame() const { return m_referenceFrame; } - //inline string GetEpoch() const { return m_epoch; } // moved to CDnaMeasurement + void SetReferenceFrame(const std::string& refFrame); + //void SetEpoch(const std::string& epoch); //moved to CDnaMeasurement + void SetEpsg(const std::string& epsg); + inline std::string GetReferenceFrame() const { return m_referenceFrame; } + //inline std::string GetEpoch() const { return m_epoch; } // moved to CDnaMeasurement - void SetPscale(const string& str); - void SetLscale(const string& str); - void SetHscale(const string& str); - void SetVscale(const string& str); + void SetPscale(const std::string& str); + void SetLscale(const std::string& str); + void SetHscale(const std::string& str); + void SetVscale(const std::string& str); inline void SetPscale(const double& dbl) { m_dPscale = dbl; } inline void SetLscale(const double& dbl) { m_dLscale = dbl; } @@ -102,16 +100,16 @@ class CDnaGpsBaseline : public CDnaMeasurement inline void SetTotal(const UINT32& l) { m_lRecordedTotal = l; } virtual UINT32 CalcBinaryRecordCount() const; - //void coutBaselineData(ostream &os, const int& pad, const UINT16& uType = 0) const; + //void coutBaselineData(std::ostream &os, const int& pad, const UINT16& uType = 0) const; virtual void WriteBinaryMsr(std::ofstream* binary_stream, PUINT32 msrIndex) const; virtual UINT32 SetMeasurementRec(const vstn_t& binaryStn, it_vmsr_t& it_msr, it_vdbid_t& dbidmap); - virtual void WriteDynaMLMsr(std::ofstream* dynaml_stream, const string& comment, bool) const; + virtual void WriteDynaMLMsr(std::ofstream* dynaml_stream, const std::string& comment, bool) const; virtual void WriteDNAMsr(std::ofstream* dna_stream, const dna_msr_fields& dmw, const dna_msr_fields& dml, bool) const; virtual void SimulateMsr(vdnaStnPtr* vStations, const CDnaEllipsoid* ellipsoid); virtual void SerialiseDatabaseMap(std::ofstream* os); - string m_strTarget; + std::string m_strTarget; inline double GetVscale() const { return m_dVscale; } inline double GetPscale() const { return m_dPscale; } @@ -139,12 +137,12 @@ class CDnaGpsBaseline : public CDnaMeasurement double m_dHscale; double m_dVscale; - string m_referenceFrame; + std::string m_referenceFrame; //string m_epoch; UINT32 m_lclusterID; - vector m_vGpsCovariances; + std::vector m_vGpsCovariances; }; // used for Type G or X @@ -164,8 +162,8 @@ class CDnaGpsBaselineCluster : public CDnaMeasurement CDnaGpsBaselineCluster& operator=(const CDnaGpsBaselineCluster& rhs); public: - //CDnaGpsBaselineCluster(const bool bIgnore, const string& strType, const string& strFirstStation); - CDnaGpsBaselineCluster(const UINT32 lclusterID, const string& referenceframe, const string& epoch); + //CDnaGpsBaselineCluster(const bool bIgnore, const std::string& strType, const std::string& strFirstStation); + CDnaGpsBaselineCluster(const UINT32 lclusterID, const std::string& referenceframe, const std::string& epoch); //virtual inline CDnaGpsBaselineCluster* clone() const { return new CDnaGpsBaselineCluster(*this); } bool operator==(const CDnaGpsBaselineCluster& rhs) const; @@ -174,31 +172,31 @@ class CDnaGpsBaselineCluster : public CDnaMeasurement //inline CDnaGpsBaselineCluster& operator[](int iIndex) { return this[iIndex]; } //inline UINT32 GetNumBaselinens() { return m_vGpsBaselines.size(); } - inline vector& GetBaselines() { return m_vGpsBaselines; } - inline vector* GetBaselines_ptr() { return &m_vGpsBaselines; } + inline std::vector& GetBaselines() { return m_vGpsBaselines; } + inline std::vector* GetBaselines_ptr() { return &m_vGpsBaselines; } inline UINT32 GetClusterID() const { return m_lclusterID; } - inline string GetTarget() const { return m_strTarget; } + inline std::string GetTarget() const { return m_strTarget; } inline UINT32 GetTotal() const { return m_lRecordedTotal; } inline double GetPscale() const { return m_dPscale; } inline double GetLscale() const { return m_dLscale; } inline double GetHscale() const { return m_dHscale; } inline double GetVscale() const { return m_dVscale; } - void SetReferenceFrame(const string& refFrame); - //void SetEpoch(const string& epoch); - void SetEpsg(const string& epsg); - inline string GetReferenceFrame() const { return m_referenceFrame; } - //inline string GetEpoch() const { return m_epoch; } + void SetReferenceFrame(const std::string& refFrame); + //void SetEpoch(const std::string& epoch); + void SetEpsg(const std::string& epsg); + inline std::string GetReferenceFrame() const { return m_referenceFrame; } + //inline std::string GetEpoch() const { return m_epoch; } - inline void SetTarget(const string& str) { m_strTarget = trimstr(str); } + inline void SetTarget(const std::string& str) { m_strTarget = trimstr(str); } inline void SetTotal(const UINT32& l) { m_lRecordedTotal = l; } - void SetTotal(const string& str); - void SetPscale(const string& str); - void SetLscale(const string& str); - void SetHscale(const string& str); - void SetVscale(const string& str); + void SetTotal(const std::string& str); + void SetPscale(const std::string& str); + void SetLscale(const std::string& str); + void SetHscale(const std::string& str); + void SetVscale(const std::string& str); inline void SetPscale(const double& dbl) { m_dPscale = dbl; } inline void SetLscale(const double& dbl) { m_dLscale = dbl; } @@ -214,7 +212,7 @@ class CDnaGpsBaselineCluster : public CDnaMeasurement virtual UINT32 CalcBinaryRecordCount() const; virtual void WriteBinaryMsr(std::ofstream* binary_stream, PUINT32 msrIndex) const; virtual UINT32 SetMeasurementRec(const vstn_t& binaryStn, it_vmsr_t& it_msr, it_vdbid_t& dbidmap); - virtual void WriteDynaMLMsr(std::ofstream* dynaml_stream, const string& comment, bool) const; + virtual void WriteDynaMLMsr(std::ofstream* dynaml_stream, const std::string& comment, bool) const; virtual void WriteDNAMsr(std::ofstream* dna_stream, const dna_msr_fields& dmw, const dna_msr_fields& dml, bool) const; virtual void SimulateMsr(vdnaStnPtr* vStations, const CDnaEllipsoid* ellipsoid); @@ -224,17 +222,17 @@ class CDnaGpsBaselineCluster : public CDnaMeasurement protected: - string m_strTarget; + std::string m_strTarget; UINT32 m_lRecordedTotal; double m_dPscale; double m_dLscale; double m_dHscale; double m_dVscale; - vector m_vGpsBaselines; + std::vector m_vGpsBaselines; - string m_referenceFrame; - //string m_epoch; + std::string m_referenceFrame; + //std::string m_epoch; UINT32 m_lclusterID; diff --git a/dynadjust/include/measurement_types/dnagpspoint.cpp b/dynadjust/include/measurement_types/dnagpspoint.cpp index 4f0bdef2..81a05c86 100644 --- a/dynadjust/include/measurement_types/dnagpspoint.cpp +++ b/dynadjust/include/measurement_types/dnagpspoint.cpp @@ -53,7 +53,7 @@ CDnaGpsPoint::CDnaGpsPoint(void) { SetEpoch(DEFAULT_EPOCH); - SetEpsg(epsgStringFromName(m_referenceFrame)); + SetEpsg(epsgStringFromName(m_referenceFrame)); m_vPointCovariances.clear(); m_vPointCovariances.reserve(0); @@ -155,7 +155,7 @@ bool CDnaGpsPoint::operator== (const CDnaGpsPoint& rhs) const fabs(m_dX - rhs.m_dX) < PRECISION_1E4 && fabs(m_dY - rhs.m_dY) < PRECISION_1E4 && fabs(m_dZ - rhs.m_dZ) < PRECISION_1E4 && - iequals(m_referenceFrame, rhs.m_referenceFrame) + boost::iequals(m_referenceFrame, rhs.m_referenceFrame) ); } @@ -198,7 +198,7 @@ void CDnaGpsPoint::ResizeGpsCovariancesCount(const UINT32& size) } -void CDnaGpsPoint::SetCoordType(const string& sType) { +void CDnaGpsPoint::SetCoordType(const std::string& sType) { m_strCoordType = trimstr(sType); m_ctType = GetMyCoordTypeC(); } @@ -219,145 +219,145 @@ void CDnaGpsPoint::AddPointCovariance(const CDnaCovariance* pGpsCovariance) UINT32 CDnaGpsPoint::CalcBinaryRecordCount() const { UINT32 RecordCount = 3; - vector::const_iterator _it_cov = m_vPointCovariances.begin(); + std::vector::const_iterator _it_cov = m_vPointCovariances.begin(); for (; _it_cov!=m_vPointCovariances.end(); ++_it_cov) RecordCount += _it_cov->CalcBinaryRecordCount(); return RecordCount; } -void CDnaGpsPoint::WriteDynaMLMsr(std::ofstream* dynaml_stream, const string&, bool) const +void CDnaGpsPoint::WriteDynaMLMsr(std::ofstream* dynaml_stream, const std::string&, bool) const { UINT32 precision(4); - *dynaml_stream << " " << m_strFirst << "" << endl; - *dynaml_stream << " " << endl; + *dynaml_stream << " " << m_strFirst << "" << std::endl; + *dynaml_stream << " " << std::endl; if (m_ctType == LLH_type_i || m_ctType == LLh_type_i) { precision = 10; - *dynaml_stream << " " << fixed << setprecision(precision) << RadtoDms(m_dX) << "" << endl; - *dynaml_stream << " " << RadtoDmsL(m_dY) << "" << endl; + *dynaml_stream << " " << std::fixed << std::setprecision(precision) << RadtoDms(m_dX) << "" << std::endl; + *dynaml_stream << " " << RadtoDmsL(m_dY) << "" << std::endl; } else { - *dynaml_stream << " " << fixed << setprecision(precision) << m_dX << "" << endl; - *dynaml_stream << " " << m_dY << "" << endl; + *dynaml_stream << " " << std::fixed << std::setprecision(precision) << m_dX << "" << std::endl; + *dynaml_stream << " " << m_dY << "" << std::endl; } - *dynaml_stream << " " << setprecision(4) << m_dZ << "" << endl; + *dynaml_stream << " " << std::setprecision(4) << m_dZ << "" << std::endl; if (m_msr_db_map.is_msr_id_set) - *dynaml_stream << " " << m_msr_db_map.msr_id << "" << endl; + *dynaml_stream << " " << m_msr_db_map.msr_id << "" << std::endl; - *dynaml_stream << " " << scientific << setprecision(13) << m_dSigmaXX << "" << endl; - *dynaml_stream << " " << m_dSigmaXY << "" << endl; - *dynaml_stream << " " << m_dSigmaXZ << "" << endl; - *dynaml_stream << " " << m_dSigmaYY << "" << endl; - *dynaml_stream << " " << m_dSigmaYZ << "" << endl; - *dynaml_stream << " " << m_dSigmaZZ << "" << endl; + *dynaml_stream << " " << std::scientific << std::setprecision(13) << m_dSigmaXX << "" << std::endl; + *dynaml_stream << " " << m_dSigmaXY << "" << std::endl; + *dynaml_stream << " " << m_dSigmaXZ << "" << std::endl; + *dynaml_stream << " " << m_dSigmaYY << "" << std::endl; + *dynaml_stream << " " << m_dSigmaYZ << "" << std::endl; + *dynaml_stream << " " << m_dSigmaZZ << "" << std::endl; // write GPSPoint covariances - vector::const_iterator _it_cov = m_vPointCovariances.begin(); + std::vector::const_iterator _it_cov = m_vPointCovariances.begin(); for (; _it_cov!=m_vPointCovariances.end(); ++_it_cov) _it_cov->WriteDynaMLMsr(dynaml_stream); - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; } void CDnaGpsPoint::WriteDNAMsr(std::ofstream* dna_stream, const dna_msr_fields& dmw, const dna_msr_fields& dml, bool) const { - *dna_stream << setw(dmw.msr_type) << m_strType; + *dna_stream << std::setw(dmw.msr_type) << m_strType; if (m_bIgnore) - *dna_stream << setw(dmw.msr_ignore) << "*"; + *dna_stream << std::setw(dmw.msr_ignore) << "*"; else - *dna_stream << setw(dmw.msr_ignore) << " "; + *dna_stream << std::setw(dmw.msr_ignore) << " "; - *dna_stream << left << setw(dmw.msr_inst) << m_strFirst; + *dna_stream << std::left << std::setw(dmw.msr_inst) << m_strFirst; // Print header for first cluster point if (m_lRecordedTotal == m_vPointCovariances.size() + 1) { if (m_ctType == LLH_type_i) - *dna_stream << left << setw(dmw.msr_targ1) << LLH_type; + *dna_stream << std::left << std::setw(dmw.msr_targ1) << LLH_type; else if (m_ctType == LLh_type_i) - *dna_stream << left << setw(dmw.msr_targ1) << LLh_type; + *dna_stream << std::left << std::setw(dmw.msr_targ1) << LLh_type; else - *dna_stream << left << setw(dmw.msr_targ1) << XYZ_type; + *dna_stream << std::left << std::setw(dmw.msr_targ1) << XYZ_type; - *dna_stream << left << setw(dmw.msr_targ2) << m_lRecordedTotal; + *dna_stream << std::left << std::setw(dmw.msr_targ2) << m_lRecordedTotal; // print scaling *dna_stream << - fixed << setprecision(2) << - right << setw(dmw.msr_gps_vscale) << double_string_width(m_dVscale, dmw.msr_gps_vscale) << - right << setw(dmw.msr_gps_pscale) << double_string_width(m_dPscale, dmw.msr_gps_vscale) << - right << setw(dmw.msr_gps_lscale) << double_string_width(m_dLscale, dmw.msr_gps_vscale) << - right << setw(dmw.msr_gps_hscale) << double_string_width(m_dHscale, dmw.msr_gps_vscale); + std::fixed << std::setprecision(2) << + std::right << std::setw(dmw.msr_gps_vscale) << double_string_width(m_dVscale, dmw.msr_gps_vscale) << + std::right << std::setw(dmw.msr_gps_pscale) << double_string_width(m_dPscale, dmw.msr_gps_vscale) << + std::right << std::setw(dmw.msr_gps_lscale) << double_string_width(m_dLscale, dmw.msr_gps_vscale) << + std::right << std::setw(dmw.msr_gps_hscale) << double_string_width(m_dHscale, dmw.msr_gps_vscale); // print reference frame and epoch *dna_stream << - right << setw(dmw.msr_gps_reframe) << m_referenceFrame << - right << setw(dmw.msr_gps_epoch) << m_epoch; + std::right << std::setw(dmw.msr_gps_reframe) << m_referenceFrame << + std::right << std::setw(dmw.msr_gps_epoch) << m_epoch; // print database ids if (m_msr_db_map.is_msr_id_set) - *dna_stream << setw(dmw.msr_id_msr) << m_msr_db_map.msr_id; + *dna_stream << std::setw(dmw.msr_id_msr) << m_msr_db_map.msr_id; if (m_msr_db_map.is_cls_id_set) - *dna_stream << setw(dmw.msr_id_cluster) << m_msr_db_map.cluster_id; + *dna_stream << std::setw(dmw.msr_id_cluster) << m_msr_db_map.cluster_id; } else { // print database ids if (m_msr_db_map.is_msr_id_set) - *dna_stream << setw(dml.msr_id_msr - dml.msr_targ1) << " " << - right << setw(dmw.msr_id_msr) << m_msr_db_map.msr_id; + *dna_stream << std::setw(dml.msr_id_msr - dml.msr_targ1) << " " << + std::right << std::setw(dmw.msr_id_msr) << m_msr_db_map.msr_id; if (m_msr_db_map.is_cls_id_set) - *dna_stream << setw(dmw.msr_id_cluster) << m_msr_db_map.cluster_id; + *dna_stream << std::setw(dmw.msr_id_cluster) << m_msr_db_map.cluster_id; } - *dna_stream << endl; + *dna_stream << std::endl; UINT32 precision = 4; UINT32 pad(dmw.msr_type + dmw.msr_ignore + dmw.msr_inst + dmw.msr_targ1 + dmw.msr_targ2); // X - *dna_stream << setw(pad) << " "; + *dna_stream << std::setw(pad) << " "; if (m_ctType == LLH_type_i || m_ctType == LLh_type_i) { precision = 13; - *dna_stream << right << setw(dmw.msr_gps) << fixed << setprecision(precision) << RadtoDms(m_dX); + *dna_stream << std::right << std::setw(dmw.msr_gps) << std::fixed << std::setprecision(precision) << RadtoDms(m_dX); } else - *dna_stream << right << setw(dmw.msr_gps) << fixed << setprecision(precision) << m_dX; + *dna_stream << std::right << std::setw(dmw.msr_gps) << std::fixed << std::setprecision(precision) << m_dX; - *dna_stream << right << setw(dmw.msr_gps_vcv_1) << scientific << setprecision(13) << m_dSigmaXX; - *dna_stream << endl; + *dna_stream << std::right << std::setw(dmw.msr_gps_vcv_1) << std::scientific << std::setprecision(13) << m_dSigmaXX; + *dna_stream << std::endl; // Y - *dna_stream << setw(pad) << " "; + *dna_stream << std::setw(pad) << " "; if (m_ctType == LLH_type_i || m_ctType == LLh_type_i) - *dna_stream << right << setw(dmw.msr_gps) << fixed << setprecision(precision) << RadtoDmsL(m_dY); + *dna_stream << std::right << std::setw(dmw.msr_gps) << std::fixed << std::setprecision(precision) << RadtoDmsL(m_dY); else - *dna_stream << right << setw(dmw.msr_gps) << fixed << setprecision(precision) << m_dY; + *dna_stream << std::right << std::setw(dmw.msr_gps) << std::fixed << std::setprecision(precision) << m_dY; *dna_stream << - right << setw(dmw.msr_gps_vcv_1) << scientific << setprecision(13) << m_dSigmaXY << - right << setw(dmw.msr_gps_vcv_2) << m_dSigmaYY; - *dna_stream << endl; + std::right << std::setw(dmw.msr_gps_vcv_1) << std::scientific << std::setprecision(13) << m_dSigmaXY << + std::right << std::setw(dmw.msr_gps_vcv_2) << m_dSigmaYY; + *dna_stream << std::endl; // Z precision = 4; // whether XYZ or LLH, precision only needs to be at 4 - *dna_stream << setw(pad) << " "; - *dna_stream << right << setw(dmw.msr_gps) << fixed << setprecision(precision) << m_dZ; + *dna_stream << std::setw(pad) << " "; + *dna_stream << std::right << std::setw(dmw.msr_gps) << std::fixed << std::setprecision(precision) << m_dZ; *dna_stream << - right << setw(dmw.msr_gps_vcv_1) << scientific << setprecision(13) << m_dSigmaXZ << - right << setw(dmw.msr_gps_vcv_2) << m_dSigmaYZ << - right << setw(dmw.msr_gps_vcv_3) << m_dSigmaZZ; - *dna_stream << endl; + std::right << std::setw(dmw.msr_gps_vcv_1) << std::scientific << std::setprecision(13) << m_dSigmaXZ << + std::right << std::setw(dmw.msr_gps_vcv_2) << m_dSigmaYZ << + std::right << std::setw(dmw.msr_gps_vcv_3) << m_dSigmaZZ; + *dna_stream << std::endl; // write GPSPoint covariances (not supported by DNA format) - vector::const_iterator _it_cov = m_vPointCovariances.begin(); + std::vector::const_iterator _it_cov = m_vPointCovariances.begin(); for (_it_cov=m_vPointCovariances.begin(); _it_cov!=m_vPointCovariances.end(); ++_it_cov) _it_cov->WriteDNAMsr(dna_stream, dmw, dml); } @@ -395,7 +395,7 @@ void CDnaGpsPoint::SimulateMsr(vdnaStnPtr* vStations, const CDnaEllipsoid* ellip m_dSigmaZZ = 6.803E-04; } - vector::iterator _it_cov = m_vPointCovariances.begin(); + std::vector::iterator _it_cov = m_vPointCovariances.begin(); for (_it_cov=m_vPointCovariances.begin(); _it_cov!=m_vPointCovariances.end(); ++_it_cov) _it_cov->SimulateMsr(vStations, ellipsoid); } @@ -439,7 +439,7 @@ void CDnaGpsPoint::PopulateMsr(pvstn_t bstRecords, uint32_uint32_map* blockStati m_vPointCovariances.clear(); m_vPointCovariances.resize(covariance_count); - vector::iterator _it_cov = m_vPointCovariances.begin(); + std::vector::iterator _it_cov = m_vPointCovariances.begin(); matrix_2d variances_cart(3, 3); UINT32 ic, jc; @@ -478,7 +478,7 @@ UINT32 CDnaGpsPoint::SetMeasurementRec(const vstn_t& binaryStn, it_vmsr_t& it_ms m_epoch = it_msr->epoch; m_epsgCode = it_msr->epsgCode; - m_referenceFrame = datumFromEpsgCode(LongFromString(it_msr->epsgCode)); + m_referenceFrame = datumFromEpsgCode(LongFromString(it_msr->epsgCode)); m_lclusterID = it_msr->clusterID; m_MSmeasurementStations = (MEASUREMENT_STATIONS)it_msr->measurementStations; @@ -514,7 +514,7 @@ UINT32 CDnaGpsPoint::SetMeasurementRec(const vstn_t& binaryStn, it_vmsr_t& it_ms dbidmap += (it_msr->vectorCount2 * 3); // now covariances - vector::iterator _it_cov = m_vPointCovariances.begin(); + std::vector::iterator _it_cov = m_vPointCovariances.begin(); for (; _it_cov!=m_vPointCovariances.end(); ++_it_cov) _it_cov->SetMeasurementRec(binaryStn, it_msr); @@ -591,7 +591,7 @@ void CDnaGpsPoint::WriteBinaryMsr(std::ofstream* binary_stream, PUINT32 msrIndex binary_stream->write(reinterpret_cast(&measRecord), sizeof(measurement_t)); // now write covariance elements - vector::const_iterator _it_cov; + std::vector::const_iterator _it_cov; for (_it_cov=m_vPointCovariances.begin(); _it_cov!=m_vPointCovariances.end(); ++_it_cov) _it_cov->WriteBinaryMsr(binary_stream, msrIndex, m_epsgCode, m_epoch); } @@ -615,20 +615,20 @@ void CDnaGpsPoint::SerialiseDatabaseMap(std::ofstream* os) } -void CDnaGpsPoint::SetEpsg(const string& epsg) +void CDnaGpsPoint::SetEpsg(const std::string& epsg) { m_epsgCode = epsg; } -void CDnaGpsPoint::SetReferenceFrame(const string& refFrame) +void CDnaGpsPoint::SetReferenceFrame(const std::string& refFrame) { m_referenceFrame = refFrame; - SetEpsg(epsgStringFromName(refFrame)); + SetEpsg(epsgStringFromName(refFrame)); } -void CDnaGpsPoint::SetX(const string& str) +void CDnaGpsPoint::SetX(const std::string& str) { if (m_ctType == LLH_type_i || m_ctType == LLh_type_i) { @@ -640,7 +640,7 @@ void CDnaGpsPoint::SetX(const string& str) DoubleFromString(m_dX, trimstr(str)); } -void CDnaGpsPoint::SetY(const string& str) +void CDnaGpsPoint::SetY(const std::string& str) { if (m_ctType == LLH_type_i || m_ctType == LLh_type_i) { @@ -652,14 +652,14 @@ void CDnaGpsPoint::SetY(const string& str) DoubleFromString(m_dY, trimstr(str)); } -void CDnaGpsPoint::SetZ(const string& str) +void CDnaGpsPoint::SetZ(const std::string& str) { // if (m_ctType == LLH_type_i) // then height should be ellipsoid height (but input files show height to be orthometric!) DoubleFromString(m_dZ, trimstr(str)); } -void CDnaGpsPoint::SetSigmaXX(const string& str) +void CDnaGpsPoint::SetSigmaXX(const std::string& str) { // if LLH, then SigmaXX is in radians^2 // if XYZ, then SigmaXX is in metres^2 @@ -667,17 +667,17 @@ void CDnaGpsPoint::SetSigmaXX(const string& str) throw XMLInteropException("SetSigmaXX(): Variances cannot be zero.", 0); } -void CDnaGpsPoint::SetSigmaXY(const string& str) +void CDnaGpsPoint::SetSigmaXY(const std::string& str) { DoubleFromString(m_dSigmaXY, trimstr(str)); } -void CDnaGpsPoint::SetSigmaXZ(const string& str) +void CDnaGpsPoint::SetSigmaXZ(const std::string& str) { DoubleFromString(m_dSigmaXZ, trimstr(str)); } -void CDnaGpsPoint::SetSigmaYY(const string& str) +void CDnaGpsPoint::SetSigmaYY(const std::string& str) { // if LLH, then SigmaYY is in radians^2 // if XYZ, then SigmaYY is in metres^2 @@ -685,12 +685,12 @@ void CDnaGpsPoint::SetSigmaYY(const string& str) throw XMLInteropException("SetSigmaYY(): Variances cannot be zero.", 0); } -void CDnaGpsPoint::SetSigmaYZ(const string& str) +void CDnaGpsPoint::SetSigmaYZ(const std::string& str) { DoubleFromString(m_dSigmaYZ, trimstr(str)); } -void CDnaGpsPoint::SetSigmaZZ(const string& str) +void CDnaGpsPoint::SetSigmaZZ(const std::string& str) { // if LLH, then SigmaZZ is in radians^2 // if XYZ, then SigmaZZ is in metres^2 @@ -722,7 +722,7 @@ CDnaGpsPointCluster::CDnaGpsPointCluster(void) , m_lclusterID(0) { SetEpoch(DEFAULT_EPOCH); - SetEpsg(epsgStringFromName(m_referenceFrame)); + SetEpsg(epsgStringFromName(m_referenceFrame)); m_strType = "Y"; m_MSmeasurementStations = ONE_STATION; @@ -793,7 +793,7 @@ CDnaGpsPointCluster& CDnaGpsPointCluster::operator= (CDnaGpsPointCluster&& rhs) } -CDnaGpsPointCluster::CDnaGpsPointCluster(const UINT32 lclusterID, const string& referenceframe, const string& epoch) +CDnaGpsPointCluster::CDnaGpsPointCluster(const UINT32 lclusterID, const std::string& referenceframe, const std::string& epoch) : m_lRecordedTotal(0) , m_dPscale(1.) , m_dLscale(1.) @@ -805,7 +805,7 @@ CDnaGpsPointCluster::CDnaGpsPointCluster(const UINT32 lclusterID, const string& , m_lclusterID(lclusterID) { SetEpoch(epoch); - SetEpsg(epsgStringFromName(referenceframe)); + SetEpsg(epsgStringFromName(referenceframe)); m_strType = "Y"; m_MSmeasurementStations = ONE_STATION; @@ -851,7 +851,7 @@ bool CDnaGpsPointCluster::operator< (const CDnaGpsPointCluster& rhs) const return m_strFirst < rhs.m_strFirst; } -void CDnaGpsPointCluster::SetCoordType(const string& sType) { +void CDnaGpsPointCluster::SetCoordType(const std::string& sType) { m_strCoordType = trimstr(sType); m_ctType = GetMyCoordTypeC(); } @@ -903,67 +903,67 @@ UINT32 CDnaGpsPointCluster::CalcBinaryRecordCount() const } -void CDnaGpsPointCluster::WriteDynaMLMsr(std::ofstream* dynaml_stream, const string& comment, bool) const +void CDnaGpsPointCluster::WriteDynaMLMsr(std::ofstream* dynaml_stream, const std::string& comment, bool) const { const size_t pntCount = m_vGpsPoints.size(); if (comment.empty()) { - *dynaml_stream << " " << endl; + *dynaml_stream << " -->" << std::endl; } else - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; - *dynaml_stream << " " << endl; - *dynaml_stream << " " << m_strType << "" << endl; + *dynaml_stream << " " << std::endl; + *dynaml_stream << " " << m_strType << "" << std::endl; // Source file from which the measurement came - *dynaml_stream << " " << m_sourceFile << "" << endl; + *dynaml_stream << " " << m_sourceFile << "" << std::endl; if (m_bIgnore) - *dynaml_stream << " *" << endl; + *dynaml_stream << " *" << std::endl; else - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; // Reference frame and epoch - *dynaml_stream << " " << m_referenceFrame << "" << endl; - *dynaml_stream << " " << m_epoch << "" << endl; + *dynaml_stream << " " << m_referenceFrame << "" << std::endl; + *dynaml_stream << " " << m_epoch << "" << std::endl; // Scalars - *dynaml_stream << " " << fixed << setprecision(3) << m_dVscale << "" << endl; - *dynaml_stream << " " << m_dPscale << "" << endl; - *dynaml_stream << " " << m_dLscale << "" << endl; - *dynaml_stream << " " << m_dHscale << "" << endl; + *dynaml_stream << " " << std::fixed << std::setprecision(3) << m_dVscale << "" << std::endl; + *dynaml_stream << " " << m_dPscale << "" << std::endl; + *dynaml_stream << " " << m_dLscale << "" << std::endl; + *dynaml_stream << " " << m_dHscale << "" << std::endl; if (m_msr_db_map.is_cls_id_set) - *dynaml_stream << " " << m_msr_db_map.cluster_id << "" << endl; + *dynaml_stream << " " << m_msr_db_map.cluster_id << "" << std::endl; - *dynaml_stream << " " << m_strCoordType << "" << endl; - *dynaml_stream << " " << pntCount << "" << endl; + *dynaml_stream << " " << m_strCoordType << "" << std::endl; + *dynaml_stream << " " << pntCount << "" << std::endl; // write GpsPoints - vector::const_iterator _it_pnt; + std::vector::const_iterator _it_pnt; for (_it_pnt=m_vGpsPoints.begin(); _it_pnt!=m_vGpsPoints.end(); ++_it_pnt) _it_pnt->WriteDynaMLMsr(dynaml_stream, comment, true); - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; } void CDnaGpsPointCluster::WriteDNAMsr(std::ofstream* dna_stream, const dna_msr_fields& dmw, const dna_msr_fields& dml, bool) const { // write GpsPoints - vector::const_iterator _it_pnt; + std::vector::const_iterator _it_pnt; for (_it_pnt=m_vGpsPoints.begin(); _it_pnt!=m_vGpsPoints.end(); ++_it_pnt) _it_pnt->WriteDNAMsr(dna_stream, dmw, dml, true); } void CDnaGpsPointCluster::SimulateMsr(vdnaStnPtr* vStations, const CDnaEllipsoid* ellipsoid) { - vector::iterator _it_pnt = m_vGpsPoints.begin(); + std::vector::iterator _it_pnt = m_vGpsPoints.begin(); for (_it_pnt=m_vGpsPoints.begin(); _it_pnt!=m_vGpsPoints.end(); ++_it_pnt) _it_pnt->SimulateMsr(vStations, ellipsoid); } @@ -990,7 +990,7 @@ void CDnaGpsPointCluster::PopulateMsr(pvstn_t bstRecords, uint32_uint32_map* blo m_dHscale = 1.0; m_dVscale = 1.0; - vector::iterator _it_pnt = m_vGpsPoints.begin(); + std::vector::iterator _it_pnt = m_vGpsPoints.begin(); for (UINT32 i(0); iSetClusterID(block); @@ -1010,7 +1010,7 @@ UINT32 CDnaGpsPointCluster::SetMeasurementRec(const vstn_t& binaryStn, it_vmsr_t m_vGpsPoints.clear(); m_vGpsPoints.resize(m_lRecordedTotal); - m_referenceFrame = datumFromEpsgCode(LongFromString(it_msr->epsgCode)); + m_referenceFrame = datumFromEpsgCode(LongFromString(it_msr->epsgCode)); m_epoch = it_msr->epoch; m_epsgCode = it_msr->epsgCode; @@ -1043,7 +1043,7 @@ UINT32 CDnaGpsPointCluster::SetMeasurementRec(const vstn_t& binaryStn, it_vmsr_t void CDnaGpsPointCluster::WriteBinaryMsr(std::ofstream* binary_stream, PUINT32 msrIndex) const { - vector< CDnaGpsPoint >::const_iterator _it_pnt; + std::vector< CDnaGpsPoint >::const_iterator _it_pnt; for (_it_pnt=m_vGpsPoints.begin(); _it_pnt!=m_vGpsPoints.end(); ++_it_pnt) _it_pnt->WriteBinaryMsr(binary_stream, msrIndex); @@ -1054,42 +1054,42 @@ void CDnaGpsPointCluster::WriteBinaryMsr(std::ofstream* binary_stream, PUINT32 m } -void CDnaGpsPointCluster::SetEpsg(const string& epsg) +void CDnaGpsPointCluster::SetEpsg(const std::string& epsg) { m_epsgCode = epsg; } -void CDnaGpsPointCluster::SetReferenceFrame(const string& refFrame) +void CDnaGpsPointCluster::SetReferenceFrame(const std::string& refFrame) { m_referenceFrame = refFrame; - SetEpsg(epsgStringFromName(refFrame)); + SetEpsg(epsgStringFromName(refFrame)); } -void CDnaGpsPointCluster::SetTotal(const string& str) +void CDnaGpsPointCluster::SetTotal(const std::string& str) { m_lRecordedTotal = LongFromString(trimstr(str)); m_vGpsPoints.reserve(m_lRecordedTotal); } -void CDnaGpsPointCluster::SetPscale(const string& str) +void CDnaGpsPointCluster::SetPscale(const std::string& str) { DoubleFromString(m_dPscale, trimstr(str)); } -void CDnaGpsPointCluster::SetLscale(const string& str) +void CDnaGpsPointCluster::SetLscale(const std::string& str) { DoubleFromString(m_dLscale, trimstr(str)); } -void CDnaGpsPointCluster::SetHscale(const string& str) +void CDnaGpsPointCluster::SetHscale(const std::string& str) { DoubleFromString(m_dHscale, trimstr(str)); } -void CDnaGpsPointCluster::SetVscale(const string& str) +void CDnaGpsPointCluster::SetVscale(const std::string& str) { DoubleFromString(m_dVscale, trimstr(str)); } diff --git a/dynadjust/include/measurement_types/dnagpspoint.hpp b/dynadjust/include/measurement_types/dnagpspoint.hpp index 9bd16036..810ef832 100644 --- a/dynadjust/include/measurement_types/dnagpspoint.hpp +++ b/dynadjust/include/measurement_types/dnagpspoint.hpp @@ -32,8 +32,6 @@ #include #include -using namespace std; - namespace dynadjust { namespace measurements { @@ -53,7 +51,7 @@ class CDnaGpsPoint : public CDnaMeasurement //CDnaGpsPoint& operator=(const CDnaGpsPoint& rhs); public: - //CDnaGpsPoint(const bool bIgnore, const string& strType, const string& strFirstStation); + //CDnaGpsPoint(const bool bIgnore, const std::string& strType, const std::string& strFirstStation); //virtual inline CDnaGpsPoint* clone() const { return new CDnaGpsPoint(*this); } bool operator==(const CDnaGpsPoint& rhs) const; @@ -64,31 +62,31 @@ class CDnaGpsPoint : public CDnaMeasurement void AddPointCovariance(const CDnaCovariance* pGpsCovariance); inline UINT32 GetClusterID() const { return m_lclusterID; } - inline string GetCoordType() const { return m_strCoordType; } + inline std::string GetCoordType() const { return m_strCoordType; } - inline vector* GetCovariances_ptr() { return &m_vPointCovariances; } + inline std::vector* GetCovariances_ptr() { return &m_vPointCovariances; } inline void SetClusterID(const UINT32& id) { m_lclusterID = id; } - void SetX(const string& str); - void SetY(const string& str); - void SetZ(const string& str); - void SetSigmaXX(const string& str); - void SetSigmaXY(const string& str); - void SetSigmaXZ(const string& str); - void SetSigmaYY(const string& str); - void SetSigmaYZ(const string& str); - void SetSigmaZZ(const string& str); + void SetX(const std::string& str); + void SetY(const std::string& str); + void SetZ(const std::string& str); + void SetSigmaXX(const std::string& str); + void SetSigmaXY(const std::string& str); + void SetSigmaXZ(const std::string& str); + void SetSigmaYY(const std::string& str); + void SetSigmaYZ(const std::string& str); + void SetSigmaZZ(const std::string& str); - void SetReferenceFrame(const string& refFrame); - //void SetEpoch(const string& epoch); - void SetEpsg(const string& epsg); - inline string GetReferenceFrame() const { return m_referenceFrame; } - //inline string GetEpoch() const { return m_epoch; } + void SetReferenceFrame(const std::string& refFrame); + //void SetEpoch(const std::string& epoch); + void SetEpsg(const std::string& epsg); + inline std::string GetReferenceFrame() const { return m_referenceFrame; } + //inline std::string GetEpoch() const { return m_epoch; } - //void SetPscale(const string& str); - //void SetLscale(const string& str); - //void SetHscale(const string& str); - //void SetVscale(const string& str); + //void SetPscale(const std::string& str); + //void SetLscale(const std::string& str); + //void SetHscale(const std::string& str); + //void SetVscale(const std::string& str); inline void SetTotal(const UINT32& l) { m_lRecordedTotal = l; } @@ -107,7 +105,7 @@ class CDnaGpsPoint : public CDnaMeasurement inline void SetLscale(const double& dbl) { m_dLscale = dbl; } inline void SetHscale(const double& dbl) { m_dHscale = dbl; } inline void SetVscale(const double& dbl) { m_dVscale = dbl; } - void SetCoordType(const string& str); + void SetCoordType(const std::string& str); inline void SetRecordedTotal(const UINT32& total) { m_lRecordedTotal = total; } @@ -117,10 +115,10 @@ class CDnaGpsPoint : public CDnaMeasurement void ResizeGpsCovariancesCount(const UINT32& size = 0); virtual UINT32 CalcBinaryRecordCount() const; - //void coutPointData(ostream &os) const; + //void coutPointData(std::ostream &os) const; virtual void WriteBinaryMsr(std::ofstream* binary_stream, PUINT32 msrIndex) const; virtual UINT32 SetMeasurementRec(const vstn_t& binaryStn, it_vmsr_t& it_msr, it_vdbid_t& dbidmap); - virtual void WriteDynaMLMsr(std::ofstream* dynaml_stream, const string& comment, bool) const; + virtual void WriteDynaMLMsr(std::ofstream* dynaml_stream, const std::string& comment, bool) const; virtual void WriteDNAMsr(std::ofstream* dna_stream, const dna_msr_fields& dmw, const dna_msr_fields& dml, bool) const; virtual void SimulateMsr(vdnaStnPtr* vStations, const CDnaEllipsoid* ellipsoid); virtual void PopulateMsr(pvstn_t bstRecords, uint32_uint32_map* blockStationsMap, vUINT32* blockStations, @@ -155,16 +153,16 @@ class CDnaGpsPoint : public CDnaMeasurement double m_dLscale; double m_dHscale; double m_dVscale; - string m_strCoordType; + std::string m_strCoordType; COORD_TYPE m_ctType; - string m_referenceFrame; + std::string m_referenceFrame; //string m_epoch; UINT32 m_lclusterID; - vector m_vPointCovariances; + std::vector m_vPointCovariances; }; @@ -184,8 +182,8 @@ class CDnaGpsPointCluster : public CDnaMeasurement CDnaGpsPointCluster& operator=(const CDnaGpsPointCluster& rhs); public: - //CDnaGpsPointCluster(const bool bIgnore, const string& strType, const string& strFirstStation); - CDnaGpsPointCluster(const UINT32 lclusterID, const string& referenceframe, const string& epoch); + //CDnaGpsPointCluster(const bool bIgnore, const std::string& strType, const std::string& strFirstStation); + CDnaGpsPointCluster(const UINT32 lclusterID, const std::string& referenceframe, const std::string& epoch); //virtual inline CDnaGpsPointCluster* clone() const { return new CDnaGpsPointCluster(*this); } bool operator==(const CDnaGpsPointCluster& rhs) const; @@ -194,33 +192,33 @@ class CDnaGpsPointCluster : public CDnaMeasurement //inline CDnaGpsPointCluster& operator[](int iIndex) { return this[iIndex]; } //inline UINT32 GetNumPoints() { return m_vGpsPoints.size(); } - inline vector& GetPoints() { return m_vGpsPoints; } - inline vector* GetPoints_ptr() { return &m_vGpsPoints; } + inline std::vector& GetPoints() { return m_vGpsPoints; } + inline std::vector* GetPoints_ptr() { return &m_vGpsPoints; } inline UINT32 GetClusterID() const { return m_lclusterID; } - inline string GetCoordType() const { return m_strCoordType; } + inline std::string GetCoordType() const { return m_strCoordType; } inline UINT32 GetTotal() const { return m_lRecordedTotal; } inline double GetPscale() const { return m_dPscale; } inline double GetLscale() const { return m_dLscale; } inline double GetHscale() const { return m_dHscale; } inline double GetVscale() const { return m_dVscale; } - void SetCoordType(const string& str); + void SetCoordType(const std::string& str); _COORD_TYPE_ GetMyCoordTypeC(); - void SetReferenceFrame(const string& refFrame); - //void SetEpoch(const string& epoch); - void SetEpsg(const string& epsg); - inline string GetReferenceFrame() const { return m_referenceFrame; } - //inline string GetEpoch() const { return m_epoch; } + void SetReferenceFrame(const std::string& refFrame); + //void SetEpoch(const std::string& epoch); + void SetEpsg(const std::string& epsg); + inline std::string GetReferenceFrame() const { return m_referenceFrame; } + //inline std::string GetEpoch() const { return m_epoch; } - //inline void SetPoints(const vector& d) { m_vGpsPoints = d; } - void SetTotal(const string& str); - void SetPscale(const string& str); - void SetLscale(const string& str); - void SetHscale(const string& str); - void SetVscale(const string& str); + //inline void SetPoints(const std::vector& d) { m_vGpsPoints = d; } + void SetTotal(const std::string& str); + void SetPscale(const std::string& str); + void SetLscale(const std::string& str); + void SetHscale(const std::string& str); + void SetVscale(const std::string& str); inline void SetTotal(const UINT32& u) { m_lRecordedTotal = u; } @@ -235,7 +233,7 @@ class CDnaGpsPointCluster : public CDnaMeasurement virtual UINT32 CalcBinaryRecordCount() const; virtual void WriteBinaryMsr(std::ofstream* binary_stream, PUINT32 msrIndex) const; virtual UINT32 SetMeasurementRec(const vstn_t& binaryStn, it_vmsr_t& it_msr, it_vdbid_t& dbidmap); - virtual void WriteDynaMLMsr(std::ofstream* dynaml_stream, const string& comment, bool) const; + virtual void WriteDynaMLMsr(std::ofstream* dynaml_stream, const std::string& comment, bool) const; virtual void WriteDNAMsr(std::ofstream* dna_stream, const dna_msr_fields& dmw, const dna_msr_fields& dml, bool) const; virtual void SimulateMsr(vdnaStnPtr* vStations, const CDnaEllipsoid* ellipsoid); virtual void PopulateMsr(pvstn_t bstRecords, uint32_uint32_map* blockStationsMap, vUINT32* blockStations, @@ -252,13 +250,13 @@ class CDnaGpsPointCluster : public CDnaMeasurement double m_dLscale; double m_dHscale; double m_dVscale; - string m_strCoordType; + std::string m_strCoordType; COORD_TYPE m_ctType; - vector m_vGpsPoints; + std::vector m_vGpsPoints; - string m_referenceFrame; + std::string m_referenceFrame; //string m_epoch; UINT32 m_lclusterID; diff --git a/dynadjust/include/measurement_types/dnaheight.cpp b/dynadjust/include/measurement_types/dnaheight.cpp index 4f8cbfed..19b3d966 100644 --- a/dynadjust/include/measurement_types/dnaheight.cpp +++ b/dynadjust/include/measurement_types/dnaheight.cpp @@ -73,63 +73,63 @@ bool CDnaHeight::operator< (const CDnaHeight& rhs) const } -void CDnaHeight::WriteDynaMLMsr(std::ofstream* dynaml_stream, const string& comment, bool) const +void CDnaHeight::WriteDynaMLMsr(std::ofstream* dynaml_stream, const std::string& comment, bool) const { if (comment.empty()) - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; else - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; - *dynaml_stream << " " << endl; - *dynaml_stream << " " << m_strType << "" << endl; + *dynaml_stream << " " << std::endl; + *dynaml_stream << " " << m_strType << "" << std::endl; // Source file from which the measurement came - *dynaml_stream << " " << m_sourceFile << "" << endl; + *dynaml_stream << " " << m_sourceFile << "" << std::endl; if (m_bIgnore) - *dynaml_stream << " *" << endl; + *dynaml_stream << " *" << std::endl; else - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; if (m_epoch.empty()) - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; else - *dynaml_stream << " " << m_epoch << "" << endl; + *dynaml_stream << " " << m_epoch << "" << std::endl; - *dynaml_stream << " " << m_strFirst << "" << endl; - *dynaml_stream << " " << fixed << setprecision(4) << m_dValue << "" << endl; - *dynaml_stream << " " << scientific << setprecision(6) << m_dStdDev << "" << endl; + *dynaml_stream << " " << m_strFirst << "" << std::endl; + *dynaml_stream << " " << std::fixed << std::setprecision(4) << m_dValue << "" << std::endl; + *dynaml_stream << " " << std::scientific << std::setprecision(6) << m_dStdDev << "" << std::endl; if (m_msr_db_map.is_msr_id_set) - *dynaml_stream << " " << m_msr_db_map.msr_id << "" << endl; + *dynaml_stream << " " << m_msr_db_map.msr_id << "" << std::endl; - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; } void CDnaHeight::WriteDNAMsr(std::ofstream* dna_stream, const dna_msr_fields& dmw, const dna_msr_fields& dml, bool) const { - *dna_stream << setw(dmw.msr_type) << m_strType; + *dna_stream << std::setw(dmw.msr_type) << m_strType; if (m_bIgnore) - *dna_stream << setw(dmw.msr_ignore) << "*"; + *dna_stream << std::setw(dmw.msr_ignore) << "*"; else - *dna_stream << setw(dmw.msr_ignore) << " "; + *dna_stream << std::setw(dmw.msr_ignore) << " "; - *dna_stream << left << setw(dmw.msr_inst) << m_strFirst; - *dna_stream << setw(dmw.msr_targ1) << " "; - *dna_stream << setw(dmw.msr_targ2) << " "; - *dna_stream << right << setw(dmw.msr_linear) << fixed << setprecision(4) << m_dValue; // linear measurement value - *dna_stream << setw(dmw.msr_ang_d + dmw.msr_ang_m + dmw.msr_ang_s) << " "; + *dna_stream << std::left << std::setw(dmw.msr_inst) << m_strFirst; + *dna_stream << std::setw(dmw.msr_targ1) << " "; + *dna_stream << std::setw(dmw.msr_targ2) << " "; + *dna_stream << std::right << std::setw(dmw.msr_linear) << std::fixed << std::setprecision(4) << m_dValue; // linear measurement value + *dna_stream << std::setw(dmw.msr_ang_d + dmw.msr_ang_m + dmw.msr_ang_s) << " "; UINT32 m_stdDevPrec(3); // note change from 6 decimal places to 3 - *dna_stream << setw(dmw.msr_stddev) << StringFromTW(m_dStdDev, dmw.msr_stddev, m_stdDevPrec); - //*dna_stream << setw(dmw.msr_stddev) << fixed << setprecision(6) << m_dStdDev; + *dna_stream << std::setw(dmw.msr_stddev) << StringFromTW(m_dStdDev, dmw.msr_stddev, m_stdDevPrec); + //*dna_stream << std::setw(dmw.msr_stddev) << std::fixed << std::setprecision(6) << m_dStdDev; - *dna_stream << setw(dml.msr_gps_epoch - dml.msr_inst_ht) << " "; - *dna_stream << setw(dmw.msr_gps_epoch) << m_epoch; + *dna_stream << std::setw(dml.msr_gps_epoch - dml.msr_inst_ht) << " "; + *dna_stream << std::setw(dmw.msr_gps_epoch) << m_epoch; if (m_msr_db_map.is_msr_id_set) - *dna_stream << setw(dmw.msr_id_msr) << m_msr_db_map.msr_id; + *dna_stream << std::setw(dmw.msr_id_msr) << m_msr_db_map.msr_id; - *dna_stream << endl; + *dna_stream << std::endl; } @@ -216,12 +216,12 @@ void CDnaHeight::WriteBinaryMsr(std::ofstream* binary_stream, PUINT32 msrIndex) } -void CDnaHeight::SetValue(const string& str) +void CDnaHeight::SetValue(const std::string& str) { DoubleFromString(m_dValue, trimstr(str)); } -void CDnaHeight::SetStdDev(const string& str) +void CDnaHeight::SetStdDev(const std::string& str) { DoubleFromString(m_dStdDev, trimstr(str)); } diff --git a/dynadjust/include/measurement_types/dnaheight.hpp b/dynadjust/include/measurement_types/dnaheight.hpp index 374c02ab..e52e9694 100644 --- a/dynadjust/include/measurement_types/dnaheight.hpp +++ b/dynadjust/include/measurement_types/dnaheight.hpp @@ -31,8 +31,6 @@ #include -using namespace std; - namespace dynadjust { namespace measurements { @@ -48,7 +46,7 @@ class CDnaHeight : public CDnaMeasurement //CDnaHeight& operator=(const CDnaHeight& rhs); public: - //CDnaHeight(const bool bIgnore, const string& strType, const string& strFirst, const double& dValue, const double& dStdDev); + //CDnaHeight(const bool bIgnore, const std::string& strType, const std::string& strFirst, const double& dValue, const double& dStdDev); bool operator==(const CDnaHeight& rhs) const; bool operator<(const CDnaHeight& rhs) const; @@ -58,14 +56,14 @@ class CDnaHeight : public CDnaMeasurement inline double GetValue() const { return m_dValue; } inline double GetStdDev() const { return m_dStdDev; } - void SetValue(const string& str); - void SetStdDev(const string& str); + void SetValue(const std::string& str); + void SetStdDev(const std::string& str); inline virtual UINT32 CalcBinaryRecordCount() const { return 1; } virtual void WriteBinaryMsr(std::ofstream* binary_stream, PUINT32 msrIndex) const; virtual UINT32 SetMeasurementRec(const vstn_t& binaryStn, it_vmsr_t& it_msr, it_vdbid_t& dbidmap); - virtual void WriteDynaMLMsr(std::ofstream* dynaml_stream, const string& comment, bool) const; + virtual void WriteDynaMLMsr(std::ofstream* dynaml_stream, const std::string& comment, bool) const; virtual void WriteDNAMsr(std::ofstream* dna_stream, const dna_msr_fields& dmw, const dna_msr_fields& dml, bool) const; virtual void SimulateMsr(vdnaStnPtr* vStations, const CDnaEllipsoid* ellipsoid); diff --git a/dynadjust/include/measurement_types/dnaheightdifference.cpp b/dynadjust/include/measurement_types/dnaheightdifference.cpp index d0157bd6..76833c5c 100644 --- a/dynadjust/include/measurement_types/dnaheightdifference.cpp +++ b/dynadjust/include/measurement_types/dnaheightdifference.cpp @@ -83,64 +83,64 @@ bool CDnaHeightDifference::operator< (const CDnaHeightDifference& rhs) const } -void CDnaHeightDifference::WriteDynaMLMsr(std::ofstream* dynaml_stream, const string& comment, bool) const +void CDnaHeightDifference::WriteDynaMLMsr(std::ofstream* dynaml_stream, const std::string& comment, bool) const { if (comment.empty()) - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; else - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; - *dynaml_stream << " " << endl; - *dynaml_stream << " " << m_strType << "" << endl; + *dynaml_stream << " " << std::endl; + *dynaml_stream << " " << m_strType << "" << std::endl; // Source file from which the measurement came - *dynaml_stream << " " << m_sourceFile << "" << endl; + *dynaml_stream << " " << m_sourceFile << "" << std::endl; if (m_bIgnore) - *dynaml_stream << " *" << endl; + *dynaml_stream << " *" << std::endl; else - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; if (m_epoch.empty()) - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; else - *dynaml_stream << " " << m_epoch << "" << endl; + *dynaml_stream << " " << m_epoch << "" << std::endl; - *dynaml_stream << " " << m_strFirst << "" << endl; - *dynaml_stream << " " << m_strTarget << "" << endl; - *dynaml_stream << " " << fixed << setprecision(4) << m_dValue << "" << endl; - *dynaml_stream << " " << fixed << setprecision(6) << m_dStdDev << "" << endl; + *dynaml_stream << " " << m_strFirst << "" << std::endl; + *dynaml_stream << " " << m_strTarget << "" << std::endl; + *dynaml_stream << " " << std::fixed << std::setprecision(4) << m_dValue << "" << std::endl; + *dynaml_stream << " " << std::fixed << std::setprecision(6) << m_dStdDev << "" << std::endl; if (m_msr_db_map.is_msr_id_set) - *dynaml_stream << " " << m_msr_db_map.msr_id << "" << endl; + *dynaml_stream << " " << m_msr_db_map.msr_id << "" << std::endl; - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; } void CDnaHeightDifference::WriteDNAMsr(std::ofstream* dna_stream, const dna_msr_fields& dmw, const dna_msr_fields& dml, bool) const { - *dna_stream << setw(dmw.msr_type) << m_strType; + *dna_stream << std::setw(dmw.msr_type) << m_strType; if (m_bIgnore) - *dna_stream << setw(dmw.msr_ignore) << "*"; + *dna_stream << std::setw(dmw.msr_ignore) << "*"; else - *dna_stream << setw(dmw.msr_ignore) << " "; + *dna_stream << std::setw(dmw.msr_ignore) << " "; - *dna_stream << left << setw(dmw.msr_inst) << m_strFirst; - *dna_stream << left << setw(dmw.msr_targ1) << m_strTarget; - *dna_stream << setw(dmw.msr_targ2) << " "; - *dna_stream << right << setw(dmw.msr_linear) << fixed << setprecision(4) << m_dValue; // linear measurement value - *dna_stream << setw(dmw.msr_ang_d + dmw.msr_ang_m + dmw.msr_ang_s) << " "; + *dna_stream << std::left << std::setw(dmw.msr_inst) << m_strFirst; + *dna_stream << std::left << std::setw(dmw.msr_targ1) << m_strTarget; + *dna_stream << std::setw(dmw.msr_targ2) << " "; + *dna_stream << std::right << std::setw(dmw.msr_linear) << std::fixed << std::setprecision(4) << m_dValue; // linear measurement value + *dna_stream << std::setw(dmw.msr_ang_d + dmw.msr_ang_m + dmw.msr_ang_s) << " "; UINT32 m_stdDevPrec(3); // note change from 6 decimal places to 3 - *dna_stream << setw(dmw.msr_stddev) << StringFromTW(m_dStdDev, dmw.msr_stddev, m_stdDevPrec); - //*dna_stream << setw(dmw.msr_stddev) << fixed << setprecision(6) << m_dStdDev; + *dna_stream << std::setw(dmw.msr_stddev) << StringFromTW(m_dStdDev, dmw.msr_stddev, m_stdDevPrec); + //*dna_stream << std::setw(dmw.msr_stddev) << std::fixed << std::setprecision(6) << m_dStdDev; - *dna_stream << setw(dml.msr_gps_epoch - dml.msr_inst_ht) << " "; - *dna_stream << setw(dmw.msr_gps_epoch) << m_epoch; + *dna_stream << std::setw(dml.msr_gps_epoch - dml.msr_inst_ht) << " "; + *dna_stream << std::setw(dmw.msr_gps_epoch) << m_epoch; if (m_msr_db_map.is_msr_id_set) - *dna_stream << setw(dmw.msr_id_msr) << m_msr_db_map.msr_id; + *dna_stream << std::setw(dmw.msr_id_msr) << m_msr_db_map.msr_id; - *dna_stream << endl; + *dna_stream << std::endl; } @@ -251,12 +251,12 @@ void CDnaHeightDifference::WriteBinaryMsr(std::ofstream* binary_stream, PUINT32 } -void CDnaHeightDifference::SetValue(const string& str) +void CDnaHeightDifference::SetValue(const std::string& str) { DoubleFromString(m_dValue, trimstr(str)); } -void CDnaHeightDifference::SetStdDev(const string& str) +void CDnaHeightDifference::SetStdDev(const std::string& str) { DoubleFromString(m_dStdDev, trimstr(str)); } diff --git a/dynadjust/include/measurement_types/dnaheightdifference.hpp b/dynadjust/include/measurement_types/dnaheightdifference.hpp index 33f311de..2518cfbf 100644 --- a/dynadjust/include/measurement_types/dnaheightdifference.hpp +++ b/dynadjust/include/measurement_types/dnaheightdifference.hpp @@ -31,8 +31,6 @@ #include -using namespace std; - namespace dynadjust { namespace measurements { @@ -48,7 +46,7 @@ class CDnaHeightDifference : public CDnaHeight //CDnaHeightDifference& operator=(const CDnaHeightDifference& rhs); public: - //CDnaHeightDifference(const bool bIgnore, const string& strType, const string& strFirst, const string& strTarget, const double& dValue, const double& dStdDev); + //CDnaHeightDifference(const bool bIgnore, const std::string& strType, const std::string& strFirst, const std::string& strTarget, const double& dValue, const double& dStdDev); //virtual inline CDnaHeightDifference* clone() const { return new CDnaHeightDifference(*this); } bool operator==(const CDnaHeightDifference& rhs) const; @@ -56,24 +54,24 @@ class CDnaHeightDifference : public CDnaHeight //inline CDnaHeightDifference& operator[](int iIndex) { return this[iIndex]; } - inline string GetTarget() const { return m_strTarget; } + inline std::string GetTarget() const { return m_strTarget; } inline double GetValue() const { return m_dValue; } inline double GetStdDev() const { return m_dStdDev; } - inline void SetTarget(const string& str) { m_strTarget = trimstr(str); } + inline void SetTarget(const std::string& str) { m_strTarget = trimstr(str); } - void SetValue(const string& str); - void SetStdDev(const string& str); + void SetValue(const std::string& str); + void SetStdDev(const std::string& str); inline virtual UINT32 CalcBinaryRecordCount() const { return 1; } virtual void WriteBinaryMsr(std::ofstream* binary_stream, PUINT32 msrIndex) const; virtual UINT32 SetMeasurementRec(const vstn_t& binaryStn, it_vmsr_t& it_msr, it_vdbid_t& dbidmap); - virtual void WriteDynaMLMsr(std::ofstream* dynaml_stream, const string& comment, bool) const; + virtual void WriteDynaMLMsr(std::ofstream* dynaml_stream, const std::string& comment, bool) const; virtual void WriteDNAMsr(std::ofstream* dna_stream, const dna_msr_fields& dmw, const dna_msr_fields& dml, bool) const; virtual void SimulateMsr(vdnaStnPtr* vStations, const CDnaEllipsoid* ellipsoid); public: - string m_strTarget; + std::string m_strTarget; double m_dValue; double m_dStdDev; }; diff --git a/dynadjust/include/measurement_types/dnameasurement.cpp b/dynadjust/include/measurement_types/dnameasurement.cpp index f97fc00a..b455dcd6 100644 --- a/dynadjust/include/measurement_types/dnameasurement.cpp +++ b/dynadjust/include/measurement_types/dnameasurement.cpp @@ -121,24 +121,24 @@ bool CDnaCovariance::operator== (const CDnaCovariance& rhs) const void CDnaCovariance::WriteDynaMLMsr(std::ofstream* dynaml_stream) const { if (GetTypeC() == 'X') - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; else - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; - *dynaml_stream << " " << scientific << setprecision(13) << m_dM11 << "" << endl; - *dynaml_stream << " " << m_dM12 << "" << endl; - *dynaml_stream << " " << m_dM13 << "" << endl; - *dynaml_stream << " " << m_dM21 << "" << endl; - *dynaml_stream << " " << m_dM22 << "" << endl; - *dynaml_stream << " " << m_dM23 << "" << endl; - *dynaml_stream << " " << m_dM31 << "" << endl; - *dynaml_stream << " " << m_dM32 << "" << endl; - *dynaml_stream << " " << m_dM33 << "" << endl; + *dynaml_stream << " " << std::scientific << std::setprecision(13) << m_dM11 << "" << std::endl; + *dynaml_stream << " " << m_dM12 << "" << std::endl; + *dynaml_stream << " " << m_dM13 << "" << std::endl; + *dynaml_stream << " " << m_dM21 << "" << std::endl; + *dynaml_stream << " " << m_dM22 << "" << std::endl; + *dynaml_stream << " " << m_dM23 << "" << std::endl; + *dynaml_stream << " " << m_dM31 << "" << std::endl; + *dynaml_stream << " " << m_dM32 << "" << std::endl; + *dynaml_stream << " " << m_dM33 << "" << std::endl; if (GetTypeC() == 'X') - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; else - *dynaml_stream << " " << endl; + *dynaml_stream << " " << std::endl; } @@ -147,28 +147,28 @@ void CDnaCovariance::WriteDNAMsr(std::ofstream* dna_stream, { UINT32 pad(dmw.msr_type + dmw.msr_ignore + dmw.msr_inst + dmw.msr_targ1 + dmw.msr_targ2 + dmw.msr_gps); // X - *dna_stream << setw(pad) << " "; + *dna_stream << std::setw(pad) << " "; *dna_stream << - right << setw(dmw.msr_gps_vcv_1) << scientific << setprecision(13) << m_dM11 << - right << setw(dmw.msr_gps_vcv_2) << m_dM12 << - right << setw(dmw.msr_gps_vcv_3) << m_dM13; - *dna_stream << endl; + std::right << std::setw(dmw.msr_gps_vcv_1) << std::scientific << std::setprecision(13) << m_dM11 << + std::right << std::setw(dmw.msr_gps_vcv_2) << m_dM12 << + std::right << std::setw(dmw.msr_gps_vcv_3) << m_dM13; + *dna_stream << std::endl; // Y - *dna_stream << setw(pad) << " "; + *dna_stream << std::setw(pad) << " "; *dna_stream << - right << setw(dmw.msr_gps_vcv_1) << scientific << setprecision(13) << m_dM21 << - right << setw(dmw.msr_gps_vcv_2) << m_dM22 << - right << setw(dmw.msr_gps_vcv_3) << m_dM23; - *dna_stream << endl; + std::right << std::setw(dmw.msr_gps_vcv_1) << std::scientific << std::setprecision(13) << m_dM21 << + std::right << std::setw(dmw.msr_gps_vcv_2) << m_dM22 << + std::right << std::setw(dmw.msr_gps_vcv_3) << m_dM23; + *dna_stream << std::endl; // Z - *dna_stream << setw(pad) << " "; + *dna_stream << std::setw(pad) << " "; *dna_stream << - right << setw(dmw.msr_gps_vcv_1) << scientific << setprecision(13) << m_dM31 << - right << setw(dmw.msr_gps_vcv_2) << m_dM32 << - right << setw(dmw.msr_gps_vcv_3) << m_dM33; - *dna_stream << endl; + std::right << std::setw(dmw.msr_gps_vcv_1) << std::scientific << std::setprecision(13) << m_dM31 << + std::right << std::setw(dmw.msr_gps_vcv_2) << m_dM32 << + std::right << std::setw(dmw.msr_gps_vcv_3) << m_dM33; + *dna_stream << std::endl; } @@ -221,7 +221,7 @@ UINT32 CDnaCovariance::SetMeasurementRec(const vstn_t&, it_vmsr_t& it_msr) } -void CDnaCovariance::WriteBinaryMsr(std::ofstream *binary_stream, PUINT32 msrIndex, const string& epsgCode, const string& epoch) const +void CDnaCovariance::WriteBinaryMsr(std::ofstream *binary_stream, PUINT32 msrIndex, const std::string& epsgCode, const std::string& epoch) const { *msrIndex += 3; measurement_t measRecord; @@ -283,47 +283,47 @@ void CDnaCovariance::SerialiseDatabaseMap(std::ofstream* os, const msr_database_ os->write(reinterpret_cast(&cls), sizeof(UINT16)); } -void CDnaCovariance::SetM11(const string& str) +void CDnaCovariance::SetM11(const std::string& str) { DoubleFromString(m_dM11, trimstr(str)); } -void CDnaCovariance::SetM12(const string& str) +void CDnaCovariance::SetM12(const std::string& str) { DoubleFromString(m_dM12, trimstr(str)); } -void CDnaCovariance::SetM13(const string& str) +void CDnaCovariance::SetM13(const std::string& str) { DoubleFromString(m_dM13, trimstr(str)); } -void CDnaCovariance::SetM21(const string& str) +void CDnaCovariance::SetM21(const std::string& str) { DoubleFromString(m_dM21, trimstr(str)); } -void CDnaCovariance::SetM22(const string& str) +void CDnaCovariance::SetM22(const std::string& str) { DoubleFromString(m_dM22, trimstr(str)); } -void CDnaCovariance::SetM23(const string& str) +void CDnaCovariance::SetM23(const std::string& str) { DoubleFromString(m_dM23, trimstr(str)); } -void CDnaCovariance::SetM31(const string& str) +void CDnaCovariance::SetM31(const std::string& str) { DoubleFromString(m_dM31, trimstr(str)); } -void CDnaCovariance::SetM32(const string& str) +void CDnaCovariance::SetM32(const std::string& str) { DoubleFromString(m_dM32, trimstr(str)); } -void CDnaCovariance::SetM33(const string& str) +void CDnaCovariance::SetM33(const std::string& str) { DoubleFromString(m_dM33, trimstr(str)); } @@ -427,12 +427,12 @@ CDnaMeasurement& CDnaMeasurement::operator= (CDnaMeasurement&& rhs) } -void CDnaMeasurement::coutMeasurement(ostream& os) const +void CDnaMeasurement::coutMeasurement(std::ostream& os) const { - os << setw(2) << left << "+ " << setw(2) << m_strType; + os << std::setw(2) << std::left << "+ " << std::setw(2) << m_strType; } -void CDnaMeasurement::SetMeasurementDBID(const string& str) +void CDnaMeasurement::SetMeasurementDBID(const std::string& str) { if (str.empty()) { @@ -446,7 +446,7 @@ void CDnaMeasurement::SetMeasurementDBID(const string& str) } } -void CDnaMeasurement::SetClusterDBID(const string& str) +void CDnaMeasurement::SetClusterDBID(const std::string& str) { if (str.empty()) { @@ -466,7 +466,7 @@ void CDnaMeasurement::SetClusterDBID(const UINT32& u, bool s) m_msr_db_map.is_cls_id_set = s; } -void CDnaMeasurement::SetType(const string& str) +void CDnaMeasurement::SetType(const std::string& str) { m_strType = trimstr(str); str_toupper(m_strType); @@ -495,7 +495,7 @@ void CDnaMeasurement::SerialiseDatabaseMap(std::ofstream* os) os->write(reinterpret_cast(&val), sizeof(UINT16)); } -void CDnaMeasurement::SetEpoch(const string& epoch) +void CDnaMeasurement::SetEpoch(const std::string& epoch) { m_epoch = epoch; } diff --git a/dynadjust/include/measurement_types/dnameasurement.hpp b/dynadjust/include/measurement_types/dnameasurement.hpp index 5cbe76b1..a388ada6 100644 --- a/dynadjust/include/measurement_types/dnameasurement.hpp +++ b/dynadjust/include/measurement_types/dnameasurement.hpp @@ -49,9 +49,6 @@ //#include -using namespace std; -using namespace boost; - enum { INST_WIDTH = 12, TARG_WIDTH = 12, @@ -104,7 +101,7 @@ S measurement_name(const C& type) case 'R': return "(R) Ellipsoidal height"; case 'V': - return "(V) Zenith angle"; + return "(V) Zenith distance"; case 'Z': return "(Z) Vertical angle"; case 'Y': @@ -123,12 +120,12 @@ class CDnaCovariance; // measurement types typedef boost::shared_ptr dnaMsrPtr; -typedef vector vdnaMsrPtr, *pvdnaMsrPtr; // vector of dnaMsrPtr +typedef std::vector vdnaMsrPtr, *pvdnaMsrPtr; // vector of dnaMsrPtr typedef vdnaMsrPtr::iterator _it_vdnamsrptr; typedef vdnaMsrPtr::const_iterator _it_vdnamsrptr_const; typedef boost::shared_ptr dnaCovariancePtr; -typedef boost::shared_ptr< vector > vecCovariancePtr; +typedef boost::shared_ptr< std::vector > vecCovariancePtr; // data struct for storing measurement information to binary measurement file typedef struct msr_t { @@ -161,6 +158,7 @@ typedef struct msr_t { UINT32 station3; // record file. UINT32 vectorCount1; // number of directions, GpsPoints or GpsBaselines UINT32 vectorCount2; // number of covariances for GpsPoint or GpsBaseline + // number of non-ignored directions UINT32 clusterID; // cluster ID (which cluster this measurement belongs to) UINT32 fileOrder; // original file order double term1; // measurement, X, Y, Z, dX, dY, dZ value @@ -168,13 +166,13 @@ typedef struct msr_t { double term2; // measurement, XX, XY or XZ variance // direction variance double term3; // instrument height, YY or YZ variance - // derived angle double term4; // target height or ZZ variance - // derived angle variance double scale1; // phi, n or X scalar - // derived angle covariance + // derived angle corrected for deflection of the vertical double scale2; // lambda, e or Y scalar + // derived angle variance double scale3; // height, up or Z scalar + // derived angle covariance double scale4; // matrix scalar double measAdj; double measCorr; @@ -187,7 +185,7 @@ typedef struct msr_t { double preAdjMeas; } measurement_t; -typedef vector vmsr_t, *pvmsr_t; +typedef std::vector vmsr_t, *pvmsr_t; typedef vmsr_t::iterator it_vmsr_t, *pit_vmsr_t; typedef vmsr_t::const_iterator it_vmsr_t_const; @@ -197,15 +195,15 @@ typedef struct scl_t { , v_scale(1.), p_scale(1.), l_scale(1.), h_scale(1.) {} - string station1; - string station2; + std::string station1; + std::string station2; double v_scale; // phi, n or X scalar double p_scale; // lambda, e or Y scalar double l_scale; // height, up or Z scalar double h_scale; // matrix scalar } scalar_t; -typedef vector vscl_t, *pvscl_t; +typedef std::vector vscl_t, *pvscl_t; typedef vscl_t::iterator it_vscl_t, *pit_vscl_t; typedef vscl_t::const_iterator it_vscl_t_const; @@ -231,7 +229,7 @@ class CDnaCovariance //inline CDnaCovariance& operator[](int iIndex) { return this[iIndex]; } - inline void SetType(const string& str) { m_strType = trimstr(str); } + inline void SetType(const std::string& str) { m_strType = trimstr(str); } inline char GetTypeC() const { return (m_strType.c_str())[0]; } // m_bIgnore used only to 'split' cluster measurements @@ -239,7 +237,7 @@ class CDnaCovariance inline bool GetIgnore() const { return m_bIgnore; } inline virtual UINT32 CalcBinaryRecordCount() const { return 3; } - void WriteBinaryMsr(std::ofstream* binary_stream, PUINT32 msrIndex, const string& epsgCode, const string& epoch) const; + void WriteBinaryMsr(std::ofstream* binary_stream, PUINT32 msrIndex, const std::string& epsgCode, const std::string& epoch) const; virtual UINT32 SetMeasurementRec(const vstn_t& binaryStn, it_vmsr_t& it_msr); virtual void WriteDynaMLMsr(std::ofstream* dynaml_stream) const; virtual void WriteDNAMsr(std::ofstream* dna_stream, @@ -251,15 +249,15 @@ class CDnaCovariance inline void SetClusterID(const UINT32& id) { m_lclusterID = id; } inline void SetStn1Index(const UINT32& stn) { m_lstn1Index = stn; } inline void SetStn2Index(const UINT32& stn) { m_lstn2Index = stn; } - void SetM11(const string& str); - void SetM12(const string& str); - void SetM13(const string& str); - void SetM21(const string& str); - void SetM22(const string& str); - void SetM23(const string& str); - void SetM31(const string& str); - void SetM32(const string& str); - void SetM33(const string& str); + void SetM11(const std::string& str); + void SetM12(const std::string& str); + void SetM13(const std::string& str); + void SetM21(const std::string& str); + void SetM22(const std::string& str); + void SetM23(const std::string& str); + void SetM31(const std::string& str); + void SetM32(const std::string& str); + void SetM33(const std::string& str); inline void SetM11(const double& dbl) { m_dM11 = dbl; } inline void SetM12(const double& dbl) { m_dM12 = dbl; } @@ -288,7 +286,7 @@ class CDnaCovariance bool m_bIgnore; UINT32 m_lstn1Index; // This is an index to the record number in the station file UINT32 m_lstn2Index; - string m_strType; + std::string m_strType; double m_dM11; double m_dM12; double m_dM13; @@ -322,24 +320,24 @@ class CDnaMeasurement public: //virtual CDnaMeasurement* clone() const = 0; // The Virtual (Copy) Constructor - inline string GetType() const { return m_strType; } + inline std::string GetType() const { return m_strType; } inline char GetTypeC() const { return (m_strType.c_str())[0]; } inline bool GetIgnore() const { return m_bIgnore; } inline bool NotIgnored() const { return m_bIgnore == false; } - inline string GetFirst() const { return m_strFirst; } + inline std::string GetFirst() const { return m_strFirst; } inline MEASUREMENT_STATIONS GetMsrStnCount() const { return m_MSmeasurementStations; } - inline string GetEpsg() const { return m_epsgCode; } - inline string GetSource() const { return m_sourceFile; } + inline std::string GetEpsg() const { return m_epsgCode; } + inline std::string GetSource() const { return m_sourceFile; } inline bool GetInsufficient() const { return m_bInsufficient; } - void SetType(const string& str); + void SetType(const std::string& str); inline void SetIgnore(const bool bval) { m_bIgnore = bval; } - inline void SetFirst(const string& str) { m_strFirst = trimstr(str); } + inline void SetFirst(const std::string& str) { m_strFirst = trimstr(str); } - inline void SetEpsg(const string& e) { m_epsgCode = trimstr(e); } - inline void SetSource(const string& source) { m_sourceFile = source; } + inline void SetEpsg(const std::string& e) { m_epsgCode = trimstr(e); } + inline void SetSource(const std::string& source) { m_sourceFile = source; } inline void SetInsufficient(const bool bval) { m_bInsufficient = bval; } @@ -364,7 +362,7 @@ class CDnaMeasurement virtual UINT32 CalcBinaryRecordCount() const = 0; virtual void WriteBinaryMsr(std::ofstream* binary_stream, PUINT32 msrIndex) const = 0; virtual UINT32 SetMeasurementRec(const vstn_t&, it_vmsr_t& it_msr, it_vdbid_t& dbidmap) = 0; - virtual void WriteDynaMLMsr(std::ofstream* dynaml_stream, const string& comment, bool bSubMeasurement = false) const = 0; + virtual void WriteDynaMLMsr(std::ofstream* dynaml_stream, const std::string& comment, bool bSubMeasurement = false) const = 0; virtual void WriteDNAMsr(std::ofstream* dna_stream, const dna_msr_fields& dmw, const dna_msr_fields& dml, bool bSubMeasurement = false) const = 0; virtual void SimulateMsr(vdnaStnPtr* vStations, const CDnaEllipsoid* ellipsoid) = 0; @@ -375,26 +373,26 @@ class CDnaMeasurement // virtual functions overridden by specialised classes virtual inline UINT32 GetClusterID() const { return 0; } - virtual inline string GetCoordType() const { return m_strType; } + virtual inline std::string GetCoordType() const { return m_strType; } virtual inline float GetInstrHeight() const { return 0; } virtual inline double GetVscale() const { return 0; } virtual inline double GetPscale() const { return 0; } virtual inline double GetLscale() const { return 0; } virtual inline double GetHscale() const { return 0; } virtual inline double GetStdDev() const { return 0; } - virtual inline string GetTarget() const { return ""; } - virtual inline string GetTarget2() const { return ""; } + virtual inline std::string GetTarget() const { return ""; } + virtual inline std::string GetTarget2() const { return ""; } virtual inline float GetTargetHeight() const { return 0; } virtual inline UINT32 GetTotal() const { return 0; } virtual inline double GetValue() const { return 0; } - virtual inline string GetReferenceFrame() const { return ""; } - inline string GetEpoch() const { return m_epoch; } + virtual inline std::string GetReferenceFrame() const { return ""; } + inline std::string GetEpoch() const { return m_epoch; } - virtual inline vector* GetBaselines_ptr() { return 0; } - virtual inline vector* GetDirections_ptr() { return 0; } - virtual inline vector* GetPoints_ptr() { return 0; } - virtual inline vector* GetCovariances_ptr() { return 0; } + virtual inline std::vector* GetBaselines_ptr() { return 0; } + virtual inline std::vector* GetDirections_ptr() { return 0; } + virtual inline std::vector* GetPoints_ptr() { return 0; } + virtual inline std::vector* GetCovariances_ptr() { return 0; } virtual void AddDirection(const CDnaMeasurement*) {} virtual void AddGpsBaseline(const CDnaMeasurement*) {} @@ -409,36 +407,37 @@ class CDnaMeasurement virtual void ResizeGpsCovariancesCount(const UINT32&) {} virtual void SetRecordedTotal(const UINT32&) {} + virtual void SetNonIgnoredDirns(const UINT32&) {} virtual void SetClusterID(const UINT32&) {} - virtual void SetCoordType(const string&) {} - virtual void SetHscale(const string&) {} + virtual void SetCoordType(const std::string&) {} + virtual void SetHscale(const std::string&) {} virtual void SetHscale(const double&) {} - virtual void SetInstrumentHeight(const string&) {} + virtual void SetInstrumentHeight(const std::string&) {} - virtual void SetReferenceFrame(const string&) {} - void SetEpoch(const string& epoch); + virtual void SetReferenceFrame(const std::string&) {} + void SetEpoch(const std::string& epoch); - virtual void SetLscale(const string&) {} + virtual void SetLscale(const std::string&) {} virtual void SetLscale(const double&) {} - virtual void SetPscale(const string&) {} + virtual void SetPscale(const std::string&) {} virtual void SetPscale(const double&) {} - virtual void SetSigmaXX(const string&) {} - virtual void SetSigmaXY(const string&) {} - virtual void SetSigmaXZ(const string&) {} - virtual void SetSigmaYY(const string&) {} - virtual void SetSigmaYZ(const string&) {} - virtual void SetSigmaZZ(const string&) {} - virtual void SetStdDev(const string&) {} - virtual void SetTarget(const string&) {} - virtual void SetTarget2(const string&) {} - virtual void SetTargetHeight(const string&) {} - virtual void SetTotal(const string&) {} - virtual void SetValue(const string&) {} - virtual void SetVscale(const string&) {} + virtual void SetSigmaXX(const std::string&) {} + virtual void SetSigmaXY(const std::string&) {} + virtual void SetSigmaXZ(const std::string&) {} + virtual void SetSigmaYY(const std::string&) {} + virtual void SetSigmaYZ(const std::string&) {} + virtual void SetSigmaZZ(const std::string&) {} + virtual void SetStdDev(const std::string&) {} + virtual void SetTarget(const std::string&) {} + virtual void SetTarget2(const std::string&) {} + virtual void SetTargetHeight(const std::string&) {} + virtual void SetTotal(const std::string&) {} + virtual void SetValue(const std::string&) {} + virtual void SetVscale(const std::string&) {} virtual void SetVscale(const double&) {} - virtual void SetX(const string&) {} - virtual void SetY(const string&) {} - virtual void SetZ(const string&) {} + virtual void SetX(const std::string&) {} + virtual void SetY(const std::string&) {} + virtual void SetZ(const std::string&) {} virtual void SetXAxis(const double&) {} virtual void SetYAxis(const double&) {} @@ -453,10 +452,10 @@ class CDnaMeasurement virtual void PreferGMeasurements() {} - //virtual void coutBaselineData(ostream &os, const int& pad, const UINT16& uType = 0) {} + //virtual void coutBaselineData(std::ostream &os, const int& pad, const UINT16& uType = 0) {} - void SetMeasurementDBID(const string& str); - void SetClusterDBID(const string& str); + void SetMeasurementDBID(const std::string& str); + void SetClusterDBID(const std::string& str); void SetClusterDBID(const UINT32& u, bool s); @@ -469,14 +468,14 @@ class CDnaMeasurement virtual void SerialiseDatabaseMap(std::ofstream* os); protected: - void coutMeasurement(ostream &os) const; + void coutMeasurement(std::ostream &os) const; public: - string m_strFirst; + std::string m_strFirst; MEASUREMENT_STATIONS m_MSmeasurementStations; protected: - string m_strType; + std::string m_strType; bool m_bIgnore; UINT32 m_lmeasurementIndex; @@ -490,10 +489,10 @@ class CDnaMeasurement double m_residualPrec; double m_preAdjCorr; - string m_epsgCode; - string m_sourceFile; + std::string m_epsgCode; + std::string m_sourceFile; - string m_epoch; + std::string m_epoch; msr_database_id_map m_msr_db_map; @@ -512,7 +511,7 @@ class MsrTally } static void FillMsrList(vchar& msr_list); - static string GetMsrName(const char& c); + static std::string GetMsrName(const char& c); void initialise(); @@ -521,7 +520,7 @@ class MsrTally MsrTally operator+(const MsrTally& rhs) const; //MsrTally operator-(const MsrTally& rhs) const; UINT32 TotalCount(); - void coutSummary(ostream &os, const string& title); + void coutSummary(std::ostream &os, const std::string& title); UINT32 MeasurementCount(const char& msrType); void CreateTally(const vdnaMsrPtr& vMeasurements); @@ -530,8 +529,8 @@ class MsrTally void IncrementMsrType(const char& msrType, const UINT32& count=1); - void coutSummaryMsrToStn(ostream &os, const string& station); - void coutSummaryMsrToStn_Compressed(ostream &os, const string& station); + void coutSummaryMsrToStn(std::ostream &os, const std::string& station); + void coutSummaryMsrToStn_Compressed(std::ostream &os, const std::string& station); //bool GPSOnly(); inline bool ContainsNonGPS() { return containsNonGPS; } @@ -546,7 +545,7 @@ class MsrTally UINT32 totalCount; }; -typedef vector vmsrtally; +typedef std::vector vmsrtally; typedef vmsrtally::iterator _it_vmsrtally; template @@ -557,40 +556,40 @@ void MsrToStnSummaryHeaderLine( for (i=0; i void MsrToStnSummaryHeader( - T& stream, string& header) + T& stream, std::string& header) { - stream << endl << header << endl; - stream << "------------------------------------------" << endl << endl; - - stream << setw(STATION) << left << "Station" << - setw(NUMERIC_WIDTH) << right << "A" << - setw(NUMERIC_WIDTH) << right << "B" << - setw(NUMERIC_WIDTH) << right << "C" << - setw(NUMERIC_WIDTH) << right << "D" << - setw(NUMERIC_WIDTH) << right << "E" << - setw(NUMERIC_WIDTH) << right << "G" << - setw(NUMERIC_WIDTH) << right << "H" << - setw(NUMERIC_WIDTH) << right << "I" << - setw(NUMERIC_WIDTH) << right << "J" << - setw(NUMERIC_WIDTH) << right << "K" << - setw(NUMERIC_WIDTH) << right << "L" << - setw(NUMERIC_WIDTH) << right << "M" << - setw(NUMERIC_WIDTH) << right << "P" << - setw(NUMERIC_WIDTH) << right << "Q" << - setw(NUMERIC_WIDTH) << right << "R" << - setw(NUMERIC_WIDTH) << right << "S" << - setw(NUMERIC_WIDTH) << right << "V" << - setw(NUMERIC_WIDTH) << right << "X" << - setw(NUMERIC_WIDTH) << right << "Y" << - setw(NUMERIC_WIDTH) << right << "Z" << + stream << std::endl << header << std::endl; + stream << "------------------------------------------" << std::endl << std::endl; + + stream << std::setw(STATION) << std::left << "Station" << + std::setw(NUMERIC_WIDTH) << std::right << "A" << + std::setw(NUMERIC_WIDTH) << std::right << "B" << + std::setw(NUMERIC_WIDTH) << std::right << "C" << + std::setw(NUMERIC_WIDTH) << std::right << "D" << + std::setw(NUMERIC_WIDTH) << std::right << "E" << + std::setw(NUMERIC_WIDTH) << std::right << "G" << + std::setw(NUMERIC_WIDTH) << std::right << "H" << + std::setw(NUMERIC_WIDTH) << std::right << "I" << + std::setw(NUMERIC_WIDTH) << std::right << "J" << + std::setw(NUMERIC_WIDTH) << std::right << "K" << + std::setw(NUMERIC_WIDTH) << std::right << "L" << + std::setw(NUMERIC_WIDTH) << std::right << "M" << + std::setw(NUMERIC_WIDTH) << std::right << "P" << + std::setw(NUMERIC_WIDTH) << std::right << "Q" << + std::setw(NUMERIC_WIDTH) << std::right << "R" << + std::setw(NUMERIC_WIDTH) << std::right << "S" << + std::setw(NUMERIC_WIDTH) << std::right << "V" << + std::setw(NUMERIC_WIDTH) << std::right << "X" << + std::setw(NUMERIC_WIDTH) << std::right << "Y" << + std::setw(NUMERIC_WIDTH) << std::right << "Z" << // Total - setw(STAT) << right << "Total" << - endl; + std::setw(STAT) << std::right << "Total" << + std::endl; MsrToStnSummaryHeaderLine(stream); diff --git a/dynadjust/include/measurement_types/dnamsrtally.cpp b/dynadjust/include/measurement_types/dnamsrtally.cpp index d44bd54b..793c0c43 100644 --- a/dynadjust/include/measurement_types/dnamsrtally.cpp +++ b/dynadjust/include/measurement_types/dnamsrtally.cpp @@ -55,15 +55,15 @@ void MsrTally::FillMsrList(vchar& msr_list) msr_list.push_back('Q'); // Geodetic longitude msr_list.push_back('R'); // Ellipsoidal height msr_list.push_back('S'); // Slope distance - msr_list.push_back('V'); // Zenith angle + msr_list.push_back('V'); // Zenith distance msr_list.push_back('X'); // GPS Baseline cluster msr_list.push_back('Y'); // GPS point cluster msr_list.push_back('Z'); // Vertical angle } -string MsrTally::GetMsrName(const char& c) +std::string MsrTally::GetMsrName(const char& c) { - return measurement_name(c); + return measurement_name(c); } @@ -173,169 +173,169 @@ UINT32 MsrTally::TotalCount() { return totalCount=A+B+C+D+E+G+H+I+J+K+L+M+P+Q+R+S+V+X+Y+Z; } -void MsrTally::coutSummary(ostream &os, const string& title) +void MsrTally::coutSummary(std::ostream &os, const std::string& title) { // Print title - os << title << " " << TotalCount() << " measurements:" << endl; + os << title << " " << TotalCount() << " measurements:" << std::endl; UINT32 i, w(PRINT_VAR_PAD+NUMERIC_WIDTH); // Print line os << " "; for (i=0; i > +// std::vector< boost::shared_ptr > void MsrTally::CreateTally(const vdnaMsrPtr& vMeasurements) { initialise(); @@ -496,7 +496,7 @@ void MsrTally::CreateTally(const vdnaMsrPtr& vMeasurements) case 'S': // Slope distance S++; break; - case 'V': // Zenith angle + case 'V': // Zenith distance V++; break; case 'Y': // GPS point cluster @@ -565,7 +565,7 @@ void MsrTally::IncrementMsrType(const char& msrType, const UINT32& count) case 'S': // Slope distance S += count; break; - case 'V': // Zenith angle + case 'V': // Zenith distance V += count; break; case 'Y': // GPS point cluster @@ -579,7 +579,7 @@ void MsrTally::IncrementMsrType(const char& msrType, const UINT32& count) } -// vector +// std::vector void MsrTally::CreateTally(const vmsr_t& vMeasurements, const vUINT32& CML) { initialise(); @@ -599,7 +599,7 @@ void MsrTally::CreateTally(const vmsr_t& vMeasurements, const vUINT32& CML) break; case 'D': // Direction set if (vMeasurements.at(*_it_msr).measStart == xMeas) - D += vMeasurements.at(*_it_msr).vectorCount1 - 1; + D += vMeasurements.at(*_it_msr).vectorCount2 - 1; break; case 'E': // Ellipsoid arc E++; @@ -641,7 +641,7 @@ void MsrTally::CreateTally(const vmsr_t& vMeasurements, const vUINT32& CML) case 'S': // Slope distance S++; break; - case 'V': // Zenith angle + case 'V': // Zenith distance V++; break; case 'Y': // GPS point cluster @@ -656,7 +656,7 @@ void MsrTally::CreateTally(const vmsr_t& vMeasurements, const vUINT32& CML) TotalCount(); } -// vector +// std::vector UINT32 MsrTally::CreateTally(const vmsr_t& vMeasurements, bool countValidOnly) { initialise(); @@ -688,7 +688,7 @@ UINT32 MsrTally::CreateTally(const vmsr_t& vMeasurements, bool countValidOnly) break; case 'D': // Direction set if (_it_msr->measStart == xMeas) - D += _it_msr->vectorCount1 - 1; + D += _it_msr->vectorCount2 - 1; break; case 'E': // Ellipsoid arc E++; @@ -730,7 +730,7 @@ UINT32 MsrTally::CreateTally(const vmsr_t& vMeasurements, bool countValidOnly) case 'S': // Slope distance S++; break; - case 'V': // Zenith angle + case 'V': // Zenith distance V++; break; case 'Y': // GPS point cluster @@ -769,7 +769,7 @@ _MEASUREMENT_STATIONS_ MsrTally::Stations(const char& measType) case 'M': // MSL arc case 'S': // Slope distance case 'L': // Level difference - case 'V': // Zenith angle + case 'V': // Zenith distance case 'Z': // Vertical angle return TWO_STATION; // triple station measurements diff --git a/dynadjust/include/measurement_types/dnastation.cpp b/dynadjust/include/measurement_types/dnastation.cpp index 4c5e052b..8a4eb2de 100644 --- a/dynadjust/include/measurement_types/dnastation.cpp +++ b/dynadjust/include/measurement_types/dnastation.cpp @@ -24,7 +24,6 @@ #include #include -using namespace std; using namespace dynadjust::epsg; using namespace dynadjust::datum_parameters; using namespace dynadjust::exception; @@ -105,7 +104,7 @@ CAStationList& CAStationList::operator =(CAStationList&& rhs) //// -CDnaStation::CDnaStation(const string& referenceframe, const string& epoch) +CDnaStation::CDnaStation(const std::string& referenceframe, const std::string& epoch) : m_strName(""), m_strOriginalName("") , m_dXAxis(0.), m_dYAxis(0.), m_dZAxis(0.), m_dHeight(0.) , m_dStdDevX(0.), m_dStdDevY(0.), m_dStdDevZ(0.), m_dStdDevHt(0.) @@ -119,7 +118,7 @@ CDnaStation::CDnaStation(const string& referenceframe, const string& epoch) , m_referenceFrame(referenceframe), m_epoch(epoch) , m_constraintType(free_3D) { - m_epsgCode = epsgStringFromName(referenceframe); + m_epsgCode = epsgStringFromName(referenceframe); } CDnaStation::~CDnaStation() @@ -170,10 +169,10 @@ CDnaStation::CDnaStation(const CDnaStation& newStation) m_constraintType = newStation.m_constraintType; } -CDnaStation::CDnaStation(const string& strName, const string& strConstraints, - const string& strType, const double& dXAxis, const double& dYAxis, const double& dZAxis, - const double& dHeight, const string& strHemisphereZone, const string& strDescription, - const string& strComment) +CDnaStation::CDnaStation(const std::string& strName, const std::string& strConstraints, + const std::string& strType, const double& dXAxis, const double& dYAxis, const double& dZAxis, + const double& dHeight, const std::string& strHemisphereZone, const std::string& strDescription, + const std::string& strComment) { m_strName = strName; @@ -264,7 +263,7 @@ CDnaStation& CDnaStation::operator =(const CDnaStation& rhs) } -void CDnaStation::SetConstraints(const string& sConstraints) +void CDnaStation::SetConstraints(const std::string& sConstraints) { // capture string, trim whitespace m_strConstraints = trimstr(sConstraints); @@ -286,29 +285,29 @@ void CDnaStation::SetConstraints(const string& sConstraints) m_cHtConstraint = (char)(*m_strConstraints.substr(2, 1).c_str()); // Free in all 3 dimensions - if (iequals(m_strConstraints, "FFF")) + if (boost::iequals(m_strConstraints, "FFF")) m_constraintType = free_3D; // Constrained in all 3 dimensions - else if (iequals(m_strConstraints, "CCC")) + else if (boost::iequals(m_strConstraints, "CCC")) m_constraintType = constrained_3D; // Horizontal or 2D adjustment - else if (iequals(m_strConstraints, "FFC")) + else if (boost::iequals(m_strConstraints, "FFC")) m_constraintType = free_2D; // Vertical or 1D adjustment - else if (iequals(m_strConstraints, "CCF")) + else if (boost::iequals(m_strConstraints, "CCF")) m_constraintType = free_1D; else m_constraintType = custom_constraint; } -void CDnaStation::SetCoordType(const string& sType) { +void CDnaStation::SetCoordType(const std::string& sType) { m_strType = trimstr(sType); m_ctTypeSupplied = m_ctType = GetMyCoordTypeC(); } // X, Easting, Latitude -void CDnaStation::SetXAxis(const string& str) +void CDnaStation::SetXAxis(const std::string& str) { switch (m_ctType) { @@ -325,7 +324,7 @@ void CDnaStation::SetXAxis(const string& str) // Y, Northing, Longitude -void CDnaStation::SetYAxis(const string& str) +void CDnaStation::SetYAxis(const std::string& str) { switch (m_ctType) { @@ -341,14 +340,14 @@ void CDnaStation::SetYAxis(const string& str) // Z -void CDnaStation::SetZAxis(const string& str) +void CDnaStation::SetZAxis(const std::string& str) { DoubleFromString(m_dZAxis, trimstr(str)); } // Height -void CDnaStation::SetHeight(const string& str) +void CDnaStation::SetHeight(const std::string& str) { if (GetMyCoordTypeC() == XYZ_type_i) SetZAxis(str); @@ -357,7 +356,7 @@ void CDnaStation::SetHeight(const string& str) } // Hemisphere zone -void CDnaStation::SetHemisphereZone(const string& sHemisphereZone) +void CDnaStation::SetHemisphereZone(const std::string& sHemisphereZone) { m_strHemisphereZone = trimstr(sHemisphereZone); if (m_strHemisphereZone.empty()) @@ -439,36 +438,36 @@ void CDnaStation::ReduceStations_XYZ(const CDnaEllipsoid* m_eEllipsoid, const CD m_strType = XYZ_type; } -bool CDnaStation::IsValidConstraint(const string& sConst) +bool CDnaStation::IsValidConstraint(const std::string& sConst) { - if (iequals(sConst, "CCC")) + if (boost::iequals(sConst, "CCC")) return true; - if (iequals(sConst, "CCF")) + if (boost::iequals(sConst, "CCF")) return true; - if (iequals(sConst, "CFF")) + if (boost::iequals(sConst, "CFF")) return true; - if (iequals(sConst, "FFF")) + if (boost::iequals(sConst, "FFF")) return true; - if (iequals(sConst, "FFC")) + if (boost::iequals(sConst, "FFC")) return true; - if (iequals(sConst, "FCC")) + if (boost::iequals(sConst, "FCC")) return true; - if (iequals(sConst, "FCF")) + if (boost::iequals(sConst, "FCF")) return true; - if (iequals(sConst, "CFC")) + if (boost::iequals(sConst, "CFC")) return true; return false; } -_COORD_TYPE_ CDnaStation::GetCoordTypeC(const string& sType) +_COORD_TYPE_ CDnaStation::GetCoordTypeC(const std::string& sType) { // case insensitive - if (iequals(sType, XYZ_type)) + if (boost::iequals(sType, XYZ_type)) return XYZ_type_i; - else if (iequals(sType, UTM_type)) + else if (boost::iequals(sType, UTM_type)) return UTM_type_i; // height is assumed to be orthometric - else if (iequals(sType, ENU_type)) + else if (boost::iequals(sType, ENU_type)) return ENU_type_i; // case sensitive @@ -480,9 +479,9 @@ _COORD_TYPE_ CDnaStation::GetCoordTypeC(const string& sType) return LLH_type_i; // orthometric height (default) // If this point is reached, sType is an unknown coordinate type, so throw! - stringstream ss; - ss << " '" << sType << "' is not a recognised coordinate type." << endl; - throw boost::enable_current_exception(runtime_error(ss.str())); + std::stringstream ss; + ss << " '" << sType << "' is not a recognised coordinate type." << std::endl; + throw boost::enable_current_exception(std::runtime_error(ss.str())); return LLH_type_i; } @@ -494,7 +493,7 @@ _COORD_TYPE_ CDnaStation::GetMyCoordTypeC() const } -_HEIGHT_SYSTEM_ CDnaStation::GetHeightSystemC(const string& sType) const +_HEIGHT_SYSTEM_ CDnaStation::GetHeightSystemC(const std::string& sType) const { if (sType.compare(ELLIPSOIDAL_type) == 0) return ELLIPSOIDAL_type_i; @@ -511,7 +510,7 @@ _HEIGHT_SYSTEM_ CDnaStation::GetMyHeightSystemC() const // SetHeightSystem called by void Height_pimpl::system(const ::std::string& system) // where system is an attribute of the element Height (either "ellipsoidal" or "orthometric") -void CDnaStation::SetHeightSystem(const string& sType) +void CDnaStation::SetHeightSystem(const std::string& sType) { SetHeightSystem(GetHeightSystemC(sType)); } @@ -539,13 +538,13 @@ void CDnaStation::SetHeightSystem(const HEIGHT_SYSTEM& type_i) } } -//void CDnaStation::coutStationData(ostream &os, ostream &os2, const UINT16& uType) const +//void CDnaStation::coutStationData(std::ostream &os, ostream &os2, const UINT16& uType) const //{ // UINT32 precision = 3; // if (m_ctType == LLH_type_i) // precision = 10; -// stringstream ss; -// string str; +// std::stringstream ss; +// std::string str; // size_t dot; // // switch (uType) @@ -553,27 +552,27 @@ void CDnaStation::SetHeightSystem(const HEIGHT_SYSTEM& type_i) // case DNA_COUT: // case GEOLAB_COUT: // -// os << "+ " << setw(16) << m_strName; -// os << setw(4) << m_strConstraints; -// os << setw(4) << m_strType; -// os << setw(20) << setprecision(precision) << fixed << (m_ctType == LLH_type_i ? RadtoDms(m_dXAxis): m_dXAxis); -// os << setw(20) << setprecision(precision) << fixed << (m_ctType == LLH_type_i ? RadtoDmsL(m_dYAxis): m_dYAxis); -// //os << setw(16) << vStations[s].GetZAxis(); -// os << setw(13) << setprecision(4) << fixed << m_dHeight; -// //os << setw(10) << vStations[s].GetRedHeight(); -// os << setw(5) << m_strHemisphereZone; -// os << setw(6) << m_lnameOrder; -// os << setw(19) << m_strDescription; -// //os << setw(10) << vStations[s].GetComment(); -// os << endl; +// os << "+ " << std::setw(16) << m_strName; +// os << std::setw(4) << m_strConstraints; +// os << std::setw(4) << m_strType; +// os << std::setw(20) << std::setprecision(precision) << std::fixed << (m_ctType == LLH_type_i ? RadtoDms(m_dXAxis): m_dXAxis); +// os << std::setw(20) << std::setprecision(precision) << std::fixed << (m_ctType == LLH_type_i ? RadtoDmsL(m_dYAxis): m_dYAxis); +// //os << std::setw(16) << vStations[s].GetZAxis(); +// os << std::setw(13) << std::setprecision(4) << std::fixed << m_dHeight; +// //os << std::setw(10) << vStations[s].GetRedHeight(); +// os << std::setw(5) << m_strHemisphereZone; +// os << std::setw(6) << m_lnameOrder; +// os << std::setw(19) << m_strDescription; +// //os << std::setw(10) << vStations[s].GetComment(); +// os << std::endl; // break; // case NEWGAN_COUT: -// os << setw(3) << "4"; -// os << right << setw(12) << m_strName; +// os << std::setw(3) << "4"; +// os << std::right << std::setw(12) << m_strName; // os << " "; -// os << left << setw(23) << m_strDescription.substr(0, 23); +// os << std::left << std::setw(23) << m_strDescription.substr(0, 23); // ss.str(""); -// ss << setprecision(precision) << fixed << (m_ctType == LLH_type_i ? RadtoDms(m_dXAxis): m_dXAxis); +// ss << std::setprecision(precision) << std::fixed << (m_ctType == LLH_type_i ? RadtoDms(m_dXAxis): m_dXAxis); // str = trimstr(ss.str()); // dot = str.find("."); // str.replace(dot, 1, " "); @@ -582,13 +581,13 @@ void CDnaStation::SetHeightSystem(const HEIGHT_SYSTEM& type_i) // { // str.replace(0, 1, " "); // replace negative sign // str = trimstr(str); -// os << left << "S" << setw(precision + 4) << right << str; +// os << std::left << "S" << std::setw(precision + 4) << std::right << str; // } // else -// os << left << "N" << setw(precision + 4) << right << str; +// os << std::left << "N" << std::setw(precision + 4) << std::right << str; // // ss.str(""); -// ss << setprecision(precision) << fixed << (m_ctType == LLH_type_i ? RadtoDmsL(m_dYAxis): m_dYAxis); +// ss << std::setprecision(precision) << std::fixed << (m_ctType == LLH_type_i ? RadtoDmsL(m_dYAxis): m_dYAxis); // str = trimstr(ss.str()); // dot = str.find("."); // str.replace(dot, 1, " "); @@ -597,25 +596,25 @@ void CDnaStation::SetHeightSystem(const HEIGHT_SYSTEM& type_i) // { // str.replace(0, 1, " "); // replace negative sign // str = trimstr(str); -// os << left << "W" << setw(precision + 5) << right << str; +// os << std::left << "W" << std::setw(precision + 5) << std::right << str; // } // else -// os << left << "E" << setw(precision + 5) << right << str; +// os << std::left << "E" << std::setw(precision + 5) << std::right << str; // // -// os << right << setw(9) << setprecision(3) << fixed << m_dHeight; -// os << endl; +// os << std::right << std::setw(9) << std::setprecision(3) << std::fixed << m_dHeight; +// os << std::endl; // break; // case GMT_OUT: -// os << setprecision(precision) << fixed << (m_ctType == LLH_type_i ? DegreesL(m_dYAxis): m_dYAxis); +// os << std::setprecision(precision) << std::fixed << (m_ctType == LLH_type_i ? DegreesL(m_dYAxis): m_dYAxis); // os << " "; -// os << setprecision(precision) << fixed << (m_ctType == LLH_type_i ? Degrees(m_dXAxis): m_dXAxis); -// os << endl; +// os << std::setprecision(precision) << std::fixed << (m_ctType == LLH_type_i ? Degrees(m_dXAxis): m_dXAxis); +// os << std::endl; // -// os2 << setprecision(precision) << fixed << (m_ctType == LLH_type_i ? DegreesL(m_dYAxis): m_dYAxis); +// os2 << std::setprecision(precision) << std::fixed << (m_ctType == LLH_type_i ? DegreesL(m_dYAxis): m_dYAxis); // os2 << " "; -// os2 << setprecision(precision) << fixed << (m_ctType == LLH_type_i ? Degrees(m_dXAxis): m_dXAxis); -// os2 << " 6 0 0 LM " << m_strName << endl; +// os2 << std::setprecision(precision) << std::fixed << (m_ctType == LLH_type_i ? Degrees(m_dXAxis): m_dXAxis); +// os2 << " 6 0 0 LM " << m_strName << std::endl; // break; // } // @@ -713,8 +712,8 @@ void CDnaStation::WriteDNAXMLStn(std::ofstream* dna_ofstream, { //m_ctTypeSupplied = LLh_type_i; - string hemisphereZone(m_strHemisphereZone); - string coordinateType(LLH_type); + std::string hemisphereZone(m_strHemisphereZone); + std::string coordinateType(LLH_type); switch (m_ctTypeSupplied) { @@ -768,7 +767,7 @@ void CDnaStation::WriteDNAXMLStn(std::ofstream* dna_ofstream, // Convert coordinates to cartesian or utm? // Convert radians values to degrees, minutes and seconds? - stringstream ss; + std::stringstream ss; double zone; switch (m_ctTypeSupplied) { @@ -781,7 +780,7 @@ void CDnaStation::WriteDNAXMLStn(std::ofstream* dna_ofstream, GeoToGrid(lat_east_x, lon_north_y, &lat_east_x_mod, &lon_north_y_mod, &zone, ellipsoid, projection, true); - ss << fixed << setprecision(0) << zone; + ss << std::fixed << std::setprecision(0) << zone; hemisphereZone = ss.str(); break; @@ -816,9 +815,9 @@ void CDnaStation::WriteDNAXMLStn(std::ofstream* dna_ofstream, } } -void CDnaStation::WriteDNAStn(std::ofstream* dna_ofstream, const string& coordinateType, +void CDnaStation::WriteDNAStn(std::ofstream* dna_ofstream, const std::string& coordinateType, const double& lat_east_x, const double& lon_north_y, const double& ht_zone_z, - string& hemisphereZone, const dna_stn_fields& dsw) + std::string& hemisphereZone, const dna_stn_fields& dsw) { UINT32 LEX_precision(4), LNY_precision(4), HZ_precision(4); @@ -832,25 +831,25 @@ void CDnaStation::WriteDNAStn(std::ofstream* dna_ofstream, const string& coordin break; } - (*dna_ofstream) << left << setw(dsw.stn_name) << m_strName; - (*dna_ofstream) << left << setw(dsw.stn_const) << m_strConstraints; + (*dna_ofstream) << std::left << std::setw(dsw.stn_name) << m_strName; + (*dna_ofstream) << std::left << std::setw(dsw.stn_const) << m_strConstraints; (*dna_ofstream) << " "; - (*dna_ofstream) << left << setw(dsw.stn_type) << coordinateType; - (*dna_ofstream) << right << setw(dsw.stn_e_phi_x) << setprecision(LEX_precision) << fixed << lat_east_x; - (*dna_ofstream) << right << setw(dsw.stn_n_lam_y) << setprecision(LNY_precision) << fixed << lon_north_y; - (*dna_ofstream) << right << setw(dsw.stn_ht_z) << setprecision(HZ_precision) << fixed << ht_zone_z; + (*dna_ofstream) << std::left << std::setw(dsw.stn_type) << coordinateType; + (*dna_ofstream) << std::right << std::setw(dsw.stn_e_phi_x) << std::setprecision(LEX_precision) << std::fixed << lat_east_x; + (*dna_ofstream) << std::right << std::setw(dsw.stn_n_lam_y) << std::setprecision(LNY_precision) << std::fixed << lon_north_y; + (*dna_ofstream) << std::right << std::setw(dsw.stn_ht_z) << std::setprecision(HZ_precision) << std::fixed << ht_zone_z; if (m_ctTypeSupplied == UTM_type_i) - (*dna_ofstream) << right << setw(dsw.stn_hemi_zo) << hemisphereZone; + (*dna_ofstream) << std::right << std::setw(dsw.stn_hemi_zo) << hemisphereZone; else - (*dna_ofstream) << right << setw(dsw.stn_hemi_zo) << " "; + (*dna_ofstream) << std::right << std::setw(dsw.stn_hemi_zo) << " "; (*dna_ofstream) << " "; - (*dna_ofstream) << left << m_strDescription << endl; + (*dna_ofstream) << std::left << m_strDescription << std::endl; } -void CDnaStation::WriteDynaMLStn(std::ofstream* xml_ofstream, const string& coordinateType, +void CDnaStation::WriteDynaMLStn(std::ofstream* xml_ofstream, const std::string& coordinateType, const double& lat_east_x, const double& lon_north_y, const double& ht_zone_z, - string& hemisphereZone) + std::string& hemisphereZone) { UINT32 LEX_precision(4), LNY_precision(4), HZ_precision(4); @@ -865,32 +864,32 @@ void CDnaStation::WriteDynaMLStn(std::ofstream* xml_ofstream, const string& coor break; } - (*xml_ofstream) << " " << endl; - (*xml_ofstream) << " " << m_strName << "" << endl; - (*xml_ofstream) << " " << m_strConstraints << "" << endl; - (*xml_ofstream) << " " << coordinateType << "" << endl; - (*xml_ofstream) << " " << endl; - (*xml_ofstream) << " " << m_strName << "" << endl; - (*xml_ofstream) << " " << setprecision(LEX_precision) << fixed << lat_east_x << "" << endl; - (*xml_ofstream) << " " << setprecision(LNY_precision) << fixed << lon_north_y << "" << endl; - (*xml_ofstream) << " " << setprecision(HZ_precision) << fixed << ht_zone_z << "" << endl; + (*xml_ofstream) << " " << std::endl; + (*xml_ofstream) << " " << m_strName << "" << std::endl; + (*xml_ofstream) << " " << m_strConstraints << "" << std::endl; + (*xml_ofstream) << " " << coordinateType << "" << std::endl; + (*xml_ofstream) << " " << std::endl; + (*xml_ofstream) << " " << m_strName << "" << std::endl; + (*xml_ofstream) << " " << std::setprecision(LEX_precision) << std::fixed << lat_east_x << "" << std::endl; + (*xml_ofstream) << " " << std::setprecision(LNY_precision) << std::fixed << lon_north_y << "" << std::endl; + (*xml_ofstream) << " " << std::setprecision(HZ_precision) << std::fixed << ht_zone_z << "" << std::endl; // Convert radians values to degrees, minutes and seconds if (m_ctTypeSupplied == UTM_type_i) - (*xml_ofstream) << " " << hemisphereZone << "" << endl; + (*xml_ofstream) << " " << hemisphereZone << "" << std::endl; - (*xml_ofstream) << " " << endl; - (*xml_ofstream) << " " << m_strDescription << "" << endl; - (*xml_ofstream) << " " << endl; + (*xml_ofstream) << " " << std::endl; + (*xml_ofstream) << " " << m_strDescription << "" << std::endl; + (*xml_ofstream) << " " << std::endl; } void CDnaStation::WriteGeoidfile(std::ofstream* geo_ofstream) { - (*geo_ofstream) << setw(44) << left << m_strName << - setw(15) << setprecision(3) << fixed << left << m_fgeoidSep << - setw(10) << setprecision(3) << fixed << right << m_dmeridianDef << - setw(10) << setprecision(3) << fixed << right << m_dverticalDef << endl; + (*geo_ofstream) << std::setw(44) << std::left << m_strName << + std::setw(15) << std::setprecision(3) << std::fixed << std::left << m_fgeoidSep << + std::setw(10) << std::setprecision(3) << std::fixed << std::right << m_dmeridianDef << + std::setw(10) << std::setprecision(3) << std::fixed << std::right << m_dverticalDef << std::endl; } @@ -945,10 +944,10 @@ void CDnaStation::SetStationRec(const station_t& stationRecord) m_epoch = stationRecord.epoch; m_epsgCode = stationRecord.epsgCode; - m_referenceFrame = datumFromEpsgCode(LongFromString(m_epsgCode)); + m_referenceFrame = datumFromEpsgCode(LongFromString(m_epsgCode)); } -string CDnaStation::CoordinateName(const char& c) +std::string CDnaStation::CoordinateName(const char& c) { switch (c) { diff --git a/dynadjust/include/measurement_types/dnastation.hpp b/dynadjust/include/measurement_types/dnastation.hpp index 56e2aea0..b68fefb7 100644 --- a/dynadjust/include/measurement_types/dnastation.hpp +++ b/dynadjust/include/measurement_types/dnastation.hpp @@ -55,8 +55,6 @@ #include -using namespace std; -using namespace boost; using namespace dynadjust::datum_parameters; #define XML_INDENT_1 " " @@ -70,15 +68,15 @@ class CDnaStation; // station types typedef boost::shared_ptr dnaStnPtr; -typedef vector vdnaStnPtr; // vector of dnaStnPtr +typedef std::vector vdnaStnPtr, * pvdnaStnPtr; // vector of dnaStnPtr typedef vdnaStnPtr::iterator _it_vdnastnptr; typedef vdnaStnPtr::const_iterator _it_vdnastnptr_const; -typedef pair<_it_vdnastnptr, _it_vdnastnptr> it_pair_dnastnptr; +typedef std::pair<_it_vdnastnptr, _it_vdnastnptr> it_pair_dnastnptr; -typedef vector vASL, *pvASL; +typedef std::vector vASL, *pvASL; typedef vASL::iterator _it_vasl; typedef boost::shared_ptr ASLPtr; -typedef vector vASLPtr, *pvASLPtr; +typedef std::vector vASLPtr, *pvASLPtr; #ifdef _MSC_VER @@ -154,9 +152,9 @@ class CDnaStation #endif { public: - CDnaStation(const string& referenceframe, const string& epoch); + CDnaStation(const std::string& referenceframe, const std::string& epoch); CDnaStation(const CDnaStation&); - CDnaStation(const string& strName, const string& strConstraints, const string& strType, const double& dXAxis, const double& dYAxis, const double& dZAxis, const double& dHeight, const string& strHemisphereZone, const string& strDescription, const string& strComment); + CDnaStation(const std::string& strName, const std::string& strConstraints, const std::string& strType, const double& dXAxis, const double& dYAxis, const double& dZAxis, const double& dHeight, const std::string& strHemisphereZone, const std::string& strDescription, const std::string& strComment); virtual ~CDnaStation(); CDnaStation& operator=(const CDnaStation& rhs); @@ -167,12 +165,12 @@ class CDnaStation friend bool operator<(const CDnaStation& left, const CDnaStation& right); friend bool operator<(const boost::shared_ptr& left, const boost::shared_ptr& right); - inline int CompareStationName(const string& s) { return m_strName.compare(s); } - inline string GetName() const { return m_strName; } - inline string GetOriginalName() const { return m_strOriginalName; } - inline string GetConstraints() const { return m_strConstraints; } + inline int CompareStationName(const std::string& s) { return m_strName.compare(s); } + inline std::string GetName() const { return m_strName; } + inline std::string GetOriginalName() const { return m_strOriginalName; } + inline std::string GetConstraints() const { return m_strConstraints; } inline CONSTRAINT_TYPE GetConstraintType() const { return m_constraintType; } - inline string GetCoordType() const { return m_strType; } + inline std::string GetCoordType() const { return m_strType; } inline double GetXAxis() const { return m_dXAxis; } // X, Easting, Latitude inline double GetYAxis() const { return m_dYAxis; } // Y, Northing, Longitude @@ -182,9 +180,9 @@ class CDnaStation inline double GetEasting() const { return m_dXAxis; } inline double GetNorthing() const { return m_dYAxis; } inline double GetHeight() const { return m_dHeight; } - inline string GetHemisphereZone() const { return m_strHemisphereZone; } - inline string GetDescription() const { return m_strDescription; } - inline string GetComment() const { return m_strComment; } + inline std::string GetHemisphereZone() const { return m_strHemisphereZone; } + inline std::string GetDescription() const { return m_strDescription; } + inline std::string GetComment() const { return m_strComment; } inline double GetcurrentLatitude() const { return m_dcurrentLatitude; } inline double GetcurrentLongitude() const { return m_dcurrentLongitude; } @@ -201,23 +199,23 @@ class CDnaStation inline bool IsUnused() const { return m_unusedStation; } inline bool IsNotUnused() const { return m_unusedStation == false; } - static bool IsValidConstraint(const string& sConst); - static _COORD_TYPE_ GetCoordTypeC(const string& sType); + static bool IsValidConstraint(const std::string& sConst); + static _COORD_TYPE_ GetCoordTypeC(const std::string& sType); _COORD_TYPE_ GetMyCoordTypeC() const; - _HEIGHT_SYSTEM_ GetHeightSystemC(const string& sType) const; + _HEIGHT_SYSTEM_ GetHeightSystemC(const std::string& sType) const; _HEIGHT_SYSTEM_ GetMyHeightSystemC() const; inline _HEIGHT_SYSTEM_ GetMyHeightSystem() const { return m_htType; } - void SetHeightSystem(const string& sType); + void SetHeightSystem(const std::string& sType); void SetHeightSystem(const _HEIGHT_SYSTEM_& type_i); void SetStationRec(const station_t& stationRecord); - void SetXAxis(const string& str); - void SetYAxis(const string& str); - void SetZAxis(const string& str); - void SetHeight(const string& str); - void SetCoordType(const string& sType); + void SetXAxis(const std::string& str); + void SetYAxis(const std::string& str); + void SetZAxis(const std::string& str); + void SetHeight(const std::string& str); + void SetCoordType(const std::string& sType); void ReduceStations_LLH(const CDnaEllipsoid* m_eEllipsoid, const CDnaProjection* m_pProjection); void ReduceStations_XYZ(const CDnaEllipsoid* m_eEllipsoid, const CDnaProjection* m_pProjection); @@ -231,12 +229,12 @@ class CDnaStation inline void SetHeight_d(const double& dHeight) { m_dHeight = dHeight; } inline void SetcurrentHeight_d(const double& dHeight) { m_dcurrentHeight = dHeight; } - inline void SetName(const string& sName) { m_strName = trimstr(sName); } - inline void SetOriginalName(const string& sName) { m_strOriginalName = trimstr(sName); } + inline void SetName(const std::string& sName) { m_strName = trimstr(sName); } + inline void SetOriginalName(const std::string& sName) { m_strOriginalName = trimstr(sName); } inline void SetOriginalName() { m_strOriginalName = m_strName; } - void SetHemisphereZone(const string& sHemisphereZone); - inline void SetDescription(const string& sDescription) { m_strDescription = trimstr(sDescription); } - inline void SetComment(const string& sComment) { m_strComment = trimstr(sComment); } + void SetHemisphereZone(const std::string& sHemisphereZone); + inline void SetDescription(const std::string& sDescription) { m_strDescription = trimstr(sDescription); } + inline void SetComment(const std::string& sComment) { m_strComment = trimstr(sComment); } inline void SetfileOrder(const UINT32& order) { m_lfileOrder = order; } inline void SetnameOrder(const UINT32& order) { m_lnameOrder = order; } @@ -248,18 +246,18 @@ class CDnaStation inline void SetStationUnused() { m_unusedStation = true; } inline void SetStationUse(bool use) { m_unusedStation = use; } - void SetConstraints(const string& str); + void SetConstraints(const std::string& str); - void SetXAxisStdDev(const string& str); - void SetYAxisStdDev(const string& str); - void SetHeightStdDev(const string& str); + void SetXAxisStdDev(const std::string& str); + void SetYAxisStdDev(const std::string& str); + void SetHeightStdDev(const std::string& str); void PrepareStnData(double& lat_east_x, double& lon_north_y, double& ht_zone_z, - string& hemisphereZone, string& coordinateType, + std::string& hemisphereZone, std::string& coordinateType, UINT32& LEX_precision, UINT32& LNY_precision, UINT32& HZ_precision, const CDnaEllipsoid* ellipsoid, const CDnaProjection* projection, bool writeCurrentEstimates); - //void coutStationData(ostream &os, ostream &os2, const UINT16& uType = 0) const; + //void coutStationData(std::ostream &os, ostream &os2, const UINT16& uType = 0) const; void WriteBinaryStn(std::ofstream* binary_stream, const UINT16 bUnused=0); void WriteDNAXMLStnCurrentEstimates(std::ofstream* dna_ofstream, @@ -275,30 +273,30 @@ class CDnaStation const double& lat_east_x, const double& lon_north_y, const double& ht_zone_z, INPUT_FILE_TYPE t, const dna_stn_fields* dsw=0); - void WriteDNAStn(std::ofstream* dna_ofstream, const string& coordinateType, + void WriteDNAStn(std::ofstream* dna_ofstream, const std::string& coordinateType, const double& lat_east_x, const double& lon_north_y, const double& ht_zone_z, - string& hemisphereZone, const dna_stn_fields& dsw); + std::string& hemisphereZone, const dna_stn_fields& dsw); - void WriteDynaMLStn(std::ofstream* xml_ofstream, const string& coordinateType, + void WriteDynaMLStn(std::ofstream* xml_ofstream, const std::string& coordinateType, const double& lat_east_x, const double& lon_north_y, const double& ht_zone_z, - string& hemisphereZone); + std::string& hemisphereZone); void WriteGeoidfile(std::ofstream* binary_stream); - static string CoordinateName(const char& c); + static std::string CoordinateName(const char& c); - inline string GetReferenceFrame() const { return m_referenceFrame; } - inline string GetEpoch() const { return m_epoch; } + inline std::string GetReferenceFrame() const { return m_referenceFrame; } + inline std::string GetEpoch() const { return m_epoch; } - inline void SetReferenceFrame(const string& r) { m_referenceFrame = trimstr(r); } - inline void SetEpoch(const string& e) { m_epoch = trimstr(e); } - inline void SetEpsg(const string& e) { m_epsgCode = trimstr(e); } + inline void SetReferenceFrame(const std::string& r) { m_referenceFrame = trimstr(r); } + inline void SetEpoch(const std::string& e) { m_epoch = trimstr(e); } + inline void SetEpsg(const std::string& e) { m_epsgCode = trimstr(e); } - string m_strName; + std::string m_strName; protected: - string m_strOriginalName; + std::string m_strOriginalName; double m_dXAxis; double m_dYAxis; @@ -310,11 +308,11 @@ class CDnaStation double m_dStdDevZ; double m_dStdDevHt; - string m_strConstraints; - string m_strType; - string m_strHemisphereZone; - string m_strDescription; - string m_strComment; + std::string m_strConstraints; + std::string m_strType; + std::string m_strHemisphereZone; + std::string m_strDescription; + std::string m_strComment; char m_cLatConstraint; char m_cLonConstraint; @@ -335,9 +333,9 @@ class CDnaStation UINT32 m_zone; bool m_unusedStation; - string m_referenceFrame; - string m_epsgCode; - string m_epoch; + std::string m_referenceFrame; + std::string m_epsgCode; + std::string m_epoch; CONSTRAINT_TYPE m_constraintType; }; diff --git a/dynadjust/include/measurement_types/dnastntally.cpp b/dynadjust/include/measurement_types/dnastntally.cpp index 08c1d872..d6a1e89c 100644 --- a/dynadjust/include/measurement_types/dnastntally.cpp +++ b/dynadjust/include/measurement_types/dnastntally.cpp @@ -73,65 +73,65 @@ UINT32 StnTally::TotalCount() { return CCC + FFF + CCF + CFF + FFC + FCC + CFC + FCF; } -void StnTally::addstation(const string& constraint) { +void StnTally::addstation(const std::string& constraint) { - if (iequals(constraint, "CCC")) + if (boost::iequals(constraint, "CCC")) CCC += 1; - else if (iequals(constraint, "FFF")) + else if (boost::iequals(constraint, "FFF")) FFF += 1; - else if (iequals(constraint, "CCF")) + else if (boost::iequals(constraint, "CCF")) CCF += 1; - else if (iequals(constraint, "CFF")) + else if (boost::iequals(constraint, "CFF")) CFF += 1; - else if (iequals(constraint, "FFC")) + else if (boost::iequals(constraint, "FFC")) FFC += 1; - else if (iequals(constraint, "FCC")) + else if (boost::iequals(constraint, "FCC")) FCC += 1; - else if (iequals(constraint, "CFC")) + else if (boost::iequals(constraint, "CFC")) CFC += 1; - else if (iequals(constraint, "FCF")) + else if (boost::iequals(constraint, "FCF")) FCF += 1; } -void StnTally::removestation(const string& constraint) { +void StnTally::removestation(const std::string& constraint) { - if (iequals(constraint, "CCC")) + if (boost::iequals(constraint, "CCC")) { if (CCC > 0) CCC -= 1; } - else if (iequals(constraint, "FFF")) + else if (boost::iequals(constraint, "FFF")) { if (FFF > 0) FFF -= 1; } - else if (iequals(constraint, "CCF")) + else if (boost::iequals(constraint, "CCF")) { if (CCF > 0) CCF -= 1; } - else if (iequals(constraint, "CFF")) + else if (boost::iequals(constraint, "CFF")) { if (CFF > 0) CFF -= 1; } - else if (iequals(constraint, "FFC")) + else if (boost::iequals(constraint, "FFC")) { if (FFC > 0) FFC -= 1; } - else if (iequals(constraint, "FCC")) + else if (boost::iequals(constraint, "FCC")) { if (FCC > 0) FCC -= 1; } - else if (iequals(constraint, "CFC")) + else if (boost::iequals(constraint, "CFC")) { if (CFC > 0) CFC -= 1; } - else if (iequals(constraint, "FCF")) + else if (boost::iequals(constraint, "FCF")) { if (FCF > 0) FCF -= 1; @@ -139,36 +139,36 @@ void StnTally::removestation(const string& constraint) { } -void StnTally::coutSummary(ostream &os, const string& title) +void StnTally::coutSummary(std::ostream &os, const std::string& title) { // Print title - os << title << " " << TotalCount() << " stations:" << endl; + os << title << " " << TotalCount() << " stations:" << std::endl; UINT32 i, w(PRINT_VAR_PAD+NUMERIC_WIDTH); // Print line os << " "; for (i=0; i -using namespace std; - namespace dynadjust { namespace measurements { class StnTally { @@ -47,9 +45,9 @@ class StnTally { const StnTally operator-(const StnTally& rhs) const; UINT32 TotalCount(); - void addstation(const string& constraint); - void removestation(const string& constraint); - void coutSummary(ostream &os, const string& title); + void addstation(const std::string& constraint); + void removestation(const std::string& constraint); + void coutSummary(std::ostream &os, const std::string& title); void CreateTally(const vdnaStnPtr& vStations); UINT32 CCC, FFF, CCF, CFF, FFC, FCC, CFC, FCF; diff --git a/dynadjust/include/memory/dnafile_mapping.cpp b/dynadjust/include/memory/dnafile_mapping.cpp index 8f3e24e1..107578f1 100644 --- a/dynadjust/include/memory/dnafile_mapping.cpp +++ b/dynadjust/include/memory/dnafile_mapping.cpp @@ -71,9 +71,9 @@ block_map_t::block_map_t(const block_map_t &p) void block_map_t::MapRegion(FileMapPtr file_map_ptr) { region_ptr_.reset( - new mapped_region( + new boost::interprocess::mapped_region( *file_map_ptr, - read_write, + boost::interprocess::read_write, region_offset_, data_size_ ) @@ -89,18 +89,18 @@ vmat_file_map::vmat_file_map() } -vmat_file_map::vmat_file_map(const string& filePath, bool remove_mapped_file) +vmat_file_map::vmat_file_map(const std::string& filePath, bool remove_mapped_file) : filePath_(filePath), remove_mapped_file_(remove_mapped_file) { - file_map_ptr_.reset(new file_mapping(filePath_.c_str(), read_write)); + file_map_ptr_.reset(new boost::interprocess::file_mapping(filePath_.c_str(), boost::interprocess::read_write)); } vmat_file_map::~vmat_file_map() { if (remove_mapped_file_) - if (exists(filePath_)) - file_mapping::remove(filePath_.c_str()); + if (boost::filesystem::exists(filePath_)) + boost::interprocess::file_mapping::remove(filePath_.c_str()); } @@ -116,7 +116,7 @@ void vmat_file_map::addblockMapRegion(const block_map_t& map) } -void vmat_file_map::setnewFilePath(const string& filePath, bool remove_mapped_file) +void vmat_file_map::setnewFilePath(const std::string& filePath, bool remove_mapped_file) { filePath_ = filePath; remove_mapped_file_ = remove_mapped_file; @@ -125,7 +125,7 @@ void vmat_file_map::setnewFilePath(const string& filePath, bool remove_mapped_fi void vmat_file_map::CreateFileMapping() { - file_map_ptr_.reset(new file_mapping(filePath_.c_str(), read_write)); + file_map_ptr_.reset(new boost::interprocess::file_mapping(filePath_.c_str(), boost::interprocess::read_write)); } diff --git a/dynadjust/include/memory/dnafile_mapping.hpp b/dynadjust/include/memory/dnafile_mapping.hpp index d544fe34..cb9748bf 100644 --- a/dynadjust/include/memory/dnafile_mapping.hpp +++ b/dynadjust/include/memory/dnafile_mapping.hpp @@ -36,17 +36,11 @@ #include #include -using namespace std; -using namespace boost; -using namespace boost::filesystem; -using namespace boost::interprocess; - - namespace dynadjust { namespace memory { -typedef boost::shared_ptr MapRegPtr; -typedef boost::shared_ptr FileMapPtr; +typedef boost::shared_ptr MapRegPtr; +typedef boost::shared_ptr FileMapPtr; class block_map_t { @@ -78,7 +72,7 @@ class block_map_t MapRegPtr region_ptr_; // shared pointer to the region }; -typedef vector vblock_map; +typedef std::vector vblock_map; typedef vblock_map::iterator _it_block_map; // class to hold addresses and sizes for all matrices @@ -86,13 +80,13 @@ typedef vblock_map::iterator _it_block_map; class vmat_file_map { public: vmat_file_map(); - vmat_file_map(const string& filePath, bool remove_mapped_file); + vmat_file_map(const std::string& filePath, bool remove_mapped_file); ~vmat_file_map(); void reserveblockMapRegions(const UINT32& size); void addblockMapRegion(const block_map_t& map); - void setnewFilePath(const string& filePath, bool remove_mapped_file); + void setnewFilePath(const std::string& filePath, bool remove_mapped_file); void CreateFileMapping(); void MapRegion(const UINT32 block); @@ -105,12 +99,12 @@ class vmat_file_map { vmat_file_map& operator=(const vmat_file_map&); // '' '' vblock_map vblockMapRegions_; - string filePath_; + std::string filePath_; FileMapPtr file_map_ptr_; bool remove_mapped_file_; }; -typedef vector vvmatf_map; +typedef std::vector vvmatf_map; typedef vvmatf_map::iterator _it_vvmatf_map; diff --git a/dynadjust/include/memory/dnamemory_handler.hpp b/dynadjust/include/memory/dnamemory_handler.hpp index 6f33b4f1..e946a51d 100644 --- a/dynadjust/include/memory/dnamemory_handler.hpp +++ b/dynadjust/include/memory/dnamemory_handler.hpp @@ -43,18 +43,16 @@ typedef enum _MEM_UNIT_ { // the following will be truncated //const UINT32 TERABYTE_SIZE = 1099511627776; // 2 ^ 40 -using namespace std; - namespace dynadjust { namespace memory { class new_handler_holder { public: - explicit new_handler_holder(new_handler nh) // acquire current + explicit new_handler_holder(std::new_handler nh) // acquire current : _handler(nh) {} // new handler - ~new_handler_holder() { set_new_handler(_handler); } // release it + ~new_handler_holder() { std::set_new_handler(_handler); } // release it private: - new_handler _handler; + std::new_handler _handler; new_handler_holder(const new_handler_holder&); // prevent copying new_handler_holder& operator=(const new_handler_holder&); // '' '' }; @@ -62,17 +60,17 @@ class new_handler_holder template class new_handler_support { public: - static new_handler set_new_handler(new_handler p) noexcept; + static std::new_handler set_new_handler(std::new_handler p) noexcept; static void* operator new(size_t size) noexcept(false); private: - static new_handler _current_handler; + static std::new_handler _current_handler; }; template -new_handler new_handler_support::set_new_handler(new_handler p) noexcept +std::new_handler new_handler_support::set_new_handler(std::new_handler p) noexcept { - new_handler old_handler = _current_handler; + std::new_handler old_handler = _current_handler; _current_handler = p; return old_handler; } @@ -80,13 +78,13 @@ new_handler new_handler_support::set_new_handler(new_handler p) noexcept template void* new_handler_support::operator new(size_t size) noexcept(false) { - new_handler_holder h(set_new_handler(_current_handler)); + new_handler_holder h(std::set_new_handler(_current_handler)); return ::operator new(size); } // this initialises each _current_handler to null template -new_handler new_handler_support::_current_handler = 0; +std::new_handler new_handler_support::_current_handler = 0; } // namespace memory } // namespace dynadjust diff --git a/dynadjust/include/memory/managed_mapped_file_test.cpp b/dynadjust/include/memory/managed_mapped_file_test.cpp index f0b3f6ec..7d5757bc 100644 --- a/dynadjust/include/memory/managed_mapped_file_test.cpp +++ b/dynadjust/include/memory/managed_mapped_file_test.cpp @@ -16,8 +16,6 @@ #include #include "get_process_id_name.hpp" -using namespace boost::interprocess; - int main () { const int FileSize = 65536*10; diff --git a/dynadjust/include/parameters/dnaconsts-datums.hpp b/dynadjust/include/parameters/dnaconsts-datums.hpp index 705e7ef5..9b04a67e 100644 --- a/dynadjust/include/parameters/dnaconsts-datums.hpp +++ b/dynadjust/include/parameters/dnaconsts-datums.hpp @@ -34,13 +34,13 @@ const UINT16 AGD66_i = 4202; const UINT16 AGD84_i = 4203; -const UINT16 GDA94_i_2d = 4283; // LatLon const UINT16 GDA94_i_xyz = 4938; // XYZ +const UINT16 GDA94_i_2d = 4283; // LatLon const UINT16 GDA94_i = 4939; // LatLonEht const UINT16 GDA2020_i_xyz = 7842; // XYZ -const UINT16 GDA2020_i = 7843; // LatLonEht const UINT16 GDA2020_i_2d = 7844; // LatLon +const UINT16 GDA2020_i = 7843; // LatLonEht const UINT16 ITRF2020_i_xyz = 9988; // XYZ const UINT16 ITRF2020_i = 9989; // LatLonEht @@ -93,11 +93,11 @@ const UINT16 WGS84_ensemble_i = 6326; // WGS84 ensemble const char* const AGD66_c = "4202"; const char* const AGD84_c = "4203"; const char* const GDA94_c_xyz = "4938"; -const char* const GDA94_c = "4939"; const char* const GDA94_c_2d = "4283"; +const char* const GDA94_c = "4939"; const char* const GDA2020_c_xyz = "7842"; -const char* const GDA2020_c = "7843"; const char* const GDA2020_c_2d = "7844"; +const char* const GDA2020_c = "7843"; // epsg strings for ITRF provide XYZ definition only const char* const ITRF2020_c = "9988"; diff --git a/dynadjust/include/parameters/dnadatum.cpp b/dynadjust/include/parameters/dnadatum.cpp index 6012a2a2..a5258a50 100644 --- a/dynadjust/include/parameters/dnadatum.cpp +++ b/dynadjust/include/parameters/dnadatum.cpp @@ -32,7 +32,7 @@ namespace datum_parameters { CDnaDatum::CDnaDatum(void) // "GDA2020 (3D)" - geographic : epsgCode_(DEFAULT_EPSG_U) - , epoch_(date(2020, 1, 1)) + , epoch_(boost::gregorian::date(2020, 1, 1)) , datumType_(STATIC_DATUM) , datumName_(DEFAULT_DATUM) { @@ -45,19 +45,19 @@ CDnaDatum::CDnaDatum(const UINT32& epsgCode) SetDatum(epsgCode); } -CDnaDatum::CDnaDatum(const UINT32& epsgCode, const date& epoch) +CDnaDatum::CDnaDatum(const UINT32& epsgCode, const boost::gregorian::date& epoch) { SetDatum(epsgCode, epoch); } -CDnaDatum::CDnaDatum(const string& epsgCode, const string& epoch) +CDnaDatum::CDnaDatum(const std::string& epsgCode, const std::string& epoch) { SetDatumFromEpsg(epsgCode, epoch); } //// datumName corresponds to the name given in epsg //// epoch is a space delimited string: YYY MM DD -//CDnaDatum::CDnaDatum(const string& datumName, const string& epoch) +//CDnaDatum::CDnaDatum(const std::string& datumName, const std::string& epoch) //{ // datumName_ = datumName; // SetDatumFromName(datumName, epoch); @@ -117,38 +117,38 @@ void CDnaDatum::initialiseDatumFromEpsgCode() datumType_ = DYNAMIC_DATUM; // Set name - datumName_ = datumFromEpsgCode(epsgCode_); + datumName_ = datumFromEpsgCode(epsgCode_); } // returns: // - dd.mm.yyyy for datums that have a reference epoch // - "" for ensembles that do not have an epoch -string CDnaDatum::GetEpoch_s() const +std::string CDnaDatum::GetEpoch_s() const { if (isEpsgWGS84Ensemble(epsgCode_) && isTimeImmemorial(epoch_)) return ""; else if (isTimeImmemorial(epoch_)) return ""; - return stringFromDate(epoch_); + return stringFromDate(epoch_); } -string CDnaDatum::GetEpsgCode_s() const +std::string CDnaDatum::GetEpsgCode_s() const { char epsgCode[8]; sprintf(epsgCode, "%d", epsgCode_); - return string(epsgCode); + return std::string(epsgCode); } void CDnaDatum::SetDatum(const UINT32& epsgCode) { epsgCode_ = epsgCode; - epoch_ = dateFromString(referenceepochFromEpsgCode(epsgCode_)); + epoch_ = dateFromString(referenceepochFromEpsgCode(epsgCode_)); // set datum parameters using epsg code initialiseDatumFromEpsgCode(); } -void CDnaDatum::SetDatum(const UINT32& epsgCode, const date& epoch) +void CDnaDatum::SetDatum(const UINT32& epsgCode, const boost::gregorian::date& epoch) { epsgCode_ = epsgCode; epoch_ = epoch; @@ -157,42 +157,42 @@ void CDnaDatum::SetDatum(const UINT32& epsgCode, const date& epoch) initialiseDatumFromEpsgCode(); } -void CDnaDatum::SetDatum(const string& epsgCode) +void CDnaDatum::SetDatum(const std::string& epsgCode) { // Reuse SetDatum(LongFromString(trimstr(epsgCode))); } -//void CDnaDatum::SetDatum(const string& epsgCode, const date& epoch) +//void CDnaDatum::SetDatum(const std::string& epsgCode, const boost::gregorian::date& epoch) //{ // // Reuse // SetDatum(LongFromString(trimstr(epsgCode)), epoch); //} -void CDnaDatum::SetEpoch(const string& epoch) +void CDnaDatum::SetEpoch(const std::string& epoch) { // Parse epoch if (epoch.empty()) { if (isEpsgWGS84Ensemble(epsgCode_)) - epoch_ = timeImmemorial(); + epoch_ = timeImmemorial(); else - epoch_ = dateFromString(referenceepochFromEpsgCode(epsgCode_)); + epoch_ = dateFromString(referenceepochFromEpsgCode(epsgCode_)); } else - epoch_ = dateFromString(epoch); + epoch_ = dateFromString(epoch); } //void CDnaDatum::SetEpoch(const double& decimal_year) //{ -// epoch_ = dateFromDouble_doy_year(decimal_year); +// epoch_ = dateFromDouble_doy_year(decimal_year); // //} -void CDnaDatum::SetDatumFromName(const string& datumName, const string& epoch) +void CDnaDatum::SetDatumFromName(const std::string& datumName, const std::string& epoch) { // Get epsg code - epsgCode_ = epsgCodeFromName(datumName); + epsgCode_ = epsgCodeFromName(datumName); // Parse epoch SetEpoch(epoch); @@ -201,7 +201,7 @@ void CDnaDatum::SetDatumFromName(const string& datumName, const string& epoch) initialiseDatumFromEpsgCode(); } -void CDnaDatum::SetDatumFromEpsg(const string& epsgCode, const string& epoch) +void CDnaDatum::SetDatumFromEpsg(const std::string& epsgCode, const std::string& epoch) { // Get epsg code epsgCode_ = LongFromString(trimstr(epsgCode)); diff --git a/dynadjust/include/parameters/dnadatum.hpp b/dynadjust/include/parameters/dnadatum.hpp index 797fadbd..b1b557c7 100644 --- a/dynadjust/include/parameters/dnadatum.hpp +++ b/dynadjust/include/parameters/dnadatum.hpp @@ -36,11 +36,6 @@ #include #include -using namespace std; -using namespace boost; -using namespace boost::gregorian; -using namespace boost::local_time; - #include #include #include @@ -56,8 +51,8 @@ class CDnaDatum CDnaDatum(void); CDnaDatum(const UINT32& epsgCode); - CDnaDatum(const UINT32& epsgCode, const date& epoch); - CDnaDatum(const string& epsgCode, const string& epoch); + CDnaDatum(const UINT32& epsgCode, const boost::gregorian::date& epoch); + CDnaDatum(const std::string& epsgCode, const std::string& epoch); virtual inline ~CDnaDatum(void) {} private: @@ -78,26 +73,26 @@ class CDnaDatum inline CDnaEllipsoid GetEllipsoid() const { return ellipsoid_; } inline const CDnaEllipsoid* GetEllipsoidRef() const { return &ellipsoid_; } - string GetName() const { return datumName_; } - string GetEpsgCode_s() const; - string GetEpoch_s() const; + std::string GetName() const { return datumName_; } + std::string GetEpsgCode_s() const; + std::string GetEpoch_s() const; inline UINT32 GetEpsgCode_i() const { return epsgCode_; } - inline date GetEpoch() const { return epoch_; } + inline boost::gregorian::date GetEpoch() const { return epoch_; } inline DATUM_TYPE GetType() const { return datumType_; } inline bool isStatic() const { return datumType_ == STATIC_DATUM; } inline bool isDynamic() const { return datumType_ == DYNAMIC_DATUM; } - inline void SetEpoch(const date& epoch) { epoch_ = epoch; } - void SetEpoch(const string& epoch); + inline void SetEpoch(const boost::gregorian::date& epoch) { epoch_ = epoch; } + void SetEpoch(const std::string& epoch); //void SetEpoch(const double& decimal_year); void SetDatum(const UINT32& epsgCode); - void SetDatum(const UINT32& epsgCode, const date& epoch); - void SetDatum(const string& epsgCode); - //void SetDatum(const string& epsgCode, const date& epoch); + void SetDatum(const UINT32& epsgCode, const boost::gregorian::date& epoch); + void SetDatum(const std::string& epsgCode); + //void SetDatum(const std::string& epsgCode, const boost::gregorian::date& epoch); - void SetDatumFromName(const string& datumName, const string& epoch); - void SetDatumFromEpsg(const string& epsgCode, const string& epoch); + void SetDatumFromName(const std::string& datumName, const std::string& epoch); + void SetDatumFromEpsg(const std::string& epsgCode, const std::string& epoch); //bool isSameFrame(const CDnaDatum& rhs) const; @@ -106,9 +101,9 @@ class CDnaDatum UINT32 epsgCode_; CDnaEllipsoid ellipsoid_; - date epoch_; + boost::gregorian::date epoch_; DATUM_TYPE datumType_; - string datumName_; + std::string datumName_; }; diff --git a/dynadjust/include/parameters/dnadatumprojectionparam.hpp b/dynadjust/include/parameters/dnadatumprojectionparam.hpp index 46930a32..03621e84 100644 --- a/dynadjust/include/parameters/dnadatumprojectionparam.hpp +++ b/dynadjust/include/parameters/dnadatumprojectionparam.hpp @@ -31,8 +31,6 @@ #include -using namespace std; - #include // GRS80 parameters diff --git a/dynadjust/include/parameters/dnaellipsoid.cpp b/dynadjust/include/parameters/dnaellipsoid.cpp index ab01e91e..c44b2ff8 100644 --- a/dynadjust/include/parameters/dnaellipsoid.cpp +++ b/dynadjust/include/parameters/dnaellipsoid.cpp @@ -44,7 +44,7 @@ CDnaEllipsoid::CDnaEllipsoid(const UINT32& epsgCode) CalculateEllipsoidParams(); } -CDnaEllipsoid::CDnaEllipsoid(const string& epsgCode) +CDnaEllipsoid::CDnaEllipsoid(const std::string& epsgCode) { UINT32 epsgCode_uint32 = LongFromString(trimstr(epsgCode)); SetEllipsoid(epsgCode_uint32); diff --git a/dynadjust/include/parameters/dnaellipsoid.hpp b/dynadjust/include/parameters/dnaellipsoid.hpp index 48266c04..d13e676f 100644 --- a/dynadjust/include/parameters/dnaellipsoid.hpp +++ b/dynadjust/include/parameters/dnaellipsoid.hpp @@ -33,8 +33,6 @@ #include #include -using namespace std; - #include #include @@ -48,7 +46,7 @@ class CDnaEllipsoid // predefined ellipsoid CDnaEllipsoid(void); CDnaEllipsoid(const UINT32& epsgCode); - CDnaEllipsoid(const string& epsgCode); + CDnaEllipsoid(const std::string& epsgCode); CDnaEllipsoid(const CDnaEllipsoid& newEllipsoid); // user-defined ellipsoid diff --git a/dynadjust/include/parameters/dnaepsg.hpp b/dynadjust/include/parameters/dnaepsg.hpp index 92fca12e..db7aacc2 100644 --- a/dynadjust/include/parameters/dnaepsg.hpp +++ b/dynadjust/include/parameters/dnaepsg.hpp @@ -39,24 +39,21 @@ #include #include -using namespace std; -using namespace boost; - namespace dynadjust { namespace epsg { // pairs to help parsing epsg codes -typedef pair epsg_string_uint32; -typedef pair epsg_uint32_string; +typedef std::pair epsg_string_uint32; +typedef std::pair epsg_uint32_string; // pairs needed for the epsg structs -typedef pair epsg_unit; -typedef pair epsg_axis; -typedef pair epsg_authority; -typedef pair epsg_parameter; +typedef std::pair epsg_unit; +typedef std::pair epsg_axis; +typedef std::pair epsg_authority; +typedef std::pair epsg_parameter; typedef struct { - string name_; + std::string name_; double semi_major_; double inv_flattening_; epsg_authority authority_; @@ -67,20 +64,20 @@ typedef struct { } epsg_tparams; typedef struct { - string name_; + std::string name_; epsg_spheroid spheroid_; epsg_tparams towgs84_; epsg_authority authority_; } epsg_datum; typedef struct { - string name_; + std::string name_; double value_; epsg_authority authority_; } epsg_primem; typedef struct { - string name; + std::string name; epsg_datum datum_; epsg_primem primem_; epsg_unit unit_; @@ -91,12 +88,12 @@ typedef struct { } epsg_geogcs; typedef struct { - string name_; + std::string name_; epsg_authority authority_; } epsg_projection; typedef struct { - string name_; + std::string name_; epsg_geogcs geogcs_; epsg_projection projection_; epsg_parameter central_meridian_; @@ -119,73 +116,73 @@ typedef struct { template U epsgCodeFromName(const S& datumName) { - if (iequals(datumName, AGD66_s)) + if (boost::iequals(datumName, AGD66_s)) return AGD66_i; - if (iequals(datumName, AGD84_s)) + if (boost::iequals(datumName, AGD84_s)) return AGD84_i; - if (iequals(datumName, GDA94_s)) + if (boost::iequals(datumName, GDA94_s)) return GDA94_i_xyz; - if (iequals(datumName, GDA2020_s)) + if (boost::iequals(datumName, GDA2020_s)) return GDA2020_i_xyz; // ITRF - if (iequals(datumName, ITRF2020_s)) + if (boost::iequals(datumName, ITRF2020_s)) return ITRF2020_i_xyz; - if (iequals(datumName, ITRF2014_s)) + if (boost::iequals(datumName, ITRF2014_s)) return ITRF2014_i_xyz; - if (iequals(datumName, ITRF2008_s)) + if (boost::iequals(datumName, ITRF2008_s)) return ITRF2008_i_xyz; - if (iequals(datumName, ITRF2005_s)) + if (boost::iequals(datumName, ITRF2005_s)) return ITRF2005_i_xyz; - if (iequals(datumName, ITRF2000_s)) + if (boost::iequals(datumName, ITRF2000_s)) return ITRF2000_i_xyz; - if (iequals(datumName, ITRF1997_s) || iequals(datumName, ITRF1997_s_brief)) + if (boost::iequals(datumName, ITRF1997_s) || boost::iequals(datumName, ITRF1997_s_brief)) return ITRF1997_i_xyz; - if (iequals(datumName, ITRF1996_s) || iequals(datumName, ITRF1996_s_brief)) + if (boost::iequals(datumName, ITRF1996_s) || boost::iequals(datumName, ITRF1996_s_brief)) return ITRF1996_i_xyz; - if (iequals(datumName, ITRF1994_s) || iequals(datumName, ITRF1994_s_brief)) + if (boost::iequals(datumName, ITRF1994_s) || boost::iequals(datumName, ITRF1994_s_brief)) return ITRF1994_i_xyz; - if (iequals(datumName, ITRF1993_s) || iequals(datumName, ITRF1993_s_brief)) + if (boost::iequals(datumName, ITRF1993_s) || boost::iequals(datumName, ITRF1993_s_brief)) return ITRF1993_i_xyz; - if (iequals(datumName, ITRF1992_s) || iequals(datumName, ITRF1992_s_brief)) + if (boost::iequals(datumName, ITRF1992_s) || boost::iequals(datumName, ITRF1992_s_brief)) return ITRF1992_i_xyz; - if (iequals(datumName, ITRF1991_s) || iequals(datumName, ITRF1991_s_brief)) + if (boost::iequals(datumName, ITRF1991_s) || boost::iequals(datumName, ITRF1991_s_brief)) return ITRF1991_i_xyz; - if (iequals(datumName, ITRF1990_s) || iequals(datumName, ITRF1990_s_brief)) + if (boost::iequals(datumName, ITRF1990_s) || boost::iequals(datumName, ITRF1990_s_brief)) return ITRF1990_i_xyz; - if (iequals(datumName, ITRF1989_s) || iequals(datumName, ITRF1989_s_brief)) + if (boost::iequals(datumName, ITRF1989_s) || boost::iequals(datumName, ITRF1989_s_brief)) return ITRF1989_i_xyz; - if (iequals(datumName, ITRF1988_s) || iequals(datumName, ITRF1988_s_brief)) + if (boost::iequals(datumName, ITRF1988_s) || boost::iequals(datumName, ITRF1988_s_brief)) return ITRF1988_i_xyz; // WGS84 - if (iequals(datumName, WGS84_s) || - iequals(datumName, WGS84_ensemble_s) || - iequals(datumName, WGS84_alias_s)) + if (boost::iequals(datumName, WGS84_s) || + boost::iequals(datumName, WGS84_ensemble_s) || + boost::iequals(datumName, WGS84_alias_s)) return WGS84_i_xyz; - if (iequals(datumName, WGS84_transit_s) || - iequals(datumName, WGS84_transit_alias_s)) + if (boost::iequals(datumName, WGS84_transit_s) || + boost::iequals(datumName, WGS84_transit_alias_s)) return WGS84_transit_i_xyz; - if (iequals(datumName, WGS84_G730_s) || - iequals(datumName, WGS84_G730_alias_s)) + if (boost::iequals(datumName, WGS84_G730_s) || + boost::iequals(datumName, WGS84_G730_alias_s)) return WGS84_G730_i_xyz; - if (iequals(datumName, WGS84_G873_s) || - iequals(datumName, WGS84_G873_alias_s)) + if (boost::iequals(datumName, WGS84_G873_s) || + boost::iequals(datumName, WGS84_G873_alias_s)) return WGS84_G873_i_xyz; - if (iequals(datumName, WGS84_G1150_s) || - iequals(datumName, WGS84_G1150_alias_s)) + if (boost::iequals(datumName, WGS84_G1150_s) || + boost::iequals(datumName, WGS84_G1150_alias_s)) return WGS84_G1150_i_xyz; - if (iequals(datumName, WGS84_G1674_s) || - iequals(datumName, WGS84_G1674_alias_s)) + if (boost::iequals(datumName, WGS84_G1674_s) || + boost::iequals(datumName, WGS84_G1674_alias_s)) return WGS84_G1674_i_xyz; - if (iequals(datumName, WGS84_G1762_s) || - iequals(datumName, WGS84_G1762_alias_s)) + if (boost::iequals(datumName, WGS84_G1762_s) || + boost::iequals(datumName, WGS84_G1762_alias_s)) return WGS84_G1762_i_xyz; - if (iequals(datumName, WGS84_G2139_s) || - iequals(datumName, WGS84_G2139_alias_s)) + if (boost::iequals(datumName, WGS84_G2139_s) || + boost::iequals(datumName, WGS84_G2139_alias_s)) return WGS84_G2139_i_xyz; - stringstream ss; - ss << "epsgCodeFromName: " << datumName << " is not a supported reference frame label." << endl; - throw boost::enable_current_exception(runtime_error(ss.str())); + std::stringstream ss; + ss << " epsgCodeFromName: '" << datumName << "' is not a supported reference frame label." << std::endl; + throw boost::enable_current_exception(std::runtime_error(ss.str())); } template @@ -206,11 +203,11 @@ S epsgStringFromName(const S& datumName) case GDA94_i: case GDA94_i_2d: case GDA94_i_xyz: - return GDA94_c; + return GDA94_c_xyz; case GDA2020_i: case GDA2020_i_2d: case GDA2020_i_xyz: - return GDA2020_c; + return GDA2020_c_xyz; // ITRF case ITRF2020_i: case ITRF2020_i_xyz: @@ -282,15 +279,15 @@ S epsgStringFromName(const S& datumName) return WGS84_G2139_c; } - stringstream ss; - ss << "epsgCodeFromName: " << datumName << " is either unknown or not yet supported." << endl; - throw boost::enable_current_exception(runtime_error(ss.str())); + std::stringstream ss; + ss << " epsgStringFromName: '" << datumName << "' is either unknown or not yet supported." << std::endl; + throw boost::enable_current_exception(std::runtime_error(ss.str())); } template bool isEpsgDatumStatic(const U& epsgCode) { - stringstream ss; + std::stringstream ss; switch (epsgCode) { @@ -357,8 +354,8 @@ bool isEpsgDatumStatic(const U& epsgCode) case WGS84_G2139_i: return false; default: - ss << "isEpsgDatumStatic: EPSG code " << epsgCode << " is not a supported EPSG code." << endl; - throw boost::enable_current_exception(runtime_error(ss.str())); + ss << " isEpsgDatumStatic: EPSG code '" << epsgCode << "' is not a supported EPSG code." << std::endl; + throw boost::enable_current_exception(std::runtime_error(ss.str())); } return false; } @@ -456,14 +453,14 @@ void spheroidFromEpsgCode(const U& epsgCode, epsg_spheroid& ellipsoid) ellipsoid.semi_major_ = WGS84_a; break; default: - stringstream ss; - ss << "spheroidFromEpsgCode: EPSG code " << epsgCode << " is not a supported EPSG code." << endl; - throw boost::enable_current_exception(runtime_error(ss.str())); + std::stringstream ss; + ss << " spheroidFromEpsgCode: EPSG code '" << epsgCode << "' is not a supported EPSG code." << std::endl; + throw boost::enable_current_exception(std::runtime_error(ss.str())); } } template -string referenceepochFromEpsgCode(const U& epsgCode) +std::string referenceepochFromEpsgCode(const U& epsgCode) { switch (epsgCode) { @@ -551,12 +548,18 @@ string referenceepochFromEpsgCode(const U& epsgCode) case WGS84_G2139_i: return WGS84_G2139_epoch; default: - stringstream ss; - ss << "referenceepochFromEpsgCode: EPSG code " << epsgCode << " is not a supported EPSG code." << endl; - throw boost::enable_current_exception(runtime_error(ss.str())); + std::stringstream ss; + ss << " referenceepochFromEpsgCode: EPSG code '" << epsgCode << "' is not a supported EPSG code." << std::endl; + throw boost::enable_current_exception(std::runtime_error(ss.str())); } return ""; } + +template +S referenceepochFromEpsgString(const S& epsgString) +{ + return referenceepochFromEpsgCode(LongFromString(epsgString)); +} template S datumFromEpsgCode(const U& epsgCode) @@ -650,9 +653,9 @@ S datumFromEpsgCode(const U& epsgCode) case WGS84_G2139_i: return WGS84_G2139_s; default: - stringstream ss; - ss << "datumFromEpsgCode: EPSG code " << epsgCode << " is not a supported EPSG code." << endl; - throw boost::enable_current_exception(runtime_error(ss.str())); + std::stringstream ss; + ss << " datumFromEpsgCode: EPSG code '" << epsgCode << "' is not a supported EPSG code." << std::endl; + throw boost::enable_current_exception(std::runtime_error(ss.str())); } return ""; } @@ -743,9 +746,9 @@ bool validateEpsgCode(const U& epsgCode) case WGS84_G2139_i: return true; default: - stringstream ss; - ss << "validateEpsgCode: EPSG code " << epsgCode << " is not a supported EPSG code." << endl; - throw boost::enable_current_exception(runtime_error(ss.str())); + std::stringstream ss; + ss << " validateEpsgCode: EPSG code '" << epsgCode << "' is not a supported EPSG code." << std::endl; + throw boost::enable_current_exception(std::runtime_error(ss.str())); } return false; } @@ -769,8 +772,8 @@ bool isEpsgWGS84Ensemble(const U& epsgCode) template bool isEpsgStringWGS84Ensemble(const U& epsgString) { - if (iequals(epsgString, WGS84_c) || - iequals(epsgString, WGS84_ensemble_c)) + if (boost::iequals(epsgString, WGS84_c) || + boost::iequals(epsgString, WGS84_ensemble_c)) return true; return false; @@ -809,15 +812,15 @@ bool isEpsgWGS84(const U& epsgCode) template bool isEpsgStringWGS84(const U& epsgString) { - if (iequals(epsgString, WGS84_c) || - iequals(epsgString, WGS84_ensemble_c) || - iequals(epsgString, WGS84_transit_c) || - iequals(epsgString, WGS84_G730_c) || - iequals(epsgString, WGS84_G873_c) || - iequals(epsgString, WGS84_G1150_c) || - iequals(epsgString, WGS84_G1674_c) || - iequals(epsgString, WGS84_G1762_c) || - iequals(epsgString, WGS84_G2139_c)) + if (boost::iequals(epsgString, WGS84_c) || + boost::iequals(epsgString, WGS84_ensemble_c) || + boost::iequals(epsgString, WGS84_transit_c) || + boost::iequals(epsgString, WGS84_G730_c) || + boost::iequals(epsgString, WGS84_G873_c) || + boost::iequals(epsgString, WGS84_G1150_c) || + boost::iequals(epsgString, WGS84_G1674_c) || + boost::iequals(epsgString, WGS84_G1762_c) || + boost::iequals(epsgString, WGS84_G2139_c)) return true; return false; diff --git a/dynadjust/include/parameters/dnaframesubstitutions.hpp b/dynadjust/include/parameters/dnaframesubstitutions.hpp index 72f783a4..dc80aafc 100644 --- a/dynadjust/include/parameters/dnaframesubstitutions.hpp +++ b/dynadjust/include/parameters/dnaframesubstitutions.hpp @@ -39,7 +39,7 @@ namespace frame_substitutions { ///////////////////////////////////////////////////////////// // Custom type to manage frame substitutions -template +template class frame_substitutions_t { public: @@ -75,15 +75,15 @@ class frame_substitutions_t T3 parameters_[7]; // transformation parameters (if any) }; -typedef frame_substitutions_t frame_substitutions; +typedef frame_substitutions_t frame_substitutions; -typedef boost::shared_ptr< frame_substitutions_t > frameSubsPtr; -typedef vector vframeSubsPtr, *pvframeSubsPtr; +typedef boost::shared_ptr< frame_substitutions_t > frameSubsPtr; +typedef std::vector vframeSubsPtr, *pvframeSubsPtr; typedef vframeSubsPtr::iterator _it_vframesubptr; // WGS84 (Transit) to ITRF90 -template +template class WGS84_TRANSIT_ITRF90 : public frame_substitutions_t { public: @@ -103,8 +103,8 @@ class WGS84_TRANSIT_ITRF90 : public frame_substitutions_t frame_substitutions::parameters_[5] = -0.0003; frame_substitutions::parameters_[6] = 0.0070; - frame_substitutions::from_epoch = dateFromString("01.01.1987"); - frame_substitutions::to_epoch = dateFromString("01.01.1994"); + frame_substitutions::from_epoch = dateFromString("01.01.1987"); + frame_substitutions::to_epoch = dateFromString("01.01.1994"); }; ~WGS84_TRANSIT_ITRF90() {} @@ -112,7 +112,7 @@ class WGS84_TRANSIT_ITRF90 : public frame_substitutions_t // WGS84 to ITRF90 -template +template class WGS84_ITRF90 : public frame_substitutions_t { public: @@ -132,8 +132,8 @@ class WGS84_ITRF90 : public frame_substitutions_t frame_substitutions::parameters_[5] = -0.0003; frame_substitutions::parameters_[6] = 0.0070; - frame_substitutions::from_epoch = dateFromString("01.01.1987"); - frame_substitutions::to_epoch = dateFromString("01.01.1994"); + frame_substitutions::from_epoch = dateFromString("01.01.1987"); + frame_substitutions::to_epoch = dateFromString("01.01.1994"); }; ~WGS84_ITRF90() {} @@ -141,7 +141,7 @@ class WGS84_ITRF90 : public frame_substitutions_t // WGS84 (G730) to ITRF91 -template +template class WGS84_G730_ITRF91 : public frame_substitutions_t { public: @@ -153,8 +153,8 @@ class WGS84_G730_ITRF91 : public frame_substitutions_t frame_substitutions::substitute_name = ITRF1991_s_brief; frame_substitutions::substitute_epsg = ITRF1991_i_xyz; - frame_substitutions::from_epoch = dateFromString("02.01.1994"); - frame_substitutions::to_epoch = dateFromString("28.09.1996"); + frame_substitutions::from_epoch = dateFromString("02.01.1994"); + frame_substitutions::to_epoch = dateFromString("28.09.1996"); }; virtual ~WGS84_G730_ITRF91() {} @@ -162,7 +162,7 @@ class WGS84_G730_ITRF91 : public frame_substitutions_t // WGS84 to ITRF91 -template +template class WGS84_ITRF91 : public frame_substitutions_t { public: @@ -174,8 +174,8 @@ class WGS84_ITRF91 : public frame_substitutions_t frame_substitutions::substitute_name = ITRF1991_s_brief; frame_substitutions::substitute_epsg = ITRF1991_i_xyz; - frame_substitutions::from_epoch = dateFromString("02.01.1994"); - frame_substitutions::to_epoch = dateFromString("28.09.1996"); + frame_substitutions::from_epoch = dateFromString("02.01.1994"); + frame_substitutions::to_epoch = dateFromString("28.09.1996"); }; virtual ~WGS84_ITRF91() {} @@ -183,7 +183,7 @@ class WGS84_ITRF91 : public frame_substitutions_t // WGS84 (G873) to ITRF94 -template +template class WGS84_G873_ITRF94 : public frame_substitutions_t { public: @@ -195,15 +195,15 @@ class WGS84_G873_ITRF94 : public frame_substitutions_t frame_substitutions::substitute_name = ITRF1994_s_brief; frame_substitutions::substitute_epsg = ITRF1994_i_xyz; - frame_substitutions::from_epoch = dateFromString("29.09.1996"); - frame_substitutions::to_epoch = dateFromString("19.01.2002"); + frame_substitutions::from_epoch = dateFromString("29.09.1996"); + frame_substitutions::to_epoch = dateFromString("19.01.2002"); }; virtual ~WGS84_G873_ITRF94() {} }; // WGS84 to ITRF94 -template +template class WGS84_ITRF94 : public frame_substitutions_t { public: @@ -215,15 +215,15 @@ class WGS84_ITRF94 : public frame_substitutions_t frame_substitutions::substitute_name = ITRF1994_s_brief; frame_substitutions::substitute_epsg = ITRF1994_i_xyz; - frame_substitutions::from_epoch = dateFromString("29.09.1996"); - frame_substitutions::to_epoch = dateFromString("19.01.2002"); + frame_substitutions::from_epoch = dateFromString("29.09.1996"); + frame_substitutions::to_epoch = dateFromString("19.01.2002"); }; virtual ~WGS84_ITRF94() {} }; // WGS84 (G1150) to ITRF2000 -template +template class WGS84_G1150_ITRF2000 : public frame_substitutions_t { public: @@ -235,15 +235,15 @@ class WGS84_G1150_ITRF2000 : public frame_substitutions_t frame_substitutions::substitute_name = ITRF2000_s; frame_substitutions::substitute_epsg = ITRF2000_i_xyz; - frame_substitutions::from_epoch = dateFromString("20.01.2002"); - frame_substitutions::to_epoch = dateFromString("06.05.2012"); + frame_substitutions::from_epoch = dateFromString("20.01.2002"); + frame_substitutions::to_epoch = dateFromString("06.05.2012"); }; virtual ~WGS84_G1150_ITRF2000() {} }; // WGS84 to ITRF2000 -template +template class WGS84_ITRF2000 : public frame_substitutions_t { public: @@ -255,15 +255,15 @@ class WGS84_ITRF2000 : public frame_substitutions_t frame_substitutions::substitute_name = ITRF2000_s; frame_substitutions::substitute_epsg = ITRF2000_i_xyz; - frame_substitutions::from_epoch = dateFromString("20.01.2002"); - frame_substitutions::to_epoch = dateFromString("06.05.2012"); + frame_substitutions::from_epoch = dateFromString("20.01.2002"); + frame_substitutions::to_epoch = dateFromString("06.05.2012"); }; virtual ~WGS84_ITRF2000() {} }; // WGS84 (G1674) to ITRF2008 -template +template class WGS84_G1674_ITRF2008 : public frame_substitutions_t { public: @@ -275,15 +275,15 @@ class WGS84_G1674_ITRF2008 : public frame_substitutions_t frame_substitutions::substitute_name = ITRF2008_s; frame_substitutions::substitute_epsg = ITRF2008_i_xyz; - frame_substitutions::from_epoch = dateFromString("07.05.2012"); - frame_substitutions::to_epoch = dateFromString("15.10.2013"); + frame_substitutions::from_epoch = dateFromString("07.05.2012"); + frame_substitutions::to_epoch = dateFromString("15.10.2013"); }; virtual ~WGS84_G1674_ITRF2008() {} }; // WGS84 to ITRF2008 -template +template class WGS84_ITRF2008_1 : public frame_substitutions_t { public: @@ -295,15 +295,15 @@ class WGS84_ITRF2008_1 : public frame_substitutions_t frame_substitutions::substitute_name = ITRF2008_s; frame_substitutions::substitute_epsg = ITRF2008_i_xyz; - frame_substitutions::from_epoch = dateFromString("07.05.2012"); - frame_substitutions::to_epoch = dateFromString("15.10.2013"); + frame_substitutions::from_epoch = dateFromString("07.05.2012"); + frame_substitutions::to_epoch = dateFromString("15.10.2013"); }; virtual ~WGS84_ITRF2008_1() {} }; // WGS84 (G1762) to ITRF2008 -template +template class WGS84_G1762_ITRF2008 : public frame_substitutions_t { public: @@ -315,15 +315,15 @@ class WGS84_G1762_ITRF2008 : public frame_substitutions_t frame_substitutions::substitute_name = ITRF2008_s; frame_substitutions::substitute_epsg = ITRF2008_i_xyz; - frame_substitutions::from_epoch = dateFromString("16.10.2013"); - frame_substitutions::to_epoch = dateFromString("02.01.2021"); + frame_substitutions::from_epoch = dateFromString("16.10.2013"); + frame_substitutions::to_epoch = dateFromString("02.01.2021"); }; virtual ~WGS84_G1762_ITRF2008() {} }; // WGS84 to ITRF2008 -template +template class WGS84_ITRF2008_2 : public frame_substitutions_t { public: @@ -335,15 +335,15 @@ class WGS84_ITRF2008_2 : public frame_substitutions_t frame_substitutions::substitute_name = ITRF2008_s; frame_substitutions::substitute_epsg = ITRF2008_i_xyz; - frame_substitutions::from_epoch = dateFromString("16.10.2013"); - frame_substitutions::to_epoch = dateFromString("02.01.2021"); + frame_substitutions::from_epoch = dateFromString("16.10.2013"); + frame_substitutions::to_epoch = dateFromString("02.01.2021"); }; virtual ~WGS84_ITRF2008_2() {} }; // WGS84 (G2139) to ITRF2014 -template +template class WGS84_G2139_ITRF2014 : public frame_substitutions_t { public: @@ -355,15 +355,15 @@ class WGS84_G2139_ITRF2014 : public frame_substitutions_t frame_substitutions::substitute_name = ITRF2014_s; frame_substitutions::substitute_epsg = ITRF2014_i_xyz; - frame_substitutions::from_epoch = dateFromString("02.01.2021"); - frame_substitutions::to_epoch = day_clock::local_day() + years(100); + frame_substitutions::from_epoch = dateFromString("02.01.2021"); + frame_substitutions::to_epoch = boost::gregorian::day_clock::local_day() + boost::gregorian::years(100); }; virtual ~WGS84_G2139_ITRF2014() {} }; // WGS84 to ITRF2014 -template +template class WGS84_ITRF2014 : public frame_substitutions_t { public: @@ -375,8 +375,8 @@ class WGS84_ITRF2014 : public frame_substitutions_t frame_substitutions::substitute_name = ITRF2014_s; frame_substitutions::substitute_epsg = ITRF2014_i_xyz; - frame_substitutions::from_epoch = dateFromString("02.01.2021"); - frame_substitutions::to_epoch = day_clock::local_day() + years(100); + frame_substitutions::from_epoch = dateFromString("02.01.2021"); + frame_substitutions::to_epoch = boost::gregorian::day_clock::local_day() + boost::gregorian::years(100); }; virtual ~WGS84_ITRF2014() {} @@ -425,7 +425,7 @@ struct CompareSubstituteOnFrameName template T binary_search_substitution(T begin, T end, S value) { - T i = lower_bound(begin, end, value, CompareSubstituteOnFrameName< frame_substitutions_t , string>()); + T i = lower_bound(begin, end, value, CompareSubstituteOnFrameName< frame_substitutions_t , std::string>()); if (i != end && i->get()->getFrameName() == value) return i; else diff --git a/dynadjust/include/parameters/dnaplatemotionmodels.hpp b/dynadjust/include/parameters/dnaplatemotionmodels.hpp index 1a27b4c7..6b7e2ae8 100644 --- a/dynadjust/include/parameters/dnaplatemotionmodels.hpp +++ b/dynadjust/include/parameters/dnaplatemotionmodels.hpp @@ -37,9 +37,6 @@ #include -using namespace std; -using namespace boost; - using namespace dynadjust::epsg; namespace dynadjust { diff --git a/dynadjust/include/parameters/dnaprojection.hpp b/dynadjust/include/parameters/dnaprojection.hpp index c4ab93dc..df32f934 100644 --- a/dynadjust/include/parameters/dnaprojection.hpp +++ b/dynadjust/include/parameters/dnaprojection.hpp @@ -33,8 +33,6 @@ #include #include -using namespace std; - #include #include diff --git a/dynadjust/include/parameters/dnatransformationparameters.hpp b/dynadjust/include/parameters/dnatransformationparameters.hpp index a37abbc4..d9ef5ec8 100644 --- a/dynadjust/include/parameters/dnatransformationparameters.hpp +++ b/dynadjust/include/parameters/dnatransformationparameters.hpp @@ -36,9 +36,6 @@ #include -using namespace std; -using namespace boost; - using namespace dynadjust::epsg; namespace dynadjust { @@ -63,7 +60,7 @@ typedef enum __plate_motion_model__ = 8 } transformationType; -template +template S TransformationType(const U& u) { switch (u) @@ -148,7 +145,7 @@ typedef struct transformation_parameter_set_ { } } transformation_parameter_set; -typedef vector vtransparams; +typedef std::vector vtransparams; //////////////////////////////////////////////////////////////////////////////////// diff --git a/dynadjust/include/thread/dnathreading.hpp b/dynadjust/include/thread/dnathreading.hpp index cde8a5ee..43dec1a0 100644 --- a/dynadjust/include/thread/dnathreading.hpp +++ b/dynadjust/include/thread/dnathreading.hpp @@ -33,9 +33,6 @@ #include #include -using namespace std; -using namespace boost; - template class concurrent_block_adjustment { @@ -94,31 +91,31 @@ class concurrent_block_adjustment reset_reverse_run(); } - inline string print_adjusted_forward_blocks() { - stringstream ss(""); + inline std::string print_adjusted_forward_blocks() { + std::stringstream ss(""); boost::lock_guard lock(forward_mutex); - ss << "Forward blocks (" << v_fwd_blocks.size() << "):" << endl; + ss << "Forward blocks (" << v_fwd_blocks.size() << "):" << std::endl; for (UINT32 i=0; i lock(reverse_mutex); - stringstream ss; - ss << "Reverse blocks (" << v_fwd_blocks.size() << "):" << endl; + std::stringstream ss; + ss << "Reverse blocks (" << v_fwd_blocks.size() << "):" << std::endl; for (UINT32 i=0; i > v_fwd_blocks; - vector< sequential_adj_t > v_rev_blocks; + std::vector< sequential_adj_t > v_fwd_blocks; + std::vector< sequential_adj_t > v_rev_blocks; mutable boost::mutex forward_mutex, reverse_mutex, combine_mutex; mutable boost::mutex fwd_state_mutex, rev_state_mutex, cmb_state_mutex; @@ -228,7 +225,7 @@ class concurrent_queue : more_blocks_coming_(true) {} virtual ~concurrent_queue() {} - inline void push_data(const vector& data) + inline void push_data(const std::vector& data) { boost::lock_guard ql(queue_mutex); // push a vector of data elements @@ -335,7 +332,7 @@ class concurrent_queue bool more_blocks_coming_; }; -template +template class concurrent_ofstream { public: @@ -386,7 +383,7 @@ class message_bank } private: - vector messages; + std::vector messages; mutable boost::mutex message_mutex; }; diff --git a/resources/BUILDING.md b/resources/BUILDING.md index 91a395de..25599b45 100644 --- a/resources/BUILDING.md +++ b/resources/BUILDING.md @@ -25,7 +25,7 @@ The following build instructions are only needed if you would like to build DynA To build DynAdjust, the following prerequisites will be needed: -- A C++14 compiler (e.g. gcc, Microsoft Visual Studio or Apple LLVM (clang)) +- A C++14, C++17 or C++20 compiler (e.g. gcc, Microsoft Visual Studio or Apple LLVM (clang)) - Boost C++ headers and libraries - Apache Xerces C++ headers and libraries - Codesynthesis XSD headers and libraries @@ -48,11 +48,11 @@ C++ is required for compiling all DynAdjust binaries. MFC is required only for #### 1.2 Install Boost C++ headers and libraries -The supported versions of boost are 1.58.0 – 1.78.0. The headers and library sources are available from https://www.boost.org/users/download/ +The supported versions of boost are 1.58.0 – 1.87.0. The headers and library sources are available from https://www.boost.org/users/download/ The boost libraries needed by DynAdjust include `filesystem`, `system`, `program_options`, `thread`, `date_time`, `math`, `timer`, `atomic` and `chrono`. These will need to be built from the boost C++ sources using Visual Studio 2022, and installed to a suitable folder on your machine. -Follow the instructions on the [Boost Website](https://www.boost.org/doc/libs/1_78_0/more/getting_started/windows.html#prepare-to-use-a-boost-library-binary) to build the boost libraries from source. For example, the steps are: +Follow the instructions on the [Boost Website](https://www.boost.org/doc/libs/1_87_0/more/getting_started/windows.html#prepare-to-use-a-boost-library-binary) to build the boost libraries from source. For example, the steps are: 1. Download and extract boost to a suitable folder 2. Run `Bootstrap.bat` to build `b2` @@ -73,7 +73,7 @@ rem build b2 using VS 2022 call bootstrap.bat vc143 rem Directory to boost root -set boost_dir=boost_1_78_0 +set boost_dir=boost_1_87_0 rem Store compiled libraries in directories corresponding to 64-bit and 32-bit. set stage_64=C:\Data\boost\%boost_dir%\lib\x64 @@ -118,8 +118,8 @@ provides a convenient way to reference custom boost C++ file paths across the en By default, the boost paths are set as follows. Change these to match the location of the boost header files and libraries on your machine, making sure that `\lib\` contains two folders named `x64` and `Win32` if you need to build 64-bit and 32-bit binaries respectively. -- **BoostIncludeDir:** `C:\Data\boost\boost_1_78_0\include\` -- **BoostLibDir:** `C:\Data\boost\boost_1_78_0\lib\$(Platform)` +- **BoostIncludeDir:** `C:\Data\boost\boost_1_87_0\include\` +- **BoostLibDir:** `C:\Data\boost\boost_1_87_0\lib\$(Platform)` #### 1.3 Install CodeSynthesis XSD and Apache xerces-c headers and libraries @@ -191,7 +191,7 @@ The specific Linux/Mac prerequisites for building DynaAdjust include the followi - gcc-c++ (with std C++ 14 support), with a compatible version of make - cmake (minimum v3.13) - Intel oneAPI Math Kernel Library (MKL) -- boost-devel (minimum v1.58.0. v1.78.0 preferred) +- boost-devel (minimum v1.58.0. v1.87.0 preferred) - xerces-c (3.1.4) - xsd (4.0) - git (if cloning copies from the GitHub repository) diff --git a/resources/DynAdjust Users Guide.pdf b/resources/DynAdjust Users Guide.pdf index 25150884..3a1c7c09 100644 Binary files a/resources/DynAdjust Users Guide.pdf and b/resources/DynAdjust Users Guide.pdf differ diff --git a/resources/make_dynadjust_gcc.sh b/resources/make_dynadjust_gcc.sh index 1b23cac0..5dc1f69a 100755 --- a/resources/make_dynadjust_gcc.sh +++ b/resources/make_dynadjust_gcc.sh @@ -260,12 +260,26 @@ fi cd "$_build_dir" -# 3. copy files: +# 3. copy cmake files: echo "Copying Find*.cmake files to build directory..." cp ../FindXercesC.cmake ./ #cp ../FindMKL.cmake ./ cp ../FindXSD.cmake ./ +# check if MKLROOT environment variable has been set, which means +# intel MKL has been installed. +if [ -z "$MKLROOT" ] +then + # If not, find setvars.h and execute to set environment variables + if [ -e /opt/intel/oneapi/setvars.sh ] + then + echo "Setting environment variables for intel..." + source /opt/intel/oneapi/setvars.sh + fi +else + echo "Intel root: $MKLROOT" +fi + REL_BUILD_TYPE="Release" DBG_BUILD_TYPE="Debug" THIS_BUILD_TYPE=$REL_BUILD_TYPE diff --git a/sampleData/gnss.simult.adj.expected b/sampleData/gnss.simult.adj.expected index b0b2cc2d..8b265bdc 100644 --- a/sampleData/gnss.simult.adj.expected +++ b/sampleData/gnss.simult.adj.expected @@ -18,6 +18,7 @@ Free Station S.D. (m): 10 Iteration threshold: 0.0005 Maximum iterations: 10 Test confidence interval: 95.0% +Uncertainties SD(e,n,up): 68.3% (1 sigma) Station coordinate types: PLHhXYZ Stations printed in blocks: No -------------------------------------------------------------------------------- diff --git a/sampleData/sample.dnaproj b/sampleData/sample.dnaproj index 2461bf20..d2139688 100644 --- a/sampleData/sample.dnaproj +++ b/sampleData/sample.dnaproj @@ -57,7 +57,7 @@ epoch #geoid (35) VALUE -------------------------------------------------------------------------------- -ntv2-file ../../sampleData/urban-network-geoid.gsb +ntv2-file urban-network-geoid.gsb interpolation-method 1 decimal-degrees 0 direction 0 diff --git a/sampleData/urban-networkmsr.xml b/sampleData/urban-networkmsr.xml index 7006d7b7..33bd9fdc 100644 --- a/sampleData/urban-networkmsr.xml +++ b/sampleData/urban-networkmsr.xml @@ -224,7 +224,7 @@ 91.20310000 2.000000e+01 - + V @@ -237,7 +237,7 @@ 1.545 0.125 - + V @@ -4528,7 +4528,7 @@ 1.606 1.715 - + V @@ -4541,7 +4541,7 @@ 1.606 1.715 - + V @@ -4554,7 +4554,7 @@ 1.606 1.565 - + V @@ -4567,7 +4567,7 @@ 1.606 1.337 - + V @@ -4580,7 +4580,7 @@ 1.428 1.514 - + V @@ -4593,7 +4593,7 @@ 1.428 1.645 - + V @@ -4606,7 +4606,7 @@ 1.428 1.570 - + V @@ -4619,7 +4619,7 @@ 1.665 1.337 - + V @@ -4632,7 +4632,7 @@ 1.665 1.445 - + V @@ -4645,7 +4645,7 @@ 1.665 1.386 - + V @@ -4658,7 +4658,7 @@ 1.480 1.570 - + V @@ -4671,7 +4671,7 @@ 1.480 1.422 - + V @@ -4684,7 +4684,7 @@ 1.510 1.514 - + V @@ -4697,7 +4697,7 @@ 1.510 1.384 - + V @@ -4710,7 +4710,7 @@ 1.550 1.660 - + V @@ -4723,7 +4723,7 @@ 1.583 1.460 - + V @@ -4736,7 +4736,7 @@ 1.583 1.625 - + V @@ -4749,7 +4749,7 @@ 1.583 1.660 - + V @@ -4762,7 +4762,7 @@ 1.572 1.460 - + V @@ -4775,7 +4775,7 @@ 1.572 1.625 - + V @@ -4788,7 +4788,7 @@ 1.572 1.358 - + V @@ -4801,7 +4801,7 @@ 1.694 1.532 - + V @@ -4814,7 +4814,7 @@ 1.770 1.565 - + V @@ -4827,7 +4827,7 @@ 1.770 1.432 - + V @@ -4840,7 +4840,7 @@ 1.770 1.574 - + V @@ -4853,7 +4853,7 @@ 1.574 1.210 - + V @@ -4866,7 +4866,7 @@ 1.542 1.300 - + V @@ -4879,7 +4879,7 @@ 1.542 2.595 - + V @@ -4892,7 +4892,7 @@ 1.542 1.559 - + V @@ -4905,7 +4905,7 @@ 1.654 1.362 - + V @@ -4918,7 +4918,7 @@ 1.654 1.445 - + V @@ -4931,7 +4931,7 @@ 1.654 1.743 - + V @@ -4944,7 +4944,7 @@ 1.390 0.000 - + V @@ -4957,7 +4957,7 @@ 1.390 0.000 - + V @@ -4970,7 +4970,7 @@ 1.398 0.000 - + V @@ -4983,7 +4983,7 @@ 1.398 0.000 - + V @@ -4996,7 +4996,7 @@ 1.367 0.000 - + V @@ -5009,7 +5009,7 @@ 1.367 0.000 - + V @@ -5022,7 +5022,7 @@ 1.367 1.908 - + V @@ -5035,7 +5035,7 @@ 1.622 1.425 - + V @@ -5048,7 +5048,7 @@ 1.622 1.571 - + V @@ -5061,7 +5061,7 @@ 1.622 1.523 - + V @@ -5074,7 +5074,7 @@ 1.662 1.523 - + V @@ -5087,7 +5087,7 @@ 1.662 1.535 - + V @@ -5100,7 +5100,7 @@ 1.662 1.461 - + V @@ -5113,7 +5113,7 @@ 1.547 1.678 - + V @@ -5126,7 +5126,7 @@ 1.547 1.573 - + V @@ -5139,7 +5139,7 @@ 1.547 1.492 - + V @@ -5152,7 +5152,7 @@ 1.584 1.456 - + V @@ -5165,7 +5165,7 @@ 1.584 1.588 - + V @@ -5178,7 +5178,7 @@ 1.520 1.588 - + V @@ -5191,7 +5191,7 @@ 1.722 1.537 - + V @@ -5204,7 +5204,7 @@ 1.722 1.510 - + V @@ -5217,7 +5217,7 @@ 1.722 1.469 - + V @@ -5230,7 +5230,7 @@ 1.560 1.627 - + V @@ -5243,7 +5243,7 @@ 1.560 1.759 - + V @@ -5256,7 +5256,7 @@ 1.532 1.272 - + V @@ -5269,7 +5269,7 @@ 1.532 1.763 - + V @@ -5282,7 +5282,7 @@ 1.532 1.513 - + V @@ -5295,7 +5295,7 @@ 1.473 1.545 - + V @@ -5308,7 +5308,7 @@ 1.473 1.763 - + V @@ -5321,7 +5321,7 @@ 1.473 1.580 - + V @@ -5334,7 +5334,7 @@ 1.708 1.860 - + V @@ -5347,7 +5347,7 @@ 1.708 1.545 - + V @@ -5360,7 +5360,7 @@ 1.675 1.523 - + V @@ -5373,7 +5373,7 @@ 1.675 1.502 - + V @@ -5386,7 +5386,7 @@ 1.675 1.528 - + V @@ -5399,7 +5399,7 @@ 1.623 1.524 - + V @@ -5412,7 +5412,7 @@ 1.623 1.472 - + V @@ -5425,7 +5425,7 @@ 1.623 1.578 - + V @@ -5438,7 +5438,7 @@ 1.621 1.524 - + V @@ -5451,7 +5451,7 @@ 1.621 1.493 - + V @@ -5464,7 +5464,7 @@ 1.538 1.113 - + V @@ -5477,7 +5477,7 @@ 1.538 1.380 - + V @@ -5490,7 +5490,7 @@ 1.538 0.000 - + V @@ -5503,7 +5503,7 @@ 1.769 1.481 - + V @@ -5516,7 +5516,7 @@ 1.769 1.416 - + V @@ -5529,7 +5529,7 @@ 1.614 1.500 - + V @@ -5542,7 +5542,7 @@ 1.614 1.404 - + V @@ -5555,7 +5555,7 @@ 1.731 1.500 - + V @@ -5568,7 +5568,7 @@ 1.731 1.404 - + V @@ -5581,7 +5581,7 @@ 1.731 1.392 - + V @@ -5594,7 +5594,7 @@ 1.499 1.433 - + V @@ -5607,7 +5607,7 @@ 1.499 1.638 - + V @@ -5620,7 +5620,7 @@ 1.499 1.401 - + V @@ -5633,7 +5633,7 @@ 1.491 1.410 - + V @@ -5646,7 +5646,7 @@ 1.491 1.452 - + V @@ -5659,7 +5659,7 @@ 1.369 1.401 - + V @@ -5672,7 +5672,7 @@ 1.369 1.410 - + V @@ -5685,7 +5685,7 @@ 1.369 1.539 - + V @@ -5698,7 +5698,7 @@ 1.649 1.436 - + V @@ -5711,7 +5711,7 @@ 1.649 1.444 - + V @@ -5724,7 +5724,7 @@ 1.649 1.634 - + V @@ -5737,7 +5737,7 @@ 1.512 1.410 - + V @@ -5750,7 +5750,7 @@ 1.512 1.470 - + V @@ -5763,7 +5763,7 @@ 1.512 1.614 - + V @@ -5776,7 +5776,7 @@ 1.564 1.419 - + V @@ -5789,7 +5789,7 @@ 1.564 1.614 - + V @@ -5802,7 +5802,7 @@ 1.705 1.489 - + V @@ -5815,7 +5815,7 @@ 1.705 1.470 - + V @@ -5828,7 +5828,7 @@ 1.705 1.642 - + V @@ -5841,7 +5841,7 @@ 1.735 1.614 - + V @@ -5854,7 +5854,7 @@ 1.735 1.413 - + V @@ -5867,7 +5867,7 @@ 1.614 1.433 - + V @@ -5880,7 +5880,7 @@ 1.522 1.543 - + V @@ -5893,7 +5893,7 @@ 1.516 1.543 - + V @@ -5906,7 +5906,7 @@ 1.516 1.550 - + V @@ -5919,7 +5919,7 @@ 1.385 1.394 - + V @@ -5932,7 +5932,7 @@ 1.606 1.616 - + V @@ -5945,7 +5945,7 @@ 1.385 1.368 - + V @@ -5958,7 +5958,7 @@ 1.385 1.287 - + V @@ -5971,7 +5971,7 @@ 1.462 1.291 - + V @@ -5984,7 +5984,7 @@ 1.462 1.296 - + V @@ -5997,7 +5997,7 @@ 1.392 1.369 - + V @@ -6010,7 +6010,7 @@ 1.392 1.295 - + V @@ -6023,7 +6023,7 @@ 1.392 1.340 - + V @@ -6036,7 +6036,7 @@ 1.393 1.329 - + V @@ -6049,7 +6049,7 @@ 1.393 1.298 - + V @@ -6062,7 +6062,7 @@ 1.640 1.570 - + V @@ -6075,7 +6075,7 @@ 1.540 1.530 - + V @@ -6088,7 +6088,7 @@ 1.540 1.520 - + V @@ -6101,7 +6101,7 @@ 1.540 1.530 - + V @@ -6114,7 +6114,7 @@ 1.530 1.550 - + V @@ -6127,7 +6127,7 @@ 1.490 1.450 - + V @@ -6140,7 +6140,7 @@ 1.240 1.690 - + V @@ -6153,7 +6153,7 @@ 1.550 1.470 - + V @@ -6166,7 +6166,7 @@ 1.540 1.080 - + V @@ -6179,7 +6179,7 @@ 1.603 1.190 - + V @@ -6192,7 +6192,7 @@ 1.696 1.604 - + V @@ -6205,7 +6205,7 @@ 1.696 1.616 - + V @@ -6218,7 +6218,7 @@ 1.696 1.634 - + V @@ -6231,7 +6231,7 @@ 1.490 1.570 - + V @@ -6244,7 +6244,7 @@ 1.530 1.355 - + V @@ -6257,7 +6257,7 @@ 1.530 1.550 - + V @@ -6270,7 +6270,7 @@ 1.540 1.540 - + V @@ -6283,7 +6283,7 @@ 1.312 1.237 - + V @@ -6296,7 +6296,7 @@ 1.312 1.458 - + V @@ -6309,7 +6309,7 @@ 1.468 1.523 - + V @@ -6322,7 +6322,7 @@ 1.548 1.615 - + V @@ -6335,7 +6335,7 @@ 1.319 1.314 - + V @@ -6348,7 +6348,7 @@ 1.319 1.581 - + V @@ -6361,7 +6361,7 @@ 1.688 1.665 - + V @@ -6374,7 +6374,7 @@ 1.322 1.581 - + V @@ -6387,7 +6387,7 @@ 1.322 1.338 - + V @@ -6400,7 +6400,7 @@ 1.338 1.306 - + V @@ -6413,7 +6413,7 @@ 1.310 1.306 - + V @@ -6426,7 +6426,7 @@ 1.370 1.438 - + V @@ -6439,7 +6439,7 @@ 1.381 1.361 - + V @@ -6452,7 +6452,7 @@ 1.540 1.510 - + V @@ -6465,7 +6465,7 @@ 1.540 1.540 - + V @@ -6478,7 +6478,7 @@ 1.560 1.480 - + V @@ -6491,7 +6491,7 @@ 1.520 1.530 - + V @@ -6504,7 +6504,7 @@ 1.520 1.520 - + V @@ -6517,7 +6517,7 @@ 1.530 1.550 - + V @@ -6530,7 +6530,7 @@ 1.540 1.540 - + V @@ -6543,7 +6543,7 @@ 1.560 1.600 - + V @@ -6556,7 +6556,7 @@ 1.644 1.641 - + V @@ -6569,7 +6569,7 @@ 1.490 1.590 - + V @@ -6582,7 +6582,7 @@ 1.540 1.080 - + V @@ -6595,7 +6595,7 @@ 1.540 1.615 - + V @@ -6608,7 +6608,7 @@ 1.540 1.580 - + V @@ -6621,7 +6621,7 @@ 1.170 1.675 - + V @@ -6634,7 +6634,7 @@ 1.520 1.530 - + V @@ -6647,7 +6647,7 @@ 1.570 0.880 - + V @@ -6660,7 +6660,7 @@ 1.545 1.610 - + V @@ -6673,7 +6673,7 @@ 1.505 2.000 - + V @@ -6686,7 +6686,7 @@ 1.738 1.704 - + V @@ -6699,7 +6699,7 @@ 1.505 1.514 - + V @@ -6712,7 +6712,7 @@ 1.612 1.414 - + V @@ -6725,7 +6725,7 @@ 1.612 1.322 - + V @@ -6738,7 +6738,7 @@ 1.412 1.514 - + V @@ -6751,7 +6751,7 @@ 1.412 1.305 - + V @@ -6764,7 +6764,7 @@ 1.555 1.415 - + V @@ -6777,7 +6777,7 @@ 1.555 1.492 - + V @@ -6790,7 +6790,7 @@ 1.501 1.461 - + V @@ -6803,7 +6803,7 @@ 1.501 1.492 - + V @@ -6816,7 +6816,7 @@ 1.601 1.406 - + V @@ -6829,7 +6829,7 @@ 1.601 1.337 - + V @@ -6842,7 +6842,7 @@ 1.601 1.337 - + V @@ -6855,7 +6855,7 @@ 1.601 1.406 - + V @@ -6868,7 +6868,7 @@ 1.549 1.333 - + V @@ -6881,7 +6881,7 @@ 1.549 1.619 - + V @@ -6894,7 +6894,7 @@ 1.549 1.619 - + V @@ -6907,7 +6907,7 @@ 1.549 1.530 - + V @@ -6920,7 +6920,7 @@ 1.525 1.578 - + V @@ -6933,7 +6933,7 @@ 1.730 1.493 - + V @@ -6946,7 +6946,7 @@ 1.730 1.242 - + V @@ -8031,7 +8031,7 @@ 111.18442000 2.000000e+01 - + V @@ -8044,7 +8044,7 @@ 1.608 1.560 - + V @@ -8057,7 +8057,7 @@ 1.608 1.500 - + V @@ -8070,7 +8070,7 @@ 1.608 1.474 - + V @@ -8083,7 +8083,7 @@ 1.608 1.425 - + V @@ -8096,7 +8096,7 @@ 1.608 1.482 - + V @@ -8109,7 +8109,7 @@ 1.562 1.567 - + V @@ -8122,7 +8122,7 @@ 1.562 1.472 - + V @@ -8135,7 +8135,7 @@ 1.562 1.467 - + V @@ -8148,7 +8148,7 @@ 1.562 1.486 - + V @@ -8161,7 +8161,7 @@ 1.562 1.501 - + V @@ -8174,7 +8174,7 @@ 1.562 1.512 - + V @@ -8187,7 +8187,7 @@ 1.604 1.533 - + V @@ -8200,7 +8200,7 @@ 1.604 1.567 - + V @@ -8213,7 +8213,7 @@ 1.604 1.472 - + V @@ -8226,7 +8226,7 @@ 1.604 1.467 - + V @@ -8239,7 +8239,7 @@ 1.604 1.512 - + V @@ -8252,7 +8252,7 @@ 1.604 1.560 - + V @@ -8265,7 +8265,7 @@ 1.580 1.472 - + V @@ -8278,7 +8278,7 @@ 1.580 1.533 - + V @@ -8291,7 +8291,7 @@ 1.580 1.486 - + V @@ -8304,7 +8304,7 @@ 1.580 1.501 - + V @@ -8317,7 +8317,7 @@ 1.580 1.579 - + V @@ -8330,7 +8330,7 @@ 1.580 1.472 - + V @@ -8343,7 +8343,7 @@ 1.580 1.512 - + V @@ -8356,7 +8356,7 @@ 1.580 1.528 - + V @@ -8369,7 +8369,7 @@ 1.537 1.570 - + V @@ -8382,7 +8382,7 @@ 1.537 1.530 - + V @@ -8395,7 +8395,7 @@ 1.457 1.448 - + V @@ -8408,7 +8408,7 @@ 1.457 1.470 - + V @@ -8421,7 +8421,7 @@ 1.457 1.627 - + V @@ -8434,7 +8434,7 @@ 1.457 1.510 - + V @@ -8447,7 +8447,7 @@ 1.457 1.450 - + V @@ -8460,7 +8460,7 @@ 1.457 1.530 - + V @@ -8473,7 +8473,7 @@ 1.457 1.530 - + V @@ -8486,7 +8486,7 @@ 1.575 1.577 - + V @@ -8499,7 +8499,7 @@ 1.575 1.530 - + V @@ -8512,7 +8512,7 @@ 1.575 1.448 - + V @@ -8525,7 +8525,7 @@ 1.575 1.470 - + V @@ -8538,7 +8538,7 @@ 1.575 1.450 - + V @@ -8551,7 +8551,7 @@ 1.575 1.627 - + V @@ -8564,7 +8564,7 @@ 1.570 1.618 - + V @@ -8577,7 +8577,7 @@ 1.570 1.548 - + V @@ -8590,7 +8590,7 @@ 1.570 1.607 - + V @@ -8603,7 +8603,7 @@ 1.570 1.575 - + V @@ -8616,7 +8616,7 @@ 1.570 1.802 - + V @@ -8629,7 +8629,7 @@ 1.615 1.538 - + V @@ -8642,7 +8642,7 @@ 1.615 1.505 - + V @@ -8655,7 +8655,7 @@ 1.615 1.578 - + V @@ -8668,7 +8668,7 @@ 1.615 1.496 - + V @@ -8681,7 +8681,7 @@ 1.615 1.583 - + V @@ -8694,7 +8694,7 @@ 1.615 1.538 - + V @@ -8707,7 +8707,7 @@ 1.615 1.595 - + V @@ -8720,7 +8720,7 @@ 1.615 1.525 - + V @@ -8733,7 +8733,7 @@ 1.620 1.505 - + V @@ -8746,7 +8746,7 @@ 1.620 1.523 - + V @@ -8759,7 +8759,7 @@ 1.620 1.555 - + V @@ -8772,7 +8772,7 @@ 1.620 1.496 - + V @@ -8785,7 +8785,7 @@ 1.620 1.578 - + V @@ -8798,7 +8798,7 @@ 1.620 1.583 - + V @@ -8811,7 +8811,7 @@ 1.620 1.538 - + V @@ -8824,7 +8824,7 @@ 1.612 1.505 - + V @@ -8837,7 +8837,7 @@ 1.612 1.578 - + V @@ -8850,7 +8850,7 @@ 1.612 1.583 - + V @@ -8863,7 +8863,7 @@ 1.612 1.538 - + V @@ -8876,7 +8876,7 @@ 1.582 1.659 - + V @@ -8889,7 +8889,7 @@ 1.582 1.583 - + V @@ -8902,7 +8902,7 @@ 1.582 1.563 - + V @@ -8915,7 +8915,7 @@ 1.582 1.538 - + V @@ -8928,7 +8928,7 @@ 1.582 1.496 - + V @@ -8941,7 +8941,7 @@ 1.582 1.504 - + V @@ -8954,7 +8954,7 @@ 1.576 1.676 - + V @@ -8967,7 +8967,7 @@ 1.587 1.656 - + V @@ -8980,7 +8980,7 @@ 1.576 1.581 - + V @@ -8993,7 +8993,7 @@ 1.587 1.645 - + V @@ -9006,7 +9006,7 @@ 1.576 1.451 - + V @@ -9019,7 +9019,7 @@ 1.587 1.624 - + V @@ -9032,7 +9032,7 @@ 1.576 1.411 - + V @@ -9045,7 +9045,7 @@ 1.587 1.601 - + V @@ -9058,7 +9058,7 @@ 1.620 1.561 - + V @@ -9071,7 +9071,7 @@ 1.529 1.581 - + V @@ -9084,7 +9084,7 @@ 1.620 1.573 - + V @@ -9097,7 +9097,7 @@ 1.529 1.620 - + V @@ -9110,7 +9110,7 @@ 1.620 1.610 - + V @@ -9123,7 +9123,7 @@ 1.529 1.411 - + V @@ -9136,7 +9136,7 @@ 1.620 1.601 - + V @@ -9149,7 +9149,7 @@ 1.397 1.425 - + V @@ -9162,7 +9162,7 @@ 1.397 1.411 - + V @@ -9175,7 +9175,7 @@ 1.397 1.557 - + V @@ -9188,7 +9188,7 @@ 1.397 1.558 - + V @@ -9201,7 +9201,7 @@ 1.579 1.376 - + V @@ -9214,7 +9214,7 @@ 1.590 1.583 - + V @@ -9227,7 +9227,7 @@ 1.579 1.425 - + V @@ -9240,7 +9240,7 @@ 1.590 1.624 - + V @@ -9253,7 +9253,7 @@ 1.579 1.558 - + V @@ -9266,7 +9266,7 @@ 1.590 1.604 - + V @@ -9279,7 +9279,7 @@ 1.579 1.557 - + V @@ -10644,7 +10644,7 @@ 1.730 1.346 - + V @@ -10990,7 +10990,7 @@ 178.46090000 2.000000e+01 - + V @@ -11003,7 +11003,7 @@ 1.550 1.572 - + V @@ -11016,7 +11016,7 @@ 1.358 1.565 - + V @@ -11029,7 +11029,7 @@ 1.458 1.210 - + V @@ -11042,7 +11042,7 @@ 1.458 1.295 - + V @@ -11055,7 +11055,7 @@ 1.314 1.295 - + V @@ -11068,7 +11068,7 @@ 1.581 1.371 - + V @@ -11081,7 +11081,7 @@ 1.310 1.259 - + V @@ -11094,7 +11094,7 @@ 1.730 1.346 - + V @@ -11107,7 +11107,7 @@ 1.652 1.545 - + V @@ -11120,7 +11120,7 @@ 1.510 1.585 - + V @@ -11133,7 +11133,7 @@ 1.735 1.543 - + V @@ -11146,7 +11146,7 @@ 1.538 0.000 - + V