Revision 47476 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
FLyrVect.java | ||
---|---|---|
24 | 24 |
|
25 | 25 |
import java.awt.Graphics2D; |
26 | 26 |
import java.awt.Point; |
27 |
import java.awt.geom.AffineTransform; |
|
28 | 27 |
import java.awt.geom.Point2D; |
29 | 28 |
import java.awt.image.BufferedImage; |
30 | 29 |
import java.io.File; |
... | ... | |
41 | 40 |
import org.gvsig.fmap.dal.exception.DataException; |
42 | 41 |
import org.gvsig.fmap.dal.exception.InitializeException; |
43 | 42 |
import org.gvsig.fmap.dal.exception.ReadException; |
44 |
import org.gvsig.fmap.dal.feature.Feature; |
|
45 | 43 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
46 | 44 |
import org.gvsig.fmap.dal.feature.FeatureQuery; |
47 | 45 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
... | ... | |
70 | 68 |
import org.gvsig.fmap.mapcontext.exceptions.ReloadLayerException; |
71 | 69 |
import org.gvsig.fmap.mapcontext.exceptions.StartEditionLayerException; |
72 | 70 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
73 |
import org.gvsig.fmap.mapcontext.layers.FLayerStatus; |
|
74 | 71 |
import org.gvsig.fmap.mapcontext.layers.FLyrDefault; |
75 | 72 |
import org.gvsig.fmap.mapcontext.layers.LayerEvent; |
76 | 73 |
import org.gvsig.fmap.mapcontext.layers.LayerInformationBuilder; |
... | ... | |
87 | 84 |
import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendContentsChangedListener; |
88 | 85 |
import org.gvsig.fmap.mapcontext.rendering.legend.events.SymbolLegendEvent; |
89 | 86 |
import org.gvsig.fmap.mapcontext.rendering.legend.styling.ILabelingStrategy; |
90 |
import org.gvsig.fmap.mapcontext.rendering.symbols.CartographicSupport; |
|
91 | 87 |
import org.gvsig.metadata.exceptions.MetadataException; |
92 | 88 |
import org.gvsig.tools.ToolsLocator; |
93 | 89 |
import org.gvsig.tools.dynobject.DynObjectManager; |
... | ... | |
104 | 100 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
105 | 101 |
import org.gvsig.tools.task.Cancellable; |
106 | 102 |
import org.gvsig.tools.util.Callable; |
107 |
import org.gvsig.tools.visitor.VisitCanceledException; |
|
108 |
import org.gvsig.tools.visitor.Visitor; |
|
109 | 103 |
import org.slf4j.LoggerFactory; |
110 | 104 |
|
111 | 105 |
/** |
... | ... | |
824 | 818 |
return clonedLayer; |
825 | 819 |
} |
826 | 820 |
|
827 |
protected boolean isOnePoint(AffineTransform graphicsTransform, |
|
828 |
ViewPort viewPort, |
|
829 |
double dpi, |
|
830 |
CartographicSupport csSym, |
|
831 |
Geometry geom, |
|
832 |
int[] xyCoords) { |
|
833 |
return isOnePoint(graphicsTransform, viewPort, geom, xyCoords) |
|
834 |
&& csSym.getCartographicSize(viewPort, dpi, geom) <= 1; |
|
835 |
} |
|
836 |
|
|
837 |
private boolean isOnePoint(AffineTransform graphicsTransform, |
|
838 |
ViewPort viewPort, |
|
839 |
Geometry geom, |
|
840 |
int[] xyCoords) { |
|
841 |
boolean onePoint = false; |
|
842 |
int type = geom.getType(); |
|
843 |
if (type == Geometry.TYPES.NULL) { |
|
844 |
return false; |
|
845 |
} |
|
846 |
if (type != Geometry.TYPES.POINT && type != Geometry.TYPES.MULTIPOINT) { |
|
847 |
|
|
848 |
Envelope geomBounds = geom.getEnvelope(); |
|
849 |
|
|
850 |
// ICoordTrans ct = getCoordTrans(); |
|
851 |
// Se supone que la geometria ya esta reproyectada |
|
852 |
// if (ct!=null) { |
|
853 |
// // geomBounds = ct.getInverted().convert(geomBounds); |
|
854 |
// geomBounds = geomBounds.convert(ct); |
|
855 |
// } |
|
856 |
double dist1Pixel = viewPort.getDist1pixel(); |
|
857 |
|
|
858 |
onePoint |
|
859 |
= (geomBounds.getLength(0) <= dist1Pixel && geomBounds.getLength(1) <= dist1Pixel); |
|
860 |
|
|
861 |
if (onePoint) { |
|
862 |
// avoid out of range exceptions |
|
863 |
org.gvsig.fmap.geom.primitive.Point p; |
|
864 |
try { |
|
865 |
p |
|
866 |
= geomManager.createPoint(geomBounds.getMinimum(0), |
|
867 |
geomBounds.getMinimum(1), |
|
868 |
SUBTYPES.GEOM2D); |
|
869 |
p.transform(viewPort.getAffineTransform()); |
|
870 |
p.transform(graphicsTransform); |
|
871 |
xyCoords[0] = (int) p.getX(); |
|
872 |
xyCoords[1] = (int) p.getY(); |
|
873 |
} catch (org.gvsig.fmap.geom.exception.CreateGeometryException e) { |
|
874 |
logger.error("Error creating a point", e); |
|
875 |
} |
|
876 |
|
|
877 |
} |
|
878 |
|
|
879 |
} |
|
880 |
return onePoint; |
|
881 |
} |
|
882 |
|
|
883 | 821 |
public boolean isLabeled() { |
884 | 822 |
return isLabeled; |
885 | 823 |
} |
Also available in: Unified diff