/**
* Default constructor.
*/
-RS_FilterCXF::RS_FilterCXF(): RS_FilterInterface()
+FilterCXF::FilterCXF(): FilterInterface()
{
- RS_DEBUG->print("Setting up CXF filter...");
+ DEBUG->print("Setting up CXF filter...");
addImportFormat(RS2::FormatCXF);
addExportFormat(RS2::FormatCXF);
}
-RS_FilterCXF::~RS_FilterCXF()
+FilterCXF::~FilterCXF()
{
}
* will be created or the graphics from which the entities are
* taken to be stored in a file.
*/
-bool RS_FilterCXF::fileImport(Drawing & g, const QString & file, RS2::FormatType /*type*/)
+bool FilterCXF::fileImport(Drawing & g, const QString & file, RS2::FormatType /*type*/)
{
- RS_DEBUG->print("CXF Filter: importing file '%s'...", file.toLatin1().data());
+ DEBUG->print("CXF Filter: importing file '%s'...", file.toLatin1().data());
//this->graphic = &g;
bool success = false;
// Load font file as we normally do, but the font doesn't own the
// letters (we'll add them to the graphic instead. Hence 'false').
- RS_Font font(file, false);
+ Font font(file, false);
success = font.loadFont();
if (!success)
{
- RS_DEBUG->print(RS_Debug::D_WARNING, "Cannot open CXF file '%s'.", file.toLatin1().data());
+ DEBUG->print(Debug::D_WARNING, "Cannot open CXF file '%s'.", file.toLatin1().data());
return false;
}
if (!font.getEncoding().isEmpty())
g.addVariable("Encoding", font.getEncoding(), 0);
- RS_BlockList * letterList = font.getLetterList();
+ BlockList * letterList = font.getLetterList();
for(uint i=0; i<font.countLetters(); i++)
{
- RS_Block * ch = font.letterAt(i);
+ Block * ch = font.letterAt(i);
QString uCode;
uCode.setNum(ch->getName().at(0).unicode(), 16);
*
* @param file Full path to the CXF file that will be written.
*/
-bool RS_FilterCXF::fileExport(Drawing & g, const QString & file, RS2::FormatType /*type*/)
+bool FilterCXF::fileExport(Drawing & g, const QString & file, RS2::FormatType /*type*/)
{
- RS_DEBUG->print("CXF Filter: exporting file '%s'...", file.toAscii().data());
+ DEBUG->print("CXF Filter: exporting file '%s'...", file.toAscii().data());
// crashes under windoze xp:
//std::ofstream fout;
- RS_DEBUG->print("RS_FilterCXF::fileExport: open");
+ DEBUG->print("FilterCXF::fileExport: open");
//fout.open((const char*)file.local8Bit());
FILE * fp;
if ((fp = fopen((const char *)file.toLocal8Bit(), "wt")) != NULL)
{
- RS_DEBUG->print("RS_FilterCXF::fileExport: open: OK");
- RS_DEBUG->print("RS_FilterCXF::fileExport: header");
+ DEBUG->print("FilterCXF::fileExport: open: OK");
+ DEBUG->print("FilterCXF::fileExport: header");
// header:
fprintf(fp, "# Format: QCad II Font\n");
- fprintf(fp, "# Creator: %s\n", (const char *)RS_SYSTEM->getAppName().toLocal8Bit());
- fprintf(fp, "# Version: %s\n", (const char *)RS_SYSTEM->getAppVersion().toLocal8Bit());
+ fprintf(fp, "# Creator: %s\n", (const char *)SYSTEM->getAppName().toLocal8Bit());
+ fprintf(fp, "# Version: %s\n", (const char *)SYSTEM->getAppVersion().toLocal8Bit());
- RS_DEBUG->print("001");
+ DEBUG->print("001");
QString ns = g.getVariableString("Names", "");
if (!ns.isEmpty())
{
QStringList names = ns.split(',');
- RS_DEBUG->print("002");
+ DEBUG->print("002");
for(QStringList::Iterator it=names.begin(); it!=names.end(); ++it)
{
}
}
- RS_DEBUG->print("003");
+ DEBUG->print("003");
QString es = g.getVariableString("Encoding", "");
if (!es.isEmpty())
fprintf(fp, "# Encoding: %s\n", (const char *)es.toLocal8Bit());
- RS_DEBUG->print("004a");
+ DEBUG->print("004a");
fprintf(fp, "# LetterSpacing: %f\n", g.getVariableDouble("LetterSpacing", 3.0));
fprintf(fp, "# WordSpacing: %f\n", g.getVariableDouble("WordSpacing", 6.75));
fprintf(fp, "# LineSpacingFactor: %f\n", g.getVariableDouble("LineSpacingFactor", 1.0));
QString sa = g.getVariableString("Authors", "");
- RS_DEBUG->print("authors: %s", (const char *)sa.toLocal8Bit());
+ DEBUG->print("authors: %s", (const char *)sa.toLocal8Bit());
if (!sa.isEmpty())
{
QStringList authors = sa.split(',');
- RS_DEBUG->print("006");
- RS_DEBUG->print("count: %d", authors.count());
+ DEBUG->print("006");
+ DEBUG->print("count: %d", authors.count());
QString a;
for(QStringList::Iterator it2=authors.begin(); it2!=authors.end(); ++it2)
{
- RS_DEBUG->print("006a");
+ DEBUG->print("006a");
a = QString(*it2);
- RS_DEBUG->print("006b");
- RS_DEBUG->print("string is: %s", a.toAscii().data());
- RS_DEBUG->print("006b0");
+ DEBUG->print("006b");
+ DEBUG->print("string is: %s", a.toAscii().data());
+ DEBUG->print("006b0");
fprintf(fp, "# Author: ");
- RS_DEBUG->print("006b1");
+ DEBUG->print("006b1");
fprintf(fp, "%s\n", a.toAscii().data());
//fout << "# Author: " << a.ascii() << "\n";
}
- RS_DEBUG->print("007");
+ DEBUG->print("007");
}
- RS_DEBUG->print("RS_FilterCXF::fileExport: header: OK");
+ DEBUG->print("FilterCXF::fileExport: header: OK");
- RS_DEBUG->print("008");
+ DEBUG->print("008");
// iterate through blocks (=letters of font)
for(uint i=0; i<g.countBlocks(); ++i)
{
- RS_Block * blk = g.blockAt(i);
+ Block * blk = g.blockAt(i);
- RS_DEBUG->print("block: %d", i);
- RS_DEBUG->print("001");
+ DEBUG->print("block: %d", i);
+ DEBUG->print("001");
if (blk != NULL)
{
- RS_DEBUG->print("002");
- RS_DEBUG->print("002a: %s", (const char *)(blk->getName().toLocal8Bit()));
+ DEBUG->print("002");
+ DEBUG->print("002a: %s", (const char *)(blk->getName().toLocal8Bit()));
fprintf(fp, "\n%s\n", (const char *)(blk->getName().toLocal8Bit()));
// iterate through entities of this letter:
- for(RS_Entity * e=blk->firstEntity(RS2::ResolveAll); e!=NULL;
+ for(Entity * e=blk->firstEntity(RS2::ResolveAll); e!=NULL;
e=blk->nextEntity(RS2::ResolveAll))
{
if (!e->isUndone())
{
- RS_DEBUG->print("004");
+ DEBUG->print("004");
// lines:
if (e->rtti() == RS2::EntityLine)
{
- RS_Line * l = (RS_Line *)e;
+ Line * l = (Line *)e;
fprintf(fp, "L %f,%f,%f,%f\n", l->getStartpoint().x, l->getStartpoint().y,
l->getEndpoint().x, l->getEndpoint().y);
// arcs:
else if (e->rtti() == RS2::EntityArc)
{
- RS_Arc * a = (RS_Arc *)e;
+ Arc * a = (Arc *)e;
if (!a->isReversed())
{
}
}
- RS_DEBUG->print("005");
+ DEBUG->print("005");
}
- RS_DEBUG->print("006");
+ DEBUG->print("006");
}
- RS_DEBUG->print("007");
+ DEBUG->print("007");
}
//fout.close();
fclose(fp);
- RS_DEBUG->print("CXF Filter: exporting file: OK");
+ DEBUG->print("CXF Filter: exporting file: OK");
return true;
}
else
{
- RS_DEBUG->print("CXF Filter: exporting file failed");
+ DEBUG->print("CXF Filter: exporting file failed");
}
return false;
*
* @param value A double value. e.g. 2.700000
*/
-void RS_FilterCXF::stream(std::ofstream & fs, double value)
+void FilterCXF::stream(std::ofstream & fs, double value)
{
- fs << (const char *)RS_Utility::doubleToString(value).toAscii().data();
+ fs << (const char *)Utility::doubleToString(value).toAscii().data();
}