Bug report #10047
DXF2SHP Plugin doesn't include elevation of polyline
Status: | Closed | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | - | ||
Category: | C++ Plugins | ||
Affected QGIS version: | 2.2.0 | Regression?: | No |
Operating System: | Easy fix?: | No | |
Pull Request or Patch supplied: | No | Resolution: | wontfix |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 18527 |
Description
The DXF2SHP plugin fails include the elevation information of a LWPOLYLINE entity when saving the data.
The file dl_dxf.cpp needs the handleLWPolylineData function updated to the allow for processing the groupCode 38
eg the following should work:
/**- Handles additional polyline data.
/
bool DL_Dxf::handleLWPolylineData( DL_CreationInterface /*creationInterface*/ ) {
// Allocate LWPolyline vertices (group code 90):
if ( groupCode 90 ) {
maxVertices = toInt( groupValue );
if ( maxVertices > 0 ) {
if ( vertices != NULL ) {
delete[] vertices;
}
vertices = new double[4*maxVertices];
for ( int i = 0; i < maxVertices; ++i ) {
vertices[i*4] = 0.0;
vertices[i*4+1] = 0.0;
vertices[i*4+2] = 0.0;
vertices[i*4+3] = 0.0;
}
}
vertexIndex = -1;
return true;
}
// Add the elevation as the z point to the vertices[]
else if ( groupCode == 38 )
{
for ( int i = 0; i < maxVertices; ++i )
{
vertices[i*4+2] = toReal(groupValue);
}
}
// Compute LWPolylines vertices (group codes 10/20/30/42):
else if ( groupCode 10 || groupCode 20 ||
groupCode 30 || groupCode 42 )
{
if ( vertexIndex < maxVertices - 1 && groupCode == 10 )
{
vertexIndex++;
}
if ( groupCode <= 30 )
{
if ( vertexIndex >= 0 && vertexIndex < maxVertices )
{
vertices[4*vertexIndex + ( groupCode/10-1 )]
= toReal( groupValue );
}
}
else if ( groupCode == 42 && vertexIndex < maxVertices )
{
vertices[4*vertexIndex + 3] = toReal( groupValue );
}
return true;
}
return false;
}
History
#1 Updated by Giovanni Manghi almost 8 years ago
- Resolution set to wontfix
- Status changed from Open to Closed
#e75b572b6e08f141a927c62f710a67629a0dbe46
tool has been removed on master (qgis 3).