本文整理汇总了C++中DL_Dxf::writeLine方法的典型用法代码示例。如果您正苦于以下问题:C++ DL_Dxf::writeLine方法的具体用法?C++ DL_Dxf::writeLine怎么用?C++ DL_Dxf::writeLine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DL_Dxf
的用法示例。
在下文中一共展示了DL_Dxf::writeLine方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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));
//.........这里部分代码省略.........
示例2: 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));
//.........这里部分代码省略.........
示例3: main
int main() {
DL_Dxf dxf;
DL_WriterA* dw = dxf.out("dimension.dxf", DL_Codes::AC1015);
// section header:
dxf.writeHeader(*dw);
dw->sectionEnd();
// section tables:
dw->sectionTables();
// VPORT:
dxf.writeVPort(*dw);
// LTYPE:
dw->tableLinetypes(1);
dxf.writeLinetype(*dw, DL_LinetypeData("CONTINUOUS", "Continuous", 0, 0, 0.0));
dxf.writeLinetype(*dw, DL_LinetypeData("BYLAYER", "", 0, 0, 0.0));
dxf.writeLinetype(*dw, DL_LinetypeData("BYBLOCK", "", 0, 0, 0.0));
dw->tableEnd();
// LAYER:
dw->tableLayers(1);
dxf.writeLayer(
*dw,
DL_LayerData("0", 0),
DL_Attributes("", 1, 0x00ff0000, 15, "CONTINUOUS")
);
dw->tableEnd();
// STYLE:
dw->tableStyle(1);
DL_StyleData style("Standard", 0, 0.0, 1.0, 0.0, 0, 2.5, "txt", "");
style.bold = false;
style.italic = false;
dxf.writeStyle(*dw, style);
dw->tableEnd();
// VIEW:
dxf.writeView(*dw);
// UCS:
dxf.writeUcs(*dw);
// APPID:
dw->tableAppid(1);
dxf.writeAppid(*dw, "ACAD");
dw->tableEnd();
// DIMSTYLE:
dxf.writeDimStyle(*dw, 2.5, 0.625, 0.625, 0.625, 2.5);
// BLOCK_RECORD:
dxf.writeBlockRecord(*dw);
dw->tableEnd();
dw->sectionEnd();
// BLOCK:
dw->sectionBlocks();
dxf.writeBlock(*dw, DL_BlockData("*Model_Space", 0, 0.0, 0.0, 0.0));
dxf.writeEndBlock(*dw, "*Model_Space");
dxf.writeBlock(*dw, DL_BlockData("*Paper_Space", 0, 0.0, 0.0, 0.0));
dxf.writeEndBlock(*dw, "*Paper_Space");
dxf.writeBlock(*dw, DL_BlockData("*Paper_Space0", 0, 0.0, 0.0, 0.0));
dxf.writeEndBlock(*dw, "*Paper_Space0");
dw->sectionEnd();
// ENTITIES:
dw->sectionEntities();
DL_Attributes attributes("0", 256, -1, -1, "BYLAYER");
// LINE:
DL_LineData lineData(10, 5, 0, 30, 5, 0);
dxf.writeLine(*dw, lineData, attributes);
// DIMENSION:
DL_DimensionData dimData(10.0, // def point (dimension line pos)
50.0,
0.0,
0, // text pos (irrelevant if flag 0x80 (128) set for type
0,
0.0,
0x1, // type: aligned with auto text pos (0x80 NOT set)
8, // attachment point: bottom center
2, // line spacing: exact
1.0, // line spacing factor
"", // text
"Standard", // style
0.0, // text angle
1.0, // linear factor
1.0); // dim scale
DL_DimAlignedData dimAlignedData(10.0, // extension point 1
5.0,
0.0,
30.0, // extension point 2
5.0,
0.0);
//.........这里部分代码省略.........