正在显示
3 个修改的文件
包含
79 行增加
和
73 行删除
... | ... | @@ -191,8 +191,9 @@ namespace DmapCore_30 |
191 | 191 | { |
192 | 192 | unsigned char *here = (unsigned char *)PQgetvalue(res, i, 0); |
193 | 193 | unsigned char hasZorSrsid = ((unsigned char *)(here + 4))[0] / 16; |
194 | - unsigned char hasZ = hasZorSrsid / 8; | |
195 | - unsigned char hasSrsid = hasZorSrsid % 8; | |
194 | + unsigned char hasM = hasZorSrsid & 1<<2; | |
195 | + unsigned char hasZ = hasZorSrsid & 1<<3; | |
196 | + unsigned char hasSrsid = hasZorSrsid & 1<<1; | |
196 | 197 | |
197 | 198 | int not_big = here[0]; |
198 | 199 | here++; |
... | ... | @@ -275,8 +276,9 @@ namespace DmapCore_30 |
275 | 276 | { |
276 | 277 | unsigned char *here = (unsigned char *)PQgetvalue(res, i, 0); |
277 | 278 | unsigned char hasZorSrsid = ((unsigned char *)(here + 4))[0] / 16; |
278 | - unsigned char hasZ = hasZorSrsid / 8; | |
279 | - unsigned char hasSrsid = hasZorSrsid % 8; | |
279 | + unsigned char hasM = hasZorSrsid & 1<<2; | |
280 | + unsigned char hasZ = hasZorSrsid & 1<<3; | |
281 | + unsigned char hasSrsid = hasZorSrsid & 1<<1; | |
280 | 282 | |
281 | 283 | int not_big = here[0]; |
282 | 284 | here++; |
... | ... | @@ -368,8 +370,10 @@ namespace DmapCore_30 |
368 | 370 | unsigned char *here = (unsigned char *)PQgetvalue(res, i, 0); |
369 | 371 | unsigned char geom_type = (here)[1]; |
370 | 372 | unsigned char hasZorSrsid = ((unsigned char *)(here + 4))[0] / 16; |
371 | - unsigned char hasZ = hasZorSrsid / 8; | |
372 | - unsigned char hasSrsid = hasZorSrsid % 8; | |
373 | + unsigned char hasM = hasZorSrsid & 1<<2; | |
374 | + unsigned char hasZ = hasZorSrsid & 1<<3; | |
375 | + unsigned char hasSrsid = hasZorSrsid & 1<<1; | |
376 | + | |
373 | 377 | int not_big = clsUtil::ReadByte(here); |
374 | 378 | int shapetype = clsUtil::ReadInt(here, not_big); |
375 | 379 | if (hasSrsid) |
... | ... | @@ -404,11 +408,8 @@ namespace DmapCore_30 |
404 | 408 | |
405 | 409 | double x = clsUtil::ReadDouble(here, not_big); |
406 | 410 | double y = clsUtil::ReadDouble(here, not_big); |
407 | - if (hasZ) | |
408 | - { | |
409 | - //Z 值跳过 | |
410 | - here += 8; | |
411 | - } | |
411 | + if (hasZ)here += 8; | |
412 | + if (hasM) here += 8; | |
412 | 413 | double x0 = 0, y0 = 0; |
413 | 414 | this->ToScale(x, y, x0, y0); |
414 | 415 | |
... | ... | @@ -446,11 +447,8 @@ namespace DmapCore_30 |
446 | 447 | |
447 | 448 | double x = clsUtil::ReadDouble(here, not_big2); |
448 | 449 | double y = clsUtil::ReadDouble(here, not_big2); |
449 | - if (hasZ) | |
450 | - { | |
451 | - //Z 值跳过 | |
452 | - here += 8; | |
453 | - } | |
450 | + if (hasZ) here += 8; | |
451 | + if (hasM) here += 8; | |
454 | 452 | double x0 = 0, y0 = 0; |
455 | 453 | this->ToScale(x, y, x0, y0); |
456 | 454 | |
... | ... | @@ -492,8 +490,10 @@ namespace DmapCore_30 |
492 | 490 | |
493 | 491 | unsigned char *here = (unsigned char *)PQgetvalue(res, i, 0); |
494 | 492 | unsigned char hasZorSrsid = ((unsigned char *)(here + 4))[0] / 16; |
495 | - unsigned char hasZ = hasZorSrsid / 8; | |
496 | - unsigned char hasSrsid = hasZorSrsid % 8; | |
493 | + unsigned char hasM = hasZorSrsid & 1<<2; | |
494 | + unsigned char hasZ = hasZorSrsid & 1<<3; | |
495 | + unsigned char hasSrsid = hasZorSrsid & 1<<1; | |
496 | + | |
497 | 497 | int not_big = clsUtil::ReadByte(here); |
498 | 498 | int shapetype = clsUtil::ReadInt(here, not_big); |
499 | 499 | if (hasSrsid) |
... | ... | @@ -527,11 +527,8 @@ namespace DmapCore_30 |
527 | 527 | |
528 | 528 | double x = clsUtil::ReadDouble(here, not_big2); |
529 | 529 | double y = clsUtil::ReadDouble(here, not_big2); |
530 | - if (hasZ) | |
531 | - { | |
532 | - //Z 值跳过 | |
533 | - here += 8; | |
534 | - } | |
530 | + if (hasZ) here += 8; | |
531 | + if (hasM) here += 8; | |
535 | 532 | double x0 = 0, y0 = 0; |
536 | 533 | this->ToScale(x, y, x0, y0); |
537 | 534 | |
... | ... | @@ -639,8 +636,9 @@ namespace DmapCore_30 |
639 | 636 | |
640 | 637 | unsigned char geom_type = (here)[1]; |
641 | 638 | unsigned char hasZorSrsid = ((unsigned char *)(here + 4))[0] / 16; |
642 | - unsigned char hasZ = hasZorSrsid / 8; | |
643 | - unsigned char hasSrsid = hasZorSrsid % 8; | |
639 | + unsigned char hasM = hasZorSrsid & 1<<2; | |
640 | + unsigned char hasZ = hasZorSrsid & 1<<3; | |
641 | + unsigned char hasSrsid = hasZorSrsid & 1<<1; | |
644 | 642 | // printf("%d %d \r\n",i,geom_type ); |
645 | 643 | not_big1 = clsUtil::ReadByte(here); |
646 | 644 | shapetype1 = clsUtil::ReadInt(here, not_big1); |
... | ... | @@ -720,11 +718,8 @@ namespace DmapCore_30 |
720 | 718 | { |
721 | 719 | double x = clsUtil::ReadDouble(here, not_big1); |
722 | 720 | double y = clsUtil::ReadDouble(here, not_big1); |
723 | - if (hasZ) | |
724 | - { | |
725 | - //Z 值跳过 | |
726 | - here += 8; | |
727 | - } | |
721 | + if (hasZ) here += 8; | |
722 | + if (hasM) here += 8; | |
728 | 723 | double x0 = 0, y0 = 0; |
729 | 724 | this->ToScale(x, y, x0, y0); |
730 | 725 | |
... | ... | @@ -817,11 +812,8 @@ namespace DmapCore_30 |
817 | 812 | { |
818 | 813 | double x = clsUtil::ReadDouble(here, not_big2); |
819 | 814 | double y = clsUtil::ReadDouble(here, not_big2); |
820 | - if (hasZ) | |
821 | - { | |
822 | - //Z 值跳过 | |
823 | - here += 8; | |
824 | - } | |
815 | + if (hasZ) here += 8; | |
816 | + if (hasM) here += 8; | |
825 | 817 | double x0 = 0, y0 = 0; |
826 | 818 | this->ToScale(x, y, x0, y0); |
827 | 819 | |
... | ... | @@ -879,8 +871,9 @@ namespace DmapCore_30 |
879 | 871 | |
880 | 872 | unsigned char geom_type = (here)[1]; |
881 | 873 | unsigned char hasZorSrsid = ((unsigned char *)(here + 4))[0] / 16; |
882 | - unsigned char hasZ = hasZorSrsid / 8; | |
883 | - unsigned char hasSrsid = hasZorSrsid % 8; | |
874 | + unsigned char hasM = hasZorSrsid & 1<<2; | |
875 | + unsigned char hasZ = hasZorSrsid & 1<<3; | |
876 | + unsigned char hasSrsid = hasZorSrsid & 1<<1; | |
884 | 877 | |
885 | 878 | not_big1 = clsUtil::ReadByte(here); |
886 | 879 | shapetype1 = clsUtil::ReadInt(here, not_big1); |
... | ... | @@ -1008,11 +1001,8 @@ namespace DmapCore_30 |
1008 | 1001 | { |
1009 | 1002 | double x = clsUtil::ReadDouble(here, not_big2); |
1010 | 1003 | double y = clsUtil::ReadDouble(here, not_big2); |
1011 | - if (hasZ) | |
1012 | - { | |
1013 | - //Z 值跳过 | |
1014 | - here += 8; | |
1015 | - } | |
1004 | + if (hasZ) here += 8; | |
1005 | + if (hasM) here += 8; | |
1016 | 1006 | double x0 = 0, y0 = 0; |
1017 | 1007 | this->ToScale(x, y, x0, y0); |
1018 | 1008 | |
... | ... | @@ -1066,8 +1056,9 @@ namespace DmapCore_30 |
1066 | 1056 | unsigned char *here = (unsigned char *)PQgetvalue(res, i, 0); |
1067 | 1057 | unsigned char geom_type = (here)[1]; |
1068 | 1058 | unsigned char hasZorSrsid = ((unsigned char *)(here + 4))[0] / 16; |
1069 | - unsigned char hasZ = hasZorSrsid / 8; | |
1070 | - unsigned char hasSrsid = hasZorSrsid % 8; | |
1059 | + unsigned char hasM = hasZorSrsid & 1<<2; | |
1060 | + unsigned char hasZ = hasZorSrsid & 1<<3; | |
1061 | + unsigned char hasSrsid = hasZorSrsid & 1<<1; | |
1071 | 1062 | not_big1 = clsUtil::ReadByte(here); |
1072 | 1063 | shapetype1 = clsUtil::ReadInt(here, not_big1); |
1073 | 1064 | if (hasSrsid) |
... | ... | @@ -1194,11 +1185,8 @@ namespace DmapCore_30 |
1194 | 1185 | { |
1195 | 1186 | double x = clsUtil::ReadDouble(here, not_big2); |
1196 | 1187 | double y = clsUtil::ReadDouble(here, not_big2); |
1197 | - if (hasZ) | |
1198 | - { | |
1199 | - //Z 值跳过 | |
1200 | - here += 8; | |
1201 | - } | |
1188 | + if (hasZ) here += 8; | |
1189 | + if (hasM) here += 8; | |
1202 | 1190 | double x0 = 0, y0 = 0; |
1203 | 1191 | this->ToScale(x, y, x0, y0); |
1204 | 1192 | |
... | ... | @@ -1630,8 +1618,9 @@ namespace DmapCore_30 |
1630 | 1618 | shared_ptr<PointClass> DataCollection::GetDataPoint(unsigned char *vc) |
1631 | 1619 | { |
1632 | 1620 | unsigned char hasZorSrsid = ((unsigned char *)(vc + 4))[0] / 16; |
1633 | - unsigned char hasZ = hasZorSrsid / 8; | |
1634 | - unsigned char hasSrsid = hasZorSrsid % 8; | |
1621 | + unsigned char hasM = hasZorSrsid & 1<<2; | |
1622 | + unsigned char hasZ = hasZorSrsid & 1<<3; | |
1623 | + unsigned char hasSrsid = hasZorSrsid & 1<<1; | |
1635 | 1624 | |
1636 | 1625 | int not_big = clsUtil::ReadByte(vc); |
1637 | 1626 | int shapetype = clsUtil::ReadInt(vc, not_big); |
... | ... | @@ -1650,8 +1639,9 @@ namespace DmapCore_30 |
1650 | 1639 | shared_ptr<PointClass> DataCollection::GetMDataPoint(unsigned char *vc) |
1651 | 1640 | { |
1652 | 1641 | unsigned char hasZorSrsid = ((unsigned char *)(vc + 4))[0] / 16; |
1653 | - unsigned char hasZ = hasZorSrsid / 8; | |
1654 | - unsigned char hasSrsid = hasZorSrsid % 8; | |
1642 | + unsigned char hasM = hasZorSrsid & 1<<2; | |
1643 | + unsigned char hasZ = hasZorSrsid & 1<<3; | |
1644 | + unsigned char hasSrsid = hasZorSrsid & 1<<1; | |
1655 | 1645 | |
1656 | 1646 | int not_big = clsUtil::ReadByte(vc); |
1657 | 1647 | int shapetype = clsUtil::ReadInt(vc, not_big); |
... | ... | @@ -1686,8 +1676,9 @@ namespace DmapCore_30 |
1686 | 1676 | shared_ptr<PolygonClass> DataCollection::GetDataLine(unsigned char *vc) |
1687 | 1677 | { |
1688 | 1678 | unsigned char hasZorSrsid = ((unsigned char *)(vc + 4))[0] / 16; |
1689 | - unsigned char hasZ = hasZorSrsid / 8; | |
1690 | - unsigned char hasSrsid = hasZorSrsid % 8; | |
1679 | + unsigned char hasM = hasZorSrsid & 1<<2; | |
1680 | + unsigned char hasZ = hasZorSrsid & 1<<3; | |
1681 | + unsigned char hasSrsid = hasZorSrsid & 1<<1; | |
1691 | 1682 | |
1692 | 1683 | int not_big = clsUtil::ReadByte(vc); |
1693 | 1684 | int shapetype = clsUtil::ReadInt(vc, not_big); |
... | ... | @@ -1722,8 +1713,9 @@ namespace DmapCore_30 |
1722 | 1713 | double y = clsUtil::ReadDouble(vc, not_big); |
1723 | 1714 | p_polygon->vec_X.push_back(x); |
1724 | 1715 | p_polygon->vec_Y.push_back(y); |
1725 | - if (hasZ) | |
1726 | - vc += 8; | |
1716 | + if (hasZ) vc += 8; | |
1717 | + if (hasM) vc += 8; | |
1718 | + | |
1727 | 1719 | if (pol_minx > x) |
1728 | 1720 | pol_minx = x; |
1729 | 1721 | if (pol_miny > y) |
... | ... | @@ -1744,8 +1736,9 @@ namespace DmapCore_30 |
1744 | 1736 | shared_ptr<PolygonClass> DataCollection::GetDataMLine(unsigned char *vc) |
1745 | 1737 | { |
1746 | 1738 | unsigned char hasZorSrsid = ((unsigned char *)(vc + 4))[0] / 16; |
1747 | - unsigned char hasZ = hasZorSrsid / 8; | |
1748 | - unsigned char hasSrsid = hasZorSrsid % 8; | |
1739 | + unsigned char hasM = hasZorSrsid & 1<<2; | |
1740 | + unsigned char hasZ = hasZorSrsid & 1<<3; | |
1741 | + unsigned char hasSrsid = hasZorSrsid & 1<<1; | |
1749 | 1742 | |
1750 | 1743 | int not_big = clsUtil::ReadByte(vc); |
1751 | 1744 | int shapetype = clsUtil::ReadInt(vc, not_big); |
... | ... | @@ -1782,8 +1775,8 @@ namespace DmapCore_30 |
1782 | 1775 | double y = clsUtil::ReadDouble(vc, not_big2); |
1783 | 1776 | p_polygon->vec_X.push_back(x); |
1784 | 1777 | p_polygon->vec_Y.push_back(y); |
1785 | - if (hasZ) | |
1786 | - vc += 8; | |
1778 | + if (hasZ) vc += 8; | |
1779 | + if (hasM) vc += 8; | |
1787 | 1780 | if (pol_minx > x) |
1788 | 1781 | pol_minx = x; |
1789 | 1782 | if (pol_miny > y) |
... | ... | @@ -1807,8 +1800,9 @@ namespace DmapCore_30 |
1807 | 1800 | try |
1808 | 1801 | { |
1809 | 1802 | unsigned char hasZorSrsid = ((unsigned char *)(here + 4))[0] / 16; |
1810 | - unsigned char hasZ = hasZorSrsid / 8; | |
1811 | - unsigned char hasSrsid = hasZorSrsid % 8; | |
1803 | + unsigned char hasM = hasZorSrsid & 1<<2; | |
1804 | + unsigned char hasZ = hasZorSrsid & 1<<3; | |
1805 | + unsigned char hasSrsid = hasZorSrsid & 1<<1; | |
1812 | 1806 | //bool hasZ = false; |
1813 | 1807 | int not_big1, not_big2, shapetype1, nring, npoint; |
1814 | 1808 | not_big1 = clsUtil::ReadByte(here); |
... | ... | @@ -1842,8 +1836,8 @@ namespace DmapCore_30 |
1842 | 1836 | { |
1843 | 1837 | double x = clsUtil::ReadDouble(here, not_big1); |
1844 | 1838 | double y = clsUtil::ReadDouble(here, not_big1); |
1845 | - if (hasZ) | |
1846 | - here += 8; | |
1839 | + if (hasZ) here += 8; | |
1840 | + if (hasM) here += 8; | |
1847 | 1841 | p_polygon->vec_X.push_back(x); |
1848 | 1842 | p_polygon->vec_Y.push_back(y); |
1849 | 1843 | |
... | ... | @@ -1886,8 +1880,9 @@ namespace DmapCore_30 |
1886 | 1880 | try |
1887 | 1881 | { |
1888 | 1882 | unsigned char hasZorSrsid = ((unsigned char *)(here + 4))[0] / 16; |
1889 | - unsigned char hasZ = hasZorSrsid / 8; | |
1890 | - unsigned char hasSrsid = hasZorSrsid % 8; | |
1883 | + unsigned char hasM = hasZorSrsid & 1<<2; | |
1884 | + unsigned char hasZ = hasZorSrsid & 1<<3; | |
1885 | + unsigned char hasSrsid = hasZorSrsid & 1<<1; | |
1891 | 1886 | |
1892 | 1887 | unsigned char geom_type = (here)[1]; |
1893 | 1888 | |
... | ... | @@ -1947,8 +1942,8 @@ namespace DmapCore_30 |
1947 | 1942 | { |
1948 | 1943 | double x = clsUtil::ReadDouble(here, not_big2); |
1949 | 1944 | double y = clsUtil::ReadDouble(here, not_big2); |
1950 | - if (hasZ) | |
1951 | - here += 8; | |
1945 | + if (hasZ) here += 8; | |
1946 | + if (hasM) here += 8; | |
1952 | 1947 | p_polygon->vec_X.push_back(x); |
1953 | 1948 | p_polygon->vec_Y.push_back(y); |
1954 | 1949 | ... | ... |
... | ... | @@ -19,9 +19,10 @@ namespace mapserver |
19 | 19 | unsigned char hasZorSrsid = ((unsigned char *)(pwkb + 4))[0] / 16; |
20 | 20 | |
21 | 21 | unsigned char type = ((unsigned char *)(pwkb + 1))[0]; |
22 | - this->hasZ_ = hasZorSrsid / 8; | |
23 | - this->hasSrid_ = hasZorSrsid % 8; | |
24 | - | |
22 | + | |
23 | + this->hasSrid_ = hasZorSrsid & 1<<1; | |
24 | + this->hasM_ = hasZorSrsid & 1<<2; | |
25 | + this->hasZ_ =hasZorSrsid & 1<<3; | |
25 | 26 | |
26 | 27 | notbig_ = this->ReadByte(pwkb); |
27 | 28 | int shape = this->ReadInt(pwkb, notbig_); |
... | ... | @@ -40,7 +41,11 @@ namespace mapserver |
40 | 41 | // case DmpWkbTypes::Type::PointZM: |
41 | 42 | { |
42 | 43 | sstream << R"({"type":"Point","coordinates": [)"; |
43 | - readPointfromWKB(pwkb,sstream); | |
44 | + double xx = this->ReadDouble(pwkb,notbig_); | |
45 | + double yy = this->ReadDouble(pwkb,notbig_); | |
46 | + | |
47 | + sstream << ToDoubleStr(xx) << "," << ToDoubleStr(yy) ; | |
48 | + | |
44 | 49 | break; |
45 | 50 | } |
46 | 51 | |
... | ... | @@ -136,6 +141,11 @@ namespace mapserver |
136 | 141 | pwkb += 8; |
137 | 142 | // double zz = this->ReadDouble(pwkb,notbig_); |
138 | 143 | } |
144 | + if(hasM_) | |
145 | + { | |
146 | + pwkb += 8; | |
147 | + // double zz = this->ReadDouble(pwkb,notbig_); | |
148 | + } | |
139 | 149 | return true; |
140 | 150 | } |
141 | 151 | ... | ... |
请
注册
或
登录
后发表评论