123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- /* D_setup (clear)
- *
- * This is a high level D call.
- * It does a full setup for the current graphics frame.
- *
- * Note: Connection to driver must already be made.
- *
- * clear values:
- * 1: clear frame (visually and coordinates)
- * 0: do not clear frame
- */
- #include <string.h>
- #include <grass/gis.h>
- #include <grass/raster.h>
- #include <grass/display.h>
- /*!
- * \brief graphics frame setup
- *
- * D_setup() sets the source coordinate system to the current region, and
- * adjusts the destination coordinate system to preserve the aspect
- * ratio.
- *
- * Performs a full setup for the current graphics frame:
- * 1) Makes sure there is a current graphics frame (will create a full-screen
- * one, if not);
- * 2) Sets the region coordinates so that the graphics frame and the active
- * module region agree (may change active module region to do this); and
- * 3) Performs graphic frame/region coordinate conversion initialization.
- *
- * If <b>clear</b> is true, the frame is cleared (same as running
- * <i>d.erase</i>.) Otherwise, it is not cleared.
- *
- * \param clear
- * \return none
- */
- void D_setup(int clear)
- {
- struct Cell_head region;
- double dt, db, dl, dr;
- D_get_window(&dt, &db, &dl, &dr);
- G_get_set_window(®ion);
- Rast_set_window(®ion);
- D_do_conversions(®ion, dt, db, dl, dr);
- if (clear)
- D_erase(DEFAULT_BG_COLOR);
- }
- /*!
- * \brief
- *
- * D_setup_unity() sets the source coordinate system to match the
- * destination coordinate system, so that D_* functions use the same
- * coordinate system as R_* functions.
- *
- * If <b>clear</b> is true, the frame is cleared (same as running
- * <i>d.erase</i>.) Otherwise, it is not cleared.
- *
- * \param clear
- * \return none
- */
- void D_setup_unity(int clear)
- {
- double dt, db, dl, dr;
- D_get_window(&dt, &db, &dl, &dr);
- D_set_src(dt, db, dl, dr);
- D_set_dst(dt, db, dl, dr);
- D_update_conversions();
- if (clear)
- D_erase(DEFAULT_BG_COLOR);
- }
- /*!
- * \brief
- *
- * D_setup2() sets the source coordinate system to its arguments, and if
- * the <b>fit</b> argument is non-zero, adjusts the destination coordinate
- * system to preserve the aspect ratio.
- *
- * If <b>clear</b> is true, the frame is cleared (same as running
- * <i>d.erase</i>.) Otherwise, it is not cleared.
- *
- * \param clear
- * \param fit
- * \param s_top
- * \param s_bottom
- * \param s_left
- * \param s_right
- * \return none
- */
- void D_setup2(int clear, int fit, double st, double sb, double sl, double sr)
- {
- double dt, db, dl, dr;
- D_get_window(&dt, &db, &dl, &dr);
- D_set_src(st, sb, sl, sr);
- D_set_dst(dt, db, dl, dr);
- if (fit)
- D_fit_d_to_u();
- D_update_conversions();
- if (clear)
- D_erase(DEFAULT_BG_COLOR);
- }
|