Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.12.1.181 #1777

Merged
merged 11 commits into from
Dec 7, 2018
20 changes: 15 additions & 5 deletions BuildTools/windows/GeoDa.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -389,12 +389,19 @@
<ClCompile Include="..\..\io\MatfileReader.cpp" />
<ClCompile Include="..\..\io\matlab_mat.cpp" />
<ClCompile Include="..\..\kNN\ANN.cpp" />
<ClCompile Include="..\..\kNN\bd_fix_rad_search.cpp" />
<ClCompile Include="..\..\kNN\bd_pr_search.cpp" />
<ClCompile Include="..\..\kNN\bd_search.cpp" />
<ClCompile Include="..\..\kNN\bd_tree.cpp" />
<ClCompile Include="..\..\kNN\brute.cpp" />
<ClCompile Include="..\..\kNN\kd_dump.cpp" />
<ClCompile Include="..\..\kNN\kd_fix_rad_search.cpp" />
<ClCompile Include="..\..\kNN\kd_pr_search.cpp" />
<ClCompile Include="..\..\kNN\kd_search.cpp" />
<ClCompile Include="..\..\kNN\kd_split.cpp" />
<ClCompile Include="..\..\kNN\kd_tree.cpp" />
<ClCompile Include="..\..\kNN\kd_util.cpp" />
<ClCompile Include="..\..\kNN\kNN.cpp" />
<ClCompile Include="..\..\kNN\perf.cpp" />
<ClCompile Include="..\..\libgdiam\gdiam.cpp" />
<ClCompile Include="..\..\ogl\basic.cpp" />
<ClCompile Include="..\..\ogl\basic2.cpp" />
Expand Down Expand Up @@ -423,6 +430,7 @@
<ClCompile Include="..\..\VarCalc\NumericTests.cpp" />
<ClCompile Include="..\..\VarCalc\WeightsMetaInfo.cpp" />
<ClCompile Include="..\..\VarTools.cpp" />
<ClCompile Include="..\..\Weights\DistUtils.cpp" />
<ClCompile Include="..\..\wxTranslationHelper.cpp" />
<ClInclude Include="..\..\Algorithms\cluster.h" />
<ClInclude Include="..\..\Algorithms\DataUtils.h" />
Expand Down Expand Up @@ -538,17 +546,18 @@
<ClInclude Include="..\..\io\MatfileReader.h" />
<ClInclude Include="..\..\io\matlab_mat.h" />
<ClInclude Include="..\..\io\weights_interface.h" />
<ClInclude Include="..\..\kNN\ANN.h" />
<ClInclude Include="..\..\kNN\ANNperf.h" />
<ClInclude Include="..\..\kNN\ANNx.h" />
<ClInclude Include="..\..\kNN\ANN\ANN.h" />
<ClInclude Include="..\..\kNN\ANN\ANNperf.h" />
<ClInclude Include="..\..\kNN\ANN\ANNx.h" />
<ClInclude Include="..\..\kNN\bd_tree.h" />
<ClInclude Include="..\..\kNN\kd_fix_rad_search.h" />
<ClInclude Include="..\..\kNN\kd_pr_search.h" />
<ClInclude Include="..\..\kNN\kd_search.h" />
<ClInclude Include="..\..\kNN\kd_split.h" />
<ClInclude Include="..\..\kNN\kd_tree.h" />
<ClInclude Include="..\..\kNN\kd_util.h" />
<ClInclude Include="..\..\kNN\pr_queue.h" />
<ClInclude Include="..\..\kNN\pr_queue_k.h" />
<ClInclude Include="..\..\kNN\values.h" />
<ClInclude Include="..\..\libgdiam\gdiam.hpp" />
<ClInclude Include="..\..\MapLayerStateObserver.h" />
<ClInclude Include="..\..\Observable.h" />
Expand Down Expand Up @@ -711,6 +720,7 @@
<ClInclude Include="..\..\VarCalc\WeightsMetaInfo.h" />
<ClInclude Include="..\..\VarTools.h" />
<ClInclude Include="..\..\version.h" />
<ClInclude Include="..\..\Weights\DistUtils.h" />
<ClInclude Include="..\..\wxTranslationHelper.h" />
</ItemGroup>
<ItemGroup>
Expand Down
144 changes: 90 additions & 54 deletions BuildTools/windows/GeoDa.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@
<Filter Include="ogl">
<UniqueIdentifier>{85fd04ff-4aa4-45d8-8492-8a7d69f0dc17}</UniqueIdentifier>
</Filter>
<Filter Include="Weights">
<UniqueIdentifier>{5afad44a-83ce-4cf0-bb16-70dcd9e4b1e6}</UniqueIdentifier>
</Filter>
<Filter Include="kNN\ANN">
<UniqueIdentifier>{dcde4097-4967-4ebe-98cd-897b7657a5d2}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<None Include="..\..\rc\GeoDa.ico">
Expand Down Expand Up @@ -729,39 +735,6 @@
<ClInclude Include="..\..\DialogTools\HDBScanDlg.h">
<Filter>DialogTools</Filter>
</ClInclude>
<ClInclude Include="..\..\kNN\ANN.h">
<Filter>kNN</Filter>
</ClInclude>
<ClInclude Include="..\..\kNN\ANNperf.h">
<Filter>kNN</Filter>
</ClInclude>
<ClInclude Include="..\..\kNN\ANNx.h">
<Filter>kNN</Filter>
</ClInclude>
<ClInclude Include="..\..\kNN\kd_pr_search.h">
<Filter>kNN</Filter>
</ClInclude>
<ClInclude Include="..\..\kNN\kd_search.h">
<Filter>kNN</Filter>
</ClInclude>
<ClInclude Include="..\..\kNN\kd_split.h">
<Filter>kNN</Filter>
</ClInclude>
<ClInclude Include="..\..\kNN\kd_tree.h">
<Filter>kNN</Filter>
</ClInclude>
<ClInclude Include="..\..\kNN\kd_util.h">
<Filter>kNN</Filter>
</ClInclude>
<ClInclude Include="..\..\kNN\pr_queue.h">
<Filter>kNN</Filter>
</ClInclude>
<ClInclude Include="..\..\kNN\pr_queue_k.h">
<Filter>kNN</Filter>
</ClInclude>
<ClInclude Include="..\..\kNN\values.h">
<Filter>kNN</Filter>
</ClInclude>
<ClInclude Include="..\..\Algorithms\distmatrix.h">
<Filter>Algorithms</Filter>
</ClInclude>
Expand Down Expand Up @@ -841,6 +814,45 @@
<ClInclude Include="..\..\DialogTools\SpatialJoinDlg.h">
<Filter>DialogTools</Filter>
</ClInclude>
<ClInclude Include="..\..\kNN\bd_tree.h">
<Filter>kNN</Filter>
</ClInclude>
<ClInclude Include="..\..\kNN\kd_fix_rad_search.h">
<Filter>kNN</Filter>
</ClInclude>
<ClInclude Include="..\..\kNN\kd_pr_search.h">
<Filter>kNN</Filter>
</ClInclude>
<ClInclude Include="..\..\kNN\kd_search.h">
<Filter>kNN</Filter>
</ClInclude>
<ClInclude Include="..\..\kNN\kd_split.h">
<Filter>kNN</Filter>
</ClInclude>
<ClInclude Include="..\..\kNN\kd_tree.h">
<Filter>kNN</Filter>
</ClInclude>
<ClInclude Include="..\..\kNN\kd_util.h">
<Filter>kNN</Filter>
</ClInclude>
<ClInclude Include="..\..\kNN\pr_queue.h">
<Filter>kNN</Filter>
</ClInclude>
<ClInclude Include="..\..\kNN\pr_queue_k.h">
<Filter>kNN</Filter>
</ClInclude>
<ClInclude Include="..\..\Weights\DistUtils.h">
<Filter>Weights</Filter>
</ClInclude>
<ClInclude Include="..\..\kNN\ANN\ANN.h">
<Filter>kNN\ANN</Filter>
</ClInclude>
<ClInclude Include="..\..\kNN\ANN\ANNperf.h">
<Filter>kNN\ANN</Filter>
</ClInclude>
<ClInclude Include="..\..\kNN\ANN\ANNx.h">
<Filter>kNN\ANN</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\rc\GdaAppResources.cpp">
Expand Down Expand Up @@ -1419,27 +1431,6 @@
<ClCompile Include="..\..\DialogTools\HDBScanDlg.cpp">
<Filter>DialogTools</Filter>
</ClCompile>
<ClCompile Include="..\..\kNN\ANN.cpp">
<Filter>kNN</Filter>
</ClCompile>
<ClCompile Include="..\..\kNN\kd_pr_search.cpp">
<Filter>kNN</Filter>
</ClCompile>
<ClCompile Include="..\..\kNN\kd_search.cpp">
<Filter>kNN</Filter>
</ClCompile>
<ClCompile Include="..\..\kNN\kd_split.cpp">
<Filter>kNN</Filter>
</ClCompile>
<ClCompile Include="..\..\kNN\kd_tree.cpp">
<Filter>kNN</Filter>
</ClCompile>
<ClCompile Include="..\..\kNN\kd_util.cpp">
<Filter>kNN</Filter>
</ClCompile>
<ClCompile Include="..\..\kNN\kNN.cpp">
<Filter>kNN</Filter>
</ClCompile>
<ClCompile Include="..\..\Algorithms\distmatrix.cpp">
<Filter>Algorithms</Filter>
</ClCompile>
Expand Down Expand Up @@ -1509,5 +1500,50 @@
<ClCompile Include="..\..\DialogTools\SpatialJoinDlg.cpp">
<Filter>DialogTools</Filter>
</ClCompile>
<ClCompile Include="..\..\kNN\ANN.cpp">
<Filter>kNN</Filter>
</ClCompile>
<ClCompile Include="..\..\kNN\bd_fix_rad_search.cpp">
<Filter>kNN</Filter>
</ClCompile>
<ClCompile Include="..\..\kNN\bd_pr_search.cpp">
<Filter>kNN</Filter>
</ClCompile>
<ClCompile Include="..\..\kNN\bd_search.cpp">
<Filter>kNN</Filter>
</ClCompile>
<ClCompile Include="..\..\kNN\bd_tree.cpp">
<Filter>kNN</Filter>
</ClCompile>
<ClCompile Include="..\..\kNN\brute.cpp">
<Filter>kNN</Filter>
</ClCompile>
<ClCompile Include="..\..\kNN\kd_dump.cpp">
<Filter>kNN</Filter>
</ClCompile>
<ClCompile Include="..\..\kNN\kd_fix_rad_search.cpp">
<Filter>kNN</Filter>
</ClCompile>
<ClCompile Include="..\..\kNN\kd_pr_search.cpp">
<Filter>kNN</Filter>
</ClCompile>
<ClCompile Include="..\..\kNN\kd_search.cpp">
<Filter>kNN</Filter>
</ClCompile>
<ClCompile Include="..\..\kNN\kd_split.cpp">
<Filter>kNN</Filter>
</ClCompile>
<ClCompile Include="..\..\kNN\kd_tree.cpp">
<Filter>kNN</Filter>
</ClCompile>
<ClCompile Include="..\..\kNN\kd_util.cpp">
<Filter>kNN</Filter>
</ClCompile>
<ClCompile Include="..\..\kNN\perf.cpp">
<Filter>kNN</Filter>
</ClCompile>
<ClCompile Include="..\..\Weights\DistUtils.cpp">
<Filter>Weights</Filter>
</ClCompile>
</ItemGroup>
</Project>
14 changes: 12 additions & 2 deletions DataViewer/OGRTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,16 @@ bool OGRTable::DoesNameExist(const wxString& name, bool case_sensitive) const
return var_order.DoesNameExist(name, case_sensitive);
}

int OGRTable::GetFirstNumericCol()
{
int n = GetNumberCols(); // var_order size
for (size_t i=0; i<n; i++) {
if (IsColNumeric(i)) {
return i;
}
}
}

/** Return the Group column name. */
wxString OGRTable::GetColName(int col)
{
Expand Down Expand Up @@ -1582,7 +1592,7 @@ int OGRTable::FindOGRColId(int wxgrid_col_pos, int time)
int OGRTable::FindOGRColId(const wxString& name)
{
for (size_t i=0; i < org_var_names.size(); i++ ) {
if (name == org_var_names[i] ) {
if (name.CmpNoCase(org_var_names[i]) == 0 ) {
return i;
}
}
Expand All @@ -1601,7 +1611,7 @@ OGRColumn* OGRTable::FindOGRColumn(const wxString& name)
if (name.IsEmpty()) return NULL;

for (size_t i=0; i<org_var_names.size(); i++ ) {
if (name == org_var_names[i] ) {
if ( name.CmpNoCase(org_var_names[i]) == 0 ) {
return columns[i];
}
}
Expand Down
3 changes: 2 additions & 1 deletion DataViewer/OGRTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ class OGRTable : public TableInterface, TableStateObserver
virtual bool HasFixedDecimals();
virtual bool PermitChangeDecimals();
virtual bool PermitChangeDisplayedDecimals();


virtual int GetFirstNumericCol();
virtual bool DbColNmToColAndTm(const wxString& name, int& col, int& tm);
virtual int FindColId(const wxString& name);
virtual int GetColIdx(const wxString& name, bool ignore_case=false);
Expand Down
3 changes: 2 additions & 1 deletion DataViewer/TableInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ class TableInterface

virtual int GetNumberCols() = 0;
virtual int GetNumberRows() = 0;


virtual int GetFirstNumericCol() = 0;
virtual bool IsColTimeVariant(const wxString& name);
virtual bool IsColTimeVariant(int col) = 0;
virtual int GetColTimeSteps(int col) = 0;
Expand Down
6 changes: 3 additions & 3 deletions DataViewer/VarOrderPtree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,17 +190,17 @@ bool VarOrderPtree::CorrectVarGroups(const std::map<wxString,
LOG_MSG("Entering VarOrderPtree::CorrectVarGroups");
bool changed = false;
set<wxString> ds_var_set;
BOOST_FOREACH(const wxString &v, ds_var_list) { ds_var_set.insert(v); }
BOOST_FOREACH(const wxString &v, ds_var_list) { ds_var_set.insert(v.Lower()); }

set<wxString> var_set;
set<wxString> group_nm_set;
BOOST_FOREACH(const VarGroup& e, var_grps) {
if (e.vars.size() == 0) {
var_set.insert(e.name);
var_set.insert(e.name.Lower());
} else {
group_nm_set.insert(e.name);
BOOST_FOREACH(const wxString& v, e.vars) {
if (!v.empty()) var_set.insert(v);
if (!v.empty()) var_set.insert(v.Lower());
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion DialogTools/AbstractClusterDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ double AbstractClusterDlg::CreateSummary(const vector<vector<int> >& solution, c
summary << _printConfiguration();

// auto weighting
if (m_use_centroids->IsChecked()) {
if (m_use_centroids != NULL && m_use_centroids->IsChecked()) {
wxString w_val = m_wc_txt->GetValue();
double w_valf = 0;
if (w_val.ToDouble(&w_valf)) {
Expand Down
2 changes: 1 addition & 1 deletion DialogTools/CsvFieldConfDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ CsvFieldConfDlg::CsvFieldConfDlg(wxWindow* parent,
{

wxLogMessage("Open CsvFieldConfDlg.");

HEADERS = 1;
lat_box = NULL;
n_max_rows = 10;
filepath = _filepath;
Expand Down
12 changes: 10 additions & 2 deletions DialogTools/HDBScanDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -488,23 +488,31 @@ void HDBScanDlg::OnOKClick(wxCommandEvent& event )
*/
double** ragged_distances = distancematrix(rows, columns, input_data, mask, weight, dist, transpose);
double** distances = DataUtils::fullRaggedMatrix(ragged_distances, rows, rows);

for (int i = 1; i < rows; i++) free(ragged_distances[i]);
free(ragged_distances);

// add weight to input_data
double** data = new double*[rows];
for (int i=0; i<rows; i++) {
data[i] = new double[columns];
for (int j=0; j<columns; j++) {
input_data[i][j] = input_data[i][j] * weight[j];
data[i][j] = input_data[i][j] * weight[j];
}
}

GeoDaClustering::HDBScan hdb(minPts, minSamples, alpha, cluster_selection_method, allow_single_cluster, rows, columns, distances, input_data, undefs);
GeoDaClustering::HDBScan hdb(minPts, minSamples, alpha, cluster_selection_method, allow_single_cluster, rows, columns, distances, data, undefs);

cluster_ids = hdb.GetRegions();
core_dist = hdb.core_dist;
probabilities = hdb.probabilities;
outliers = hdb.outliers;

for (int i=0; i<rows; i++) {
delete[] data[i];
}
delete[] data;

int ncluster = cluster_ids.size();

vector<wxInt64> clusters(rows, 0);
Expand Down
Loading