Skip to content

Point object angle/rotation is lost during DXF import #2133

Open
@MaBreaker

Description

@MaBreaker

Steps to reproduce

  1. Generate DXF file with rotated POINT objects (slope lines, springs, cave, bouldery field etc.)
  2. Import DXF into new map
  3. Point objects are not rotated as should, but pointing north

Actual behaviour

Point object rotation angle is defined in DXF file (like below POINT code 50 angle -167.00), but are lost in Import

POINT
8
101.1_slope_line
10
12345.00
20
67890.50
50
-167.00
0

Expected behaviour

Point object rotation angle should be set accordingly (when defined) during file import.

Proposal

I believe DXF file is imported through OGR and POINTs with importPointGeometry function. If so and if original DXF angle is stored into OGR symbol details (which I do not know) the same way as with Text objects, then it could work something like..

Object* OgrFileImport::importPointGeometry(OGRFeatureH feature, OGRGeometryH geometry)
{
  ...
  if (symbol->getType() == Symbol::Point)
  {
    auto object = new PointObject(symbol);
    object->setPosition(toMapCoord(OGR_G_GetX(geometry, 0), OGR_G_GetY(geometry, 0)));

    // get rotation angle from symbol details
    const auto& description = symbol->getDescription();
    auto split = description.indexOf(QLatin1Char(' '));
    auto angle = QStringRef(&description, 3, split-3).toDouble(&ok);
    if (ok)
    {
      object->setRotation(qDegreesToRadians(angle));
    }

    return object;
  }
  ...

Configuration

Mapper Version: 0.9.5
Operating System: All

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions