bool LDLLineLine::parse(void) { float x1, y1, z1; float x2, y2, z2; int lineType; if (sscanf(m_line, "%d %i %f %f %f %f %f %f", &lineType, &m_colorNumber, &x1, &y1, &z1, &x2, &y2, &z2) == 8) { m_points = new TCVector[2]; m_points[0] = TCVector(x1, y1, z1); m_points[1] = TCVector(x2, y2, z2); if (!getMainModel()->getSkipValidation()) { getMatchingPoints(); } return true; } else { m_valid = false; setError(LDLEParse, TCLocalStrings::get(_UC("LDLLineParse"))); return false; } }
bool LDLQuadLine::parse(void) { float x1, y1, z1; float x2, y2, z2; float x3, y3, z3; float x4, y4, z4; int lineType; if (sscanf(m_line, "%d %i %f %f %f %f %f %f %f %f %f %f %f %f", &lineType, &m_colorNumber, &x1, &y1, &z1, &x2, &y2, &z2, &x3, &y3, &z3, &x4, &y4, &z4) == 14) { std::string prefix = getTypeAndColorPrefix(); std::stringstream ss; if (!prefix.empty()) { ss << prefix << " "; } else { ss << "4 " << m_colorNumber << " "; } ss << x1 << " " << y1 << " " << z1 << " "; ss << x2 << " " << y2 << " " << z2 << " "; ss << x3 << " " << y3 << " " << z3 << " "; ss << x4 << " " << y4 << " " << z4 << " "; m_formattedLine = copyString(ss.str().c_str()); m_points = new TCVector[4]; m_points[0] = TCVector(x1, y1, z1); m_points[1] = TCVector(x2, y2, z2); m_points[2] = TCVector(x3, y3, z3); m_points[3] = TCVector(x4, y4, z4); if (!getMainModel()->getSkipValidation()) { // Note that we don't care what the second matching index is, // because we only need to throw out one of the two points, so don't // bother to even read it. if (getMatchingPoints(&m_matchingIndex)) { m_valid = false; } else { swapPointsIfNeeded(); checkForColinearPoints(); } } return true; } else { m_valid = false; setError(LDLEParse, TCLocalStrings::get(_UC("LDLQuadLineParse"))); return false; } }
bool LDLQuadLine::parse(void) { float x1, y1, z1; float x2, y2, z2; float x3, y3, z3; float x4, y4, z4; int lineType; if (sscanf(m_line, "%d %i %f %f %f %f %f %f %f %f %f %f %f %f", &lineType, &m_colorNumber, &x1, &y1, &z1, &x2, &y2, &z2, &x3, &y3, &z3, &x4, &y4, &z4) == 14) { m_points = new TCVector[4]; m_points[0] = TCVector(x1, y1, z1); m_points[1] = TCVector(x2, y2, z2); m_points[2] = TCVector(x3, y3, z3); m_points[3] = TCVector(x4, y4, z4); if (!getMainModel()->getSkipValidation()) { // Note that we don't care what the second matching index is, // because we only need to throw out one of the two points, so don't // bother to even read it. if (getMatchingPoints(&m_matchingIndex)) { m_valid = false; } else { swapPointsIfNeeded(); checkForColinearPoints(); } } return true; } else { m_valid = false; setError(LDLEParse, TCLocalStrings::get(_UC("LDLQuadLineParse"))); return false; } }