Skip to content

Commit

Permalink
r.terrafow: explicit use of default constructors (OSGeo#2660)
Browse files Browse the repository at this point in the history
Fixes -Wclass-memaccess and -Wdeprecated-declaration warnings.

Use 'default' for implicitly-declared constructors and use default
(implicit) destructor.

Simplify; modernise constructs.
  • Loading branch information
a0x8o committed Oct 21, 2024
1 parent f5c4d35 commit 6caabc6
Show file tree
Hide file tree
Showing 29 changed files with 378 additions and 40 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@
# See INSTALL.md file for usage.
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
# COPYRIGHT: (C) 2002-2024 by the GRASS Development Team
=======
# COPYRIGHT: (C) 2002-2022 by the GRASS Development Team
>>>>>>> 6cf60c76a4 (wxpyimgview: explicit conversion to int (#2704))
=======
# COPYRIGHT: (C) 2002-2022 by the GRASS Development Team
>>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704))
=======
# COPYRIGHT: (C) 2002-2023 by the GRASS Development Team
>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660))
#
# This program is free software under the GNU General Public
# License (>=v2). Read the file COPYING that comes with GRASS
Expand Down
2 changes: 1 addition & 1 deletion REQUIREMENTS.html
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ <h3>Note:</h3>
<p>

<hr width="100%">
<i>&copy; GRASS Development Team 1997-2022</i>
<i>&copy; GRASS Development Team 1997-2023</i>

<p>Please report bugs here:
<br><a href="https://grass.osgeo.org/contribute/">https://grass.osgeo.org/contribute/</a>
Expand Down
4 changes: 4 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@
# configuration variables for compilation and installation.
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
# COPYRIGHT: (C) 2000-2024 by the GRASS Development Team
=======
# COPYRIGHT: (C) 2000-2022 by the GRASS Development Team
>>>>>>> 6cf60c76a4 (wxpyimgview: explicit conversion to int (#2704))
=======
# COPYRIGHT: (C) 2000-2022 by the GRASS Development Team
>>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704))
=======
# COPYRIGHT: (C) 2000-2023 by the GRASS Development Team
>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660))
#
# This program is free software under the GNU General
# Public License (>=v2). Read the file COPYING that
Expand Down
8 changes: 8 additions & 0 deletions grasslib.dox
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
* updated 8/2005, 2006-2024
=======
Expand All @@ -18,6 +19,9 @@
=======
* updated 8/2005, 2006-2008, 2010-2011, 2017-2022
>>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704))
=======
* updated 8/2005, 2006-2008, 2010-2011, 2017-2023
>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660))
-->

<a href="https://grass.osgeo.org">GRASS GIS</a> (<b>Geographic
Expand All @@ -39,6 +43,7 @@ Team</a>, an international team of programmers, GRASS module authors
are cited within their module's source code and the contributed manual
pages.

<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
&copy; 2000-2024 by the GRASS Development Team
Expand All @@ -48,6 +53,9 @@ pages.
=======
&copy; 2000-2022 by the GRASS Development Team
>>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704))
=======
&copy; 2000-2023 by the GRASS Development Team
>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660))

This manual is published under <a
href="http://www.fsf.org/copyleft/fdl.html">GNU Free Documentation
Expand Down
81 changes: 81 additions & 0 deletions gui/wxpython/gui_core/goutput.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@
)
from core.globalvar import CheckWxVersion, wxPythonPhoenix
from gui_core.prompt import GPromptSTC
<<<<<<< HEAD
from gui_core.wrap import Button, ClearButton, StaticText
=======
from gui_core.wrap import Button, ClearButton, StaticText, StaticBox
>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660))
from core.settings import UserSettings


Expand Down Expand Up @@ -144,10 +148,28 @@ def __init__(
self.btnOutputSave.SetToolTip(_("Save output to a file"))
self.btnCmdAbort = Button(parent=self.panelProgress, id=wx.ID_STOP)
self.btnCmdAbort.SetToolTip(_("Abort running command"))
<<<<<<< HEAD

self.btnClear.Bind(wx.EVT_BUTTON, self.OnClear)
self.btnOutputSave.Bind(wx.EVT_BUTTON, self.OnOutputSave)
self.btnCmdAbort.Bind(wx.EVT_BUTTON, self._gconsole.OnCmdAbort)
=======
self.btnCmdExportHistory = Button(parent=self.panelOutput, id=wx.ID_ANY)
self.btnCmdExportHistory.SetLabel(_("&Export history"))
self.btnCmdExportHistory.SetToolTip(
_("Export history of executed commands to a file")
)

if not self._gcstyle & GC_PROMPT:
self.btnCmdClear.Hide()
self.btnCmdExportHistory.Hide()

self.btnCmdClear.Bind(wx.EVT_BUTTON, self.cmdPrompt.OnCmdErase)
self.btnOutputClear.Bind(wx.EVT_BUTTON, self.OnOutputClear)
self.btnOutputSave.Bind(wx.EVT_BUTTON, self.OnOutputSave)
self.btnCmdAbort.Bind(wx.EVT_BUTTON, self._gconsole.OnCmdAbort)
self.btnCmdExportHistory.Bind(wx.EVT_BUTTON, self.OnCmdExportHistory)
>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660))

self._layout()

Expand Down Expand Up @@ -189,6 +211,39 @@ def _layout(self):
self.cmdOutput, proportion=1, flag=wx.EXPAND | wx.ALL, border=3
)
<<<<<<< HEAD
=======
outBtnSizer.Add(
self.btnOutputClear,
proportion=proportion,
flag=wx.ALIGN_LEFT | wx.LEFT | wx.RIGHT | wx.BOTTOM,
border=5,
)
outBtnSizer.Add(
self.btnOutputSave,
proportion=proportion,
flag=wx.RIGHT | wx.BOTTOM,
border=5,
)
cmdBtnSizer.Add(
self.btnCmdExportHistory,
proportion=1,
flag=wx.ALIGN_CENTER
| wx.ALIGN_CENTER_VERTICAL
| wx.LEFT
| wx.RIGHT
| wx.BOTTOM,
border=5,
)
cmdBtnSizer.Add(
self.btnCmdClear,
proportion=1,
flag=wx.ALIGN_CENTER | wx.RIGHT | wx.BOTTOM,
border=5,
)
>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660))
progressSizer.Add(
self.btnCmdAbort, proportion=0, flag=wx.ALL | wx.ALIGN_CENTER, border=5
)
Expand Down Expand Up @@ -403,6 +458,32 @@ def OnCmdProgress(self, event):
self.progressbar.SetValue(event.value)
event.Skip()
<<<<<<< HEAD
=======
def OnCmdExportHistory(self, event):
"""Export the history of executed commands stored
in a .wxgui_history file to a selected file."""
dlg = wx.FileDialog(
self,
message=_("Save file as..."),
defaultFile="grass_cmd_log.txt",
wildcard=_("{txt} (*.txt)|*.txt|{files} (*)|*").format(
txt=_("Text files"), files=_("Files")
),
style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT,
)
if dlg.ShowModal() == wx.ID_OK:
path = dlg.GetPath()
if self.cmdPrompt.CopyHistory(path):
self.showNotification.emit(
message=_("Command history saved to '{}'".format(path))
)
dlg.Destroy()
event.Skip()
>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660))
def OnCmdRun(self, event):
"""Run command"""
self.outputSizer.Show(self.panelProgress)
Expand Down
22 changes: 22 additions & 0 deletions gui/wxpython/gui_core/prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import difflib
import sys
import shutil

import wx
import wx.stc
Expand Down Expand Up @@ -141,6 +142,27 @@ def _runCmd(self, cmdString):
self.CmdErase()
self.ShowStatusText("")

def CopyHistory(self, targetFile):
"""Copy history file to the target location.
Returns True if file is successfully copied."""
env = grass.gisenv()
historyFile = os.path.join(
env["GISDBASE"],
env["LOCATION_NAME"],
env["MAPSET"],
".wxgui_history",
)
try:
shutil.copyfile(historyFile, targetFile)
except (IOError, OSError) as e:
GError(
_("Unable to copy file {} to {}'.\n\nDetails: {}").format(
historyFile, targetFile, e
)
)
return False
return True
def GetCommands(self):
"""Get list of launched commands"""
return self.commands
Expand Down
5 changes: 5 additions & 0 deletions imagery/i.maxlik/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ int main(int argc, char *argv[])
/* Predicted classes start at 1 but signature array is 0 based
*/
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
if (Rast_is_c_null_value(&class_cell[col]) == 0)
class_cell[col] = S.sig[class_cell[col] - 1].oclass;
Expand All @@ -148,6 +149,10 @@ int main(int argc, char *argv[])
=======
class_cell[col] = S.sig[class_cell[col] - 1].oclass;
>>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704))
=======
if (Rast_is_c_null_value(&class_cell[col]) == 0)
class_cell[col] = S.sig[class_cell[col] - 1].oclass;
>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660))
}
}
Rast_put_row(class_fd, class_cell, CELL_TYPE);
Expand Down
4 changes: 4 additions & 0 deletions imagery/i.maxlik/testsuite/test_i_maxlik.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def setUpClass(cls):
cls.runModule(
"r.mapcalc",
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
expression=f"{cls.b2}=if(row() == 3 && col() == 3, null(), 5.0+rand(-1.0,1.0))",
=======
Expand All @@ -76,6 +77,9 @@ def setUpClass(cls):
=======
expression=f"{cls.b2}=5.0+rand(-1.0,1.0)",
>>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704))
=======
expression=f"{cls.b2}=if(row() == 3 && col() == 3, null(), 5.0+rand(-1.0,1.0))",
>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660))
flags="s",
quiet=True,
)
Expand Down
4 changes: 4 additions & 0 deletions include/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@ dev
=======
3
dev
<<<<<<< HEAD
2022
>>>>>>> 6cf60c76a4 (wxpyimgview: explicit conversion to int (#2704))
=======
3
dev
2022
>>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704))
=======
2023
>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660))
4 changes: 4 additions & 0 deletions include/grass/gis.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
* COPYRIGHT: (C) 2000-2024 by the GRASS Development Team
=======
Expand All @@ -23,6 +24,9 @@
=======
* COPYRIGHT: (C) 2000-2022 by the GRASS Development Team
>>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704))
=======
* COPYRIGHT: (C) 2000-2023 by the GRASS Development Team
>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660))
*
* This program is free software under the GNU General Public
* License (>=v2). Read the file COPYING that comes with GRASS
Expand Down
4 changes: 4 additions & 0 deletions lib/gis/env.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
\brief GIS library - environment routines
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
(C) 2001-2024 by the GRASS Development Team
Expand All @@ -12,6 +13,9 @@
=======
(C) 2001-2022 by the GRASS Development Team
>>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704))
=======
(C) 2001-2023 by the GRASS Development Team
>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660))
This program is free software under the GNU General Public License
(>=v2). Read the file COPYING that comes with GRASS for details.
Expand Down
4 changes: 4 additions & 0 deletions lib/gis/gislib_cmdline_parsing.dox
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<!--
extracted form gislib.dox and improved by Vaclav Petras, 2013

<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
Copyright 2004-2024 by the GRASS Development Team
Expand All @@ -13,6 +14,9 @@ Copyright 2004-2022 by the GRASS Development Team
=======
Copyright 2004-2022 by the GRASS Development Team
>>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704))
=======
Copyright 2004-2023 by the GRASS Development Team
>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660))

Published under GNU Free Documentation License
-->
Expand Down
4 changes: 4 additions & 0 deletions lib/gis/parser_html.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
\brief GIS Library - Argument parsing functions (HTML output)
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
(C) 2001-2024 by the GRASS Development Team
Expand All @@ -12,6 +13,9 @@
=======
(C) 2001-2022 by the GRASS Development Team
>>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704))
=======
(C) 2001-2023 by the GRASS Development Team
>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660))
This program is free software under the GNU General Public License
(>=v2). Read the file COPYING that comes with GRASS for details.
Expand Down
4 changes: 4 additions & 0 deletions lib/init/grass.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,17 @@
# user interface and cleans up after it is finished.
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
# COPYRIGHT: (C) 2000-2024 by the GRASS Development Team
=======
# COPYRIGHT: (C) 2000-2022 by the GRASS Development Team
>>>>>>> 6cf60c76a4 (wxpyimgview: explicit conversion to int (#2704))
=======
# COPYRIGHT: (C) 2000-2022 by the GRASS Development Team
>>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704))
=======
# COPYRIGHT: (C) 2000-2023 by the GRASS Development Team
>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660))
#
# This program is free software under the GNU General
# Public License (>=v2). Read the file COPYING that
Expand Down
4 changes: 4 additions & 0 deletions lib/init/grass.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@
# interface and cleans up after it is finished.
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
# COPYRIGHT: (C) 2000-2024 by the GRASS Development Team
=======
# COPYRIGHT: (C) 2000-2022 by the GRASS Development Team
>>>>>>> 6cf60c76a4 (wxpyimgview: explicit conversion to int (#2704))
=======
# COPYRIGHT: (C) 2000-2022 by the GRASS Development Team
>>>>>>> 8422103f4c (wxpyimgview: explicit conversion to int (#2704))
=======
# COPYRIGHT: (C) 2000-2023 by the GRASS Development Team
>>>>>>> 021dfb5d52 (r.terrafow: explicit use of default constructors (#2660))
#
# This program is free software under the GNU General
# Public License (>=v2). Read the file COPYING that
Expand Down
Loading

0 comments on commit 6caabc6

Please sign in to comment.