public void Load() { FileCode = Util.FromBigEndian(br.ReadInt32()); br.BaseStream.Seek(20, SeekOrigin.Current); FileLength = Util.FromBigEndian(br.ReadInt32()) * 2; FileVersion = br.ReadInt32(); ShpType = (ShapeType)br.ReadInt32(); TotalXYRange = new RangeXY(); ZRange = new Range(); MRange = new Range(); TotalXYRange.Load(ref br); ZRange.Load(ref br); MRange.Load(ref br); ContentLength = FileLength - 100; long curPoint = 0; RecordSet = new List <ShpRecord>(); while (curPoint < ContentLength) { ShpRecord record = new ShpRecord(ShpType); record.Load(ref br); long size = record.GetLength(); RecordSet.Add(record); curPoint += record.GetLength(); } }
public void Load(ref BinaryReader br) { XYRange = new RangeXY(); XYRange.Load(ref br); NumPoints = br.ReadInt32(); Points = new Point[NumPoints]; for (int i = 0; i < NumPoints; i++) { Points[i] = new Point(); Points[i].Load(ref br); } ZRange = new Range(); ZRange.Load(ref br); ZValues = new double[NumPoints]; for (int i = 0; i < NumPoints; i++) { ZValues[i] = br.ReadDouble(); } MRange = new Range(); MRange.Load(ref br); MValues = new double[NumPoints]; for (int i = 0; i < NumPoints; i++) { MValues[i] = br.ReadDouble(); } }
public void Render(RangeXY range, Color color) { try { IRenderableData renderContents = (IRenderableData)Contents; renderContents.Render(range, color); } catch (Exception e) { Console.WriteLine(e); } }
public void Load(ref BinaryReader br) { XYRange = new RangeXY(); XYRange.Load(ref br); NumPoints = br.ReadInt32(); Points = new Point[NumPoints]; for (int i = 0; i < NumPoints; i++) { Points[i] = new Point(); Points[i].Load(ref br); } }
public void Render(RangeXY range, Color color) { GameObject gameObject = new GameObject("2DPolyLineM"); LineRenderer lineRenderer = gameObject.AddComponent <LineRenderer>(); lineRenderer.material = new Material(Shader.Find("Sprites/Default")); lineRenderer.startColor = color; lineRenderer.endColor = color; lineRenderer.positionCount = NumPoints; for (int i = 0; i < NumPoints; i++) { // For unity float acurracy,, double relativeX = (Points[i].X - (range.MaxX + range.MinX) / 2) % 100000; double relativeY = (Points[i].Y - (range.MaxY + range.MinY) / 2) % 100000; Vector3 pt = new Vector3((float)relativeX, 0, (float)relativeY); lineRenderer.SetPosition(i, pt * 100); } }
public void Render(RangeXY range, Color color) { GameObject shape = new GameObject("2DPolygonM"); shape.AddComponent <MeshRenderer>(); shape.AddComponent <MeshFilter>(); // Change Point type Vector2[] ptList = new Vector2[Points.Length]; for (int i = 0; i < Points.Length; i++) { // For unity float acurracy,, double relativeX = (Points[i].X - (range.MaxX + range.MinX) / 2) % 100000;; double relativeY = (Points[i].Y - (range.MaxY + range.MinY) / 2) % 100000;; ptList[i] = new Vector2((float)relativeX, (float)relativeY); } shape.GetComponent <MeshFilter>().mesh = Util.CreateMesh(ptList); shape.GetComponent <MeshRenderer>().sharedMaterial = new Material(Shader.Find("Default-Diffuse.mat")); shape.GetComponent <MeshRenderer>().sharedMaterial.SetColor("_Color", color); }
public void Load() { FileCode = Util.FromBigEndian(br.ReadInt32()); br.BaseStream.Seek(20, SeekOrigin.Current); FileLength = Util.FromBigEndian(br.ReadInt32()) * 2; FileVersion = br.ReadInt32(); ShpType = (ShapeType)br.ReadInt32(); TotalXYRange = new RangeXY(); ZRange = new Range(); MRange = new Range(); TotalXYRange.Load(ref br); ZRange.Load(ref br); MRange.Load(ref br); int ContentLength = FileLength - 100; long curPoint = 0; RecordSet = new List <ShxRecord>(); while (curPoint < ContentLength) { ShxRecord record = new ShxRecord(); record.Load(ref br); RecordSet.Add(record); curPoint += record.GetLength(); } try { ContentsFile = (ShpFile)FileFactory.CreateInstance(shpPath); } catch (Exception) { ContentsFile = null; } }
public void Render(RangeXY range, Color color) { throw new NotImplementedException(); }