本文整理汇总了C++中DL_Dxf::writeLineType方法的典型用法代码示例。如果您正苦于以下问题:C++ DL_Dxf::writeLineType方法的具体用法?C++ DL_Dxf::writeLineType怎么用?C++ DL_Dxf::writeLineType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DL_Dxf
的用法示例。
在下文中一共展示了DL_Dxf::writeLineType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveVerticalProfiles
bool DxfProfilesExporter::SaveVerticalProfiles( const QSharedPointer<DistanceMapGenerationTool::Map>& map,
ccPolyline* profile,
QString filename,
unsigned angularStepCount,
double heightStep,
const Parameters& params,
ccMainAppInterface* app/*=0*/)
{
#ifdef CC_DXF_SUPPORT
assert(c_pageMargin_mm < c_profileMargin_mm);
assert(2.0*c_profileMargin_mm < std::min(c_pageWidth_mm,c_pageHeight_mm));
if (!map || !profile || angularStepCount == 0 || heightStep <= 0)
{
//invalid parameters
return false;
}
//Theoretical profile bounding box
PointCoordinateType profileBBMin[3],profileBBMax[3];
profile->getAssociatedCloud()->getBoundingBox(profileBBMin,profileBBMax);
//Mix with the map's boundaries along 'Y'
double yMin = std::max(map->yMin,static_cast<double>(profileBBMin[1]));
double yMax = std::min(map->yMin + static_cast<double>(map->ySteps) * map->yStep, static_cast<double>(profileBBMax[1]));
const double ySpan = yMax - yMin;
//For the 'X' dimension, it's easier to stick with the th. profile
const double xMin = profileBBMin[0];
// const double xMax = profileBBMax[0];
const double xSpan = profileBBMax[0] - profileBBMin[0];
if (xSpan == 0.0 || ySpan == 0.0)
{
if (app)
app->dispToConsole(QString("Internal error: null profile?!"),ccMainAppInterface::ERR_CONSOLE_MESSAGE);
return false;
}
DL_Dxf dxf;
DL_WriterA* dw = dxf.out(qPrintable(filename), DL_VERSION_R12);
if (!dw)
{
if (app)
app->dispToConsole(QString("Failed to open '%1' file for writing!").arg(filename),ccMainAppInterface::ERR_CONSOLE_MESSAGE);
return false;
}
//write header
dxf.writeHeader(*dw);
//add dimensions
dw->dxfString(9, "$INSBASE");
dw->dxfReal(10,0.0);
dw->dxfReal(20,0.0);
dw->dxfReal(30,0.0);
dw->dxfString(9, "$EXTMIN");
dw->dxfReal(10,0.0);
dw->dxfReal(20,0.0);
dw->dxfReal(30,0.0);
dw->dxfString(9, "$EXTMAX");
dw->dxfReal(10,c_pageWidth_mm);
dw->dxfReal(20,c_pageHeight_mm);
dw->dxfReal(30,0.0);
dw->dxfString(9, "$LIMMIN");
dw->dxfReal(10,0.0);
dw->dxfReal(20,0.0);
dw->dxfString(9, "$LIMMAX");
dw->dxfReal(10,c_pageWidth_mm);
dw->dxfReal(20,c_pageHeight_mm);
//close header
dw->sectionEnd();
//Opening the Tables Section
dw->sectionTables();
//Writing the Viewports
dxf.writeVPort(*dw);
//Writing the Linetypes (all by default)
{
dw->tableLineTypes(25);
dxf.writeLineType(*dw, DL_LineTypeData("BYBLOCK", 0));
dxf.writeLineType(*dw, DL_LineTypeData("BYLAYER", 0));
dxf.writeLineType(*dw, DL_LineTypeData("CONTINUOUS", 0));
dxf.writeLineType(*dw, DL_LineTypeData("ACAD_ISO02W100", 0));
dxf.writeLineType(*dw, DL_LineTypeData("ACAD_ISO03W100", 0));
dxf.writeLineType(*dw, DL_LineTypeData("ACAD_ISO04W100", 0));
dxf.writeLineType(*dw, DL_LineTypeData("ACAD_ISO05W100", 0));
dxf.writeLineType(*dw, DL_LineTypeData("BORDER", 0));
dxf.writeLineType(*dw, DL_LineTypeData("BORDER2", 0));
dxf.writeLineType(*dw, DL_LineTypeData("BORDERX2", 0));
dxf.writeLineType(*dw, DL_LineTypeData("CENTER", 0));
dxf.writeLineType(*dw, DL_LineTypeData("CENTER2", 0));
dxf.writeLineType(*dw, DL_LineTypeData("CENTERX2", 0));
dxf.writeLineType(*dw, DL_LineTypeData("DASHDOT", 0));
dxf.writeLineType(*dw, DL_LineTypeData("DASHDOT2", 0));
dxf.writeLineType(*dw, DL_LineTypeData("DASHDOTX2", 0));
dxf.writeLineType(*dw, DL_LineTypeData("DASHED", 0));
dxf.writeLineType(*dw, DL_LineTypeData("DASHED2", 0));
dxf.writeLineType(*dw, DL_LineTypeData("DASHEDX2", 0));
dxf.writeLineType(*dw, DL_LineTypeData("DIVIDE", 0));
//.........这里部分代码省略.........
示例2: saveToFile
CC_FILE_ERROR DxfFilter::saveToFile(ccHObject* root, const char* filename)
{
#ifndef CC_DXF_SUPPORT
ccLog::Error("[DXF] DXF format not supported! Check compilation parameters!");
return CC_FERR_CONSOLE_ERROR;
#else
if (!root || !filename)
return CC_FERR_BAD_ARGUMENT;
ccHObject::Container polylines;
root->filterChildren(polylines,true,CC_POLY_LINE);
//only polylines are handled for now
size_t polyCount = polylines.size();
if (!polyCount)
return CC_FERR_NO_SAVE;
//get global bounding box
ccBBox box;
for (size_t i=0; i<polyCount; ++i)
{
ccBBox polyBox = polylines[i]->getBB();
if (i)
{
box += polyBox;
}
else
{
box = polyBox;
}
}
CCVector3 diag = box.getDiagVec();
double baseSize = static_cast<double>(std::max(diag.x,diag.y));
double lineWidth = baseSize / 40.0;
double pageMargin = baseSize / 20.0;
DL_Dxf dxf;
DL_WriterA* dw = dxf.out(qPrintable(filename), DL_VERSION_R12);
if (!dw)
{
return CC_FERR_WRITING;
}
//write header
dxf.writeHeader(*dw);
//add dimensions
dw->dxfString(9, "$INSBASE");
dw->dxfReal(10,0.0);
dw->dxfReal(20,0.0);
dw->dxfReal(30,0.0);
dw->dxfString(9, "$EXTMIN");
dw->dxfReal(10,static_cast<double>(box.minCorner().x)-pageMargin);
dw->dxfReal(20,static_cast<double>(box.minCorner().y)-pageMargin);
dw->dxfReal(30,static_cast<double>(box.minCorner().z)-pageMargin);
dw->dxfString(9, "$EXTMAX");
dw->dxfReal(10,static_cast<double>(box.maxCorner().x)+pageMargin);
dw->dxfReal(20,static_cast<double>(box.maxCorner().y)+pageMargin);
dw->dxfReal(30,static_cast<double>(box.maxCorner().z)+pageMargin);
dw->dxfString(9, "$LIMMIN");
dw->dxfReal(10,static_cast<double>(box.minCorner().x)-pageMargin);
dw->dxfReal(20,static_cast<double>(box.minCorner().y)-pageMargin);
dw->dxfString(9, "$LIMMAX");
dw->dxfReal(10,static_cast<double>(box.maxCorner().x)+pageMargin);
dw->dxfReal(20,static_cast<double>(box.maxCorner().y)+pageMargin);
//close header
dw->sectionEnd();
//Opening the Tables Section
dw->sectionTables();
//Writing the Viewports
dxf.writeVPort(*dw);
//Writing the Linetypes (all by default)
{
dw->tableLineTypes(25);
dxf.writeLineType(*dw, DL_LineTypeData("BYBLOCK", 0));
dxf.writeLineType(*dw, DL_LineTypeData("BYLAYER", 0));
dxf.writeLineType(*dw, DL_LineTypeData("CONTINUOUS", 0));
dxf.writeLineType(*dw, DL_LineTypeData("ACAD_ISO02W100", 0));
dxf.writeLineType(*dw, DL_LineTypeData("ACAD_ISO03W100", 0));
dxf.writeLineType(*dw, DL_LineTypeData("ACAD_ISO04W100", 0));
dxf.writeLineType(*dw, DL_LineTypeData("ACAD_ISO05W100", 0));
dxf.writeLineType(*dw, DL_LineTypeData("BORDER", 0));
dxf.writeLineType(*dw, DL_LineTypeData("BORDER2", 0));
dxf.writeLineType(*dw, DL_LineTypeData("BORDERX2", 0));
dxf.writeLineType(*dw, DL_LineTypeData("CENTER", 0));
dxf.writeLineType(*dw, DL_LineTypeData("CENTER2", 0));
dxf.writeLineType(*dw, DL_LineTypeData("CENTERX2", 0));
dxf.writeLineType(*dw, DL_LineTypeData("DASHDOT", 0));
dxf.writeLineType(*dw, DL_LineTypeData("DASHDOT2", 0));
dxf.writeLineType(*dw, DL_LineTypeData("DASHDOTX2", 0));
dxf.writeLineType(*dw, DL_LineTypeData("DASHED", 0));
dxf.writeLineType(*dw, DL_LineTypeData("DASHED2", 0));
dxf.writeLineType(*dw, DL_LineTypeData("DASHEDX2", 0));
//.........这里部分代码省略.........
示例3: SaveHorizontalProfiles
bool DxfProfilesExporter::SaveHorizontalProfiles( const QSharedPointer<DistanceMapGenerationTool::Map>& map,
ccPolyline* profile,
QString filename,
unsigned heightStepCount,
double angularStep_rad,
double radToUnitConvFactor,
QString angleUnit,
const Parameters& params,
ccMainAppInterface* app/*= 0*/)
{
#ifdef CC_DXF_SUPPORT
assert(c_pageMargin_mm < c_profileMargin_mm);
assert(2.0*c_profileMargin_mm < std::min(c_pageWidth_mm,c_pageHeight_mm));
if (!map || !profile || heightStepCount == 0 || angularStep_rad <= 0)
{
//invalid parameters
return false;
}
//Theoretical profile bounding box
PointCoordinateType profileBBMin[3],profileBBMax[3];
profile->getAssociatedCloud()->getBoundingBox(profileBBMin,profileBBMax);
//Mix with the map's boundaries along 'Y'
double yMin = std::max( map->yMin + 0.5 * map->xStep, //central height of first row
static_cast<double>(profileBBMin[1]));
double yMax = std::min( map->yMin + (static_cast<double>(map->ySteps)-0.5) * map->yStep, //central height of last row
static_cast<double>(profileBBMax[1]));
const double ySpan = yMax - yMin;
//For the 'X' dimension, it's easier to stick with the th. profile
// const double xMin = profileBBMin[0];
const double xMax = profileBBMax[0];
const double xSpan = profileBBMax[0] - profileBBMin[0];
//shortcut for clarity
const double& maxRadius = xMax;
if (xSpan == 0.0 || ySpan == 0.0)
{
if (app)
app->dispToConsole(QString("Internal error: null profile?!"),ccMainAppInterface::ERR_CONSOLE_MESSAGE);
return false;
}
DL_Dxf dxf;
DL_WriterA* dw = dxf.out(qPrintable(filename), DL_VERSION_R12);
if (!dw)
{
if (app)
app->dispToConsole(QString("Failed to open '%1' file for writing!").arg(filename),ccMainAppInterface::ERR_CONSOLE_MESSAGE);
return false;
}
//write header
dxf.writeHeader(*dw);
//add dimensions
dw->dxfString(9, "$INSBASE");
dw->dxfReal(10,0.0);
dw->dxfReal(20,0.0);
dw->dxfReal(30,0.0);
dw->dxfString(9, "$EXTMIN");
dw->dxfReal(10,0.0);
dw->dxfReal(20,0.0);
dw->dxfReal(30,0.0);
dw->dxfString(9, "$EXTMAX");
dw->dxfReal(10,c_pageWidth_mm);
dw->dxfReal(20,c_pageHeight_mm);
dw->dxfReal(30,0.0);
dw->dxfString(9, "$LIMMIN");
dw->dxfReal(10,0.0);
dw->dxfReal(20,0.0);
dw->dxfString(9, "$LIMMAX");
dw->dxfReal(10,c_pageWidth_mm);
dw->dxfReal(20,c_pageHeight_mm);
//close header
dw->sectionEnd();
//Opening the Tables Section
dw->sectionTables();
//Writing the Viewports
dxf.writeVPort(*dw);
//Writing the Linetypes (all by default)
{
dw->tableLineTypes(25);
dxf.writeLineType(*dw, DL_LineTypeData("BYBLOCK", 0));
dxf.writeLineType(*dw, DL_LineTypeData("BYLAYER", 0));
dxf.writeLineType(*dw, DL_LineTypeData("CONTINUOUS", 0));
dxf.writeLineType(*dw, DL_LineTypeData("ACAD_ISO02W100", 0));
dxf.writeLineType(*dw, DL_LineTypeData("ACAD_ISO03W100", 0));
dxf.writeLineType(*dw, DL_LineTypeData("ACAD_ISO04W100", 0));
dxf.writeLineType(*dw, DL_LineTypeData("ACAD_ISO05W100", 0));
dxf.writeLineType(*dw, DL_LineTypeData("BORDER", 0));
dxf.writeLineType(*dw, DL_LineTypeData("BORDER2", 0));
dxf.writeLineType(*dw, DL_LineTypeData("BORDERX2", 0));
dxf.writeLineType(*dw, DL_LineTypeData("CENTER", 0));
dxf.writeLineType(*dw, DL_LineTypeData("CENTER2", 0));
dxf.writeLineType(*dw, DL_LineTypeData("CENTERX2", 0));
//.........这里部分代码省略.........
示例4: writeLineTypes
void writeLineTypes(DL_Dxf &output, DL_WriterA *writer)
{
writer->tableLineTypes(25);
output.writeLineType(*writer, DL_LineTypeData("BYBLOCK", 0));
output.writeLineType(*writer, DL_LineTypeData("BYLAYER", 0));
output.writeLineType(*writer, DL_LineTypeData("CONTINUOUS", 0));
output.writeLineType(*writer, DL_LineTypeData("ACAD_ISO02W100", 0));
output.writeLineType(*writer, DL_LineTypeData("ACAD_ISO03W100", 0));
output.writeLineType(*writer, DL_LineTypeData("ACAD_ISO04W100", 0));
output.writeLineType(*writer, DL_LineTypeData("ACAD_ISO05W100", 0));
output.writeLineType(*writer, DL_LineTypeData("BORDER", 0));
output.writeLineType(*writer, DL_LineTypeData("BORDER2", 0));
output.writeLineType(*writer, DL_LineTypeData("BORDERX2", 0));
output.writeLineType(*writer, DL_LineTypeData("CENTER", 0));
output.writeLineType(*writer, DL_LineTypeData("CENTER2", 0));
output.writeLineType(*writer, DL_LineTypeData("CENTERX2", 0));
output.writeLineType(*writer, DL_LineTypeData("DASHDOT", 0));
output.writeLineType(*writer, DL_LineTypeData("DASHDOT2", 0));
output.writeLineType(*writer, DL_LineTypeData("DASHDOTX2", 0));
output.writeLineType(*writer, DL_LineTypeData("DASHED", 0));
output.writeLineType(*writer, DL_LineTypeData("DASHED2", 0));
output.writeLineType(*writer, DL_LineTypeData("DASHEDX2", 0));
output.writeLineType(*writer, DL_LineTypeData("DIVIDE", 0));
output.writeLineType(*writer, DL_LineTypeData("DIVIDE2", 0));
output.writeLineType(*writer, DL_LineTypeData("DIVIDEX2", 0));
output.writeLineType(*writer, DL_LineTypeData("DOT", 0));
output.writeLineType(*writer, DL_LineTypeData("DOT2", 0));
output.writeLineType(*writer, DL_LineTypeData("DOTX2", 0));
writer->tableEnd();
}