private static IVerticalCoordinateSystem ReadVerticalCoordinateSystem(WktStreamTokenizer tokenizer) { /* * VERT_CS["Newlyn", * VERT_DATUM["Ordnance Datum Newlyn",2005,AUTHORITY["EPSG","5101"]] * UNIT["metre",1,AUTHORITY["EPSG","9001"]] * AUTHORITY["EPSG","5701"] */ tokenizer.ReadToken("["); string name = tokenizer.ReadDoubleQuotedWord(); tokenizer.ReadToken(","); tokenizer.ReadToken("VERT_DATUM"); IVerticalDatum verticalDatum = ReadVerticalDatum(tokenizer); tokenizer.ReadToken("UNIT"); IUnit unit = ReadUnit(tokenizer); string authority = ""; string authorityCode = ""; tokenizer.ReadAuthority(ref authority, ref authorityCode); tokenizer.ReadToken("]"); IVerticalCoordinateSystem verticalCS = new VerticalCoordinateSystem(name, verticalDatum, "", authority, authorityCode, "", ""); return(verticalCS); }
public void Test_Constructor() { VerticalDatum datum = VerticalDatum.Ellipsoidal; IAxisInfo axis = AxisInfo.Altitude; ILinearUnit unit = LinearUnit.Meters; VerticalCoordinateSystem vcs = new VerticalCoordinateSystem("test1", datum, axis, unit); Assertion.AssertEquals("Test1", datum, vcs.VerticalDatum); Assertion.AssertEquals("Test2", 1.0, vcs.VerticalUnit.MetersPerUnit); Assertion.AssertEquals("ctor. 3", unit, vcs.VerticalUnit); Assertion.AssertEquals("ctor. 4", axis, vcs.GetAxis(0)); }
private static IVerticalCoordinateSystem ReadVerticalCoordinateSystem(XmlTextReader reader) { /* * <?xml version="1.0"?> * <IVerticalCoordinateSystem> * <IInfo AuthorityCode="5701" Abbreviation="ODN" Authority="EPSG" Name="Newlyn"/> * <IAxisInfo Name="Up" Orientation="UP"/> * <IVerticalDatum DatumType="2005"> * <IInfo AuthorityCode="5101" Abbreviation="ODN" Authority="EPSG" Name="Ordnance Datum Newlyn"/> * </IVerticalDatum> * <ILinearUnit MetersPerUnit="1"> * <IInfo AuthorityCode="9001" Abbreviation="m" Authority="EPSG" Name="metre"/> * </ILinearUnit> * </IVerticalCoordinateSystem> */ if (!(reader.NodeType == XmlNodeType.Element && reader.Name == "CS_VerticalCoordinateSystem")) { throw new ParseException(String.Format("Expected a IVerticalCoordinateSystem but got a {0} at line {1} col {2}", reader.Name, reader.LineNumber, reader.LinePosition)); } string authority = "", authorityCode = "", abbreviation = "", name = ""; reader.Read(); ReadInfo(reader, ref authority, ref authorityCode, ref abbreviation, ref name); //reader.Read(); ArrayList list = new ArrayList(); while (reader.NodeType == XmlNodeType.Element && reader.Name == "CS_AxisInfo") { IAxisInfo axis = ReadAxisInfo(reader); list.Add(axis); reader.Read(); } IAxisInfo[] axisInfos = new IAxisInfo[list.Count]; axisInfos = (IAxisInfo[])list.ToArray(typeof(IAxisInfo)); IVerticalDatum verticalDatum = ReadVerticalDatum(reader); ILinearUnit linearUnit = ReadLinearUnit(reader); reader.Read(); reader.Read(); VerticalCoordinateSystem verticalCoordinateSystem = new VerticalCoordinateSystem(name, verticalDatum, axisInfos[0], linearUnit, "", authority, authorityCode, "", abbreviation); return(verticalCoordinateSystem); }