コード例 #1
0
        private static ICompoundCoordinateSystem ReadCompoundCoordinateSystem(XmlTextReader reader)
        {
            if (!(reader.NodeType == XmlNodeType.Element && reader.Name == "CS_CompoundCoordinateSystem"))
            {
                throw new ParseException(String.Format("Expected a ICompoundCoordinateSystem 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);

            while (reader.NodeType == XmlNodeType.Element && reader.Name == "CS_AxisInfo")
            {
                //IAxisInfo axis = ReadAxisInfo( reader );
                //list.Add(axis);
                reader.Read();
            }
            reader.Read();
            ICoordinateSystem headCS = ReadCoordinateSystem(reader);

            reader.Read();
            reader.Read();
            reader.Read();
            ICoordinateSystem tailCS = ReadCoordinateSystem(reader);

            reader.Read();
            CompoundCoordinateSystem compoundCS = new CompoundCoordinateSystem(headCS, tailCS, "", authority, authorityCode, name, "", abbreviation);

            return(compoundCS);
        }
コード例 #2
0
        public void Test_Constructor3()
        {
            ICoordinateSystem headCRS = _factory.CreateProjectedCoordinateSystem("27700");;
            ICoordinateSystem tailCRS = null;

            try
            {
                CompoundCoordinateSystem compoundCS = new CompoundCoordinateSystem(headCRS,
                                                                                   tailCRS,
                                                                                   "remarks",
                                                                                   "authority",
                                                                                   "code",
                                                                                   "name",
                                                                                   "alias",
                                                                                   "abbreviation");
                Assertion.Fail("Argumentexception should be thrown.");
            }
            catch (ArgumentNullException)
            {
            }
        }
コード例 #3
0
        public void Test_Constructor1()
        {
            ICoordinateSystem        headCRS    = _factory.CreateProjectedCoordinateSystem("27700");
            ICoordinateSystem        tailCRS    = _factory.CreateVerticalCoordinateSystem("5701");
            CompoundCoordinateSystem compoundCS = new CompoundCoordinateSystem(headCRS,
                                                                               tailCRS,
                                                                               "remarks",
                                                                               "authority",
                                                                               "code",
                                                                               "name",
                                                                               "alias",
                                                                               "abbreviation");

            Assertion.AssertEquals("ctor1.", headCRS, compoundCS.HeadCS);
            Assertion.AssertEquals("ctor2.", tailCRS, compoundCS.TailCS);
            Assertion.AssertEquals("ctor3.", "remarks", compoundCS.Remarks);
            Assertion.AssertEquals("ctor3.", "authority", compoundCS.Authority);
            Assertion.AssertEquals("ctor3.", "code", compoundCS.AuthorityCode);
            Assertion.AssertEquals("ctor3.", "name", compoundCS.Name);
            Assertion.AssertEquals("ctor3.", "alias", compoundCS.Alias);
            Assertion.AssertEquals("ctor3.", "abbreviation", compoundCS.Abbreviation);
        }
コード例 #4
0
        private static ICompoundCoordinateSystem ReadCompoundCoordinateSystem(WktStreamTokenizer tokenizer)
        {
            /*
             * COMPD_CS[
             * "OSGB36 / British National Grid + ODN",
             * PROJCS[]
             * VERT_CS[]
             * AUTHORITY["EPSG","7405"]
             * ]*/

            //TODO add a ReadCoordinateSystem - that determines the correct coordinate system to
            //read. Right now this hard coded for a projected and a vertical coord sys - so the UK
            //national grid works.
            tokenizer.ReadToken("[");
            string name = tokenizer.ReadDoubleQuotedWord();

            tokenizer.ReadToken(",");
            tokenizer.NextToken();
            string            headCSCode = tokenizer.GetStringValue();
            ICoordinateSystem headCS     = ReadCoordinateSystem(headCSCode, tokenizer);

            tokenizer.ReadToken(",");
            tokenizer.NextToken();
            string            tailCSCode = tokenizer.GetStringValue();
            ICoordinateSystem tailCS     = ReadCoordinateSystem(tailCSCode, tokenizer);

            tokenizer.ReadToken(",");
            string authority     = "";
            string authorityCode = "";

            tokenizer.ReadAuthority(ref authority, ref authorityCode);
            tokenizer.ReadToken("]");
            ICompoundCoordinateSystem compoundCS = new CompoundCoordinateSystem(headCS, tailCS, "", authority, authorityCode, name, "", "");

            return(compoundCS);
        }