⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rs_entity.h

📁 qcad2.05可用于windows和linux的源码
💻 H
📖 第 1 页 / 共 2 页
字号:
/****************************************************************************** $Id: rs_entity.h 1958 2005-02-28 18:15:01Z andrew $**** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.**** This file is part of the qcadlib Library project.**** This file may be distributed and/or modified under the terms of the** GNU General Public License version 2 as published by the Free Software** Foundation and appearing in the file LICENSE.GPL included in the** packaging of this file.**** Licensees holding valid qcadlib Professional Edition licenses may use ** this file in accordance with the qcadlib 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 RS_ENTITY_H#define RS_ENTITY_H//#include <values.h>#include "rs_dict.h"#include "rs.h"#include "rs_layer.h"#include "rs_math.h"#include "rs_pen.h"#include "rs_string.h"#include "rs_stringlist.h"#include "rs_undoable.h"#include "rs_vector.h"class RS_Arc;class RS_Block;class RS_Circle;class RS_Document;class RS_EntityContainer;class RS_Graphic;class RS_GraphicView;class RS_Insert;class RS_Line;class RS_Painter;class RS_Point;class RS_Polyline;class RS_Text;/** * Base class for an entity (line, arc, circle, ...) * * @author Andrew Mustun */class RS_Entity : public RS_Undoable {public:    RS_Entity(RS_EntityContainer* parent=NULL);    virtual ~RS_Entity();    void init();    virtual void initId();    virtual RS_Entity* clone() = 0;    virtual void reparent(RS_EntityContainer* parent) {        this->parent = parent;    }    void resetBorders();    /**     * Must be overwritten to return the rtti of this entity     * (e.g. RS2::EntityArc).     */    virtual RS2::EntityType rtti() const {        return RS2::EntityUnknown;    }    /**     * Identify all entities as undoable entities.     * @return RS2::UndoableEntity     */    virtual RS2::UndoableType undoRtti() {        return RS2::UndoableEntity;    }    /**     * @return Unique Id of this entity.     */    unsigned long int getId() const {        return id;    }    /**     * This method must be overwritten in subclasses and return the      * number of <b>atomic</b> entities in this entity.     */    virtual unsigned long int count() = 0;	    /**     * This method must be overwritten in subclasses and return the      * number of <b>atomic</b> entities in this entity including sub containers.     */    virtual unsigned long int countDeep() = 0;	/**	 * Implementations must return the total length of the entity	 * or a negative number if the entity has no length (e.g. a text or hatch).	 */	virtual double getLength() {		return -1.0;	}    /**     * @return Parent of this entity or NULL if this is a root entity.     */    RS_EntityContainer* getParent() const {        return parent;    }    /**     * Reparents this entity.     */    void setParent(RS_EntityContainer* p) {        parent = p;    }    RS_Graphic* getGraphic();    RS_Block* getBlock();    RS_Insert* getInsert();    RS_Entity* getBlockOrInsert();    RS_Document* getDocument();    void setLayer(const RS_String& name);    void setLayer(RS_Layer* l);    void setLayerToActive();    RS_Layer* getLayer(bool resolve = true) const;    /**     * Sets the explicit pen for this entity or a pen with special     * attributes such as BY_LAYER, ..     */    void setPen(const RS_Pen& pen) {        this->pen = pen;    }    void setPenToActive();    RS_Pen getPen(bool resolve = true) const;    /**     * Must be overwritten to return true if an entity type      * is a container for other entities (e.g. polyline, group, ...).     */    virtual bool isContainer() const = 0;    /**     * Must be overwritten to return true if an entity type      * is an atomic entity.     */    virtual bool isAtomic() const = 0;    /**     * Must be overwritten to return true if an entity type      * is a potential edge entity of a contour. By default    * this returns false.     */    virtual bool isEdge() const {        return false;    }    /**     * @return true for all document entities (e.g. Graphics or Blocks).     * false otherwise.     */    virtual bool isDocument() const {        return false;    }    virtual bool setSelected(bool select);    virtual bool toggleSelected();    virtual bool isSelected() const;	virtual bool isParentSelected();    virtual bool isProcessed() const;    virtual void setProcessed(bool on);    virtual bool isInWindow(RS_Vector v1, RS_Vector v2);    virtual bool hasEndpointsWithinWindow(RS_Vector /*v1*/, RS_Vector /*v2*/) {        return false;    }    virtual bool isVisible();    virtual void setVisible(bool v) {        if (v) {            setFlag(RS2::FlagVisible);        } else {            delFlag(RS2::FlagVisible);        }    }	virtual void setHighlighted(bool on);	virtual bool isHighlighted();	    virtual bool isLocked();    virtual void undoStateChanged(bool undone);    virtual bool isUndone() const;    /**     * Can be implemented by child classes to update the entities     * temporary subentities. update() is called if the entity's     * paramters or undo state changed.     */    virtual void update() {}	    virtual void setUpdateEnabled(bool on) {		updateEnabled = on;	}    /**     * This method doesn't do any calculations.      * @return minimum coordinate of the entity.     * @see calculateBorders()     */    RS_Vector getMin() const {        return minV;    }    /**     * This method doesn't do any calculations.      * @return minimum coordinate of the entity.     * @see calculateBorders()     */    RS_Vector getMax() const {        return maxV;    }    /**     * This method returns the difference of max and min returned      * by the above functions.      * @return size of the entity.     * @see calculateBorders()     * @see getMin()     * @see getMax()     */    RS_Vector getSize() const {        return maxV-minV;    }    void addGraphicVariable(const RS_String& key, double val, int code);    void addGraphicVariable(const RS_String& key, int val, int code);    void addGraphicVariable(const RS_String& key, const RS_String& val, int code);	    double getGraphicVariableDouble(const RS_String& key, double def);    int getGraphicVariableInt(const RS_String& key, int def);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -