ArcGIS API for JavaScript开发之必学渲染方式及渲染符号概念(0)

一.渲染方式

1.1简单渲染

点:

"rendererType": "simple",               // 渲染类型
"rendererInfo": {                       // 具体的渲染信息
    "type": "simple",                   // 渲染类型
    "symbol": {                         // 具体样式
        "type": "esriPMS",              // 样式类型-点位图片
        "url": "widgets/LayerManager/LayerList/data/350400/img/jcdm/label/qsk.png", // 图片路径
        "contentType": "image/png",     // 数据类型
        "width": 20,                    // 图片的宽度
        "height": 22,                   // 图片的高度
        "angle": 0,                     // 旋转角度
        "xoffset": 0,                   // x轴偏移(+:向右)
        "yoffset": 0,                   // y轴偏移 (+:向上)
    }
}

线

"rendererType": "simple",                // 渲染类型,此处为simple(简单渲染)
"rendererInfo":{                         // 渲染信息
    "type": "simple",                    // 渲染类型
    "symbol": {                          // 渲染符号
        "type": "esriSLS",               // 线类型,此处为esriSLS(简单线样式)
        "style": "esriSLSSolid",         // 线型,此处为esriSLSSolid,可选的有esriSLSNull(不显示边线)、esriSLSSolid(显示边线)、esriSLSDash(横线)、esriSLSDashDot(横线和点线) esriSLSDashDotDot(横线和两点线)、esriSLSDot(点线)、
                                                          esriSLSLongDash(长横线)、esriSLSLongDashDot(长横线和点线)、 esriSLSShortDash(短横线)、 esriSLSShortDot(短点线)、esriSLSShortDashDot(短横线和点线)、 esriSLSShortDashDotDot(短横线和两点线)                  
        "color": [115,76,0,255],         // 线颜色
        "width": 1                       // 线宽度
   } 
}

"rendererType": "simple",                // 渲染类型,此处为simple(简单渲染)
"rendererInfo":{                         // 渲染信息
    "type": "simple",                    // 渲染类型
    "symbol": {                          // 渲染符号
        "type": "esriSFS",               // 填充类型,此处是esriSFS (简单面样式),面常用的的符号类型有esriSFS (简单面样式)、esriPFS(图片面样式)
        "style": "esriSFSSolid",         // 填充样式,此处为esriSFSSolid,常用的有esriSFSNull(不显示)和esriSFSSolid(显示)、esriSFSBackwardDiagonal(后对角线填充)、esriSFSCross(十字架填充)、
                                         // esriSFSDiagonalCross(对角线填充)、esriSFSForwardDiagonal(前对角线填充)、esriSFSHorizontal(水平整体对角线填充)、esriSFSVertical(垂直整体对角线填充)
        "color": [115,76,0,255],         // 填充颜色
        "outline": {                     // 边线样式信息,同线图层simple(简单渲染)的symbol
            "type": "esriSLS",           // 边线类型
            "style": "esriSLSSolid",     // 边线线型
            "color": [110,110,110,255],  // 边线颜色
            "width": 1                   // 边线宽度
        }
   } 
}

1.2唯一值渲染

点:

"rendererType": "uniqueValue",           // 渲染类型:uniqueValue(唯一值渲染) 
"rendererInfo": {                        // 渲染信息
    "type": "uniqueValue",// 渲染类型
    "field1": "codeWaterQualityLevel",   // 渲染字段(采用多字段进行唯一值渲染,可添加字段"field2""field3")
    "fieldDelimiter": ", ",              // 多字段的字段分割符(注意分隔符中的空格)
    "defaultSymbol": {                   // 默认样式
       "type": "esriPMS",                // 样式类型
       "url": "widgets/LayerManager/LayerList/data/350400/img/jcdm/assessLevels/gkao/gk_7.png", // 图片地址
          "contentType": "image/png",    // 内容类型
          "width": 27,                   // 宽度
          "height": 31,                  // 高度
          "angle": 0,                    // 旋转角度
          "xoffset": 0,                  // x轴偏移(+:向右)
          "yoffset": 0,                  // y轴偏移 (+:向上)

    },
    "uniqueValueInfos": [{               
       "value": "1",                     // 渲染字段的唯一值
       "symbol": {                       // 图形样式
          "type": "esriPMS",             // esriSMS esriSLS esriSFS esriPMS esriPFS esriTS
          "url": "widgets/LayerManager/LayerList/data/350400/img/jcdm/assessLevels/gkao/{1}.png", // 样式的图片路径
          "contentType": "image/png",    // 内容类型
          "width": 27,                   // 宽度
          "height": 31                   // 高度
          "angle": 0,                    // 旋转角度
          "xoffset": 0,                  // x轴偏移(+:向右)
          "yoffset": 0,                  // y轴偏移 (+:向上)
         }
       }
     ]
 }

线

"rendererType" : "uniqueValue",          // 渲染类型,此处为uniqueValue(唯一值渲染)
"rendererInfo":{                         // 渲染信息
    "type" : "uniqueValue",              // 渲染类型
    "field1": "waterCode",               // 渲染字段,即根据哪个字段的值渲染(采用多字段进行唯一值渲染,可添加字段"field2""field3")
    "fieldDelimiter": ", ",              // 多字段的字段分割符(注意分隔符中的空格)
    "defaultSymbol":{                    // 默认渲染符号,同simple(简单渲染)的symbol
        "type": "esriSLS",        
        "style": "esriSLSSolid",          
        "color": [115,76,0,255],
        "width": 1
    },
    // 唯一值渲染信息(渲染字段的唯一值与对应的渲染符号)
    "uniqueValueInfos" :[                //唯一值渲染的信息,为一个数组,这里以一个元素为例
        {                    
            "value": "{0}",              // 渲染字段的唯一值
            "symbol": {                  // 对应的渲染符号,同simple(简单渲染)的symbol
                "type": "esriSLS",        
                "style": "esriSLSSolid",          
                "color": [115,76,0,255],
                "width": 1
            }
        }
    ]
}

"rendererType" : "uniqueValue",          // 渲染类型,此处为uniqueValue(唯一值渲染)
"rendererInfo":{                         // 渲染信息
    "type" : "uniqueValue",              // 渲染类型
    "field1": "waterCode",               // 渲染字段,即根据哪个字段的值渲染(采用多字段进行唯一值渲染,可添加字段"field2""field3")
    "fieldDelimiter": ", ",              // 多字段的字段分割符(注意分隔符中的空格)
    "defaultSymbol":{                    // 默认渲染符号,同simple(简单渲染)的symbol
        "type": "esriSFS",               
        "style": "esriSFSSolid",         // 填充样式,此处为esriSFSSolid,常用的有esriSFSNull(不显示)和esriSFSSolid(显示)、esriSFSBackwardDiagonal(后对角线填充)、esriSFSCross(十字架填充)、
                                         // esriSFSDiagonalCross(对角线填充)、esriSFSForwardDiagonal(前对角线填充)、esriSFSHorizontal(水平整体对角线填充)、esriSFSVertical(垂直整体对角线填充)
        "color": [115,76,0,255],         // 填充颜色  
        "outline": {                     // 边线样式 
            "type": "esriSLS",           // 边线类型
            "style": "esriSLSSolid",     // 边线线型
            "color": [110,110,110,255],  // 边线颜色 
            "width": 1                   // 边线宽度
        }
    },
    // 唯一值渲染信息(渲染字段的唯一值与对应的渲染符号)
    "uniqueValueInfos" :[                // 唯一值渲染的信息,为一个数组,这里以一个元素为例
        {                    
            "value": "1",                // 渲染字段的唯一值
            "symbol": {                  // 对应的渲染符号,同simple(简单渲染)的symbol
                "type": "esriSFS",           
                "style": "esriSFSSolid", 
                "color": [115,76,0,255], 
                "outline": {             
                    "type": "esriSLS",               
                    "style": "esriSLSSolid",       
                    "color": [110,110,110,255],    
                    "width": 1                     
                }
            }
        }
    ]
}

1.3分级渲染

"rendererType": "classBreaks",           // 渲染类型:classBreaks
"rendererInfo": {                        // 渲染信息
   "type": "classBreaks",
   "field": "BottomElev",                // 渲染字段
   "defaultSymbol": {                    // 默认样式
       "type": "esriPMS",                // 样式类型
       "url": "widgets/LayerManager/LayerList/data/350400/img/jcdm/assessLevels/gkao/gk_7.png", // 图片地址
       "contentType": "image/png",       // 内容类型
       "width": 27,                      // 宽度
       "height": 31,                     // 高度
       "angle": 0,                       // 旋转角度
       "xoffset": 0,                     // x轴偏移(+:向右)
       "yoffset": 0,                     // y轴偏移 (+:向上)

    },
   "classBreakInfos": [
      {
         "classMinValve": 0,             // 该分级范围的最小值
         "classMaxValue": 20,            // 该分级级别的最大值
         "description": "",              // 该级别的描述
         "label": "10-20",               // 表示值的范围的标签
         "symbol":{                      // 样式
             "type": "esriPMS",          // 样式类型
             "url": "widgets/LayerManager/LayerList/data/350400/img/jcdm/assessLevels/gkao/gk_7.png", // 图片地址
             "contentType": "image/png", // 内容类型
             "width": 27,                // 宽度
             "height": 31,               // 高度
             "angle": 0,                 // 旋转角度
             "xoffset": 0,               // x轴偏移(+:向右)
             "yoffset": 0,               // y轴偏移 (+:向上)

        }                     
      }
   ]
}

线:

"rendererType":"classBreaks",            // 渲染类型,此处为classBreaks(分级渲染)
"rendererInfo":{                         // 渲染信息
    "type" : "classBreaks",          // 渲染类型
    "field":"BottomElev",            // 分级渲染的字段
    "defaultSymbol" :{               // 默认渲染符号,同simple(简单渲染)的symbol
        "type": "esriSLS",        
        "style": "esriSLSSolid",          
        "color": [115,76,0,255],
        "width": 1
    } ,
    "classBreakInfos":[              //分级渲染的信息,为一个数组,这里以一个元素为例
        {
            "classMinValve": 0,      // 该分级范围的最小值
            "classMaxValue": 20,     // 该分级范围的最大值
            "description": "0 to 20",// 该级别的描述,如"0 to 20"
            "label": "0.0-20.0",     // 表示值的范围的标签,如"0.0 - 20.0"
            "symbol": {              // 该分级的渲染符号,同simple(简单渲染)的symbol
                "type": "esriSLS",        
                "style": "esriSLSSolid",          
                "color": [115,76,0,255],
                "width": 1
            }            
        }
    ]
}

 面:

"rendererType":"classBreaks",            // 渲染类型,此处为classBreaks(分级渲染)
"rendererInfo":{                         // 渲染信息
    "type" : "classBreaks",              // 渲染类型
    "field":"BottomElev",                // 分级渲染的字段
    "defaultSymbol" :{                   // 默认渲染符号,同simple(简单渲染)的symbol
        "type": "esriSFS",           
        "style": "esriSFSSolid",     
        "color": [115,76,0,255],     
        "outline": {                 
            "type": "esriSLS",             
            "style": "esriSLSSolid",       
            "color": [110,110,110,255],    
            "width": 1                     
        }
    },
    "classBreakInfos":[                  //分级渲染的信息,为一个数组,这里以一个元素为例
         {
            "classMinValve": 0,          // 该分级范围的最小值
            "classMaxValue": 20,         // 该分级范围的最大值
            "description": "0 to 20",    // 该级别的描述,如"0 to 20"
            "label": "0.0-20.0",         // 表示值的范围的标签,如"0.0 - 20.0"
            "symbol": {                  // 该分级的渲染符号,同simple(简单渲染)的symbol
                "type": "esriSFS",           
                "style": "esriSFSSolid",     
                "color": [115,76,0,255],     
                "outline": {                 
                    "type": "esriSLS",             
                    "style": "esriSLSSolid",       
                    "color": [110,110,110,255],    
                    "width": 1                     
                }
            }            
        }
    ]
}

1.4多字段

{
	"multiFieldsRenderer": { // 图层多字段渲染配置
		"type": "radio",
		"active": "ORDERNO", // 图层有多字段时,默认使用那个配置
		"data": [{ // 存放多字段配置的节点
				"value": "ORDERNO", // 配置根据哪个字段来进行渲染
				"label": "ORDERNO", // 配置图层列表中显示该字段的标注
				"renderer": { // 具体的渲染信息,详细参见单字段中,点线面的渲染方式
					"rendererType": "simple",
					"rendererInfo": {
						"type": "simple",
						"symbol": {
							"type": "esriPMS",
							"url": "../icons/svgs/工业.svg",
							"width": 22,
							"height": 22,
							"angle": 0,
							"xoffset": 0,
							"yoffset": 0
						}
					}
				}
			},
			{
				"value": "CODE_REGION",
				"label": "CODE_REGION",
				"renderer": {
					"rendererType": "uniqueValue",
					"rendererInfo": {
						"type": "uniqueValue",
						"defaultSymbol": {
							"type": "esriPMS",
							"url": "../icons/svgs/产废规模无数据.svg",
							"width": 22,
							"height": 22,
							"angle": 0,
							"xoffset": 0,
							"yoffset": 0
						},
						"uniqueValueInfos": [{
								"symbol": {
									"type": "esriPMS",
									"url": "../icons/svgs/产废规模1.svg",
									"contentType": "image/png",
									"width": 22,
									"height": 22,
									"angle": 0,
									"xoffset": 0,
									"yoffset": 0
								},
								"value": "2324A"
							},
							{
								"symbol": {
									"type": "esriPMS",
									"url": "../icons/svgs/产废规模2.svg",
									"contentType": "image/png",
									"width": 22,
									"height": 22,
									"angle": 0,
									"xoffset": 0,
									"yoffset": 0
								},
								"value": "2325A"
							},
							{
								"symbol": {
									"type": "esriPMS",
									"url": "../icons/svgs/产废规模3.svg",
									"contentType": "image/png",
									"width": 22,
									"height": 22,
									"angle": 0,
									"xoffset": 0,
									"yoffset": 0
								},
								"value": "2326A"
							},
							{
								"symbol": {
									"type": "esriPMS",
									"url": "../icons/svgs/产废规模4.svg",
									"contentType": "image/png",
									"width": 22,
									"height": 22,
									"angle": 0,
									"xoffset": 0,
									"yoffset": 0
								},
								"value": "2327A"
							}
						]
					}
				}
			}
		]
	}
}

1.5多级别

{
	"multiLevelRenderer": {
		"active": "ORDERNO",    //默认用那个渲染
		"renderers": [{
				"value": "ORDERNO",
				"maxLevel": 6,        //最大级别
				"renderer": {
					"rendererType": "simple",
					"rendererInfo": {
						"type": "simple",
						"symbol": {
							"type": "esriSMS",
							"style": "esriSMSSquare",
							"color": [
								76,
								115,
								0,
								255
							],
							"size": 50,
							"angle": 0,
							"xoffset": 0,
							"yoffset": 0,
							"outline": {
								"color": [
									152,
									230,
									0,
									255
								],
								"width": 1
							},
							"scaleByDistance": {   // 三维中配置,设置图标比例线性变化
								"near": 500000,
								"nearValue": 1,
								"far": 2000000,
								"farValue": 0.17
							}
						}
					}
				}
			},
			{
				"value": "ORDERNO1",
				"minLevel": 6,
				"maxLevel": 10,
				"renderer": {
					"rendererType": "simple",
					"rendererInfo": {
						"type": "simple",
						"symbol": {
							"type": "esriPMS",
							"url": "http://10.100.245.102:8089/gis_framework/icons/PC-水/icon_黑臭水体80px.png",
							"width": 24,
							"height": 24,
							"angle": 0,
							"xoffset": 0,
							"yoffset": 0
						}
					}
				}
			}
		]
	}
}

二基本图层信息(渲染的几何类型)

geometryType //几何类型

      "geometryType": "point"/"esriGeometryPoint", 点

      "geometryType": "line"/"esriGeometryPolyline", 线

      "geometryType": "polygon"/"esriGeometryPolygon",//几何类型,此处为面

三渲染符号symbol

symbol: {//可选,默认渲染符号,即不在渲染区间的值使用此符号
    "color": [239, 244, 244],//必选,符号颜色,及填充颜色
    "outline": {//可选,符号边线设置,及边框设置
        "color": [255,255, 255],//必选,边线颜色
         "width": 1,//必选,边线宽度
          "type": "esriSLS"
//        "style": "esriSLSNull"//可选,边线样式,当前设置时不显示边线,默认为:esriSFSSolid,显示边线
},
"type": "esriSFS",//必选,符号类型,此处是指面符号,点符号为:"esriSMS",线符号:esriSLS
 "style": "esriSFSSolid"//必选,填充样式,不填充esriSFSNull
},
"infoTemplate": {  //点击该面显示的信息窗口内容
"title": "面信息",
 }

  "style": "esriSFSSolid",         // 填充样式,此处为esriSFSSolid,常用的有esriSFSNull(不显示)和esriSFSSolid(显示)、esriSFSBackwardDiagonal(后对角线填充)、esriSFSCross(十字架填充)、 // esriSFSDiagonalCross(对角线填充)、esriSFSForwardDiagonal(前对角线填充)、esriSFSHorizontal(水平整体对角线填充)、esriSFSVertical(垂直整体对角线填充)

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值