input
stringlengths
10
828
output
stringlengths
5
107
public void add list listener list listener l delegate add list listener l
adds a listener for objects being added to or removed from the set
public r2 point translate r2 vect v x v x y v y return this
shift this point on given vector
public void remove list listener list listener l delegate remove list listener l
removes a listener for objects being added to or removed from the set
public r2 vect normal double len length if len 0 incorrect situation return new r2 vect 1 0 return new r2 vect y len x len
returns perpendicular vector of length 1
public r2 point transform double coeff x coeff y coeff return this
multiply this point by a scalar
public r2 point dilate double coeff return transform coeff
the same as transform
private void delete edge r2 point a r2 point b r2 point t polygon perimeter a distance b polygon area t area a b
modify the area and perimeter after deleting of the edge a b
public boolean is visible viewpoint viewpoint return true
returns true if the chunk is within the bounds
public boolean equals object p return p instanceof r2 point x r2 point p x y r2 point p y
two points are equal
public object get object at int idx return items element at idx
returns the object at the given index
public boolean between r2 point s1 r2 point s2 return distance to segment s1 s2 presizion
a point lays between two given points
public void set object id object id id object old this id this id id listeners fire property change object id old id
sets the spots content
public boolean on line r2 point s1 r2 point s2 return distance to line s1 s2 presizion
a point lays on a strait line defined by two points
public string get unique id return uid
returns an opaque unique id for this embedded object
public boolean on line r2 point p r2 vect v return distance to line p v presizion
a point lays on a strait line defined by point and vector
public void set replicated object client replicated object client client this client client load
sets the local replicated object client with which replicated chunks
public double signed area r2 point p1 r2 point p2 return 0 5 r2 vect signed area p1 sub this p2 sub this
signed area of a triangle this p1 p2
public double area r2 point p1 r2 point p2 return math abs signed area p1 p2
area of a triangle this p1 p2 absolute value
public boolean is visible viewpoint viewpoint float rectangle view viewpoint get view bounds we could probably re use our bounds as long as the region s bounds and grid size do not change float w bounds get width grid size float h bounds get height grid size float x coord bounds get x x w float y coord bounds get y y h float rectangle rect new float rectangle x coord y coord w h return view intersects rect
returns true if the chunk is within the bounds
public double area r2 point p1 r2 point p2 r2 point p3 return p1 area p2 p3
area of a triangle p1 p2 p3 absolute value
public boolean is loaded return list null
returns true if the chunks data is currently loaded
public object get object at int idx object obj null the list contains object ids so we have to ask the replicated object client for the actual object the objects should however already have been pre fetched during load try obj client get object object id from string list get item at idx to string catch exception e e print stack trace return obj
returns the object at the given index
public navigable location get current location navigable location p null if control null p control get current location return p
returns the path to the object that we are currently navigated to
public void load properties p for enumeration e p keys e has more elements string key string e next element system err println in load p key key add navigation control key p get property key null
loads object class view class mappings from a properties object
public void set current location navigable location path if control null control set current location path
sets the path to the current location
public dimension get preferred size if control null return control get preferred size else return new dimension 10 10
returns the preferred size of the control
public void load defaults try input stream in navigation registry class get resource as stream default map path system err println in load defaults in in load in catch ioexception e e print stack trace
loads object class view class mappings from the default
public void add navigation control string map class string map helper class if map helper class null classes remove map class else try class cl class for name map helper class classes put map class cl system err println map class map helper class classes put map class map helper class catch exception e e print stack trace
adds a mapping from the name of a class that contains navigable data
public navigation control get navigation control object id id navigation control nc null try class cl class classes get id get classname if cl null system err println found it id get classname nc navigation control cl new instance string hn string classes get id get classname system err println hn from hashtable if hn null system err println find hn nc navigation control class for name hn new instance catch exception e e print stack trace return nc
returns the map helper navigation control for the given object id
public void remove renderable data renderable set factory factory remove pairs factory null data remove pairs factory null dynamic data remove pairs factory null sources
removes all renderers and component sources associated with the
public class get type return shape arc class
returns the type of objects that renderable sets created by this
public shapefile renderable set factory get factory string data url shapefile renderable set factory f null synchronized cache f shapefile renderable set factory cache get data url if f null try f new shapefile renderable set factory data url catch exception e system out println dump happens in shapefile cache get factory method e print stack trace f new shapefile renderable set factory cache put data url f return f
returns a factory for loading shapefiles from the given url
protected shape arc get shape arc from renderable object renderable if renderable instanceof shape arc return shape arc renderable return null
can be overridden by subclasses to extract a shape arc from some
public renderable set get renderable set viewpoint viewpoint return set
returns the set of renderable objects for the viewpoint
private void update viewpoint point p viewpoint vp full view get viewpoint float rectangle view vp get view bounds grrrr n s translation of y coords p y thumbnail get size height p y float point center thumbnail get translated coordinates p full view set viewpoint new viewpoint vp get world bounds new float rectangle center get x view get width 2 center get y view get height 2 view get width view get height vp get rendered dimension
moves the full views viewpoint based on activity at the given point
public boolean is visible viewpoint viewpoint float rectangle view viewpoint get view bounds boolean visible true if magnification threshold 0 dimension sz viewpoint get rendered dimension double mag math max view get width sz width view get height sz height visible mag magnification threshold system err println shapefile renderable set factory mag mag if visible visible has bounds view get x view get width x1 view get y view get height y1 view get x x2 view get y y2 return visible
returns true if the chunk is within the bounds
public void init servlet config config
setting up map widget in init
public boolean building selected float point p viewpoint vp renderer set viewpoint vp set point p vp true renderable set set get renderable set vp if set null set get size 0 return true else return false
returns whether or not the selected point lands on a building
public void set point point p set point renderer get translated coordinates p renderer get viewpoint true
sets the selected point
public shape arc get unclaimed building shape arc arc null the structure property check is a hack to ensure that only consider the top renderer if renderer null unclaimed buildings null renderer get property structure property null viewpoint vp renderer get viewpoint renderable set unc bldg unclaimed buildings get renderable set vp if unc bldg get size 0 arc shape arc unc bldg get object at 0 return arc
returns a shapearc for the currently selected unclaimed building
protected shape arc renderer get shape arc renderer color c boolean fill return new shape arc renderer c fill
can be overridden by subclasses to return specialized shape arc renderers
public object get object at int idx return data get shape idx
returns the object at the given index
protected string get building name object obj return
should be overriden to return the name of the building described by
public float rectangle get bounds return new float rectangle float x1 float y1 float x2 x1 float y2 y1
returns the bounds of the chunk
protected int get building levels object obj return 1
should be overriden to return the number of levels in the building
public void mouse moved mouse event evt check source evt if current null current mouse moved evt
delegate all mouse events to the current tool if we have one
public int get level count object obj set get object at 0 return get building levels obj
returns the number of levels the building has
public component get component object obj jcomponent l null if obj instanceof spot spot obj get level level l new spot component spot obj this causes deadlock problems since we re outside of the awt s thread l set location out of sight if tool manager null tool manager attach l return l
return the component that we use to draw a spot
public float rectangle get bounds float rectangle b null if chunks size 0 b new float rectangle else b shape arc chunk chunks element at 0 get bounds for int i 1 i chunks size i b b union shape arc chunk chunks element at i get bounds return b
returns the bounds of the data in the factory calculated from the
private properties load properties from query http servlet request request properties props new properties string name for enumeration enumer request get parameter names enumer has more elements name string enumer next element props set property name string request get parameter name return props
loads all of the chat settings off the http query string and
public void set world float rectangle world object old this world this world world fire property change world old world
sets the rectangle representing the maps world bounds
public float rectangle get world if world null world new float rectangle return world
returns the rectangle representing the maps world bounds
public int get vertical scroll mode return vertical scroll mode
returns the vertical scroll mode for the map
public void set vertical scroll mode int mode int old vertical scroll mode this vertical scroll mode mode if old vertical scroll mode fire property change vertical scroll mode new integer old new integer vertical scroll mode
sets the vertical scroll mode for the map
public void set horizontal scroll mode int mode int old horizontal scroll mode this horizontal scroll mode mode if old horizontal scroll mode fire property change horizontal scroll mode new integer old new integer horizontal scroll mode
sets the horizontal scroll mode for the map
protected int get floor count viewpoint vp string building x string building y point p new point integer parse int building x integer parse int building y map set viewpoint vp float point building coords map get translated coordinates p bldg handler set point building coords vp return bldg handler get level count
returns the number of floors for the given building coordinates
public void init map config config this config config string n config get name if n null n length 0 n untitled map name set text n init size button set enabled config get size 0 float rectangle world config get world if world null world new float rectangle x set text world x y set text world y width set text world w height set text world h v scroll mode set selected index config get vertical scroll mode h scroll mode set selected index config get horizontal scroll mode
initialized the panel from the given map config
public void save map config config config set name name get text float rectangle world new float rectangle try world x float parse float x get text world y float parse float y get text world w float parse float width get text world h float parse float height get text catch exception e e print stack trace config set world world config set vertical scroll mode v scroll mode get selected index config set horizontal scroll mode h scroll mode get selected index
saves the values on the panel to the given map config object
public void save properties props component context context props set property class prop get class get name props set property name prop name get text props set property data prop url get text props set property color prop get string for color color get background props set property thumbnail prop on thumbnail is selected props set property thumbnail color prop get string for color thumbnail color get background props set property fill prop fill is selected props set property structure prop has structures is selected
saves the contents of the config panel to the given properties
protected int get floor count replicated object client client spot current spot get user spot client viewpoint vp get viewpoint from spot current spot float point fp current spot get location bldg handler set point fp vp return bldg handler get level count
returns the number of floors for the building were in
public float rectangle get bounds properties props float rectangle bounds null try string data url props get property data prop shapefile renderable set factory f shapefile cache get instance get factory data url new shapefile renderable set factory f add shapefile new java net url props get property data prop f load all renderable chunks bounds f get bounds catch exception e e print stack trace bounds new float rectangle return bounds
returns the bounds of the data in the layer
protected void do edit room room replicated object client client http servlet request request string desc string request get parameter description property support listener new property support client client get object id room room add property change listener listener room set description desc room remove property change listener listener sleep for a bit try thread sleep 100 catch exception e
performs the update of a rooms description
public navigable location get current location system err println get current location in map com system err println current return current
returns the path to the object that we are currently navigated to
protected room get room replicated object client client throws ioexception get the current spot and its room id shared spot spot get spot client if the spot doesn t exist then return null if spot null return null object id room id spot get object id create the room if it doesn t exist yet if room id null room id make room client spot get the room return room client get object room id
returns the room that the user is currently at
public void set shapefile cache shapefile cache cache this cache cache
sets the shapefile cache used by this map object
public void save properties props component context context props set property class prop get class get name props set property name prop name get text props set property data prop oid get text props set property color prop get string for color structure color get background props set property selection color prop get string for color undefined structure color get background props set property linked layer prop structure layer get text
saves the contents of the config panel to the given properties
public void set current location navigable location path system err println in map component set current location method system err println path system err println current if path current object old current current path listeners fire property change current location old current
sets the path to the current location
public string get navigation control return navigation control
returns the unique id of the object in our embedded object set that
public void set navigation control string nav uid object old navigation control navigation control nav uid fire property change navigation control old navigation control
sets the unique id of the object in our embedded object set that
protected zoomable renderer get floor replicated object client client spot current spot get user spot client if current spot null return get floor current spot current spot get level else return null
returns the zoomable renderer that represents the floor of the current building
public dimension get preferred size rectangle r new rectangle 65 65 360 300 return new dimension r x r width r y r height
returns the preferred size of the control
public float rectangle get bounds properties props float rectangle bounds null try shapefile renderable set factory f new shapefile renderable set factory f add shapefile new java net url props get property data prop f load all renderable chunks bounds f get bounds catch exception e e print stack trace bounds new float rectangle return bounds fix this return new float rectangle
returns the bounds of the data in the layer
protected zoomable renderer get floor replicated object client client int floor spot current spot get user spot client if current spot null return get floor current spot floor else return null
returns the zoomable renderer that represents the floor of the current building
public void set markers url icon files string labels int count marker panel set markers icon files labels count
passses on the set markers call to our marker panel
public vector get markers return marker panel get markers
returns the collection of markers
public void repaint dimension size get size if layered pane null layered pane set preferred size size layered pane set maximum size size layered pane set minimum size size layered pane set size size if map panel null map panel set size size if marker panel null marker panel set size size
overrides repaint method so that the background panel and each
public void component resized component event evt radar map size radar map get size marker panel set corner radar map size width
invoked when component has been resized
public shared marker replicated object client client object id id this client client try data shared map client get object id catch exception e e print stack trace start sharing the data in the map if data null replication manager get instance start sharing data client
construtor to handle the case where shared map already exists and
protected zoomable renderer get floor spot current spot int floor num we re inside so we need to set some stuff viewpoint vp get viewpoint from spot current spot float point fp current spot get location system out println getting floor floor num for current spot get name system out println location fp system out println viewpoint vp map set viewpoint vp if bldg handler building selected fp vp return bldg handler get floor floor num int map size get width else system out println get floor structure not found return null
returns the zoomable renderer that represents the floor of the current building
public void remove try replication manager get instance stop sharing data client client delete object client get object id data catch exception e e print stack trace
method for removing the shared data when the map is removed
public shared marker map replicated object client client object id id this client client try data shared map client get object id catch exception e e print stack trace start sharing the data in the map if data null replication manager get instance start sharing data client string map item smi string map item data get new string map item markers id object id from string smi to string shared marker set new shared marker set client id
construtor to handle the case where shared map already exists and
public shared marker set replicated object client client object id id this client client try data shared list client get object id catch exception e e print stack trace table new hashtable for int i 0 i data get size i string list item sli string list item data get item at i id object id from string sli get value table put sli new shared marker client id start sharing the data in the map if data null replication manager get instance start sharing data client data add list listener this
construtor to handle the case where shared list already exists and
public void set markers url icon files string labels int count marker m null point p null for int i 0 i count i m new marker icon files i labels i p new point corner int size m get preferred size width 2 i m get preferred size height i 1 20 m set bounds p x p y m get preferred size width m get preferred size height m add mouse listener this m add mouse motion listener this add m all markers add element m repaint
sets and lays out the markers for the panel
public void remove try delete each shared marker object for int i 0 i data get size i string list item sli string list item data get item at i shared marker m shared marker table get sli table remove sli data remove item sli m remove delete the set itself replication manager get instance stop sharing data client client delete object client get object id data catch exception e e print stack trace
method for removing the shared data when the map is removed
public void remove try delete the shared viewbounds and shared cursor objects shared marker set remove delete the viewpoint itself replication manager get instance stop sharing data client client delete object client get object id data catch exception e e print stack trace
method for removing the shared data when the map is removed
public void state changed change event evt double adjusted value apply quadratic slider get value system out println quadratic zoom control adjusted value adjusted value double zoom view model get min zoom view model get max zoom view model get min zoom adjusted value 100 0 system out println quadratic zoom control zoomed in value view model get max zoom system out println quadratic zoom control zoomed out value view model get min zoom system out println quadratic zoom control zoom value zoom view model set zoom zoom
method to handle a slider change by dragging
public void set value double new zoom double view model min zoom view model get min zoom double view model max zoom view model get max zoom double temp new zoom view model min zoom 100 0 double temp2 view model max zoom view model min zoom int new value int math round apply quadratic temp temp2 if new value slider get value slider set value new value
sets the zoom value based on a basic map view model
public void mouse dragged mouse event evt rectangle old bounds marker moving get bounds point new p new point old bounds x evt get point x cursor position x old bounds y evt get point y cursor position y rectangle new bounds new rectangle new p x new p y old bounds width old bounds height marker moving set location new p new bounds add old bounds repaint new bounds
mouse motion listener interface
public void pass up click coordinate click user viewpoint model set map focus click x click y
passes a click on a jradar view up to the users local
public void element added map event evt view bounds set bounds get xposition get yposition get xextent get yextent update dependents view bounds
if someone changes any of the view bounds variables update the display
public void set entrance events boolean marker moving this marker moving marker moving
sets whether an entrance exit mouse events should be used
protected zoomable renderer get floor string floor num viewpoint vp float point fp zoomable renderer floor image null bldg handler set point fp vp floor image bldg handler get floor integer parse int floor num int map size get width return floor image
returns the zoomable renderer that represents the floor of the selected building
public void component resized component event evt system out println basic map view component resized called basic map view model set size get size
invoked when component has been resized
public boolean discrete view focus double new focus boolean result false if new focus min max min 2 0 result true int i 0 while result i 3 if new focus large views i large width 2 0 result true else i i 0 while result i 9 if new focus small views i small width 2 0 result true else i return result
tests whether the a coordinate is the center of any of the discrete
public void swap sub map if this submap null zoomable renderer zr zoom get zoomable renderer component tnail get thumbnail component m get map set map tnail if zr submap zoom set zoomable renderer world renderer else zoom set zoomable renderer submap evidently this needs to go after the set map call set thumbnail m
swap the main map and the submap
public void set min view width float min view width this min view width min view width
sets the minimum viewable width
public void set shared data shared viewpoint list shared data this shared data shared data this table new hashtable viewpoint remove viewpoint listener local view layered pane remove local view local view null for enumeration e shared data get users e has more elements shared viewpoint v shared viewpoint e next element added v
displays a set of shared data rather than just the local users
public double closer to double position double value1 double value2 double closer value if value1 value2 if position value1 value2 position closer value value1 else closer value value2 else if position value2 value1 position closer value value2 else closer value value1 return closer value
tests which value a position is closer to assumes position is
public map tool manager get map tool manager return tool manager
returns the map tool manager for this map
public jradar view get radar view return radar view
method to return just the radar view component