Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
soomro30 opened this issue Jun 23, 2015 · 5 comments

Comments

@soomro30
Copy link

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
Copy link
Member

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
    • 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

@soomro30
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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 [email protected]
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
#44 (comment)
.

@soomro30
Copy link
Author

Any way to pass distance variable in

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants