From: <had...@us...> - 2009-01-16 08:14:21
|
Revision: 4365 http://fudaa.svn.sourceforge.net/fudaa/?rev=4365&view=rev Author: hadouxad Date: 2009-01-16 08:14:16 +0000 (Fri, 16 Jan 2009) Log Message: ----------- corrections bug + persistance donn?\195?\169es enregistr?\195?\169es Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/ScopCourbeTreeModel.java Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/ScopCourbeTreeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/ScopCourbeTreeModel.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/ScopCourbeTreeModel.java 2009-01-16 08:14:16 UTC (rev 4365) @@ -0,0 +1,137 @@ +package org.fudaa.fudaa.tr.post; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.fudaa.ctulu.CtuluCommandManager; +import org.fudaa.ctulu.ProgressionInterface; +import org.fudaa.dodico.h2d.type.H2dVariableType; +import org.fudaa.dodico.mesure.EvolutionReguliere; +import org.fudaa.dodico.mesure.EvolutionReguliereInterface; +import org.fudaa.ebli.courbe.EGCourbe; +import org.fudaa.ebli.courbe.EGCourbeChild; +import org.fudaa.ebli.courbe.EGGrapheDuplicator; +import org.fudaa.ebli.courbe.EGGrapheModel; +import org.fudaa.ebli.courbe.EGGroup; +import org.fudaa.ebli.courbe.EGGrapheTreeModel.GrapheTreeNode; + +import org.fudaa.fudaa.commun.courbe.FudaaCourbeModel; +import org.fudaa.fudaa.commun.courbe.ScopeCourbeModel; +import org.fudaa.fudaa.meshviewer.profile.MVProfileCourbeModel; +import org.fudaa.fudaa.meshviewer.profile.MvProfileCourbe; +import org.fudaa.fudaa.meshviewer.profile.MvProfileCourbeGroup; +import org.fudaa.fudaa.meshviewer.profile.MvProfileTreeModel; + + +/** + * Tree Model des formats scope + * @author genesis + * + */ +public class ScopCourbeTreeModel extends TrPostCourbeTreeModel{ + + + public void importCourbes(final EvolutionReguliereInterface[] _crb, final CtuluCommandManager _mng, + final ProgressionInterface _prog) { + if (_crb == null) return; + final EGGroup gr = getGroupFor(H2dVariableType.SANS); + final List<EGCourbeChild> childs = new ArrayList<EGCourbeChild>(_crb.length); + for (int i = 0; i < _crb.length; i++) { + + EvolutionReguliere evol=null; + if(_crb[i] instanceof EvolutionReguliere) + evol=(EvolutionReguliere) _crb[i]; + else + evol=new EvolutionReguliere(_crb[i]); + final EGCourbeChild child = new EGCourbeChild(gr, new ScopeCourbeModel(evol)); + childs.add(child); + + //-- on met a jour si la courbe est un nuage de points ou non --// + child.setNuagePoints_(_crb[i].isNuagePoints()); + + gr.addEGComponent(child); + } + + if (_mng != null) { + _mng.addCmd(new CommandAddCourbesMulti(childs.toArray(new EGCourbeChild[childs.size()]), new EGGroup[] { gr })); + } + fireStructureChanged(); + + } + + /** + * Methode qui permet de fusionner le model courant avec un autre model SPATIAL. Utilsier poru la fusion de courbes spatiales + * et l ajout dans d autres courbes. + * + * @author Adrien Hadoux + * @param anotherModel + */ + public void mergeWithAnotherMvProfileTreeModel(final MvProfileTreeModel anotherModel) { + // -- parcours de la liste des variables du graphe a fusionner --// + for (int i = 0; i < anotherModel.target_.getVars().length; i++) { + final H2dVariableType var = (H2dVariableType) anotherModel.target_.getVars()[i]; + + // -- on recupere toutes les courbes associees a la var pour le + // graphe merges + final MvProfileCourbeGroup g = anotherModel.getGroup(var, false); + if (g != null) { + // -- on recherche le group associe a la variale dans l autre graphe + // sinon on le cree --// + final EGGroup group = this.getGroupFor(var); + + for (int k = g.getChildCount() - 1; k >= 0; k--) { + if (g.getCourbeAt(k).getModel() instanceof MVProfileCourbeModel) { + if (((MVProfileCourbeModel) g.getCourbeAt(k).getModel()).getVariable() == var) { + + // -- duplication de la courbe dans le groupe --// + + + group.addEGComponent((EGCourbeChild) g.getCourbeAt(k).duplicate(group, new EGGrapheDuplicator())); + + + } + } + + } + } + + } + this.fireStructureChanged(); + + } + + +// public EGCourbe[] getCourbes() { +// +// List<EGCourbe> liste=new ArrayList<EGCourbe>(); +// +// for(int i=0;i<this.getNbEGObject();i++){ +// if(this.getEGObject(i) instanceof EGCourbe){ +// liste.add((EGCourbe) this.getEGObject(i)); +// } +// } +// return liste.toArray(new EGCourbe[liste.size()]); +// +// } + + public EGGrapheModel duplicate(final EGGrapheDuplicator _duplicator) { + final ScopCourbeTreeModel duplic = new ScopCourbeTreeModel(); + duplic.setAxeX(this.getAxeX().duplicate()); + + duplic.getSelectionModel().setSelectionMode(this.getSelectionModel().getSelectionMode()); + + final GrapheTreeNode root = this.getGrapheTreeNode(); + final GrapheTreeNode rootDuplique = duplic.getGrapheTreeNode(); + + for (int i = 0; i < root.components_.size(); i++) { + + // -- ajout du groupe duplique --// + duplic.add(root.getGroup(i).duplicate(_duplicator)); + + } + + return duplic; + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |