tww
.tww_app
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
symbology_calculate_reach_length()
Parameters
Name
Type
Mode
IN
Definition
DECLARE _rp_from_level numeric(7,3); _rp_to_level numeric(7,3); BEGIN SELECT rp_from.level INTO _rp_from_level FROM tww_od.reach_point rp_from WHERE NEW.fk_reach_point_from = rp_from.obj_id; SELECT rp_to.level INTO _rp_to_level FROM tww_od.reach_point rp_to WHERE NEW.fk_reach_point_to = rp_to.obj_id; IF _rp_from_level=0 OR _rp_to_level=0 THEN NEW.length_effective = ST_Length(NEW.progression3d_geometry); ELSE NEW.length_effective = COALESCE(sqrt((_rp_from_level - _rp_to_level)^2 + ST_Length(NEW.progression3d_geometry)^2), ST_Length(NEW.progression3d_geometry) ); END IF; RETURN NEW; END;