tww
.tww_app
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
ft_vw_tww_reach_update()
Parameters
Name
Type
Mode
IN
Definition
BEGIN -- Synchronize geometry with level IF NEW.rp_from_level <> OLD.rp_from_level OR (NEW.rp_from_level IS NULL AND OLD.rp_from_level IS NOT NULL) OR (NEW.rp_from_level IS NOT NULL AND OLD.rp_from_level IS NULL) THEN NEW.progression3d_geometry = ST_ForceCurve(ST_SetPoint(ST_CurveToLine(NEW.progression3d_geometry),0, ST_MakePoint(ST_X(ST_StartPoint(NEW.progression3d_geometry)),ST_Y(ST_StartPoint(NEW.progression3d_geometry)),COALESCE(NEW.rp_from_level,'NaN')))); ELSE IF ST_Z(ST_StartPoint(NEW.progression3d_geometry)) <> ST_Z(ST_StartPoint(OLD.progression3d_geometry)) THEN NEW.rp_from_level = NULLIF(ST_Z(ST_StartPoint(NEW.progression3d_geometry)),'NaN'); END IF; END IF; -- Synchronize geometry with level IF NEW.rp_to_level <> OLD.rp_to_level OR (NEW.rp_to_level IS NULL AND OLD.rp_to_level IS NOT NULL) OR (NEW.rp_to_level IS NOT NULL AND OLD.rp_to_level IS NULL) THEN NEW.progression3d_geometry = ST_ForceCurve(ST_SetPoint(ST_CurveToLine(NEW.progression3d_geometry),ST_NumPoints(NEW.progression3d_geometry)-1, ST_MakePoint(ST_X(ST_EndPoint(NEW.progression3d_geometry)),ST_Y(ST_EndPoint(NEW.progression3d_geometry)),COALESCE(NEW.rp_to_level,'NaN')))); ELSE IF ST_Z(ST_EndPoint(NEW.progression3d_geometry)) <> ST_Z(ST_EndPoint(OLD.progression3d_geometry)) THEN NEW.rp_to_level = NULLIF(ST_Z(ST_EndPoint(NEW.progression3d_geometry)),'NaN'); END IF; END IF; UPDATE tww_od.reach_point SET elevation_accuracy = NEW.rp_from_elevation_accuracy , fk_dataowner = NEW.rp_from_fk_dataowner , fk_provider = NEW.rp_from_fk_provider , fk_wastewater_networkelement = NEW.rp_from_fk_wastewater_networkelement , identifier = NEW.rp_from_identifier , last_modification = NEW.rp_from_last_modification , level = NEW.rp_from_level , outlet_shape = NEW.rp_from_outlet_shape , pipe_closure = NEW.rp_from_pipe_closure , position_of_connection = NEW.rp_from_position_of_connection , remark = NEW.rp_from_remark , situation3d_geometry = ST_StartPoint(NEW.progression3d_geometry) WHERE obj_id = OLD.rp_from_obj_id; UPDATE tww_od.reach_point SET elevation_accuracy = NEW.rp_to_elevation_accuracy , fk_dataowner = NEW.rp_to_fk_dataowner , fk_provider = NEW.rp_to_fk_provider , fk_wastewater_networkelement = NEW.rp_to_fk_wastewater_networkelement , identifier = NEW.rp_to_identifier , last_modification = NEW.rp_to_last_modification , level = NEW.rp_to_level , outlet_shape = NEW.rp_to_outlet_shape , pipe_closure = NEW.rp_to_pipe_closure , position_of_connection = NEW.rp_to_position_of_connection , remark = NEW.rp_to_remark , situation3d_geometry = ST_EndPoint(NEW.progression3d_geometry) WHERE obj_id = OLD.rp_to_obj_id; UPDATE tww_od.channel SET bedding_encasement = NEW.ch_bedding_encasement , connection_type = NEW.ch_connection_type , function_amelioration = NEW.ch_function_amelioration , function_hierarchic = NEW.ch_function_hierarchic , function_hydraulic = NEW.ch_function_hydraulic , jetting_interval = NEW.ch_jetting_interval , pipe_length = NEW.ch_pipe_length , seepage = NEW.ch_seepage , usage_current = NEW.ch_usage_current , usage_planned = NEW.ch_usage_planned WHERE obj_id = OLD.ws_obj_id; UPDATE tww_od.wastewater_structure SET _bottom_label = NEW.ws__bottom_label , _cover_label = NEW.ws__cover_label -- , _depth = NEW.ws__depth , _input_label = NEW.ws__input_label -- , _label = NEW.ws__label , _output_label = NEW.ws__output_label , accessibility = NEW.ws_accessibility , condition_score = NEW.ws_condition_score , contract_section = NEW.ws_contract_section -- , detail_geometry3d_geometry = NEW.ws_detail_geometry3d_geometry , elevation_determination = NEW.ws_elevation_determination , financing = NEW.ws_financing , fk_dataowner = NEW.fk_dataowner -- , fk_main_cover = NEW.ws_fk_main_cover , fk_main_wastewater_node = NEW.ws_fk_main_wastewater_node , fk_operator = NEW.ws_fk_operator , fk_owner = NEW.ws_fk_owner , fk_provider = NEW.fk_provider , gross_costs = NEW.ws_gross_costs , identifier = NEW.ws_identifier , inspection_interval = NEW.ws_inspection_interval , last_modification = NEW.last_modification , location_name = NEW.ws_location_name , records = NEW.ws_records , remark = NEW.ws_remark , renovation_necessity = NEW.ws_renovation_necessity , replacement_value = NEW.ws_replacement_value , rv_base_year = NEW.ws_rv_base_year , rv_construction_type = NEW.ws_rv_construction_type , status = NEW.ws_status , status_survey_year = NEW.ws_status_survey_year , structure_condition = NEW.ws_structure_condition , subsidies = NEW.ws_subsidies , urgency_figure = NEW.ws_urgency_figure , year_of_construction = NEW.ws_year_of_construction , year_of_replacement = NEW.ws_year_of_replacement WHERE obj_id = OLD.ws_obj_id; UPDATE tww_od.wastewater_networkelement SET fk_dataowner = NEW.fk_dataowner , fk_provider = NEW.fk_provider , fk_wastewater_structure = NEW.ws_obj_id , identifier = NEW.identifier , last_modification = NEW.last_modification , remark = NEW.remark WHERE obj_id = OLD.obj_id; UPDATE tww_od.reach SET clear_height = NEW.clear_height , coefficient_of_friction = NEW.coefficient_of_friction , elevation_determination = NEW.elevation_determination , fk_pipe_profile = NEW.fk_pipe_profile -- , fk_reach_point_from = NEW.fk_reach_point_from -- , fk_reach_point_to = NEW.fk_reach_point_to , flow_time_dry_weather = NEW.flow_time_dry_weather , horizontal_positioning = NEW.horizontal_positioning , hydraulic_load_current = NEW.hydraulic_load_current , inside_coating = NEW.inside_coating , leak_protection = NEW.leak_protection , length_effective = NEW.length_effective , material = NEW.material , progression3d_geometry = NEW.progression3d_geometry , reliner_material = NEW.reliner_material , reliner_nominal_size = NEW.reliner_nominal_size , relining_construction = NEW.relining_construction , relining_kind = NEW.relining_kind , ring_stiffness = NEW.ring_stiffness , slope_building_plan = NEW.slope_building_plan , swmm_default_coefficient_of_friction = NEW.swmm_default_coefficient_of_friction , wall_roughness = NEW.wall_roughness WHERE obj_id = OLD.obj_id; RETURN NEW; END;