[qet] [4256] DXFtoQET

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 4256
Author:   rdsivd
Date:     2015-11-11 22:17:51 +0100 (Wed, 11 Nov 2015)
Log Message:
-----------
DXFtoQET
added entities LWPOLYLINE
entities ELLIPSE not finished(placed into wrong position)

Modified Paths:
--------------
    branches/dxftoqet2/DXFtoQET.pro
    branches/dxftoqet2/dxf_create_elmt.cpp
    branches/dxftoqet2/dxf_create_elmt.h
    branches/dxftoqet2/dxftoqet_mainwindow.ui
    branches/dxftoqet2/src/dxf/dxf_ellipse.cpp
    branches/dxftoqet2/src/dxf_base_types/dxf_base_polyline.cpp
    branches/dxftoqet2/src/dxf_data.h
    branches/dxftoqet2/src/dxf_split.cpp

Added Paths:
-----------
    branches/dxftoqet2/src/dxf/dxf_lwpolyline.cpp
    branches/dxftoqet2/src/dxf/dxf_lwpolyline.h

Modified: branches/dxftoqet2/DXFtoQET.pro
===================================================================
--- branches/dxftoqet2/DXFtoQET.pro	2015-11-09 20:20:11 UTC (rev 4255)
+++ branches/dxftoqet2/DXFtoQET.pro	2015-11-11 21:17:51 UTC (rev 4256)
@@ -45,7 +45,8 @@
     src/dxf/dxf_ellipse.cpp \
     src/dxf_base_types/dxf_base_ellipse.cpp \
     src/dxf_base_types/dxf_base_polyline.cpp \
-    src/dxf/dxf_polyline.cpp
+    src/dxf/dxf_polyline.cpp \
+    src/dxf/dxf_lwpolyline.cpp
 
 HEADERS  += dxftoqet_mainwindow.h \
     src/dxf_data.h \
@@ -78,7 +79,8 @@
     src/dxf/dxf_ellipse.h \
     src/dxf_base_types/dxf_base_ellipse.h \
     src/dxf_base_types/dxf_base_polyline.h \
-    src/dxf/dxf_polyline.h
+    src/dxf/dxf_polyline.h \
+    src/dxf/dxf_lwpolyline.h
 
 FORMS    += dxftoqet_mainwindow.ui
 

Modified: branches/dxftoqet2/dxf_create_elmt.cpp
===================================================================
--- branches/dxftoqet2/dxf_create_elmt.cpp	2015-11-09 20:20:11 UTC (rev 4255)
+++ branches/dxftoqet2/dxf_create_elmt.cpp	2015-11-11 21:17:51 UTC (rev 4256)
@@ -16,6 +16,7 @@
 extern struct DXF_entities_polyline DXF_input_entities_polyline[1000];
 extern struct DXF_entities_seqend DXF_input_entities_seqend[1000];
 extern struct DXF_entities_vertex DXF_input_entities_vertex[5000];
+extern struct DXF_entities_lwpolyline DXF_input_entities_lwpolyline[1000];
 
 extern struct DXF_block_line DXF_input_block_line[100][50];
 extern struct DXF_block_arc DXF_input_block_arc[100][50];
@@ -285,6 +286,10 @@
 	Count_entitie_insert=DXF_main_base[0].DXF_entities_insert_count;
 	Result.append(Make_INSERT());
 
+	/* LWPOLYLINE */
+	Count_entitie_lwpolyline=DXF_main_base[0].DXF_entities_lwpolyline_count;
+	Result.append(Make_LWPOLYLINE());
+
 	/* Close elmt description */
 
 	Result.append(Create_ELMT.DescriptionEnd());
@@ -580,7 +585,7 @@
 	   db_ellipse.end2=DXF_input_entities_ellipse[Count_lines].DXF_entities_ellipse_code_42;
 	   db_ellipse.LineTypeOFLine=DXF_input_entities_ellipse[Count_lines].DXF_entities_ellipse_code_6;
 	   db_ellipse.LayerNameOFLine=DXF_input_entities_ellipse[Count_lines].DXF_entities_ellipse_code_8;
-	   db_ellipse.Color="red";
+	   db_ellipse.Color="blue";
 	   db_ellipse.Line_weight="thin";
 	   db_ellipse.Filling="none";
 
@@ -660,7 +665,70 @@
 
 	return Result_polyline;
  }
+ 
+ QString DXF_create_elmt::Make_LWPOLYLINE()
+ {
 
+	dxf_lwpolyline db_lwpolyline;
+
+
+	Result_lwpolyline="";
+
+	Count_lines=0;
+	count_vertex=1;
+
+	while (Count_lines<=Count_entitie_lwpolyline)
+	{
+		vector_max=DXF_input_entities_lwpolyline[Count_lines].DXF_entities_lwpolyline_code_90;
+	   for(counter_x=0;counter_x<=vector_max;counter_x++)
+	   {
+
+
+			db_lwpolyline.x_vector[count_vertex]=DXF_input_entities_lwpolyline[Count_lines].DXF_entities_lwpolyline_code_10[counter_x];
+			db_lwpolyline.y_vector[count_vertex]=-DXF_input_entities_lwpolyline[Count_lines].DXF_entities_lwpolyline_code_20[counter_x];
+			count_vertex=count_vertex+1;
+
+		   if (count_vertex>49)
+		   {
+			   counter_x=vector_max+2;
+		   }
+		   if (count_vertex>vector_max+1)
+		   {
+			   counter_x=vector_max+2;
+		   }
+
+	   }
+
+	   db_lwpolyline.vector_count=vector_max;
+
+	   db_lwpolyline.antialias="false";
+	   db_lwpolyline.line_style="normal";
+	   db_lwpolyline.line_weight="thin";
+	   db_lwpolyline.filling="none";
+	   db_lwpolyline.color="black";
+	   db_lwpolyline.closed=DXF_input_entities_lwpolyline[Count_lines].DXF_entities_lwpolyline_code_70;
+
+
+	   db_lwpolyline.ltype=DXF_input_entities_lwpolyline[Count_lines].DXF_entities_lwpolyline_code_6;
+	   db_lwpolyline.layer=DXF_input_entities_lwpolyline[Count_lines].DXF_entities_lwpolyline_code_8;
+
+
+
+
+	  Result_lwpolyline.append(db_lwpolyline.Create_LWPOLYLINE());
+
+	   Count_lines=Count_lines+1;
+	   count_vertex=1;
+	   counter_x=0;
+
+
+
+
+	}
+
+	return Result_lwpolyline;
+ }
+
   QString DXF_create_elmt::Make_INSERT()
   {
 	  Result_insert="";

Modified: branches/dxftoqet2/dxf_create_elmt.h
===================================================================
--- branches/dxftoqet2/dxf_create_elmt.h	2015-11-09 20:20:11 UTC (rev 4255)
+++ branches/dxftoqet2/dxf_create_elmt.h	2015-11-11 21:17:51 UTC (rev 4256)
@@ -16,6 +16,7 @@
 #include "dxf/dxf_text.h"
 #include "dxf/dxf_ellipse.h"
 #include "dxf/dxf_polyline.h"
+#include "dxf/dxf_lwpolyline.h"
 
 class DXF_create_elmt : public QMainWindow
 {
@@ -36,6 +37,7 @@
 	QString Make_ELLIPSE();
 	QString Make_INSERT();
 	QString Make_POLYLINE();
+	QString Make_LWPOLYLINE();
 
 	QString Make_Block_LINES();
 	QString Make_Block_ARC();
@@ -62,6 +64,7 @@
 	QString Result_ellipse2;
 	QString Result_insert;
 	QString Result_polyline;
+	QString Result_lwpolyline;
 
 	QString Result_Block_Lines;
 	QString Result_Block_Arc;
@@ -81,6 +84,7 @@
 	int Count_header;
 	int counter_x;
 	int count_vertex;
+	int vector_max;
 
 	int Count_entitie_line;
 	int Count_entitie_arc;
@@ -92,6 +96,7 @@
 	int Count_entitie_ellipse;
 	int Count_entitie_insert;
 	int Count_entitie_polyline;
+	int Count_entitie_lwpolyline;
 
 	int Count_lines;
 	int Count_lines_block;

Modified: branches/dxftoqet2/dxftoqet_mainwindow.ui
===================================================================
--- branches/dxftoqet2/dxftoqet_mainwindow.ui	2015-11-09 20:20:11 UTC (rev 4255)
+++ branches/dxftoqet2/dxftoqet_mainwindow.ui	2015-11-11 21:17:51 UTC (rev 4256)
@@ -757,7 +757,7 @@
               <string notr="true">BACKGROUND:rgb(225, 225, 225)</string>
              </property>
              <property name="currentIndex">
-              <number>2</number>
+              <number>3</number>
              </property>
              <widget class="QWidget" name="tab_dxf_sections">
               <attribute name="title">
@@ -1928,7 +1928,9 @@
                    </size>
                   </property>
                   <property name="styleSheet">
-                   <string notr="true">color:rgb(170, 85, 255)</string>
+                   <string notr="true">color:rgb(170, 85, 255);
+border-width: 2px;
+border-color: rgb(170, 0, 0);</string>
                   </property>
                  </widget>
                 </item>
@@ -2244,8 +2246,11 @@
                 </item>
                 <item row="3" column="2">
                  <widget class="QLabel" name="label_39">
+                  <property name="styleSheet">
+                   <string notr="true">BACKGROUND:rgb(165, 198, 130)</string>
+                  </property>
                   <property name="text">
-                   <string>LWPOLYLINE</string>
+                   <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;LWPOLYLINE&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
                   </property>
                  </widget>
                 </item>

Modified: branches/dxftoqet2/src/dxf/dxf_ellipse.cpp
===================================================================
--- branches/dxftoqet2/src/dxf/dxf_ellipse.cpp	2015-11-09 20:20:11 UTC (rev 4255)
+++ branches/dxftoqet2/src/dxf/dxf_ellipse.cpp	2015-11-11 21:17:51 UTC (rev 4256)
@@ -28,11 +28,11 @@
 
 	if (((qPow(pow_major_x,2) - qPow(pow_major_y,2)))<0)
 	{
-		width=(qSqrt(-(qPow(pow_major_x,2) - qPow(pow_major_y,2))));
+		width=2*(qSqrt(-(qPow(pow_major_x,2) - qPow(pow_major_y,2))));
 	}
 	else
 	{
-		width=(qSqrt(qPow(pow_major_x,2) - qPow(pow_major_y,2)));
+		width=2*(qSqrt(qPow(pow_major_x,2) - qPow(pow_major_y,2)));
 	}
 
 

Added: branches/dxftoqet2/src/dxf/dxf_lwpolyline.cpp
===================================================================
--- branches/dxftoqet2/src/dxf/dxf_lwpolyline.cpp	                        (rev 0)
+++ branches/dxftoqet2/src/dxf/dxf_lwpolyline.cpp	2015-11-11 21:17:51 UTC (rev 4256)
@@ -0,0 +1,46 @@
+#include "dxf_lwpolyline.h"
+
+dxf_lwpolyline::dxf_lwpolyline(QWidget *parent) : QMainWindow(parent)
+{
+
+}
+
+QString dxf_lwpolyline::Create_LWPOLYLINE()
+{
+	dxf_base_polyline db_lwpolyline;
+	DXF_Ltype_control db_line_ltype_control;
+
+	Result_lwpolyline="";
+
+	db_line_ltype_control.FindLT=ltype;
+	db_line_ltype_control.Layer=layer;
+
+	db_lwpolyline.QET_line_style=db_line_ltype_control.Ltype_control();
+
+	db_lwpolyline.QET_antialias=antialias;
+	db_lwpolyline.QET_line_weight=line_weight;
+	db_lwpolyline.QET_filling=filling;
+	db_lwpolyline.QET_color=color;
+	if (closed==1)
+	{
+		db_lwpolyline.QET_closed="true";
+	}
+	else
+	{
+		db_lwpolyline.QET_closed="false";
+	}
+
+	for (count=1; count<=vector_count+1;count++)
+	{
+		db_lwpolyline.QET_x[count]=x_vector[count];
+		db_lwpolyline.QET_y[count]=y_vector[count];
+
+
+	}
+
+	db_lwpolyline.segments=vector_count;
+
+	Result_lwpolyline.append(db_lwpolyline.Create_polyline());
+
+	return Result_lwpolyline;
+}

Added: branches/dxftoqet2/src/dxf/dxf_lwpolyline.h
===================================================================
--- branches/dxftoqet2/src/dxf/dxf_lwpolyline.h	                        (rev 0)
+++ branches/dxftoqet2/src/dxf/dxf_lwpolyline.h	2015-11-11 21:17:51 UTC (rev 4256)
@@ -0,0 +1,43 @@
+#ifndef DXF_LWPOLYLINE_H
+#define DXF_LWPOLYLINE_H
+
+#include <QMainWindow>
+#include "dxf_base_types/dxf_base_polyline.h"
+#include "dxf_control/dxf_ltype_control.h"
+
+class dxf_lwpolyline : public QMainWindow
+{
+	Q_OBJECT
+	public:
+	explicit dxf_lwpolyline(QWidget *parent = 0);
+
+	QString layer;				//8
+	QString ltype;				//6
+
+	QString antialias;
+	QString style;
+	QString line_style;
+	QString line_weight;
+	QString filling;
+	QString color;
+
+	int16_t closed;				//70
+
+	double x_vector[50];
+	double y_vector[50];
+
+	QString Result_lwpolyline;
+
+
+	int vector_count;
+	int count;
+
+
+	QString Create_LWPOLYLINE();
+	
+	signals:
+
+	public slots:
+};
+
+#endif // DXF_LWPOLYLINE_H

Modified: branches/dxftoqet2/src/dxf_base_types/dxf_base_polyline.cpp
===================================================================
--- branches/dxftoqet2/src/dxf_base_types/dxf_base_polyline.cpp	2015-11-09 20:20:11 UTC (rev 4255)
+++ branches/dxftoqet2/src/dxf_base_types/dxf_base_polyline.cpp	2015-11-11 21:17:51 UTC (rev 4256)
@@ -60,7 +60,7 @@
 	Result_polyline.append(QET_antialias);
 	Result_polyline.append(QChar(34));
 
-	for (count_segments=1; count_segments<segments;count_segments++)
+	for (count_segments=1; count_segments<=segments;count_segments++)
 	{
 		Result_polyline.append(" x");
 		Result_polyline.append(QString::number(count_segments));

Modified: branches/dxftoqet2/src/dxf_data.h
===================================================================
--- branches/dxftoqet2/src/dxf_data.h	2015-11-09 20:20:11 UTC (rev 4255)
+++ branches/dxftoqet2/src/dxf_data.h	2015-11-11 21:17:51 UTC (rev 4256)
@@ -3370,20 +3370,20 @@
 
 		QString DXF_entities_lwpolyline_code_8;
 
-		double DXF_entities_lwpolyline_code_10[50];
+		double DXF_entities_lwpolyline_code_10[50]; //x
 		double DXF_entities_lwpolyline_code_11;
-		double DXF_entities_lwpolyline_code_20[50];
+		double DXF_entities_lwpolyline_code_20[50]; //y
 		double DXF_entities_lwpolyline_code_21;
-		double DXF_entities_lwpolyline_code_30;
+		double DXF_entities_lwpolyline_code_30; //z
 		double DXF_entities_lwpolyline_code_31;
 
-		double DXF_entities_lwpolyline_code_43;
+		double DXF_entities_lwpolyline_code_43;// constant width default=0
 
 		int16_t DXF_entities_lwpolyline_code_62;
 
-		int16_t DXF_entities_lwpolyline_code_70;
+		int16_t DXF_entities_lwpolyline_code_70; //1= closed 128=plingen
 
-		int32_t DXF_entities_lwpolyline_code_90;
+		int32_t DXF_entities_lwpolyline_code_90; //number of vertices
 
 		QString DXF_entities_lwpolyline_code_100[3];
 

Modified: branches/dxftoqet2/src/dxf_split.cpp
===================================================================
--- branches/dxftoqet2/src/dxf_split.cpp	2015-11-09 20:20:11 UTC (rev 4255)
+++ branches/dxftoqet2/src/dxf_split.cpp	2015-11-11 21:17:51 UTC (rev 4256)
@@ -24095,18 +24095,7 @@
 											}
 											else
 											{
-												Log_1.append("Find in ENTITIES code ");
-												Log_1.append(QString::number(entities_LWPOLYLINE_count2));
-												Log_1.append(" LWPOLYLINE \n");
-												Log_1.append("Line :" );
-												Log_1.append(QString::number( for_count1));
-												Log_1.append(" ");
-												Log_1.append("Code :" );
-												Log_1.append(QString::number( line5));
-												Log_1.append(" : ");
-												Log_1.append(line6);
-												Log_1.append(" ");
-												Log_1.append("\n");
+												Log_1.append(found_entities_lwpolyline());
 											}
 
 											break;
@@ -24120,18 +24109,7 @@
 											}
 											else
 											{
-												Log_1.append("Find in ENTITIES code ");
-												Log_1.append(QString::number(entities_LWPOLYLINE_count2));
-												Log_1.append(" LWPOLYLINE \n");
-												Log_1.append("Line :" );
-												Log_1.append(QString::number( for_count1));
-												Log_1.append(" ");
-												Log_1.append("Code :" );
-												Log_1.append(QString::number( line5));
-												Log_1.append(" : ");
-												Log_1.append(line6);
-												Log_1.append(" ");
-												Log_1.append("\n");
+												Log_1.append(found_entities_lwpolyline());
 											}
 
 											break;
@@ -24140,18 +24118,7 @@
 
 											if (entities_LWPOLYLINE_count2_10>49)
 											{
-												Log_1.append("Find in ENTITIES code ");
-												Log_1.append(QString::number(entities_LWPOLYLINE_count2));
-												Log_1.append(" LWPOLYLINE \n");
-												Log_1.append("Line :" );
-												Log_1.append(QString::number( for_count1));
-												Log_1.append(" ");
-												Log_1.append("Code :" );
-												Log_1.append(QString::number( line5));
-												Log_1.append(" : ");
-												Log_1.append(line6);
-												Log_1.append(" ");
-												Log_1.append("\n");
+												Log_1.append(found_entities_lwpolyline());
 											}
 											else
 											{
@@ -24168,18 +24135,7 @@
 
 											if (entities_LWPOLYLINE_count2_20>49)
 											{
-												Log_1.append("Find in ENTITIES code ");
-												Log_1.append(QString::number(entities_LWPOLYLINE_count2));
-												Log_1.append(" LWPOLYLINE \n");
-												Log_1.append("Line :" );
-												Log_1.append(QString::number( for_count1));
-												Log_1.append(" ");
-												Log_1.append("Code :" );
-												Log_1.append(QString::number( line5));
-												Log_1.append(" : ");
-												Log_1.append(line6);
-												Log_1.append(" ");
-												Log_1.append("\n");
+												Log_1.append(found_entities_lwpolyline());
 											}
 											else
 											{
@@ -24201,18 +24157,7 @@
 											}
 											else
 											{
-												Log_1.append("Find in ENTITIES code ");
-												Log_1.append(QString::number(entities_LWPOLYLINE_count2));
-												Log_1.append(" LWPOLYLINE \n");
-												Log_1.append("Line :" );
-												Log_1.append(QString::number( for_count1));
-												Log_1.append(" ");
-												Log_1.append("Code :" );
-												Log_1.append(QString::number( line5));
-												Log_1.append(" : ");
-												Log_1.append(line6);
-												Log_1.append(" ");
-												Log_1.append("\n");
+												Log_1.append(found_entities_lwpolyline());
 											}
 
 											break;
@@ -24227,23 +24172,12 @@
 											}
 											else
 											{
-												Log_1.append("Find in ENTITIES code ");
-												Log_1.append(QString::number(entities_LWPOLYLINE_count2));
-												Log_1.append(" LWPOLYLINE \n");
-												Log_1.append("Line :" );
-												Log_1.append(QString::number( for_count1));
-												Log_1.append(" ");
-												Log_1.append("Code :" );
-												Log_1.append(QString::number( line5));
-												Log_1.append(" : ");
-												Log_1.append(line6);
-												Log_1.append(" ");
-												Log_1.append("\n");
+												Log_1.append(found_entities_lwpolyline());
 											}
 
 											break;
 
-										case 70:
+										case 70: // 1 = closed 128 = plinegen
 
 											if(sw_entities_lwpolyline[70]==0)
 											{
@@ -24252,23 +24186,12 @@
 											}
 											else
 											{
-												Log_1.append("Find in ENTITIES code ");
-												Log_1.append(QString::number(entities_LWPOLYLINE_count2));
-												Log_1.append(" LWPOLYLINE \n");
-												Log_1.append("Line :" );
-												Log_1.append(QString::number( for_count1));
-												Log_1.append(" ");
-												Log_1.append("Code :" );
-												Log_1.append(QString::number( line5));
-												Log_1.append(" : ");
-												Log_1.append(line6);
-												Log_1.append(" ");
-												Log_1.append("\n");
+												Log_1.append(found_entities_lwpolyline());
 											}
 
 											break;
 
-										case 90:
+										case 90: // number of vertices
 
 											if(sw_entities_lwpolyline[90]==0)
 											{
@@ -24277,18 +24200,7 @@
 											}
 											else
 											{
-												Log_1.append("Find in ENTITIES code ");
-												Log_1.append(QString::number(entities_LWPOLYLINE_count2));
-												Log_1.append(" LWPOLYLINE \n");
-												Log_1.append("Line :" );
-												Log_1.append(QString::number( for_count1));
-												Log_1.append(" ");
-												Log_1.append("Code :" );
-												Log_1.append(QString::number( line5));
-												Log_1.append(" : ");
-												Log_1.append(line6);
-												Log_1.append(" ");
-												Log_1.append("\n");
+												Log_1.append(found_entities_lwpolyline());
 											}
 
 											break;
@@ -24297,18 +24209,7 @@
 
 											if (entities_LWPOLYLINE_count2_100>2)
 											{
-												Log_1.append("Find in ENTITIES code ");
-												Log_1.append(QString::number(entities_LWPOLYLINE_count2));
-												Log_1.append(" LWPOLYLINE \n");
-												Log_1.append("Line :" );
-												Log_1.append(QString::number( for_count1));
-												Log_1.append(" ");
-												Log_1.append("Code :" );
-												Log_1.append(QString::number( line5));
-												Log_1.append(" : ");
-												Log_1.append(line6);
-												Log_1.append(" ");
-												Log_1.append("\n");
+												Log_1.append(found_entities_lwpolyline());
 											 }
 											else
 											 {
@@ -24327,33 +24228,13 @@
 											}
 											else
 											{
-												Log_1.append("Find in ENTITIES code ");
-												Log_1.append(QString::number(entities_LWPOLYLINE_count2));
-												Log_1.append(" LWPOLYLINE \n");
-												Log_1.append("Line :" );
-												Log_1.append(QString::number( for_count1));
-												Log_1.append(" ");
-												Log_1.append("Code :" );
-												Log_1.append(QString::number( line5));
-												Log_1.append(" : ");
-												Log_1.append(line6);
-												Log_1.append(" ");
-												Log_1.append("\n");
+												Log_1.append(found_entities_lwpolyline());
 											}
 
 											break;
 
 										default:
-											Log_1.append("Find in entities LWPOLYLINE \n");
-											Log_1.append("Line :" );
-											Log_1.append(QString::number( for_count1));
-											Log_1.append(" ");
-											Log_1.append("Code :" );
-											Log_1.append(QString::number( line5));
-											Log_1.append(" : ");
-											Log_1.append(line6);
-											Log_1.append(" ");
-											Log_1.append("\n");
+											Log_1.append(found_entities_lwpolyline());
 									}
 								}
 
@@ -31285,7 +31166,24 @@
 	return Log_2;
 }
 
+QString dxf_split::found_entities_lwpolyline()
+{
+	Log_2="";
+	Log_2.append("Found in ENTITIES code ");
+	Log_2.append(" LWPOLYLINE n°: ");
+	Log_2.append(QString::number(entities_LINE_count2));
+	Log_2.append(" line :" );
+	Log_2.append(QString::number( for_count1));
+	Log_2.append(" ");
+	Log_2.append(" code :" );
+	Log_2.append(QString::number( line5));
+	Log_2.append(" - ");
+	Log_2.append(line6);
+	Log_2.append(" ");
+	Log_2.append("\n");
 
+	return Log_2;
+}
 
 QString dxf_split::found_block_section2()
 {


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/