From: <had...@us...> - 2008-09-25 15:22:19
|
Revision: 3982 http://fudaa.svn.sourceforge.net/fudaa/?rev=3982&view=rev Author: hadouxad Date: 2008-09-25 15:22:02 +0000 (Thu, 25 Sep 2008) Log Message: ----------- - fonction sonde ok - preparation des outils pour l'import export de graphe Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalquePoint.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueSondeSynchroniserFusion.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquePanelController.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/palette/BPaletteInfo.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetFusionCalques.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/GrapheCellRenderer.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeImporter.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrCourbeTemporelleManager.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/tr_en.fr_txt branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrIsoLayerDefault.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionController.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/rubar/TrRubarTarageCourbesManager.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/GrapheTreeCellRenderer.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrCourbeSpatialManager.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalquePoint.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalquePoint.java 2008-09-25 15:13:21 UTC (rev 3981) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalquePoint.java 2008-09-25 15:22:02 UTC (rev 3982) @@ -14,25 +14,25 @@ import javax.swing.table.AbstractTableModel; -import com.vividsolutions.jts.algorithm.SIRtreePointInRing; -import com.vividsolutions.jts.geom.Coordinate; -import com.vividsolutions.jts.geom.Envelope; -import com.vividsolutions.jts.geom.LineString; -import com.vividsolutions.jts.geom.LinearRing; - import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluListSelection; import org.fudaa.ctulu.gis.GISGeometryFactory; import org.fudaa.ctulu.gis.GISLib; - import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.geometrie.GrBoite; import org.fudaa.ebli.geometrie.GrMorphisme; import org.fudaa.ebli.geometrie.GrPoint; import org.fudaa.ebli.palette.BPalettePlage; +import org.fudaa.ebli.palette.BPaletteInfo.InfoData; import org.fudaa.ebli.trace.TraceIcon; import org.fudaa.ebli.trace.TraceIconModel; +import com.vividsolutions.jts.algorithm.SIRtreePointInRing; +import com.vividsolutions.jts.geom.Coordinate; +import com.vividsolutions.jts.geom.Envelope; +import com.vividsolutions.jts.geom.LineString; +import com.vividsolutions.jts.geom.LinearRing; + /** * Un calque d'affichage de point avec un icone. * @@ -91,6 +91,11 @@ } } + + public void fillWithInterpolateInfo(final InfoData _m) { + + } + /** * @author Fred Deniger * @version $Id: ZCalquePoint.java,v 1.51 2007-05-04 13:49:42 deniger Exp $ Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueSondeSynchroniserFusion.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueSondeSynchroniserFusion.java 2008-09-25 15:13:21 UTC (rev 3981) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueSondeSynchroniserFusion.java 2008-09-25 15:22:02 UTC (rev 3982) @@ -1,20 +1,32 @@ package org.fudaa.ebli.calque; import java.awt.BorderLayout; +import java.awt.Frame; import java.awt.event.MouseEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; import java.util.List; +import java.util.Map; +import javax.swing.Icon; +import javax.swing.ImageIcon; import javax.swing.JComponent; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; +import org.fudaa.ctulu.gui.CtuluLibSwing; +import org.fudaa.ctulu.gui.CtuluUIDialog; import org.fudaa.ebli.geometrie.GrPoint; +import org.fudaa.ebli.palette.BPaletteInfo.InfoData; import org.fudaa.ebli.ressource.EbliResource; +import org.fudaa.ebli.visuallibrary.EbliNode; +import org.fudaa.ebli.visuallibrary.calque.EbliWidgetVueCalque; +import org.fudaa.ebli.visuallibrary.graphe.GrapheTreeCellRenderer; import org.jdesktop.swingx.JXTreeTable; import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode; import org.jdesktop.swingx.treetable.DefaultTreeTableModel; @@ -32,24 +44,43 @@ //private List<ZCalqueSondeInterface> listeTarget_; final List<ZCalqueSondeInteraction> listeSondeInteractions_ = new ArrayList<ZCalqueSondeInteraction>(); - final List<String> listeNodeCalques = new ArrayList<String>(); - + + ArrayList<EbliWidgetVueCalque> listeWidgetCalque_ = new ArrayList<EbliWidgetVueCalque>(); + + /** + * Liste des panelTableModel qui contiennent les infos des calques. + */ + ArrayList<DataSonde> listInfoData_ = new ArrayList<DataSonde>(); + + /** + * HahMap qui contient les infos mises a jour des positions des sondes. + */ + + + public ZCalqueSondeSynchroniserFusion() { + } int cpt = 1; - public void addZCalqueSondeInteraction(ZCalqueSondeInteraction si/* - * , EbliNode - * node - */) { + public void addZCalqueSondeInteraction(ZCalqueSondeInteraction si, EbliWidgetVueCalque _widget) { // -- ajout de la sonde dans le manager --// listeSondeInteractions_.add(si); - - listeNodeCalques.add("calque " + (cpt++)); + + // -- ajout de la widget --// + listeWidgetCalque_.add(_widget); + + // -- ajout du model de la palete info du calque --// + // listTableModel_.add(_widget.getCalqueController().getVisuPanel(). + // getController().getPaletteInfo().getTableModel()); + + //-- init des datas --// + listInfoData_.add(new DataSonde()); + // -- enregistrement aupres de la sonde du manager comme listener --// si.addZCalqueSondeListener(this); - + } /** @@ -60,91 +91,309 @@ for (ZCalqueSondeInteraction sondeInteraction : listeSondeInteractions_) sondeInteraction.removeZCalqueSondeListener(this); } - + /** * lorsque c'est appel\xE9, met a jour les sondes pour tous les autre * zcalquesondeInteraction. */ public void notifySondeMoved(ZCalqueSondeInteraction _activator, MouseEvent _e) { - for (ZCalqueSondeInteraction sondeInteraction : listeSondeInteractions_) { - if (sondeInteraction != _activator && sondeInteraction.getTarget() != null) { - // -- on recupere le point et on met a jour les sondes --// + if (structureModel_ == null) + structureModel_ = constructStructureModel(); + + for (int i=0;i<listeSondeInteractions_.size();i++) { + + ZCalqueSondeInteraction sondeInteraction=listeSondeInteractions_.get(i); + if (/* sondeInteraction != _activator && */sondeInteraction.getTarget() != null) { + // -- on recupere le point et on met a jour les sondes --// final GrPoint pt = new GrPoint(_e.getX(), _e.getY(), 0); pt.autoApplique(((BCalque) sondeInteraction.getTarget()).getVersReel()); // -- on replace la sonde des autres calques --// ZCalqueSondeInterface objet = sondeInteraction.getTarget(); + objet.setSondeEnable(true); objet.changeSonde(pt); + + //--remplissage des infos specifiques a la sonde --// + ZCalquePoint isoLayer = listeWidgetCalque_.get(i).getCalqueController().getVisuPanel().getIsoLayer(); + isoLayer.fillWithInterpolateInfo(listInfoData_.get(i)); + + // -- mise a jour du model avec les nouvelles infos + // structureModel_.fillWithInfos(i, listInfoData_.get(i)); } } + buildDialog(); - + // structureModel_ = constructStructureModel(); + // treeTableNodes_.setTreeTableModel(structureModel_); + // treeTableNodes_.expandAll(); + structureModel_.reload(); } - + JDialog dialog_; public void buildDialog() { if (dialog_ != null) { dialog_.setVisible(true); return; } - -// CtuluUIDialog ui = new CtuluUIDialog(listeSondeInteractions_); -// final Frame f = CtuluLibSwing.getFrameAncestorHelper(ui.getParentComponent()); - dialog_ = new JDialog(/*f*/); + // CtuluUIDialog ui_ = new + // CtuluUIDialog(listeWidgetCalque_.get(0).getCalqueController + // ().getVisuPanel()); + CtuluUIDialog ui = new CtuluUIDialog(listeWidgetCalque_.get(0).getEbliScene().getView()); + final Frame f = CtuluLibSwing.getFrameAncestorHelper(ui.getParentComponent()); + dialog_ = new JDialog(f); + dialog_.addWindowListener(new WindowAdapter() { - public void windowClosed(WindowEvent _e) { - // on desactive l action de suivi sur le graphe - dialog_ = null; - } + public void windowClosed(WindowEvent _e) { + // on desactive l action de suivi sur le graphe + dialog_ = null; + } - public void windowClosing(WindowEvent _e) { - dialog_ = null; - } - }); - - + public void windowClosing(WindowEvent _e) { + dialog_ = null; + } + }); + + dialog_.setModal(false); dialog_.pack(); dialog_.setTitle(getTitle()); JPanel container=new JPanel(new BorderLayout()); - container.add(new JScrollPane(buildComponent()),BorderLayout.CENTER); + container.add(buildComponent(), BorderLayout.CENTER); container - .add( - new JLabel( - "<html> <body><b>" + getTitle() + "</b> </body></html>"), + .add(new JLabel("<html> <body><b><center>" + getTitle() + "</center></b> </body></html>"), BorderLayout.NORTH); dialog_.setContentPane(container); - dialog_.setSize(250, 400); - // dialog_.setLocationRelativeTo(CtuluLibSwing.getFrameAncestor(ui. - // getParentComponent())); + dialog_.setSize(400, 250); + dialog_.setLocationRelativeTo(CtuluLibSwing.getFrameAncestor(ui.getParentComponent())); dialog_.setVisible(true); - + } - + public String getTitle() { return EbliResource.EBLI.getString("-- Interpolation r\xE9sultats -- "); } - + + JXTreeTable treeTableNodes_; public JComponent buildComponent() { JPanel container = new JPanel(new BorderLayout()); - JXTreeTable treeTableNodes_ = new JXTreeTable(constructStructureModel()); - container.add(treeTableNodes_, BorderLayout.CENTER); + if (structureModel_ == null) + structureModel_ = constructStructureModel(); + treeTableNodes_ = new JXTreeTable(structureModel_); + + // treeTableNodes.setRowHeight(60); + treeTableNodes_.getColumn(0).setMinWidth(100); + treeTableNodes_.setTreeCellRenderer(new GrapheTreeCellRenderer()); + JPanel containerTree = new JPanel(new BorderLayout()); + containerTree.add(treeTableNodes_, BorderLayout.CENTER); + container.add(new JScrollPane(containerTree), BorderLayout.CENTER); container.add(treeTableNodes_.getTableHeader(), BorderLayout.NORTH); return container; } + - public DefaultTreeTableModel constructStructureModel() { + TreeTableModelGraphe structureModel_; + + public TreeTableModelGraphe constructStructureModel() { DefaultMutableTreeTableNode root = new DefaultMutableTreeTableNode("Sonde pour la fusion des calques"); - for (String titre : listeNodeCalques) - root.add(new DefaultMutableTreeTableNode(titre)); - - DefaultTreeTableModel model = new DefaultTreeTableModel(); + for (int i = 0; i < listeWidgetCalque_.size(); i++) { + EbliWidgetVueCalque widget = listeWidgetCalque_.get(i); + JLabel label = new JLabel(); + label.setText(getTitleCalque(widget)); + label.setIcon(getIconCalque(widget)); + DefaultMutableTreeTableNode nodeCalque = new DefaultMutableTreeTableNode(label); + root.add(nodeCalque); + + fillWithInfos(i, nodeCalque, listInfoData_.get(i)); + + + // -- parcours des donn\xE9es + + } + TreeTableModelGraphe model = new TreeTableModelGraphe(); model.setRoot(root); return model; } + + public String getTitleCalque(EbliWidgetVueCalque _widget) { + return ((EbliNode) _widget.getEbliScene().findObject(_widget)).getTitle(); + } + + public Icon getIconCalque(EbliWidgetVueCalque _widget) { + return new ImageIcon(_widget.getCalqueController().getVisuPanel().produceImage(60, 30, new HashMap())); + } + + + + public class DataSonde implements InfoData { + private Map<String, Object> mapValueSonde = new HashMap<String, Object>(); + public ArrayList<String> listOrdonneetitres_ = new ArrayList<String>(); + private String valueEmpty = "N/A"; + + public DataSonde() { + // -- init de la map sonde avec les valeurs par defaut --// + + listOrdonneetitres_.add("X"); + listOrdonneetitres_.add("Y"); + listOrdonneetitres_.add("El\xE9ment englobant"); + listOrdonneetitres_.add("Bathym\xE9trie"); + listOrdonneetitres_.add("Cote eau"); + listOrdonneetitres_.add("Hauteur d'eau"); + listOrdonneetitres_.add("Nombre de Froude"); + listOrdonneetitres_.add("Vitesse"); + listOrdonneetitres_.add("Vitesse u"); + listOrdonneetitres_.add("Vitesse v"); + + for (String key : listOrdonneetitres_) { + mapValueSonde.put(key, valueEmpty); + + } + + + + + } + + public boolean isTitleSet() { + return false; + } + + public void put(String _key, String _value) { + mapValueSonde.put(_key, _value); + if (!listOrdonneetitres_.contains(_key)) + listOrdonneetitres_.add(_key); + } + + public void setTitle(String _title) { + } + + + } + + public class SondeCouple { + public String name; + public int indiceData_; + + public SondeCouple(String _name, int indiceData) { + super(); + name = _name; + indiceData_ = indiceData; + } + + public Object getValue() { + return listInfoData_.get(indiceData_).mapValueSonde.get(name); + } + + } + + + public class TreeTableModelGraphe extends DefaultTreeTableModel { + String[] titre_; + + // -- data correspondant au x donn\xE9 --// + double[] dataY_ = new double[0]; + + public TreeTableModelGraphe() { + String[] val = { "Nom", "Valeur" }; + titre_ = val; + } + + public int getColumnCount() { + + return titre_.length; + } + + @Override + public boolean isCellEditable(Object _node, int _column) { + return false; + } + + public String getColumnName(int _columnIndex) { + return titre_[_columnIndex]; + } + + public int getRowCount() { + return listeWidgetCalque_.size(); + + } + + public Object getValueAt(Object node, int column) { + Object res = new DefaultMutableTreeTableNode("n/a"); + if (node instanceof DefaultMutableTreeTableNode) { + DefaultMutableTreeTableNode defNode = (DefaultMutableTreeTableNode) node; + if (defNode.getUserObject() instanceof JLabel) { + if (column == 0) + return defNode.getUserObject(); + else + return ""; + } else if (defNode.getUserObject() instanceof SondeCouple) { + SondeCouple couple = (SondeCouple) defNode.getUserObject(); + if (column == 0) + return couple.name; + else if (column == 1) + return couple.getValue(); + else + return ""; + } + else + return ""; + } + return res; + } + + public DefaultMutableTreeTableNode getTreeNodeCalque(int i) { + return (DefaultMutableTreeTableNode) getRoot().getChildAt(i); + + } + + public void reload() { + + this.modelSupport.fireTreeStructureChanged(treeTableNodes_.getPathForRow(0)); +// treeTableNodes_.collapseAll(); +// treeTableNodes_.expandAll(); + } + + + /** + * met a jour les nodes childre ndu node calque pour le jtree. + * + * @param _treenode + */ + + + + + } + + public void fillWithInfos(int indice, DefaultMutableTreeTableNode treenode, DataSonde data_) { + + // on enleve les children + // Enumeration<? extends MutableTreeTableNode> children = + // treenode.children(); + // ArrayList<MutableTreeTableNode> listChildren = new + // ArrayList<MutableTreeTableNode>(); + // while (children.hasMoreElements()) { + // MutableTreeTableNode node = children.nextElement(); + // listChildren.add(node); + // + // } + // for (MutableTreeTableNode node : listChildren) { + // node.removeFromParent(); + // } + // -- on ajoute les nouveaux + for (Iterator<String> it = data_.listOrdonneetitres_.iterator(); it.hasNext();) { + String key = it.next(); + Object value = data_.mapValueSonde.get(key); + DefaultMutableTreeTableNode node = new DefaultMutableTreeTableNode( + new SondeCouple(key, indice)); + treenode.add(node); + } + } + + + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquePanelController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquePanelController.java 2008-09-25 15:13:21 UTC (rev 3981) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquePanelController.java 2008-09-25 15:22:02 UTC (rev 3982) @@ -44,6 +44,7 @@ import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.controle.BConfigurePaletteAction; import org.fudaa.ebli.geometrie.GrBoite; +import org.fudaa.ebli.palette.BPaletteInfo; import org.fudaa.ebli.palette.BPaletteInfoAbstractAction; import org.fudaa.ebli.palette.PaletteEditAction; import org.fudaa.ebli.repere.BControleRepereTexte; @@ -334,6 +335,15 @@ public final CtuluUI getUI() { return ui_; } + + /** + * A overrider. + * + * @return + */ + public BPaletteInfo getPaletteInfo() { + return null; + } protected void removePaletteAction() { navigationActionGroup_ = removePaletteAction(navigationActionGroup_); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java 2008-09-25 15:13:21 UTC (rev 3981) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java 2008-09-25 15:22:02 UTC (rev 3982) @@ -110,6 +110,10 @@ } } + public ZCalquePoint getIsoLayer() { + return null; + } + /** * @author Fred Deniger * @version $Id: ZEbliCalquesPanel.java,v 1.55 2007-06-05 08:58:38 deniger Exp $ Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/palette/BPaletteInfo.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/palette/BPaletteInfo.java 2008-09-25 15:13:21 UTC (rev 3981) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/palette/BPaletteInfo.java 2008-09-25 15:22:02 UTC (rev 3982) @@ -23,13 +23,13 @@ import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.TableColumnModel; +import org.fudaa.ebli.commun.EbliLib; + import com.memoire.bu.BuBorderLayout; import com.memoire.bu.BuPanel; import com.memoire.bu.BuScrollPane; import com.memoire.bu.BuTextField; -import org.fudaa.ebli.commun.EbliLib; - /** * Un panel affichant les infos envoyes. * @@ -115,6 +115,11 @@ protected Component parent_; protected JTable table_; protected transient PanelTableModel tableModel_; + + public PanelTableModel getTableModel() { + return tableModel_; + } + protected JTextField txtTitle_; public BPaletteInfo() { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetFusionCalques.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetFusionCalques.java 2008-09-25 15:13:21 UTC (rev 3981) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/calque/EbliWidgetFusionCalques.java 2008-09-25 15:22:02 UTC (rev 3982) @@ -85,9 +85,11 @@ */ public void synchroniseSondeFusion() { + // -- creation du manager de sonde fusion qui synchronise toute ses sondes // --// managerSondesFusion_ = new ZCalqueSondeSynchroniserFusion(); + for (EbliWidgetVueCalque widget : listeWidgetCalque_) { ZEbliCalquesPanel panel = widget.calquePanel_; @@ -99,7 +101,7 @@ ZCalqueSondeInteraction sonde = panel.getController().getCalqueSondeInteraction(); // -- ajout de la sonde dans le manager - managerSondesFusion_.addZCalqueSondeInteraction(sonde); + managerSondesFusion_.addZCalqueSondeInteraction(sonde, widget); } // -- ajout dans les toolbars de tous les calques de la meme action --// // for (EbliWidgetVueCalque widget : listeWidgetCalque_) { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/GrapheCellRenderer.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/GrapheCellRenderer.java 2008-09-25 15:13:21 UTC (rev 3981) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/GrapheCellRenderer.java 2008-09-25 15:22:02 UTC (rev 3982) @@ -37,4 +37,7 @@ } return this; } + + + } \ No newline at end of file Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/GrapheTreeCellRenderer.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/GrapheTreeCellRenderer.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/visuallibrary/graphe/GrapheTreeCellRenderer.java 2008-09-25 15:22:02 UTC (rev 3982) @@ -0,0 +1,68 @@ +package org.fudaa.ebli.visuallibrary.graphe; + +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; + +import javax.swing.JLabel; +import javax.swing.JTree; +import javax.swing.UIManager; +import javax.swing.tree.DefaultTreeCellRenderer; +import javax.swing.tree.TreeCellRenderer; + +import org.fudaa.ebli.calque.ZCalqueSondeSynchroniserFusion.SondeCouple; +import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode; + +/** + * Tree cell Renderer classique pour afficher les icones mignature a cot\xE9 des + * objets + * + * @author genesis + * + */ +public class GrapheTreeCellRenderer extends JLabel implements TreeCellRenderer { + private final Color HIGHLIGHT_COLOR = UIManager.getColor("Tree.selectionBackground"); + private DefaultTreeCellRenderer rendererClassique_ = new DefaultTreeCellRenderer(); + JLabel defaultZone_ = new JLabel(""); + + public GrapheTreeCellRenderer() { + setOpaque(true); + setIconTextGap(12); + setSize(150, 100); + setMinimumSize(new Dimension(150, 100)); + + } + + public Component getTreeCellRendererComponent(JTree _tree, Object _value, boolean _selected, boolean _expanded, + boolean _leaf, int _row, boolean _hasFocus) { + + + + DefaultMutableTreeTableNode node= (DefaultMutableTreeTableNode) _value; + + if(node.getUserObject() instanceof JLabel){ + JLabel entry = (JLabel) node.getUserObject(); + + setText(entry.getText()); + setIcon(entry.getIcon()); + if (_selected) { + setBackground(HIGHLIGHT_COLOR); + setForeground(Color.white); + } else { + setBackground(Color.white); + setForeground(Color.black); + } + return this; + } + else if (node.getUserObject() instanceof SondeCouple){ + SondeCouple entry = (SondeCouple) node.getUserObject(); + defaultZone_.setText(entry.name); + return defaultZone_; + } + else + return rendererClassique_.getTreeCellRendererComponent(_tree, _value, _selected, _expanded, _leaf, _row, + _hasFocus); + + } + +} Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeImporter.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeImporter.java 2008-09-25 15:13:21 UTC (rev 3981) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeImporter.java 2008-09-25 15:22:02 UTC (rev 3982) @@ -15,9 +15,6 @@ import javax.swing.filechooser.FileFilter; -import com.memoire.bu.BuFileFilter; -import com.memoire.bu.BuResource; - import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ctulu.CtuluIOOperationSynthese; import org.fudaa.ctulu.CtuluLib; @@ -30,7 +27,6 @@ import org.fudaa.ctulu.gui.CtuluFileChooser; import org.fudaa.ctulu.gui.CtuluLibSwing; import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; - import org.fudaa.dodico.mesure.EvolutionFileFormat; import org.fudaa.dodico.mesure.EvolutionFileFormatVersion; import org.fudaa.dodico.mesure.EvolutionReguliereInterface; @@ -38,18 +34,22 @@ import org.fudaa.dodico.reflux.io.CrbFileFormat; import org.fudaa.dodico.rubar.io.RubarCLIFileFormat; import org.fudaa.dodico.rubar.io.RubarTARFileFormat; +import org.fudaa.dodico.telemac.io.ScopeGENEFileFormat; +import org.fudaa.dodico.telemac.io.ScopeSFileFormat; +import org.fudaa.dodico.telemac.io.ScopeStructure; import org.fudaa.dodico.telemac.io.TelemacLiquideFileFormat; - import org.fudaa.ebli.commun.EbliActionInterface; import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.courbe.EGExporter; import org.fudaa.ebli.courbe.EGGraphe; - import org.fudaa.fudaa.commun.FudaaLib; import org.fudaa.fudaa.commun.impl.FudaaCommonImplementation; import org.fudaa.fudaa.commun.impl.FudaaGuiLib; import org.fudaa.fudaa.commun.impl.FudaaImportCsvPanel; +import com.memoire.bu.BuFileFilter; +import com.memoire.bu.BuResource; + /** * @author fred deniger * @version $Id: FudaaCourbeImporter.java,v 1.8 2007-06-29 15:09:42 deniger Exp $ @@ -95,7 +95,10 @@ if (op.getSource() == null) { _ui.warn(FudaaLib.getS("Import"), FudaaLib.getS("Pas de courbes \xE0 importer")); } else { + if (op.getSource() instanceof EvolutionReguliereInterface[]) _target.importCourbes((EvolutionReguliereInterface[]) op.getSource(), _mng, prog); + else + _target.importCourbes((ScopeStructure) op.getSource(), _mng, prog); } } _ui.unsetMainMessage(); @@ -107,9 +110,16 @@ public interface Target { void importCourbes(EvolutionReguliereInterface[] _crb, CtuluCommandManager _mng, ProgressionInterface _prog); + + /** + * a utiliser pour les formats scope + * + */ + void importCourbes(ScopeStructure _crb, CtuluCommandManager _mng, ProgressionInterface _prog); + } - private static class ExportAction extends EbliActionSimple { + public static class ExportAction extends EbliActionSimple { final EGGraphe graphe_; final CtuluUI impl_; @@ -130,7 +140,7 @@ new ExportAction(_graphe, _imp) }; } - private static class ImportAction extends EbliActionSimple { + public static class ImportAction extends EbliActionSimple { final FudaaCourbeImporter.Target target_; final FudaaCommonImplementation ui_; final CtuluCommandManager mng_; @@ -178,6 +188,9 @@ r.add(CLTransitoireFileFormat.getInstance()); r.add(RubarTARFileFormat.getInstance()); r.add(RubarCLIFileFormat.getInstance()); + r.add(ScopeSFileFormat.getInstance()); + r.add(ScopeGENEFileFormat.getInstance()); + final FileFormat[] rf = new FileFormat[r.size()]; r.toArray(rf); return rf; Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrCourbeSpatialManager.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrCourbeSpatialManager.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrCourbeSpatialManager.java 2008-09-25 15:22:02 UTC (rev 3982) @@ -0,0 +1,51 @@ +package org.fudaa.fudaa.tr.common; + +import org.fudaa.ctulu.CtuluCommandManager; +import org.fudaa.ctulu.ProgressionInterface; +import org.fudaa.dodico.mesure.EvolutionReguliereInterface; +import org.fudaa.dodico.telemac.io.ScopeStructure; +import org.fudaa.ebli.courbe.EGGraphe; +import org.fudaa.fudaa.commun.courbe.FudaaCourbeImporter; +import org.fudaa.fudaa.meshviewer.profile.MvProfileTreeModel; + +/** + * Manager pour gerer l'importation de courbes au format scope. + * + * @author Adrien Hadoux + * + */ +public class TrCourbeSpatialManager implements FudaaCourbeImporter.Target { + + EGGraphe graphe_; + MvProfileTreeModel modelGraphe_; + /** + * indique si la courbe a importer est correcte + */ + private boolean enabled = true; + TrCommonImplementation impl_; + + + public TrCourbeSpatialManager(EGGraphe _graphe, TrCommonImplementation _impl) { + super(); + graphe_ = _graphe; + impl_ = _impl; + if (_graphe.getModel() instanceof MvProfileTreeModel) + modelGraphe_ = (MvProfileTreeModel) _graphe.getModel(); + else + enabled = false; + } + + public void importCourbes(EvolutionReguliereInterface[] _crb, CtuluCommandManager _mng, ProgressionInterface _prog) { + } + + public void importCourbes(ScopeStructure _crb, CtuluCommandManager _mng, ProgressionInterface _prog) { + if (!enabled) { + impl_.error("Le graphe n'est pas compatible. Il ne s'agit pas de profil spatiaux."); + return; + } else { + // blablabli recup de ma structure + + } + } + +} Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrCourbeTemporelleManager.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrCourbeTemporelleManager.java 2008-09-25 15:13:21 UTC (rev 3981) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrCourbeTemporelleManager.java 2008-09-25 15:22:02 UTC (rev 3982) @@ -19,15 +19,11 @@ import javax.swing.JComboBox; import javax.swing.tree.TreePath; -import com.memoire.bu.BuResource; -import com.memoire.fu.FuLog; - import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.CtuluRange; import org.fudaa.ctulu.ProgressionInterface; import org.fudaa.ctulu.gui.CtuluDialogPanel; - import org.fudaa.dodico.h2d.H2dEvolutionFrontiereLiquide; import org.fudaa.dodico.h2d.H2dParameters; import org.fudaa.dodico.h2d.type.H2dVariableType; @@ -35,7 +31,7 @@ import org.fudaa.dodico.mesure.EvolutionReguliere; import org.fudaa.dodico.mesure.EvolutionReguliereAbstract; import org.fudaa.dodico.mesure.EvolutionReguliereInterface; - +import org.fudaa.dodico.telemac.io.ScopeStructure; import org.fudaa.ebli.courbe.EGAxeHorizontal; import org.fudaa.ebli.courbe.EGAxeVertical; import org.fudaa.ebli.courbe.EGCourbe; @@ -45,11 +41,13 @@ import org.fudaa.ebli.courbe.EGGroup; import org.fudaa.ebli.courbe.EGObject; import org.fudaa.ebli.palette.BPalettePlageDefault; - import org.fudaa.fudaa.commun.courbe.FudaaCourbeCreateGroupPanel; import org.fudaa.fudaa.commun.courbe.FudaaCourbeImporter; import org.fudaa.fudaa.commun.courbe.FudaaCourbeModel; +import com.memoire.bu.BuResource; +import com.memoire.fu.FuLog; + /** * Il est suppose qu'il n'y a qu'un seul graphe dessine. * @@ -464,4 +462,7 @@ fireGlobalChanged(); } + public void importCourbes(ScopeStructure _crb, CtuluCommandManager _mng, ProgressionInterface _prog) { + } + } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrIsoLayerDefault.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrIsoLayerDefault.java 2008-09-25 15:13:21 UTC (rev 3981) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrIsoLayerDefault.java 2008-09-25 15:22:02 UTC (rev 3982) @@ -526,11 +526,16 @@ public void fillWithInfo(final InfoData _m) { _m.setTitle(getTitle()); if (isSondeActive()) { - getIsoModelAbstract().fillInterpolateInfo(_m, sondeSelectedElement_, sondePt_.x_, sondePt_.y_, getTitle()); + fillWithInterpolateInfo(_m); } else { modele_.fillWithInfo(_m, this); } } + + + public void fillWithInterpolateInfo(final InfoData _m) { + getIsoModelAbstract().fillInterpolateInfo(_m, sondeSelectedElement_, sondePt_.x_, sondePt_.y_, getTitle()); + } public final String getDataDescription() { return getTitle(); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionController.java 2008-09-25 15:13:21 UTC (rev 3981) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionController.java 2008-09-25 15:22:02 UTC (rev 3982) @@ -16,6 +16,7 @@ import org.fudaa.ctulu.CtuluUI; import org.fudaa.ebli.commun.EbliActionInterface; import org.fudaa.ebli.commun.EbliActionPaletteAbstract; +import org.fudaa.ebli.palette.BPaletteInfo; import org.fudaa.fudaa.sig.layer.FSigVisuPanel; import org.fudaa.fudaa.sig.layer.FSigVisuPanelController; @@ -79,7 +80,11 @@ } return tabPalettes_; } - + + public BPaletteInfo getPaletteInfoModel() { + return ((BPaletteInfo) mapTabPalettes_.get("INFOS").buildContentPane()); + } + @Override public FSigVisuPanel getVisuPanel() { return super.getVisuPanel(); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-09-25 15:13:21 UTC (rev 3981) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2008-09-25 15:22:02 UTC (rev 3982) @@ -37,7 +37,9 @@ import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorLegende; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; +import org.fudaa.fudaa.commun.courbe.FudaaCourbeImporter; import org.fudaa.fudaa.commun.impl.FudaaCommonImplementation; +import org.fudaa.fudaa.tr.common.TrCourbeSpatialManager; import org.fudaa.fudaa.tr.common.TrLib; import org.fudaa.fudaa.tr.common.TrResource; import org.netbeans.api.visual.widget.Widget; @@ -559,6 +561,12 @@ // TODO trop dangereux... // listeActions.add(new TrPostCourbeAddPointsAction(projet_.impl_, _graphe.getGraphe(), _calque)); listeActions.add(new TrPostCourbeAddVariableAction(projet_.impl_, _graphe.getGraphe())); + + //--ajout des actions import export format scope --// + listeActions.add(new FudaaCourbeImporter.ImportAction(new TrCourbeSpatialManager(_graphe.getGraphe(), + projet_.impl_), projet_.impl_, creator.getGraphe().getCmd())); + listeActions.add( new FudaaCourbeImporter.ExportAction(creator.getGraphe(), projet_.impl_)); + _controller.addFonctionsSpecific(listeActions); } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/rubar/TrRubarTarageCourbesManager.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/rubar/TrRubarTarageCourbesManager.java 2008-09-25 15:13:21 UTC (rev 3981) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/rubar/TrRubarTarageCourbesManager.java 2008-09-25 15:22:02 UTC (rev 3982) @@ -13,19 +13,18 @@ import javax.swing.Action; -import com.memoire.bu.BuInformationsDocument; - +import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ctulu.CtuluHtmlWriter; import org.fudaa.ctulu.CtuluLib; +import org.fudaa.ctulu.ProgressionInterface; import org.fudaa.ctulu.gui.CtuluHelpComponent; - import org.fudaa.dodico.h2d.resource.H2dResource; import org.fudaa.dodico.h2d.rubar.H2dRubarTarageListener; import org.fudaa.dodico.h2d.rubar.H2dRubarTarageMng; import org.fudaa.dodico.h2d.type.H2dVariableType; import org.fudaa.dodico.mesure.EvolutionReguliereAbstract; import org.fudaa.dodico.mesure.EvolutionReguliereInterface; - +import org.fudaa.dodico.telemac.io.ScopeStructure; import org.fudaa.ebli.commun.EbliActionInterface; import org.fudaa.ebli.courbe.EGAxeHorizontal; import org.fudaa.ebli.courbe.EGAxeVertical; @@ -33,7 +32,6 @@ import org.fudaa.ebli.courbe.EGFilleSimple; import org.fudaa.ebli.courbe.EGGraphe; import org.fudaa.ebli.courbe.EGTableGraphePanel; - import org.fudaa.fudaa.commun.courbe.FudaaCourbeImporter; import org.fudaa.fudaa.commun.impl.FudaaCommonImplementation; import org.fudaa.fudaa.tr.common.TrCourbeUseAction; @@ -41,6 +39,8 @@ import org.fudaa.fudaa.tr.common.TrResource; import org.fudaa.fudaa.tr.common.TrRubarCourbeTarageUseFinder; +import com.memoire.bu.BuInformationsDocument; + /** * @author Fred Deniger * @version $Id: TrRubarTarageCourbesManager.java,v 1.25 2007-04-30 14:22:40 deniger Exp $ @@ -149,4 +149,7 @@ return true; } + public void importCourbes(ScopeStructure _crb, CtuluCommandManager _mng, ProgressionInterface _prog) { + } + } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |