Class: GeoBuildingRenderer

CMAP.GeoBuildingRenderer(geoBuilding, param)

GeoBuilding样式类

Constructor

new GeoBuildingRenderer(geoBuilding, param)

构造函数
Parameters:
Name Type Description
geoBuilding CMAP.GeoBuilding 要渲染的GeoBuilding实例
param Object 参数列表
Properties
Name Type Description
type Boolean GeoBuilding的渲染类型 支持vector,image 默认为vector
color String | Array | Number 当type=vector时生效 填充颜色 默认白色
colorMapping Object 设置建筑的渐变色,目前只有侧面生效, 当type=vector时,如果设置了colorMapping则color不生效 当type=cool,如果设置了colorMapping则颜色和贴图均不生效
opacity Number 当type=vector时生效 填充不透明度 默认1
imageUrl Array | String 当type=image时生效 贴图路径
textureWrap String 当type=image时生效 贴图循环方式 CMAP.TextureWrapMode.Stretch 拉伸,CMAP.TextureWrapMode.RepeatY 高度方向平铺 CMAP.TextureWrapMode.Repeat 水平和高度方向均平铺 默认CMAP.TextureWrapMode.RepeatY
blending Boolean 当type=image时生效 是否混合 默认不开启
windowImageUrl String 当type=cool时生效 是否加载窗户贴图
offset Array 当type=cool时生效 设置窗户贴图的偏移值 array[0]代表顶面,array[1]代表侧面
repeat Array 当type=cool时生效 设置窗户贴图的重复度 array[0]代表顶面,array[1]代表侧面
envMapUrl String 当type=cool时生效 是否使用反射贴图 array[0]代表顶面,array[1]代表侧面
metalness Array 当type=cool时生效 设置建筑的金属度 array[0]代表顶面,array[1]代表侧面
Author:

Members

blending :Boolean

是否贴图混合 当type=image时生效
Type:
  • Boolean
Author:
Example
//设置楼贴图进行混合,仅在getBuilding.render.type = image时生效
//设置该属性,贴图会透明
geoBuilding.renderer.blending = true;

color :String|Array|Number

设置楼宇填充色 在type为vector时生效
Type:
  • String | Array | Number
Author:
Example
geoBuilding.renderer.type = 'vector';//设置楼的渲染类型为vector(纯色)
geoBuilding.renderer.color = 'rgb(255,0,0)'; //将颜色设置为红色

colorMapping :Object

设置楼宇侧面的渐变色
Type:
  • Object
Author:
  • zhuguang
Example
buildingLayer.renderer.type = 'vector'; //设置图层中楼的渲染类型为纯色
buildingLayer.renderer.colorMapping = {'0':'rgb(255,0,0)', '0.5':'rgb(0,255,0)', '1.0':'rgb(0,0,255)'}; //将楼图层中侧面颜色设置成渐变色

effect :Boolean

是否开启特效
Type:
  • Boolean
Author:
  • zhuguang
Example
building.renderer.effect = true;

envMapIntensity :Number

设置楼宇反射强度
Type:
  • Number
Author:
  • zhuguang
Example
geoBuilding.renderer.envMapIntensity = 1.0;

envMapUrl :Array

设置楼宇反射贴图
Type:
  • Array
Author:
  • zhuguang
Example
geoBuilding.renderer.envMapUrl = 'http://';//窗户贴图

extrudeFactor :Number

高度拉伸倍数
Type:
  • Number
Deprecated:
  • 推荐使用geoBuilding.extrudeFactor
Author:
Example
geoBuilding.renderer.extrudeFactor = 2; //设置楼高度放大倍数

extrudeField :String

高度属性字段
Type:
  • String
Deprecated:
  • 推荐使用geoBuilding.extrudeField
Author:
Example
geoBuilding.renderer.extrudeField = 'height'; //设置楼的高度属性字段,该字段可在geoBuilding.userData中找到

glowStrength :Number

设置发光强度,前提是开启了effect
Type:
  • Number
Author:
  • zhuguang
Example
building.renderer.glowStrength = 1.0;

imageUrl :Array|String

贴图url 包括顶部的贴图和侧面的贴图 数组第一个代表顶部贴图,第二个代表侧面贴图 如果不区分顶部和侧面,数组中就只有一个元素
Type:
  • Array | String
Author:
Example
//设置楼顶部的贴图和侧面的贴图,第一个代表顶部贴图路径,第二个代表侧面的贴图路径
geoBuilding.renderer.type = 'image';//设置楼的渲染类型为image(贴图)
geoBuilding.renderer.imageUrl = ['./temp/image1.png','./temp/image1.png'];

metalness :Boolean

设置金属度,第一个为顶面金属度,第二个为侧面金属度
Type:
  • Boolean
Author:
  • zhuguang
Example
building.renderer.metalness = [0.8,0.2];

offset :Array

设置楼宇窗户平移,为x,y数组
Type:
  • Array
Author:
  • zhuguang
Example
geoBuilding.renderer.offset = [1.0,0.0];//窗户x方向平移1.0,y方向平移0.0

opacity :Number

填充色不透明度 仅在type为vector情况下生效
Type:
  • Number
Author:
Example
geoItem.renderer.opacity = 1; //将不透明度设置为1

repeat :Array

设置楼宇窗户重复度,为x,y数组
Type:
  • Array
Author:
  • zhuguang
Example
geoBuilding.renderer.repeat = [1.0,2.0];//窗户x方向复制1倍,y方向复制2倍

roughness :Boolean

设置金属度,第一个为顶面粗糙度,第二个为侧面粗糙度
Type:
  • Boolean
Author:
  • zhuguang
Example
building.renderer.roughness = [0.0,0.8];

textureWrap :String

设置贴图循环方式,CMAP.TextureWrapMode.Stretch 拉伸,CMAP.TextureWrapMode.RepeatY 高度方向平铺 CMAP.TextureWrapMode.Repeat 水平和高度方向均平铺
Type:
  • String
Author:
Example
geoBuilding.renderer.textureWrap = CMAP.TextureWrapMode.RepeatY;

type :String

设置楼宇材质类型 vector或image
Type:
  • String
Author:
Example
geoBuilding.renderer.type = 'image'; //设置楼的渲染类型为image(贴图) 设置该属性后需要设置imageUrl
geoBuilding.renderer.type = 'vector'; //设置楼的渲染类型为vector(纯色) 设置该属性后需要设置color

windowBrightness :Number

设置楼宇窗户亮度
Type:
  • Number
Author:
  • zhuguang
Example
geoBuilding.renderer.windowBrightness = 1.0;

windowColor :String

设置楼宇窗户颜色
Type:
  • String
Author:
  • zhuguang
Example
geoBuilding.renderer.windowColor = 'rgb(255,0,0)';

windowImageUrl :Array

设置楼宇窗户贴图
Type:
  • Array
Author:
  • zhuguang
Example
geoBuilding.renderer.windowImageUrl = 'http://';//窗户贴图