Esri / image-discovery-app-js

JavaScript Image Discovery Web Application. Use to search, discover, filter, and manipulate imagery.
23 stars 14 forks source link

Adding a new tool in the Geometry - Clone Search By Bounds and create new one #44

Open soomro30 opened 9 years ago

soomro30 commented 9 years ago

fireshot screen capture 065 - base configuration application - 172_16_5_231_8080_image-discovery_site

I want to clone SearchByBounds and create another tool or sixth tool in the geometry. I have tried but it looks very complex. Can you tell me quick way to create another tool of Search By Bounds

Rrivera5127 commented 9 years ago

What do you want the sixth tool to do? SearchByBounds is the most complex of the search tools and would require quite a bit of code changes to implement. Another geometry search (such as circle) would be much easier to implement.

you would add the toggle icon for the tool here:

https://github.com/Esri/image-discovery-app-js/blob/master/site/js/imagediscovery/ui/discover/template/ImageDiscoveryTemplate.html

update the view model for the clicking of the toggle icon here (need to turn off other tools when clicked)

https://github.com/Esri/image-discovery-app-js/blob/master/site/js/imagediscovery/ui/discover/model/ImageDiscoveryViewModel.js

then you create an instance of your new widget here (reference how i create an instance of SearchByBoundsWidget):

https://github.com/Esri/image-discovery-app-js/blob/master/site/js/imagediscovery/ui/discover/ImageDiscoveryWidget.js

follow the searchbyBounds widget for some geometry passing event:

https://github.com/Esri/image-discovery-app-js/blob/master/site/js/imagediscovery/ui/discover/SearchByBoundsWidget.js

inside of ImageDiscoveryWidget you need to listen on an event that your new widget will publish when the user wants to search by their inputs (you convert the input to an esri geometry). in ImageDiscoveryWidget you can see that i am listening on "boundsGeometryCreated" to be called from the bounds widget. This passes the geometry with the event where i use it to call "performSearchCallback" which does the searching.

this.searchByBoundsWidget.on("boundsGeometryCreated", this.performSearchCallback);

Not too complicated but there are a lot of moving parts:

1) add icon to the html template 2) set up viewModel binding 3) create instance of your widget

soomro30 commented 9 years ago

I will try to create and see if I can manage this. Thank you very much. If I need further help, I will contact you. I appreciate your help...

soomro30 commented 9 years ago

Thanks. I was able to create another toolbox. Is there any script in the app to convert mgrs to DD.

I need to show footprints based on mgrs.

Regards

soomro30 commented 9 years ago

Thanks Rivera,

I was able to create the search by coordinates tool but my search buffer is not working.

I have attached the screenshot.

How can I implement search by x,y as a center point and radius buffer as a circle to bring results.

You can see in the image.

fireshot screen capture 066 - base configuration application - localhost_8080_image-discovery_site

On Tue, Jun 23, 2015 at 9:00 PM, Richard Rivera notifications@github.com wrote:

What do you want the sixth tool to do? SearchByBounds is the most complex of the search tools and would require quite a bit of code changes to implement. Another geometry search (such as circle) would be much easier to implement.

you would add the toggle icon for the tool here:

https://github.com/Esri/image-discovery-app-js/blob/master/site/js/imagediscovery/ui/discover/template/ImageDiscoveryTemplate.html

update the view model for the clicking of the toggle icon here (need to turn off other tools when clicked)

https://github.com/Esri/image-discovery-app-js/blob/master/site/js/imagediscovery/ui/discover/model/ImageDiscoveryViewModel.js

then you create an instance of your new widget here (reference how i create an instance of SearchByBoundsWidget):

https://github.com/Esri/image-discovery-app-js/blob/master/site/js/imagediscovery/ui/discover/ImageDiscoveryWidget.js

follow the serchbyBounds widget for eventing:

https://github.com/Esri/image-discovery-app-js/blob/master/site/js/imagediscovery/ui/discover/SearchByBoundsWidget.js

inside of ImageDiscoveryWidget you need to listen on an even that your new widget will publish when the user wants to search by their inputs (you convert the input to an esri geometry). in ImageDiscoveryWidget you can see that i am listening on "boundsGeometryCreated" to be called from the bounds widget. This passes the geometry with the event where i use it to call "performSearchCallback" which does the searching.

this.searchByBoundsWidget.on("boundsGeometryCreated", this.performSearchCallback);

Not TOO complicated but there are a lot of moving parts:

1) add icon to the html template 2) set up viewModel binding 3) create instance of your widget

  • hook display/hide into the icon in step 1
  • in ImageDiscoveryWidget listen on an event that passes an esri geometry (you create geometry from user inputs)
  • perform the search in ImageDiscoveryWidget (this. performSearchCallback is scoped properly). look at line 399 in ImageDiscoveryWidget to see how I listen for a geometry on the SearchByBoundsWidget

— Reply to this email directly or view it on GitHub https://github.com/Esri/image-discovery-app-js/issues/44#issuecomment-114572655 .

soomro30 commented 9 years ago

Any way to pass distance variable in

return new Extent(minx, miny, maxx, maxy, new SpatialReference({ wkid: this.searchWkid })); in javascript API.