[mxcad_2d API documentation] (../README. md)/[mapbox] (../modules/mapbox. md)/MxMap
Class: MxMap
mapbox.MxMap
CAD map object
Example
import { MxMap } from 'mxcad';
let mx_map = new MxMap;Table of contents
Constructors
Properties
Methods
- cadLongToMercatorCoord
- cadToMercatorCoord
- cadTolnglat
- create
- getMapbox
- getMxDrawObject
- initMapbox
- lnglatToCAD
- lnglat_to_mercator
- map_lnglat_to_meters
- map_meters_to_lnglat
- mercatorCoord2CAD
- mercatorCoordToCAD
- mercator_to_lnglat
- outOfChina
- setCoordinatePointAlignment
- setLoadOldEditionMethod
Constructors
constructor
• new MxMap(inMxcad?)
Parameters
| Name | Type |
|---|---|
inMxcad? | McObject |
Properties
mxcad
• mxcad: McObject
MXCAD object
Methods
cadLongToMercatorCoord
▸ cadLongToMercatorCoord(len): number
Convert longitude coordinates to coordinates under Mercator projection
Parameters
| Name | Type | Description |
|---|---|---|
| Len | number | longitude |
Returns
number
Coordinates under Mercator projection
cadToMercatorCoord
▸ cadToMercatorCoord(pt): Vector3
CAD to Mapbox Mercator Coordinate System
Parameters
| Name | Type | Description |
|---|---|---|
| Pt | Vector3 | 3D point object |
Returns
Vector3
3D point object
cadTolnglat
▸ cadTolnglat(pt): number[]
Convert CAD coordinates to longitude and latitude
Parameters
| Name | Type | Description |
|---|---|---|
| Pt | Vector3 | 3D point object |
Returns
number[]
latitude and longitude
create
▸ create(map, config): Promise<void>
Create a map
Parameters
| Name | Type | Description |
|---|---|---|
| Map | any | map object |
config | any | - |
Returns
Promise<void>
getMapbox
▸ getMapbox(): any
Get the map object of mapbox
Returns
any
Map object
getMxDrawObject
▸ getMxDrawObject(): MxDrawObject
Retrieve the current mxdraw object
Returns
MxDrawObject
Mxdraw object
initMapbox
▸ initMapbox(map): void
Initialize mapbox
Parameters
| Name | Type | Description |
|---|---|---|
| Map | any | map object |
Returns
void
lnglatToCAD
▸ lnglatToCAD(lng, lat): Vector3
From latitude and longitude to CAD coordinates
Parameters
| Name | Type | Description |
|---|---|---|
| Lng | number | longitude |
| Lat | number | latitude |
Returns
Vector3
3D point object
lnglat_to_mercator
▸ lnglat_to_mercator(lng, lat): Vector3
Coordinate from latitude and longitude to the Mercator coordinate system of Mapbox
Parameters
| Name | Type | Description |
|---|---|---|
| Lng | number | longitude |
| Lat | number | dimension |
Returns
Vector3
3D point object
map_lnglat_to_meters
▸ map_lnglat_to_meters(lng, lat): number[]
Convert the coordinates (longitude and latitude) in the geographic coordinate system to the coordinates (meters) in the planar coordinate system
Parameters
| Name | Type | Description |
|---|---|---|
| Lng | number | longitude |
| Lat | number | dimension |
Returns
number[]
plane coordinates
map_meters_to_lnglat
▸ map_meters_to_lnglat(x, y): number[]
Map Mercator coordinate system to latitude and longitude
Parameters
| Name | Type | Description |
|---|---|---|
| X | number | X-axis coordinate |
| Y | number | Y-axis coordinate |
Returns
number[]
latitude and longitude
mercatorCoord2CAD
▸ mercatorCoord2CAD(x, y): Vector3
MAPBOX's Mercator Coordinate System to CAD
Parameters
| Name | Type | Description |
|---|---|---|
| X | number | X-axis coordinate |
| Y | number | Y-axis coordinate |
Returns
Vector3
3D point object
mercatorCoordToCAD
▸ mercatorCoordToCAD(x, y): Vector3
MAPBOX's Mercator Coordinate System to CAD
Parameters
| Name | Type | Description |
|---|---|---|
| X | number | X-axis coordinate |
| Y | number | Y-axis coordinate |
Returns
Vector3
3D point object
mercator_to_lnglat
▸ mercator_to_lnglat(x, y, z): number[]
Mapbox's Mercator coordinate system to latitude and longitude
Parameters
| Name | Type | Description |
|---|---|---|
| X | number | X-axis coordinate |
| Y | number | Y-axis coordinate |
| Z | number | Z-axis coordinate |
Returns
number[]
latitude and longitude
outOfChina
▸ outOfChina(lng, lat): boolean
Is it beyond the scope of China
Parameters
| Name | Type | Description |
|---|---|---|
| Lng | number | longitude |
| Lat | number | dimension |
Returns
boolean
Boolean value
setCoordinatePointAlignment
▸ setCoordinatePointAlignment(originLngLatLike, originCAD, meterInCADUnits): void
Set the alignment method of coordinate points
Parameters
| Name | Type | Description |
|---|---|---|
| OriginLngLatLike | number [] | Origin coordinates of longitude and latitude |
| OriginCAD | number [] | The starting point in the drawing coordinate system, which is the origin coordinate in AutoCAD. |
| MeterInCADUnits | Number | Conversion between Geographic Coordinate Systems and Coordinate Units Used in AutoCAD Drawing |
Returns
void
setLoadOldEditionMethod
▸ setLoadOldEditionMethod(): void
Used to set up loading of old version maps
Returns
void
