예제 #1
0
        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();
            }
        }
예제 #2
0
        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();
            }
        }
예제 #3
0
 public void Render(RangeXY range, Color color)
 {
     try
     {
         IRenderableData renderContents = (IRenderableData)Contents;
         renderContents.Render(range, color);
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
예제 #4
0
        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);
            }
        }
예제 #5
0
        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);
            }
        }
예제 #6
0
        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);
        }
예제 #7
0
        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;
            }
        }
예제 #8
0
 public void Render(RangeXY range, Color color)
 {
     throw new NotImplementedException();
 }