区块链技术博客
www.b2bchain.cn

cesium 图层构建的那些事 (十七)求职学习资料

本文介绍了cesium 图层构建的那些事 (十七)求职学习资料,有助于帮助完成毕业设计以及求职,是一篇很好的资料。

对技术面试,学习经验等有一些体会,在此分享。

根据基础聚合类,我们构建geojosn序列化的聚合使用类

首先是参数定义

interface ClassBreak {     minValue: number,     maxValue: number,     symbol: any } interface UniqueValue {     value: number,     symbol: any }  export interface PRenderer {     type: "simple"|"uniqueValue"|"classBreaks",     field?: string,//simple不需要该参数     symbol: any,     classBreakInfos?: Array<ClassBreak>,     uniqueValueInfos?:Array<UniqueValue> }

renderer设置
“`javascript

import {PRenderer} from “./PRenderer”;
import {ColorUtil} from “../utils/ColorUtil”;

export class Renderer {
type = “Renderer”;
private renderer: PRenderer;

constructor(renderer: PRenderer) {     this.renderer = renderer; }  /**  * 获得symbol  * @param attributes 属性  * @param {boolean} isEntity 是否是Entity解析  * @returns {any} symbol  */ public getSymbol(attributes: any, isEntity = false): any {     const {type, field, symbol, uniqueValueInfos, classBreakInfos} = this.renderer;     if (type === "simple") {         if (!symbol) {             throw  new Error("缺少属性symbol");         }         return symbol;     }     let value = attributes[field || ""];     if (isEntity) {         value = value?._value     }     if (type === "uniqueValue") {         if (!uniqueValueInfos) {             throw  new Error("缺少属性uniqueValueInfos");         }         for (const item of uniqueValueInfos) {             if (item.value == value) {                 return item.symbol;             }         }     }     if (type === "classBreaks") {         if (!classBreakInfos) {             throw  new Error("缺少属性classBreakInfos");         }         for (const item of classBreakInfos) {             if (value >= item.minValue && value < item.maxValue) {                 return item.symbol;             }         }     }     return symbol; }   public setEntitySymbol(entity: any, attributes: any) {     const symbol = this.getSymbol(attributes, true);     Renderer.setEntityProperties(entity, attributes, symbol); }   public static setEntityProperties(obj: any, attributes: any, properties: any) {     for (const key in properties) {         const value = properties[key];         if (Object.prototype.toString.call(value) == "[object Object]") {             if (value instanceof Cesium.Color) {                 obj[key] = value             } else if (value instanceof Cesium.LabelGraphics) {                 const v = value.clone();                 v.text = v.text._value.replace(/${(w+)+}/g, function (match, key) {                     return attributes[key]._value;                 });                 obj[key] = v

根据基础聚合类,我们构建geojosn序列化的聚合使用类

首先是参数定义

interface ClassBreak {     minValue: number,     maxValue: number,     symbol: any } interface UniqueValue {     value: number,     symbol: any }  export interface PRenderer {     type: "simple"|"uniqueValue"|"classBreaks",     field?: string,//simple不需要该参数     symbol: any,     classBreakInfos?: Array<ClassBreak>,     uniqueValueInfos?:Array<UniqueValue> }

renderer设置
“`javascript

import {PRenderer} from “./PRenderer”;
import {ColorUtil} from “../utils/ColorUtil”;

export class Renderer {
type = “Renderer”;
private renderer: PRenderer;

constructor(renderer: PRenderer) {     this.renderer = renderer; }  /**  * 获得symbol  * @param attributes 属性  * @param {boolean} isEntity 是否是Entity解析  * @returns {any} symbol  */ public getSymbol(attributes: any, isEntity = false): any {     const {type, field, symbol, uniqueValueInfos, classBreakInfos} = this.renderer;     if (type === "simple") {         if (!symbol) {             throw  new Error("缺少属性symbol");         }         return symbol;     }     let value = attributes[field || ""];     if (isEntity) {         value = value?._value     }     if (type === "uniqueValue") {         if (!uniqueValueInfos) {             throw  new Error("缺少属性uniqueValueInfos");         }         for (const item of uniqueValueInfos) {             if (item.value == value) {                 return item.symbol;             }         }     }     if (type === "classBreaks") {         if (!classBreakInfos) {             throw  new Error("缺少属性classBreakInfos");         }         for (const item of classBreakInfos) {             if (value >= item.minValue && value < item.maxValue) {                 return item.symbol;             }         }     }     return symbol; }   public setEntitySymbol(entity: any, attributes: any) {     const symbol = this.getSymbol(attributes, true);     Renderer.setEntityProperties(entity, attributes, symbol); }   public static setEntityProperties(obj: any, attributes: any, properties: any) {     for (const key in properties) {         const value = properties[key];         if (Object.prototype.toString.call(value) == "[object Object]") {             if (value instanceof Cesium.Color) {                 obj[key] = value             } else if (value instanceof Cesium.LabelGraphics) {                 const v = value.clone();                 v.text = v.text._value.replace(/${(w+)+}/g, function (match, key) {                     return attributes[key]._value;                 });                 obj[key] = v

根据基础聚合类,我们构建geojosn序列化的聚合使用类

首先是参数定义

interface ClassBreak {     minValue: number,     maxValue: number,     symbol: any } interface UniqueValue {     value: number,     symbol: any }  export interface PRenderer {     type: "simple"|"uniqueValue"|"classBreaks",     field?: string,//simple不需要该参数     symbol: any,     classBreakInfos?: Array<ClassBreak>,     uniqueValueInfos?:Array<UniqueValue> }

renderer设置
“`javascript

import {PRenderer} from “./PRenderer”;
import {ColorUtil} from “../utils/ColorUtil”;

export class Renderer {
type = “Renderer”;
private renderer: PRenderer;

constructor(renderer: PRenderer) {     this.renderer = renderer; }  /**  * 获得symbol  * @param attributes 属性  * @param {boolean} isEntity 是否是Entity解析  * @returns {any} symbol  */ public getSymbol(attributes: any, isEntity = false): any {     const {type, field, symbol, uniqueValueInfos, classBreakInfos} = this.renderer;     if (type === "simple") {         if (!symbol) {             throw  new Error("缺少属性symbol");         }         return symbol;     }     let value = attributes[field || ""];     if (isEntity) {         value = value?._value     }     if (type === "uniqueValue") {         if (!uniqueValueInfos) {             throw  new Error("缺少属性uniqueValueInfos");         }         for (const item of uniqueValueInfos) {             if (item.value == value) {                 return item.symbol;             }         }     }     if (type === "classBreaks") {         if (!classBreakInfos) {             throw  new Error("缺少属性classBreakInfos");         }         for (const item of classBreakInfos) {             if (value >= item.minValue && value < item.maxValue) {                 return item.symbol;             }         }     }     return symbol; }   public setEntitySymbol(entity: any, attributes: any) {     const symbol = this.getSymbol(attributes, true);     Renderer.setEntityProperties(entity, attributes, symbol); }   public static setEntityProperties(obj: any, attributes: any, properties: any) {     for (const key in properties) {         const value = properties[key];         if (Object.prototype.toString.call(value) == "[object Object]") {             if (value instanceof Cesium.Color) {                 obj[key] = value             } else if (value instanceof Cesium.LabelGraphics) {                 const v = value.clone();                 v.text = v.text._value.replace(/${(w+)+}/g, function (match, key) {                     return attributes[key]._value;                 });                 obj[key] = v

部分转自互联网,侵权删除联系

赞(0) 打赏
部分文章转自网络,侵权联系删除b2bchain区块链学习技术社区 » cesium 图层构建的那些事 (十七)求职学习资料
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

b2b链

联系我们联系我们