コード例 #1
0
    private void add3DLine(Parcel3DPoint point1, Parcel3DPoint point2)
    {
        //UnityEngine.Debug.Log("create2DLine");
        LineToBeAdded lineToBeAdded = new LineToBeAdded();

        //UnityEngine.Debug.Log("3D Line to be added: " + point1.y + " " + point1.x + " " + point2.y + " " + point2.x);
        lineToBeAdded.v1 = vector3(point1);
        lineToBeAdded.v2 = vector3(point2);
        //lineToBeAdded.c = Color.blue; //prepsano materialem
        linesToBeAdded.Add(lineToBeAdded);
    }
コード例 #2
0
    /*private void addParcel3DBoundaryFaces(Parcel3D parcel3D)
     * {
     *  foreach (Parcel3DBoundaryFace boundaryFace in parcel3D.boundaryFaces)
     *  {
     *
     *  }
     *
     *  ArrayList surfacePoints3D = new ArrayList();
     *  long bfid = -1;
     *  foreach (ParcelPoint3D parcelPoint3D in parcelPoints3D)
     *  {
     *      if(parcelPoint3D.bfid != bfid && bfid != -1)
     *      {
     *          SurfacesToBeAdded.Add(vector3(surfacePoints3D));
     *          surfacePoints3D = new ArrayList();
     *      }
     *      surfacePoints3D.Add(parcelPoint3D);
     *      bfid = parcelPoint3D.bfid;
     *  }
     *  SurfacesToBeAdded.Add(vector3(surfacePoints3D));
     * }
     *
     * private void addParcel3DLines(Parcel3D parcel3D)
     * {
     *  ParcelPoint3D point1 = (ParcelPoint3D)parcelPoints3D[0];
     *  foreach (ParcelPoint3D point2 in parcelPoints3D)
     *  {
     *      if(point2.seq != 1) //predpokladam, ze jdou za sebou
     *      {
     *          add3DLine(point1, point2);
     *      }
     *      point1 = point2;
     *  }
     * }*/

    private Parcel3D parseParcel3DData(ArrayList parcel3DData)
    {
        //UnityEngine.Debug.Log("parseParcel3DData");
        Parcel3D parcel = new Parcel3D();

        parcel.boundaryFaces = new ArrayList();
        Parcel3DBoundaryFace bf = new Parcel3DBoundaryFace();

        bf.parrentParcel = parcel;
        bf.points        = new ArrayList();
        bf.bfid          = -1;
        //UnityEngine.Debug.Log("parse2DParcelData... Length: " + parcel3DData.Count);
        //UnityEngine.Debug.Log(((String[])parcel3DData[0]).Length);
        foreach (string[] pointData in parcel3DData)
        {
            try
            {
                if (bf.bfid == -1)
                {
                    bf.bfid = long.Parse(pointData[2]);
                }
                if (bf.bfid != long.Parse(pointData[2]))
                {
                    parcel.boundaryFaces.Add(bf);
                    bf = new Parcel3DBoundaryFace();
                    bf.parrentParcel = parcel;
                    bf.points        = new ArrayList();
                    bf.bfid          = long.Parse(pointData[2]);
                }
                parcel.suid    = long.Parse(pointData[0]);
                parcel.parCis  = pointData[1];
                bf.orientation = char.Parse(pointData[3]);
                Parcel3DPoint point = new Parcel3DPoint();
                point.y = float.Parse(pointData[6]);
                point.x = float.Parse(pointData[5]);
                point.h = float.Parse(pointData[7]);
                bf.points.Add(point);
            }
            catch (Exception e)
            {
                UnityEngine.Debug.Log(e.Message);
            }
        }
        parcel.boundaryFaces.Add(bf);
        //UnityEngine.Debug.Log("parcela 3D... " + parcel.parCis);
        //UnityEngine.Debug.Log("  čílslo parcely: " + parcel.parCis);
        //UnityEngine.Debug.Log("  počet bf: " + parcel.boundaryFaces.Count);
        return(parcel);
    }
コード例 #3
0
 private Vector3 vector3(Parcel3DPoint p)
 {
     return(new Vector3(p.y - dy, p.h, p.x - dx));
 }