3 #include "lsst/meas/extensions/psfex/Field.hh" 
   12 namespace lsst { 
namespace meas { 
namespace extensions { 
namespace psfex {
 
   15     impl(NULL), _isInitialized(false)
 
   17     QCALLOC(impl, fieldstruct, 1);
 
   21     impl->rcatname = impl->catname;
 
   23     strncpy(impl->rtcatname, impl->rcatname, 
sizeof(impl->rtcatname) - 1);
 
   24     strncpy(impl->ident, 
"??", 
sizeof(impl->ident) - 1);
 
   26     if (!(impl->rcatname = 
strrchr(impl->catname, 
'/'))) {
 
   27         impl->rcatname = impl->catname;
 
   32     strncpy(impl->rtcatname, impl->rcatname, 
sizeof(impl->rtcatname) - 1);
 
   34         char *pstr=
strrchr(impl->rtcatname, 
'.');
 
   40     strncpy(impl->ident, 
"??", 
sizeof(impl->ident) - 1);
 
   52     for (
int i = 0; i != impl->next; ++i) {
 
   63 Field::_finalize(
bool force)
 
   65     if (force || !_isInitialized) {
 
   66         field_init_finalize(impl);
 
   67         _isInitialized = 
true;
 
   74 Field::getPsfs()
 const 
   78         for (
int i = 0; i != impl->next; ++i) {
 
   79             _psfs.push_back(Psf(impl->psf[i]));
 
   88               int const naxis1, 
int const naxis2,
 
   91     QREALLOC(impl->psf, psfstruct *, impl->next + 1);
 
   92     impl->psf[impl->next] = 0;
 
   93     QREALLOC(impl->wcs, wcsstruct *, impl->next + 1);
 
   94     impl->wcs[impl->next] = 0;
 
   98     QMALLOC(impl->wcs[impl->next], wcsstruct, 1);
 
   99     wcsstruct *
wcs = impl->wcs[impl->next];
 
  102     wcs->naxisn[0] = naxis1;
 
  103     wcs->naxisn[1] = naxis2;
 
  111     for (
int i = 0; i != 
wcs->naxis; ++i) {
 
  113         auto ctype = metadata->getAsString(
"CTYPE" + 
std::to_string(ifits));
 
  114         strncpy(
wcs->ctype[i], ctype.c_str(), ctype.size() + 1);
 
  115         strncpy(
wcs->cunit[i], cunit.c_str(), cunit.size() + 1);
 
  117         wcs->crval[i] = 
crval[i].asDegrees();
 
  122     for (
int i = 0, k = 0; i < 2; ++i) {
 
  123         for (
int j = 0; j < 2; ++j, ++k) {
 
  124             wcs->cd[k] = cdMatrix(i, j);
 
  132     wcs->wcsscalepos[0] = center.getLongitude().asDegrees();
 
  133     wcs->wcsscalepos[1] = center.getLatitude().asDegrees();
 
  135     double maxradius = 0.0;             
 
  136     for (
int x = 0; 
x <= 1; ++
x) {
 
  137         for (
int y = 0; 
y <= 1; ++
y) {
 
  139             double const radius = center.separation(wcs_.
pixelToSky(point)).asDegrees();
 
  145     wcs->wcsmaxradius = maxradius;