| 63 | } |
| 64 | |
| 65 | BOOL LASwritePoint::setup(const U32 num_items, const LASitem* items, const LASzip* laszip) |
| 66 | { |
| 67 | U32 i; |
| 68 | |
| 69 | // is laszip exists then we must use its items |
| 70 | if (laszip) |
| 71 | { |
| 72 | if (num_items == 0) return FALSE; |
| 73 | if (items == 0) return FALSE; |
| 74 | if (num_items != laszip->num_items) return FALSE; |
| 75 | if (items != laszip->items) return FALSE; |
| 76 | } |
| 77 | |
| 78 | // create entropy encoder (if requested) |
| 79 | enc = 0; |
| 80 | if (laszip && laszip->compressor) |
| 81 | { |
| 82 | switch (laszip->coder) |
| 83 | { |
| 84 | case LASZIP_CODER_ARITHMETIC: |
| 85 | enc = new ArithmeticEncoder(); |
| 86 | break; |
| 87 | default: |
| 88 | // entropy decoder not supported |
| 89 | return FALSE; |
| 90 | } |
| 91 | // maybe layered compression for LAS 1.4 |
| 92 | layered_las14_compression = (laszip->compressor == LASZIP_COMPRESSOR_LAYERED_CHUNKED); |
| 93 | } |
| 94 | |
| 95 | // initizalize the writers |
| 96 | writers = 0; |
| 97 | num_writers = num_items; |
| 98 | |
| 99 | // disable chunking |
| 100 | chunk_size = U32_MAX; |
| 101 | |
| 102 | // always create the raw writers |
| 103 | writers_raw = new LASwriteItem*[num_writers]; |
| 104 | memset(writers_raw, 0, num_writers*sizeof(LASwriteItem*)); |
| 105 | for (i = 0; i < num_writers; i++) |
| 106 | { |
| 107 | switch (items[i].type) |
| 108 | { |
| 109 | case LASitem::POINT10: |
| 110 | if (Endian::IS_LITTLE_ENDIAN) |
| 111 | writers_raw[i] = new LASwriteItemRaw_POINT10_LE(); |
| 112 | else |
| 113 | writers_raw[i] = new LASwriteItemRaw_POINT10_BE(); |
| 114 | break; |
| 115 | case LASitem::GPSTIME11: |
| 116 | if (Endian::IS_LITTLE_ENDIAN) |
| 117 | writers_raw[i] = new LASwriteItemRaw_GPSTIME11_LE(); |
| 118 | else |
| 119 | writers_raw[i] = new LASwriteItemRaw_GPSTIME11_BE(); |
| 120 | break; |
| 121 | case LASitem::RGB12: |
| 122 | case LASitem::RGB14: |
nothing calls this directly
no outgoing calls
no test coverage detected