Created
November 19, 2013 17:36
-
-
Save pilsna/7549200 to your computer and use it in GitHub Desktop.
A few lines of code demonstrating how to use viewer commands in the Geocortex HTML5 Viewer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // some sample viewers | |
| // http://e-korttest.vejenkom.dk/zpubHtml5Ekstern/Index1.html | |
| // http://e-korttest.vejenkom.dk/zpubHtml5Ekstern/Index.html?viewerConfigUri=http://e-korttest.vejenkom.dk/Geocortex/Essentials/GeocortexEkstern/REST/sites/zpubPlan/viewers/zpubplanGVH/virtualdirectory/Resources/Config/Default/desktop.json.js | |
| // https://support.geocortex.com/SupportForums/Thread.aspx?pageid=0&mid=2&ItemID=9&thread=46888 | |
| /** | |
| calling an iframe, only works if they are on the same domain | |
| var gcviewer = document.getElementById('gcviewer').contentWindow | |
| var app = gcviewer.geocortex.framework.applications[0] | |
| */ | |
| // the following examples requires the Geocortex viewer to be implemented in the same page, not through an ifram | |
| //get a reference to the application object | |
| var app = geocortex.framework.applications[0] | |
| // create a few geometries | |
| var point = new esri.geometry.Point(501103.14677944814, 6148629.802242098, new esri.SpatialReference(25832)) | |
| var rectangle = new esri.geometry.Extent({"xmin":509050.8171809043,"ymin":6146737.8442903645,"xmax":509278.7203376143,"ymax":6147034.480145129,"spatialReference":{"wkid":25832}}) | |
| // do stuff with commands | |
| app.commandRegistry.command("PanToPoint").execute(point) | |
| app.commandRegistry.command("StepZoomIn").execute() | |
| app.commandRegistry.command("Identify").execute(point) | |
| app.commandRegistry.command("SetActiveTool").execute("IdentifyPointTool") | |
| app.commandRegistry.command("StepZoomIn").execute() | |
| app.commandRegistry.command("Geolocate").execute() | |
| app.commandRegistry.command("ZoomToExtent").execute(rectangle) | |
| app.commandRegistry.command("ZoomToInitialExtent").execute() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment