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
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:
15
//The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
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.
23
#include "dxflib/src/dl_creationadapter.h"
24
#include "shapelib-1.2.10/shapefil.h"
25
#include "getInsertions.h"
28
class Builder: public DL_CreationAdapter
31
Builder( std::string theFname,
33
double *theGrpXVals, double *theGrpYVals,
34
std::string *theGrpNames,
36
bool theConvertText );
39
void FinalizeAnyPolyline();
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 );
53
void print_shpObjects();
55
int textObjectsSize();
56
std::string outputShp();
57
std::string outputTShp();
61
int shapefileType; // SHPT_POINT, ...
64
std::string *grpNames;
68
std::string outputdbf;
69
std::string outputshp;
70
std::string outputtdbf;
71
std::string outputtshp;
73
std::vector <DL_VertexData> polyVertex;
74
std::vector <SHPObject *> shpObjects; // all read objects are stored here
75
std::vector <DL_TextData> textObjects;
86
bool current_polyline_willclose;
87
bool store_next_vertex_for_polyline_close;
89
int awaiting_polyline_vertices;
90
long current_polyline_pointcount;
92
SHPObject *currently_Adding_PolyLine;
95
double closePolyX, closePolyY, closePolyZ;
96
double currentBlockX, currentBlockY;