creat_trans.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. ****************************************************************************
  3. *
  4. * MODULE: v.transform
  5. * AUTHOR(S): See other files as well...
  6. * Eric G. Miller <egm2@jps.net>
  7. * PURPOSE: To transform a vector layer's coordinates via a set of tie
  8. * points.
  9. * COPYRIGHT: (C) 2002 by the GRASS Development Team
  10. *
  11. * This program is free software under the GNU General Public
  12. * License (>=v2). Read the file COPYING that comes with GRASS
  13. * for details.
  14. *
  15. *****************************************************************************/
  16. /*
  17. * create_transform_conversion () - main driver routine to prepare
  18. * the transformation equation.
  19. *
  20. * Written by the GRASS Team, 02/16/90, -mh.
  21. */
  22. #include <stdio.h>
  23. #include <stdlib.h>
  24. #include <grass/glocale.h>
  25. #include <grass/gis.h>
  26. #include <grass/vector.h>
  27. #include "trans.h"
  28. #include "local_proto.h"
  29. int create_transform_from_file(struct file_info *Coord)
  30. {
  31. int status;
  32. int n_points;
  33. init_transform_arrays();
  34. n_points = 0;
  35. /* Get the coordinates from the file. */
  36. if ((n_points = get_coor_from_file(Coord->fp)) < 0)
  37. G_fatal_error(_("Error reading coordinates file"));
  38. status = setup_transform(n_points);
  39. if (status != ALL_OK) {
  40. G_message(_("Number of points that have been entered [%d]"),
  41. n_points);
  42. print_transform_error(status);
  43. G_fatal_error(_("Error creating transformation"));
  44. }
  45. if (G_verbose() > G_verbose_std())
  46. print_transform_resids(n_points);
  47. return (0);
  48. } /* create_transform_from_file() */