[Liblas-devel] HasColor() and HasTime() removed from Schema class public interface

Howard Butler hobu.inc at gmail.com
Sun Dec 19 21:38:58 EST 2010


On Dec 19, 2010, at 7:20 PM, Trudgett, David wrote:

> 
> Hello,
> 
> In lasschema.hpp, on lines 100 & 101 (between lines 128 and 129 in the
> new 1.6.0b3 version of the file), the HasColor() and HasTime() public
> boolean methods of the Schema class seem to have been removed. 
> 
> Was this a mistake or is there now another way to access this
> functionality?

It was intentional.  See below.  I would note that I have been working under the expectation that the entire C++ API is up for grabs for this 1.6.0 release until it goes final.  After the dust settles beyond this release, I don't envision it changing too much other than for a few additions here or there.


> There doesn't seem to be any mention of this change
> anywhere that I can see. I'm trying to build an application that depends
> on HasColor(), but obviously the build is now failing because there is
> no longer any HasColor().

Wow, I didn't know anyone noticed that, and more importantly, actually used it :)

The proper way to ask for HasColor or HasTime now is to ask the schema if the color or time dimensions exist.

bool bColorExists = false;
try {

	liblas::Dimension const& red = schema.GetDimension("Red");
	liblas::Dimension const& green = schema.GetDimension("Green");
	liblas::Dimension const& blue = schema.GetDimension("Blue");
 	bColorExists = true;

} catch (std::runtime_error const&)
{
}

Looking at this now, maybe we should have a real exception instead of the generic runtime_error.  Yes, I'm aware this design might rankle those who have not grown up with the notion that exceptions are not exceptional.  I'd be happy to hear of alternative designs, because I don't see this stuff as too engrained yet.

Howard


More information about the Liblas-devel mailing list