use of com.revolsys.swing.map.layer.Project in project com.revolsys.open by revolsys.
the class TiePointsPanel method zoomToTiePoint.
public void zoomToTiePoint() {
final MappedLocation object = getEventRowObject();
final GeoreferencedImage image = this.layer.getImage();
final Geometry geometry = object.getSourceToTargetLine(image, this.layer.getBoundingBox(), !this.layer.isShowOriginalImage());
if (geometry != null) {
final Project project = Project.get();
final GeometryFactory geometryFactory = project.getGeometryFactory();
final BoundingBox boundingBox = geometry.getBoundingBox().convert(geometryFactory).expand(200);
project.setViewBoundingBox(boundingBox);
}
}
use of com.revolsys.swing.map.layer.Project in project com.revolsys.open by revolsys.
the class MapGuideWebServer method actionAddLayer.
private static void actionAddLayer(final FeatureLayer layerDescription) {
final Project project = Project.get();
if (project != null) {
LayerGroup layerGroup = project;
final PathName layerPath = layerDescription.getPathName();
for (final String groupName : layerPath.getParent().getElements()) {
layerGroup = layerGroup.addLayerGroup(groupName);
}
final MapGuideWebServerRecordLayer layer = new MapGuideWebServerRecordLayer(layerDescription);
layerGroup.addLayer(layer);
if (AbstractLayer.isShowNewLayerTableView()) {
layer.showTableView();
}
}
}
use of com.revolsys.swing.map.layer.Project in project com.revolsys.open by revolsys.
the class GeoreferencedImageLayer method fitToViewport.
public synchronized BoundingBox fitToViewport() {
final Project project = getProject();
if (project == null || this.image == null || !isInitialized()) {
return BoundingBox.empty();
} else {
final BoundingBox oldValue = this.image.getBoundingBox();
final BoundingBox viewBoundingBox = project.getViewBoundingBox();
if (viewBoundingBox.isEmpty()) {
return viewBoundingBox;
} else {
final double viewRatio = viewBoundingBox.getAspectRatio();
final double imageRatio = this.image.getImageAspectRatio();
BoundingBox boundingBox;
if (viewRatio > imageRatio) {
boundingBox = viewBoundingBox.expandPercent(-1 + imageRatio / viewRatio, 0.0);
} else if (viewRatio < imageRatio) {
boundingBox = viewBoundingBox.expandPercent(0.0, -1 + viewRatio / imageRatio);
} else {
boundingBox = viewBoundingBox;
}
this.image.setBoundingBox(boundingBox);
firePropertyChange("boundingBox", oldValue, boundingBox);
return boundingBox;
}
}
}
use of com.revolsys.swing.map.layer.Project in project com.revolsys.open by revolsys.
the class GeoreferencedImageLayer method zoomToLayer.
@Override
public void zoomToLayer() {
final Project project = getProject();
final GeometryFactory geometryFactory = project.getGeometryFactory();
final BoundingBox layerBoundingBox = getBoundingBox();
BoundingBox boundingBox = layerBoundingBox;
final AffineTransform transform = this.image.getAffineTransformation(layerBoundingBox);
if (!transform.isIdentity()) {
final GeoreferencedImage image = getImage();
final double width = image.getImageWidth() - 1;
final double height = image.getImageHeight() - 1;
final double[] targetCoordinates = MappedLocation.toModelCoordinates(image, layerBoundingBox, true, 0, height, width, height, width, 0, 0, 0, 0, height);
final LineString line = layerBoundingBox.getGeometryFactory().lineString(2, targetCoordinates);
boundingBox = boundingBox.expandToInclude(line);
}
boundingBox = boundingBox.convert(geometryFactory).expandPercent(0.1).clipToCoordinateSystem();
project.setViewBoundingBox(boundingBox);
}
use of com.revolsys.swing.map.layer.Project in project com.revolsys.open by revolsys.
the class RecordLayerTableModel method getFilterQuery.
protected Query getFilterQuery() {
final Query query = this.layer.getQuery();
final Condition filter = getFilter();
query.and(filter);
query.setOrderBy(this.orderBy);
if (this.filterByBoundingBox) {
final Project project = this.layer.getProject();
final BoundingBox viewBoundingBox = project.getViewBoundingBox();
final RecordDefinition recordDefinition = this.layer.getRecordDefinition();
final FieldDefinition geometryField = recordDefinition.getGeometryField();
if (geometryField != null) {
query.and(F.envelopeIntersects(geometryField, viewBoundingBox));
}
}
return query;
}
Aggregations