xref: /petsc/src/sys/classes/draw/interface/dcoor.c (revision 9371c9d470a9602b6d10a8bf50c9b2280a79e45a)
15c6c1daeSBarry Smith 
25c6c1daeSBarry Smith /*
35c6c1daeSBarry Smith        Provides the calling sequences for all the basic PetscDraw routines.
45c6c1daeSBarry Smith */
5af0996ceSBarry Smith #include <petsc/private/drawimpl.h> /*I "petscdraw.h" I*/
65c6c1daeSBarry Smith 
75c6c1daeSBarry Smith /*@
85c6c1daeSBarry Smith    PetscDrawSetCoordinates - Sets the application coordinates of the corners of
95c6c1daeSBarry Smith    the window (or page).
105c6c1daeSBarry Smith 
115c6c1daeSBarry Smith    Not collective
125c6c1daeSBarry Smith 
135c6c1daeSBarry Smith    Input Parameters:
145c6c1daeSBarry Smith +  draw - the drawing object
155c6c1daeSBarry Smith -  xl,yl,xr,yr - the coordinates of the lower left corner and upper
165c6c1daeSBarry Smith                  right corner of the drawing region.
175c6c1daeSBarry Smith 
185c6c1daeSBarry Smith    Level: advanced
195c6c1daeSBarry Smith 
20db781477SPatrick Sanan .seealso: `PetscDrawGetCoordinates()`
215c6c1daeSBarry Smith 
225c6c1daeSBarry Smith @*/
23*9371c9d4SSatish Balay PetscErrorCode PetscDrawSetCoordinates(PetscDraw draw, PetscReal xl, PetscReal yl, PetscReal xr, PetscReal yr) {
245c6c1daeSBarry Smith   PetscFunctionBegin;
255c6c1daeSBarry Smith   PetscValidHeaderSpecific(draw, PETSC_DRAW_CLASSID, 1);
26*9371c9d4SSatish Balay   draw->coor_xl = xl;
27*9371c9d4SSatish Balay   draw->coor_yl = yl;
28*9371c9d4SSatish Balay   draw->coor_xr = xr;
29*9371c9d4SSatish Balay   draw->coor_yr = yr;
30dbbe0bcdSBarry Smith   PetscTryTypeMethod(draw, setcoordinates, xl, yl, xr, yr);
315c6c1daeSBarry Smith   PetscFunctionReturn(0);
325c6c1daeSBarry Smith }
335c6c1daeSBarry Smith 
348f69470aSLisandro Dalcin /*@
358f69470aSLisandro Dalcin    PetscDrawGetCoordinates - Gets the application coordinates of the corners of
368f69470aSLisandro Dalcin    the window (or page).
378f69470aSLisandro Dalcin 
388f69470aSLisandro Dalcin    Not Collective
398f69470aSLisandro Dalcin 
408f69470aSLisandro Dalcin    Input Parameter:
418f69470aSLisandro Dalcin .  draw - the drawing object
428f69470aSLisandro Dalcin 
438f69470aSLisandro Dalcin    Level: advanced
448f69470aSLisandro Dalcin 
4501d2d390SJose E. Roman    Output Parameters:
466b867d5aSJose E. Roman +  xl - the horizontal coordinate of the lower left corner of the drawing region.
476b867d5aSJose E. Roman .  yl - the vertical coordinate of the lower left corner of the drawing region.
486b867d5aSJose E. Roman .  xr - the horizontal coordinate of the upper right corner of the drawing region.
496b867d5aSJose E. Roman -  yr - the vertical coordinate of the upper right corner of the drawing region.
508f69470aSLisandro Dalcin 
51db781477SPatrick Sanan .seealso: `PetscDrawSetCoordinates()`
528f69470aSLisandro Dalcin 
538f69470aSLisandro Dalcin @*/
54*9371c9d4SSatish Balay PetscErrorCode PetscDrawGetCoordinates(PetscDraw draw, PetscReal *xl, PetscReal *yl, PetscReal *xr, PetscReal *yr) {
558f69470aSLisandro Dalcin   PetscFunctionBegin;
568f69470aSLisandro Dalcin   PetscValidHeaderSpecific(draw, PETSC_DRAW_CLASSID, 1);
578f69470aSLisandro Dalcin   PetscValidRealPointer(xl, 2);
588f69470aSLisandro Dalcin   PetscValidRealPointer(yl, 3);
598f69470aSLisandro Dalcin   PetscValidRealPointer(xr, 4);
608f69470aSLisandro Dalcin   PetscValidRealPointer(yr, 5);
61*9371c9d4SSatish Balay   *xl = draw->coor_xl;
62*9371c9d4SSatish Balay   *yl = draw->coor_yl;
63*9371c9d4SSatish Balay   *xr = draw->coor_xr;
64*9371c9d4SSatish Balay   *yr = draw->coor_yr;
658f69470aSLisandro Dalcin   PetscFunctionReturn(0);
668f69470aSLisandro Dalcin }
67