本文整理汇总了C++中dxf::LineReader::ValueAsUnsignedInt方法的典型用法代码示例。如果您正苦于以下问题:C++ LineReader::ValueAsUnsignedInt方法的具体用法?C++ LineReader::ValueAsUnsignedInt怎么用?C++ LineReader::ValueAsUnsignedInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dxf::LineReader
的用法示例。
在下文中一共展示了LineReader::ValueAsUnsignedInt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
// ------------------------------------------------------------------------------------------------
void DXFImporter::Parse3DFace(DXF::LineReader& reader, DXF::FileData& output)
{
// (note) this is also used for for parsing line entities, so we
// must handle the vertex_count == 2 case as well.
output.blocks.back().lines.push_back( std::shared_ptr<DXF::PolyLine>( new DXF::PolyLine() ) );
DXF::PolyLine& line = *output.blocks.back().lines.back();
aiVector3D vip[4];
aiColor4D clr = AI_DXF_DEFAULT_COLOR;
bool b[4] = {false,false,false,false};
while( !reader.End() ) {
// next entity with a groupcode == 0 is probably already the next vertex or polymesh entity
if (reader.GroupCode() == 0) {
break;
}
switch (reader.GroupCode())
{
// 8 specifies the layer
case 8:
line.layer = reader.Value();
break;
// x position of the first corner
case 10: vip[0].x = reader.ValueAsFloat();
b[2] = true;
break;
// y position of the first corner
case 20: vip[0].y = reader.ValueAsFloat();
b[2] = true;
break;
// z position of the first corner
case 30: vip[0].z = reader.ValueAsFloat();
b[2] = true;
break;
// x position of the second corner
case 11: vip[1].x = reader.ValueAsFloat();
b[3] = true;
break;
// y position of the second corner
case 21: vip[1].y = reader.ValueAsFloat();
b[3] = true;
break;
// z position of the second corner
case 31: vip[1].z = reader.ValueAsFloat();
b[3] = true;
break;
// x position of the third corner
case 12: vip[2].x = reader.ValueAsFloat();
b[0] = true;
break;
// y position of the third corner
case 22: vip[2].y = reader.ValueAsFloat();
b[0] = true;
break;
// z position of the third corner
case 32: vip[2].z = reader.ValueAsFloat();
b[0] = true;
break;
// x position of the fourth corner
case 13: vip[3].x = reader.ValueAsFloat();
b[1] = true;
break;
// y position of the fourth corner
case 23: vip[3].y = reader.ValueAsFloat();
b[1] = true;
break;
// z position of the fourth corner
case 33: vip[3].z = reader.ValueAsFloat();
b[1] = true;
break;
// color
case 62:
clr = g_aclrDxfIndexColors[reader.ValueAsUnsignedInt() % AI_DXF_NUM_INDEX_COLORS];
break;
};
++reader;
}
// the fourth corner may even be identical to the third,
// in this case we treat it as if it didn't exist.
if (vip[3] == vip[2]) {
b[1] = false;
//.........这里部分代码省略.........
示例2: ParsePolyLineVertex
// ------------------------------------------------------------------------------------------------
void DXFImporter::ParsePolyLineVertex(DXF::LineReader& reader, DXF::PolyLine& line)
{
unsigned int cnti = 0, flags = 0;
unsigned int indices[4];
aiVector3D out;
aiColor4D clr = AI_DXF_DEFAULT_COLOR;
while( !reader.End() ) {
if (reader.Is(0)) { // SEQEND or another VERTEX
break;
}
switch (reader.GroupCode())
{
case 8:
// layer to which the vertex belongs to - assume that
// this is always the layer the top-level polyline
// entity resides on as well.
if(reader.Value() != line.layer) {
DefaultLogger::get()->warn("DXF: expected vertex to be part of a polyface but the 0x128 flag isn't set");
}
break;
case 70:
flags = reader.ValueAsUnsignedInt();
break;
// VERTEX COORDINATES
case 10: out.x = reader.ValueAsFloat();break;
case 20: out.y = reader.ValueAsFloat();break;
case 30: out.z = reader.ValueAsFloat();break;
// POLYFACE vertex indices
case 71:
case 72:
case 73:
case 74:
if (cnti == 4) {
DefaultLogger::get()->warn("DXF: more than 4 indices per face not supported; ignoring");
break;
}
indices[cnti++] = reader.ValueAsUnsignedInt();
break;
// color
case 62:
clr = g_aclrDxfIndexColors[reader.ValueAsUnsignedInt() % AI_DXF_NUM_INDEX_COLORS];
break;
};
reader++;
}
if (line.flags & DXF_POLYLINE_FLAG_POLYFACEMESH && !(flags & DXF_VERTEX_FLAG_PART_OF_POLYFACE)) {
DefaultLogger::get()->warn("DXF: expected vertex to be part of a polyface but the 0x128 flag isn't set");
}
if (cnti) {
line.counts.push_back(cnti);
for (unsigned int i = 0; i < cnti; ++i) {
// IMPORTANT NOTE: POLYMESH indices are ONE-BASED
if (indices[i] == 0) {
DefaultLogger::get()->warn("DXF: invalid vertex index, indices are one-based.");
--line.counts.back();
continue;
}
line.indices.push_back(indices[i]-1);
}
}
else {
line.positions.push_back(out);
line.colors.push_back(clr);
}
}