22 QStringList{
"soi"},
"soi",
23 QStringList{
"Mensi Soisic cloud (*.soi)"}, QStringList(),
30 FILE* fp = fopen(qPrintable(
filename),
"rt");
35 unsigned nbScansTotal = 0;
36 unsigned nbPointsTotal = 0;
43 while ((strcmp((
char*)line.substr(0, 4).c_str(),
"#CC#") != 0) &&
45 if (strcmp(line.substr(0, 4).c_str(),
"#NP#") == 0) {
46 std::string numPoints(line, 4, line.size() - 4);
47 nbPointsTotal = strtol(numPoints.c_str(), &pEnd, 0);
50 }
else if (strcmp(line.substr(0, 4).c_str(),
"#NS#") == 0) {
51 std::string numScans(line, 4, line.size() - 4);
52 nbScansTotal = strtol(numScans.c_str(), &pEnd, 0);
60 if ((nbScansTotal == 0) || (nbPointsTotal == 0)) {
62 "[SoiFilter::loadFile] No points or scans defined in this "
69 QScopedPointer<ecvProgressDialog> pDlg(0);
73 pDlg->setMethodTitle(QObject::tr(
"Open SOI file"));
74 pDlg->setInfo(QObject::tr(
"%1 scans / %2 points")
82 for (
unsigned k = 0; k < nbScansTotal; k++) {
86 while ((strcmp(line.substr(0, 4).c_str(),
"#pt#") != 0) &&
90 unsigned nbOfPoints = 0;
92 if (strcmp(line.substr(0, 4).c_str(),
"#pt#") == 0) {
93 std::string numPoints(line, 4, line.size() - 4);
94 nbOfPoints = strtol(numPoints.c_str(), &pEnd, 0);
103 if (nbOfPoints == 0) {
109 QString
name = QString(
"unnamed - Scan #%1").arg(k);
121 for (
unsigned i = 0; i < nbOfPoints; i++) {
124 if (fscanf(fp,
"%f %f %f %i", P, P + 1, P + 2, &c) < 4) {
CC_FILE_ERROR
Typical I/O filter errors.
@ CC_FERR_NOT_ENOUGH_MEMORY
@ CC_FERR_WRONG_FILE_TYPE
const int MAX_ASCII_FILE_LINE_LENGTH
static bool Warning(const char *format,...)
Prints out a formatted warning message in console.
static constexpr float DEFAULT_PRIORITY
virtual CC_FILE_ERROR loadFile(const QString &filename, ccHObject &container, LoadParameters ¶meters) override
Loads one or more entities from a file.
static Vector3Tpl fromArray(const int a[3])
Constructor from an int array.
virtual void showColors(bool state)
Sets colors visibility.
Hierarchical CLOUDVIEWER Object.
virtual bool addChild(ccHObject *child, int dependencyFlags=DP_PARENT_OF_OTHER, int insertIndex=-1)
Adds a child.
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
void addGreyColor(ColorCompType g)
Pushes a grey color on stack (shortcut)
bool reserveTheRGBTable()
Reserves memory to store the RGB colors.
bool reserveThePointsTable(unsigned _numberOfPoints)
Reserves memory to store the points coordinates.
bool oneStep()
Increments total progress value of a single unit.
void addPoint(const CCVector3 &P)
Adds a 3D point to the database.
Graphical progress indicator (thread-safe)
unsigned char ColorCompType
Default color components type (R,G and B)
Generic loading parameters.
QWidget * parentWidget
Parent widget (if any)