Skip to content

Commit

Permalink
Merge pull request #1720 from lixun910/dev1.9
Browse files Browse the repository at this point in the history
GeoDa 1.12.1.167
  • Loading branch information
lixun910 committed Oct 2, 2018
2 parents dfdb211 + 492f610 commit b295f99
Show file tree
Hide file tree
Showing 31 changed files with 697 additions and 376 deletions.
4 changes: 2 additions & 2 deletions BuildTools/macosx/GeoDa-GDAL-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<string>io.gitub.geodacenter</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<string>1.12</string>
<key>DTCompiler</key>
<string>4.2</string>
<key>DTPlatformBuild</key>
Expand Down
2 changes: 1 addition & 1 deletion BuildTools/ubuntu/package/DEBIAN/control1804
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Architecture: amd64
Priority: optional
Section: graphics
Installed-Size: 88128
Depends: libgdal-dev, zlib1g, libexpat1, freeglut3, libreadline7, libgtk-3-0, libc-dev-bin, libssl1.0.0, libwebkitgtk-1.0-0
Depends: libcurl4-openssl-dev, libgdal-dev, zlib1g, libexpat1, freeglut3, libreadline7, libgtk-3-0, libc-dev-bin, libssl1.0.0, libwebkitgtk-1.0-0
Maintainer: Luc Anselin < [email protected] >
Provides: geoda
Homepage: http://spatial.uchicago.edu
Expand Down
16 changes: 10 additions & 6 deletions BuildTools/windows/installer/32bit/GeoDa.iss
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,17 @@ OutputBaseFilename=geoda_setup

ChangesAssociations=yes

ShowLanguageDialog=yes

[Languages]
Name: "en"; MessagesFile: "compiler:Default.isl"
Name: "zh"; MessagesFile: "compiler:Languages\ChineseSimplified.isl"

[dirs]
Name: "{app}"; Permissions: everyone-full; Check: InitializeSetup
Name: "{app}\basemap_cache"; Permissions: everyone-full
Name: "{app}\Examples"; Permissions: everyone-full
Name: "{app}\Examples"; Permissions: everyone-full
Name: "{app}\basemap_cache"; Permissions: everyone-full
Name: "{app}\lang"; Permissions: everyone-full

[Files]
Source: "..\..\Release\GeoDa.exe"; DestDir: "{app}"; DestName: "GeoDa.exe"
Expand Down Expand Up @@ -61,9 +68,7 @@ Source: "..\..\temp\boost_1_57_0\stage\lib\boost_system-vc100-mt-1_57.dll"; Dest

Source: "..\..\..\..\Algorithms\lisa_kernel.cl"; DestDir: "{app}"
Source: "..\..\..\..\internationalization\lang\*"; DestDir: "{app}\lang"; Flags: recursesubdirs
Source: "..\..\..\..\SampleData\Examples\*"; DestDir: "{app}\Examples"; Flags: recursesubdirs uninsneveruninstall


Source: "..\..\..\..\SampleData\Examples\*"; DestDir: "{app}\Examples"; Flags: recursesubdirs
Source: "..\..\temp\gdal\data\*"; DestDir: "{app}\data"; Flags: recursesubdirs

;Source: "Readme.txt"; DestDir: "{app}"; Flags: isreadme
Expand All @@ -75,7 +80,6 @@ Name: "{group}\Uninstall"; Filename: "{uninstallexe}"
Name: "{commondesktop}\GeoDa"; Filename: "{app}\GeoDa.exe"
;Name: "{commondesktop}\GeoDa"; Filename: "{app}\run_geoda.bat"; IconFilename: "{app}\GeoDa.ico"


[Registry]
; set PATH
; set GEODA_GDAL_DATA
Expand Down
2 changes: 1 addition & 1 deletion BuildTools/windows/installer/64bit/GeoDa.iss
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ Source: "..\..\run_geoda.bat"; DestDir: "{app}"
Source: "..\..\Release\sqlite.dll"; DestDir: "{app}"
Source: "..\..\temp\curl-7.46.0\builds\curlib\bin\libcurl.dll"; DestDir: "{app}"
Source: "..\..\temp\expat-2.1.0\build\Release\expat.dll"; DestDir: "{app}"
Source: "..\..\temp\gdal\gdal_geoda20.dll"; DestDir: "{app}"
Source: "..\..\temp\libspatialite-4.0.0\spatialite.dll"; DestDir: "{app}"
Source: "..\..\temp\geos-3.3.8\src\geos_c.dll"; DestDir: "{app}"
Source: "..\..\temp\freexl-1.0.0e\freexl.dll"; DestDir: "{app}"
Source: "..\..\temp\proj-4.8.0\src\proj.dll"; DestDir: "{app}"
Source: "..\..\temp\gdal\gdal_geoda20.dll"; DestDir: "{app}"
Source: "..\..\temp\pgsql\lib\libpq.dll"; DestDir: "{app}"
Source: "..\..\temp\pgsql\bin\ssleay32.dll"; DestDir: "{app}"
Source: "..\..\temp\pgsql\bin\libintl-8.dll"; DestDir: "{app}"
Expand Down
19 changes: 15 additions & 4 deletions DialogTools/KMeansDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,10 @@ void KClusterDlg::CreateControls()
wxStaticText* st1 = new wxStaticText(panel, wxID_ANY,
_("Number of Clusters:"),
wxDefaultPosition, wxSize(128,-1));
combo_n = new wxChoice(panel, wxID_ANY, wxDefaultPosition, wxSize(200,-1), 0, NULL);
max_n_clusters = num_obs < 60 ? num_obs : 60;
combo_n = new wxComboBox(panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(200,-1), 0, NULL);
max_n_clusters = num_obs < 100 ? num_obs : 100;
for (int i=2; i<max_n_clusters+1; i++)
combo_n->Append(wxString::Format("%d", i));
combo_n->SetSelection(3);
gbox->Add(st1, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 10);
gbox->Add(combo_n, 1, wxEXPAND);

Expand Down Expand Up @@ -464,7 +463,19 @@ bool KClusterDlg::Run(vector<wxInt64>& clusters)
resetrandom();
}

int ncluster = combo_n->GetSelection() + 2;
int ncluster = 0;
wxString str_ncluster = combo_n->GetValue();
long value_ncluster;
if (str_ncluster.ToLong(&value_ncluster)) {
ncluster = value_ncluster;
}
if (ncluster < 2 || ncluster > num_obs) {
wxString err_msg = _("Please enter a valid number of clusters.");
wxMessageDialog dlg(NULL, err_msg, _("Error"), wxOK | wxICON_ERROR);
dlg.ShowModal();
return false;
}

int transform = combo_tranform->GetSelection();

if (!GetInputData(transform,1))
Expand Down
4 changes: 2 additions & 2 deletions DialogTools/KMeansDlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <map>
#include <wx/choice.h>
#include <wx/checklst.h>

#include <wx/combobox.h>

#include "../FramesManager.h"
#include "../VarTools.h"
Expand Down Expand Up @@ -73,7 +73,7 @@ class KClusterDlg : public AbstractClusterDlg

wxCheckBox* chk_seed;
wxChoice* combo_method;
wxChoice* combo_n;
wxComboBox* combo_n;
wxChoice* combo_cov;
wxTextCtrl* m_textbox;
wxTextCtrl* m_iterations;
Expand Down
21 changes: 16 additions & 5 deletions DialogTools/SpectralClusteringDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ void SpectralClusteringDlg::CreateControls()

// NumberOfCluster Control
wxStaticText* st1 = new wxStaticText(panel, wxID_ANY, _("Number of Clusters:"), wxDefaultPosition, wxSize(128,-1));
combo_n = new wxChoice(panel, wxID_ANY);
int max_n_clusters = num_obs < 60 ? num_obs : 60;
for (int i=2; i<max_n_clusters+1; i++) combo_n->Append(wxString::Format("%d", i));
combo_n->SetSelection(3);
combo_n = new wxComboBox(panel, wxID_ANY);
int max_n_clusters = num_obs < 100 ? num_obs : 100;
for (int i=2; i<max_n_clusters+1; i++)
combo_n->Append(wxString::Format("%d", i));
gbox->Add(st1, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 10);
gbox->Add(combo_n, 1, wxEXPAND);

Expand Down Expand Up @@ -520,7 +520,18 @@ void SpectralClusteringDlg::OnOK(wxCommandEvent& event )
resetrandom();
}

int ncluster = combo_n->GetSelection() + 2;
int ncluster = 0;
wxString str_ncluster = combo_n->GetValue();
long value_ncluster;
if (str_ncluster.ToLong(&value_ncluster)) {
ncluster = value_ncluster;
}
if (ncluster < 2 || ncluster > num_obs) {
wxString err_msg = _("Please enter a valid number of cluster.");
wxMessageDialog dlg(NULL, err_msg, _("Error"), wxOK | wxICON_ERROR);
dlg.ShowModal();
return;
}

wxString field_name = m_textbox->GetValue();
if (field_name.IsEmpty()) {
Expand Down
3 changes: 2 additions & 1 deletion DialogTools/SpectralClusteringDlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <map>
#include <wx/choice.h>
#include <wx/checklst.h>
#include <wx/combobox.h>

#include "../FramesManager.h"
#include "../VarTools.h"
Expand Down Expand Up @@ -59,7 +60,7 @@ class SpectralClusteringDlg : public AbstractClusterDlg
protected:
wxCheckBox* chk_seed;
wxChoice* combo_method;
wxChoice* combo_n;
wxComboBox* combo_n;
wxChoice* combo_cov;
wxTextCtrl* m_textbox;
wxTextCtrl* m_iterations;
Expand Down
38 changes: 20 additions & 18 deletions Explore/Basemap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ vector<BasemapGroup> ExtractBasemapResources(wxString basemap_sources) {
return groups;
}

XY::XY(double _x, double _y)
XYFraction::XYFraction(double _x, double _y)
{
x = _x;
y = _y;
Expand All @@ -152,20 +152,22 @@ XY::XY(double _x, double _y)
}


Basemap::Basemap(BasemapItem& basemap_item,
Basemap::Basemap(BasemapItem& _basemap_item,
Screen* _screen,
MapLayer *_map,
MapLayer* _map,
MapLayer* _origMap,
wxString _cachePath,
OGRCoordinateTransformation *_poCT,
double _scale_factor)
{
poCT = _poCT;
basemap_item = _basemap_item;
screen = _screen;
map = _map;
scale_factor = _scale_factor;
origMap = new MapLayer(map);

origMap = _origMap;
cachePath = _cachePath;
poCT = _poCT;
scale_factor = _scale_factor;

bDownload = false;
downloadThread = NULL;
isPan = false;
Expand Down Expand Up @@ -298,8 +300,8 @@ void Basemap::ResizeScreen(int _width, int _height)

void Basemap::Pan(int x0, int y0, int x1, int y1)
{
XY origXY((x0 + leftP + offsetX)/256.0, (y0 + topP + offsetY)/256.0);
XY newXY((x1 + leftP + offsetX)/256.0, (y1 + topP + offsetY)/256.0);
XYFraction origXY((x0 + leftP + offsetX)/256.0, (y0 + topP + offsetY)/256.0);
XYFraction newXY((x1 + leftP + offsetX)/256.0, (y1 + topP + offsetY)/256.0);

LatLng* p0 = XYToLatLng(origXY, true);
LatLng* p1 = XYToLatLng(newXY, true);
Expand Down Expand Up @@ -331,8 +333,8 @@ bool Basemap::Zoom(bool is_zoomin, int x0, int y0, int x1, int y1)
bottom = screen->height * 2 - bottom;
}

XY origXY((left + leftP + offsetX)/256.0, (top + topP + offsetY)/256.0);
XY newXY((right + leftP + offsetX)/256.0, (bottom + topP + offsetY)/256.0);
XYFraction origXY((left + leftP + offsetX)/256.0, (top + topP + offsetY)/256.0);
XYFraction newXY((right + leftP + offsetX)/256.0, (bottom + topP + offsetY)/256.0);

LatLng* p0 = XYToLatLng(origXY, true);
LatLng* p1 = XYToLatLng(newXY, true);
Expand Down Expand Up @@ -440,11 +442,11 @@ void Basemap::GetTiles()
// following: http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames
// top-left / north-west
LatLng nw(map->north, map->west);
XY* topleft = LatLngToRawXY(nw);
XYFraction* topleft = LatLngToRawXY(nw);

// bottom-right / south-east
LatLng se(map->south, map->east);
XY* bottomright = LatLngToRawXY(se);
XYFraction* bottomright = LatLngToRawXY(se);

startX = topleft->GetXInt();
startY = topleft->GetYInt();
Expand Down Expand Up @@ -647,7 +649,7 @@ void Basemap::DownloadTile(int x, int y)
}


LatLng* Basemap::XYToLatLng(XY &xy, bool isLL)
LatLng* Basemap::XYToLatLng(XYFraction &xy, bool isLL)
{
double x = xy.x;
if (x > nn)
Expand All @@ -662,22 +664,22 @@ LatLng* Basemap::XYToLatLng(XY &xy, bool isLL)
return new LatLng(lat, lng);
}

XY* Basemap::LatLngToRawXY(LatLng &latlng)
XYFraction* Basemap::LatLngToRawXY(LatLng &latlng)
{
double lat_rad = latlng.GetLatRad();
double x = (latlng.GetLngDeg() + 180.0 ) / 360.0 * nn;
double y = (1.0 - log(tan(lat_rad) + 1.0 / cos(lat_rad)) / M_PI) / 2.0 * nn;
return new XY(x, y);
return new XYFraction(x, y);
}

XY* Basemap::LatLngToXY(LatLng &latlng)
XYFraction* Basemap::LatLngToXY(LatLng &latlng)
{
double lat_rad = latlng.GetLatRad();
double x = (latlng.GetLngDeg() + 180.0 ) / 360.0 * nn;
double y = (1.0 - log(tan(lat_rad) + 1.0 / cos(lat_rad)) / M_PI) / 2.0 * nn;
int xp = (int)(x * 256 - leftP) - offsetX;
int yp = (int)(y * 256 - topP) - offsetY;
return new XY(xp, yp);
return new XYFraction(xp, yp);
}

void Basemap::LatLngToXY(double lng, double lat, int &x, int &y)
Expand Down
Loading

0 comments on commit b295f99

Please sign in to comment.