Skip to content

BaseGeo 基础地理图形 ​

安装 ​

sh
npm install @poggi/geography-entity
pnpm add @poggi/geography-entity
yarn add @poggi/geography-entity

注意:因为地理文件只有经纬度数据,使用该方式构建的地理图形

基本用法 ​

通过BaseGeo构建一个地理三维模型

loading

指定区域显示的显示状态 ​

通过toggleAreaVisibleByName方法可以指定某个区域的显示状态 通过toggleAllAreaVisible方法可以指定所有区域的显示状态

loading

指定区域显示的样式 ​

通过setAreaStyleByName方法可以指定某个区域的显示样式

loading

解析Shape形状 ​

使用analysisShapefile解析shp文件,需要注意的是,其需要配套的dbf文件才能正确解析 在解析后得到的数据可以使用BaseGeo直接进行解析,前提是该文件为区域,如果为线条,需要另行处理

loading

API ​

Attributes ​

属性名说明类型默认值
source数据源GeoJsonDataSource-

methods ​

constructor(container: Container, options: IBaseGeoConstructorOption)

构造函数

toggleAllAreaVisible(visible: boolean)

指定所有区域的显示状态

toggleAreaVisibleByName(areaName: string,visible: boolean,otherVisible?: boolean)

指定某个区域的显示状态

  • areaName: 区域名称
  • visible: 显示状态
  • otherVisible: 其它区域的显示状态

setAreaStyleByName(areaOption: IProvincialAreaOption)

通过名称设置区域样式

lookAtMe(offset?: HeadingPitchRange, height?: number)

摄像机定位于观看改实体

setVisible(visible: boolean)

设置显示状态

destroy()

销毁

Interfaces ​

IBaseGeoConstructorOption extends GeoJsonDataSource.LoadOptions

属性名说明类型是否必选默认值
geojsongeojson地址string | Resource | any是-
arcType兼容类型(用于部分数据无法正常加载时使用)boolean否-
lineOption线条构造参数IPrimitiveGeoLineOption否-

IPrimitiveGeoLineOption

属性名说明类型是否必选默认值
color线条颜色Color是-
width宽度number否1.0
clampToGround是否贴地boolean否false
vertexFormat定点格式VertexFormat否VertexFormat.DEFAULT

IProvincialAreaOption

属性名说明类型是否必选默认值
name省会名称string是-
fill填充颜色Color否-
lineColor线条颜色Color否-