diff --git a/cmake/unix_compiler_options.cmake b/cmake/unix_compiler_options.cmake index f8445f25d1..94d3bf4e71 100644 --- a/cmake/unix_compiler_options.cmake +++ b/cmake/unix_compiler_options.cmake @@ -27,8 +27,8 @@ function(pdal_target_compile_settings target) -Wpointer-arith -Wcast-align -Wcast-qual - -Wno-error=cast-qual -Wno-error=parentheses + -Wno-error=cast-qual -Wredundant-decls -Wno-unused-parameter diff --git a/cmake/win32_compiler_options.cmake b/cmake/win32_compiler_options.cmake index 19f1d1d11b..22689001e3 100644 --- a/cmake/win32_compiler_options.cmake +++ b/cmake/win32_compiler_options.cmake @@ -15,7 +15,6 @@ function(pdal_target_compile_settings target) -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNING -D_SCL_SECURE_NO_WARNINGS - -DNOMINMAX ) target_compile_options(${target} PRIVATE # Nitro makes use of Exception Specifications, which results in diff --git a/doc/download.rst b/doc/download.rst index 8d4be09b57..6bc583cc7a 100644 --- a/doc/download.rst +++ b/doc/download.rst @@ -13,29 +13,24 @@ Download Current Release(s) ------------------------------------------------------------------------------ -* **2018-04-06** `PDAL-1.7.1-src.tar.gz`_ `Release Notes`_ (`md5`_) +* **2018-05-13** `PDAL-1.7.2-src.tar.gz`_ `Release Notes`_ (`md5`_) -.. _`Release Notes`: https://github.com/PDAL/PDAL/releases/tag/1.7.1 - -.. _`PDAL-1.7.1-src.tar.gz`: http://download.osgeo.org/pdal/PDAL-1.7.1-src.tar.gz -.. _`md5`: http://download.osgeo.org/pdal/PDAL-1.7.1-src.tar.gz.md5 -.. _`DebianGIS`: http://wiki.debian.org/DebianGis +.. _`PDAL-1.7.2-src.tar.gz`: http://download.osgeo.org/pdal/PDAL-1.7.2-src.tar.gz +.. _`Release Notes`: https://github.com/PDAL/PDAL/releases/tag/1.7.2 +.. _`md5`: http://download.osgeo.org/pdal/PDAL-1.7.2-src.tar.gz.md5 Past Releases ------------------------------------------------------------------------------ +* **2018-04-06** `PDAL-1.7.1-src.tar.gz`_ * **2018-04-05** `PDAL-1.7.0-src.tar.gz`_ * **2017-10-12** `PDAL-1.6.0-src.tar.gz`_ -* **2017-04-06** `PDAL-1.5.0-src.tar.gz`_ -* **2016-12-15** `PDAL-1.4.0-src.tar.gz`_ +.. _`PDAL-1.7.1-src.tar.gz`: http://download.osgeo.org/pdal/PDAL-1.7.1-src.tar.gz .. _`PDAL-1.7.0-src.tar.gz`: http://download.osgeo.org/pdal/PDAL-1.7.0-src.tar.gz .. _`PDAL-1.6.0-src.tar.gz`: http://download.osgeo.org/pdal/PDAL-1.6.0-src.tar.gz -.. _`PDAL-1.5.0-src.tar.gz`: http://download.osgeo.org/pdal/PDAL-1.5.0-src.tar.gz -.. _`PDAL-1.4.0-src.tar.gz`: http://download.osgeo.org/pdal/PDAL-1.4.0-src.tar.gz - .. _source: @@ -43,17 +38,48 @@ Past Releases Development Source ------------------------------------------------------------------------------ -The main repository for PDAL is located on github at https://github.com/PDAL/PDAL +The main repository for PDAL is located on github at +https://github.com/PDAL/PDAL. -You can obtain a copy of the active source code by issuing the following command:: +You can obtain a copy of the active source code by issuing the following +command - git clone https://github.com/PDAL/PDAL.git pdal +:: + git clone https://github.com/PDAL/PDAL.git pdal Binaries ------------------------------------------------------------------------------ +In this section we list a number of the binary distributions of PDAL. The table +below is intended to provide an overview of some of the differences between the +various distributions, as not all features can be enabled in every +distribution. This table only summarizes the differences between distributions, +and there are several plugins that are not built for any of the distributions. +These include Delaunay, GeoWave, MATLAB, MBIO, MRSID, OpenSceneGraph, RDBLIB, +and RiVLib. To enable any of these plugins, the reader will need to install any +required dependencies and build PDAL from source. + +.. csv-table:: PDAL Distribution Feature Comparison + :header: "", "Docker", "OSGeo4W", "RPMs", "Debian", "Alpine", "Conda" + :widths: 20, 20, 20, 20, 20, 20, 20 + + "Platform(s)", "linux", "win", "linux", "linux", "linux", "win, mac, linux" + "CPD", "X", "", "", "", "X", "" + "Greyhound", "X", "X", "", "X", "X", "X" + "Hexbin", "X", "X", "X", "", "X", "X" + "Icebridge", "X", "", "X", "X", "X", "X" + "laszip", "X", "X", "X", "", "X", "X" + "laz-perf", "X", "X", "", "", "X", "X" + "NITF", "X", "X", "", "", "X", "X" + "OCI", "", "X", "", "", "", "" + "PCL", "", "", "X", "", "", "X" + "pgpointcloud", "X", "X", "X", "X", "X", "X" + "Python", "X", "X", "", "X", "X", "X" + "SQLite", "X", "X", "", "X", "X", "X" + + Docker ................................................................................ @@ -62,27 +88,104 @@ The fastest way to get going with PDAL is to use the Docker build. See the :: - docker pull pdal/pdal:1.6 + docker pull pdal/pdal:1.7 Windows ................................................................................ -Windows builds are available via OSGeo4W (64-bit only). -See the :ref:`workshop-osgeo4w` page for more detailed information. +Windows builds are available via `OSGeo4W`_ (64-bit only). See the +:ref:`workshop-osgeo4w` page for more detailed information. +.. _`OSGeo4W`: http://trac.osgeo.org/osgeo4w/ RPMs ................................................................................ -RPMs for PDAL are available at https://copr.fedorainfracloud.org/coprs/neteler/pdal/ +RPMs for PDAL are available at +https://copr.fedorainfracloud.org/coprs/neteler/pdal/. + Debian ................................................................................ Debian packages are now available on `Debian Unstable`_. -.. _`OSGeo4W`: http://trac.osgeo.org/osgeo4w/ .. _`Debian Unstable`: https://tracker.debian.org/pkg/pdal -.. _`LASzip`: http://laszip.org + + +Alpine +................................................................................ + +`Alpine`_ is a linux distribution that is compact and frequently used with +Docker images. Alpine packages for PDAL are available at +https://pkgs.alpinelinux.org/packages?name=*pdal*&branch=edge. + +Users have a choice of three separate packages. + +1. ``pdal`` will install the PDAL binaries only, and is suitable for users who +will be using the PDAL command line applications. + +2. ``pdal-dev`` will install development files which are required for users +building their own software that will link against PDAL. + +3. ``py-pdal`` will install the PDAL Python extension. + +Note that all of these packages reside in Alpine's ``edge/testing`` repository, +which must be added to your Alpine repositories list. Information on adding and +updating repositories can be found in the Alpine documentation. + +To install one or more packages on Alpine, use the following command. + +:: + + apk add [package...] + +For example, the following command will install both the PDAL application and +the Python extension. + +:: + + apk add py-pdal pdal + +.. _`Alpine Linux`: https://www.alpinelinux.org/ + + +Conda +................................................................................ + +`Conda`_ can be used on multiple platforms (Windows, macOS, and Linux) to +install software packages and manage environments. Conda packages for PDAL are +available at https://anaconda.org/conda-forge/pdal. + +Conda installation instructions can be found on the Conda website. The +instructions below assuming you have a working Conda installation on your +system. + +Users have a choice of two separate packages. + +1. ``pdal`` will install the PDAL binaries **and** development files. + +2. ``python-pdal`` will install the PDAL Python extension. + +To install one or more Conda packages, use the following command. + +:: + + conda install [-c channel] [package...] + +Because the PDAL package (and it's dependencies) live in the `conda-forge`_ +channel, the command to install both the PDAL application and the Python +extension is + +:: + + conda install -c conda-forge pdal python-pdal + +It is strongly recommended that you make use of Conda's environment management +system and install PDAL in a separate environment (i.e., not the base +environment). Instructions can be found on the Conda website. + +.. _`Conda`: https://conda.io/docs/ +.. _`conda-forge`: https://conda-forge.org/ diff --git a/doc/stages/writers.pgpointcloud.rst b/doc/stages/writers.pgpointcloud.rst index a4153502bd..3d5423751e 100644 --- a/doc/stages/writers.pgpointcloud.rst +++ b/doc/stages/writers.pgpointcloud.rst @@ -34,7 +34,7 @@ Example { "type":"filters.chipper", "capacity":400 - } + }, { "type":"writers.pgpointcloud", "connection":"host='localhost' dbname='lidar' user='pramsey'", diff --git a/doc/workshop/Makefile b/doc/workshop/Makefile new file mode 100644 index 0000000000..929eb01951 --- /dev/null +++ b/doc/workshop/Makefile @@ -0,0 +1,228 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +PAPER = +BUILDDIR = _build + +# User-friendly check for sphinx-build +ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) +$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) +endif + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . +# the i18n builder cannot share the environment and doctrees with the others +I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . + +.PHONY: help +help: + @echo "Please use \`make ' where is one of" + @echo " html to make standalone HTML files" + @echo " dirhtml to make HTML files named index.html in directories" + @echo " singlehtml to make a single large HTML file" + @echo " pickle to make pickle files" + @echo " json to make JSON files" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " qthelp to make HTML files and a qthelp project" + @echo " applehelp to make an Apple Help Book" + @echo " devhelp to make HTML files and a Devhelp project" + @echo " epub to make an epub" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " latexpdf to make LaTeX files and run them through pdflatex" + @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" + @echo " text to make text files" + @echo " man to make manual pages" + @echo " texinfo to make Texinfo files" + @echo " info to make Texinfo files and run them through makeinfo" + @echo " gettext to make PO message catalogs" + @echo " changes to make an overview of all changed/added/deprecated items" + @echo " xml to make Docutils-native XML files" + @echo " pseudoxml to make pseudoxml-XML files for display purposes" + @echo " linkcheck to check all external links for integrity" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" + @echo " coverage to run coverage check of the documentation (if enabled)" + +.PHONY: clean +clean: + rm -rf $(BUILDDIR)/* + +.PHONY: html +html: + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + +.PHONY: dirhtml +dirhtml: + $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." + +.PHONY: singlehtml +singlehtml: + $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml + @echo + @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." + +.PHONY: pickle +pickle: + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle + @echo + @echo "Build finished; now you can process the pickle files." + +.PHONY: json +json: + $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json + @echo + @echo "Build finished; now you can process the JSON files." + +.PHONY: htmlhelp +htmlhelp: + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in $(BUILDDIR)/htmlhelp." + +.PHONY: qthelp +qthelp: + $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp + @echo + @echo "Build finished; now you can run "qcollectiongenerator" with the" \ + ".qhcp project file in $(BUILDDIR)/qthelp, like this:" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/PDALUNAVCOShortCourse.qhcp" + @echo "To view the help file:" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/PDALUNAVCOShortCourse.qhc" + +.PHONY: applehelp +applehelp: + $(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp + @echo + @echo "Build finished. The help book is in $(BUILDDIR)/applehelp." + @echo "N.B. You won't be able to view it unless you put it in" \ + "~/Library/Documentation/Help or install it in your application" \ + "bundle." + +.PHONY: devhelp +devhelp: + $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp + @echo + @echo "Build finished." + @echo "To view the help file:" + @echo "# mkdir -p $$HOME/.local/share/devhelp/PDALUNAVCOShortCourse" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/PDALUNAVCOShortCourse" + @echo "# devhelp" + +.PHONY: epub +epub: + $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub + @echo + @echo "Build finished. The epub file is in $(BUILDDIR)/epub." + +.PHONY: latex +latex: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo + @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." + @echo "Run \`make' in that directory to run these through (pdf)latex" \ + "(use \`make latexpdf' here to do that automatically)." + +.PHONY: latexpdf +latexpdf: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through pdflatex..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +.PHONY: latexpdfja +latexpdfja: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through platex and dvipdfmx..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +.PHONY: text +text: + $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text + @echo + @echo "Build finished. The text files are in $(BUILDDIR)/text." + +.PHONY: man +man: + $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man + @echo + @echo "Build finished. The manual pages are in $(BUILDDIR)/man." + +.PHONY: texinfo +texinfo: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo + @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." + @echo "Run \`make' in that directory to run these through makeinfo" \ + "(use \`make info' here to do that automatically)." + +.PHONY: info +info: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo "Running Texinfo files through makeinfo..." + make -C $(BUILDDIR)/texinfo info + @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." + +.PHONY: gettext +gettext: + $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale + @echo + @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." + +.PHONY: changes +changes: + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes + @echo + @echo "The overview file is in $(BUILDDIR)/changes." + +.PHONY: linkcheck +linkcheck: + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in $(BUILDDIR)/linkcheck/output.txt." + +.PHONY: doctest +doctest: + $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest + @echo "Testing of doctests in the sources finished, look at the " \ + "results in $(BUILDDIR)/doctest/output.txt." + +.PHONY: coverage +coverage: + $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage + @echo "Testing of coverage in the sources finished, look at the " \ + "results in $(BUILDDIR)/coverage/python.txt." + +.PHONY: xml +xml: + $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml + @echo + @echo "Build finished. The XML files are in $(BUILDDIR)/xml." + +.PHONY: pseudoxml +pseudoxml: + $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml + @echo + @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." + +.PHONY: pdf +pdf: + $(SPHINXBUILD) -b pdf $(ALLSPHINXOPTS) $(BUILDDIR)/pdf + @echo + @echo "Build finished. The PDF files are in $(BUILDDIR)/pdf." + +.PHONY: slides +slides: + cd slides; make slides; + @echo + @echo "Build finished. The slides are in ./slides/build/slides." diff --git a/doc/workshop/conf.py b/doc/workshop/conf.py index 85e931337e..f77cfb5528 100644 --- a/doc/workshop/conf.py +++ b/doc/workshop/conf.py @@ -34,7 +34,7 @@ 'sphinxcontrib.bibtex', ] -today='July 25th, 2017' +today='May 17th, 2018' docstitle='Home' intersphinx_mapping = {'pdal': ('https://pdal.io/', None)} @@ -55,7 +55,7 @@ # General information about the project. project = u'Point Cloud Processing and Analysis with PDAL' -copyright = u'2017, Howard Butler, Pete Gadomski, Dr. Craig Glennie' +copyright = u'2018, Howard Butler, Pete Gadomski, Dr. Craig Glennie' author = u'Howard Butler, Pete Gadomski, Dr. Craig Glennie' # The version info for the project you're documenting, acts as replacement for @@ -246,7 +246,7 @@ # Latex figure (float) alignment 'figure_align': 'htbp', -'releasename':'07/25/2017', +'releasename':'05/17/2018', # 'tocdepth':3, } diff --git a/doc/workshop/index.rst b/doc/workshop/index.rst index eff1ba35a6..59be53eb9a 100644 --- a/doc/workshop/index.rst +++ b/doc/workshop/index.rst @@ -7,7 +7,7 @@ Point Cloud Processing and Analysis with PDAL :Author: Pete Gadomski :Author: Dr. Craig Glennie :Contact: howard@hobu.co -:Date: 07/25/2017 +:Date: 05/17/2018 .. include:: ./includes/substitutions.rst diff --git a/doc/workshop/slides/source/introduction.rst b/doc/workshop/slides/source/introduction.rst index c52492672e..139cf250a5 100644 --- a/doc/workshop/slides/source/introduction.rst +++ b/doc/workshop/slides/source/introduction.rst @@ -8,10 +8,6 @@ Order of business * PDF http://pdal.io/PDAL.pdf * Links everywhere -Guinea Pigs -================================================================================ - - .. image:: ./img/guinea.gif Goals ================================================================================ @@ -27,8 +23,7 @@ Who are we ================================================================================ * Howard Butler -* Connor Manning -* Rick Brown +* Michael Smith Howard Butler @@ -41,20 +36,13 @@ Howard Butler .. _`Hobu, Inc.`: http://hobu.co -Connor Manning +Michael Smith ================================================================================ -* Works @ `Hobu, Inc.`_ -* Develops Entwine https://entwine.io -* Develops Greyhound http://greyhound.io -* Tweets @ http://twitter.com/csmannin - -Rick Brown -================================================================================ - -* Works here! -* LiDAR data processing and management -* Entwine with Connor Manning +* Physical Research Scientist, USACE CRREL +* Develops open source GIS and LiDAR software +* Commits over 15 years +* Tweets @ http://twitter.com/michael_smith Next ================================================================================ diff --git a/doc/workshop/slides/source/rasterization.rst b/doc/workshop/slides/source/rasterization.rst new file mode 100644 index 0000000000..025aace960 --- /dev/null +++ b/doc/workshop/slides/source/rasterization.rst @@ -0,0 +1,76 @@ +.. _rasterization: + +Rasterizing Attributes +================================================================================ + + +.. include:: ../../includes/substitutions.rst + + + +Purpose: + * Utilize :ref:`readers.greyhound` + * Interpolate data (Intensity, Classification) + * Use `gdaldem`_ to apply color ramps + * Explore :ref:`writers.gdal` options + + +:ref:`Rasterization Workshop Materials ` + +.. _`gdaldem`: http://www.gdal.org/gdaldem.html + + + +:ref:`readers.greyhound` +================================================================================ + + .. literalinclude:: ../../exercises/analysis/rasterize/classification.json + + +:ref:`pdal pipeline ` +================================================================================ + +.. literalinclude:: ../../exercises/analysis/rasterize/classify-command.txt + + +Yuck +================================================================================ + +.. image:: ../../images/rasterization-denmark-no-ramp.png + :scale: 200% + + +Color Ramp +================================================================================ + +.. literalinclude:: ../../exercises/analysis/rasterize/ramp.txt + + +`gdaldem`_ +================================================================================ + +.. literalinclude:: ../../exercises/analysis/rasterize/gdaldem-run-command.txt + +Better +================================================================================ + +.. image:: ../../images/rasterization-colored-classification.png + :scale: 200% + +Intensity +================================================================================ + +.. literalinclude:: ../../exercises/analysis/rasterize/intensity-run-command.txt + :linenos: + +Intensity Image +================================================================================ + +.. image:: ../../images/rasterization-colored-intensity.png + :scale: 200% + + +Home +================================================================================ +:ref:`Home ` + diff --git a/doc/workshop/slides/source/software.rst b/doc/workshop/slides/source/software.rst index 7160da5b8f..81e699cb49 100644 --- a/doc/workshop/slides/source/software.rst +++ b/doc/workshop/slides/source/software.rst @@ -5,24 +5,22 @@ Software installation .. include:: ../../includes/substitutions.rst -(Done for you already) +1. :ref:`workshop-osgeo4w` + * Install PDAL via OSGeo4W64 -.. 1. :ref:`Docker ` - * Run PDAL and GDAL command line applications - -.. 2. :ref:`QGIS` +2. :ref:`QGIS` * Visualize vector and raster data -.. 3. `QT Reader`_ +3. `QT Reader`_ * Visualize point cloud data -.. 4. `Fugro Viewer`_ +4. `Fugro Viewer`_ * Visualize point cloud data -.. 5. http://plas.io +5. http://plas.io * Visualize point cloud data -.. 6. `CloudCompare`_ +6. `CloudCompare`_ * Visualize point cloud data .. _`QT Reader`: http://appliedimagery.com/download/ @@ -32,13 +30,20 @@ Software installation Data installation ================================================================================ -1. Copy entire contents: +1. Copy entire contents of USB or data download: :: - C:\Users\Howard\PDAL + C:\Users\hobu\PDAL + +:: + https://s3.amazonaws.com/pdal/workshop/PDAL.zip + +Path Substitution +================================================================================ +My username is ``hobu``, yours probably isn't. Next ================================================================================ diff --git a/examples/writing-reader/MyReader.cpp b/examples/writing-reader/MyReader.cpp index 5896075999..a9b30403e5 100644 --- a/examples/writing-reader/MyReader.cpp +++ b/examples/writing-reader/MyReader.cpp @@ -62,7 +62,7 @@ namespace pdal m_stream.reset(new ILeStream(m_filename)); size_t HEADERSIZE(1); - size_t skip_lines(std::max(HEADERSIZE, (size_t)m_index)); + size_t skip_lines((std::max)(HEADERSIZE, (size_t)m_index)); size_t line_no(1); for (std::string line; std::getline(*m_stream->stream(), line); line_no++) { diff --git a/filters/ClusterFilter.cpp b/filters/ClusterFilter.cpp index 8769eba419..bd3ae39d94 100644 --- a/filters/ClusterFilter.cpp +++ b/filters/ClusterFilter.cpp @@ -60,7 +60,7 @@ void ClusterFilter::addArgs(ProgramArgs& args) args.add("min_points", "Min points per cluster", m_minPoints, static_cast(1)); args.add("max_points", "Max points per cluster", m_maxPoints, - std::numeric_limits::max()); + (std::numeric_limits::max)()); args.add("tolerance", "Radius", m_tolerance, 1.0); } diff --git a/filters/DecimationFilter.cpp b/filters/DecimationFilter.cpp index 4f707ea87a..cb8f391290 100644 --- a/filters/DecimationFilter.cpp +++ b/filters/DecimationFilter.cpp @@ -57,7 +57,7 @@ void DecimationFilter::addArgs(ProgramArgs& args) args.add("offset", "Index of first point to consider including in output", m_offset); args.add("limit", "Index of last point to consider including in output", - m_limit, std::numeric_limits::max()); + m_limit, (std::numeric_limits::max)()); } PointViewSet DecimationFilter::run(PointViewPtr inView) @@ -84,7 +84,7 @@ bool DecimationFilter::processOne(PointRef& point) void DecimationFilter::decimate(PointView& input, PointView& output) { - PointId last_idx = std::min(m_limit, input.size()); + PointId last_idx = (std::min)(m_limit, input.size()); for (PointId idx = m_offset; idx < last_idx; idx += m_step) output.appendPoint(input, idx); } diff --git a/filters/GreedyProjection.cpp b/filters/GreedyProjection.cpp index 0ac04fb6b3..890d0b0b51 100644 --- a/filters/GreedyProjection.cpp +++ b/filters/GreedyProjection.cpp @@ -135,7 +135,7 @@ void GreedyProjection::filter(PointView& view) const double sqr_mu = mu_ * mu_; const double sqr_max_edge = search_radius_*search_radius_; - nnn_ = (int)std::min((point_count_t)nnn_, view.size()); + nnn_ = (int)(std::min)((point_count_t)nnn_, view.size()); // Variables to hold the results of nearest neighbor searches std::vector nnIdx(nnn_); diff --git a/filters/HeadFilter.hpp b/filters/HeadFilter.hpp index 79ac537da6..b6fcc09298 100644 --- a/filters/HeadFilter.hpp +++ b/filters/HeadFilter.hpp @@ -66,7 +66,7 @@ class PDAL_DLL HeadFilter : public Filter << ") exceeds number of available points.\n"; PointViewSet viewSet; PointViewPtr outView = view->makeNew(); - for (PointId i = 0; i < std::min(m_count, view->size()); ++i) + for (PointId i = 0; i < (std::min)(m_count, view->size()); ++i) outView->appendPoint(*view, i); viewSet.insert(outView); return viewSet; diff --git a/filters/LOFFilter.cpp b/filters/LOFFilter.cpp index 0dad6f805d..20259adcec 100644 --- a/filters/LOFFilter.cpp +++ b/filters/LOFFilter.cpp @@ -109,7 +109,7 @@ void LOFFilter::filter(PointView& view) for (PointId j = 0; j < indices.size(); ++j) { double k = view.getFieldAs(m_kdist, indices[j]); - double reachdist = std::max(k, std::sqrt(sqr_dists[j])); + double reachdist = (std::max)(k, std::sqrt(sqr_dists[j])); M1 += (reachdist - M1) / ++n; } view.setField(m_lrd, i, 1.0 / M1); diff --git a/filters/LocateFilter.cpp b/filters/LocateFilter.cpp index 58de188d0a..322cbc2c12 100644 --- a/filters/LocateFilter.cpp +++ b/filters/LocateFilter.cpp @@ -76,7 +76,7 @@ PointViewSet LocateFilter::run(PointViewPtr inView) return viewSet; PointId minidx, maxidx; - double minval = std::numeric_limits::max(); + double minval = (std::numeric_limits::max)(); double maxval = std::numeric_limits::lowest(); for (PointId idx = 0; idx < inView->size(); idx++) diff --git a/filters/MongusFilter.cpp b/filters/MongusFilter.cpp index 2179713736..77701f7349 100644 --- a/filters/MongusFilter.cpp +++ b/filters/MongusFilter.cpp @@ -143,7 +143,7 @@ std::vector MongusFilter::processGround(PointViewPtr view) cy.setConstant(std::numeric_limits::quiet_NaN()); MatrixXd cz(m_numRows, m_numCols); - cz.setConstant(std::numeric_limits::max()); + cz.setConstant((std::numeric_limits::max)()); // find initial set of Z minimums at native resolution for (point_count_t i = 0; i < np; ++i) @@ -250,7 +250,7 @@ std::vector MongusFilter::processGround(PointViewPtr view) double sum = 0.0; double maxcoeff = std::numeric_limits::lowest(); - double mincoeff = std::numeric_limits::max(); + double mincoeff = (std::numeric_limits::max)(); for (auto i = 0; i < R.size(); ++i) { if (std::isnan(R(i))) @@ -322,7 +322,7 @@ std::vector MongusFilter::processGround(PointViewPtr view) sum = 0.0; maxcoeff = std::numeric_limits::lowest(); - mincoeff = std::numeric_limits::max(); + mincoeff = (std::numeric_limits::max)(); for (auto i = 0; i < M.size(); ++i) { if (std::isnan(M(i))) @@ -477,13 +477,13 @@ void MongusFilter::downsampleMin(Eigen::MatrixXd *cx, Eigen::MatrixXd *cy, dcy->setConstant(std::numeric_limits::quiet_NaN()); dcz->resize(nr, nc); - dcz->setConstant(std::numeric_limits::max()); + dcz->setConstant((std::numeric_limits::max)()); for (auto c = 0; c < cz->cols(); ++c) { for (auto r = 0; r < cz->rows(); ++r) { - if ((*cz)(r, c) == std::numeric_limits::max()) + if ((*cz)(r, c) == (std::numeric_limits::max)()) continue; int rr = std::floor(r/cell_size); diff --git a/filters/SMRFilter.cpp b/filters/SMRFilter.cpp index adbaefbab5..bffbbf0556 100644 --- a/filters/SMRFilter.cpp +++ b/filters/SMRFilter.cpp @@ -615,7 +615,7 @@ std::vector SMRFilter::progressiveFilter(std::vector const& ZImin, return (x > threshold) ? int(1) : int(0); }); std::transform(Obj.begin(), Obj.end(), foo.begin(), Obj.begin(), - [](int a, int b) { return std::max(a, b); }); + [](int a, int b) { return (std::max)(a, b); }); // "The algorithm then proceeds to the next window radius (up to the // maximum), and proceeds as above with the last opened surface acting diff --git a/filters/TailFilter.hpp b/filters/TailFilter.hpp index 7527f3fe5c..d7786765e6 100644 --- a/filters/TailFilter.hpp +++ b/filters/TailFilter.hpp @@ -66,7 +66,7 @@ class PDAL_DLL TailFilter : public Filter << ") exceeds number of available points.\n"; PointViewSet viewSet; PointViewPtr outView = view->makeNew(); - for (PointId i = view->size() - std::min(m_count, view->size()); + for (PointId i = view->size() - (std::min)(m_count, view->size()); i < view->size(); ++i) outView->appendPoint(*view, i); viewSet.insert(outView); diff --git a/filters/private/DimRange.cpp b/filters/private/DimRange.cpp index 3e5e97ba7a..f18797c515 100644 --- a/filters/private/DimRange.cpp +++ b/filters/private/DimRange.cpp @@ -95,7 +95,7 @@ std::string::size_type DimRange::subParse(const std::string& r) start = r.data() + pos; ub = std::strtod(start, &end); if (start == end) - ub = std::numeric_limits::max(); + ub = (std::numeric_limits::max)(); pos += (end - start); count = Utils::extractSpaces(r, pos); @@ -159,7 +159,7 @@ std::ostream& operator<<(std::ostream& out, const DimRange& r) if (r.m_lower_bound != std::numeric_limits::lowest()) out << r.m_lower_bound; out << ':'; - if (r.m_upper_bound != std::numeric_limits::max()) + if (r.m_upper_bound != (std::numeric_limits::max)()) out << r.m_upper_bound; out << (r.m_inclusive_upper_bound ? ']' : ')'); return out; diff --git a/filters/private/pnp/GridPnp.hpp b/filters/private/pnp/GridPnp.hpp index b818ff74cd..3248501a3a 100644 --- a/filters/private/pnp/GridPnp.hpp +++ b/filters/private/pnp/GridPnp.hpp @@ -197,10 +197,10 @@ class GridPnp const Point& p2 = outer[id + 1]; // Calculate bounding box. - m_xMin = std::min(m_xMin, xval(p1)); - m_xMax = std::max(m_xMax, xval(p1)); - m_yMin = std::min(m_yMin, yval(p1)); - m_yMax = std::max(m_yMax, yval(p1)); + m_xMin = (std::min)(m_xMin, xval(p1)); + m_xMax = (std::max)(m_xMax, xval(p1)); + m_yMin = (std::min)(m_yMin, yval(p1)); + m_yMax = (std::max)(m_yMax, yval(p1)); } } @@ -272,7 +272,7 @@ class GridPnp // I'm setting a minmum number of cells as 1000, because, why not? // m_rings isn't necessarily an exact count of edges, but it's close // enough for this purpose. - size_t m = std::max((size_t)1000, m_rings.size()); + size_t m = (std::max)((size_t)1000, m_rings.size()); // See paper for this calc. double scalex = ((m_xMax - m_xMin) * yAvgLen) / diff --git a/io/BpfHeader.cpp b/io/BpfHeader.cpp index d12ed82f44..97d870326d 100644 --- a/io/BpfHeader.cpp +++ b/io/BpfHeader.cpp @@ -373,7 +373,7 @@ bool BpfUlemFile::write(OLeStream& stream) char buf[MAX_BLOCKSIZE]; while (len) { - uint32_t blocksize = std::min(MAX_BLOCKSIZE, len); + uint32_t blocksize = (std::min)(MAX_BLOCKSIZE, len); in.read(buf, blocksize); stream.put(buf, blocksize); len -= blocksize; diff --git a/io/BpfReader.cpp b/io/BpfReader.cpp index c3a8d158b8..9f02962aeb 100644 --- a/io/BpfReader.cpp +++ b/io/BpfReader.cpp @@ -563,7 +563,7 @@ point_count_t BpfReader::readByteMajor(PointViewPtr data, point_count_t count) uint32_t u32; }; std::unique_ptr uArr( - new uu[std::min(count, numPoints() - m_index)]); + new uu[(std::min)(count, numPoints() - m_index)]); for (size_t d = 0; d < m_dims.size(); ++d) { diff --git a/io/BpfWriter.cpp b/io/BpfWriter.cpp index 0b7f2c1ebb..69399476ab 100644 --- a/io/BpfWriter.cpp +++ b/io/BpfWriter.cpp @@ -353,8 +353,8 @@ double BpfWriter::getAdjustedValue(const PointView* data, BpfDimension& bpfDim, PointId idx) { double d = data->getFieldAs(bpfDim.m_id, idx); - bpfDim.m_min = std::min(bpfDim.m_min, d); - bpfDim.m_max = std::max(bpfDim.m_max, d); + bpfDim.m_min = (std::min)(bpfDim.m_min, d); + bpfDim.m_max = (std::max)(bpfDim.m_max, d); if (bpfDim.m_id == Dimension::Id::X) d /= m_scaling.m_xXform.m_scale.m_val; diff --git a/io/GDALGrid.cpp b/io/GDALGrid.cpp index 2b01dfa871..182ecd6208 100644 --- a/io/GDALGrid.cpp +++ b/io/GDALGrid.cpp @@ -48,12 +48,12 @@ GDALGrid::GDALGrid(size_t width, size_t height, double edgeLength, m_width(width), m_height(height), m_windowSize(windowSize), m_edgeLength(edgeLength), m_radius(radius), m_outputTypes(outputTypes) { - if (width > std::numeric_limits::max() || - height > std::numeric_limits::max()) + if (width > (std::numeric_limits::max)() || + height > (std::numeric_limits::max)()) { std::ostringstream oss; oss << "Grid width or height is too large. Width and height are " - "limited to " << std::numeric_limits::max() << " cells." + "limited to " << (std::numeric_limits::max)() << " cells." "Try setting bounds or increasing resolution."; throw error(oss.str()); } @@ -61,7 +61,7 @@ GDALGrid::GDALGrid(size_t width, size_t height, double edgeLength, m_count.reset(new DataVec(size)); if (m_outputTypes & statMin) - m_min.reset(new DataVec(size, std::numeric_limits::max())); + m_min.reset(new DataVec(size, (std::numeric_limits::max)())); if (m_outputTypes & statMax) m_max.reset(new DataVec(size, std::numeric_limits::lowest())); if (m_outputTypes & statIdw) @@ -119,7 +119,7 @@ void GDALGrid::expand(size_t width, size_t height, size_t xshift, size_t yshift) moveVec(m_count, 0); if (m_outputTypes & statMin) - moveVec(m_min, std::numeric_limits::max()); + moveVec(m_min, (std::numeric_limits::max)()); if (m_outputTypes & statMax) moveVec(m_max, std::numeric_limits::lowest()); if (m_outputTypes & statIdw) @@ -211,8 +211,8 @@ void GDALGrid::addPoint(double x, double y, double z) int i, j; int iStart, jStart; // First quadrant; - i = iStart = std::max(0, iOrigin + 1); - j = std::min(jOrigin, int(m_height - 1)); + i = iStart = (std::max)(0, iOrigin + 1); + j = (std::min)(jOrigin, int(m_height - 1)); while (i < (int)m_width && j >= 0) { double d = distance(i, j, x, y); @@ -231,8 +231,8 @@ void GDALGrid::addPoint(double x, double y, double z) } // Second quadrant; - i = std::min(iOrigin, int(m_width - 1)); - j = jStart = std::min(jOrigin - 1, int(m_height - 1)); + i = (std::min)(iOrigin, int(m_width - 1)); + j = jStart = (std::min)(jOrigin - 1, int(m_height - 1)); while (i >= 0 && j >= 0) { double d = distance(i, j, x, y); @@ -251,8 +251,8 @@ void GDALGrid::addPoint(double x, double y, double z) } // Third quadrant; - i = iStart = std::min(iOrigin - 1, int(m_width - 1)); - j = std::max(jOrigin, 0); + i = iStart = (std::min)(iOrigin - 1, int(m_width - 1)); + j = (std::max)(jOrigin, 0); while (i >= 0 && j < (int)m_height) { double d = distance(i, j, x, y); @@ -270,8 +270,8 @@ void GDALGrid::addPoint(double x, double y, double z) } } // Fourth quadrant; - i = std::max(iOrigin, 0); - j = jStart = std::max(jOrigin + 1, 0); + i = (std::max)(iOrigin, 0); + j = jStart = (std::max)(jOrigin + 1, 0); while (i < (int)m_width && j < (int)m_height) { double d = distance(i, j, x, y); @@ -318,13 +318,13 @@ void GDALGrid::update(size_t i, size_t j, double val, double dist) if (m_min) { double& min = (*m_min)[offset]; - min = std::min(val, min); + min = (std::min)(val, min); } if (m_max) { double& max = (*m_max)[offset]; - max = std::max(val, max); + max = (std::max)(val, max); } if (m_mean) @@ -410,9 +410,9 @@ void GDALGrid::fillNodata(size_t i) void GDALGrid::windowFill(size_t dstI, size_t dstJ) { size_t istart = dstI > m_windowSize ? dstI - m_windowSize : (size_t)0; - size_t iend = std::min(width(), dstI + m_windowSize + 1); + size_t iend = (std::min)(width(), dstI + m_windowSize + 1); size_t jstart = dstJ > m_windowSize ? dstJ - m_windowSize : (size_t)0; - size_t jend = std::min(height(), dstJ + m_windowSize + 1); + size_t jend = (std::min)(height(), dstJ + m_windowSize + 1); double distSum = 0; size_t dstIdx = index(dstI, dstJ); @@ -432,7 +432,7 @@ void GDALGrid::windowFill(size_t dstI, size_t dstJ) continue; // The ternaries just avoid underflow UB. We're just trying to // find the distance from j to dstJ or i to dstI. - double distance = (double)std::max(j > dstJ ? j - dstJ : dstJ - j, + double distance = (double)(std::max)(j > dstJ ? j - dstJ : dstJ - j, i > dstI ? i - dstI : dstI - i); windowFillCell(srcIdx, dstIdx, distance); distSum += (1 / distance); diff --git a/io/GDALReader.cpp b/io/GDALReader.cpp index 83380bc976..d37635d3d2 100644 --- a/io/GDALReader.cpp +++ b/io/GDALReader.cpp @@ -128,7 +128,7 @@ void GDALReader::ready(PointTableRef table) point_count_t GDALReader::read(PointViewPtr view, point_count_t num) { - point_count_t count = std::min(num, m_count - m_index); + point_count_t count = (std::min)(num, m_count - m_index); PointId nextId = view->size(); std::array coords; diff --git a/io/HeaderVal.hpp b/io/HeaderVal.hpp index af4feb3c63..fa6cb08e44 100644 --- a/io/HeaderVal.hpp +++ b/io/HeaderVal.hpp @@ -61,7 +61,7 @@ virtual void print(const std::string& s) }; template ::lowest(), - T MAX = std::numeric_limits::max()> + T MAX = (std::numeric_limits::max)()> class NumHeaderVal : public BaseHeaderVal { public: @@ -160,7 +160,7 @@ class StringHeaderVal : public BaseHeaderVal m_valSet = true; m_val = val; if (LEN > 0) - m_val.resize(std::min(m_val.length(), LEN)); + m_val.resize((std::min)(m_val.length(), LEN)); return (LEN == 0 || val.length() <= LEN); } diff --git a/io/LasHeader.cpp b/io/LasHeader.cpp index d0199bd183..a843b7808a 100644 --- a/io/LasHeader.cpp +++ b/io/LasHeader.cpp @@ -435,7 +435,7 @@ OLeStream& operator<<(OLeStream& out, const LasHeader& h) for (size_t i = 0; i < LasHeader::LEGACY_RETURN_COUNT; ++i) { - uint32_t legacyReturnCount = std::min(h.m_pointCountByReturn[i], + uint32_t legacyReturnCount = (std::min)(h.m_pointCountByReturn[i], (uint64_t)(std::numeric_limits::max)()); out << legacyReturnCount; } diff --git a/io/LasReader.cpp b/io/LasReader.cpp index aa945b1614..13cb7a87b1 100644 --- a/io/LasReader.cpp +++ b/io/LasReader.cpp @@ -115,7 +115,7 @@ QuickInfo LasReader::inspect() for (auto di = dims.begin(); di != dims.end(); ++di) qi.m_dimNames.push_back(layout->dimName(*di)); if (!Utils::numericCast(m_header.pointCount(), qi.m_pointCount)) - qi.m_pointCount = std::numeric_limits::max(); + qi.m_pointCount = (std::numeric_limits::max)(); qi.m_bounds = m_header.getBounds(); qi.m_srs = getSpatialReference(); qi.m_valid = true; @@ -619,7 +619,7 @@ bool LasReader::processOne(PointRef& point) point_count_t LasReader::read(PointViewPtr view, point_count_t count) { size_t pointLen = m_header.pointLen(); - count = std::min(count, getNumPoints() - m_index); + count = (std::min)(count, getNumPoints() - m_index); PointId i = 0; if (m_header.compressed()) @@ -646,8 +646,7 @@ point_count_t LasReader::read(PointViewPtr view, point_count_t count) point_count_t remaining = count; // Make a buffer at most a meg. - size_t bufsize = std::min((point_count_t)1000000, - count * pointLen); + size_t bufsize = (std::min)((point_count_t)1000000, count * pointLen); std::vector buf(bufsize); try { @@ -686,7 +685,7 @@ point_count_t LasReader::readFileBlock(std::vector& buf, size_t ptLen = m_header.pointLen(); point_count_t blockpoints = buf.size() / ptLen; - blockpoints = std::min(maxpoints, blockpoints); + blockpoints = (std::min)(maxpoints, blockpoints); if (stream->eof()) throw invalid_stream("stream is done"); diff --git a/io/LasWriter.cpp b/io/LasWriter.cpp index 436243e678..adb2ddf97b 100644 --- a/io/LasWriter.cpp +++ b/io/LasWriter.cpp @@ -36,8 +36,18 @@ #include #ifdef PDAL_HAVE_LAZPERF +#pragma push_macro("min") +#pragma push_macro("max") +#ifdef min +#undef min +#endif +#ifdef max +#undef max +#endif #include #include +#pragma pop_macro("max") +#pragma pop_macro("min") #endif #include "LasWriter.hpp" @@ -834,7 +844,7 @@ void LasWriter::writeView(const PointViewPtr view) else { // Make a buffer of at most a meg. - m_pointBuf.resize(std::min((point_count_t)1000000, + m_pointBuf.resize((std::min)((point_count_t)1000000, pointLen * view->size())); const PointView& viewRef(*view.get()); @@ -1123,7 +1133,7 @@ point_count_t LasWriter::fillWriteBuf(const PointView& view, PointId startId, std::vector& buf) { point_count_t blocksize = buf.size() / m_lasHeader.pointLen(); - blocksize = std::min(blocksize, view.size() - startId); + blocksize = (std::min)(blocksize, view.size() - startId); PointId lastId = startId + blocksize; LeInserter ostream(buf.data(), buf.size()); diff --git a/io/LasWriter.hpp b/io/LasWriter.hpp index 610cd4244e..a5b17bc0f4 100644 --- a/io/LasWriter.hpp +++ b/io/LasWriter.hpp @@ -111,7 +111,7 @@ class PDAL_DLL LasWriter : public FlexWriter, public Streamable NumHeaderVal m_majorVersion; NumHeaderVal m_minorVersion; NumHeaderVal m_dataformatId; - // MSVC doesn't see numeric_limits::max() as constexpr do doesn't allow + // MSVC doesn't see numeric_limits::max() as constexpr so doesn't allow // it as defaults for templates. Remove when possible. NumHeaderVal m_filesourceId; NumHeaderVal m_globalEncoding; diff --git a/io/OptechReader.cpp b/io/OptechReader.cpp index 764f7cbf9f..bbd883a382 100644 --- a/io/OptechReader.cpp +++ b/io/OptechReader.cpp @@ -239,8 +239,8 @@ point_count_t OptechReader::read(PointViewPtr data, size_t OptechReader::fillBuffer() { - size_t numRecords = std::min(m_header.numRecords - m_recordIndex, - MaxNumRecordsInBuffer); + size_t numRecords = (std::min)(m_header.numRecords - m_recordIndex, + MaxNumRecordsInBuffer); buffer_size_t bufferSize = NumBytesInRecord * numRecords; m_buffer.resize(bufferSize); diff --git a/io/PlyWriter.cpp b/io/PlyWriter.cpp index 949726c3ff..5b352df719 100644 --- a/io/PlyWriter.cpp +++ b/io/PlyWriter.cpp @@ -143,9 +143,9 @@ void PlyWriter::writeHeader(PointLayoutPtr layout) const void PlyWriter::ready(PointTableRef table) { - if (pointCount() > std::numeric_limits::max()) + if (pointCount() > (std::numeric_limits::max)()) throwError("Can't write PLY file. Only " + - std::to_string(std::numeric_limits::max()) + + std::to_string((std::numeric_limits::max)()) + " points supported."); m_stream = Utils::createFile(m_filename, true); diff --git a/io/QfitReader.cpp b/io/QfitReader.cpp index 69a157a01e..0b39aaef71 100644 --- a/io/QfitReader.cpp +++ b/io/QfitReader.cpp @@ -327,7 +327,7 @@ point_count_t QfitReader::read(PointViewPtr data, point_count_t count) if (m_istream->stream()->eof()) throwError("End of file detected."); - count = std::min(m_numPoints - m_index, count); + count = (std::min)(m_numPoints - m_index, count); std::vector buf(m_size); PointId nextId = data->size(); point_count_t numRead = 0; diff --git a/io/TerrasolidReader.cpp b/io/TerrasolidReader.cpp index 591e5e371c..f8555143aa 100644 --- a/io/TerrasolidReader.cpp +++ b/io/TerrasolidReader.cpp @@ -142,7 +142,7 @@ void TerrasolidReader::ready(PointTableRef) point_count_t TerrasolidReader::read(PointViewPtr view, point_count_t count) { - count = std::min(count, getNumPoints() - m_index); + count = (std::min)(count, getNumPoints() - m_index); std::vector buf(m_size * count); m_istream->get(buf); diff --git a/pdal/ArtifactManager.hpp b/pdal/ArtifactManager.hpp index aedd5c5ed2..69e286b5b4 100644 --- a/pdal/ArtifactManager.hpp +++ b/pdal/ArtifactManager.hpp @@ -37,6 +37,7 @@ #include #include #include +#include #include @@ -82,6 +83,14 @@ class ArtifactManager return (m_storage.find(name) != m_storage.end()); } + std::vector keys() const + { + std::vector ks; + for (auto e : m_storage) + ks.push_back(e.first); + return ks; + } + template std::shared_ptr get(const std::string& name) { diff --git a/pdal/DimUtil.hpp b/pdal/DimUtil.hpp index 1a8e72eef5..9ba6788850 100644 --- a/pdal/DimUtil.hpp +++ b/pdal/DimUtil.hpp @@ -103,7 +103,7 @@ inline BaseType base(Type t) return BaseType(Utils::toNative(t) & 0xFF00); } -static const int COUNT = std::numeric_limits::max(); +static const int COUNT = (std::numeric_limits::max)(); static const int PROPRIETARY = 0xF000; /// Get a string reresentation of a datatype. diff --git a/pdal/EigenUtils.cpp b/pdal/EigenUtils.cpp index 7dd30a909c..52a5b018ca 100644 --- a/pdal/EigenUtils.cpp +++ b/pdal/EigenUtils.cpp @@ -366,7 +366,7 @@ Eigen::MatrixXd matrixClose(Eigen::MatrixXd data, int radius) int ncols = data2.cols(); MatrixXd minZ(nrows, ncols); - minZ.setConstant(std::numeric_limits::max()); + minZ.setConstant((std::numeric_limits::max)()); MatrixXd maxZ(nrows, ncols); maxZ.setConstant(std::numeric_limits::lowest()); for (auto c = 0; c < ncols; ++c) @@ -427,7 +427,7 @@ Eigen::MatrixXd matrixOpen(Eigen::MatrixXd data, int radius) int ncols = data2.cols(); MatrixXd minZ(nrows, ncols); - minZ.setConstant(std::numeric_limits::max()); + minZ.setConstant((std::numeric_limits::max)()); MatrixXd maxZ(nrows, ncols); maxZ.setConstant(std::numeric_limits::lowest()); for (auto c = 0; c < ncols; ++c) @@ -514,7 +514,7 @@ std::vector dilateDiamond(std::vector data, size_t rows, size_t std::vector erodeDiamond(std::vector data, size_t rows, size_t cols, int iterations) { - std::vector out(data.size(), std::numeric_limits::max()); + std::vector out(data.size(), (std::numeric_limits::max)()); std::vector idx(5); for (int iter = 0; iter < iterations; ++iter) diff --git a/pdal/KDIndex.hpp b/pdal/KDIndex.hpp index 6897a410a2..a3c1bee2f7 100644 --- a/pdal/KDIndex.hpp +++ b/pdal/KDIndex.hpp @@ -121,7 +121,7 @@ class PDAL_DLL KD2Index : public KDIndex<2> std::vector neighbors(double x, double y, point_count_t k) { - k = std::min(m_buf.size(), k); + k = (std::min)(m_buf.size(), k); std::vector output(k); std::vector out_dist_sqr(k); nanoflann::KNNResultSet resultSet(k); @@ -154,7 +154,7 @@ class PDAL_DLL KD2Index : public KDIndex<2> void knnSearch(double x, double y, point_count_t k, std::vector *indices, std::vector *sqr_dists) { - k = std::min(m_buf.size(), k); + k = (std::min)(m_buf.size(), k); nanoflann::KNNResultSet resultSet(k); resultSet.init(&indices->front(), &sqr_dists->front()); @@ -247,7 +247,7 @@ class PDAL_DLL KD3Index : public KDIndex<3> std::vector neighbors(double x, double y, double z, point_count_t k) { - k = std::min(m_buf.size(), k); + k = (std::min)(m_buf.size(), k); std::vector output(k); std::vector out_dist_sqr(k); nanoflann::KNNResultSet resultSet(k); @@ -283,7 +283,7 @@ class PDAL_DLL KD3Index : public KDIndex<3> void knnSearch(double x, double y, double z, point_count_t k, std::vector *indices, std::vector *sqr_dists) { - k = std::min(m_buf.size(), k); + k = (std::min)(m_buf.size(), k); nanoflann::KNNResultSet resultSet(k); resultSet.init(&indices->front(), &sqr_dists->front()); diff --git a/pdal/PDALUtils.cpp b/pdal/PDALUtils.cpp index d5043551fd..68c95bda37 100644 --- a/pdal/PDALUtils.cpp +++ b/pdal/PDALUtils.cpp @@ -394,7 +394,7 @@ double computeHausdorff(PointViewPtr srcView, PointViewPtr candView) maxDistSrcToCand = std::sqrt(maxDistSrcToCand); maxDistCandToSrc = std::sqrt(maxDistCandToSrc); - return std::max(maxDistSrcToCand, maxDistCandToSrc); + return (std::max)(maxDistSrcToCand, maxDistCandToSrc); } } // namespace Utils diff --git a/pdal/PluginDirectory.cpp b/pdal/PluginDirectory.cpp index c609a387ba..6a52906275 100644 --- a/pdal/PluginDirectory.cpp +++ b/pdal/PluginDirectory.cpp @@ -45,12 +45,12 @@ namespace #if defined(__APPLE__) && defined(__MACH__) static const std::string dynamicLibraryExtension(".dylib"); static const char pathSeparator(':'); -#elif defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__) || defined(__GNU__) - static const std::string dynamicLibraryExtension(".so"); - static const char pathSeparator(':'); #elif defined _WIN32 static const std::string dynamicLibraryExtension(".dll"); static const char pathSeparator(';'); +#else + static const std::string dynamicLibraryExtension(".so"); + static const char pathSeparator(':'); #endif StringList pluginSearchPaths() diff --git a/pdal/PointLayout.cpp b/pdal/PointLayout.cpp index 4b15ab3924..f09bdfdebc 100644 --- a/pdal/PointLayout.cpp +++ b/pdal/PointLayout.cpp @@ -288,7 +288,7 @@ Dimension::Type PointLayout::resolveType(Dimension::Type t1, if (t1 == t2) return t1; if (base(t1) == base(t2)) - return std::max(t1, t2); + return (std::max)(t1, t2); //Prefer floating to non-floating. if (base(t1) == BaseType::Floating && base(t2) != BaseType::Floating) return t1; @@ -301,7 +301,7 @@ Dimension::Type PointLayout::resolveType(Dimension::Type t1, if (base(t2) == BaseType::Unsigned && size(t2) < size(t1)) return t1; // Signed type is smaller or the the sizes are equal. - switch (std::max(size(t1), size(t2))) + switch ((std::max)(size(t1), size(t2))) { case 1: return Type::Signed16; diff --git a/pdal/QuadIndex.cpp b/pdal/QuadIndex.cpp index 893bcf5d8a..c641a30370 100644 --- a/pdal/QuadIndex.cpp +++ b/pdal/QuadIndex.cpp @@ -46,17 +46,18 @@ namespace struct BBox { - BBox(Point min, Point max) - : min(min) - , max(max) - , center(min.x + (max.x - min.x) / 2, min.y + (max.y - min.y) / 2) - , halfWidth(center.x - min.x) - , halfHeight(center.y - min.y) + BBox(Point minimum, Point maximum) + : minimum(minimum) + , maximum(maximum) + , center(minimum.x + (maximum.x - minimum.x) / 2, + minimum.y + (maximum.y - minimum.y) / 2) + , halfWidth(center.x - minimum.x) + , halfHeight(center.y - minimum.y) { } BBox(const BBox& other) - : min(other.min) - , max(other.max) + : minimum(other.minimum) + , maximum(other.maximum) , center(other.center) , halfWidth(other.halfWidth) , halfHeight(other.halfHeight) @@ -88,11 +89,12 @@ namespace // Returns true if the requested point is contained within this BBox. bool contains(const Point& p) const { - return p.x >= min.x && p.y >= min.y && p.x < max.x && p.y < max.y; + return p.x >= minimum.x && p.y >= minimum.y && + p.x < maximum.x && p.y < maximum.y; } - const Point min; - const Point max; + const Point minimum; + const Point maximum; // Pre-calculate these properties, rather than exposing functions to // calculate them on-demand, due to the large number of times that @@ -193,7 +195,7 @@ std::size_t Tree::addPoint(const QuadPointRef* toAdd, const std::size_t curDepth { sw.reset(new Tree( BBox( - Point(bbox.min.x, bbox.min.y), + Point(bbox.minimum.x, bbox.minimum.y), Point(center.x, center.y)), toAdd)); @@ -210,8 +212,8 @@ std::size_t Tree::addPoint(const QuadPointRef* toAdd, const std::size_t curDepth { nw.reset(new Tree( BBox( - Point(bbox.min.x, center.y), - Point(center.x, bbox.max.y)), + Point(bbox.minimum.x, center.y), + Point(center.x, bbox.maximum.y)), toAdd)); return nextDepth; @@ -230,8 +232,8 @@ std::size_t Tree::addPoint(const QuadPointRef* toAdd, const std::size_t curDepth { se.reset(new Tree( BBox( - Point(center.x, bbox.min.y), - Point(bbox.max.x, center.y)), + Point(center.x, bbox.minimum.y), + Point(bbox.maximum.x, center.y)), toAdd)); return nextDepth; @@ -248,7 +250,7 @@ std::size_t Tree::addPoint(const QuadPointRef* toAdd, const std::size_t curDepth ne.reset(new Tree( BBox( Point(center.x, center.y), - Point(bbox.max.x, bbox.max.y)), + Point(bbox.maximum.x, bbox.maximum.y)), toAdd)); return nextDepth; @@ -550,10 +552,10 @@ QuadIndex::QImpl::QImpl(const PointView& view, std::size_t topLevel) { m_pointRefVec.resize(view.size()); - double xMin(std::numeric_limits::max()); - double yMin(std::numeric_limits::max()); - double xMax(std::numeric_limits::min()); - double yMax(std::numeric_limits::min()); + double xMin((std::numeric_limits::max)()); + double yMin((std::numeric_limits::max)()); + double xMax((std::numeric_limits::min)()); + double yMax((std::numeric_limits::min)()); for (PointId i(0); i < view.size(); ++i) { @@ -575,7 +577,7 @@ QuadIndex::QImpl::QImpl(const PointView& view, std::size_t topLevel) for (std::size_t i = 0; i < m_pointRefVec.size(); ++i) { - m_depth = std::max(m_tree->addPoint(m_pointRefVec[i].get()), m_depth); + m_depth = (std::max)(m_tree->addPoint(m_pointRefVec[i].get()), m_depth); } } @@ -608,7 +610,7 @@ QuadIndex::QImpl::QImpl( for (std::size_t i = 0; i < m_pointRefVec.size(); ++i) { - m_depth = std::max(m_tree->addPoint(m_pointRefVec[i].get()), m_depth); + m_depth = (std::max)(m_tree->addPoint(m_pointRefVec[i].get()), m_depth); } } @@ -630,7 +632,7 @@ QuadIndex::QImpl::QImpl( for (std::size_t i = 0; i < points.size(); ++i) { m_pointRefVec[i] = points[i]; - m_depth = std::max(m_tree->addPoint(m_pointRefVec[i].get()), m_depth); + m_depth = (std::max)(m_tree->addPoint(m_pointRefVec[i].get()), m_depth); } } @@ -642,10 +644,10 @@ void QuadIndex::QImpl::getBounds( { if (m_tree) { - xMin = m_tree->bbox.min.x; - yMin = m_tree->bbox.min.y; - xMax = m_tree->bbox.max.x; - yMax = m_tree->bbox.max.y; + xMin = m_tree->bbox.minimum.x; + yMin = m_tree->bbox.minimum.y; + xMax = m_tree->bbox.maximum.x; + yMax = m_tree->bbox.maximum.y; } } @@ -692,17 +694,18 @@ std::vector QuadIndex::QImpl::getPoints( if (m_tree) { const std::size_t exp(std::pow(2, rasterize)); - const double xWidth(m_tree->bbox.max.x - m_tree->bbox.min.x); - const double yWidth(m_tree->bbox.max.y - m_tree->bbox.min.y); + const double xWidth(m_tree->bbox.maximum.x - m_tree->bbox.minimum.x); + const double yWidth(m_tree->bbox.maximum.y - m_tree->bbox.minimum.y); xStep = xWidth / exp; yStep = yWidth / exp; - xBegin = m_tree->bbox.min.x + (xStep / 2); - yBegin = m_tree->bbox.min.y + (yStep / 2); - xEnd = m_tree->bbox.max.x + (xStep / 2); // One tick past the end. - yEnd = m_tree->bbox.max.y + (yStep / 2); + xBegin = m_tree->bbox.minimum.x + (xStep / 2); + yBegin = m_tree->bbox.minimum.y + (yStep / 2); + // One tick past the end. + xEnd = m_tree->bbox.maximum.x + (xStep / 2); + yEnd = m_tree->bbox.maximum.y + (yStep / 2); - results.resize(exp * exp, std::numeric_limits::max()); + results.resize(exp * exp, (std::numeric_limits::max)()); m_tree->getPoints( results, @@ -733,7 +736,7 @@ std::vector QuadIndex::QImpl::getPoints( { const std::size_t width (Utils::sround((xEnd - xBegin) / xStep)); const std::size_t height(Utils::sround((yEnd - yBegin) / yStep)); - results.resize(width * height, std::numeric_limits::max()); + results.resize(width * height, (std::numeric_limits::max)()); m_tree->getPoints( results, @@ -764,8 +767,8 @@ std::vector QuadIndex::QImpl::getPoints( m_tree->getPoints( results, BBox( - Point(std::min(xMin, xMax), std::min(yMin, yMax)), - Point(std::max(xMin, xMax), std::max(yMin, yMax))), + Point((std::min)(xMin, xMax), (std::min)(yMin, yMax)), + Point((std::max)(xMin, xMax), (std::max)(yMin, yMax))), minDepth, maxDepth, m_topLevel); diff --git a/pdal/Reader.cpp b/pdal/Reader.cpp index f7fde70289..ac1720a3b5 100644 --- a/pdal/Reader.cpp +++ b/pdal/Reader.cpp @@ -42,7 +42,7 @@ void Reader::readerAddArgs(ProgramArgs& args) { m_filenameArg = &args.add("filename", "Name of file to read", m_filename); m_countArg = &args.add("count", "Maximum number of points read", m_count, - std::numeric_limits::max()); + (std::numeric_limits::max)()); } } // namespace pdal diff --git a/pdal/Scaling.cpp b/pdal/Scaling.cpp index f1aa9ec3a5..6971ffeee4 100644 --- a/pdal/Scaling.cpp +++ b/pdal/Scaling.cpp @@ -75,20 +75,20 @@ void Scaling::setAutoXForm(const PointViewPtr view) if (xmod) { double x = view->getFieldAs(Dimension::Id::X, idx); - xmin = std::min(x, xmin); - xmax = std::max(x, xmax); + xmin = (std::min)(x, xmin); + xmax = (std::max)(x, xmax); } if (ymod) { double y = view->getFieldAs(Dimension::Id::Y, idx); - ymin = std::min(y, ymin); - ymax = std::max(y, ymax); + ymin = (std::min)(y, ymin); + ymax = (std::max)(y, ymax); } if (zmod) { double z = view->getFieldAs(Dimension::Id::Z, idx); - zmin = std::min(z, zmin); - zmax = std::max(z, zmax); + zmin = (std::min)(z, zmin); + zmax = (std::max)(z, zmax); } } diff --git a/pdal/Streamable.cpp b/pdal/Streamable.cpp index d2e7e7a6a4..beb2415f68 100644 --- a/pdal/Streamable.cpp +++ b/pdal/Streamable.cpp @@ -123,6 +123,7 @@ void Streamable::execute(StreamPointTable& table) // As an example, if there are four paths from the end stage (writer) to // reader stages, there will be four stage lists and execute(table, stages) // will be called four times. + SrsMap srsMap; Streamable *s = this; stages.push_front(s); while (true) @@ -134,7 +135,7 @@ void Streamable::execute(StreamPointTable& table) (lastRunStages - stages).done(table); // Call ready on all the stages we didn't run last time. (stages - lastRunStages).ready(table); - execute(table, stages); + execute(table, stages, srsMap); lastRunStages = stages; } else @@ -159,12 +160,11 @@ void Streamable::execute(StreamPointTable& table) void Streamable::execute(StreamPointTable& table, - std::list& stages) + std::list& stages, SrsMap& srsMap) { std::vector skips(table.capacity()); std::list filters; SpatialReference srs; - std::map srsMap; // Separate out the first stage. Streamable *reader = stages.front(); diff --git a/pdal/Streamable.hpp b/pdal/Streamable.hpp index 3a1dc6ec3e..6324c1ba61 100644 --- a/pdal/Streamable.hpp +++ b/pdal/Streamable.hpp @@ -75,7 +75,10 @@ class PDAL_DLL Streamable : public virtual Stage Streamable& operator=(const Streamable&) = delete; Streamable(const Streamable&); // not implemented - void execute(StreamPointTable& table, std::list& stages); + using SrsMap = std::map; + + void execute(StreamPointTable& table, std::list& stages, + SrsMap& srsMap); /** Process a single point (streaming mode). Implement in sublcass. diff --git a/pdal/compression/LazPerfCompression.cpp b/pdal/compression/LazPerfCompression.cpp index ed0fa16c92..984f4cb6e8 100644 --- a/pdal/compression/LazPerfCompression.cpp +++ b/pdal/compression/LazPerfCompression.cpp @@ -34,6 +34,15 @@ #include +#pragma push_macro("min") +#pragma push_macro("max") +#ifdef min +#undef min +#endif +#ifdef max +#undef max +#endif + #include #include #include @@ -44,6 +53,9 @@ #include #include +#pragma pop_macro("max") +#pragma pop_macro("min") + #include "LazPerfCompression.hpp" namespace pdal @@ -116,7 +128,7 @@ class LazPerfCompressorImpl { while (bufsize) { - size_t copyCnt = std::min(m_avail, bufsize); + size_t copyCnt = (std::min)(m_avail, bufsize); std::copy(buf, buf + copyCnt, m_tmpbuf + (CHUNKSIZE - m_avail)); m_avail -= copyCnt; if (m_avail == 0) @@ -214,7 +226,7 @@ class LazPerfDecompressorImpl void getBytes(uint8_t *dst, size_t dstsize) { - size_t count = std::min(dstsize, m_srcsize); + size_t count = (std::min)(dstsize, m_srcsize); uint8_t *src = const_cast( reinterpret_cast(m_srcbuf)); std::copy(src, src + count, dst); diff --git a/pdal/compression/LazPerfVlrCompression.cpp b/pdal/compression/LazPerfVlrCompression.cpp index 428277302b..225fff5b2b 100644 --- a/pdal/compression/LazPerfVlrCompression.cpp +++ b/pdal/compression/LazPerfVlrCompression.cpp @@ -32,6 +32,15 @@ * OF SUCH DAMAGE. ****************************************************************************/ +#pragma push_macro("min") +#pragma push_macro("max") +#ifdef min +#undef min +#endif +#ifdef max +#undef max +#endif + #include #include #include @@ -42,6 +51,9 @@ #include #include +#pragma pop_macro("max") +#pragma pop_macro("min") + #include "LazPerfVlrCompression.hpp" namespace pdal diff --git a/pdal/compression/LzmaCompression.cpp b/pdal/compression/LzmaCompression.cpp index 1377ac7877..e557a484d1 100644 --- a/pdal/compression/LzmaCompression.cpp +++ b/pdal/compression/LzmaCompression.cpp @@ -139,7 +139,7 @@ class LzmaDecompressorImpl : public Lzma public: LzmaDecompressorImpl(BlockCb cb) : Lzma(cb) { - if (lzma_auto_decoder(&m_strm, std::numeric_limits::max(), + if (lzma_auto_decoder(&m_strm, (std::numeric_limits::max)(), LZMA_TELL_UNSUPPORTED_CHECK)) throw compression_error("Can't create decompressor"); } diff --git a/pdal/util/Utils.cpp b/pdal/util/Utils.cpp index 24fd630171..0eed64d561 100644 --- a/pdal/util/Utils.cpp +++ b/pdal/util/Utils.cpp @@ -506,7 +506,7 @@ StringList Utils::wordWrap2(std::string const& s, size_t lineLength, size_t startPos = 0; while (true) { - size_t endPos = std::min(startPos + len - 1, s.size() - 1); + size_t endPos = (std::min)(startPos + len - 1, s.size() - 1); if (endPos + 1 == s.size()) { pushWord(startPos, endPos); @@ -627,7 +627,7 @@ std::vector Utils::backtrace() prefix = std::to_string(i) + " ???"; trimTrailing(prefix); prefixes.push_back(prefix); - maxPrefix = std::max(prefix.size(), maxPrefix); + maxPrefix = (std::max)(prefix.size(), maxPrefix); } free(symbols); diff --git a/pdal/util/Utils.hpp b/pdal/util/Utils.hpp index f0530a73c2..f6e4535f11 100644 --- a/pdal/util/Utils.hpp +++ b/pdal/util/Utils.hpp @@ -75,9 +75,9 @@ namespace Utils * \return the value to clamped to the given bounds. */ template - PDAL_DLL const T& clamp(const T& t, const T& min, const T& max) + PDAL_DLL const T& clamp(const T& t, const T& minimum, const T& maximum) { - return ((t < min) ? min : ((t > max) ? max : t)); + return ((t < minimum) ? minimum : ((t > maximum) ? maximum : t)); } /** @@ -686,8 +686,8 @@ namespace Utils } return std::is_same::value || - (in >= static_cast(std::numeric_limits::lowest()) && - in <= static_cast(std::numeric_limits::max())); + (in >= static_cast(std::numeric_limits::lowest()) && + in <= static_cast((std::numeric_limits::max)())); } /** @@ -727,7 +727,7 @@ namespace Utils if (std::is_integral::value) in = static_cast(sround((double)in)); if ((std::is_same::value) || - (in <= static_cast(std::numeric_limits::max()) && + (in <= static_cast((std::numeric_limits::max)()) && in >= static_cast(std::numeric_limits::lowest()))) { out = static_cast(in); @@ -935,7 +935,7 @@ namespace Utils { int i = std::stoi(s); if (i >= std::numeric_limits::lowest() && - i <= std::numeric_limits::max()) + i <= (std::numeric_limits::max)()) { to = static_cast(i); return true; @@ -967,7 +967,7 @@ namespace Utils { int i = std::stoi(s); if (i >= std::numeric_limits::lowest() && - i <= std::numeric_limits::max()) + i <= (std::numeric_limits::max)()) { to = static_cast(i); return true; @@ -999,7 +999,7 @@ namespace Utils { int i = std::stoi(s); if (i >= std::numeric_limits::lowest() && - i <= std::numeric_limits::max()) + i <= (std::numeric_limits::max)()) { to = static_cast(i); return true; diff --git a/plugins/delaunay/filters/Delaunay_psm.cpp b/plugins/delaunay/filters/Delaunay_psm.cpp index f6902638fb..c0e46e3e39 100644 --- a/plugins/delaunay/filters/Delaunay_psm.cpp +++ b/plugins/delaunay/filters/Delaunay_psm.cpp @@ -7317,7 +7317,7 @@ namespace GEO { #ifdef GEO_OS_WINDOWS return rand(); #else - return int32(random() % std::numeric_limits::max()); + return int32(random() % (std::numeric_limits::max)()); #endif } @@ -7329,7 +7329,7 @@ namespace GEO { // (problem at link time) return float(random_int32()) / - float(std::numeric_limits::max()); + float((std::numeric_limits::max)()); #else return float(drand48()); #endif @@ -7343,7 +7343,7 @@ namespace GEO { // (problem at link time) return double(random_int32()) / - double(std::numeric_limits::max()); + double((std::numeric_limits::max)()); #else return double(drand48()); #endif diff --git a/plugins/delaunay/filters/Delaunay_psm.h b/plugins/delaunay/filters/Delaunay_psm.h index 5fdbf854dc..19787faa86 100644 --- a/plugins/delaunay/filters/Delaunay_psm.h +++ b/plugins/delaunay/filters/Delaunay_psm.h @@ -460,7 +460,7 @@ namespace GEO { typedef double float64; inline float32 max_float32() { - return std::numeric_limits::max(); + return (std::numeric_limits::max)(); } inline float32 min_float32() { @@ -471,7 +471,7 @@ namespace GEO { } inline float64 max_float64() { - return std::numeric_limits::max(); + return (std::numeric_limits::max)(); } inline float64 min_float64() { @@ -568,17 +568,17 @@ namespace GEO { typedef geo_index_t index_t; inline index_t max_index_t() { - return std::numeric_limits::max(); + return (std::numeric_limits::max)(); } typedef geo_signed_index_t signed_index_t; inline signed_index_t max_signed_index_t() { - return std::numeric_limits::max(); + return (std::numeric_limits::max)(); } inline signed_index_t min_signed_index_t() { - return std::numeric_limits::min(); + return (std::numeric_limits::min)(); } typedef geo_coord_index_t coord_index_t; @@ -4768,8 +4768,8 @@ namespace GEO { #endif if( end != s && *end == '\0' && errno == 0 && - v >= std::numeric_limits::min() && - v <= std::numeric_limits::max() + v >= (std::numeric_limits::min)() && + v <= (std::numeric_limits::max)() ) { value = static_cast(v); return true; @@ -4816,7 +4816,7 @@ namespace GEO { #endif if( end != s && *end == '\0' && errno == 0 && - v <= std::numeric_limits::max() + v <= (std::numeric_limits::max)() ) { value = static_cast(v); return true; diff --git a/plugins/greyhound/io/bounds.cpp b/plugins/greyhound/io/bounds.cpp index 9b6f1e2090..161300a7e0 100644 --- a/plugins/greyhound/io/bounds.cpp +++ b/plugins/greyhound/io/bounds.cpp @@ -20,19 +20,19 @@ namespace pdal namespace entwine { -Bounds::Bounds(const Point& min, const Point& max) +Bounds::Bounds(const Point& minimum, const Point& maximum) : m_min( - std::min(min.x, max.x), - std::min(min.y, max.y), - std::min(min.z, max.z)) + (std::min)(minimum.x, maximum.x), + (std::min)(minimum.y, maximum.y), + (std::min)(minimum.z, maximum.z)) , m_max( - std::max(min.x, max.x), - std::max(min.y, max.y), - std::max(min.z, max.z)) + (std::max)(minimum.x, maximum.x), + (std::max)(minimum.y, maximum.y), + (std::max)(minimum.z, maximum.z)) , m_mid() { setMid(); - if (min.x > max.x || min.y > max.y || min.z > max.z) + if (minimum.x > maximum.x || minimum.y > maximum.y || minimum.z > maximum.z) { std::cout << "Correcting malformed Bounds" << std::endl; } @@ -111,25 +111,25 @@ Json::Value Bounds::toJson() const void Bounds::grow(const Bounds& other) { - grow(other.min()); - grow(other.max()); + grow(other.minimum()); + grow(other.maximum()); } void Bounds::grow(const Point& p) { - m_min.x = std::min(m_min.x, p.x); - m_min.y = std::min(m_min.y, p.y); - m_min.z = std::min(m_min.z, p.z); - m_max.x = std::max(m_max.x, p.x); - m_max.y = std::max(m_max.y, p.y); - m_max.z = std::max(m_max.z, p.z); + m_min.x = (std::min)(m_min.x, p.x); + m_min.y = (std::min)(m_min.y, p.y); + m_min.z = (std::min)(m_min.z, p.z); + m_max.x = (std::max)(m_max.x, p.x); + m_max.y = (std::max)(m_max.y, p.y); + m_max.z = (std::max)(m_max.z, p.z); setMid(); } void Bounds::shrink(const Bounds& other) { - m_min = Point::max(m_min, other.min()); - m_max = Point::min(m_max, other.max()); + m_min = Point::maximum(m_min, other.minimum()); + m_max = Point::minimum(m_max, other.maximum()); setMid(); } @@ -150,7 +150,7 @@ std::ostream& operator<<(std::ostream& os, const Bounds& bounds) os << std::setprecision(2) << std::fixed; - os << "[" << bounds.min() << ", " << bounds.max() << "]"; + os << "[" << bounds.minimum() << ", " << bounds.maximum() << "]"; os << std::setprecision(precision); os.flags(flags); diff --git a/plugins/greyhound/io/bounds.hpp b/plugins/greyhound/io/bounds.hpp index db1cb98b10..10c4e45d84 100644 --- a/plugins/greyhound/io/bounds.hpp +++ b/plugins/greyhound/io/bounds.hpp @@ -54,8 +54,8 @@ class PDAL_DLL Bounds setMid(); } - const Point& min() const { return m_min; } - const Point& max() const { return m_max; } + const Point& minimum() const { return m_min; } + const Point& maximum() const { return m_max; } const Point& mid() const { return m_mid; } // Returns true if these Bounds share any area in common with another. @@ -64,12 +64,15 @@ class PDAL_DLL Bounds return width() > 0 && depth() > 0 && other.width() > 0 && other.depth() > 0 && - max().x > other.min().x && min().x < other.max().x && - max().y > other.min().y && min().y < other.max().y && + maximum().x > other.minimum().x && + minimum().x < other.maximum().x && + maximum().y > other.minimum().y && + minimum().y < other.maximum().y && (force2d || ( (!height() && !other.height()) || ( height() > 0 && other.height() > 0 && - max().z > other.min().z && min().z < other.max().z))); + maximum().z > other.minimum().z && + minimum().z < other.maximum().z))); } // Returns true if the requested Bounds are contained within these Bounds. @@ -239,11 +242,12 @@ class PDAL_DLL Bounds } bool empty() const { return !exists(); } - bool exists() const { return min().exists() || max().exists(); } + bool exists() const { return minimum().exists() || maximum().exists(); } bool is3d() const { return m_min.z != m_max.z; } Json::Value toJson() const; - Bounds to2d() const { return Bounds(min().x, min().y, max().x, max().y); } + Bounds to2d() const { return Bounds(minimum().x, minimum().y, + maximum().x, maximum().y); } void grow(const Bounds& bounds); void grow(const Point& p); @@ -261,40 +265,42 @@ class PDAL_DLL Bounds Bounds transform(const Transformation& t) const { - return Bounds(Point::transform(min(), t), Point::transform(max(), t)); + return Bounds(Point::transform(minimum(), t), + Point::transform(maximum(), t)); } Bounds intersection(const Bounds& b) const { if (!this->overlaps(b)) return Bounds(); - return Bounds(Point::max(min(), b.min()), Point::min(max(), b.max())); + return Bounds(Point::maximum(minimum(), b.minimum()), + Point::minimum(maximum(), b.maximum())); } Bounds scale(const Point& scale, const Point& offset) const { return Bounds( - Point::scale(min(), scale, offset), - Point::scale(max(), scale, offset)); + Point::scale(minimum(), scale, offset), + Point::scale(maximum(), scale, offset)); } Bounds unscale(const Point& scale, const Point& offset) const { return Bounds( - Point::unscale(min(), scale, offset), - Point::unscale(max(), scale, offset)); + Point::unscale(minimum(), scale, offset), + Point::unscale(maximum(), scale, offset)); } static Bounds everything() { static const double dmin(std::numeric_limits::lowest()); - static const double dmax(std::numeric_limits::max()); + static const double dmax((std::numeric_limits::max)()); return Bounds(dmin, dmin, dmin, dmax, dmax, dmax); } static Bounds expander() { static const double dmin(std::numeric_limits::lowest()); - static const double dmax(std::numeric_limits::max()); + static const double dmax((std::numeric_limits::max)()); // Use Bounds::set to avoid malformed bounds warning. Bounds b; @@ -304,12 +310,12 @@ class PDAL_DLL Bounds double operator[](std::size_t i) const { - return i < 3 ? min()[i] : max()[i - 3]; + return i < 3 ? minimum()[i] : maximum()[i - 3]; } Bounds make2d() const { - return Bounds(min().x, min().y, max().x, max().y); + return Bounds(minimum().x, minimum().y, maximum().x, maximum().y); } private: @@ -342,7 +348,7 @@ PDAL_DLL inline bool operator<(const Bounds& lhs, const Bounds& rhs) PDAL_DLL inline bool operator==(const Bounds& lhs, const Bounds& rhs) { - return lhs.min() == rhs.min() && lhs.max() == rhs.max(); + return lhs.minimum() == rhs.minimum() && lhs.maximum() == rhs.maximum(); } PDAL_DLL inline bool operator!=(const Bounds& lhs, const Bounds& rhs) @@ -352,7 +358,7 @@ PDAL_DLL inline bool operator!=(const Bounds& lhs, const Bounds& rhs) PDAL_DLL inline Bounds operator+(const Bounds& b, const Point& p) { - return Bounds(b.min() + p, b.max() + p); + return Bounds(b.minimum() + p, b.maximum() + p); } } // namespace entwine diff --git a/plugins/greyhound/io/point.hpp b/plugins/greyhound/io/point.hpp index 855dbedd49..e8d8844bb0 100644 --- a/plugins/greyhound/io/point.hpp +++ b/plugins/greyhound/io/point.hpp @@ -120,20 +120,20 @@ class PDAL_DLL Point return 0; } - static Point max(const Point& a, const Point& b) + static Point maximum(const Point& a, const Point& b) { return Point( - std::max(a.x, b.x), - std::max(a.y, b.y), - std::max(a.z, b.z)); + (std::max)(a.x, b.x), + (std::max)(a.y, b.y), + (std::max)(a.z, b.z)); } - static Point min(const Point& a, const Point& b) + static Point minimum(const Point& a, const Point& b) { return Point( - std::min(a.x, b.x), - std::min(a.y, b.y), - std::min(a.z, b.z)); + (std::min)(a.x, b.x), + (std::min)(a.y, b.y), + (std::min)(a.z, b.z)); } static Point normalize(const Point& p) @@ -385,7 +385,7 @@ inline std::ostream& operator<<(std::ostream& os, const Point& point) auto printCoord([&os](double d) { - if (d == std::numeric_limits::max()) os << "max"; + if (d == (std::numeric_limits::max)()) os << "max"; else if (d == std::numeric_limits::lowest()) os << "min"; else if (std::trunc(d) == d) os << static_cast(d); else @@ -433,20 +433,20 @@ class Color Color() : r(0), g(0), b(0) { } Color(uint8_t r, uint8_t g, uint8_t b) : r(r), g(g), b(b) { } - static Color min(const Color& a, const Color& b) + static Color minimum(const Color& a, const Color& b) { return Color( - std::min(a.r, b.r), - std::min(a.g, b.g), - std::min(a.b, b.b)); + (std::min)(a.r, b.r), + (std::min)(a.g, b.g), + (std::min)(a.b, b.b)); } - static Color max(const Color& a, const Color& b) + static Color maximum(const Color& a, const Color& b) { return Color( - std::max(a.r, b.r), - std::max(a.g, b.g), - std::max(a.b, b.b)); + (std::max)(a.r, b.r), + (std::max)(a.g, b.g), + (std::max)(a.b, b.b)); } uint8_t r, g, b; diff --git a/plugins/icebridge/io/Hdf5Handler.cpp b/plugins/icebridge/io/Hdf5Handler.cpp index 0c24fdf7e8..b2df50143b 100644 --- a/plugins/icebridge/io/Hdf5Handler.cpp +++ b/plugins/icebridge/io/Hdf5Handler.cpp @@ -74,7 +74,7 @@ void Hdf5Handler::initialize( ColumnData(predType, dataSet, dataSpace))); // Does not check whether all the columns are the same length. - m_numPoints = std::max((uint64_t)getColumnNumEntries(dataSetName), + m_numPoints = (std::max)((uint64_t)getColumnNumEntries(dataSetName), m_numPoints); } } diff --git a/plugins/icebridge/io/IcebridgeReader.cpp b/plugins/icebridge/io/IcebridgeReader.cpp index e1dca31ec6..4407f52cc7 100644 --- a/plugins/icebridge/io/IcebridgeReader.cpp +++ b/plugins/icebridge/io/IcebridgeReader.cpp @@ -121,7 +121,7 @@ point_count_t IcebridgeReader::read(PointViewPtr view, point_count_t count) PointId startId = view->size(); point_count_t remaining = m_hdf5Handler.getNumPoints() - m_index; - count = std::min(count, remaining); + count = (std::min)(count, remaining); std::unique_ptr rawData(new unsigned char[count * sizeof(float)]); diff --git a/plugins/mbio/io/MbReader.cpp b/plugins/mbio/io/MbReader.cpp index 8b56d46774..8ca26a2323 100644 --- a/plugins/mbio/io/MbReader.cpp +++ b/plugins/mbio/io/MbReader.cpp @@ -91,7 +91,7 @@ void MbReader::ready(PointTableRef table) int lonflip = 0; // Longitude -180 -> 180 double bounds[4] { -180, 180, -90, 90 }; int btime_i[7] { 0, 0, 0, 0, 0, 0, 0 }; - int etime_i[7] { std::numeric_limits::max(), 0, 0, 0, 0, 0 }; + int etime_i[7] { (std::numeric_limits::max)(), 0, 0, 0, 0, 0 }; char *mbio_ptr; double btime_d; double etime_d; diff --git a/plugins/mrsid/io/MrsidReader.cpp b/plugins/mrsid/io/MrsidReader.cpp index 2185896955..c48dc2612d 100644 --- a/plugins/mrsid/io/MrsidReader.cpp +++ b/plugins/mrsid/io/MrsidReader.cpp @@ -183,7 +183,7 @@ QuickInfo MrsidReader::inspect() for (auto di = dims.begin(); di != dims.end(); ++di) qi.m_dimNames.push_back(layout->dimName(*di)); if (!Utils::numericCast(m_PS->getNumPoints(), qi.m_pointCount)) - qi.m_pointCount = std::numeric_limits::max(); + qi.m_pointCount = (std::numeric_limits::max)(); qi.m_bounds = b; qi.m_srs = pdal::SpatialReference(m_PS->getWKT()); qi.m_valid = true; diff --git a/plugins/oci/test/OCITest.cpp b/plugins/oci/test/OCITest.cpp index ac50e9cfed..b552db4ef1 100644 --- a/plugins/oci/test/OCITest.cpp +++ b/plugins/oci/test/OCITest.cpp @@ -257,7 +257,7 @@ void compare(const PointViewPtr candidate, std::string filename) PointViewPtr source = *viewSet.begin(); EXPECT_EQ(source->size(), candidate->size()); - PointId limit = std::min(source->size(), candidate->size()); + PointId limit = (std::min)(source->size(), candidate->size()); for (PointId i = 0; i < limit; ++i) { diff --git a/plugins/pcl/pipeline/PCLPipeline.hpp b/plugins/pcl/pipeline/PCLPipeline.hpp index 20932ef9bf..699ae00983 100644 --- a/plugins/pcl/pipeline/PCLPipeline.hpp +++ b/plugins/pcl/pipeline/PCLPipeline.hpp @@ -79,10 +79,10 @@ pcl::Pipeline::applyPassThrough(PointCloudConstPtr cloud, // parse params std::string field = vt["setFilterFieldName"].asString(); float m1 = vt["setFilterLimits"] - .get("min", -std::numeric_limits::max()) + .get("min", -(std::numeric_limits::max)()) .asFloat(); float m2 = vt["setFilterLimits"] - .get("max", std::numeric_limits::max()) + .get("max", (std::numeric_limits::max)()) .asFloat(); // summarize settings @@ -91,25 +91,25 @@ pcl::Pipeline::applyPassThrough(PointCloudConstPtr cloud, if (field.compare("x") == 0) { - if (m1 != -std::numeric_limits::max()) + if (m1 != -(std::numeric_limits::max)()) m1 -= x_offset_; - if (m2 != std::numeric_limits::max()) + if (m2 != (std::numeric_limits::max)()) m2 -= x_offset_; } if (field.compare("y") == 0) { - if (m1 != -std::numeric_limits::max()) + if (m1 != -(std::numeric_limits::max)()) m1 -= y_offset_; - if (m2 != std::numeric_limits::max()) + if (m2 != (std::numeric_limits::max)()) m2 -= y_offset_; } if (field.compare("z") == 0) { - if (m1 != -std::numeric_limits::max()) + if (m1 != -(std::numeric_limits::max)()) m1 -= z_offset_; - if (m2 != std::numeric_limits::max()) + if (m2 != (std::numeric_limits::max)()) m2 -= z_offset_; } diff --git a/plugins/rxp/io/RxpPointcloud.cpp b/plugins/rxp/io/RxpPointcloud.cpp index 14d8f6ec34..a0206ac7d2 100644 --- a/plugins/rxp/io/RxpPointcloud.cpp +++ b/plugins/rxp/io/RxpPointcloud.cpp @@ -147,11 +147,11 @@ void RxpPointcloud::on_echo_transformed(echo_type echo) if (m_reflectanceAsIntensity) { uint16_t intensity; if (t.reflectance > m_maxReflectance) { - intensity = std::numeric_limits::max(); + intensity = (std::numeric_limits::max)(); } else if (t.reflectance < m_minReflectance) { intensity = 0; } else { - intensity = uint16_t(std::roundf(double(std::numeric_limits::max()) * + intensity = uint16_t(std::roundf(double((std::numeric_limits::max)()) * (t.reflectance - m_minReflectance) / (m_maxReflectance - m_minReflectance))); } m_view->setField(Id::Intensity, idx, intensity); diff --git a/plugins/rxp/test/RxpReaderTest.cpp b/plugins/rxp/test/RxpReaderTest.cpp index 4ff8448a6a..ad3c0f7455 100644 --- a/plugins/rxp/test/RxpReaderTest.cpp +++ b/plugins/rxp/test/RxpReaderTest.cpp @@ -158,5 +158,5 @@ TEST(RxpReaderTest, testReflectanceAsIntensity) PointViewSet viewSet = reader.execute(table); PointViewPtr view = *viewSet.begin(); uint16_t intensity = view->getFieldAs(Dimension::Id::Intensity, 0); - EXPECT_EQ(std::numeric_limits::max(), intensity); + EXPECT_EQ((std::numeric_limits::max)(), intensity); } diff --git a/plugins/sqlite/io/SQLiteCommon.hpp b/plugins/sqlite/io/SQLiteCommon.hpp index fecdf773ee..44ce7728a3 100644 --- a/plugins/sqlite/io/SQLiteCommon.hpp +++ b/plugins/sqlite/io/SQLiteCommon.hpp @@ -446,12 +446,13 @@ class SQLite { std::string so_extension; std::string lib_extension; -#ifdef __APPLE__ +#if defined(__APPLE__) so_extension = ".dylib"; lib_extension = "mod_"; -#endif - -#if defined(__linux__) || defined(__FreeBSD_kernel__) +#elif defined (_WIN32) + so_extension = ".dll"; + lib_extension = "pdal"; +#else so_extension = ".so"; #ifdef MOD_SPATIALITE lib_extension = "mod_"; @@ -460,11 +461,6 @@ class SQLite #endif #endif -#ifdef _WIN32 - so_extension = ".dll"; - lib_extension = "pdal"; -#endif - // #if !defined(sqlite3_enable_load_extension) // #error "sqlite3_enable_load_extension and spatialite is required for sqlite PDAL support" // #endif diff --git a/plugins/sqlite/io/SQLiteReader.cpp b/plugins/sqlite/io/SQLiteReader.cpp index 7351fdea1a..386a207fe9 100644 --- a/plugins/sqlite/io/SQLiteReader.cpp +++ b/plugins/sqlite/io/SQLiteReader.cpp @@ -244,7 +244,7 @@ point_count_t SQLiteReader::readPatch(PointViewPtr view, point_count_t numPts) const char *buf = reinterpret_cast( (*r)[position].blobBuf.data()); bufsize = (*r)[position].blobBuf.size(); - count = std::min(count, size_t(numPts)); + count = (std::min)(count, size_t(numPts)); LazPerfDecompressor(cb, dbDimTypes(), count). decompress(buf, bufsize); diff --git a/test/data/las/utm17.las b/test/data/las/utm17.las index 74f3d3d071..bd7794fe77 100644 Binary files a/test/data/las/utm17.las and b/test/data/las/utm17.las differ diff --git a/test/unit/ArtifactTest.cpp b/test/unit/ArtifactTest.cpp index 5252eb93b8..bbb8e2412b 100644 --- a/test/unit/ArtifactTest.cpp +++ b/test/unit/ArtifactTest.cpp @@ -121,4 +121,24 @@ TEST(ArtifactTest, replaceOrPut) EXPECT_FALSE(t.artifactManager().replaceOrPut("MyTest", ta2)); } +TEST(ArtifactTest, key_access) +{ + using TAPtr = std::shared_ptr; + TAPtr ta(new TestArtifact("MyTest")); + + PointTable t; + EXPECT_TRUE(t.artifactManager().keys().empty()); + + t.artifactManager().put("MyTest", ta); + EXPECT_EQ(t.artifactManager().keys().size(), 1U); + EXPECT_EQ(t.artifactManager().keys().at(0), "MyTest"); + + t.artifactManager().put("MyTest2", ta); + auto keys = t.artifactManager().keys(); + EXPECT_EQ(keys.size(), 2U); + EXPECT_EQ(std::find(keys.begin(), keys.end(), "Foo"), keys.end()); + EXPECT_NE(std::find(keys.begin(), keys.end(), "MyTest"), keys.end()); + EXPECT_NE(std::find(keys.begin(), keys.end(), "MyTest2"), keys.end()); +} + } // namespace pdal diff --git a/test/unit/DeflateTest.cpp b/test/unit/DeflateTest.cpp index 123c93eb81..dd4aa960f3 100644 --- a/test/unit/DeflateTest.cpp +++ b/test/unit/DeflateTest.cpp @@ -43,7 +43,7 @@ using namespace pdal; TEST(Compression, deflate) { std::default_random_engine generator; - std::uniform_int_distribution dist(std::numeric_limits::min()); + std::uniform_int_distribution dist((std::numeric_limits::min)()); // Choosing a size that isn't a multiple of the internal buffer. std::vector orig(1000357); diff --git a/test/unit/LazPerfTest.cpp b/test/unit/LazPerfTest.cpp index ac129ed24d..c9eb650a00 100644 --- a/test/unit/LazPerfTest.cpp +++ b/test/unit/LazPerfTest.cpp @@ -140,7 +140,8 @@ TEST(Compression, types) }; // Size is 42. - std::default_random_engine generator;std::uniform_int_distribution dist(std::numeric_limits::min()); + std::default_random_engine generator; + std::uniform_int_distribution dist((std::numeric_limits::min)()); char pts[3][42]; // Fill three "points" with some random data. diff --git a/test/unit/LzmaTest.cpp b/test/unit/LzmaTest.cpp index 22f5d0ed53..0ba8179b47 100644 --- a/test/unit/LzmaTest.cpp +++ b/test/unit/LzmaTest.cpp @@ -43,7 +43,7 @@ using namespace pdal; TEST(Compression, lzma) { std::default_random_engine generator; - std::uniform_int_distribution dist(std::numeric_limits::min()); + std::uniform_int_distribution dist((std::numeric_limits::min)()); // Choosing a size that isn't a multiple of the internal buffer. // Trying to make something that compresses reasonably well. diff --git a/test/unit/PluginManagerTest.cpp b/test/unit/PluginManagerTest.cpp index c9a7557dd1..5cbb345568 100644 --- a/test/unit/PluginManagerTest.cpp +++ b/test/unit/PluginManagerTest.cpp @@ -121,11 +121,10 @@ TEST(PluginManagerTest, validnames) { #if defined(__APPLE__) && defined(__MACH__) static const std::string dlext(".dylib"); -#elif defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__) || \ - defined(__FreeBSD_kernel__) || defined(__GNU__) - static const std::string dlext(".so"); #elif defined _WIN32 static const std::string dlext(".dll"); +#else + static const std::string dlext(".so"); #endif StringList type1 { "reader", "writer" }; diff --git a/test/unit/StreamingTest.cpp b/test/unit/StreamingTest.cpp index a13f52485e..a34cc6d216 100644 --- a/test/unit/StreamingTest.cpp +++ b/test/unit/StreamingTest.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include "Support.hpp" @@ -268,3 +269,50 @@ R"( EXPECT_NE(output.find("DGHEEFBBBBCAAAAA"), std::string::npos); } +// Test that SRS changes aren't repeated when new input is processed. +TEST(Streaming, issue_2009) +{ + StageFactory f; + + Stage& r1 = *(f.createStage("readers.las")); + Options r1Opts; + r1Opts.add("filename", Support::datapath("las/test_epsg_4326.las")); + r1.setOptions(r1Opts); + + Stage& r2 = *(f.createStage("readers.las")); + Options r2Opts; + r2Opts.add("filename", Support::datapath("las/test_epsg_4326.las")); + r2.setOptions(r2Opts); + + class TestFilter : public Filter, public Streamable + { + public: + TestFilter() : m_srsCnt(0) + {} + + std::string getName() const { return "filters.test"; } + + int m_srsCnt; + + private: + virtual void spatialReferenceChanged(const SpatialReference&) + { + m_srsCnt++; + } + + virtual bool processOne(PointRef&) + { + return true; + } + }; + + TestFilter t; + t.setInput(r1); + t.setInput(r2); + + FixedPointTable table(100); + t.prepare(table); + t.execute(table); + + EXPECT_EQ(t.m_srsCnt, 1); +} diff --git a/test/unit/ZstdTest.cpp b/test/unit/ZstdTest.cpp index c4c5f13ad7..a59d3bc9c9 100644 --- a/test/unit/ZstdTest.cpp +++ b/test/unit/ZstdTest.cpp @@ -43,7 +43,7 @@ using namespace pdal; TEST(Compression, zstd) { std::default_random_engine generator; - std::uniform_int_distribution dist(std::numeric_limits::min()); + std::uniform_int_distribution dist((std::numeric_limits::min)()); // Choosing a size that isn't a multiple of the internal buffer. // Trying to make something that compresses reasonably well. diff --git a/test/unit/io/LasWriterTest.cpp b/test/unit/io/LasWriterTest.cpp index 88474f3caf..f569253bbc 100644 --- a/test/unit/io/LasWriterTest.cpp +++ b/test/unit/io/LasWriterTest.cpp @@ -853,11 +853,11 @@ void compareFiles(const std::string& name1, const std::string& name2, EXPECT_EQ(d1.size(), d2.size()); EXPECT_EQ(size1, size2); - for (PointId i = 0; i < std::min(size1, size2); i += increment) + for (PointId i = 0; i < (std::min)(size1, size2); i += increment) { v1->getPackedPoint(d1, i, buf1.data()); v2->getPackedPoint(d2, i, buf2.data()); - EXPECT_EQ(memcmp(buf1.data(), buf2.data(), std::min(size1, size2)), 0); + EXPECT_EQ(memcmp(buf1.data(), buf2.data(), (std::min)(size1, size2)), 0); } } diff --git a/tools/lasdump/Lasdump.hpp b/tools/lasdump/Lasdump.hpp index ce68a49280..d4ec20a882 100644 --- a/tools/lasdump/Lasdump.hpp +++ b/tools/lasdump/Lasdump.hpp @@ -67,7 +67,7 @@ inline int32_t cksum(const void *c, size_t size) while (size) { int32_t val = 0; - memcpy(&val, p, std::min(sizeof(int32_t), size)); + memcpy(&val, p, (std::min)(sizeof(int32_t), size)); sum += val; p++; if (size <= sizeof(int32_t)) diff --git a/tools/nitfwrap/NitfWrap.cpp b/tools/nitfwrap/NitfWrap.cpp index 1ff2ffd0e3..cee1a74182 100644 --- a/tools/nitfwrap/NitfWrap.cpp +++ b/tools/nitfwrap/NitfWrap.cpp @@ -156,7 +156,7 @@ void NitfWrap::unwrap() in->seekg(offset, std::istream::beg); while (length) { - size_t size = std::min(length, bufsize); + size_t size = (std::min)(length, bufsize); in->read(buf.data(), size); out->write(buf.data(), size); length -= size; diff --git a/vendor/arbiter/arbiter.cpp b/vendor/arbiter/arbiter.cpp index 84457915ec..67e2ebb5d3 100644 --- a/vendor/arbiter/arbiter.cpp +++ b/vendor/arbiter/arbiter.cpp @@ -1249,11 +1249,6 @@ LocalHandle::~LocalHandle() #include #endif -#ifdef ARBITER_WINDOWS -#undef min -#undef max -#endif - #include #include #include @@ -3793,7 +3788,7 @@ Contents parse(const std::string& s) line = util::stripWhitespace(line); const std::size_t semiPos(line.find_first_of(';')); const std::size_t hashPos(line.find_first_of('#')); - line = line.substr(0, std::min(semiPos, hashPos)); + line = line.substr(0, (std::min)(semiPos, hashPos)); if (line.size()) { @@ -4494,7 +4489,7 @@ Time::Time(const std::string& s, const std::string& format) throw ArbiterError("Failed to parse " + s + " as time: " + format); } #endif - if (utcOffset > std::numeric_limits::max()) + if (utcOffset > (std::numeric_limits::max)()) throw ArbiterError("Can't convert offset time in seconds to tm type."); tm.tm_sec -= (int)utcOffset; diff --git a/vendor/kazhdan/MAT.inl b/vendor/kazhdan/MAT.inl index 3f33d76c4b..4bad6ba95b 100644 --- a/vendor/kazhdan/MAT.inl +++ b/vendor/kazhdan/MAT.inl @@ -162,7 +162,7 @@ void MinimalAreaTriangulation::GetTriangulation(const size_t& i,const size template Real MinimalAreaTriangulation::GetArea(const size_t& i,const size_t& j,const std::vector >& vertices) { - Real a(std::numeric_limits::max()); + Real a((std::numeric_limits::max)()); Real temp; size_t eCount=vertices.size(); size_t idx=i*eCount+j; diff --git a/vendor/kazhdan/PoissonRecon.h b/vendor/kazhdan/PoissonRecon.h index 06259b3968..1a307bf7cf 100644 --- a/vendor/kazhdan/PoissonRecon.h +++ b/vendor/kazhdan/PoissonRecon.h @@ -72,11 +72,11 @@ void DumpOutput2( std::vector< char* >& comments , const char* format , ... ); template XForm4x4 GetPointXForm(PointSource& source, Real scaleFactor) { - Point3D min , max; - source.boundingBox(min, max); - Point3D center = ( max + min ) / 2; - Real scale = std::max( max[0]-min[0], - std::max(max[1]-min[1], max[2]-min[2])); + Point3D minimum, maximum; + source.boundingBox(minimum, maximum); + Point3D center = (maximum + minimum) / 2; + Real scale = (std::max)(maximum[0]-minimum[0], + (std::max)(maximum[1]-minimum[1], maximum[2]-minimum[2])); scale *= scaleFactor; for( int i=0 ; i<3 ; i++ ) center[i] -= scale/2; @@ -479,7 +479,7 @@ void PoissonRecon::solve() solverInfo.verbose = m_opts.m_verbose; solverInfo.showResidual = m_opts.m_showResidual; solverInfo.lowResIterMultiplier = - std::max((Real)1.0, m_opts.m_lowResIterMult); + (std::max)((Real)1.0, m_opts.m_lowResIterMult); m_solution = m_tree.template solveSystem( FEMSystemFunctor(0, 1, 0), m_interp, m_constraints, diff --git a/vendor/kazhdan/point_source/PointSource.h b/vendor/kazhdan/point_source/PointSource.h index 8268ff1641..4d3c96dc91 100644 --- a/vendor/kazhdan/point_source/PointSource.h +++ b/vendor/kazhdan/point_source/PointSource.h @@ -41,12 +41,12 @@ class PointSource virtual void reset() = 0; virtual bool nextPoint(Point& point) = 0; - void boundingBox(Point3D& min, Point3D& max) + void boundingBox(Point3D& minimum, Point3D& maximum) { for (size_t i = 0; i < 3; ++i) { - min[i] = std::numeric_limits::max(); - max[i] = std::numeric_limits::lowest(); + minimum[i] = (std::numeric_limits::max)(); + maximum[i] = (std::numeric_limits::lowest)(); } Point p; @@ -54,8 +54,8 @@ class PointSource { for( int i=0 ; i<3 ; i++ ) { - min[i] = std::min(min[i], p.p[i]); - max[i] = std::max(max[i], p.p[i]); + minimum[i] = (std::min)(minimum[i], p.p[i]); + maximum[i] = (std::max)(maximum[i], p.p[i]); } } reset(); diff --git a/vendor/nanoflann/nanoflann.hpp b/vendor/nanoflann/nanoflann.hpp index 445aa2998c..845d86d297 100644 --- a/vendor/nanoflann/nanoflann.hpp +++ b/vendor/nanoflann/nanoflann.hpp @@ -1080,8 +1080,10 @@ namespace nanoflann node->node_type.sub.divhigh = right_bbox[cutfeat].low; for (int i=0; i<(DIM>0 ? DIM : dim); ++i) { - bbox[i].low = std::min(left_bbox[i].low, right_bbox[i].low); - bbox[i].high = std::max(left_bbox[i].high, right_bbox[i].high); + bbox[i].low = (std::min)(left_bbox[i].low, + right_bbox[i].low); + bbox[i].high = (std::max)(left_bbox[i].high, + right_bbox[i].high); } }