Summary
Methods:
fromJSON |
将JSON对象转成相应的要素类 |
addBuilding |
在园区内添加一个楼栋 |
addBuildings |
在园区内添加多个楼栋 |
calculateArea |
获取园区对象的面积 |
deleteBuildingData |
删除该园区中对应矢量楼块图服务中的楼栋数据,包括楼栋中的楼层、户室数据 |
getAddress |
获取园区地址 |
getBorderSymbol |
获取边界符号 |
getBuildingById |
根据唯一标识符fid获取一个园区内的楼栋 |
getBuildings |
获取园区内的所有楼栋合集 |
getFid |
获取园区要素的唯一标识 |
getFillSymbol |
获取园区外观样式信息 |
getGroundElevation |
获取园区底面起始高程 |
getLabel |
获取注记文本 |
getLabelSymbol |
获取注记样式 |
getLabelVisibility |
获取注记的可见性 |
getLayer |
获取对应的矢量楼块图层 |
getName |
获取园区名称 |
getType |
返回要素的类型 |
loadBuildingById |
加载指定fid的楼栋 |
loadBuildings |
从数据库加载该园区内的所有楼栋 |
removeAllBuildings |
移除园区内所有楼栋 |
removeBuilding |
移除园区内指定楼栋 |
saveData |
保存园区数据至对应矢量楼块图服务,若数据中未存在该数据则新增,若已存在则进行更新 |
setAttributes |
设置地理要素的非空间属性。注意,该操作会覆盖原有属性 |
setBorderSymbol |
设置边界符号 |
setFid |
设置园区要素的唯一标识 |
setFillSymbol |
设置园区外观 |
setGeometry |
重新设置地理要素的几何体 |
setGroundElevation |
设置园区底面起始高程 |
setLabel |
设置注记本文 |
setLabelSymbol |
设置注记样式 |
setLabelVisibility |
设置注记的可见性 |
setVisibility |
设置在图层中可见性,可见性决定了园区要素是否在图层中显示 |
toJSON |
将要素转化成JSON对象 |
Constructor
new Campus(geometry, attributes, options)
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
geometry |
module:geom~Geometry | 地理几何体。 |
|||||||||||||||||||||||||||
attributes |
Object | 一个对象,用来描述地理要素的非空间属性,可用来存储园区的名称,类型,地址,描述等自定义属性
|
|||||||||||||||||||||||||||
options |
Object | 一个对象,用来描述园区的其他属性
|
Example
const polygon = new hmap.geom.Polygon([lineRing]);
let campus = new hmap.indoor.Campus(polygon, null, { fillSymbol: new hmap.style.ColorFill(new hmap.style.Color(0, 255, 0, 0.6)) });
Methods
-
static fromJSON(json) → {module:indoor~Campus}
-
将JSON对象转成相应的要素类
Parameters:
Name Type Description json
JSON JSON对象
-
addBuilding(building)
-
在园区内添加一个楼栋
Parameters:
Name Type Description building
module:indoor~Building 待添加的楼栋
Example
campus.addBuilding(building);
-
addBuildings(buildings)
-
在园区内添加多个楼栋
Parameters:
Name Type Description buildings
Array.<module:indoor~Building> 待添加的楼栋合集
Example
campus.addBuildings(buildings);
-
calculateArea() → {Number}
-
获取园区对象的面积
Returns:
Number -园区对象的面积,单位是地图单位的平方
Example
let area = campus.calculateArea();
-
deleteBuildingData(ids)
-
删除该园区中对应矢量楼块图服务中的楼栋数据,包括楼栋中的楼层、户室数据
Parameters:
Name Type Description ids
Array.<Number> 待删除园区数据的id数组
-
getAddress() → {String}
-
获取园区地址
Returns:
String -园区地址
-
getBorderSymbol() → {module:style~LineSymbol}
-
获取边界符号
-
getBuildingById(fid) → {module:indoor~Building}
-
根据唯一标识符fid获取一个园区内的楼栋
Parameters:
Name Type Description fid
Number 唯一标识
-
getBuildings() → {Array.<module:indoor~Building>}
-
获取园区内的所有楼栋合集
-
getFid() → {String}
-
获取园区要素的唯一标识
Returns:
String -唯一标识
-
getFillSymbol() → {module:style~FillSymbol}
-
获取园区外观样式信息
-
getGroundElevation() → {Number}
-
获取园区底面起始高程
Returns:
Number -
getLabel() → {String}
-
获取注记文本
Returns:
String -注记文本
-
getLabelSymbol() → {TextSymbol}
-
获取注记样式
Returns:
TextSymbol -注记样式
-
getLabelVisibility() → {Boolean}
-
获取注记的可见性
Returns:
Boolean -注记的可见性
-
getLayer() → {module:indoor~IndoorLayer}
-
获取对应的矢量楼块图层
-
getName() → {String}
-
获取园区名称
Returns:
String -园区名称
-
getType() → {String}
-
返回要素的类型
Returns:
String -
async loadBuildingById(fid) → {Promise}
-
加载指定fid的楼栋
Parameters:
Name Type Description fid
String 指定楼栋的唯一标识符fid
Returns:
Promise -从数据库加载的楼栋信息
-
loadBuildings() → {Promise}
-
从数据库加载该园区内的所有楼栋
Returns:
Promise -
removeAllBuildings()
-
移除园区内所有楼栋
Example
campus.removeAllBuildings();
-
removeBuilding(building)
-
移除园区内指定楼栋
Parameters:
Name Type Description building
module:indoor~Building 待移除的楼栋
Example
campus.removeBuilding(building);
-
saveData() → {Promise}
-
保存园区数据至对应矢量楼块图服务,若数据中未存在该数据则新增,若已存在则进行更新
Returns:
Promise -返回保存是否成功的信息
-
setAttributes(attributes)
-
设置地理要素的非空间属性。注意,该操作会覆盖原有属性
Parameters:
Name Type Description attributes
JSON 要设置的属性
-
setBorderSymbol(lineSymbol)
-
设置边界符号
Parameters:
Name Type Description lineSymbol
module:style~LineSymbol 边界的线符号
-
setFid(id)
-
设置园区要素的唯一标识
Parameters:
Name Type Description id
String 园区要素的唯一标识
-
setFillSymbol(fillSymbol)
-
设置园区外观
Parameters:
Name Type Description fillSymbol
module:style~FillSymbol 园区外观填充样式
-
setGeometry(geom)
-
重新设置地理要素的几何体
Parameters:
Name Type Description geom
module:geom~Geometry 几何体对象
Throws:
当参数geom不是Geometry子类的实例时,抛出异常:"Campus setGeometry: the parameter is not a Geometry ."
-
setGroundElevation(z)
-
设置园区底面起始高程
Parameters:
Name Type Description z
Number 起始高程,单位为米
-
setLabel(label)
-
设置注记本文
Parameters:
Name Type Description label
String 注记本文
-
setLabelSymbol(labelSymbol)
-
设置注记样式
Parameters:
Name Type Description labelSymbol
TextSymbol 注记样式
-
setLabelVisibility(visible)
-
设置注记的可见性
Parameters:
Name Type Description visible
Boolean 注记是否可见,可见时为true,不可见为false
-
setVisibility(flag)
-
设置在图层中可见性,可见性决定了园区要素是否在图层中显示
Parameters:
Name Type Description flag
Boolean 可见用true,不可见用false
Example
campus.setVisibility(true);
-
toJSON() → {JSON}
-
将要素转化成JSON对象
Returns:
JSON -JSON对象