/** * Get a VGImage pointer decided by the filename extension. * - filename.svg == SVImage* * - filename.ps == PSImage* * - filename.eps == EPSImage* * @note This does not necessarily cover all constructors of all of * these classes but in general will cover the most cases. * @param fname The file name to create an image for * @param width Width of the canvas in points * @param height Height of the canvas in points * @param iloc Location on the page of the overall origin */ static VGImage* create(std::string fname, double width=VGImage::US_LETTER_WIDTH_PTS, double height=VGImage::US_LETTER_HEIGHT_PTS, VGImage::ORIGIN_LOCATION iloc=VGImage::LOWER_LEFT) throw (VDrawException) { size_t i = fname.find_last_of('.'); if ((string::npos != i) && (i != fname.length()-1)) { string ext = fname.substr(i+1); if( ext == "ps" ) return new PSImage(fname.c_str(),width,height,iloc); else if( ext == "eps" ) return new EPSImage(fname.c_str(),0,0,width,height,iloc); else if( ext == "svg" ) return new SVGImage(fname.c_str(),width,height,iloc); } throw VDrawException("Non-supported file name..."); }
/** * Write the footer, flush the stream, and view the output. */ virtual void view(void) throw (VDrawException) { throw VDrawException("No appropriate viewer has been defined.");}