コード例 #1
0
ファイル: VertexSelector.cs プロジェクト: Cognitics/Inception
    private void LoadPointFeatures()
    {
        cdbDatabase = fpsCDB.GetCDBDatabase();
#if UNITY_ANDROID
        string filepath = UnityEngine.Application.persistentDataPath;
#else
        string filepath = cdbDatabase.Path;
#endif
        cdbDatabase = fpsCDB.GetCDBDatabase();
        string databaseName = cdbDatabase.name;
        databaseName = databaseName.Replace('.', '_');

        var feats = Cognitics.CDB.Shapefile.ReadFeatures(filepath + "/" + databaseName + "point.shp");
        foreach (Feature f in feats)
        {
            GeoAPI.Geometries.Coordinate[] coords = f.Geometry.Coordinates;
            var geoCoords = new Cognitics.CoordinateSystems.GeographicCoordinates();
            geoCoords.Longitude = coords[0].X;
            geoCoords.Latitude  = coords[0].Y;
            var         cartCoords = geoCoords.TransformedWith(cdbDatabase.Projection);
            Vector3     loc        = new Vector3((float)cartCoords.X, (float)coords[0].Z, (float)cartCoords.Y);
            LocationPin lp         = locationPin.GetComponent <LocationPin>();
            lp.title.GetComponent <TMP_InputField>().text       = f.Attributes["Title"].ToString();
            lp.description.GetComponent <TMP_InputField>().text = f.Attributes["Description"].ToString();
            lp.location.GetComponent <TextMeshProUGUI>().text   = f.Geometry.ToString();
            lp.SetPinText();
            locationPin.SetActive(true);
            Instantiate(locationPin, loc, Quaternion.identity);
            locationPin.SetActive(false);
            lp.ClearFields();
        }
    }
コード例 #2
0
ファイル: LineObject.cs プロジェクト: Cognitics/Inception
 void Start()
 {
     vertexSelector = userObject.GetComponent <VertexSelector>();
     feature        = new Feature();
     attribute      = new AttributesTable();
     fpsCDB         = FilePanelCDB.GetComponent <FilePanel_SelectCDB>();
     cdbDatabase    = fpsCDB.GetCDBDatabase();
     userScript     = userObject.GetComponent <User>();
     SaveToNTS();
 }