~librecad-dev/librecad/librecad

« back to all changes in this revision

Viewing changes to librecad/src/lib/creation/rs_creation.h

  • Committer: Scott Howard
  • Date: 2014-02-21 19:07:55 UTC
  • Revision ID: showard@debian.org-20140221190755-csjax9wb146hgdq4
first commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
**
 
3
** This file is part of the LibreCAD project, a 2D CAD program
 
4
**
 
5
** Copyright (C) 2010 R. van Twisk (librecad@rvt.dds.nl)
 
6
** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
 
7
**
 
8
**
 
9
** This file may be distributed and/or modified under the terms of the
 
10
** GNU General Public License version 2 as published by the Free Software 
 
11
** Foundation and appearing in the file gpl-2.0.txt included in the
 
12
** packaging of this file.
 
13
**
 
14
** This program is distributed in the hope that it will be useful,
 
15
** but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
** GNU General Public License for more details.
 
18
** 
 
19
** You should have received a copy of the GNU General Public License
 
20
** along with this program; if not, write to the Free Software
 
21
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
22
**
 
23
** This copyright notice MUST APPEAR in all copies of the script!  
 
24
**
 
25
**********************************************************************/
 
26
 
 
27
 
 
28
#ifndef RS_CREATION_H
 
29
#define RS_CREATION_H
 
30
 
 
31
#include "rs_entitycontainer.h"
 
32
#include "rs_line.h"
 
33
#include "rs_polyline.h"
 
34
#include "rs_insert.h"
 
35
#include "rs_image.h"
 
36
#include "rs_block.h"
 
37
 
 
38
 
 
39
/**
 
40
 * Data needed to insert library items.
 
41
 */
 
42
struct RS_LibraryInsertData {
 
43
        QString file;
 
44
        RS_Vector insertionPoint;
 
45
        double factor;
 
46
        double angle;
 
47
};
 
48
 
 
49
 
 
50
/**
 
51
 * Class for the creation of new entities.
 
52
 * This class is bound to an entity container in which the
 
53
 * entities are stored. 
 
54
 *
 
55
 * @author Andrew Mustun
 
56
 */
 
57
class RS_Creation {
 
58
public:
 
59
    RS_Creation(RS_EntityContainer* container,
 
60
                RS_GraphicView* graphicView=NULL,
 
61
                bool handleUndo=true);
 
62
 
 
63
    RS_Entity* createParallelThrough(const RS_Vector& coord,
 
64
                              int number,
 
65
                              RS_Entity* e);
 
66
 
 
67
    RS_Entity* createParallel(const RS_Vector& coord,
 
68
                              double distance,
 
69
                              int number,
 
70
                              RS_Entity* e);
 
71
 
 
72
    RS_Line* createParallelLine(const RS_Vector& coord,
 
73
                                double distance, int number,
 
74
                                RS_Line* e);
 
75
 
 
76
    RS_Arc* createParallelArc(const RS_Vector& coord,
 
77
                              double distance, int number,
 
78
                              RS_Arc* e);
 
79
 
 
80
    RS_Circle* createParallelCircle(const RS_Vector& coord,
 
81
                                    double distance, int number,
 
82
                                    RS_Circle* e);
 
83
 
 
84
    RS_Line* createBisector(const RS_Vector& coord1,
 
85
                            const RS_Vector& coord2,
 
86
                            double length,
 
87
                            int num,
 
88
                            RS_Line* l1,
 
89
                            RS_Line* l2);
 
90
 
 
91
    RS_Line* createTangent1(const RS_Vector& coord,
 
92
                            const RS_Vector& point,
 
93
                            RS_Entity* circle);
 
94
/**
 
95
 * create a tangent line which is orthogonal to the given RS_Line(normal)
 
96
 */
 
97
    RS_Line* createLineOrthTan(const RS_Vector& coord,
 
98
                            RS_Line* normal,
 
99
                            RS_Entity* circle);
 
100
    RS_Line* createTangent2(const RS_Vector& coord,
 
101
                            RS_Entity* circle1,
 
102
                            RS_Entity* circle2);
 
103
    /**
 
104
      * create the path of centers of common tangent circles of the two given circles
 
105
      *@ return NULL, if failed
 
106
      *@ at success return either an ellipse or hyperbola
 
107
      */
 
108
    std::vector<RS_Entity*> createCircleTangent2( RS_Entity* circle1,RS_Entity* circle2);
 
109
 
 
110
    RS_Line* createLineRelAngle(const RS_Vector& coord,
 
111
                                RS_Entity* entity,
 
112
                                double angle,
 
113
                                double length);
 
114
 
 
115
    RS_Line* createPolygon(const RS_Vector& center,
 
116
                           const RS_Vector& corner,
 
117
                           int number);
 
118
 
 
119
    RS_Line* createPolygon2(const RS_Vector& corner1,
 
120
                            const RS_Vector& corner2,
 
121
                            int number);
 
122
 
 
123
    RS_Insert* createInsert(RS_InsertData& data);
 
124
        
 
125
    RS_Image* createImage(RS_ImageData& data);
 
126
 
 
127
    RS_Block* createBlock(const RS_BlockData& data,
 
128
                          const RS_Vector& referencePoint,
 
129
                          const bool remove);
 
130
                                                  
 
131
    RS_Insert* createLibraryInsert(RS_LibraryInsertData& data);
 
132
 
 
133
    //void createPoint(const RS_Vector& p);
 
134
    //void createLine2P(const RS_Vector& p1, const RS_Vector& p2);
 
135
    //void createRectangle(const RS_Vector& e1, const RS_Vector& e2);
 
136
    //RS_Polyline* createPolyline(const RS_Vector& p);
 
137
 
 
138
protected:
 
139
    RS_EntityContainer* container;
 
140
    RS_Graphic* graphic;
 
141
    RS_Document* document;
 
142
    RS_GraphicView* graphicView;
 
143
    bool handleUndo;
 
144
};
 
145
 
 
146
#endif