1
/* @(#)ag_cdef.c 19.1 (ES0-DMD) 02/25/03 13:52:57 */
2
/*===========================================================================
3
Copyright (C) 1995 European Southern Observatory (ESO)
5
This program is free software; you can redistribute it and/or
6
modify it under the terms of the GNU General Public License as
7
published by the Free Software Foundation; either version 2 of
8
the License, or (at your option) any later version.
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
15
You should have received a copy of the GNU General Public
16
License along with this program; if not, write to the Free
17
Software Foundation, Inc., 675 Massachusetss Ave, Cambridge,
20
Corresponding concerning ESO-MIDAS should be addressed as follows:
21
Internet e-mail: midas@eso.org
22
Postal address: European Southern Observatory
23
Data Management Division
24
Karl-Schwarzschild-Strasse 2
25
D 85748 Garching bei Muenchen
27
===========================================================================*/
29
/* @(#)ag_cdef.c 19.1 (OAA-ASTRONET) 02/25/03 13:52:57 */
31
* HEADER : ag_cdef.c - Vers 3.6.001 - Sep 1993 - L. Fini, OAA
32
* - Vers 3.6.000 - Oct 1991 - L. Fini, OAA
46
/*****************************************************************************/
47
/*++ AG_CDEF (C callable) */
49
/* AG_CDEF Define clipping area */
52
/* Redefine the clipping area. Clipping area is a subset of the current view-*/
53
/* port onto which graphic data are mapped when in USER mode. It defaults to */
54
/* the current viewport limits, but may be defined smaller than that, e.g. */
55
/* in order to leave space for labels and comments around the plot. */
57
/* Clipping area redefinition also resets aspect ratio control (see AG_SSET, */
60
void AG_CDEF (x1,x2,y1,y2)
62
double x1,x2,y1,y2; /* Clipping area bounds [0.0..1.0]. They must */
63
/* be also enclosed into the current viewport. */
64
/* (x1<x2) and (y1<y2) */
67
static char *modnam = "CDEF";
70
extern void AG_DMSG();
71
extern void AGL_sgbl();
73
AGL_status.errstat=AGLNOERR;
75
AG_DMSG(modnam,(char *)0);
77
xxx[0]=x1; xxx[1]=x2; xxx[2]=y1; xxx[3]=y2;
79
#ifndef NO_METAFILE_SUPPORT
80
if ( DY(filact) == SOFTMETAFILE ) { /* store data into metafile */
81
enum METACODE cod = MFCDEF;
82
is = fwrite((char *)&cod,sizeof(int),1,DY(metafile));
83
is = fwrite((char *)xxx,sizeof(float),4,DY(metafile));
85
AGL_puterr(MFWRITERR,modnam);
89
if(AGL_status.curvwp == VWPEMPTY) { /* test if viewport active */
90
AGL_puterr(NOVWPERR,modnam);
95
if((x1<XVWLOW)||(x2>XVWUP)|| /* test params. validity */
96
(y1<YVWLOW)||(y2>YVWUP)||
99
AGL_puterr(ILLBOUWNG,modnam);
103
XCLOW = x1; /* Current clipping area */
104
XCLUP = x2; /* (incl. aspect ratio control) */
108
XSVLOW = x1; /* Original clipping area */
109
XSVUP = x2; /* (No aspect ratio control) */
114
if(AGL_status.errstat != AGLNOERR)