# JSAnalysisGridShadow

> Can be created with the Module.getAnalysisGridShadow API.

```javascript
var gridShadow = Module.getAnalysisGridShadow();
```

## Function

### clear() → boolean

> Initializes the visualized results of the solar access analysis.
>
> Clears the visualized grid and selected objects.

{% tabs %}
{% tab title="Information" %}

* Return
  * true : initialization successful.
  * false : initialization failed.
  * Failure conditions
    * If there is no grid.
    * If there is no layer.
* Sample
  * Refer to function setEarthquakeMesh.
  * [Sandbox\_Solar Access Analysis](https://sandbox.egiscloud.com/code/main.do?id=analysis_grid_shadow)
    {% endtab %}

{% tab title="Template" %}

```javascript
var gridShadow = Module.getAnalysisGridShadow();
gridShadow.clear();
```

{% endtab %}
{% endtabs %}

### create(layerName, gap, isClip) → boolean

> Creates a grid for solar access analysis.
>
> Generates a grid with the specified gap size (unit: m) for both width and height.

{% tabs %}
{% tab title="Information" %}

| Name      | Type    | Description                                                         |
| --------- | ------- | ------------------------------------------------------------------- |
| layerName | string  | The name of the layer that will contain the visualized grid objects |
| gap       | number  | The size of the grid (width x height)                               |
| isClip    | boolean | Whether to evenly divide the specified area into grid sizes         |

* Return
  * true : creation successful.
  * false : creation failed.
  * Failure conditions
    * When the entered layer name is not created on the map.
    * When creating a grid area, there are 3 or fewer points
* Sample
  * Refer to function setEarthquakeMesh.
  * [Sandbox\_Solar Access Analysis](https://sandbox.egiscloud.com/code/main.do?id=analysis_grid_shadow)
    {% endtab %}

{% tab title="Template" %}

```javascript
var gridShadow = Module.getAnalysisGridShadow();
gridShadow.create("gridlayer", 10, true);
```

{% endtab %}
{% endtabs %}

### getResult() → string

> Returns the results of the solar access analysis.
>
> Returns the analysis results of sunlight exposure per grid.

{% tabs %}
{% tab title="Information" %}

* Return
  * JSON of sunlight exposure per grid, continuous sunlight exposure.
* Sample
  * Refer to function setEarthquakeMesh.
  * [Sandbox\_Solar Access Analysis](https://sandbox.egiscloud.com/code/main.do?id=analysis_grid_shadow)
    {% endtab %}

{% tab title="Template" %}

```javascript
var gridShadow = Module.getAnalysisGridShadow();
var result = gridShadow.getResult();
const json = JSON.parse(result);
```

{% endtab %}
{% endtabs %}

### reset() → boolean

> Resets the options for the solar access analysis grid.
>
> Initializes options such as exclusion grid, grid color.

{% tabs %}
{% tab title="Information" %}

* Return
  * true : Solar access analysis grid option reset successful.
  * false : Solar access analysis grid option reset failed.
  * Failure conditions
    * If there is no grid.
    * If there is no layer.
* Sample
  * Refer to function setEarthquakeMesh.
  * [Sandbox\_Solar Access Analysis](https://sandbox.egiscloud.com/code/main.do?id=analysis_grid_shadow)
    {% endtab %}

{% tab title="Template" %}

```javascript
var gridShadow = Module.getAnalysisGridShadow();
gridShadow.reset();
```

{% endtab %}
{% endtabs %}

### setAnalysis(id, isAnalysis) → boolean

> Sets exclusion grids.
>
> Excludes the grid with the entered id from the solar access analysis.

{% tabs %}
{% tab title="Information" %}

| Name       | Type    | Description                    |
| ---------- | ------- | ------------------------------ |
| id         | string  | Grid id                        |
| isAnalysis | boolean | Whether to include in analysis |

* Return
  * true : setting successful.
  * false : setting failed.
  * Failure conditions
    * If there is no grid.
    * If there is no layer.
* Sample
  * Refer to function setEarthquakeMesh.
  * [Sandbox\_Solar Access Analysis](https://sandbox.egiscloud.com/code/main.do?id=analysis_grid_shadow)
    {% endtab %}

{% tab title="Template" %}

```javascript
var gridShadow = Module.getAnalysisGridShadow();
gridShadow.setAnalysis("id", false);
```

{% endtab %}
{% endtabs %}

### setColor(id, color) → boolean

> Changes the color of the solar access analysis grid.
>
> Changes the color of the grid for the specified id object.

{% tabs %}
{% tab title="Information" %}

| Name  | Type                                                                                  | Description         |
| ----- | ------------------------------------------------------------------------------------- | ------------------- |
| id    | string                                                                                | Grid id             |
| color | [JSColor](https://egiscorp.gitbook.io/xdworld_global_manual/introduce-1/core/jscolor) | Grid color setting. |

* Return
  * true : setting successful.
  * false : setting failed.
  * Failure conditions
    * If there is no grid.
    * If there is no layer.
* Sample
  * Refer to function setEarthquakeMesh.
  * [Sandbox\_Solar Access Analysis](https://sandbox.egiscloud.com/code/main.do?id=analysis_grid_shadow)
    {% endtab %}

{% tab title="Template" %}

```javascript
var gridShadow = Module.getAnalysisGridShadow();
gridShadow.setColor("id", new Module.JSColor(150, 0, 255, 0));
```

{% endtab %}
{% endtabs %}

### startAnalysis(startTime, endTime, interval) → boolean

> Executes the solar access analysis.
>
> Runs the solar access analysis based on the start time, end time, and time interval.

{% tabs %}
{% tab title="Information" %}

| Name      | Type                                                                                        | Description                            |
| --------- | ------------------------------------------------------------------------------------------- | -------------------------------------- |
| startTime | [JSDateTime](https://egiscorp.gitbook.io/xdworld_global_manual/introduce-1/core/jsdatetime) | Analysis start time                    |
| endTime   | [JSDateTime](https://egiscorp.gitbook.io/xdworld_global_manual/introduce-1/core/jsdatetime) | Analysis end time                      |
| interval  | number                                                                                      | Analysis time interval (unit: minutes) |

* Return
  * true : Solar access analysis successful.
  * false : Solar access analysis failed.
  * Failure conditions
    * If there is no grid.
    * If there is no layer.
    * If no objects are selected.
* Sample
  * Refer to function setEarthquakeMesh.
  * [Sandbox\_Solar Access Analysis](https://sandbox.egiscloud.com/code/main.do?id=analysis_grid_shadow)
    {% endtab %}

{% tab title="Template" %}

```javascript
var gridShadow = Module.getAnalysisGridShadow();
gridShadow.startAnalysis(new Module.JSDateTime(2023, 4, 17, 9, 30, 0), new Module.JSDateTime(2023, 4, 17, 15, 30, 0), 10);
```

{% endtab %}
{% endtabs %}

### createWindow(layerName) → boolean

> Creates a window for window analysis.
>
> A window is created with two points entered by clicking with the mouse (Module.MML\_ANALYS\_WINDOWSHADOW).

{% tabs %}
{% tab title="Information" %}

| Name      | Type   | Description |
| --------- | ------ | ----------- |
| layerName | string | Layer name  |

* Return
  * true : Window creation successful.
  * false : Window creation failed.
  * Failure conditions
    * If fewer than 2 points are entered.
* Sample
  * Refer to function inputWindow.
  * [Sandbox\_Window Analysis](https://sandbox.egiscloud.com/code/main.do?id=analysis_window_shadow)
    {% endtab %}

{% tab title="Template" %}

```javascript
```

{% endtab %}
{% endtabs %}

### copyPasteWindow() → boolean

> Copies and pastes a window for window analysis.
>
> Pastes the most recently created window to the top-left corner of the point entered by clicking with the mouse (Module.MML\_ANALYS\_WINDOWSHADOW).

{% tabs %}
{% tab title="Information" %}

* Return
  * true : Window copy successful.
  * false : Window copy failed.
  * Failure conditions
    * If there is no layer.
    * If no window has been created.
    * If no point has been entered.
* Sample
  * Refer to function copyPasteWindow.
  * [Sandbox\_Window Analysis](https://sandbox.egiscloud.com/code/main.do?id=analysis_window_shadow)
    {% endtab %}

{% tab title="Template" %}

```javascript
```

{% endtab %}
{% endtabs %}

### copyPasteFloor() → boolean

> Copies and pastes a floor for window analysis.
>
> Pastes all the most recently created windows to the top-left corner of the point entered by clicking with the mouse (Module.MML\_ANALYS\_WINDOWSHADOW).

{% tabs %}
{% tab title="Information" %}

* Return
  * true : Floor copy successful.
  * false : Floor copy failed.
* Conditions for floor copy failure
  * If there is no layer.
  * If no window has been created.
  * If no point has been entered.
* Sample
  * Refer to function copyPasteFloor.
  * [Sandbox\_Window Analysis](https://sandbox.egiscloud.com/code/main.do?id=analysis_window_shadow)
    {% endtab %}

{% tab title="Template" %}

```javascript
```

{% endtab %}
{% endtabs %}
