Git Product home page Git Product logo

shploader's People

Contributors

eideallab avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

shploader's Issues

cannot import point and polyline shp.

Hello

When trying to import Shp files other than Polygone, File Code, Length, Version values ​​become 0 and Shape Type values ​​are not imported. Is there a solution to this?
Thank you!

RangeXY的值是否有误?

RecordContents.cs的第169、170两行顺序是不是写反了?导致TotalXYRange读取的最大、最小值有误。

mesh不是一个整体时会出错 (已修复)

修改 Util.cs 下的 CreateMesh 函数:

`
public static Mesh CreateMesh(Vector2[] points)
{
List<List> ptLists = splitArray(points);

        List<Vector3> vers = new List<Vector3>();
        List<int> inds = new List<int>();
        List<Vector3> nors = new List<Vector3>();

        for (int i = 0; i < ptLists.Count; i++)
        {
            MeshData meshData = getMeshData(ptLists[i]);
            vers.AddRange(new List<Vector3>(meshData.vertices));
            inds.AddRange(new List<int>(meshData.indices));
            nors.AddRange(new List<Vector3>(meshData.normals));
        }
        Mesh mesh = new Mesh();
        mesh.vertices = vers.ToArray();
        mesh.triangles = inds.ToArray();
        mesh.normals = nors.ToArray();
        mesh.RecalculateNormals();
        mesh.RecalculateBounds();
        return mesh;
    }
    static List<List<Vector2>> splitArray(Vector2[] points)
    {
        List<List<Vector2>> splits = new List<List<Vector2>>();
        int index = 0;
        Vector2 tempV2 = points[index];
        for (int i = 1; i < points.Length; i++)
        {
            if (points[i]==tempV2)
            {
                List<Vector2> list = new List<Vector2>();
                for (int j = index; j < i; j++)
                {
                    list.Add(points[j]);
                }
                splits.Add(list);

                if ((i + 1) < points.Length)
                {
                    index = i + 1;
                    tempV2 = points[index];
                }
            }
        }
        return splits;
    }

    static MeshData getMeshData(List<Vector2> ptList)
    {
        MeshData meshData = new MeshData();

        Triangulator tr = new Triangulator(ptList);
        int[] indices = tr.Triangulate();

        // Create the Vector3 vertices
        Vector3[] vertices = new Vector3[ptList.Count];
        for (int i = 0; i < vertices.Length; i++)
        {
            vertices[i] = new Vector3(ptList[i].x, 0, ptList[i].y);
        }

        Vector3[] normals = new Vector3[vertices.Length];
        for (int i = 0; i < normals.Length; i++)
        {
            normals[i] = Vector3.up;
        }

        meshData.vertices = vertices;
        meshData.indices = indices;
        meshData.normals = normals;
        return meshData;
    }

    class MeshData
    {
        public Vector3[] vertices;
        public int[] indices;
        public Vector3[] normals;
    }

`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.