Select to view content in your preferred language

Zoom to Geometry

4413
3
04-27-2015 09:06 PM
RoshnaDsouza
Deactivated User

-(void)zoomToGeometry:(AGSGeometry*)geometry withPadding:(CGFloat)padding animated:(BOOL)animated; doesn't zoom to geometry when the map is rotated , it works fine when the map rotation angle is 0.

Tags (1)
0 Kudos
3 Replies
GagandeepSingh
Frequent Contributor

Hi Roshna Dsouza​,

I just tried it and it works for me. Can you share your code or explain what you are trying to do?

Gagan

0 Kudos
RoshnaDsouza
Deactivated User

I have to check if the geometry is zoomed to a particular resolution It should be visible to the user/

This code below works perfectly fine when maps rotating angle is 0. but when rotating angle is other than 0 ,

[self.mapView  zoomToGeometry:[self.editLayerManager geometry] withPadding:[defaultScale floatValue] animated:YES];

doesn't zoom to exact geometry with padding.

    AGSMutableEnvelope *visibleAreaEnvelope = [self.mapView.visibleArea.envelope mutableCopy];

    float zoomFactor = [levelScale doubleValue]/self.mapView.resolution;

    [visibleAreaEnvelope centerAtPoint:[self.editLayerManager zoomToGeometryCenter]];

    [visibleAreaEnvelope expandByFactor:zoomFactor];

   

    if (![visibleAreaEnvelope containsEnvelope:[self.editLayerManager geometryEnvelope]]) {

[self.mapView  zoomToGeometry:[self.editLayerManager geometry] withPadding:[defaultScale floatValue] animated:YES];

        }

    } else {

        [self.mapView zoomToResolution:[levelScale doubleValue] withCenterPoint:[self.editLayerManager zoomToGeometryCenter] animated:YES];

    }

0 Kudos
GagandeepSingh
Frequent Contributor

Can you provide a demo project as a way to reproduce the issue? It will help us in debugging the problem, if there is one.

0 Kudos