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