r1013 - in trunk: coser-business/src/main/java/fr/ifremer/coser/services coser-business/src/main/resources/i18n coser-business/src/test/java/fr/ifremer/coser/services coser-ui/src/main/java/fr/ifremer/coser/ui/maps
Author: echatellier Date: 2012-07-16 18:01:56 +0200 (Mon, 16 Jul 2012) New Revision: 1013 Url: http://forge.codelutin.com/repositories/revision/coser/1013 Log: refs #1323: fix tests fixes #1324: ajout de la profondeur sur la carte Removed: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/maps/HaulLocationLayer.java Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/services/ProjectService.java trunk/coser-business/src/main/resources/i18n/coser-business_en_GB.properties trunk/coser-business/src/main/resources/i18n/coser-business_fr_FR.properties trunk/coser-business/src/test/java/fr/ifremer/coser/services/ProjectServiceTest.java trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/maps/CoserMap.java trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/maps/HaulLocationHandler.java Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/services/ProjectService.java =================================================================== --- trunk/coser-business/src/main/java/fr/ifremer/coser/services/ProjectService.java 2012-07-16 15:20:13 UTC (rev 1012) +++ trunk/coser-business/src/main/java/fr/ifremer/coser/services/ProjectService.java 2012-07-16 16:01:56 UTC (rev 1013) @@ -1963,10 +1963,10 @@ * * @param project project * @param container data container - * @param filterSpecyType filterSpecyType + * @param filterSpecyType filterSpecyType (can be null or empty) * @return species */ - public List<String> getProjectSpecies(Project project, AbstractDataContainer container, List<String> filterSpecyType) { + public List<String> getProjectSpecies(Project project, AbstractDataContainer container, Collection<String> filterSpecyType) { // first get species with trait list List<String> result = new ArrayList<String>(); @@ -2001,7 +2001,7 @@ String[] tuple = itTypeSpecies.next(); String specyType = tuple[0]; - if (filterSpecyType.contains(specyType)) { + if (filterSpecyType != null && filterSpecyType.contains(specyType)) { Integer iMinNumSys = Integer.valueOf(tuple[2]); Integer iMaxNumSys = Integer.valueOf(tuple[3]); mapType.put(specyType, new Integer[]{iMinNumSys, iMaxNumSys}); @@ -2922,6 +2922,7 @@ String stratum = tuple[Haul.INDEX_STRATUM]; String year = tuple[Haul.INDEX_YEAR]; String haul = tuple[Haul.INDEX_HAUL]; + String depth = tuple[Haul.INDEX_DEPTH]; String lat = tuple[Haul.INDEX_LAT]; String longi = tuple[Haul.INDEX_LONG]; @@ -2929,7 +2930,7 @@ double dlat = Double.parseDouble(lat); double dlong = Double.parseDouble(longi); - String name = _("coser.business.map.haulname", stratum, year, haul); + String name = _("coser.business.map.haulname", stratum, year, haul, depth); int serieIndex = serieCache.indexOf(strata); Coordinate coordinate = new Coordinate(serieIndex, name, dlat, dlong); hauls.add(coordinate); Modified: trunk/coser-business/src/main/resources/i18n/coser-business_en_GB.properties =================================================================== --- trunk/coser-business/src/main/resources/i18n/coser-business_en_GB.properties 2012-07-16 15:20:13 UTC (rev 1012) +++ trunk/coser-business/src/main/resources/i18n/coser-business_en_GB.properties 2012-07-16 16:01:56 UTC (rev 1013) @@ -100,7 +100,7 @@ coser.business.extract.projectName=Project name \: coser.business.extract.selectionName=Selection name \: coser.business.line=Line -coser.business.map.haulname=Strata \: %s, Year \: %s, Haul \: %s +coser.business.map.haulname=Strata \: %s\nYear \: %s\nHaul \: %s\nDepth \: %s coser.business.matrix.density=Density coser.business.matrix.lengthstructure=Length structures coser.business.matrix.occurrence=Occurrence Modified: trunk/coser-business/src/main/resources/i18n/coser-business_fr_FR.properties =================================================================== --- trunk/coser-business/src/main/resources/i18n/coser-business_fr_FR.properties 2012-07-16 15:20:13 UTC (rev 1012) +++ trunk/coser-business/src/main/resources/i18n/coser-business_fr_FR.properties 2012-07-16 16:01:56 UTC (rev 1013) @@ -100,7 +100,7 @@ coser.business.extract.projectName=Nom du project \: coser.business.extract.selectionName=Nom de la sélection \: coser.business.line=Ligne -coser.business.map.haulname=Strate \: %s, Année \: %s, Trait \: %s +coser.business.map.haulname=Strate \: %s\nAnnée \: %s\nTrait \: %s\nProfMoy \: %s coser.business.matrix.density=Densité coser.business.matrix.lengthstructure=Structures en taille coser.business.matrix.occurrence=Occurrence Modified: trunk/coser-business/src/test/java/fr/ifremer/coser/services/ProjectServiceTest.java =================================================================== --- trunk/coser-business/src/test/java/fr/ifremer/coser/services/ProjectServiceTest.java 2012-07-16 15:20:13 UTC (rev 1012) +++ trunk/coser-business/src/test/java/fr/ifremer/coser/services/ProjectServiceTest.java 2012-07-16 16:01:56 UTC (rev 1013) @@ -34,6 +34,7 @@ import java.util.List; import java.util.Map; import java.util.Properties; +import java.util.Set; import org.junit.Assert; import org.junit.Before; @@ -280,38 +281,41 @@ List<String> years2009 = new ArrayList<String>(); years2009.add("2009"); + // get all species type + Set<String> allPpeciesType = projectService.getProjectSpeciesTypes(project).keySet(); + // all data List<String> allStrata = projectService.filterDataYearsAndGetStrata(project, selection, years20102011); projectService.filterDataStrata(project, selection, allStrata); - List<String> species = projectService.getProjectSpecies(project, selection, null); + List<String> species = projectService.getProjectSpecies(project, selection, allPpeciesType); Assert.assertEquals(4, species.size()); // data in 2011 projectService.loadControlDataToSelection(project, selection); allStrata = projectService.filterDataYearsAndGetStrata(project, selection, years2011); projectService.filterDataStrata(project, selection, allStrata); - species = projectService.getProjectSpecies(project, selection, null); + species = projectService.getProjectSpecies(project, selection, allPpeciesType); Assert.assertEquals(4, species.size()); // all strata but no data for years projectService.loadControlDataToSelection(project, selection); allStrata = projectService.filterDataYearsAndGetStrata(project, selection, years2009); projectService.filterDataStrata(project, selection, allStrata); - species = projectService.getProjectSpecies(project, selection, null); + species = projectService.getProjectSpecies(project, selection, allPpeciesType); Assert.assertEquals(0, species.size()); // test with no strata projectService.loadControlDataToSelection(project, selection); allStrata = projectService.filterDataYearsAndGetStrata(project, selection, years20102011); projectService.filterDataStrata(project, selection, new ArrayList<String>()); - species = projectService.getProjectSpecies(project, selection, null); + species = projectService.getProjectSpecies(project, selection, allPpeciesType); Assert.assertEquals(0, species.size()); // test with only one stratum projectService.loadControlDataToSelection(project, selection); allStrata = projectService.filterDataYearsAndGetStrata(project, selection, years20102011); projectService.filterDataStrata(project, selection, Collections.singletonList("STR6")); - species = projectService.getProjectSpecies(project, selection, null); + species = projectService.getProjectSpecies(project, selection, allPpeciesType); Assert.assertEquals(4, species.size()); } Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/maps/CoserMap.java =================================================================== --- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/maps/CoserMap.java 2012-07-16 15:20:13 UTC (rev 1012) +++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/maps/CoserMap.java 2012-07-16 16:01:56 UTC (rev 1013) @@ -176,7 +176,7 @@ removeMapComponent(haulLocationLayer); } HaulLocationHandler locationHandler = new HaulLocationHandler(hauls); - haulLocationLayer = new HaulLocationLayer(); + haulLocationLayer = new LocationLayer(); haulLocationLayer.setLocationHandlers(new LocationHandler[]{locationHandler}); haulLocationLayer.addInfoDisplayListener(informationDelegator); addMapComponent(haulLocationLayer); Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/maps/HaulLocationHandler.java =================================================================== --- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/maps/HaulLocationHandler.java 2012-07-16 15:20:13 UTC (rev 1012) +++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/maps/HaulLocationHandler.java 2012-07-16 16:01:56 UTC (rev 1013) @@ -64,7 +64,6 @@ public HaulLocationHandler(List<Coordinate> coordinates) { this.coordinates = coordinates; - setLocationColor(Color.GREEN); setShowLocations(true); } @@ -80,7 +79,9 @@ int serie = coordinate.getSerie(); serie = serie % markerColors.length; - Location location = new BasicLocation(coordinate.getLatitude(), coordinate.getLongitude(), coordinate.getName(), null); + // use html for multiple line tooltip + String htmlName = "<html>" + coordinate.getName().replaceAll("\n", "<br>") + "</html>"; + Location location = new BasicLocation(coordinate.getLatitude(), coordinate.getLongitude(), htmlName, null); location.setLocationHandler(this); location.getLocationMarker().setLinePaint(markerColors[serie]); graphicList.add(location); Deleted: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/maps/HaulLocationLayer.java =================================================================== --- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/maps/HaulLocationLayer.java 2012-07-16 15:20:13 UTC (rev 1012) +++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/maps/HaulLocationLayer.java 2012-07-16 16:01:56 UTC (rev 1013) @@ -1,49 +0,0 @@ -/* - * #%L - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2011 Codelutin, Chatellier Eric - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -package fr.ifremer.coser.ui.maps; - -import com.bbn.openmap.layer.location.LocationLayer; - -/** - * Haul location layer. - * - * See http://openmap.bbn.com/mailArchives/openmap-users/2004-06/2869.html - * for tooltip details. - * - * @author chatellier - * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ - */ -public class HaulLocationLayer extends LocationLayer { - - /** serialVersionUID. */ - private static final long serialVersionUID = -4011021347597993208L; - - public HaulLocationLayer() { - //setUseDeclutterMatrix(true); - //setDeclutterMatrix(new DeclutterMatrix()); - } -}
participants (1)
-
echatellier@users.forge.codelutin.com