Skip to content

Commit

Permalink
replaced incomplete init() method with proper use of constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
Afforix committed Jun 23, 2022
1 parent edd9144 commit 5be3464
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 46 deletions.
48 changes: 12 additions & 36 deletions thexpshp.cxx
Expand Up @@ -71,16 +71,9 @@

#include "thexpshp.h"

thexpshpf::thexpshpf()
{
this->m_fnm = "default";
this->m_fpath = NULL;
this->m_is_open = false;
this->m_xshp = NULL;
this->m_type = SHPT_NULL;
this->m_object_id = -1;
this->m_num_objects = 0;
}
thexpshpf::thexpshpf(struct thexpshp * xshp, const char * fnm, int type):
m_xshp(xshp), m_fnm(fnm), m_type(type)
{}


bool thexpshpf::open()
Expand Down Expand Up @@ -131,33 +124,16 @@ void thexpshpf::close()
}


void thexpshpf::init(thexpshp * xshp, const char * fnm, int type)
{
this->m_fnm = fnm;
this->m_fpath = NULL;
this->m_xshp = xshp;
this->m_type = type;
}




thexpshp::thexpshp()
{
this->m_dirname = NULL;
this->m_xproj = NULL;
this->m_expmap = NULL;
this->m_expmodel = NULL;

this->m_fscrap.init(this, "outline2d", SHPT_POLYGONZ);
this->m_fpoints.init(this, "points2d", SHPT_POINTZ);
this->m_flines.init(this, "lines2d", SHPT_ARCZ);
this->m_fareas.init(this, "areas2d", SHPT_POLYGONZ);

this->m_fstations3D.init(this, "stations3d", SHPT_POINTZ);
this->m_fshots3D.init(this, "shots3d", SHPT_ARCZ);
this->m_fwalls3D.init(this, "walls3d", SHPT_MULTIPATCH);
}
thexpshp::thexpshp():
m_fscrap(this, "outline2d", SHPT_POLYGONZ),
m_fpoints(this, "points2d", SHPT_POINTZ),
m_flines(this, "lines2d", SHPT_ARCZ),
m_fareas(this, "areas2d", SHPT_POLYGONZ),
m_fstations3D(this, "stations3d", SHPT_POINTZ),
m_fshots3D(this, "shots3d", SHPT_ARCZ),
m_fwalls3D(this, "walls3d", SHPT_MULTIPATCH)
{}



Expand Down
19 changes: 9 additions & 10 deletions thexpshp.h
Expand Up @@ -51,23 +51,22 @@ struct thexpshpf_part {
// Shapefile module
struct thexpshpf {

const char * m_fnm, * m_fpath;
const char * m_fnm, * m_fpath = nullptr;
struct thexpshp * m_xshp;
bool m_is_open;
bool m_is_open = false;
int m_type;
size_t m_num_objects;
size_t m_num_objects = 0;
SHPHandle m_hndl = nullptr;

thattr m_attributes;

thexpshpf();
void init(struct thexpshp * xshp, const char * fnm, int type);
thexpshpf(struct thexpshp * xshp, const char * fnm, int type);
bool open();
void close();

std::list<thexpshpf_data> m_point_list;
std::list<thexpshpf_part> m_part_list;
int m_object_id;
int m_object_id = -1;
void object_clear();
void object_insert();

Expand All @@ -88,12 +87,12 @@ struct thexpshpf {
// Shapefile export structure.
struct thexpshp {

const char * m_dirname;
thdb2dprj * m_xproj;
const char * m_dirname = nullptr;
thdb2dprj * m_xproj = nullptr;
thexpshpf m_fscrap, m_fpoints, m_flines, m_fareas;
thexpshpf m_fstations3D, m_fshots3D, m_fwalls3D;
class thexpmap * m_expmap;
class thexpmodel * m_expmodel;
class thexpmap * m_expmap = nullptr;
class thexpmodel * m_expmodel = nullptr;

thexpshp();
bool open(const char * dirname);
Expand Down

0 comments on commit 5be3464

Please sign in to comment.