AttributeStringPtr aFormatAttr =
this->string(ExchangePlugin_ExportFeature::FILE_FORMAT_ID());
std::string aFormat = aFormatAttr->value();
- std::cout<<"FORMAT"<<std::endl;
- std::cout<<aFormat<<std::endl;
AttributeStringPtr aFilePathAttr =
this->string(ExchangePlugin_ExportFeature::FILE_PATH_ID());
std::string aFilePath = aFilePathAttr->value();
- std::cout<<"FILE"<<std::endl;
- std::cout<<aFilePath<<std::endl;
if (aFilePath.empty())
return;
}
}
- std::cout<<"PASSAGE1"<<std::endl;
- std::cout<<aFormatName<<std::endl;
-
if (aFormatName == "XAO") {
exportXAO(theFileName);
return;
}
-
if (aFormatName == "ROOT") {
exportROOT(theFileName);
return;
void ExchangePlugin_ExportFeature::exportROOT(const std::string& theFileName)
{
- std::cout<<"EXPORT ROOT ==> debut"<<std::endl;
std::string aName = string(ExchangePlugin_ExportFeature::ROOT_MANAGER_NAME_ID())->value();
std::string aTitle = string(ExchangePlugin_ExportFeature::ROOT_MANAGER_TITLE_ID())->value();
std::string aFileMat = string(ExchangePlugin_ExportFeature::MAT_FILE_ID())->value();
std::map<std::string, std::vector<std::string> > aMat;
std::map<std::string, std::vector<std::string> > aMedium;
ExchangePlugin_ExportRoot::readFileMat(aFileMat, aMat, aMedium);
- std::cout<<"Size "<<aMat.size()<<std::endl;
- std::cout<<"Size "<<aMedium.size()<<std::endl;
anAlgo->buildMatAndMedium(aMat, aMedium);
}
}
- std::cout<<"Nb of elements :: " << aListNamesOfFeatures.size() << std::endl;
-
// Add all groups in the file
itExport = theExport.begin();
for (; itExport != theExport.end(); ++itExport)
#include <ExchangePlugin_ExportRoot.h>
+#include <GeomAlgoAPI_PointBuilder.h>
+
#include <ModelAPI_AttributeDouble.h>
#include <ModelAPI_AttributeSelectionList.h>
#include <ModelAPI_AttributeString.h>
#include <fstream>
#include <iostream>
+#include "math.h"
+
void ExchangePlugin_ExportRoot::readFileMat(const std::string theFileMat,
std::map<std::string, std::vector<std::string> >& aMat,
std::map<std::string, std::vector<std::string> >& aMedias)
aData.push_back(anElem);
}
}
- std::cout<<"aType :: "<<aName<<std::endl;
- std::cout<<"aName :: "<<aData[0]<<std::endl;
+ //std::cout<<"aType :: "<<aName<<std::endl;
+ //std::cout<<"aName :: "<<aData[0]<<std::endl;
if (aName == "mat") {
aMat[aData[0]] = aData;
} else if (aName == "medium") {
aFile.close();
}
- std::cout<<"Size of aMat :: "<<aMat.size()<<std::endl;
- std::cout<<"Size of aMedias :: "<<aMedias.size()<<std::endl;
+ //std::cout<<"Size of aMat :: "<<aMat.size()<<std::endl;
+ //std::cout<<"Size of aMedias :: "<<aMedias.size()<<std::endl;
}
void ExchangePlugin_ExportRoot::computeBox(FeaturePtr theCurFeature,
OY = DY;
OZ = DZ;
} else if (aMethodName == "BoxByTwoPoints") {
- // A completer
+ AttributeSelectionPtr aRef1 = theCurFeature->data()->selection(PrimitivesPlugin_Box::POINT_FIRST_ID());
+ AttributeSelectionPtr aRef2 = theCurFeature->data()->selection(PrimitivesPlugin_Box::POINT_SECOND_ID());
+ GeomShapePtr aShape1 = aRef1->value();
+ if (!aShape1.get())
+ aShape1 = aRef1->context()->shape();
+ GeomShapePtr aShape2 = aRef2->value();
+ if (!aShape2.get())
+ aShape2 = aRef2->context()->shape();
+ std::shared_ptr<GeomAPI_Pnt> aFirstPoint = GeomAlgoAPI_PointBuilder::point(aShape1);
+ std::shared_ptr<GeomAPI_Pnt> aSecondPoint = GeomAlgoAPI_PointBuilder::point(aShape2);
+ double x1 = aFirstPoint->x();
+ double y1 = aFirstPoint->y();
+ double z1 = aFirstPoint->z();
+ double x2 = aSecondPoint->x();
+ double y2 = aSecondPoint->y();
+ double z2 = aSecondPoint->z();
+ DX = fabs(x2 -x1)/2;
+ DY = fabs(y2 -y1)/2;
+ DZ = fabs(z2 -z1)/2;
+ OX = fmin(x1,x2)+DX;
+ OY = fmin(y1,y2)+DY;
+ OZ = fmin(z1,z2)+DZ;
} else if (aMethodName == "BoxByOnePointAndDims") {
DX = theCurFeature->data()->real(PrimitivesPlugin_Box::HALF_DX_ID())->value();
DY = theCurFeature->data()->real(PrimitivesPlugin_Box::HALF_DY_ID())->value();
void ExchangePlugin_ExportRoot::computeGroup(FeaturePtr theCurFeature,
std::vector<std::string>& theListNames)
{
- std::cout<<"COMPUTE GROUP"<<std::endl;
+ //std::cout<<"COMPUTE GROUP"<<std::endl;
AttributeSelectionListPtr anObjectsSelList =
theCurFeature->data()->selectionList(CollectionPlugin_Group::LIST_ID());
anObjectsSelList->value(anObjectsIndex);
ObjectPtr anObject = anObjectAttr->contextObject();
std::string aName = anObject->data()->name();
- std::cout<<"NAME :: "<<aName<<std::endl;
+ //std::cout<<"NAME :: "<<aName<<std::endl;
theListNames.push_back(aName);
}
}