当前位置: 首页>>代码示例>>C++>>正文


C++ DL_Dxf::writeVertex方法代码示例

本文整理汇总了C++中DL_Dxf::writeVertex方法的典型用法代码示例。如果您正苦于以下问题:C++ DL_Dxf::writeVertex方法的具体用法?C++ DL_Dxf::writeVertex怎么用?C++ DL_Dxf::writeVertex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DL_Dxf的用法示例。


在下文中一共展示了DL_Dxf::writeVertex方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SaveHorizontalProfiles


//.........这里部分代码省略.........
		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();
	}

	//Writing the Entities Section
	{
		dw->sectionEntities();

		//we make the profile fit in the middle of the page (21.0 x 29.7 cm)
		double scale = std::min((c_pageWidth_mm - 2.0 * c_profileMargin_mm)/(2.0*maxRadius),
								(c_pageHeight_mm - 2.0 * c_profileMargin_mm)/(2.0*maxRadius));

		//min corner of profile area
//		const double x0 = (c_pageWidth_mm - 2.0*maxRadius*scale) / 2.0;
		const double y0 = (c_pageHeight_mm - 2.0*maxRadius*scale) / 2.0;
		//center of profile area
		const double xc = c_pageWidth_mm / 2.0;
		const double yc = c_pageHeight_mm / 2.0;

		//write legend
		{
			DL_Attributes DefaultLegendMaterial(LEGEND_LAYER, DL_Codes::bylayer, -1, "BYLAYER");

			//write page contour
			{
				dxf.writePolyline(	*dw,
									DL_PolylineData(4,0,0,1),
									DefaultLegendMaterial);

				dxf.writeVertex(*dw, DL_VertexData(	c_pageMargin_mm, c_pageMargin_mm, 0.0));
				dxf.writeVertex(*dw, DL_VertexData(	c_pageMargin_mm, c_pageHeight_mm-c_pageMargin_mm, 0.0));
				dxf.writeVertex(*dw, DL_VertexData(	c_pageWidth_mm-c_pageMargin_mm, c_pageHeight_mm-c_pageMargin_mm, 0.0));
				dxf.writeVertex(*dw, DL_VertexData(	c_pageWidth_mm-c_pageMargin_mm, c_pageMargin_mm, 0.0));

				dxf.writePolylineEnd(*dw);
			}

			double xLegend = c_pageMargin_mm + 2.0*c_textHeight_mm;
			double yLegend = c_pageMargin_mm + 2.0*c_textHeight_mm;
			const double legendWidth_mm = 20.0;

			//Y axis
			double axisTip = maxRadius*scale + 5.0;
			dxf.writeLine(	*dw,
							DL_LineData(xc, yc, 0.0, xc, yc-axisTip, 0.0),
							DefaultLegendMaterial);

			//Y axis tip as triangle
			{
				double axisTipSize = 3.0;

				dxf.writePolyline(	*dw,
									DL_PolylineData(3,0,0,1), //closed polyline!
									DefaultLegendMaterial);
				dxf.writeVertex(*dw, DL_VertexData(	xc, yc-(axisTip+axisTipSize), 0.0));
				dxf.writeVertex(*dw, DL_VertexData(	xc-axisTipSize/2.0, yc-axisTip, 0.0));
				dxf.writeVertex(*dw, DL_VertexData(	xc+axisTipSize/2.0, yc-axisTip, 0.0));
				dxf.writePolylineEnd(*dw);

				dxf.writeText(	*dw,
								DL_TextData(xc,yc-(axisTip+2.0*axisTipSize),0.0,xc,yc-(axisTip+2.0*axisTipSize),0.0,c_textHeight_mm,1.0,0,1,3,"Y","STANDARD",0.0),
								DefaultLegendMaterial);
开发者ID:eile,项目名称:trunk,代码行数:67,代码来源:dxfProfilesExporter.cpp

示例2: SaveVerticalProfiles


//.........这里部分代码省略.........
		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();
	}

	//Writing the Entities Section
	{
		dw->sectionEntities();

		//we make the profile fit in the middle of the page (21.0 x 29.7 cm)
		double scale = std::min((c_pageWidth_mm - 2.0 * c_profileMargin_mm)/xSpan,
								(c_pageHeight_mm - 2.0 * c_profileMargin_mm)/ySpan);

		//min corner of profile area
		const double x0 = (c_pageWidth_mm - xSpan*scale) / 2.0;
		const double y0 = (c_pageHeight_mm - ySpan*scale) / 2.0;

		//write theoretical profile (polyline)
		{
			unsigned vertexCount = profile->size();
			dxf.writePolyline(	*dw,
								DL_PolylineData(static_cast<int>(vertexCount),0,0,0),
								DL_Attributes(PROFILE_LAYER, DL_Codes::bylayer, -1, "BYLAYER"));

			for (unsigned i=0; i<vertexCount; ++i)
			{
				const CCVector3* P = profile->getPoint(i);
				dxf.writeVertex(*dw, DL_VertexData(x0+(P->x-xMin)*scale,y0+(P->y-yMin)*scale,0.0));
			}

			dxf.writePolylineEnd(*dw);
		}

		//write legend
		{
			DL_Attributes DefaultLegendMaterial(LEGEND_LAYER, DL_Codes::bylayer, -1, "BYLAYER");

			//write page contour
			{
				dxf.writePolyline(	*dw,
									DL_PolylineData(4,0,0,1),
									DefaultLegendMaterial);

				dxf.writeVertex(*dw, DL_VertexData(	c_pageMargin_mm, c_pageMargin_mm, 0.0));
				dxf.writeVertex(*dw, DL_VertexData(	c_pageMargin_mm, c_pageHeight_mm-c_pageMargin_mm, 0.0));
				dxf.writeVertex(*dw, DL_VertexData(	c_pageWidth_mm-c_pageMargin_mm, c_pageHeight_mm-c_pageMargin_mm, 0.0));
				dxf.writeVertex(*dw, DL_VertexData(	c_pageWidth_mm-c_pageMargin_mm, c_pageMargin_mm, 0.0));

				dxf.writePolylineEnd(*dw);
			}

			double xLegend = c_pageMargin_mm + 2.0*c_textHeight_mm;
			double yLegend = c_pageMargin_mm + 2.0*c_textHeight_mm;
			const double legendWidth_mm = 20.0;
			
			//deviation magnification factor
			QString magnifyStr = QString::number(params.devMagnifyCoef);
			dxf.writeText(	*dw,
				DL_TextData(xLegend,yLegend,0.0,xLegend,yLegend,0.0,c_textHeight_mm,1.0,0,0,0,(QString("Deviation magnification factor: ")+magnifyStr).toStdString(),"STANDARD",0.0),
				DefaultLegendMaterial);
开发者ID:eile,项目名称:trunk,代码行数:67,代码来源:dxfProfilesExporter.cpp

示例3: saveToFile


//.........这里部分代码省略.........

			layerNames << layerName;
			dxf.writeLayer(*dw, 
				DL_LayerData(layerName.toStdString(), 0), 
				DL_Attributes(
				std::string(""),
				i == 0 ? DL_Codes::green : /*-*/DL_Codes::green, //invisible if negative!
				lineWidth,
				"CONTINUOUS"));
		}
	}
	dw->tableEnd();

	//Writing Various Other Tables
	dxf.writeStyle(*dw);
	dxf.writeView(*dw);
	dxf.writeUcs(*dw);

	dw->tableAppid(1);
	dw->tableAppidEntry(0x12);
	dw->dxfString(2, "ACAD");
	dw->dxfInt(70, 0);
	dw->tableEnd();

	//Writing Dimension Styles
	dxf.writeDimStyle(	*dw, 
						/*arrowSize*/1, 
						/*extensionLineExtension*/1,
						/*extensionLineOffset*/1,
						/*dimensionGap*/1,
						/*dimensionTextSize*/1);
	
	//Writing Block Records
	dxf.writeBlockRecord(*dw);
	dw->tableEnd();

	//Ending the Tables Section
	dw->sectionEnd();

	//Writing the Blocks Section
	{
		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();
	}

	//Writing the Entities Section
	{
		dw->sectionEntities();

		//write polylines
		for (unsigned i=0; i<polyCount; ++i)
		{
			const ccPolyline* poly = static_cast<ccPolyline*>(polylines[i]);
			unsigned vertexCount = poly->size();
			int flags = poly->isClosed() ? 1 : 0;
			if (!poly->is2DMode())
				flags |= 8; //3D polyline
			dxf.writePolyline(	*dw,
								DL_PolylineData(static_cast<int>(vertexCount),0,0,flags),
								DL_Attributes(layerNames[i].toStdString(), DL_Codes::bylayer, -1, "BYLAYER") );

			for (unsigned i=0; i<vertexCount; ++i)
			{
				CCVector3 P;
				poly->getPoint(i,P);
				dxf.writeVertex(*dw, DL_VertexData(	P.x, P.y, P.y ) );
			}

			dxf.writePolylineEnd(*dw);
		}

		dw->sectionEnd();
	}

	//Writing the Objects Section
	dxf.writeObjects(*dw);
	dxf.writeObjectsEnd(*dw);

	//Ending and Closing the File
	dw->dxfEOF();
	dw->close();
	delete dw;
	dw = 0;

	ccLog::Print("[DXF] File %s saved successfully",filename);

	return CC_FERR_NO_ERROR;

#endif
}
开发者ID:kod3r,项目名称:trunk,代码行数:101,代码来源:DxfFilter.cpp


注:本文中的DL_Dxf::writeVertex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。