RMMarkerManager setRotation rotates not only RMMarkers but also RMPaths on the map #152

Open
clintliang opened this Issue Nov 8, 2011 · 6 comments

Comments

Projects
None yet
2 participants

I have a couple of polygon and polylines (RMPath) along with RMMarkers on the map view, when I use the [mapView.contents.markerManager setRotation(degree)] to rotate RMMarkers, it also rotates RMPaths.

I suggest that in the setRotation method on RMMarkerManager.m, check to see if each RMMarker instance isKindOfClass [RMMarker class] then do the rotation. That will solve the problem:)

Doing reflection is a relatively slow operation, so I think you might see
performance problems if you have a lot of objects being managed by the
markerManager and you check the class of all of them.

I wonder... what are you trying to accomplish... what does your app do that
it is rotating all of the markers in the mapView?

Andrew Johnson
Co-founder
www.GaiaGPS.com
415 335 7447

On Mon, Nov 7, 2011 at 6:41 PM, Clint Liang <
reply@reply.github.com>wrote:

I have a couple of polygon and polylines (RMPath) along with RMMarkers on
the map view, when I use the [mapView.contents.markerManager
setRotation(degree)] to rotate RMMarkers, it also rotates RMPaths.

I suggest that in the setRotation method on RMMarkerManager.m, check to
see if each RMMarker instance isKindOfClass [RMMarker class] then do the
rotation. That will solve the problem:)


Reply to this email directly or view it on GitHub:
#152

Hi Andrew,
I am a newbie for Route-Me framework. What I am trying to do is to duplicate the compass feature (magnetometer feature) of the Google Map App on iphone with Route-Me framework. When the mapView rotates, all the markers on the mapView will also rotates. I've done the compass like feature, but it doesn't rotate as smooth as the Google Map App:(

Hmmm, so if you rotate the mapView, don't you want all the paths and
polygons to rotates as well?

I'm not sure why you would only want to rotate the markers.

Andrew Johnson
Co-founder
www.GaiaGPS.com
415 335 7447

On Mon, Nov 7, 2011 at 7:54 PM, Clint Liang <
reply@reply.github.com>wrote:

Hi Andrew,
I am a newbie for Route-Me framework. What I am trying to do is to
duplicate the compass feature (magnetometer feature) of the Google Map App
on iphone with Route-Me framework. When the mapView rotates, all the
markers on the mapView will also rotates. I've done the compass like
feature, but it doesn't rotate as smooth as the Google Map App:(


Reply to this email directly or view it on GitHub:
#152 (comment)

Well, paths and polygons are different. Marker has single point or coordinate when it rotates the only two things that are actually rotating are icon and its shadow so that the marker is always upright. If I rotate the polygons or paths it will change the coordinates.

Should you just rotate the entire mapView? That's how I do this in Gaia GPS.

double correctedMapHeading = mapHeading;

if (lastOrientation == UIInterfaceOrientationLandscapeRight) {

correctedMapHeading += 90;

} else if (lastOrientation == UIInterfaceOrientationLandscapeLeft) {

correctedMapHeading += 270;

} else if (lastOrientation == UIInterfaceOrientationPortraitUpsideDown)
{

correctedMapHeading += 180;

}

[mapView setRotation:(-1 * mapHeading * M_PI / 180)];

Andrew Johnson
Co-founder
www.GaiaGPS.com
415 335 7447

On Mon, Nov 7, 2011 at 11:09 PM, Clint Liang <
reply@reply.github.com>wrote:

Well, paths and polygons are different. Marker has single point or
coordinate when it rotates the only two things that are actually rotating
are icon and its shadow so that the marker is always upright. If I rotate
the polygons or paths it will change the coordinates.


Reply to this email directly or view it on GitHub:
#152 (comment)

Yes, and after [mapView setRotation:] rotate the markers.
It should be as simple as [self.mapView.contents.markerManager setRotation:(-1 * newHeading.magneticHeading * M_PI / 180)]; but as I mentioned in this issue, it also rotates my paths and polygons. So I wrote my own to rotates each marker:

for (RMMarker *marker in [self.mapView.contents.markerManager markers])
{
if ([marker isKindOfClass:[RMMarker class]])
{
[marker setAffineTransform:CGAffineTransformMakeRotation(newHeading.magneticHeading * M_PI / 180)];
}

}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment