IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

API standards et tierces Java Discussion :

cartographie en Java aide


Sujet :

API standards et tierces Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre régulier
    Homme Profil pro
    Étudiant
    Inscrit en
    Août 2012
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Août 2012
    Messages : 7
    Par défaut cartographie en Java aide
    Bonjours,
    j'ai besoin de réaliser une carte graphique en java dc en cherchant j'ai trouver la librairie geotool:" http://jsorel.developpez.com/tutoriels/java/geotools/?page=chap_1#LII"
    j'ai essayer avec ce programme mais j'ai l'erreur suivante:
    Exception in thread "main" java.lang.NoSuchMethodError: org.geotools.styling.PolygonSymbolizer.setStroke(Lorg/geotools/stylin/StrokeV

    je sais qu'il ne trouve pas la méthode setStroke de la classe PolygonSymbolizer mais qd je cherche la classe et voir les methode dedans il n 'ya pas cette methode : http://docs.geotools.org/stable/java...otools.styling

    merci de m'aider svp c est urgent

  2. #2
    Membre chevronné Avatar de ruscov
    Homme Profil pro
    Architecte de système d'information
    Inscrit en
    Mars 2007
    Messages
    347
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : Belgique

    Informations professionnelles :
    Activité : Architecte de système d'information

    Informations forums :
    Inscription : Mars 2007
    Messages : 347
    Par défaut
    Moi je la trouve : http://docs.geotools.org/stable/java...tyle.Stroke%29

    Montre nous ton code (import compris) et indique nous la ligne qui plante.

  3. #3
    Membre régulier
    Homme Profil pro
    Étudiant
    Inscrit en
    Août 2012
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Août 2012
    Messages : 7
    Par défaut le Code
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    package javaapplication9;
     
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.FlowLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.net.URL;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JMenu;
    import javax.swing.JMenuBar;
    import javax.swing.JMenuItem;
    import javax.swing.JPanel;
    import org.geotools.data.FeatureSource;
    import org.geotools.data.Query;
    import org.geotools.data.shapefile.ShapefileDataStore;
    import org.geotools.gui.swing.JMapPane;
    import org.geotools.map.DefaultMapContext;
    import org.geotools.map.DefaultMapLayer;
    import org.geotools.map.MapContext;
    import org.geotools.map.MapLayer;
    import org.geotools.renderer.lite.StreamingRenderer;
    import org.geotools.styling.LineSymbolizer;
    import org.geotools.styling.PolygonSymbolizer;
    import org.geotools.styling.Style;
    import org.geotools.styling.StyleBuilder;
     
    public class Carte {
     
        private JMapPane mappane = new JMapPane();
     
        public Carte() {
            JFrame frm = new JFrame();
            frm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frm.setSize(800, 600);
            frm.setTitle("Ma Première carte avec GeoTools");
     
     
            JPanel pfond = new JPanel(new BorderLayout());
            frm.setContentPane(pfond);
     
            frm.setJMenuBar(buildMenu());
            frm.getContentPane().add(BorderLayout.CENTER, buildMap());
            frm.getContentPane().add(BorderLayout.NORTH, buildTool());
     
            frm.setVisible(true);
        }
     
        private JMenuBar buildMenu() {
            JMenuBar menu = new JMenuBar();
            JMenu mfichier = new JMenu("Fichier");
            JMenuItem iquitter = new JMenuItem("Quitter");
            iquitter.addActionListener(new ActionListener() {
     
                public void actionPerformed(ActionEvent e) {
                    System.exit(0);
                }
            });
            mfichier.add(iquitter);
            menu.add(mfichier);
     
            return menu;
        }
     
        private JPanel buildMap() {
     
            mappane.setBackground(new Color(157, 201, 255));
     
            try {
     
                MapContext mapcontext = new DefaultMapContext();
                mapcontext.setTitle("Projet");
     
                mappane.setContext(mapcontext);
     
                MapLayer maplayer;
                URL shapeURL = Carte.class.getResource("/occ_sol.shp");
     
                ShapefileDataStore store = new ShapefileDataStore(shapeURL);
                String name = store.getTypeNames()[0];
                FeatureSource source = store.getFeatureSource(name);
                StyleBuilder sb = new StyleBuilder();
     
                PolygonSymbolizer ps = sb.createPolygonSymbolizer(new Color(253, 241, 187), new Color(163, 151, 97), 1);
                Style solstyle = sb.createStyle();
                solstyle.addFeatureTypeStyle(sb.createFeatureTypeStyle(ps));
                maplayer = new DefaultMapLayer(source, solstyle);
                maplayer.setTitle("occ_sol.shp");
                maplayer.setVisible(true);
                maplayer.setQuery(Query.ALL);
                mapcontext.addLayer(maplayer);
     
                shapeURL = Carte.class.getResource("/reseau_route.shp");
     
                store = new ShapefileDataStore(shapeURL);
                name = store.getTypeNames()[0];
                source = store.getFeatureSource(name);
     
                sb = new StyleBuilder();
     
                LineSymbolizer ls2 = sb.createLineSymbolizer(Color.RED, 1);
                Style roadsStyle = sb.createStyle();
                roadsStyle.addFeatureTypeStyle(sb.createFeatureTypeStyle(ls2));
     
                maplayer = new DefaultMapLayer(source, roadsStyle);
                maplayer.setTitle("reseau_route.shp");
                maplayer.setVisible(true);
                maplayer.setQuery(Query.ALL);
                mapcontext.addLayer(maplayer);
     
                StreamingRenderer render = new StreamingRenderer();
     
                mappane.setRenderer(render);
                mappane.setMapArea(mapcontext.getLayerBounds());
     
     
            } catch (Exception e) {
                e.printStackTrace();
            }
     
            return mappane;
        }
     
         private JPanel buildTool() {
            JPanel outil = new JPanel(new FlowLayout(FlowLayout.LEFT));
     
            JButton plus = new JButton("+");
            plus.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    mappane.setState(JMapPane.ZoomIn);
                }
            });
            outil.add(plus);
     
            JButton moins = new JButton("-");
            moins.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    mappane.setState(JMapPane.ZoomOut);
                }
            });
            outil.add(moins);
     
            JButton pan = new JButton("Pan");
            pan.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    mappane.setState(JMapPane.Pan);
                }
            });
            outil.add(pan);
     
            return outil;
        }
     
     
        // public static void main(String[] args){
          //   new Chap1Contact();
         //}
     
    }

  4. #4
    Membre régulier
    Homme Profil pro
    Étudiant
    Inscrit en
    Août 2012
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Août 2012
    Messages : 7
    Par défaut
    j'ai importer les JAR de Geotool

  5. #5
    Membre chevronné Avatar de ruscov
    Homme Profil pro
    Architecte de système d'information
    Inscrit en
    Mars 2007
    Messages
    347
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : Belgique

    Informations professionnelles :
    Activité : Architecte de système d'information

    Informations forums :
    Inscription : Mars 2007
    Messages : 347
    Par défaut
    Est ce que tu as la bonne version de Jar importée dans ton projet?

Discussions similaires

  1. [JAVA] Aide pour client/Serveur
    Par Caranille dans le forum Débuter avec Java
    Réponses: 1
    Dernier message: 14/08/2013, 11h53
  2. librerie Goetool cartographie en JAVA
    Par ismailovic22 dans le forum Général Java
    Réponses: 0
    Dernier message: 17/05/2013, 13h28
  3. Programme JAVA - aide minime
    Par andreou dans le forum Débuter avec Java
    Réponses: 13
    Dernier message: 12/05/2013, 20h55
  4. Cartographie en Java
    Par BoBy9 dans le forum SIG : Système d'information Géographique
    Réponses: 4
    Dernier message: 01/06/2008, 15h57
  5. Cartographie en JAVA
    Par m@t dans le forum Multimédia
    Réponses: 2
    Dernier message: 01/11/2007, 03h05

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo