Project

General

Profile

« Previous | Next » 

Revision 347a3650

Added by Andreas Kohlbecker over 12 years ago

skipping site-depoy in maven release plugin

View differences:

cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/geo/EditGeoService.java
87 87
		if(backLayer == null){
88 88
			backLayer = DEFAULT_BACK_LAYER;
89 89
		}
90
		String uriParams = EditGeoServiceUtilities.getDistributionServiceRequestParameterString(distributions, presenceAbsenceTermColors, width, height, bbox, backLayer, langs);
90
		String uriParams = EditGeoServiceUtilities.getDistributionServiceRequestParameterString(distributions, presenceAbsenceTermColors, width, height, bbox, backLayer, null, langs);
91 91

  
92 92
		return uriParams;
93 93
	}
......
128 128
			backLayer = DEFAULT_BACK_LAYER;
129 129
		}
130 130
		String uriParams = EditGeoServiceUtilities.getDistributionServiceRequestParameterString(distCollection,
131
			presenceAbsenceTermColors, width, height, bbox, backLayer, langs);
131
			presenceAbsenceTermColors, width, height, bbox, backLayer, null, langs);
132 132

  
133 133
		return uriParams;
134 134
	}
cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/geo/EditGeoServiceUtilities.java
1 1
// $Id$
2 2
/**
3 3
* Copyright (C) 2007 EDIT
4
* European Distributed Institute of Taxonomy 
4
* European Distributed Institute of Taxonomy
5 5
* http://www.e-taxonomy.eu
6
* 
6
*
7 7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8 8
* See LICENSE.TXT at the top of this package for the full license terms.
9 9
*/
......
56 56
	private static final Logger logger = Logger.getLogger(EditGeoServiceUtilities.class);
57 57

  
58 58
	private static PresenceAbsenceTermBase<?> defaultStatus = PresenceTerm.PRESENT();
59
	
59

  
60 60
	private static IDefinedTermDao termDao;
61
	
61

  
62 62
	/**
63 63
	 * @param termDao
64 64
	 */
65 65
	public static void setTermDao(IDefinedTermDao termDao) {
66 66
		EditGeoServiceUtilities.termDao= termDao;
67 67
	}
68
	
68

  
69 69
	private static HashMap<Class<? extends SpecimenOrObservationBase>, Color> defaultSpecimenOrObservationTypeColors = null;
70 70

  
71 71
	private static HashMap<Class<? extends SpecimenOrObservationBase>, Color> getDefaultSpecimenOrObservationTypeColors() {
......
75 75
			defaultSpecimenOrObservationTypeColors.put(DerivedUnit.class, Color.RED);
76 76
			defaultSpecimenOrObservationTypeColors.put(LivingBeing.class, Color.GREEN);
77 77
			defaultSpecimenOrObservationTypeColors.put(Observation.class, Color.ORANGE);
78
			defaultSpecimenOrObservationTypeColors.put(Specimen.class, Color.GRAY);			
78
			defaultSpecimenOrObservationTypeColors.put(Specimen.class, Color.GRAY);
79 79
		}
80 80
		return defaultSpecimenOrObservationTypeColors;
81 81
	}
......
93 93
			defaultPresenceAbsenceTermBaseColors.put(PresenceTerm.INTRODUCED(), Color.decode("0xff7f00"));
94 94
			defaultPresenceAbsenceTermBaseColors.put(PresenceTerm.INTRODUCED_ADVENTITIOUS(), Color.decode("0xffff33"));
95 95
			defaultPresenceAbsenceTermBaseColors.put(PresenceTerm.INTRODUCED_CULTIVATED(), Color.decode("0xa65628"));
96
			defaultPresenceAbsenceTermBaseColors.put(PresenceTerm.INTRODUCED_NATURALIZED(), Color.decode("0xf781bf"));	
97
			
96
			defaultPresenceAbsenceTermBaseColors.put(PresenceTerm.INTRODUCED_NATURALIZED(), Color.decode("0xf781bf"));
97

  
98 98
			/*
99 99
			 * and now something very hacky ...
100 100
			 * ONLY-A-TEST is set by the Test class EditGeoServiceTest
101
			 * 
101
			 *
102 102
			 * TODO remove according line from
103 103
			 * EditGeoServiceTest.setUp() when the hardcoded colors for flora of
104 104
			 * cyprus are no further needed !!
105 105
			 */
106
			String onlyTest = System.getProperty("ONLY-A-TEST"); // 
106
			String onlyTest = System.getProperty("ONLY-A-TEST"); //
107 107
			if(onlyTest != null && onlyTest.equals("TRUE")){
108 108
				return defaultPresenceAbsenceTermBaseColors;
109 109
			}
110 110
			//special colors for flora of cyprus !!! see HACK above !!!
111 111
			UUID indigenousUuid = UUID.fromString("b325859b-504b-45e0-9ef0-d5c1602fcc0f");
112 112
			UUID indigenousQUuid = UUID.fromString("17bc601f-53eb-4997-a4bc-c03ce5bfd1d3");
113
			
113

  
114 114
			UUID cultivatedQUuid = UUID.fromString("4f31bfc8-3058-4d83-aea5-3a1fe9773f9f");
115
			
115

  
116 116
			UUID casualUuid = UUID.fromString("5e81353c-38a3-4ca6-b979-0d9abc93b877");
117 117
			UUID casualQUuid = UUID.fromString("73f75493-1185-4a3e-af1e-9a1f2e8dadb7");
118
			
118

  
119 119
			UUID naturalizedNonInvasiveUuid = UUID.fromString("1b025e8b-901a-42e8-9739-119b410c6f03");
120 120
			UUID naturalizedNonInvasiveQUuid = UUID.fromString("11f56e2f-c16c-4b3d-a870-bb5d3b20e624");
121
			
121

  
122 122
			UUID naturalizedInvasiveUuid = UUID.fromString("faf2d271-868a-4bf7-b0b8-a1c5ab309de2");
123 123
			UUID naturalizedInvasiveQUuid = UUID.fromString("ac429d5f-e8ad-49ae-a41c-e4779b58b96a");
124
			
124

  
125 125
			UUID questionablelUuid = UUID.fromString("4b48f675-a6cf-49f3-a5ba-77e2c2979eb3");
126 126
			UUID questionableQUuid = UUID.fromString("914e7393-1314-4632-bc45-5eff3dc1e424");
127
			
127

  
128 128
			UUID reportedInErrorUuid = UUID.fromString("38604788-cf05-4607-b155-86db456f7680");
129
			
129

  
130 130
			defaultPresenceAbsenceTermBaseColors.put((PresenceAbsenceTermBase<?>) termDao.load(indigenousUuid), Color.decode("0x339966"));
131 131
			defaultPresenceAbsenceTermBaseColors.put((PresenceAbsenceTermBase<?>) termDao.load(indigenousQUuid), Color.decode("0x339966"));
132
			
132

  
133 133
			defaultPresenceAbsenceTermBaseColors.put((PresenceAbsenceTermBase<?>) termDao.load(cultivatedQUuid), Color.decode("0xbdb76b"));
134
			
134

  
135 135
			defaultPresenceAbsenceTermBaseColors.put((PresenceAbsenceTermBase<?>) termDao.load(casualUuid), Color.decode("0xffff00"));
136 136
			defaultPresenceAbsenceTermBaseColors.put((PresenceAbsenceTermBase<?>) termDao.load(casualQUuid), Color.decode("0xffff00"));
137
			
137

  
138 138
			defaultPresenceAbsenceTermBaseColors.put((PresenceAbsenceTermBase<?>) termDao.load(naturalizedNonInvasiveUuid), Color.decode("0xff9900"));
139 139
			defaultPresenceAbsenceTermBaseColors.put((PresenceAbsenceTermBase<?>) termDao.load(naturalizedNonInvasiveQUuid), Color.decode("0xff9900"));
140
			
140

  
141 141
			defaultPresenceAbsenceTermBaseColors.put((PresenceAbsenceTermBase<?>) termDao.load(naturalizedInvasiveUuid), Color.decode("0xff0000"));
142 142
			defaultPresenceAbsenceTermBaseColors.put((PresenceAbsenceTermBase<?>) termDao.load(naturalizedInvasiveQUuid), Color.decode("0xff0000"));
143
			
143

  
144 144
			defaultPresenceAbsenceTermBaseColors.put((PresenceAbsenceTermBase<?>) termDao.load(questionablelUuid), Color.decode("0x00ccff"));
145 145
			defaultPresenceAbsenceTermBaseColors.put((PresenceAbsenceTermBase<?>) termDao.load(questionableQUuid), Color.decode("0x00ccff"));
146
			
146

  
147 147
			defaultPresenceAbsenceTermBaseColors.put((PresenceAbsenceTermBase<?>) termDao.load(reportedInErrorUuid), Color.decode("0xcccccc"));
148
			
148

  
149 149
		}
150 150
		return defaultPresenceAbsenceTermBaseColors;
151 151
	}
......
157 157
	static final String ID_FROM_VALUES_SEPARATOR = ":";
158 158
	static final String VALUE_LIST_ENTRY_SEPARATOR = "|";
159 159
	static final String VALUE_SUPER_LIST_ENTRY_SEPARATOR = "||";
160
	
160

  
161 161

  
162 162

  
163 163
	//preliminary implementation for TDWG areas
164 164
	/**
165 165
	 * Returns the parameter String for the EDIT geo webservice to create a
166 166
	 * dsitribution map.
167
	 * 
167
	 *
168 168
	 * @param distributions
169 169
	 *            A set of distributions that should be shown on the map
170 170
	 * @param presenceAbsenceTermColors
......
180 180
	 * @param bbox
181 181
	 *            The maps bounding box (e.g. "-180,-90,180,90" for the whole
182 182
	 *            world)
183
	 * @param projectToLayer
184
	 *            name of a layer which is representing a specific
185
	 *            {@link NamedAreaLevel} Supply this parameter if you to project
186
	 *            all other distribution area levels to this layer.
183 187
	 * @param layer
184 188
	 *            The layer that is responsible for background borders and
185 189
	 *            colors. Use the name for the layer. If null 'earth' is taken
......
189 193
	 */
190 194
	@Transient
191 195
	public static String getDistributionServiceRequestParameterString(
192
			Set<Distribution> distributions, 
193
			Map<PresenceAbsenceTermBase<?>,Color> presenceAbsenceTermColors, 
194
			int width, 
195
			int height, 
196
			String bbox, 
197
			String backLayer,
196
			Set<Distribution> distributions,
197
			Map<PresenceAbsenceTermBase<?>,Color> presenceAbsenceTermColors,
198
			int width,
199
			int height,
200
			String bbox,
201
			String baseLayerName,
202
			String projectToLayer,
198 203
			List<Language> languages){
199
		
204

  
200 205

  
201 206
		/**
202 207
		 * generateMultipleAreaDataParameters switches between the two possible styles:
......
209 214
		List<String> areaStyles = new ArrayList<String>();
210 215
		List<String> legendLabels = new ArrayList<String>();
211 216

  
212
		
217

  
213 218
		String borderWidth = "0.1";
214 219
		String borderColorRgb = "";
215 220
		String borderDashingPattern = "";
216
		
217
		
221

  
222

  
218 223
		if(distributions == null || distributions.size() == 0){
219 224
			return "";
220 225
		}
221
		Map<String, Map<Integer, Set<Distribution>>> layerMap = new HashMap<String, Map<Integer, Set<Distribution>>>(); 
226
		Map<String, Map<Integer, Set<Distribution>>> layerMap = new HashMap<String, Map<Integer, Set<Distribution>>>();
222 227
		List<PresenceAbsenceTermBase<?>> statusList = new ArrayList<PresenceAbsenceTermBase<?>>();
223 228
		groupStylesAndLayers(distributions, layerMap, statusList);
224
				
229

  
225 230
		presenceAbsenceTermColors = mergeMaps(getDefaultPresenceAbsenceTermBaseColors(), presenceAbsenceTermColors);
226 231

  
227 232
		Map<String, String> parameters = new HashMap<String, String>();
228
		
233

  
229 234
		//bbox
230 235
		if (bbox != null){
231 236
			parameters.put("bbox", bbox);
......
236 241
			parameters.put("ms", ms);
237 242
		}
238 243
		//layer
239
		if (StringUtils.isBlank(backLayer)){
240
			backLayer = "earth"; 
244
		if (StringUtils.isBlank(baseLayerName)){
245
			baseLayerName = "earth";
241 246
		}
242
		parameters.put("l", backLayer);
243
		
247
		parameters.put("l", baseLayerName);
248

  
244 249
		//style
245 250
		int i = 0;
246 251
		for (PresenceAbsenceTermBase<?> status: statusList){
247
			
252

  
248 253
			char styleId = getStyleAbbrev(i);
249
			
254

  
250 255
			//getting the area title
251 256
			if (languages == null){
252 257
				languages = new ArrayList<Language>();
......
259 264
			//statusLabel.replace('introduced: ', '');
260 265
			statusLabel = statusLabel.replace("introduced: ", "introduced, ");
261 266
			statusLabel = statusLabel.replace("native: ", "native,  ");
262
			
267

  
263 268
			//getting the area color
264 269
			Color statusColor = presenceAbsenceTermColors.get(status);
265 270
			String fillColorRgb;
......
272 277
					fillColorRgb = defaultStatus.getDefaultColor();
273 278
				}
274 279
			}
275
			String styleValues = StringUtils.join(new String[]{fillColorRgb, borderColorRgb, borderWidth, borderDashingPattern}, ',');			
280
			String styleValues = StringUtils.join(new String[]{fillColorRgb, borderColorRgb, borderWidth, borderDashingPattern}, ',');
276 281

  
277 282
			areaStyles.add(styleId + ID_FROM_VALUES_SEPARATOR + styleValues);
278 283
			legendLabels.add(styleId + ID_FROM_VALUES_SEPARATOR + encode(statusLabel));
279
			i++;			
284
			i++;
280 285
		}
281
		
286

  
282 287
		if(areaStyles.size() > 0){
283 288
			parameters.put("as", StringUtils.join(areaStyles.iterator(), VALUE_LIST_ENTRY_SEPARATOR));
284 289
		}
285 290
		if(legendLabels.size() > 0){
286 291
			parameters.put("title", StringUtils.join(legendLabels.iterator(), VALUE_LIST_ENTRY_SEPARATOR));
287 292
		}
288
		
293

  
289 294
		// area data
290 295
		List<String> stylesPerLayer;
291 296
		List<String> areasPerStyle;
......
306 311
			}
307 312
			perLayerAreaData.add(encode(layerString) + ID_FROM_VALUES_SEPARATOR + StringUtils.join(stylesPerLayer.iterator(), VALUE_LIST_ENTRY_SEPARATOR));
308 313
		}
309
		
314

  
310 315
		if(generateMultipleAreaDataParameters){
311 316
			// not generically possible since parameters can not contain duplicate keys with value "ad"
312 317
		} else {
......
315 320

  
316 321
		String queryString = makeQueryString(parameters);
317 322
		logger.debug("getDistributionServiceRequestParameterString(): " + queryString);
318
		
323

  
319 324
		return queryString;
320 325
	}
321 326

  
322 327
	private static void groupStylesAndLayers(Set<Distribution> distributions,
323 328
			Map<String, Map<Integer, Set<Distribution>>> layerMap,
324 329
			List<PresenceAbsenceTermBase<?>> statusList) {
330

  
325 331
		//iterate through distributions and group styles and layers
326 332
		//and collect necessary information
327 333
		for (Distribution distribution:distributions){
......
333 339
			if (! statusList.contains(status)){
334 340
				statusList.add(status);
335 341
			}
336
			//group by layers and styles
342
			//group areas by layers and styles
337 343
			NamedArea area = distribution.getArea();
338
			if (area != null){
339
				String geoLayerString = getWMSLayerName(area);
340
				if(geoLayerString != null){
341
					Map<Integer, Set<Distribution>> styleMap = layerMap.get(geoLayerString);
342
					if (styleMap == null){
343
						styleMap = new HashMap<Integer, Set<Distribution>>();
344
						layerMap.put(geoLayerString, styleMap);
345
					}
346
					addDistributionToMap(distribution, styleMap, statusList);
344

  
345
			addArea(layerMap, statusList, distribution, area);
346

  
347
		}
348
	}
349

  
350
	/**
351
	 * @param layerMap
352
	 * @param statusList
353
	 * @param distribution
354
	 * @param area
355
	 */
356
	private static void addArea(Map<String, Map<Integer, Set<Distribution>>> layerMap, List<PresenceAbsenceTermBase<?>> statusList,
357
			Distribution distribution, NamedArea area) {
358

  
359
		if (area != null){
360
			String geoLayerString = getWMSLayerName(area);
361

  
362
			if(geoLayerString == null){
363

  
364
				// if no layer is mapped this area descend into sub areas in order to project
365
				// the distribution to those
366
				for(NamedArea subArea : area.getIncludes()){
367
					addArea(layerMap, statusList, distribution, subArea);
368
				}
369

  
370
			} else {
371

  
372
				Map<Integer, Set<Distribution>> styleMap = layerMap.get(geoLayerString);
373
				if (styleMap == null) {
374
					styleMap = new HashMap<Integer, Set<Distribution>>();
375
					layerMap.put(geoLayerString, styleMap);
347 376
				}
377
				addDistributionToMap(distribution, styleMap, statusList);
378

  
348 379
			}
349 380
		}
350 381
	}
351 382

  
383

  
352 384
	private static String compileMapSizeParameterValue(int width, int height) {
353 385

  
354 386
		String widthStr = "";
......
381 413
		}
382 414
		return encoded;
383 415
	}
384
	
416

  
385 417
	/**
386 418
	 * combine parameter into a URI query string fragment. The values will be
387 419
	 * escaped correctly.
388
	 * 
420
	 *
389 421
	 * @param parameters
390 422
	 * @return a URI query string fragment
391 423
	 */
......
396 428
				queryString.append('&');
397 429
			}
398 430
			if(key.equals("od") || key.equals("os") || key.equals("ms") || key.equals("ad") || key.equals("as") || key.equals("title") || key.equals("bbox")){
399
				queryString.append(key).append('=').append(parameters.get(key));				
431
				queryString.append(key).append('=').append(parameters.get(key));
400 432
			} else {
401 433
				queryString.append(key).append('=').append(encode(parameters.get(key)));
402 434
			}
403 435
		}
404 436
		return queryString.toString();
405 437
	}
406
	
438

  
407 439
	private static String getAreaAbbrev(Distribution distribution){
408 440
		NamedArea area = distribution.getArea();
409 441
		Representation representation = area.getRepresentation(Language.DEFAULT());
......
413 445
		}
414 446
		return CdmUtils.Nz(areaAbbrev, "-");
415 447
	}
416
	
417 448

  
418
	//Preliminary as long as user defined areas are not fully implemented  
449

  
450
	//Preliminary as long as user defined areas are not fully implemented
419 451
	public static final UUID uuidCyprusDivisionsVocabulary = UUID.fromString("2119f610-1f93-4d87-af28-40aeefaca100");
420
	
421
	private static String getWMSLayerName(NamedArea area){
452

  
453
	private static List<String> projectToWMSSubLayer(NamedArea area){
454

  
455
		List<String> layerNames = new ArrayList<String>();
456
		String matchedLayerName = null;
422 457
		TermVocabulary<NamedArea> voc = area.getVocabulary();
423 458
		//TDWG areas
424 459
		if (voc.getUuid().equals(TdwgArea.uuidTdwgAreaVocabulary)){
425 460
			NamedAreaLevel level = area.getLevel();
426 461
			if (level != null) {
427
				//TODO integrate into CDM 
462
				//TODO integrate into CDM
463
				if (level.equals(NamedAreaLevel.TDWG_LEVEL1())) {
464
					matchedLayerName = "tdwg1" ;
465
				} else if (level.equals(NamedAreaLevel.TDWG_LEVEL2())) {
466
					matchedLayerName = "tdwg2";
467
				}else if (level.equals(NamedAreaLevel.TDWG_LEVEL3())) {
468
					matchedLayerName = "tdwg3";
469
				}else if (level.equals(NamedAreaLevel.TDWG_LEVEL4())) {
470
					matchedLayerName = "tdwg4";
471
				}
472
			}
473
			//unrecognized tdwg area
474

  
475
		}
476
		//TODO hardcoded for cyprus (as long as user defined areas are not fully implemented). Remove afterwards.
477
		if (voc.getUuid().equals(uuidCyprusDivisionsVocabulary)){
478
			matchedLayerName = "cyprusdivs:bdcode";
479
		}
480

  
481
		// check if the matched layer equals the layer to project to
482
		// if not: recurse into the sub-level in order to find the specified one.
483
		String[] matchedLayerNameTokens = StringUtils.split(matchedLayerName, ':');
484
//		if(matchedLayerNameTokens.length > 0 &&  matchedLayerNameTokens[0] != projectToLayer){
485
//			for (NamedArea subArea : area.getIncludes()){
486
//
487
//			}
488
			//
489
			// add all sub areas
490
//		}
491

  
492
		return null;
493
	}
494

  
495
	private static String getWMSLayerName(NamedArea area){
496
		TermVocabulary<NamedArea> voc = area.getVocabulary();
497
		//TDWG areas
498
		if (false && voc.getUuid().equals(TdwgArea.uuidTdwgAreaVocabulary)){
499
			NamedAreaLevel level = area.getLevel();
500
			if (level != null) {
501
				//TODO integrate into CDM
428 502
				if (level.equals(NamedAreaLevel.TDWG_LEVEL1())) {
429 503
					return "tdwg1";
430 504
				} else if (level.equals(NamedAreaLevel.TDWG_LEVEL2())) {
......
437 511
			}
438 512
			//unrecognized tdwg area
439 513
			return null;
440
		
514

  
441 515
		}
442 516
		//hardcoded for cyprus (as long as user defined areas are not fully implemented). Remove afterwards.
443 517
		if (voc.getUuid().equals(uuidCyprusDivisionsVocabulary)){
......
445 519
		}
446 520
		return null;
447 521
	}
448
	
449
	
522

  
523

  
450 524
	private static void addDistributionToMap(Distribution distribution, Map<Integer, Set<Distribution>> styleMap,
451 525
			List<PresenceAbsenceTermBase<?>> statusList) {
452 526
		PresenceAbsenceTermBase<?> status = distribution.getStatus();
......
461 535
		}
462 536
		distributionSet.add(distribution);
463 537
	}
464
	
538

  
465 539
	/**
466 540
	 * @param fieldObservationPoints
467 541
	 * @param derivedUnitPoints
......
487 561
			List<Point> derivedUnitPoints,
488 562
			Map<Class<? extends SpecimenOrObservationBase>, Color> specimenOrObservationTypeColors,
489 563
			Boolean doReturnImage, Integer width, Integer height, String bbox, String backLayer) {
490
		
564

  
491 565
			specimenOrObservationTypeColors = mergeMaps(getDefaultSpecimenOrObservationTypeColors(), specimenOrObservationTypeColors);
492
			
566

  
493 567
			Map<String, String> parameters = new HashMap<String, String>();
494 568
			parameters.put("legend", "0");
495 569
			parameters.put("image", doReturnImage != null && doReturnImage ? "true" : "false");
......
500 574
			if(width != null || height != null){
501 575
				parameters.put("ms", compileMapSizeParameterValue(width, height));
502 576
			}
503
			
577

  
504 578
			Map<String, String> styleAndData = new HashMap<String, String>();
505
			
579

  
506 580
			addToStyleAndData(fieldObservationPoints, FieldObservation.class, specimenOrObservationTypeColors, styleAndData);
507 581
			addToStyleAndData(derivedUnitPoints, DerivedUnit.class, specimenOrObservationTypeColors, styleAndData);
508
			
582

  
509 583
			parameters.put("os", StringUtils.join(styleAndData.keySet().iterator(), "||"));
510 584
			parameters.put("od", StringUtils.join(styleAndData.values().iterator(), "||"));
511
			
585

  
512 586
			String queryString = makeQueryString(parameters);
513
			
587

  
514 588
			logger.info(queryString);
515
			
589

  
516 590
		return queryString;
517 591
	}
518 592

  
......
526 600
	private static <T, S> Map<T, S> mergeMaps(Map<T, S> defaultMap, Map<T, S> overrideMap) {
527 601
		Map<T, S> tmpMap = new HashMap<T, S>();
528 602
		tmpMap.putAll(defaultMap);
529
		if(overrideMap != null){				
603
		if(overrideMap != null){
530 604
			tmpMap.putAll(overrideMap);
531 605
		}
532 606
		return tmpMap;
......
538 612
			Map<Class<? extends SpecimenOrObservationBase>, Color> specimenOrObservationTypeColors, Map<String, String> styleAndData) {
539 613

  
540 614
		//TODO add markerShape and size and Label to specimenOrObservationTypeColors -> Map<Class<SpecimenOrObservationBase<?>>, MapStyle>
541
		
615

  
542 616
		if(points != null && points.size()>0){
543 617
			String style =  "c/" + Integer.toHexString(specimenOrObservationTypeColors.get(specimenOrObservationType).getRGB()).substring(2) + "/10/noLabel";
544 618
			StringBuilder data = new StringBuilder();
......
552 626
			styleAndData.put(index + ":" +style, index + ":" +data.toString());
553 627
		}
554 628
	}
555
	
556
	
629

  
630

  
557 631
	/**
558 632
	 * transform an integer (style counter) into a valid character representing a style.
559 633
	 * 0-25 => a-z<br>
cdmlib-ext/src/test/java/eu/etaxonomy/cdm/ext/geo/EditGeoServiceTest.java
123 123
		String bbox="-20,0,120,70";
124 124
		List<Language> languages = new ArrayList<Language>();
125 125
				
126
		String result = EditGeoServiceUtilities.getDistributionServiceRequestParameterString(distributions, presenceAbsenceColorMap, 600, 300, bbox,backLayer, languages );		
126
		String result = EditGeoServiceUtilities.getDistributionServiceRequestParameterString(distributions, presenceAbsenceColorMap, 600, 300, bbox,backLayer, null, languages );		
127 127
		//TODO Set semantics is not determined
128 128
		//String expected = "http://www.test.de/webservice?l=tdwg3&ad=tdwg3:a:GER|b:OKL|c:BGM|b:SPA|d:FRA&as=a:005500|b:00FF00|c:FFFFFF|d:001100&bbox=-20,40,40,40&ms=400x300";
129 129
		System.out.println(result);
......
163 163
		String bbox="-20,0,120,70";
164 164
		List<Language> languages = new ArrayList<Language>();
165 165
				
166
		String result = EditGeoServiceUtilities.getDistributionServiceRequestParameterString(distributions, presenceAbsenceColorMap, 600, 300, bbox,backLayer, languages );		
166
		String result = EditGeoServiceUtilities.getDistributionServiceRequestParameterString(distributions, presenceAbsenceColorMap, 600, 300, bbox,backLayer, null, languages );		
167 167
		//TODO Set semantics is not determined
168 168
		//String expected = "http://www.test.de/webservice?l=tdwg3&ad=tdwg3:a:GER|b:OKL|c:BGM|b:SPA|d:FRA&as=a:005500|b:00FF00|c:FFFFFF|d:001100&bbox=-20,40,40,40&ms=400x300";
169 169
		System.out.println(result);
cdmlib-ext/src/test/java/eu/etaxonomy/cdm/ext/sru/SruServiceWrapperTest.java
1 1
/**
2
 * 
2
 *
3 3
 */
4 4
package eu.etaxonomy.cdm.ext.sru;
5 5

  
......
9 9
import org.junit.Assert;
10 10
import org.junit.Before;
11 11
import org.junit.BeforeClass;
12
import org.junit.Ignore;
12 13
import org.junit.Test;
13 14

  
14 15
import eu.etaxonomy.cdm.common.UriUtils;
......
23 24
	public static final Logger logger = Logger.getLogger(SruServiceWrapperTest.class);
24 25

  
25 26
	private static final String baseUrl = "http://gso.gbv.de/sru/DB=1.83/";
26
	
27
	
27

  
28

  
28 29
	private SruServiceWrapper sruServiceWrapper;
29
	
30

  
30 31
	private static boolean internetIsAvailable = true;
31
	
32

  
32 33
	@BeforeClass
33 34
	public static void setUpClass() throws Exception {
34 35
		internetIsAvailable = true;
35 36
	}
36
	
37

  
37 38
	/**
38 39
	 * @throws java.lang.Exception
39 40
	 */
......
47 48
// ******************************* TESTS ******************************************************/
48 49

  
49 50
	@Test
50
	//@Ignore // ignore web accessing tests
51
	@Ignore // ignoring since Global References Index to Biodiversity has problems
51 52
	public void testDoSearchRetrieve(){
52
		
53

  
53 54
		List<Reference> refList_1 = sruServiceWrapper.doSearchRetrieve("pica.tit=\"Linnaei Species Plantarum\"", "dc");
54 55
		// -> http://gso.gbv.de/sru/DB=2.1/?version=1.1&operation=searchRetrieve&query=pica.tit%3D%22Species+Plantarum%22&recordSchema=dc
55
			
56

  
56 57
		if (testInternetConnectivity(refList_1)){
57 58

  
58 59
			Assert.assertEquals("There should be exactly 5 results for 'Linnaei Species Plantarum'", 5, refList_1.size());
......
60 61
			logger.info(reference_1.toString());
61 62
			//title cache
62 63
			Assert.assertEquals("Title of first entry should be 'Caroli Linnaei species plantarum'", "Caroli Linnaei species plantarum", reference_1.getTitleCache());
63
	
64

  
64 65
			//--------------------------
65
			
66

  
66 67
			List<Reference> refList_2 = sruServiceWrapper.doSearchRetrieve("pica.all = \"Species+plantarum\" and pica.dst = \"8305\"", "dc");
67 68
			// -> http://gso.gbv.de/sru/DB=2.1/?version=1.1&operation=searchRetrieve&query=pica.tit%3D%22Species+Plantarum%22&recordSchema=dc
68
				
69

  
69 70
			Assert.assertTrue("There should be at least 1 result for 'species+plantarum' and digitized", refList_2.size() > 0);
70 71
			Reference reference_2 = refList_2.get(0);
71 72
			logger.info(reference_2.toString());
72 73
		}
73 74
	}
74
	
75

  
75 76
	private boolean testInternetConnectivity(List<?> list) {
76 77
		if (list == null || list.isEmpty()){
77 78
			boolean result = internetIsAvailable && UriUtils.isInternetAvailable(null);
78 79
			internetIsAvailable = result;
79 80
			return result;
80
			
81

  
81 82
		}
82 83
		return true;
83 84
	}

Also available in: Unified diff