Sospecho que el java no está lejos de esto (esto es C#) pero los principios son los mismos. Consultar las extensiones de la selección, unirlas, multiplicar el resultado por un factor y mostrarlo.
// passing in ActiveView
// passing in targetLayer
// ZOOM_FACTOR = 1.5
// ensure we have selected features
IFeatureSelection featureSelection = targetLayer as IFeatureSelection;
if (featureSelection == null) return;
ISelectionSet selectionSet = featureSelection.SelectionSet;
using (ComReleaser comReleaser = new ComReleaser())
{
// search for each selection
ICursor cursor;
selectionSet.Search(null, true, out cursor);
comReleaser.ManageLifetime(cursor);
// build an envelope containing a union of the selections
IFeatureCursor featureCursor = cursor as IFeatureCursor;
IFeature feature;
IEnvelope envelope = new EnvelopeClass();
while ((feature = featureCursor.NextFeature()) != null)
{
IGeometry geometry = feature.Shape;
IEnvelope featureExtent = geometry.Envelope;
envelope.Union(featureExtent);
}
if (!envelope.IsEmpty)
{
// set the extent
envelope.Expand(ZOOM_FACTOR, ZOOM_FACTOR, true);
view.Extent = envelope;
view.Refresh();
}
}
0 votos
Estoy tratando de hacer esto en javascript.