Package net.sf.fysix.leveleditor.tool.level.subtool.presentation

Examples of net.sf.fysix.leveleditor.tool.level.subtool.presentation.PresentationSettings


         
          if(ds.isAttachToGrid()){
            List<IMapObject> mapobjs = refEditor.getIMapObjects();
            for (IMapObject mo : Collections.unmodifiableCollection(mapobjs)){
              if(mo instanceof GridMapObject){
                PresentationSettings ps = ((GridMapObject)mo).getPresentationSettings();
                int x = (pos.getX()/ps.getGridWidth())*ps.getGridWidth();
                if(pos.getX()%ps.getGridWidth()>(ps.getGridWidth()/2)){
                  x += ps.getGridWidth();
                }
                int y = (pos.getY()/ps.getGridHeight())*ps.getGridHeight();
                if(pos.getY()%ps.getGridHeight()>(ps.getGridHeight()/2)){
                  y += ps.getGridHeight();
                }
                WorldPos gridAttachPos = new WorldPos(x,y);
                pos = gridAttachPos; // Replace with adjusted pos!
              }
            }
View Full Code Here


    // TODO: TEST
    propMapWidth.setEditable(true);
    propMapHeight.setEditable(true);

    ps = new PresentationSettings();
   
    // TODO: TEST
    propGridWidth.setValue(ps.getGridWidth());
    propGridHeight.setValue(ps.getGridHeight());
   
View Full Code Here

        if(ds.isAttachToGrid()){
          List<IMapObject> mapobjs = refEditor.getIMapObjects();
          for (IMapObject mo : Collections.unmodifiableCollection(mapobjs)){
            if(mo instanceof GridMapObject){
              PresentationSettings ps = ((GridMapObject)mo).getPresentationSettings();
              int x = (pos.getX()/ps.getGridWidth())*ps.getGridWidth();
              if(pos.getX()%ps.getGridWidth()>(ps.getGridWidth()/2)){
                x += ps.getGridWidth();
              }
              int y = (pos.getY()/ps.getGridHeight())*ps.getGridHeight();
              if(pos.getY()%ps.getGridHeight()>(ps.getGridHeight()/2)){
                y += ps.getGridHeight();
              }
              WorldPos gridAttachPos = new WorldPos(x,y);
              pos = gridAttachPos; // Replace with adjusted pos!
            }
          }
        }

        if (smo == null) {
          smo = new ShapeMapObject(ds);
          smo.setPosition(pos);
          refEditor.addMapObject(smo);
        }
        if(e.getClickCount() > 1){ // READY! DOUBLE CLICK
          smo = null;
        } else {
          smo.addVertex(pos);
          if(ds.isEnableAutocomplete() && smo.getNumberOfVertices()>=ds.getNrOfAutocompleteVertices()){
            smo = null;
          }
        }
      } else if(e.getButton() == MouseEvent.BUTTON3){ // CANCEL - UNDO/DEL LATEST VERTEX
        if(smo != null && smo.getNumberOfVertices()>0){
          smo.delVertex();
          if(smo.getNumberOfVertices()==0){
            refEditor.delMapObject(smo);
            smo = null;
          }
        }
      }
      break;

    case MODE_DRAW_COPY:
    case MODE_DRAW_MOVE:
      if(cs.isAttachToGrid()){
        List<IMapObject> mapobjs = refEditor.getIMapObjects();
        for (IMapObject mo : Collections.unmodifiableCollection(mapobjs)){
          if(mo instanceof GridMapObject){
            PresentationSettings ps = ((GridMapObject)mo).getPresentationSettings();
            int x = (pos.getX()/ps.getGridWidth())*ps.getGridWidth();
            if(pos.getX()%ps.getGridWidth()>(ps.getGridWidth()/2)){
              x += ps.getGridWidth();
            }
            int y = (pos.getY()/ps.getGridHeight())*ps.getGridHeight();
            if(pos.getY()%ps.getGridHeight()>(ps.getGridHeight()/2)){
              y += ps.getGridHeight();
            }
            WorldPos gridAttachPos = new WorldPos(x,y);
            pos = gridAttachPos; // Replace with adjusted pos!
          }
        }
View Full Code Here

    if(updCS){
      setValues(csCopy);
    }

    boolean updPS = false;
    PresentationSettings psCopy = new PresentationSettings();
    readValues(psCopy);
   
    if (propertyName.equals(propGridWidth.getName())) {
      if (newValue instanceof String) {
        psCopy.setGridWidth(Integer.parseInt(newValue.toString()));
        updPS = true;
      }
    }
    else if (propertyName.equals(propGridHeight.getName())) {
      if (newValue instanceof String) {
        psCopy.setGridHeight(Integer.parseInt(newValue.toString()));
        updPS = true;
      }
    }
   
    if(updPS){
View Full Code Here

     
      if(cs.isAttachToGrid()){
      List<IMapObject> mapobjs = refEditor.getIMapObjects();
      for (IMapObject mo : Collections.unmodifiableCollection(mapobjs)){
        if(mo instanceof GridMapObject){
          PresentationSettings ps = ((GridMapObject)mo).getPresentationSettings();
          int x = (pos.getX()/ps.getGridWidth())*ps.getGridWidth();
          if(pos.getX()%ps.getGridWidth()>(ps.getGridWidth()/2)){
            x += ps.getGridWidth();
          }
          int y = (pos.getY()/ps.getGridHeight())*ps.getGridHeight();
          if(pos.getY()%ps.getGridHeight()>(ps.getGridHeight()/2)){
            y += ps.getGridHeight();
          }
          WorldPos gridAttachPos = new WorldPos(x,y);
          pos = gridAttachPos; // Replace with adjusted pos!
        }
      }
View Full Code Here

TOP

Related Classes of net.sf.fysix.leveleditor.tool.level.subtool.presentation.PresentationSettings

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.