# FlattenTool

#### new Cesium.FlattenTool(scene)
MapGIS/Tools/FlattenTool.js 8

压平工具

Name | Type | Description
--- | --- | ---
`scene` | Scene |

### Methods

#### modelFlatten(positionArray, flattenHeight, flattenWithId, tileSetList)
MapGIS/Tools/FlattenTool.js 38

模型压平（该功能目前不支持M3D 2.0）

Name | Type | Description
--- | --- | ---
`positionArray` | Array | 压平区域多边形顶点坐标数组，封闭多边形
`flattenHeight` | Number | 压平到指定高度，绝对海拔高度，单位米
`flattenWithId` | Boolean | 是否根据id压平
`tileSetList` | Array.<MapGISM3DSet> | optional 参与压平的MapGISM3DSet列表

##### Example:

    var flattenTool = new Cesium.FlattenTool(viewer.scene);
    var positions;
    // 绘制压平区域
    var drawElement = new Cesium.DrawElement(viewer);
    drawElement.startDrawingPolygon({
        callback: function (result) {
            positions = result.positions;
            var polygon = new Cesium.DrawElement.PolygonPrimitive({
                positions: positions,
                allowPicking: false,
                material: Cesium.Material.fromType('Color', {
                    color: new Cesium.Color(249 / 255, 177 / 255, 27 / 255, 0.5)
                })
            });
            viewer.scene.primitives.add(polygon);
        }
    });
    flattenTool.modelFlatten(positions, 10, true, tileSetList);

#### removeModelFlatten()
MapGIS/Tools/FlattenTool.js 66

移除模型压平