Exemple #1
0
Origin *Locator::relocate(const Origin *origin)
{
	_count++;

// vvvvvvvvvvvvvvvvv
// FIXME: This is still needed, but it would be better to get rid of it!
	// if the origin to relocate has a fixed depth, keep it fixed!
	if (fixedDepth(origin)) {
		setFixedDepth(origin->dep);
	}
// ^^^^^^^^^^^^^^^^
/*
	else
		useFixedDepth(false);
*/


	Origin* relo = _sc3relocate(origin);
	if (relo == NULL)
		return NULL;

	if (relo->dep <= _minDepth &&
	    relo->depthType != Origin::DepthManuallyFixed &&
	    ! usingFixedDepth()) {

			// relocate again, this time fixing the depth to _minDepth
			// NOTE: This reconfigures the locator temporarily!
			setFixedDepth(_minDepth, true);
			Origin *relo2 = _sc3relocate(origin);
			useFixedDepth(false); // restore free depth

			if (relo2 != NULL) {
				delete relo;
				relo = relo2;
				relo->depthType = Origin::DepthMinimum;
			}
			else {
				delete relo;
				return NULL;
			}
	}

	OriginQuality &q = relo->quality;
	if ( ! determineAzimuthalGaps(relo, &q.aziGapPrimary, &q.aziGapSecondary))
		q.aziGapPrimary = q.aziGapSecondary = 360.;

	OriginErrorEllipsoid &e = relo->errorEllipsoid;
	e.sdobs         = errorEllipsoid().sdobs;
	double norm     = 1./e.sdobs;
	e.semiMajorAxis = norm*errorEllipsoid().smajax;
	e.semiMinorAxis = norm*errorEllipsoid().sminax;
	e.strike        = norm*errorEllipsoid().strike;
	e.sdepth        = norm*errorEllipsoid().sdepth;
	e.stime         = norm*errorEllipsoid().stime;
	e.conf          = errorEllipsoid().conf;

	return relo;
}
void LocatorInterface::releaseDepth() {
	useFixedDepth(false);
}