[med-svn] r1168 - in trunk/packages: . treeplot treeplot/branches treeplot/branches/upstream treeplot/branches/upstream/current treeplot/branches/upstream/current/debian treeplot/branches/upstream/current/treeplot

charles-guest at alioth.debian.org charles-guest at alioth.debian.org
Sat Jan 19 03:42:32 UTC 2008


Author: charles-guest
Date: 2008-01-19 03:42:28 +0000 (Sat, 19 Jan 2008)
New Revision: 1168

Added:
   trunk/packages/treeplot/
   trunk/packages/treeplot/branches/
   trunk/packages/treeplot/branches/upstream/
   trunk/packages/treeplot/branches/upstream/current/
   trunk/packages/treeplot/branches/upstream/current/debian/
   trunk/packages/treeplot/branches/upstream/current/debian/changelog
   trunk/packages/treeplot/branches/upstream/current/debian/control
   trunk/packages/treeplot/branches/upstream/current/debian/rules
   trunk/packages/treeplot/branches/upstream/current/treeplot/
   trunk/packages/treeplot/branches/upstream/current/treeplot/arbre.h
   trunk/packages/treeplot/branches/upstream/current/treeplot/main.cpp
   trunk/packages/treeplot/branches/upstream/current/treeplot/treeplotter.h
   trunk/packages/treeplot/branches/upstream/current/treeplot/vecteurs.cpp
   trunk/packages/treeplot/branches/upstream/current/treeplot/vecteurs.h
Log:
[svn-inject] Installing original source of treeplot

Added: trunk/packages/treeplot/branches/upstream/current/debian/changelog
===================================================================
--- trunk/packages/treeplot/branches/upstream/current/debian/changelog	                        (rev 0)
+++ trunk/packages/treeplot/branches/upstream/current/debian/changelog	2008-01-19 03:42:28 UTC (rev 1168)
@@ -0,0 +1,9 @@
+treeplot (0.7-1) unstable; urgency=low
+
+  * Initial release.
+
+ -- Olivier Langella <Olivier.Langella at pge.cnrs-gif.fr>  Wed, 24 Oct 2001 11:18:51 +0200
+
+Local variables:
+mode: debian-changelog
+End:

Added: trunk/packages/treeplot/branches/upstream/current/debian/control
===================================================================
--- trunk/packages/treeplot/branches/upstream/current/debian/control	                        (rev 0)
+++ trunk/packages/treeplot/branches/upstream/current/debian/control	2008-01-19 03:42:28 UTC (rev 1168)
@@ -0,0 +1,11 @@
+Source: treeplot
+Section: science
+Priority: optional
+Maintainer: Olivier Langella <Olivier.Langella at pge.cnrs-gif.fr>
+Standards-Version: 3.2.1
+
+Package: treeplot
+Architecture: any
+Depends: libplot (>> 2.4.1)
+Description: Phylogenetic tree file converter (xfig, Phylip, Gif, Postscript, Adobe Illustrator)
+ Treeplot is a conversion tool, from "Phylip" phylogenetic tree file to Postscript (.ps), Adobe Illustrator (.ai), Scalable Vector Graphic (.svg), Computer Graphic Metafile(.cgm), Hewlet Packard Graphic Language (.hpgl), xfig file (.fig), gif image file(.gif), PBM Portable aNy Map file (.pnm)

Added: trunk/packages/treeplot/branches/upstream/current/debian/rules
===================================================================
--- trunk/packages/treeplot/branches/upstream/current/debian/rules	                        (rev 0)
+++ trunk/packages/treeplot/branches/upstream/current/debian/rules	2008-01-19 03:42:28 UTC (rev 1168)
@@ -0,0 +1,50 @@
+#!/usr/bin/make -f
+# Made with the aid of debmake, by Christoph Lameter,
+# based on the sample debian/rules file for GNU hello by Ian Jackson.
+
+package=treeplot
+
+build:
+	$(checkdir)
+	./configure --prefix=/usr
+	$(MAKE) CFLAGS="-O2 -g -Wall"
+	touch build
+
+clean:
+	$(checkdir)
+	-rm -f build
+	-$(MAKE) distclean
+	-rm -f `find . -name "*~"`
+	-rm -rf debian/tmp debian/files* core debian/substvars
+
+binary-indep: checkroot build
+	$(checkdir)
+# There are no architecture-independent files to be uploaded
+# generated by this package.  If there were any they would be
+# made here.
+
+binary-arch: checkroot build
+	$(checkdir)
+	-rm -rf debian/tmp
+	install -d debian/tmp
+	cd debian/tmp && install -d `cat ../dirs`
+	$(MAKE) install prefix=`pwd`/debian/tmp/usr
+# Must have debmake installed for this to work. Otherwise please copy
+# /usr/bin/debstd into the debian directory and change debstd to debian/debstd
+	debstd ChangeLog README TODO 
+	dpkg-gencontrol -isp
+	chown -R root.root debian/tmp
+	chmod -R go=rX debian/tmp
+	dpkg --build debian/tmp ..
+
+define checkdir
+	test -f debian/rules
+endef
+
+binary: binary-indep binary-arch
+
+checkroot:
+	$(checkdir)
+	test root = "`whoami`"
+
+.PHONY: binary binary-arch binary-indep clean checkroot


Property changes on: trunk/packages/treeplot/branches/upstream/current/debian/rules
___________________________________________________________________
Name: svn:executable
   + 

Added: trunk/packages/treeplot/branches/upstream/current/treeplot/arbre.h
===================================================================
--- trunk/packages/treeplot/branches/upstream/current/treeplot/arbre.h	                        (rev 0)
+++ trunk/packages/treeplot/branches/upstream/current/treeplot/arbre.h	2008-01-19 03:42:28 UTC (rev 1168)
@@ -0,0 +1,318 @@
+/***************************************************************************
+                          arbre.h  -  description
+                             -------------------
+    begin                : Mon Dec 18 2000
+    copyright            : (C) 2000 by Olivier Langella
+    email                : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+
+//modifications le 2/1/2001
+//modifications le 4/6/2001
+
+#ifndef ARBRE_H
+#define ARBRE_H
+
+#include <stdlib.h>
+#include <fstream>
+#include <vector>
+#include <string>
+#include <cmath>
+
+#include "internat.h"
+#include "matrices.h"
+
+class ArbreVectUINT:public vector<unsigned int>  {
+public:
+	void f_tri();
+
+	bool Existe (unsigned int element) const {
+//cerr << "ArbreVectUINT::Existe "  << endl;
+//affiche();
+			unsigned int i;
+			for (i= 0 ; i < size(); i++) {
+//cerr << "ArbreVectUINT::Existe i " << i << endl;
+				if (operator[](i) == element) return(true);
+			}
+
+			return (false);
+		};
+
+	void affiche() const;
+
+	bool operator== (const ArbreVectUINT &rval);
+
+private:
+	void f_trishell(unsigned int n,unsigned int j);
+	void f_tribulle();
+};
+
+class Arbre;
+class ArbreNdNoeud;
+class ArbreNdOTU;
+
+class ArbreNdBase {
+public:
+	ArbreNdBase(Arbre * Parbre);
+	ArbreNdBase(const ArbreNdBase &) {};
+	virtual ~ArbreNdBase();
+
+	virtual void set_longueur(unsigned int pos, float taille);
+//	virtual void set_longueur(float longueur) {};
+
+	virtual void set_longueur(ArbreNdBase * Pnoeudbase, float taille);
+	virtual void oPhylipRec(ostream & fichier) const;//écriture d'arbres au format Phylip
+	virtual ArbreNdBase * get_Pracine() const;
+	virtual ArbreNdBase * get_Pnoeud(unsigned int i) const {return(_tabPNoeuds[i]);};
+	virtual unsigned int get_nbbranches() const;
+	virtual double get_longueur_branche() const;
+	virtual double get_tabLgBranches(unsigned int i) const;
+	virtual bool est_racine() const ;
+	virtual void set_nom(const string & nom);
+	virtual void f_chgt_sens(ArbreNdNoeud * Pancracine, ArbreNdNoeud * Pnvsens);
+	virtual int get_posnoeuds(ArbreNdNoeud * Pnoeud) const;
+
+	void set_Pnoeud(unsigned int pos, ArbreNdBase * Pnoeud);
+
+	virtual void fCalcValBootstrap(unsigned int total_bootstrap) {return;};
+	virtual double get_longueur_max()const {return(0);} ;
+	virtual unsigned int get_nbnoeuds_max()const {return(0);} ;
+
+	virtual ArbreVectUINT* f_load_id_ind() {return (0);};
+
+//interface pour PointPlotArbreBase
+protected:
+
+	Arbre * _Parbre;
+	vector<ArbreNdBase *> _tabPNoeuds;
+	vector<float> _tabLgBranches;
+};
+
+
+class ArbreNdOTU: public ArbreNdBase {
+public:
+	ArbreNdOTU(Arbre * Parbre, ArbreNdNoeud * Pnoeud);
+	ArbreNdOTU(Arbre * Parbre, const string & nom);
+	ArbreNdOTU(const ArbreNdOTU & original):ArbreNdBase(original) {};
+	virtual ~ArbreNdOTU();
+
+	void set_nom(const string & nom){_nom.assign(nom);};
+	void set_nom(const char * nom){_nom.assign(nom);};
+
+//	void set_longueur(float longueur){ArbreNdBase::set_longueur((unsigned int) 0,longueur);};
+
+	void set_reference(const string & ref) {strcpy(_reference, ref.c_str());};
+	void set_reference(const char * ref){strcpy(_reference, ref);};
+	const char * get_reference() const {return (_reference);};
+
+	void set_id(unsigned int id) { _id = id;};
+	const string & get_nom() const {return(_nom);};
+
+	inline bool operator== (const ArbreNdOTU &rval){return (_nom == rval._nom);};
+	virtual void oPhylipRec(ostream & fichier) const;//écriture d'arbres au format Phylip
+	virtual double get_longueur_max()const;
+	virtual unsigned int get_nbnoeuds_max()const;
+	unsigned int get_id() const {return(_id);};
+
+	virtual ArbreVectUINT* f_load_id_ind();
+
+private:
+
+//	char _nomchar[50];
+	char _reference[50];
+	string _nom;
+
+	unsigned int _id;
+};
+
+
+class ArbreNdNoeud: public ArbreNdBase {
+public:
+	ArbreNdNoeud(Arbre * Parbre, ArbreNdNoeud * Pnoeud=0);
+	ArbreNdNoeud(const ArbreNdNoeud & original):ArbreNdBase(original) {};
+	ArbreNdNoeud(Arbre * Parbre, unsigned int nbbranches);
+	virtual ~ArbreNdNoeud();
+	inline bool operator== (const ArbreNdNoeud &rval);
+
+	void AjouterFils(ArbreNdBase * Pnoeud);
+	void AjBootstrap();
+
+	double get_val_bootstrap() const;
+	void set_force(float force);
+	void set_longueur(unsigned int pos, float taille);
+	void set_racine(bool oui) {_racine = oui;};
+	virtual void oPhylipRec(ostream & fichier) const;//écriture d'arbres au format Phylip
+	virtual ArbreNdBase * get_Pracine() const;
+	virtual unsigned int get_nbbranches() const;
+	virtual bool est_racine() const;
+	virtual bool ExisteBranche(const ArbreVectUINT & tabInd) const;
+
+	void f_chgt_racine(ArbreNdNoeud * Pracine);
+	void f_load_vectind();
+
+	virtual ArbreVectUINT* f_load_id_ind();
+
+	void fCalcValBootstrap(unsigned int total_bootstrap);
+	virtual double get_longueur_max() const;
+	virtual unsigned int get_nbnoeuds_max()const;
+
+protected:
+	void f_chgt_sens(ArbreNdNoeud * Pancracine, ArbreNdNoeud * Pnvsens);
+
+	bool _racine;
+	int _force;
+//	vector<VectArbreNdOTU *> _tabPPind;
+	vector<ArbreVectUINT *> _tabP_tab_id_ind;
+	unsigned int _accuvalboot;
+};
+
+class Arbre {
+public:
+	Arbre();
+//	Arbre(unsigned int nbessais , unsigned int nbind, unsigned int * Ptemp, char * * PPotu);
+	Arbre(const Arbre &) {};
+	
+	virtual ~Arbre();
+
+	virtual ArbreNdOTU * new_ArbreNdOTU(const string & nom);
+	virtual ArbreNdOTU * new_ArbreNdOTU(ArbreNdNoeud * PArbreNdNoeudere);
+	virtual ArbreNdNoeud * new_ArbreNdNoeud(unsigned int nbbranches);
+	virtual ArbreNdNoeud * new_ArbreNdNoeud(ArbreNdNoeud * PArbreNdNoeudere=0);
+
+	void AjBootstrap(Arbre &);
+
+	virtual void iFichier(istream &);
+
+	void iPhylip(istream &);//lecture d'arbres au format Phylip
+	void iNimbus(unsigned int nbessais , unsigned int nbind, unsigned int * Ptemp, char * * PPotu);
+
+	void iDistances(MatriceLD &, int);
+	void iDistances(MatriceF &, int);
+	void iDistances(MatriceLD & matrice);
+	void f_forceiDistances(MatriceLD & distancesRef,int methodeArbre);
+
+	void oFichier(ostream & fichier, unsigned int format=0) const;
+//	void iMega(istream &);//lecture d'arbres au format Mega
+	void set_Pracine(ArbreNdNoeud * Pracine);
+
+	void f_test();
+	void SquizNoeud(ArbreNdNoeud * Pndaeffacer);
+
+	int PositionInd(const char *) const;
+
+	virtual void f_load_vect_id_ind();
+
+	void reset();
+	void fCalcValBootstrap();
+	bool get_oui_bootstrap() const {return(_oui_bootstrap);};
+	bool get_oui_taille_branches() const {return(_oui_taille_branches);};
+	void set_oformat(unsigned int nbformat=1) {_oFormat = nbformat;};
+	unsigned int get_nbind() const {return(_tabPind.size());};
+	void f_tri_ind_alpha();
+
+	void operator>>(ostream& sortie);
+
+	Titre _titre;
+
+protected:
+	ArbreNdNoeud * RechercheNoeud(const ArbreVectUINT &) const;
+	const ArbreNdOTU * RecherchePOTU(unsigned int id) const;
+
+	template<class T> void iNeighborJoining(Matrice<T> & distances);
+	template<class T> void iNeighborJoiningTopo(Matrice<T> & distances);
+	template<class T> void iUPGMA(Matrice<T> & distances);
+
+	float iPhylipRecGetTaille(istream & fichier);
+	float iPhylipRecGetForce(istream & fichier);
+	void i_PhylipRecGetNom(istream & fichier, char *);
+	void iPhylipRec(istream & fichier, ArbreNdNoeud * Pnoeud=0 );//lecture d'arbres au format Phylip
+	virtual void iPhylipDefGroupe(const string &) {}; //définition d'un groupe
+	void oPhylip(ostream &) const;//écriture d'arbres au format Phylip
+	virtual void oPhylipEcritGroupes(ostream &) const {};
+
+	void iNimbusRec(ArbreNdNoeud * Pnoeud, MatriceF & tab_nimbus, unsigned int numessai, unsigned int deb, unsigned int fin, unsigned int longueur=0);
+//	void iPhylipRecPasser(istream & fichier);
+	void f_trishell_ind_alpha(unsigned int lb, unsigned int ub);
+	void f_tribulle_ind_alpha();//	void f_tri_ind_alpha();
+
+	ArbreNdNoeud * _Pracine;
+	vector<ArbreNdNoeud *> _tabPnoeuds;
+	vector<ArbreNdOTU *> _tabPind;
+
+	bool _oui_taille_branches;
+	bool _oui_bootstrap;
+	bool _ind_charge;
+	unsigned int _cumulbootstrap;
+	unsigned int _oFormat; //format de sortie (1 = phylip/newick)
+
+public:
+	struct Anomalie{
+		Anomalie (int i):le_pb(i){};
+
+		// 1-> Echec de RechercheNoeud
+		int le_pb;
+		string _message;
+
+		string& fmessage(int num){
+			switch (num) {
+			case 1:
+				_message = _("Error n°1 in Arbre: leaf not found");
+				break;
+			case 100:
+				_message = _("Error reading treefile");
+				break;
+				
+			default:
+				_message = _("Error in Arbre");
+				break;
+			}
+			return(_message);
+		}
+	};
+
+};
+
+
+inline bool ArbreNdNoeud::operator== (const ArbreNdNoeud &rval) {
+	//=>remplir les vecteurs avant
+//cerr << "ArbreNdNoeud::operator==" << endl;		
+	unsigned int taille(_tabP_tab_id_ind.size());
+	if (taille != rval._tabP_tab_id_ind.size()) return (false);
+	if (taille == 0) cerr << "ArbreNdNoeud::operator== vide" << endl;
+	if (taille == 1) return (*_tabP_tab_id_ind[0] == *rval._tabP_tab_id_ind[0]);
+
+	unsigned int i,j;
+	
+	bool ok;
+
+//	bool * tab_dejatrouve;
+//	tab_dejatrouve = new bool[taille];
+ // for (i = 0; i < taille; i++) tab_dejatrouve[i] = false;
+
+	for (i=0; i < (taille - 1); i++) {
+		ok = false;
+		for (j=0; ((ok == false) && (j < taille)); j++)
+//			if (!tab_dejatrouve[j])
+			ok = (*_tabP_tab_id_ind[i] == *rval._tabP_tab_id_ind[j]);
+//				if (ok = (*_tabPPind[i] == *rval._tabPPind[j])) tab_dejatrouve[j] = true;
+//if (ok) cerr << "ArbreNdNoeud::operator== ok " << this << endl;		
+		
+		if (!ok) return (false);
+	}
+//	delete tab_dejatrouve;
+
+	return(true);	
+}
+
+#endif
+
+

Added: trunk/packages/treeplot/branches/upstream/current/treeplot/main.cpp
===================================================================
--- trunk/packages/treeplot/branches/upstream/current/treeplot/main.cpp	                        (rev 0)
+++ trunk/packages/treeplot/branches/upstream/current/treeplot/main.cpp	2008-01-19 03:42:28 UTC (rev 1168)
@@ -0,0 +1,34 @@
+/***************************************************************************
+                          main.cpp  -  description
+                             -------------------
+    begin                : lun mar 26 11:11:09 CEST 2001
+    copyright            : (C) 2001 by Olivier Langella
+    email                : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <iostream.h>
+#include <stdlib.h>
+
+#include "appltreeplot.h"
+
+int main(int argc, char *argv[])
+{
+	ApplTreePlot application;
+
+	application.lancement(argc, argv);
+
+  return EXIT_SUCCESS;
+}

Added: trunk/packages/treeplot/branches/upstream/current/treeplot/treeplotter.h
===================================================================
--- trunk/packages/treeplot/branches/upstream/current/treeplot/treeplotter.h	                        (rev 0)
+++ trunk/packages/treeplot/branches/upstream/current/treeplot/treeplotter.h	2008-01-19 03:42:28 UTC (rev 1168)
@@ -0,0 +1,210 @@
+/***************************************************************************
+                          treeplotter.h  -  description
+                             -------------------
+    begin                : Mon Mar 26 2001
+    copyright            : (C) 2001 by Olivier Langella
+    email                : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+#ifndef TREEPLOTTER_H
+#define TREEPLOTTER_H
+
+#include "arbreplus.h"
+#include <plotter.h>
+/*
+   From the base Plotter class, the BitmapPlotter, MetaPlotter, TekPlotter,
+   ReGISPlotter, HPGLPlotter, FigPlotter, CGMPlotter, PSPlotter, AIPlotter,
+   SVGPlotter, GIFPlotter, PNMPlotter, PNGPlotter, and XDrawablePlotter
+   classes are derived.  The PNMPlotter and PNGPlotter classes are derived
+   from the BitmapPlotter class, the PCLPlotter class is derived from the
+   HPGLPlotter class, and the XPlotter class is derived from the
+   XDrawablePlotter class.
+*/
+
+// BitmapPlotter -> 9
+// MetaPlotter
+// TekPlotter,
+// ReGISPlotter
+// HPGLPlotter  -> 4
+// FigPlotter   -> 3
+// CGMPlotter   -> 5
+// PSPlotter  -> 1
+// AIPlotter   -> 2
+// SVGPlotter   -> 6
+// GIFPlotter   -> 7
+// PNMPlotter  -> 8
+// PNGPlotter
+// XDrawablePlotter
+//  classes are derived.  The PNMPlotter and PNGPlotter
+
+
+/**
+  *@author Olivier Langella
+  */
+class PointPlotArbreBase;
+class PointPlotArbreNoeud;
+class PointPlotArbreInd;
+
+class TreePlotter:public ArbrePlus {
+public:
+	TreePlotter();
+	virtual ~TreePlotter();
+
+	virtual ArbreNdOTU * new_ArbreNdOTU(const string & nom);
+	virtual ArbreNdOTU * new_ArbreNdOTU(ArbreNdNoeud * PnoeudPere);
+	virtual ArbreNdNoeud * new_ArbreNdNoeud(unsigned int nbbranches);
+	virtual ArbreNdNoeud * new_ArbreNdNoeud(ArbreNdNoeud * PnoeudPere=0);
+
+  /** fabrique le dessin d'un arbre dans sortie */
+  virtual void oDessin(ostream & sortie, unsigned int format=1);
+  virtual void oDessin(FILE *, const char *);
+  virtual void oDessin(FILE *, unsigned int format=1);
+
+	virtual void iFichier(istream &);
+
+//	virtual PointPlotArbreBase * get_Ppoint(NoeudPBase *) const;
+	
+	bool get_aff_taille_branches () const;
+	double get_echelleX_arbre () const {return(_echelleX_arbre);};
+
+	void set_aff_taille_branches (bool aff);
+	void set_aff_bootstrap (bool aff);
+	void set_style_branches (unsigned int style) {_style_branches = style;};
+//	void define_outgroup (ChaineCar outgroup);
+
+	Plotter * _Pplotter;
+
+	double _decolleX;
+	double _decolleY;
+
+friend PointPlotArbreInd;
+friend PointPlotArbreNoeud;
+
+protected: // Protected methods
+  /** Dessin de l'arbre */
+	void DessineArbre();
+	virtual void oDessincestparti();
+
+	virtual void f_coloriage();
+	virtual void f_calculcoordonnees();
+	virtual void f_ordonneind();
+	virtual void f_case_espaceX(double espaceX);
+	virtual void f_case_espaceY(double espaceY, char car='B');
+  /** décallage des points pour faire un espace en X */
+//  virtual void f_case_espaceX(double espaceX);
+	virtual PointPlotArbreNoeud * get_Ppointplotracine();
+
+//	const ArbreP * _Parbre;
+
+	double _espX;
+	double _espY;
+	double _liminfY;
+	double _limsupY;
+	double _uniteY;
+	double _liminfX;
+	double _limsupX;
+	double _echelleX_arbre;
+	double _unite_echelleX_arbre;
+
+
+//	vector<PointPlotArbreNoeud *> _tabPpointsnoeuds;
+//	vector<PointPlotArbreInd *> _tabPpointsind;
+
+	bool _aff_taille_branches;
+	bool _aff_bootstrap;
+	bool _ignore_neg_value;
+
+	unsigned int _style_branches; // 1 => trait direct 2 => trait coudé rectangulaire
+
+};
+
+class PointPlotArbreBase {
+public:
+	PointPlotArbreBase(TreePlotter *, const Couleur & lacouleur);
+	virtual ~PointPlotArbreBase() {};
+
+	virtual void set_coordy(double coordy) {_coordy = coordy;};
+	virtual double get_coordy() const {return (_coordy);};
+	virtual void set_coordx(double coordx) {_coordx = coordx;};
+	virtual double get_coordx() const {return (_coordx);};
+	virtual const Couleur & get_couleur() const {return (_couleur);};
+//	virtual PointPlot f_calculcoordoneesRec(unsigned int * Pnum_ordre) {};
+	virtual void f_ordonneind(unsigned int * Pnum_ordre) {};
+
+	virtual void f_coloriage() {};
+	virtual void f_calculcoordonnees() {};
+	virtual void DessineEtiquette() const {};
+	virtual void DessineBranche(unsigned int style) const {};
+/*
+	virtual double get_longueur_totale() {return(0);};
+
+	virtual void DessineBranche(unsigned int style=1) {};
+	virtual double get_taille_etiquette() const {return(0);};
+	virtual void DessineEtiquette() const {};
+	virtual void DessineValBootstrap() const {};
+
+protected:
+	virtual double get_taille_bootstrap() const;
+
+
+	double _cumul_longueur;
+
+	vector<double> _tabcoordy;
+*/
+protected:
+	Couleur _couleur;
+	double _coordx;
+	double _coordy;
+	TreePlotter * _Ptreeplot;
+
+};
+
+class PointPlotArbreNoeud:public PointPlotArbreBase, public ArbreNdNoeud  {
+public:
+	PointPlotArbreNoeud(TreePlotter * Parbre, const Couleur & lacouleur, ArbreNdNoeud * PnoeudPere=0):PointPlotArbreBase(Parbre, lacouleur),ArbreNdNoeud((ArbrePlus *) Parbre, PnoeudPere){};
+	PointPlotArbreNoeud(TreePlotter * Parbre, const Couleur & lacouleur, unsigned int nbbranches):PointPlotArbreBase(Parbre, lacouleur),ArbreNdNoeud((ArbrePlus *) Parbre, nbbranches){};
+	virtual ~PointPlotArbreNoeud() {};
+//	virtual PointPlot f_calculcoordoneesRec(unsigned int * Pnum_ordre);
+//	virtual void f_calculcoordonees() {};
+//	virtual double get_taille_bootstrap() const;
+//	virtual void DessineValBootstrap() const;
+	virtual double get_taille_bootstrap() const;
+	virtual void f_coloriage();
+	virtual void f_calculcoordonnees();
+	virtual void f_ordonneind(unsigned int * Pnum_ordre);
+	virtual void DessineBranche(unsigned int style) const;
+	virtual void DessineValBootstrap (unsigned int style) const;
+protected:
+
+};
+
+class PointPlotArbreInd:public PointPlotArbreBase, public ArbreNdOTU {
+public:
+	PointPlotArbreInd(TreePlotter *, const Couleur & lacouleur, ArbreNdNoeud *);
+	PointPlotArbreInd(TreePlotter *, const Couleur & lacouleur, const string &);
+	virtual ~PointPlotArbreInd() {};
+	virtual void f_ordonneind(unsigned int * Pnum_ordre);
+	virtual void f_coloriage();
+	virtual void f_calculcoordonnees();
+	virtual double get_taille_etiquette() const;
+	virtual void DessineEtiquette() const;
+	virtual void DessineBranche(unsigned int style) const;
+//	virtual double get_taille_etiquette() const;
+//	virtual void DessineEtiquette() const;
+
+protected:
+	unsigned int _num_ordre;
+
+};
+
+
+#endif

Added: trunk/packages/treeplot/branches/upstream/current/treeplot/vecteurs.cpp
===================================================================
--- trunk/packages/treeplot/branches/upstream/current/treeplot/vecteurs.cpp	                        (rev 0)
+++ trunk/packages/treeplot/branches/upstream/current/treeplot/vecteurs.cpp	2008-01-19 03:42:28 UTC (rev 1168)
@@ -0,0 +1,462 @@
+/***************************************************************************
+                          vecteurs.cpp  -  Librairie d'objets permettant de manipuler des vecteurs
+                             -------------------
+    begin                : ven aug 14 10:25:55 CEST 2000
+    copyright            : (C) 2000 by Olivier Langella CNRS UPR9034
+    email                : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+
+//#include <strstream>
+
+using namespace std;
+
+#include"vecteurs.h"
+
+void GetLigneFlot(istream& entree, string & ligne) {
+	char car;
+	ligne.assign("");
+	car = entree.peek();
+	while (((car != 10)&&(car != 13)) && (entree.eof() == 0)){
+		entree.get(car);
+		ligne += car;
+		car = entree.peek();
+	}	
+	while (((car == 10)||(car == 13)) && (entree.eof() == 0)){
+		entree.get(car);
+		car = entree.peek();
+	}
+}
+void ChaineCar::GetLigneFlot(istream& entree) {
+//cerr << "ChaineCar::GetLigneFlot debut" << endl;
+
+	char car;
+	
+	assign("");
+	car = entree.peek();
+	while (((car != 10)&&(car != 13)) && (entree.good())){
+
+		entree.clear();
+		
+		entree.get(car);
+
+//cerr << "ChaineCar::GetLigneFlot car" << car << endl;
+		assign(*this + car);
+		car = entree.peek();
+	}	
+	while (((car == 10)||(car == 13)) && (entree.good())){
+		entree.get(car);
+		car = entree.peek();
+	}
+
+//cerr << "ChaineCar::GetLigneFlot fin" << endl;
+}
+
+
+void ChaineCar::assigner(const string& chorigine, signed long deb, signed long fin) {
+	//assigne seuleument une partie de la chorigine
+	// de deb a fin inclus
+
+	signed long i;
+
+	assign("");
+	if (deb < 0) deb = 0;
+
+	for (i = deb; i <= fin ; i++) {
+		if (i >= (signed long) chorigine.size()) break;
+		*this += chorigine[i];
+//		cout << chorigine[i];
+	}
+//	cout << endl;
+}
+
+bool ChaineCar::EstUnChiffre() const {
+	unsigned long i;
+
+	for (i = 0;i < size(); i++) {
+		if ((this->operator[](i) < 48) && (this->operator[](i) > 57)) return(false);
+	}
+
+	return(true);
+}
+
+ChaineCar& ChaineCar::AjEntier (long i) {
+	 //conversion automatique en base 10 et concaténation
+	 int unite;
+	 long facteur;
+	 char chiffre;
+	 bool debut(false);
+	
+
+	 for (facteur = 1000000; facteur > 0; facteur = facteur / 10) {
+	 
+	 	unite = i / facteur;
+
+	 	if ((debut) || (unite > 0)) {
+	 		debut = true;
+	 		i = i - (unite * facteur);
+	 		chiffre = unite + 48;
+	 		
+	 		this->string::operator+=(chiffre);
+	 	}
+	 }
+	 return (*this);
+}
+
+long ChaineCar::GetNbMots() const {
+	 //retourne le nombre de mots contenus 
+		// dans la chaine (séparateur= ' ' ou '/t')
+	long resultat(0);
+	long i, taille;
+	bool change(true);
+	bool quote(false);
+
+	taille = this->size();
+
+//cerr << "ChaineCar::GetNbMots()" << *this <<"Fin" << endl;
+	for (i=0; i < taille; i++) {
+		if (this->operator[](i) == '\'') quote = !(quote);
+		if ((quote == false) && (this->operator[](i) > 32)) {
+			if(change) {
+//cerr << this->operator[](i) << endl;
+				resultat++;
+				change = false;
+			}
+		}
+		else {
+			change = true;
+		}
+	}
+
+//cerr << *this << endl;
+//cerr << "ChaineCar::GetNbMots()" << resultat << endl;
+	return (resultat);
+}
+
+void ChaineCar::GetMot(unsigned int numero, string &mot) const {
+	 //retourne le numeroième mot contenu 
+		// dans la chaine (séparateur= ' ' ou '/t')
+	if (numero < 1) {
+		mot = "";
+		return;
+	}
+
+	unsigned int resultat(0);
+	unsigned int i, taille, debut(0), fin(0);
+	bool change(true);
+	bool quote(false);
+
+	taille = this->size();
+
+//cerr << "mot:" << *this <<"Fin" << endl;
+	for (i=0; i < taille; i++) {
+//cerr << this->operator[](i) << endl;
+		if (this->operator[](i) == '\'') {
+			if ((resultat == numero) && (quote)) {
+				fin = (i-1);
+				break;
+			}
+			quote = !(quote);
+			if ((resultat == numero) && (quote)) {
+				debut = (i+1);
+	//			break;
+			}
+		}
+		if ((quote) || (this->operator[](i) > 32)) {
+			//caractere normal
+			if (change) {
+				change = false;
+				resultat++;
+				debut = i;
+				if (quote) debut++;
+			}
+			fin = i;
+		}
+		else {
+			if (resultat == numero) break;
+			change = true;
+		}
+	}
+	fin++;
+
+	if (resultat != numero) {
+		mot = "";
+		return;
+	}
+
+	mot = substr(debut, (fin - debut));
+//cerr << "mot:" << mot <<"Fin" << endl;
+
+}
+
+
+const Titre& Titre::operator= (const Titre &rval) {
+	unsigned long t(rval.size());
+	unsigned long i;
+
+	for (i=0; i < size(); i++) {
+		delete vector<ChaineCar*>::operator[](i);
+//		delete at(i);
+	}
+
+	erase(begin(), end());
+	reserve(t);
+	for (i=0; i < t ; i++) {
+		push_back(rval.GetTitre(i));
+	}
+	return (*this);
+}
+
+Titre::~Titre(){		
+	unsigned long i;
+
+	for (i=0; i < size(); i++) {
+		delete vector<ChaineCar*>::operator[](i);
+//		delete at(i);
+	}
+}
+
+long Titre::Position (const ChaineCar& chaine) const {
+	unsigned long i;
+	signed long res(-1);
+
+	for (i= 0 ; i < size(); i++) {
+		if (!(chaine.compare(GetTitre(i)))) {
+//cerr << chaine << GetTitre(i) << "_" << endl;
+//		if (chaine.compare(GetTitre(i)) == 0) {
+			res = i;
+			break;
+		}
+	}
+
+	return (res);
+};
+
+void Titre::GetArguments(const string & ligne) {
+	//doit se comporter comme le shell
+	// sépare les mots, et accepte les ' ou les "
+	unsigned int i;
+	bool quote(false), vide(false);
+
+	push_back("");
+	
+	for (i=0; i < ligne.size(); i++) {
+		if ((quote == false) && ((back().size() > 0) || vide) && ((ligne[i] == ' ') || (ligne[i] == '\t')))  {//séparateur
+			push_back("");
+			vide = false;		
+		}
+		else {
+			if ((ligne[i] == '"') || (ligne[i] == '\'')) {
+        if ((quote) && (back().size() == 0)) vide = true;
+				quote = !(quote);
+			}
+			else back() += ligne[i];
+		}
+	}
+/*
+cerr << "Titre::GetArguments(const string & ligne)" << endl;
+	for (i=0; i < size(); i++) {
+cerr << get_titre(i) << endl;
+	}
+*/
+}
+
+bool Titre::operator== (const Titre &rval){
+	// comparaison de deux titres
+	unsigned long i;
+
+	if (rval.size() != size()) return(false);
+
+	for (i = 0; i < size(); i++) {
+		if (GetTitre(i).compare(rval.GetTitre(i)) != 0) return(false);
+	}
+	
+
+	return (true);
+}
+
+Titre::Titre(char ** commandes, int nbcommandes) {
+	long i;
+
+	for (i = 0; i < nbcommandes; i++) {
+		push_back(commandes[i]);
+	}
+}
+
+Titre::Titre(const Titre& rval) {
+
+	*this = rval;
+
+}
+
+void Titre::resize(long nouvtaille) {
+	//on efface:
+	long i, taille(size());
+	
+	for (i=0 ; i < taille; i++) delete vector<ChaineCar*>::operator[](i);
+
+	//on réalloue
+	vector<ChaineCar*>::resize(nouvtaille);
+	for (i=0 ; i < nouvtaille; i++) vector<ChaineCar*>::operator[](i) = new ChaineCar;
+	
+}
+
+Titre Titre::operator+ (const Titre &rval) const {
+	//marche pas...
+	long i , taille(rval.size());
+	Titre Resultat;
+
+	Resultat = *this;
+
+	for (i=0; i < taille; i++) {
+//cerr << rval.GetTitre(i);
+		Resultat.push_back(rval.GetTitre(i));
+	}
+
+	return Resultat;
+}
+
+
+void ChaineCar::fmajus() {
+	//convertit la chaine en majuscules
+	// après une lecture par exemple
+	int taille(size());
+	int i;
+
+	for (i = 0; i < taille; i++) {
+		if ((operator[](i) > 96)&&(operator[](i) < 124)) operator[](i) = operator[](i) - 32;
+	}
+}
+
+void ChaineCar::fsupprchiffres() {
+	//supprime les chiffres contenu dans une chaine
+	// après une lecture par exemple
+	int taille(size()-1);
+	int car, i;
+
+	for (i = taille; i >= 0; i--) {
+		car = operator[](i);
+		if ((car > 47) && (car < 58)) erase(i,1);
+	}
+}
+
+void ChaineCar::fsupprgauche() {
+	//supprime les espaces ou tabulations à gauche
+	unsigned int i;
+
+	i = 0;
+	while (((operator[](i) == ' ')||(operator[](i) == '\t')) && (i < size())) {
+		erase(i,1);
+		i++;
+	}
+}
+
+void ChaineCar::fsupprdroite() {
+	//supprime les espaces ou tabulations à droite
+	unsigned int i;
+
+	i = size()-1;
+	while (((operator[](i) == ' ')||(operator[](i) == '\t')) && (i >= 0)) {
+		erase(i,1);
+		i--;
+	}
+}
+
+void ChaineCar::fnettoie(const string & mot) {
+	//supprime de la chaine de caractere toutes les occurences de "mot"
+
+	int pos;
+
+	pos = find(mot, 0);
+	while (pos != -1) {
+		replace(pos, mot.size(), "");
+		pos = find(mot, 0);
+	}
+}
+
+unsigned long ChaineCar::GetNbMots(const string & separateur) const {
+	//retourne le nombre de mot separes par separateur
+
+	long pos;
+	unsigned long iteration(0);
+	
+	if (size() == 0) return(0);
+
+	pos = find(separateur, 0);
+	while (pos != -1) {
+		pos = find(separateur, pos+1);
+		iteration++;
+	}
+
+	return(iteration + 1);
+}
+
+void ChaineCar::GetMot(unsigned int numero, string &mot, const string & separateur) const {
+	//retourne le nieme mot separe par separateur
+
+	signed int debut(0);
+	int fin(-1);
+	unsigned int iteration(1);
+	int taillesep(separateur.size());
+	mot.assign("");
+
+	fin = find(separateur, 0);
+	if ((fin == -1) && (numero < 2)) {
+		mot.assign(*this);
+		return;
+	}
+	if (fin == -1) fin = size();
+	while ((debut != -1) && (iteration < numero)) {
+		debut = fin + taillesep;
+//cerr << "debut " << debut << endl;
+		fin = find(separateur, debut);
+		if (fin == -1) fin = size();
+		//else fin = pos;
+		iteration++;
+	}
+	
+	if (debut == -1) return;
+	if (debut > (signed int)size()) return;
+	if (fin > (signed int)size()) return;
+	if (debut > fin) return;
+	
+	mot = substr(debut, (fin - debut));
+}
+
+
+ChaineCar& Titre::GetTitre(long i) const {
+	return (*(vector<ChaineCar*>::operator[](i)));
+}
+
+void Titre::Suppr (unsigned long pos) {
+	if (pos >= size()) throw Anomalie(1);
+	delete (vector<ChaineCar*>::operator[](pos));
+	erase(begin()+pos);
+}
+
+
+
+/** remplacer les occurences de "couper" par "coller" */
+void ChaineCar::Remplacer(const string & couper, const string & coller){
+
+	int pos;
+
+	pos = find(couper, 0);
+	while (pos != -1) {
+		replace(pos, couper.size(), coller);
+		pos = find(couper, 0);
+	}
+}
+
+int ChaineCar::Position(const string & motif) const {
+	return(find(motif, 0));
+}

Added: trunk/packages/treeplot/branches/upstream/current/treeplot/vecteurs.h
===================================================================
--- trunk/packages/treeplot/branches/upstream/current/treeplot/vecteurs.h	                        (rev 0)
+++ trunk/packages/treeplot/branches/upstream/current/treeplot/vecteurs.h	2008-01-19 03:42:28 UTC (rev 1168)
@@ -0,0 +1,173 @@
+/***************************************************************************
+                          vecteurs.h  -  Librairie d'objets permettant
+                          de manipuler des vecteurs
+                             -------------------
+    begin                : ven aug 14 10:25:55 CEST 2000
+    copyright            : (C) 2000 by Olivier Langella CNRS UPR9034
+    email                : Olivier.Langella at pge.cnrs-gif.fr
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   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 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+// Objets permettant de manipuler des vecteurs
+// Olivier Langella le 12/5/99
+// langella at pge.cnrs-gif.fr
+
+#ifndef VECTEUR_H
+#define VECTEUR_H
+
+#include <vector>
+#include <string>
+
+class VecteurLD:public vector<long double>  {
+};
+
+template<class T> class Vecteur:public vector<T>  {
+	public:
+
+		unsigned long getNbOccurence (const T& element) const {
+			unsigned long i;
+			unsigned long res(0);
+
+			for (i= 0 ; i < size(); i++) {
+				if (vector<T>::operator[](i) == element) res++;
+//				if (this->operator[](i) == element) res++;
+			}
+
+			return (res);
+		};
+
+		bool Existe (const T& element) const {
+			unsigned long i;
+			bool res(false);
+
+			for (i= 0 ; i < size(); i++) {
+				if (vector<T>::operator[](i) == element) {
+					res = true;
+					break;
+				}
+			}
+
+			return (res);
+		};
+
+		signed long Position (const T& element) const {
+			unsigned long i;
+			signed long res(-1);
+
+		//	long taille(vector<T>::size());
+
+			for (i = 0 ; i < size(); i++) {
+				if (vector<T>::operator[](i) == element) {
+					res = i;
+					break;
+				}
+			}
+			return (res);
+		};
+
+		void Suppr (unsigned long pos){
+			erase(begin()+pos);
+		};
+
+};
+
+class ChaineCar:public string {
+public:
+	ChaineCar(){assign("");};
+	ChaineCar(long i){AjEntier(i);};
+	ChaineCar(const char * tag){assign(tag);};
+	ChaineCar(const string& chaine){assign(chaine);};
+	
+	~ChaineCar(){};
+	
+	void assigner(const string& chaine, signed long deb, signed long fin);
+
+    operator double() const {return(atof(c_str()));};
+    operator int() const {return(atoi(c_str()));};
+    operator unsigned int() const {return(atoi(c_str()));};
+
+	void GetLigneFlot(istream& entree);
+
+	long GetNbMots() const; //retourne le nombre de mots contenus 
+	void GetMot(unsigned int numero, string &mot) const ;
+		// dans la chaine (séparateur= ' ' ou '/t')
+	unsigned long GetNbMots(const string & separateur) const; //retourne le nombre de mots contenus
+	void GetMot(unsigned int numero, string &mot, const string & separateur) const ;
+	
+	const char * GetStr() {return(c_str());};
+
+	ChaineCar& AjEntier (long i); //conversion automatique en base 10 et concaténation
+//	ChaineCar& operator+= (char car) {return (string::operator+=(car));};
+	bool EstUnChiffre() const;
+
+	void fmajus ();
+	void fsupprchiffres();
+	void fsupprgauche();
+	void fsupprdroite();
+	void fnettoie(const string &);
+  /** remplacer les occurences de "couper" par "coller" */
+  void Remplacer(const string & couper, const string & coller);
+	int Position(const string & motif) const;
+
+
+//	const ChaineCar& operator= (const string &rval) {*this = (ChaineCar) rval; return (*this);};
+
+//	const ChaineCar& operator= (const char * chaine) ;
+};
+
+class Titre: public vector<ChaineCar*> {
+
+public:
+	~Titre();
+	Titre(){};
+	Titre(const Titre&);
+	Titre(char ** commandes, int nbcommandes);
+
+	//déprécié:
+	const ChaineCar& get_titre(long i) const {return (*(vector<ChaineCar*>::operator[](i)));};
+
+	ChaineCar& GetTitre(long i)const;
+	void GetArguments(const string &);
+	ChaineCar& operator[] (unsigned long i)const {if (i >= size()) throw Anomalie(1); return (GetTitre(i));};
+	ChaineCar& back() {return (*(vector<ChaineCar*>::back()));};
+
+	long Position (const ChaineCar& chaine) const;
+
+	void push_back(const char * pcar) {vector<ChaineCar*>::push_back(new ChaineCar(pcar));};
+	void push_back(const string & chaine) {vector<ChaineCar*>::push_back(new ChaineCar(chaine.c_str()));};
+	void pop_back() {delete vector<ChaineCar*>::back(); vector<ChaineCar*>::pop_back();};
+	void resize(long nouvtaille);
+
+//	void Suppr (unsigned long pos) {if (pos >= size()) throw Anomalie(1); delete (operator[](pos)); erase(begin()+pos);};
+	void Suppr (unsigned long pos);
+
+
+	const Titre& operator= (const Titre &rval);
+	bool operator== (const Titre &rval);
+	Titre operator+ (const Titre &rval) const;
+
+	//string & affiche() const;
+
+public:
+
+	struct Anomalie{
+		Anomalie (int i):le_pb(i){};
+
+				// 1-> titre inexistant
+		int le_pb;
+	};
+};
+
+void GetLigneFlot(istream& entree, string & ligne);
+
+#endif
+
+




More information about the debian-med-commit mailing list