arcgis for js学习之Graphic类

    <title>Graphic类</title>
<meta charset="utf-8" />
<!-- 说明:Graphic类
一个graphic类包括四个基本的参数:一个geometer,一个symbol,attribute和infoTemplate.
Grpaphic只能显示在GraphicsLayer对象中,即在GraphicLayer上监听Graphic对象。
两种实例化的方式:
new Graphic(geometry,symbol,attributes,infoTemplate)
new Grpahic(json)
-->
<!-- data 属性:
data-class-break:
data-geometry-type:几何类型:point,polyline,polygon ,multipoint
data-hidden:添加到图形中的节点时隐藏
data-selected:添加到图形中的节点被选中
-->
<!-- 属性:
attributes:属性字段值
geometry:定义一个几何图形
infoTemplate:infoWindow中显示的内容
symbol:图形的样式
visible:图形的可见性
-->
<!-- 方法:
attr(name,value):修改属性值
draw():绘制图形
getContent():返回内容的值
getDojoShape():
getInfoTemplate():返回信息模板
getLayer():返回一个图层的
getNode():返回节点用于绘制图层
getNodes():返回多个节点
getShape():返回一个esri图形
getShapes():。。。。
getATitle():获取标题
hide():隐藏图形
setAttributes(attributes):定义图形的属性
setGeometry(geometry):定义几何图形
setInfoTemplate(infoTempate):定义一个infoWindow
setSymbol(symbol):设置图形的象征
show():显示图形
toJson():将对象转换为json标的是的gis服务器
-->
<script>
//实例一:最基本的图形
require([
"esri/geometry/Point", "esri/symbols/SimpleMarkerSymbol",
"esri/Color", "esri/InfoTemplate", "esri/graphic"
], function (Point, SimpleMarkerSymbol, Color, InfoTemplate, Graphic) {
var pt = new Point(xloc, yloc, map.spatialReference);
var sms = new SimpleMarkerSymbol().setStyle(SimpleMarkerSymbol.STYLE_SQUARE).setColor(new Color([225, 0, 0, 0.5]));
var attr = {
"Xcoord": evt.mapPoint.x,
"Ycoord": evt.mapPoint.y,
"Plant": "Mesa Mint"
};
var infoTemplate = new InfoTemplate("");
var graphic = new Graphic(pt, sms, attr, infoTemplate);
});
//实例二:创建一个线图形
require([
"esri/graphic"
], function (Graphic) {
var myLine = {
geometry: {
"path": [[[111, 222], [222, 333]]],
"spatialReference": { "wkid": 4326 }
},
"symbol": {
"color": [0, 0, 0, 255],
"width": 1,
"type": "esriSLS",
"style": "esriSLSSolid"
}
};
var gra = new Graphic(myLine);
});
//实例三:创建一个面图层
require([
"esri/graphic"
], function (Graphic) {
var myPolygon = {
"geometry": {
"rings": [[[222, 333], [333, 222], [334, 666]]],
"spatialReference": { "wkid": 4326 }
},
"symbol": {
"color": [0, 0, 0, 64],
"outline": {
"outline": [0, 0, 0, 255],
"width": 1,
"type": "esriSLS",
"style": "esriSFSSolid"
}
}
};
var gra = new Graphic(myPolygon);
});
//实例四:创建多个点
require([
"esri/graphic"
], function (Graphic) {
var myPoint = {
"geometry": {
"x": 333,
"y": 222,
"spatialReference": { "wkid": 4326 }
},
"attributes": {
"Xcoord": 222.222,
"Ycoord": 333.333,
"Plant": "Mesa Mint"
},
"symbol": {
"color": [222, 0, 0, 222],
"size": 12,
"angle": 0,
"xoffest": 0,
"yoffest": 0,
"type": "esriSMS",
"style": "esriSMSSquare",
"outline": {
"color": [0, 0, 0, 233],
"width": 1,
"type": "esriSLS",
"type": "esriSLSSOlid"
}
},
"infoTemplate": {
"title": "sssss",
"content": "latude:${Field}"
}
};
var gra = new Graphic(myPoint);
})
</script>

arcgis for js学习之Graphic类的更多相关文章

  1. arcgis for js学习之Draw类

    arcgis for js学习之Draw类 <!DOCTYPE html> <html> <head> <meta http-equiv="Cont ...

  2. js学习(五)-全局函数和类内部函数区别

    //---------------------------js代码--------------------------- function User(){       //类成员的定义及构造函数 th ...

  3. Arcgis for Js之加载wms服务

    概述:本节讲述Arcgis for Js加载ArcgisServer和GeoServer发布的wms服务. 1.定义resourceInfo var resourceInfo = { extent: ...

  4. Arcgis for Js之鼠标经过显示对象名的实现

    在浏览地图时,移动鼠标经过某个对象或者POI的时候,能够提示该对象的名称对用户来说是很实用的,本文讲述在Arcgis for Js中,用两种不同的方式来实现该效果. 为了有个直观的概念,先给大家看看实 ...

  5. js学习之变量、作用域和内存问题

    js学习之变量.作用域和内存问题 标签(空格分隔): javascript 变量 1.基本类型和引用类型: 基本类型值:Undefined, Null, Boolean, Number, String ...

  6. 【Knockout.js 学习体验之旅】(2)花式捆绑

    本文是[Knockout.js 学习体验之旅]系列文章的第2篇,所有demo均基于目前knockout.js的最新版本(3.4.0).小茄才识有限,文中若有不当之处,还望大家指出. 目录: [Knoc ...

  7. 【Knockout.js 学习体验之旅】(1)ko初体验

    前言 什么,你现在还在看knockout.js?这货都已经落后主流一千年了!赶紧去学Angular.React啊,再不赶紧的话,他们也要变out了哦.身旁的90后小伙伴,嘴里还塞着山东的狗不理大蒜包, ...

  8. Backbone.js学习之一

    昨天一个我崇拜的朋友,徐飞送我一本名为<Backbone.js实战>书,让我心中狂喜,于是带着这份浓厚的兴趣,开始研究Backbone.js之路. 打开这本书的第一句话就很有哲理,“授人以 ...

  9. Arcgis for JS之Cluster聚类分析的实现(基于区域范围的)

    原文:Arcgis for JS之Cluster聚类分析的实现(基于区域范围的) 咱们书接上文,在上文,实现了基于距离的空间聚类的算法实现,在本文,将继续介绍空间聚类之基于区域范围的实现方式,好了,闲 ...

随机推荐

  1. 记录k8s:k8s1.8.4无坑离线安装

    安装部署: 1. 使用vagrant 准备3太虚拟机,自己使用Vbox 准备3太也可以. 2. 按照 https://github.com/gjmzj/kubeasz 安装. 3. 使用letsenc ...

  2. Springboot Selenide UI 自动化测试

    标题中的Selenide 并没有拼错,确实不是selenium Selenium做UI自动化,可以参考我其他的blog: Selenium做自动化最好要封装起来,否则对于元素的等待,页面的加载会使得自 ...

  3. TCP与UDP区别总结

    TCP与UDP区别总结:1.TCP面向连接(如打电话要先拨号建立连接);UDP是无连接的,即发送数据之前不需要建立连接2.TCP提供可靠的服务.也就是说,通过TCP连接传送的数据,无差错,不丢失,不重 ...

  4. S-CMS企业建站v3几处SQL注入

    0x01 前言 有段时间没有发文章了,主要没挖到比较有意思的漏洞点.然后看最近爆了很多关于S-CMS的漏洞,下载了源码简单挖了一下然后给大家分享一下. 0x02 目录 Wap_index.php sq ...

  5. 阿里面试题,深入理解Java类加载机制

    类的生命周期 包括以下 7 个阶段: 加载(Loading) 验证(Verification) 准备(Preparation) 解析(Resolution) 初始化(Initialization) 使 ...

  6. 吴恩达机器学习笔记54-开发与评价一个异常检测系统及其与监督学习的对比(Developing and Evaluating an Anomaly Detection System and the Comparison to Supervised Learning)

    一.开发与评价一个异常检测系统 异常检测算法是一个非监督学习算法,意味着我们无法根据结果变量

  7. [Swift]LeetCode219. 存在重复元素 II | Contains Duplicate II

    Given an array of integers and an integer k, find out whether there are two distinct indices i and j ...

  8. [Swift]LeetCode668. 乘法表中第k小的数 | Kth Smallest Number in Multiplication Table

    Nearly every one have used the Multiplication Table. But could you find out the k-th smallest number ...

  9. 浏览器与服务端请求响应流程与HTTP协议

    浏览器与服务端请求响应流程图: 1.HTTP概要 1.1. 定义 HTTP(HyperText Transfer  Protocol,超文本传输协议)最早就是计算机与计算机之间沟通的一种标准协议,这种 ...

  10. BBS论坛(三)

    3.1.cms用户名渲染和注销功能实现 显示登录的用户名 (1)app/cms/hooks.py from .views import bp import config from flask impo ...