Skip to content

Commit

Permalink
merge util.js + colors.js and modify function name
Browse files Browse the repository at this point in the history
  • Loading branch information
lancard committed Jun 26, 2024
1 parent 4d5dafa commit bfd81ad
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 25 deletions.
3 changes: 1 addition & 2 deletions sector.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const fs = require('fs');
const path = require('path');
const util = require('./util.js');
const colorUtil = require('./sectorutils/colors.js')

function getSidStarLatitudeLongitudeString(fixOrCoord) {
if (fixOrCoord.length < 10) {
Expand Down Expand Up @@ -76,7 +75,7 @@ module.exports = {
["FIR-Label", 0x50, 0x50, 0x70],
["Test-White", 0xff, 0xff, 0xff],
["Test-Yellow", 0xff, 0xff, 0x00]
].map((color) => colorUtil.makeColorDefine(color[0], colorUtil.rgb2BgrInt(color[1], color[2], color[3]))).join("\n");
].map((color) => util.makeColorDefine(color[0], util.convertRgbtoSectorInteger(color[1], color[2], color[3]))).join("\n");
},
getInfo() {
return `Incheon vACC (${gitHeadDateTime.format("YYYYMMDD_HHmmss")})\n` +
Expand Down
23 changes: 0 additions & 23 deletions sectorutils/colors.js

This file was deleted.

18 changes: 18 additions & 0 deletions util.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,23 @@ module.exports = {
return false;

return true;
},
/**
* 직관적으로 인식 가능한 RGB 색상을 유로스코프의 십진수 BGR로 변환합니다.
* @param {*} r 빨강 채널(10진수)
* @param {*} g 초록 채널(10진수)
* @param {*} b 파랑 채널(10진수)
*/
convertRgbtoSectorInteger(r, g, b){
return r + g * 0x01_00 + b * 0x01_00_00;
},
/**
* 유로스코프의 색상 정의 문자열을 생성합니다.
* @param {*} name 색상의 이름은 무엇입니까?
* @param {*} colorInt 이 색상의 BGR 10진수 정수 값은 무엇입니까?
* @returns
*/
makeColorDefine(name, colorInt){
return "#define " + name + " " + colorInt;
}
}

0 comments on commit bfd81ad

Please sign in to comment.