diff --git a/pyhelios/simulation_build.py b/pyhelios/simulation_build.py index a5db4ca4f..b777fb7cc 100644 --- a/pyhelios/simulation_build.py +++ b/pyhelios/simulation_build.py @@ -85,7 +85,9 @@ def copy(self): Return: SimulationBuild which is a copy of current one """ - copySim = SimulationBuild(None, None, None, None, None, None, True) + copySim = SimulationBuild( + None, None, None, None, None, None, None, None, True + ) copySim.sim = self.sim.copy() return copySim diff --git a/pyhelios/simulation_builder.py b/pyhelios/simulation_builder.py index 60568e1b4..e1558a89c 100644 --- a/pyhelios/simulation_builder.py +++ b/pyhelios/simulation_builder.py @@ -148,7 +148,8 @@ def build(self): self.writeWaveform, self.calcEchowidth, self.fullwaveNoise, - self.platformNoiseDisabled + self.platformNoiseDisabled, + False ) if self.callback is not None: build.sim.setCallback(self.callback) diff --git a/src/main/helios_version.cpp b/src/main/helios_version.cpp index b4a426775..0242f54a3 100644 --- a/src/main/helios_version.cpp +++ b/src/main/helios_version.cpp @@ -4,7 +4,7 @@ const char * HELIOS_VERSION = "1.3.0"; -const char * HELIOS_GIT_HASH = "107d3ee5"; +const char * HELIOS_GIT_HASH = "917263d4"; const char * getHeliosVersion(){ return HELIOS_VERSION; diff --git a/src/pybinds/PyHelios.cpp b/src/pybinds/PyHelios.cpp index febedd9b1..805f03ad4 100644 --- a/src/pybinds/PyHelios.cpp +++ b/src/pybinds/PyHelios.cpp @@ -153,6 +153,11 @@ BOOST_PYTHON_MODULE(_pyhelios){ &PyHeliosSimulation::newLeg, return_internal_reference<>() ) + .def( + "newLegFromTemplate", + &PyHeliosSimulation::newLegFromTemplate, + return_internal_reference<>() + ) .def( "newScanningStrip", &PyHeliosSimulation::newScanningStrip, diff --git a/src/pybinds/PyHeliosSimulation.cpp b/src/pybinds/PyHeliosSimulation.cpp index da16ef7b0..76db70439 100644 --- a/src/pybinds/PyHeliosSimulation.cpp +++ b/src/pybinds/PyHeliosSimulation.cpp @@ -98,10 +98,20 @@ Leg & PyHeliosSimulation::newLeg(int index){ int const n = (int) survey->legs.size(); if(index<0 || index>n) index = n; std::shared_ptr leg = std::make_shared(); - leg->mScannerSettings = - std::make_shared(); - leg->mPlatformSettings = - std::make_shared(); + leg->mScannerSettings = std::make_shared(); + leg->mPlatformSettings = std::make_shared(); + survey->addLeg(index, leg); + return *leg; +} + +Leg & PyHeliosSimulation::newLegFromTemplate( + int index, + Leg &baseLeg +){ + int const n = (int) survey->legs.size(); + if(index<0 || index>n) index = n; + std::shared_ptr leg = std::make_shared(baseLeg); + leg->setSerialId(index); survey->addLeg(index, leg); return *leg; } @@ -312,13 +322,15 @@ void PyHeliosSimulation::loadSurvey( bool writeWaveform, bool calcEchowidth, bool fullWaveNoise, - bool platformNoiseDisabled + bool platformNoiseDisabled, + bool writePulse ){ xmlreader->sceneLoader.kdtFactoryType = kdtFactory; xmlreader->sceneLoader.kdtNumJobs = kdtJobs; xmlreader->sceneLoader.kdtSAHLossNodes = kdtSAHLossNodes; survey = xmlreader->load(legNoiseDisabled, rebuildScene); survey->scanner->setWriteWaveform(writeWaveform); + survey->scanner->setWritePulse(writePulse); survey->scanner->setCalcEchowidth(calcEchowidth); survey->scanner->setFullWaveNoise(fullWaveNoise); survey->scanner->setPlatformNoiseDisabled(platformNoiseDisabled); diff --git a/src/pybinds/PyHeliosSimulation.h b/src/pybinds/PyHeliosSimulation.h index ed3bc51b4..59cac82ad 100644 --- a/src/pybinds/PyHeliosSimulation.h +++ b/src/pybinds/PyHeliosSimulation.h @@ -176,11 +176,23 @@ class PyHeliosSimulation{ {survey->legs.erase(survey->legs.begin() + index);} /** * @brief Create a new empty leg - * @param index The index specifying the position in the survey where the - * leg will be inserted - * @return Created empty leg + * @param index The index specifying the position in the survey where the + * leg will be inserted. + * @return Created leg. */ Leg & newLeg(int index); + /** + * @brief Create a new leg from a template. + * @param index The index specifying the position in the survey where the + * leg will be inserted. + * @param baseLeg The leg to be used as a template to build the new leg. + * If null, the new leg will be created fully from scratch. + * @return Created leg. + */ + Leg & newLegFromTemplate( + int index, + Leg &baseLeg + ); /** * @brief Create a new empty scanning strip (with no legs) * @param stripId The identifier for the strip @@ -390,7 +402,8 @@ class PyHeliosSimulation{ bool writeWaveform = false, bool calcEchowidth = false, bool fullWaveNoise = false, - bool platformNoiseDisabled = true + bool platformNoiseDisabled = true, + bool writePulse = false ); void addRotateFilter( double q0, diff --git a/src/scanner/MultiScanner.cpp b/src/scanner/MultiScanner.cpp index 860d2da21..7e610b657 100644 --- a/src/scanner/MultiScanner.cpp +++ b/src/scanner/MultiScanner.cpp @@ -8,7 +8,7 @@ // ************************************ // MultiScanner::MultiScanner(MultiScanner &scanner) : Scanner(scanner), - scanDevs(std::move(scanner.scanDevs)) + scanDevs(scanner.scanDevs) {} diff --git a/src/sim/comps/Survey.cpp b/src/sim/comps/Survey.cpp index 11cb76ec8..41c003de5 100644 --- a/src/sim/comps/Survey.cpp +++ b/src/sim/comps/Survey.cpp @@ -19,7 +19,9 @@ Survey::Survey(Survey &survey, bool const deepCopy){ // Copy Scanner this->scanner = survey.scanner->clone(); - this->scanner->getDetector()->scanner = this->scanner; + for(size_t i = 0 ; i < this->scanner->getNumDevices() ; ++i){ + this->scanner->getDetector(i)->scanner = this->scanner; + } // Copy legs this->legs = std::vector>(0); diff --git a/src/sim/core/SurveyPlayback.cpp b/src/sim/core/SurveyPlayback.cpp index 838e5da21..a382a01fc 100644 --- a/src/sim/core/SurveyPlayback.cpp +++ b/src/sim/core/SurveyPlayback.cpp @@ -517,7 +517,7 @@ void SurveyPlayback::clearPointcloudFile(){ // Dont clear strip file, it would overwrite previous point cloud content if(getCurrentLeg()->isContainedInAStrip()) return; // Dont clear pcloud file, if leg is not active there is nothing to clear - // Otherwise, WATCHOUT because last active leg might be overwriten + // Otherwise, WATCH OUT because last active leg might be overwriten if(!getCurrentLeg()->mScannerSettings->active) return; fms->write.clearPointcloudFile(); }