GRASS
Class Mapinfo

java.lang.Object
  |
  +--GRASS.Mapinfo

public class Mapinfo
extends java.lang.Object

Wraps GRASS library struc Map_info which is used to access vector files in GRASS database. This class does not have any public constructors. Use methods in libvect to create objects of this class.

See Also:
libvect

Method Summary
 long getOffset()
          Inquiries file offset.
 java.lang.String toString()
          Returns a string representation of the object.
 int V2_area_att(int area)
          Retrieves area's attribute number.
 int V2_line_att(int line)
          Retrieves line's attribute number.
 int V2_num_areas()
          Returns total number of areas in the vector Map.
 int V2_num_lines()
          Returns total number of lines in the vector Map.
 linepnts V2_read_line(int line)
          This routine will read a line from the vector map at the specified line index in the map.
 void Vect_close()
          This routine closes an open vector map and cleans up the structures associated with it.
 linepnts Vect_get_area_points(int area)
          Creates a new linepnts structure with the list of points which describe an area in clockwise order.
 int Vect_level()
          Returns the number of the level at which a Map is opened at or -1 if Map is not opened.
 linepnts Vect_read_next_line()
          This is the primary routine for reading through a vector map.
 void Vect_remove_constraints()
          Removes all constraints currently affecting this object.
 void Vect_rewind()
          Resets the read pointer to the beginning of the map.
 void Vect_set_constraint_region(double n, double s, double e, double w)
          This method is broken! I will fix it in GRASS-JNI release for GRASS 5. This routine will set a restriction on reading only those lines which fall entirely or partially in the specified rectangular region.
 void Vect_set_constraint_type(int type)
          This routine will set a restriction on reading only those lines which match the types specified.
 long Vect_write_line(int type, linepnts points)
          This method will write out a line.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getOffset

public long getOffset()
Inquiries file offset.
Returns:
file offset

Vect_level

public int Vect_level()
Returns the number of the level at which a Map is opened at or -1 if Map is not opened. Wraps GRASS library routine:
 Vect_level (Map)
   struct Map_info *Map;
 
See the GRASS 4.2 Programmer's Manual, Section 13.7. Miscellaneous (Vector Library)
Returns:
level at which a Map is opened at, -1 if Map is not opened

Vect_read_next_line

public linepnts Vect_read_next_line()
                             throws GRASSException
This is the primary routine for reading through a vector map. It simply reads the next line from the map into the linepnts object. This method should not be used in conjunction with any other read_line method. Wraps GRASS library routine:
 Vect_read_next_line (Map, Points)
    struct Map_info *Map;
    struct line_pnts *Points;
 
See the GRASS 4.2 Programmer's Manual, Section 13.4. Reading and writing vector maps
Returns:
linepents object read or null on EOF
Throws:
GRASSException - if an error was returned by the GRASS routine

V2_num_lines

public int V2_num_lines()
                 throws GRASSException
Returns total number of lines in the vector Map. Works for vector layers of level 2 or higher. Wraps GRASS library routine:
 V2_num_lines (Map)
    struct Map_info *Map; 
 
See the GRASS 4.2 Programmer's Manual, Section 13.7. Miscellaneous (Reading and writing vector maps)
Returns:
number of arcs in vector map
Throws:
GRASSException - if an error was returned by the GRASS routine (usually it means that open vector layer is not of Level 2)

V2_num_areas

public int V2_num_areas()
                 throws GRASSException
Returns total number of areas in the vector Map. Works for vector layers of level 2 or higher. Wraps GRASS library routine:
 V2_num_areas (Map)
    struct Map_info *Map; 
 
See the GRASS 4.2 Programmer's Manual, Section 13.7. Miscellaneous (Reading and writing vector maps)
Returns:
number of areas in vector map
Throws:
GRASSException - if an error was returned by the GRASS routine (usually it means that open vector layer is not of Level 2)

Vect_get_area_points

public linepnts Vect_get_area_points(int area)
                              throws GRASSException
Creates a new linepnts structure with the list of points which describe an area in clockwise order. Wraps GRASS library routine:
 Vect_get_area_points (Map, area, Points)
     struct Map_info *Map;
     int area;
     struct line_pnts *Points;
 
See the GRASS 4.2 Programmer's Manual, Section 13.7. Miscellaneous (Reading and writing vector maps)
Parameters:
int - area number in interval 1..V2_num_areas()
Returns:
linepents object read
Throws:
GRASSException - if an error was returned by the GRASS routine (usually it means that open vector layer is not of Level 2 or I/O problem)

V2_read_line

public linepnts V2_read_line(int line)
                      throws GRASSException
This routine will read a line from the vector map at the specified line index in the map. Refer to V2_num_lines for number of lines in the map. This function is available at level 2 or higher. Wraps GRASS library routine:
 V2_read_line (Map, Points, line)
      struct Map_info *Map;
      struct line_pnts *Points;
      int line;
 
See the GRASS 4.2 Programmer's Manual, Section 13.4. Reading and writing vector maps
Parameters:
int - area number in interval 1..V2_num_lines()
Returns:
linepents object read or null on EOF
Throws:
GRASSException - if an error was returned by the GRASS routine (usually it means that open vector layer is not of Level 2 or I/O problem)

V2_line_att

public int V2_line_att(int line)
Retrieves line's attribute number. This function is available at level 2 or higher. Wraps GRASS library routine:
 V2_line_att (Map, line)
      struct Map_info *Map;
      int line;
 
See the GRASS 4.2 Programmer's Manual, Section 13.7. Miscellaneous (Reading and writing vector maps)
Parameters:
int - area number in interval 1..V2_num_lines()
Returns:
line's attribute number

V2_area_att

public int V2_area_att(int area)
Retrieves area's attribute number. This function is available at level 2 or higher. Wraps GRASS library routine:
 V2_area_att (Map, line)
      struct Map_info *Map;
      int area;
 
See the GRASS 4.2 Programmer's Manual, Section 13.7. Miscellaneous (Reading and writing vector maps)
Parameters:
int - area number in interval 1..V2_num_areas()
Returns:
area's attribute number

Vect_rewind

public void Vect_rewind()
Resets the read pointer to the beginning of the map. This only affects the routine Vect_read_next_line. Wraps GRASS library routine:
 Vect_rewind (Map)
     struct Map_info *Map;
 
See the GRASS 4.2 Programmer's Manual, Section 13.4. Reading and writing vector maps

Vect_set_constraint_region

public void Vect_set_constraint_region(double n,
                                       double s,
                                       double e,
                                       double w)
This method is broken! I will fix it in GRASS-JNI release for GRASS 5.

This routine will set a restriction on reading only those lines which fall entirely or partially in the specified rectangular region. Vect_read_next_line is the only routine affected by this, and it does NOT cause line clipping. Constraints affect only this Mapinfo specified. They do not affect any other Maps that may be open. Wraps GRASS library routine:
 Vect_set_constraint_region (Map, n, s, e, w)
    struct Map_info *Map;
    double n, s, e, w;
 
See the GRASS 4.2 Programmer's Manual, Section 13.4. Reading and writing vector maps
Parameters:
n - coordinate of the northern edge
s - coordinate of the southern edge
e - coordinate of the eastern edge
w - coordinate of the western edge

Vect_set_constraint_type

public void Vect_set_constraint_type(int type)
This routine will set a restriction on reading only those lines which match the types specified. This can be any combination of types bitwise OR'ed together. For example: linepnts.LINE | linepnts.AREA would exclude any DOT line types. Vect_read_next_line is the only routine affected by this. If type is set to -1, all lines will be read including deleted or dead lines. Wraps GRASS library routine:
 Vect_set_constraint_type (Map, type)
    struct Map_info *Map;
    int type;
 
See the GRASS 4.2 Programmer's Manual, Section 13.4. Reading and writing vector maps
Parameters:
type - constraints type (see linepnts for type values)
See Also:
linepnts

Vect_remove_constraints

public void Vect_remove_constraints()
Removes all constraints currently affecting this object. Wraps GRASS library routine:
 Vect_remove_constraints (Map)
    struct Map_info *Map;
 
See the GRASS 4.2 Programmer's Manual, Section 13.4. Reading and writing vector maps

Vect_write_line

public long Vect_write_line(int type,
                            linepnts points)
                     throws GRASSException
This method will write out a line. The type of line is one of: AREA, LINE, DOT (defined in linepnts) Wraps GRASS library routine:
 long
 Vect_write_line (Map, type, Points)
    struct Map_info *Map;
    int type;
    struct line_pnts *Points;
 
See the GRASS 4.2 Programmer's Manual, Section 13.4. Reading and writing vector maps
Parameters:
type - constraints type (see linepnts for type values)
points - object with feature geometry
Returns:
offset into the file where the line started.
Throws:
GRASSException - if an error code was returned by the GARSS library routine

Vect_close

public void Vect_close()
This routine closes an open vector map and cleans up the structures associated with it. It has to be called before exiting the program or it is called automatically by the finalise() method. When used in conjunction with Vect_open_new, it will cause the final writing of the vector header before closing the vector map. Wraps GRASS library routine:
 Vect_close (Map)
    struct Map_info *Map;
 
See the GRASS 4.2 Programmer's Manual, Section 13.4. Reading and writing vector maps

toString

public java.lang.String toString()
Returns a string representation of the object.
Returns:
String that represents this object -- memory address, level, open flag and current offset.
Overrides:
toString in class java.lang.Object


GRASS-JNI Home Page