Dxf库中的DL_Attributes类

DL_Attributes 通常是 DXF 库中用于存储图形实体属性的类。在 DXF 文件中,每个图形实体都可以具有一系列属性,如颜色、线型、线宽等。DL_Attributes 类用于封装和管理这些属性,以便在创建、编辑和显示图形实体时使用。

以下是一个简单的伪代码示例,展示了如何使用 DL_Attributes 类来设置和获取图形实体的属性:

DL_Attributes attributes;// 设置属性值
attributes.setColor(DL_Codes::black);  // 设置颜色为黑色
attributes.setLineWidth(0.5);  // 设置线宽为0.5// 获取属性值
int color = attributes.getColor();  // 获取颜色值
double lineWidth = attributes.getLineWidth();  // 获取线宽值

在上面的示例中,我们创建了一个 DL_Attributes 对象 attributes,并使用该对象的方法来设置和获取图形实体的属性。通过调用 setColor 和 setLineWidth 方法,我们设置了图形实体的颜色和线宽属性,然后通过 getColor 和 getLineWidth 方法获取这些属性的值。

DL_Attributes 类的具体方法和属性可能会根据您所使用的 DXF 库的实现有所不同,具体取决于库的设计和功能。通常,您可以在 DXF 库的文档或源代码中找到关于 DL_Attributes 类的详细信息,包括其方法、属性和用法示例。

老版源码:

/****************************************************************************
** Copyright (C) 2001-2013 RibbonSoft, GmbH. All rights reserved.
**
** This file is part of the dxflib project.
**
** This file is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** Licensees holding valid dxflib Professional Edition licenses may use
** this file in accordance with the dxflib Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.ribbonsoft.com for further details.
**
** Contact info@ribbonsoft.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/#ifndef DL_ATTRIBUTES_H
#define DL_ATTRIBUTES_H#include "dl_global.h"#include <string>
#include <vector>#include "dl_codes.h"/*** Storing and passing around attributes. Attributes* are the layer name, color, width and line type.** @author Andrew Mustun*/
class DXFLIB_EXPORT DL_Attributes
{
public:/*** Default constructor.*/DL_Attributes() :layer( "" ),color( 0 ),color24( -1 ),width( 0 ),linetype( "BYLAYER" ),linetypeScale( 1.0 ),handle( -1 ),inPaperSpace( false ){}/*** Constructor for DXF attributes.** @param layer Layer name for this entity or NULL for no layer*              (every entity should be on a named layer!).* @param color Color number (0..256). 0 = BYBLOCK, 256 = BYLAYER.* @param width Line thickness. Defaults to zero. -1 = BYLAYER,*               -2 = BYBLOCK, -3 = default width* @param linetype Line type name or "BYLAYER" or "BYBLOCK". Defaults*              to "BYLAYER"*/DL_Attributes( const std::string& alayer,int acolor, int awidth,const std::string& alinetype,double alinetypeScale ) :layer( alayer ), color( acolor ), color24( -1 ), width( awidth ),linetype( alinetype ), linetypeScale( alinetypeScale ),handle( -1 ), inPaperSpace( false ){}/*** Constructor for DXF attributes.** @param layer Layer name for this entity or NULL for no layer*              (every entity should be on a named layer!).* @param color Color number (0..256). 0 = BYBLOCK, 256 = BYLAYER.* @param color24 24 bit color (0x00RRGGBB, see DXF reference).* @param width Line thickness. Defaults to zero. -1 = BYLAYER,*               -2 = BYBLOCK, -3 = default width* @param linetype Line type name or "BYLAYER" or "BYBLOCK". Defaults*              to "BYLAYER"*/DL_Attributes( const std::string& alayer,int acolor, int acolor24, int awidth,const std::string& alinetype, int ahandle = -1 )  :layer( alayer ),color( acolor ), color24( acolor24 ),width( awidth ), linetype( alinetype ), linetypeScale( 1.0 ),handle( ahandle ),inPaperSpace( false ){}/*** Sets the layer. If the given pointer points to NULL, the*  new layer name will be an empty but valid string.*/void setLayer( const std::string& alayer ){layer = alayer;}/*** @return Layer name.*/std::string getLayer() const{return layer;}/*** Sets the color.** @see DL_Codes, dxfColors*/void setColor( int acolor ){color = acolor;}/*** Sets the 24bit color.** @see DL_Codes, dxfColors*/void setColor24( int acolor ){color24 = acolor;}/*** @return Color.** @see DL_Codes, dxfColors*/int getColor() const{return color;}/*** @return 24 bit color or -1 if no 24bit color is defined.** @see DL_Codes, dxfColors*/int getColor24() const{return color24;}/*** Sets the width.*/void setWidth( int awidth ){width = awidth;}/*** @return Width.*/int getWidth() const{return width;}/*** Sets the line type. This can be any string and is not*  checked to be a valid line type.*/void setLinetype( const std::string& alinetype ){linetype = alinetype;}/*** Sets the entity specific line type scale.*/void setLinetypeScale( double alinetypeScale ){linetypeScale = alinetypeScale;}double getLinetypeScale() const{return linetypeScale;}/*** @return Line type.*/std::string getLinetype() const{if( linetype.length()==0 ){return "BYLAYER";}else{return linetype;}}void setHandle( int h ){handle = h;}int getHandle() const{return handle;}void setInPaperSpace( bool on ){inPaperSpace = on;}bool isInPaperSpace() const{return inPaperSpace;}private:std::string layer;int color;int color24;int width;std::string linetype;double linetypeScale;int handle;// DXF code 67 (true: entity in paper space, false: entity in model space (default):bool inPaperSpace;
};#endif// EOF

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/34838.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

对于“青少年与成年人抑郁症的不同点”,以下说法错误的是?

对于“青少年与成年人抑郁症的不同点”&#xff0c;以下说法错误的是()点击查看答案 A.刻意引人关注B.易激惹或愤怒情绪 C.无法解释的隐痛或疼痛D.对于批评的极端敏感 青春期孩子的心理需求层次的是:①满足②成长③归属④需求 A.②③④ B.①③④C.③④② D.①②③ 关于亲子关系…

python之闭包以及服务器的开发

闭包&#xff1a; 函数嵌套函数 函数的返回值是一个函数 内部函数使用了外部函数的变量 造成数据不会被释放。 函数的参数是一个变量 def f(a):def f1():print(a)return f1f2 f(2) f2() # 2 函数的参数是另外一个函数 def fn(f):def fn1():f()return fn1def a():print(1…

autossh实现内外网穿透

一、介绍 ​ Autossh 是一个用于建立和维护 SSH 隧道的工具&#xff0c;它在网络连接断开或中断时可以自动重新连接。通过 Autossh&#xff0c;您可以方便地在不稳定的网络环境下保持持久的 SSH 连接。 ​ Autossh 是一个跨平台的工具&#xff0c;可在多个操作系统上使用&…

Java操作Redis(通过Jedis)

一、环境搭建 这里我使用的SpringBoot版本是2.6.3&#xff0c;所以我引入的Jedis相关版本也不是很高 <dependency><groupId>redis.clients</groupId><artifactId>jedis</artifactId><version>3.2.0</version></dependency><…

数学建模--Matlab求解线性规划问题两种类型实际应用

1.约束条件的符号一致 &#xff08;1&#xff09;约束条件的符号一致的意思就是指的是这个约束条件里面的&#xff0c;像这个下面的实例里面的三个约束条件&#xff0c;都是小于号&#xff0c;这个我称之为约束条件符号一致&#xff1b; &#xff08;2&#xff09;下面的就是上…

我的3次软考高项通关之旅

1、缘起 初次听说软考是在2022年下半年了&#xff0c;软考的高级分为很多种&#xff0c;我起先想报考高级架构师&#xff0c;但是架构师一年才考一次&#xff0c;如果一次考不过得再准备一年&#xff0c;时间对我来说太长了&#xff0c;于是我决定报考一年考两次的高项。对于国…

iPhone怎么恢复删除的数据?几款顶级iPhone数据恢复软件

从iOS设备恢复数据。 对于任何数据恢复软件来说&#xff0c;从iOS设备恢复数据都是一项复杂的任务&#xff0c;因为Apple已将众多数据保护技术集成到现代iPhone和iPad中。其中包括硬件加密和文件级加密。iOS 上已删除的数据只能通过取证文件工件搜索来找到&#xff0c;例如分析…

Python 报错 Max retries exceeded with url 解决方案

下面有三个常见的方法&#xff1a; 1、增加重试连接次数&#xff1a; requests.DEFAULT_RETRIES 52、关闭多余的链接&#xff1a; 默认的http connection是keep-alive的&#xff0c;在post请求中&#xff0c;header中有这样一个字段&#xff1a;Connection&#xff0c;我们…

抖音集团基于 Apache Doris 的实时数据仓库实践

作者&#xff1a;字节跳动数据平台 在直播、电商等业务场景中存在着大量实时数据&#xff0c;这些数据对业务发展至关重要。而在处理实时数据时&#xff0c;我们也遇到了诸多挑战&#xff0c;比如实时数据开发门槛高、运维成本高以及资源浪费等。 此外&#xff0c;实时数据处…

游戏心理学Day26

游戏测试 我们能够成为创建游戏机制和系统的专家&#xff0c;却无法在没有测试数据支持的情况下&#xff0c;妄言游戏的真实品质。因为游戏更关注的是人的感受而非系统&#xff0c;毕竟系统通常都很清晰且符合逻辑&#xff0c;而玩家的感受却个人化且难以洞悉。我们能够在自身…

C#面试题目含参考答案(四)

前言 面试是应聘一个工作岗位的环节&#xff0c;来考察一个人的工作能力与综合素质。在应聘C#程序员或与C#相关岗位时&#xff0c;我们都会被问到一些与.NET、C#、数据库、业务知识或编程思想等问题。本文列举一些问题及提供参考答案&#xff0c;题目&#xff08;四&#xff0…

用谷歌Gemini免费批量生成微信公众号图书带货文章

谷歌Gemini 的api现在是免费的&#xff0c;功能很强大。可以在其官网简单几步操作申请到API&#xff1a;https://ai.google.dev/pricing 以上是一些Excel表格中的图书名称&#xff0c;现在要通过谷歌Gemini来批量生成这些图书的带货推广文章。 ChatGPT中输入提示词&#xff1a…

NVIDIA GPU参数

NVIDIA作为全球领先的GPU制造商&#xff0c;其产品广泛应用于深度学习、机器学习、高性能计算&#xff08;HPC&#xff09;和图形计算等领域。以下是NVIDIA一系列GPU的性能参数概述&#xff1a; V100 Tensor Core GPU V100是NVIDIA的一款高性能GPU&#xff0c;专为深度学习、机…

java对word文档预设参数填值并生成

目录 &#xff08;1&#xff09;定义word文档模板 &#xff08;2&#xff09;模板二次处理 处理模板图片&#xff0c;不涉及图片可以跳过 处理模板内容 &#xff08;3&#xff09;java对word模板填值 &#xff08;4&#xff09;Notepad的XML Tools插件安装 工作上要搞一个…

什么是服务器硬盘?

什么是服务器硬盘呢&#xff1f; 服务器硬盘顾名思义&#xff0c;指的就是在服务器上所使用的硬盘&#xff0c;如果服务器是数据网络中的核心部分&#xff0c;那么服务器硬盘则是指数据网络核心的数据仓库&#xff0c;其中所有的软件应用与用户数据信息都是存储在服务器硬盘当中…

C#与工业自动化结合还有搞头吗?

在开始前刚好我有一些资料&#xff0c;是我根据网友给的问题精心整理了一份「c#的资料从专业入门到高级教程」&#xff0c; 点个关注在评论区回复“666”之后私信回复“666”&#xff0c;全部无偿共享给大家&#xff01;&#xff01;&#xff01;当然有搞头&#xff01;C#是一…

Java 8 新特性:Lambda表达式让你的代码焕然一新——掌握它,让编程变得轻松又高效!

前言 Java 8 是 Java 发展史上的一次重要里程碑。作为企业级开发语言&#xff0c;它在性能和功能上做了巨大的提升。这其中&#xff0c;Lambda表达式是一个关键的新特性&#xff0c;它为 Java 语言带来了函数式编程的概念。本篇文章将深入探讨Lambda表达式&#xff0c;并结合热…

中断变轮询的一种机制

前言 MCU中断嵌套中断很容易引起问题&#xff0c;例如我们在MCU中引入串口shell&#xff0c;封装一些指令&#xff0c;如果这些指令中需要调用其他中断&#xff0c;例如I2C发送中断等&#xff0c;就很容易引起问题&#xff0c;这个时候我们就需要搞一个缓冲机制 思考 那么应…

element 问题整合

没关系&#xff0c;凡事发生必有利于我 文章目录 一、el-table 同级数据对齐及展开图标的位置问题二、el-table 勾选框为圆角及只能勾选一个 一、el-table 同级数据对齐及展开图标的位置问题 element 官方提供的扩展tree型数据在表格里默认是靠左边对齐&#xff0c;项目需求需要…

超越边界:探索深度学习的泛化力量

深度学习的泛化能力 一. 简介1.1 深度学习的定义1.2 什么是泛化能力1.3 深度学习模型的泛化能力1.4 提升深度学习模型的泛化能力 二. 泛化能力的重要性2.1 深度学习中泛化能力的作用2.1.1 防止过拟合2.1.2 处理噪声和不完整数据2.1.3 对于数据分布的变化具有适应性 2.2 泛化能力…