ArcGIS Server 开发实践之【Search类】
- 开发中整理的。不足之处还请谅解!
- -----------------------------------------------
- Class:Search
- 调用方式:require(["esri/dijit/Search",function(Search){......}]);
- /*描述:搜索小工具提供一种基于位置服务和地图、要素服务图层的搜索。这些指定的数据源在搜索框中搜索的内容。
- 如果用定位或地理服务时使用 findAddressCandidates方法。
- 搜索工具类似地理编辑工具。主要的不同时搜索工具提供附加的允许搜索和建议多种数据的功能。
- 注意:当使用一个空间参考的地图或其他的web墨卡托或者地理,要确保建立一个默认集合服务。
- 这将确保用户的位置返回相同的空间参考地图。*/
- ----------------------
- requrie(["esri/config"],function(esriConfig){
- esriConfig.defaults.geometryService="http://www.example.com/arcgis/rest/services/Utilities/Geometry/GeometryServer";
- });
- ----------------------
- 构造函数:
- new Search(options,srcNode) //使用给定DOM节点新建一个搜索工具
- ---------------------------------------
- CSS
- Name 描述
- active 类用于描述的风格活跃的“搜索”按钮,生成的菜单项。
- arcgisSearch 代表节点搜索的实例小部件呈现。这是默认主题独特风格的小部件。
- hasButtonMode 类指示是否显示模式按钮
- hasMultipleSources 类指示是否正在使用多个来源
- menuHeader 类用于样式标题搜索结果的顶部菜单。
- moreResults 类用于指示是否显示额外的结果在生成的搜索弹出。
- noResultsBody Class used to style the body of how "No results" is displayed.类用于样式的身体如何显示“没有结果”。
- noResultsHeader Class used to style the header of how "No results" displays.类用于样式的标题显示“没有结果”。
- noResultsMenu Class used to style the menu if there are "No results".类用于样式菜单如果有“没有结果”。
- noResultsText The class used to style the "No results" text.类用于风格“没有结果”文本。
- noValueIcon This class is used used if wanting to display a warning icon when no value is entered into the search box.使用这个类使用时如果想显示一个警告图标没有值输入到搜索框。
- noValueText Class used to style the resulting dialog when no value is entered in the search box.类用于样式结果对话框时不搜索框中输入的值。
- popupHeader Class used to style the popupHeader in the search popup's "More results".
- resultsList Class used to style the popup's search results list.
- searchAnimate Class used to style how the search animation displays.
- searchBtn Class used to style the Search button.
- searchButtonText The class used to style how the "Search" button displays its text.
- searchClear The class used to style the "Clear search" (x) area of the widget.
- searchClearFloat Used to clear floats in the Search widget.
- searchClearIcon | esriIconCancel Class used to style the clear icon.
- searchCollapsed Class used to indicate whether the search is collapsed.
- searchExpandContainer Containing class for when the widget is expanded.
- searchExpanded Class used to indicate whether the search is expanded.
- searchGroup Class used to style the elements used for the input text and search.
- searchIcon | esriIconZoom Class used to style the search icon.
- .arcgisSearch .searchIcon {
- color:orange;
- font-size:20px;
- }
- searchInput Class used to style the search input box.
- searchInputGroup Class used to style the grouping of input elements.
- searchLoading Class used to indicate that the search is loading.
- searchMenu Class used to style the resulting search results menu.
- searchSubmit Class used to style the Search's submit button when collapsed.
- searchToggle Class used to style how the toggle button displays.
- searchToggleIcon | esriIconDownDir Class used to style the toggle icon.
- .arcgisSearch .esriIconDownDir{
- color: #ccc;
- }
- showMoreResults Class used to indicate if showing more results in the search result popup.
- showNoResults Class indicating whether to display "No results".
- showSources Class indicating whether to display sources.
- showSuggestions Class indicating whether to show suggestions for text input.
- sourceName Class used to style how the source name is displayed.
- sourcesMenu Class used to style the drop-down menu listing all available sources.
- suggestionsMenu Class used to style the drop-down menu for suggestions.
- --------------------------------------------------------------------------------------------------------------------------
- 属性
- name type Summary
- activeSourse object 只读属性的当前选中的源对象
- activeSourseIndex Number 当前选择的来源
- addLayersFromMap Boolean 指示是否自动添加层从地图上的所有功能。
- allPlaceholder String 这个默认的值用来在搜索多个值时提示输入文本信息
- autoNavigate Boolean 指示是否自动导航到所选择的结果。
- autoSelect Boolean Indicates whether to automatically select the first geocoded result.
- defaultSource Object (Read-only), the default source used for the Search widget.
- enableButtonMode Boolean Indicates whether to enable an option to collapse/expand the search into a button.
- enableHighlight Boolean Show the selected feature on the map using a default symbol determined by the source's geometry type.
- enableInfoWindow Boolean Indicates whether to display the infoWindow on feature click.
- enableLabel Boolean Indicates whether to enable showing a label for the geometry.
- enableSearchingAll Boolean Indicates whether to display the option to search "All" sources.
- enableSourcesMenu Boolean Indicates whether to enable the menu for selecting different sources.
- enableSuggestions Boolean Enable suggestions for the widget.
- enableSuggestionsMenu Boolean Indicates whether to display suggest results.
- expanded Boolean Indicates whether to set the state of the enableButtonMode to expanded (true) or collapsed (false).
- graphicsLayer Layer This is the specified graphicsLayer to use for the highlightGraphic and labelGraphic instead of map.graphics.
- highlightGraphic Graphic Read-only property indicating the highlighted location graphic.
- infoTemplate InfoTemplate A customized infoTemplate for the selected feature.
- labelGraphic Graphic Read-only graphic property for the text label.
- labelSymbol TextSymbol The text symbol for the label graphic.
- loaded Boolean Read-only property indicating whether the widget is loaded.
- locationToAddressDistance Number The default distance specified in meters used to reverse geocode (if not specified by source).
- map Map Reference to the map.
- maxResults Number The default maximum number of results returned by the widget if not specified by source.
- maxSuggestions Number The default maximum number of suggestions returned by the widget if not specified by source.
- minCharacters Number The default minimum number of characters needed for the search if not specified by source.
- searchResults Object[] Read-only property that returns an array of current results from the search.
- showInfoWindowOnSelect Boolean Indicates whether to show the infoWindow when a result is selected.
- sources Object[] An array of source objects used to find search results.
- suggestResults Object[] Read-only property that returns an array of current results from the suggest.
- suggestionDelay Number The millisecond delay after keyup and before making a suggest network request.
- theme String The CSS class selector used to uniquely style the widget.
- value String The current value of the search box input text string.
- visible Boolean Indicate whether to show the widget.
- zoomScale Number If the result does not have an associated extent, specify this number to use as the zoom scale for the result.
- ---------------------------------------------------------------------
- ------------------------------------------------------------------------
- 方法:
- Name 返回类型 简述
- blur() None 滑动块工具的文本输入
- clear() None 清除当前的值,搜索结果,显示结果,几何图形或者几何图层
- collaspe() None 从按钮模式关闭小部件
- destory() None 清除搜索小部件
- expand() None 从按钮模式打开小部件
- get(name) Object|B 从搜索小部件获取属性的值。
- hide() None 隐藏搜索部件
- search(value?) Promise 根据指定的来源,search()查询功能层(s)和/或执行地址匹配使用Locator(s),并返回指定任何任何适用的结果。
- select(value) None 选择一个结果
- set(name,value) None 设置一个非只读属性值的部件
- show() 显示部件
- startup() 结束搜索的小部件
- suggest(value?) Promise 执行一个活动定位器上的suggest()请求或功能层。
- ===================================================================
- 事件
- blur Fired when the widget's text input loses focus.
- clear-search Fired when a result is cleared from the input box or a new result is selected.
- focus Fired when the widget's text input sets focus.
- load Fired when the search widget has fully loaded.
- search-results
- {
- activeSourceIndex: <Number>,
- errors: <Error[]>,
- numErrors: <Number>,
- numResults: <Number>,
- results: <Object[]>,
- value: <String>
- }
- Fires when the search method is called and returns its results.
- select-result
- {
- result: <Object>,
- source: <Object>,
- sourceIndex: <Number>
- }
- Fired when a search result is selected.
- suggest-results
- {
- activeSourceIndex: <Number>,
- errors: <Error[]>,
- numErrors: <Number>,
- numResults: <Number>,
- results: <Object[]>,
- value: <String>
- }
- Fired when the suggest method is called and returns its results.
- Constructor Details
- new Search(options, srcNode)
- Create a new Search widget using the given DOM node.
- Parameters:
- <Object> options Required Set of options used to specify Search options. This parameter is required but can be null or an empty object. See the options properties below for details.
- <Node | String> srcNode Required Reference or id of the HTML element where the widget should be rendered.
- options properties:
- <Number | String> activeSourceIndex Optional The currently selected source. The default is "all".
- <Boolean> addLayersFromMap Optional Indicates whether to automatically add all the feature layers from the map. The default value is false.
- <String> allPlaceholder Optional This is the default value used as a hint for input text when searching on multiple sources. The default value is "Find address or place".
- <Boolean> autoNavigate Optional Indicates whether to automatically navigate to the selected result. The default value is true.
- <Boolean> autoSelect Optional Indicates whether to automatically select the first geocoded result (not the first suggestion). The default value is true.
- <Boolean> enableButtonMode Optional Indicates whether to enable an option to collapse/expand the search into a button. The default value is false.
- <Boolean> enableHighlight Optional Indicates whether to show the selected feature on the map using the highlight symbol property. The default value is true.
- <Boolean> enableInfoWindow Optional Indicates whether to display the infoWindow on feature click. The default value is true. See the enableInfoWindow property for additional information on this.
- <Boolean> enableLabel Optional Indicates whether to enable showing a label for the geometry.The default value is false.
- <Boolean> enableSearchingAll Optional Indicates whether to display the option to search "All" sources. Default is true.
- <Boolean> enableSourcesMenu Optional Indicates whether to enable the menu for selecting different sources. The default value is true.
- <Boolean> enableSuggestions Optional Indicates whether or not to enable suggest on the widget. The default value is true.
- NOTE: This is available if working with a 10.3 geocoding service that has suggest capability loaded or a 10.3 feature layer that supports pagination, i.e. supportsPagination = true.
- <Boolean> enableSuggestionsMenu Optional Indicates whether to display suggest results. The default value is true.
- <Boolean> expanded Optional Indicates whether to set the state of the enableButtonMode to expanded (true) or collapsed (false). The default value is false.
- <Layer> graphicsLayer Optional This the specified graphicsLayer to use for the highlightGraphic and labelGraphic instead of map.graphics.
- <Symbol> highlightSymbol Optional The symbol used for highlightGraphic. Defaults to PictureMarkerSymbol.
- <InfoTemplate> infoTemplate Optional A customized infoTemplate for the selected feature.
- NOTE: Do not specify a wildcard "${*}" for this specific infoTemplate as it will return all fields in addition to search-specific fields.
- <TextSymbol> labelSymbol Optional The text symbol for the label graphic.
- <Number> locationToAddressDistance Optional The default distance specified in meters used to reverse geocode, (if not specified by source). The default value is 1500.
- <Map> map Optional Reference to the map. If no map is specified, the value is null.
- <Number> maxResults Optional The default maximum number of results returned by the widget if not specified by source. The default value is 6.
- <Number> maxSuggestions Optional The default maximum number of suggestions returned by the widget if not specified by source. The default value is 6. NOTE: If working with the default ArcGIS Online Geocoding service, the default remains at 5.
- <Number> minCharacters Optional The default minimum amount of characters needed for the search if not specified by source. The default value is 1.
- <Boolean> showInfoWindowOnSelect Optional Indicates whether to show the infoWindow when a result is selected. The default value is true. See the showInfoWindowOnSelect property for additional information on this.
- <Object[]> sources Optional An array of source objects used to find search results. Refer to the sources property for additional information on this.
- <Number> suggestionDelay Optional The millisecond delay after keyup and before making a suggest network request. The default value is 150.
- <String> theme Optional The CSS class selector used to uniquely style the widget. The default value is arcgisSearch.
- <String> value Optional Current value of the search box input text string. The default value is "".
- <Boolean> visible Optional Indicates whether to show the Search widget. Default value is true.
- <Number> zoomScale Optional If the result does not have an associated extent, specify this number to use as the zoom scale for the result. The default value is 1000.
- ================================================================================
- Sample:
- require([
- "esri/map","esri/dijit/Search",....],function(Map,Search,....){
- var map=new Map(....);
- var s=new Search({
- map:map
- },"search");
- )};
- =============================================================
- 具体的方法简介
- <object[]>sources
- 源对象数组用于查找搜索结果。 支持多种地理编码服务除了搜索功能层。参见下面对象规格表结构的源对象。
- 默认的源对象
- Default sourses[]
- [
- {
- locator:new Locator("//geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer"),
- singleLineFieldName:"SingleLine",
- outFields:["Addr_type"],
- name:i18n.widgets.Search.main.esriLocationName,
- localSearchOptions:{
- minScale:300000,
- maxScale:500000
- },
- placeholder:i18n,widget.Search.main.placeholder,
- highlighSymbol:new PictureMarkerSymbol(this.basePath+"/images/search-pointer.png",36,36).setOffset(9,18)
- }
- ]
- --------------------------------------------------
- 具体的示例
- var sourse=[
- {
- locator:,
- singleLineFieldName:"SingleLine",
- name:"Custom Geocoding Service",
- localSearchOptions:{
- minScale:300000,
- distance:50000
- },
- placeholder:"Search Geocoder",
- maxResults:3,
- maxSuggestions:6,
- enableSuggestions:false,
- minCharacters:0
- },{
- featureLayer:new FeatureLayer("http://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/US_Senators/FeatureServer/0"),
- searchFisds:["Name","Party"],
- suggestionTemplate:"${Name},Party:${Party}",
- exactMatch:false,
- outFields:["*"],
- name:"Senators",
- lableSymbol:textSymbol,
- placeholder:"Senator Nmae",
- maxResults:6,
- maxSuggestions:true,
- minCharacters:0,
- searchQuaryParams:{distance:5000},
- },
- {
- featureLayer:new FeatureLayer(),{
- outFields:["*"]
- });
- placeholder:"esri",
- name:"A FeatureLayer",
- prefix:"",
- suffix:"",
- maxResults:1,
- maxSuggestions:6,
- searchExtent:null,
- exactMath:fasle,
- searchFields:[],//默认为 FeatureLayer.displayField
- displayField:"",//默认为 FeatureLayer.displayField
- labelSymbol:new TextSymbol(),
- minCharacters:0
- }
- ];
- ===========================================
- 设置源的一些方法
- 1. Set source(s) on creation
- var s=new Search({
- sources:[]
- });
- s.startup();
- 2.Add to sources
- var s=new Search();
- var sources=s.get("sources");
- sources.push({//new sources}) ;
- s.set("sources",sources);
- s.startup();
- 3.set sources
- var s=new Search();
- var sources=[my sources];
- s.set("sources",sources);
- s.startup();
- -----------------------------------------------------------
- 规范:
- 1、local Search Options
- distance //指定一个搜索位置的距离,默认值为12000
- minScale //位置搜索时指定比例尺至小于指定值。默认为15000
- 2.sources
- autoNavigate //同时适用于定位器和功能层。这表明是否自动导航到选定的结果一旦选中。默认是正确的。
- categories //一个字符串数组限制到一个或多个类别的结果。例如“密集的地方”或“机场”。只适用于当使用世界地理编码服务。查看世界地理编码服务文档了解更多信息。
- countryCode //只用于使用定位器的来源。这个会对搜索结果到指定的国家代码。例如,“US”美国和瑞典“SE”。只适用于世界地理服务。
- displayField //只适用于要素图层源。结果显示正在使用的字段。默认的显示图层的第一个字段。
- enableHighlight //同时适用于定位器和功能层。这表明是否在地图上显示一个图形使用highlightSymbol选中的源。默认值是正确的。
- enableInfoWindow //同时适用于定位器和功能层。它显示一个信息窗口,单击选择的结果。默认是正确的。
- enableLabel //同时适用于定位器和功能层。这表明是否在地图上显示一个文本标签使用labelSymbol选中的源。默认值是错误的。
- enableSuggestions//同时适用于定位器和功能层。这表明是否启用建议小部件的用户输入。默认值是正确的。 注意:这是可用的,如果使用10.3地理编码服务,建议功能层,支持分页加载或10.3特性,即supportsPagination = true。
- exactMathch //只适用于功能层源。这只搜索值完全匹配的返回结果。默认是假的。
- featureLayer //这只适用于地图服务功能层。功能层是在搜索查询。如果搜索功能层,这是必需的。
- infoTemplate //用于选择结果。同时适用于定位和功能层。
- labelSymbol //TextSymbol用于标签所选择的结果。这同时适用于定位器和功能层。
- localSearchOptions//只适用于在使用定位器的来源。这是用于设置为当地的距离和minScale搜索来源。有关详细信息,请参阅下面的localSearchOptions表。
- locationToAddressDistance//默认的距离米为反向地理编码。
- locator //这只适用于定位器的来源。这是用于搜索定位任务。这是必需的,默认为世界地理编码服务。
- maxResualts //同时适用于定位器和功能层。这个数字显示返回结果的最大数目。默认值是6。
- maxSuggestions //同时适用于定位器和功能层。这个数字表示建议的最大数量换取小部件的输入。默认值为15。
- minCharacters //同时适用于定位器和功能层。这个数字显示所需的最小字符数在查询一个建议。默认值是1。
- name //同时适用于定位器和功能层。这是来源显示的名称。
- outFields //这个字符串数组同时适用于定位器和功能层。它指定的字段返回搜索结果。
- placeholder //同时适用于定位器和功能层。这是用来提示源输入文本。不支持的IE9和下面。
- prefix //同时适用于定位器和功能层。指定该前缀的输入搜索文本。
- searchExtent //程度上对象的数组,同时适用于定位器和功能层。设置这个如果要限制搜索结果在某种程度上
- searchFields //只适用于功能层。它是一个字符串值数组搜索结果在这些领域的功能层
- searchQueryParams//定义了一个查询的默认选项,当搜索功能层。有些选项可能会覆盖搜索部件包括以下几点:
- outSpatialReference
- returnGeometry
- num
- outFields
- where
- maxAllowableOffset
- objectIds
- suggestionTemplate //一个模板字符串用于显示多个字段顺序定义。这仅适用于功能层和优先于displayField来源。
- useMapExtent //指示是否限制搜索结果在地图的程度上。
- zoomScale //适用于指定的源。如果结果没有一个关联的程度,指定要使用这个号码的缩放尺度结果。
ArcGIS Server 开发实践之【Search类】的更多相关文章
- ArcGIS Server开发实践之【Search Widget工具查询本地地图服务】
加载本地地图服务,并实现要素的查询.(不足之处还请指点)具体代码如下: <!DOCTYPE html> <html dir="ltr"> <head& ...
- ArcGIS server 开发实践之【FeatureLayer类】
全是干活,你值得拥有 要素图层类简介:Class:FeatureLayer //调用方式:require(["esri/layers/FeatureLayer"],function ...
- 【ArcGIS Server 开发系列】Flyingis六大系列讲座精品PDF奉献
转自:http://www.cnblogs.com/gispeng/archive/2008/07/24/1250116.html [ArcGIS Server 开发系列]Flyingis六大系列讲座 ...
- ArcGIS Server开发教程系列(3)切片
切片工作,我们可以一级一级的切,也可以,所有的一块切,Recreate All Tiles这项是说,在没有进行任何的切片工作时,可以选用这项:Recreate Empty Tiles这项是说,如果之前 ...
- ArcGIS Server开发教程系列(1) Arcgis server 10.1 的安装
本系列所使用的软件版本如下: Windows 7 X64 / Windows server 2008 X64 Arcgis for Desktop 10.1 Arcgis 10.1 for serve ...
- ArcGIS Server开发教程系列(2)配置ARCMAP和ARCCatalog发布服务
1. Arc catalog的配置 打开catalog,如图新增刚刚创建的server 1. Use GIS services: 用户身份连接 使用此种连接,可以浏览.使用站点内发布的所有 ...
- ArcGIS Server开发教程系列(7)使用ArcGIS API for Javascript-Hello World
ArcGIS API for Javascript API下载地址:http://support.esrichina-bj.cn/2011/0223/960.html 选择最新的下载就好了,目前是3 ...
- ArcGIS Server 开发之鹰眼地图的实现
鹰眼简单点说就是地图的联动,鹰眼的全称是OverviewMap,在ERSI提供的API包中,在dijit中进行类的调用.查了很多的资料,总结一下: 具体的代码: <!DOCTYPE html&g ...
- ArcGIS Server开发教程系列(8)ArcGIS API for Javascript-控件(小部件)
1. 鹰眼 OverviewMap小部件用于在其关联的主地图内较清楚的当前鸟瞰图的范围.当主地图范围变化时,鹰眼图会自动在其空间内更新范围以保持和地图的当前范围保持一致,当鹰眼图空间的地图范围 ...
随机推荐
- VS2013模块对于SAFESEH映像是不安全的解决方法
常见报错:error LNK2026: 模块对于 SAFESEH 映像是不安全的 解决方法:右键打开项目属性 -> 链接器 -> 命令行 -> 其他选项 (D) 中加入 /SAFE ...
- Construction of Primitives in Open Cascade
Construction of Primitives in Open Cascade eryar@163.com 一.创建基本图元 Making Primitives 将用到如下的类创建基本图元,包括 ...
- 深入理解PHP内核(二)概览-PHP生命周期与Zend引擎
本文参考自<深入理解PHP内核>,地址:https://github.com/reeze/tipi 本文链接:http://www.orlion.ml/232/ 1.SAPI接口 SAPI ...
- 分享几个asp.net开发中的小技巧
下面这几个,是在实际开发或阅读中发现的一些问题,有些甚至是有很多年开发人员写出的代码,也是很多人经常犯的错误.各位可以看看,你有没有躺着中枪. 第一个,对整型变量进行非null判断. // a 是in ...
- maven -- 学习笔记(二)之setting.xml配置说明(备忘)
setting.xml配置说明,learn from:http://pengqb.javaeye.com,http://blog.csdn.net/mypop/article/details/6146 ...
- bootstrap插件思路整理
知识有时也需温故知新嘛,本次做一次bs插件梳理. $.support.transition 通过判断自定义元素是否支持WebkitTransition.MozTransition.OTransitio ...
- 哈夫曼树(二)之 C++详解
上一章介绍了哈夫曼树的基本概念,并通过C语言实现了哈夫曼树.本章是哈夫曼树的C++实现. 目录 1. 哈夫曼树的介绍 2. 哈夫曼树的图文解析 3. 哈夫曼树的基本操作 4. 哈夫曼树的完整源码 转载 ...
- .net using使用小结
在.net中using使用方法有3种,分别是using指令.using定义使用范围.using别名. using指令,即引用命名空间. using System; using System.Colle ...
- JAVA - IDEA快捷键(精简版)
快捷键 功能 Ctrl + Alt + V 对应eclipse ctrl + l + 2 自动补全 Ctrl + Alt + L 对应eclipse ctrl + shift + o 代码格式化 Ct ...
- C语言学习009:管道连接输入输出
现在我们需要对gpsdata.csv文件中的数据进行筛选,然后将符合条件的数据输出到output.json文件中,第一种方式当然是在之前的代码中进行修改,但是如果我们不想修改原来的代码就能得到我们期望 ...