[GRASS-dev] Rast_add_d_colour
Yann Chemin
ychemin at gmail.com
Sat Dec 6 19:44:41 PST 2014
OK, I found why I got lost in all that...
there is no file appearing in colr/ with the rules made in the code.
On 7 December 2014 at 06:51, Yann Chemin <ychemin at gmail.com> wrote:
> Thanks,
> Will try again today.
> On Dec 7, 2014 3:36 AM, "Vaclav Petras" <wenzeslaus at gmail.com> wrote:
>
>>
>>
>> On Sat, Dec 6, 2014 at 3:59 PM, Markus Metz <
>> markus.metz.giswork at gmail.com> wrote:
>>
>>> Yann Chemin wrote:
>>> > Hi,
>>> >
>>> > I am working on beautifying the output of i.theilsen, a new addon.
>>> >
>>> > For some reason, I cannot apply a grayscale palette.
>>> > ---------------
>>> > Rast_init_colors(&colors);
>>> > DCELL val1 = ts_min;
>>> > DCELL val2 = ceil(ts_max);
>>> > Rast_add_d_color_rule(&val1, 0, 0, 0, &val2, 255, 255, 255, &colors);
>>> > ---------------
>>> >
>>> > ts_min, ts_max are known from the data processed,
>>> > val1 and val2 are declared as DCELL instead of const DCELL as required,
>>> > but if I declare const DCELL val1, then I cannot write stats to it for
>>> > palette definition...
>>> >
>>> > What I am doing wrong?
>>>
>>> If you declare const DCELL val1, you can not pass a pointer to val1 to
>>> another function, because this other function could then easily modify
>>> to contents of that pointer.
>>
>>
>> This is of course true.
>>
>>
>>> Rast_add_d_color_rule() requires const
>>> DCELL *, not const DCELL.
>>>
>>
>> Strange, (generated) documentation says const DCELL * [1] which fits with
>> the source code [2, 3].
>>
>> I haven't tried compile anything now but isn't `const DCELL` constant
>> (value) and `const DCELL *` pointer to constant value. While `const DCELL *
>> const` would be constant pointer to constant value.
>>
>> Also
>>
>> const DCELL val;
>> const DCELL * pval = &val;
>>
>> should work and carry on the constness which is exactly what should be
>> happening when calling the Rast_add_d_color_rule() function.
>>
>> So, I don't understand.
>>
>> Vaclav
>>
>> [1]
>> http://grass.osgeo.org/programming7/color__rule_8c.html#a160535a46694589674f68c60eac23a05
>> [2] lib/raster/color_rule.c:35:void Rast_add_d_color_rule(const DCELL *
>> val1, int r1, int g1, int b1, ...
>> [3] include/defs/raster.h:198:void Rast_add_d_color_rule(const DCELL *,
>> int, int, int, ...
>>
>>
>>> Markus M
>>> _______________________________________________
>>> grass-dev mailing list
>>> grass-dev at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/grass-dev
>>>
>>
>>
--
----
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20141207/fced1293/attachment-0001.html>
More information about the grass-dev
mailing list