rcgis js graphic SimpleFillSymbol
时间: 2024-06-12 09:06:25 浏览: 61
The SimpleFillSymbol is a type of symbol used to represent polygon geometries in the ArcGIS JavaScript API. It allows you to define the fill color, outline color, and width of the polygon. Here's an example of how to use it:
```javascript
// Define the fill symbol
var fillSymbol = new SimpleFillSymbol({
color: [255, 0, 0, 0.5], // Red with 50% transparency
outline: {
color: [0, 0, 0],
width: 1
}
});
// Create a new graphic with a polygon geometry and the fill symbol
var polygon = new Polygon([
[-118.25, 34.05],
[-117.75, 34.05],
[-117.75, 34.45],
[-118.25, 34.45]
]);
var graphic = new Graphic({ geometry: polygon, symbol: fillSymbol });
// Add the graphic to a graphics layer or map
graphicsLayer.add(graphic);
```
In this example, we defined a SimpleFillSymbol with a red fill color and black outline, with a width of 1. We then created a new graphic with a polygon geometry and the fill symbol, and added it to a graphics layer or map.
阅读全文