# JSPipe

> Create a Pipe object with Module.createPipe API.

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

## Function

### create(coordinates, startColor, endColor, segment, radius, width) → boolean

> Creates a 3D pipe object.
>
> Object settings through parameter variables.
>
> A segment input value > 3 is required.
>
> A radius input value > 0 is required.

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

| Name        | Type                                                                                        | Description                                        |
| ----------- | ------------------------------------------------------------------------------------------- | -------------------------------------------------- |
| coordinates | [Collection](https://egiscorp.gitbook.io/xdworld_global_manual/introduce-1/core/collection) | List of longitude, latitude, altitude coordinates. |
| startColor  | [JSColor](https://egiscorp.gitbook.io/xdworld_global_manual/introduce-1/core/jscolor)       | Start point color.                                 |
| endColor    | [JSColor](https://egiscorp.gitbook.io/xdworld_global_manual/introduce-1/core/jscolor)       | End point color.                                   |
| segment     | number                                                                                      | Number of sides for the cross-section.             |
| radius      | number                                                                                      | Radius.                                            |
| width       | number                                                                                      | Line thickness in line representation.             |

* Return
  * true: Object creation was successful.
  * false: Object creation failed.
* Sample
  * Refer to function createUndergroundFacility.
  * [Sandbox\_Creating Excavation](https://sandbox.egiscloud.com/code/main.do?id=analysis_transparency_create)
    {% endtab %}

{% tab title="Template" %}

```javascript
```

{% endtab %}
{% endtabs %}

### getExtent() → number

> Returns the distance between Min-Max of the object boundary Box.

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

* Return
  * number: Distance between Min-Max of the object boundary Box.
    {% endtab %}

{% tab title="Template" %}

```javascript
var bExtends = figure.getExtent();
```

{% endtab %}
{% endtabs %}

### 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 %}

### getPositions() → [JSVec3Array](https://egiscorp.gitbook.io/xdworld_global_manual/introduce-1/core/jsvec3array)

> Returns a list of coordinates that make up a JSPipe object.

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

* Return
  * [JSVec3Array](https://egiscorp.gitbook.io/xdworld_global_manual/introduce-1/core/jsvec3array): Successfully returned a list of coordinates that make up a object.
  * null: Coordinate return failed.
    {% endtab %}

{% tab title="Template" %}

```javascript
```

{% endtab %}
{% endtabs %}

### getRadius() → number

> Returns the radius of the pipe.

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

* Return
  * Pipe radius applied to object (in meters)
    {% endtab %}

{% tab title="Template" %}

```javascript
```

{% endtab %}
{% endtabs %}

### moveVertically(altitude) → boolean

> Sets the height of the 3D pipe.
>
> Altitude input must be greater than -1000 (based on sea level altitude).

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

| Name     | Type   | Description         |
| -------- | ------ | ------------------- |
| altitude | number | Height reset value. |

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

{% tab title="Template" %}

```javascript
```

{% endtab %}
{% endtabs %}

### setColor(starColor, endColor) → boolean

> Sets the color of the start and end points of the 3D pipe.

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

| Name       | Type                                                                                  | Description        |
| ---------- | ------------------------------------------------------------------------------------- | ------------------ |
| startColor | [JSColor](https://egiscorp.gitbook.io/xdworld_global_manual/introduce-1/core/jscolor) | Start point color. |
| endColor   | [JSColor](https://egiscorp.gitbook.io/xdworld_global_manual/introduce-1/core/jscolor) | End point color.   |

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

{% tab title="Template" %}

```javascript
```

{% endtab %}
{% endtabs %}

### setFlow(startColor, endColor, segment, interval) → boolean

> Sets the internal flow representation of the 3D pipe.
>
> A segment (integer) input value >3 is required.
>
> An interval (float) input value >0 is required.

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

| Name       | Type                                                                                  | Description                             |
| ---------- | ------------------------------------------------------------------------------------- | --------------------------------------- |
| startColor | [JSColor](https://egiscorp.gitbook.io/xdworld_global_manual/introduce-1/core/jscolor) | Flow start color.                       |
| endColor   | [JSColor](https://egiscorp.gitbook.io/xdworld_global_manual/introduce-1/core/jscolor) | Flow end color.                         |
| segment    | number                                                                                | Number of points for flow composition.  |
| interval   | number                                                                                | Interval of flow representation arrows. |

* Return
  * true: Object setting successful.
  * false: Object setting failed.
* Sample
  * Refer to function createUndergroundFacility.
  * [Sandbox\_Creating Excavation](https://sandbox.egiscloud.com/code/main.do?id=analysis_transparency_create)
    {% endtab %}

{% tab title="Template" %}

```javascript
```

{% endtab %}
{% endtabs %}

### setFlowDisplay(type) → boolean

> Sets the visibility of the internal flow representation of the 3D pipe.

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

| Name | Type    | Description                                                             |
| ---- | ------- | ----------------------------------------------------------------------- |
| type | boolean | <p>true for flow visualization.<br>false for default visualization.</p> |

* Return
  * true: Object setting successful.
  * false: Object setting failed.
* Sample
  * Refer to function createUndergroundFacility.
  * [Sandbox\_Creating Excavation](https://sandbox.egiscloud.com/code/main.do?id=analysis_transparency_create)
    {% endtab %}

{% tab title="Template" %}

```javascript
```

{% endtab %}
{% endtabs %}

### setFlowWaitFrame(farme) → boolean

> Sets the number of frames for updating the internal flow of the 3D pipe.
>
> Frame (integer) component count > 0 is required.

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

| Name  | Type   | Description                 |
| ----- | ------ | --------------------------- |
| frame | number | Number of frames to update. |

* Return
  * true: Object setting successful.
  * false: Object setting failed.
* Sample
  * Refer to function createUndergroundFacility.
  * [Sandbox\_Creating Excavation](https://sandbox.egiscloud.com/code/main.do?id=analysis_transparency_create)
    {% endtab %}

{% tab title="Template" %}

```javascript
```

{% endtab %}
{% endtabs %}

### setSimplifyRange(range) → boolean

> Sets the distance for simplified representation of the 3D pipe.
>
> A range input value > 0 is required.
>
> Simplified representation omits flow representation.

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

| Name  | Type   | Description                              |
| ----- | ------ | ---------------------------------------- |
| range | number | Object precision representation distance |

* Return
  * true: Object setting successful.
  * false: Object setting failed.
* Sample
  * Refer to function createPipe.
  * [Sandbox\_Pipe](https://sandbox.egiscloud.com/code/main.do?id=object_pipe)
    {% 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 %}
