Discussion:
[mapguide-users] Adding custom command in react layout
TabrizSoftware
8 years ago
Permalink
Hi Jackie,
I have a question about execute *setScale *command from
a function in /application.tsx/

i want to add function in /application.tsx/ to communicate
custom ui (in template) with Mapguide react


application.tsx


import * as React from "react";

import * as ReactDOM from "react-dom";

import { Provider } from "react-redux";

import { IAppProps, App } from "../containers/app";

import { ClientKind } from "../api/common";

import { ClientContext } from "../api/client";

import configureStore from "../store/configure-store";

import { INITIAL_STATE } from "../reducers/config";

 

import * as MapActions from "../actions/map";

/**

 * This is the entry point to the Application component

 */

export class ApplicationViewModel {

    constructor() {

       

    }

    public mount(node: Element, props: IAppProps) {

        const agentConf = {

            agentUri: props.agent.uri,

            agentKind: props.agent.kind || "mapagent"

        };

        const store = configureStore({ config: { ...INITIAL_STATE,
...agentConf } });

        ReactDOM.render(<Provider store={store}>

            <App {...props} />

        </Provider>, node);

    }

               

                public setScale_To_20000()

                {

                                // I don’t khnow how to call _setScale_
function

                                return 'Ok';

                }

}

 
 


Index.html


var el = document.getElementById("map");

            var viewer = new MapGuide.Application();

            viewer.mount(el, {

                layout: "ajax-viewer",

                externalBaseLayers: [

                    { name: "OpenStreetMap", kind:
"OSM" },

                ],

                agent: {

                    uri: "../mapagent/mapagent.fcgi"

                }

            });

 

 

*viewer**. setScale_To_20000();*

* *

* *





--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Adding-custom-command-in-react-layout-tp5304940.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
Jackie Ng
8 years ago
Permalink
Are you trying to automatically go to a certain scale on viewer startup? If
so, there is no hook or extension point to allow for this at the moment.

Please note that the viewer customization story (beyond the same InvokeURL
command mechanism used by AJAX/Fusion viewers) is not yet fully defined.
Until then, I am in no real position to offer solid advice on how you should
approach this problem.

- Jackie



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Adding-custom-command-in-react-layout-tp5304940p5305480.html
Sent from the MapGuide Users mailing list archive at Nabble.com.

Loading...