コード例 #1
0
ファイル: DimTypeList.cs プロジェクト: PDAL/CAPI
        public DimType at(uint index)
        {
            DimType type = null;

            if (!mCache.TryGetValue(index, out type))
            {
                type = new DimType(getType(mNative, index));
                mCache.Add(index, type);
            }

            return(type);
        }
コード例 #2
0
ファイル: PointLayout.cs プロジェクト: PDAL/CAPI
        public DimType FindDimType(string name)
        {
            DimType type = null;

            if (!mCache.TryGetValue(name, out type))
            {
                type = new DimType(findDimType(mNative, name));
                mCache.Add(name, type);
            }

            return(type);
        }
コード例 #3
0
        public BpcData GetBakedPointCloud()
        {
            BpcData     pc;
            ulong       size;
            PointLayout layout   = Layout;
            DimTypeList typelist = layout.Types;

            byte[]          data      = GetAllPackedPoints(typelist, out size);
            List <Vector3d> positions = new List <Vector3d>();
            List <Vector3f> colors    = new List <Vector3f>();

            uint pointSize = layout.PointSize;
            Dictionary <string, int>    indexs = new Dictionary <string, int>();
            Dictionary <string, string> types  = new Dictionary <string, string>();
            int  count    = 0;
            bool hasColor = false;

            for (uint j = 0; j < typelist.Size; j++)
            {
                DimType type = typelist.at(j);
                string  interpretationName      = type.InterpretationName;
                int     interpretationByteCount = type.InterpretationByteCount;
                string  name = type.IdName;
                indexs.Add(name, count);
                types.Add(name, interpretationName);
                if (name == "Red")
                {
                    hasColor = true;
                }
                count += interpretationByteCount;
            }

            for (long i = 0; i < (long)size; i += pointSize)
            {
                positions.Add(new Vector3d(parseDouble(data, types["X"], (int)(i + indexs["X"])),
                                           parseDouble(data, types["Y"], (int)(i + indexs["Y"])),
                                           parseDouble(data, types["Z"], (int)(i + indexs["Z"]))
                                           ));
                if (hasColor)
                {
                    colors.Add(new Vector3f((float)parseColor(data, types["Red"], (int)(i + indexs["Red"])),
                                            (float)parseColor(data, types["Green"], (int)(i + indexs["Green"])),
                                            (float)parseColor(data, types["Blue"], (int)(i + indexs["Blue"]))
                                            ));
                }
            }

            pc.positions = positions;
            pc.colors    = colors;
            pc.size      = (int)size;
            return(pc);
        }