public void WriteToNTS() { if (vectLocations.Contains(new Vector3(0, 0, 0))) { return; } if (vertexSelector.lineFeatures.Contains(feature)) { attribute["Title"] = title.GetComponent <TMP_InputField>().text; attribute["Description"] = description.GetComponent <TMP_InputField>().text; feature.Attributes = attribute; } else { attribute.Add("Title", title.GetComponent <TMP_InputField>().text); attribute.Add("Description", description.GetComponent <TMP_InputField>().text); feature.Attributes = attribute; GeoAPI.Geometries.Coordinate[] coord = new GeoAPI.Geometries.Coordinate[vectLocations.Count]; int i = 0; foreach (Vector3 v in vectLocations) { var cartesianCoordinates = new Cognitics.CoordinateSystems.CartesianCoordinates(v.x, v.z); var geographicCoordinates = cartesianCoordinates.TransformedWith(cdbDatabase.Projection); coord[i] = new GeoAPI.Geometries.Coordinate(geographicCoordinates.Longitude, geographicCoordinates.Latitude, v.y); ++i; } LineString ls = new LineString(coord); feature.Geometry = ls; vertexSelector.lineFeatures.Add(feature); } ClearFields(); }
public void PlaceObservation() { var pos = ThrowTerrainTester(); float x = pos.x; float z = pos.z; var cartesianCoordinates = new Cognitics.CoordinateSystems.CartesianCoordinates(x, z); var geoCoords = cartesianCoordinates.TransformedWith(ApplicationState.Instance.cdbDatabase.Projection); MageScript.AddObservation(geoCoords.Latitude, geoCoords.Longitude); gameObject.GetComponent <Button>().GetComponent <Image>().color = buttonColor; gameObject.GetComponent <Button>().GetComponentInChildren <Text>().text = buttonString; buttonSelected = false; }
public void PositionToWorldSpace() { if (vectLocation == null) { return; } float x = vectLocation.x; float z = vectLocation.z; var cartesianCoordinates = new Cognitics.CoordinateSystems.CartesianCoordinates(x, z); var geographicCoordinates = cartesianCoordinates.TransformedWith(cdbDatabase.Projection); x = (float)geographicCoordinates.Longitude; z = (float)geographicCoordinates.Latitude; string latitudeString = (z < 0) ? string.Format("S{0:##0.0000}", -z) : string.Format("N{0:##0.0000}", z); string longitudeString = (x < 0) ? string.Format("W{0:###0.0000}", -x) : string.Format("E{0:###0.0000}", x); string str = string.Format("{0} {1} {2:###0.00}", latitudeString, longitudeString, vectLocation.y); worldLocation = str; }
public void WriteToNTS() { var cartesianCoordinates = new Cognitics.CoordinateSystems.CartesianCoordinates(vectLocation.x, vectLocation.z); var geographicCoordinate = cartesianCoordinates.TransformedWith(cdbDatabase.Projection); Geometry g = new Point(geographicCoordinate.Longitude, geographicCoordinate.Latitude, vectLocation.y); if (vertexSelector.pinFeatures.Contains(feature)) { attribute["Title"] = title.GetComponent <TMP_InputField>().text; attribute["Description"] = description.GetComponent <TMP_InputField>().text; feature.Attributes = attribute; } else { attribute.Add("Title", title.text); attribute.Add("Description", description.text); feature.Attributes = attribute; feature.Geometry = g; vertexSelector.pinFeatures.Add(feature); } SetPinText(); }