Class DxfGeoData
- Namespace
- GeometryHelper.Dxf
- Assembly
- GeometryHelper.dll
A GEODATA of a DXF file, as AutoCAD's GeoLocationData: where a drawing stands on the earth, kept in the extension
dictionary of its block, model space's, under the name ACAD_GEOGRAPHICDATA; its design point and the reference point of
the coordinate system it stands for, the units and scales that take the drawing's units to metres, the up and north
directions, the coordinate system itself and the points of the mesh that fit the one to the other, read and set as the
groups of AcDbGeoData of the DXF reference.
public sealed class DxfGeoData : DxfDBObject
- Inheritance
-
DxfGeoData
- Inherited Members
Remarks
new DxfGeoData { BlockTableRecord = db.ModelSpace, TypeOfCoordinates = DxfTypeOfCoordinates.Local, DesignPoint = new GeoPoint3(0, 0, 0), ReferencePoint = new GeoPoint3(500000, 4100000, 0), HorizontalUnits = DxfUnits.Millimeters, HorizontalUnitsScale = 0.001 }.PostToDb()
places a drawing in millimetres on a local grid, its origin at 500 000 east and 4 100 000 north: a GEODATA at the end of
the OBJECTS section owned by model space's extension dictionary, made where it had none, and the class GEODATA listed
where the drawing lists none. GeoDataObject reads it back.
A GEODATA made in code is AutoCAD 2021's new one, written in the order of ezdxf's: of version 3, as AutoCAD 2021 writes
one (group 90), of no known type of coordinates, its two points at the origin, its units metres of scale 1, up along Z
and north along Y, its scale judged at the reference point, a coordinate system of no text and no mesh. It is posted to model space alone, as AutoCAD's
BlockTableRecordId takes no other block. A GEODATA came with R2010 (AC1024), version 1 of R2009 having no DXF
version of its own: one of version 1 is read by the groups a comment of ezdxf gives it, those of version 2 but the north
direction, the points of its mesh in 12 and 13 there; ezdxf 1.4.5 itself reads no points of the mesh in one of version
1, and only warns of it.
The faces of the mesh (96 to 99) are kept as they are and not given. Taking a point to latitude and longitude, AutoCAD's
TransformToLonLatAlt and TransformFromLonLatAlt, needs the coordinate system's projection, which AutoCAD
works out by its own library: neither is here.
Constructors
- DxfGeoData()
Initializes a GEODATA made in code, as AutoCAD's
GeoLocationData(), with AutoCAD 2021's defaults: of version 3, of no known type of coordinates, its points at the origin, metres of scale 1, up along Z and north along Y, its scale judged at the reference point; given a BlockTableRecord and added to its drawing by PostToDb().
Properties
- BlockTableRecord
Gets or sets the block whose geographic location the GEODATA gives (group 330 of AcDbGeoData), as AutoCAD's
BlockTableRecordId: ModelSpace for the drawing's own; null where the drawing has no block of the handle, and for one made in code not given one.
- CoordinateProjectionRadius
Gets or sets the radius of the coordinate system's projection (group 143), as AutoCAD's
CoordinateProjectionRadius; nought where the record gives none.
- CoordinateSystem
Gets or sets the definition of the coordinate system (groups 303 and 301), as AutoCAD's
CoordinateSystem: the XML of its projection, datum and ellipsoid, as ezdxf reads it, the pieces of 303 then the last of 301 joined, each^Ja line feed; empty where the record gives none.
- DesignPoint
Gets or sets the design point (groups 10, 20 and 30), as AutoCAD's
DesignPoint: the point of the drawing, in its world coordinates, that stands at the reference point; the origin where the record gives none.
- DoSeaLevelCorrection
Gets or sets whether lengths are corrected to the level of the sea (group 294), as AutoCAD's
DoSeaLevelCorrection; false where the record gives none.
- GeoRSSTag
Gets or sets the GeoRSS tag (group 302), as AutoCAD's
GeoRSSTag; empty where the record gives none.
- HorizontalUnits
Gets or sets the unit of the drawing's horizontal lengths (group 91), as AutoCAD's
HorizontalUnits, numbered as$INSUNITSis; inches where the record gives none, as ezdxf reads it.
- HorizontalUnitsScale
Gets or sets the scale that takes a horizontal length of the drawing to metres (group 40), as AutoCAD's
HorizontalUnitsScale: 0.001 for a drawing in millimetres; 1 where the record gives none.
- NorthDirection
Gets the angle of the direction north, in radians, as AutoCAD's
NorthDirectiongives it: from the Y axis of the drawing, positive towards X, from -π to π. North along Y is 0, along X a quarter turn (90 degrees), and along -X -90 degrees, as AutoCAD 2021 reads the three.
- NorthDirectionVector
Gets or sets the direction north in the drawing (groups 12 and 22), as AutoCAD's
NorthDirectionVector, as written; along Y where the record gives none, and for a GEODATA of version 1, whose group 12 is a point of its mesh.
- NumMeshPoints
Gets how many points the mesh has, as AutoCAD's
NumMeshPoints: the pairs of a point of the drawing (13 and 23) and the point it is taken to (14 and 24), 12 and 13 in a GEODATA of version 1; a point of the drawing with no point to take it to is not counted.
- ObservationCoverageTag
Gets or sets the tag of the observation's coverage (group 307), as the DXF reference names it; empty where the record gives none.
- ObservationFromTag
Gets or sets the tag of the observation from (group 305), as the DXF reference names it; empty where the record gives none.
- ObservationToTag
Gets or sets the tag of the observation to (group 306), as the DXF reference names it; empty where the record gives none.
- ReferencePoint
Gets or sets the reference point (groups 11, 21 and 31), as AutoCAD's
ReferencePoint: the point of the coordinate system the design point stands at, east and north on a grid, longitude and latitude where the coordinates are geographic; the origin where the record gives none.
- ScaleEstimationMethod
Gets or sets how the scale is judged (group 95), as AutoCAD's
ScaleEstimationMethod; none, a scale of 1, where the record gives none.
- ScaleFactor
Gets or sets the scale factor the user gives (group 141), as AutoCAD's
ScaleFactor, read where the scale is judged by it; 1 where the record gives none.
- SeaLevelElevation
Gets or sets the height of the sea's level (group 142), as AutoCAD's
SeaLevelElevation, in the drawing's units; nought where the record gives none.
- TypeOfCoordinates
Gets or sets what the coordinates of the location are (group 70), as AutoCAD's
TypeOfCoordinates: a local grid, a projected grid or latitude and longitude; geographic where the record gives none.
- UpDirection
Gets or sets the direction up (groups 210, 220 and 230), as AutoCAD's
UpDirection, as written, not made of length 1; along Z where the record gives none.
- VerticalUnits
Gets or sets the unit of the drawing's heights (group 92), as AutoCAD's
VerticalUnits; inches where the record gives none, as ezdxf reads it.
- VerticalUnitsScale
Gets or sets the scale that takes a height of the drawing to metres (group 41), as AutoCAD's
VerticalUnitsScale; 1 where the record gives none.
Methods
- AddMeshPointMap(int, GeoPoint2, GeoPoint2)
Puts a point in the mesh, as AutoCAD's
AddMeshPointMap: before the point of the index, or last for the index NumMeshPoints; the count (93) written anew, the faces of the mesh kept as they are.
- Erase()
Erases the GEODATA, as AutoCAD's
EraseFromDb: it is taken out of the file, and the entry of the extension dictionary that names it with it.
- GetMeshPointMap(int)
Gets a point of the mesh, as AutoCAD's
GetMeshPointMap.
- GetMeshPointMaps()
Gets the points of the mesh, as AutoCAD's
GetMeshPointMaps, in the order of the record; here a list of pairs where AutoCAD gives two lists.
- PostToDb()
Adds the GEODATA made in code to the drawing of its BlockTableRecord, as AutoCAD's
PostToDb: at the end of the OBJECTS section, owned by the block's extension dictionary, which is made where the block has none, under the name ACAD_GEOGRAPHICDATA, the GEODATA it held erased, as ezdxf replaces it; the block's handle written as its group 330 and the class GEODATA listed where the drawing lists none, as AutoCAD 2021 lists it (flags 4095, a count of 1).
- ResetMeshPointMaps()
Takes every point out of the mesh, as AutoCAD's
ResetMeshPointMaps: the count (93) written 0, the faces of the mesh kept as they are; a mesh of no points changes nothing.
- SetMeshPointMaps(IEnumerable<GeoPoint2>, IEnumerable<GeoPoint2>)
Gives the mesh its points, as AutoCAD's
SetMeshPointMaps: each point of the drawing with the point at its place among those it is taken to, in place of the points it had, the faces of the mesh kept as they are; the points it has change nothing.
- ToString()
Gives the GEODATA as a line for debugging: its type, its handle and what its coordinates are.