input
stringlengths
10
828
output
stringlengths
5
107
protected void paint geo layers graphics2 d g2 for geo layer layer geo layers layer project projection layer draw layer g2 default layer project projection default layer draw layer g2
paint the geographic layers
public double get min latitude return min lat
return the minimum latitude in degrees
public void set background image image image background image image if image null world color null
set the background image for this geo canvas
public void move to point pt int steps move to pt x pt y steps
move to the specified point in the appropriate number of steps
public double get min longitude return min lon
return the minimum longitude in degrees
public void set geo bounds geo bounds geo bounds bounds geo bounds invalidate
set the geographic bounds
public void set layers collection geo layer layers geo layers clear geo layers add all layers
set the geographic layers
public void set data data record node data node
sets the data record of this geo bounds object
public void set world color color color world color color
set the world color
public void add coord geo coord coord date date coords put date coord
add a geographic coordinate with an associated date to this track
public geo polyline create polyline return new geo polyline coords values to array new geo coord 0
create a geo polyline which represents the path of this track
public geo coord get current value return cur loc
returns the current value based upon the current time setting for this
private int calc map level double ang rad get geo bounds get angular radius double win rad get bounds get width 2 if win rad 0 double cels win rad 256 1 double log span math log math pi cels ang rad math log 2 map level int math round log span return map level
calculate the google map level
public date get cur time return cur time
returns the time for the object
private image get image int x int y int lvl image img null if y 1 string key x x y y z lvl img img cache get key if img null try url url new url url base key image icon icn new image icon url img icn get image img cache put key img catch exception exc create a default buffered image for now img new buffered image 256 256 buffered image type int argb return img
get the google map image cell for the specified coordinate and level
public geo coord get value int index geo coord coord null if index coords size int count 0 for geo coord val coord coords values if count index coord val coord count return coord
return the value for the given index
public boolean is timed return coords is empty
return whether the track is indexed by time
public void set cur time date time cur time time cur loc get value cur time
sets the time for the object
public void set data data record data record data data record
set the data record associated with this track
public geo reader add file string file name esri reader reader readers get file name if reader null reader new esri reader base url file name readers put file name reader list geo shape shapes reader get shapes for geo shape shape shapes data record data shape get data string name data get name if places contains key name places put name file name return reader
add a specific shape file to the locator
public geo reader get reader string type return readers get type
get the particular reader associated with a type
public void show hint string text int millis point top left top frame get location on screen glass set text loc loc x top left x loc y top left y glass set text text top frame repaint delay millis glass set text top frame repaint glass set visible false glass remove all
displays a pop up message for descriptive text
public geo coord get start coord return start coord
get the coordinate of the start of the line of bearing
public void set url base string url url base url
sets the the google maps url base
public boolean contains point2 d point return path contains point
tests if the specified point is inside the boundary of the shape
public int get row count return layer data size
get the number of rows
public boolean contains rectangle2 d rect return path contains rect
tests if the interior of the shape entirely contains the specified
public void set data list geo layer layers layer data layers
sets the data for the table model
public rectangle get bounds return path get bounds
returns an integer rectangle that completely encloses the shape
public void add shape geo shape shape add timed shape shape null
add a shape to the kml file
private void fire state changed change event evt new change event this for change listener listener listeners listener state changed evt
fire change events to all listeners
public void set layers list geo layer layers layer list layers model set data layer list pack
sets the list of layers
public void add timed shape geo shape shape time span span add timed shape shape span doc elem
add a shape with a time component
private void build doc try doc doc build new document doc set xml version 1 0 element kml elem doc create element kml kml elem set attribute xmlns http earth google com kml 2 1 doc append child kml elem doc elem doc create element document kml elem append child doc elem catch exception exc exc print stack trace
build the xml document for the kml file
private void add to record element elem data record rec string tag string value get child value elem tag if value null rec set text field tag value
adds a text value to a data record
private color convert hex to color string hex color int alpha integer decode 0x hex color substring 0 2 int blue integer decode 0x hex color substring 2 4 int green integer decode 0x hex color substring 4 6 int red integer decode 0x hex color substring 6 8 return new color red green blue alpha
convert google color hex values to color objects
public void clear build doc
clear and reset the writer
private string get child value element parent string tag string value null node list kids parent get elements by tag name tag for int j 0 j kids get length j element val elem element kids item j node first child val elem get first child if first child instanceof text text val text text first child value val text get data return value
gets the value of a tagged text child element
public void close try transformer transform new domsource doc new stream result out writer out writer close catch exception exc exc print stack trace
close the kml file writing the contents to the specified output stream
public boolean intersects rectangle2 d rect return path intersects rect
tests if the interior of the geo polyline intersects the interior of a
private void load from elements element kml elem node list style list kml elem get elements by tag name style for int j 0 j style list get length j element style elem element style list item j load style style elem node list place list kml elem get elements by tag name placemark for int j 0 j place list get length j element place elem element place list item j add placemark place elem style map clear
load the geographic data from elements of the kml document
public void project projection proj path reset boolean first true point pts proj project coords for point point pts if point null if first first false path move to point x point y else path line to point x point y else coordinate could not be projected start new segment first true plot reverse path to close segment preventing chord fills for int i pts length 2 i 0 i if pts i null if first path move to pts i x pts i y else path line to pts i x pts i y else first true
projects the geographic coordinates into the given projection
protected element create description data record rec element desc elem null if rec null string buffer desc new string buffer if rec get link null desc append a href rec get link rec get name a br string rec str rec write fields to string replace n br desc append rec str string desc str desc to string trim if desc str length 0 desc elem doc create element description cdatasection cdata doc create cdatasection desc to string desc elem append child cdata return desc elem
create a description element
private element create marker geo marker marker element point elem doc create element point element coord elem create text element coordinates to degree string marker get center point elem append child coord elem return point elem
create a kml element from a marker
private geo shape read marker element elem string coord str get child value elem coordinates geo coord coords convert coord string coord str return new geo marker coords 0
read marker data from an element
private geo shape read polygon element elem string coord str get child value elem coordinates geo coord coords convert coord string coord str return new geo polygon coords
read polygon data from an element
private element create multi shape geo multi shape shape element multi elem doc create element multi geometry for geo shape segment shape multi elem append child create shape segment return multi elem
create a multishape element
private geo shape read polyline element elem string coord str get child value elem coordinates geo coord coords convert coord string coord str return new geo polyline coords
read polyline data from an element
public void set max sleep int sleep seconds max sleep sleep seconds 1000
set the maximum time to sleep between generating random events
public void add alt name string alt name alt names add alt name
add an alternate name for this object
public int compare to geo object other int comp type compare to other get type if comp 0 long pop comp other get population population comp int math signum pop comp if comp 0 comp get name compare to other get name return comp
compare this geographic object to another geographic object
public long get population return population
get the population for this object
public geo feature type get type return type
get the geographic feature type for this object
public void set country string cntry name country cntry name
set the country name for this object
public double eccentricity return eccentricity
get the eccentricity of the geoid
public double polar radius return eq radius math sqrt 1 eccentricity eccentricity
calculate the polar radius of the geoid in meters
public double radius return eq radius
get the equatorial radius of the geoid in meters
public void set feature type geo feature type feature type type feature type
set the geographic feature type
public void set population long pop population pop
set the population
private jlabel get image int x int y int lvl jlabel lbl new jlabel if y 1 try url url new url http mt0 google com mt n 404 v w2 25 x x y y zoom lvl image icon icn new image icon url lbl new jlabel icn catch exception exc create a default buffered image for now image img new buffered image 256 256 buffered image type int argb lbl new jlabel new image icon img return lbl
get the google map image cell for the specified coordinate and level
public int get map level return disp level
get the currently displayed map level
public void popup map int level find location if level 0 popup map level
pop up the map display
private element create text element string tag string body element tag elem null if tag null body null tag elem doc create element tag text body txt doc create text node body tag elem append child body txt return tag elem
create an element containing a text node with the specified body text
public void set location location location loc location loc valid false
set the location currently displayed by this popup map
public geo bounds get geo bounds return geo bounds
get the geographic bounds for the projection
public geoid get geoid return geoid
get the geoid used for projections
public geo coord get proj center return center
get the center of projection
public rectangle get view bounds return view bounds
get the view bounds
public void set geo bounds geo bounds bounds geo bounds bounds rescale
set the geographic bounds for the projection
private element create time element time span span string date str date fmt format span get start date element time elem null if span is instantaneous time elem doc create element time stamp time elem append child create text element when date str else time elem doc create element time span time elem append child create text element begin date str date str date fmt format span get stop date time elem append child create text element end date str return time elem
create a time primitive element
public void set geoid geoid proj geoid geoid proj geoid
set the geoid used for projections
public void set proj center geo coord proj center center proj center
set the center of projection
public void set view bounds rectangle bounds view bounds bounds rescale
set the view bounds
public geo feature type get feature type string loc name return geo feature type other
get the feature type for the location name
public string get content type return application vnd google earth kml xml
get the content type generated by this writer
public string get country string loc name geo object geo obj get geo object loc name return geo obj null null geo obj get country
get the country containing the named location
public void set destination string destination throws ioexception set writer new buffered writer new file writer destination
set the destination for this writer
private void load shapes try read dbf catch ioexception ioe ignore assume there is no data file available try read shp catch ioexception ioe throw new runtime exception cannot find shape file base name at base ioe
load the shapes and associated data from the shape files
public void set writer writer writer out writer writer
set the writer
private string to degree string geo coord coord return coord get longitude coord get latitude coord get altitude
convert a geographic coordinate to a degree string
private geo marker read point char pt type throws ioexception double lon read double shp stream double lat read double shp stream double alt 0 if pt type m read double shp stream eat measure else if pt type z alt read double shp stream read double shp stream eat measure geo coord coord new geo coord lat lon alt geo marker point new geo marker coord return point
read a geographic point shape
public geo object get geo object string loc name geo object geo obj cache get loc name if geo obj null cache contains key loc name loc name length 2 if geo path starts with http geo obj get geo from url loc name else if loaded geo obj get geo from file loc name if geo obj null cache put loc name geo obj cache put geo obj get name geo obj for string alt geo obj get alt names cache put alt geo obj return geo obj
get the geographic object for the given location name
private string to hex color color color int alpha color get alpha int red color get red int blu color get blue int grn color get green string alpha str alpha 16 integer to string alpha 16 0 integer to string alpha 16 string red str red 16 integer to string red 16 0 integer to string red 16 string grn str grn 16 integer to string grn 16 0 integer to string grn 16 string blu str blu 16 integer to string blu 16 0 integer to string blu 16 return alpha str red str grn str blu str
convert a color into a hexidecimal string
public string get geo path return geo path
get the geonames path
public void write data collection geo shape data for geo shape shape data add shape shape
write a collection of geoshapes
public string get real name string loc name geo object geo obj get geo object loc name return geo obj null null geo obj get name
get the real name known by geo names for the location name
public geo bounds get geo bounds return new geo bounds coord get latitude coord get latitude coord get longitude coord get longitude
get the geographic bounds for this shape
public boolean contains double x double y return trans shape contains x y
tests if the specified coordinates are inside the boundary of the shape
public boolean contains double x double y double w double h return trans shape contains x y w h
tests if the interior of the shape entirely contains the specified
public boolean contains point2 d point return trans shape contains point
tests if the specified point is inside the boundary of the shape
public boolean contains rectangle2 d rect return trans shape contains rect
tests if the interior of the shape entirely contains the specified
public rectangle get bounds return trans shape get bounds
returns an integer rectangle that completely encloses the shape
public rectangle2 d get bounds2 d return trans shape get bounds2 d
returns a high precision rectangle that completely encloses the shape
public boolean is retry flag return retry
return whether the locator allows retrying if the servers are busy
public geo coord get center return coord
get the center of the shape
public shape get marker shape return render style null new line2 d double 0 0 0 0 render style get marker shape
get the shape used to render the marker
public path iterator get path iterator affine transform at return trans shape get path iterator at
returns an iterator object that iterates along the shape boundary and
private void calc center radius for geo shape shape this if center null center shape get center radius shape get radius else geo coord shape ctr shape get center double shape rad shape get radius double dist center get distance shape ctr if radius dist shape rad double azimuth center get azimuth shape ctr double new rad radius shape rad dist 2 0 double move new rad radius center center get bearing point move azimuth radius new rad
calculate the center and radius for this collection of shapes
public path iterator get path iterator affine transform at double flatness return trans shape get path iterator at flatness
returns an iterator object that iterates along the shape boundary and
public boolean contains double x double y boolean inside false for geo shape shape this inside shape contains x y return inside
tests if the specified coordinates are inside the boundary of the shape