~ubuntu-branches/debian/jessie/eso-midas/jessie

« back to all changes in this revision

Viewing changes to libsrc/agl/ag_cdef.c

  • Committer: Package Import Robot
  • Author(s): Ole Streicher
  • Date: 2014-04-22 14:44:58 UTC
  • Revision ID: package-import@ubuntu.com-20140422144458-okiwi1assxkkiz39
Tags: upstream-13.09pl1.2+dfsg
ImportĀ upstreamĀ versionĀ 13.09pl1.2+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* @(#)ag_cdef.c        19.1 (ES0-DMD) 02/25/03 13:52:57 */
 
2
/*===========================================================================
 
3
  Copyright (C) 1995 European Southern Observatory (ESO)
 
4
 
 
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.
 
9
 
 
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.
 
14
 
 
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, 
 
18
  MA 02139, USA.
 
19
 
 
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 
 
26
                        GERMANY
 
27
===========================================================================*/
 
28
 
 
29
/* @(#)ag_cdef.c        19.1  (OAA-ASTRONET) 02/25/03 13:52:57   */
 
30
/*
 
31
 * HEADER : ag_cdef.c      - Vers 3.6.001  - Sep 1993 -  L. Fini, OAA
 
32
 *                         - Vers 3.6.000  - Oct 1991 -  L. Fini, OAA
 
33
 *
 
34
 *
 
35
 *                           C INTERFACE MODULE
 
36
 */
 
37
 
 
38
 
 
39
#include <aglenvr.h>
 
40
#include <aglstat.h>
 
41
 
 
42
 
 
43
 
 
44
 
 
45
 
 
46
/*****************************************************************************/
 
47
/*++                         AG_CDEF (C callable)                            */
 
48
 
 
49
/* AG_CDEF    Define clipping area                                           */
 
50
 
 
51
 
 
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.          */
 
56
 
 
57
/* Clipping area redefinition also resets aspect ratio control (see AG_SSET, */
 
58
/* item: "GEOM").                                                            */
 
59
 
 
60
void AG_CDEF (x1,x2,y1,y2)
 
61
 
 
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)                         */
 
65
                                                                         /*--*/
 
66
{
 
67
static char *modnam = "CDEF";
 
68
float xxx[4];
 
69
int is;
 
70
extern void AG_DMSG();
 
71
extern void AGL_sgbl();
 
72
 
 
73
AGL_status.errstat=AGLNOERR;
 
74
 
 
75
AG_DMSG(modnam,(char *)0);
 
76
 
 
77
xxx[0]=x1; xxx[1]=x2; xxx[2]=y1; xxx[3]=y2;
 
78
 
 
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));
 
84
        if(is != 4) 
 
85
                AGL_puterr(MFWRITERR,modnam);
 
86
}
 
87
#endif
 
88
 
 
89
if(AGL_status.curvwp == VWPEMPTY) {     /* test if viewport active       */
 
90
        AGL_puterr(NOVWPERR,modnam);
 
91
        return;
 
92
}
 
93
 
 
94
 
 
95
if((x1<XVWLOW)||(x2>XVWUP)||           /* test params. validity            */
 
96
   (y1<YVWLOW)||(y2>YVWUP)||
 
97
   ((x2-x1) <= 0.0)||
 
98
   ((y2-y1) <= 0.0)  )  { 
 
99
        AGL_puterr(ILLBOUWNG,modnam); 
 
100
        return; 
 
101
}
 
102
 
 
103
XCLOW = x1;                            /* Current clipping area            */
 
104
XCLUP = x2;                            /* (incl. aspect ratio control)     */
 
105
YCLOW = y1;
 
106
YCLUP = y2;
 
107
 
 
108
XSVLOW = x1;                           /* Original clipping area           */
 
109
XSVUP = x2;                            /* (No aspect ratio control)        */
 
110
YSVLOW = y1;
 
111
YSVUP = y2;
 
112
 
 
113
AGL_sgbl();
 
114
if(AGL_status.errstat != AGLNOERR) 
 
115
        AGL_siger(modnam);
 
116
}
 
117