Commit d87eef10 authored by jaehyu's avatar jaehyu

location coordinate

parent 1b8504da
......@@ -6,18 +6,13 @@ package com.skt.ehs.mbs.fpbuilder;
public class BLECell {
private int ble_cell_id;
private double location_x;
private double location_y; // 실거리 ??
private double rssi_min;
private double rssi_max;
private double rssi_avg;
private double rssi_std_dev;
private int rssi_dir;
private int location_x;
private int location_y; // 실거리 ??
BLECell(int id) {
ble_cell_id = id;
}
double mag_angle; // 해당 cell의 각 수집방향에 대하여 수집된 지자기방향의 평균값으로 대표
public int getBle_cell_id() {
return ble_cell_id;
......@@ -27,69 +22,22 @@ public class BLECell {
this.ble_cell_id = ble_cell_id;
}
public double getLocation_x() {
public int getLocation_x() {
return location_x;
}
public void setLocation_x(double location_x) {
public void setLocation_x(int location_x) {
this.location_x = location_x;
}
public double getLocation_y() {
public int getLocation_y() {
return location_y;
}
public void setLocation_y(double location_y) {
public void setLocation_y(int location_y) {
this.location_y = location_y;
}
public double getRssi_min() {
return rssi_min;
}
public void setRssi_min(double rssi_min) {
this.rssi_min = rssi_min;
}
public double getRssi_max() {
return rssi_max;
}
public void setRssi_max(double rssi_max) {
this.rssi_max = rssi_max;
}
public double getRssi_avg() {
return rssi_avg;
}
public void setRssi_avg(double rssi_avg) {
this.rssi_avg = rssi_avg;
}
public double getRssi_std_dev() {
return rssi_std_dev;
}
public void setRssi_std_dev(double rssi_std_dev) {
this.rssi_std_dev = rssi_std_dev;
}
public int getRssi_dir() {
return rssi_dir;
}
public void setRssi_dir(int rssi_dir) {
this.rssi_dir = rssi_dir;
}
public double getMagnitude_angle() {
return mag_angle;
}
public void setMagnitude_angle(double magnitude_angle) {
this.mag_angle = magnitude_angle;
}
@Override
public String toString() {
......@@ -97,12 +45,6 @@ public class BLECell {
"ble_cell_id=" + ble_cell_id +
", location_x=" + location_x +
", location_y=" + location_y +
", rssi_min=" + rssi_min +
", rssi_max=" + rssi_max +
", rssi_avg=" + rssi_avg +
", rssi_std_dev=" + rssi_std_dev +
", rssi_dir=" + rssi_dir +
", mag_angle=" + mag_angle +
'}';
}
}
......@@ -3,6 +3,8 @@ package com.skt.ehs.mbs.fpbuilder;
import com.skt.ehs.mbs.db.maria.DBManager;
import com.skt.ehs.mbs.db.maria.MariaConnectionManager;
import java.util.Arrays;
public class BLEFPBuilder {
public static final int CELL_SIZE_BLE = 300;
......@@ -63,23 +65,55 @@ public class BLEFPBuilder {
return ret;
}
public boolean build() {
double scale_pixel = readMapScale();
System.out.println("scale_pixel : "+scale_pixel);
mFloor.setMap_scale_pixel(scale_pixel);
// Todo access DB & calculate factor & build fp.
// 수집방향 맵 준비
int[] temp = mFloor.loadRSSIDir();
System.out.println(Arrays.toString(temp));
/* Todo 8분위 되어 있는 기준값을 단말기에서 올려주는 값의 범위로 바꾸어 사용할 수 있도록 준비
switch case 사용
*/
// location coordinate 준비
BLECell bleCell = mFloor.getBLECell(3,5);
System.out.printf("Location : ("+bleCell.getLocation_x()+", "+bleCell.getLocation_y()+")");
System.out.println();
int coordinate_pixel_x1 = ( mFloor.getBLECell(3,5).getLocation_x() - CELL_SIZE_BLE/2 ) / (int)mFloor.getMap_scale_pixel();
int coordinate_pixel_y1 = ( mFloor.getBLECell(3,5).getLocation_y() - CELL_SIZE_BLE/2 ) / (int)mFloor.getMap_scale_pixel();
int coordinate_pixel_x2 = ( mFloor.getBLECell(3,5).getLocation_x() + CELL_SIZE_BLE/2 ) / (int)mFloor.getMap_scale_pixel();
int coordinate_pixel_y2 = ( mFloor.getBLECell(3,5).getLocation_y() + CELL_SIZE_BLE/2 ) / (int)mFloor.getMap_scale_pixel();
System.out.printf("Pixel Coordinate : ("+coordinate_pixel_x1+", "+coordinate_pixel_y1+") ("+coordinate_pixel_x2+", "+coordinate_pixel_y2+")");
System.out.println();
return true;
}
public static void main(String[] args) {
BLEFPBuilder blefpBuilder = new BLEFPBuilder((LENGTH_X % CELL_SIZE_BLE == 0)? LENGTH_X/CELL_SIZE_BLE : LENGTH_X/CELL_SIZE_BLE + 1,(WIDTH_Y % CELL_SIZE_BLE == 0)? WIDTH_Y/CELL_SIZE_BLE : WIDTH_Y/CELL_SIZE_BLE + 1); // mFloor
blefpBuilder.LoadCellID();
blefpBuilder.LoadCellLocation();
if (!blefpBuilder.LoadDBConnectionPool()) {
BLEFPBuilder bleFPBuilder = new BLEFPBuilder((LENGTH_X % CELL_SIZE_BLE == 0)? LENGTH_X/CELL_SIZE_BLE : LENGTH_X/CELL_SIZE_BLE + 1,(WIDTH_Y % CELL_SIZE_BLE == 0)? WIDTH_Y/CELL_SIZE_BLE : WIDTH_Y/CELL_SIZE_BLE + 1); // mFloor
bleFPBuilder.LoadCellID();
bleFPBuilder.LoadCellLocation();
if (!bleFPBuilder.LoadDBConnectionPool()) {
//exit
}
blefpBuilder.build();
bleFPBuilder.build();
}
}
......@@ -8,18 +8,24 @@ package com.skt.ehs.mbs.fpbuilder;
class Floor {
private int M;
private int N;
private BLECell[][] fp; // FingerPrint
private BLECell[][] cm; // cell matrix
// 수집방향
private final int[] rssi_dir = new int[]{1000000, 2000000, 3000000, 4000000, 5000000, 6000000, 7000000, 8000000};
// FingerPrint
public Floor(int M, int N) {
this.M = M;
this.N = N;
fp = new BLECell[M][N];
cm = new BLECell[M][N];
}
public void showCellID() {
for(int j=0;j< N;j++) {
for(int i=0;i< M; i++) {
System.out.printf("%9d ", fp[i][j].getBle_cell_id());
System.out.printf("%9d ", cm[i][j].getBle_cell_id());
}
System.out.println();
}
......@@ -28,7 +34,7 @@ class Floor {
public void showCellLocation() {
for(int j=0;j< N;j++) {
for(int i=0;i< M; i++) {
System.out.printf("("+fp[i][j].getLocation_x()+","+fp[i][j].getLocation_y()+")");
System.out.printf("("+cm[i][j].getLocation_x()+","+cm[i][j].getLocation_y()+")");
}
System.out.println();
}
......@@ -51,15 +57,16 @@ class Floor {
}
public BLECell getBLECell(int M, int N) {
return fp[M][N];
return cm[M][N];
}
public void setBLECell(int M, int N, BLECell bleCell) {
fp[M][N] = bleCell;
cm[M][N] = bleCell;
}
public void setBLECellLocation(int M, int N, int x, int y) {
fp[M][N].setLocation_x(x);
fp[M][N].setLocation_y(y);
cm[M][N].setLocation_x(x);
cm[M][N].setLocation_y(y);
}
double map_scale_pixel;
......@@ -81,4 +88,8 @@ class Floor {
public void setBle_cell_size(int ble_cell_size) {
this.ble_cell_size = ble_cell_size;
}
public int[] loadRSSIDir () {
return rssi_dir;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment