[Liblas-commits] hg: GetDimension doesn't throw anymore,
it returns a boost::opti...
liblas-commits at liblas.org
liblas-commits at liblas.org
Thu Jan 6 10:10:06 EST 2011
details: http://hg.liblas.orghg/rev/3ff92de69331
changeset: 2700:3ff92de69331
user: Howard Butler <hobu.inc at gmail.com>
date: Thu Jan 06 09:09:54 2011 -0600
description:
GetDimension doesn't throw anymore, it returns a boost::optional
diffstat:
src/utility.cpp | 48 ++++++++++++------------------------------------
1 files changed, 12 insertions(+), 36 deletions(-)
diffs (68 lines):
diff -r f797616d8827 -r 3ff92de69331 src/utility.cpp
--- a/src/utility.cpp Wed Jan 05 21:35:25 2011 -0600
+++ b/src/utility.cpp Thu Jan 06 09:09:54 2011 -0600
@@ -133,26 +133,21 @@
min.SetHeaderPtr(h);
max.SetHeaderPtr(h);
liblas::Schema const& schema = hdr->GetSchema();
- try {
+ boost::optional<Dimension const&> red;
+ boost::optional<Dimension const&> green;
+ boost::optional<Dimension const&> blue;
+ boost::optional<Dimension const&> time;
- schema.GetDimension("Red");
- schema.GetDimension("Green");
- schema.GetDimension("Blue");
+ red = schema.GetDimension("Red");
+ green = schema.GetDimension("Green");
+ blue = schema.GetDimension("Blue");
+ if (red && green && blue)
bHaveColor = true;
+ else
+ bHaveColor = false;
- } catch (std::runtime_error const&)
- {
- bHaveColor = false;
- }
- try {
-
- schema.GetDimension("Time");
- bHaveTime = true;
-
- } catch (std::runtime_error const&)
- {
- bHaveTime = false;
- }
+ time = schema.GetDimension("Time");
+ if (time) bHaveTime = true; else bHaveTime = false;
} else
{
min.SetHeaderPtr(HeaderPtr());
@@ -630,25 +625,6 @@
min.SetHeaderPtr(h);
max.SetHeaderPtr(h);
- liblas::Schema const& schema = hdr->GetSchema();
- try {
-
- schema.GetDimension("Red");
- schema.GetDimension("Green");
- schema.GetDimension("Blue");
- bHaveColor = true;
-
- } catch (std::runtime_error const&)
- {
- }
- try {
-
- schema.GetDimension("Time");
- bHaveTime = true;
-
- } catch (std::runtime_error const&)
- {
- }
} else
{
min.SetHeaderPtr(HeaderPtr());
More information about the Liblas-commits
mailing list