diff --git a/apps/trimeshinfo/trimeshinfo.cpp b/apps/trimeshinfo/trimeshinfo.cpp index 57157dc2..d2943d95 100644 --- a/apps/trimeshinfo/trimeshinfo.cpp +++ b/apps/trimeshinfo/trimeshinfo.cpp @@ -1,78 +1,78 @@ /**************************************************************************** -* VCGLib o o * -* Visual and Computer Graphics Library o o * -* _ O _ * -* Copyright(C) 2004 \/)\/ * -* Visual Computing Lab /\/| * -* ISTI - Italian National Research Council | * -* \ * -* All rights reserved. * -* * -* 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. * -* * -* 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 Public License (http://www.gnu.org/licenses/gpl.txt) * -* for more details. * -* * +* VCGLib o o * +* Visual and Computer Graphics Library o o * +* _ O _ * +* Copyright(C) 2004 \/)\/ * +* Visual Computing Lab /\/| * +* ISTI - Italian National Research Council | * +* \ * +* All rights reserved. * +* * +* 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. * +* * +* 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 Public License (http://www.gnu.org/licenses/gpl.txt) * +* for more details. * +* * ****************************************************************************/ /**************************************************************************** History $Log: not supported by cvs2svn $ -Revision 1.5 2005/09/30 13:29:40 rita_borgo +Revision 1.6 2005/09/30 14:13:01 rita_borgo +Problem: Text not aligned + +Revision 1.5 2005/09/30 13:29:40 rita_borgo Fixed Manifold Test -Revision 1.4 2005/09/29 14:48:15 rita_borgo +Revision 1.4 2005/09/29 14:48:15 rita_borgo Fixed code related to creation of the XML file -Revision 1.3 2005/09/28 13:57:09 rita_borgo +Revision 1.3 2005/09/28 13:57:09 rita_borgo Fixed some printout not alligned -Revision 1.2 2005/09/28 10:46:04 rita_borgo +Revision 1.2 2005/09/28 10:46:04 rita_borgo Added possibility of saving File in OFF format -Revision 1.1 2005/09/20 10:15:27 rita_borgo +Revision 1.1 2005/09/20 10:15:27 rita_borgo Changed file name to uniform with other solution projects, before was main.cpp -Revision 1.8 2005/02/15 12:26:06 rita_borgo +Revision 1.8 2005/02/15 12:26:06 rita_borgo Minor changes to self-intersection -Revision 1.7 2005/02/07 15:44:31 rita_borgo +Revision 1.7 2005/02/07 15:44:31 rita_borgo Fixed Color and Volume -Revision 1.6 2005/02/01 17:37:53 rita_borgo +Revision 1.6 2005/02/01 17:37:53 rita_borgo Fixed Volume and Color -Revision 1.5 2005/01/18 16:33:12 rita_borgo +Revision 1.5 2005/01/18 16:33:12 rita_borgo Added OFF file Option -Revision 1.4 2005/01/17 18:19:00 rita_borgo +Revision 1.4 2005/01/17 18:19:00 rita_borgo Added new routines. Self-intersection first release -Revision 1.2 2005/01/03 16:13:09 rita_borgo +Revision 1.2 2005/01/03 16:13:09 rita_borgo Added Standard comments ****************************************************************************/ #include -#include +#include #include using namespace std; - #include #include #include -#include // mi sembra di averlo aggiunto! - - +#include // mi sembra di averlo aggiunto! #include #include #include @@ -84,46 +84,36 @@ using namespace std; #include #include #include - #include "XMLTree.h" #include - - -// loader +// loader #include - #include "defs.h" - +string ans; using namespace vcg; using namespace tri; using namespace face; +int prova1; class MyFace; class MyEdge; -class MyVertex:public Vertex{}; +class MyVertex : public Vertex{}; class MyFace :public FaceAFAV{}; class MyMesh: public tri::TriMesh< std::vector, std::vector >{}; - - -typedef MyMesh::VertexPointer VertexPointer; -typedef MyMesh::VertexIterator VertexIterator; - +typedef MyMesh::VertexPointer VertexPointer; +typedef MyMesh::VertexIterator VertexIterator; typedef Point3 Point3x; typedef vector Hole; -string ans; - void OpenMesh(const char *filename, MyMesh &m) { int err = tri::io::Importer::Open(m,filename); - if(err) { + if(err){ printf("Error in reading %s: '%s'\n",filename,tri::io::Importer::ErrorMsg(err)); exit(-1); } - printf("read mesh `%s'\n", filename); + printf("read mesh `%s'\n", filename); } - - inline char* GetExtension(char* filename) { for(int i=strlen(filename)-1; i >= 0; i--) @@ -134,11 +124,8 @@ inline char* GetExtension(char* filename) else return NULL; } - - -typedef MyMesh::VertexPointer VertexPointer; -typedef MyMesh::VertexIterator VertexIterator; - +typedef MyMesh::VertexPointer VertexPointer; +typedef MyMesh::VertexIterator VertexIterator; /* classe di confronto per l'algoritmo di individuazione vertici duplicati*/ template class DuplicateVert_Compare{ @@ -148,80 +135,69 @@ public: return *a < *b; } }; - -static int DuplicateVertex( MyMesh & m ) // V1.0 +static int DuplicateVertex( MyMesh & m )// V1.0 +{if(m.vert.size()==0 || m.vn==0) +return 0; +std::map mp; +int i,j; +VertexIterator vi; +int deleted=0; +int k=0; +int num_vert = m.vert.size(); +vector perm(num_vert); +for(vi=m.vert.begin(); vi!=m.vert.end(); ++vi, ++k) +perm[k] = &(*vi); +DuplicateVert_Compare c_obj; +std::sort(perm.begin(),perm.end(),c_obj); +j = 0; +i = j; +mp[perm[i]] = perm[j]; +++i; +for(;i!=num_vert;) { - - if(m.vert.size()==0 || m.vn==0) - return 0; - std::map mp; - int i,j; - VertexIterator vi; - int deleted=0; - int k=0; - int num_vert = m.vert.size(); - vector perm(num_vert); - for(vi=m.vert.begin(); vi!=m.vert.end(); ++vi, ++k) - perm[k] = &(*vi); - - DuplicateVert_Compare c_obj; - - std::sort(perm.begin(),perm.end(),c_obj); - j = 0; - i = j; - mp[perm[i]] = perm[j]; - ++i; - for(;i!=num_vert;) + if( (! (*perm[i]).IsD()) && + (! (*perm[j]).IsD()) && + (*perm[i]).P() == (*perm[j]).cP() ) { - if( (! (*perm[i]).IsD()) && - (! (*perm[j]).IsD()) && - (*perm[i]).P() == (*perm[j]).cP() ) + if(deleted ==0) { - if(deleted ==0) - { - cout<< "\t Found Duplicated Vertices"<< endl; - cout<< "\t do you want to remove them? [y/Y| n/N]\n"; - cin>>ans; - } - if((ans == "s") ||(ans=="S")) - { - VertexPointer t = perm[i]; - mp[perm[i]] = perm[j]; - (*t).SetD(); - m.vn--; - } - ++i; - deleted++;// per evitare che su risposta no rifaccia la domanda ad ogni vertice che incontra; + cout<< "\t Found Duplicated Vertices"<< endl; + cout<< "\t do you want to remove them? [y/Y| n/N]\n"; + cin>>ans; } - else + if((ans == "s") ||(ans=="S")) { - j = i; - ++i; + VertexPointer t = perm[i]; + mp[perm[i]] = perm[j]; + (*t).SetD(); + m.vn--; } + ++i; + deleted++;// per evitare che su risposta no rifaccia la domanda ad ogni vertice che incontra; } - ans.clear(); - return deleted; + else + { + j = i; + ++i; + } +} +ans.clear(); +return deleted; } - void main(int argc,char ** argv){ - - MyMesh m; - bool DEBUG = true; -int k; - k=3; + bool DEBUG=false; + int j; j=0; -cout<<"Punto 1"<Number of vertices: %d

\n", m.vn); fprintf(index,"

Number of faces: %d

\n", m.fn); printf("Mesh info:\n"); - printf(" M: '%s'\n\t Number of vertices: %d \n", argv[1], m.vn); + printf(" M: '%s'\n\t Number of vertices: %d \n", argv[1], m.vn); printf("\t Number of faces: %d \n", m.fn); -cout<<"Punto 6"<setValue(s); @@ -304,7 +280,7 @@ cout<<"Punto 6"<setValue(s); en->addValue(*vn); en->type = "Integer"; @@ -315,7 +291,6 @@ cout<<"Punto 6"<addNode(osn); /*--------------------------------------------*/ -cout<<"Punto 7"<setValue(s); en->addValue(*vn); en->type = "Float"; @@ -341,7 +316,7 @@ cout<<"Punto 7"<::FaceFace(m); // IS MANIFOLD @@ -349,14 +324,19 @@ cout<<"Punto 7"< he; vcg::face::Pos hei; - - for(fi=m.face.begin();fi!=m.face.end();++fi) + + for(fi=m.face.begin();fi!=m.face.end();fi++) + { + (*fi).ClearB(0); + (*fi).ClearB(1); + (*fi).ClearB(2); (*fi).ClearS(); + } int cf=0; bool Manifold=true; - - - + + + for(fi=m.face.begin();fi!=m.face.end();++fi) { for (j=0;j<3;j++) @@ -368,20 +348,19 @@ cout<<"Punto 7"<HasFFAdjacency())&&(fi!=m.face.begin())) - { - Manifold = false; - fi= m.face.end(); - --fi; - j=3; - } + } + if((BorderCount(*fi)>0)) + { + Manifold = false; + fi= m.face.end(); + --fi; } } - + if (!Manifold) { - fprintf(index, "

Manifold: NO

"); + fprintf(index, "

Manifold: NO

"); printf( "\t Manifold: NO\n"); /*------------XML file part ------------------*/ @@ -402,7 +381,7 @@ cout<<"Punto 7"< Manifold: YES

"); + fprintf(index, "

Manifold: YES

"); printf( "\t Manifold: YES\n "); /*------------XML file part ------------------*/ @@ -430,29 +409,29 @@ cout<<"Punto 7"<IsBorder(j)) //If this edge is a border edge - boundary_e++; // then increase the number of boundary edges - else if (IsManifold(*fi,j)) //If this edge is manifold + if (fi->IsBorder(j)) //If this edge is a border edge + boundary_e++; // then increase the number of boundary edges + else if (IsManifold(*fi,j))//If this edge is manifold { if((*fi).FFp(j)->IsS()) //If the face on the other side of the edge is already selected - count_e--; // we counted one edge twice + count_e--; // we counted one edge twice } - else //We have a non-manifold edge + else//We have a non-manifold edge { hei.Set(&(*fi), j , fi->V(j)); he=hei; he.NextF(); - while (he.f!=hei.f) // so we have to iterate all faces that are connected to this edge + while (he.f!=hei.f)// so we have to iterate all faces that are connected to this edge { - if (he.f->IsS()) // if one of the other faces was already visited than this edge was counted already. + if (he.f->IsS())// if one of the other faces was already visited than this edge was counted already. { counted=true; break; } - else + else { he.NextF(); } @@ -464,7 +443,7 @@ cout<<"Punto 7"<Number of edges: %d

\n", count_e); fprintf(index, "

Number of internal edges: %d

\n", count_e-boundary_e); fprintf(index, "

Number of boundary edges: %i

\n", boundary_e); @@ -477,7 +456,7 @@ cout<<"Punto 7"<setValue(s); en->addValue(*vn); en->type = "Integer"; @@ -504,7 +483,7 @@ cout<<"Punto 7"<setValue(s); en->addValue(*vn); en->type = "Integer"; @@ -540,7 +519,7 @@ cout<<"Punto 7"<setValue(s); en->addValue(*vn); en->type = "Integer"; @@ -548,15 +527,15 @@ cout<<"Punto 7"<setName("Number of unreferenced vertices"); osn->addEntry(*en); sn->addOwnSlot(osn); - ng->addNode(osn); + ng->addNode(osn); /*--------------------------------------------*/ - // HOLES COUNT + // HOLES COUNT int numholes=0; int numholev=0; - int BEdges=0; + int BEdges=0; vector > holes; //indices of vertices for(fi=m.face.begin();fi!=m.face.end();++fi) @@ -566,56 +545,56 @@ cout<<"Punto 7"<V(j)->IsS()) continue; - if((*fi).IsBorder(j)) //found an unvisited border edge + if((*fi).IsBorder(j))//found an unvisited border edge { - he.Set(&(*fi),j,fi->V(j)); //set the face-face iterator to the current face, edge and vertex - vector hole; //start of a new hole - hole.push_back(fi->P(j)); // including the first vertex + he.Set(&(*fi),j,fi->V(j)); //set the face-face iterator to the current face, edge and vertex + vector hole; //start of a new hole + hole.push_back(fi->P(j)); // including the first vertex numholev++; - he.v->SetS(); //set the current vertex as selected - he.NextB(); //go to the next boundary edge + he.v->SetS(); //set the current vertex as selected + he.NextB(); //go to the next boundary edge - while(fi->V(j) != he.v) //will we do not encounter the first boundary edge. + while(fi->V(j) != he.v)//will we do not encounter the first boundary edge. { - Point3x newpoint = he.v->P(); //select its vertex. - if(he.v->IsS()) //check if this vertex was selected already, because then we have an additional hole. + Point3x newpoint = he.v->P(); //select its vertex. + if(he.v->IsS())//check if this vertex was selected already, because then we have an additional hole. { //cut and paste the additional hole. - vector hole2; + vector hole2; int index = find(hole.begin(),hole.end(),newpoint) - hole.begin(); for(int i=index; iSetS(); //set the current vertex as selected - he.NextB(); //go to the next boundary edge + he.v->SetS(); //set the current vertex as selected + he.NextB(); //go to the next boundary edge } holes.push_back(hole); } } } numholes = holes.size(); - fprintf(index,"

Number of holes/boundaries: %d

\n", numholes); - printf("\t Number of holes/boundaries: %d \n", numholes); + fprintf(index,"

Number of holes/boundaries: %d

\n", numholes); + printf("\t Number of holes/boundaries: %d \n", numholes); /*------------XML file part ------------------*/ s = new(char[25]); vn = new ValueNode; en = new EntryNode; osn = new OwnSlotNode; - sprintf(s,"%d",numholes); + sprintf(s,"%d",numholes); vn->setValue(s); en->addValue(*vn); en->type = "Integer"; @@ -623,7 +602,7 @@ cout<<"Punto 7"<setName("Number of Holes"); osn->addEntry(*en); sn->addOwnSlot(osn); - ng->addNode(osn); + ng->addNode(osn); /*--------------------------------------------*/ @@ -643,14 +622,14 @@ cout<<"Punto 7"<setValue(s); en->addValue(*vn); en->type = "Integer"; osn->setName("Number of Border Edges"); osn->addEntry(*en); sn->addOwnSlot(osn); - ng->addNode(osn); + ng->addNode(osn); /*--------------------------------------------*/ } } @@ -671,7 +650,7 @@ cout<<"Punto 7"<setValue(s); en->addValue(*vn); en->type = "Float"; @@ -679,10 +658,10 @@ cout<<"Punto 7"<setName("Volume"); osn->addEntry(*en); sn->addOwnSlot(osn); - ng->addNode(osn); + ng->addNode(osn); /*--------------------------------------------*/ } - else + else { printf("\t Volume: UNDEFINED, mesh is either non-manifold or has holes \n"); fprintf(index,"Volume: UNDEFINED, mesh is either non-manifold or has holes \n"); @@ -692,18 +671,19 @@ cout<<"Punto 7"< nrfaces; + nrfaces.reserve(1); for(fi=m.face.begin();fi!=m.face.end();++fi) (*fi).ClearS(); gi=m.face.begin(); fi=gi; int Compindex=0; - stack sf; + stack sf; MyMesh::FaceType *l; for(fi=m.face.begin();fi!=m.face.end();++fi) { if (!(*fi).IsS()) { (*fi).SetS(); - (*fi).Q()=Compindex; + //(*fi).Q()=Compindex; nrfaces.push_back(1); sf.push(fi); while (!sf.empty()) @@ -728,15 +708,15 @@ cout<<"Punto 7"< Number of connected components: %d

", numcomponents); - printf("\t Number of connected components: %d\n", numcomponents); + fprintf(index, "

Number of connected components: %d

", numcomponents); + printf("\t Number of connected components: %d\n", numcomponents); /*------------XML file part ------------------*/ s = new(char[25]); vn = new ValueNode; en = new EntryNode; osn = new OwnSlotNode; - sprintf(s,"%d",numcomponents); + sprintf(s,"%d",numcomponents); vn->setValue(s); en->addValue(*vn); en->type = "Integer"; @@ -747,14 +727,14 @@ cout<<"Punto 7"<addNode(osn); /*--------------------------------------------*/ - //GENUS --> 2( #components - genus ) = #vertices + #faces - #edge - #boundary_loops = eulernumber - #holes + //GENUS --> 2( #components - genus ) = #vertices + #faces - #edge - #boundary_loops = eulernumber - #holes //eulero = (mesh.vn-count_uv) - (count_e)+mesh.fn; int eulernumber = (m.vn-count_uv) + m.fn - count_e; if(Manifold) { int genus = -( 0.5 * (eulernumber - numholes) - numcomponents ); - fprintf(index, "

Genus: %d

\n ", genus); + fprintf(index, "

Genus: %d

\n ", genus); printf( "\t Genus: %d \n", genus); /*------------XML file part ------------------*/ @@ -762,7 +742,7 @@ cout<<"Punto 7"<setValue(s); en->addValue(*vn); en->type = "Integer"; @@ -770,13 +750,13 @@ cout<<"Punto 7"<setName("Genus"); osn->addEntry(*en); sn->addOwnSlot(osn); - ng->addNode(osn); + ng->addNode(osn); /*--------------------------------------------*/ } - else //(!Manifold) + else//(!Manifold) { fprintf( index,"

Genus: UNDEFINED, mesh is non-manifold

\n"); - printf( "Genus: UNDEFINED, mesh is non-manifold \n"); + printf( "\t Genus: UNDEFINED, mesh is non-manifold \n"); } // REGULARITY @@ -824,15 +804,15 @@ cout<<"Punto 7"< Type of Mesh: REGULAR

"); - printf("\t Type of Mesh: REGULAR\n"); + fprintf(index, "

Type of Mesh: REGULAR

"); + printf("\t Type of Mesh: REGULAR\n"); /*------------XML file part ------------------*/ s = new(char[25]); vn = new ValueNode; en = new EntryNode; osn = new OwnSlotNode; - s="REGULAR"; + s="REGULAR"; vn->setValue(s); en->addValue(*vn); en->type = "String"; @@ -851,7 +831,7 @@ cout<<"Punto 7"<setValue(s); en->addValue(*vn); en->type = "String"; @@ -859,19 +839,19 @@ cout<<"Punto 7"<setName("Type of Mesh"); osn->addEntry(*en); sn->addOwnSlot(osn); - ng->addNode(osn); + ng->addNode(osn); } - else + else { - fprintf(index, "

Type of Mesh: IRREGULAR

"); - printf("\t Type of Mesh: IRREGULAR\n"); + fprintf(index, "

Type of Mesh: IRREGULAR

"); + printf("\t Type of Mesh: IRREGULAR\n"); /*------------XML file part ------------------*/ s = new(char[25]); vn = new ValueNode; en = new EntryNode; osn = new OwnSlotNode; - s="IRREGULAR"; + s="IRREGULAR"; vn->setValue(s); en->addValue(*vn); en->type = "String"; @@ -879,7 +859,7 @@ cout<<"Punto 7"<setName("Type of Mesh"); osn->addEntry(*en); sn->addOwnSlot(osn); - ng->addNode(osn); + ng->addNode(osn); /*--------------------------------------------*/ } // ORIENTABLE E ORIENTED MESH @@ -888,15 +868,15 @@ cout<<"Punto 7"< Orientable Mesh: NO

"); - printf( "\t Orientable Mesh: NO\n"); + fprintf(index, "

Orientable Mesh: NO

"); + printf( "\t Orientable Mesh: NO\n"); /*------------XML file part ------------------*/ s = new(char[25]); vn = new ValueNode; en = new EntryNode; osn = new OwnSlotNode; - s="NO"; + s="NO"; vn->setValue(s); en->addValue(*vn); en->type = "String"; @@ -904,7 +884,7 @@ cout<<"Punto 7"<setName("Orientable Mesh"); osn->addEntry(*en); sn->addOwnSlot(osn); - ng->addNode(osn); + ng->addNode(osn); /*--------------------------------------------*/ } else @@ -914,7 +894,7 @@ cout<<"Punto 7"<V(0)); l=he.f->FFp(j); - he.Set(&(*gi),j,gi->V(j)); + he.Set(&(*gi),j,gi->V(j)); hei.Set(he.f->FFp(j),he.f->FFi(j), (he.f->FFp(j))->V(he.f->FFi(j))); if( !(*gi).IsUserBit(0) ) { - if (he.v!=hei.v) // bene + if (he.v!=hei.v)// bene { if ((*l).IsS() && (*l).IsUserBit(0)) { @@ -948,7 +928,7 @@ cout<<"Punto 7"< Orientable Mesh: YES

"); + fprintf(index, "

Orientable Mesh: YES

"); printf( "\t Orientable Mesh: YES\n"); /*------------XML file part ------------------*/ @@ -1004,7 +984,7 @@ cout<<"Punto 7"<setValue(s); en->addValue(*vn); en->type = "String"; @@ -1012,12 +992,12 @@ cout<<"Punto 7"<setName("Orientable Mesh"); osn->addEntry(*en); sn->addOwnSlot(osn); - ng->addNode(osn); + ng->addNode(osn); /*--------------------------------------------*/ } else { - fprintf(index, "

Orientable Mesh: NO

"); + fprintf(index, "

Orientable Mesh: NO

"); printf( "\t Orientable Mesh: NO\n"); /*------------XML file part ------------------*/ @@ -1033,21 +1013,21 @@ cout<<"Punto 7"<setName("Orientable Mesh"); osn->addEntry(*en); sn->addOwnSlot(osn); - ng->addNode(osn); + ng->addNode(osn); /*--------------------------------------------*/ } } if (Oriented && Manifold) { - fprintf(index, "

Oriented Mesh: YES

"); - printf( "\t Oriented Mesh: YES\n"); + fprintf(index, "

Oriented Mesh: YES

"); + printf( "\t Oriented Mesh: YES\n"); /*------------XML file part ------------------*/ s = new(char[25]); vn = new ValueNode; en = new EntryNode; osn = new OwnSlotNode; - s="YES"; + s="YES"; vn->setValue(s); en->addValue(*vn); en->type = "String"; @@ -1055,20 +1035,20 @@ cout<<"Punto 7"<setName("Oriented Mesh"); osn->addEntry(*en); sn->addOwnSlot(osn); - ng->addNode(osn); + ng->addNode(osn); /*--------------------------------------------*/ } else { - fprintf(index, "

Oriented Mesh: NO

"); - printf( "\t Oriented Mesh: NO\n"); + fprintf(index, "

Oriented Mesh: NO

"); + printf( "\t Oriented Mesh: NO\n"); /*------------XML file part ------------------*/ s = new(char[25]); vn = new ValueNode; en = new EntryNode; osn = new OwnSlotNode; - s="NO"; + s="NO"; vn->setValue(s); en->addValue(*vn); en->type = "String"; @@ -1076,21 +1056,21 @@ cout<<"Punto 7"<setName("Oriented Mesh"); osn->addEntry(*en); sn->addOwnSlot(osn); - ng->addNode(osn); + ng->addNode(osn); /*--------------------------------------------*/ } int dv = DuplicateVertex(m); if(dv>0) { - fprintf(index, "

Duplicated vertices: %d

", dv); - printf( "\t Number of duplicated vertices found: %d\n",dv); + fprintf(index, "

Duplicated vertices: %d

", dv); + printf( "\t Number of duplicated vertices found: %d\n",dv); /*------------XML file part ------------------*/ s = new(char[25]); vn = new ValueNode; en = new EntryNode; osn = new OwnSlotNode; - sprintf(s,"%d",dv); + sprintf(s,"%d",dv); vn->setValue(s); en->addValue(*vn); en->type = "Int"; @@ -1098,12 +1078,12 @@ cout<<"Punto 7"<setName("Duplicated Vertices"); osn->addEntry(*en); sn->addOwnSlot(osn); - ng->addNode(osn); + ng->addNode(osn); /*--------------------------------------------*/ } else { - fprintf(index, "

Duplicated vertices: NO

"); + fprintf(index, "

Duplicated vertices: NO

"); printf( "\t Duplicated vertices: NO\n"); /*------------XML file part ------------------*/ @@ -1111,7 +1091,7 @@ cout<<"Punto 7"<setValue(s); en->addValue(*vn); en->type = "String"; @@ -1119,7 +1099,7 @@ cout<<"Punto 7"<setName("Duplicated Vertices"); osn->addEntry(*en); sn->addOwnSlot(osn); - ng->addNode(osn); + ng->addNode(osn); /*--------------------------------------------*/ } // SELF INTERSECTION @@ -1140,11 +1120,11 @@ cout<<"Punto 7"< Self Intersection: YES

"); + fprintf(index, "

Self Intersection: YES

"); printf( "\t Self Intersection: YES\n"); /*------------XML file part ------------------*/ @@ -1152,7 +1132,7 @@ cout<<"Punto 7"<setValue(s); en->addValue(*vn); en->type = "String"; @@ -1160,20 +1140,20 @@ cout<<"Punto 7"<setName("Self Intersection"); osn->addEntry(*en); sn->addOwnSlot(osn); - ng->addNode(osn); + ng->addNode(osn); /*--------------------------------------------*/ } else { - fprintf(index, "

Self Intersection: NO

"); - printf( "\t Self Intersection: NO\n"); + fprintf(index, "

Self Intersection: NO

"); + printf( "\t Self Intersection: NO\n"); /*------------XML file part ------------------*/ s = new(char[25]); vn = new ValueNode; en = new EntryNode; osn = new OwnSlotNode; - s="NO"; + s="NO"; vn->setValue(s); en->addValue(*vn); en->type = "String"; @@ -1181,7 +1161,7 @@ cout<<"Punto 7"<setName("Self Intersection"); osn->addEntry(*en); sn->addOwnSlot(osn); - ng->addNode(osn); + ng->addNode(osn); /*--------------------------------------------*/ } } @@ -1217,19 +1197,19 @@ cout<<"Punto 7"<>ans; if((ans=="Y")||(ans=="y")) { - /*------------XML file part ------------------*/ - doc.addSlots(sn); - OwnSlotsNode* ossn = new OwnSlotsNode; - ossn->addOwnSlot(ng); - ClassNode* cn = new ClassNode; - cn->addOwnSlots(ossn); - doc.addClasses(cn); + /*------------XML file part ------------------*/ + doc.addSlots(sn); + OwnSlotsNode* ossn = new OwnSlotsNode; + ossn->addOwnSlot(ng); + ClassNode* cn = new ClassNode; + cn->addOwnSlots(ossn); + doc.addClasses(cn); - InstanceNode* in = new InstanceNode; - in->addOwnSlots(ossn); - doc.addInstances(in); - doc.finalizeMain("/",XML_SCHEMA_NAME); - doc.printXMLTree(); + InstanceNode* in = new InstanceNode; + in->addOwnSlots(ossn); + doc.addInstances(in); + doc.finalizeMain("/",XML_SCHEMA_NAME); + doc.printXMLTree(); } /*--------------------------------------------*/ fclose(index);