Skip to content

Commit

Permalink
create support and azimut from view
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Feb 14, 2024
1 parent 347a873 commit 434c496
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion datamodel/app/vw_azimut_edit.sql
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ CREATE FUNCTION signalo_app.ft_azimut_insert() RETURNS trigger
END IF;
SELECT id FROM signalo_db.support s WHERE ST_Equals(s.geometry, ST_StartPoint(NEW.geometry)) INTO support_id;
IF support_id IS NULL THEN
RAISE EXCEPTION 'Could not find a support at the start of the line';
INSERT INTO signalo_db.support (geometry) VALUES (ST_StartPoint(NEW.geometry)) RETURNING id INTO support_id;
IF support_id IS NULL THEN
RAISE EXCEPTION 'Could not create a support';
END IF;
END IF;
INSERT INTO signalo_db.azimut (fk_support, azimut) VALUES (support_id, degrees(ST_Azimuth(ST_StartPoint(NEW.geometry), ST_EndPoint(NEW.geometry))));
RETURN NEW;
Expand Down
2 changes: 1 addition & 1 deletion test/official_sign_images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ for _IMG_DIR in "${_IMG_DIRS[@]}"; do
elif [[ ${_IMG_DIR} = editable ]]; then
ih=$(exiftool -ImageHeight ${FILE} | sed "s/.*: //;s/pt//g")
iw=$(exiftool -ImageWidth ${FILE} | sed "s/.*: //;s/pt//g")
tsize=$(psql -t -c "SELECT img_width,img_height FROM signalo_db.vl_official_sign WHERE img_de='${IMAGE}' OR img_fr='${IMAGE}' OR img_it='${IMAGE}' OR img_ro='${IMAGE}' OR img_de_right='${IMAGE}' OR img_fr_right='${IMAGE}' OR img_it_right='${IMAGE}' OR img_ro_right='${IMAGE}'")
tsize=$(psql -t -c "SELECT img_width,img_height FROM signalo_db.vl_official_sign WHERE img_de='${IMAGE}' OR img_fr='${IMAGE}' OR img_it='${IMAGE}' OR img_ro='${IMAGE}' OR img_de_right='${IMAGE}' OR img_fr_right='${IMAGE}' OR img_it_right='${IMAGE}' OR img_ro_right='${IMAGE}'")
tw=$(echo ${tsize} | cut -d\| -f1)
th=$(echo ${tsize} | cut -d\| -f2)
ir=$(echo "${ih}/${iw}" | bc -l)
Expand Down

0 comments on commit 434c496

Please sign in to comment.