00001 #include "vuSphericFilterFactory.h"
00002
00003 template <int S, class T>
00004 vuSphericFilter<S,T> *vuSphericFilterFactory<S,T>::getFilter(dword idx)
00005 {
00006 static vuString *filterNames = NULL;
00007 static dword count = 0;
00008
00009 if (filterNames == NULL)
00010 vuSphericFilterFactory<S,T>::getFilterNames(filterNames, count);
00011
00012 if (idx < count)
00013 return getFilter(filterNames[idx]);
00014 else
00015 return NULL;
00016 }
00017
00018
00019 template <int S, class T> vuSphericFilter<S,T> *
00020 vuSphericFilterFactory<S,T>::getFilter(const vuString &filterName)
00021 {
00022 if (filterName == "BestMatch")
00023 return new vuSphLfFlt_BestMatch<S,T>("BestMatch");
00024 else if (filterName == "Line")
00025 return new vuSphLfFlt_Line<S,T>("Line");
00026 else if (filterName == "Triangle")
00027 return new vuSphLfFlt_Triangle<S,T>("Triangle");
00028 else if (filterName == "Z-Axis")
00029 return new vuSphLfFlt_Z_Axis<S,T>("Z-Axis");
00030 else if (filterName == "XZ-Axis")
00031 return new vuSphLfFlt_XZ_Axis<S,T>("XZ-Axis");
00032 else if (filterName == "XYZ-Axis")
00033 return new vuSphLfFlt_XYZ_Axis<S,T>("XYZ-Axis");
00034 else if (filterName == "All")
00035 return new vuSphLfFlt_All<S,T>("All");
00036 else if (filterName == "Fit Angle")
00037 return new vuSphLfFlt_FitAngle<S,T>("Fit Angle");
00038 else if (filterName == "Nearest")
00039 return new vuSphLfFlt_Nearest<S,T>("Nearest");
00040 else
00041 return NULL;
00042 }
00043
00044 template <int S, class T>
00045 void vuSphericFilterFactory<S,T>::getFilterNames(vuString* &filterNames,
00046 dword &numberOfNames)
00047 {
00048 static const dword count = 9;
00049 static const vuString result[count] = { "BestMatch",
00050 "Line",
00051 "Triangle",
00052 "Z-Axis",
00053 "XZ-Axis",
00054 "XYZ-Axis",
00055 "All",
00056 "Fit Angle",
00057 "Nearest"};
00058
00059
00060 filterNames = (vuString *)result;
00061 numberOfNames = count;
00062 }