Select to view content in your preferred language

FrStreetView

2988
23
10-19-2010 08:11 AM
philippschnetzer
Occasional Contributor III
Frank Roberts released his FrStreetView widget on the code gallery a few days ago.  It looks and functions great!  I have tried to change the mxml to work with my wkid (2961) but no luck yet.   Can anyone solve this issue...here is the portion of code that needs to be changed:

private function mouseClickHandler(event:MouseEvent):void
   {
   const frmapPoint:MapPoint = map.toMapFromStage(event.stageX, event.stageY);
    var latlong:MapPoint;
    var wkidString:String = frmapPoint.spatialReference.wkid.toString();
  //Alert.show("Spatial Ref for map: " + frmapPoint.spatialReference.wkid.toString());
    if ( wkidString == "102100")
    {
   latlong = WebMercatorUtil.webMercatorToGeographic(frmapPoint) as MapPoint;
     frLat = latlong.y.toFixed(6);
     frLong = latlong.x.toFixed(6);
     displayForm(frLat, frLong);
    }
    else if ( wkidString == "3857")
    {
   latlong = WebMercatorUtil.webMercatorToGeographic(frmapPoint) as MapPoint;
     frLat = latlong.y.toFixed(6);
     frLong = latlong.x.toFixed(6);
     displayForm(frLat, frLong);
    }
    else if ( wkidString == "4326")
    {
     latlong = map.toMapFromStage(event.stageX, event.stageY);
     frLat = latlong.y.toFixed(12);
     frLong = latlong.x.toFixed(12);
     displayForm(frLat, frLong);
    }
    else
    {
     //Alert.show("Non client side projection");
     var outSR:SpatialReference = new SpatialReference(4326);
     geometryService.project([frmapPoint as Geometry], outSR);
    }
    
    var graphic:Graphic = new Graphic(); 
    var mapPoint2:MapPoint = frmapPoint;
    mapPoint2.spatialReference = map.spatialReference;    
    graphic.geometry = mapPoint2;    
    graphicsLayer.clear();    
    graphicsLayer.add(graphic);


wkid=2961 is a NAD83/UTM coordinate system with units in meters.

Thanks!

Here's the link to Franks widget: http://www.arcgis.com/home/item.html?id=dc56d2ab11534d24a5559ea9dc8f5119
Tags (2)
0 Kudos
23 Replies
philippschnetzer
Occasional Contributor III
Please disregard above post.  It works now having made no changes whatsoever...nice code!
0 Kudos
FrankRoberts
Occasional Contributor III
Glad it is working for you!

Per your other question you emailed me about the default viewer/popup.  You can set the default view in the code by modifying the pull-down on around line 221 of frStreetView.mxml.  Just change the first label in the array to the one you want to be the default.  Feel free to move the order around any way you like.

Enjoy!
Frank
0 Kudos
philippschnetzer
Occasional Contributor III
Frank,

Actually what I am hoping to accomplish is to remove the widget all together and just have an icon that when the user clicks that icon and then clicks on the map the code will default to use the dual viewer and open it in a new browser window.  For some reason only the dual viewer and bing options work in my application - and since there is no bing oblique imagery in my area I can only use the dual viewer...and then it seems unnecessary to have a widget open up just to be able to select 'in flash' or 'in new browser' so that could be defaulted to a new browser. 

Or at the very least I would like to keep the widget but remove the options/drop-down to choose what kind of viewer and leave only the flash or browser option in the widget itself. 

Thanks for any input!
0 Kudos
philippschnetzer
Occasional Contributor III
If the widget is opened, then minimized, then opened again and closed the little man cursor remains.  An easy fix no doubt....
0 Kudos
FrankRoberts
Occasional Contributor III
I'll take a look at that...
0 Kudos
FrankRoberts
Occasional Contributor III
Thanks for pointing it out, good find!  I have resolved this issue and it is available as version 1.1 of frStreetView. Feel free to down load it at:

http://www.arcgis.com/home/item.html?id=dc56d2ab11534d24a5559ea9dc8f5119

I hope to have some additional improvements out in the future.

Frank
0 Kudos
MichaelTucker
New Contributor
Hey just wanted to say good work on the widget!  I did notice a slight bug in version 1.1 as I was trying to add it to our app...

I found that in the displayForm function all of the if statements refer to the frLat and frLong variables, with the exception of dualmaps.  As a result, anyone using the geometry service to project the points will not be able to use anything but dualmaps.  I fixed this on ours by changing the frLat and frLong variables to lat and long.  With the way it is coded, this should now work for everyone regardless of what projection their app is using.

Mike
0 Kudos
FrankRoberts
Occasional Contributor III
Thanks for pointing that out, I was just looking at that code wondering about the repercussions of that error.  I have posted an update at the website.  The link above should get you there.

Have a Merry Christmas!
Frank
0 Kudos
philippschnetzer
Occasional Contributor III
How would one go about removing the little man cursor when the widget is minimized?  I can see the click events for when a widget is opened or closed but not for when it is minimized.

Thanks.

SOLVED:

place this function at the end of your code:

private function widgetMinumizedHandler(event:Event):void
   {
    graphicsLayer.visible = false;
    CursorManager.removeAllCursors();
   }

  
Then add the bolded line below:

<viewer:WidgetTemplate id="frStreetView"
         width="250" height="100"
         y="500"
         closed="widgetClosedHandler(event)"
        minimized="widgetMinumizedHandler(event)"
         open="widgetOpenedHandler(event)" >
0 Kudos