adg: add geometry handling to AdgDim
commit21ba042dec9aed63d6a899e3432659ebbe338288
authorNicola Fontana <ntd@entidi.it>
Fri, 31 Mar 2017 09:37:03 +0000 (31 11:37 +0200)
committerNicola Fontana <ntd@entidi.it>
Fri, 31 Mar 2017 09:37:03 +0000 (31 11:37 +0200)
treea6f2bfa2063fb14923381500aba71b354f55a9e9
parent207aac8ad624d5ddfa47293d9b31a209f83d7151
adg: add geometry handling to AdgDim

Add new internal methods to help the relocation of geometry behavior
into AdgDim in view of the planned a change of behavior on the geometry
computation.

Actually when a point is missing or when two points that must be
differents are coincidents the entity is not rendered but in the former
case it is done silently while in the latter case a warning is issued.
This is not consistent and implicates code duplication. Worse, the
caller has no easy way to know if the dimension has been rendered.

The new behavior will be to always be silent and to provide a way to
inspect if the dimension is valid before the rendering, allowing to do
some code similar to the following one:

    dim = <create new dimension>
    if dim:compute_geometry() then
        -- The dimension is valid: render it
        canvas:add(dim)
    else
        print('Dimension not valid: ', dim:get_geometry_notice())
    end
src/adg/adg-dim-private.h
src/adg/adg-dim.c
src/adg/adg-dim.h
src/adg/tests/test-dim.c