# JSReal3D

> Create a API with Module.createReal3D.
>
> Real3D is an object that outputs 3D building shapes.

```javascript
var object = Module.createReal3D("ID");
```

## Function

### getId() → string

> Returns the ID of the object.

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

* Return
  * string: Successful return of the object's Key string.
  * null: If the object is null.
    {% endtab %}

{% tab title="Template" %}

```javascript
lat strKey = object.getId();
```

{% endtab %}
{% endtabs %}

### setElevationSectionColor(elevation, color) → boolean

> Sets the color list for each floor of the building.

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

| Name      | Type                                                                                        | Description         |
| --------- | ------------------------------------------------------------------------------------------- | ------------------- |
| elevation | [Collection](https://egiscorp.gitbook.io/xdworld_global_manual/introduce-1/core/collection) | List of elevations. |
| color     | [Collection](https://egiscorp.gitbook.io/xdworld_global_manual/introduce-1/core/collection) | List of colors.     |

* Return
  * true: Setting successful.
  * false: Setting failed.
    {% endtab %}

{% tab title="Template" %}

```javascript
var elevationList = new Module.Collection();
//.. add elevation values ..
var colorList = new Module.Collection();
//.. add color values ..
object.setElevationSectionColor(elevationList, colorList);
```

{% endtab %}
{% endtabs %}

### setFillColor(type, color) → boolean

> Sets the color of the Real3D object.

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

| Name  | Type                                                                                  | Description                                                                        |
| ----- | ------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
| type  | boolean                                                                               | <p>true for changing color in simple rendering mode.<br>false for normal mode.</p> |
| color | [JSColor](https://egiscorp.gitbook.io/xdworld_global_manual/introduce-1/core/jscolor) | Fill color.                                                                        |

* Return
  * true: Setting successful.
  * false: Setting failed.
    {% endtab %}

{% tab title="Template" %}

```javascript
```

{% endtab %}
{% endtabs %}

### setShaderType(type) → boolean

> Sets the display method for building floor colors.

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

| Name | Type   | Description                                                                       |
| ---- | ------ | --------------------------------------------------------------------------------- |
| type | number | <p>The output type to set.<br>0: Texture.<br>1: Texture + Color.<br>2: Color.</p> |

* Return
  * true: Setting successful.
  * false: Setting failed.
    {% endtab %}

{% tab title="Template" %}

```javascript
object.setShaderType(1);
```

{% endtab %}
{% endtabs %}

### setStyle(style) → boolean

> Sets the style of the building.
>
> Currently, only building color style can be set.

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

| Name  | Type                                                                                                  | Description                |
| ----- | ----------------------------------------------------------------------------------------------------- | -------------------------- |
| style | [JSPolygonStyle](https://egiscorp.gitbook.io/xdworld_global_manual/introduce-1/object/jspolygonstyle) | The building style to set. |

* Return
  * true: Setting successful.
  * false: Setting failed.
    {% endtab %}

{% tab title="Template" %}

```javascript
var polyStyle = new Module.JSPolygonStyle();
polyStyle.setFill(true);
polyStyle.setFillColor(new Module.JSColor(255, 255, 0, 0));
//...
object.setStyle(polyStyle);
```

{% endtab %}
{% endtabs %}

### getFillColor() → [JSColor](https://egiscorp.gitbook.io/xdworld_global_manual/introduce-1/core/jscolor)

> Returns the color of the Real3D object.

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

* Return
  * [JSColor](https://egiscorp.gitbook.io/xdworld_global_manual/introduce-1/core/jscolor): Successfully returns the object's color.
  * null: Color return failed.
    {% endtab %}

{% tab title="Template" %}

```javascript
```

{% endtab %}
{% endtabs %}

### getPosition() → [JSVector3D](https://egiscorp.gitbook.io/xdworld_global_manual/introduce-1/core/jsvector3d)

> Returns the central latitude and longitude coordinates of the Real3D object.

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

* Return
  * [JSVector3D](https://egiscorp.gitbook.io/xdworld_global_manual/introduce-1/core/jsvector3d): Returns the centroid coordinates (longitude, latitude, altitude) of the Real3D object successfully.
  * null: Coordinate return failed.
    {% endtab %}

{% tab title="Template" %}

```javascript
```

{% endtab %}
{% endtabs %}

### getHeight() → number

> Returns the height of the 3D model itself.

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

* Return
  * number : Height of object (in meters).
    {% endtab %}

{% tab title="Template" %}

```javascript
```

{% endtab %}
{% endtabs %}

## Getter / Setter

### getDescription(), setDescription(desc) → string

> Set a description for the object.

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

| Name | Type   | Description                |
| ---- | ------ | -------------------------- |
| desc | string | Object description string. |

* Return
  * string: Successful return of the object's description string.
  * null: If the object is null.
    {% endtab %}

{% tab title="Template" %}

```javascript
var strDesc = object.getDescription();
// ... or ...
object.setDescription("First Object.");
```

{% endtab %}
{% endtabs %}

### getName(), setName(name) → string

> Sets the name of the object.

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

| Name | Type   | Description                     |
| ---- | ------ | ------------------------------- |
| name | string | The name to set for the object. |

* Return
  * string: Successful return of the object's name.
  * null: If the object is null.
    {% endtab %}

{% tab title="Template" %}

```javascript
var objName = object.getName();
// ... or ...
object.setName("MyObject");
```

{% endtab %}
{% endtabs %}

### getVisible(), setVisible(visible) → boolean

> Sets the visibility state of an object.

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

| Name    | Type    | Description                                                      |
| ------- | ------- | ---------------------------------------------------------------- |
| visible | boolean | <p>true: Make the object visible.<br>false: Hide the object.</p> |

* Return
  * true: Object visible state.
  * false: Object hidden state.
    {% endtab %}

{% tab title="Template" %}

```javascript
var objName = object.getName();
// ... or ...
object.setVisible(true);
```

{% endtab %}
{% endtabs %}
