~ubuntu-branches/ubuntu/wily/qgis/wily

« back to all changes in this revision

Viewing changes to src/plugins/dxf2shp_converter/builder.h

  • Committer: Bazaar Package Importer
  • Author(s): Johan Van de Wauw
  • Date: 2010-07-11 20:23:24 UTC
  • mfrom: (3.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100711202324-5ktghxa7hracohmr
Tags: 1.4.0+12730-3ubuntu1
* Merge from Debian unstable (LP: #540941).
* Fix compilation issues with QT 4.7
* Add build-depends on libqt4-webkit-dev 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// The code is heavily based on Christopher Michaelis'  DXF to Shapefile Converter
 
2
// (http://www.wanderingidea.com/content/view/12/25/), released under GPL License
 
3
//
 
4
// This code is based on two other products:
 
5
// DXFLIB (http://www.ribbonsoft.com/dxflib.html)
 
6
//    This is a library for reading DXF files, also GPL.
 
7
// SHAPELIB (http://shapelib.maptools.org/)
 
8
//    Used for the Shapefile functionality.
 
9
//    It is Copyright (c) 1999, Frank Warmerdam, released under the following "MIT Style" license:
 
10
//Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
 
11
//documentation files (the "Software"), to deal in the Software without restriction, including without limitation
 
12
//the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
 
13
//and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 
14
 
 
15
//The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
 
16
 
 
17
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 
18
//OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
 
19
//LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
 
20
//IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
21
//
 
22
 
 
23
#include "dxflib/src/dl_creationadapter.h"
 
24
#include "shapelib-1.2.10/shapefil.h"
 
25
#include "getInsertions.h"
 
26
#include <vector>
 
27
 
 
28
class Builder: public DL_CreationAdapter
 
29
{
 
30
  public:
 
31
    Builder( std::string theFname,
 
32
             int theShapefileType,
 
33
             double *theGrpXVals, double *theGrpYVals,
 
34
             std::string *theGrpNames,
 
35
             int theInsertCount,
 
36
             bool theConvertText );
 
37
    ~Builder();
 
38
 
 
39
    void FinalizeAnyPolyline();
 
40
 
 
41
    virtual void addLayer( const DL_LayerData &data );
 
42
    virtual void addPoint( const DL_PointData &data );
 
43
    virtual void addLine( const DL_LineData &data );
 
44
    virtual void addPolyline( const DL_PolylineData &data );
 
45
    virtual void addArc( const DL_ArcData &data );
 
46
    virtual void addCircle( const DL_CircleData &data );
 
47
    virtual void addVertex( const DL_VertexData &data );
 
48
    virtual void addBlock( const DL_BlockData &data );
 
49
    virtual void endBlock();
 
50
    virtual void endSequence();
 
51
    virtual void addText( const DL_TextData &data );
 
52
 
 
53
    void print_shpObjects();
 
54
 
 
55
    int textObjectsSize();
 
56
    std::string outputShp();
 
57
    std::string outputTShp();
 
58
 
 
59
  private:
 
60
    std::string fname;
 
61
    int shapefileType; // SHPT_POINT, ...
 
62
    double *grpXVals;
 
63
    double *grpYVals;
 
64
    std::string *grpNames;
 
65
    int insertCount;
 
66
    bool convertText;
 
67
 
 
68
    std::string outputdbf;
 
69
    std::string outputshp;
 
70
    std::string outputtdbf;
 
71
    std::string outputtshp;
 
72
 
 
73
    std::vector <DL_VertexData> polyVertex;
 
74
    std::vector <SHPObject *> shpObjects; // all read objects are stored here
 
75
    std::vector <DL_TextData> textObjects;
 
76
 
 
77
    int numlayers;
 
78
    int numpoints;
 
79
    int numlines;
 
80
    int numplines;
 
81
 
 
82
    int fetchedprims;
 
83
    int fetchedtexts;
 
84
 
 
85
    bool ignoringBlock;
 
86
    bool current_polyline_willclose;
 
87
    bool store_next_vertex_for_polyline_close;
 
88
 
 
89
    int awaiting_polyline_vertices;
 
90
    long current_polyline_pointcount;
 
91
 
 
92
    SHPObject *currently_Adding_PolyLine;
 
93
 
 
94
 
 
95
    double closePolyX, closePolyY, closePolyZ;
 
96
    double currentBlockX, currentBlockY;
 
97
};