00001 //------------------------------------------------------------------------ 00002 // 00003 // Joe Kniss 00004 // 6-20-03 00005 // ________ ____ ___ 00006 // | \ / | / / 00007 // +---+ \/ |/ / 00008 // +--+| |\ /| < 00009 // | || | \ / | |\ \ 00010 // | | \/ | | \ \ 00011 // \_____| |__| \__\ 00012 // Copyright 2003 00013 // Joe Michael Kniss 00014 // <<< jmk@cs.utah.edu >>> 00015 // "All Your Base are Belong to Us" 00016 //------------------------------------------------------------------------- 00017 00018 00019 #include "TFItem.h" 00020 #include <tf/TFElementSTD.h> 00021 #include "TFItemSTD.h" 00022 00023 ////////////////////////////////////////////////////////////////////////// 00024 /// TFItem Factory function 00025 /// 00026 /// this simple function generates the correct TFItem for each TFElement type 00027 /// if you add a new TFElement type, you should also have a corresponding 00028 /// TFItem, modify this funciton to produce the right one. 00029 TFItemSP genTFItem(TFEltSP elt, QCanvas *canvas) 00030 { 00031 if( TFElementBox * box = dynamic_cast<TFElementBox*>(elt.getPtr()) ) 00032 { 00033 return TFItemSP( new TFBoxItem(canvas,box) ); 00034 } 00035 00036 return TFItemSP(0); 00037 }