示例#1
0
        public void TestPolygonMShapeType()
        {
            double[]      measures = new double[] { 1.0, 2.0, 3.0, 4.0, 1.0 };
            PolygonMShape polygon  = new PolygonMShape(1, m_metadata, m_extent, m_parts, m_positions, 1.0, 4.0, measures);

            Assert.AreEqual(ShapeType.PolygonM, polygon.ShapeType);
        }
示例#2
0
        public void TestPolygonMPositions()
        {
            double[]      measures = new double[] { 1.0, 2.0, 3.0, 4.0, 1.0 };
            PolygonMShape polygon  = new PolygonMShape(1, m_metadata, m_extent, m_parts, m_positions, 1.0, 4.0, measures);

            Assert.AreEqual(polygon[0][0], new Cartographic(0.0, 0.0, 0.0));
            Assert.AreEqual(polygon[0][1], new Cartographic(0.0, Constants.RadiansPerDegree, 0.0));
            Assert.AreEqual(polygon[0][2], new Cartographic(Constants.RadiansPerDegree, Constants.RadiansPerDegree, 0.0));
            Assert.AreEqual(polygon[0][3], new Cartographic(Constants.RadiansPerDegree, 0.0, 0.0));
            Assert.AreEqual(polygon[0][4], new Cartographic(0.0, 0.0, 0.0));
        }
示例#3
0
        public void TestPolygonMMeasures()
        {
            double[]      measures = new double[] { 1.0, 2.0, 3.0, 4.0, 1.0 };
            PolygonMShape polygon  = new PolygonMShape(1, m_metadata, m_extent, m_parts, m_positions, 1.0, 4.0, measures);

            Assert.AreEqual(1.0, polygon[0].GetMeasure(0));
            Assert.AreEqual(2.0, polygon[0].GetMeasure(1));
            Assert.AreEqual(3.0, polygon[0].GetMeasure(2));
            Assert.AreEqual(4.0, polygon[0].GetMeasure(3));
            Assert.AreEqual(1.0, polygon[0].GetMeasure(4));
        }
        private static VectorLayer ReadPolygonMShapes(BinaryReader br, int shapeNum)
        {
            VectorLayer aLayer = new VectorLayer(ShapeTypes.PolygonM);
            double      x, y;

            //PointD aPoint;

            for (int i = 0; i < shapeNum; i++)
            {
                //geolayer.getAttributeContainer().Add(ds.Tables[0].Rows[i][0]);

                /*  bb0.rewind();
                 * bb0.position(indexRecs[i].Offset + 8);
                 * stype = BinaryFile.ReadInt32();
                 *
                 * if (stype != shapetype)
                 * {
                 *    continue;
                 * }*/

                br.ReadBytes(12);

                PolygonMShape aSPG = new PolygonMShape();
                Extent        extent;
                extent.minX  = br.ReadDouble();
                extent.minY  = br.ReadDouble();
                extent.maxX  = br.ReadDouble();
                extent.maxY  = br.ReadDouble();
                aSPG.Extent  = extent;
                aSPG.PartNum = br.ReadInt32();
                int numPoints = br.ReadInt32();
                aSPG.parts = new int[aSPG.PartNum];
                List <PointD> points = new List <PointD>();

                //firstly read out parts begin pos in file
                for (int j = 0; j < aSPG.PartNum; j++)
                {
                    aSPG.parts[j] = br.ReadInt32();
                }

                //read out coordinates
                for (int j = 0; j < numPoints; j++)
                {
                    x = br.ReadDouble();
                    y = br.ReadDouble();
                    PointD aPoint = new PointD();
                    aPoint.X = x;
                    aPoint.Y = y;
                    points.Add(aPoint);
                }

                //Read measure
                double   mmin   = br.ReadDouble();
                double   mmax   = br.ReadDouble();
                double[] mArray = new double[numPoints];
                for (int j = 0; j < numPoints; j++)
                {
                    mArray[j] = br.ReadDouble();
                }

                //Get pointM list
                List <PointD> pointMs = new List <PointD>();
                for (int j = 0; j < numPoints; j++)
                {
                    pointMs.Add(new PointM(points[j].X, points[j].Y, mArray[j]));
                }

                aSPG.Points = pointMs;
                aLayer.ShapeList.Add(aSPG);
            }

            //Create legend scheme
            aLayer.LegendScheme = LegendManage.CreateSingleSymbolLegendScheme(ShapeTypes.Polygon, Color.FromArgb(255, 251, 195), 1.0F);
            return(aLayer);
        }