diff --git a/gui/wxpython/iclass/digit.py b/gui/wxpython/iclass/digit.py index bd1a7f0234a..23e06c2b7df 100644 --- a/gui/wxpython/iclass/digit.py +++ b/gui/wxpython/iclass/digit.py @@ -129,13 +129,15 @@ def DeleteAreasByCat(self, cats): for cat in cats: Vedit_delete_areas_cat(self.poMapInfo, 1, cat) - def CopyMap(self, name, tmp=False): + def CopyMap(self, name, tmp=False, update=False): """Make a copy of open vector map Note: Attributes are not copied :param name: name for a copy :param tmp: True for temporary map + :param bool update: True if copy target vector map (poMapInfoNew) + exist :return: number of copied features :return: -1 on error @@ -147,13 +149,23 @@ def CopyMap(self, name, tmp=False): poMapInfoNew = pointer(Map_info()) if not tmp: - open_fn = Vect_open_new + if update: + open_fn = Vect_open_update + else: + open_fn = Vect_open_new else: - open_fn = Vect_open_tmp_new - - is3D = bool(Vect_is_3d(self.poMapInfo)) - if open_fn(poMapInfoNew, name, is3D) == -1: - return -1 + if update: + open_fn = Vect_open_tmp_update + else: + open_fn = Vect_open_tmp_new + + if update: + if open_fn(poMapInfoNew, name, '') == -1: + return -1 + else: + is3D = bool(Vect_is_3d(self.poMapInfo)) + if open_fn(poMapInfoNew, name, is3D) == -1: + return -1 verbose = G_verbose() G_set_verbose(-1) # be silent diff --git a/gui/wxpython/iclass/frame.py b/gui/wxpython/iclass/frame.py index 1e7264ce8a9..bd086b20765 100644 --- a/gui/wxpython/iclass/frame.py +++ b/gui/wxpython/iclass/frame.py @@ -615,7 +615,7 @@ def ImportAreas(self, vector): vname = self._getTempVectorName() # avoid deleting temporary map os.environ['GRASS_VECTOR_TEMPORARY'] = '1' - if digitClass.CopyMap(vname, tmp=True) == -1: + if digitClass.CopyMap(vname, tmp=True, update=True) == -1: GError( parent=self, message=_("Unable to copy vector features from <%s>") %