コード例 #1
0
        public void SetUp()
        {
            this.factory = new GeometryFactory();

            this.geometries = new IGeometry[]
            {
                this.factory.CreatePoint(1.5, 1.5),
                this.factory.CreateLineString(Enumerable.Range(1, 4).Select(i => new Coordinate(-i / 2.0, i / 2.0))),
                this.factory.CreatePolygon(Enumerable.Range(1, 4).Select(i => new Coordinate(i, i)),
                                           new Coordinate[][]
                {
                    Enumerable.Range(1, 4).Select(i => new Coordinate(i, i)).ToArray(),
                    Enumerable.Range(1, 4).Select(i => new Coordinate(i, i)).ToArray()
                }),
                this.factory.CreateMultiPoint(Enumerable.Range(1, 4).Select(i => this.factory.CreatePoint(i / 2.0, i / 2.0))),
                this.factory.CreateMultiLineString(new ILineString[]
                {
                    this.factory.CreateLineString(Enumerable.Range(1, 4).Select(i => new Coordinate(i, i))),
                    this.factory.CreateLineString(Enumerable.Range(1, 4).Select(i => new Coordinate(i / 2.0, i / 2.0)))
                }),
                this.factory.CreateMultiPolygon(new IPolygon[]
                {
                    this.factory.CreatePolygon(Enumerable.Range(1, 4).Select(i => new Coordinate(i, i)),
                                               new Coordinate[][]
                    {
                        Enumerable.Range(1, 4).Select(i => new Coordinate(i, i)).ToArray(),
                        Enumerable.Range(1, 4).Select(i => new Coordinate(i, i)).ToArray()
                    }),
                    this.factory.CreatePolygon(Enumerable.Range(1, 4).Select(i => new Coordinate(i / 2.0, i / 2.0)))
                })
            };

            this.mockReferenceSystem = new Mock <IReferenceSystem>(MockBehavior.Strict);
            this.mockReferenceSystem.Setup(referenceSystem => referenceSystem.Code).Returns(1000);
            this.mockReferenceSystem.Setup(referenceSystem => referenceSystem.Dimension).Returns(2);

            this.mockReferenceSystemFactory = new Mock <IReferenceSystemFactory>(MockBehavior.Strict);
            this.mockReferenceSystemFactory.Setup(factory => factory.CreateReferenceSystemFromIdentifier("EPSG::1000")).Returns(this.mockReferenceSystem.Object);

            GeometryFactory factoryWithReference = new GeometryFactory(this.mockReferenceSystem.Object);

            this.geometriesWithReference = new IGeometry[]
            {
                factoryWithReference.CreatePoint(1.5, 1.5),
                factoryWithReference.CreateLineString(Enumerable.Range(1, 4).Select(i => new Coordinate(-i / 2.0, i / 2.0))),
                factoryWithReference.CreatePolygon(Enumerable.Range(1, 4).Select(i => new Coordinate(i, i)),
                                                   new Coordinate[][]
                {
                    Enumerable.Range(1, 4).Select(i => new Coordinate(i, i)).ToArray(),
                    Enumerable.Range(1, 4).Select(i => new Coordinate(i, i)).ToArray()
                }),
                factoryWithReference.CreateMultiPoint(Enumerable.Range(1, 4).Select(i => this.factory.CreatePoint(i / 2.0, i / 2.0))),
                factoryWithReference.CreateMultiLineString(new ILineString[]
                {
                    this.factory.CreateLineString(Enumerable.Range(1, 4).Select(i => new Coordinate(i, i))),
                    this.factory.CreateLineString(Enumerable.Range(1, 4).Select(i => new Coordinate(i / 2.0, i / 2.0)))
                }),
                factoryWithReference.CreateMultiPolygon(new IPolygon[]
                {
                    factoryWithReference.CreatePolygon(Enumerable.Range(1, 4).Select(i => new Coordinate(i, i)),
                                                       new Coordinate[][]
                    {
                        Enumerable.Range(1, 4).Select(i => new Coordinate(i, i)).ToArray(),
                        Enumerable.Range(1, 4).Select(i => new Coordinate(i, i)).ToArray()
                    }),
                    factoryWithReference.CreatePolygon(Enumerable.Range(1, 4).Select(i => new Coordinate(i / 2.0, i / 2.0)))
                })
            };

            this.geometriesMarkup = new String[]
            {
                "<gml:Point xmlns:gml=\"http://www.opengis.net/gml/\"><gml:pos>1.5 1.5</gml:pos></gml:Point>",
                "<gml:LineString xmlns:gml=\"http://www.opengis.net/gml/\"><gml:posList>-0.5 0.5 -1 1 -1.5 1.5 -2 2</gml:posList></gml:LineString>",
                "<gml:Polygon xmlns:gml=\"http://www.opengis.net/gml/\"><gml:outerBoundaryIs><gml:LinearRing><gml:posList>1 1 2 2 3 3 4 4 1 1</gml:posList></gml:LinearRing></gml:outerBoundaryIs><gml:innerBoundaryIs><gml:LinearRing><gml:posList>1 1 2 2 3 3 4 4 1 1</gml:posList></gml:LinearRing></gml:innerBoundaryIs><gml:innerBoundaryIs><gml:LinearRing><gml:posList>1 1 2 2 3 3 4 4 1 1</gml:posList></gml:LinearRing></gml:innerBoundaryIs></gml:Polygon>",
                "<gml:MultiPoint xmlns:gml=\"http://www.opengis.net/gml/\"><gml:posList>0.5 0.5 1 1 1.5 1.5 2 2</gml:posList></gml:MultiPoint>",
                "<gml:MultiLineString xmlns:gml=\"http://www.opengis.net/gml/\"><gml:LineStringMember><gml:LineString><gml:posList>1 1 2 2 3 3 4 4</gml:posList></gml:LineString></gml:LineStringMember><gml:LineStringMember><gml:LineString><gml:posList>0.5 0.5 1 1 1.5 1.5 2 2</gml:posList></gml:LineString></gml:LineStringMember></gml:MultiLineString>",
                "<gml:MultiPolygon xmlns:gml=\"http://www.opengis.net/gml/\"><gml:PolygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:posList>1 1 2 2 3 3 4 4 1 1</gml:posList></gml:LinearRing></gml:outerBoundaryIs><gml:innerBoundaryIs><gml:LinearRing><gml:posList>1 1 2 2 3 3 4 4 1 1</gml:posList></gml:LinearRing></gml:innerBoundaryIs><gml:innerBoundaryIs><gml:LinearRing><gml:posList>1 1 2 2 3 3 4 4 1 1</gml:posList></gml:LinearRing></gml:innerBoundaryIs></gml:Polygon></gml:PolygonMember><gml:PolygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:posList>0.5 0.5 1 1 1.5 1.5 2 2 0.5 0.5</gml:posList></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:PolygonMember></gml:MultiPolygon>"
            };

            this.identifier = "12345678";

            this.geometriesMarkupWithIdentifier = new String[]
            {
                "<gml:Point gml:id=\"12345678\" xmlns:gml=\"http://www.opengis.net/gml/\"><gml:pos>1.5 1.5</gml:pos></gml:Point>",
                "<gml:LineString gml:id=\"12345678\" xmlns:gml=\"http://www.opengis.net/gml/\"><gml:posList>-0.5 0.5 -1 1 -1.5 1.5 -2 2</gml:posList></gml:LineString>",
                "<gml:Polygon gml:id=\"12345678\" xmlns:gml=\"http://www.opengis.net/gml/\"><gml:outerBoundaryIs><gml:LinearRing><gml:posList>1 1 2 2 3 3 4 4 1 1</gml:posList></gml:LinearRing></gml:outerBoundaryIs><gml:innerBoundaryIs><gml:LinearRing><gml:posList>1 1 2 2 3 3 4 4 1 1</gml:posList></gml:LinearRing></gml:innerBoundaryIs><gml:innerBoundaryIs><gml:LinearRing><gml:posList>1 1 2 2 3 3 4 4 1 1</gml:posList></gml:LinearRing></gml:innerBoundaryIs></gml:Polygon>",
                "<gml:MultiPoint gml:id=\"12345678\" xmlns:gml=\"http://www.opengis.net/gml/\"><gml:posList>0.5 0.5 1 1 1.5 1.5 2 2</gml:posList></gml:MultiPoint>",
                "<gml:MultiLineString gml:id=\"12345678\" xmlns:gml=\"http://www.opengis.net/gml/\"><gml:LineStringMember><gml:LineString><gml:posList>1 1 2 2 3 3 4 4</gml:posList></gml:LineString></gml:LineStringMember><gml:LineStringMember><gml:LineString><gml:posList>0.5 0.5 1 1 1.5 1.5 2 2</gml:posList></gml:LineString></gml:LineStringMember></gml:MultiLineString>",
                "<gml:MultiPolygon gml:id=\"12345678\" xmlns:gml=\"http://www.opengis.net/gml/\"><gml:PolygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:posList>1 1 2 2 3 3 4 4 1 1</gml:posList></gml:LinearRing></gml:outerBoundaryIs><gml:innerBoundaryIs><gml:LinearRing><gml:posList>1 1 2 2 3 3 4 4 1 1</gml:posList></gml:LinearRing></gml:innerBoundaryIs><gml:innerBoundaryIs><gml:LinearRing><gml:posList>1 1 2 2 3 3 4 4 1 1</gml:posList></gml:LinearRing></gml:innerBoundaryIs></gml:Polygon></gml:PolygonMember><gml:PolygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:posList>0.5 0.5 1 1 1.5 1.5 2 2 0.5 0.5</gml:posList></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:PolygonMember></gml:MultiPolygon>"
            };

            this.geometriesMarkupWithReference = new String[]
            {
                "<gml:Point srsName=\"http://www.opengis.net/def/crs/EPSG/0/1000\" srsDimension=\"2\" xmlns:gml=\"http://www.opengis.net/gml/\"><gml:pos>1.5 1.5</gml:pos></gml:Point>",
                "<gml:LineString srsName=\"http://www.opengis.net/def/crs/EPSG/0/1000\" srsDimension=\"2\" xmlns:gml=\"http://www.opengis.net/gml/\"><gml:posList>-0.5 0.5 -1 1 -1.5 1.5 -2 2</gml:posList></gml:LineString>",
                "<gml:Polygon srsName=\"http://www.opengis.net/def/crs/EPSG/0/1000\" srsDimension=\"2\" xmlns:gml=\"http://www.opengis.net/gml/\"><gml:outerBoundaryIs><gml:LinearRing><gml:posList>1 1 2 2 3 3 4 4 1 1</gml:posList></gml:LinearRing></gml:outerBoundaryIs><gml:innerBoundaryIs><gml:LinearRing><gml:posList>1 1 2 2 3 3 4 4 1 1</gml:posList></gml:LinearRing></gml:innerBoundaryIs><gml:innerBoundaryIs><gml:LinearRing><gml:posList>1 1 2 2 3 3 4 4 1 1</gml:posList></gml:LinearRing></gml:innerBoundaryIs></gml:Polygon>",
                "<gml:MultiPoint srsName=\"http://www.opengis.net/def/crs/EPSG/0/1000\" srsDimension=\"2\" xmlns:gml=\"http://www.opengis.net/gml/\"><gml:posList>0.5 0.5 1 1 1.5 1.5 2 2</gml:posList></gml:MultiPoint>",
                "<gml:MultiLineString srsName=\"http://www.opengis.net/def/crs/EPSG/0/1000\" srsDimension=\"2\" xmlns:gml=\"http://www.opengis.net/gml/\"><gml:LineStringMember><gml:LineString><gml:posList>1 1 2 2 3 3 4 4</gml:posList></gml:LineString></gml:LineStringMember><gml:LineStringMember><gml:LineString><gml:posList>0.5 0.5 1 1 1.5 1.5 2 2</gml:posList></gml:LineString></gml:LineStringMember></gml:MultiLineString>",
                "<gml:MultiPolygon srsName=\"http://www.opengis.net/def/crs/EPSG/0/1000\" srsDimension=\"2\" xmlns:gml=\"http://www.opengis.net/gml/\"><gml:PolygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:posList>1 1 2 2 3 3 4 4 1 1</gml:posList></gml:LinearRing></gml:outerBoundaryIs><gml:innerBoundaryIs><gml:LinearRing><gml:posList>1 1 2 2 3 3 4 4 1 1</gml:posList></gml:LinearRing></gml:innerBoundaryIs><gml:innerBoundaryIs><gml:LinearRing><gml:posList>1 1 2 2 3 3 4 4 1 1</gml:posList></gml:LinearRing></gml:innerBoundaryIs></gml:Polygon></gml:PolygonMember><gml:PolygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:posList>0.5 0.5 1 1 1.5 1.5 2 2 0.5 0.5</gml:posList></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:PolygonMember></gml:MultiPolygon>"
            };

            this.geometryComparer = new GeometryComparer();
        }