private static final Color COLOR_MAP_INSIDE = new Color(32, 115, 185);
private static final Color COLOR_MAP_OUTSIDE = new Color(19, 87, 148);
private static final Color COLOR_MAP_WALL = new Color(100, 196, 254);
+ private static final Color COLOR_CARPET = new Color(0xDF, 0xDF, 0xDF, 0xA0);
private static final Color COLOR_GREY_WALL = new Color(93, 109, 126);
private static final Color COLOR_PATH = new Color(147, 194, 238);
private static final Color COLOR_ZONES = new Color(0xAD, 0xD8, 0xFF, 0x8F);
}
}
+ /**
+ * draws the carpet map
+ */
+ private void drawCarpetMap(Graphics2D g2d, float scale) {
+ if (rmfp.getCarpetMap().length == 0) {
+ return;
+ }
+ Stroke stroke = new BasicStroke(1.1f * scale);
+ g2d.setStroke(stroke);
+ for (int y = 0; y < rmfp.getImgHeight() - 1; y++) {
+ for (int x = 0; x < rmfp.getImgWidth() + 1; x++) {
+ int carpetType = rmfp.getCarpetMap()[x + rmfp.getImgWidth() * y];
+ switch (carpetType) {
+ case 0:
+ // ignore
+ break;
+ default:
+ g2d.setColor(COLOR_CARPET);
+ float xPos = scale * (rmfp.getImgWidth() - x);
+ float yP = scale * y;
+ g2d.draw(new Line2D.Float(xPos, yP, xPos, yP));
+ break;
+ }
+ }
+ }
+ }
+
/**
* draws the vacuum path
*
tx.translate(-width, -height);
g2d.setTransform(tx);
drawMap(g2d, scale);
+ drawCarpetMap(g2d, scale);
drawZones(g2d, scale);
drawNoGo(g2d, scale);
drawWalls(g2d, scale);
public static final int NO_GO_AREAS = 9;
public static final int VIRTUAL_WALLS = 10;
public static final int BLOCKS = 11;
- public static final int MFBZS_AREA = 12;
+ public static final int MOB_FORBIDDEN_AREA = 12;
public static final int OBSTACLES = 13;
public static final int IGNORED_OBSTACLES = 14;
public static final int OBSTACLES2 = 15;
public static final int IGNORED_OBSTACLES2 = 16;
public static final int CARPET_MAP = 17;
+ public static final int MOP_PATH = 18;
+ public static final int CARPET_FORBIDDEN_AREA = 19;
public static final int DIGEST = 1024;
public static final int HEADER = 0x7272;
private Map<Integer, ArrayList<int[]>> obstacles = new HashMap<>();
private byte[] blocks = new byte[0];
private int[] carpetMap = {};
+ private int[] mopPath = {};
private final Logger logger = LoggerFactory.getLogger(RRMapFileParser.class);
}
break;
case NO_GO_AREAS:
- case MFBZS_AREA:
+ case MOB_FORBIDDEN_AREA:
+ case CARPET_FORBIDDEN_AREA:
int areaPairs = getUInt16(header, 0x08);
ArrayList<float[]> area = new ArrayList<float[]>();
for (int areaPair = 0; areaPair < areaPairs; areaPair++) {
carpetMap[carpetNode] = data[carpetNode] & 0xFF;
}
break;
+ case MOP_PATH:
+ mopPath = new int[blockDataLength];
+ for (int mopNode = 0; mopNode < blockDataLength; mopNode++) {
+ mopPath[mopNode] = data[mopNode] & 0xFF;
+ }
+ break;
case BLOCKS:
int blocksPairs = getUInt16(header, 0x08);
blocks = getBytes(data, 0, blocksPairs);
break;
default:
- logger.info("Unknown blocktype (pls report to author)");
+ logger.info("Unknown blocktype {} (pls report to author)", blocktype);
printBlockDetails = true;
}
if (logger.isTraceEnabled() || printBlockDetails) {
pw.printf("Robo pos:\tX: %.0f\tY: %.0f\tAngle: %d\r\n", getRoboX(), getRoboY(), getRoboA());
pw.printf("Goto:\tX: %.0f\tY: %.0f\r\n", getGotoX(), getGotoY());
for (Entry<Integer, ArrayList<float[]>> area : areas.entrySet()) {
- pw.print(area.getKey() == NO_GO_AREAS ? "No Go zones:\t" : "MFBZS zones:\t");
+ switch (area.getKey()) {
+ case NO_GO_AREAS:
+ pw.print("Regular No Go zones:\t");
+ break;
+ case MOB_FORBIDDEN_AREA:
+ pw.print("Mop No Go zones:\t");
+ break;
+ case CARPET_FORBIDDEN_AREA:
+ pw.print("Carpet No Go zones:\t");
+ break;
+ default:
+ pw.print("Unknown type zones:\t");
+ }
pw.printf("%d\r\n", area.getValue().size());
printAreaDetails(area.getValue(), pw);
}
}
}
pw.println();
+ pw.printf("Carpet Map:\t%d\r\n", carpetMap.length);
+ pw.printf("Mop Path:\t%d\r\n", mopPath.length);
pw.close();
return sw.toString();
}
public final int[] getCarpetMap() {
return carpetMap;
}
+
+ public final int[] getMopPath() {
+ return mopPath;
+ }
}