/* ===========================================================================

  crossFunc.h    Global variables and functions for Cross Section Tool

=============================================================================*/
#ifdef CROSS_FUNC_ALLOCATE
#define EXTERN
#else
#define EXTERN extern
#endif

struct cross_line
{
  FLT4  fLeft[2];
  FLT4 fRight[2];
};

class CrossFunc 
{
  public :
    CrossFunc( void );                       /* Constructor */
    void  buttonDown(SINT4 x_a, SINT4 y_a);  /* Button 1 was pressed */
    void  buttonDrag(SINT4 x_a, SINT4 y_a);  /* Button 1 dragged */
    void  buttonUp(SINT4 x_a, SINT4 y_a);    /* Button 1 was released */
    void  enterMode( void );                 /* Cross mode entered */
    void  exitMode( void );                  /* Cross mode exited */
    void  newProduct( void );                /* New product is on the screen */

    void  clrMakingXSectFlag();              /* clear flag making Xsect  */
    void  makeButton( void );                /* "Make" button was pressed */
    void  heightTyped( const char *string ); /* Height was typed in by user */
    void  sizeTyped( UINT2 iSize_a );        /* Size was typed in by user */
    void  dataTyped                          /* Data was typed in by user */
      ( UINT2 iDataIn_a, UINT2 iDataOut_a );
    void  SmootherTyped                      /* New smoothing number type in by user */
      ( FLT4 fXSmooth_a, FLT4 fYSmooth_a );

    void  notifyPeerEntered( void );         /* Another tool was entered */
    void  getCrossSize                       /* Get current cross section desired size */
      (SINT4 iSize_a[2] );
    void  processServerReply                 /* Cross section command from server */
      (char *stoks_a[8], const char *pdata, SINT4 isize );

  private :
    UINT2 lInCrossMode_c;           /* Indicates which end we are attached to */
    UINT2 lAttachedToRight;         /* Indicates which end we are attached to */
    UINT2 lMakingXSect;             /* Indicates if were are mak a x sect */
    FLT8 fSavedLeft[2];             /* Saved end location between modes */
    FLT8 fSavedRight[2];            /* These are distances from the radar in km */

    struct cross_line currentLine;  /* The current cross section line definition */

    UINT4 iSiteNum_c;         /* Site number for the product on the screen */
    UINT2 iDataIn_c;          /* Input data type for the product */
    UINT2 iDataOut_c;         /* Output data type for the product */
    char  sPName_c[16];       /* Cross product name to make */
    struct serv_ymds_time time_c; /* Time to make cross section from.  This is 
				   * ingest time found when doing ingest check. 
				   * It may differ from the base product time if
				   * data is not there. */

    FLT8  fHeight_c;        /* Height of Cross section in km */
    UINT4 lValid_c;         /* Cross section info below is valid*/
    FLT8  fWidth_c;         /* Width of Cross section in km */
    FLT8  fRange_c;         /* Range from radar to center of Cross section in km */
    FLT8  fAzimuth_c;       /* Azimuth from radar to center of Cross section */
    FLT8  fAngle_c;         /* Orientation angle of Cross section in radians */
    FLT4  fXSmoother_c;     /* Smoothing distances in km */
    FLT4  fYSmoother_c;

    UINT4 iPSCState_c;      /* State of the cross product in the Schedule */
    SINT4 iWidth_c;         /* Width and height of the cross section window in pixels*/
    SINT4 iHeight_c;

    void RedrawCrossLine
      (void);
    void plantCrossLine
      (const struct cross_line *line,   /* Position of the end points of the line */
       const struct on_screen_picture8 *onscreen_a,
       UINT2 lsave_a );
    void drawHeight
      ( UINT4 iunits_a );  /* Units to display in */
    void processCheckCommand
      (const char *pdata_a, SINT4 isize_a );
    void ConfigurePCF( void );
    void processIngCheckCommand
      (const char *spcf_a, UINT4 ilen_a );
    void processKeepCheckCommand
      (const char *phd_a, SINT4 ilen_a, const char* stat_a );
    void processTimeCommand( void );

};
EXTERN CrossFunc crossFunc;

#undef EXTERN
