]> Shamusworld >> Repos - architektonas/blobdiff - src/base/filterdxf1.cpp
Major refactor of Architektonas: Jettisoning old cruft.
[architektonas] / src / base / filterdxf1.cpp
diff --git a/src/base/filterdxf1.cpp b/src/base/filterdxf1.cpp
deleted file mode 100644 (file)
index 75dbbaf..0000000
+++ /dev/null
@@ -1,1897 +0,0 @@
-// filterdxf1.cpp
-//
-// Part of the Architektonas Project
-// Originally part of QCad Community Edition by Andrew Mustun
-// Extensively rewritten and refactored by James L. Hammons
-// Portions copyright (C) 2001-2003 RibbonSoft
-// Copyright (C) 2010 Underground Software
-// See the README and GPLv2 files for licensing and warranty information
-//
-// JLH = James L. Hammons <jlhamm@acm.org>
-//
-// Who  When        What
-// ---  ----------  -----------------------------------------------------------
-// JLH  05/28/2010  Added this text. :-)
-//
-
-#include "filterdxf1.h"
-
-#include <iostream>
-#include "filterdxf.h"
-#include "font.h"
-#include "information.h"
-#include "utility.h"
-#include "system.h"
-#include "dimlinear.h"
-#include "dimaligned.h"
-#include "dimangular.h"
-#include "dimdiametric.h"
-#include "dimradial.h"
-
-/**
- * Default constructor.
- */
-FilterDXF1::FilterDXF1(): FilterInterface()
-{
-       DEBUG->print("Setting up DXF 1 filter...");
-       graphic = NULL;
-       addImportFormat(RS2::FormatDXF1);
-}
-
-/**
- * Implementation of the method used for RS_Import to communicate
- * with this filter.
- *
- * @param graphic The graphic in which the entities from the file
- * will be created or the graphics from which the entities are
- * taken to be stored in a file.
- */
-bool FilterDXF1::fileImport(Drawing& g, const QString& file, RS2::FormatType /*type*/)
-{
-       DEBUG->print("DXF1 Filter: importing file '%s'...", file.toLatin1().data());
-
-       this->graphic = &g;
-
-       fPointer = 0;
-       fBuf = 0;
-       fBufP = 0;
-       fSize = 0;
-       dosFile = false;
-       name = file;
-
-       if (readFileInBuffer())
-       {
-               separateBuf();
-               return readFromBuffer();
-       }
-
-       return false;
-}
-
-
-
-/**
- * Reads a dxf1 file from buffer.
- */
-bool FilterDXF1::readFromBuffer()
-{
-       DEBUG->print("\nDXF: Read from buffer");
-
-       bool      ret;                    // returned value
-       QString dxfLine;                // A line in the dxf file
-       QString dxfCode;                // A Code in the dxf file as string
-       int       code = -1;                // Dxf-code as number
-       double    vx1 = 0.0, vy1 = 0.0;       // Start point
-       double    vx2 = 0.0, vy2 = 0.0;       // End point
-       double    vcx = 0.0, vcy = 0.0;       // Centre
-       double    vcr = 0.0;                // Radius
-       double    va1 = 0.0, va2 = 0.0;       // Start / End Angle
-       //double    vab=0.0,                // Bulge
-       //           vpx=0.0, vpy=0.0;       // First Polyline point
-       //double    ax=0.0, ay=0.0;         // Current coordinate
-       //bool      plClose=false;          // Polyline closed-flag
-       QString lastLayer;              // Last used layer name (test adding only
-       //   if the new layer!=lastLayer)
-       //int       currentLayerNum=0;      // Current layer number
-       Layer * currentLayer = 0;         // Pointer to current layer
-       //QList<RGraphic> blockList;        // List of blocks
-       //blockList.setAutoDelete( true );
-       //bool      oldColorNumbers=false;  // use old color numbers (qcad<1.5.3)
-       Pen pen;
-
-       ///if(!add) graphic->clearLayers();
-
-       //graphic->addLayer(DEF_DEFAULTLAYER);
-
-       //DEBUG->print( "\nDefault layer added" );
-
-       // Loaded graphics without unit information: load as unit less:
-       //graphic->setUnit( None );
-
-       DEBUG->print("\nUnit set");
-
-       resetBufP();
-
-       if (fBuf)
-       {
-               DEBUG->print("\nBuffer OK");
-               DEBUG->print("\nBuffer: ");
-               DEBUG->print(fBuf);
-
-               do
-               {
-                       dxfLine = getBufLine();
-                       pen = Pen(Color(RS2::FlagByLayer), RS2::WidthByLayer, RS2::LineByLayer);
-
-                       DEBUG->print("\ndxfLine: ");
-                       DEBUG->print(dxfLine.toAscii().data());
-
-                       // $-Setting in the header of DXF found
-                       //
-                       if (!dxfLine.isEmpty() && dxfLine[0] == '$')
-                       {
-                               // Units:
-                               //
-                               if (dxfLine == "$INSUNITS")
-                               {
-                                       dxfCode = getBufLine();
-                                       if (!dxfCode.isEmpty())
-                                       {
-                                               if (dxfCode.toInt() == 70)
-                                               {
-                                                       dxfLine = getBufLine();
-                                                       if (!dxfLine.isEmpty())
-                                                       {
-                                                               graphic->addVariable("$INSUNITS", dxfLine, 70);
-                                                               /*
-                                                                                       switch( dxfLine.toInt() ) {
-                                                                                       case  0: graphic->setUnit( RS2::None );       break;
-                                                                                       case  1: graphic->setUnit( RS2::Inch );       break;
-                                                                                       case  2: graphic->setUnit( RS2::Foot );       break;
-                                                                                       case  3: graphic->setUnit( RS2::Mile );       break;
-                                                                                       case  4: graphic->setUnit( RS2::Millimeter ); break;
-                                                                                       case  5: graphic->setUnit( RS2::Centimeter ); break;
-                                                                                       case  6: graphic->setUnit( RS2::Meter );      break;
-                                                                                       case  7: graphic->setUnit( RS2::Kilometer );  break;
-                                                                                       case  8: graphic->setUnit( RS2::Microinch );  break;
-                                                                                       case  9: graphic->setUnit( RS2::Mil );        break;
-                                                                                       case 10: graphic->setUnit( RS2::Yard );       break;
-                                                                                       case 11: graphic->setUnit( RS2::Angstrom );   break;
-                                                                                       case 12: graphic->setUnit( RS2::Nanometer );  break;
-                                                                                       case 13: graphic->setUnit( RS2::Micron );     break;
-                                                                                       case 14: graphic->setUnit( RS2::Decimeter );  break;
-                                                                                       case 15: graphic->setUnit( RS2::Decameter );  break;
-                                                                                       case 16: graphic->setUnit( RS2::Hectometer ); break;
-                                                                                       case 17: graphic->setUnit( RS2::Gigameter );  break;
-                                                                                       case 18: graphic->setUnit( RS2::Astro );      break;
-                                                                                       case 19: graphic->setUnit( RS2::Lightyear );  break;
-                                                                                       case 20: graphic->setUnit( RS2::Parsec );     break;
-                                                                                       }
-
-                                                                                       graphic->setDimensionUnit( graphic->getUnit() );
-                                                                                       //graphic->setGridUnit( graphic->getUnit() );
-                                                               */
-                                                       }
-                                               }
-                                       }
-                               }
-
-                               // Dimenison Units:
-                               //
-                               else if (dxfLine == "$DIMALT")
-                               {
-                                       dxfCode = getBufLine();
-                                       if (!dxfCode.isEmpty())
-                                       {
-                                               if (dxfCode.toInt() == 70)
-                                               {
-                                                       dxfLine = getBufLine();
-                                                       if (!dxfLine.isEmpty())
-                                                       {
-                                                               graphic->addVariable("$DIMALT", dxfLine, 70);
-                                                               /*
-                                                                                       switch( dxfLine.toInt() ) {
-                                                                                       case  0: graphic->setDimensionUnit( RS2::None );       break;
-                                                                                       case  1: graphic->setDimensionUnit( RS2::Inch );       break;
-                                                                                       case  2: graphic->setDimensionUnit( RS2::Foot );       break;
-                                                                                       case  3: graphic->setDimensionUnit( RS2::Mile );       break;
-                                                                                       case  4: graphic->setDimensionUnit( RS2::Millimeter ); break;
-                                                                                       case  5: graphic->setDimensionUnit( RS2::Centimeter ); break;
-                                                                                       case  6: graphic->setDimensionUnit( RS2::Meter );      break;
-                                                                                       case  7: graphic->setDimensionUnit( RS2::Kilometer );  break;
-                                                                                       case  8: graphic->setDimensionUnit( RS2::Microinch );  break;
-                                                                                       case  9: graphic->setDimensionUnit( RS2::Mil );        break;
-                                                                                       case 10: graphic->setDimensionUnit( RS2::Yard );       break;
-                                                                                       case 11: graphic->setDimensionUnit( RS2::Angstrom );   break;
-                                                                                       case 12: graphic->setDimensionUnit( RS2::Nanometer );  break;
-                                                                                       case 13: graphic->setDimensionUnit( RS2::Micron );     break;
-                                                                                       case 14: graphic->setDimensionUnit( RS2::Decimeter );  break;
-                                                                                       case 15: graphic->setDimensionUnit( RS2::Decameter );  break;
-                                                                                       case 16: graphic->setDimensionUnit( RS2::Hectometer ); break;
-                                                                                       case 17: graphic->setDimensionUnit( RS2::Gigameter );  break;
-                                                                                       case 18: graphic->setDimensionUnit( RS2::Astro );      break;
-                                                                                       case 19: graphic->setDimensionUnit( RS2::Lightyear );  break;
-                                                                                       case 20: graphic->setDimensionUnit( RS2::Parsec );     break;
-                                                                                       }
-                                                               */
-                                                       }
-                                               }
-                                       }
-                               }
-
-                               // Dimension Format:
-                               //
-                               /*else if( dxfLine=="$DIMLUNIT" ) {
-                               if(dxfCode=getBufLine()) {
-                                       if( dxfCode.toInt()==70 ) {
-                                       if( dxfLine=getBufLine() ) {
-                                               switch( dxfLine.toInt() ) {
-                                               case 1: graphic->setDimensionFormat( Scientific ); break;
-                                               case 2:
-                                               case 3: graphic->setDimensionFormat( Decimal ); break;
-                                               case 4:
-                                               case 5: graphic->setDimensionFormat( Fractional ); break;
-                                               default: break;
-                                               }
-                                       }
-                                       }
-                               }
-                       }*/
-
-                               // Dimension Arrow Size:
-                               //
-                               else if (dxfLine == "$DIMASZ")
-                               {
-                                       dxfCode = getBufLine();
-                                       if (!dxfCode.isEmpty() && dxfCode.toInt() == 40)
-                                       {
-                                               dxfLine = getBufLine();
-                                               if (!dxfLine.isEmpty())
-                                               {
-                                                       graphic->addVariable("$DIMASZ", dxfLine, 40);
-                                                       //graphic->setDimensionArrowSize( dxfLine.toDouble() );
-                                               }
-                                       }
-                               }
-
-                               // Dimension Scale:
-                               //
-                               /*
-                               else if( dxfLine=="$DIMSCALE" ) {
-                               if(dxfCode=getBufLine()) {
-                                       if( dxfCode.toInt()==40 ) {
-                                       if( dxfLine=getBufLine() ) {
-                                               graphic->setDimensionScale( dxfLine.toDouble() );
-                                       }
-                                       }
-                               }
-                       }
-                               */
-
-                               // Dimension Text Height:
-                               //
-                               else if (dxfLine == "$DIMTXT")
-                               {
-                                       dxfCode = getBufLine();
-                                       if (!dxfCode.isEmpty())
-                                       {
-                                               if (dxfCode.toInt() == 40)
-                                               {
-                                                       dxfLine = getBufLine();
-                                                       if (!dxfLine.isEmpty())
-                                                       {
-                                                               graphic->addVariable("$DIMTXT", dxfLine, 40);
-                                                               //graphic->setDimensionTextHeight( dxfLine.toDouble() );
-                                                       }
-                                               }
-                                       }
-                               }
-
-                               // Dimension exactness:
-                               //
-                               else if (dxfLine == "$DIMRND")
-                               {
-                                       dxfCode = getBufLine();
-                                       if (dxfCode.toInt() == 40)
-                                       {
-                                               dxfLine = getBufLine();
-                                               if (!dxfLine.isEmpty())
-                                               {
-                                                       graphic->addVariable("$DIMRND", dxfLine, 40);
-                                                       //if( dxfLine.toDouble()>0.000001 ) {
-                                                       //graphic->setDimensionExactness( dxfLine.toDouble() );
-                                               }
-                                               //}
-                                       }
-                               }
-
-                               // Dimension over length:
-                               //
-                               else if (dxfLine == "$DIMEXE")
-                               {
-                                       dxfCode = getBufLine();
-                                               if (dxfCode.toInt() == 40)
-                                               {
-                                                       dxfLine = getBufLine();
-                                                       if (!dxfLine.isEmpty())
-                                                       {
-                                                               graphic->addVariable("$DIMEXE", dxfLine, 40);
-                                                               //graphic->setDimensionOverLength( dxfLine.toDouble() );
-                                                       }
-                                               }
-                               }
-
-                               // Dimension under length:
-                               //
-                               else if( dxfLine=="$DIMEXO" )
-                               {
-                                       dxfCode = getBufLine();
-                                               if( dxfCode.toInt()==40 )
-                                               {
-                                                       dxfLine = getBufLine();
-                                                       if (!dxfLine.isEmpty())
-                                                       {
-                                                               graphic->addVariable("$DIMEXO", dxfLine, 40);
-                                                               //graphic->setDimensionUnderLength( dxfLine.toDouble() );
-                                                       }
-                                               }
-                               }
-
-
-                               // Angle dimension format:
-                               //
-                               else if( dxfLine=="$DIMAUNIT" )
-                               {
-                                       dxfCode = getBufLine();
-                                               if( dxfCode.toInt()==70 )
-                                               {
-                                                       dxfLine = getBufLine();
-                                                       if (!dxfLine.isEmpty())
-                                                       {
-                                                               graphic->addVariable("$DIMAUNIT", dxfLine, 70);
-                                                               /*
-                                                                                       switch( dxfLine.toInt() ) {
-                                                                                       case 0: graphic->setAngleDimensionFormat( DecimalDegrees ); break;
-                                                                                       case 1: graphic->setAngleDimensionFormat( DegreesMinutesSeconds ); break;
-                                                                                       case 2: graphic->setAngleDimensionFormat( Gradians ); break;
-                                                                                       case 3: graphic->setAngleDimensionFormat( Radians ); break;
-                                                                                       case 4: graphic->setAngleDimensionFormat( Surveyor ); break;
-                                                                                       default: break;
-                                                                                       }
-                                                               */
-                                                       }
-                                               }
-                               }
-
-                               // Angle dimension exactness:
-                               //
-                               else if( dxfLine=="$DIMADEC" )
-                               {
-                                       dxfCode = getBufLine();
-                                               if( dxfCode.toInt()==70 )
-                                               {
-                                                       dxfLine = getBufLine();
-                                                       if (!dxfLine.isEmpty())
-                                                       {
-                                                               graphic->addVariable("$DIMADEC", dxfLine, 70);
-                                                               //graphic->setAngleDimensionExactness( Math::pow(0.1, dxfLine.toInt()) );
-                                                       }
-                                               }
-                               }
-
-                               // Grid x/y:
-                               //
-                               else if (dxfLine == "$GRIDUNIT")
-                               {
-                                       dxfCode = getBufLine();
-
-                                       if (dxfCode.toInt() == 10)
-                                       {
-                                               dxfLine = getBufLine();
-
-                                               if (!dxfLine.isEmpty())
-                                               {
-                                                       double x = atof(dxfLine.toAscii().data());
-                                                       dxfLine = getBufLine();
-
-                                                       if (!dxfLine.isEmpty())
-                                                       {
-                                                               double y = atof(dxfLine.toAscii().data());
-
-                                                               graphic->addVariable("$GRIDUNIT", Vector(x, y), 10);
-                                                       }
-                                               }
-                                       }
-                               }
-                               /*
-                                                       double gx=dxfLine.toDouble();
-                                                       if (gx<0.0001) gx=0.0001;
-                                                       graphic->setMinGridX(gx);
-                                                       graphic->setGridFormat( Fractional );
-
-                                                       for( double q=0.00000001; q<=100000.0; q*=10.0 ) {
-                                                       if( mtCompFloat(gx, q, q/1000.0) ) {
-                                                               graphic->setGridFormat( Decimal );
-                                                               break;
-                                                       }
-                                                       }
-
-                                               }
-                                               }
-                                       }
-                                       if(dxfCode=getBufLine()) {
-                                               if( dxfCode.toInt()==20 ) {
-                                               if( dxfLine=getBufLine() ) {
-                                                       double gy=dxfLine.toDouble();
-                                                       if (gy<0.0001) gy=0.0001;
-                                                       graphic->setMinGridY(gy);
-                                               }
-                                               }
-                                       }
-                               */
-
-                               // Page limits min x/y:
-                               //
-                               /*else if( dxfLine=="$PLIMMIN" ) {
-                               if(dxfCode=getBufLine()) {
-                                       if( dxfCode.toInt()==10 ) {
-                                       if( dxfLine=getBufLine() ) {
-                                               graphic->setPageOriginX( dxfLine.toDouble() );
-                                       }
-                                       }
-                               }
-                               if(dxfCode=getBufLine()) {
-                                       if( dxfCode.toInt()==20 ) {
-                                       if( dxfLine=getBufLine() ) {
-                                               graphic->setPageOriginY( dxfLine.toDouble() );
-                                       }
-                                       }
-                               }
-                       }
-                               */
-
-                               // Page limits min x/y:
-                               //
-                               /*
-                                       else if( dxfLine=="$PLIMMAX" ) {
-                                               if(dxfCode=getBufLine()) {
-                                               if( dxfCode.toInt()==10 ) {
-                                                       if( dxfLine=getBufLine() ) {
-                                                       graphic->setPageSizeX( dxfLine.toDouble() - graphic->getPageOriginX() );
-                                                       }
-                                               }
-                                               }
-                                               if(dxfCode=getBufLine()) {
-                                               if( dxfCode.toInt()==20 ) {
-                                                       if( dxfLine=getBufLine() ) {
-                                                       graphic->setPageSizeY( dxfLine.toDouble() - graphic->getPageOriginY() );
-                                                       }
-                                               }
-                                               }
-                                       }
-                               */
-
-                               // Paper space scale:
-                               //
-                               /*
-                                       else if( dxfLine=="$PSVPSCALE" ) {
-                                               if(dxfCode=getBufLine()) {
-                                               if( dxfCode.toInt()==40 ) {
-                                                       if( dxfLine=getBufLine() ) {
-                                                       graphic->setPaperSpace( dxfLine.toDouble() );
-                                                       }
-                                               }
-                                               }
-                                       }
-                               */
-
-                       }
-
-                       // Entity
-                       //
-                       else if (!dxfLine.isEmpty() &&
-                                       dxfLine[0] >= 'A' && dxfLine[0] <= 'Z')
-                       {
-                               if (dxfLine == "EOF")
-                               {
-                                       // End of file reached
-                                       //
-                               }
-
-                               // ------
-                               // Layer:
-                               // ------
-                               else if (dxfLine == "LAYER")
-                               {
-                                       currentLayer = 0;
-                                       do
-                                       {
-                                               dxfCode = getBufLine();
-                                               if(!dxfCode.isEmpty())
-                                                       code = dxfCode.toInt();
-                                               if(!dxfCode.isEmpty() && code != 0)
-                                               {
-                                                       dxfLine = getBufLine();
-                                                       if (!dxfLine.isEmpty())
-                                                       {
-                                                               switch(code)
-                                                               {
-                                                               case  2:  // Layer name
-                                                                       if (dxfLine=="(null)" || dxfLine=="default") {
-                                                                               dxfLine = "0";
-                                                                       }
-                                                                       graphic->addLayer(new Layer(dxfLine));
-                                                                       graphic->activateLayer(dxfLine);
-                                                                       currentLayer = graphic->getActiveLayer();
-                                                                       lastLayer=dxfLine;
-                                                                       break;
-                                                               case 70:  // Visibility
-                                                                       /*
-                                                                       if(dxfLine.toInt()&5) {
-                                                                       if(currentLayerNum>=0 && currentLayerNum<DEF_MAXLAYERS) {
-                                                                               graphic->layer[currentLayerNum].DelFlag(Y_VISIBLE);
-                                                                       }
-                                                               }
-                                                                       */
-                                                                       break;
-                                                               case  6:  // style
-                                                                       //if(currentLayer)
-                                                                       //currentLayer->setStyle( graphic->nameToStyle(dxfLine) );
-                                                                       pen.setLineType(FilterDXF::nameToLineType(dxfLine));
-                                                                       break;
-                                                               case 39:  // Thickness
-                                                                       //if(currentLayer) currentLayer->setWidth(dxfLine.toInt());
-                                                                       pen.setWidth(FilterDXF::numberToWidth(dxfLine.toInt()));
-                                                                       break;
-                                                               case 62:  // Color
-                                                                       pen.setColor(FilterDXF::numberToColor(dxfLine.toInt()));
-                                                                       //if(currentLayer) {
-                                                                       //      currentLayer->setColor( graphic->numberToColor(dxfLine.toInt(), !oldColorNumbers));
-                                                                       //}
-                                                                       break;
-                                                               default:
-                                                                       break;
-                                                               }
-                                                       }
-                                               }
-                                       }
-                                       while(!dxfCode.isEmpty() && code != 0);
-
-                                       if (currentLayer)
-                                       {
-                                               currentLayer->setPen(pen);
-                                       }
-                                       //graphic->setStyle("CONTINOUS");
-                                       //graphic->setWidth(0);
-                                       //graphic->setColor(0, false);
-                               }
-
-                               // ------
-                               // Point:
-                               // ------
-                               else if(dxfLine=="POINT") {
-                                       do {
-                                               dxfCode=getBufLine();
-                                               if(!dxfCode.isEmpty())
-                                                       code=dxfCode.toInt();
-                                               if(!dxfCode.isEmpty() && code!=0) {
-                                                       dxfLine=getBufLine();
-                                                       if(!dxfLine.isEmpty()) {
-                                                               switch(code) {
-                                                               case  6:  // style
-                                                                       pen.setLineType(FilterDXF::nameToLineType(dxfLine));
-                                                                       break;
-                                                               case  8:  // Layer
-                                                                       //if(dxfLine!=lastLayer) {
-                                                                       if (dxfLine=="(null)" || dxfLine=="default") {
-                                                                               dxfLine = "0";
-                                                                       }
-                                                                       graphic->activateLayer(dxfLine);
-                                                                       //lastLayer=dxfLine;
-                                                                       //}
-                                                                       break;
-                                                               case 10:  // X1
-                                                                       dxfLine.replace( QRegExp(","), "." );
-                                                                       vx1 = dxfLine.toDouble();
-                                                                       break;
-                                                               case 20:  // Y1
-                                                                       dxfLine.replace( QRegExp(","), "." );
-                                                                       vy1 = dxfLine.toDouble();
-                                                                       break;
-                                                               case 39:  // Thickness
-                                                                       pen.setWidth(FilterDXF::numberToWidth(dxfLine.toInt()));
-                                                                       break;
-                                                               case 62:  // Color
-                                                                       pen.setColor(FilterDXF::numberToColor(dxfLine.toInt()));
-                                                                       break;
-                                                               default:
-                                                                       break;
-                                                               }
-                                                       }
-                                               }
-                                       }
-                                       while(!dxfCode.isEmpty() && code != 0);
-
-                                       graphic->setActivePen(pen);
-                                       graphic->addEntity(new Point(graphic,
-                                                                                                       PointData(Vector(vx1, vy1))));
-                               }
-
-                               // -----
-                               // Line:
-                               // -----
-                               else if(dxfLine=="LINE") {
-                                       do {
-                                               dxfCode=getBufLine();
-
-                                               if(!dxfCode.isEmpty())
-                                                       code=dxfCode.toInt();
-                                               if(!dxfCode.isEmpty() && code!=0) {
-
-                                                       dxfLine=getBufLine();
-
-                                                       if(!dxfLine.isEmpty()) {
-                                                               switch(code) {
-                                                               case  6:  // style
-                                                                       pen.setLineType(FilterDXF::nameToLineType(dxfLine));
-                                                                       break;
-                                                               case  8:  // Layer
-                                                                       //if(dxfLine!=lastLayer) {
-                                                                       if (dxfLine=="(null)" || dxfLine=="default") {
-                                                                               dxfLine = "0";
-                                                                       }
-                                                                       graphic->activateLayer(dxfLine);
-                                                                       //lastLayer=dxfLine;
-                                                                       //}
-                                                                       break;
-                                                               case 10:  // X1
-                                                                       dxfLine.replace( QRegExp(","), "." );
-                                                                       vx1 = dxfLine.toDouble();
-                                                                       break;
-                                                               case 20:  // Y1
-                                                                       dxfLine.replace( QRegExp(","), "." );
-                                                                       vy1 = dxfLine.toDouble();
-                                                                       break;
-                                                               case 11:  // X2
-                                                                       dxfLine.replace( QRegExp(","), "." );
-                                                                       vx2 = dxfLine.toDouble();
-                                                                       break;
-                                                               case 21:  // Y2
-                                                                       dxfLine.replace( QRegExp(","), "." );
-                                                                       vy2 = dxfLine.toDouble();
-                                                                       break;
-                                                               case 39:  // Thickness
-                                                                       pen.setWidth(FilterDXF::numberToWidth(dxfLine.toInt()));
-                                                                       break;
-                                                               case 62:  // Color
-                                                                       pen.setColor(FilterDXF::numberToColor(dxfLine.toInt()));
-                                                                       break;
-                                                               default:
-                                                                       break;
-                                                               }
-                                                       }
-                                               }
-                                       } while(!dxfCode.isEmpty() && code!=0);
-
-                                       //if(!mtCompFloat(vx1, vx2) || !mtCompFloat(vy1, vy2)) {
-                                       //graphic->addLine(vx1, vy1, vx2, vy2, currentLayerNum, add);
-                                       graphic->setActivePen(pen);
-                                       graphic->addEntity(new Line(graphic,
-                                                                                               LineData(Vector(vx1, vy1), Vector(vx2, vy2))));
-                                       //}
-                               }
-
-
-                               // ----
-                               // Arc:
-                               // ----
-                               else if(dxfLine=="ARC") {
-                                       do {
-                                               dxfCode=getBufLine();
-                                               if(!dxfCode.isEmpty())
-                                                       code=dxfCode.toInt();
-                                               if(!dxfCode.isEmpty() && code!=0) {
-                                                       dxfLine=getBufLine();
-                                                       if(!dxfLine.isEmpty()) {
-                                                               switch(code) {
-                                                               case  6:  // style
-                                                                       pen.setLineType(FilterDXF::nameToLineType(dxfLine));
-                                                                       break;
-                                                               case  8:  // Layer
-                                                                       //if(dxfLine!=lastLayer) {
-                                                                       if (dxfLine=="(null)" || dxfLine=="default") {
-                                                                               dxfLine = "0";
-                                                                       }
-                                                                       graphic->activateLayer(dxfLine);
-                                                                       //lastLayer=dxfLine;
-                                                                       //}
-                                                                       break;
-                                                               case 10:  // Centre X
-                                                                       dxfLine.replace( QRegExp(","), "." );
-                                                                       vcx = dxfLine.toDouble();
-                                                                       break;
-                                                               case 20:  // Centre Y
-                                                                       dxfLine.replace( QRegExp(","), "." );
-                                                                       vcy = dxfLine.toDouble();
-                                                                       break;
-                                                               case 40:  // Radius
-                                                                       dxfLine.replace( QRegExp(","), "." );
-                                                                       vcr = dxfLine.toDouble();
-                                                                       break;
-                                                               case 50:  // Start Angle
-                                                                       dxfLine.replace( QRegExp(","), "." );
-                                                                       va1 = Math::correctAngle(dxfLine.toDouble()/ARAD);
-                                                                       break;
-                                                               case 51:  // End Angle
-                                                                       dxfLine.replace( QRegExp(","), "." );
-                                                                       va2 = Math::correctAngle(dxfLine.toDouble()/ARAD);
-                                                                       break;
-                                                               case 39:  // Thickness
-                                                                       pen.setWidth(FilterDXF::numberToWidth(dxfLine.toInt()));
-                                                                       break;
-                                                               case 62:  // Color
-                                                                       pen.setColor(FilterDXF::numberToColor(dxfLine.toInt()));
-                                                                       break;
-                                                               default:
-                                                                       break;
-                                                               }
-                                                       }
-                                               }
-                                       } while(!dxfCode.isEmpty() && code!=0);
-                                       //if(vcr>0.0 && !mtCompFloat(va1, va2)) {
-                                       //  graphic->addArc(vcx, vcy, vcr, va1, va2, false, currentLayerNum, add);
-                                       //}
-                                       graphic->setActivePen(pen);
-                                       graphic->addEntity(new Arc(graphic,
-                                                                                               ArcData(Vector(vcx, vcy),
-                                                                                                                       vcr, va1, va2, false)));
-                               }
-
-                               // -------
-                               // Circle:
-                               // -------
-                               else if(dxfLine=="CIRCLE") {
-                                       do {
-                                               dxfCode=getBufLine();
-                                               if(!dxfCode.isEmpty())
-                                                       code=dxfCode.toInt();
-                                               if(!dxfCode.isEmpty() && code!=0) {
-                                                       dxfLine=getBufLine();
-                                                       if(!dxfLine.isEmpty()) {
-                                                               switch(code) {
-                                                               case  6:  // style
-                                                                       pen.setLineType(FilterDXF::nameToLineType(dxfLine));
-                                                                       break;
-                                                               case  8:  // Layer
-                                                                       //if(dxfLine!=lastLayer) {
-                                                                       if (dxfLine=="(null)" || dxfLine=="default") {
-                                                                               dxfLine = "0";
-                                                                       }
-                                                                       graphic->activateLayer(dxfLine);
-                                                                       //lastLayer=dxfLine;
-                                                                       //}
-                                                                       break;
-                                                               case 10:  // Centre X
-                                                                       dxfLine.replace( QRegExp(","), "." );
-                                                                       vcx = dxfLine.toDouble();
-                                                                       break;
-                                                               case 20:  // Centre Y
-                                                                       dxfLine.replace( QRegExp(","), "." );
-                                                                       vcy = dxfLine.toDouble();
-                                                                       break;
-                                                               case 40:  // Radius
-                                                                       dxfLine.replace( QRegExp(","), "." );
-                                                                       vcr = dxfLine.toDouble();
-                                                                       break;
-                                                               case 39:  // Thickness
-                                                                       pen.setWidth(FilterDXF::numberToWidth(dxfLine.toInt()));
-                                                                       break;
-                                                               case 62:  // Color
-                                                                       pen.setColor(FilterDXF::numberToColor(dxfLine.toInt()));
-                                                                       break;
-                                                               default:
-                                                                       break;
-                                                               }
-                                                       }
-                                               }
-                                       } while(!dxfCode.isEmpty() && code!=0);
-                                       /*if(vcr>0.0) {
-                                       graphic->addCircle(vcx, vcy, vcr, 0.0, 360.0, false, currentLayerNum, add);
-                               }*/
-                                       graphic->setActivePen(pen);
-                                       graphic->addEntity(new Circle(graphic,
-                                                                                                       CircleData(Vector(vcx, vcy),
-                                                                                                                               vcr)));
-                               }
-
-
-                               // ------
-                               // Hatch:
-                               // ------
-                               /*
-                               if(dxfLine=="HATCH") {
-                               do {
-                                       dxfCode=getBufLine();
-                                       if(dxfCode) code=dxfCode.toInt();
-                                       if(dxfCode && code!=0) {
-                                       dxfLine=getBufLine();
-                                       if(dxfLine) {
-                                               switch(code) {
-                                               case  8:  // Layer
-                                               //  if(dxfLine!=lastLayer) {
-                                                                       if (dxfLine=="(null)" || dxfLine=="default") {
-                                                                               dxfLine = "0";
-                                                                       }
-                                                       graphic->activateLayer(dxfLine);
-                                                       //lastLayer=dxfLine;
-                                                       //}
-                                                       break;
-                                               case 10:  // X1
-                                                       vx1 = dxfLine.toDouble();
-                                                       break;
-                                               case 20:  // Y1
-                                                       vy1 = dxfLine.toDouble();
-                                                       //graphic->Vec[vc].CreatePoint(vy1, vx1, currentLayerNum);
-                                                       //if(vc<vElements-1) ++vc;
-                                                       break;
-                                               case 11:  // X2
-                                                       vx2 = dxfLine.toDouble();
-                                                       break;
-                                               case 21:  // Y2
-                                                       vy2 = dxfLine.toDouble();
-                                                       //graphic->Vec[vc].CreatePoint(vy2, vx2, currentLayerNum);
-                                                       //if(vc<vElements-1) ++vc;
-                                                       break;
-                                               default:
-                                                       break;
-                                               }
-                                       }
-                                       }
-                               }while(dxfCode && code!=0);
-                               / *
-                               if(!mt.CompFloat(vx1, vx2) || !mt.CompFloat(vy1, vy2)) {
-                                       graphic->Vec[vc].CreateLine(vx1, vy1, vx2, vy2, currentLayerNum);
-                                       if(vc<vElements-1) ++vc;
-                               }
-                               if(++updProgress==1000) {
-                                       np->getStateWin()->UpdateProgressBar((int)(pcFact*vc)+25);
-                                       updProgress=0;
-                               }
-                               * /
-                       }
-                               */
-
-
-                               // -----
-                               // Text:
-                               // -----
-                               else if(dxfLine=="TEXT") {
-
-                                       QString vtext;          // the text
-                                       char  vtextStyle[256];  // text style (normal_ro, cursive_ri, normal_st, ...)
-                                       double vheight=10.0;     // text height
-                                       double vtextAng=0.0;     // text angle
-                                       //double vradius=0.0;      // text radius
-                                       //double vletterspace=2.0; // Text letter space
-                                       //double vwordspace=6.0;   // Text wordspace
-                                       QString vfont;         // font "normal", "cursive", ...
-                                       RS2::HAlign vhalign=RS2::HAlignLeft;
-                                       // alignment (0=left, 1=center, 2=right)
-                                       //int   vattachement=7;   // 1=top left, 2, 3, 4, 5, 6, 7, 8, 9=bottom right
-                                       //uint  vfl=0;            // special flags
-                                       bool  codeSeven=false;  // Have we found a code seven?
-
-                                       vtextStyle[0] = '\0';
-                                       vfont="normal";
-
-                                       do {
-                                               dxfCode=getBufLine();
-                                               if(!dxfCode.isEmpty())
-                                                       code=dxfCode.toInt();
-                                               if(!dxfCode.isEmpty() && code!=0) {
-                                                       if(code!=1 && code!=3 && code!=7)
-                                                               dxfLine=getBufLine();
-                                                       if(!dxfLine.isEmpty() || code==1 || code==3 || code==7) {
-
-                                                               switch(code)
-                                                               {
-                                                               case  1:  // Text itself
-                                                                       vtext = getBufLine();
-                                                                       strDecodeDxfString(vtext);
-                                                                       break;
-
-                                                               case  3:  // Text parts (always 250 chars)
-                                                                       vtext = getBufLine();
-                                                                       break;
-
-                                                               case  6:  // style
-                                                                       pen.setLineType(FilterDXF::nameToLineType(dxfLine));
-                                                                       break;
-
-                                                               case  7:
-                                                                       // Text style (normal_ro#50.0,
-                                                                       //    cursive_ri#20.0, normal_st)
-                                                                       qstrncpy(vtextStyle, getBufLine().toAscii().data(), 249);
-
-                                                                       // get font typ:
-                                                                       //
-                                                                       {
-                                                                               char dummy[256];
-                                                                               sscanf(vtextStyle, "%[^_#\n]", dummy);
-                                                                               vfont = dummy;
-                                                                       }
-
-                                                                       // get text style:
-                                                                       //
-                                                                       /*
-                                                                                                                       if(strstr(vtextStyle, "_ro"))
-                                                                                                                               vfl=vfl|E_ROUNDOUT;
-                                                                                                                       else if(strstr(vtextStyle, "_ri"))
-                                                                                                                               vfl=vfl|E_ROUNDIN;
-                                                                                                                       else
-                                                                                                                               vfl=vfl|E_STRAIGHT;
-                                                                       */
-
-
-                                                                       /*if(strstr(vtextStyle, "_fix")) {
-                                                                               vfl=vfl|E_FIXEDWIDTH;
-                                                               }*/
-
-                                                                       // get radius, letterspace, wordspace:
-                                                                       //
-                                                                       {
-                                                                               char * ptr;  // pointer to value
-                                                                               ptr = strchr(vtextStyle, '#');
-
-                                                                               if (ptr)
-                                                                               {
-                                                                                       // Parse radius
-                                                                                       /*if(vfl&E_ROUNDOUT || vfl&E_ROUNDIN) {
-                                                                                               ++ptr;
-                                                                                               if(ptr[0]) {
-                                                                                                       sscanf(ptr, "%lf", &vradius);
-                                                                                               }
-                                                                                               ptr = strchr(ptr, '#');
-                                                                               }*/
-                                                                                       /*if(ptr) {
-                                                                                               // Parse letter space:
-                                                                                               ++ptr;
-                                                                                               if(ptr[0]) {
-                                                                                                       sscanf(ptr, "%lf", &vletterspace);
-                                                                                               }
-                                                                                               // Parse word space:
-                                                                                               ptr = strchr(ptr, '#');
-                                                                                               if(ptr) {
-                                                                                                       ++ptr;
-                                                                                                       if(ptr[0]) {
-                                                                                                               sscanf(ptr, "%lf", &vwordspace);
-                                                                                                       }
-                                                                                               }
-                                                                               }*/
-                                                                               }
-                                                                       }
-                                                                       codeSeven = true;
-                                                                       break;
-
-                                                               case  8:  // Layer
-                                                                       //if(dxfLine!=lastLayer) {
-                                                                       if (dxfLine == "(null)" || dxfLine == "default")
-                                                                       {
-                                                                               dxfLine = "0";
-                                                                       }
-
-                                                                       graphic->activateLayer(dxfLine);
-                                                                       //lastLayer=dxfLine;
-                                                                       //}
-                                                                       break;
-
-                                                               case 10:  // X1
-                                                                       dxfLine.replace( QRegExp(","), "." );
-                                                                       vx1 = dxfLine.toDouble();
-                                                                       break;
-                                                               case 20:  // Y1
-                                                                       dxfLine.replace( QRegExp(","), "." );
-                                                                       vy1 = dxfLine.toDouble();
-                                                                       break;
-                                                               case 40:  // height
-                                                                       dxfLine.replace( QRegExp(","), "." );
-                                                                       vheight = dxfLine.toDouble();
-                                                                       /*if(!codeSeven) {
-                                                                               vletterspace = vheight*0.2;
-                                                                               vwordspace = vheight*0.6;
-                                                               }*/
-                                                                       break;
-                                                               case 50:  // angle
-                                                                       dxfLine.replace( QRegExp(","), "." );
-                                                                       vtextAng = dxfLine.toDouble() / ARAD;
-                                                                       break;
-                                                               case 72:  {// alignment
-                                                                               //if(!mtext) {
-                                                                               int v = dxfLine.toInt();
-                                                                               if(v==1)
-                                                                                       vhalign = RS2::HAlignCenter;
-                                                                               else if(v==2)
-                                                                                       vhalign = RS2::HAlignRight;
-                                                                               else
-                                                                                       vhalign = RS2::HAlignLeft;
-                                                                               //}
-                                                                       }
-                                                                       break;
-                                                               case 39:  // Thickness
-                                                                       pen.setWidth(FilterDXF::numberToWidth(dxfLine.toInt()));
-                                                                       break;
-                                                               case 62:  // Color
-                                                                       pen.setColor(FilterDXF::numberToColor(dxfLine.toInt()));
-                                                                       break;
-                                                               default:
-                                                                       break;
-                                                               }
-                                                       }
-                                               }
-                                       }
-                                       while(!dxfCode.isEmpty() && code != 0);
-
-                                       char * i = strchr(vtextStyle, '#');
-
-                                       if (i != NULL)
-                                       {
-                                               i[0] = '\0';
-                                       }
-
-                                       graphic->addEntity(
-                                               new Text(graphic,
-                                                                       TextData(
-                                                                               Vector(vx1, vy1),
-                                                                               vheight,
-                                                                               100.0,
-                                                                               RS2::VAlignBottom,
-                                                                               vhalign,
-                                                                               RS2::LeftToRight,
-                                                                               RS2::Exact,
-                                                                               1.0,
-                                                                               vtext,
-                                                                               vtextStyle,
-                                                                               vtextAng
-                                                                       )
-                                                               )
-                                       );
-                               }
-
-                               // ----------
-                               // Dimension:
-                               // ----------
-                               else if(dxfLine=="DIMENSION") {
-                                       int typ=1;
-                                       double v10=0.0, v20=0.0;
-                                       double v13=0.0, v23=0.0;
-                                       double v14=0.0, v24=0.0;
-                                       double v15=0.0, v25=0.0;
-                                       double v16=0.0, v26=0.0;
-                                       double v40=0.0, v50=0.0;
-                                       QString dimText;
-                                       do {
-                                               dxfCode=getBufLine();
-                                               if(!dxfCode.isEmpty()) {
-                                                       code=dxfCode.toInt();
-                                               }
-                                               if(!dxfCode.isEmpty() && code!=0) {
-                                                       dxfLine=getBufLine();
-                                                       if(!dxfLine.isEmpty()) {
-                                                               switch(code) {
-                                                               case  1:  // Text (if any)
-                                                                       dimText=dxfLine;
-
-                                                                       // Mend unproper savings of older versions:
-                                                                       if(dimText==" " || dimText==";;")
-                                                                               dimText="";
-
-                                                                       //else dimText.replace(QRegExp("%%c"), "�");
-                                                                       else
-                                                                               strDecodeDxfString(dimText);
-                                                                       break;
-                                                               case  6:  // style
-                                                                       pen.setLineType(FilterDXF::nameToLineType(dxfLine));
-                                                                       break;
-                                                               case  8:  // Layer
-                                                                       //if(dxfLine!=lastLayer) {
-                                                                       if (dxfLine=="(null)" || dxfLine=="default") {
-                                                                               dxfLine = "0";
-                                                                       }
-                                                                       graphic->activateLayer(dxfLine);
-                                                                       //lastLayer=dxfLine;
-                                                                       //}
-                                                                       break;
-                                                               case 10:  // line position x
-                                                                       dxfLine.replace( QRegExp(","), "." );
-                                                                       v10 = dxfLine.toDouble();
-                                                                       break;
-                                                               case 20:  // line position y
-                                                                       dxfLine.replace( QRegExp(","), "." );
-                                                                       v20 = dxfLine.toDouble();
-                                                                       break;
-                                                               case 13:  // X1
-                                                                       dxfLine.replace( QRegExp(","), "." );
-                                                                       v13 = dxfLine.toDouble();
-                                                                       break;
-                                                               case 23:  // Y1
-                                                                       dxfLine.replace( QRegExp(","), "." );
-                                                                       v23 = dxfLine.toDouble();
-                                                                       break;
-                                                               case 14:  // X2
-                                                                       dxfLine.replace( QRegExp(","), "." );
-                                                                       v14 = dxfLine.toDouble();
-                                                                       break;
-                                                               case 24:  // Y2
-                                                                       dxfLine.replace( QRegExp(","), "." );
-                                                                       v24 = dxfLine.toDouble();
-                                                                       break;
-                                                               case 15:  // X3
-                                                                       dxfLine.replace( QRegExp(","), "." );
-                                                                       v15 = dxfLine.toDouble();
-                                                                       break;
-                                                               case 25:  // Y3
-                                                                       dxfLine.replace( QRegExp(","), "." );
-                                                                       v25 = dxfLine.toDouble();
-                                                                       break;
-                                                               case 16:  // X4
-                                                                       dxfLine.replace( QRegExp(","), "." );
-                                                                       v16 = dxfLine.toDouble();
-                                                                       break;
-                                                               case 26:  // Y4
-                                                                       dxfLine.replace( QRegExp(","), "." );
-                                                                       v26 = dxfLine.toDouble();
-                                                                       break;
-                                                               case 40:
-                                                                       dxfLine.replace( QRegExp(","), "." );
-                                                                       v40 = dxfLine.toDouble();
-                                                                       break;
-                                                               case 50:
-                                                                       dxfLine.replace( QRegExp(","), "." );
-                                                                       v50 = dxfLine.toDouble();
-                                                                       break;
-                                                               case 70:  // Typ
-                                                                       typ = dxfLine.toInt();
-                                                                       break;
-                                                               case 39:  // Thickness
-                                                                       pen.setWidth(FilterDXF::numberToWidth(dxfLine.toInt()));
-                                                                       break;
-                                                               case 62:  // Color
-                                                                       pen.setColor(FilterDXF::numberToColor(dxfLine.toInt()));
-                                                                       break;
-
-                                                               default:
-                                                                       break;
-                                                               }
-                                                       }
-                                               }
-                                       } while(!dxfCode.isEmpty() && code!=0);
-
-                                       //double dist;
-
-                                       // Remove Bit values:
-                                       if(typ>=128) {
-                                               typ-=128;   // Location of Text
-                                       }
-                                       if(typ>= 64) {
-                                               typ-= 64;   // Ordinate
-                                       }
-
-                                       switch(typ) {
-                                               // Horiz. / vert.:
-                                       case 0: {
-                                                       DimLinear* d =
-                                                               new DimLinear(
-                                                                       graphic,
-                                                                       DimensionData(
-                                                                               Vector(v10, v20),
-                                                                               Vector(0.0, 0.0),
-                                                                               RS2::VAlignBottom,
-                                                                               RS2::HAlignCenter,
-                                                                               RS2::Exact,
-                                                                               1.0,
-                                                                               dimText,
-                                                                               "ISO-25",
-                                                                               0.0
-                                                                       ),
-                                                                       DimLinearData(
-                                                                               Vector(v13, v23),
-                                                                               Vector(v14, v24),
-                                                                               v50/ARAD,
-                                                                               0.0
-                                                                       )
-                                                               );
-                                                       d->update();
-                                                       graphic->addEntity(d);
-                                               }
-                                               break;
-
-                                               // Aligned:
-                                       case 1: {
-                                                       double angle =
-                                                               Vector(v13, v23).angleTo(Vector(v10,v20));
-                                                       double dist =
-                                                               Vector(v13, v23).distanceTo(Vector(v10,v20));
-
-                                                       Vector defP;
-                                                       defP.setPolar(dist, angle);
-                                                       defP+=Vector(v14, v24);
-
-                                                       DimAligned* d =
-                                                               new DimAligned(
-                                                                       graphic,
-                                                                       DimensionData(
-                                                                               defP,
-                                                                               Vector(0.0, 0.0),
-                                                                               RS2::VAlignBottom,
-                                                                               RS2::HAlignCenter,
-                                                                               RS2::Exact,
-                                                                               1.0,
-                                                                               dimText,
-                                                                               "ISO-25",
-                                                                               0.0
-                                                                       ),
-                                                                       DimAlignedData(
-                                                                               Vector(v13, v23),
-                                                                               Vector(v14, v24)
-                                                                       )
-                                                               );
-                                                       d->update();
-                                                       graphic->addEntity(d);
-                                               }
-                                               break;
-
-                                               // Angle:
-                                       case 2: {
-                                                       Line tl1(NULL,
-                                                                               LineData(Vector(v13, v23),
-                                                                                                       Vector(v14, v24)));
-                                                       Line tl2(NULL,
-                                                                               LineData(Vector(v10, v20),
-                                                                                                       Vector(v15, v25)));
-
-                                                       VectorSolutions s;
-                                                       //bool inters=false;
-                                                       //tmpEl1.getIntersection(&tmpEl2,
-                                                       //                       &inters, &vcx, &vcy, 0,0,0,0, false);
-                                                       s = Information::getIntersection(
-                                                                       &tl1, &tl2, false);
-
-                                                       if (s.get(0).valid) {
-                                                               vcx = s.get(0).x;
-                                                               vcy = s.get(0).y;
-                                                               //vcr = Vector(vcx, vcy).distanceTo(v16, v26);
-
-                                                               /*if(Vector(vcx,vcy).distanceTo(v13,v23)<vcr) {
-                                                                       va1 = tl1.getAngle1();
-                                                       } else {
-                                                                       va1 = tl2.getAngle2();
-                                                       }
-
-                                                               if(Vector(vcx,vcy).distanceTo(v10,v20)<vcr) {
-                                                                       va2 = tl2.getAngle1();
-                                                       } else {
-                                                                       va2 = tl2.getAngle2();
-                                                       }
-                                                               */
-                                                               /*
-                                                               graphic->addDimension(vcx, vcy, va1, va2,
-                                                                                       mtGetDistance(vcx, vcy, v13, v23),
-                                                                                       mtGetDistance(vcx, vcy, v10, v20),
-                                                                                                       vcr,
-                                                                                                       E_ROUNDOUT,
-                                                                                                       currentLayerNum,
-                                                                                                       add);
-                                                               */
-                                                               //Vector dp4;
-                                                               //dp4.setPolar();
-                                                               DimAngular* d =
-                                                                       new DimAngular(
-                                                                               graphic,
-                                                                               DimensionData(
-                                                                                       Vector(v10, v20),
-                                                                                       Vector(0.0, 0.0),
-                                                                                       RS2::VAlignBottom,
-                                                                                       RS2::HAlignCenter,
-                                                                                       RS2::Exact,
-                                                                                       1.0,
-                                                                                       dimText,
-                                                                                       "ISO-25",
-                                                                                       0.0
-                                                                               ),
-                                                                               DimAngularData(
-                                                                                       Vector(v13, v23),
-                                                                                       Vector(vcx, vcy),
-                                                                                       Vector(vcx, vcy),
-                                                                                       Vector(v16, v26)
-                                                                               )
-                                                                       );
-                                                               d->update();
-                                                               graphic->addEntity(d);
-                                                       }
-                                               }
-                                               break;
-
-                                               // Radius:
-                                       case 4: {
-                                                       /*
-                                                                                               graphic->addDimension(v10, v20, v15, v25,
-                                                                                                                                       0.0, 0.0,
-                                                                                                                                                                       v40,
-                                                                                                                                                                       E_STRAIGHT|E_RADIUS,
-                                                                                                                                                                       currentLayerNum,
-                                                                                                                                                                       add);
-                                                                                                                               */
-
-                                                       double ang =
-                                                               Vector(v10, v20)
-                                                               .angleTo(Vector(v15, v25));
-                                                       Vector v2;
-                                                       v2.setPolar(v40, ang);
-                                                       DimRadial* d =
-                                                               new DimRadial(
-                                                                       graphic,
-                                                                       DimensionData(
-                                                                               Vector(v10, v20),
-                                                                               Vector(0.0, 0.0),
-                                                                               RS2::VAlignBottom,
-                                                                               RS2::HAlignCenter,
-                                                                               RS2::Exact,
-                                                                               1.0,
-                                                                               dimText,
-                                                                               "ISO-25",
-                                                                               0.0
-                                                                       ),
-                                                                       DimRadialData(
-                                                                               Vector(v10, v20) + v2,
-                                                                               0.0
-                                                                       )
-                                                               );
-                                                       d->update();
-                                                       graphic->addEntity(d);
-                                               }
-                                               break;
-
-                                               // Arrow:
-                                       case 7: {
-                                                       /*
-                                                                               graphic->addDimension(v13, v23, v14, v24,
-                                                                                                                               0.0, 0.0, 0.0,
-                                                                                                                               E_STRAIGHT|E_ARROW,
-                                                                                                                               currentLayerNum,
-                                                                                                                               add);
-                                                       */
-                                                       /*
-                                                       double ang =
-                                                               Vector(v10, v20)
-                                                               .angleTo(Vector(v15, v25));
-                                                       Vector v2;
-                                                       v2.setPolar(v40, ang);
-                                                       DimDiametric* d =
-                                                               new DimDiametric(
-                                                                       graphic,
-                                                                       DimensionData(
-                                                                               Vector(v10, v20),
-                                                                               Vector(0.0, 0.0),
-                                                                               RS2::VAlignBottom,
-                                                                               RS2::HAlignCenter,
-                                                                               RS2::Exact,
-                                                                               1.0,
-                                                                               dimText,
-                                                                               "ISO-25",
-                                                                               0.0
-                                                                       ),
-                                                                       DimDiametricData(
-                                                                               Vector(v10, v20) + v2,
-                                                                               0.0
-                                                                       )
-                                                               );
-                                                       d->update();
-                                                       graphic->addEntity(d);
-                                                       */
-                                                       LeaderData data(true);
-                                                       Leader* d =
-                                                               new Leader(graphic, data);
-                                                       d->addVertex(Vector(v14, v24));
-                                                       d->addVertex(Vector(v10, v20));
-                                                       d->update();
-                                                       graphic->addEntity(d);
-                                               }
-                                               break;
-                                       }
-                                       //graphic->elementCurrent()->setText(dimText);
-                               }
-
-
-
-                               // ---------
-                               // Hatching:
-                               // ---------
-                               /*
-                                       else if(dxfLine=="HATCH") {
-                                               QString patternName="45";
-                                               double patternScale=1.0;
-                                               //int numPaths=1;
-                                               //int numEdges=1;
-                                               int nextObjectTyp=T_LINE;
-                                               double v10=0.0, v20=0.0,
-                                                       v11=0.0, v21=0.0,
-                                                       v40=0.0, v50=0.0,
-                                                       v51=0.0;
-                                               do {
-                                               dxfCode=getBufLine();
-                                               if(dxfCode) code=dxfCode.toInt();
-                                               if(dxfCode && code!=0) {
-                                                       dxfLine=getBufLine();
-                                                       if(dxfLine) {
-                                                       switch(code) {
-                                                               case  2:
-                                                               patternName = dxfLine;
-                                                               break;
-                                                               case  6:  // style
-                                                               pen.setLineType(FilterDXF::nameToLineType(dxfLine));
-                                                               break;
-                                                               case  8:  // Layer
-                                                               //  if(dxfLine!=lastLayer) {
-                                                                       if (dxfLine=="(null)" || dxfLine=="default") {
-                                                                               dxfLine = "0";
-                                                                       }
-                                                                       graphic->activateLayer(dxfLine);
-                                                                       //lastLayer=dxfLine;
-                                                               //}
-                                                               break;
-                                                               case 10:  // Start point/center of boundary line/arc
-                                                               dxfLine.replace( QRegExp(","), "." );
-                                                               v10=dxfLine.toDouble();
-                                                               break;
-                                                               case 20:  // Start point/center of boundary line/arc
-                                                               dxfLine.replace( QRegExp(","), "." );
-                                                               v20=dxfLine.toDouble();
-                                                               break;
-                                                               case 11:  // End point of boundary line
-                                                               dxfLine.replace( QRegExp(","), "." );
-                                                               v11=dxfLine.toDouble();
-                                                               break;
-                                                               case 21:  // End point of boundary line
-                                                               dxfLine.replace( QRegExp(","), "." );
-                                                               v21=dxfLine.toDouble();
-                                                               if(nextObjectTyp==T_LINE) {
-                                                                       int elnu=graphic->addLine(v10, v20, v11, v21, currentLayerNum, add);
-                                                                       graphic->elementAt(elnu)->setFlag(E_TAGGED);
-                                                               }
-                                                               break;
-                                                               case 40:  // Radius of boundary entity
-                                                               dxfLine.replace( QRegExp(","), "." );
-                                                               v40=dxfLine.toDouble();
-                                                               break;
-                                                               case 50:  // Start angle
-                                                               dxfLine.replace( QRegExp(","), "." );
-                                                               v50=dxfLine.toDouble();
-                                                               break;
-                                                               case 51:  // End angle
-                                                               dxfLine.replace( QRegExp(","), "." );
-                                                               v51=dxfLine.toDouble();
-                                                               break;
-                                                               case 73:  // Counterclockwise?
-                                                               if(nextObjectTyp==T_ARC) {
-                                                                       int elnu;
-                                                                       if( mtCompFloat( v50, 0.0 ) && mtCompFloat( v51, 0.0 ) ) {
-                                                                       elnu=graphic->addCircle(v10, v20, v40, 0.0, 360.0, (bool)dxfLine.toInt(), currentLayerNum, add);
-                                                                       }
-                                                                       else {
-                                                                       elnu=graphic->addArc(v10, v20, v40, v50, v51, (bool)dxfLine.toInt(), currentLayerNum, add);
-                                                                       }
-                                                                       graphic->elementAt(elnu)->setFlag(E_TAGGED);
-                                                                       //newEl = new RElement( graphic );
-                                                                       //newEl->createArc(v10, v20, v40, v50, v51, (bool)dxfLine.toInt());
-                                                                       //boundaryList.append(newEl);
-                                                               }
-                                                               break;
-                                                               case 41:  // Scale
-                                                               dxfLine.replace( QRegExp(","), "." );
-                                                               patternScale=dxfLine.toDouble();
-                                                               break;
-                                                               case 52:  // Angle
-
-                                                               break;
-                                                               case 70:  // Solid (=1) or pattern (=0)
-
-                                                               break;
-                                                               case 39:  // Thickness
-                                                               pen.setWidth(FilterDXF::numberToWidth(dxfLine.toInt()));
-                                                               break;
-                                                               case 62:  // Color
-                                                               pen.setColor(FilterDXF::numberToColor(dxfLine.toInt()));
-                                                               break;
-                                                               case 91:  // Number of boundary paths (loops)
-                                                               //numPaths=dxfLine.toInt();
-                                                               break;
-                                                               case 92:  // Typ of boundary
-
-                                                               break;
-                                                               case 93:  // Number of edges in this boundary
-                                                               //numEdges=dxfLine.toInt();
-                                                               break;
-                                                               case 72:  // Edge typ
-                                                               switch(dxfLine.toInt()) {
-                                                                       case 1: nextObjectTyp=T_LINE; break;
-                                                                       case 2: nextObjectTyp=T_ARC;  break;
-                                                                       default: break;
-                                                               }
-                                                               break;
-
-                                                               default:
-                                                               break;
-                                                       }
-                                                       }
-                                               }
-                                               }while(dxfCode && code!=0);
-
-                                               graphic->addHatching(patternScale,
-                                                                                       patternName,
-                                                                                       currentLayerNum,
-                                                                                       add);
-
-                                               graphic->editDelete(false);
-
-                                       }
-                               */
-
-                       }
-               }
-#warning "This will probably fail since it was expecting to be null on EOF"
-               while (!dxfLine.isEmpty() && dxfLine != "EOF");
-
-               //graphic->terminateAction();
-
-               //graphic->debugElements();
-
-               ret = true;
-       }
-       else
-       {
-               ret = false;
-       }
-
-       return ret;
-}
-
-/**
- * Resets  the whole object
- *   (base class too)
- */
-void FilterDXF1::reset()
-{
-       file.reset();
-
-       delBuffer();
-       fBufP = 0;
-       fSize = 0;
-
-       if (fPointer)
-       {
-               fclose(fPointer);
-               fPointer = 0;
-       }
-}
-
-/**
- * Reset buffer pointer to the beginning of the buffer:
- */
-void FilterDXF1::resetBufP()
-{
-       fBufP = 0;
-}
-
-/**
- * Set buffer pointer to the given index:
- */
-void FilterDXF1::setBufP(int _fBufP)
-{
-       if (_fBufP < (int)fSize)
-               fBufP = _fBufP;
-}
-
-/**
- * delete buffer:
- */
-void FilterDXF1::delBuffer()
-{
-       if (fBuf)
-       {
-               delete[] fBuf;
-               fBuf = 0;
-       }
-}
-
-/**
- * Remove any 13-characters in the buffer:
- */
-void FilterDXF1::dos2unix()
-{
-       char * src = fBuf, * dst = fBuf;
-
-       if (!fBuf)
-               return;
-
-       while (*src != '\0')
-       {
-               if (*src == '\r')
-                       dosFile = true;
-               else
-                       *dst++ = *src;
-
-               src++;
-       }
-
-       *dst = '\0';
-}
-
-// Get next line in the buffer:
-//   and overread ALL seperators
-//
-// return:  -Null-string: end of buffer
-//          -String which is the next line in buffer
-//
-QString FilterDXF1::getBufLine()
-{
-       char * ret;
-       QString str;
-
-       if (fBufP >= (int)fSize)
-               return QString::null;
-
-       ret = &fBuf[fBufP];
-
-       // Move fBufP pointer to the next line
-       while (fBufP < (int)fSize && fBuf[fBufP++] != '\0')
-               ;
-
-//     str = QString::fromLocal8Bit(ret).stripWhiteSpace();
-       str = QString::fromLocal8Bit(ret).simplified();
-
-//    if (str.isNull())
-//    {
-//        return "";
-//    }
-//    else
-//    {
-               return str;
-//    }
-}
-
-
-// Get next line in the buffer:
-//   and overread ALL seperators
-//
-// return:  -Null-string: end of buffer
-//          -String which is the next line in buffer
-//
-char * FilterDXF1::getBufLineCh()
-{
-    char * ret;
-
-    if (fBufP >= (int)fSize)
-        return 0;
-
-    ret = &fBuf[fBufP];
-
-    // Skip empty lines
-    /*if (*ret == '\0' && noEmptyLines) {
-        while (++fBufP < (int)fSize && fBuf[fBufP] == '\0')
-            ;
-        if (fBufP >= (int)fSize)
-            return 0;
-        ret = &fBuf[fBufP];
-}*/
-
-    // Move fBufP pointer to the next line
-    while (fBufP < (int)fSize && fBuf[fBufP++] != '\0')
-        ;
-
-    return ret;
-}
-
-
-// Copy buffer from a given string:
-//
-void FilterDXF1::copyBufFrom(const char * _buf)
-{
-    if (_buf)
-    {
-        fBuf = new char[strlen(_buf) + 16];
-        strcpy(fBuf, _buf);
-    }
-}
-
-
-// Go to the next '_lstr'-line in buffer:
-//
-// return: true:  line found
-//         false: end of buffer
-//
-bool FilterDXF1::gotoBufLine(char * _lstr)
-{
-    QString l;
-
-    do
-    {
-        l = getBufLine();
-    }
-    while (!l.isNull() && l!=_lstr);
-
-    if (!l.isNull())
-        return true;
-
-    return false;
-}
-
-
-// Goto next line where the string _lstr appears:
-//
-// return: true:  string in line found
-//         false: end of buffer
-//
-//
-bool FilterDXF1::gotoBufLineString(char * _lstr)
-{
-    QString l;
-
-    do
-    {
-        l = getBufLine();
-    }
-    while (!l.isNull() && l.contains(_lstr));
-
-    if (!l.isNull())
-        return true;
-
-    return false;
-}
-
-
-// Replace bynary Bytes (<32) by an other (given) byte:
-//
-void FilterDXF1::replaceBinaryBytesBy(char _c)
-{
-    int bc;
-
-    for(bc=0; bc<(int)fSize; ++bc)
-    {
-        if (fBuf[bc] < 32 && fBuf[bc] >= 0)
-        {
-            fBuf[bc] = _c;
-        }
-    }
-}
-
-
-// Separate buffer (change chars sc1 and sc2 in '\0'
-//
-void FilterDXF1::separateBuf(char _c1,
-                                char _c2,
-                                char _c3,
-                                char _c4)
-{
-    for(int bc=0; bc<(int)fSize; ++bc)
-    {
-        if (fBuf[bc] == _c1 || fBuf[bc] == _c2 ||
-            fBuf[bc] == _c3 || fBuf[bc] == _c4)
-        {
-            fBuf[bc] = '\0';
-        }
-    }
-}
-
-
-// remove comment between '_fc' and '_lc'
-//   comments get replaced by '\0'
-//
-void FilterDXF1::removeComment(char _fc, char _lc)
-{
-    bool rem = false;   // Are we removing currrently?
-    int bc;           // counter
-
-    for(bc=0; bc<(int)fSize; ++bc)
-    {
-        if (fBuf[bc] == _fc)
-            rem = true;
-
-        if (fBuf[bc] == _lc)
-        {
-            fBuf[bc] = '\0';
-            rem = false;
-        }
-
-        if (rem)
-            fBuf[bc] = '\0';
-    }
-}
-
-// Read file '_name' in buffer (buf)
-//
-// '_bNum' : Max number of Bytes
-//         : -1: All
-// return: true: successful
-//         false: file not found
-//
-bool FilterDXF1::readFileInBuffer(char * _name, int _bNum)
-{
-//    file.setName(_name);
-    file.setFileName(_name);
-    return readFileInBuffer(_bNum);
-}
-
-// Read file in buffer (buf)
-//
-// 'bNum' : Max number of Bytes
-//        : -1: All
-// return: true: successful
-//         false: file not found
-//
-bool FilterDXF1::readFileInBuffer(int _bNum)
-{
-       fPointer = fopen(name.toAscii().data(), "rb");
-
-       if (fPointer != NULL)
-       {
-//             if (file.open(QIODevice::ReadOnly, fPointer))
-               if (file.open(fPointer, QIODevice::ReadOnly))
-               {
-                       fSize = file.size();
-
-                       if (_bNum == -1)
-                               _bNum = fSize;
-
-                       fBuf = new char[_bNum + 16];
-
-//                     file.readBlock(fBuf, _bNum);
-                       file.read(fBuf, _bNum);
-                       fBuf[_bNum] = '\0';
-                       file.close();
-               }
-
-               fclose(fPointer);
-
-               // Convert 13/10 to 10
-               dos2unix();
-               fPointer = NULL;
-
-               return true;
-       }
-
-       return false;
-}
-
-
-// Decode a DXF string to the C-convention (special character \P is a \n)
-//
-void FilterDXF1::strDecodeDxfString(QString & str)
-{
-    if (str.isEmpty())
-        return;
-
-    str.replace(QRegExp("%%c"), QChar(0xF8)); // Diameter
-    str.replace(QRegExp("%%d"), QChar(0xB0)); // Degree
-    str.replace(QRegExp("%%p"), QChar(0xB1)); // Plus/minus
-    str.replace(QRegExp("\\\\[pP]"), QChar('\n'));
-}
-
-
-// Compare two double values:
-//
-// return: true: values are equal
-//         false: values are not equal
-//
-bool FilterDXF1::mtCompFloat(double _v1, double _v2, double _tol)
-{
-    double delta = _v2 - _v1;
-
-    if (delta > -_tol && delta < _tol)
-        return true;
-    else
-        return false;
-}
-
-
-// EOF
-