Package main

Examples of main.AuxiliarElement


        }
    }  
   
    public void showMap(int id, String type){
        Map aux = cjtMap.getMap(id);
        AuxiliarElement elem;
        List<String[]> dat = new ArrayList();
        Stack<AuxiliarElement> auxiliar = (Stack)aux.getCjtElement().clone();
        String [] list;
        int i=0;
        while(!auxiliar.isEmpty()){           
            elem = auxiliar.peek();
            auxiliar.pop();
            list = new String[6];          
            list[0] = elem.getName();
            list[1] = String.valueOf(elem.getDim().getX());
            list[2] = String.valueOf(elem.getDim().getY());
        
            switch (elem.getFlag()){
                    case 0:
                        list[3] = String.valueOf(elem.getFinalX());
                        list[4] = String.valueOf(elem.getFinalY());
                        break;
                    case 1:           
                        list[3] = String.valueOf(elem.getFinalX());
                        list[4] = String.valueOf(elem.getFinalY()-elem.getDim().getY()+1);                       
                        break;
                    case 2:
                        list[3] = String.valueOf(elem.getFinalX()-elem.getDim().getX()+1);
                        list[4] = String.valueOf(elem.getFinalY()-elem.getDim().getY());
                        break;
                    case 3:
                        list[3] = String.valueOf(elem.getFinalX()-elem.getDim().getX());
                        list[4] = String.valueOf(elem.getFinalY());
                        break;
           
           
            list[5] = "S";           
            dat.add(list);           
View Full Code Here


    /**
     * Visualiza la habitacion diseñada
     * Procesa los parametros necesarios para visualizar la habitacion.    
     */
    public void callGraphicInterface(){
        AuxiliarElement elem;
        List<String[]> dat = new ArrayList();       
        Stack<AuxiliarElement> auxiliar = (Stack)actualElements.clone();
        String [] list;
        while(!auxiliar.isEmpty()){
            elem = auxiliar.peek();
            auxiliar.pop();
            list = new String[6];          
            list[0] = this.configurationController.getCjtElementsController().getElement(elem.getIdObject()).getName();
            list[1] = String.valueOf(elem.getDim().getX());
            list[2] = String.valueOf(elem.getDim().getY());           
            list[5] = String.valueOf(elem.getId());
            switch (elem.getFlag()){
                    case 0:
                        list[3] = String.valueOf(elem.getFinalX());
                        list[4] = String.valueOf(elem.getFinalY());
                        break;
                    case 1:           
                        list[3] = String.valueOf(elem.getFinalX());
                        list[4] = String.valueOf(elem.getFinalY()-elem.getDim().getY()+10);                       
                        break;
                    case 2:
                        list[3] = String.valueOf(elem.getFinalX()-elem.getDim().getX()+10);
                        list[4] = String.valueOf(elem.getFinalY()-elem.getDim().getY()+10);
                        break;
                    case 3:
                        list[3] = String.valueOf(elem.getFinalX()-elem.getDim().getX()+10);
                        list[4] = String.valueOf(elem.getFinalY());
                        break;
            }
            dat.add(list);           
        }
        mainFrame.removeDesignView();
View Full Code Here

     * Interprete de los elementos
     * Interpreta y prepara los elementos seleccionados para que el algoritmo pueda utilizarlos.    
     */
    public Stack<AuxiliarElement> interpretData(){
        Stack<AuxiliarElement> queue = new Stack();
        AuxiliarElement elem;
        Dimension dim;
        Sequence seq;
        areaOc = 0;
        seq = new Sequence(1,0,1,false);       
        for(int id : idList){           
            dim = this.configurationController.getCjtElementsController().getElement(id).getDimension();
            elem = new AuxiliarElement();
            elem.setObjectId(id);
            elem.setDim(dim);
            elem.setName(this.configurationController.getCjtElementsController().getElement(id).getName());
            elem.setId(seq.getValue());
            seq.increase();
            areaOc = areaOc + (dim.getX() * dim.getY());
            queue.push(elem);
        }       
        return queue;
View Full Code Here

     * Carga el conjunto de mapas del fichero "cjtmap.txt".      
     */
    public void loadCjtMap(){       
        String nameRoom, nameElement;   
        int[][] doors, windows;
        AuxiliarElement auxiliar;
        Stack<AuxiliarElement> elements;
        int idRoom, dimRoomX, dimRoomY, posX, posY, dimAuxX, dimAuxY, idAux, flagAux, size, sizeAux, doorSize, windowSize;       
  File file;
  FileReader fr;
  BufferedReader reader;      
  try {     
            file = new File("cjtmap.txt");
            if(file.length() > 0){
                fr = new FileReader(file);
    reader = new BufferedReader(fr);   
                String linea;                       
                linea = reader.readLine();
                size = Integer.parseInt(linea);
                if(size > 0){ 
                   
                    reader.readLine();
                    reader.readLine();                   
                    reader.readLine();
                    for(int i = 0; i < size; ++i){
                        elements = new Stack();
                        linea = reader.readLine();
                        idRoom = Integer.parseInt(linea);                       
                        linea = reader.readLine();
                        dimRoomX = Integer.parseInt(linea);
                        linea = reader.readLine();
                        dimRoomY = Integer.parseInt(linea);
                        nameRoom = reader.readLine();
                        linea = reader.readLine();
                        sizeAux = Integer.parseInt(linea);
                      
                        reader.readLine();
                        for(int j = 0; j < sizeAux; ++j){   
                         
                            linea = reader.readLine();
                            idAux = Integer.parseInt(linea);
                           
                            linea = reader.readLine();
                            flagAux = Integer.parseInt(linea);
                           
                            nameElement = reader.readLine();
                           
                            linea = reader.readLine();
                            dimAuxX = Integer.parseInt(linea);
                           
                            linea = reader.readLine();
                            dimAuxY = Integer.parseInt(linea);
                           
                            linea = reader.readLine();
                            posX = Integer.parseInt(linea);
                           
                            linea = reader.readLine();
                            posY = Integer.parseInt(linea);
                           
                            auxiliar = new AuxiliarElement( posX, posY, dimAuxX, dimAuxY, idAux, flagAux, nameElement)
                           
                            elements.push(auxiliar);
                            reader.readLine();
                        }                       
                        reader.readLine();
View Full Code Here

    public void saveCjtMap(){
        int cjtMapSize = this.cjtMap.size();
        int cjtmapMaxId = this.cjtMap.getCount();
        int[][] doors, windows;
        List<AuxiliarElement> list;
        AuxiliarElement auxiliar;
        Map map;
        FileWriter file;
        PrintWriter writer;
        try{   
            file = new FileWriter("cjtmap.txt");           
            writer = new PrintWriter(file);
            writer.write("");
            writer.println(cjtMapSize);           
            writer.println("");
            writer.println("##### CjtMap #####");
            writer.println("");
            for(int i = 1; i<=cjtmapMaxId; ++i){                
                if(this.cjtMap.existsKey(i)){
                    map = this.cjtMap.getMap(i);
                    list = map.getCjtElement();
                    writer.println(map.getIdRoom());    
                    writer.println(map.getDimensionMap().getX());
                    writer.println(map.getDimensionMap().getY());
                    writer.println(map.getNameRoom());
                    writer.println(list.size());
                    writer.println();
                    for(int j=0; j< list.size();++j){                       
                        auxiliar = list.get(j);
                        writer.println(auxiliar.getIdObject());
                        writer.println(auxiliar.getFlag());
                        writer.println(auxiliar.getName());
                        writer.println(auxiliar.getDim().getX());
                        writer.println(auxiliar.getDim().getY());
                        writer.println(auxiliar.getFinalX());
                        writer.println(auxiliar.getFinalY());                       
                       
                        writer.println("");
                    }
                    writer.println("Doors");
                    doors = map.getDoors();
View Full Code Here

    }
   
    public boolean validation(int[][] posEl, String names[], int[] id){
        boolean valid = true;
        Stack<AuxiliarElement> queueElements = new Stack();
        AuxiliarElement elem;
       
        int xMin = (900-x)/2;
        int yMin = 50 + (900-y)/4;
       
     
        int size = posEl.length;       
        for(int i=0; i<size; ++i){
         
            posEl[i][0]-=xMin;posEl[i][1]-=yMin;
            elem = new AuxiliarElement(posEl[i][0], posEl[i][1], posEl[i][2], posEl[i][3], id[i], 0, configurationController.getCjtElementsController().getElement(idList.get(i)).getName());
            queueElements.push(elem);
        }
    
       
        frontController.saveDesignedRoom(idRoom, x, y, areaOc, queueElements, nameRoom, posDoor, posWindow);
View Full Code Here

TOP

Related Classes of main.AuxiliarElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.