Line data Source code
1 : //# ComponentType2.cc: this defines ComponentType2.cc 2 : //# Copyright (C) 1997,1998,1999 3 : //# Associated Universities, Inc. Washington DC, USA. 4 : //# 5 : //# This library is free software; you can redistribute it and/or modify it 6 : //# under the terms of the GNU Library General Public License as published by 7 : //# the Free Software Foundation; either version 2 of the License, or (at your 8 : //# option) any later version. 9 : //# 10 : //# This library is distributed in the hope that it will be useful, but WITHOUT 11 : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 : //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 13 : //# License for more details. 14 : //# 15 : //# You should have received a copy of the GNU Library General Public License 16 : //# along with this library; if not, write to the Free Software Foundation, 17 : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 18 : //# 19 : //# Correspondence concerning AIPS++ should be addressed as follows: 20 : //# Internet email: aips2-request@nrao.edu. 21 : //# Postal address: AIPS++ Project Office 22 : //# National Radio Astronomy Observatory 23 : //# 520 Edgemont Road 24 : //# Charlottesville, VA 22903-2475 USA 25 : //# 26 : //# $Id: ComponentType2.cc 21130 2011-10-18 07:39:05Z gervandiepen $ 27 : 28 : #include <components/ComponentModels/ComponentType.h> 29 : #include <components/ComponentModels/ComponentShape.h> 30 : #include <components/ComponentModels/ConstantSpectrum.h> 31 : #include <components/ComponentModels/DiskShape.h> 32 : #include <components/ComponentModels/LimbDarkenedDiskShape.h> 33 : #include <components/ComponentModels/GaussianShape.h> 34 : #include <components/ComponentModels/PointShape.h> 35 : #include <components/ComponentModels/PowerLogPoly.h> 36 : #include <components/ComponentModels/SpectralIndex.h> 37 : #include <components/ComponentModels/SpectralModel.h> 38 : #include <components/ComponentModels/TabularSpectrum.h> 39 : 40 : using namespace casacore; 41 : namespace casa { //# NAMESPACE CASA - BEGIN 42 : 43 : // The functions declared below are contained in a seperate .cc file to prevent 44 : // all the derived classes from unnecessarily being linked in when they are not 45 : // needed. 46 : 47 1447 : ComponentShape* ComponentType:: 48 : construct(ComponentType::Shape shapeEnum) { 49 1447 : switch (shapeEnum) { 50 89 : case ComponentType::POINT: 51 89 : return new PointShape; 52 735 : case ComponentType::GAUSSIAN: 53 735 : return new GaussianShape; 54 623 : case ComponentType::DISK: 55 623 : return new DiskShape; 56 0 : case ComponentType::LDISK: 57 0 : return new LimbDarkenedDiskShape; 58 0 : default: 59 0 : return reinterpret_cast<ComponentShape*>(0); 60 : }; 61 : } 62 : 63 5391 : SpectralModel* ComponentType::construct( 64 : ComponentType::SpectralShape spectralEnum 65 : ) { 66 5391 : switch (spectralEnum) { 67 212 : case ComponentType::CONSTANT_SPECTRUM: 68 212 : return new ConstantSpectrum; 69 714 : case ComponentType::SPECTRAL_INDEX: 70 714 : return new SpectralIndex; 71 4280 : case ComponentType::TABULAR_SPECTRUM: 72 4280 : return new TabularSpectrum; 73 185 : case ComponentType::PLP: 74 185 : return new PowerLogPoly; 75 0 : default: 76 0 : return reinterpret_cast<SpectralModel*>(0); 77 : }; 78 : } 79 : // Local Variables: 80 : // compile-command: "gmake ComponentType2" 81 : // End: 82 : 83 : } //# NAMESPACE CASA - END 84 :