Skip to content

Commit

Permalink
Merge branch 'main' into 405-wxdisplay1
Browse files Browse the repository at this point in the history
  • Loading branch information
petrasovaa authored Jan 27, 2025
2 parents d8f5950 + 71f1bce commit a70d478
Show file tree
Hide file tree
Showing 29 changed files with 1,413 additions and 171 deletions.
Binary file added .DS_Store
Binary file not shown.
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
if: ${{ matrix.language == 'c-cpp' }}

- name: Initialize CodeQL
uses: github/codeql-action/init@d68b2d4edb4189fd2a5366ac14e72027bd4b37dd # v3.28.2
uses: github/codeql-action/init@f6091c0113d1dcf9b98e269ee48e8a7e51b7bdd4 # v3.28.5
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql/codeql-config.yml
Expand All @@ -82,6 +82,6 @@ jobs:
run: .github/workflows/build_ubuntu-22.04.sh "${HOME}/install"

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@d68b2d4edb4189fd2a5366ac14e72027bd4b37dd # v3.28.2
uses: github/codeql-action/analyze@f6091c0113d1dcf9b98e269ee48e8a7e51b7bdd4 # v3.28.5
with:
category: "/language:${{matrix.language}}"
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@67a2d409c0a876cbe6b11854e3e25193efe4e62d # v6.12.0
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6.13.0
with:
push: true
pull: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ jobs:
coverage html
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v5.1.2
uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v5.3.1
with:
verbose: true
flags: pytest-python-${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ jobs:
path: bandit.sarif

- name: Upload SARIF File into Security Tab
uses: github/codeql-action/upload-sarif@d68b2d4edb4189fd2a5366ac14e72027bd4b37dd # v3.28.2
uses: github/codeql-action/upload-sarif@f6091c0113d1dcf9b98e269ee48e8a7e51b7bdd4 # v3.28.5
with:
sarif_file: bandit.sarif

Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ repos:
- id: ruff
args: [--fix, --preview]
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.43.0
rev: v0.44.0
hooks:
- id: markdownlint-fix
# Using this mirror lets us use mypyc-compiled black, which is about 2x faster
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# syntax=docker/dockerfile:1.12@sha256:93bfd3b68c109427185cd78b4779fc82b484b0b7618e36d0f104d4d801e66d25
# syntax=docker/dockerfile:1.13@sha256:426b85b823c113372f766a963f68cfd9cd4878e1bcc0fda58779127ee98a28eb

# Note: This file must be kept in sync in ./Dockerfile and ./docker/ubuntu/Dockerfile.
# Changes to this file must be copied over to the other file.
Expand Down
2 changes: 1 addition & 1 deletion docker/ubuntu/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# syntax=docker/dockerfile:1.12@sha256:93bfd3b68c109427185cd78b4779fc82b484b0b7618e36d0f104d4d801e66d25
# syntax=docker/dockerfile:1.13@sha256:426b85b823c113372f766a963f68cfd9cd4878e1bcc0fda58779127ee98a28eb

# Note: This file must be kept in sync in ./Dockerfile and ./docker/ubuntu/Dockerfile.
# Changes to this file must be copied over to the other file.
Expand Down
2 changes: 1 addition & 1 deletion gui/wxpython/vdigit/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"""

try:
from vdigit.wxdigit import IVDigit, GV_LINES, CFUNCTYPE # noqa: F401
from vdigit.wxdigit import IVDigit, GV_LINES # noqa: F401

haveVDigit = True
errorMsg = ""
Expand Down
167 changes: 149 additions & 18 deletions gui/wxpython/vdigit/wxdigit.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,152 @@
@author Martin Landa <landa.martin gmail.com>
"""

import grass.script.core as grass

from grass.pydispatch.signal import Signal
import os
import sys
from ctypes import byref, c_double, c_int, create_string_buffer, pointer

from core.gcmd import GError
import grass.script.core as grass
from core.debug import Debug
from core.gcmd import GError
from core.settings import UserSettings
from vdigit.wxdisplay import DisplayDriver, GetLastError

try:
from grass.lib.gis import *
from grass.lib.vector import *
from grass.lib.vedit import *
from grass.lib.dbmi import *
from grass.lib.dbmi import (
DB_C_TYPE_STRING,
DB_NEXT,
DB_OK,
DB_SEQUENTIAL,
db_append_string,
db_close_database_shutdown_driver,
db_convert_column_value_to_string,
db_execute_immediate,
db_fetch,
db_get_column_name,
db_get_column_sqltype,
db_get_column_value,
db_get_cursor_table,
db_get_string,
db_get_table_column,
db_get_table_number_of_columns,
db_init_handle,
db_init_string,
db_open_database,
db_open_select_cursor,
db_set_handle,
db_set_string,
db_shutdown_driver,
db_sqltype_to_Ctype,
db_start_driver,
db_test_value_isnull,
dbCursor,
dbHandle,
dbString,
)
from grass.lib.gis import (
GMAPSET_MAX,
GNAME_MAX,
G_find_vector2,
G_free,
G_name_is_fully_qualified,
)
from grass.lib.vector import (
GV_AREA,
GV_BOUNDARY,
GV_CENTROID,
GV_LINE,
GV_LINES,
GV_POINT,
GV_POINTS,
GV_TOPO_PSEUDO,
WITHOUT_Z,
Map_info,
Vect_append_point,
Vect_area_alive,
Vect_get_area_perimeter,
Vect_break_lines_list,
Vect_cat_set,
Vect_cidx_get_cat_by_index,
Vect_cidx_get_field_number,
Vect_cidx_get_num_cats_by_index,
Vect_cidx_get_num_fields,
Vect_close,
Vect_delete_line,
Vect_destroy_boxlist,
Vect_destroy_cats_struct,
Vect_destroy_line_struct,
Vect_destroy_list,
Vect_field_cat_del,
Vect_get_area_area,
Vect_get_area_boundaries,
Vect_get_area_centroid,
Vect_get_area_points,
Vect_get_centroid_area,
Vect_get_dblink,
Vect_get_field,
Vect_get_finfo_geometry_type,
Vect_get_finfo_topology_info,
Vect_get_line_areas,
Vect_get_line_box,
Vect_get_line_type,
Vect_get_mapset,
Vect_get_name,
Vect_get_num_dblinks,
Vect_get_num_lines,
Vect_get_num_updated_lines,
Vect_get_point_in_area,
Vect_get_updated_line,
Vect_get_updated_line_offset,
Vect_is_3d,
Vect_line_alive,
Vect_line_check_intersection,
Vect_line_length,
Vect_list_append,
Vect_new_boxlist,
Vect_new_cats_struct,
Vect_new_line_struct,
Vect_new_list,
Vect_open_old,
Vect_points_distance,
Vect_read_line,
Vect_reset_cats,
Vect_reset_line,
Vect_reset_updated,
Vect_restore_line,
Vect_rewrite_line,
Vect_select_lines_by_box,
Vect_select_lines_by_polygon,
Vect_set_updated,
Vect_snap_lines_list,
Vect_write_line,
bound_box,
)
from grass.lib.vedit import (
NO_SNAP,
SNAP,
SNAPVERTEX,
Vedit_add_vertex,
Vedit_bulk_labeling,
Vedit_chtype_lines,
Vedit_connect_lines,
Vedit_copy_lines,
Vedit_delete_area_centroid,
Vedit_delete_lines,
Vedit_flip_lines,
Vedit_merge_lines,
Vedit_move_lines,
Vedit_move_vertex,
Vedit_remove_vertex,
Vedit_select_by_query,
Vedit_snap_line,
Vedit_split_lines,
QUERY_UNKNOWN,
QUERY_LENGTH,
QUERY_DANGLE,
)
except (ImportError, OSError, TypeError) as e:
print("wxdigit.py: {}".format(e), file=sys.stderr)
from grass.pydispatch.signal import Signal
from vdigit.wxdisplay import DisplayDriver, GetLastError


class VDigitError:
Expand Down Expand Up @@ -756,7 +886,7 @@ def _getCategories(self, ln_id):
:return: None feature does not exist
"""
if not Vect_line_alive(self.poMapInfo, ln_id):
return none
return None

poCats = Vect_new_cats_struct()
if Vect_read_line(self.poMapInfo, None, poCats, ln_id) < 0:
Expand Down Expand Up @@ -886,7 +1016,7 @@ def MoveSelectedLines(self, move):

if nlines > 0 and self._settings["breakLines"]:
for i in range(1, nlines):
self._breakLineAtIntersection(nlines + i, None, changeset)
self._breakLineAtIntersection(nlines + i, None)

if nlines > 0:
self._addChangeset()
Expand Down Expand Up @@ -1086,6 +1216,7 @@ def EditLine(self, line, coords):
self.poMapInfo, line, ltype, self.poPoints, self.poCats
)
if newline > 0 and self.emit_signals:
new_bboxs = [self._getBbox(newline)]
new_areas_cats = [self._getLineAreasCategories(newline)]

if newline > 0 and self._settings["breakLines"]:
Expand Down Expand Up @@ -1486,7 +1617,7 @@ def GetLineLength(self, line):
ltype = Vect_read_line(self.poMapInfo, self.poPoints, None, line)
if ltype < 0:
self._error.ReadLine(line)
return ret
return -1

length = -1
if ltype & GV_LINES: # lines & boundaries
Expand All @@ -1507,8 +1638,8 @@ def GetAreaSize(self, centroid):

ltype = Vect_read_line(self.poMapInfo, None, None, centroid)
if ltype < 0:
self._error.ReadLine(line)
return ret
self._error.ReadLine(centroid)
return -1

if ltype != GV_CENTROID:
return -1
Expand Down Expand Up @@ -1536,8 +1667,8 @@ def GetAreaPerimeter(self, centroid):

ltype = Vect_read_line(self.poMapInfo, None, None, centroid)
if ltype < 0:
self._error.ReadLine(line)
return ret
self._error.ReadLine(centroid)
return -1

if ltype != GV_CENTROID:
return -1
Expand All @@ -1549,7 +1680,7 @@ def GetAreaPerimeter(self, centroid):
return -1

Vect_get_area_points(self.poMapInfo, area, self.poPoints)
perimeter = Vect_area_perimeter(self.poPoints)
perimeter = Vect_get_area_perimeter(self.poPoints)

return perimeter

Expand Down Expand Up @@ -1943,7 +2074,7 @@ def _addFeature(self, ftype, coords, layer, cat, snap, threshold):
)
if newc < 0:
self._error.WriteLine()
return len(fids, fids)
return len(fids), fids
fids.append(newc)

Vect_destroy_line_struct(bpoints)
Expand Down
Binary file added raster/.DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion raster/r.describe/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ MODULE_TOPDIR = ../..

PGM = r.describe

LIBES = $(RASTERLIB) $(GISLIB)
LIBES = $(RASTERLIB) $(GISLIB) $(PARSONLIB)
DEPENDENCIES = $(RASTERDEP) $(GISDEP)

include $(MODULE_TOPDIR)/include/Make/Module.make
Expand Down
12 changes: 7 additions & 5 deletions raster/r.describe/describe.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@
#include <grass/gis.h>
#include <grass/raster.h>
#include <grass/glocale.h>

#include "local_proto.h"

int describe(const char *name, int compact, char *no_data_str, int range,
int windowed, int nsteps, int as_int, int skip_nulls)
int windowed, int nsteps, int as_int, int skip_nulls,
enum OutputFormat format)
{
int fd;
struct Cell_stats statf;
Expand Down Expand Up @@ -127,20 +129,20 @@ int describe(const char *name, int compact, char *no_data_str, int range,
if (range) {
if (compact)
compact_range_list(negmin, negmax, zero, posmin, posmax, null,
no_data_str, skip_nulls);
no_data_str, skip_nulls, format);
else
range_list(negmin, negmax, zero, posmin, posmax, null, no_data_str,
skip_nulls);
skip_nulls, format);
}
else {
Rast_rewind_cell_stats(&statf);

if (compact)
compact_list(&statf, dmin, dmax, no_data_str, skip_nulls, map_type,
nsteps);
nsteps, format);
else
long_list(&statf, dmin, dmax, no_data_str, skip_nulls, map_type,
nsteps);
nsteps, format);

Rast_free_cell_stats(&statf);
}
Expand Down
Loading

0 comments on commit a70d478

Please sign in to comment.