Revision 42555
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 | ||
---|---|---|
131 | 131 |
import org.gvsig.fmap.geom.GeometryLocator; |
132 | 132 |
import org.gvsig.fmap.geom.GeometryManager; |
133 | 133 |
import org.gvsig.fmap.geom.aggregate.MultiPrimitive; |
134 |
import org.gvsig.fmap.geom.exception.CreateEnvelopeException; |
|
135 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
|
136 |
import org.gvsig.fmap.geom.operation.GeometryOperationException; |
|
137 |
import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException; |
|
134 | 138 |
import org.gvsig.fmap.geom.primitive.Envelope; |
135 | 139 |
import org.gvsig.fmap.geom.primitive.Point; |
136 | 140 |
import org.gvsig.fmap.geom.type.GeometryType; |
... | ... | |
159 | 163 |
import org.gvsig.tools.ToolsLocator; |
160 | 164 |
import org.gvsig.tools.dispose.DisposableIterator; |
161 | 165 |
import org.gvsig.tools.dynobject.DynStruct; |
166 |
import org.gvsig.tools.locator.LocatorException; |
|
162 | 167 |
import org.gvsig.tools.persistence.PersistenceManager; |
163 | 168 |
import org.gvsig.tools.persistence.PersistentState; |
164 | 169 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
165 | 170 |
import org.gvsig.tools.task.Cancellable; |
171 |
|
|
166 | 172 |
import org.slf4j.Logger; |
167 | 173 |
import org.slf4j.LoggerFactory; |
168 | 174 |
|
... | ... | |
750 | 756 |
int maxx = (int) rPixels.getMaximum(0); |
751 | 757 |
int maxy = (int) rPixels.getMaximum(1); |
752 | 758 |
|
753 |
for (int i = minx; i <= maxx; i++) {
|
|
754 |
for (int j = miny; j <= maxy; j++) {
|
|
759 |
for (int i = minx; i <= maxx; i++) {
|
|
760 |
for (int j = miny; j <= maxy; j++) {
|
|
755 | 761 |
|
756 |
if (!lblgeom.contains(i, j) |
|
757 |
// contains seems to don't detect points |
|
758 |
// placed in the rectangle boundaries |
|
759 |
&& !lblgeom.intersects(i, j, i, j)) { |
|
760 |
continue; |
|
761 |
} |
|
762 |
GeometryManager geomManager = GeometryLocator.getGeometryManager(); |
|
763 |
try { |
|
764 |
if (!lblgeom.contains(geomManager.createPoint(i, j, Geometry.SUBTYPES.GEOM2D)) |
|
765 |
// contains seems to don't detect points |
|
766 |
// placed in the rectangle boundaries |
|
767 |
&& !lblgeom.intersects(geomManager.createEnvelope(i, j, i, j, Geometry.SUBTYPES.GEOM2D).getGeometry())) { |
|
768 |
continue; |
|
769 |
} |
|
770 |
} catch (CreateGeometryException | GeometryOperationNotSupportedException | GeometryOperationException |
|
771 |
| CreateEnvelopeException e) { |
|
772 |
logger.warn("Can't check overlapping with point ("+i+","+j+")."); |
|
762 | 773 |
|
763 |
if (i < 0 || j < 0) { |
|
764 |
continue; |
|
765 |
} |
|
774 |
} |
|
766 | 775 |
|
767 |
if (bi.getWidth() < i + 1 || bi.getHeight() < j + 1) {
|
|
768 |
continue;
|
|
769 |
}
|
|
776 |
if (i < 0 || j < 0) {
|
|
777 |
continue;
|
|
778 |
}
|
|
770 | 779 |
|
771 |
if (bi.getRGB(i, j) != 0) { |
|
772 |
return true; |
|
773 |
} |
|
774 |
} |
|
775 |
} |
|
780 |
if (bi.getWidth() < i + 1 || bi.getHeight() < j + 1) { |
|
781 |
continue; |
|
782 |
} |
|
783 |
|
|
784 |
if (bi.getRGB(i, j) != 0) { |
|
785 |
return true; |
|
786 |
} |
|
787 |
} |
|
788 |
} |
|
776 | 789 |
return false; |
777 | 790 |
} |
778 | 791 |
|
Also available in: Unified diff