/**
* Default constructor.
*/
-RS_FilterDXF1::RS_FilterDXF1(): RS_FilterInterface()
+FilterDXF1::FilterDXF1(): FilterInterface()
{
- RS_DEBUG->print("Setting up DXF 1 filter...");
+ DEBUG->print("Setting up DXF 1 filter...");
graphic = NULL;
addImportFormat(RS2::FormatDXF1);
}
* will be created or the graphics from which the entities are
* taken to be stored in a file.
*/
-bool RS_FilterDXF1::fileImport(Drawing& g, const QString& file, RS2::FormatType /*type*/)
+bool FilterDXF1::fileImport(Drawing& g, const QString& file, RS2::FormatType /*type*/)
{
- RS_DEBUG->print("DXF1 Filter: importing file '%s'...", file.toLatin1().data());
+ DEBUG->print("DXF1 Filter: importing file '%s'...", file.toLatin1().data());
this->graphic = &g;
/**
* Reads a dxf1 file from buffer.
*/
-bool RS_FilterDXF1::readFromBuffer()
+bool FilterDXF1::readFromBuffer()
{
- RS_DEBUG->print("\nDXF: Read from buffer");
+ DEBUG->print("\nDXF: Read from buffer");
bool ret; // returned value
QString dxfLine; // A line in the dxf file
QString lastLayer; // Last used layer name (test adding only
// if the new layer!=lastLayer)
//int currentLayerNum=0; // Current layer number
- RS_Layer * currentLayer = 0; // Pointer to current layer
+ 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)
- RS_Pen pen;
+ Pen pen;
///if(!add) graphic->clearLayers();
//graphic->addLayer(DEF_DEFAULTLAYER);
- //RS_DEBUG->print( "\nDefault layer added" );
+ //DEBUG->print( "\nDefault layer added" );
// Loaded graphics without unit information: load as unit less:
//graphic->setUnit( None );
- RS_DEBUG->print("\nUnit set");
+ DEBUG->print("\nUnit set");
resetBufP();
if (fBuf)
{
- RS_DEBUG->print("\nBuffer OK");
- RS_DEBUG->print("\nBuffer: ");
- RS_DEBUG->print(fBuf);
+ DEBUG->print("\nBuffer OK");
+ DEBUG->print("\nBuffer: ");
+ DEBUG->print(fBuf);
do
{
dxfLine = getBufLine();
- pen = RS_Pen(RS_Color(RS2::FlagByLayer), RS2::WidthByLayer, RS2::LineByLayer);
+ pen = Pen(Color(RS2::FlagByLayer), RS2::WidthByLayer, RS2::LineByLayer);
- RS_DEBUG->print("\ndxfLine: ");
- RS_DEBUG->print(dxfLine.toAscii().data());
+ DEBUG->print("\ndxfLine: ");
+ DEBUG->print(dxfLine.toAscii().data());
// $-Setting in the header of DXF found
//
if (!dxfLine.isEmpty())
{
graphic->addVariable("$DIMADEC", dxfLine, 70);
- //graphic->setAngleDimensionExactness( RS_Math::pow(0.1, dxfLine.toInt()) );
+ //graphic->setAngleDimensionExactness( Math::pow(0.1, dxfLine.toInt()) );
}
}
}
if (dxfLine=="(null)" || dxfLine=="default") {
dxfLine = "0";
}
- graphic->addLayer(new RS_Layer(dxfLine));
+ graphic->addLayer(new Layer(dxfLine));
graphic->activateLayer(dxfLine);
currentLayer = graphic->getActiveLayer();
lastLayer=dxfLine;
case 6: // style
//if(currentLayer)
//currentLayer->setStyle( graphic->nameToStyle(dxfLine) );
- pen.setLineType(RS_FilterDXF::nameToLineType(dxfLine));
+ pen.setLineType(FilterDXF::nameToLineType(dxfLine));
break;
case 39: // Thickness
//if(currentLayer) currentLayer->setWidth(dxfLine.toInt());
- pen.setWidth(RS_FilterDXF::numberToWidth(dxfLine.toInt()));
+ pen.setWidth(FilterDXF::numberToWidth(dxfLine.toInt()));
break;
case 62: // Color
- pen.setColor(RS_FilterDXF::numberToColor(dxfLine.toInt()));
+ pen.setColor(FilterDXF::numberToColor(dxfLine.toInt()));
//if(currentLayer) {
// currentLayer->setColor( graphic->numberToColor(dxfLine.toInt(), !oldColorNumbers));
//}
if(!dxfLine.isEmpty()) {
switch(code) {
case 6: // style
- pen.setLineType(RS_FilterDXF::nameToLineType(dxfLine));
+ pen.setLineType(FilterDXF::nameToLineType(dxfLine));
break;
case 8: // Layer
//if(dxfLine!=lastLayer) {
vy1 = dxfLine.toDouble();
break;
case 39: // Thickness
- pen.setWidth(RS_FilterDXF::numberToWidth(dxfLine.toInt()));
+ pen.setWidth(FilterDXF::numberToWidth(dxfLine.toInt()));
break;
case 62: // Color
- pen.setColor(RS_FilterDXF::numberToColor(dxfLine.toInt()));
+ pen.setColor(FilterDXF::numberToColor(dxfLine.toInt()));
break;
default:
break;
while(!dxfCode.isEmpty() && code != 0);
graphic->setActivePen(pen);
- graphic->addEntity(new RS_Point(graphic,
- RS_PointData(Vector(vx1, vy1))));
+ graphic->addEntity(new Point(graphic,
+ PointData(Vector(vx1, vy1))));
}
// -----
if(!dxfLine.isEmpty()) {
switch(code) {
case 6: // style
- pen.setLineType(RS_FilterDXF::nameToLineType(dxfLine));
+ pen.setLineType(FilterDXF::nameToLineType(dxfLine));
break;
case 8: // Layer
//if(dxfLine!=lastLayer) {
vy2 = dxfLine.toDouble();
break;
case 39: // Thickness
- pen.setWidth(RS_FilterDXF::numberToWidth(dxfLine.toInt()));
+ pen.setWidth(FilterDXF::numberToWidth(dxfLine.toInt()));
break;
case 62: // Color
- pen.setColor(RS_FilterDXF::numberToColor(dxfLine.toInt()));
+ pen.setColor(FilterDXF::numberToColor(dxfLine.toInt()));
break;
default:
break;
//if(!mtCompFloat(vx1, vx2) || !mtCompFloat(vy1, vy2)) {
//graphic->addLine(vx1, vy1, vx2, vy2, currentLayerNum, add);
graphic->setActivePen(pen);
- graphic->addEntity(new RS_Line(graphic,
- RS_LineData(Vector(vx1, vy1), Vector(vx2, vy2))));
+ graphic->addEntity(new Line(graphic,
+ LineData(Vector(vx1, vy1), Vector(vx2, vy2))));
//}
}
if(!dxfLine.isEmpty()) {
switch(code) {
case 6: // style
- pen.setLineType(RS_FilterDXF::nameToLineType(dxfLine));
+ pen.setLineType(FilterDXF::nameToLineType(dxfLine));
break;
case 8: // Layer
//if(dxfLine!=lastLayer) {
break;
case 50: // Start Angle
dxfLine.replace( QRegExp(","), "." );
- va1 = RS_Math::correctAngle(dxfLine.toDouble()/ARAD);
+ va1 = Math::correctAngle(dxfLine.toDouble()/ARAD);
break;
case 51: // End Angle
dxfLine.replace( QRegExp(","), "." );
- va2 = RS_Math::correctAngle(dxfLine.toDouble()/ARAD);
+ va2 = Math::correctAngle(dxfLine.toDouble()/ARAD);
break;
case 39: // Thickness
- pen.setWidth(RS_FilterDXF::numberToWidth(dxfLine.toInt()));
+ pen.setWidth(FilterDXF::numberToWidth(dxfLine.toInt()));
break;
case 62: // Color
- pen.setColor(RS_FilterDXF::numberToColor(dxfLine.toInt()));
+ pen.setColor(FilterDXF::numberToColor(dxfLine.toInt()));
break;
default:
break;
// graphic->addArc(vcx, vcy, vcr, va1, va2, false, currentLayerNum, add);
//}
graphic->setActivePen(pen);
- graphic->addEntity(new RS_Arc(graphic,
- RS_ArcData(Vector(vcx, vcy),
+ graphic->addEntity(new Arc(graphic,
+ ArcData(Vector(vcx, vcy),
vcr, va1, va2, false)));
}
if(!dxfLine.isEmpty()) {
switch(code) {
case 6: // style
- pen.setLineType(RS_FilterDXF::nameToLineType(dxfLine));
+ pen.setLineType(FilterDXF::nameToLineType(dxfLine));
break;
case 8: // Layer
//if(dxfLine!=lastLayer) {
vcr = dxfLine.toDouble();
break;
case 39: // Thickness
- pen.setWidth(RS_FilterDXF::numberToWidth(dxfLine.toInt()));
+ pen.setWidth(FilterDXF::numberToWidth(dxfLine.toInt()));
break;
case 62: // Color
- pen.setColor(RS_FilterDXF::numberToColor(dxfLine.toInt()));
+ pen.setColor(FilterDXF::numberToColor(dxfLine.toInt()));
break;
default:
break;
graphic->addCircle(vcx, vcy, vcr, 0.0, 360.0, false, currentLayerNum, add);
}*/
graphic->setActivePen(pen);
- graphic->addEntity(new RS_Circle(graphic,
- RS_CircleData(Vector(vcx, vcy),
+ graphic->addEntity(new Circle(graphic,
+ CircleData(Vector(vcx, vcy),
vcr)));
}
break;
case 6: // style
- pen.setLineType(RS_FilterDXF::nameToLineType(dxfLine));
+ pen.setLineType(FilterDXF::nameToLineType(dxfLine));
break;
case 7:
}
break;
case 39: // Thickness
- pen.setWidth(RS_FilterDXF::numberToWidth(dxfLine.toInt()));
+ pen.setWidth(FilterDXF::numberToWidth(dxfLine.toInt()));
break;
case 62: // Color
- pen.setColor(RS_FilterDXF::numberToColor(dxfLine.toInt()));
+ pen.setColor(FilterDXF::numberToColor(dxfLine.toInt()));
break;
default:
break;
}
graphic->addEntity(
- new RS_Text(graphic,
- RS_TextData(
+ new Text(graphic,
+ TextData(
Vector(vx1, vy1),
vheight,
100.0,
strDecodeDxfString(dimText);
break;
case 6: // style
- pen.setLineType(RS_FilterDXF::nameToLineType(dxfLine));
+ pen.setLineType(FilterDXF::nameToLineType(dxfLine));
break;
case 8: // Layer
//if(dxfLine!=lastLayer) {
typ = dxfLine.toInt();
break;
case 39: // Thickness
- pen.setWidth(RS_FilterDXF::numberToWidth(dxfLine.toInt()));
+ pen.setWidth(FilterDXF::numberToWidth(dxfLine.toInt()));
break;
case 62: // Color
- pen.setColor(RS_FilterDXF::numberToColor(dxfLine.toInt()));
+ pen.setColor(FilterDXF::numberToColor(dxfLine.toInt()));
break;
default:
switch(typ) {
// Horiz. / vert.:
case 0: {
- RS_DimLinear* d =
- new RS_DimLinear(
+ DimLinear* d =
+ new DimLinear(
graphic,
- RS_DimensionData(
+ DimensionData(
Vector(v10, v20),
Vector(0.0, 0.0),
RS2::VAlignBottom,
"ISO-25",
0.0
),
- RS_DimLinearData(
+ DimLinearData(
Vector(v13, v23),
Vector(v14, v24),
v50/ARAD,
defP.setPolar(dist, angle);
defP+=Vector(v14, v24);
- RS_DimAligned* d =
- new RS_DimAligned(
+ DimAligned* d =
+ new DimAligned(
graphic,
- RS_DimensionData(
+ DimensionData(
defP,
Vector(0.0, 0.0),
RS2::VAlignBottom,
"ISO-25",
0.0
),
- RS_DimAlignedData(
+ DimAlignedData(
Vector(v13, v23),
Vector(v14, v24)
)
// Angle:
case 2: {
- RS_Line tl1(NULL,
- RS_LineData(Vector(v13, v23),
+ Line tl1(NULL,
+ LineData(Vector(v13, v23),
Vector(v14, v24)));
- RS_Line tl2(NULL,
- RS_LineData(Vector(v10, v20),
+ 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 = RS_Information::getIntersection(
+ s = Information::getIntersection(
&tl1, &tl2, false);
if (s.get(0).valid) {
*/
//Vector dp4;
//dp4.setPolar();
- RS_DimAngular* d =
- new RS_DimAngular(
+ DimAngular* d =
+ new DimAngular(
graphic,
- RS_DimensionData(
+ DimensionData(
Vector(v10, v20),
Vector(0.0, 0.0),
RS2::VAlignBottom,
"ISO-25",
0.0
),
- RS_DimAngularData(
+ DimAngularData(
Vector(v13, v23),
Vector(vcx, vcy),
Vector(vcx, vcy),
.angleTo(Vector(v15, v25));
Vector v2;
v2.setPolar(v40, ang);
- RS_DimRadial* d =
- new RS_DimRadial(
+ DimRadial* d =
+ new DimRadial(
graphic,
- RS_DimensionData(
+ DimensionData(
Vector(v10, v20),
Vector(0.0, 0.0),
RS2::VAlignBottom,
"ISO-25",
0.0
),
- RS_DimRadialData(
+ DimRadialData(
Vector(v10, v20) + v2,
0.0
)
.angleTo(Vector(v15, v25));
Vector v2;
v2.setPolar(v40, ang);
- RS_DimDiametric* d =
- new RS_DimDiametric(
+ DimDiametric* d =
+ new DimDiametric(
graphic,
- RS_DimensionData(
+ DimensionData(
Vector(v10, v20),
Vector(0.0, 0.0),
RS2::VAlignBottom,
"ISO-25",
0.0
),
- RS_DimDiametricData(
+ DimDiametricData(
Vector(v10, v20) + v2,
0.0
)
d->update();
graphic->addEntity(d);
*/
- RS_LeaderData data(true);
- RS_Leader* d =
- new RS_Leader(graphic, data);
+ LeaderData data(true);
+ Leader* d =
+ new Leader(graphic, data);
d->addVertex(Vector(v14, v24));
d->addVertex(Vector(v10, v20));
d->update();
patternName = dxfLine;
break;
case 6: // style
- pen.setLineType(RS_FilterDXF::nameToLineType(dxfLine));
+ pen.setLineType(FilterDXF::nameToLineType(dxfLine));
break;
case 8: // Layer
// if(dxfLine!=lastLayer) {
break;
case 39: // Thickness
- pen.setWidth(RS_FilterDXF::numberToWidth(dxfLine.toInt()));
+ pen.setWidth(FilterDXF::numberToWidth(dxfLine.toInt()));
break;
case 62: // Color
- pen.setColor(RS_FilterDXF::numberToColor(dxfLine.toInt()));
+ pen.setColor(FilterDXF::numberToColor(dxfLine.toInt()));
break;
case 91: // Number of boundary paths (loops)
//numPaths=dxfLine.toInt();
* Resets the whole object
* (base class too)
*/
-void RS_FilterDXF1::reset()
+void FilterDXF1::reset()
{
file.reset();
/**
* Reset buffer pointer to the beginning of the buffer:
*/
-void RS_FilterDXF1::resetBufP()
+void FilterDXF1::resetBufP()
{
fBufP = 0;
}
/**
* Set buffer pointer to the given index:
*/
-void RS_FilterDXF1::setBufP(int _fBufP)
+void FilterDXF1::setBufP(int _fBufP)
{
if (_fBufP < (int)fSize)
fBufP = _fBufP;
/**
* delete buffer:
*/
-void RS_FilterDXF1::delBuffer()
+void FilterDXF1::delBuffer()
{
if (fBuf)
{
/**
* Remove any 13-characters in the buffer:
*/
-void RS_FilterDXF1::dos2unix()
+void FilterDXF1::dos2unix()
{
char * src = fBuf, * dst = fBuf;
// return: -Null-string: end of buffer
// -String which is the next line in buffer
//
-QString RS_FilterDXF1::getBufLine()
+QString FilterDXF1::getBufLine()
{
char * ret;
QString str;
// return: -Null-string: end of buffer
// -String which is the next line in buffer
//
-char * RS_FilterDXF1::getBufLineCh()
+char * FilterDXF1::getBufLineCh()
{
char * ret;
// Copy buffer from a given string:
//
-void RS_FilterDXF1::copyBufFrom(const char * _buf)
+void FilterDXF1::copyBufFrom(const char * _buf)
{
if (_buf)
{
// return: true: line found
// false: end of buffer
//
-bool RS_FilterDXF1::gotoBufLine(char * _lstr)
+bool FilterDXF1::gotoBufLine(char * _lstr)
{
QString l;
// false: end of buffer
//
//
-bool RS_FilterDXF1::gotoBufLineString(char * _lstr)
+bool FilterDXF1::gotoBufLineString(char * _lstr)
{
QString l;
// Replace bynary Bytes (<32) by an other (given) byte:
//
-void RS_FilterDXF1::replaceBinaryBytesBy(char _c)
+void FilterDXF1::replaceBinaryBytesBy(char _c)
{
int bc;
// Separate buffer (change chars sc1 and sc2 in '\0'
//
-void RS_FilterDXF1::separateBuf(char _c1,
+void FilterDXF1::separateBuf(char _c1,
char _c2,
char _c3,
char _c4)
// remove comment between '_fc' and '_lc'
// comments get replaced by '\0'
//
-void RS_FilterDXF1::removeComment(char _fc, char _lc)
+void FilterDXF1::removeComment(char _fc, char _lc)
{
bool rem = false; // Are we removing currrently?
int bc; // counter
// return: true: successful
// false: file not found
//
-bool RS_FilterDXF1::readFileInBuffer(char * _name, int _bNum)
+bool FilterDXF1::readFileInBuffer(char * _name, int _bNum)
{
// file.setName(_name);
file.setFileName(_name);
// return: true: successful
// false: file not found
//
-bool RS_FilterDXF1::readFileInBuffer(int _bNum)
+bool FilterDXF1::readFileInBuffer(int _bNum)
{
fPointer = fopen(name.toAscii().data(), "rb");
// Decode a DXF string to the C-convention (special character \P is a \n)
//
-void RS_FilterDXF1::strDecodeDxfString(QString & str)
+void FilterDXF1::strDecodeDxfString(QString & str)
{
if (str.isEmpty())
return;
// return: true: values are equal
// false: values are not equal
//
-bool RS_FilterDXF1::mtCompFloat(double _v1, double _v2, double _tol)
+bool FilterDXF1::mtCompFloat(double _v1, double _v2, double _tol)
{
double delta = _v2 - _v1;