Coser-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
November 2011
- 4 participants
- 22 discussions
Author: tchemit
Date: 2011-11-05 13:41:37 +0100 (Sat, 05 Nov 2011)
New Revision: 889
Url: http://forge.codelutin.com/repositories/revision/coser/889
Log:
use license-m-p and webstart-m-p from codehaus, our are obsolete
Modified:
trunk/coser-ui/pom.xml
Modified: trunk/coser-ui/pom.xml
===================================================================
--- trunk/coser-ui/pom.xml 2011-11-04 18:18:44 UTC (rev 888)
+++ trunk/coser-ui/pom.xml 2011-11-05 12:41:37 UTC (rev 889)
@@ -143,8 +143,8 @@
<plugins>
<plugin>
- <groupId>org.nuiton</groupId>
- <artifactId>maven-license-plugin</artifactId>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>license-maven-plugin</artifactId>
<configuration>
<generateBundle>true</generateBundle>
</configuration>
@@ -305,7 +305,7 @@
</executions>
</plugin>
<plugin>
- <groupId>org.nuiton.thirdparty</groupId>
+ <groupId>org.codehaus.mojo.webstart</groupId>
<artifactId>webstart-maven-plugin</artifactId>
<configuration>
<libPath>lib</libPath>
@@ -361,9 +361,9 @@
<reporting>
<plugins>
<plugin>
- <groupId>org.nuiton.thirdparty</groupId>
+ <groupId>org.codehaus.mojo.webstart</groupId>
<artifactId>webstart-maven-plugin</artifactId>
- <version>1.0-alpha-2-cl_20100511</version>
+ <version>${webstartPluginVersion}</version>
</plugin>
</plugins>
</reporting>
1
0
r888 - in trunk: coser-business/src/main/java/fr/ifremer/coser/services coser-business/src/main/java/fr/ifremer/coser/util coser-ui/src/main/java/fr/ifremer/coser coser-ui/src/main/java/fr/ifremer/coser/ui/maps coser-ui/src/main/java/fr/ifremer/coser/ui/selection
by echatellier@users.forge.codelutin.com 04 Nov '11
by echatellier@users.forge.codelutin.com 04 Nov '11
04 Nov '11
Author: echatellier
Date: 2011-11-04 19:18:44 +0100 (Fri, 04 Nov 2011)
New Revision: 888
Url: http://forge.codelutin.com/repositories/revision/coser/888
Log:
#312 : V?\195?\169rifier la coh?\195?\169rence entre le code de strate dans le fichier Traits et l'appartenance des coordonn?\195?\169es g?\195?\169ographiques du trait au polygone de la strate
Added:
trunk/coser-business/src/main/java/fr/ifremer/coser/util/Coordinate.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/maps/HaulLocationHandler.java
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-ui/src/main/java/fr/ifremer/coser/Coser.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/maps/CoserMap.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionDetailsView.jaxx
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionHandler.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 2011-10-28 21:27:27 UTC (rev 887)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/services/ProjectService.java 2011-11-04 18:18:44 UTC (rev 888)
@@ -90,6 +90,7 @@
import fr.ifremer.coser.data.Length;
import fr.ifremer.coser.data.Strata;
import fr.ifremer.coser.storage.DataStorage;
+import fr.ifremer.coser.util.Coordinate;
import fr.ifremer.coser.util.ProgressMonitor;
/**
@@ -2873,4 +2874,37 @@
return result;
}
+
+ /**
+ * Get all strata's haul coordinates of given strata.
+ *
+ * @param selection project's selection
+ * @param strataCollection starta collection to get haul
+ * @return haul collection
+ * @throws CoserBusinessException
+ */
+ public List<Coordinate> getStrataHaulCoordinate(Selection selection, Collection<String> strataCollection) throws CoserBusinessException {
+
+ List<Coordinate> hauls = new ArrayList<Coordinate>();
+
+ Iterator<String[]> itData = selection.getHaul().iterator(true);
+ while (itData.hasNext()) {
+ String[] tuple = itData.next();
+
+ String strata = tuple[Haul.INDEX_STRATUM];
+ if (strataCollection.contains(strata)) {
+ String haul = tuple[Haul.INDEX_HAUL];
+ String lat = tuple[Haul.INDEX_LAT];
+ String longi = tuple[Haul.INDEX_LONG];
+
+ double dlat = Double.parseDouble(lat);
+ double dlong = Double.parseDouble(longi);
+
+ Coordinate coordinate = new Coordinate(haul, dlat, dlong);
+ hauls.add(coordinate);
+ }
+ }
+
+ return hauls;
+ }
}
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/util/Coordinate.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/util/Coordinate.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/util/Coordinate.java 2011-11-04 18:18:44 UTC (rev 888)
@@ -0,0 +1,84 @@
+/*
+ * #%L
+ *
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 Ifremer, Codelutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package fr.ifremer.coser.util;
+
+import java.io.Serializable;
+
+/**
+ * Coordinate used to manipulate haul in map.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class Coordinate implements Serializable {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = -5111417883474394223L;
+
+ protected String name;
+
+ protected double latitude;
+
+ protected double longitude;
+
+ public Coordinate() {
+
+ }
+
+ public Coordinate(String name, double latitude, double longitude) {
+ this();
+ this.name = name;
+ this.latitude = latitude;
+ this.longitude = longitude;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public double getLatitude() {
+ return latitude;
+ }
+
+ public void setLatitude(double latitude) {
+ this.latitude = latitude;
+ }
+
+ public double getLongitude() {
+ return longitude;
+ }
+
+ public void setLongitude(double longitude) {
+ this.longitude = longitude;
+ }
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/util/Coordinate.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/Coser.java
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/Coser.java 2011-10-28 21:27:27 UTC (rev 887)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/Coser.java 2011-11-04 18:18:44 UTC (rev 888)
@@ -38,6 +38,8 @@
import org.nuiton.util.ArgumentsParserException;
import org.nuiton.widget.SwingSession;
+import com.bbn.openmap.MapBean;
+
import fr.ifremer.coser.services.ControlService;
import fr.ifremer.coser.services.ImportService;
import fr.ifremer.coser.services.ProjectService;
@@ -76,6 +78,9 @@
}
}
+ // OpenMap sysout
+ MapBean.suppressCopyright = true;
+
// catch wall application exception
launch(coserConfig);
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 2011-10-28 21:27:27 UTC (rev 887)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/maps/CoserMap.java 2011-11-04 18:18:44 UTC (rev 888)
@@ -23,23 +23,35 @@
package fr.ifremer.coser.ui.maps;
+import java.awt.Color;
import java.io.File;
+import java.util.List;
import java.util.Properties;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import com.bbn.openmap.BufferedMapBean;
+import com.bbn.openmap.InformationDelegator;
import com.bbn.openmap.Layer;
import com.bbn.openmap.LayerHandler;
+import com.bbn.openmap.MapBean;
import com.bbn.openmap.MouseDelegator;
+import com.bbn.openmap.PropertyHandler;
+import com.bbn.openmap.event.CoordMouseMode;
import com.bbn.openmap.event.MapMouseMode;
import com.bbn.openmap.event.NavMouseMode;
+import com.bbn.openmap.event.NavMouseMode2;
+import com.bbn.openmap.event.OMMouseMode;
+import com.bbn.openmap.gui.OverlayMapPanel;
import com.bbn.openmap.layer.GraticuleLayer;
+import com.bbn.openmap.layer.location.LocationHandler;
+import com.bbn.openmap.layer.location.LocationLayer;
import com.bbn.openmap.layer.shape.ShapeLayer;
import com.bbn.openmap.omGraphics.DrawingAttributes;
+import com.bbn.openmap.tools.drawing.OMDrawingToolMouseMode;
import fr.ifremer.coser.bean.Project;
+import fr.ifremer.coser.util.Coordinate;
/**
* Coser map based open openmap.
@@ -50,44 +62,44 @@
* Last update : $Date$
* By : $Author$
*/
-public class CoserMap extends BufferedMapBean {
+public class CoserMap extends OverlayMapPanel {
/** serialVersionUID. */
private static final long serialVersionUID = 3134624721243512358L;
private static final Log log = LogFactory.getLog(CoserMap.class);
-
- protected LayerHandler layerHandler = new LayerHandler();
- protected MapMouseMode currentMouseMode;
+ protected InformationDelegator informationDelegator;
- protected MouseDelegator md;
+ protected LocationLayer haulLocationLayer;
protected static final float SCALE = 9500000f;
-
+
public CoserMap() {
- setScale(SCALE);
- md = new MouseDelegator(this);
- md.setDefaultMouseModes();
- setActiveMouseMode(new NavMouseMode());
- layerHandler.addLayerListener(this);
- //initMap();
- }
+ super(new PropertyHandler(new Properties()), true);
+ create();
- public void setActiveMouseMode(MapMouseMode mode) {
- md.setActiveMouseMode(mode);
- currentMouseMode = mode;
- // il faut remettre les listeners
- /*for (MapMouseListener l : orderedListener) {
- currentMouseMode.addMapMouseListener(l);
- }*/
+ MapBean mapBean = getMapBean();
+ mapBean.setScale(SCALE);
+
+ addMapComponent(new LayerHandler());
+ addMapComponent(new MouseDelegator(mapBean));
+
+ getMapBean().setBackgroundColor(new Color(0x99b3cc));
}
-
- public void initMap(Project project) {
+ public void initMap(Project project, InformationDelegator informationDelegator) {
+
+ this.informationDelegator = informationDelegator;
+ OMMouseMode mouseMode = new OMMouseMode();
+ mouseMode.setInfoDelegator(informationDelegator);
+ addMapComponent(mouseMode);
+
+ MapBean mapBean = getMapBean();
+
// centrée sur la france
- setCenter(50f, 0f);
- setScale(16000000f);
+ mapBean.setCenter(50f, 0f);
+ mapBean.setScale(16000000f);
// graticule layer
addGraticuleLayer();
@@ -151,10 +163,30 @@
p.setProperty("." + GraticuleLayer.TextColorProperty, "FF000000");
layer.setProperties("", p);
- layerHandler.addLayer(layer);
+ addMapComponent(layer);
}
-
+
/**
+ * Display stata's haul position in an openmap layer
+ *
+ * @param hauls coordinate to display on map
+ */
+ public void addStataHaulLayer(List<Coordinate> hauls) {
+
+ if (log.isDebugEnabled()) {
+ log.debug("Adding strata haul layer (" + hauls.size() + " coordinates)");
+ }
+
+ HaulLocationHandler locationHandler = new HaulLocationHandler(hauls);
+ haulLocationLayer = new HaulLocationLayer();
+ haulLocationLayer.setLocationHandlers(new LocationHandler[]{locationHandler});
+ haulLocationLayer.addInfoDisplayListener(informationDelegator);
+ //haulLocationLayer.set
+ addMapComponent(haulLocationLayer);
+
+ }
+
+ /**
* Add a new layer to the map depending on mapFile extension.
*
* @param layerId layer id
@@ -181,10 +213,10 @@
if (log.isDebugEnabled()) {
log.debug("Add layer " + layer);
}
- layerHandler.addLayer(layer);
+ addMapComponent(layer);
}
}
-
+
/**
* Manage shp layer display.
*
Added: 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 (rev 0)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/maps/HaulLocationHandler.java 2011-11-04 18:18:44 UTC (rev 888)
@@ -0,0 +1,94 @@
+/*
+ * #%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 Lesser 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package fr.ifremer.coser.ui.maps;
+
+import java.awt.Color;
+import java.awt.Component;
+import java.util.List;
+
+import com.bbn.openmap.layer.location.AbstractLocationHandler;
+import com.bbn.openmap.layer.location.BasicLocation;
+import com.bbn.openmap.layer.location.Location;
+import com.bbn.openmap.layer.location.LocationLayer;
+import com.bbn.openmap.omGraphics.OMGraphicList;
+
+import fr.ifremer.coser.util.Coordinate;
+
+/**
+ * Handler used by {@link LocationLayer} to provide haul's locations.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class HaulLocationHandler extends AbstractLocationHandler {
+
+ protected List<Coordinate> coordinates;
+
+ public HaulLocationHandler(List<Coordinate> coordinates) {
+ this.coordinates = coordinates;
+ setLocationColor(Color.RED);
+ }
+
+ /*
+ * @see com.bbn.openmap.layer.location.LocationHandler#get(float, float, float, float, com.bbn.openmap.omGraphics.OMGraphicList)
+ */
+ @Override
+ public OMGraphicList get(float nwLat, float nwLon, float seLat, float seLon, OMGraphicList graphicList) {
+
+ for (Coordinate coordinate : coordinates) {
+ Location location = new BasicLocation(coordinate.getLatitude(), coordinate.getLongitude(), coordinate.getName(), null);
+ location.setLocationHandler(this);
+ location.getLabel().setLinePaint(Color.BLACK);
+ location.getLabel().setMatted(true);
+ location.setLinePaint(Color.BLUE);
+ location.setShowName(true);
+ location.setShowLocation(true);
+
+ graphicList.add(location);
+ }
+
+ return graphicList;
+ }
+
+ /*
+ * @see com.bbn.openmap.layer.location.LocationHandler#getItemsForPopupMenu(com.bbn.openmap.layer.location.Location)
+ */
+ @Override
+ public List<Component> getItemsForPopupMenu(Location arg0) {
+ return null;
+ }
+
+ /*
+ * @see com.bbn.openmap.layer.location.LocationHandler#reloadData()
+ */
+ @Override
+ public void reloadData() {
+
+ }
+}
Property changes on: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/maps/HaulLocationHandler.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: 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 (rev 0)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/maps/HaulLocationLayer.java 2011-11-04 18:18:44 UTC (rev 888)
@@ -0,0 +1,75 @@
+/*
+ * #%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 Lesser 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package fr.ifremer.coser.ui.maps;
+
+import com.bbn.openmap.layer.DeclutterMatrix;
+import com.bbn.openmap.layer.location.LocationLayer;
+import com.bbn.openmap.omGraphics.OMGraphic;
+
+/**
+ * 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());
+ }
+
+ @Override
+ public String getToolTipTextFor(OMGraphic omg) {
+ return super.getToolTipTextFor(omg);
+ }
+
+ @Override
+ public boolean isHighlightable(OMGraphic omg) {
+ return super.isHighlightable(omg);
+ }
+
+ @Override
+ public void highlight(OMGraphic omg) {
+ super.highlight(omg);
+ }
+
+ @Override
+ public String getInfoText(OMGraphic omg) {
+ return super.getInfoText(omg);
+ }
+
+
+}
Property changes on: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/maps/HaulLocationLayer.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionDetailsView.jaxx
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionDetailsView.jaxx 2011-10-28 21:27:27 UTC (rev 887)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionDetailsView.jaxx 2011-11-04 18:18:44 UTC (rev 888)
@@ -167,7 +167,7 @@
</cell>
<cell anchor="northeast">
<JButton icon="map.png" toolTipText="coser.ui.selection.details.showMapTip"
- onActionPerformed='getDetailDecisionPanelLayout().show(getDetailDecisionPanel(), "ZONEMAP");' />
+ onActionPerformed='getDetailDecisionPanelLayout().show(getDetailDecisionPanel(), "ZONEMAP");getHandler().showStataOnMap(this);' />
</cell>
<cell anchor="northeast">
<JButton icon="table.png" toolTipText="coser.ui.selection.details.showSpreciesTip"
@@ -301,8 +301,8 @@
</Table>
</JScrollPane>
<JPanel layout="{new BorderLayout()}" constraints='"ZONEMAP"'>
- <com.bbn.openmap.gui.ToolPanel id='strataMapToolBar' javaBean='new com.bbn.openmap.gui.ToolPanel()' constraints='BorderLayout.NORTH' />
<fr.ifremer.coser.ui.maps.CoserMap id="strataMap" constraints='BorderLayout.CENTER' />
+ <com.bbn.openmap.InformationDelegator id="stataMapInfo" constraints='BorderLayout.SOUTH' />
</JPanel>
<JScrollPane constraints='"SPECIESGRAPH"'>
<JPanel id="speciesGraphPanel" layout="{new GridBagLayout()}"/>
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionHandler.java
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionHandler.java 2011-10-28 21:27:27 UTC (rev 887)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionHandler.java 2011-11-04 18:18:44 UTC (rev 888)
@@ -28,6 +28,7 @@
import java.awt.Component;
import java.awt.GridBagConstraints;
import java.awt.Insets;
+import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
@@ -80,6 +81,7 @@
import fr.ifremer.coser.ui.result.SelectionEditResultDialog;
import fr.ifremer.coser.ui.selection.model.OccurrenceDensitySpeciesListModel;
import fr.ifremer.coser.ui.util.CoserListSelectionModel;
+import fr.ifremer.coser.util.Coordinate;
/**
* Selection handler.
@@ -382,12 +384,11 @@
// add layers
Project project = view.getContextValue(Project.class);
- view.getStrataMap().initMap(project);
+ view.getStrataMap().initMap(project, view.getStataMapInfo());
+ view.getStataMapInfo().setMap(view.getStrataMap().getMapBean());
+ view.getStataMapInfo().setShowCoordsInfoLine(true);
+ view.getStataMapInfo().setShowInfoLine(true);
- // link toolbar with map
- OMToolSet toolSet = new OMToolSet();
- toolSet.setupListeners(view.getStrataMap());
- view.getStrataMapToolBar().add((Tool)toolSet);
}
/**
@@ -1041,7 +1042,32 @@
view.getMatrixPanelEditor().getTable().setDefaultRenderer(String.class,
new SamplingEffortRenderer((MatrixTableModelND)view.getMatrixPanelEditor().getTable().getModel()));
}
+
+ /**
+ * Display selected strata haul position in map.
+ *
+ * @param view view
+ */
+ public void showStataOnMap(SelectionDetailsView view) {
+ Selection selection = view.getContextValue(Selection.class);
+ ProjectService projectService = view.getContextValue(ProjectService.class);
+
+ // get selected stata
+ Object[] selectedStrataArray = view.getStrataList().getSelectedValues();
+ Set<String> selectedStata = new HashSet<String>();
+ for (Object selectedStrataItem : selectedStrataArray) {
+ selectedStata.add((String)selectedStrataItem);
+ }
+ // display on map
+ try {
+ List<Coordinate> hauls = projectService.getStrataHaulCoordinate(selection, selectedStata);
+ view.getStrataMap().addStataHaulLayer(hauls);
+ } catch (CoserBusinessException ex) {
+ throw new CoserException("Can't display stata's hauls on map", ex);
+ }
+ }
+
/**
* Display data graph, initialized with graph for selected specy
* selected.
1
0