Develop a tool
I know how to implement a custom command in Javascript/Typescript, but how can I develop a tool? After activating the tool, a user should click on the map before proceeding.
Berend
-
The error I get in Visual Studio is "The property 'toolRegistry' does not exist on value of type 'geocortex.framework.application.Application'".
Should I use the definition files from Quickstart/Lib? The toolRegistry property is not in there (framework.d.ts).
Berend
0 -
Ah, right - you'll have to cast "this.app" to any, like so:
(<any>this.app).toolRegistry
The reason for this is that "app" as defined on the base classes of views, view models, and modules is of type geocortex.framework.application.Application.
At runtime, app is actually an instance of a ViewerApplication, a derived subclass, and it lives in the Mapping.Infastructure namespace.
As of 1.3 we had not ported this namespace to TypeScript, meaning that you'll have to interact with it by casting your app instance to <any>. We've actually now ported MappingInfastructure to TypeScript, and the definition file will be available in the next release. However, you'll still have to cast app from the base framework application type to ViewerApplication. It illustrates the fact that we previously leaned on JavaScript's lack of static typing to use "app" freely (as both a framework Application and a ViewerApplication), but our new coding environment is much less forgiving (which is a good thing, ultimately).
0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
2 Kommentare