brep_to_xml.cxx revision 43bf9eeafccc24eace346c76537edad9257bc0bf
#include "brep_to_xml.hxx"
#include <iostream>
#include <cstdlib>
#include <Standard_PrimitiveTypes.hxx>
#include <TopTools_LocationSet.hxx>
#include <BRep_Tool.hxx>
#include <sstream>
using namespace std;
/*******************************************************************************
*
*Constructor and destructor for BrepToXML class
*
******************************************************************************/
{
}
{
}
/*
*setter and getter for the contained shape
*/
{
return Sh;
}
{
//TODO Refresh the shapeset
}
/*******************************************************************************
*
* method to print the type of the contained shape
*
******************************************************************************/
{
switch (st)
{
case TopAbs_COMPOUND:
break;
case TopAbs_COMPSOLID:
break;
case TopAbs_SOLID:
break;
case TopAbs_SHELL:
break;
case TopAbs_FACE:
break;
case TopAbs_WIRE:
break;
case TopAbs_EDGE:
break;
case TopAbs_VERTEX:
break;
case TopAbs_SHAPE:
break;
}
}
/*******************************************************************************
*
* method to read from a .brp file given the filepath as a c_string
*
******************************************************************************/
{
//insert testing guards
if (!b)
{
}
return b;
}
/*******************************************************************************
*
* method to print the subshapes of the contained shape
*
******************************************************************************/
void BrepToXML::print_subshapes()
{
{
// cout << SS.Locations().Location(i+1) << endl;
}
}
/*******************************************************************************
*
*return a vector containing the subshapes only
*
* arg == 0 => the vector includes the container shape
* arg == 1 => it does not
* arg > 1 => lose data
******************************************************************************/
{
{
{
// temp.push_back(SS.Shape(i+1));
}
}
else
{
}
return temp;
}
/*******************************************************************************
*
* initializer for the graph matrix
*
******************************************************************************/
void BrepToXML::init_graph(void)
{
{
{
}
}
}
/*******************************************************************************
*
* method to build the dependency graph for the shapeset
*
******************************************************************************/
void BrepToXML::build_graph(void)
{
this->init_graph();
this->add_to_graph();
this->simplify_graph();
}
void BrepToXML::add_to_graph()
{
{
{
}
}
}
// graph[i][j] == 1 <=> Shape(i) contains Shape(j)
void BrepToXML::simplify_graph(void)
{
//neglect the fact that an object contains itself
{
graph[i][i] = 0;
}
{
//for every object higher in the hierarchy
{
if (graph[j][i]) //if i is contained by j
{
//for every k higher than j
{
//if j is contained by k and i is contained by k
{
graph[k][i] = 0;
//=> i is contained indirectly by k so we could delete this edge
}
}
}
}
}
}
void BrepToXML::print_graph(void)
{
{
{
}
}
}
{
{
switch (childType)
{
case TopAbs_COMPOUND:
break;
case TopAbs_COMPSOLID:
break;
case TopAbs_SOLID:
break;
case TopAbs_SHELL:
break;
case TopAbs_FACE:
break;
case TopAbs_WIRE:
break;
case TopAbs_SHAPE:
break;
case TopAbs_EDGE:
//TODO extract data describing the curve:
//
//Handle(Geom_Curve) aCurve3d =
//BRep_Tool::Curve (anEdge, aFirst, aLast)
break;
case TopAbs_VERTEX:
//vertLoc.X(), .Y() and .Z() -- absolute location values on x, y
// and z axis.
break;
}
}
}
{
if(what == "rectangle")
//we only need 4 points to define it
this->cacheProperties(Sh);
{
//if ( SS.NbShapes != 9 ) exit(1);
{
bool write = true;
for (int j = 0; j < (int) duplicates.size(); j++)
{
{
write = false;
break;
}
}
/*for (int j = 0; j < (int) duplicates.size(); j++)
{
cout << vLocs[j].second.X() << " "
<< vLocs[j].second.X() << " "
<< vLocs[j].second.X() << endl;
}
cout << endl;*/
if (write) {
}
}
}
}