xref: /petsc/src/sys/classes/draw/interface/dcoor.c (revision e611a964e9853b74d61a56642fe9d06a6e51780f)
1 
2 /*
3        Provides the calling sequences for all the basic PetscDraw routines.
4 */
5 #include <petsc/private/drawimpl.h>  /*I "petscdraw.h" I*/
6 
7 #undef __FUNCT__
8 #define __FUNCT__ "PetscDrawSetCoordinates"
9 /*@
10    PetscDrawSetCoordinates - Sets the application coordinates of the corners of
11    the window (or page).
12 
13    Not collective
14 
15    Input Parameters:
16 +  draw - the drawing object
17 -  xl,yl,xr,yr - the coordinates of the lower left corner and upper
18                  right corner of the drawing region.
19 
20    Level: advanced
21 
22    Concepts: drawing^coordinates
23    Concepts: graphics^coordinates
24 
25 .seealso: PetscDrawGetCoordinates()
26 
27 @*/
28 PetscErrorCode  PetscDrawSetCoordinates(PetscDraw draw,PetscReal xl,PetscReal yl,PetscReal xr,PetscReal yr)
29 {
30   PetscErrorCode ierr;
31 
32   PetscFunctionBegin;
33   PetscValidHeaderSpecific(draw,PETSC_DRAW_CLASSID,1);
34   draw->coor_xl = xl; draw->coor_yl = yl;
35   draw->coor_xr = xr; draw->coor_yr = yr;
36   if (draw->ops->setcoordinates) {
37     ierr = (*draw->ops->setcoordinates)(draw,xl,yl,xr,yr);CHKERRQ(ierr);
38   }
39   PetscFunctionReturn(0);
40 }
41 
42 #undef __FUNCT__
43 #define __FUNCT__ "PetscDrawGetCoordinates"
44 /*@
45    PetscDrawGetCoordinates - Gets the application coordinates of the corners of
46    the window (or page).
47 
48    Not Collective
49 
50    Input Parameter:
51 .  draw - the drawing object
52 
53    Level: advanced
54 
55    Ouput Parameters:
56 .  xl,yl,xr,yr - the coordinates of the lower left corner and upper
57                  right corner of the drawing region.
58 
59    Concepts: drawing^coordinates
60    Concepts: graphics^coordinates
61 
62 .seealso: PetscDrawSetCoordinates()
63 
64 @*/
65 PetscErrorCode  PetscDrawGetCoordinates(PetscDraw draw,PetscReal *xl,PetscReal *yl,PetscReal *xr,PetscReal *yr)
66 {
67   PetscFunctionBegin;
68   PetscValidHeaderSpecific(draw,PETSC_DRAW_CLASSID,1);
69   PetscValidRealPointer(xl,2);
70   PetscValidRealPointer(yl,3);
71   PetscValidRealPointer(xr,4);
72   PetscValidRealPointer(yr,5);
73   *xl = draw->coor_xl; *yl = draw->coor_yl;
74   *xr = draw->coor_xr; *yr = draw->coor_yr;
75   PetscFunctionReturn(0);
76 }
77