Пример #1
0
        public ListMapLayerOptionsWindow(MapLayerOptionListData optionListData)
        {
            InitializeComponent();
            this._optionListData = optionListData;
            this.HeadingTB.Text = this._optionListData.Opening;
            this.OptionLB.ItemsSource = this._optionListData.Options;
            this._selectedItems = new List<MapLayerOptionItemData>();

            System.Windows.Forms.Integration.WindowsFormsHost host = new System.Windows.Forms.Integration.WindowsFormsHost();
            // Create an object of the map control.
            this._axMapCtrl = new AxMapControl();
            host.Child = this._axMapCtrl;
            this.mapGrid.Children.Add(host);

        }
Пример #2
0
        private ArrayList AskForMoreValue(ActionNode actionNode, DialogueAct currDlgAct)
        {
            ArrayList respList = new ArrayList();

            if (actionNode.ActState == ActionState.Initiated)
            {
                // change its own state
                actionNode.ActState = ActionState.Executing;

                // do something: generate the candiate list           
                respList.Add(new DialogueResponse(DialogueResponseType.debugInfo, "Basic Action: AskForMoreValue"));

                ParamNode paramNode = (ParamNode)actionNode.Parent;

                if (paramNode.Name == "feature_class")
                {
                    // fixed at the moment, future work will search the database to generate the list
                    MapLayerOptionListData respContent = new MapLayerOptionListData();
                    //respContent.Opening = this._generateQuestionString(paramNode);
                    respContent.Opening = "You may want to consider adding the following layers to the map as background:";
                    respContent.AddOption(new MapLayerOptionItemData("Lot boundaries", @"C:\Work\Data\GISLAB\Data\Oleader\Lot Boundaries.lyr"));
                    respContent.AddOption(new MapLayerOptionItemData("Zoning", @"C:\Work\Data\GISLAB\Data\Oleader\Zoning.lyr"));
                    respContent.AddOption(new MapLayerOptionItemData("Flood areas", @"C:\Work\Data\GISLAB\Data\Oleader\Flood Areas.lyr"));
                    
                    respList.Add(new DialogueResponse(DialogueResponseType.listMapLayerOptions, respContent));
                    return respList;
                }
            }
            // if the action is executing, try to check whether the current input answers the question
            else if (actionNode.ActState == ActionState.Executing)
            {
                ParamNode paramNode = (ParamNode)actionNode.Parent;
                foreach (string phrase in currDlgAct.SpeechContext.Keys)
                {
                    if (phrase.ToLower() == paramNode.Name.ToLower())
                    {
                        object newValue = this._parseValueFromSpeech(paramNode, currDlgAct.SpeechContext[phrase]);
                        if (newValue != null)
                        {
                            this._addValueToParam(paramNode, newValue);

                            // change its own state
                            actionNode.ActState = ActionState.Complete;
                            // generate response 
                            if (paramNode.ParamType == "feature_class")
                            {
                                // fixed at the moment
                                string dataSourcePath = @"C:\Work\Data\GISLAB\Data\Oleader\";
                                string filePath = System.IO.Path.Combine(dataSourcePath + (string)newValue + ".lyr");
                                if (System.IO.File.Exists(filePath))
                                {
                                    respList.Add(new DialogueResponse(DialogueResponseType.mapLayerAdded, filePath));
                                }
                            }
                            return respList;
                        }
                    }
                }
            }
            
            // change its own state
            actionNode.ActState = ActionState.Complete;
            // generate response 
            return respList;
        }