ifcplusplus icon indicating copy to clipboard operation
ifcplusplus copied to clipboard

styles converter transparency fix and code modernisation

Open loebl opened this issue 7 years ago • 2 comments

This pull request contains the following changes:

  • Fix transparency import for IfcSurfaceStyleShading: Transparency was only read from SurfaceStyleRendering, although it is earlier available in SurfaceStyleShading
  • Replace various variable declarations with auto. Makes the lines a bit shorter
  • Declare functions only used inside the class as private
  • Change out parameters to return statements in a few functions

If you only want the fix separately, I can put it in an isolated pull request.

loebl avatar Apr 20 '18 14:04 loebl

Thanks for the pull request. However, heavy usage of the auto keyword is a different coding style, that I don't really like too much. Mostly I actually prefer the explicit datatype. You can see more clearly what it is, and jump more easily to the class definition in case you want to look at the attributes for example. Like in this example, I would prefer the first one: shared_ptr<IfcComplexProperty> complex_property = dynamic_pointer_cast... auto const complex_property = dynamic_pointer_cast...

It is a bit more text, but it makes it better readable. A search in the project where certain classes are used, is also easier with explicit data types. There are tons of reasons I like it more.

An std::vector as return value could cause some copy operations. I prefer to pass a reference as parameter.

I'm aware that loops can be written like for( auto node : vec_nodes ). But I don't really use it any more because when debugging, you never know in which round you are.

If you agree, I would like to keep the pull request open and take some parts of it in the future.

ifcquery avatar Apr 23 '18 12:04 ifcquery

sure, no problem

loebl avatar Apr 24 '18 06:04 loebl