#include <RingCouples.h>
List of all members.
Constructor & Destructor Documentation
Member Function Documentation
References name(), and str.
Referenced by SPACLoop::setParameters().
{
QString str;
str += QString( " --- Ring %1\n" ).arg(name());
double totalWeight=0;
int nCouples=count();
for(int i=0;i < nCouples;i++ ) {
str += QString( "%1 azimuth=%2 weight=%3\n" ).
arg(at( i) ->name()).arg(at( i) ->azimuth().degrees()).arg(_weights[ i ] );
totalWeight += _weights[ i ];
}
str += QString( "Total weight=%1\n" ).arg(totalWeight);
return str;
}
void ArrayCore::RingCouples::operator= |
( |
const RingCouples & |
o | ) |
|
Identify couples belonging to this ring and store the weight of all of them. The range for angle does not matter (it can be from 0 to M_PI or -M_PI/2 to M_PI/2), but must be in radians.
References ArrayCore::StationCouple::azimuth(), QGpCoreTools::Angle::degrees(), ArrayCore::StationCouple::distance(), QGpCoreWave::AutocorrRing::maxRadius(), QGpCoreWave::AutocorrRing::minRadius(), TRACE, and weight().
Referenced by ArrayCore::SPACParameters::addRing().
{
TRACE;
clear();
int nCouples=couples.count();
int iCouple;
for(iCouple=0;iCouple < nCouples;iCouple++ ) {
const StationCouple& cp=couples[ iCouple ];
if(cp.distance() >= minRadius() && cp.distance() <= maxRadius()) {
append(&cp);
}
}
qSort(begin(), end(), lessThan);
nCouples=count();
if(nCouples==0) {
return false;
}
delete _weights;
_weights=new double [ nCouples ];
const StationCouple * cp;
const StationCouple * lastcp=at(0);
double azimuth, lastAzimuth=0;
int nStatPerAzimuth=1;
for(iCouple=1;iCouple < nCouples;iCouple++ ) {
cp=at(iCouple);
if(cp->azimuth()==lastcp->azimuth()) nStatPerAzimuth++;
else {
azimuth=(cp->azimuth().degrees() + lastcp->azimuth().degrees()) * 0.5;
if(nStatPerAzimuth==1) _weights[ iCouple - 1 ]=azimuth - lastAzimuth;
else {
double weight=(azimuth - lastAzimuth)/nStatPerAzimuth;
int n=iCouple - 1 - nStatPerAzimuth;
for(int i=iCouple - 1;i > n;i-- )
_weights[ i ]=weight;
nStatPerAzimuth=1;
}
lastAzimuth=azimuth;
}
lastcp=cp;
}
double weight=(180.0 - lastAzimuth)/nStatPerAzimuth;
int n=nCouples - 1 - nStatPerAzimuth;
for(int i=nCouples - 1;i > n;i-- )
_weights[ i ] =weight;
return true;
}
The documentation for this class was generated from the following files: