IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 3, 2005, 4:34:58 PM (22 years ago)
Author:
desonia
Message:

added tests for psRegion functions.

Location:
trunk/psLib/src/mathtypes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/mathtypes/psImage.c

    r2762 r2879  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.55 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-12-20 21:39:42 $
     11 *  @version $Revision: 1.56 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-01-04 02:34:57 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2323#include "psError.h"
    2424#include "psImage.h"
     25#include "psString.h"
    2526
    2627#include "psImageErrors.h"
     
    146147
    147148    return psRegionAlloc(col0,col1,row0,row1);
     149}
     150
     151char* psRegionToString(psRegion* region)
     152{
     153    char tmpText[256]; // big enough to store any region as text
     154
     155    if (region == NULL) {
     156        psError(PS_ERR_BAD_PARAMETER_NULL, true,
     157                PS_ERRORTEXT_psImage_REGION_NULL);
     158        return NULL;
     159    }
     160
     161    snprintf(tmpText,256,"[%g:%g,%g:%g]",
     162             region->x0, region->x1,
     163             region->y0, region->y1);
     164
     165    return psStringCopy(tmpText);
    148166}
    149167
  • trunk/psLib/src/mathtypes/psImage.h

    r2375 r2879  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.43 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2004-11-16 20:00:21 $
     13 *  @version $Revision: 1.44 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-01-04 02:34:57 $
    1515 *
    1616 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    103103);
    104104
    105 /** Create an image of the specified size and type.
    106  *
    107  * Uses psLib memory allocation functions to create an image struct of the
    108  * specified size and type.
    109  *
    110  * @return psImage* : Pointer to psImage.
     105/** Create a psRegion with the specified attributes.
     106 *
     107 * Uses psLib memory allocation functions to create a psRegion the
     108 * specified x0, x1, y0, and y1.
     109 *
     110 * @return psRegion* : Pointer to psRegion.
    111111 *
    112112 */
     
    118118);
    119119
     120/** Create a psRegion with the attribute values given as a string.
     121 *
     122 *  Create a psRegion with the attribute values given as a string.  The format
     123 *  shall be of the standard IRAF form '[x0:x1,y0:y1]'
     124 *
     125 *  @return psRegion*:  A new psRegion struct, or NULL is not successful.
     126 */
    120127psRegion* psRegionFromString(
    121128    char* region                       ///< image rectangular region in the form '[x0:x1,y0:y1]'
     129);
     130
     131/** Create a string of the standard IRAF form '[x0:x1,y0:y1]' from a psRegion.
     132 *
     133 *  @return char*:  A new string representing the psRegion as text, or NULL
     134 *                  is not successful.
     135 */
     136char* psRegionToString(
     137    psRegion* region                   ///< the psRegion to convert to a string
    122138);
    123139
Note: See TracChangeset for help on using the changeset viewer.