[英]Print task with client-side graphics and dynamic classbreakrenderer not working
[英]3D callout line doesn't work with client-side graphics
我正在努力将标注行与客户端图形一起使用。
我遵循了“城市的点样式”示例 ,该示例使用了来自“ LyonPointsOfInterest(FeatureServer)”的要素图层。
但是,它不适用于基于Web服务返回的数据来创建客户端图形的要素层。
3d标注行有限制吗?
这是我的代码段:
根据图层定义创建要素图层:
featureLayer = new FeatureLayer({ fields: this.layerDefinition.fields, objectIdField: this.layerDefinition.objectIdField, geometryType: this.layerDefinition.geometryType, id: this.layerId });
设置高程和特征缩减以及渲染器:
featureLayer.elevationInfo = { // elevation mode that will place points on top of the buildings or other SceneLayer 3D objects mode: "relative-to-scene" }; // feature reduction is set to selection because our scene contains too many points and they overlap featureLayer.featureReduction = { type: "selection" }; featureLayer.renderer = this._getUniqueValueRenderer() as any as Renderer// callout render
这里的渲染器代码:
_getUniqueValueRenderer() { let verticalOffset = { // verticalOffset shifts the symbol vertically screenLength: 150, // callout line length maxWorldLength: 200, minWorldLength: 35 }, uniqueValueRenderer = { type: "unique-value", // autocasts as new UniqueValueRenderer() field: "AQHI", uniqueValueInfos: [{ value: 1, symbol: this._get3DCallOutSymbol(verticalOffset, "Museum.png", "#D13470") }, { value: 2, symbol: this._get3DCallOutSymbol(verticalOffset, "Restaurant.png", "#F97C5A") }, { value: 3, symbol: this._get3DCallOutSymbol(verticalOffset, "Church.png", "#884614") }, { value: 4, symbol: this._get3DCallOutSymbol(verticalOffset, "Hotel.png", "#56B2D6") }, { value: 5, symbol: this._get3DCallOutSymbol(verticalOffset, "Park.png", "#40C2B4") }, { value: 6, symbol: this._get3DCallOutSymbol(verticalOffset, "Museum.png", "#D13470") }, { value: 7, symbol: this._get3DCallOutSymbol(verticalOffset, "beer.png", "#F97C5A") }, { value: 8, symbol: this._get3DCallOutSymbol(verticalOffset, "senate.png", "#884614") }, { value: 9, symbol: this._get3DCallOutSymbol(verticalOffset, "Hotel.png", "#56B2D6") }, { value: 10, symbol: this._get3DCallOutSymbol(verticalOffset, "Park.png", "#40C2B4") } ]}; return uniqueValueRenderer; } _get3DCallOutSymbol(verticalOffset: any, iconName: string, color: string) { return { type: "point-3d", // autocasts as new PointSymbol3D() symbolLayers: [{ type: "icon", // autocasts as new IconSymbol3DLayer() resource: { href: this.iconPath + iconName }, size: 20, outline: { color: "white", size: 2 } }], verticalOffset: verticalOffset, callout: { type: "line", // autocasts as new LineCallout3D() color: "white", size: 2, border: { color: color } } }; }
将源设置为基于Web服务数据生成的图形阵列
featureLayer.source = graphics;
您不应在新的FeatureLayer的实例中使用this.layerDefinition
,而应将其放在新的var中。 同上this.layerId
:
var layerDef = this.layerDefinition;
var lyrId = this.layerId;
featureLayer = new FeatureLayer({
fields: layerDef.fields,
objectIdField: layerDef.objectIdField,
geometryType: layerDef.geometryType,
id: lyrId
});
因为this.
在这个地方,在new Feature()
的范围内
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.