Package kartoMNT.karto.outils

Examples of kartoMNT.karto.outils.MsgInfo


                    dispose();

                }
            catch (NumberFormatException ne)
                {
                    MsgInfo msg=new MsgInfo(frameParent,MsgInfo.ERROR,MsgInfo.OK,ResourceManager.get("fillError"));

                }


        }
View Full Code Here


                carroyage.setProj(calibration,getLignesDeNiveaux().getXMax(),getLignesDeNiveaux().getYMax());
            }
        catch(Exception ex)
            {

                MsgInfo msg=new MsgInfo(frameParent,MsgInfo.ERROR,MsgInfo.OK,ResourceManager.get("calibError")
                                        +"\n("+ex.getMessage()+")");

                calibration=null;
            }
    }
View Full Code Here

  }

  public void actionPerformed(ActionEvent e){
    if(getCurrentDocument()!=null){
      // Message de confirmation
      MsgInfo msg=new MsgInfo(parent,MsgInfo.WARN,MsgInfo.OUI|MsgInfo.NON,ResourceManager.get("clearAllWarn"));
      if(msg.reponse()==MsgInfo.OUI){
        LignesDeNiveaux l=(getCurrentDocument()).getLignesDeNiveaux();
           int w = l.getXMax();
           int h = l.getYMax();
           // Nouvelles lignes de niveau vides aux dimensions des anciennes
           getCurrentDocument().setLignesDeNiveaux(new LignesDeNiveaux(w,h));
View Full Code Here

                      l.write(dos);
                      dos.close();
                    }
                  catch(IOException ex)
                    {
                      MsgInfo msg=new MsgInfo(parent,MsgInfo.ERROR,MsgInfo.OK,ResourceManager.get("sgError")+"\n("+ex.getMessage()+")");
                    }
                }
            }
        }
View Full Code Here

                  dis.close();
                  (getCurrentDocument()).setLignesDeNiveaux(l);
                }
              catch(IOException ex)
                {
                  MsgInfo msg=new MsgInfo(parent,MsgInfo.ERROR,MsgInfo.OK,ResourceManager.get("loadLdnError")+"\n("+ex.getMessage()+")");
                }
            }
        }

View Full Code Here

              actionSave.documentSelected(getCurrentDocument());
            }
          catch(Exception ex)
            {
              getCurrentDocument().setFileName(null);
              MsgInfo msg=new MsgInfo(parent,MsgInfo.ERROR,MsgInfo.OK,ResourceManager.get("sgError")+"\n("+ex.getMessage()+")");
            }
        }
    }
View Full Code Here

                bw.close();*/
              }
        }
      catch(Exception ex)
        {
          MsgInfo msg=new MsgInfo(parent,MsgInfo.ERROR,MsgInfo.OK,ResourceManager.get("sgError")
                      +ResourceManager.get("sgFail")+"\n("+ex.getMessage()+")");
        }
    }
View Full Code Here

          String fich=chooser.getSelectedFile().getPath();
          BufferedImage bufim=BufferedImageIO.load(fich);

          if(bufim==null)
            {
              MsgInfo msg=new MsgInfo(parent,MsgInfo.ERROR,MsgInfo.OK,ResourceManager.get("imgLoadError")
                          +ResourceManager.get("imgLoadFail"));

            }
          else
            {
View Full Code Here

                carroyage.setProj(calibration,getLignesDeNiveaux().getXMax(),getLignesDeNiveaux().getYMax());
            }
        catch(Exception ex)
            {

                MsgInfo msg=new MsgInfo(frameParent,MsgInfo.ERROR,MsgInfo.OK,ResourceManager.get("calibError")
                                        +"\n("+ex.getMessage()+")");

                calibration=null;
            }
    }
View Full Code Here

  {
    // On recup�re le doc courant
      DocumentKarto doc=documentKartoContainer.getCurrentDocumentKarto();
      if(doc==null)
    {
        MsgInfo msg=new MsgInfo(frame,MsgInfo.INFO,MsgInfo.OK,ResourceManager.get("noDocOpenError"));

        return;
    }
      try
      {
        // R�cup�ration des dimensions du MNT � g�n�rer
          double deltax,deltay;
          Rectangle2 rect=new Rectangle2();
          if(true/*jCheckBox4.isSelected()*/)
        {
            double xx1,yy1,xx2,yy2;
            xx1=Double.parseDouble(jTextFieldx1.getText());
            yy1=Double.parseDouble(jTextFieldy1.getText());

            xx2=Double.parseDouble(jTextFieldx2.getText());
            yy2=Double.parseDouble(jTextFieldy2.getText());
            rect.x1=Math.min(xx1,xx2);

            rect.y1=Math.min(yy1,yy2);

            rect.x2=Math.max(xx1,xx2);

            rect.y2=Math.max(yy1,yy2);

        } else
          {// on obtient un rectangle englobant
              Proj projection=doc.getProjection();
              if(projection==null)
              {
                  MsgInfo msg=new MsgInfo(frame,MsgInfo.ERROR,MsgInfo.OK,ResourceManager.get("mapNotCalibError"));

                  return;
              }
              rect=MathUtil.getEnglobingRect(projection,0,0,doc.getLignesDeNiveaux().getXMax()-1,doc.getLignesDeNiveaux().getYMax()-1);

          }
          deltax=Double.parseDouble(jTextField6.getText());
          deltay=Double.parseDouble(jTextField3.getText());
          int nbiter=Integer.parseInt(jTextFieldNbiter.getText());
          double residumax=Double.parseDouble(jTextResiduMax.getText());

          Proj projection=doc.getProjection();
          FloatData fd=doc.getLignesDeNiveaux();

          boolean generate=true;
          if(!(inside(fd,projection.projX(rect.x1,rect.y1),projection.projY(rect.x1,rect.y1)) &&
              inside(fd,projection.projX(rect.x1,rect.y2),projection.projY(rect.x1,rect.y2)) &&
              inside(fd,projection.projX(rect.x2,rect.y1),projection.projY(rect.x2,rect.y1)) &&
              inside(fd,projection.projX(rect.x2,rect.y2),projection.projY(rect.x2,rect.y2)) ) )
        {
            MsgInfo msg=new MsgInfo(frame,MsgInfo.INFO,MsgInfo.OUI|MsgInfo.NON,ResourceManager.get("regionOut"));
            generate=(msg.reponse()==MsgInfo.OUI);
        }

          if(generate)
          {
            //on lance l'interpolation dans un thread
              class Run extends Thread
              {
                  LignesDeNiveaux lignesDeNiveaux;
                  public int nbiter;
                  public  float residumax;
                  public  Proj projection;
                  public  double x1,y1,dx,dy;
                  public  int sx,sy;
                  public MNT mnt;
                  ProgressionDialog pd;
                  public void run()
                {
                  //G�neration du MNT � partir des lignes de niveau
                  //mnt=lignesDeNiveaux.interpolationOLd(nbiter,residumax,projection,x1,y1,dx,sx,dy,sy);
                  // Correction bug de generation :
                    mnt=lignesDeNiveaux.interpolation(nbiter,residumax,projection,x1,y1,dx,sx,dy,sy);
                 
                  //notifyInterpolationFinished();
                    if(pd!=null)
                      pd.taskFinished();
                }
              };
              Run mythread=new Run();
              mythread.lignesDeNiveaux=doc.getLignesDeNiveaux();
              mythread.nbiter=nbiter;
              mythread.residumax=(float)residumax;
              mythread.projection=projection;
              mythread.x1= rect.x1;
              mythread.y1= rect.y1;
              mythread.dx= deltax;
              mythread.dy= deltay;
              mythread.sx=(int)((rect.x2-rect.x1)/deltax+1) ;
              mythread.sy=(int)((rect.y2-rect.y1)/deltay+1) ;

              ProgressionDialog pd=new ProgressionDialog(frame,doc.getLignesDeNiveaux(),mythread);
              doc.getLignesDeNiveaux().setProgressionDialog(pd);
//System.out.println("GFE progression InterpolationDialog");
              mythread.pd=pd;
              mythread.start();
              pd.setVisible(true);
              doc.getLignesDeNiveaux().setProgressionDialog(null);
            /*MNT mnt=doc.getLignesDeNiveaux().interpolation(nbiter,(float)residumax,
                doc.getProjection(), rect.x1,rect.y1,deltax,(int)((rect.x2-rect.x1)/deltax+1), deltay,(int)((rect.y2-rect.y1)/deltay+1));
            */
              MNT mnt_final=mythread.mnt;
             
//  System.out.println("InterpolationDialog mnt="+mnt_final);
              if(mnt_final!=null)
              {
                // Ici on cr�e le document MNT-->faire passer aussi le lignes
                  DocumentMNTContainer cont=documentMNTContainer.nextDocumentMNTContainer();
                  DocumentMNT dmnt=new DocumentMNT(cont);
                  dmnt.setMNT(mnt_final);
             
               
                  LignesDeNiveaux ldn=doc.getLignesDeNiveaux();
                // Nouvelles lignes de niveau � la dimension du MNT selectionn�
                  double x1lignes=doc.calibration.projX(rect.x1,rect.y1);     
                  double y1lignes=doc.calibration.projY(rect.x1,rect.y1);
                  double x2lignes=doc.calibration.projX(rect.x2,rect.y2);
                  double y2lignes=doc.calibration.projY(rect.x2,rect.y2);
                // Valeurs absolues : la calibration peut �tre invers�e...
                  int dx = Math.abs((int)(x2lignes-x1lignes));
                  int dy = Math.abs((int)(y2lignes-y1lignes));
                  //System.out.println("dimensions: " + dx + " x " + dy);
                  LignesDeNiveaux newLdn = new LignesDeNiveaux(dx-1,dy-1);
                int posX,posY;
                for (int y = 0; y < newLdn.getYMax(); y++){
                  for (int x = 0; x < newLdn.getXMax(); x++){
                    //newLdn.setValue(x,y,ldn.getValue((int)(Math.min(x1lignes,x2lignes)+x),(int)(Math.min(y1lignes,y2lignes)+y)));
                     if(x1lignes<x2lignes)
                       posX = (int)(x1lignes+x);
                     else
                       posX = (int)(x1lignes-x);
                    if(y1lignes<y2lignes)
                      posY = (int)(y1lignes+y);
                     else
                       posY = (int)(y1lignes-y);
                     // l'image est invers�e en Y (pb de librairie graphique)
                     y=dy-y-2;
                    newLdn.setValueData(x,y,ldn.getValueData(posX,posY));
                  }
                }
               
               
                // Attacher les lignes pour la superposition
                  dmnt.setLdn(newLdn);
               
                // Ajuster l'�chelle en fonction des pas d'echantillonnage
                  dmnt.setScale(1,1);
               
                  dmnt.setFileName(ResourceManager.get("noTitle"));
                  cont.addDocument(dmnt);

                  fermer();
              }
          }
      }
      catch (NumberFormatException ne)
      {
          MsgInfo msg=new MsgInfo(frame,MsgInfo.ERROR,MsgInfo.OK,ResourceManager.get("fillError"));
      }


  }
View Full Code Here

TOP

Related Classes of kartoMNT.karto.outils.MsgInfo

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.