[general]
name=TopoTidy
qgisMinimumVersion=3.16
description=Processing tools for line network cleanup: removing disconnected segments, snapping gappy endpoints, finding dangles, trimming overshoots, extending undershoots, and removing duplicate lines (roads, rivers, pipes, etc.)
version=1.13.2
author=Muhammad Kholifatkhur Rohman
email=muhammadkoliatkhurrohman@gmail.com

about=TopoTidy adds line-network cleanup and polygon/point topology-rule checks to the QGIS Processing Toolbox: network cleanup tools ("Remove Disconnected Network Lines", "Snap Network Endpoints", "Find Dangling Endpoints", "Remove Duplicate Lines", "Trim", "Extend", "Split with Lines", "Multipart to Singleparts", "Dissolve", "Fix Geometry", "Simplify") plus topology rule checks ("Must Not Overlap", "Must Not Have Gaps", "Must Be Disjoint", "Must Not Intersect", "Must Not Self-Intersect", "Must Not Self-Overlap", "Must Not Have Pseudo Nodes", "Must Be Single Part"). Every fixer tool can either write a new fixed layer or edit the input layer in place. A dockable Topology panel drives the same rules from one place - pick the layers, build a Layer/Rule/Compared-to table, validate, then work through a dockable report that names the tool which fixes each kind of error, with a manual-editing toolbar (vertex, split, trim/extend, snapping) for the by-hand fixes, and re-validate until it is clean.

tracker=https://github.com/muhammadkholifatkhurrohman-spec/TopoTidy/issues
repository=https://github.com/muhammadkholifatkhurrohman-spec/TopoTidy

hasProcessingProvider=yes
tags=network,lines,topology,cleanup,roads,rivers,pipes,processing,connectivity,snap,dangles,duplicates,gaps,endpoints,trim,overshoot,extend,undershoot,validation,quality,coverage,containment

homepage=https://github.com/muhammadkholifatkhurrohman-spec/TopoTidy
category=Analysis
icon=icon.png
experimental=False
deprecated=False

server=False

changelog=1.13.2
  - Code quality: the 11 defensive "try / except / pass" blocks flagged by
    the plugin scanner now log the swallowed, non-fatal exception to the QGIS
    log (via a small qt_compat.log_quiet helper) instead of discarding it
    silently. Behaviour is unchanged - the plugin still never crashes on an
    optional operation - but failures are now traceable.
  - Packaging: plugin files are shipped with normal (non-executable) 0644
    permissions.

  1.13.1
  - Qt6 compatibility: removed the last two unscoped enum fallbacks flagged by
    the plugin checker (Qt.RightDockWidgetArea in topotidy_plugin.py and
    QgsFeatureRequest.GeometryNoCheck in output_mode.py). Both now resolve
    through getattr, so no unscoped enum literal remains and behaviour is
    unchanged on Qt5 and Qt6.

  1.13.0
  - New "Simplify" tool: removes vertices from lines and polygons while
    keeping their shape (Douglas-Peucker, snap-to-grid or Visvalingam), with
    a tolerance. Like the other tools it can write a new layer or - the
    default - edit the input in place, preserving feature ids. In the
    Processing Toolbox and on the panel's Cleanup tools.

  1.12.4
  - Fixed: "Fix Geometry" (and the other cleanup tools) aborted with
    "Feature (N) has invalid geometry. Please fix the geometry or change the
    Invalid features filtering option" the moment the input had an invalid
    feature - which for a geometry-repair tool is exactly the input it is
    meant to handle. The tools now read invalid features instead of stopping
    on them, so Fix Geometry, Split, Dissolve and Multipart to Singleparts
    run on messy data without needing the global Processing setting changed.

  1.12.3
  - Fixed: clicking through point errors in the report stopped zooming after
    a few of them. Each point zoom used to derive its window from the current
    (already zoomed-in) extent, shrinking the view ~25x per click until it
    collapsed to nothing. Point errors are now centred at a fixed close-up
    scale, so every one of them frames cleanly no matter how many you step
    through.

  1.12.2
  - Fixed: accepted exceptions came back as errors on "Validate again". The
    exceptions marked by hand in the report are now carried into the re-run
    (matched by rule and feature ids), the same way exceptions from a saved
    report are - so once an error is accepted it stays accepted across a
    re-validation of the same data, instead of the report flipping back from
    clean to "still has errors".

  1.12.1
  - Fixed a crash ("wrapped C/C++ object of type QgsVectorLayer has been
    deleted") when clicking an error in the report after its error layer had
    been removed from the project on a re-validation. Each error row now
    carries its own CRS, so zooming to an error never touches the error
    layer, and marking exceptions writes back to the layer only when it is
    still alive. Old error layers are also no longer removed until the
    replacement run has actually produced its own, so a failed re-validation
    can no longer leave the report pointing at deleted layers.

  1.12.0
  - New "Fix Geometry" tool: attempts to create a valid representation of an
    invalid geometry without losing any of the input vertices; already-valid
    geometries are returned without further intervention. New-layer mode
    always outputs a multi-geometry layer, exactly like the stock Fix
    geometries; in-place mode rewrites only the invalid features (valid ones
    keep their feature ids) and respects the input layer's own type, writing
    one feature per part on a single-part layer so nothing is lost.
  - Repair method choice: "Linework" (keeps the original line-work) or
    "Structure" (rebuilds shells and holes), matching the stock tool. Method-
    aware repair uses QGIS 3.28+; older builds fall back to the default
    make-valid.
  - Fix Geometry is in the Processing Toolbox, on the panel's Cleanup tools,
    and behind the report's "Fix Geometry" button (opened set to in place).
    Replaces the previous native:fixgeometries link.

  1.11.0
  - Dissolve now edits the input layer in place too, the same way Split and
    Multipart to Singleparts do: a TopoTidy "Dissolve" algorithm with the
    "Output mode" choice, defaulting to editing the input directly. Pick the
    field(s) to dissolve on (leave empty to merge everything), and the merged
    result replaces the input's features on the same layer. When the layer
    stores a single-part geometry type, each dissolved group is written back
    as one feature per connected part so nothing is dropped. The report's
    "Dissolve" fix button opens it already set to in place.
  - The validation report is no longer one crowded view. It is split into
    pages: "Report" (the rules summary and the errors of the selected rule),
    "How to fix" (the guidance and the fix buttons for that rule) and "Log".
    The verdict banner and the action buttons stay visible on every page, and
    a "How to fix" button on the Report page jumps straight to the fixes.

  1.10.0
  - Split and Multipart to Singleparts now edit the input layer in place.
    Both are TopoTidy algorithms with the same "Output mode" choice as the
    other fixer tools (new fixed shp/layer, or edit the input directly), and
    they default to editing in place - so fixing a crossing or exploding a
    multipart feature changes the layer already on the map instead of leaving
    a new copy to swap in. The report's "Fix with" buttons open them already
    set to in place.
      * "Split with Lines (at self-intersections)" nodes every crossing by
        splitting the layer against itself, then replaces the input's
        features with the result.
      * "Multipart to Singleparts" keeps the first part on the original
        feature and adds the rest as new features on the same layer.
  - Error layers are now managed for you: each validation makes fresh error
    layers, so the ones a previous run left on the map are pulled off before
    the next run and - if you had them showing - the new ones are put back
    automatically. No more piling up duplicate "Topology errors" layers and
    no more re-adding them by hand after "Validate again".
  - The validation report is now a dock panel instead of a floating window.
    Park it on the left, right or bottom edge of the canvas (it opens at the
    bottom by default) so it sits beside the map rather than covering it.
  - New "Manual editing" toolbar in the panel: icon buttons for Toggle
    editing, Vertex tool, Split features, Trim/Extend and Snapping, each with
    its QGIS tool icon, for the by-hand fixes that no automatic tool can
    decide. Clicking one points the map tools at the layer selected in the
    panel and starts editing it.

  1.9.0
  - Rebuilt the TopoTidy panel as a topology setup, in the order ArcGIS asks
    for: which layers take part, which rules they must obey, what the cluster
    tolerance is, then Validate. Rules now live in a Layer / Rule / Compared
    to table instead of a flat checkbox list, so the same layer can carry
    several rules and the two-layer rules can finally be reached from the
    panel. "Add SHP..." loads a shapefile straight into the map and the
    topology; "Add standard rules" ticks everything that applies in one press.
    The rule list is filtered to the geometry of the layer you picked, so an
    impossible combination cannot be built.
  - New report window, the equivalent of the ArcGIS Error Inspector: a green
    or red banner, one row per rule with its error count, and - the part a
    plain list of violations leaves out - the tool that repairs that kind of
    error, opened with the layer and tolerance already filled in. Dangles
    offer Extend / Snap Endpoints / Trim, crossings offer Split with Lines,
    coverage errors offer Snap Geometries, and where no tool can decide the
    answer the panel says so and offers to start editing instead.
  - New "Validate again" button: re-runs the same rules and shows each one as
    "37 -> 0 (fixed)" against the previous counts, with the banner reporting
    how much better or worse things got, and stating plainly when nothing is
    left to fix.
  - Reports can be saved as a standalone HTML page or a CSV.
  - Errors can be accepted as exceptions from the report; exceptions from a
    saved error layer can be carried into the next run.
  - The panel now holds its layers by id rather than by object, so removing a
    layer from the project no longer leaves it holding a dead reference.
  - New offline tests: tools/tests/test_rule_catalog.py checks every rule's
    algorithm name, parameters, output keys and attribute columns against the
    real algorithm sources (276 assertions), and tools/tests/test_report.py
    covers the counting, the before/after comparison and both export formats
    (33 assertions).

  1.8.1
  - Fixed: "Point Must Be Covered By Line" reported distance = -1 for
    practically every error. The candidate search window was only as wide
    as the tolerance, and an error point is by definition further away
    than that, so no nearest line was ever found. It now widens the search
    via the spatial index when a point misses, and reports the real
    distance - which is what makes the column sortable by severity.
  - Added tools/tests/: an offline test harness that runs the algorithms
    against a stub QGIS API, so the logic can be checked without a QGIS
    install. 41 assertions across the two-layer rules and the Validate
    Topology orchestration. See tools/tests/README.md for what this does
    and does not prove.

  1.8.0
  - New: the TopoTidy panel, a dock widget opened from the toolbar button
    or Vector > TopoTidy > TopoTidy Panel. Three numbered steps - pick the
    layers, tick the checks, review the results - so a full validation no
    longer means assembling a workflow out of Toolbox dialogs.
  - Clicking a result row zooms the map to that problem and highlights it,
    which is the piece the Processing Toolbox cannot offer.
  - Rows can be marked as acceptable (status "exception") straight from the
    panel, and the error layers can be added to the map in one click.
  - A "Fix things" section opens the geometry-changing tools (Snap, Trim,
    Extend, Remove Duplicates, Remove Disconnected) in their usual dialogs.
  - The panel is a front-end only: it runs the same validate_topology
    algorithm as the Toolbox, so results are identical either way and
    anything done in the panel can be reproduced in a model or script.

  1.7.0
  - New: "Validate Topology (run several rules at once)" - the batch
    validation pass. Pick a point, line and/or polygon layer, tick the
    rules to run, and every violation is collected into three error
    layers (point / line / polygon, since one layer cannot mix geometry
    types). Each error carries the same columns whichever rule produced
    it: rule, layer, fid_a, fid_b, value, status.
  - New: exception handling. Errors are written with status "new"; mark
    the acceptable ones as "exception", save the report, and pass it back
    via the "previous error layer" parameter on the next run to have them
    returned as exceptions instead of new violations. Matching is by rule
    plus feature IDs, so it survives geometry being redrawn.
  - Rules whose input layer was not supplied are skipped rather than
    failing the run, and a per-rule summary is printed to the log.

  1.6.0
  - New: topology rules that compare TWO layers, the ArcGIS-style
    "must ... of another feature class" checks. Cross-layer validation no
    longer requires leaving TopoTidy for the core Topology Checker:
      * Must Not Overlap With (polygon vs polygon)
      * Must Be Covered By Boundary Of (line vs polygon)
      * Point Must Be Covered By Line (point vs line, with an optional
        stricter "endpoints only" mode)
      * Must Be Inside (point or line vs polygon, with an optional
        "strictly inside" mode)
    All four take a tolerance, report the offending geometry itself (the
    overlap area, the uncovered stretch, the stray point), and warn in the
    log when the two layers use different CRSs.
  - New shared module topology_pairs.py holding the reference-layer
    indexing and candidate lookup used by every two-layer rule.
  - 4 new Before/After help illustrations, generated by the same script as
    the existing 14, so all 18 share identical type sizes and layout.

  1.5.1
  - All 14 help-panel Before/After illustrations regenerated from a single
    shared script (tools/make_illustrations.py), so every image now uses
    exactly the same type sizes: DejaVu Sans Bold 16 px for the
    BEFORE/AFTER label and DejaVu Serif Bold 12 px for the caption under
    each panel. Previously only "Extend" used the 12 px caption; the other
    13 illustrations rendered their caption at roughly a quarter of that
    size (3-4 px of ink), which was unreadable in the QGIS help panel.
  - Panel geometry, palette and the arrow between panels are now identical
    across all 14 images.
  - Captions reworded for consistency (the previous ones were too small to
    read); edit the SPECS table in tools/make_illustrations.py and re-run
    the script to change any wording.

  1.5.0
  - New tool: "Extend" - the counterpart to "Trim". Extends dangling
    "undershoot" line endpoints forward, along the direction of their
    final segment, until they meet another feature (closing small gaps
    left where a line was digitized a little short of a junction).
    Includes the same "Max extend length" / "Junction tolerance"
    parameters and "Output mode" (new layer vs. in-place) choice as the
    other fixer tools.

  1.4.0
  - All help-panel illustrations redrawn from scratch: fully in English
    (was Indonesian "SEBELUM/SESUDAH"), pixel-precise and perfectly
    aligned (previously hand-drawn shapes could look slightly offset/
    jittery), and generally clearer - especially "Must Not Have Gaps",
    which now uses two simple rectangles with an obvious gap instead of
    an oddly-shaped pair of polygons.
  - New tool: "Trim" - trims short dangling overshoot spurs in a line
    network back to the nearest real junction.
  - Every geometry-changing ("fixer") tool - Snap Network Endpoints,
    Remove Duplicate Lines, Remove Disconnected Network Lines, and the
    new Trim - now has an "Output mode" choice: create a brand-new
    fixed shp/layer (input untouched, previous behaviour), or edit the
    input layer directly in place with no new output created at all.
  - "Must Be Disjoint" is no longer report-only: it now has an "Edit
    mode" choice of Report only / Move overlapping points apart / Delete
    one point from each overlapping cluster, combined with the same new
    Output mode (new layer vs. in-place) when a fix mode is selected.
  - Help text and category badges for every tool translated to English
    and clarified.

  1.3.0
  - Added a Before/After illustration to every tool's help panel showing
    what the algorithm does to sample geometry.
  - Added a clear category badge at the top of every tool's help panel:
    "creates a new FIXED shp/layer" for the 3 network-cleanup tools (Snap
    Network Endpoints, Remove Duplicate Lines, Remove Disconnected Network
    Lines), or "creates a new REPORT-only shp/layer, input untouched" for
    the 9 topology-rule-check tools.

  1.2.1
  - Fixed 49 Qt6-incompatible unscoped enum references (e.g.
    QgsFeatureSink.FastInsert -> QgsFeatureSink.Flag.FastInsert,
    QgsProcessing.TypeVectorLine -> QgsProcessing.SourceType.TypeVectorLine)
    across all algorithm files, for compatibility with upcoming Qt6-based
    QGIS builds. No behavior change; fully-qualified enum paths work
    identically on current Qt5-based QGIS.

  1.2.0
  - Must Not Intersect: split the single output into two typed outputs
    (Crossing errors / Overlap errors). The old single output silently
    dropped features whenever a run produced both point and line errors.
  - Must Not Self-Intersect: fixed a wrap-around check that incorrectly
    skipped a real self-crossing between a line's first and last segment
    on open (non-closed) lines.
  - Must Not Self-Overlap: fixed an overly broad adjacent-segment skip
    that could miss a "spike" (a line doubling back over itself using
    two adjacent segments).
