kiwi-postgis  Version 0.1.0.0
PolyshapeReader.XReader Class Reference

from Apache 2.0 licensed: https://github.com/googlemaps/android-maps-utils/blob/master/library/src/com/google/maps/android/PolyUtil.java More...

Collaboration diagram for PolyshapeReader.XReader:

Public Member Functions

 XReader (final Reader input, GeometryFactory shpFactory) throws IOException
 
Coordinate [] readPoints () throws IOException
 
double readLat () throws IOException
 
double readLng () throws IOException
 
double readDouble () throws IOException
 
int peek ()
 
char readKey () throws IOException
 
boolean isData ()
 
boolean isDone ()
 
boolean isEvent ()
 

Package Functions

int readInt () throws IOException
 

Package Attributes

int lat = 0
 
int lng = 0
 
int head = -1
 
final Reader input
 
final GeometryFactory shpFactory
 

Detailed Description

Constructor & Destructor Documentation

◆ XReader()

XReader ( final Reader  input,
GeometryFactory  shpFactory 
) throws IOException

References PolyshapeReader.XReader.input, and PolyshapeReader.XReader.shpFactory.

210  {
211  this.input = input;
212  this.shpFactory = shpFactory;
213  head = input.read();
214  }
final GeometryFactory shpFactory
Definition: PolyshapeReader.java:208

Member Function Documentation

◆ isData()

boolean isData ( )

Referenced by PolyshapeReader.XReader.readPoints().

249  {
250  return head >= '?';
251  }

◆ isDone()

boolean isDone ( )

Referenced by PolyshapeReader.read().

253  {
254  return head < 0;
255  }

◆ isEvent()

boolean isEvent ( )

Referenced by PolyshapeReader.read().

257  {
258  return head > 0 && head < '?';
259  }

◆ peek()

int peek ( )

References PolyshapeReader.XReader.head.

Referenced by PolyshapeReader.read().

238  {
239  return head;
240  }

◆ readDouble()

double readDouble ( ) throws IOException

References PolyshapeReader.XReader.readInt().

Referenced by PolyshapeReader.read().

234  {
235  return readInt() * 1e-5;
236  }

◆ readInt()

int readInt ( ) throws IOException
package

Referenced by PolyshapeReader.XReader.readDouble(), PolyshapeReader.XReader.readLat(), and PolyshapeReader.XReader.readLng().

262  {
263  int b;
264  int result = 1;
265  int shift = 0;
266  do {
267  b = head - 63 - 1;
268  result += b << shift;
269  shift += 5;
270 
271  head = input.read();
272  } while (b >= 0x1f);
273  return (result & 1) != 0 ? ~(result >> 1) : (result >> 1);
274  }

◆ readKey()

char readKey ( ) throws IOException

Referenced by PolyshapeReader.read().

242  {
243  lat = lng = 0; // reset the offset
244  char key = (char)head;
245  head = input.read();
246  return key;
247  }

◆ readLat()

double readLat ( ) throws IOException

◆ readLng()

double readLng ( ) throws IOException

◆ readPoints()

Coordinate [] readPoints ( ) throws IOException

References PolyshapeReader.XReader.isData(), PolyshapeReader.XReader.readLat(), and PolyshapeReader.XReader.readLng().

Referenced by PolyshapeReader.read().

216  {
217  List<Coordinate> coords=new ArrayList<Coordinate>();
218  while(isData()) {
219  coords.add(new Coordinate(readLat(),readLng()));
220  }
221  return coords.toArray(new Coordinate[0]);
222  }

Member Data Documentation

◆ head

int head = -1
package

◆ input

final Reader input
package

◆ lat

int lat = 0
package

◆ lng

int lng = 0
package

◆ shpFactory

final GeometryFactory shpFactory
package