40 lines
1.1 KiB
C#
40 lines
1.1 KiB
C#
using System.IO;
|
|
using GISTech.GISTerrainLoader;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class RuntimeVectorDataExport : MonoBehaviour
|
|
{
|
|
public GISTerrainContainer Container;
|
|
|
|
public string ExportFolder;
|
|
|
|
public bool StoreElevationValue;
|
|
|
|
public RealWorldElevation ElevationMode;
|
|
|
|
public ExportVectorType VectorType = ExportVectorType.Shapfile;
|
|
|
|
public Button export_btn;
|
|
|
|
private void Start()
|
|
{
|
|
export_btn.onClick.AddListener(ExportVectorData);
|
|
}
|
|
|
|
private void ExportVectorData()
|
|
{
|
|
string path = Random.Range(1, 100).ToString();
|
|
string text = Path.Combine(ExportFolder, path);
|
|
if (!Directory.Exists(text))
|
|
{
|
|
Directory.CreateDirectory(text);
|
|
}
|
|
string text2 = Path.Combine(text, "MyShapeFile.shp");
|
|
Container.GetStoredHeightmap();
|
|
GISTerrainLoaderGeoVectorData geoDataFromScene = GISTerrainLoaderGeoVectorData.GetGeoDataFromScene(Container, CoordinatesSource.FromTerrain, StoreElevationValue, ElevationMode);
|
|
Container.ExportVectorData(VectorType, text2, geoDataFromScene, StoreElevationValue);
|
|
Debug.Log("VectorData Exported to : " + text2);
|
|
}
|
|
}
|