Revision 41676
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/main/java/org/gvsig/fmap/mapcontext/rendering/legend/styling/ILabelingStrategy.java | ||
---|---|---|
93 | 93 |
* @param dpi TODO |
94 | 94 |
* @throws ReadException |
95 | 95 |
*/ |
96 |
public void draw(BufferedImage mapImage, Graphics2D mapGraphics, ViewPort viewPort, |
|
96 |
public void draw(BufferedImage mapImage, Graphics2D mapGraphics, double scale, ViewPort viewPort,
|
|
97 | 97 |
Cancellable cancel, double dpi) throws ReadException; |
98 | 98 |
|
99 | 99 |
/** |
... | ... | |
105 | 105 |
* @param properties |
106 | 106 |
* @throws ReadException |
107 | 107 |
*/ |
108 |
public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel, PrintAttributes properties) |
|
108 |
public void print(Graphics2D g, double scale, ViewPort viewPort, Cancellable cancel, PrintAttributes properties)
|
|
109 | 109 |
throws ReadException; |
110 | 110 |
|
111 | 111 |
/** |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/main/java/org/gvsig/fmap/mapcontext/rendering/legend/styling/ILabelClass.java | ||
---|---|---|
34 | 34 |
import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolDrawingException; |
35 | 35 |
import org.gvsig.fmap.mapcontext.rendering.symbols.styles.ILabelStyle; |
36 | 36 |
import org.gvsig.tools.persistence.Persistent; |
37 |
import org.gvsig.tools.lang.Cloneable; |
|
37 | 38 |
|
38 |
public interface ILabelClass extends Persistent, CartographicSupport{ |
|
39 |
public interface ILabelClass extends Cloneable, Persistent, CartographicSupport{
|
|
39 | 40 |
|
40 | 41 |
/** |
41 | 42 |
* Returns true if the label will be showed in the map |
... | ... | |
45 | 46 |
boolean isVisible(); |
46 | 47 |
|
47 | 48 |
/** |
49 |
* Returns true if the label will be showed in the map |
|
50 |
* |
|
51 |
* @return isVisible boolean |
|
52 |
*/ |
|
53 |
boolean isVisible(double scale); |
|
54 |
|
|
55 |
/** |
|
48 | 56 |
* Sets the visibility of the label in the map. |
49 | 57 |
* |
50 | 58 |
* @param isVisible boolean |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/main/java/org/gvsig/fmap/mapcontext/layers/vectorial/FLyrVect.java | ||
---|---|---|
777 | 777 |
double scale, |
778 | 778 |
double dpi) throws ReadException { |
779 | 779 |
if (strategy != null && isWithinScale(scale)) { |
780 |
strategy.draw(image, g, viewPort, cancel, dpi); |
|
780 |
strategy.draw(image, g, scale, viewPort, cancel, dpi);
|
|
781 | 781 |
} |
782 | 782 |
} |
783 | 783 |
|
... | ... | |
787 | 787 |
double scale, |
788 | 788 |
PrintAttributes properties) throws ReadException { |
789 | 789 |
if (strategy != null) { |
790 |
strategy.print(g, viewPort, cancel, properties); |
|
790 |
strategy.print(g, scale, viewPort, cancel, properties);
|
|
791 | 791 |
} |
792 | 792 |
} |
793 | 793 |
|
... | ... | |
917 | 917 |
featureQuery.setAttributeNames(names); |
918 | 918 |
featureQuery.setFeatureTypeId(featureType.getId()); |
919 | 919 |
} |
920 |
String geomName = featureStore.getDefaultFeatureType() |
|
920 |
String geomName = featureStore.getDefaultFeatureType()
|
|
921 | 921 |
.getDefaultGeometryAttributeName(); |
922 | 922 |
|
923 | 923 |
Envelope query_env = fromViewPortCRSToSourceCRS(this, envelope); |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.labeling.app/org.gvsig.labeling.app.mainplugin/src/main/java/org/gvsig/labeling/label/SmartTextSymbolLabelClass.java | ||
---|---|---|
59 | 59 |
import org.gvsig.tools.ToolsLocator; |
60 | 60 |
import org.gvsig.tools.dynobject.DynStruct; |
61 | 61 |
import org.gvsig.tools.persistence.PersistenceManager; |
62 |
import org.gvsig.tools.persistence.PersistentContext; |
|
62 | 63 |
import org.gvsig.tools.persistence.PersistentState; |
63 | 64 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
65 |
import org.gvsig.tools.persistence.spi.PersistentContextServices; |
|
64 | 66 |
|
65 | 67 |
|
66 | 68 |
/** |
... | ... | |
189 | 191 |
return defLabelClass.isVisible(); |
190 | 192 |
} |
191 | 193 |
|
194 |
public boolean isVisible(double scale) { |
|
195 |
return this.isVisible(); |
|
196 |
} |
|
197 |
|
|
192 | 198 |
public void setVisible(boolean isVisible) { |
193 | 199 |
defLabelClass.setVisible(isVisible); |
194 | 200 |
} |
... | ... | |
287 | 293 |
return defLabelClass.getStringLabelExpression(); |
288 | 294 |
} |
289 | 295 |
|
296 |
public Object clone() throws CloneNotSupportedException { |
|
290 | 297 |
|
298 |
PersistenceManager persman = ToolsLocator.getPersistenceManager(); |
|
299 |
|
|
300 |
PersistentContext context = null; |
|
301 |
Object resp = null; |
|
302 |
PersistentState state = null; |
|
303 |
try { |
|
304 |
state = persman.getState(this, true); |
|
305 |
} catch (PersistenceException e) { |
|
306 |
logger.warn("Can't clone, return me !!!!!!!!!!!!!!", e); |
|
307 |
return this; |
|
308 |
} |
|
309 |
context = state.getContext(); |
|
310 |
if (context instanceof PersistentContextServices) { |
|
311 |
/* |
|
312 |
* Ensure that previous instances are not used, |
|
313 |
* so objects are recreated |
|
314 |
*/ |
|
315 |
((PersistentContextServices) context).clear(); |
|
316 |
} |
|
317 |
try { |
|
318 |
resp = persman.create(state); |
|
319 |
} catch (Exception e) { |
|
320 |
logger.warn("Can't clone, return me !!!!!!!!!!!!!!", e); |
|
321 |
return this; |
|
322 |
} |
|
323 |
return resp; |
|
324 |
|
|
325 |
} |
|
326 |
|
|
291 | 327 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.labeling.app/org.gvsig.labeling.app.mainplugin/src/main/java/org/gvsig/labeling/label/GeneralLabelingStrategy.java | ||
---|---|---|
240 | 240 |
} |
241 | 241 |
} |
242 | 242 |
public void draw(BufferedImage mapImage, Graphics2D mapGraphics, |
243 |
ViewPort viewPort, |
|
243 |
double scale, ViewPort viewPort,
|
|
244 | 244 |
Cancellable cancel, |
245 | 245 |
double dpi) throws ReadException { |
246 | 246 |
|
... | ... | |
299 | 299 |
*/ |
300 | 300 |
for (ILabelClass lc : ts) { |
301 | 301 |
|
302 |
if (!lc.isVisible()) { |
|
302 |
if (!lc.isVisible(scale)) {
|
|
303 | 303 |
/* |
304 | 304 |
* Avoid non-visible labels |
305 | 305 |
*/ |
... | ... | |
885 | 885 |
} |
886 | 886 |
|
887 | 887 |
public void print( |
888 |
Graphics2D g, ViewPort viewPort, |
|
888 |
Graphics2D g, double scale, ViewPort viewPort,
|
|
889 | 889 |
Cancellable cancel, PrintAttributes properties) |
890 | 890 |
throws ReadException { |
891 | 891 |
|
... | ... | |
904 | 904 |
/* signal printing output */ |
905 | 905 |
printMode = true; |
906 | 906 |
|
907 |
draw(null,g,viewPort,cancel,dpi); |
|
907 |
draw(null,g,scale, viewPort,cancel,dpi);
|
|
908 | 908 |
} |
909 | 909 |
|
910 | 910 |
public String[] getUsedFields() { |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.labeling.app/org.gvsig.labeling.app.mainplugin/src/main/java/org/gvsig/labeling/gui/layerproperties/LabelClassProperties.java | ||
---|---|---|
49 | 49 |
import java.awt.GridLayout; |
50 | 50 |
import java.awt.event.ActionEvent; |
51 | 51 |
import java.awt.event.ActionListener; |
52 |
import java.util.logging.Level; |
|
52 | 53 |
|
53 | 54 |
import javax.swing.AbstractCellEditor; |
54 | 55 |
import javax.swing.BorderFactory; |
... | ... | |
351 | 352 |
return; |
352 | 353 |
|
353 | 354 |
lc = labelClass; |
354 |
clonedClass = (ILabelClass) LabelClassUtils.clone(lc); |
|
355 |
|
|
356 |
try { |
|
357 |
clonedClass = (ILabelClass) lc.clone(); |
|
358 |
} catch (CloneNotSupportedException ex) { |
|
359 |
clonedClass = lc; |
|
360 |
} |
|
355 | 361 |
|
356 | 362 |
labelPreview.setLabelClass(clonedClass); |
357 | 363 |
boolean clo_use_sql = LabelClassUtils.isUseSqlQuery(clonedClass); |
trunk/org.gvsig.desktop/pom.xml | ||
---|---|---|
1943 | 1943 |
URL u = new URL(url); |
1944 | 1944 |
String[] x = u.getPath().split("/"); |
1945 | 1945 |
String path = ""; |
1946 |
for( int i=1; i<x.length; i++ ) { path = path + "/" + x[i]; URL t = new URL(u,path) ; mkdir(t.toString()); } } public void mkdir(String url) throws Exception { |
|
1946 |
for( int i=1; i<x.length; i++ ) { |
|
1947 |
path = path + "/" + x[i]; |
|
1948 |
URL t = new URL(u,path) ; |
|
1949 |
mkdir(t.toString()); |
|
1950 |
} |
|
1951 |
} |
|
1952 |
|
|
1953 |
public void mkdir(String url) throws Exception { |
|
1947 | 1954 |
if( ! exists(url) ) { |
1948 | 1955 |
log.info("[WEBDAV] mkdir '"+url+"'."); |
1949 | 1956 |
sardine.createDirectory(url); |
trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/legend/styling/LabelClass.java | ||
---|---|---|
112 | 112 |
import org.gvsig.tools.ToolsLocator; |
113 | 113 |
import org.gvsig.tools.dynobject.DynStruct; |
114 | 114 |
import org.gvsig.tools.persistence.PersistenceManager; |
115 |
import org.gvsig.tools.persistence.Persistent; |
|
116 |
import org.gvsig.tools.persistence.PersistentContext; |
|
115 | 117 |
import org.gvsig.tools.persistence.PersistentState; |
116 | 118 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
119 |
import org.gvsig.tools.persistence.spi.PersistentContextServices; |
|
117 | 120 |
import org.gvsig.tools.util.Callable; |
118 | 121 |
import org.slf4j.Logger; |
119 | 122 |
import org.slf4j.LoggerFactory; |
... | ... | |
171 | 174 |
} |
172 | 175 |
|
173 | 176 |
/** |
177 |
* Returns true if the label will be showed in the map |
|
178 |
* |
|
179 |
* @return isVisible boolean |
|
180 |
*/ |
|
181 |
public boolean isVisible(double scale) { |
|
182 |
return isVisible(); |
|
183 |
} |
|
184 |
|
|
185 |
/** |
|
174 | 186 |
* Sets the visibility of the label in the map. |
175 | 187 |
* |
176 | 188 |
* @param isVisible boolean |
... | ... | |
655 | 667 |
return expr; |
656 | 668 |
} |
657 | 669 |
|
670 |
public Object clone() throws CloneNotSupportedException { |
|
658 | 671 |
|
672 |
PersistenceManager persman = ToolsLocator.getPersistenceManager(); |
|
673 |
|
|
674 |
PersistentContext context = null; |
|
675 |
Object resp = null; |
|
676 |
PersistentState state = null; |
|
677 |
try { |
|
678 |
state = persman.getState(this, true); |
|
679 |
} catch (PersistenceException e) { |
|
680 |
logger.warn("Can't clone, return me !!!!!!!!!!!!!!", e); |
|
681 |
return this; |
|
682 |
} |
|
683 |
context = state.getContext(); |
|
684 |
if (context instanceof PersistentContextServices) { |
|
685 |
/* |
|
686 |
* Ensure that previous instances are not used, |
|
687 |
* so objects are recreated |
|
688 |
*/ |
|
689 |
((PersistentContextServices) context).clear(); |
|
690 |
} |
|
691 |
try { |
|
692 |
resp = persman.create(state); |
|
693 |
} catch (Exception e) { |
|
694 |
logger.warn("Can't clone, return me !!!!!!!!!!!!!!", e); |
|
695 |
return this; |
|
696 |
} |
|
697 |
return resp; |
|
698 |
|
|
699 |
} |
|
700 |
|
|
701 |
|
|
702 |
|
|
659 | 703 |
|
660 | 704 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/legend/styling/AttrInTableLabelingStrategy.java | ||
---|---|---|
143 | 143 |
this.zoom = constraints; |
144 | 144 |
} |
145 | 145 |
|
146 |
private double getScale(ViewPort vp, PrintAttributes patts) |
|
147 |
throws ReadException { |
|
146 |
// private double getScale(ViewPort vp, PrintAttributes patts) |
|
147 |
// throws ReadException { |
|
148 |
// |
|
149 |
// double dpi = 0; |
|
150 |
// if (patts != null) { |
|
151 |
// int len = PrintAttributes.PRINT_QUALITY_DPI.length; |
|
152 |
// int priq = patts.getPrintQuality(); |
|
153 |
// if (priq < 0 || priq >= len) { |
|
154 |
// dpi = vp.getDPI(); |
|
155 |
// } else { |
|
156 |
// dpi = PrintAttributes.PRINT_QUALITY_DPI[priq]; |
|
157 |
// } |
|
158 |
// } else { |
|
159 |
// dpi = vp.getDPI(); |
|
160 |
// } |
|
161 |
// |
|
162 |
// // ============== We have dpi now ==================== |
|
163 |
// IProjection proj = vp.getProjection(); |
|
164 |
// |
|
165 |
// if (vp.getImageSize() == null || vp.getAdjustedEnvelope() == null) { |
|
166 |
// throw new ReadException("", |
|
167 |
// new Exception("Viewport does not have image size or envelope")); |
|
168 |
// } |
|
169 |
// |
|
170 |
// double[] trans2Meter = MapContext.getDistanceTrans2Meter(); |
|
171 |
// if (proj == null) { |
|
172 |
// double wmeters = ((vp.getImageSize().width / dpi) * 0.0254); |
|
173 |
// return (long) ((trans2Meter[vp.getMapUnits()] * vp.getAdjustedEnvelope().getLength(0)) |
|
174 |
// / wmeters); |
|
175 |
// } else { |
|
176 |
// return Math.round(proj.getScale( |
|
177 |
// vp.getAdjustedEnvelope().getMinimum(0) |
|
178 |
// * trans2Meter[vp.getMapUnits()], |
|
179 |
// vp.getAdjustedEnvelope().getMaximum(0) |
|
180 |
// * trans2Meter[vp.getMapUnits()], |
|
181 |
// vp.getImageSize().width, |
|
182 |
// dpi)); |
|
183 |
// } |
|
184 |
// |
|
185 |
// } |
|
148 | 186 |
|
149 |
double dpi = 0; |
|
150 |
if (patts != null) { |
|
151 |
int len = PrintAttributes.PRINT_QUALITY_DPI.length; |
|
152 |
int priq = patts.getPrintQuality(); |
|
153 |
if (priq < 0 || priq >= len) { |
|
154 |
dpi = vp.getDPI(); |
|
155 |
} else { |
|
156 |
dpi = PrintAttributes.PRINT_QUALITY_DPI[priq]; |
|
157 |
} |
|
158 |
} else { |
|
159 |
dpi = vp.getDPI(); |
|
160 |
} |
|
161 |
|
|
162 |
// ============== We have dpi now ==================== |
|
163 |
IProjection proj = vp.getProjection(); |
|
164 |
|
|
165 |
if (vp.getImageSize() == null || vp.getAdjustedEnvelope() == null) { |
|
166 |
throw new ReadException("", |
|
167 |
new Exception("Viewport does not have image size or envelope")); |
|
168 |
} |
|
169 |
|
|
170 |
double[] trans2Meter = MapContext.getDistanceTrans2Meter(); |
|
171 |
if (proj == null) { |
|
172 |
double wmeters = ((vp.getImageSize().width / dpi) * 0.0254); |
|
173 |
return (long) ((trans2Meter[vp.getMapUnits()] * vp.getAdjustedEnvelope().getLength(0)) |
|
174 |
/ wmeters); |
|
175 |
} else { |
|
176 |
return Math.round(proj.getScale( |
|
177 |
vp.getAdjustedEnvelope().getMinimum(0) |
|
178 |
* trans2Meter[vp.getMapUnits()], |
|
179 |
vp.getAdjustedEnvelope().getMaximum(0) |
|
180 |
* trans2Meter[vp.getMapUnits()], |
|
181 |
vp.getImageSize().width, |
|
182 |
dpi)); |
|
183 |
} |
|
184 |
|
|
185 |
} |
|
186 |
|
|
187 |
private void draw(BufferedImage image, Graphics2D g, ViewPort viewPort, |
|
187 |
private void draw(BufferedImage image, Graphics2D g, double scale, ViewPort viewPort, |
|
188 | 188 |
Cancellable cancel, PrintAttributes props) throws ReadException { |
189 | 189 |
|
190 |
double scale = getScale(viewPort, props); |
|
190 |
// double scale = getScale(viewPort, props);
|
|
191 | 191 |
|
192 | 192 |
SimpleTextSymbol sym = new SimpleTextSymbol(); |
193 | 193 |
sym.setFont(getFont()); |
... | ... | |
478 | 478 |
} |
479 | 479 |
} |
480 | 480 |
|
481 |
public void draw(BufferedImage image, Graphics2D g, ViewPort viewPort, |
|
481 |
public void draw(BufferedImage image, Graphics2D g, double scale, ViewPort viewPort,
|
|
482 | 482 |
Cancellable cancel, double dpi) throws ReadException { |
483 |
draw(image, g, viewPort, cancel, null); |
|
483 |
draw(image, g, scale, viewPort, cancel, null);
|
|
484 | 484 |
} |
485 | 485 |
|
486 | 486 |
private org.gvsig.fmap.geom.primitive.Point createLabelPoint(org.gvsig.fmap.geom.Geometry geom) |
... | ... | |
540 | 540 |
this.colorFieldName = colorFieldName; |
541 | 541 |
} |
542 | 542 |
|
543 |
public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel, |
|
543 |
public void print(Graphics2D g, double scale, ViewPort viewPort, Cancellable cancel,
|
|
544 | 544 |
PrintAttributes props) throws ReadException { |
545 |
draw(null, g, viewPort, cancel, props); |
|
545 |
draw(null, g, scale, viewPort, cancel, props);
|
|
546 | 546 |
} |
547 | 547 |
|
548 | 548 |
public void setUsesFixedSize(boolean b) { |
Also available in: Unified diff