# Interface IDxfJsonComponentContext

Context object for DXF-to-GeoJSON or map layer conversion.

interface IDxfJsonComponentContext {
colorIndex: number;
dxf: IDxfData;
dxfToGeoJsonInsertBlockMapper: DxfToGeoJsonInsertBlockMapper;
dxfToGeoJsonLineMapper: DxfToGeoJsonLineMapper;
dxfToGeoJsonPolygonMapper: DxfToGeoJsonPolygonMapper;
dxfToGeoJsonTextMapper: DxfToGeoJsonTextMapper;
fileName?: string;
lastLineEnd?: [number, number];
lastLineLayer?: string;
lineFeatures: Feature<Geometry, {
[name: string]: any;
}>[];
pointFeatures: Feature<Geometry, {
[name: string]: any;
}>[];
polygonFeatures: Feature<Geometry, {
[name: string]: any;
}>[];
renderer_Object_Line: RendererObjectLine;
renderer_Object_Point: RendererObjectPoint;
renderer_Object_Polygon: RendererObjectPolygon;
sanitizedFileName?: string;
sourceSR: SpatialReference;
subLayers: (FeatureLayer | GeoJSONLayer | GraphicsLayer)[];
targetSR: SpatialReference;
textFeatures: Feature<Geometry, {
[name: string]: any;
}>[];
convertToSpatialReference(x: number, y: number): Promise<[number, number]>;
dxfEntities(entity: IEntity | IEntity[]): Promise<void>;
intToRGB(colorInt: number): number[];
projectMany(points: Point[]): Promise<[number, number][]>;
}

#####
Index

### Properties

colorIndex
dxf
dxfToGeoJsonInsertBlockMapper
dxfToGeoJsonLineMapper
dxfToGeoJsonPolygonMapper
dxfToGeoJsonTextMapper
fileName?
lastLineEnd?
lastLineLayer?
lineFeatures
pointFeatures
polygonFeatures
renderer_Object_Line
renderer_Object_Point
renderer_Object_Polygon
sanitizedFileName?
sourceSR
subLayers
targetSR
textFeatures

### Methods

convertToSpatialReference
dxfEntities
intToRGB
projectMany

##
Properties

### colorIndex

colorIndex: number

A running index to provide unique colors for entities.

### dxf

dxf: IDxfData

Parsed DXF data structure.

### dxfToGeoJsonInsertBlockMapper

dxfToGeoJsonInsertBlockMapper: DxfToGeoJsonInsertBlockMapper

DxfContext responsible for insert block handling.

### dxfToGeoJsonLineMapper

dxfToGeoJsonLineMapper: DxfToGeoJsonLineMapper

DxfContext responsible for line entity processing.

### dxfToGeoJsonPolygonMapper

dxfToGeoJsonPolygonMapper: DxfToGeoJsonPolygonMapper

DxfContext responsible for polygon entity processing.

### dxfToGeoJsonTextMapper

dxfToGeoJsonTextMapper: DxfToGeoJsonTextMapper

DxfContext responsible for text entity processing.

### `Optional` fileName

fileName?: string

The original file name of the DXF file.

### `Optional` lastLineEnd

lastLineEnd?: [number, number]

The end coordinate of the last processed line or arc segment, used for determining continuity. It is `undefined` if there is no previous segment or if continuity is broken.

### `Optional` lastLineLayer

lastLineLayer?: string

The layer of the last processed line or arc segment. This is used in conjunction with `lastLineEnd` to ensure that line segments are only merged if they belong to the same layer.

### lineFeatures

lineFeatures: Feature<Geometry, {
[name: string]: any;
}>[]

Generated GeoJSON line features.

### pointFeatures

pointFeatures: Feature<Geometry, {
[name: string]: any;
}>[]

Generated GeoJSON point features.

### polygonFeatures

polygonFeatures: Feature<Geometry, {
[name: string]: any;
}>[]

Generated GeoJSON polygon features.

### renderer_Object_Line

renderer_Object_Line: RendererObjectLine

Renderer for line features.

### renderer_Object_Point

renderer_Object_Point: RendererObjectPoint

Renderer for point features.

### renderer_Object_Polygon

renderer_Object_Polygon: RendererObjectPolygon

Renderer for polygon features.

### `Optional` sanitizedFileName

sanitizedFileName?: string

A sanitized version of the file name suitable for use in an ID.

### sourceSR

sourceSR: SpatialReference

Source spatial reference.

### subLayers

subLayers: (FeatureLayer | GeoJSONLayer | GraphicsLayer)[]

Generated sublayers (GeoJSON or graphics layers).

### targetSR

targetSR: SpatialReference

Target spatial reference for transformation.

### textFeatures

textFeatures: Feature<Geometry, {
[name: string]: any;
}>[]

Generated GeoJSON text features.

##
Methods

### convertToSpatialReference

- convertToSpatialReference(x, y): Promise<[number, number]>

- Convert raw XY coordinates into the target spatial reference.

  #### Parameters

  - x: number

    X coordinate value.

  - y: number

    Y coordinate value.

  #### Returns Promise<[number, number]>

  Converted coordinate pair.

### dxfEntities

- dxfEntities(entity): Promise<void>

- Process DXF entities and convert them to GIS features.

  #### Parameters

  - entity: IEntity | IEntity[]

    The entity or list of entities to process.

  #### Returns Promise<void>

### intToRGB

- intToRGB(colorInt): number[]

- Convert a DXF integer color value to an RGB array.

  #### Parameters

  - colorInt: number

    Integer color value.

  #### Returns number[]

  RGB array.

### projectMany

- projectMany(points): Promise<[number, number][]>

- Project an array of points into the target spatial reference.

  #### Parameters

  - points: Point[]

    Array of points to project.

  #### Returns Promise<[number, number][]>

  Array of converted coordinate pairs.