00001 /* 00002 * lib-controler-gmap : Le contrôleur de 3-G-cartes, surcouche de lib-controler. 00003 * Copyright (C) 2004, Moka Team, Université de Poitiers, Laboratoire SIC 00004 * http://www.sic.sp2mi.univ-poitiers.fr/ 00005 * Copyright (C) 2009, Guillaume Damiand, CNRS, LIRIS, 00006 * guillaume.damiand@liris.cnrs.fr, http://liris.cnrs.fr/ 00007 * 00008 * This file is part of lib-controler-gmap 00009 * 00010 * This program is free software: you can redistribute it and/or modify 00011 * it under the terms of the GNU Lesser General Public License as published by 00012 * the Free Software Foundation, either version 3 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU Lesser General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU Lesser General Public License 00021 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00022 */ 00023 00024 //****************************************************************************** 00025 // Export XFig. Il y a deux formats "principaux" : 00026 // - sauveCarteXfig pour sauver la carte. Suivant les paramètres, 00027 // sauve les brins orientés (comme si on avait une carte), les faces 00028 // pleines, les coutures, la grille, les sommets, et inverse l'axe Y. 00029 // - sauveCarteIntervoxelXfig qui sauve au format intervoxel (donc avec 00030 // les faces pleines, les arêtes et les sommets comme si on avait des 00031 // surfels, pointels et lignels. 00032 public: 00033 00034 void initConfig(); 00035 00036 void sauveCarteXfig(TViewId, std::ofstream &, bool AArrow, bool AFace, 00037 bool ASews, bool AGrid, bool AVertices, bool AInvert = true); 00038 00039 void sauveCarteIntervoxelXfig(TViewId, std::ofstream &, bool AInvert = true); 00040 00041 // Export the actual map in the fout stream, with intervoxels elements 00042 private: 00043 void transfoMmPixel(CVertex & v2d); 00044 void sauveEntete(std::ofstream &os, int nbCoul); 00045 void debutComposante(std::ofstream &os, 00046 const CVertex & min, const CVertex & max); 00047 int computeProf(const CVertex & V); 00048 int computeProf(const CVertex & V1, const CVertex & V2); 00049 void sauvePoint(std::ofstream &os, const CVertex & v, int coul, int larg); 00050 void sauveLine(std::ofstream &os, const CVertex & p1, const CVertex & p2, 00051 int coul, int larg, bool arrow, int AProf = -1); 00052 void sauveTriangle(std::ofstream & os, int coulFill, int larg, 00053 CVertex & PC, CVertex & P1, CVertex & P2); 00054 void sauveFace(std::ofstream &os, CVertex *p, int nbPts, 00055 int coulFill, int larg); 00056 00057 void sauveDartVertex(std::ofstream &os, const CVertex & v, const CVertex & v2); 00058 00059 void treatSews(std::ofstream & /*fout*/, 00060 CDart* /*dart*/, int /*mark*/, int /*mark2*/); 00061 00062 void treatFace(std::ofstream& /*fout*/, CDart* /*dart*/, 00063 int /*mark*/, int /*mark2*/ ); 00064 00065 void treatFilledFace(std::ofstream& /*fout*/, CDart* /*dart*/, 00066 int /*mark*/, int /*mark2*/ ); 00067 00068 void treatDartWithArrow(std::ofstream& /*fout*/, CDart* /*dart*/, 00069 int /*mark*/, int /*mark2*/); 00070 00071 void treatDartNoArrow(std::ofstream& /*fout*/, CDart* /*dart*/, 00072 int /*mark*/, int /*mark2*/ ); 00073 00074 void saveGridIncludingBox(std::ofstream & /*fout*/); 00075 00076 00077 // Projet the 3d vertex into the 2d plane, with the Open GL 00078 // matrix. The z of the out parameter v2d is the depth of the point 00079 void transfo3dTo2d( const CVertex &, CVertex & /*v2d*/); 00080 00081 // this method is used for compute the 2d including box of an 00082 // object. pts is alpha 3d point, min and max was 2d points, in-out 00083 // parameters. Project the 3d pts in 2d, and compare this with min 00084 // and max, and eventually update them if necessary. 00085 // If init is true, min=max=the project in 2d of pts 00086 void updateMinMax2d(const CVertex& /*pts*/, CVertex& /*min*/, 00087 CVertex & /*max*/, bool init=false); 00088 00089 // compute the 2d including box of the projection of the darts in the orbit. 00090 void getIncludingBoxForDarts(CDart*, TOrbit, CVertex& /*min*/, 00091 CVertex& /*max*/); 00092 00093 // save the grid in fout in xfig format. 00094 void treatGrid(std::ofstream& /*fout*/); 00095 00096 void treatPointel(std::ofstream& /*os*/, CDart* /*d*/, int /*mark*/); 00097 void treatLignel(std::ofstream& /*os*/, CDart* /*d*/, int /*mark*/); 00098 //******************************************************************************
1.5.8