Skip to content
Newer
Older
100644 396 lines (347 sloc) 13.6 KB
3675745 @camillol added MapView
authored Oct 14, 2011
1 import processing.opengl.*;
2 import com.modestmaps.*;
3 import com.modestmaps.core.*;
4 import com.modestmaps.geo.*;
5 import com.modestmaps.providers.*;
d727a20 @camillol background rendering of buffers
authored Oct 29, 2011
6 import java.util.concurrent.*;
3675745 @camillol added MapView
authored Oct 14, 2011
7
8 class MapView extends View {
9 InteractiveMap mmap;
d46044f @pjimen5 UFOInfoBox+LimitMapZoom
pjimen5 authored Oct 21, 2011
10 float zoomValue = 4;
11 float minZoom = 4;
95ab44d @pjimen5 SighingsDetailsViewUpdates
pjimen5 authored Oct 23, 2011
12 float maxZoom = 15;
e952c0c @camillol can choose type of drawing
authored Oct 30, 2011
13 int minPointSize= 5;
60a76c2 @pjimen5 InformationalBox
pjimen5 authored Oct 22, 2011
14 int maxPointSize = 45;
44698ff @pjimen5 filterByUFOType+DrawingAirports
pjimen5 authored Oct 28, 2011
15 int minIconSize= 10;
f051126 @pjimen5 DrawingSightings+SizeIconsAccordingZoom
pjimen5 authored Oct 19, 2011
16 int maxIconSize = 25;
17 int minDistSize = 1;
44698ff @pjimen5 filterByUFOType+DrawingAirports
pjimen5 authored Oct 29, 2011
18 int maxDistSize = 150;
e9fc876 @pjimen5 AddedDetailViewForSightings
pjimen5 authored Oct 21, 2011
19 Sighting clickedSighting;
60a76c2 @pjimen5 InformationalBox
pjimen5 authored Oct 22, 2011
20 Place clickedPlace;
3675745 @camillol added MapView
authored Oct 14, 2011
21
d4325f8 @camillol tiled map overlay
authored Oct 23, 2011
22 int MAX_BUFFERS_TO_KEEP = 64;
23
24
d727a20 @camillol background rendering of buffers
authored Oct 30, 2011
25 Map<Coordinate, Future<PGraphics>> buffers;
26 ExecutorService bufferExec;
ac40bd5 @camillol optional tiled buffering
authored Oct 23, 2011
27 boolean USE_BUFFERS = true;
afeb1eb @camillol experimental buffer for map overlay
authored Oct 22, 2011
28
24fbd23 @camillol only draw places in area that needs to be drawn
authored Oct 25, 2011
29 double TILE_EXPAND_FACTOR = 0.05; // as a fraction of the tile size
30
e952c0c @camillol can choose type of drawing
authored Oct 30, 2011
31 boolean DRAW_ALL_TYPES = false;
d727a20 @camillol background rendering of buffers
authored Oct 30, 2011
32
3675745 @camillol added MapView
authored Oct 14, 2011
33 MapView(float x_, float y_, float w_, float h_)
34 {
35 super(x_, y_, w_, h_);
36 mmap = new InteractiveMap(papplet, new Microsoft.HybridProvider(), w, h);
d46044f @pjimen5 UFOInfoBox+LimitMapZoom
pjimen5 authored Oct 21, 2011
37 // mmap = new InteractiveMap(papplet, new Microsoft.AerialProvider());
38 /* String template = "http://{S}.mqcdn.com/tiles/1.0.0/osm/{Z}/{X}/{Y}.png";
39 String[] subdomains = new String[] { "otile1", "otile2", "otile3", "otile4"}; // optional
40 mmap = new InteractiveMap(papplet, new TemplatedMapProvider(template, subdomains));*/
41
d4325f8 @camillol tiled map overlay
authored Oct 23, 2011
42 mmap.MAX_IMAGES_TO_KEEP = 64;
afeb1eb @camillol experimental buffer for map overlay
authored Oct 22, 2011
43 mmap.setCenterZoom(new Location(39,-98), int(zoomValue));
44
d727a20 @camillol background rendering of buffers
authored Oct 30, 2011
45 buffers = new LinkedHashMap<Coordinate, Future<PGraphics>>(MAX_BUFFERS_TO_KEEP, 0.75, true) {
46 protected boolean removeEldestEntry(Entry<Coordinate, Future<PGraphics>> eldest) {
47 if (size() > MAX_BUFFERS_TO_KEEP) {
48 eldest.getValue().cancel(true);
49 this.remove(eldest.getKey());
50 }
51 return false;
d4325f8 @camillol tiled map overlay
authored Oct 23, 2011
52 }
53 };
d727a20 @camillol background rendering of buffers
authored Oct 30, 2011
54 bufferExec = Executors.newSingleThreadExecutor();
d4325f8 @camillol tiled map overlay
authored Oct 23, 2011
55 }
56
56348f4 @camillol reload sighting counts only
authored Oct 25, 2011
57 void rebuildOverlay()
58 {
d727a20 @camillol background rendering of buffers
authored Oct 30, 2011
59 for (Future<PGraphics> future : buffers.values()) {
60 future.cancel(true);
61 }
56348f4 @camillol reload sighting counts only
authored Oct 25, 2011
62 buffers.clear();
63 }
64
d4325f8 @camillol tiled map overlay
authored Oct 23, 2011
65 void drawOverlay()
66 {
67 double sc = mmap.sc;
68 double tx = mmap.tx;
69 double ty = mmap.ty;
70
71 // translate and scale, from the middle
72 pushMatrix();
73 translate(width/2, height/2);
74 scale((float)sc);
75 translate((float)tx, (float)ty);
76
77 // find the bounds of the ur-tile in screen-space:
78 float minX = screenX(0,0);
79 float minY = screenY(0,0);
80 float maxX = screenX(mmap.TILE_WIDTH, mmap.TILE_HEIGHT);
81 float maxY = screenY(mmap.TILE_WIDTH, mmap.TILE_HEIGHT);
82
83 int zoom = mmap.getZoom();
84 int cols = (int)pow(2,zoom);
85 int rows = (int)pow(2,zoom);
86
87 // find start and end columns
88 // println("minX " + minX + " maxX " + maxX + " cols " + cols);
89 int minCol = (int)floor(cols * (0-minX) / (maxX-minX));
3dcf3e8 @camillol overlay with chicago location
authored Oct 23, 2011
90 int maxCol = (int)ceil(cols * (w-minX) / (maxX-minX)) - 1;
d4325f8 @camillol tiled map overlay
authored Oct 23, 2011
91 int minRow = (int)floor(rows * (0-minY) / (maxY-minY));
3dcf3e8 @camillol overlay with chicago location
authored Oct 23, 2011
92 int maxRow = (int)ceil(rows * (h-minY) / (maxY-minY)) - 1;
d4325f8 @camillol tiled map overlay
authored Oct 23, 2011
93
94 minCol = constrain(minCol, 0, cols);
95 maxCol = constrain(maxCol, 0, cols);
96 minRow = constrain(minRow, 0, rows);
97 maxRow = constrain(maxRow, 0, rows);
98
99 scale(1.0f/pow(2, zoom));
100 int count = 0;
101 for (int col = minCol; col <= maxCol; col++) {
102 for (int row = minRow; row <= maxRow; row++) {
103 // source coordinate wraps around the world:
104 Coordinate coord = mmap.provider.sourceCoordinate(new Coordinate(row,col,zoom));
105
106 // let's make sure we still have ints:
107 coord.row = round(coord.row);
108 coord.column = round(coord.column);
109 coord.zoom = round(coord.zoom);
110
111 if (!buffers.containsKey(coord))
d727a20 @camillol background rendering of buffers
authored Oct 30, 2011
112 buffers.put(coord, bufferExec.submit(new BufferMaker(coord)));
d4325f8 @camillol tiled map overlay
authored Oct 23, 2011
113
d727a20 @camillol background rendering of buffers
authored Oct 30, 2011
114 if (buffers.get(coord).isDone()) {
115 try {
116 PGraphics img = buffers.get(coord).get();
117 image(img, coord.column*mmap.TILE_WIDTH, coord.row*mmap.TILE_HEIGHT, mmap.TILE_WIDTH, mmap.TILE_HEIGHT);
118 } catch (InterruptedException e) {
119 println(e);
120 } catch (ExecutionException e) {
121 println(e);
122 }
123 }
d4325f8 @camillol tiled map overlay
authored Oct 23, 2011
124 count++;
125 }
126 }
127 popMatrix();
128 // println("images: " + count + " col " + minCol + " " + maxCol + " rows " + minRow + " " + maxRow);
129 }
130
ac40bd5 @camillol optional tiled buffering
authored Oct 23, 2011
131 void applyMapToTileMatrix(PGraphics buffer, Coordinate tileCoord) {
132 buffer.translate(-tileCoord.column * mmap.TILE_WIDTH, -tileCoord.row * mmap.TILE_HEIGHT);
133 buffer.scale(pow(2, tileCoord.zoom));
134 buffer.translate(-(float)mmap.tx, -(float)mmap.ty);
135 buffer.scale(1.0/(float)mmap.sc);
136 buffer.translate(-mmap.width/2, -mmap.height/2);
137 }
138
d4325f8 @camillol tiled map overlay
authored Oct 23, 2011
139 PGraphics makeOverlayBuffer(Coordinate coord) {
ac40bd5 @camillol optional tiled buffering
authored Oct 23, 2011
140 // println("makebuf: " + coord);
d4325f8 @camillol tiled map overlay
authored Oct 23, 2011
141 PGraphics buf = createGraphics(mmap.TILE_WIDTH, mmap.TILE_HEIGHT, JAVA2D);
142 buf.beginDraw();
24fbd23 @camillol only draw places in area that needs to be drawn
authored Oct 25, 2011
143 /* if ((coord.row + coord.column) % 2 == 0) {
d4325f8 @camillol tiled map overlay
authored Oct 23, 2011
144 buf.background(255,0,0,128);
145 }
ac40bd5 @camillol optional tiled buffering
authored Oct 23, 2011
146 buf.text(coord.toString(), 50, 50);*/
3dcf3e8 @camillol overlay with chicago location
authored Oct 23, 2011
147
148 // we want to be compatible with drawing code that calls mmap.locationPoint
ac40bd5 @camillol optional tiled buffering
authored Oct 23, 2011
149 applyMapToTileMatrix(buf, coord);
24fbd23 @camillol only draw places in area that needs to be drawn
authored Oct 25, 2011
150
151 // only draw places inside this tile, but with a little margin to account for markers that cross tile boundaries
152 Location loc1 = mmap.provider.coordinateLocation(coord);
153 Coordinate coord2 = new Coordinate(coord.row + 1, coord.column + 1, coord.zoom);
154 Location loc2 = mmap.provider.coordinateLocation(coord2);
155
706cecd @pjimen5 Map+Tree updates
pjimen5 authored Oct 29, 2011
156 drawPlaces(buf, placesInRect(cityTree, loc1, loc2, TILE_EXPAND_FACTOR));
2e33fd5 @pjimen5 animationWithTimer
pjimen5 authored Oct 29, 2011
157 if (showAirports)
706cecd @pjimen5 Map+Tree updates
pjimen5 authored Oct 30, 2011
158 drawAirports(buf,placesInRect(airportTree,loc1,loc2,TILE_EXPAND_FACTOR));
2e33fd5 @pjimen5 animationWithTimer
pjimen5 authored Oct 30, 2011
159 if (showMilitaryBases)
706cecd @pjimen5 Map+Tree updates
pjimen5 authored Oct 30, 2011
160 drawMilitaryBases(buf,placesInRect(militaryBaseTree,loc1,loc2,TILE_EXPAND_FACTOR));
2e33fd5 @pjimen5 animationWithTimer
pjimen5 authored Oct 30, 2011
161 if (showWeatherStation)
706cecd @pjimen5 Map+Tree updates
pjimen5 authored Oct 30, 2011
162 drawWeatherStations(buf,placesInRect(weatherStationTree,loc1,loc2,TILE_EXPAND_FACTOR));
3dcf3e8 @camillol overlay with chicago location
authored Oct 23, 2011
163
d4325f8 @camillol tiled map overlay
authored Oct 23, 2011
164 buf.endDraw();
165 return buf;
3675745 @camillol added MapView
authored Oct 14, 2011
166 }
167
d727a20 @camillol background rendering of buffers
authored Oct 30, 2011
168 class BufferMaker implements Callable<PGraphics> {
169 Coordinate coord;
170 BufferMaker(Coordinate coord)
171 {
172 this.coord = coord;
173 }
174
175 PGraphics call()
176 {
177 return makeOverlayBuffer(coord);
178 }
179 }
180
3675745 @camillol added MapView
authored Oct 14, 2011
181 void drawContent()
182 {
ff69b0a @camillol added mouse wheel support to map
authored Oct 19, 2011
183 imageMode(CORNER); // modestmaps needs this - I sent a patch, but who knows when it'll be committed
3675745 @camillol added MapView
authored Oct 14, 2011
184 mmap.draw();
9874feb @camillol drag map, fix map positioning
authored Oct 19, 2011
185
ac40bd5 @camillol optional tiled buffering
authored Oct 23, 2011
186 if (USE_BUFFERS) drawOverlay();
44698ff @pjimen5 filterByUFOType+DrawingAirports
pjimen5 authored Oct 29, 2011
187 else{
706cecd @pjimen5 Map+Tree updates
pjimen5 authored Oct 30, 2011
188 drawPlaces(papplet.g, cityMap.values());
189 drawAirports(papplet.g, airportMap.values());
2e33fd5 @pjimen5 animationWithTimer
pjimen5 authored Oct 30, 2011
190 drawMilitaryBases(papplet.g,militaryBaseMap.values());
191 drawWeatherStations(papplet.g,weatherStationMap.values());
44698ff @pjimen5 filterByUFOType+DrawingAirports
pjimen5 authored Oct 29, 2011
192
193 }
194
b77cea0 @pjimen5 CallUpdateCitiesWhenSettingsChange
pjimen5 authored Oct 24, 2011
195 drawPlacesInformationBox();
196
9874feb @camillol drag map, fix map positioning
authored Oct 20, 2011
197 }
198
ff69b0a @camillol added mouse wheel support to map
authored Oct 20, 2011
199 boolean contentMouseWheel(float lx, float ly, int delta)
200 {
10e05a6 @pjimen5 lastupdates
pjimen5 authored Oct 25, 2011
201 if ( ly > (settingsView.y+settingsView.h) && ly < (sightingDetailsView.y)){
202 float sc = 1.0;
203 if (delta < 0) {
204 sc = 1.05;
205 }
206 else if (delta > 0) {
207 sc = 1.0/1.05;
208 }
209 float mx = lx - w/2;
210 float my = ly - h/2;
211 mmap.tx -= mx/mmap.sc;
212 mmap.ty -= my/mmap.sc;
213 if (mmap.sc*sc > 16 && mmap.sc*sc < 900){
214 mmap.sc *= sc;
215 zoomValue = ceil(map((int)mmap.sc,16,900,minZoom,maxZoom));
216 }
217 mmap.tx += mx/mmap.sc;
218 mmap.ty += my/mmap.sc;
ff69b0a @camillol added mouse wheel support to map
authored Oct 20, 2011
219 }
220 return true;
221 }
e9fc876 @pjimen5 AddedDetailViewForSightings
pjimen5 authored Oct 21, 2011
222
b77cea0 @pjimen5 CallUpdateCitiesWhenSettingsChange
pjimen5 authored Oct 25, 2011
223 boolean contentClicked(float px, float py)
e9fc876 @pjimen5 AddedDetailViewForSightings
pjimen5 authored Oct 21, 2011
224 {
b77cea0 @pjimen5 CallUpdateCitiesWhenSettingsChange
pjimen5 authored Oct 25, 2011
225 if (clickedPlace == null){
226 detailsAnimator.target(height);
227 }
228 else if (sightingDetailsView.place!=clickedPlace){
229 sightingDetailsView.place = clickedPlace;
2202254 @camillol isolated DB access layer
authored Oct 29, 2011
230 sightingDetailsView.setSightings(data.sightingsForCity(mapv.clickedPlace));
b77cea0 @pjimen5 CallUpdateCitiesWhenSettingsChange
pjimen5 authored Oct 25, 2011
231 detailsAnimator.target(height-200);
232 }
233
e9fc876 @pjimen5 AddedDetailViewForSightings
pjimen5 authored Oct 21, 2011
234 return true;
235 }
236
9874feb @camillol drag map, fix map positioning
authored Oct 20, 2011
237 boolean mouseDragged(float px, float py)
238 {
10e05a6 @pjimen5 lastupdates
pjimen5 authored Oct 25, 2011
239 if ( py > (settingsView.y+settingsView.h) && py < (sightingDetailsView.y)){
240 mmap.mouseDragged();
241 }
242 return true;
3675745 @camillol added MapView
authored Oct 14, 2011
243 }
f051126 @pjimen5 DrawingSightings+SizeIconsAccordingZoom
pjimen5 authored Oct 20, 2011
244
44698ff @pjimen5 filterByUFOType+DrawingAirports
pjimen5 authored Oct 29, 2011
245 void drawAirports(PGraphics buffer, Iterable<Place> airports){
246 buffer.imageMode(CENTER);
247 buffer.noStroke();
248 buffer.fill(airportAreaColor,40);
249 for (Place airport : airports) {
250 float pointSize = map(zoomValue, minZoom, maxZoom, minDistSize, maxDistSize);
251 float iconSize = map(zoomValue,minZoom,maxZoom,minIconSize,maxIconSize);
252 Point2f p = mmap.locationPoint(airport.loc);
253 buffer.ellipse(p.x,p.y,pointSize,pointSize);
254 buffer.image(airplaneImage,p.x,p.y,iconSize,iconSize);
255 }
f051126 @pjimen5 DrawingSightings+SizeIconsAccordingZoom
pjimen5 authored Oct 20, 2011
256 }
257
d8ca394 @pjimen5 DrawingMilitaryBases
pjimen5 authored Oct 28, 2011
258 void drawMilitaryBases(PGraphics buffer, Iterable<Place> militaryBases){
259 buffer.imageMode(CENTER);
260 buffer.noStroke();
1b99571 @pjimen5 DrawingWeatherStations
pjimen5 authored Oct 28, 2011
261 buffer.fill(militaryBaseColor,40);
d8ca394 @pjimen5 DrawingMilitaryBases
pjimen5 authored Oct 29, 2011
262 for (Place militaryBase : militaryBases) {
263 float pointSize = map(zoomValue, minZoom, maxZoom, minDistSize, maxDistSize);
264 float iconSize = map(zoomValue,minZoom,maxZoom,minIconSize,maxIconSize);
265 Point2f p = mmap.locationPoint(militaryBase.loc);
266 buffer.ellipse(p.x,p.y,pointSize,pointSize);
267 buffer.image(militaryBaseImage,p.x,p.y,iconSize,iconSize);
268 }
269 }
270
1b99571 @pjimen5 DrawingWeatherStations
pjimen5 authored Oct 29, 2011
271 void drawWeatherStations(PGraphics buffer, Iterable<Place> weatherStations){
272 buffer.imageMode(CENTER);
273 buffer.noStroke();
274 buffer.fill(weatherStationColor,40);
275 for (Place weatherStation : weatherStations) {
276 float pointSize = map(zoomValue, minZoom, maxZoom, minDistSize, maxDistSize);
277 float iconSize = map(zoomValue,minZoom,maxZoom,minIconSize,maxIconSize);
278 Point2f p = mmap.locationPoint(weatherStation.loc);
279 buffer.ellipse(p.x,p.y,pointSize,pointSize);
280 buffer.image(weatherStationImage,p.x,p.y,iconSize,iconSize);
281 }
282 }
283
24fbd23 @camillol only draw places in area that needs to be drawn
authored Oct 25, 2011
284 void drawPlaces(PGraphics buffer, Iterable<Place> places) {
afeb1eb @camillol experimental buffer for map overlay
authored Oct 22, 2011
285 buffer.imageMode(CENTER);
adeea9f @pjimen5 ChangeIconForEllipses
pjimen5 authored Oct 30, 2011
286 buffer.strokeWeight(0.5);
c36fe9b @camillol try drawing all types
authored Oct 30, 2011
287
288 buffer.noStroke();
24fbd23 @camillol only draw places in area that needs to be drawn
authored Oct 25, 2011
289 for (Place place : places) {
430e863 @pjimen5 yearQuery
pjimen5 authored Oct 25, 2011
290 if (place.sightingCount > 0){
291 Point2f p = mmap.locationPoint(place.loc);
e952c0c @camillol can choose type of drawing
authored Oct 30, 2011
292 if (DRAW_ALL_TYPES) {
293 int boxsz = ceil(sqrt(place.sightingCount));
294 int boxx = 0;
295 int boxy = 0;
296 buffer.pushMatrix();
297 buffer.translate(p.x - boxsz/2, p.y - boxsz/2);
298 int idx = 0;
299 for (SightingType st : sightingTypeMap.values()) {
300 buffer.fill(st.colr);
301 int count = place.counts[idx];
302 while (count > 0) {
303 if (boxx == boxsz){
304 boxx = 0;
305 boxy++;
306 }
307 int len = min(boxsz - boxx, count);
308 buffer.rect(boxx, boxy, len, 1);
309 boxx += len;
310 count -= len;
c36fe9b @camillol try drawing all types
authored Oct 30, 2011
311 }
e952c0c @camillol can choose type of drawing
authored Oct 30, 2011
312 idx++;
c36fe9b @camillol try drawing all types
authored Oct 30, 2011
313 }
e952c0c @camillol can choose type of drawing
authored Oct 30, 2011
314 buffer.popMatrix();
315 } else {
4bc6668 @camillol fix use of sightingtype color
authored Oct 30, 2011
316 SightingType st = mainSightingTypeForPlace(place);
e952c0c @camillol can choose type of drawing
authored Oct 30, 2011
317 float maxPointValue = map(zoomValue, minZoom, maxZoom, minPointSize, maxPointSize);
318 float dotSize = map(place.sightingCount, minCountSightings, maxCountSightings, minPointSize, maxPointValue);
319
4bc6668 @camillol fix use of sightingtype color
authored Oct 30, 2011
320 if (st == null) {
e952c0c @camillol can choose type of drawing
authored Oct 30, 2011
321 buffer.stroke(0);
322 buffer.fill(255);
323 buffer.ellipse(p.x, p.y, dotSize, dotSize);
324 }
325 else {
326 buffer.noStroke();
4bc6668 @camillol fix use of sightingtype color
authored Oct 30, 2011
327 buffer.fill(st.colr,150);
e952c0c @camillol can choose type of drawing
authored Oct 30, 2011
328 buffer.ellipse(p.x, p.y, dotSize, dotSize);
329 //buffer.image((sightingTypeMap.get(place.sightingType)).icon, p.x, p.y, dotSize, dotSize);
330 }
adeea9f @pjimen5 ChangeIconForEllipses
pjimen5 authored Oct 30, 2011
331 }
430e863 @pjimen5 yearQuery
pjimen5 authored Oct 25, 2011
332 }
a675529 @camillol simplified data loading
authored Oct 22, 2011
333 }
334 }
335
4bc6668 @camillol fix use of sightingtype color
authored Oct 30, 2011
336 SightingType mainSightingTypeForPlace(Place place)
337 {
338 /* I now load sighting counts for all types, but this calculates the values we had before */
339 int typeOfSightingCount = 0;
340 SightingType sightingType = null;
341 int idx = 0;
342 for (SightingType st : sightingTypeMap.values()) {
343 if (place.counts[idx] > 0) {
344 typeOfSightingCount++;
345 sightingType = st;
346 }
347 idx++;
348 }
349 if (typeOfSightingCount == 1) return sightingType;
350 else return null;
351 }
352
60a76c2 @pjimen5 InformationalBox
pjimen5 authored Oct 22, 2011
353 void drawPlacesInformationBox() {
354 imageMode(CENTER);
b748dec @camillol only scan points around cursor for overlay
authored Oct 25, 2011
355
356 float maxPointValue = map(zoomValue, minZoom, maxZoom, minPointSize, maxPointSize);
357 Location loc1 = mmap.pointLocation(mouseX - maxPointValue, mouseY - maxPointValue); // TODO: use local coordinates (although they're identical in this app)
358 Location loc2 = mmap.pointLocation(mouseX + maxPointValue, mouseY + maxPointValue);
359
706cecd @pjimen5 Map+Tree updates
pjimen5 authored Oct 30, 2011
360 for (Place place : placesInRect(cityTree,loc1, loc2, 0.0)) {
c90ff16 @pjimen5 RetrievedPlaces&SightingsByDateTime
pjimen5 authored Oct 25, 2011
361 if (place.sightingCount > 0){
362 float dotSize = map(place.sightingCount, minCountSightings, maxCountSightings, minPointSize, maxPointValue);
363 Point2f p = mmap.locationPoint(place.loc);
364 if (dist(mouseX,mouseY,p.x,p.y) < dotSize/2 && p.y > (settingsView.y+settingsView.h) && p.y < (sightingDetailsView.y)){
365 textSize(normalFontSize);
366 strokeWeight(1);
367 String textToPrint = "Click on it to see details";
368 String numOfSightings = "Total # of sightings = " + str(place.sightingCount);
369 if (textToPrint.length() < place.name.length())
370 textToPrint = place.name;
371 if (textToPrint.length() < numOfSightings.length())
372 textToPrint = numOfSightings;
373 fill(infoBoxBackground);
4bc6668 @camillol fix use of sightingtype color
authored Oct 30, 2011
374 SightingType st = mainSightingTypeForPlace(place);
375 if (st == null) stroke(255);
376 else stroke(st.colr);
c90ff16 @pjimen5 RetrievedPlaces&SightingsByDateTime
pjimen5 authored Oct 26, 2011
377 float w_ = textWidth(textToPrint)+10;
378 float x_ = (p.x+w_ > w)?w-w_-5:p.x;
a4a5056 @pjimen5 ChangeFont
pjimen5 authored Oct 28, 2011
379 float h_ = (textAscent() + textDescent()) * 3 + 15;
c90ff16 @pjimen5 RetrievedPlaces&SightingsByDateTime
pjimen5 authored Oct 26, 2011
380 float y_ = (p.y+h_ > sightingDetailsView.y)?sightingDetailsView.y-h_-5:p.y;
381 rect(x_,y_,w_,h_);
382 fill(textColor);
061667c @pjimen5 UpdateSomeColors
pjimen5 authored Oct 30, 2011
383 text(place.name, x_ + (w_ - textWidth(place.name))/2 ,y_+5);
c90ff16 @pjimen5 RetrievedPlaces&SightingsByDateTime
pjimen5 authored Oct 26, 2011
384 text(numOfSightings,x_ + (w_ - textWidth(numOfSightings))/2, (y_+ h_/3)+5);
385 textSize(smallFontSize);
a4a5056 @pjimen5 ChangeFont
pjimen5 authored Oct 29, 2011
386 text("Click on it to see details",x_+5,y_+h_-12);
c90ff16 @pjimen5 RetrievedPlaces&SightingsByDateTime
pjimen5 authored Oct 26, 2011
387 if (mousePressed){
388 clickedPlace = place;
389 }
390 }
391 }
392 }
d46044f @pjimen5 UFOInfoBox+LimitMapZoom
pjimen5 authored Oct 21, 2011
393 }
3675745 @camillol added MapView
authored Oct 14, 2011
394 }
395
Something went wrong with that request. Please try again.