Esempio n. 1
0
/**
 * Calls the export method of the object responsible for the format
 * of the given file.
 *
 * @param file Path and name of the file to import.
 */
bool RS_FileIO::fileExport(RS_Graphic& graphic, const QString& file,
        RS2::FormatType type) {

    RS_DEBUG->print("RS_FileIO::fileExport");
    //RS_DEBUG->print("Trying to export file '%s'...", file.latin1());

    if (type==RS2::FormatUnknown) {
        QString extension;
        extension = QFileInfo(file).suffix().toLower();

        if (extension=="dxf") {
            type = RS2::FormatDXFRW;
        }
        else if (extension=="cxf") {
            type = RS2::FormatCXF;
        }
        else if (extension=="lff") {
            type = RS2::FormatLFF;
        }
    }

    std::unique_ptr<RS_FilterInterface> filter(getExportFilter(file, type));
    if (filter.get() != NULL ){
        return filter->fileExport(graphic, file, type);
    }
    RS_DEBUG->print("RS_FileIO::fileExport: no filter found");

    return false;
}
Esempio n. 2
0
/**
 * Calls the export method of the object responsible for the format
 * of the given file.
 *
 * @param file Path and name of the file to import.
 */
bool RS_FileIO::fileExport(RS_Graphic& graphic, const QString& file,
        RS2::FormatType type) {

    RS_DEBUG->print("RS_FileIO::fileExport");
    //RS_DEBUG->print("Trying to export file '%s'...", file.latin1());

    if (type==RS2::FormatUnknown) {
		type=detectFormat(file, false);
    }

	std::unique_ptr<RS_FilterInterface>&& filter(getExportFilter(file, type));
	if (filter){
        return filter->fileExport(graphic, file, type);
    }
    RS_DEBUG->print("RS_FileIO::fileExport: no filter found");

    return false;
}