From: <de...@us...> - 2009-02-02 22:46:08
|
Revision: 4437 http://fudaa.svn.sourceforge.net/fudaa/?rev=4437&view=rev Author: deniger Date: 2009-02-02 22:46:04 +0000 (Mon, 02 Feb 2009) Log Message: ----------- Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueGrille.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/palette/PaletteSelecteurCouleurPlage.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvElementLayer.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilder.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilderFromLine.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTarget.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTreeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSig.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigAttibuteTypeManager.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigAttributeEditorPanel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigAttributeTableModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigExportImportAttributesMapper.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigFilterZone.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigFilterZoneActivity.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigGeomDataClosedLayerFilter.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigGeomSrcData.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigGeomSrcDataUtils.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigImplementation.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigLayerGroupSaver.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigLayerLineAddedSaver.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigLayerPointAddedSaver.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigLib.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigLineSingleModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigLoaderPreviewer.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigProjectPersistence.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigProjet.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigProjetDefault.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigResource.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigVarAttrMapperTableModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigVarPolygoneModifierActivity.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigVariableModifResult.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigVariableModifResultSub.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/FSigVisuPanelDefault.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigEditor.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigFilleDefault.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigGrillePalette.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigImageImportAction.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigLayerAction.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigLayerExporter.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigLayerFilter.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigLayerGroup.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigLayerLine.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigLayerLineEditable.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigLayerPointEditable.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigVisuPanel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigVisuPanelController.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/persistence/FSigLayerGroupPersistence.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/persistence/FSigLayerLinePersistence.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/persistence/FSigLayerMultiPointPersistence.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/persistence/FSigLayerPointPersistence.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSIgImageWizartStepCalageUI.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigDataModelSinusxAdapter.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigDataModelStoreAdapter.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoadResult.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderCsv.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderGIS.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderGrid.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderI.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderInp.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderPanel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderReflucadSEM.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderRefluxRefondeResult.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderRubarCox.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderRubarInx.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderRubarSem.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderRubarSt.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderSerafin.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigFileLoaderSinusX.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigImageWizardPanelController.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigImageWizardStepCalage.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigImageWizardStepCalageLogic.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigImageWizardStepImage.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigImageWizardTableModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigImageWizardTask.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigVariableInterpolator.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigWizardDefaultPanel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigWizardFileMng.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigWizardFileModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigWizardImport.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigWizardImportHelper.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigWizardImportStepDestination.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigWizardVariableModifier.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrCommonImplementation.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrExplorer.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrLib.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/data/TrGisProjectEditor.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/ScopCourbeTreeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostBuilderSuiteCalcul.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeBuilder.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeTreeModelPersist.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFusionProjet.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostMultiSourceActivator2.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjetsManagerFille.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSource.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceAbstract.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceFromReader.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceReaderComposite.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceReaderReflux.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostTrajectoireLineLayer.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostTrajectoireLineLayerPersist.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanelPersistManager.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrReplayCurvesData.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueGrille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueGrille.java 2009-02-02 19:33:52 UTC (rev 4436) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueGrille.java 2009-02-02 22:46:04 UTC (rev 4437) @@ -42,974 +42,922 @@ * @author Guillaume Desnoix */ public class ZCalqueGrille extends ZCalqueAffichageDonnees { - // Proprietes - // private GrBoite boite_; - boolean drawGrid_; - boolean drawX_ = true; - boolean drawY_ = true; - // Envelope customBounds_; - // boolean useCustom_; + // Proprietes + // private GrBoite boite_; + boolean drawGrid_; + boolean drawX_ = true; + boolean drawY_ = true; + // Envelope customBounds_; + // boolean useCustom_; - int nbGraduationX_ = 10; - int nbGraduationY_ = 10; + int nbGraduationX_ = 10; + int nbGraduationY_ = 10; - //-- sous graduations --// - int nbSousGraduationX_ = 2; - //-- sous graduations --// - int nbSousGraduationY_ = 2; + // -- sous graduations --// + int nbSousGraduationX_ = 2; + // -- sous graduations --// + int nbSousGraduationY_ = 2; - final BVueCalque vue_; + final BVueCalque vue_; + /** + * Indique la facon de calculer les graduations. pour l'axe des x. + */ + boolean modeAutomatiqueX_ = false; + /** + * Indique la facon de calculer les graduations. pour l'axe des y. + */ + boolean modeAutomatiqueY_ = false; - /** - * Indique la facon de calculer les graduations. - * pour l'axe des x. - */ - boolean modeAutomatiqueX_=false; - /** - * Indique la facon de calculer les graduations. - * pour l'axe des y. - */ - boolean modeAutomatiqueY_=false; + /** + * Indique si on utilise par taille de pas ou par nombre de graduations + */ + boolean modeLongueurPasX_ = false; + boolean modeLongueurPasY_ = false; + /** + * Valeur du pas que devront suivrent tous les traits de la grilles si on en mode taille pas. + */ + int valeurPasX_; + int valeurPasY_; + boolean drawSousGrilleX_ = false; + boolean drawSousGrilleY_ = false; + boolean modeLongueurPasSousGradX_ = false; + boolean modeLongueurPasSousGradY_ = false; - /** - * Indique si on utilise par taille de pas ou par nombre de graduations - */ - boolean modeLongueurPasX_=false; - boolean modeLongueurPasY_=false; + int valeurPasSousGradX_; + int valeurPasSousGradY_; - /** - * Valeur du pas que devront suivrent tous les traits de la grilles si on en mode taille pas. - */ - int valeurPasX_; - int valeurPasY_; + private Color couleurSousGraduation_ = Color.blue; - boolean drawSousGrilleX_ = false; - boolean drawSousGrilleY_ = false; + public ZCalqueGrille(final BVueCalque _vue) { + super(); + vue_ = _vue; + setDestructible(false); + setName("cqGrille"); + setTitle(EbliLib.getS("Grille")); + // setForeground(new Color(204, 153, 0)); + setForeground(Color.BLACK); + } - boolean modeLongueurPasSousGradX_=false; - boolean modeLongueurPasSousGradY_=false; + public void paintAllInImage(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel, + final GrBoite _clipReel) { + // super.paintAllInImage(_g, _versEcran, _versReel, _clipReel); + } - int valeurPasSousGradX_; - int valeurPasSousGradY_; + public void changeZoom(double minx, double miny, double maxx, double maxy) { + vue_.changeViewBoite(this, new GrBoite(new GrPoint(minx, miny, 0), new GrPoint(maxx, maxy, 0)), false); + } - private Color couleurSousGraduation_=Color.blue; + public int getNbXGraduations() { + return nbGraduationX_; + } - public ZCalqueGrille(final BVueCalque _vue) { - super(); - vue_ = _vue; - setDestructible(false); - setName("cqGrille"); - setTitle(EbliLib.getS("Grille")); - // setForeground(new Color(204, 153, 0)); - setForeground(Color.BLACK); - } + public int getNbYGraduations() { + return nbGraduationY_; + } - public void paintAllInImage(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel, - final GrBoite _clipReel) { - // super.paintAllInImage(_g, _versEcran, _versReel, _clipReel); - } + public int getNbXSousGraduations() { + return nbSousGraduationX_; + } - public void changeZoom(double minx, double miny, double maxx, double maxy) { - vue_.changeViewBoite(this, new GrBoite(new GrPoint(minx, miny, 0), new GrPoint(maxx, maxy, 0)), false); - } + public int getNbYSousGraduations() { + return nbSousGraduationY_; + } - public int getNbXGraduations() { - return nbGraduationX_; - } + public void setSousGraduationColor(Color c) { + if (couleurSousGraduation_ != c) { + couleurSousGraduation_ = c; + grilleChanged(); + } - public int getNbYGraduations() { - return nbGraduationY_; - } + } - public int getNbXSousGraduations() { - return nbSousGraduationX_; - } + /** + * Accesseur de la propriete <I>boite</I>. Elle donne la position, la taille, le domaine de la grille. + */ + // public GrBoite getBoite() { + // return boite_; + // } + public GrBoite getDomaine() { + return null; + // GrBoite r = null; + // if (isVisible()) { + // GrBoite d = null; + // d = super.getDomaine(); + // r = getBoite(); + // if (d != null) { + // if (r == null) { + // r = d; + // } else { + // r = r.union(d); + // } + // } + // } + // return r; + } - public int getNbYSousGraduations() { - return nbSousGraduationY_; - } + public GrBoite getDomaineOnSelected() { + return getDomaine(); + } - public void setSousGraduationColor(Color c){ - if(couleurSousGraduation_!=c){ - couleurSousGraduation_=c; - grilleChanged(); - } + public boolean isCouleurModifiable() { + return true; + } - } + public int getTiretLength() { + return 3; + } - /** - * Accesseur de la propriete <I>boite</I>. Elle donne la position, la taille, le domaine de la grille. - */ - // public GrBoite getBoite() { - // return boite_; - // } - public GrBoite getDomaine() { - return null; - // GrBoite r = null; - // if (isVisible()) { - // GrBoite d = null; - // d = super.getDomaine(); - // r = getBoite(); - // if (d != null) { - // if (r == null) { - // r = d; - // } else { - // r = r.union(d); - // } - // } - // } - // return r; - } + public void paintDonnees(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel, + final GrBoite _clipReel) { + GrBoite domaine = vue_.getAbstractCalque().getDomaine(); + final GrBoite zv = _clipReel.intersectionXY(domaine); - public GrBoite getDomaineOnSelected() { - return getDomaine(); - } + if (zv == null) { return; } + // updateBounds(zv); + final GrBoite targetBoite = new GrBoite(); + targetBoite.ajuste(0, 0, 0); + // la boite d'affichage - public boolean isCouleurModifiable() { - return true; - } + if (!_versEcran.isSame(getVersEcran())) { return; } + targetBoite.ajuste(getWidth(), getHeight(), 0); + final Color old = _g.getColor(); + final Font oldFont = _g.getFont(); + // la fonte + final Font font = getFont(); + if (font != null) { + _g.setFont(font); + } + final FontMetrics fm = font == null ? null : _g.getFontMetrics(font); + final TDoubleArrayList xValue = new TDoubleArrayList(20); + final TIntArrayList xStrWidth = new TIntArrayList(20); + final List xString = new ArrayList(20); + final NumberIterator it = new NumberIterator(); + final boolean isXPainted = drawX_ && zv.getMinX() < zv.getMaxX() && nbGraduationX_ > 0; - public int getTiretLength() { - return 3; - } + if (isXPainted) { + computeXValues(zv, _g, xValue, xStrWidth, xString, it); + } + double yMax = 0; + final TDoubleArrayList yValue = new TDoubleArrayList(20); + final TIntArrayList yStrWidth = new TIntArrayList(20); + final List yString = new ArrayList(20); + final boolean isYPainted = drawY_ && zv.getMinY() < zv.getMaxY() && nbGraduationY_ > 0; + if (isYPainted) { + yMax = computeYValues(_g, zv, yValue, yStrWidth, yString); + } - public void paintDonnees(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel, - final GrBoite _clipReel) { - GrBoite domaine = vue_.getAbstractCalque().getDomaine(); - final GrBoite zv = _clipReel.intersectionXY(domaine); + // boolean rapide = isRapide(); + final GrMorphisme versEcran = _versEcran; + final int tiret = getTiretLength(); + final int marge = 1; + int absyAxe = (int) (targetBoite.getMinX() + yMax + 2 * marge + tiret); + final int margeBas = (font == null ? 0 : font.getSize()) + 2 * marge + tiret; + int ordxAxe = (int) (targetBoite.getMaxY() - margeBas); + vue_.setUserInsets(new Insets(3, absyAxe + 5, margeBas + 5, 3)); - if (zv == null) { return; } - // updateBounds(zv); - final GrBoite targetBoite = new GrBoite(); - targetBoite.ajuste(0, 0, 0); - // la boite d'affichage + final GrBoite ecranBoite = domaine.applique(_versEcran); + if (ecranBoite.getMinX() - 5 > absyAxe) { + absyAxe = (int) (ecranBoite.getMinX() - 5); + } + if (ecranBoite.getMaxY() + 5 < ordxAxe) { + ordxAxe = (int) (ecranBoite.getMaxY() + 5); + } + if (isXPainted) { + fillXZone(_g, targetBoite, absyAxe, ordxAxe, ecranBoite); - if (!_versEcran.isSame(getVersEcran())) { return; } - targetBoite.ajuste(getWidth(), getHeight(), 0); - final Color old = _g.getColor(); - final Font oldFont = _g.getFont(); - // la fonte - final Font font = getFont(); - if (font != null) { - _g.setFont(font); - } - final FontMetrics fm = font == null ? null : _g.getFontMetrics(font); - final TDoubleArrayList xValue = new TDoubleArrayList(20); - final TIntArrayList xStrWidth = new TIntArrayList(20); - final List xString = new ArrayList(20); - final NumberIterator it = new NumberIterator(); - final boolean isXPainted = drawX_ && zv.getMinX() < zv.getMaxX() && nbGraduationX_ > 0; + } - if (isXPainted) { - computeXValues(zv, _g, xValue, xStrWidth, xString, it); - } - double yMax = 0; - final TDoubleArrayList yValue = new TDoubleArrayList(20); - final TIntArrayList yStrWidth = new TIntArrayList(20); - final List yString = new ArrayList(20); - final boolean isYPainted = drawY_ && zv.getMinY() < zv.getMaxY() && nbGraduationY_ > 0; - if (isYPainted) { - yMax = computeYValues(_g, zv, yValue, yStrWidth, yString); - } + // l'axe des x + final double maxXForAxe = ecranBoite.getMaxX() - marge; - // boolean rapide = isRapide(); - final GrMorphisme versEcran = _versEcran; - final int tiret = getTiretLength(); - final int marge = 1; - int absyAxe = (int) (targetBoite.getMinX() + yMax + 2 * marge + tiret); - final int margeBas = (font == null ? 0 : font.getSize()) + 2 * marge + tiret; - int ordxAxe = (int) (targetBoite.getMaxY() - margeBas); - vue_.setUserInsets(new Insets(3, absyAxe + 5, margeBas + 5, 3)); + // l'axe des y + final double minYForAxe = ecranBoite.getMinY() + marge; + // les graduation en x - final GrBoite ecranBoite = domaine.applique(_versEcran); - if (ecranBoite.getMinX() - 5 > absyAxe) { - absyAxe = (int) (ecranBoite.getMinX() - 5); - } - if (ecranBoite.getMaxY() + 5 < ordxAxe) { - ordxAxe = (int) (ecranBoite.getMaxY() + 5); - } - if (isXPainted) { - fillXZone(_g, targetBoite, absyAxe, ordxAxe, ecranBoite); + final int ascent = fm == null ? 0 : fm.getAscent(); + final int ordXString = ordxAxe + tiret + ascent; + if (isXPainted) { + drawXAxe(_g, zv, xValue, versEcran, absyAxe, ordxAxe, maxXForAxe); + drawXGraduations(_g, targetBoite, xValue, xStrWidth, xString, absyAxe, ordxAxe, ecranBoite, minYForAxe, + ordXString); + } - } + // y - // l'axe des x - final double maxXForAxe = ecranBoite.getMaxX() - marge; + if (isYPainted) { + fillYZone(_g, targetBoite, absyAxe, ecranBoite); + drawYaxe(_g, zv, xValue, yValue, versEcran, absyAxe, ordxAxe, minYForAxe); + drawYGraduations(_g, yValue, yStrWidth, yString, versEcran, marge, absyAxe, ordxAxe, ecranBoite, maxXForAxe); + } + _g.setColor(old); + _g.setFont(oldFont); + } - // l'axe des y - final double minYForAxe = ecranBoite.getMinY() + marge; - // les graduation en x + void fillXZone(final Graphics2D _g, final GrBoite _targetBoite, final int _absyAxe, final int _ordxAxe, + final GrBoite _ecranBoite) { + if (_ecranBoite.getMaxX() > _ordxAxe) { + _g.setColor(vue_.getBackground()); + _g.fillRect(_absyAxe, _ordxAxe, (int) _targetBoite.getMaxX() - _absyAxe, (int) _targetBoite.getMaxY() - _ordxAxe); + } + } - final int ascent = fm == null ? 0 : fm.getAscent(); - final int ordXString = ordxAxe + tiret + ascent; - if (isXPainted) { - drawXAxe(_g, zv, xValue, versEcran, absyAxe, ordxAxe, maxXForAxe); - drawXGraduations(_g, targetBoite, xValue, xStrWidth, xString, absyAxe, ordxAxe, ecranBoite, minYForAxe, - ordXString); - } + private void fillYZone(final Graphics2D _g, final GrBoite _targetBoite, final int _absyAxe, final GrBoite _ecranBoite) { + if (_ecranBoite.getMinX() < _absyAxe) { + _g.setColor(vue_.getBackground()); + _g.fillRect(0, 0, _absyAxe, (int) _targetBoite.getMaxY()); + } + } - // y + protected void drawYGraduations(final Graphics2D _g, final TDoubleArrayList _yValue, final TIntArrayList _yStrWidth, + final List _yString, final GrMorphisme _versEcran, final int _marge, final int _absyAxe, final int _ordxAxe, + final GrBoite _ecranBoite, final double _maxXForAxe) { + final int nb = _yString.size(); + final int tiret = getTiretLength(); + final Font font = getFont(); + final FontMetrics fm = font == null ? null : _g.getFontMetrics(font); + final int ascent = fm == null ? 0 : fm.getAscent(); + int idxStr = -1; + final Color fg = getDrawColor(); + final Color subColor = getSubColor(); + GrPoint tmpSousGrille_ = new GrPoint(); + double longueurMoyenne = 0; + for (int i = 0; i < nb; i++) { + tmp_.y_ = _yValue.getQuick(i); + tmp_.autoApplique(_versEcran); + if (tmp_.y_ > _ordxAxe) { + continue; + } + if (tmp_.y_ < _ecranBoite.getMinY()) { + break; + } + // le tiret + tl_.setTypeTrait(TraceLigne.LISSE); + tl_.setCouleur(fg); + final int w = _yStrWidth.getQuick(i); + tl_.dessineTrait(_g, _absyAxe, tmp_.y_, _absyAxe - (w > 0 ? tiret : tiret - 2), tmp_.y_); + if (w > 0 && (tmp_.y_ < idxStr || idxStr < 0)) { + _g.setColor(fg); + _g.drawString((String) _yString.get(i), (_absyAxe - w - tiret - _marge), (int) (tmp_.y_ + ascent / 2D)); + idxStr = (int) (tmp_.y_ - ascent / 2D - 3D); + } - if (isYPainted) { - fillYZone(_g, targetBoite, absyAxe, ecranBoite); - drawYaxe(_g, zv, xValue, yValue, versEcran, absyAxe, ordxAxe, minYForAxe); - drawYGraduations(_g, yValue, yStrWidth, yString, versEcran, marge, absyAxe, ordxAxe, ecranBoite, maxXForAxe); - } - _g.setColor(old); - _g.setFont(oldFont); - } + // -- on trace ou non les sous graduations --// + if ((w > 0 || i == nb - 2) && drawSousGrilleY_ && i > 0 && i < nb - 1) { + int valNextPotable = -1; + for (int j = i + 1; valNextPotable == -1 && j < _yStrWidth.size(); j++) + if (_yStrWidth.getQuick(j) > 0) valNextPotable = j; - void fillXZone(final Graphics2D _g, final GrBoite _targetBoite, final int _absyAxe, final int _ordxAxe, - final GrBoite _ecranBoite) { - if (_ecranBoite.getMaxX() > _ordxAxe) { - _g.setColor(vue_.getBackground()); - _g.fillRect(_absyAxe, _ordxAxe, (int) _targetBoite.getMaxX() - _absyAxe, (int) _targetBoite.getMaxY() - _ordxAxe); - } - } + if (i == nb - 2) { + // -- la fin il faut creer le nouveau + valNextPotable = nb - 1; + _yValue.set(valNextPotable, _yValue.get(i) + longueurMoyenne); + } - private void fillYZone(final Graphics2D _g, final GrBoite _targetBoite, final int _absyAxe, final GrBoite _ecranBoite) { - if (_ecranBoite.getMinX() < _absyAxe) { - _g.setColor(vue_.getBackground()); - _g.fillRect(0, 0, _absyAxe, (int) _targetBoite.getMaxY()); - } - } + if (valNextPotable != -1) { - protected void drawYGraduations(final Graphics2D _g, final TDoubleArrayList _yValue, final TIntArrayList _yStrWidth, - final List _yString, final GrMorphisme _versEcran, final int _marge, final int _absyAxe, final int _ordxAxe, - final GrBoite _ecranBoite, final double _maxXForAxe) { - final int nb = _yString.size(); - final int tiret = getTiretLength(); - final Font font = getFont(); - final FontMetrics fm = font == null ? null : _g.getFontMetrics(font); - final int ascent = fm == null ? 0 : fm.getAscent(); - int idxStr = -1; - final Color fg = getDrawColor(); - final Color subColor = getSubColor(); - GrPoint tmpSousGrille_=new GrPoint(); - double longueurMoyenne=0; - for (int i = 0; i < nb; i++) { - tmp_.y_ = _yValue.getQuick(i); - tmp_.autoApplique(_versEcran); - if (tmp_.y_ > _ordxAxe) { - continue; - } - if (tmp_.y_ < _ecranBoite.getMinY()) { - break; - } - // le tiret - tl_.setTypeTrait(TraceLigne.LISSE); - tl_.setCouleur(fg); - final int w = _yStrWidth.getQuick(i); - tl_.dessineTrait(_g, _absyAxe, tmp_.y_, _absyAxe - (w > 0 ? tiret : tiret - 2), tmp_.y_); - if (w > 0 && (tmp_.y_ < idxStr || idxStr < 0)) { - _g.setColor(fg); - _g.drawString((String) _yString.get(i), (_absyAxe - w - tiret - _marge), (int) (tmp_.y_ + ascent / 2D)); - idxStr = (int) (tmp_.y_ - ascent / 2D - 3D); - } - - - //-- on trace ou non les sous graduations --// - if((w > 0 || i==nb-2) && drawSousGrilleY_ && i>0 && i<nb-1){ - int valNextPotable=-1; - for(int j=i+1;valNextPotable==-1 &&j<_yStrWidth.size();j++) - if(_yStrWidth.getQuick(j)>0) - valNextPotable=j; - - if(i==nb-2){ - //-- la fin il faut creer le nouveau - valNextPotable=nb-1; - _yValue.set(valNextPotable,_yValue.get(i)+longueurMoyenne); - } - - if(valNextPotable!=-1){ + tmpSousGrille_.y_ = _yValue.getQuick(valNextPotable); + tmpSousGrille_.autoApplique(_versEcran); + double distanceEntre2Trait = Math.abs(tmpSousGrille_.y_ - tmp_.y_); + int nbSousGrilles = 0; + int taillePasSousgrille = 0; + if (!this.modeLongueurPasSousGradY_) { + // -- on trace des nombre de cesure --// + nbSousGrilles = this.getNbYSousGraduations(); + if (nbSousGrilles != 0) taillePasSousgrille = (int) ((distanceEntre2Trait) / nbSousGrilles); + } else { + // -- on trace des pas par longueur --// + double ratio = (_yValue.getQuick(valNextPotable) - _yValue.getQuick(i)); + if (ratio != 0) ratio = this.valeurPasSousGradY_ / ratio; - tmpSousGrille_.y_=_yValue.getQuick(valNextPotable); - tmpSousGrille_.autoApplique(_versEcran); - double distanceEntre2Trait=Math.abs(tmpSousGrille_.y_-tmp_.y_); - int nbSousGrilles=0; - int taillePasSousgrille=0; - if(!this.modeLongueurPasSousGradY_){ - //-- on trace des nombre de cesure --// - nbSousGrilles=this.getNbYSousGraduations(); - if(nbSousGrilles!=0) - taillePasSousgrille=(int) ((distanceEntre2Trait)/nbSousGrilles); - }else{ - //-- on trace des pas par longueur --// - double ratio=(_yValue.getQuick(valNextPotable)-_yValue.getQuick(i)); - if(ratio!=0) - ratio=this.valeurPasSousGradY_/ratio; + taillePasSousgrille = (int) (ratio * distanceEntre2Trait); + if (taillePasSousgrille != 0) nbSousGrilles = (int) (distanceEntre2Trait / taillePasSousgrille); + } + // -- si on a des bons pas et nb de grilles --// + if (nbSousGrilles > 0 && taillePasSousgrille > 0 && taillePasSousgrille < distanceEntre2Trait) { - taillePasSousgrille=(int) (ratio*distanceEntre2Trait); - if(taillePasSousgrille!=0) - nbSousGrilles=(int) (distanceEntre2Trait/taillePasSousgrille); - } - //-- si on a des bons pas et nb de grilles --// - if(nbSousGrilles>0 && taillePasSousgrille>0 && taillePasSousgrille<distanceEntre2Trait){ + for (int k = 0; k < nbSousGrilles + 1; k++) { + // -- on trace un trait de couleur de subgrid --// + tl_.setTypeTrait(TraceLigne.POINTILLE); + tl_.setEpaisseur((float) 0.1); + tl_.setCouleur(this.couleurSousGraduation_); + double longueur = ((k) * taillePasSousgrille); + tmpSousGrille_.autoApplique(_versEcran); + tl_.dessineTrait(_g, _absyAxe, tmp_.y_ + longueur, _maxXForAxe, tmp_.y_ + longueur); + } + longueurMoyenne = (int) (_yValue.getQuick(valNextPotable) - _yValue.getQuick(i)); + } - for(int k=0;k<nbSousGrilles+1;k++){ - //-- on trace un trait de couleur de subgrid --// - tl_.setTypeTrait(TraceLigne.POINTILLE); - tl_.setEpaisseur((float) 0.1); - tl_.setCouleur(this.couleurSousGraduation_); - double longueur=((k)*taillePasSousgrille); - tmpSousGrille_.autoApplique(_versEcran); - tl_.dessineTrait(_g,_absyAxe, tmp_.y_+longueur,_maxXForAxe,tmp_.y_+ longueur); - } - longueurMoyenne=(int) (_yValue.getQuick(valNextPotable)-_yValue.getQuick(i)); - } + } + } - } - } - - - if (drawGrid_ && w > 0) { - tl_.setTypeTrait(TraceLigne.TIRETE); - tl_.setEpaisseur(1); - tl_.setCouleur(subColor); - tl_.dessineTrait(_g, _absyAxe, tmp_.y_, _maxXForAxe, tmp_.y_); - } - } - } + if (drawGrid_ && w > 0) { + tl_.setTypeTrait(TraceLigne.TIRETE); + tl_.setEpaisseur(1); + tl_.setCouleur(subColor); + tl_.dessineTrait(_g, _absyAxe, tmp_.y_, _maxXForAxe, tmp_.y_); + } + } + } - private Color getSubColor() { - Color subColor = attenueCouleur(getForeground()); - if (isAttenue()) { - subColor = attenueCouleur(subColor); - } - return subColor; - } + private Color getSubColor() { + Color subColor = attenueCouleur(getForeground()); + if (isAttenue()) { + subColor = attenueCouleur(subColor); + } + return subColor; + } - private Color getDrawColor() { - Color fg = getForeground(); - if (isAttenue()) { - fg = attenueCouleur(fg); - } - return fg; - } + private Color getDrawColor() { + Color fg = getForeground(); + if (isAttenue()) { + fg = attenueCouleur(fg); + } + return fg; + } - final GrPoint tmp_ = new GrPoint(); + final GrPoint tmp_ = new GrPoint(); - private void drawXGraduations(final Graphics2D _g, final GrBoite _targetBoite, final TDoubleArrayList _xValue, - final TIntArrayList _xStrWidth, final List _xString, final int _absyAxe, final int _ordxAxe, - final GrBoite _ecranBoite, final double _minYForAxe, final int _ordXString) { - final int nb = _xString.size(); - final Color fg = getDrawColor(); - final Color subColor = getSubColor(); - int idxStr = -1; - final GrMorphisme versEcran = getVersEcran(); - final int tiret = getTiretLength(); - final TraceLigne gtl = new TraceLigne(); - GrPoint tmpSousGrille_=new GrPoint(); - - double longueurMoyenne=0; - - for (int i = 0; i < nb; i++) { - tmp_.x_ = _xValue.getQuick(i); - tmp_.autoApplique(versEcran); - if (tmp_.x_ < _absyAxe) { - continue; - } - if (tmp_.x_ > _ecranBoite.getMaxX()) { - break; - } - // le tiret - gtl.setTypeTrait(TraceLigne.LISSE); - gtl.setCouleur(fg); - final int w = _xStrWidth.getQuick(i); - gtl.dessineTrait(_g, tmp_.x_, _ordxAxe, tmp_.x_, _ordxAxe + (w > 0 ? tiret : tiret - 2)); - if (w > 0) { - final int start = (int) (tmp_.x_ - w / 2D); - if (start > idxStr + 1 && start + w < _targetBoite.getMaxX()) { - _g.setColor(fg); - _g.drawString((String) _xString.get(i), start, _ordXString); - idxStr = start + w; - } - } + private void drawXGraduations(final Graphics2D _g, final GrBoite _targetBoite, final TDoubleArrayList _xValue, + final TIntArrayList _xStrWidth, final List _xString, final int _absyAxe, final int _ordxAxe, + final GrBoite _ecranBoite, final double _minYForAxe, final int _ordXString) { + final int nb = _xString.size(); + final Color fg = getDrawColor(); + final Color subColor = getSubColor(); + int idxStr = -1; + final GrMorphisme versEcran = getVersEcran(); + final int tiret = getTiretLength(); + final TraceLigne gtl = new TraceLigne(); + GrPoint tmpSousGrille_ = new GrPoint(); + double longueurMoyenne = 0; + for (int i = 0; i < nb; i++) { + tmp_.x_ = _xValue.getQuick(i); + tmp_.autoApplique(versEcran); + if (tmp_.x_ < _absyAxe) { + continue; + } + if (tmp_.x_ > _ecranBoite.getMaxX()) { + break; + } + // le tiret + gtl.setTypeTrait(TraceLigne.LISSE); + gtl.setCouleur(fg); + final int w = _xStrWidth.getQuick(i); + gtl.dessineTrait(_g, tmp_.x_, _ordxAxe, tmp_.x_, _ordxAxe + (w > 0 ? tiret : tiret - 2)); + if (w > 0) { + final int start = (int) (tmp_.x_ - w / 2D); + if (start > idxStr + 1 && start + w < _targetBoite.getMaxX()) { + _g.setColor(fg); + _g.drawString((String) _xString.get(i), start, _ordXString); + idxStr = start + w; + } + } - //-- on trace ou non les sous graduations --// - if((w > 0 || i==nb-2) && drawSousGrilleX_ && i<nb-1){ - int valNextPotable=-1; - for(int j=i+1;valNextPotable==-1 &&j<_xStrWidth.size();j++) - if(_xStrWidth.getQuick(j)>0) - valNextPotable=j; - if(i==nb-2){ - //-- la fin il faut creer le nouveau - valNextPotable=nb-1; - _xValue.set(valNextPotable,_xValue.get(i)+longueurMoyenne); - } - if(valNextPotable!=-1 ){ - - tmpSousGrille_.x_=_xValue.getQuick(valNextPotable); - tmpSousGrille_.autoApplique(versEcran); - double distanceEntre2Trait=Math.abs(tmpSousGrille_.x_-tmp_.x_); - int nbSousGrilles=0; - int taillePasSousgrille=0; - if(!this.modeLongueurPasSousGradX_){ - //-- on trace des nombre de cesure --// - nbSousGrilles=this.getNbXSousGraduations(); - if(nbSousGrilles!=0) - taillePasSousgrille=(int) ((distanceEntre2Trait)/nbSousGrilles); - }else{ - //-- on trace des pas par longueur --// - double ratio=(_xValue.getQuick(valNextPotable)-_xValue.getQuick(i)); - if(ratio!=0) - ratio=this.valeurPasSousGradX_/ratio; + // -- on trace ou non les sous graduations --// + if ((w > 0 || i == nb - 2) && drawSousGrilleX_ && i < nb - 1) { + int valNextPotable = -1; + for (int j = i + 1; valNextPotable == -1 && j < _xStrWidth.size(); j++) + if (_xStrWidth.getQuick(j) > 0) valNextPotable = j; + if (i == nb - 2) { + // -- la fin il faut creer le nouveau + valNextPotable = nb - 1; + _xValue.set(valNextPotable, _xValue.get(i) + longueurMoyenne); + } + if (valNextPotable != -1) { - taillePasSousgrille=(int) (ratio*distanceEntre2Trait); - if(taillePasSousgrille!=0) - nbSousGrilles=(int) (distanceEntre2Trait/taillePasSousgrille); - } - //-- si on a des bons pas et nb de grilles --// - if(nbSousGrilles>0 && taillePasSousgrille>0 && taillePasSousgrille<distanceEntre2Trait){ + tmpSousGrille_.x_ = _xValue.getQuick(valNextPotable); + tmpSousGrille_.autoApplique(versEcran); + double distanceEntre2Trait = Math.abs(tmpSousGrille_.x_ - tmp_.x_); + int nbSousGrilles = 0; + int taillePasSousgrille = 0; + if (!this.modeLongueurPasSousGradX_) { + // -- on trace des nombre de cesure --// + nbSousGrilles = this.getNbXSousGraduations(); + if (nbSousGrilles != 0) taillePasSousgrille = (int) ((distanceEntre2Trait) / nbSousGrilles); + } else { + // -- on trace des pas par longueur --// + double ratio = (_xValue.getQuick(valNextPotable) - _xValue.getQuick(i)); + if (ratio != 0) ratio = this.valeurPasSousGradX_ / ratio; - for(int k=0;k<nbSousGrilles+1;k++){ - //-- on trace un trait de couleur de subgrid --// - gtl.setTypeTrait(TraceLigne.POINTILLE); - gtl.setEpaisseur((float) 0.1); - gtl.setCouleur(this.couleurSousGraduation_); - double longueur=((k)*taillePasSousgrille); - tmpSousGrille_.autoApplique(versEcran); - gtl.dessineTrait(_g, tmp_.x_+longueur, _ordxAxe,tmp_.x_+ longueur, _minYForAxe); - } - - longueurMoyenne=(int) (_xValue.getQuick(valNextPotable)-_xValue.getQuick(i)); - } + taillePasSousgrille = (int) (ratio * distanceEntre2Trait); + if (taillePasSousgrille != 0) nbSousGrilles = (int) (distanceEntre2Trait / taillePasSousgrille); + } + // -- si on a des bons pas et nb de grilles --// + if (nbSousGrilles > 0 && taillePasSousgrille > 0 && taillePasSousgrille < distanceEntre2Trait) { - } - } - if (drawGrid_ && w > 0) { - gtl.setTypeTrait(TraceLigne.TIRETE); - gtl.setCouleur(subColor); - gtl.setEpaisseur((float) 1); - gtl.dessineTrait(_g, tmp_.x_, _ordxAxe, tmp_.x_, _minYForAxe); - } + for (int k = 0; k < nbSousGrilles + 1; k++) { + // -- on trace un trait de couleur de subgrid --// + gtl.setTypeTrait(TraceLigne.POINTILLE); + gtl.setEpaisseur((float) 0.1); + gtl.setCouleur(this.couleurSousGraduation_); + double longueur = ((k) * taillePasSousgrille); + tmpSousGrille_.autoApplique(versEcran); + gtl.dessineTrait(_g, tmp_.x_ + longueur, _ordxAxe, tmp_.x_ + longueur, _minYForAxe); + } - } - } + longueurMoyenne = (int) (_xValue.getQuick(valNextPotable) - _xValue.getQuick(i)); + } - private void drawYaxe(final Graphics2D _g, final GrBoite _zv, final TDoubleArrayList _xValue, - final TDoubleArrayList _yValue, final GrMorphisme _versEcran, final int _absyAxe, final int _ordxAxe, - final double _minYForAxe) { - int minYDraw = _ordxAxe; - int maxYDraw = (int) _minYForAxe; + } + } + if (drawGrid_ && w > 0) { + gtl.setTypeTrait(TraceLigne.TIRETE); + gtl.setCouleur(subColor); + gtl.setEpaisseur((float) 1); + gtl.dessineTrait(_g, tmp_.x_, _ordxAxe, tmp_.x_, _minYForAxe); + } - // if (useCustom_) { - // tmp_.y_ = _zv.getMinY(); - // if (_yValue.size() > 0) { - // tmp_.y_ = Math.min(_yValue.get(0), tmp_.y_); - // } - // tmp_.autoApplique(_versEcran); - // tmp_.y_ = Math.floor(tmp_.y_); - // if (tmp_.y_ > minYDraw) { - // minYDraw = (int) tmp_.y_; - // } - // tmp_.y_ = _zv.getMaxY(); - // if (_yValue.size() > 1) { - // tmp_.y_ = Math.max(_yValue.get(_yValue.size() - 1), tmp_.y_); - // } - // tmp_.autoApplique(_versEcran); - // tmp_.y_ = Math.ceil(tmp_.y_); - // if (tmp_.y_ < maxYDraw) { - // maxYDraw = (int) tmp_.y_; - // } - // } - tl_.setCouleur(getDrawColor()); - tl_.setTypeTrait(TraceLigne.LISSE); - tl_.dessineTrait(_g, _absyAxe, minYDraw, _absyAxe, maxYDraw); - } + } + } - final TraceLigne tl_ = new TraceLigne(); + private void drawYaxe(final Graphics2D _g, final GrBoite _zv, final TDoubleArrayList _xValue, + final TDoubleArrayList _yValue, final GrMorphisme _versEcran, final int _absyAxe, final int _ordxAxe, + final double _minYForAxe) { + int minYDraw = _ordxAxe; + int maxYDraw = (int) _minYForAxe; - private void drawXAxe(final Graphics2D _g, final GrBoite _zv, final TDoubleArrayList _xValue, - final GrMorphisme _versEcran, final int _absyAxe, final int _ordxAxe, final double _maxXForAxe) { - int minXDraw = _absyAxe; - int maxXDraw = (int) _maxXForAxe; + // if (useCustom_) { + // tmp_.y_ = _zv.getMinY(); + // if (_yValue.size() > 0) { + // tmp_.y_ = Math.min(_yValue.get(0), tmp_.y_); + // } + // tmp_.autoApplique(_versEcran); + // tmp_.y_ = Math.floor(tmp_.y_); + // if (tmp_.y_ > minYDraw) { + // minYDraw = (int) tmp_.y_; + // } + // tmp_.y_ = _zv.getMaxY(); + // if (_yValue.size() > 1) { + // tmp_.y_ = Math.max(_yValue.get(_yValue.size() - 1), tmp_.y_); + // } + // tmp_.autoApplique(_versEcran); + // tmp_.y_ = Math.ceil(tmp_.y_); + // if (tmp_.y_ < maxYDraw) { + // maxYDraw = (int) tmp_.y_; + // } + // } + tl_.setCouleur(getDrawColor()); + tl_.setTypeTrait(TraceLigne.LISSE); + tl_.dessineTrait(_g, _absyAxe, minYDraw, _absyAxe, maxYDraw); + } - // if (useCustom_) { - // tmp_.x_ = _zv.getMinX(); - // if (_xValue.size() > 0) { - // tmp_.x_ = Math.min(_xValue.get(0), tmp_.x_); - // } - // tmp_.autoApplique(_versEcran); - // tmp_.x_ = Math.floor(tmp_.x_); - // if (tmp_.x_ < minXDraw) { - // minXDraw = (int) tmp_.x_; - // } - // tmp_.x_ = _zv.getMaxX(); - // if (_xValue.size() > 1) { - // tmp_.x_ = Math.max(_xValue.get(_xValue.size() - 1), tmp_.x_); - // } - // tmp_.autoApplique(_versEcran); - // tmp_.x_ = Math.ceil(tmp_.x_); - // if (tmp_.x_ < maxXDraw) { - // maxXDraw = (int) tmp_.x_; - // } - // } + final TraceLigne tl_ = new TraceLigne(); - tl_.setCouleur(getDrawColor()); - tl_.setTypeTrait(TraceLigne.LISSE); - tl_.dessineTrait(_g, minXDraw, _ordxAxe, maxXDraw, _ordxAxe); - } + private void drawXAxe(final Graphics2D _g, final GrBoite _zv, final TDoubleArrayList _xValue, + final GrMorphisme _versEcran, final int _absyAxe, final int _ordxAxe, final double _maxXForAxe) { + int minXDraw = _absyAxe; + int maxXDraw = (int) _maxXForAxe; - private void computeXValues(final GrBoite _zv, final Graphics2D _g, final TDoubleArrayList _xValue, - final TIntArrayList _xStrWidth, final List _xString, final NumberIterator _it) { - final Font font = getFont(); - if (font != null) { - _g.setFont(font); - } - final FontMetrics fm = font == null ? null : _g.getFontMetrics(font); + tl_.setCouleur(getDrawColor()); + tl_.setTypeTrait(TraceLigne.LISSE); + tl_.dessineTrait(_g, minXDraw, _ordxAxe, maxXDraw, _ordxAxe); + } - //-- mode manuel --// - if(!modeAutomatiqueX_){ - if(modeLongueurPasX_) - fillGraduationsWithPas(_g,this.valeurPasX_, _zv.getMinX(), _zv.getMaxX(), _xValue, _xStrWidth, _xString, fm); - else - fillGraduations(_g,getNbXGraduations(), _zv.getMinX(), _zv.getMaxX(), _xValue, _xStrWidth, _xString, fm); - return; - } + private void computeXValues(final GrBoite _zv, final Graphics2D _g, final TDoubleArrayList _xValue, + final TIntArrayList _xStrWidth, final List _xString, final NumberIterator _it) { + final Font font = getFont(); + if (font != null) { + _g.setFont(font); + } + final FontMetrics fm = font == null ? null : _g.getFontMetrics(font); - _it.init(_zv.getMinX(), _zv.getMaxX(), getNbXGraduations()); + // -- mode manuel --// + if (!modeAutomatiqueX_) { + if (modeLongueurPasX_) fillGraduationsWithPas(_g, this.valeurPasX_, _zv.getMinX(), _zv.getMaxX(), _xValue, + _xStrWidth, _xString, fm); + else fillGraduations(_g, getNbXGraduations(), _zv.getMinX(), _zv.getMaxX(), _xValue, _xStrWidth, _xString, fm); + return; + } - //_it= - while (_it.hasNext()) { - final double x = _it.currentValue(); - _xValue.add(x); + _it.init(_zv.getMinX(), _zv.getMaxX(), getNbXGraduations()); - if (font == null || !_it.isMajorTick()) { - _xStrWidth.add(0); - _xString.add(CtuluLibString.EMPTY_STRING); - } else { - final String currentLabel = _it.currentLabel(); - _xStrWidth.add(fm.stringWidth(currentLabel)); - _xString.add(currentLabel); - } - _it.next(); - } - } + // _it= + while (_it.hasNext()) { + final double x = _it.currentValue(); + _xValue.add(x); + if (font == null || !_it.isMajorTick()) { + _xStrWidth.add(0); + _xString.add(CtuluLibString.EMPTY_STRING); + } else { + final String currentLabel = _it.currentLabel(); + _xStrWidth.add(fm.stringWidth(currentLabel)); + _xString.add(currentLabel); + } + _it.next(); + } + } - public boolean isModeAutomatiqueX() { - return modeAutomatiqueX_; - } + public boolean isModeAutomatiqueX() { + return modeAutomatiqueX_; + } - public void setModeAutomatiqueX(boolean modeAutomatiqueX) { - this.modeAutomatiqueX_ = modeAutomatiqueX; - } + public void setModeAutomatiqueX(boolean modeAutomatiqueX) { + this.modeAutomatiqueX_ = modeAutomatiqueX; + } - public boolean isModeAutomatiqueY() { - return modeAutomatiqueY_; - } + public boolean isModeAutomatiqueY() { + return modeAutomatiqueY_; + } - public void setModeAutomatiqueY(boolean modeAutomatiqueY) { - this.modeAutomatiqueY_ = modeAutomatiqueY; - } + public void setModeAutomatiqueY(boolean modeAutomatiqueY) { + this.modeAutomatiqueY_ = modeAutomatiqueY; + } - /** - * Remplit les graduations correctement: nb cesures= nombre de trait sur l'ecran - * que ce soit pour le mode par taille de pas ou par nb de cesures. - * @param nbGraduations - * @param min - * @param max - * @param _xValue - * @param _xStrWidth - * @param _xString - */ - private double fillGraduations(Graphics2D _g,int nbGraduations,double min,double max,final TDoubleArrayList _xValue,final TIntArrayList _xStrWidth,final List _xString,FontMetrics fm ){ + /** + * Remplit les graduations correctement: nb cesures= nombre de trait sur l'ecran que ce soit pour le mode par taille + * de pas ou par nb de cesures. + * + * @param nbGraduations + * @param min + * @param max + * @param _xValue + * @param _xStrWidth + * @param _xString + */ + private double fillGraduations(Graphics2D _g, int nbGraduations, double min, double max, + final TDoubleArrayList _xValue, final TIntArrayList _xStrWidth, final List _xString, FontMetrics fm) { - //-- distance tot a couvrir --// - final double distance=max-min; - final int taillePas=(int) (distance/nbGraduations); - double yMax=0; + // -- distance tot a couvrir --// + final double distance = max - min;// e + final int taillePas = Math.max(1, (int) (distance / nbGraduations));// FREd ne fonctionne pas toujours si on a des + // valeurs <1 - for(int i=0;i<nbGraduations+1;i++){ - int cesure=(int) (min+(taillePas*(i))); - _xValue.add(cesure); - final String currentLabel =""+cesure; - _xStrWidth.add(fm.stringWidth(currentLabel)); - _xString.add(currentLabel); + double yMax = 0; + // boucle infinie ! - final double stringWidth = fm == null ? 0 : fm.getStringBounds(currentLabel, _g).getWidth(); - if (stringWidth > yMax) { - yMax = stringWidth; - } - if(i==nbGraduations) - if(cesure<max) - nbGraduations++; - } - return yMax; + for (int i = 0; i < nbGraduations + 1; i++) { + int cesure = (int) (min + (taillePas * (i))); + _xValue.add(cesure); + final String currentLabel = Integer.toString(cesure); + _xStrWidth.add(fm.stringWidth(currentLabel)); + _xString.add(currentLabel); + final double stringWidth = fm == null ? 0 : fm.getStringBounds(currentLabel, _g).getWidth(); + if (stringWidth > yMax) { + yMax = stringWidth; + } + // boucle infinie ! + if (i == nbGraduations) if (cesure < max) nbGraduations++; + // Fred truc tempo pour eviter les crashs + if (i > 100) break; + } + return yMax; - } + } + /** + * Remplit les graduations correctement: nb cesures= nombre de trait sur l'ecran que ce soit pour le mode par taille + * de pas ou par nb de cesures. + * + * @param nbGraduations + * @param min + * @param max + * @param _xValue + * @param _xStrWidth + * @param _xString + */ + private double fillGraduationsWithPas(Graphics2D _g, int pas, double min, double max, final TDoubleArrayList _xValue, + final TIntArrayList _xStrWidth, final List _xString, FontMetrics fm) { - /** - * Remplit les graduations correctement: nb cesures= nombre de trait sur l'ecran - * que ce soit pour le mode par taille de pas ou par nb de cesures. - * @param nbGraduations - * @param min - * @param max - * @param _xValue - * @param _xStrWidth - * @param _xString - */ - private double fillGraduationsWithPas(Graphics2D _g,int pas,double min,double max,final TDoubleArrayList _xValue,final TIntArrayList _xStrWidth,final List _xString,FontMetrics fm ){ + // -- distance tot a couvrir --// + final double distance = max - min; + final int taillePas = pas; + if (pas == 0) return 0; + int nbGraduations = (int) (distance / taillePas); + double yMax = 0; - //-- distance tot a couvrir --// - final double distance=max-min; - final int taillePas= pas; - if(pas==0) - return 0; - int nbGraduations=(int) (distance/taillePas); - double yMax=0; + for (int i = 0; i < nbGraduations + 1; i++) { + int cesure = (int) (min + (taillePas * (i))); + _xValue.add(cesure); + final String currentLabel = Integer.toString(cesure); + _xStrWidth.add(fm.stringWidth(currentLabel)); + _xString.add(currentLabel); - for(int i=0;i<nbGraduations+1;i++){ - int cesure=(int) (min+(taillePas*(i))); - _xValue.add(cesure); - final String currentLabel =""+cesure; - _xStrWidth.add(fm.stringWidth(currentLabel)); - _xString.add(currentLabel); + final double stringWidth = fm == null ? 0 : fm.getStringBounds(currentLabel, _g).getWidth(); + if (stringWidth > yMax) { + yMax = stringWidth; + } - final double stringWidth = fm == null ? 0 : fm.getStringBounds(currentLabel, _g).getWidth(); - if (stringWidth > yMax) { - yMax = stringWidth; - } - - if(i==nbGraduations){ - if(cesure<max) - nbGraduations++; - } + if (i == nbGraduations) { + if (cesure < max) nbGraduations++;// ATTENTION boucle infinie ! + } + if (i > 100) break;// a enlever bugfix temporaire. - } - return yMax; + } + return yMax; + } - } + private double computeYValues(final Graphics2D _g, final GrBoite _zv, final TDoubleArrayList _yValue, + final TIntArrayList _yStrWidth, final List _yString) { + final Font font = getFont(); + if (font != null) { + _g.setFont(font); + } + final FontMetrics fm = font == null ? null : _g.getFontMetrics(font); + double yMax = 0; + NumberIterator it; - private double computeYValues(final Graphics2D _g, final GrBoite _zv, final TDoubleArrayList _yValue, - final TIntArrayList _yStrWidth, final List _yString) { - final Font font = getFont(); - if (font != null) { - _g.setFont(font); - } - final FontMetrics fm = font == null ? null : _g.getFontMetrics(font); - double yMax = 0; - NumberIterator it; + // -- mode manuel --// + if (!modeAutomatiqueY_) { + if (modeLongueurPasY_) yMax = fillGraduationsWithPas(_g, this.valeurPasY_, _zv.getMinY(), _zv.getMaxY(), _yValue, + _yStrWidth, _yString, fm); + else yMax = fillGraduations(_g, nbGraduationY_, _zv.getMinY(), _zv.getMaxY(), _yValue, _yStrWidth, _yString, fm); + return yMax; + } + it = new NumberIterator(); + it.init(_zv.getMinY(), _zv.getMaxY(), getNbYGraduations()); + while (it.hasNext()) { + final double x = it.currentValue(); + _yValue.add(x); + if (font == null || !it.isMajorTick()) { + _yStrWidth.add(0); + _yString.add(CtuluLibString.EMPTY_STRING); + } else { + final String currentLabel = it.currentLabel(); + final double stringWidth = fm == null ? 0 : fm.getStringBounds(currentLabel, _g).getWidth(); + if (stringWidth > yMax) { + yMax = stringWidth; + } + _yStrWidth.add((int) stringWidth); + _yString.add(currentLabel); + } + it.next(); + } + return yMax; + } - //-- mode manuel --// - if(!modeAutomatiqueY_){ - if(modeLongueurPasY_) - yMax=fillGraduationsWithPas(_g,this.valeurPasY_, _zv.getMinY(), _zv.getMaxY(), _yValue, _yStrWidth, _yString, fm); - else - yMax=fillGraduations(_g,nbGraduationY_, _zv.getMinY(), _zv.getMaxY(), _yValue, _yStrWidth, _yString, fm); - return yMax; - } + // private void updateBounds(final GrBoite _zv) { + // if (useCustom_ && customBounds_ != null) { + // _zv.o_.x_ = Math.max(_zv.o_.x_, customBounds_.getMinX()); + // _zv.e_.x_ = Math.min(_zv.e_.x_, customBounds_.getMaxX()); + // _zv.o_.y_ = Math.max(_zv.o_.y_, customBounds_.getMinY()); + // _zv.e_.y_ = Math.min(_zv.e_.y_, customBounds_.getMaxY()); + // } + // } - it = new NumberIterator(); - it.init(_zv.getMinY(), _zv.getMaxY(), getNbYGraduations()); - while (it.hasNext()) { + // Icon + /** + * Dessin de l'icone. + * + * @param _c composant dont l'icone peut deriver des proprietes (couleur, ...). Ce parametre peut etre <I>null</I>. Il + * est ignore ici. + * @param _g le graphics sur lequel dessiner l'icone + * @param _x lieu cible de l'icone (x) + * @param _y lieu cible de l'icone (y) + */ + public void paintIcon(final Component _c, final Graphics _g, final int _x, final int _y) { + super.paintIcon(_c, _g, _x, _y); + Color fg = getForeground(); + if (isAttenue()) { + fg = attenueCouleur(fg); + } + _g.setColor(fg); + final int w = getIconWidth(); + final int h = getIconHeight(); + for (int i = 6; i < w - 2; i += 8) { + _g.drawLine(_x + i, _y + 1, _x + i, _y + h - 1); + } + for (int j = 6; j < h - 2; j += 8) { + _g.drawLine(_x + 1, _y + j, _x + w - 1, _y + j); + } + } - final double x = it.currentValue(); - _yValue.add(x); - if (font == null || !it.isMajorTick()) { - _yStrWidth.add(0); - _yString.add(CtuluLibString.EMPTY_STRING); - } else { - final String currentLabel = it.currentLabel(); - final double stringWidth = fm == null ? 0 : fm.getStringBounds(currentLabel, _g).getWidth(); - if (stringWidth > yMax) { - yMax = stringWidth; - } - _yStrWidth.add((int) stringWidth); - _yString.add(currentLabel); - } - it.next(); - } - return yMax; - } + public void paintSelection(final Graphics2D _g, final ZSelectionTrace _trace, final GrMorphisme _versEcran, + final GrBoite _clipReel) {} - // private void updateBounds(final GrBoite _zv) { - // if (useCustom_ && customBounds_ != null) { - // _zv.o_.x_ = Math.max(_zv.o_.x_, customBounds_.getMinX()); - // _zv.e_.x_ = Math.min(_zv.e_.x_, customBounds_.getMaxX()); - // _zv.o_.y_ = Math.max(_zv.o_.y_, customBounds_.getMinY()); - // _zv.e_.y_ = Math.min(_zv.e_.y_, customBounds_.getMaxY()); - // } - // } + public CtuluListSelection selection(final GrPoint _pt, final int _tolerance) { + return null; + } - // Icon - /** - * Dessin de l'icone. - * - * @param _c composant dont l'icone peut deriver des proprietes (couleur, ...). Ce parametre peut etre <I>null</I>. Il - * est ignore ici. - * @param _g le graphics sur lequel dessiner l'icone - * @param _x lieu cible de l'icone (x) - * @param _y lieu cible de l'icone (y) - */ - public void paintIcon(final Component _c, final Graphics _g, final int _x, final int _y) { - super.paintIcon(_c, _g, _x, _y); - Color fg = getForeground(); - if (isAttenue()) { - fg = attenueCouleur(fg); - } - _g.setColor(fg); - final int w = getIconWidth(); - final int h = getIconHeight(); - for (int i = 6; i < w - 2; i += 8) { - _g.drawLine(_x + i, _y + 1, _x + i, _y + h - 1); - } - for (int j = 6; j < h - 2; j += 8) { - _g.drawLine(_x + 1, _y + j, _x + w - 1, _y + j); - } - } + public CtuluListSelection selection(final LinearRing _poly, final int _mode) { + return null; + } - public void paintSelection(final Graphics2D _g, final ZSelectionTrace _trace, final GrMorphisme _versEcran, - final GrBoite _clipReel) {} + public LineString getSelectedLine() { + return null; + } - public CtuluListSelection selection(final GrPoint _pt, final int _tolerance) { - return null; - } + /** + * Affectation de la propriete <I>boite</I>. + */ + // public void setBoite(final GrBoite _v) { + // if (boite_ != _v) { + // final GrBoite vp = boite_; + // boite_ = _v; + // firePropertyChange("boite", vp, _v); + // } + // } + public void setVisible(final boolean _v) { + // if (_v && boite_ == null) { + // boite_ = vue_.getAbstractCalque().getDomaine(); + // } + if (!_v) { + vue_.setUserInsets(null); + super.setVisible(false); + } else { + super.setVisible(_v); + } + firePropertyChange("grille", true, false); - public CtuluListSelection selection(final LinearRing _poly, final int _mode) { - return null; - } + } - public LineString getSelectedLine() { - return null; - } + public boolean isDrawGrid() { + return drawGrid_; + } - /** - * Affectation de la propriete <I>boite</I>. - */ - // public void setBoite(final GrBoite _v) { - // if (boite_ != _v) { - // final GrBoite vp = boite_; - // boite_ = _v; - // firePropertyChange("boite", vp, _v); - // } - // } - public void setVisible(final boolean _v) { - // if (_v && boite_ == null) { - // boite_ = vue_.getAbstractCalque().getDomaine(); - // } - if (!_v) { - vue_.setUserInsets(null); - super.setVisible(false); - } else { - super.setVisible(_v); - } - firePropertyChange("grille", true, false); + public void setDrawGrid(final boolean _drawGrid) { + if (_drawGrid != drawGrid_) { + drawGrid_ = _drawGrid; + grilleChanged(); + } + } - } + // public boolean isUseCustom() { + // return useCustom_; + // } + // + // public void setUseCustom(final boolean _useCustom) { + // if (useCustom_ != _useCustom) { + // useCustom_ = _useCustom; + // repaint(); + // } + // } + // + // public Envelope getCustomBounds() { + // return customBounds_ == null ? null : new Envelope(customBounds_); + // } + // + // public void setCustomBounds(final Envelope _customBounds) { + // if (customBounds_ != _customBounds) { + // customBounds_ = _customBounds; + // repaint(); + // } + // } - public boolean isDrawGrid() { - return drawGrid_; - } + public boolean isDrawX() { + return drawX_; + } - public void setDrawGrid(final boolean _drawGrid) { - if (_drawGrid != drawGrid_) { - drawGrid_ = _drawGrid; - grilleChange... [truncated message content] |