Exemplo n.º 1
0
/* get the number of entries with a negative
 * number for a type 1 legend
 */
static int NrLegendEntries(MAP *m)
{
	int size = CsfAttributeSize(m, ATTR_ID_LEGEND_V2);
	if (size == 0)
	{
		if ( (size = -1 * CsfAttributeSize(m, ATTR_ID_LEGEND_V1)) != 0 )
			size -= CSF_LEGEND_ENTRY_SIZE;
	}
	return size/CSF_LEGEND_ENTRY_SIZE;
}
Exemplo n.º 2
0
/* replace an attribute (LIBRARY_INTERNAL)
 *
 */
CSF_ATTR_ID CsfUpdateAttribute(
	MAP *m,       		/* map handle */
	CSF_ATTR_ID id,               /* attribute identification */
	size_t itemSize,        /* size of each attribute element.
	                         * 1 or sizeof(char) in case of a
	                         * string
	                         */
	size_t nitems,          /* number of attribute elements or
	                         * strlen+1 in case of a variable character
	                         * string field. Don't forget to pad a
	                         * non-variable field with '\0'!
	                         */
	void *attr)       /* buffer containing attribute */
{
	PRECOND(CsfValidSize(itemSize));
	if (CsfAttributeSize(m,id))
		if (! MdelAttribute(m,id))
			return 0;
	return CsfPutAttribute(m,id,itemSize,nitems, attr);
}
Exemplo n.º 3
0
/* get the number of grey palette entries
 * MgetNrGreyPaletteEntries returns the number of grey tupels
 * of the grey palette. Each tuple is one UINT2
 * words describing the intensity: low, 0 is black, high is white.
 * returns
 *  the number of grey tuples,
 *  or 0 if not available or in case of error
 */
size_t MgetNrGreyPaletteEntries(MAP *m) /* the map to get it from */
{
	size_t s = (size_t)CsfAttributeSize(m, ATTR_ID_GREY_PAL);
	POSTCOND( (s % (sizeof(UINT2))) == 0);
	return s / (sizeof(UINT2));
}
Exemplo n.º 4
0
/* get the number of colour palette entries
 * MgetNrColourPaletteEntries returns the number of rgb tupels
 * of the colour palette. Each tuple is a sequence of 3 UINT2
 * words describing red, green and blue.
 * returns
 *  the number of rgb tuples,
 *  or 0 if not available or in case of error
 */
size_t MgetNrColourPaletteEntries(MAP *m) /* the map to get it from */
{
	size_t s = (size_t)CsfAttributeSize(m, ATTR_ID_COLOUR_PAL);
	POSTCOND( (s % (3*sizeof(UINT2))) == 0);
	return s / (3*sizeof(UINT2));
}
Exemplo n.º 5
0
/* get the size of the description attribute
 * returns
 *  the size of description buffer INCLUDING the terminating `\0`,
 *  or 0 if not available or in case of error
 */
size_t MgetDescriptionSize(MAP *m) /* the map to get it from */
{
	return (size_t)CsfAttributeSize(m, ATTR_ID_DESCRIPTION);
}
Exemplo n.º 6
0
/* get the size of the history attribute
 * returns
 *  the size of history buffer INCLUDING the terminating `\0`,
 *  or 0 if not available or in case of error
 */
size_t MgetHistorySize(MAP *m) /* the map to get it from */
{
	return (size_t)CsfAttributeSize(m, ATTR_ID_HISTORY);
}