public void TestPolylineMShapeType() { double[] measures = new double[] { 1.0, 2.0 }; PolylineMShape line = new PolylineMShape(1, m_metadata, m_extent, m_parts, m_positions, 1.0, 2.0, measures); Assert.AreEqual(ShapeType.PolylineM, line.ShapeType); }
public void TestPolylineMPositions() { double[] measures = new double[] { 1.0, 2.0 }; PolylineMShape line = new PolylineMShape(1, m_metadata, m_extent, m_parts, m_positions, 1.0, 2.0, measures); Assert.AreEqual(line[0][0], new Cartographic(0.0, 0.0, 0.0)); Assert.AreEqual(line[0][1], new Cartographic(Constants.RadiansPerDegree, Constants.RadiansPerDegree, 0.0)); }
public void TestPolylineMMeasures() { double[] measures = new double[] { 1.0, 2.0 }; PolylineMShape line = new PolylineMShape(1, m_metadata, m_extent, m_parts, m_positions, 1.0, 2.0, measures); Assert.AreEqual(1.0, line[0].GetMeasure(0)); Assert.AreEqual(2.0, line[0].GetMeasure(1)); }
private static VectorLayer ReadPolylineMShapes(BinaryReader br, int shapeNum) { VectorLayer aLayer = new VectorLayer(ShapeTypes.PolylineM); double x, y; //PointD aPoint; for (int i = 0; i < shapeNum; i++) { br.ReadBytes(12); //Read bounding box PolylineMShape aPL = new PolylineMShape(); Extent extent; extent.minX = br.ReadDouble(); extent.minY = br.ReadDouble(); extent.maxX = br.ReadDouble(); extent.maxY = br.ReadDouble(); aPL.Extent = extent; aPL.PartNum = br.ReadInt32(); int numPoints = br.ReadInt32(); aPL.parts = new int[aPL.PartNum]; List <PointD> points = new List <PointD>(); //firstly read out parts begin position in file for (int j = 0; j < aPL.PartNum; j++) { aPL.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])); } aPL.Points = pointMs; aLayer.ShapeList.Add(aPL); } //Create legend scheme aLayer.LegendScheme = LegendManage.CreateSingleSymbolLegendScheme(ShapeTypes.Polyline, Color.DarkGray, 1.0F); return(aLayer); }