Revision 3018 trunk/extensions/extCatalogYNomenclator/src/es/gva/cit/gvsig/gazetteer/loaders/FeatureLoader.java

View differences:

FeatureLoader.java
40 40
*/
41 41
package es.gva.cit.gvsig.gazetteer.loaders;
42 42

  
43
import java.awt.Graphics;
44
import java.awt.Graphics2D;
45
import java.awt.geom.Point2D;
46
import java.awt.geom.Rectangle2D;
47
import java.awt.image.BufferedImage;
48
import java.io.File;
49
import java.io.IOException;
50
import java.net.MalformedURLException;
51
import java.net.URL;
52
import java.util.ArrayList;
53

  
54
import javax.imageio.ImageIO;
55

  
56
import org.cresques.cts.ICoordTrans;
57
import org.cresques.cts.gt2.CoordSys;
58
import org.cresques.cts.gt2.CoordTrans;
59
import org.cresques.geo.Ellipsoid;
60
import org.cresques.geo.Mercator;
61
import org.cresques.geo.Projection;
62
import org.cresques.geo.ViewPortData;
63

  
64
import com.iver.andami.PluginServices;
65
import com.iver.andami.plugins.Extension;
66
import com.iver.andami.ui.mdiManager.ViewInfo;
67
import com.iver.cit.gvsig.ProjectExtension;
68
import com.iver.cit.gvsig.RasterizerLayer;
69
import com.iver.cit.gvsig.fmap.DriverException;
70
import com.iver.cit.gvsig.fmap.ViewPort;
71
import com.iver.cit.gvsig.fmap.core.v02.FLabel;
43 72
import com.iver.cit.gvsig.fmap.layers.FLayer;
73
import com.iver.cit.gvsig.fmap.layers.FLyrText;
74
import com.iver.cit.gvsig.fmap.operations.Cancellable;
75
import com.iver.cit.gvsig.gui.layout.FLayoutDraw;
76
import com.iver.cit.gvsig.project.Project;
77
import com.iver.cit.gvsig.project.ProjectView;
44 78

  
45 79
import es.gva.cit.gazetteer.querys.Feature;
46 80
import es.gva.cit.gvsig.catalogClient.loaders.AbstractLoader;
......
75 109
		return false;
76 110
	}
77 111
    /**
78
     * It creates the new Feature layer into gvSIG
112
     * It adds the new Feature layer into gvSIG
79 113
     * @param feature
80 114
     * Feature to load
81 115
     * @return
82
     */
83
    
84
    private FLayer createFeatureLayer(Feature feature) {
85
       
116
     * @throws DriverException
117
     * @throws IOException
118
     * @throws MalformedURLException
119
     */    
120
    private FLayer createFeatureLayer(Feature feature) throws DriverException, MalformedURLException, IOException {
121
        ProjectExtension pe = (ProjectExtension) PluginServices.getExtension(com.iver.cit.gvsig.ProjectExtension.class);
122
        Project p = pe.getProject();
123
        ProjectView v = (ProjectView) p.getViews().get(0);
124
        v.getMapContext().getViewPort().setExtent(new Rectangle2D.Double(feature.getCoordinates().getX() - 0.05,
125
                feature.getCoordinates().getY() - 0.05,
126
                0.1,
127
                0.1));
128
        
129
           //ViewPort viewPort =  new ViewPort(Mercator.getProjection(Ellipsoid.ed50));
130
        
131
        /*
132
        FLabel label = new FLabel(feature.getName(),feature.getCoordinates(),20,0);
133
                
134
        ArrayList al = new ArrayList();
135
        al.add(0,label);
136
        
137
        FLyrText ft = new FLyrText(al);
138
        ft.setName(feature.getName());
139
           
140
        */
141
        //ICoordTrans ct = new CoordTrans((CoordSys) proj,
142
          //    (CoordSys) wi.getProjection());
143
      
144
        //ft.setCoordTrans(ct);
145
        
146
        
147
        /*
148
        FLayoutDraw fld = new FLayoutDraw(new Layout());
149
        Graphics2D g2d = null;
150
        
151
        BufferedImage img = ImageIO.read(new URL("http://sercartlin:8080/geonetwork/srv/es/resources.getgraphover?id=78&fname=31es.jpg"));
152
                
153
        BufferedImage image = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB);
154
        g2d = (Graphics2D) image.getGraphics();
155
               
156
        fld.drawLayout(g2d, img);
157
        */
158
        Cancellable cancel = new Cancellable() {
159
            public boolean isCanceled() {
160
                return false;
161
            }
162
        };
163
        
164
        //ft.draw(null,null,v.getMapContext().getViewPort(),cancel,1);
165
        
166
                
86 167
        return null;
87 168
	   
88 169
	}

Also available in: Unified diff