当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


JavaScript ArcGIS Accessor.set用法及代码示例


基本信息

以下是所在类或对象的基本信息。

AMD: require(["esri/core/Accessor"], (Accessor) => { /* code goes here */ });

ESM: import Accessor from "@arcgis/core/core/Accessor";

类: esri/core/Accessor

子类: ActionBase , ActiveLayerInfo , AddressCandidate , AddressCandidate , AggregatedGeometry , ApplicationProperties , ApplicationProperties , AreaMeasurement3DViewModel , AreasAndLengthsParameters , AreasAndLengthsParameters , Association , AssociationGeometriesResult , AttachmentInfo , AttachmentQuery , AttachmentQuery , AttachmentsViewModel , AttributeColorInfo , AttributionViewModel , AuthoringInfo , AuthoringInfoVisualVariable , Background , BarChartMediaInfo , BarcodeScannerInput , Basemap , BasemapGalleryItem , BasemapGalleryViewModel , BasemapLayerListViewModel , BasemapToggleViewModel , BasemapView , Bookmark , BookmarksViewModel , BufferParameters , BufferParameters , BuildingComponentSublayerView , BuildingExplorerViewModel , BuildingFilter , BuildingLevel , BuildingPhase , BuildingSublayer , BuildingSummaryStatistics , ButtonMenuItem , ButtonMenuViewModel , Callout3D , Camera , ChartMediaInfoValue , ChartMediaInfoValueSeries , ClassBreakInfo , ClosestFacilityParameters , ClosestFacilityParameters , ClosestFacilitySolveResult , ClosestFacilitySolveResult , CloudyWeather , Collection , ColorBackground , ColorRamp , ColorRamp , ColorSizeStop , ColorStop , ColormapInfo , ComboBoxInput , CompassViewModel , Content , Conversion , CoordinateConversionViewModel , CreateFeaturesWorkflowData , CreateWorkflowData , Credential , CustomTemplate , DataFile , DataFile , DataLayer , DataLayer , DatePickerViewModel , DateTimePickerInput , DaylightViewModel , DensifyParameters , DensifyParameters , DimensionalDefinition , DirectLineMeasurement3DViewModel , DirectionLine , DirectionPoint , DirectionsFeatureSet , DirectionsFeatureSet , DirectionsViewModel , DistanceMeasurement2DViewModel , DistanceParameters , DistanceParameters , Domain , Draw , DrawAction , Edges3D , EditorViewModel , Edits , Element , ElementExpressionInfo , ElevationProfileLine , ElevationProfileViewModel , Environment , ExpandViewModel , ExpressionInfo , ExpressionInfo , FacilityLayerInfo , FeatureEffect , FeatureEffect , FeatureFilter , FeatureFilter , FeatureFormViewModel , FeatureReductionCluster , FeatureReductionSelection , FeatureSet , FeatureSet , FeatureSnappingLayerSource , FeatureTableViewModel , FeatureTemplate , FeatureTemplatesViewModel , FeatureType , FeatureViewModel , Field , FieldColumn , FieldConfig , FieldGroupConfig , FieldInfo , FieldInfoFormat , FindParameters , FindParameters , FindResult , FindResult , FloorFilterViewModel , FlowRenderer , FoggyWeather , Font , FormTemplate , Format , FullscreenViewModel , FunctionResult , GPMessage , GPMessage , GamepadInputDevice , GamepadSettings , GamepadSettings , GeneralizeParameters , GeneralizeParameters , Geometry , GeometryFieldsInfo , Graphic , Ground , GroundView , HandleOwner , Handles , HeatmapColorStop , HeightModelInfo , HistogramViewModel , HomeViewModel , IdentifyParameters , IdentifyParameters , IdentifyResult , IdentifyResult , ImageAngleParameters , ImageAngleResult , ImageHistogramParameters , ImageHistogramParameters , ImageIdentifyParameters , ImageIdentifyParameters , ImageIdentifyResult , ImageIdentifyResult , ImageMediaInfo , ImageMediaInfoValue , ImageParameters , ImagePixelLocationParameters , ImagePixelLocationResult , ImageSample , ImageSampleParameters , ImageSampleResult , InitialViewProperties , InitialViewProperties , Input , InputField , InputFieldGroup , JobInfo , JobInfo , KMLSublayer , LOD , LabelClass , Layer , LayerFloorInfo , LayerListViewModel , LayerOptions , LayerView , LegendLayer , LegendLayer , LegendViewModel , LengthsParameters , LengthsParameters , LevelLayerInfo , Lighting , LineChartMediaInfo , LineOfSightTarget , LineOfSightViewModel , LineStyleMarker3D , LineStylePattern3D , LineSymbolMarker , LinearUnit , LinearUnit , ListItem , LocalBasemapsSource , LocateViewModel , Magnifier , Map , MapFloorInfo , MapImage , MeasurementViewModel , MeshComponent , MeshMaterial , MeshTexture , MosaicRule , NAMessage , NAMessage , Navigation , NavigationToggleViewModel , Network , NetworkElement , NetworkFeatureSet , NetworkUrl , OAuthInfo , OffsetParameters , OffsetParameters , OpacityStop , ParameterValue , ParameterValue , PieChartMediaInfo , PixelBlock , PointBarrier , PointCloudFilter , PointCloudRenderer , PolygonBarrier , PolylineBarrier , PopupTemplate , PopupViewModel , Portal , PortalFolder , PortalGroup , PortalItem , PortalItemResource , PortalQueryParams , PortalQueryResult , PortalRating , PortalUser , Presentation , PrintParameters , PrintParameters , PrintTemplate , PrintTemplate , PrintViewModel , ProjectParameters , ProjectParameters , Query , Query , RadioButtonsInput , RainyWeather , RasterColormapRenderer , RasterData , RasterData , RasterFunction , RasterInfo , RasterShadedReliefRenderer , RasterStretchRenderer , RelatedRecordsInfo , RelatedRecordsInfoFieldOrder , RelationParameters , RelationParameters , Relationship , RelationshipQuery , RelationshipQuery , Renderer , RouteInfo , RouteParameters , RouteParameters , RouteResult , RouteResult , RouteSolveResult , RouteSolveResult , ScaleBarViewModel , ScaleRangeSliderViewModel , ScaleRanges , SceneModification , Search , SearchLayer , SearchLayerField , SearchSource , SearchTable , SearchTableField , SearchViewModel , ServerInfo , ServiceAreaParameters , ServiceAreaParameters , ServiceAreaSolveResult , ServiceAreaSolveResult , ShadowCastViewModel , SiteLayerInfo , SizeStop , SketchViewModel , SlicePlane , SlicePlane , SliceViewModel , Slide , SliderViewModel , SnappingControlsViewModel , SnappingOptions , SpatialReference , StatisticDefinition , StatisticDefinition , Stop , StylePattern3D , Sublayer , SunnyWeather , SwipeViewModel , SwitchInput , Symbol , Symbol3DLayer , SynthesizeAssociationGeometriesParameters , Task , TemplateItem , TemplateItemGroup , TemplateOptions , Terminal , TerminalConfiguration , TextBoxInput , TileInfo , TileMatrixSet , TimeExtent , TimeInfo , TimeInterval , TimePickerViewModel , TimeSliderViewModel , TopFeaturesQuery , TopFilter , TraceLocation , TraceParameters , TraceResult , TrackViewModel , TravelMode , TrimExtendParameters , TrimExtendParameters , UI , UniqueValueInfo , UpdateWorkflowData , UtilityNetworkTraceViewModel , VectorFieldRenderer , View , ViewAnimation , ViewState , Viewing , Viewpoint , VisualVariable , WMSSublayer , WMTSStyle , WMTSSublayer , WeatherViewModel , Widget , Workflow , ZoomViewModel

自从:用于 JavaScript 4.0 的 ArcGIS API

用法说明

Accessor.set函数(或属性)的定义如下:

set (path, value) {*}


设置属性的值。

使用属性名称和值调用 set() 以更改属性的值。

// setting the basemap of the map
map.set("basemap", "topo-vector");
// is equivalent to
map.basemap = "topo-vector";

// currying set
let updateViewScale = view.set.bind(view, "scale");
updateViewScale(5000);

set() 可以使用属性和值的路径来调用。如果路径中的属性不存在,则不会设置该属性。

// updating the title of the basemap
map.set("basemap.title", "World Topographic Map");

// is equivalent to
if (map.basemap != null) {
  map.basemap.title = "World Topographic Map";
}

可以将具有键值对的对象传递到 set() 以一次更新多个属性。

// setting a viewpoint on the view
view.set({
  center: [-4.4861, 48.3904],
  scale: 5000
});

// currying set
let updateView = view.set.bind(view);

updateView({
  center: [-4.4861, 48.3904],
  scale: 5000
});

参数:

类型说明
path String|Object

要设置的属性的路径,或键值对的对象

value *

要在属性上设置的新值。

返回:

类型 说明
* 实例。

相关用法


注:本文由纯净天空筛选整理自arcgis.com大神的英文原创作品 Accessor.set。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。