public int compareModuleAdd(ModuleOne gp)//比较两个模块的位置并范围对应的位置类型 { if (posx == gp.getPosx()) { if (posy > gp.getPosy()) { if (posy - gp.getPosy() > mody) { return(10);//up } else { return(1); } } if (posy < gp.getPosy()) { if (gp.getPosy() - posy > mody) { return(14); } else { return(5); } } } if (posx < gp.getPosx()) { if (posy > gp.getPosy()) { if (posy - gp.getPosy() > mody) { if (gp.getPosx() - posx > modx) { return(18); } else { return(11); } } else { return(2); } } if (posy == gp.getPosy()) { if (gp.getPosx() - posx > modx) { return(12); } else { return(3); } } if (posy < gp.getPosy()) { if (gp.getPosy() - posy > mody) { if (gp.getPosx() - posx > modx) { return(19); } else { return(13); } } else { return(4); } } } if (posx > gp.getPosx()) { if (posy < gp.getPosy()) { if (gp.getPosy() - posy > mody) { if (posx - gp.getPosx() > modx) { return(20); } else { return(15); } } else { return(6); } } if (posy == gp.getPosy()) { if (posx - gp.getPosx() > modx) { return(16); } else { return(7); } } if (posy > gp.getPosy()) { if (posy - gp.getPosy() > mody) { if (posx - gp.getPosx() > modx) { return(17); } else { return(9); } } else { return(8); } } } return(0); }
public GridPoint goWestStepVertex(ModuleOne m, int i, int step) { return(myGrid.gridPointAt(m.getPosx() - (i + 1) * step, posy)); }
public GridPoint goEastStepVertex(ModuleOne m, int i, int step) { return(myGrid.gridPointAt(m.getPosx() + m.getWidth0() + ModuleOne.gapx - (i + 1) * step, posy)); }
public void computeRowColumn(ModuleOne mi, ModuleOne mj, int com, int[] rows, int[] columns) //根据模块之间的位置关系,记录每个模块每条边的引脚数量,记录每个区域关系线的数量 { switch (com) { case 1: mi.addNumNorthOne(); mj.addNumSouthOne(); break; case 2: case 8: mi.addNumNorthOne(); mj.addNumSouthOne(); rows[mi.getPosy() / ModuleOne.mody] += 1; break; case 3: mi.addNumEastOne(); mj.addNumWestOne(); break; case 4: case 6: mi.addNumSouthOne(); mj.addNumNorthOne(); rows[mi.getPosy() / ModuleOne.mody + 1] += 1; break; case 5: mi.addNumSouthOne(); mj.addNumNorthOne(); break; case 7: mi.addNumWestOne(); mj.addNumEastOne(); break; case 9: case 15: mi.addNumWestOne(); mj.addNumEastOne(); columns[mi.getPosx() / ModuleOne.modx - 1] += 1; break; case 10: case 14: mi.addNumEastOne(); mj.addNumEastOne(); columns[mi.getPosx() / ModuleOne.modx] += 1; break; case 11: case 13: mi.addNumEastOne(); mj.addNumWestOne(); columns[mi.getPosx() / ModuleOne.modx] += 1; break; case 12: case 16: mi.addNumNorthOne(); mj.addNumNorthOne(); rows[mi.getPosy() / ModuleOne.mody] += 1; break; case 17: mi.addNumNorthOne(); mj.addNumEastOne(); rows[mi.getPosy() / ModuleOne.mody] += 1; columns[mj.getPosx() / ModuleOne.modx] += 1; break; case 18: mi.addNumNorthOne(); mj.addNumWestOne(); rows[mi.getPosy() / ModuleOne.mody] += 1; columns[mj.getPosx() / ModuleOne.modx - 1] += 1; break; case 19: mi.addNumSouthOne(); mj.addNumWestOne(); rows[mi.getPosy() / ModuleOne.mody + 1] += 1; columns[mj.getPosx() / ModuleOne.modx - 1] += 1; break; case 20: mi.addNumSouthOne(); mj.addNumEastOne(); rows[mi.getPosy() / ModuleOne.mody + 1] += 1; columns[mj.getPosx() / ModuleOne.modx] += 1; break; default: break; } }