Skip to content

Commit

Permalink
Merge pull request #648 from lixun910/master
Browse files Browse the repository at this point in the history
1.8.16.4
  • Loading branch information
lixun910 committed Mar 8, 2017
2 parents 55ae016 + 1a6c257 commit 8ffaaf4
Show file tree
Hide file tree
Showing 4 changed files with 6,373 additions and 6,369 deletions.
54 changes: 34 additions & 20 deletions DialogTools/AutoUpdateDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ wxString AutoUpdate::GetCheckList()
}
} else {
// we don't support auto update on other platforms
return "";
checklistUrl += ".linux.txt";
}

return ReadUrlContent(checklistUrl);
Expand Down Expand Up @@ -429,29 +429,43 @@ void AutoUpdateDlg::OnOkClick( wxCommandEvent& event )

} else {
file_name = exeDir + file_name;
wxString update_file_name = file_name + ".update";
wxString backup_file_name = file_name + ".backup";

wxRemoveFile(backup_file_name);
wxRemoveFile(update_file_name);

file_url.Replace(" ", "%20");
if (DownloadUrl(file_url.mb_str(), update_file_name.mb_str())){
// check file size
wxFileName updateFile(update_file_name);
wxULongLong update_size = updateFile.GetSize();

if (update_size != size )
throw GdaException("");
wxStructStat strucStat;
wxStat(file_name, &strucStat);
wxFileOffset filelen=strucStat.st_size;

// should skip unless some criticle file
if (filelen == size &&
file_name.EndsWith("cache.sqlite") )
{
success = true;

// replace the old file
wxRenameFile(file_name, backup_file_name);
wxRenameFile(update_file_name, file_name);
} else {

wxString update_file_name = file_name + ".update";
wxString backup_file_name = file_name + ".backup";

wxRemoveFile(backup_file_name);
wxRemoveFile(update_file_name);
wxRemoveFile(backup_file_name);
wxRemoveFile(update_file_name);

file_url.Replace(" ", "%20");
if (DownloadUrl(file_url.mb_str(), update_file_name.mb_str())){
// check file size
wxFileName updateFile(update_file_name);
wxULongLong update_size = updateFile.GetSize();

if (update_size != size )
throw GdaException("");

// replace the old file
wxRenameFile(file_name, backup_file_name);
wxRenameFile(update_file_name, file_name);

wxRemoveFile(backup_file_name);
wxRemoveFile(update_file_name);

success = true;
success = true;
}
}
progressDlg.Update(current_job++);
}
Expand Down
12 changes: 12 additions & 0 deletions Explore/HistogramView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,10 @@ void HistogramCanvas::PopulateCanvas()
}

selectable_shps.resize(cur_intervals);
if (!is_custom_category) {
cat_classif_def.colors.resize(cur_intervals);
cat_classif_def.names.resize(cur_intervals);
}
for (int i=0; i<cur_intervals; i++) {
double x0 = orig_x_pos_left[i];
double x1 = orig_x_pos_right[i];
Expand All @@ -757,6 +761,7 @@ void HistogramCanvas::PopulateCanvas()
int sz = GdaConst::qualitative_colors.size();
selectable_shps[i]->setPen(GdaConst::qualitative_colors[i%sz]);
selectable_shps[i]->setBrush(GdaConst::qualitative_colors[i%sz]);
cat_classif_def.colors[i] = GdaConst::qualitative_colors[i%sz];
} else {
selectable_shps[i]->setPen(cat_classif_def.colors[i]);
selectable_shps[i]->setBrush(cat_classif_def.colors[i]);
Expand Down Expand Up @@ -890,6 +895,8 @@ void HistogramCanvas::InitIntervals()
ival_obs_cnt.resize(boost::extents[ts][cur_intervals]);
ival_obs_sel_cnt.resize(boost::extents[ts][cur_intervals]);

cat_classif_def.num_cats = cur_intervals;

for (int t=0; t<ts; t++)
ival_to_obs_ids[t].clear();
for (int t=0; t<ts; t++)
Expand Down Expand Up @@ -939,8 +946,10 @@ void HistogramCanvas::InitIntervals()
double ival_size = range/((double) cur_intervals);

if (!is_custom_category) {
cat_classif_def.breaks.resize(cur_intervals-1);
for (int i=0; i<cur_intervals-1; i++) {
ival_breaks[t][i] = min_ival_val[t]+ival_size*((double) (i+1));
cat_classif_def.breaks[i] = ival_breaks[t][i];
}
} else {
for (int i=0; i<cur_intervals-1; i++) {
Expand Down Expand Up @@ -989,6 +998,9 @@ void HistogramCanvas::InitIntervals()
}
}

int sel_t = var_info[0].time;
cat_classif_def.uniform_dist_min = data_stats[sel_t].min;
cat_classif_def.uniform_dist_max = data_stats[sel_t].max;
}

void HistogramCanvas::UpdateIvalSelCnts()
Expand Down
Loading

0 comments on commit 8ffaaf4

Please sign in to comment.